Skip to content

Commit 3ff955e

Browse files
hugomrdiasvasco-santos
authored andcommitted
fix: reduce bundle size (#67)
* fix: reduce bundle size
1 parent 355ab30 commit 3ff955e

File tree

4 files changed

+14
-49
lines changed

4 files changed

+14
-49
lines changed

.npmignore

-34
This file was deleted.

gulpfile.js

-5
This file was deleted.

package.json

+10-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"coverage": "aegir coverage",
1818
"coverage-publish": "aegir coverage --provider coveralls"
1919
},
20+
"files": [
21+
"src",
22+
"dist"
23+
],
2024
"pre-push": [
2125
"lint"
2226
],
@@ -38,25 +42,25 @@
3842
},
3943
"homepage": "https://github.com/libp2p/js-libp2p-floodsub#readme",
4044
"devDependencies": {
41-
"aegir": "^18.0.2",
45+
"aegir": "^18.0.3",
4246
"benchmark": "^2.1.4",
4347
"chai": "^4.2.0",
4448
"chai-spies": "^1.0.0",
4549
"dirty-chai": "^2.0.1",
46-
"libp2p": "~0.24.3",
50+
"libp2p": "~0.24.4",
4751
"libp2p-secio": "~0.11.0",
4852
"libp2p-spdy": "~0.13.1",
4953
"libp2p-tcp": "~0.13.0",
50-
"peer-id": "~0.12.1",
51-
"peer-info": "~0.15.0"
54+
"lodash": "^4.17.11",
55+
"peer-id": "~0.12.2",
56+
"peer-info": "~0.15.1"
5257
},
5358
"dependencies": {
5459
"async": "^2.6.1",
5560
"bs58": "^4.0.1",
5661
"debug": "^4.1.1",
5762
"length-prefixed-stream": "^1.6.0",
58-
"libp2p-crypto": "~0.15.0",
59-
"lodash": "^4.17.11",
63+
"libp2p-crypto": "~0.16.0",
6064
"protons": "^1.0.1",
6165
"pull-pushable": "^2.2.0",
6266
"time-cache": "~0.3.0"

src/base.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict'
22

33
const EventEmitter = require('events')
4-
const values = require('lodash/values')
5-
const pull = require('pull-stream')
4+
const pull = require('pull-stream/pull')
5+
const empty = require('pull-stream/sources/empty')
66
const asyncEach = require('async/each')
77
const debug = require('debug')
88

@@ -136,7 +136,7 @@ class BaseProtocol extends EventEmitter {
136136
conn.getPeerInfo((err, peerInfo) => {
137137
if (err) {
138138
this.log.err('Failed to identify incomming conn', err)
139-
return pull(pull.empty(), conn)
139+
return pull(empty(), conn)
140140
}
141141

142142
const idB58Str = peerInfo.id.toB58String()
@@ -180,7 +180,7 @@ class BaseProtocol extends EventEmitter {
180180
this.libp2p.on('peer:connect', this._dialPeer)
181181

182182
// Dial already connected peers
183-
const peerInfos = values(this.libp2p.peerBook.getAll())
183+
const peerInfos = Object.values(this.libp2p.peerBook.getAll())
184184

185185
asyncEach(peerInfos, (peer, cb) => this._dialPeer(peer, cb), (err) => {
186186
setImmediate(() => {

0 commit comments

Comments
 (0)