Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit b2fd458

Browse files
fix: update vite example (#431)
Fixes: #449 Co-authored-by: achingbrain <[email protected]>
1 parent 428ddec commit b2fd458

File tree

55 files changed

+459
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+459
-159
lines changed

examples/browser-add-readable-stream/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"browserslist": "last 1 Chrome version",
1717
"dependencies": {
18-
"ipfs-core": "^0.15.2"
18+
"ipfs-core": "^0.16.0"
1919
},
2020
"devDependencies": {
2121
"@babel/core": "^7.14.8",
@@ -25,6 +25,6 @@
2525
"rimraf": "^3.0.2",
2626
"test-util-ipfs-example": "^1.0.2",
2727
"util": "^0.12.4",
28-
"vite": "^3.0.0-beta.1"
28+
"vite": "^3.1.0"
2929
}
3030
}

examples/browser-add-readable-stream/src/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,16 @@ const main = async () => {
159159
DOM.content.innerHTML = '';
160160

161161
for await (const file of fileList) {
162-
const content = [];
162+
const decoder = new TextDecoder()
163+
let content = ''
163164

164165
for await (const chunk of ipfs.cat(file.cid)) {
165-
content.push(chunk)
166+
content += decoder.decode(chunk, {
167+
stream: true
168+
})
166169
}
167170

168-
showStatus(`\u2514\u2500 ${file.name} ${file.path} ${content.toString()}`)
171+
showStatus(`\u2514\u2500 ${file.name} ${file.path} ${content}`)
169172
showStatus(`Preview: https://ipfs.io/ipfs/${file.path}`, COLORS.success)
170173
addFileDOM(file.name, content, DOM.content, false)
171174
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
export default {
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig({
24
build: {
3-
target: 'esnext',
4-
minify: false
5+
target: 'es2020',
6+
minify: false,
7+
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
8+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
9+
commonjsOptions: {
10+
include: []
11+
}
512
},
613
define: {
714
'process.env.NODE_DEBUG': 'false',
815
'global': 'globalThis'
16+
},
17+
optimizeDeps: {
18+
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
19+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
20+
disabled: false,
21+
22+
// target: es2020 added as workaround to make big ints work
23+
// - should be removable with vite 4
24+
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
25+
esbuildOptions: {
26+
target: 'es2020'
27+
}
928
}
10-
}
29+
})

examples/browser-angular/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"@angular/router": "^13.2.0",
2424
"@libp2p/interface-peer-id": "^1.0.2",
2525
"global": "^4.4.0",
26-
"ipfs-core": "^0.15.2",
27-
"ipfs-core-types": "^0.11.0",
26+
"ipfs-core": "^0.16.0",
27+
"ipfs-core-types": "^0.12.0",
2828
"rxjs": "^7.5.2",
2929
"tslib": "^2.3.0",
3030
"zone.js": "~0.11.4"

examples/browser-create-react-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@testing-library/react": "^12.1.2",
3838
"@testing-library/user-event": "^13.5.0",
3939
"dot-prop": "^7.1.1",
40-
"ipfs-core": "^0.15.2",
40+
"ipfs-core": "^0.16.0",
4141
"ipfs-css": "^1.3.0",
4242
"react": "^17.0.2",
4343
"react-dom": "^17.0.2",

examples/browser-exchange-files/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
},
1414
"browserslist": "last 1 Chrome version",
1515
"dependencies": {
16-
"@libp2p/websockets": "^1.0.8",
17-
"ipfs-core": "^0.15.2",
16+
"@libp2p/websockets": "^3.0.3",
17+
"ipfs-core": "^0.16.0",
1818
"it-all": "^1.0.4",
1919
"uint8arrays": "^3.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/core": "^7.14.8",
2323
"@libp2p/webrtc-star-signalling-server": "^2.0.1",
2424
"@playwright/test": "^1.12.3",
25-
"ipfs": "^0.63.3",
26-
"ipfs-core-types": "^0.11.0",
27-
"ipfs-http-client": "^57.0.1",
25+
"ipfs": "^0.64.0",
26+
"ipfs-core-types": "^0.12.0",
27+
"ipfs-http-client": "^58.0.0",
2828
"playwright": "^1.12.3",
2929
"process": "^0.11.10",
3030
"rimraf": "^3.0.2",
3131
"test-util-ipfs-example": "^1.0.2",
3232
"util": "^0.12.4",
33-
"vite": "^3.0.0-beta.1"
33+
"vite": "^3.1.0"
3434
}
3535
}

examples/browser-exchange-files/tests/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const play = test.extend({
4444
)
4545
});
4646

47-
test.setTimeout(1000 * 60 * 2);
47+
test.setTimeout(1000 * 60 * 10);
4848

4949
play.describe('upload file using http client: ', () => {
5050
// DOM
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
export default {
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig({
24
build: {
3-
target: 'esnext',
4-
minify: false
5+
target: 'es2020',
6+
minify: false,
7+
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
8+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
9+
commonjsOptions: {
10+
include: []
11+
}
512
},
613
define: {
714
'process.env.NODE_DEBUG': 'false',
815
'global': 'globalThis'
16+
},
17+
optimizeDeps: {
18+
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
19+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
20+
disabled: false,
21+
22+
// target: es2020 added as workaround to make big ints work
23+
// - should be removable with vite 4
24+
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
25+
esbuildOptions: {
26+
target: 'es2020'
27+
}
928
}
10-
}
29+
})

examples/browser-ipns-publish/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@
2323
},
2424
"browserslist": "last 1 Chrome version",
2525
"dependencies": {
26-
"@libp2p/websockets": "^1.0.8",
27-
"ipfs-core": "^0.15.2",
28-
"ipfs-http-client": "^57.0.1",
26+
"@libp2p/websockets": "^3.0.3",
27+
"ipfs-core": "^0.16.0",
28+
"ipfs-http-client": "^58.0.0",
2929
"ipfs-utils": "^9.0.6",
30-
"ipns": "^1.0.2",
30+
"ipns": "^2.0.3",
3131
"it-last": "^1.0.4",
3232
"multiformats": "^9.6.5",
33-
"p-retry": "^4.2.0",
33+
"p-retry": "^5.1.1",
3434
"uint8arrays": "^3.0.0"
3535
},
3636
"devDependencies": {
3737
"@babel/core": "^7.14.8",
3838
"@playwright/test": "^1.12.3",
3939
"delay": "^5.0.0",
4040
"execa": "^6.0.0",
41-
"go-ipfs": "^0.11.0",
42-
"ipfsd-ctl": "^11.0.1",
41+
"go-ipfs": "^0.15.0",
42+
"ipfsd-ctl": "^12.0.2",
4343
"playwright": "^1.12.3",
4444
"process": "^0.11.10",
4545
"rimraf": "^3.0.2",
4646
"test-util-ipfs-example": "^1.0.2",
4747
"util": "^0.12.4",
48-
"vite": "^3.0.0-beta.1"
48+
"vite": "^3.1.0"
4949
}
5050
}
+23-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
export default {
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig({
24
build: {
3-
target: 'esnext',
4-
minify: false
5+
target: 'es2020',
6+
minify: false,
7+
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
8+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
9+
commonjsOptions: {
10+
include: []
11+
}
512
},
613
define: {
714
'process.env.NODE_DEBUG': 'false',
815
'global': 'globalThis'
16+
},
17+
optimizeDeps: {
18+
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
19+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
20+
disabled: false,
21+
22+
// target: es2020 added as workaround to make big ints work
23+
// - should be removable with vite 4
24+
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
25+
esbuildOptions: {
26+
target: 'es2020'
27+
}
928
}
10-
}
29+
})

examples/browser-lit/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"browserslist": "last 1 Chrome version",
1717
"dependencies": {
18-
"ipfs-core": "^0.15.2",
18+
"ipfs-core": "^0.16.0",
1919
"ipfs-css": "^1.3.0",
2020
"lit": "^2.0.2",
2121
"tachyons": "^4.12.0"
@@ -28,6 +28,6 @@
2828
"rimraf": "^3.0.2",
2929
"test-util-ipfs-example": "^1.0.2",
3030
"util": "^0.12.4",
31-
"vite": "^3.0.0-beta.1"
31+
"vite": "^3.1.0"
3232
}
3333
}

examples/browser-lit/vite.config.js

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
export default {
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig({
24
build: {
3-
target: 'esnext',
4-
minify: false
5+
target: 'es2020',
6+
minify: false,
7+
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
8+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
9+
commonjsOptions: {
10+
include: []
11+
}
512
},
613
define: {
714
'process.env.NODE_DEBUG': 'false',
815
'global': 'globalThis'
16+
},
17+
optimizeDeps: {
18+
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
19+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
20+
disabled: false,
21+
22+
// target: es2020 added as workaround to make big ints work
23+
// - should be removable with vite 4
24+
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
25+
esbuildOptions: {
26+
target: 'es2020'
27+
}
928
}
10-
}
29+
})

examples/browser-mfs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"browserslist": "last 1 Chrome version",
1717
"dependencies": {
18-
"ipfs-core": "^0.15.2",
18+
"ipfs-core": "^0.16.0",
1919
"mime-sniffer": "~0.0.3"
2020
},
2121
"devDependencies": {
@@ -26,6 +26,6 @@
2626
"rimraf": "^3.0.2",
2727
"test-util-ipfs-example": "^1.0.2",
2828
"util": "^0.12.4",
29-
"vite": "^3.0.0-beta.1"
29+
"vite": "^3.1.0"
3030
}
3131
}

examples/browser-mfs/vite.config.js

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
export default {
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig({
24
build: {
3-
target: 'esnext',
4-
minify: false
5+
target: 'es2020',
6+
minify: false,
7+
// disable @rollup/plugin-commonjs https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
8+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
9+
commonjsOptions: {
10+
include: []
11+
}
512
},
613
define: {
714
'process.env.NODE_DEBUG': 'false',
815
'global': 'globalThis'
16+
},
17+
optimizeDeps: {
18+
// enable esbuild dep optimization during build https://github.com/vitejs/vite/issues/9703#issuecomment-1216662109
19+
// should be removable with vite 4 https://vitejs.dev/blog/announcing-vite3.html#esbuild-deps-optimization-at-build-time-experimental
20+
disabled: false,
21+
22+
// target: es2020 added as workaround to make big ints work
23+
// - should be removable with vite 4
24+
// https://github.com/vitejs/vite/issues/9062#issuecomment-1182818044
25+
esbuildOptions: {
26+
target: 'es2020'
27+
}
928
}
10-
}
29+
})

examples/browser-nextjs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"test": "npm run build && playwright test tests"
1414
},
1515
"dependencies": {
16-
"ipfs-core": "^0.15.2",
16+
"ipfs-core": "^0.16.0",
1717
"next": "^12.0.7",
1818
"react": "^17.0.2",
1919
"react-dom": "^17.0.2"

examples/browser-readablestream/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"browserslist": "last 1 Chrome version",
1717
"dependencies": {
1818
"buffer": "^6.0.3",
19-
"ipfs-core": "^0.15.2",
19+
"ipfs-core": "^0.16.0",
2020
"it-to-stream": "^1.0.0",
2121
"videostream": "^3.2.0"
2222
},
@@ -31,6 +31,6 @@
3131
"rimraf": "^3.0.2",
3232
"test-util-ipfs-example": "^1.0.2",
3333
"util": "^0.12.4",
34-
"vite": "^3.0.0-beta.1"
34+
"vite": "^3.1.0"
3535
}
3636
}

0 commit comments

Comments
 (0)