mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-04-26 12:32:33 +00:00
fix: reduce bundle size
This commit is contained in:
parent
c26ae32829
commit
68ae2c344d
35
.npmignore
35
.npmignore
@ -1,35 +0,0 @@
|
|||||||
test
|
|
||||||
|
|
||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
npm-debug.log*
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
coverage
|
|
||||||
|
|
||||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directory
|
|
||||||
node_modules
|
|
||||||
|
|
||||||
# Optional npm cache directory
|
|
||||||
.npm
|
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
.node_repl_history
|
|
32
.travis.yml
32
.travis.yml
@ -1,32 +0,0 @@
|
|||||||
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
|
|
||||||
sudo: false
|
|
||||||
language: node_js
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- node_js: 6
|
|
||||||
env: CXX=g++-4.8
|
|
||||||
- node_js: 8
|
|
||||||
env: CXX=g++-4.8
|
|
||||||
# - node_js: stable
|
|
||||||
# env: CXX=g++-4.8
|
|
||||||
|
|
||||||
script:
|
|
||||||
- npm run lint
|
|
||||||
- npm run test
|
|
||||||
- npm run coverage
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- export DISPLAY=:99.0
|
|
||||||
- sh -e /etc/init.d/xvfb start
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- npm run coverage-publish
|
|
||||||
|
|
||||||
addons:
|
|
||||||
firefox: 'latest'
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.8
|
|
29
appveyor.yml
29
appveyor.yml
@ -1,29 +0,0 @@
|
|||||||
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
|
|
||||||
version: "{build}"
|
|
||||||
|
|
||||||
environment:
|
|
||||||
matrix:
|
|
||||||
- nodejs_version: "6"
|
|
||||||
- nodejs_version: "8"
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
install:
|
|
||||||
# Install Node.js
|
|
||||||
- ps: Install-Product node $env:nodejs_version
|
|
||||||
|
|
||||||
# Upgrade npm
|
|
||||||
- npm install -g npm
|
|
||||||
|
|
||||||
# Output our current versions for debugging
|
|
||||||
- node --version
|
|
||||||
- npm --version
|
|
||||||
|
|
||||||
# Install our package dependencies
|
|
||||||
- npm install
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- npm run test:node
|
|
||||||
|
|
||||||
build: off
|
|
15
circle.yml
15
circle.yml
@ -1,15 +0,0 @@
|
|||||||
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
|
|
||||||
machine:
|
|
||||||
node:
|
|
||||||
version: stable
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
pre:
|
|
||||||
- google-chrome --version
|
|
||||||
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
||||||
- sudo dpkg -i google-chrome.deb || true
|
|
||||||
- sudo apt-get update
|
|
||||||
- sudo apt-get install -f
|
|
||||||
- sudo apt-get install --only-upgrade lsb-base
|
|
||||||
- sudo dpkg -i google-chrome.deb
|
|
||||||
- google-chrome --version
|
|
15
package.json
15
package.json
@ -19,6 +19,10 @@
|
|||||||
"browser": {
|
"browser": {
|
||||||
"src/listener": "./src/listener.browser.js"
|
"src/listener": "./src/listener.browser.js"
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"src",
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
"pre-push": [
|
"pre-push": [
|
||||||
"lint",
|
"lint",
|
||||||
"test"
|
"test"
|
||||||
@ -37,18 +41,17 @@
|
|||||||
"homepage": "https://github.com/libp2p/js-libp2p-websockets#readme",
|
"homepage": "https://github.com/libp2p/js-libp2p-websockets#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"class-is": "^1.1.0",
|
"class-is": "^1.1.0",
|
||||||
|
"debug": "^4.1.0",
|
||||||
"interface-connection": "~0.3.2",
|
"interface-connection": "~0.3.2",
|
||||||
"lodash.includes": "^4.3.0",
|
"mafmt": "multiformats/js-mafmt#fix/bundle-size",
|
||||||
"mafmt": "^6.0.0",
|
"pull-ws": "hugomrdias/pull-ws#fix/bundle-size"
|
||||||
"pull-ws": "^3.3.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aegir": "^13.1.0",
|
"aegir": "github:ipfs/aegir#feat/make-exp-build-test-default",
|
||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"dirty-chai": "^2.0.1",
|
"dirty-chai": "^2.0.1",
|
||||||
"gulp": "^3.9.1",
|
|
||||||
"interface-transport": "~0.3.6",
|
"interface-transport": "~0.3.6",
|
||||||
"multiaddr": "^5.0.0",
|
"multiaddr": "^6.0.0",
|
||||||
"pull-goodbye": "0.0.2",
|
"pull-goodbye": "0.0.2",
|
||||||
"pull-stream": "^3.6.7"
|
"pull-stream": "^3.6.7"
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
const connect = require('pull-ws/client')
|
const connect = require('pull-ws/client')
|
||||||
const mafmt = require('mafmt')
|
const mafmt = require('mafmt')
|
||||||
const withIs = require('class-is')
|
const withIs = require('class-is')
|
||||||
const includes = require('lodash.includes')
|
|
||||||
const Connection = require('interface-connection').Connection
|
const Connection = require('interface-connection').Connection
|
||||||
|
|
||||||
const maToUrl = require('./ma-to-url')
|
const maToUrl = require('./ma-to-url')
|
||||||
@ -52,11 +51,11 @@ class WebSockets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return multiaddrs.filter((ma) => {
|
return multiaddrs.filter((ma) => {
|
||||||
if (includes(ma.protoNames(), 'p2p-circuit')) {
|
if (ma.protoNames().includes('p2p-circuit')) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includes(ma.protoNames(), 'ipfs')) {
|
if (ma.protoNames().includes('ipfs')) {
|
||||||
ma = ma.decapsulate('ipfs')
|
ma = ma.decapsulate('ipfs')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const Connection = require('interface-connection').Connection
|
const Connection = require('interface-connection').Connection
|
||||||
const includes = require('lodash.includes')
|
|
||||||
const multiaddr = require('multiaddr')
|
const multiaddr = require('multiaddr')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ module.exports = (options, handler) => {
|
|||||||
callback = callback || noop
|
callback = callback || noop
|
||||||
listeningMultiaddr = ma
|
listeningMultiaddr = ma
|
||||||
|
|
||||||
if (includes(ma.protoNames(), 'ipfs')) {
|
if (ma.protoNames().includes('ipfs')) {
|
||||||
ma = ma.decapsulate('ipfs')
|
ma = ma.decapsulate('ipfs')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user