From ad725b57c37c1e0f0a96ae5422edd6f581794870 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 28 Jan 2021 18:07:00 +0000 Subject: [PATCH 1/6] fix: updates webpack example to use v5 Takes the config from the service worker example and uses it to patch up the webpack example to use v5 fixes: #3511 --- examples/browser-webpack/package.json | 12 +++++---- examples/browser-webpack/webpack.config.js | 30 ++++++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/examples/browser-webpack/package.json b/examples/browser-webpack/package.json index 872c201cfd..e2d4b31a55 100644 --- a/examples/browser-webpack/package.json +++ b/examples/browser-webpack/package.json @@ -16,14 +16,16 @@ "@babel/preset-env": "^7.3.1", "@babel/preset-react": "^7.0.0", "babel-loader": "^8.0.5", - "copy-webpack-plugin": "^5.0.4", - "react": "^16.8.6", - "react-dom": "^16.8.6", + "copy-webpack-plugin": "^7.0.0", + "node-polyfill-webpack-plugin": "^1.0.2", + "react": "^17.0.1", + "react-dom": "^17.0.1", "react-hot-loader": "^4.12.21", "rimraf": "^3.0.2", + "stream-browserify": "^3.0.0", "test-ipfs-example": "^2.0.3", - "webpack": "^4.43.0", - "webpack-cli": "^3.3.11", + "webpack": "^5.18.0", + "webpack-cli": "^4.4.0", "webpack-dev-server": "^3.11.0" }, "dependencies": { diff --git a/examples/browser-webpack/webpack.config.js b/examples/browser-webpack/webpack.config.js index de12448fe9..8b3e6ddaf3 100644 --- a/examples/browser-webpack/webpack.config.js +++ b/examples/browser-webpack/webpack.config.js @@ -3,6 +3,7 @@ var path = require('path') var webpack = require('webpack') const CopyWebpackPlugin = require('copy-webpack-plugin') +const NodePolyfillPlugin = require('node-polyfill-webpack-plugin') module.exports = { devtool: 'eval', @@ -18,12 +19,24 @@ module.exports = { }, plugins: [ new webpack.HotModuleReplacementPlugin(), - new CopyWebpackPlugin([{ - from: 'index.html' - }, { - from: 'img', - to: 'static/img' - }]) + new CopyWebpackPlugin({ + patterns: [{ + from: 'index.html' + }, { + from: 'img', + to: 'static/img' + }] + }), + // fixes Module not found: Error: Can't resolve 'stream' in '.../node_modules/nofilter/lib' + new NodePolyfillPlugin(), + // Note: stream-browserify has assumption about `Buffer` global in its + // dependencies causing runtime errors. This is a workaround to provide + // global `Buffer` until https://github.com/isaacs/core-util-is/issues/29 + // is fixed. + new webpack.ProvidePlugin({ + Buffer: ['buffer', 'Buffer'], + process: 'process/browser' + }) ], module: { rules: [ @@ -38,10 +51,5 @@ module.exports = { } } ] - }, - node: { - fs: 'empty', - net: 'empty', - tls: 'empty' } } From 6dddccee8bcf88c9686f866abe8116168905ed46 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 29 Jan 2021 08:03:19 +0000 Subject: [PATCH 2/6] chore: ts types --- packages/ipfs-core/src/components/libp2p.js | 1 - packages/ipfs-grpc-server/src/endpoints/add.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/ipfs-core/src/components/libp2p.js b/packages/ipfs-core/src/components/libp2p.js index f0437c0945..35e4798664 100644 --- a/packages/ipfs-core/src/components/libp2p.js +++ b/packages/ipfs-core/src/components/libp2p.js @@ -54,7 +54,6 @@ module.exports = ({ * @param {KeychainConfig} input.keychainConfig * @param {PeerId} input.peerId * @param {Multiaddr[]} input.multiaddrs - * @returns {Options} */ function getLibp2pOptions ({ options, config, datastore, keys, keychainConfig, peerId, multiaddrs }) { const getPubsubRouter = () => { diff --git a/packages/ipfs-grpc-server/src/endpoints/add.js b/packages/ipfs-grpc-server/src/endpoints/add.js index 5f39f01413..be75509981 100644 --- a/packages/ipfs-grpc-server/src/endpoints/add.js +++ b/packages/ipfs-grpc-server/src/endpoints/add.js @@ -83,7 +83,7 @@ module.exports = function grpcAdd (ipfs, options = {}) { fileInputStream.end(err) } finally { // clean up any open streams - streams.filter(Boolean).forEach(stream => stream.end()) + streams.forEach(stream => stream && stream.end()) } }, 0) From e57ec693d2151fdf621ee682fc6e6a9868215bfb Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 29 Jan 2021 08:10:03 +0000 Subject: [PATCH 3/6] chore: bundle size --- packages/ipfs-core/.aegir.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipfs-core/.aegir.js b/packages/ipfs-core/.aegir.js index b88202b237..b8d103743f 100644 --- a/packages/ipfs-core/.aegir.js +++ b/packages/ipfs-core/.aegir.js @@ -8,7 +8,7 @@ let preloadNode = MockPreloadNode.createNode() let ipfsdServer module.exports = { - bundlesize: { maxSize: '600kB' }, + bundlesize: { maxSize: '612kB' }, karma: { files: [{ pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*', From 48b74a290e3dd588bd2b0730dd93aa73331bc272 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 29 Jan 2021 08:10:43 +0000 Subject: [PATCH 4/6] chore: bundle size --- packages/ipfs/.aegir.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipfs/.aegir.js b/packages/ipfs/.aegir.js index 38cc93fb84..687580f6d8 100644 --- a/packages/ipfs/.aegir.js +++ b/packages/ipfs/.aegir.js @@ -15,7 +15,7 @@ let sigServerB let ipfsdServer module.exports = { - bundlesize: { maxSize: '600kB' }, + bundlesize: { maxSize: '612kB' }, karma: { files: [{ pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*', From b65b1c7e196c66a3d71db85285134c2b086a5bde Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 29 Jan 2021 11:11:28 +0000 Subject: [PATCH 5/6] chore: update deps --- examples/custom-libp2p/package.json | 2 +- packages/interface-ipfs-core/package.json | 2 +- packages/ipfs-cli/package.json | 2 +- packages/ipfs-core/package.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/custom-libp2p/package.json b/examples/custom-libp2p/package.json index b76e3b9483..55e6392bbb 100644 --- a/examples/custom-libp2p/package.json +++ b/examples/custom-libp2p/package.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "ipfs": "^0.53.2", - "libp2p": "^0.29.3", + "libp2p": "^0.30.0", "libp2p-bootstrap": "^0.12.1", "libp2p-kad-dht": "^0.20.1", "libp2p-mdns": "^0.15.0", diff --git a/packages/interface-ipfs-core/package.json b/packages/interface-ipfs-core/package.json index c5034eee7e..bcb622e919 100644 --- a/packages/interface-ipfs-core/package.json +++ b/packages/interface-ipfs-core/package.json @@ -54,7 +54,7 @@ "it-last": "^1.0.4", "it-map": "^1.0.4", "it-pushable": "^1.4.0", - "libp2p-crypto": "^0.18.0", + "libp2p-crypto": "^0.19.0", "libp2p-websockets": "^0.15.0", "multiaddr": "^8.0.0", "multibase": "^3.0.0", diff --git a/packages/ipfs-cli/package.json b/packages/ipfs-cli/package.json index b17c75769e..8f4aed67a8 100644 --- a/packages/ipfs-cli/package.json +++ b/packages/ipfs-cli/package.json @@ -51,7 +51,7 @@ "it-glob": "0.0.10", "it-pipe": "^1.1.0", "jsondiffpatch": "^0.4.1", - "libp2p-crypto": "^0.18.0", + "libp2p-crypto": "^0.19.0", "mafmt": "^8.0.0", "multiaddr": "^8.0.0", "multiaddr-to-uri": "^6.0.0", diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 26f711bd61..53fd650227 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -68,7 +68,7 @@ "hamt-sharding": "^1.0.0", "hashlru": "^2.3.0", "interface-datastore": "^2.0.0", - "ipfs-bitswap": "^4.0.0", + "ipfs-bitswap": "^4.0.2", "ipfs-block-service": "^0.18.0", "ipfs-core-types": "^0.2.1", "ipfs-core-utils": "^0.6.1", @@ -91,7 +91,7 @@ "it-pipe": "^1.1.0", "libp2p": "^0.30.0", "libp2p-bootstrap": "^0.12.1", - "libp2p-crypto": "^0.18.0", + "libp2p-crypto": "^0.19.0", "libp2p-floodsub": "^0.24.1", "libp2p-gossipsub": "^0.8.0", "libp2p-kad-dht": "^0.20.1", From 8f090088f9913742a466785f5fc97de3ed7ec7f6 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 29 Jan 2021 11:31:04 +0000 Subject: [PATCH 6/6] chore: update bundle sizes --- packages/ipfs-core/.aegir.js | 2 +- packages/ipfs/.aegir.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ipfs-core/.aegir.js b/packages/ipfs-core/.aegir.js index b8d103743f..dc2115e8d7 100644 --- a/packages/ipfs-core/.aegir.js +++ b/packages/ipfs-core/.aegir.js @@ -8,7 +8,7 @@ let preloadNode = MockPreloadNode.createNode() let ipfsdServer module.exports = { - bundlesize: { maxSize: '612kB' }, + bundlesize: { maxSize: '545kB' }, karma: { files: [{ pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*', diff --git a/packages/ipfs/.aegir.js b/packages/ipfs/.aegir.js index 687580f6d8..e1b92f5939 100644 --- a/packages/ipfs/.aegir.js +++ b/packages/ipfs/.aegir.js @@ -15,7 +15,7 @@ let sigServerB let ipfsdServer module.exports = { - bundlesize: { maxSize: '612kB' }, + bundlesize: { maxSize: '545kB' }, karma: { files: [{ pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',