Skip to content

Commit

Permalink
Switch to min Node v16.13, and use undici and native streams
Browse files Browse the repository at this point in the history
  • Loading branch information
jplhomer committed Apr 5, 2022
1 parent 13376ef commit 2976ae8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 24 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"packages/playground/*"
],
"engines": {
"node": ">=14"
"node": ">=16.13"
},
"scripts": {
"dev": "cross-env LOCAL_DEV=true yarn turbo run dev --parallel",
Expand Down Expand Up @@ -40,7 +40,6 @@
"@types/faker": "^5.5.7",
"@types/fs-extra": "^9.0.12",
"@types/jest": "^26.0.22",
"@types/node-fetch": "^2.5.9",
"@typescript-eslint/parser": "^4.20.0",
"abort-controller": "^3.0.0",
"alex": "^9.1.0",
Expand All @@ -57,7 +56,6 @@
"glob": "^7.2.0",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"node-fetch": "^2.6.7",
"npm-run-all": "^4.1.5",
"playwright-chromium": "^1.13.0",
"prettier": "^2.2.1",
Expand All @@ -68,6 +66,7 @@
"turbo": "^1.1.2",
"type-fest": "^2.12.0",
"typescript": "^4.6.2",
"undici": "^5.0.0",
"vite": "^2.8.0",
"yorkie": "^2.0.0"
},
Expand Down
8 changes: 3 additions & 5 deletions packages/hydrogen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@shopify:registry": "https://registry.npmjs.org"
},
"engines": {
"node": ">=14"
"node": ">=16.13"
},
"version": "0.13.2",
"description": "Modern custom Shopify storefronts",
Expand Down Expand Up @@ -67,7 +67,6 @@
"@types/connect": "^3.4.34",
"@types/graphql": "^14.5.0",
"@types/node": "^16.11.7",
"@types/node-fetch": "^2.5.9",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3",
"@types/ws": "^8.2.0",
Expand Down Expand Up @@ -109,11 +108,10 @@
"history": "^5.3.0",
"kolorist": "^1.5.1",
"magic-string": "^0.26.1",
"node-fetch": "^2.6.7",
"path-to-regexp": "^6.2.0",
"react-error-boundary": "^3.1.3",
"react-helmet-async": "^1.2.3",
"vite-plugin-inspect": "^0.3.6",
"web-streams-polyfill": "^3.2.0"
"undici": "^5.0.0",
"vite-plugin-inspect": "^0.3.6"
}
}
8 changes: 2 additions & 6 deletions packages/hydrogen/src/utilities/web-api-polyfill.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import fetch, {Request, Response, Headers} from 'node-fetch';
import {fetch, Request, Response, Headers} from 'undici';
import AbortController from 'abort-controller';
import {
ReadableStream,
WritableStream,
TransformStream,
} from 'web-streams-polyfill/ponyfill';
import {ReadableStream, WritableStream, TransformStream} from 'node:stream/web';

if (!globalThis.fetch) {
Object.assign(globalThis, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {RSC_PATHNAME} from '../../../hydrogen/src/constants';
import fetch from 'node-fetch';
import {fetch} from 'undici';
import {resolve} from 'path';

import {edit, untilUpdated} from '../../utilities';
Expand Down
2 changes: 1 addition & 1 deletion scripts/polyfillWebRuntime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fetch from 'node-fetch';
import {fetch} from 'undici';
import AbortController from 'abort-controller';

// Note: globalThis.fetch is already polyfilled by Jest with DOM utilities
Expand Down
13 changes: 5 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2499,14 +2499,6 @@
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197"
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==

"@types/node-fetch@^2.5.9":
version "2.5.12"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66"
integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==
dependencies:
"@types/node" "*"
form-data "^3.0.0"

"@types/node@*":
version "16.11.12"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.12.tgz#ac7fb693ac587ee182c3780c26eb65546a1a3c10"
Expand Down Expand Up @@ -11890,6 +11882,11 @@ undici@^4.9.3:
resolved "https://registry.yarnpkg.com/undici/-/undici-4.14.1.tgz#7633b143a8a10d6d63335e00511d071e8d52a1d9"
integrity sha512-WJ+g+XqiZcATcBaUeluCajqy4pEDcQfK1vy+Fo+bC4/mqXI9IIQD/XWHLS70fkGUT6P52Drm7IFslO651OdLPQ==

undici@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/undici/-/undici-5.0.0.tgz#3c1e08c7f0df90c485d5d8dbb0517e11e34f2090"
integrity sha512-VhUpiZ3No1DOPPQVQnsDZyfcbTTcHdcgWej1PdFnSvOeJmOVDgiOHkunJmBLfmjt4CqgPQddPVjSWW0dsTs5Yg==

unherit@^1.0.4:
version "1.1.3"
resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.3.tgz#6c9b503f2b41b262330c80e91c8614abdaa69c22"
Expand Down

0 comments on commit 2976ae8

Please sign in to comment.