Skip to content

Commit

Permalink
deps: upgrade deps (#52)
Browse files Browse the repository at this point in the history
* deps: upgraded deps

* chore: linting fixes
  • Loading branch information
maschad authored May 17, 2023
1 parent 684de7c commit d00570c
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 56 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,22 @@
"docs": "aegir docs"
},
"dependencies": {
"@libp2p/interface-connection": "^5.0.0",
"@libp2p/interface-stream-muxer": "^4.0.0",
"@libp2p/interfaces": "^3.2.0",
"@libp2p/logger": "^2.0.1",
"abortable-iterator": "^4.0.2",
"@libp2p/interface-connection": "^5.1.0",
"@libp2p/interface-stream-muxer": "^4.1.2",
"@libp2p/interfaces": "^3.3.2",
"@libp2p/logger": "^2.0.7",
"abortable-iterator": "^5.0.1",
"any-signal": "^4.1.1",
"it-pipe": "^3.0.1",
"it-pushable": "^3.1.3",
"uint8arraylist": "^2.3.2"
"uint8arraylist": "^2.4.3"
},
"devDependencies": {
"@dapplion/benchmark": "^0.2.2",
"@libp2p/interface-stream-muxer-compliance-tests": "^7.0.0",
"@libp2p/mplex": "^8.0.0",
"aegir": "^38.1.0",
"it-drain": "^3.0.1",
"@dapplion/benchmark": "^0.2.4",
"@libp2p/interface-stream-muxer-compliance-tests": "^7.0.3",
"@libp2p/mplex": "^8.0.3",
"aegir": "^39.0.7",
"it-drain": "^3.0.2",
"it-pair": "^2.0.6",
"it-stream-types": "^2.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger, Logger } from '@libp2p/logger'
import { CodeError } from '@libp2p/interfaces/errors'
import { logger, type Logger } from '@libp2p/logger'
import { ERR_INVALID_CONFIG, INITIAL_STREAM_WINDOW, MAX_STREAM_WINDOW } from './constants.js'

// TOOD use config items or delete them
Expand Down
4 changes: 2 additions & 2 deletions src/decode.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Uint8ArrayList } from 'uint8arraylist'
import { CodeError } from '@libp2p/interfaces/errors'
import { FrameHeader, FrameType, HEADER_LENGTH, YAMUX_VERSION } from './frame.js'
import { Uint8ArrayList } from 'uint8arraylist'
import { ERR_DECODE_INVALID_VERSION, ERR_DECODE_IN_PROGRESS } from './constants.js'
import { type FrameHeader, FrameType, HEADER_LENGTH, YAMUX_VERSION } from './frame.js'
import type { Source } from 'it-stream-types'

// used to bitshift in decoding
Expand Down
3 changes: 2 additions & 1 deletion src/encode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FrameHeader, HEADER_LENGTH } from './frame.js'
import { HEADER_LENGTH } from './frame.js'
import type { FrameHeader } from './frame.js'

export function encodeHeader (header: FrameHeader): Uint8Array {
const frame = new Uint8Array(HEADER_LENGTH)
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer'
import { Yamux } from './muxer.js'
import type { YamuxMuxerInit } from './muxer.js'
import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer'
export { GoAwayCode } from './frame.js'

export function yamux (init: YamuxMuxerInit = {}): () => StreamMuxerFactory {
Expand Down
20 changes: 10 additions & 10 deletions src/muxer.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { Stream } from '@libp2p/interface-connection'
import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer'
import { CodeError } from '@libp2p/interfaces/errors'
import { abortableSource } from 'abortable-iterator'
import { anySignal, type ClearableSignal } from 'any-signal'
import { pipe } from 'it-pipe'
import type { Sink, Source } from 'it-stream-types'
import { pushable, Pushable } from 'it-pushable'
import { CodeError } from '@libp2p/interfaces/errors'
import { anySignal, ClearableSignal } from 'any-signal'
import { Flag, FrameHeader, FrameType, GoAwayCode, stringifyHeader } from './frame.js'
import { StreamState, YamuxStream } from './stream.js'
import { encodeHeader } from './encode.js'
import { pushable, type Pushable } from 'it-pushable'
import { type Config, defaultConfig, verifyConfig } from './config.js'
import { ERR_BOTH_CLIENTS, ERR_INVALID_FRAME, ERR_MAX_OUTBOUND_STREAMS_EXCEEDED, ERR_MUXER_LOCAL_CLOSED, ERR_MUXER_REMOTE_CLOSED, ERR_NOT_MATCHING_PING, ERR_STREAM_ALREADY_EXISTS, ERR_UNREQUESTED_PING, PROTOCOL_ERRORS } from './constants.js'
import { Config, defaultConfig, verifyConfig } from './config.js'
import { Decoder } from './decode.js'
import { encodeHeader } from './encode.js'
import { Flag, type FrameHeader, FrameType, GoAwayCode, stringifyHeader } from './frame.js'
import { StreamState, YamuxStream } from './stream.js'
import type { Stream } from '@libp2p/interface-connection'
import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer'
import type { Logger } from '@libp2p/logger'
import type { Sink, Source } from 'it-stream-types'
import type { Uint8ArrayList } from 'uint8arraylist'

const YAMUX_PROTOCOL_ID = '/yamux/1.0.0'
Expand Down
12 changes: 6 additions & 6 deletions src/stream.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { Stream, StreamStat } from '@libp2p/interface-connection'
import { pushable, Pushable } from 'it-pushable'
import type { Sink, Source } from 'it-stream-types'
import { CodeError } from '@libp2p/interfaces/errors'
import { abortableSource } from 'abortable-iterator'
import type { Uint8ArrayList } from 'uint8arraylist'
import { Flag, FrameHeader, FrameType, HEADER_LENGTH } from './frame.js'
import { pushable, type Pushable } from 'it-pushable'
import { ERR_RECV_WINDOW_EXCEEDED, ERR_STREAM_ABORT, ERR_STREAM_RESET, INITIAL_STREAM_WINDOW } from './constants.js'
import type { Logger } from '@libp2p/logger'
import { Flag, type FrameHeader, FrameType, HEADER_LENGTH } from './frame.js'
import type { Config } from './config.js'
import type { Stream, StreamStat } from '@libp2p/interface-connection'
import type { Logger } from '@libp2p/logger'
import type { Sink, Source } from 'it-stream-types'
import type { Uint8ArrayList } from 'uint8arraylist'

export enum StreamState {
Init,
Expand Down
4 changes: 2 additions & 2 deletions test/bench/codec.bench.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { itBench } from '@dapplion/benchmark'
import { Flag, FrameHeader, FrameType } from '../../src/frame.js'
import { encodeHeader } from '../../src/encode.js'
import { decodeHeader } from '../../src/decode.js'
import { encodeHeader } from '../../src/encode.js'
import { Flag, type FrameHeader, FrameType } from '../../src/frame.js'
import { decodeHeaderNaive, encodeHeaderNaive } from '../codec.util.js'

describe('codec benchmark', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/bench/comparison.bench.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { itBench } from '@dapplion/benchmark'
import drain from 'it-drain'
import { pipe } from 'it-pipe'
import { testClientServer as testYamuxClientServer } from '../util.js'
import { testClientServer as testMplexClientServer } from '../mplex.util.js'
import { testClientServer as testYamuxClientServer } from '../util.js'

describe('comparison benchmark', () => {
for (const { impl, name } of [
Expand Down
3 changes: 1 addition & 2 deletions test/codec.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { expect } from 'aegir/chai'

import { decodeHeader } from '../src/decode.js'
import { encodeHeader } from '../src/encode.js'
import { Flag, FrameHeader, FrameType, GoAwayCode, stringifyHeader } from '../src/frame.js'
import { Flag, type FrameHeader, FrameType, GoAwayCode, stringifyHeader } from '../src/frame.js'
import { decodeHeaderNaive, encodeHeaderNaive } from './codec.util.js'

const frames: Array<{ header: FrameHeader, data?: Uint8Array }> = [
Expand Down
2 changes: 1 addition & 1 deletion test/codec.util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { ERR_DECODE_INVALID_VERSION } from '../src/constants.js'
import { FrameHeader, HEADER_LENGTH, YAMUX_VERSION } from '../src/frame.js'
import { type FrameHeader, HEADER_LENGTH, YAMUX_VERSION } from '../src/frame.js'

// Slower encode / decode functions that use dataview

Expand Down
7 changes: 3 additions & 4 deletions test/decode.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable @typescript-eslint/dot-notation */
import { Pushable, pushable } from 'it-pushable'
import { expect } from 'aegir/chai'

import { type Pushable, pushable } from 'it-pushable'
import { ERR_DECODE_IN_PROGRESS } from '../src/constants.js'
import { Decoder } from '../src/decode.js'
import { encodeHeader } from '../src/encode.js'
import { Flag, FrameHeader, FrameType, GoAwayCode } from '../src/frame.js'
import { Flag, type FrameHeader, FrameType, GoAwayCode } from '../src/frame.js'
import { timeout } from './util.js'
import { ERR_DECODE_IN_PROGRESS } from '../src/constants.js'
import type { Uint8ArrayList } from 'uint8arraylist'

const frames: Array<{ header: FrameHeader, data?: Uint8Array }> = [
Expand Down
8 changes: 4 additions & 4 deletions test/mplex.util.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Source, Transform } from 'it-stream-types'
import { mplex } from '@libp2p/mplex'
import { duplexPair } from 'it-pair/duplex'
import { pipe } from 'it-pipe'
import { mplex } from '@libp2p/mplex'
import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface-stream-muxer'
import type { Source, Transform } from 'it-stream-types'

const factory = mplex()()

Expand Down Expand Up @@ -82,9 +82,9 @@ export function testClientServer (conf: StreamMuxerInit = {}): {
}

export async function timeout (ms: number): Promise<unknown> {
return await new Promise((_resolve, reject) => setTimeout(() => { reject(new Error(`timeout after ${ms}ms`)) }, ms))
return new Promise((_resolve, reject) => setTimeout(() => { reject(new Error(`timeout after ${ms}ms`)) }, ms))
}

export async function sleep (ms: number): Promise<unknown> {
return await new Promise(resolve => setTimeout(() => { resolve(ms) }, ms))
return new Promise(resolve => setTimeout(() => { resolve(ms) }, ms))
}
4 changes: 2 additions & 2 deletions test/muxer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env mocha */

import { expect } from 'aegir/chai'
import { duplexPair } from 'it-pair/duplex'
import { pipe } from 'it-pipe'
import { expect } from 'aegir/chai'
import { sleep, testClientServer, testYamuxMuxer } from './util.js'
import { ERR_MUXER_LOCAL_CLOSED } from '../src/constants.js'
import { sleep, testClientServer, testYamuxMuxer } from './util.js'

describe('muxer', () => {
it('test repeated close', async () => {
Expand Down
8 changes: 4 additions & 4 deletions test/stream.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-env mocha */

import { pipe } from 'it-pipe'
import { expect } from 'aegir/chai'
import { sleep, testClientServer } from './util.js'
import { HalfStreamState, StreamState } from '../src/stream.js'
import { Pushable, pushable } from 'it-pushable'
import { pipe } from 'it-pipe'
import { type Pushable, pushable } from 'it-pushable'
import { defaultConfig } from '../src/config.js'
import { ERR_STREAM_RESET } from '../src/constants.js'
import { GoAwayCode } from '../src/frame.js'
import { HalfStreamState, StreamState } from '../src/stream.js'
import { sleep, testClientServer } from './util.js'

describe('stream', () => {
it('test send data - small', async () => {
Expand Down
8 changes: 4 additions & 4 deletions test/util.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { logger } from '@libp2p/logger'
import type { Source, Transform } from 'it-stream-types'
import { duplexPair } from 'it-pair/duplex'
import { pipe } from 'it-pipe'
import { Yamux, YamuxMuxer, type YamuxMuxerInit } from '../src/muxer.js'
import type { Config } from '../src/config.js'
import { Yamux, YamuxMuxer, YamuxMuxerInit } from '../src/muxer.js'
import type { Source, Transform } from 'it-stream-types'

const isClient = (() => {
let client = false
Expand Down Expand Up @@ -110,9 +110,9 @@ export function testClientServer (conf: YamuxMuxerInit = {}): {
}

export async function timeout (ms: number): Promise<unknown> {
return await new Promise((_resolve, reject) => setTimeout(() => { reject(new Error(`timeout after ${ms}ms`)) }, ms))
return new Promise((_resolve, reject) => setTimeout(() => { reject(new Error(`timeout after ${ms}ms`)) }, ms))
}

export async function sleep (ms: number): Promise<unknown> {
return await new Promise(resolve => setTimeout(() => { resolve(ms) }, ms))
return new Promise(resolve => setTimeout(() => { resolve(ms) }, ms))
}

0 comments on commit d00570c

Please sign in to comment.