From 0ef940a36d591b7aa92094aafa91642177e0afc1 Mon Sep 17 00:00:00 2001 From: Umed Khudoiberdiev Date: Fri, 5 Aug 2022 21:26:55 +0500 Subject: [PATCH 1/8] fix vite example as discussed in #4147 --- examples/browser-vite/vite.config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/browser-vite/vite.config.js b/examples/browser-vite/vite.config.js index 1ae5efa8..46cd3fc4 100644 --- a/examples/browser-vite/vite.config.js +++ b/examples/browser-vite/vite.config.js @@ -6,5 +6,12 @@ export default { define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // target: es2020 added as workaround to make big ints work + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020', + }, } } From 090a31a41452df9423c44def2eed2c0758a60ee9 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 7 Sep 2022 09:21:24 +0100 Subject: [PATCH 2/8] fix: update vite and make magic incantations --- .../browser-add-readable-stream/package.json | 2 +- .../vite.config.js | 27 ++++++++++++++++--- examples/browser-exchange-files/package.json | 2 +- .../browser-exchange-files/vite.config.js | 27 ++++++++++++++++--- examples/browser-ipns-publish/package.json | 2 +- examples/browser-ipns-publish/vite.config.js | 27 ++++++++++++++++--- examples/browser-lit/package.json | 2 +- examples/browser-lit/vite.config.js | 27 ++++++++++++++++--- examples/browser-mfs/package.json | 2 +- examples/browser-mfs/vite.config.js | 27 ++++++++++++++++--- examples/browser-readablestream/package.json | 2 +- .../browser-readablestream/vite.config.js | 20 +++++++++++--- examples/browser-script-tag/package.json | 2 +- examples/browser-script-tag/vite.config.js | 27 ++++++++++++++++--- .../package.json | 2 +- .../vite.config.js | 27 ++++++++++++++++--- examples/browser-video-streaming/package.json | 2 +- .../browser-video-streaming/vite.config.js | 27 ++++++++++++++++--- examples/browser-vite/package.json | 2 +- examples/browser-vite/vite.config.js | 24 ++++++++++++----- examples/circuit-relaying/package.json | 2 +- examples/circuit-relaying/vite.config.js | 27 ++++++++++++++++--- .../http-client-browser-pubsub/package.json | 2 +- .../http-client-browser-pubsub/vite.config.js | 27 ++++++++++++++++--- examples/http-client-name-api/package.json | 2 +- examples/http-client-name-api/vite.config.js | 27 ++++++++++++++++--- examples/http-client-upload-file/package.json | 2 +- .../http-client-upload-file/vite.config.js | 27 ++++++++++++++++--- examples/ipfs-client-add-files/package.json | 2 +- examples/ipfs-client-add-files/vite.config.js | 27 ++++++++++++++++--- 30 files changed, 349 insertions(+), 76 deletions(-) diff --git a/examples/browser-add-readable-stream/package.json b/examples/browser-add-readable-stream/package.json index 94696b8f..fad26a7b 100644 --- a/examples/browser-add-readable-stream/package.json +++ b/examples/browser-add-readable-stream/package.json @@ -25,6 +25,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-add-readable-stream/vite.config.js b/examples/browser-add-readable-stream/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/browser-add-readable-stream/vite.config.js +++ b/examples/browser-add-readable-stream/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/browser-exchange-files/package.json b/examples/browser-exchange-files/package.json index bc3a6642..343a5857 100644 --- a/examples/browser-exchange-files/package.json +++ b/examples/browser-exchange-files/package.json @@ -30,6 +30,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-exchange-files/vite.config.js b/examples/browser-exchange-files/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/browser-exchange-files/vite.config.js +++ b/examples/browser-exchange-files/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/browser-ipns-publish/package.json b/examples/browser-ipns-publish/package.json index dae2c7d8..98a01c6e 100644 --- a/examples/browser-ipns-publish/package.json +++ b/examples/browser-ipns-publish/package.json @@ -45,6 +45,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-ipns-publish/vite.config.js b/examples/browser-ipns-publish/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/browser-ipns-publish/vite.config.js +++ b/examples/browser-ipns-publish/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/browser-lit/package.json b/examples/browser-lit/package.json index 2d4c3438..845b015a 100644 --- a/examples/browser-lit/package.json +++ b/examples/browser-lit/package.json @@ -28,6 +28,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-lit/vite.config.js b/examples/browser-lit/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/browser-lit/vite.config.js +++ b/examples/browser-lit/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/browser-mfs/package.json b/examples/browser-mfs/package.json index 49ae4f76..e19b3b2e 100644 --- a/examples/browser-mfs/package.json +++ b/examples/browser-mfs/package.json @@ -26,6 +26,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-mfs/vite.config.js b/examples/browser-mfs/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/browser-mfs/vite.config.js +++ b/examples/browser-mfs/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/browser-readablestream/package.json b/examples/browser-readablestream/package.json index 40c67b1a..bfe71bfc 100644 --- a/examples/browser-readablestream/package.json +++ b/examples/browser-readablestream/package.json @@ -31,6 +31,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-readablestream/vite.config.js b/examples/browser-readablestream/vite.config.js index 6d9535e4..11c62ea6 100644 --- a/examples/browser-readablestream/vite.config.js +++ b/examples/browser-readablestream/vite.config.js @@ -1,10 +1,16 @@ +import { defineConfig } from 'vite' import inject from '@rollup/plugin-inject' import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill' -export default { +export default defineConfig({ build: { - target: 'esnext', + target: 'es2020', minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + }, rollupOptions: { plugins: [inject({ Buffer: ['Buffer', 'Buffer'] })], } @@ -15,7 +21,15 @@ export default { 'process.version': `'${process.version}'` }, optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 esbuildOptions: { + target: 'es2020', // Node.js global to browser globalThis define: { global: 'globalThis', @@ -29,4 +43,4 @@ export default { ] } } -} +}) diff --git a/examples/browser-script-tag/package.json b/examples/browser-script-tag/package.json index 121644d5..0c94f2c2 100644 --- a/examples/browser-script-tag/package.json +++ b/examples/browser-script-tag/package.json @@ -22,6 +22,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-script-tag/vite.config.js b/examples/browser-script-tag/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/browser-script-tag/vite.config.js +++ b/examples/browser-script-tag/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/browser-sharing-node-across-tabs/package.json b/examples/browser-sharing-node-across-tabs/package.json index 311861d9..29a56962 100644 --- a/examples/browser-sharing-node-across-tabs/package.json +++ b/examples/browser-sharing-node-across-tabs/package.json @@ -27,6 +27,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-sharing-node-across-tabs/vite.config.js b/examples/browser-sharing-node-across-tabs/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/browser-sharing-node-across-tabs/vite.config.js +++ b/examples/browser-sharing-node-across-tabs/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/browser-video-streaming/package.json b/examples/browser-video-streaming/package.json index 758f02bb..811b7373 100644 --- a/examples/browser-video-streaming/package.json +++ b/examples/browser-video-streaming/package.json @@ -27,6 +27,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-video-streaming/vite.config.js b/examples/browser-video-streaming/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/browser-video-streaming/vite.config.js +++ b/examples/browser-video-streaming/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/browser-vite/package.json b/examples/browser-vite/package.json index 86fd8307..d58bef0f 100644 --- a/examples/browser-vite/package.json +++ b/examples/browser-vite/package.json @@ -26,6 +26,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/browser-vite/vite.config.js b/examples/browser-vite/vite.config.js index 46cd3fc4..64267fbc 100644 --- a/examples/browser-vite/vite.config.js +++ b/examples/browser-vite/vite.config.js @@ -1,17 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' }, optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 esbuildOptions: { - target: 'es2020', - }, + target: 'es2020' + } } -} +}) diff --git a/examples/circuit-relaying/package.json b/examples/circuit-relaying/package.json index 2fccc0da..2a9e7a52 100644 --- a/examples/circuit-relaying/package.json +++ b/examples/circuit-relaying/package.json @@ -34,6 +34,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/circuit-relaying/vite.config.js b/examples/circuit-relaying/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/circuit-relaying/vite.config.js +++ b/examples/circuit-relaying/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/http-client-browser-pubsub/package.json b/examples/http-client-browser-pubsub/package.json index 5a610466..0afd24f1 100644 --- a/examples/http-client-browser-pubsub/package.json +++ b/examples/http-client-browser-pubsub/package.json @@ -27,6 +27,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/http-client-browser-pubsub/vite.config.js b/examples/http-client-browser-pubsub/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/http-client-browser-pubsub/vite.config.js +++ b/examples/http-client-browser-pubsub/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/http-client-name-api/package.json b/examples/http-client-name-api/package.json index 1a0bbd31..500aa745 100644 --- a/examples/http-client-name-api/package.json +++ b/examples/http-client-name-api/package.json @@ -26,6 +26,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/http-client-name-api/vite.config.js b/examples/http-client-name-api/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/http-client-name-api/vite.config.js +++ b/examples/http-client-name-api/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/http-client-upload-file/package.json b/examples/http-client-upload-file/package.json index 1ad337ad..ad29ee2b 100644 --- a/examples/http-client-upload-file/package.json +++ b/examples/http-client-upload-file/package.json @@ -31,6 +31,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/http-client-upload-file/vite.config.js b/examples/http-client-upload-file/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/http-client-upload-file/vite.config.js +++ b/examples/http-client-upload-file/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) diff --git a/examples/ipfs-client-add-files/package.json b/examples/ipfs-client-add-files/package.json index 21406910..d321e26d 100644 --- a/examples/ipfs-client-add-files/package.json +++ b/examples/ipfs-client-add-files/package.json @@ -24,6 +24,6 @@ "rimraf": "^3.0.2", "test-util-ipfs-example": "^1.0.2", "util": "^0.12.4", - "vite": "^3.0.0-beta.1" + "vite": "^3.1.0" } } diff --git a/examples/ipfs-client-add-files/vite.config.js b/examples/ipfs-client-add-files/vite.config.js index 1ae5efa8..64267fbc 100644 --- a/examples/ipfs-client-add-files/vite.config.js +++ b/examples/ipfs-client-add-files/vite.config.js @@ -1,10 +1,29 @@ -export default { +import { defineConfig } from 'vite' + +export default defineConfig({ build: { - target: 'esnext', - minify: false + target: 'es2020', + minify: false, + // disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + commonjsOptions: { + include: [] + } }, define: { 'process.env.NODE_DEBUG': 'false', 'global': 'globalThis' + }, + optimizeDeps: { + // enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109 + // should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental + disabled: false, + + // target: es2020 added as workaround to make big ints work + // - should be removable with vite 4 + // https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044 + esbuildOptions: { + target: 'es2020' + } } -} +}) From 5acd81369151bfbc4abf71c11ae50dc347839175 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 7 Sep 2022 16:39:23 +0100 Subject: [PATCH 3/8] chore: update deps --- examples/browser-add-readable-stream/package.json | 2 +- examples/browser-add-readable-stream/src/index.js | 10 +++++++--- examples/browser-angular/package.json | 4 ++-- examples/browser-create-react-app/package.json | 2 +- examples/browser-exchange-files/package.json | 10 +++++----- examples/browser-ipns-publish/package.json | 14 +++++++------- examples/browser-lit/package.json | 2 +- examples/browser-mfs/package.json | 2 +- examples/browser-nextjs/package.json | 2 +- examples/browser-readablestream/package.json | 2 +- examples/browser-service-worker/package.json | 8 ++++---- .../browser-sharing-node-across-tabs/package.json | 6 +++--- examples/browser-video-streaming/package.json | 2 +- examples/browser-vite/package.json | 2 +- examples/browser-vue/package.json | 2 +- examples/browser-webpack/package.json | 2 +- examples/circuit-relaying/package.json | 6 +++--- examples/custom-ipfs-repo/package.json | 8 ++++---- examples/custom-ipld-formats/package.json | 8 ++++---- examples/custom-libp2p/package.json | 14 +++++++------- examples/http-client-browser-pubsub/package.json | 6 +++--- examples/http-client-bundle-webpack/package.json | 4 ++-- examples/http-client-name-api/package.json | 4 ++-- examples/http-client-upload-file/package.json | 4 ++-- examples/ipfs-101/package.json | 2 +- examples/ipfs-client-add-files/package.json | 2 +- examples/run-in-electron/package.json | 4 ++-- examples/running-multiple-nodes/package.json | 4 ++-- examples/traverse-ipld-graphs/package.json | 2 +- examples/types-use-ipfs-from-ts/package.json | 2 +- examples/types-use-ipfs-from-typed-js/package.json | 2 +- lib/test-util-ipfs-example/package.json | 2 +- 32 files changed, 75 insertions(+), 71 deletions(-) diff --git a/examples/browser-add-readable-stream/package.json b/examples/browser-add-readable-stream/package.json index fad26a7b..30d905b2 100644 --- a/examples/browser-add-readable-stream/package.json +++ b/examples/browser-add-readable-stream/package.json @@ -15,7 +15,7 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "ipfs-core": "^0.15.2" + "ipfs-core": "^0.16.0" }, "devDependencies": { "@babel/core": "^7.14.8", diff --git a/examples/browser-add-readable-stream/src/index.js b/examples/browser-add-readable-stream/src/index.js index 385e53b2..5ba8e1e0 100644 --- a/examples/browser-add-readable-stream/src/index.js +++ b/examples/browser-add-readable-stream/src/index.js @@ -159,13 +159,17 @@ const main = async () => { DOM.content.innerHTML = ''; for await (const file of fileList) { - const content = []; + const decoder = new TextDecoder() + let content = '' + for await (const chunk of ipfs.cat(file.cid)) { - content.push(chunk) + content += decoder.decode(chunk, { + stream: true + }) } - showStatus(`\u2514\u2500 ${file.name} ${file.path} ${content.toString()}`) + showStatus(`\u2514\u2500 ${file.name} ${file.path} ${content}`) showStatus(`Preview: https://ipfs.io/ipfs/${file.path}`, COLORS.success) addFileDOM(file.name, content, DOM.content, false) } diff --git a/examples/browser-angular/package.json b/examples/browser-angular/package.json index 13cbd347..f2331207 100644 --- a/examples/browser-angular/package.json +++ b/examples/browser-angular/package.json @@ -23,8 +23,8 @@ "@angular/router": "^13.2.0", "@libp2p/interface-peer-id": "^1.0.2", "global": "^4.4.0", - "ipfs-core": "^0.15.2", - "ipfs-core-types": "^0.11.0", + "ipfs-core": "^0.16.0", + "ipfs-core-types": "^0.12.0", "rxjs": "^7.5.2", "tslib": "^2.3.0", "zone.js": "~0.11.4" diff --git a/examples/browser-create-react-app/package.json b/examples/browser-create-react-app/package.json index baa1cc9d..fb11adbd 100644 --- a/examples/browser-create-react-app/package.json +++ b/examples/browser-create-react-app/package.json @@ -37,7 +37,7 @@ "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^13.5.0", "dot-prop": "^7.1.1", - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "ipfs-css": "^1.3.0", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/examples/browser-exchange-files/package.json b/examples/browser-exchange-files/package.json index 343a5857..54e07963 100644 --- a/examples/browser-exchange-files/package.json +++ b/examples/browser-exchange-files/package.json @@ -13,8 +13,8 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "@libp2p/websockets": "^1.0.8", - "ipfs-core": "^0.15.2", + "@libp2p/websockets": "^3.0.3", + "ipfs-core": "^0.16.0", "it-all": "^1.0.4", "uint8arrays": "^3.0.0" }, @@ -22,9 +22,9 @@ "@babel/core": "^7.14.8", "@libp2p/webrtc-star-signalling-server": "^2.0.1", "@playwright/test": "^1.12.3", - "ipfs": "^0.63.3", - "ipfs-core-types": "^0.11.0", - "ipfs-http-client": "^57.0.1", + "ipfs": "^0.64.0", + "ipfs-core-types": "^0.12.0", + "ipfs-http-client": "^58.0.0", "playwright": "^1.12.3", "process": "^0.11.10", "rimraf": "^3.0.2", diff --git a/examples/browser-ipns-publish/package.json b/examples/browser-ipns-publish/package.json index 98a01c6e..852c589b 100644 --- a/examples/browser-ipns-publish/package.json +++ b/examples/browser-ipns-publish/package.json @@ -23,14 +23,14 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "@libp2p/websockets": "^1.0.8", - "ipfs-core": "^0.15.2", - "ipfs-http-client": "^57.0.1", + "@libp2p/websockets": "^3.0.3", + "ipfs-core": "^0.16.0", + "ipfs-http-client": "^58.0.0", "ipfs-utils": "^9.0.6", - "ipns": "^1.0.2", + "ipns": "^2.0.3", "it-last": "^1.0.4", "multiformats": "^9.6.5", - "p-retry": "^4.2.0", + "p-retry": "^5.1.1", "uint8arrays": "^3.0.0" }, "devDependencies": { @@ -38,8 +38,8 @@ "@playwright/test": "^1.12.3", "delay": "^5.0.0", "execa": "^6.0.0", - "go-ipfs": "^0.11.0", - "ipfsd-ctl": "^11.0.1", + "go-ipfs": "^0.15.0", + "ipfsd-ctl": "^12.0.2", "playwright": "^1.12.3", "process": "^0.11.10", "rimraf": "^3.0.2", diff --git a/examples/browser-lit/package.json b/examples/browser-lit/package.json index 845b015a..47f3e13f 100644 --- a/examples/browser-lit/package.json +++ b/examples/browser-lit/package.json @@ -15,7 +15,7 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "ipfs-css": "^1.3.0", "lit": "^2.0.2", "tachyons": "^4.12.0" diff --git a/examples/browser-mfs/package.json b/examples/browser-mfs/package.json index e19b3b2e..bb035345 100644 --- a/examples/browser-mfs/package.json +++ b/examples/browser-mfs/package.json @@ -15,7 +15,7 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "mime-sniffer": "~0.0.3" }, "devDependencies": { diff --git a/examples/browser-nextjs/package.json b/examples/browser-nextjs/package.json index 6cb8fe7a..7ffcf33a 100644 --- a/examples/browser-nextjs/package.json +++ b/examples/browser-nextjs/package.json @@ -13,7 +13,7 @@ "test": "npm run build && playwright test tests" }, "dependencies": { - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "next": "^12.0.7", "react": "^17.0.2", "react-dom": "^17.0.2" diff --git a/examples/browser-readablestream/package.json b/examples/browser-readablestream/package.json index bfe71bfc..0c488169 100644 --- a/examples/browser-readablestream/package.json +++ b/examples/browser-readablestream/package.json @@ -16,7 +16,7 @@ "browserslist": "last 1 Chrome version", "dependencies": { "buffer": "^6.0.3", - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "it-to-stream": "^1.0.0", "videostream": "^3.2.0" }, diff --git a/examples/browser-service-worker/package.json b/examples/browser-service-worker/package.json index c8ba3826..876216cf 100644 --- a/examples/browser-service-worker/package.json +++ b/examples/browser-service-worker/package.json @@ -17,10 +17,10 @@ "last 1 Chrome version" ], "dependencies": { - "ipfs-core": "^0.15.2", - "ipfs-message-port-client": "^0.12.2", - "ipfs-message-port-protocol": "^0.12.0", - "ipfs-message-port-server": "^0.12.0" + "ipfs-core": "^0.16.0", + "ipfs-message-port-client": "^0.13.0", + "ipfs-message-port-protocol": "^0.13.0", + "ipfs-message-port-server": "^0.13.0" }, "devDependencies": { "@babel/core": "^7.13.10", diff --git a/examples/browser-sharing-node-across-tabs/package.json b/examples/browser-sharing-node-across-tabs/package.json index 29a56962..36428920 100644 --- a/examples/browser-sharing-node-across-tabs/package.json +++ b/examples/browser-sharing-node-across-tabs/package.json @@ -15,9 +15,9 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "ipfs-core": "^0.15.2", - "ipfs-message-port-client": "^0.12.2", - "ipfs-message-port-server": "^0.12.0" + "ipfs-core": "^0.16.0", + "ipfs-message-port-client": "^0.13.0", + "ipfs-message-port-server": "^0.13.0" }, "devDependencies": { "@babel/core": "^7.14.8", diff --git a/examples/browser-video-streaming/package.json b/examples/browser-video-streaming/package.json index 811b7373..1742b0cf 100644 --- a/examples/browser-video-streaming/package.json +++ b/examples/browser-video-streaming/package.json @@ -17,7 +17,7 @@ "dependencies": { "hls.js": "^0.14.17", "hlsjs-ipfs-loader": "^0.3.0", - "ipfs-core": "^0.15.2" + "ipfs-core": "^0.16.0" }, "devDependencies": { "@babel/core": "^7.14.8", diff --git a/examples/browser-vite/package.json b/examples/browser-vite/package.json index d58bef0f..afab9c96 100644 --- a/examples/browser-vite/package.json +++ b/examples/browser-vite/package.json @@ -16,7 +16,7 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "ipfs-core": "^0.15.2" + "ipfs-core": "^0.16.0" }, "devDependencies": { "@babel/core": "^7.14.8", diff --git a/examples/browser-vue/package.json b/examples/browser-vue/package.json index 76df2db3..67fb9098 100644 --- a/examples/browser-vue/package.json +++ b/examples/browser-vue/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "core-js": "^3.8.3", - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "vue": "^3.0.4" }, "devDependencies": { diff --git a/examples/browser-webpack/package.json b/examples/browser-webpack/package.json index 07bdd134..9ef8ee21 100644 --- a/examples/browser-webpack/package.json +++ b/examples/browser-webpack/package.json @@ -17,7 +17,7 @@ "last 1 Chrome version" ], "dependencies": { - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "react": "^17.0.2", "react-dom": "^17.0.2" }, diff --git a/examples/circuit-relaying/package.json b/examples/circuit-relaying/package.json index 2a9e7a52..f2ad3c2a 100644 --- a/examples/circuit-relaying/package.json +++ b/examples/circuit-relaying/package.json @@ -16,9 +16,9 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "@libp2p/websockets": "^1.0.8", + "@libp2p/websockets": "^3.0.3", "delay": "^5.0.0", - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "ipfs-css": "^1.3.0", "ipfs-pubsub-room": "^3.0.0", "uint8arrays": "^3.0.0" @@ -28,7 +28,7 @@ "@playwright/test": "^1.12.3", "events": "^3.3.0", "fs-extra": "^10.0.0", - "ipfs-http-client": "^57.0.1", + "ipfs-http-client": "^58.0.0", "playwright": "^1.12.3", "process": "^0.11.10", "rimraf": "^3.0.2", diff --git a/examples/custom-ipfs-repo/package.json b/examples/custom-ipfs-repo/package.json index b2895b21..17ca70ab 100644 --- a/examples/custom-ipfs-repo/package.json +++ b/examples/custom-ipfs-repo/package.json @@ -15,10 +15,10 @@ "dependencies": { "@ipld/dag-cbor": "^7.0.0", "@ipld/dag-pb": "^2.1.3", - "blockstore-datastore-adapter": "^2.0.3", - "datastore-fs": "^7.0.0", - "ipfs-core": "^0.15.2", - "ipfs-repo": "^14.0.1", + "blockstore-datastore-adapter": "^3.0.1", + "datastore-fs": "^8.0.0", + "ipfs-core": "^0.16.0", + "ipfs-repo": "^15.0.2", "it-all": "^1.0.4", "multiformats": "^9.6.5", "uint8arrays": "^3.0.0", diff --git a/examples/custom-ipld-formats/package.json b/examples/custom-ipld-formats/package.json index 998e5c1d..db62b60c 100644 --- a/examples/custom-ipld-formats/package.json +++ b/examples/custom-ipld-formats/package.json @@ -11,10 +11,10 @@ "test": "node tests/test.js" }, "dependencies": { - "dag-jose": "^1.0.0", - "ipfs-core": "^0.15.2", - "ipfs-daemon": "^0.13.3", - "ipfs-http-client": "^57.0.1", + "dag-jose": "^2.0.1", + "ipfs-core": "^0.16.0", + "ipfs-daemon": "^0.14.0", + "ipfs-http-client": "^58.0.0", "multiformats": "^9.6.5", "uint8arrays": "^3.0.0" }, diff --git a/examples/custom-libp2p/package.json b/examples/custom-libp2p/package.json index 3a8436fd..3936c08b 100644 --- a/examples/custom-libp2p/package.json +++ b/examples/custom-libp2p/package.json @@ -13,14 +13,14 @@ "test": "node tests/test.js" }, "dependencies": { - "@chainsafe/libp2p-noise": "^7.0.0", + "@chainsafe/libp2p-noise": "^8.0.1", "@libp2p/bootstrap": "^2.0.0", - "@libp2p/kad-dht": "^3.0.0", - "@libp2p/mdns": "^2.0.0", - "@libp2p/mplex": "^3.0.0", - "@libp2p/tcp": "^3.0.0", - "ipfs-core": "^0.15.2", - "libp2p": "^0.37.3", + "@libp2p/kad-dht": "^3.0.4", + "@libp2p/mdns": "^3.0.0", + "@libp2p/mplex": "^5.2.0", + "@libp2p/tcp": "^3.0.6", + "ipfs-core": "^0.16.0", + "libp2p": "^0.39.0", "uint8arrays": "^3.0.0" }, "devDependencies": { diff --git a/examples/http-client-browser-pubsub/package.json b/examples/http-client-browser-pubsub/package.json index 0afd24f1..c5366b63 100644 --- a/examples/http-client-browser-pubsub/package.json +++ b/examples/http-client-browser-pubsub/package.json @@ -15,13 +15,13 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "ipfs-http-client": "^57.0.1" + "ipfs-http-client": "^58.0.0" }, "devDependencies": { "@babel/core": "^7.14.8", "@playwright/test": "^1.12.3", - "go-ipfs": "^0.11.0", - "ipfs": "^0.63.3", + "go-ipfs": "^0.15.0", + "ipfs": "^0.64.0", "playwright": "^1.12.3", "process": "^0.11.10", "rimraf": "^3.0.2", diff --git a/examples/http-client-bundle-webpack/package.json b/examples/http-client-bundle-webpack/package.json index e25b2296..5fe201a3 100644 --- a/examples/http-client-bundle-webpack/package.json +++ b/examples/http-client-bundle-webpack/package.json @@ -18,7 +18,7 @@ "last 1 Chrome version" ], "dependencies": { - "ipfs-http-client": "^57.0.1", + "ipfs-http-client": "^58.0.0", "react": "^17.0.2", "react-dom": "^17.0.2" }, @@ -31,7 +31,7 @@ "copy-webpack-plugin": "^10.0.0", "css-loader": "^6.2.0", "html-webpack-plugin": "^5.3.1", - "ipfs": "^0.63.3", + "ipfs": "^0.64.0", "node-polyfill-webpack-plugin": "^1.0.3", "playwright": "^1.12.3", "react-hot-loader": "^4.12.21", diff --git a/examples/http-client-name-api/package.json b/examples/http-client-name-api/package.json index 500aa745..10128cae 100644 --- a/examples/http-client-name-api/package.json +++ b/examples/http-client-name-api/package.json @@ -15,12 +15,12 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "ipfs-http-client": "^57.0.1" + "ipfs-http-client": "^58.0.0" }, "devDependencies": { "@babel/core": "^7.14.8", "@playwright/test": "^1.12.3", - "go-ipfs": "^0.11.0", + "go-ipfs": "^0.15.0", "playwright": "^1.12.3", "process": "^0.11.10", "rimraf": "^3.0.2", diff --git a/examples/http-client-upload-file/package.json b/examples/http-client-upload-file/package.json index ad29ee2b..adcf93f2 100644 --- a/examples/http-client-upload-file/package.json +++ b/examples/http-client-upload-file/package.json @@ -18,14 +18,14 @@ }, "browserslist": "last 1 Chrome version", "dependencies": { - "ipfs-http-client": "^57.0.1", + "ipfs-http-client": "^58.0.0", "react": "^17.0.2", "react-dom": "^17.0.2" }, "devDependencies": { "@babel/core": "^7.14.8", "@playwright/test": "^1.12.3", - "ipfs": "^0.63.3", + "ipfs": "^0.64.0", "playwright": "^1.12.3", "process": "^0.11.10", "rimraf": "^3.0.2", diff --git a/examples/ipfs-101/package.json b/examples/ipfs-101/package.json index 84cc9c25..f72936ae 100644 --- a/examples/ipfs-101/package.json +++ b/examples/ipfs-101/package.json @@ -14,7 +14,7 @@ "test": "node tests/test.js" }, "dependencies": { - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "it-all": "^1.0.4", "uint8arrays": "^3.0.0" }, diff --git a/examples/ipfs-client-add-files/package.json b/examples/ipfs-client-add-files/package.json index d321e26d..ae643fbb 100644 --- a/examples/ipfs-client-add-files/package.json +++ b/examples/ipfs-client-add-files/package.json @@ -18,7 +18,7 @@ "devDependencies": { "@babel/core": "^7.14.8", "@playwright/test": "^1.12.3", - "ipfs": "^0.63.3", + "ipfs": "^0.64.0", "playwright": "^1.12.3", "process": "^0.11.10", "rimraf": "^3.0.2", diff --git a/examples/run-in-electron/package.json b/examples/run-in-electron/package.json index 929e35fd..3fd24dca 100644 --- a/examples/run-in-electron/package.json +++ b/examples/run-in-electron/package.json @@ -18,10 +18,10 @@ "test": "node test.mjs" }, "dependencies": { - "ipfs-core": "^0.15.2" + "ipfs-core": "^0.16.0" }, "devDependencies": { - "electron": "^17.0.0", + "electron": "^20.1.1", "electron-rebuild": "^3.1.1", "test-util-ipfs-example": "^1.0.2" }, diff --git a/examples/running-multiple-nodes/package.json b/examples/running-multiple-nodes/package.json index bb18e0ec..c088d6db 100644 --- a/examples/running-multiple-nodes/package.json +++ b/examples/running-multiple-nodes/package.json @@ -14,10 +14,10 @@ "test": "node tests/test.js" }, "dependencies": { - "ipfs": "^0.63.3" + "ipfs": "^0.64.0" }, "devDependencies": { - "nanoid": "^3.1.23", + "nanoid": "^4.0.0", "test-util-ipfs-example": "^1.0.2" } } diff --git a/examples/traverse-ipld-graphs/package.json b/examples/traverse-ipld-graphs/package.json index 5e0d6fcd..66ec005b 100644 --- a/examples/traverse-ipld-graphs/package.json +++ b/examples/traverse-ipld-graphs/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@ipld/dag-pb": "^2.1.3", - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "ipld-ethereum": "^6.0.0", "ipld-format-to-blockcodec": "0.0.1", "ipld-git": "^0.6.1", diff --git a/examples/types-use-ipfs-from-ts/package.json b/examples/types-use-ipfs-from-ts/package.json index 5f6f0792..84a194f4 100644 --- a/examples/types-use-ipfs-from-ts/package.json +++ b/examples/types-use-ipfs-from-ts/package.json @@ -8,7 +8,7 @@ "test": "tsc --noEmit" }, "dependencies": { - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "multiformats": "^9.6.5" }, "devDependencies": { diff --git a/examples/types-use-ipfs-from-typed-js/package.json b/examples/types-use-ipfs-from-typed-js/package.json index e6bc10f7..508b7ffe 100644 --- a/examples/types-use-ipfs-from-typed-js/package.json +++ b/examples/types-use-ipfs-from-typed-js/package.json @@ -8,7 +8,7 @@ "test": "tsc --noEmit" }, "dependencies": { - "ipfs-core": "^0.15.2", + "ipfs-core": "^0.16.0", "multiformats": "^9.6.5" }, "devDependencies": { diff --git a/lib/test-util-ipfs-example/package.json b/lib/test-util-ipfs-example/package.json index d8fa7363..2008c503 100644 --- a/lib/test-util-ipfs-example/package.json +++ b/lib/test-util-ipfs-example/package.json @@ -26,7 +26,7 @@ "dependencies": { "execa": "^6.0.0", "fs-extra": "^10.1.0", - "ipfsd-ctl": "^11.0.1", + "ipfsd-ctl": "^12.0.2", "polka": "^0.5.2", "sirv": "^2.0.2", "stoppable": "^1.1.0", From db9707aca72c88f9c415aafb3e3397ab9cb78048 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 7 Sep 2022 16:46:32 +0100 Subject: [PATCH 4/8] fix: use text decoder to decode text --- examples/browser-add-readable-stream/src/index.js | 1 - examples/browser-vite/src/index.js | 9 ++++++--- examples/types-use-ipfs-from-ts/src/main.ts | 5 ++++- examples/types-use-ipfs-from-typed-js/src/main.js | 8 ++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/examples/browser-add-readable-stream/src/index.js b/examples/browser-add-readable-stream/src/index.js index 5ba8e1e0..e136c938 100644 --- a/examples/browser-add-readable-stream/src/index.js +++ b/examples/browser-add-readable-stream/src/index.js @@ -162,7 +162,6 @@ const main = async () => { const decoder = new TextDecoder() let content = '' - for await (const chunk of ipfs.cat(file.cid)) { content += decoder.decode(chunk, { stream: true diff --git a/examples/browser-vite/src/index.js b/examples/browser-vite/src/index.js index b72e183b..ace4bd98 100644 --- a/examples/browser-vite/src/index.js +++ b/examples/browser-vite/src/index.js @@ -47,10 +47,13 @@ const App = () => { } const cat = async (cid) => { - const content = [] + const decoder = new TextDecoder() + let content = '' - for await (const chunk of ipfs.cat(cid)) { - content.push(chunk) + for await (const chunk of ipfs.cat(file.cid)) { + content += decoder.decode(chunk, { + stream: true + }) } return content diff --git a/examples/types-use-ipfs-from-ts/src/main.ts b/examples/types-use-ipfs-from-ts/src/main.ts index 1fbebcdb..b93774ab 100644 --- a/examples/types-use-ipfs-from-ts/src/main.ts +++ b/examples/types-use-ipfs-from-ts/src/main.ts @@ -28,8 +28,11 @@ export default async function main() { const readFile = async (ipfs: IPFS, cid: CID): Promise => { const decoder = new TextDecoder() let content = '' + for await (const chunk of ipfs.cat(cid)) { - content += decoder.decode(chunk) + content += decoder.decode(chunk, { + stream: true + }) } return content diff --git a/examples/types-use-ipfs-from-typed-js/src/main.js b/examples/types-use-ipfs-from-typed-js/src/main.js index 82cacf4d..7dbac55c 100644 --- a/examples/types-use-ipfs-from-typed-js/src/main.js +++ b/examples/types-use-ipfs-from-typed-js/src/main.js @@ -35,11 +35,15 @@ async function main () { * @returns {Promise} */ const readFile = async (ipfs, cid) => { - const decoder = new TextDecoder() + const decoder = new TextDecoder() let content = '' + for await (const chunk of ipfs.cat(cid)) { - content += decoder.decode(chunk) + content += decoder.decode(chunk, { + stream: true + }) } + return content } From ecabc54e32e43086ebe6885e4b95b563e1feff41 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 7 Sep 2022 16:53:44 +0100 Subject: [PATCH 5/8] chore: fix test --- examples/browser-webpack/src/app.js | 9 ++++++--- examples/ipfs-101/README.md | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/examples/browser-webpack/src/app.js b/examples/browser-webpack/src/app.js index 98b7d0c8..4b2e154c 100644 --- a/examples/browser-webpack/src/app.js +++ b/examples/browser-webpack/src/app.js @@ -58,13 +58,16 @@ function App() { showStatus(`Added to ${file.cid}`, COLORS.success, file.cid) showStatus('Reading file...', COLORS.active) - const text = [] + const decoder = new TextDecoder() + let text = '' for await (const chunk of node.cat(file.cid)) { - text.push(chunk) + text += decoder.decode(chunk, { + stream: true + }) } - showStatus(`\u2514\u2500 ${file.path} ${text.toString()}`) + showStatus(`\u2514\u2500 ${file.path} ${text}`) showStatus(`Preview: https://ipfs.io/ipfs/${file.cid}`, COLORS.success) } diff --git a/examples/ipfs-101/README.md b/examples/ipfs-101/README.md index f01d66d9..67a87108 100644 --- a/examples/ipfs-101/README.md +++ b/examples/ipfs-101/README.md @@ -164,12 +164,16 @@ async function main() { console.log("Added file:", fileAdded.path, fileAdded.cid); - const chunks = []; + const decoder = new TextDecoder() + let text = '' + for await (const chunk of node.cat(fileAdded.cid)) { - chunks.push(chunk); + text += decoder.decode(chunk, { + stream: true + }) } - console.log("Added file contents:", uint8ArrayConcat(chunks).toString()); + console.log("Added file contents:", text); } main(); From afdecf0cfdd5d34bc5fc5fdfa3c77bb56b6fd55c Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 7 Sep 2022 17:22:34 +0100 Subject: [PATCH 6/8] chore: fix vite test --- examples/browser-vite/package.json | 2 +- examples/browser-vite/src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/browser-vite/package.json b/examples/browser-vite/package.json index afab9c96..894e3030 100644 --- a/examples/browser-vite/package.json +++ b/examples/browser-vite/package.json @@ -1,5 +1,5 @@ { - "name": "example-browser-vide", + "name": "example-browser-vite", "version": "1.0.0", "private": true, "type": "module", diff --git a/examples/browser-vite/src/index.js b/examples/browser-vite/src/index.js index ace4bd98..7e338590 100644 --- a/examples/browser-vite/src/index.js +++ b/examples/browser-vite/src/index.js @@ -50,7 +50,7 @@ const App = () => { const decoder = new TextDecoder() let content = '' - for await (const chunk of ipfs.cat(file.cid)) { + for await (const chunk of ipfs.cat(cid)) { content += decoder.decode(chunk, { stream: true }) From 96a461ecd95f6582b05c3f3c865c712f6ccca269 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 7 Sep 2022 17:29:12 +0100 Subject: [PATCH 7/8] chore: fix browser pubsub test --- examples/http-client-browser-pubsub/tests/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/http-client-browser-pubsub/tests/test.js b/examples/http-client-browser-pubsub/tests/test.js index 2e18b413..93d6692d 100644 --- a/examples/http-client-browser-pubsub/tests/test.js +++ b/examples/http-client-browser-pubsub/tests/test.js @@ -94,7 +94,7 @@ play.describe('http client pubsub:', () => { console.info(m._peerId.agentVersion) return m._peerId.agentVersion.includes("js-ipfs") }) - const goDaemon = daemons.find(m => m._peerId.agentVersion.includes("go-ipfs")) + const goDaemon = daemons.find(m => m._peerId.agentVersion.includes("kubo")) const goAddress = goDaemon.apiAddr.toString(); const jsAddress = jsDaemon.apiAddr.toString() From 6ced9a6a8fe2805a9b68d396d15957546ecdb275 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 8 Sep 2022 08:16:00 +0100 Subject: [PATCH 8/8] chore: increase timeout for slow test --- examples/browser-exchange-files/tests/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/browser-exchange-files/tests/test.js b/examples/browser-exchange-files/tests/test.js index 3c3d07de..8a65ce12 100644 --- a/examples/browser-exchange-files/tests/test.js +++ b/examples/browser-exchange-files/tests/test.js @@ -44,7 +44,7 @@ const play = test.extend({ ) }); -test.setTimeout(1000 * 60 * 2); +test.setTimeout(1000 * 60 * 10); play.describe('upload file using http client: ', () => { // DOM