fix: reduce bundle size

This commit is contained in:
Hugo Dias 2018-12-15 22:00:29 +00:00 committed by Jacob Heun
parent c26ae32829
commit 68ae2c344d
7 changed files with 12 additions and 122 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -19,6 +19,10 @@
"browser": {
"src/listener": "./src/listener.browser.js"
},
"files": [
"src",
"dist"
],
"pre-push": [
"lint",
"test"
@ -37,18 +41,17 @@
"homepage": "https://github.com/libp2p/js-libp2p-websockets#readme",
"dependencies": {
"class-is": "^1.1.0",
"debug": "^4.1.0",
"interface-connection": "~0.3.2",
"lodash.includes": "^4.3.0",
"mafmt": "^6.0.0",
"pull-ws": "^3.3.1"
"mafmt": "multiformats/js-mafmt#fix/bundle-size",
"pull-ws": "hugomrdias/pull-ws#fix/bundle-size"
},
"devDependencies": {
"aegir": "^13.1.0",
"aegir": "github:ipfs/aegir#feat/make-exp-build-test-default",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"gulp": "^3.9.1",
"interface-transport": "~0.3.6",
"multiaddr": "^5.0.0",
"multiaddr": "^6.0.0",
"pull-goodbye": "0.0.2",
"pull-stream": "^3.6.7"
},

View File

@ -3,7 +3,6 @@
const connect = require('pull-ws/client')
const mafmt = require('mafmt')
const withIs = require('class-is')
const includes = require('lodash.includes')
const Connection = require('interface-connection').Connection
const maToUrl = require('./ma-to-url')
@ -52,11 +51,11 @@ class WebSockets {
}
return multiaddrs.filter((ma) => {
if (includes(ma.protoNames(), 'p2p-circuit')) {
if (ma.protoNames().includes('p2p-circuit')) {
return false
}
if (includes(ma.protoNames(), 'ipfs')) {
if (ma.protoNames().includes('ipfs')) {
ma = ma.decapsulate('ipfs')
}

View File

@ -1,7 +1,6 @@
'use strict'
const Connection = require('interface-connection').Connection
const includes = require('lodash.includes')
const multiaddr = require('multiaddr')
const os = require('os')
@ -26,7 +25,7 @@ module.exports = (options, handler) => {
callback = callback || noop
listeningMultiaddr = ma
if (includes(ma.protoNames(), 'ipfs')) {
if (ma.protoNames().includes('ipfs')) {
ma = ma.decapsulate('ipfs')
}