From b6435f9c5e11d33de63ed99849fce6de7f356ec0 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 13 May 2022 14:19:01 +0800 Subject: [PATCH 1/3] chore: migarte to `node-fetch-native` --- .github/renovate.json5 | 1 - package.json | 2 +- .../__test__/optimize-missing-deps.spec.ts | 2 +- playground/ssr-html/__tests__/ssr-html.spec.ts | 2 +- playground/ssr-pug/__tests__/ssr-pug.spec.ts | 2 +- playground/ssr-react/__tests__/ssr-react.spec.ts | 2 +- playground/ssr-vue/__tests__/ssr-vue.spec.ts | 2 +- pnpm-lock.yaml | 12 ++++++++++-- 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 17898db2741284..1ddfab4e2e41ad 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -27,7 +27,6 @@ "dotenv-expand", // `dotenv-expand:6.0.0+` has breaking changes (#6858) // ESM Only => https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm - "node-fetch", "periscopic", "strip-ansi" ] diff --git a/package.json b/package.json index dd19523dfdc497..b9889c29509c9a 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "kill-port": "^1.6.1", "lint-staged": "^12.4.1", "minimist": "^1.2.6", - "node-fetch": "^2.6.7", + "node-fetch-native": "^0.1.3", "npm-run-all": "^4.1.5", "picocolors": "^1.0.0", "playwright-chromium": "^1.21.1", diff --git a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts index d6e2403761268a..5cab874e29fb58 100644 --- a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts +++ b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts @@ -1,5 +1,5 @@ import { port } from './serve' -import fetch from 'node-fetch' +import fetch from 'node-fetch-native' import { page, untilUpdated } from '~utils' import { platform } from 'os' diff --git a/playground/ssr-html/__tests__/ssr-html.spec.ts b/playground/ssr-html/__tests__/ssr-html.spec.ts index bcf66c8f5ad128..1529972f882264 100644 --- a/playground/ssr-html/__tests__/ssr-html.spec.ts +++ b/playground/ssr-html/__tests__/ssr-html.spec.ts @@ -1,4 +1,4 @@ -import fetch from 'node-fetch' +import fetch from 'node-fetch-native' import { port } from './serve' import { page } from '~utils' diff --git a/playground/ssr-pug/__tests__/ssr-pug.spec.ts b/playground/ssr-pug/__tests__/ssr-pug.spec.ts index bcf66c8f5ad128..1529972f882264 100644 --- a/playground/ssr-pug/__tests__/ssr-pug.spec.ts +++ b/playground/ssr-pug/__tests__/ssr-pug.spec.ts @@ -1,4 +1,4 @@ -import fetch from 'node-fetch' +import fetch from 'node-fetch-native' import { port } from './serve' import { page } from '~utils' diff --git a/playground/ssr-react/__tests__/ssr-react.spec.ts b/playground/ssr-react/__tests__/ssr-react.spec.ts index 62bb7d2014f770..927a585a4cad95 100644 --- a/playground/ssr-react/__tests__/ssr-react.spec.ts +++ b/playground/ssr-react/__tests__/ssr-react.spec.ts @@ -1,4 +1,4 @@ -import fetch from 'node-fetch' +import fetch from 'node-fetch-native' import { port } from './serve' import { browserLogs, editFile, page, untilUpdated } from '~utils' diff --git a/playground/ssr-vue/__tests__/ssr-vue.spec.ts b/playground/ssr-vue/__tests__/ssr-vue.spec.ts index c58cea4cd13e59..921fee3f263319 100644 --- a/playground/ssr-vue/__tests__/ssr-vue.spec.ts +++ b/playground/ssr-vue/__tests__/ssr-vue.spec.ts @@ -1,5 +1,5 @@ import { resolve } from 'path' -import fetch from 'node-fetch' +import fetch from 'node-fetch-native' import { port } from './serve' import { browserLogs, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 00d6847a132bf4..4689ed8694c557 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,7 +45,7 @@ importers: kill-port: ^1.6.1 lint-staged: ^12.4.1 minimist: ^1.2.6 - node-fetch: ^2.6.7 + node-fetch-native: ^0.1.3 npm-run-all: ^4.1.5 picocolors: ^1.0.0 playwright-chromium: ^1.21.1 @@ -99,7 +99,7 @@ importers: kill-port: 1.6.1 lint-staged: 12.4.1 minimist: 1.2.6 - node-fetch: 2.6.7 + node-fetch-native: 0.1.3 npm-run-all: 4.1.5 picocolors: 1.0.0 playwright-chromium: 1.21.1 @@ -5934,6 +5934,10 @@ packages: lodash: 4.17.21 dev: false + /node-fetch-native/0.1.3: + resolution: {integrity: sha512-Jf1IQZdovUIv9E+5avmN6Sf+bND+rnMlODnBQhdE2VRyuWP9WgqZb/KEgPekh19DAN1X2C4vbS1VCOaz2OH19g==} + dev: true + /node-fetch/2.6.7: resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} engines: {node: 4.x || >=6.0.0} @@ -5944,6 +5948,7 @@ packages: optional: true dependencies: whatwg-url: 5.0.0 + dev: false /node-forge/0.10.0: resolution: {integrity: sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==} @@ -7935,6 +7940,7 @@ packages: /tr46/0.0.3: resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=} + dev: false /tr46/1.0.1: resolution: {integrity: sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=} @@ -8371,6 +8377,7 @@ packages: /webidl-conversions/3.0.1: resolution: {integrity: sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=} + dev: false /webidl-conversions/4.0.2: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} @@ -8386,6 +8393,7 @@ packages: dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 + dev: false /whatwg-url/7.1.0: resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} From 79c8fb0231268b7af63b82eb1f8508d1273e1535 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 17 May 2022 18:25:12 +0800 Subject: [PATCH 2/3] feat: use undici --- package.json | 2 +- .../__test__/optimize-missing-deps.spec.ts | 4 ++-- playground/ssr-html/__tests__/ssr-html.spec.ts | 2 +- playground/ssr-pug/__tests__/ssr-pug.spec.ts | 2 +- playground/ssr-react/__tests__/ssr-react.spec.ts | 2 +- playground/ssr-vue/__tests__/ssr-vue.spec.ts | 2 +- pnpm-lock.yaml | 13 +++++++------ 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index b9889c29509c9a..841d218a662bc9 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "kill-port": "^1.6.1", "lint-staged": "^12.4.1", "minimist": "^1.2.6", - "node-fetch-native": "^0.1.3", "npm-run-all": "^4.1.5", "picocolors": "^1.0.0", "playwright-chromium": "^1.21.1", @@ -82,6 +81,7 @@ "ts-node": "^10.7.0", "typescript": "^4.6.4", "unbuild": "^0.7.4", + "undici": "^5.2.0", "vite": "workspace:*", "vitepress": "^0.22.4", "vitest": "^0.12.4", diff --git a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts index 5cab874e29fb58..d90ebd5a7d09b4 100644 --- a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts +++ b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts @@ -1,7 +1,7 @@ +import { platform } from 'os' +import { fetch } from 'undici' import { port } from './serve' -import fetch from 'node-fetch-native' import { page, untilUpdated } from '~utils' -import { platform } from 'os' const url = `http://localhost:${port}/` diff --git a/playground/ssr-html/__tests__/ssr-html.spec.ts b/playground/ssr-html/__tests__/ssr-html.spec.ts index 1529972f882264..9b08c06228ab10 100644 --- a/playground/ssr-html/__tests__/ssr-html.spec.ts +++ b/playground/ssr-html/__tests__/ssr-html.spec.ts @@ -1,4 +1,4 @@ -import fetch from 'node-fetch-native' +import { fetch } from 'undici' import { port } from './serve' import { page } from '~utils' diff --git a/playground/ssr-pug/__tests__/ssr-pug.spec.ts b/playground/ssr-pug/__tests__/ssr-pug.spec.ts index 1529972f882264..9b08c06228ab10 100644 --- a/playground/ssr-pug/__tests__/ssr-pug.spec.ts +++ b/playground/ssr-pug/__tests__/ssr-pug.spec.ts @@ -1,4 +1,4 @@ -import fetch from 'node-fetch-native' +import { fetch } from 'undici' import { port } from './serve' import { page } from '~utils' diff --git a/playground/ssr-react/__tests__/ssr-react.spec.ts b/playground/ssr-react/__tests__/ssr-react.spec.ts index 927a585a4cad95..c76c2014d1eab7 100644 --- a/playground/ssr-react/__tests__/ssr-react.spec.ts +++ b/playground/ssr-react/__tests__/ssr-react.spec.ts @@ -1,4 +1,4 @@ -import fetch from 'node-fetch-native' +import { fetch } from 'undici' import { port } from './serve' import { browserLogs, editFile, page, untilUpdated } from '~utils' diff --git a/playground/ssr-vue/__tests__/ssr-vue.spec.ts b/playground/ssr-vue/__tests__/ssr-vue.spec.ts index 921fee3f263319..2764034a314fff 100644 --- a/playground/ssr-vue/__tests__/ssr-vue.spec.ts +++ b/playground/ssr-vue/__tests__/ssr-vue.spec.ts @@ -1,5 +1,5 @@ import { resolve } from 'path' -import fetch from 'node-fetch-native' +import { fetch } from 'undici' import { port } from './serve' import { browserLogs, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4689ed8694c557..0874a54cb9d245 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,7 +45,6 @@ importers: kill-port: ^1.6.1 lint-staged: ^12.4.1 minimist: ^1.2.6 - node-fetch-native: ^0.1.3 npm-run-all: ^4.1.5 picocolors: ^1.0.0 playwright-chromium: ^1.21.1 @@ -59,6 +58,7 @@ importers: ts-node: ^10.7.0 typescript: ^4.6.4 unbuild: ^0.7.4 + undici: ^5.2.0 vite: workspace:* vitepress: ^0.22.4 vitest: ^0.12.4 @@ -99,7 +99,6 @@ importers: kill-port: 1.6.1 lint-staged: 12.4.1 minimist: 1.2.6 - node-fetch-native: 0.1.3 npm-run-all: 4.1.5 picocolors: 1.0.0 playwright-chromium: 1.21.1 @@ -113,6 +112,7 @@ importers: ts-node: 10.7.0_sm5zkxj4s52nbddwl76qwfh6ya typescript: 4.6.4 unbuild: 0.7.4 + undici: 5.2.0 vite: link:packages/vite vitepress: 0.22.4 vitest: 0.12.4 @@ -5934,10 +5934,6 @@ packages: lodash: 4.17.21 dev: false - /node-fetch-native/0.1.3: - resolution: {integrity: sha512-Jf1IQZdovUIv9E+5avmN6Sf+bND+rnMlODnBQhdE2VRyuWP9WgqZb/KEgPekh19DAN1X2C4vbS1VCOaz2OH19g==} - dev: true - /node-fetch/2.6.7: resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} engines: {node: 4.x || >=6.0.0} @@ -8197,6 +8193,11 @@ packages: - supports-color dev: true + /undici/5.2.0: + resolution: {integrity: sha512-XY6+NS3WH9b3TKOHeNz2CjR+qrVz/k4fO9g3etPpLozRvULoQmZ1+dk9JbIz40ehn27xzFk4jYVU2MU3Nle62A==} + engines: {node: '>=12.18'} + dev: true + /universalify/0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} From 10b31628cc4d40cf2c1db479ff8e48b6ae2601ac Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 17 May 2022 18:56:10 +0800 Subject: [PATCH 3/3] Revert "feat: use undici" This reverts commit 79c8fb0231268b7af63b82eb1f8508d1273e1535. --- package.json | 2 +- .../__test__/optimize-missing-deps.spec.ts | 4 ++-- playground/ssr-html/__tests__/ssr-html.spec.ts | 2 +- playground/ssr-pug/__tests__/ssr-pug.spec.ts | 2 +- playground/ssr-react/__tests__/ssr-react.spec.ts | 2 +- playground/ssr-vue/__tests__/ssr-vue.spec.ts | 2 +- pnpm-lock.yaml | 13 ++++++------- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 841d218a662bc9..b9889c29509c9a 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "kill-port": "^1.6.1", "lint-staged": "^12.4.1", "minimist": "^1.2.6", + "node-fetch-native": "^0.1.3", "npm-run-all": "^4.1.5", "picocolors": "^1.0.0", "playwright-chromium": "^1.21.1", @@ -81,7 +82,6 @@ "ts-node": "^10.7.0", "typescript": "^4.6.4", "unbuild": "^0.7.4", - "undici": "^5.2.0", "vite": "workspace:*", "vitepress": "^0.22.4", "vitest": "^0.12.4", diff --git a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts index d90ebd5a7d09b4..5cab874e29fb58 100644 --- a/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts +++ b/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts @@ -1,7 +1,7 @@ -import { platform } from 'os' -import { fetch } from 'undici' import { port } from './serve' +import fetch from 'node-fetch-native' import { page, untilUpdated } from '~utils' +import { platform } from 'os' const url = `http://localhost:${port}/` diff --git a/playground/ssr-html/__tests__/ssr-html.spec.ts b/playground/ssr-html/__tests__/ssr-html.spec.ts index 9b08c06228ab10..1529972f882264 100644 --- a/playground/ssr-html/__tests__/ssr-html.spec.ts +++ b/playground/ssr-html/__tests__/ssr-html.spec.ts @@ -1,4 +1,4 @@ -import { fetch } from 'undici' +import fetch from 'node-fetch-native' import { port } from './serve' import { page } from '~utils' diff --git a/playground/ssr-pug/__tests__/ssr-pug.spec.ts b/playground/ssr-pug/__tests__/ssr-pug.spec.ts index 9b08c06228ab10..1529972f882264 100644 --- a/playground/ssr-pug/__tests__/ssr-pug.spec.ts +++ b/playground/ssr-pug/__tests__/ssr-pug.spec.ts @@ -1,4 +1,4 @@ -import { fetch } from 'undici' +import fetch from 'node-fetch-native' import { port } from './serve' import { page } from '~utils' diff --git a/playground/ssr-react/__tests__/ssr-react.spec.ts b/playground/ssr-react/__tests__/ssr-react.spec.ts index c76c2014d1eab7..927a585a4cad95 100644 --- a/playground/ssr-react/__tests__/ssr-react.spec.ts +++ b/playground/ssr-react/__tests__/ssr-react.spec.ts @@ -1,4 +1,4 @@ -import { fetch } from 'undici' +import fetch from 'node-fetch-native' import { port } from './serve' import { browserLogs, editFile, page, untilUpdated } from '~utils' diff --git a/playground/ssr-vue/__tests__/ssr-vue.spec.ts b/playground/ssr-vue/__tests__/ssr-vue.spec.ts index 2764034a314fff..921fee3f263319 100644 --- a/playground/ssr-vue/__tests__/ssr-vue.spec.ts +++ b/playground/ssr-vue/__tests__/ssr-vue.spec.ts @@ -1,5 +1,5 @@ import { resolve } from 'path' -import { fetch } from 'undici' +import fetch from 'node-fetch-native' import { port } from './serve' import { browserLogs, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0874a54cb9d245..4689ed8694c557 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,7 @@ importers: kill-port: ^1.6.1 lint-staged: ^12.4.1 minimist: ^1.2.6 + node-fetch-native: ^0.1.3 npm-run-all: ^4.1.5 picocolors: ^1.0.0 playwright-chromium: ^1.21.1 @@ -58,7 +59,6 @@ importers: ts-node: ^10.7.0 typescript: ^4.6.4 unbuild: ^0.7.4 - undici: ^5.2.0 vite: workspace:* vitepress: ^0.22.4 vitest: ^0.12.4 @@ -99,6 +99,7 @@ importers: kill-port: 1.6.1 lint-staged: 12.4.1 minimist: 1.2.6 + node-fetch-native: 0.1.3 npm-run-all: 4.1.5 picocolors: 1.0.0 playwright-chromium: 1.21.1 @@ -112,7 +113,6 @@ importers: ts-node: 10.7.0_sm5zkxj4s52nbddwl76qwfh6ya typescript: 4.6.4 unbuild: 0.7.4 - undici: 5.2.0 vite: link:packages/vite vitepress: 0.22.4 vitest: 0.12.4 @@ -5934,6 +5934,10 @@ packages: lodash: 4.17.21 dev: false + /node-fetch-native/0.1.3: + resolution: {integrity: sha512-Jf1IQZdovUIv9E+5avmN6Sf+bND+rnMlODnBQhdE2VRyuWP9WgqZb/KEgPekh19DAN1X2C4vbS1VCOaz2OH19g==} + dev: true + /node-fetch/2.6.7: resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} engines: {node: 4.x || >=6.0.0} @@ -8193,11 +8197,6 @@ packages: - supports-color dev: true - /undici/5.2.0: - resolution: {integrity: sha512-XY6+NS3WH9b3TKOHeNz2CjR+qrVz/k4fO9g3etPpLozRvULoQmZ1+dk9JbIz40ehn27xzFk4jYVU2MU3Nle62A==} - engines: {node: '>=12.18'} - dev: true - /universalify/0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'}