Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
chore: update deps (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Apr 16, 2021
1 parent 0aeae8b commit df51b54
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 43 deletions.
14 changes: 3 additions & 11 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
'use strict'

/** @type {import('aegir').PartialOptions} */
module.exports = {
webpack: {
node: {
// needed by random-bytes
crypto: true,

// needed by cipher-base
stream: true,

// needed by core-util-is
Buffer: true
}
build: {
bundlesizeMax: '17KB'
}
}
25 changes: 14 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
language: node_js
cache: npm
stages:
- check
- test
- cov
cache: false
dist: bionic

branches:
only:
- master
- /^release\/.*$/

node_js:
- '10'
- 'lts/*'
- 'node'

stages:
- check

os:
- linux
- osx
- windows

script: npx nyc -s npm run test:node -- --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov

jobs:
include:
- os: windows
cache: false

- stage: check
script:
- npx aegir commitlint --travis
- npx aegir dep-check
- npm run lint

Expand All @@ -36,7 +39,7 @@ jobs:
name: firefox
addons:
firefox: latest
script: npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless
script: npx aegir test -t browser -t webworker -- --browser firefox

notifications:
email: false
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"src"
],
"browser": {
"./src/coder/encode.js": "./src/coder/encode.browser.js"
"./src/coder/encode.js": "./src/coder/encode.browser.js",
"libp2p-tcp": false
},
"scripts": {
"lint": "aegir lint",
Expand Down Expand Up @@ -42,20 +43,21 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-mplex#readme",
"devDependencies": {
"aegir": "^30.3.0",
"libp2p-interfaces": "^0.8.3",
"aegir": "^33.1.0",
"cborg": "^1.2.1",
"iso-random-stream": "^2.0.0",
"libp2p-interfaces": "^0.10.0",
"p-defer": "^3.0.0",
"random-bytes": "^1.0.0",
"random-int": "^2.0.0",
"streaming-iterables": "^5.0.4",
"uint8arrays": "^2.0.5"
},
"dependencies": {
"abort-controller": "^3.0.0",
"abortable-iterator": "^3.0.0",
"bl": "^4.0.0",
"bl": "^5.0.0",
"debug": "^4.3.1",
"err-code": "^2.0.3",
"err-code": "^3.0.1",
"it-pipe": "^1.1.0",
"it-pushable": "^1.4.1",
"varint": "^6.0.0"
Expand Down
2 changes: 1 addition & 1 deletion test/restrict-size.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const { expect } = require('aegir/utils/chai')
const pipe = require('it-pipe')
const randomBytes = require('random-bytes')
const { randomBytes } = require('iso-random-stream')
const { tap, consume, collect } = require('streaming-iterables')

const restrictSize = require('../src/restrict-size')
Expand Down
23 changes: 9 additions & 14 deletions test/stream.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

const { expect } = require('aegir/utils/chai')
const pipe = require('it-pipe')
const randomBytes = require('random-bytes')
const { randomBytes } = require('iso-random-stream')
const randomInt = require('random-int')
const { tap, take, collect, consume, map } = require('streaming-iterables')
const defer = require('p-defer')
const uint8ArrayFromString = require('uint8arrays/from-string')
const uint8ArrayToString = require('uint8arrays/to-string')
const uint8ArrayConcat = require('uint8arrays/concat')
const cborg = require('cborg')

const createStream = require('../src/stream')
const { MessageTypes, MessageTypeNames } = require('../src/message-types')
Expand All @@ -30,16 +29,8 @@ const infiniteRandom = {
}
}

const msgToBuffer = msg => uint8ArrayFromString(JSON.stringify(msg))

const bufferToMessage = buf => {
const msg = JSON.parse(uint8ArrayToString(buf))
// JSON.stringify(Buffer) encodes as {"type":"Buffer","data":[1,2,3]}
if (msg.data && msg.data.type === 'Buffer') {
msg.data = new Uint8Array(msg.data.data)
}
return msg
}
const msgToBuffer = msg => cborg.encode(msg)
const bufferToMessage = buf => cborg.decode(buf)

describe('stream', () => {
it('should initiate stream with NEW_STREAM message', async () => {
Expand Down Expand Up @@ -320,13 +311,17 @@ describe('stream', () => {
await pipe(
input,
tap(msg => generatedMsgs.push(msg)),
tap(() => { if (i++ >= maxMsgs) initiator.abort(error) }),
initiator,
tap(msg => {
if (msg.data) {
msg.data = bufferToMessage(msg.data)
}

msgs.push(msg)

if (i++ >= maxMsgs) {
initiator.abort(error)
}
}),
consume
)
Expand Down

0 comments on commit df51b54

Please sign in to comment.