From b4ffccad2ba970ca4551f7913b13d7daba73ee38 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 May 2023 11:04:41 +0000 Subject: [PATCH 1/3] deps(dev): bump aegir from 38.1.8 to 39.0.6 Bumps [aegir](https://github.com/ipfs/aegir) from 38.1.8 to 39.0.6. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md) - [Commits](https://github.com/ipfs/aegir/compare/v38.1.8...v39.0.6) --- updated-dependencies: - dependency-name: aegir dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d6c71f8..55b4051 100644 --- a/package.json +++ b/package.json @@ -165,7 +165,7 @@ "devDependencies": { "@libp2p/interface-stream-muxer-compliance-tests": "^7.0.0", "@types/varint": "^6.0.0", - "aegir": "^38.1.7", + "aegir": "^39.0.6", "cborg": "^1.8.1", "delay": "^5.0.0", "eslint-plugin-etc": "^2.0.2", From 2f73277dcba950dab5144f2a03fb01fffee456b2 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 17 May 2023 07:54:47 +0100 Subject: [PATCH 2/3] chore: fix linting --- src/decode.ts | 2 +- src/encode.ts | 8 ++++---- src/index.ts | 2 +- src/mplex.ts | 22 +++++++++++----------- src/stream.ts | 12 ++++++------ test/coder.spec.ts | 6 +++--- test/fixtures/decode.ts | 2 +- test/fixtures/utils.ts | 2 +- test/mplex.spec.ts | 18 +++++++++--------- test/restrict-size.spec.ts | 10 +++++----- test/stream.spec.ts | 14 +++++++------- 11 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/decode.ts b/src/decode.ts index d95f058..2b85cd5 100644 --- a/src/decode.ts +++ b/src/decode.ts @@ -1,5 +1,5 @@ -import { MessageTypeNames, MessageTypes } from './message-types.js' import { Uint8ArrayList } from 'uint8arraylist' +import { MessageTypeNames, MessageTypes } from './message-types.js' import type { Message } from './message-types.js' export const MAX_MSG_SIZE = 1 << 20 // 1MB diff --git a/src/encode.ts b/src/encode.ts index bd79b37..9dc5194 100644 --- a/src/encode.ts +++ b/src/encode.ts @@ -1,9 +1,9 @@ -import type { Source } from 'it-stream-types' -import varint from 'varint' +import batchedBytes from 'it-batched-bytes' import { Uint8ArrayList } from 'uint8arraylist' +import varint from 'varint' import { allocUnsafe } from './alloc-unsafe.js' -import { Message, MessageTypes } from './message-types.js' -import batchedBytes from 'it-batched-bytes' +import { type Message, MessageTypes } from './message-types.js' +import type { Source } from 'it-stream-types' const POOL_SIZE = 10 * 1024 diff --git a/src/index.ts b/src/index.ts index 8a72a21..d78f652 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ -import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer' import { MplexStreamMuxer } from './mplex.js' +import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer' export interface MplexInit { /** diff --git a/src/mplex.ts b/src/mplex.ts index 0ae7b57..7b21671 100644 --- a/src/mplex.ts +++ b/src/mplex.ts @@ -1,18 +1,18 @@ -import { pushableV } from 'it-pushable' +import { CodeError } from '@libp2p/interfaces/errors' +import { logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' -import { encode } from './encode.js' +import { anySignal } from 'any-signal' +import { pushableV } from 'it-pushable' +import { RateLimiterMemory } from 'rate-limiter-flexible' +import { toString as uint8ArrayToString } from 'uint8arrays' import { Decoder } from './decode.js' -import { MessageTypes, MessageTypeNames, Message } from './message-types.js' +import { encode } from './encode.js' +import { MessageTypes, MessageTypeNames, type Message } from './message-types.js' import { createStream } from './stream.js' -import { toString as uint8ArrayToString } from 'uint8arrays' -import { logger } from '@libp2p/logger' -import { CodeError } from '@libp2p/interfaces/errors' -import { RateLimiterMemory } from 'rate-limiter-flexible' -import type { Sink, Source } from 'it-stream-types' -import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface-stream-muxer' -import type { Stream } from '@libp2p/interface-connection' import type { MplexInit } from './index.js' -import { anySignal } from 'any-signal' +import type { Stream } from '@libp2p/interface-connection' +import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface-stream-muxer' +import type { Sink, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' const log = logger('libp2p:mplex') diff --git a/src/stream.ts b/src/stream.ts index 924b0a8..ef03f16 100644 --- a/src/stream.ts +++ b/src/stream.ts @@ -1,16 +1,16 @@ +import { CodeError } from '@libp2p/interfaces/errors' +import { logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' +import { anySignal } from 'any-signal' import { pushable } from 'it-pushable' -import { CodeError } from '@libp2p/interfaces/errors' +import { Uint8ArrayList } from 'uint8arraylist' +import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { MAX_MSG_SIZE } from './decode.js' -import { anySignal } from 'any-signal' import { InitiatorMessageTypes, ReceiverMessageTypes } from './message-types.js' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { Uint8ArrayList } from 'uint8arraylist' -import { logger } from '@libp2p/logger' import type { Message } from './message-types.js' +import type { MplexStream } from './mplex.js' import type { StreamTimeline } from '@libp2p/interface-connection' import type { Source } from 'it-stream-types' -import type { MplexStream } from './mplex.js' const log = logger('libp2p:mplex:stream') diff --git a/test/coder.spec.ts b/test/coder.spec.ts index 10cc713..af0b6cb 100644 --- a/test/coder.spec.ts +++ b/test/coder.spec.ts @@ -2,14 +2,14 @@ /* eslint max-nested-callbacks: ["error", 5] */ import { expect } from 'aegir/chai' +import all from 'it-all' +import { Uint8ArrayList } from 'uint8arraylist' +import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { encode } from '../src/encode.js' import { decode } from './fixtures/decode.js' -import all from 'it-all' -import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { messageWithBytes } from './fixtures/utils.js' import type { Message, NewStreamMessage } from '../src/message-types.js' -import { Uint8ArrayList } from 'uint8arraylist' describe('coder', () => { it('should encode header', async () => { diff --git a/test/fixtures/decode.ts b/test/fixtures/decode.ts index 8b3a1ad..a050d4f 100644 --- a/test/fixtures/decode.ts +++ b/test/fixtures/decode.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ -import type { Message } from '../../src/message-types.js' import { Decoder, MAX_MSG_QUEUE_SIZE, MAX_MSG_SIZE } from '../../src/decode.js' +import type { Message } from '../../src/message-types.js' import type { Source } from 'it-stream-types' export function decode (maxMessageSize: number = MAX_MSG_SIZE, maxUnprocessedMessageQueueSize: number = MAX_MSG_QUEUE_SIZE) { diff --git a/test/fixtures/utils.ts b/test/fixtures/utils.ts index bfab13a..edc3d1e 100644 --- a/test/fixtures/utils.ts +++ b/test/fixtures/utils.ts @@ -1,4 +1,4 @@ -import { Message, MessageTypes } from '../../src/message-types.js' +import { type Message, MessageTypes } from '../../src/message-types.js' export type MessageWithBytes = { [k in keyof Message]: Message[k] diff --git a/test/mplex.spec.ts b/test/mplex.spec.ts index 993f89c..d6e9a63 100644 --- a/test/mplex.spec.ts +++ b/test/mplex.spec.ts @@ -2,18 +2,18 @@ /* eslint max-nested-callbacks: ["error", 5] */ import { expect } from 'aegir/chai' -import { mplex } from '../src/index.js' -import { CloseInitiatorMessage, Message, MessageInitiatorMessage, MessageTypes, NewStreamMessage } from '../src/message-types.js' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { concat as uint8ArrayConcat } from 'uint8arrays/concat' -import { encode } from '../src/encode.js' -import all from 'it-all' -import type { Source } from 'it-stream-types' import delay from 'delay' -import pDefer from 'p-defer' -import { decode } from './fixtures/decode.js' +import all from 'it-all' import { pushable } from 'it-pushable' +import pDefer from 'p-defer' import { Uint8ArrayList } from 'uint8arraylist' +import { concat as uint8ArrayConcat } from 'uint8arrays/concat' +import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { encode } from '../src/encode.js' +import { mplex } from '../src/index.js' +import { type CloseInitiatorMessage, type Message, type MessageInitiatorMessage, MessageTypes, type NewStreamMessage } from '../src/message-types.js' +import { decode } from './fixtures/decode.js' +import type { Source } from 'it-stream-types' describe('mplex', () => { it('should restrict number of initiator streams per connection', async () => { diff --git a/test/restrict-size.spec.ts b/test/restrict-size.spec.ts index fc6637f..ba23704 100644 --- a/test/restrict-size.spec.ts +++ b/test/restrict-size.spec.ts @@ -1,16 +1,16 @@ /* eslint-env mocha */ import { expect } from 'aegir/chai' -import { pipe } from 'it-pipe' import randomBytes from 'iso-random-stream/src/random.js' import all from 'it-all' import drain from 'it-drain' import each from 'it-foreach' -import { Message, MessageTypes } from '../src/message-types.js' +import { pipe } from 'it-pipe' +import toBuffer from 'it-to-buffer' +import { Uint8ArrayList } from 'uint8arraylist' import { encode } from '../src/encode.js' +import { type Message, MessageTypes } from '../src/message-types.js' import { decode } from './fixtures/decode.js' -import { Uint8ArrayList } from 'uint8arraylist' -import toBuffer from 'it-to-buffer' describe('restrict size', () => { it('should throw when size is too big', async () => { @@ -57,7 +57,7 @@ describe('restrict size', () => { input, encode, decode(32), - async (source) => await all(source) + async (source) => all(source) ) expect(output).to.deep.equal(input[0]) }) diff --git a/test/stream.spec.ts b/test/stream.spec.ts index f7d19e9..43ddd5f 100644 --- a/test/stream.spec.ts +++ b/test/stream.spec.ts @@ -1,21 +1,21 @@ /* eslint-env mocha */ import { expect } from 'aegir/chai' -import { pipe } from 'it-pipe' +import * as cborg from 'cborg' import randomBytes from 'iso-random-stream/src/random.js' -import randomInt from 'random-int' -import each from 'it-foreach' import drain from 'it-drain' +import each from 'it-foreach' import map from 'it-map' +import { pipe } from 'it-pipe' import defer from 'p-defer' -import * as cborg from 'cborg' -import { createStream } from '../src/stream.js' -import { MessageTypes, MessageTypeNames } from '../src/message-types.js' +import randomInt from 'random-int' +import { Uint8ArrayList } from 'uint8arraylist' import { fromString as uint8ArrayFromString } from 'uint8arrays' +import { MessageTypes, MessageTypeNames } from '../src/message-types.js' +import { createStream } from '../src/stream.js' import { messageWithBytes } from './fixtures/utils.js' import type { Message } from '../src/message-types.js' import type { MplexStream } from '../src/mplex.js' -import { Uint8ArrayList } from 'uint8arraylist' function randomInput (min = 1, max = 100): Uint8ArrayList[] { return Array.from(Array(randomInt(min, max)), () => new Uint8ArrayList(randomBytes(randomInt(1, 128)))) From 7b0bb46048cb772b276e9a882d4b848e46b73724 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 17 May 2023 08:10:34 +0100 Subject: [PATCH 3/3] chore: update aegir --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 55b4051..c69a7e7 100644 --- a/package.json +++ b/package.json @@ -165,7 +165,7 @@ "devDependencies": { "@libp2p/interface-stream-muxer-compliance-tests": "^7.0.0", "@types/varint": "^6.0.0", - "aegir": "^39.0.6", + "aegir": "^39.0.7", "cborg": "^1.8.1", "delay": "^5.0.0", "eslint-plugin-etc": "^2.0.2",