diff --git a/.gitignore b/.gitignore index 3d255fa..7ad9e67 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,9 @@ -# Coverage directory used by tools like istanbul -.nyc_output - +node_modules build dist -docs - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git +.docs +.coverage node_modules -# Lock files package-lock.json yarn.lock -.clinic -coverage +.vscode diff --git a/package.json b/package.json index d5be1af..1137aee 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,6 @@ "interface", "libp2p" ], - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - }, "private": true, "scripts": { "reset": "aegir run clean && aegir clean ./node_modules ./package-lock.json packages/*/node_modules packages/*/package-lock.json packages/*/dist", @@ -37,7 +33,7 @@ "release": "aegir run release" }, "dependencies": { - "aegir": "^38.0.0" + "aegir": "^39.0.13" }, "workspaces": [ "packages/*" diff --git a/packages/protons-benchmark/package.json b/packages/protons-benchmark/package.json index 167cd2e..cfe2302 100644 --- a/packages/protons-benchmark/package.json +++ b/packages/protons-benchmark/package.json @@ -11,28 +11,8 @@ "bugs": { "url": "https://github.com/ipfs/protons/issues" }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - }, "type": "module", "types": "./dist/src/index.d.ts", - "typesVersions": { - "*": { - "*": [ - "*", - "dist/*", - "dist/src/*", - "dist/src/*/index" - ], - "src/*": [ - "*", - "dist/*", - "dist/src/*", - "dist/src/*/index" - ] - } - }, "files": [ "src", "dist", @@ -43,10 +23,6 @@ ".": { "types": "./dist/src/index.d.ts", "import": "./dist/src/index.js" - }, - "./status": { - "types": "./dist/src/status.d.ts", - "import": "./dist/src/status.js" } }, "eslintConfig": { @@ -73,7 +49,7 @@ "@protobuf-ts/plugin": "^2.8.1", "@protobuf-ts/runtime": "^2.8.1", "@types/benchmark": "^2.1.1", - "aegir": "^38.0.0", + "aegir": "^39.0.13", "benchmark": "^2.1.4", "pbjs": "^0.0.14", "protobufjs": "^7.0.0", diff --git a/packages/protons-benchmark/src/decode.ts b/packages/protons-benchmark/src/decode.ts index cdd798d..1506b7b 100644 --- a/packages/protons-benchmark/src/decode.ts +++ b/packages/protons-benchmark/src/decode.ts @@ -6,7 +6,6 @@ $ npx playwright-test dist/src/index.js --runner benchmark */ import Benchmark from 'benchmark' - import { decodeTest as pbjsDecodeTest } from './pbjs/bench.js' import { Test as ProtobufjsTest } from './protobufjs/bench.js' import { Test as ProtonsTest } from './protons/bench.js' diff --git a/packages/protons-benchmark/src/encode.ts b/packages/protons-benchmark/src/encode.ts index 119a01a..6218836 100644 --- a/packages/protons-benchmark/src/encode.ts +++ b/packages/protons-benchmark/src/encode.ts @@ -6,7 +6,6 @@ $ npx playwright-test dist/src/index.js --runner benchmark */ import Benchmark from 'benchmark' - import { encodeTest as pbjsEncodeTest } from './pbjs/bench.js' import { Test as ProtobufjsTest } from './protobufjs/bench.js' import { Test as ProtonsTest } from './protons/bench.js' diff --git a/packages/protons-benchmark/src/index.ts b/packages/protons-benchmark/src/index.ts index 760d892..540fd9e 100644 --- a/packages/protons-benchmark/src/index.ts +++ b/packages/protons-benchmark/src/index.ts @@ -6,9 +6,7 @@ $ npx playwright-test dist/src/index.js --runner benchmark */ import { expect } from 'aegir/chai' - import Benchmark from 'benchmark' - import { encodeTest as pbjsEncodeTest, decodeTest as pbjsDecodeTest } from './pbjs/bench.js' import { Test as ProtobufTsTest } from './protobuf-ts/bench.js' import { Test as ProtobufjsTest } from './protobufjs/bench.js' diff --git a/packages/protons-benchmark/src/rpc.ts b/packages/protons-benchmark/src/rpc.ts index fa9dc5e..c5af0f3 100644 --- a/packages/protons-benchmark/src/rpc.ts +++ b/packages/protons-benchmark/src/rpc.ts @@ -5,10 +5,8 @@ $ node dist/src/index.js $ npx playwright-test dist/src/index.js --runner benchmark */ -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' - import Benchmark from 'benchmark' - +import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { RPC as ProtobufjsRPC } from './protobufjs/rpc.js' import { RPC as ProtonsRPC } from './protons/rpc.js' diff --git a/packages/protons-runtime/package.json b/packages/protons-runtime/package.json index 16513bd..449eb6c 100644 --- a/packages/protons-runtime/package.json +++ b/packages/protons-runtime/package.json @@ -11,28 +11,8 @@ "bugs": { "url": "https://github.com/ipfs/protons/issues" }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - }, "type": "module", "types": "./dist/src/index.d.ts", - "typesVersions": { - "*": { - "*": [ - "*", - "dist/*", - "dist/src/*", - "dist/src/*/index" - ], - "src/*": [ - "*", - "dist/*", - "dist/src/*", - "dist/src/*/index" - ] - } - }, "files": [ "src", "dist", @@ -43,10 +23,6 @@ ".": { "types": "./dist/src/index.d.ts", "import": "./dist/src/index.js" - }, - "./status": { - "types": "./dist/src/status.d.ts", - "import": "./dist/src/status.js" } }, "eslintConfig": { @@ -152,7 +128,7 @@ "uint8arraylist": "^2.4.3" }, "devDependencies": { - "aegir": "^38.0.0" + "aegir": "^39.0.13" }, "peerDependencies": { "uint8arraylist": "^2.3.2" diff --git a/packages/protons-runtime/src/codecs/message.ts b/packages/protons-runtime/src/codecs/message.ts index eca5171..a96f8e7 100644 --- a/packages/protons-runtime/src/codecs/message.ts +++ b/packages/protons-runtime/src/codecs/message.ts @@ -1,5 +1,4 @@ -import { createCodec, CODEC_TYPES, EncodeOptions } from '../codec.js' -import type { Codec } from '../codec.js' +import { createCodec, CODEC_TYPES, type EncodeOptions, type Codec } from '../codec.js' import type { Reader, Writer } from '../index.js' export interface Factory { diff --git a/packages/protons-runtime/src/decode.ts b/packages/protons-runtime/src/decode.ts index bd395ac..aa80e88 100644 --- a/packages/protons-runtime/src/decode.ts +++ b/packages/protons-runtime/src/decode.ts @@ -1,7 +1,6 @@ -import type { Uint8ArrayList } from 'uint8arraylist' - -import type { Codec } from './codec.js' import { reader } from './utils.js' +import type { Codec } from './codec.js' +import type { Uint8ArrayList } from 'uint8arraylist' export function decodeMessage (buf: Uint8Array | Uint8ArrayList, codec: Codec): T { const r = reader(buf instanceof Uint8Array ? buf : buf.subarray()) diff --git a/packages/protons-runtime/src/encode.ts b/packages/protons-runtime/src/encode.ts index 7a8b8b5..3a6822e 100644 --- a/packages/protons-runtime/src/encode.ts +++ b/packages/protons-runtime/src/encode.ts @@ -1,5 +1,5 @@ -import type { Codec } from './codec.js' import { writer } from './utils.js' +import type { Codec } from './codec.js' export function encodeMessage (message: T, codec: Codec): Uint8Array { const w = writer() diff --git a/packages/protons-runtime/src/utils.ts b/packages/protons-runtime/src/utils.ts index d125d64..7a746c6 100644 --- a/packages/protons-runtime/src/utils.ts +++ b/packages/protons-runtime/src/utils.ts @@ -8,7 +8,6 @@ import util from 'protobufjs/src/util/minimal.js' import WriterClass from 'protobufjs/src/writer.js' // @ts-expect-error no types import WriterBufferClass from 'protobufjs/src/writer_buffer.js' - import type { Reader, Writer } from './index.js' function configure (): void { diff --git a/packages/protons/bin/protons.ts b/packages/protons/bin/protons.ts index 55e6615..23ceee2 100644 --- a/packages/protons/bin/protons.ts +++ b/packages/protons/bin/protons.ts @@ -1,7 +1,6 @@ #! /usr/bin/env node import meow from 'meow' - import { generate } from '../src/index.js' async function main (): Promise { diff --git a/packages/protons/package.json b/packages/protons/package.json index ebb0a4b..1cc8a15 100644 --- a/packages/protons/package.json +++ b/packages/protons/package.json @@ -11,31 +11,11 @@ "bugs": { "url": "https://github.com/ipfs/protons/issues" }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - }, "bin": { "protons": "./dist/bin/protons.js" }, "type": "module", "types": "./dist/src/index.d.ts", - "typesVersions": { - "*": { - "*": [ - "*", - "dist/*", - "dist/src/*", - "dist/src/*/index" - ], - "src/*": [ - "*", - "dist/*", - "dist/src/*", - "dist/src/*/index" - ] - } - }, "files": [ "src", "dist", @@ -46,10 +26,6 @@ ".": { "types": "./dist/src/index.d.ts", "import": "./dist/src/index.js" - }, - "./status": { - "types": "./dist/src/status.d.ts", - "import": "./dist/src/status.js" } }, "eslintConfig": { @@ -157,7 +133,7 @@ "protobufjs-cli": "^1.0.0" }, "devDependencies": { - "aegir": "^38.0.0", + "aegir": "^39.0.13", "long": "^5.2.0", "pbjs": "^0.0.14", "protobufjs": "^7.0.0", diff --git a/packages/protons/src/index.ts b/packages/protons/src/index.ts index ecb5481..e64c3ba 100644 --- a/packages/protons/src/index.ts +++ b/packages/protons/src/index.ts @@ -3,7 +3,6 @@ import fs from 'fs/promises' import path from 'path' import { promisify } from 'util' - import { main as pbjs } from 'protobufjs-cli/pbjs.js' export enum CODEC_TYPES { diff --git a/packages/protons/test/compatibility.spec.ts b/packages/protons/test/compatibility.spec.ts index de7e36c..0eb68e9 100644 --- a/packages/protons/test/compatibility.spec.ts +++ b/packages/protons/test/compatibility.spec.ts @@ -1,20 +1,17 @@ /* eslint-env mocha */ import fs from 'fs' - import { expect } from 'aegir/chai' - import Long from 'long' import pbjs from 'pbjs' -import protobufjs, { Type as PBType } from 'protobufjs' - +import protobufjs, { type Type as PBType } from 'protobufjs' import { Basic, Empty } from './fixtures/basic.js' +import { Message as Bitswap } from './fixtures/bitswap.js' import { CircuitRelay } from './fixtures/circuit.js' import { Optional, OptionalEnum } from './fixtures/optional.js' import { Peer } from './fixtures/peer.js' import { Singular, SingularEnum } from './fixtures/singular.js' import { AllTheTypes, AnEnum } from './fixtures/test.js' -import { Message as Bitswap } from './fixtures/bitswap.js' function longifyBigInts (obj: any): any { const output = { @@ -280,7 +277,7 @@ describe('encode', () => { } const root = protobufjs.loadSync('./test/fixtures/circuit.proto') - // @ts-expect-error + // @ts-expect-error root.nested is possibly undefined const PbCircuitRelay = root.nested.CircuitRelay as PBType const protobufJsBuf = PbCircuitRelay.encode(PbCircuitRelay.fromObject(message)).finish() diff --git a/packages/protons/test/maps.spec.ts b/packages/protons/test/maps.spec.ts index c73eb77..b8c1181 100644 --- a/packages/protons/test/maps.spec.ts +++ b/packages/protons/test/maps.spec.ts @@ -1,11 +1,9 @@ /* eslint-env mocha */ import { expect } from 'aegir/chai' - import Long from 'long' import protobufjs from 'protobufjs' - -import { MapTypes, SubMessage } from './fixtures/maps.js' +import { MapTypes, type SubMessage } from './fixtures/maps.js' function longifyBigInts (obj: any): any { const output = { diff --git a/packages/protons/test/unsupported.spec.ts b/packages/protons/test/unsupported.spec.ts index 216198e..7f29154 100644 --- a/packages/protons/test/unsupported.spec.ts +++ b/packages/protons/test/unsupported.spec.ts @@ -1,7 +1,6 @@ /* eslint-env mocha */ import { expect } from 'aegir/chai' - import { generate } from '../src/index.js' describe('unsupported', () => {