Skip to content

Commit

Permalink
fix: reduce bundle size (libp2p#292)
Browse files Browse the repository at this point in the history
* fix: reduce bundle size

* fix: use bignumber everywhere

* chore: update deps
  • Loading branch information
hugomrdias authored and jacobheun committed Jan 11, 2019
1 parent b3a6a74 commit 76e5d1d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
28 changes: 13 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,39 @@
"npm": ">=3.0.0"
},
"devDependencies": {
"aegir": "^17.1.1",
"aegir": "^18.0.3",
"chai": "^4.2.0",
"chai-checkmark": "^1.0.1",
"dirty-chai": "^2.0.1",
"libp2p-mplex": "~0.8.4",
"libp2p-pnet": "~0.1.0",
"libp2p-secio": "~0.10.1",
"libp2p-secio": "~0.11.0",
"libp2p-spdy": "~0.13.1",
"libp2p-tcp": "~0.13.0",
"libp2p-webrtc-star": "~0.15.6",
"libp2p-websockets": "~0.12.0",
"peer-book": "~0.9.0",
"libp2p-webrtc-star": "~0.15.8",
"libp2p-websockets": "~0.12.1",
"peer-book": "~0.9.1",
"portfinder": "^1.0.20",
"sinon": "^7.2.0",
"webrtcsupport": "^2.2.0"
},
"dependencies": {
"async": "^2.6.1",
"big.js": "^5.2.2",
"bignumber.js": "^8.0.1",
"class-is": "^1.1.0",
"debug": "^4.1.0",
"debug": "^4.1.1",
"err-code": "^1.1.2",
"fsm-event": "^2.1.0",
"hashlru": "^2.3.0",
"interface-connection": "~0.3.3",
"ip-address": "^5.8.9",
"libp2p-circuit": "~0.3.1",
"libp2p-identify": "~0.7.2",
"lodash.includes": "^4.3.0",
"libp2p-circuit": "~0.3.4",
"libp2p-identify": "~0.7.5",
"moving-average": "^1.0.0",
"multiaddr": "^6.0.0",
"multistream-select": "~0.14.3",
"multiaddr": "^6.0.3",
"multistream-select": "~0.14.4",
"once": "^1.4.0",
"peer-id": "~0.12.0",
"peer-info": "~0.15.0",
"peer-id": "~0.12.2",
"peer-info": "~0.15.1",
"pull-stream": "^3.6.9",
"retimer": "^2.0.0"
},
Expand Down
5 changes: 3 additions & 2 deletions src/limit-dialer/queue.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict'

const Connection = require('interface-connection').Connection
const pull = require('pull-stream')
const pull = require('pull-stream/pull')
const empty = require('pull-stream/sources/empty')
const timeout = require('async/timeout')
const queue = require('async/queue')
const debug = require('debug')
Expand Down Expand Up @@ -50,7 +51,7 @@ class DialQueue {
if (token.cancel) {
log(`${transport.constructor.name}:work:cancel`)
// clean up already done dials
pull(pull.empty(), conn)
pull(empty(), conn)
// If we can close the connection, do it
if (typeof conn.close === 'function') {
return conn.close((_) => callback(null, { cancel: true }))
Expand Down
2 changes: 1 addition & 1 deletion src/observe-connection.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const Connection = require('interface-connection').Connection
const pull = require('pull-stream')
const pull = require('pull-stream/pull')

/**
* Creates a pull stream to run the given Connection stream through
Expand Down
4 changes: 2 additions & 2 deletions src/observer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const pull = require('pull-stream')
const map = require('pull-stream/throughs/map')
const EventEmitter = require('events')

/**
Expand Down Expand Up @@ -30,7 +30,7 @@ module.exports = (swtch) => {

function observe (direction) {
return (transport, protocol, peerInfo) => {
return pull.map((buffer) => {
return map((buffer) => {
willObserve(peerInfo, transport, protocol, direction, buffer.length)
return buffer
})
Expand Down
2 changes: 1 addition & 1 deletion src/stats/stat.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const EventEmitter = require('events')
const Big = require('big.js').Big
const Big = require('bignumber.js')
const MovingAverage = require('moving-average')
const retimer = require('retimer')

Expand Down

0 comments on commit 76e5d1d

Please sign in to comment.