From 4670ed00cb088615091b811b2d48362c0888db43 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Wed, 2 Aug 2023 18:59:17 +0200 Subject: [PATCH 01/38] Apply multiple log replacers instead of only the first match --- packages/cli/src/lib/log.ts | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/lib/log.ts b/packages/cli/src/lib/log.ts index 7fc5c52260..43f3b835ba 100644 --- a/packages/cli/src/lib/log.ts +++ b/packages/cli/src/lib/log.ts @@ -67,10 +67,18 @@ function injectLogReplacer( console[method] = (...args: unknown[]) => { if (debounceMessage(args, debouncer?.(args))) return; - const replacer = messageReplacers.find(([matcher]) => matcher(args))?.[1]; - if (!replacer) return originalConsole[method](...args); + const replacers = messageReplacers.reduce((acc, [matcher, replacer]) => { + if (matcher(args)) acc.push(replacer); + return acc; + }, [] as Replacer[]); + + if (replacers.length === 0) return originalConsole[method](...args); + + const result = replacers.reduce( + (resultArgs, replacer) => resultArgs && replacer(resultArgs), + args as void | string[], + ); - const result = replacer(args); if (result) return originalConsole[method](...result); }; } @@ -123,12 +131,18 @@ export function muteAuthLogs({ process.stdout.write = ((item, cb: any) => { if (typeof item !== 'string') return write(item, cb); - const replacer = messageReplacers.find(([matcher]) => - matcher([item]), - )?.[1]; - if (!replacer) return write(item, cb); + const replacers = messageReplacers.reduce((acc, [matcher, replacer]) => { + if (matcher([item])) acc.push(replacer); + return acc; + }, [] as Replacer[]); + + if (replacers.length === 0) return write(item, cb); + + const result = replacers.reduce( + (resultArgs, replacer) => resultArgs && replacer(resultArgs), + [item] as void | string[], + ); - const result = replacer([item]); if (result) return write(result[0] as string, cb); }) as typeof write; } From 93f7a5a076265f6bbf6b7128ebfd440d7809390d Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Wed, 2 Aug 2023 19:08:51 +0200 Subject: [PATCH 02/38] Basic workerd integration --- package-lock.json | 1702 +++++++-------------- packages/cli/package.json | 3 +- packages/cli/src/commands/hydrogen/dev.ts | 2 + packages/cli/src/lib/mini-oxygen.ts | 207 ++- 4 files changed, 741 insertions(+), 1173 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f1d31cad1..4b69c404e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3381,6 +3381,81 @@ "node": ">= 4.0.0" } }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230724.0.tgz", + "integrity": "sha512-DQmFZWHhs8waQFYRb/Z8QmbitAvBMXnbUMUentp+3lS4eCYI0/iurTaQDiz5+ldUn9FTxD+1XuYZlTHzVNxoHw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20230724.0.tgz", + "integrity": "sha512-C7T0v/lMjEX7c4iROSZKgIF1eGw3+sj/gFpBD6xwxfbIcrKBjncMypeLQNpRTCdBQr1W3sNpg9jagwuVX5ByZQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20230724.0.tgz", + "integrity": "sha512-o0F/hj73UXOQwkPkYqZuIxpjG8gAs2eoAGqxX1HSIYRf7iUhfFcPrupwjqlNqf7Oo1h46M+sClSFjr/ZU/LCjg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20230724.0.tgz", + "integrity": "sha512-UpzCoo7LOuPWxFPw84TZQTPIawIDQNSb3XnC6ffMjUH/FVwHmHdngIFZxW+xjLHKMIzGNAqSn3eRHekKgO3QqA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20230724.0.tgz", + "integrity": "sha512-wVpPNu19fnvgsD8V6NiGPSuET0bzKmgn3wJ6RwAwQA+GQ0hdDIDVYd13aImhgO6jLfQvkduCDxeZluGZ7PPojQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "license": "MIT", @@ -5725,140 +5800,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/@miniflare/cache": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.14.0.tgz", - "integrity": "sha512-0mz0OCzTegiX75uMURLJpDo3DaOCSx9M0gv7NMFWDbK/XrvjoENiBZiKu98UBM5fts0qtK19a+MfB4aT0uBCFg==", - "dependencies": { - "@miniflare/core": "2.14.0", - "@miniflare/shared": "2.14.0", - "http-cache-semantics": "^4.1.0", - "undici": "5.20.0" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@miniflare/core": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.14.0.tgz", - "integrity": "sha512-BjmV/ZDwsKvXnJntYHt3AQgzVKp/5ZzWPpYWoOnUSNxq6nnRCQyvFvjvBZKnhubcmJCLSqegvz0yHejMA90CTA==", - "dependencies": { - "@iarna/toml": "^2.2.5", - "@miniflare/queues": "2.14.0", - "@miniflare/shared": "2.14.0", - "@miniflare/watcher": "2.14.0", - "busboy": "^1.6.0", - "dotenv": "^10.0.0", - "kleur": "^4.1.4", - "set-cookie-parser": "^2.4.8", - "undici": "5.20.0", - "urlpattern-polyfill": "^4.0.3" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@miniflare/core/node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "engines": { - "node": ">=10" - } - }, - "node_modules/@miniflare/queues": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/queues/-/queues-2.14.0.tgz", - "integrity": "sha512-flS4MqlgBKyv6QBqKD0IofjmMDW9wP1prUNQy2wWPih9lA6bFKmml3VdFeDsPnWtE2J67K0vCTf5kj1Q0qdW1w==", - "dependencies": { - "@miniflare/shared": "2.14.0" - }, - "engines": { - "node": ">=16.7" - } - }, - "node_modules/@miniflare/runner-vm": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/runner-vm/-/runner-vm-2.14.0.tgz", - "integrity": "sha512-01CmNzv74u0RZgT/vjV/ggDzECXTG88ZJAKhXyhAx0s2DOLIXzsGHn6pUJIsfPCrtj8nfqtTCp1Vf0UMVWSpmw==", - "dependencies": { - "@miniflare/shared": "2.14.0" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@miniflare/shared": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.14.0.tgz", - "integrity": "sha512-O0jAEdMkp8BzrdFCfMWZu76h4Cq+tt3/oDtcTFgzum3fRW5vUhIi/5f6bfndu6rkGbSlzxwor8CJWpzityXGug==", - "dependencies": { - "@types/better-sqlite3": "^7.6.0", - "kleur": "^4.1.4", - "npx-import": "^1.1.4", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@miniflare/storage-memory": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/storage-memory/-/storage-memory-2.14.0.tgz", - "integrity": "sha512-5aFjEiTSNrHJ+iAiGMCA/TVPnNMrnokG5r0vKrwj4knbf8pisgfP04x18zCgOlG7kaIWNmqdO/vtVT5BIioiSQ==", - "dependencies": { - "@miniflare/shared": "2.14.0" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@miniflare/watcher": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.14.0.tgz", - "integrity": "sha512-O8Abg2eHpGmcZb8WyUaA6Av1Mqt5bSrorzz4CrWwsvJHBdekZPIX0GihC9vn327d/1pKRs81YTiSAfBoSZpVIw==", - "dependencies": { - "@miniflare/shared": "2.14.0" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@miniflare/web-sockets": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/web-sockets/-/web-sockets-2.14.0.tgz", - "integrity": "sha512-lB1CB4rBq0mbCuh55WgIEH4L3c4/i4MNDBfrQL+6r+wGcr/BJUqF8BHpsfAt5yHWUJVtK5mlMeesS/xpg4Ao1w==", - "dependencies": { - "@miniflare/core": "2.14.0", - "@miniflare/shared": "2.14.0", - "undici": "5.20.0", - "ws": "^8.2.2" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/@miniflare/web-sockets/node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "dev": true, @@ -7597,386 +7538,6 @@ "resolved": "packages/hydrogen-react", "link": true }, - "node_modules/@shopify/mini-oxygen": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@shopify/mini-oxygen/-/mini-oxygen-1.7.0.tgz", - "integrity": "sha512-uU9d4OhwepTAtNFTDKXijD5cgGlUQN0cX9n4rY7I8UIg4kNKaV+TvBZB3UwyNloOPOfhaOJf33zRnzHKwHsXEg==", - "dependencies": { - "@miniflare/cache": "^2.14.0", - "@miniflare/core": "^2.14.0", - "@miniflare/queues": "^2.14.0", - "@miniflare/runner-vm": "^2.14.0", - "@miniflare/shared": "^2.14.0", - "@miniflare/storage-memory": "^2.14.0", - "@miniflare/web-sockets": "2.14.0", - "@types/connect": "^3.4.35", - "@types/mime": "^3.0.1", - "body-parser": "1.20.2", - "connect": "^3.7.0", - "eventsource": "^2.0.2", - "fs-extra": "^11.1.0", - "get-port": "^5.1.1", - "inquirer": "^9.0.0", - "mime": "^3.0.0", - "semiver": "^1.1.0", - "source-map-support": "^0.5.21", - "typescript": "^4.7.2" - }, - "bin": { - "oxygen-gen-config": "dist/gen-config.js", - "oxygen-preview": "dist/bootstrap.js" - }, - "engines": { - "node": ">16.7.0" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/ansi-escapes": { - "version": "6.0.0", - "license": "MIT", - "dependencies": { - "type-fest": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/ansi-regex": { - "version": "6.0.1", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/ansi-styles": { - "version": "6.2.1", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/bl": { - "version": "5.1.0", - "license": "MIT", - "dependencies": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/buffer": { - "version": "6.0.3", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/chalk": { - "version": "5.1.2", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/cli-cursor": { - "version": "4.0.0", - "license": "MIT", - "dependencies": { - "restore-cursor": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/cli-width": { - "version": "4.0.0", - "license": "ISC", - "engines": { - "node": ">= 12" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/escape-string-regexp": { - "version": "5.0.0", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/figures": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^5.0.0", - "is-unicode-supported": "^1.2.0" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/fs-extra": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", - "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/inquirer": { - "version": "9.1.4", - "license": "MIT", - "dependencies": { - "ansi-escapes": "^6.0.0", - "chalk": "^5.1.2", - "cli-cursor": "^4.0.0", - "cli-width": "^4.0.0", - "external-editor": "^3.0.3", - "figures": "^5.0.0", - "lodash": "^4.17.21", - "mute-stream": "0.0.8", - "ora": "^6.1.2", - "run-async": "^2.4.0", - "rxjs": "^7.5.7", - "string-width": "^5.1.2", - "strip-ansi": "^7.0.1", - "through": "^2.3.6", - "wrap-ansi": "^8.0.1" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/is-interactive": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/is-unicode-supported": { - "version": "1.3.0", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/log-symbols": { - "version": "5.1.0", - "license": "MIT", - "dependencies": { - "chalk": "^5.0.0", - "is-unicode-supported": "^1.1.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/mimic-fn": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/@shopify/mini-oxygen/node_modules/onetime": { - "version": "5.1.2", - "license": "MIT", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/ora": { - "version": "6.1.2", - "license": "MIT", - "dependencies": { - "bl": "^5.0.0", - "chalk": "^5.0.0", - "cli-cursor": "^4.0.0", - "cli-spinners": "^2.6.1", - "is-interactive": "^2.0.0", - "is-unicode-supported": "^1.1.0", - "log-symbols": "^5.1.0", - "strip-ansi": "^7.0.1", - "wcwidth": "^1.0.1" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/restore-cursor": { - "version": "4.0.0", - "license": "MIT", - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/string-width": { - "version": "5.1.2", - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/strip-ansi": { - "version": "7.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/type-fest": { - "version": "3.1.0", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@shopify/mini-oxygen/node_modules/wrap-ansi": { - "version": "8.0.1", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/@shopify/oxygen-workers-types": { "version": "3.17.2", "dev": true, @@ -8381,14 +7942,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/better-sqlite3": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.4.tgz", - "integrity": "sha512-dzrRZCYPXIXfSR1/surNbJ/grU3scTaygS0OMzjlGf71i9sc2fGyHPXXiXmEvNIoE0cGwsanEFMVJxPXmco9Eg==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/body-parser": { "version": "1.19.2", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", @@ -8442,6 +7995,7 @@ }, "node_modules/@types/connect": { "version": "3.4.35", + "dev": true, "license": "MIT", "dependencies": { "@types/node": "*" @@ -8684,6 +8238,7 @@ }, "node_modules/@types/mime": { "version": "3.0.1", + "dev": true, "license": "MIT" }, "node_modules/@types/minimatch": { @@ -10239,6 +9794,16 @@ "node": ">=4" } }, + "node_modules/better-sqlite3": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.5.0.tgz", + "integrity": "sha512-vbPcv/Hx5WYdyNg/NbcfyaBZyv9s/NVbxb7yCeC5Bq1pVocNxeL2tZmSu3Rlm4IEOTjYdGyzWQgyx0OSdORBzw==", + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.5.0", + "prebuild-install": "^7.1.0" + } + }, "node_modules/big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", @@ -10262,6 +9827,14 @@ "node": ">=8" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bl": { "version": "4.1.0", "license": "MIT", @@ -10547,14 +10120,6 @@ "version": "1.1.2", "license": "MIT" }, - "node_modules/builtins": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", - "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", - "dependencies": { - "semver": "^7.0.0" - } - }, "node_modules/bundle-name": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", @@ -10806,6 +10371,20 @@ "version": "2.4.0", "license": "0BSD" }, + "node_modules/capnp-ts": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", + "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", + "dependencies": { + "debug": "^4.3.1", + "tslib": "^2.2.0" + } + }, + "node_modules/capnp-ts/node_modules/tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + }, "node_modules/cardinal": { "version": "2.1.1", "license": "MIT", @@ -11283,63 +10862,6 @@ "proto-list": "~1.2.1" } }, - "node_modules/connect": { - "version": "3.7.0", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "finalhandler": "1.1.2", - "parseurl": "~1.3.3", - "utils-merge": "1.0.1" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/connect/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/connect/node_modules/finalhandler": { - "version": "1.1.2", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/connect/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/connect/node_modules/on-finished": { - "version": "2.3.0", - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/connect/node_modules/statuses": { - "version": "1.5.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/constant-case": { "version": "3.0.4", "license": "MIT", @@ -12315,6 +11837,14 @@ "node": ">=8" } }, + "node_modules/detect-libc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "engines": { + "node": ">=8" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "license": "MIT", @@ -14110,36 +13640,6 @@ "node": ">=6" } }, - "node_modules/eventsource": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", - "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/execa": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", - "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^3.0.1", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, "node_modules/exit-hook": { "version": "2.2.1", "license": "MIT", @@ -14150,6 +13650,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "engines": { + "node": ">=6" + } + }, "node_modules/expect": { "version": "29.4.3", "dev": true, @@ -14433,6 +13941,11 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, "node_modules/filelist": { "version": "1.0.4", "license": "Apache-2.0", @@ -15032,6 +14545,11 @@ "url": "https://github.com/fisker/git-hooks-list?sponsor=1" } }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" + }, "node_modules/glob": { "version": "7.2.3", "license": "ISC", @@ -15060,6 +14578,11 @@ "node": ">= 6" } }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, "node_modules/globals": { "version": "11.12.0", "license": "MIT", @@ -19260,7 +18783,8 @@ }, "node_modules/mime": { "version": "3.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", "bin": { "mime": "cli.js" }, @@ -19318,6 +18842,52 @@ "mini-svg-data-uri": "cli.js" } }, + "node_modules/miniflare": { + "version": "3.20230724.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230724.0.tgz", + "integrity": "sha512-YU8yUwoVJCiuzY2i9ZBJ+McjL/mqwKnMJfn23QedSCvx82Mys8GAlkHCH69mqSqzlSw8IVcdxec330meRRf9bg==", + "dependencies": { + "acorn": "^8.8.0", + "acorn-walk": "^8.2.0", + "better-sqlite3": "^8.1.0", + "capnp-ts": "^0.7.0", + "exit-hook": "^2.2.1", + "glob-to-regexp": "^0.4.1", + "http-cache-semantics": "^4.1.0", + "kleur": "^4.1.5", + "set-cookie-parser": "^2.6.0", + "source-map-support": "0.5.21", + "stoppable": "^1.1.0", + "undici": "^5.13.0", + "workerd": "1.20230724.0", + "ws": "^8.11.0", + "youch": "^3.2.2", + "zod": "^3.20.6" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/miniflare/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/minimatch": { "version": "3.1.2", "license": "ISC", @@ -19495,6 +19065,14 @@ "version": "2.1.2", "license": "MIT" }, + "node_modules/mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "bin": { + "mustache": "bin/mustache" + } + }, "node_modules/mute-stream": { "version": "0.0.8", "license": "ISC" @@ -19553,6 +19131,11 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + }, "node_modules/natural-compare": { "version": "1.4.0", "dev": true, @@ -19605,6 +19188,17 @@ "version": "2.4.0", "license": "0BSD" }, + "node_modules/node-abi": { + "version": "3.45.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.45.0.tgz", + "integrity": "sha512-iwXuFrMAcFVi/ZoZiqq8BzAdsLw9kxDfTC0HMyjXfSL/6CSDAGD5UmR7azrAgWV1zKYq7dUUMj4owusBWKLsiQ==", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/node-abort-controller": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", @@ -20007,17 +19601,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/npx-import": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/npx-import/-/npx-import-1.1.4.tgz", - "integrity": "sha512-3ShymTWOgqGyNlh5lMJAejLuIv3W1K3fbI5Ewc6YErZU3Sp0PqsNs8UIU1O8z5+KVl/Du5ag56Gza9vdorGEoA==", - "dependencies": { - "execa": "^6.1.0", - "parse-package-name": "^1.0.0", - "semver": "^7.3.7", - "validate-npm-package-name": "^4.0.0" - } - }, "node_modules/nullthrows": { "version": "1.1.1", "license": "MIT" @@ -20634,11 +20217,6 @@ "node": ">=6" } }, - "node_modules/parse-package-name": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-package-name/-/parse-package-name-1.0.0.tgz", - "integrity": "sha512-kBeTUtcj+SkyfaW4+KBe0HtsloBJ/mKTPoxpVdA57GZiPerREsUWJOhVj9anXweFiJkm5y8FG1sxFZkZ0SN6wg==" - }, "node_modules/parse5": { "version": "6.0.1", "dev": true, @@ -21795,6 +21373,40 @@ "version": "4.2.0", "license": "MIT" }, + "node_modules/prebuild-install": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", + "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prebuild-install/node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/preferred-pm": { "version": "3.0.3", "dev": true, @@ -23248,13 +22860,6 @@ "version": "1.1.0", "license": "MIT" }, - "node_modules/semiver": { - "version": "1.1.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/semver": { "version": "7.5.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", @@ -23363,8 +22968,9 @@ "license": "ISC" }, "node_modules/set-cookie-parser": { - "version": "2.5.1", - "license": "MIT" + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" }, "node_modules/set-harmonic-interval": { "version": "1.0.1", @@ -23450,6 +23056,49 @@ "version": "1.0.0", "license": "BSD-3-Clause" }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "node_modules/simple-git": { "version": "3.19.1", "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.19.1.tgz", @@ -23973,6 +23622,15 @@ "integrity": "sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==", "dev": true }, + "node_modules/stoppable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", + "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", + "engines": { + "node": ">=4", + "npm": ">=6" + } + }, "node_modules/stream-shift": { "version": "1.0.1", "license": "MIT" @@ -25801,11 +25459,6 @@ "punycode": "^2.1.0" } }, - "node_modules/urlpattern-polyfill": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-4.0.3.tgz", - "integrity": "sha512-DOE84vZT2fEcl9gqCUTcnAw5ZY5Id55ikUcziSUntuEFL3pRvavg5kwDmTEUJkeCHInTlV/HexFomgYnzO5kdQ==" - }, "node_modules/use-isomorphic-layout-effect": { "version": "1.1.2", "license": "MIT", @@ -25890,17 +25543,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "node_modules/validate-npm-package-name": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz", - "integrity": "sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q==", - "dependencies": { - "builtins": "^5.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/value-or-promise": { "version": "1.0.12", "license": "MIT", @@ -26755,6 +26397,25 @@ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" }, + "node_modules/workerd": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230724.0.tgz", + "integrity": "sha512-++D7JqS4/dk7zvtGpk+i/7G9bZtEl6lTtgAsIoSSGR1qJAxxEu21ktm9+FH0EYh7uKfizuM5H9lrTsR+3u44PA==", + "hasInstallScript": true, + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20230724.0", + "@cloudflare/workerd-darwin-arm64": "1.20230724.0", + "@cloudflare/workerd-linux-64": "1.20230724.0", + "@cloudflare/workerd-linux-arm64": "1.20230724.0", + "@cloudflare/workerd-windows-64": "1.20230724.0" + } + }, "node_modules/worktop": { "version": "0.7.3", "license": "MIT", @@ -27077,6 +26738,24 @@ "dev": true, "license": "ISC" }, + "node_modules/youch": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/youch/-/youch-3.2.3.tgz", + "integrity": "sha512-ZBcWz/uzZaQVdCvfV4uk616Bbpf2ee+F/AvuKDR5EwX/Y4v06xWdtMluqTD7+KlZdM93lLm9gMZYo0sKBS0pgw==", + "dependencies": { + "cookie": "^0.5.0", + "mustache": "^4.2.0", + "stacktracey": "^2.1.8" + } + }, + "node_modules/youch/node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/zip-stream": { "version": "4.1.0", "license": "MIT", @@ -27115,7 +26794,7 @@ }, "packages/cli": { "name": "@shopify/cli-hydrogen", - "version": "5.1.0", + "version": "5.1.1", "license": "MIT", "dependencies": { "@ast-grep/napi": "^0.5.3", @@ -27124,12 +26803,13 @@ "@remix-run/dev": "1.19.1", "@shopify/cli-kit": "3.48.0", "@shopify/hydrogen-codegen": "^0.0.2", - "@shopify/mini-oxygen": "^1.7.0", "ansi-escapes": "^6.2.0", "diff": "^5.1.0", "fast-glob": "^3.2.12", "fs-extra": "^11.1.0", "gunzip-maybe": "^1.4.2", + "mime": "^3.0.0", + "miniflare": "3.20230724.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", "tar-fs": "^2.1.1", @@ -27155,7 +26835,7 @@ "peerDependencies": { "@remix-run/react": "1.19.1", "@shopify/hydrogen-react": "^2023.7.0", - "@shopify/remix-oxygen": "^1.1.1" + "@shopify/remix-oxygen": "^1.1.2" } }, "packages/cli/node_modules/@oclif/core": { @@ -27381,7 +27061,7 @@ }, "packages/hydrogen": { "name": "@shopify/hydrogen", - "version": "2023.7.0", + "version": "2023.7.1", "license": "MIT", "dependencies": { "@shopify/hydrogen-react": "2023.7.0", @@ -27650,7 +27330,7 @@ }, "packages/remix-oxygen": { "name": "@shopify/remix-oxygen", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "dependencies": { "@remix-run/server-runtime": "1.19.1" @@ -27663,14 +27343,14 @@ } }, "templates/demo-store": { - "version": "2.0.0", + "version": "2.0.1", "dependencies": { "@headlessui/react": "^1.7.2", "@remix-run/react": "1.19.1", "@shopify/cli": "3.48.0", - "@shopify/cli-hydrogen": "^5.1.0", - "@shopify/hydrogen": "^2023.7.0", - "@shopify/remix-oxygen": "^1.1.1", + "@shopify/cli-hydrogen": "^5.1.1", + "@shopify/hydrogen": "^2023.7.1", + "@shopify/remix-oxygen": "^1.1.2", "clsx": "^1.2.1", "cross-env": "^7.0.3", "graphql": "^16.6.0", @@ -27717,9 +27397,9 @@ "dependencies": { "@remix-run/react": "1.19.1", "@shopify/cli": "3.48.0", - "@shopify/cli-hydrogen": "^5.1.0", - "@shopify/hydrogen": "^2023.7.0", - "@shopify/remix-oxygen": "^1.1.1", + "@shopify/cli-hydrogen": "^5.1.1", + "@shopify/hydrogen": "^2023.7.1", + "@shopify/remix-oxygen": "^1.1.2", "@total-typescript/ts-reset": "^0.4.2", "graphql": "^16.6.0", "graphql-tag": "^2.12.6", @@ -27748,9 +27428,9 @@ "dependencies": { "@remix-run/react": "1.19.1", "@shopify/cli": "3.48.0", - "@shopify/cli-hydrogen": "^5.1.0", - "@shopify/hydrogen": "^2023.7.0", - "@shopify/remix-oxygen": "^1.1.1", + "@shopify/cli-hydrogen": "^5.1.1", + "@shopify/hydrogen": "^2023.7.1", + "@shopify/remix-oxygen": "^1.1.2", "graphql": "^16.6.0", "graphql-tag": "^2.12.6", "isbot": "^3.6.6", @@ -30015,6 +29695,36 @@ } } }, + "@cloudflare/workerd-darwin-64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230724.0.tgz", + "integrity": "sha512-DQmFZWHhs8waQFYRb/Z8QmbitAvBMXnbUMUentp+3lS4eCYI0/iurTaQDiz5+ldUn9FTxD+1XuYZlTHzVNxoHw==", + "optional": true + }, + "@cloudflare/workerd-darwin-arm64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20230724.0.tgz", + "integrity": "sha512-C7T0v/lMjEX7c4iROSZKgIF1eGw3+sj/gFpBD6xwxfbIcrKBjncMypeLQNpRTCdBQr1W3sNpg9jagwuVX5ByZQ==", + "optional": true + }, + "@cloudflare/workerd-linux-64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20230724.0.tgz", + "integrity": "sha512-o0F/hj73UXOQwkPkYqZuIxpjG8gAs2eoAGqxX1HSIYRf7iUhfFcPrupwjqlNqf7Oo1h46M+sClSFjr/ZU/LCjg==", + "optional": true + }, + "@cloudflare/workerd-linux-arm64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20230724.0.tgz", + "integrity": "sha512-UpzCoo7LOuPWxFPw84TZQTPIawIDQNSb3XnC6ffMjUH/FVwHmHdngIFZxW+xjLHKMIzGNAqSn3eRHekKgO3QqA==", + "optional": true + }, + "@cloudflare/workerd-windows-64": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20230724.0.tgz", + "integrity": "sha512-wVpPNu19fnvgsD8V6NiGPSuET0bzKmgn3wJ6RwAwQA+GQ0hdDIDVYd13aImhgO6jLfQvkduCDxeZluGZ7PPojQ==", + "optional": true + }, "@cspotcode/source-map-support": { "version": "0.8.1", "requires": { @@ -31466,103 +31176,6 @@ } } }, - "@miniflare/cache": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.14.0.tgz", - "integrity": "sha512-0mz0OCzTegiX75uMURLJpDo3DaOCSx9M0gv7NMFWDbK/XrvjoENiBZiKu98UBM5fts0qtK19a+MfB4aT0uBCFg==", - "requires": { - "@miniflare/core": "2.14.0", - "@miniflare/shared": "2.14.0", - "http-cache-semantics": "^4.1.0", - "undici": "5.20.0" - } - }, - "@miniflare/core": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.14.0.tgz", - "integrity": "sha512-BjmV/ZDwsKvXnJntYHt3AQgzVKp/5ZzWPpYWoOnUSNxq6nnRCQyvFvjvBZKnhubcmJCLSqegvz0yHejMA90CTA==", - "requires": { - "@iarna/toml": "^2.2.5", - "@miniflare/queues": "2.14.0", - "@miniflare/shared": "2.14.0", - "@miniflare/watcher": "2.14.0", - "busboy": "^1.6.0", - "dotenv": "^10.0.0", - "kleur": "^4.1.4", - "set-cookie-parser": "^2.4.8", - "undici": "5.20.0", - "urlpattern-polyfill": "^4.0.3" - }, - "dependencies": { - "dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" - } - } - }, - "@miniflare/queues": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/queues/-/queues-2.14.0.tgz", - "integrity": "sha512-flS4MqlgBKyv6QBqKD0IofjmMDW9wP1prUNQy2wWPih9lA6bFKmml3VdFeDsPnWtE2J67K0vCTf5kj1Q0qdW1w==", - "requires": { - "@miniflare/shared": "2.14.0" - } - }, - "@miniflare/runner-vm": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/runner-vm/-/runner-vm-2.14.0.tgz", - "integrity": "sha512-01CmNzv74u0RZgT/vjV/ggDzECXTG88ZJAKhXyhAx0s2DOLIXzsGHn6pUJIsfPCrtj8nfqtTCp1Vf0UMVWSpmw==", - "requires": { - "@miniflare/shared": "2.14.0" - } - }, - "@miniflare/shared": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.14.0.tgz", - "integrity": "sha512-O0jAEdMkp8BzrdFCfMWZu76h4Cq+tt3/oDtcTFgzum3fRW5vUhIi/5f6bfndu6rkGbSlzxwor8CJWpzityXGug==", - "requires": { - "@types/better-sqlite3": "^7.6.0", - "kleur": "^4.1.4", - "npx-import": "^1.1.4", - "picomatch": "^2.3.1" - } - }, - "@miniflare/storage-memory": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/storage-memory/-/storage-memory-2.14.0.tgz", - "integrity": "sha512-5aFjEiTSNrHJ+iAiGMCA/TVPnNMrnokG5r0vKrwj4knbf8pisgfP04x18zCgOlG7kaIWNmqdO/vtVT5BIioiSQ==", - "requires": { - "@miniflare/shared": "2.14.0" - } - }, - "@miniflare/watcher": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.14.0.tgz", - "integrity": "sha512-O8Abg2eHpGmcZb8WyUaA6Av1Mqt5bSrorzz4CrWwsvJHBdekZPIX0GihC9vn327d/1pKRs81YTiSAfBoSZpVIw==", - "requires": { - "@miniflare/shared": "2.14.0" - } - }, - "@miniflare/web-sockets": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@miniflare/web-sockets/-/web-sockets-2.14.0.tgz", - "integrity": "sha512-lB1CB4rBq0mbCuh55WgIEH4L3c4/i4MNDBfrQL+6r+wGcr/BJUqF8BHpsfAt5yHWUJVtK5mlMeesS/xpg4Ao1w==", - "requires": { - "@miniflare/core": "2.14.0", - "@miniflare/shared": "2.14.0", - "undici": "5.20.0", - "ws": "^8.2.2" - }, - "dependencies": { - "ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "requires": {} - } - } - }, "@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "dev": true, @@ -32377,7 +31990,6 @@ "@remix-run/dev": "1.19.1", "@shopify/cli-kit": "3.48.0", "@shopify/hydrogen-codegen": "^0.0.2", - "@shopify/mini-oxygen": "^1.7.0", "@types/diff": "^5.0.2", "@types/fs-extra": "^11.0.1", "@types/gunzip-maybe": "^1.4.0", @@ -32389,6 +32001,8 @@ "fast-glob": "^3.2.12", "fs-extra": "^11.1.0", "gunzip-maybe": "^1.4.2", + "mime": "^3.0.0", + "miniflare": "3.20230724.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", "tar-fs": "^2.1.1", @@ -33171,224 +32785,6 @@ } } }, - "@shopify/mini-oxygen": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@shopify/mini-oxygen/-/mini-oxygen-1.7.0.tgz", - "integrity": "sha512-uU9d4OhwepTAtNFTDKXijD5cgGlUQN0cX9n4rY7I8UIg4kNKaV+TvBZB3UwyNloOPOfhaOJf33zRnzHKwHsXEg==", - "requires": { - "@miniflare/cache": "^2.14.0", - "@miniflare/core": "^2.14.0", - "@miniflare/queues": "^2.14.0", - "@miniflare/runner-vm": "^2.14.0", - "@miniflare/shared": "^2.14.0", - "@miniflare/storage-memory": "^2.14.0", - "@miniflare/web-sockets": "2.14.0", - "@types/connect": "^3.4.35", - "@types/mime": "^3.0.1", - "body-parser": "1.20.2", - "connect": "^3.7.0", - "eventsource": "^2.0.2", - "fs-extra": "^11.1.0", - "get-port": "^5.1.1", - "inquirer": "^9.0.0", - "mime": "^3.0.0", - "semiver": "^1.1.0", - "source-map-support": "^0.5.21", - "typescript": "^4.7.2" - }, - "dependencies": { - "ansi-escapes": { - "version": "6.0.0", - "requires": { - "type-fest": "^3.0.0" - } - }, - "ansi-regex": { - "version": "6.0.1" - }, - "ansi-styles": { - "version": "6.2.1" - }, - "bl": { - "version": "5.1.0", - "requires": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - } - }, - "buffer": { - "version": "6.0.3", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "chalk": { - "version": "5.1.2" - }, - "cli-cursor": { - "version": "4.0.0", - "requires": { - "restore-cursor": "^4.0.0" - } - }, - "cli-width": { - "version": "4.0.0" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "escape-string-regexp": { - "version": "5.0.0" - }, - "figures": { - "version": "5.0.0", - "requires": { - "escape-string-regexp": "^5.0.0", - "is-unicode-supported": "^1.2.0" - } - }, - "fs-extra": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", - "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "inquirer": { - "version": "9.1.4", - "requires": { - "ansi-escapes": "^6.0.0", - "chalk": "^5.1.2", - "cli-cursor": "^4.0.0", - "cli-width": "^4.0.0", - "external-editor": "^3.0.3", - "figures": "^5.0.0", - "lodash": "^4.17.21", - "mute-stream": "0.0.8", - "ora": "^6.1.2", - "run-async": "^2.4.0", - "rxjs": "^7.5.7", - "string-width": "^5.1.2", - "strip-ansi": "^7.0.1", - "through": "^2.3.6", - "wrap-ansi": "^8.0.1" - } - }, - "is-interactive": { - "version": "2.0.0" - }, - "is-unicode-supported": { - "version": "1.3.0" - }, - "log-symbols": { - "version": "5.1.0", - "requires": { - "chalk": "^5.0.0", - "is-unicode-supported": "^1.1.0" - } - }, - "mimic-fn": { - "version": "2.1.0" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "onetime": { - "version": "5.1.2", - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "ora": { - "version": "6.1.2", - "requires": { - "bl": "^5.0.0", - "chalk": "^5.0.0", - "cli-cursor": "^4.0.0", - "cli-spinners": "^2.6.1", - "is-interactive": "^2.0.0", - "is-unicode-supported": "^1.1.0", - "log-symbols": "^5.1.0", - "strip-ansi": "^7.0.1", - "wcwidth": "^1.0.1" - } - }, - "raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "restore-cursor": { - "version": "4.0.0", - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, - "string-width": { - "version": "5.1.2", - "requires": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - } - }, - "strip-ansi": { - "version": "7.0.1", - "requires": { - "ansi-regex": "^6.0.1" - } - }, - "type-fest": { - "version": "3.1.0" - }, - "wrap-ansi": { - "version": "8.0.1", - "requires": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - } - } - } - }, "@shopify/oxygen-workers-types": { "version": "3.17.2", "dev": true @@ -33682,14 +33078,6 @@ "version": "4.2.2", "dev": true }, - "@types/better-sqlite3": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.4.tgz", - "integrity": "sha512-dzrRZCYPXIXfSR1/surNbJ/grU3scTaygS0OMzjlGf71i9sc2fGyHPXXiXmEvNIoE0cGwsanEFMVJxPXmco9Eg==", - "requires": { - "@types/node": "*" - } - }, "@types/body-parser": { "version": "1.19.2", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", @@ -33741,6 +33129,7 @@ }, "@types/connect": { "version": "3.4.35", + "dev": true, "requires": { "@types/node": "*" } @@ -33946,7 +33335,8 @@ "dev": true }, "@types/mime": { - "version": "3.0.1" + "version": "3.0.1", + "dev": true }, "@types/minimatch": { "version": "5.1.2" @@ -35017,6 +34407,15 @@ "is-windows": "^1.0.0" } }, + "better-sqlite3": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.5.0.tgz", + "integrity": "sha512-vbPcv/Hx5WYdyNg/NbcfyaBZyv9s/NVbxb7yCeC5Bq1pVocNxeL2tZmSu3Rlm4IEOTjYdGyzWQgyx0OSdORBzw==", + "requires": { + "bindings": "^1.5.0", + "prebuild-install": "^7.1.0" + } + }, "big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", @@ -35029,6 +34428,14 @@ "binary-extensions": { "version": "2.2.0" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "4.1.0", "requires": { @@ -35201,14 +34608,6 @@ "buffer-from": { "version": "1.1.2" }, - "builtins": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", - "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", - "requires": { - "semver": "^7.0.0" - } - }, "bundle-name": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", @@ -35365,6 +34764,22 @@ } } }, + "capnp-ts": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", + "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", + "requires": { + "debug": "^4.3.1", + "tslib": "^2.2.0" + }, + "dependencies": { + "tslib": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + } + } + }, "cardinal": { "version": "2.1.1", "requires": { @@ -35675,47 +35090,6 @@ "proto-list": "~1.2.1" } }, - "connect": { - "version": "3.7.0", - "requires": { - "debug": "2.6.9", - "finalhandler": "1.1.2", - "parseurl": "~1.3.3", - "utils-merge": "1.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "finalhandler": { - "version": "1.1.2", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - } - }, - "ms": { - "version": "2.0.0" - }, - "on-finished": { - "version": "2.3.0", - "requires": { - "ee-first": "1.1.1" - } - }, - "statuses": { - "version": "1.5.0" - } - } - }, "constant-case": { "version": "3.0.4", "requires": { @@ -36269,12 +35643,12 @@ "@remix-run/eslint-config": "1.19.1", "@remix-run/react": "1.19.1", "@shopify/cli": "3.48.0", - "@shopify/cli-hydrogen": "^5.1.0", + "@shopify/cli-hydrogen": "^5.1.1", "@shopify/eslint-plugin": "^42.0.1", - "@shopify/hydrogen": "^2023.7.0", + "@shopify/hydrogen": "^2023.7.1", "@shopify/oxygen-workers-types": "^3.17.2", "@shopify/prettier-config": "^1.1.2", - "@shopify/remix-oxygen": "^1.1.1", + "@shopify/remix-oxygen": "^1.1.2", "@tailwindcss/forms": "^0.5.3", "@tailwindcss/typography": "^0.5.9", "@total-typescript/ts-reset": "^0.4.2", @@ -36320,6 +35694,11 @@ "detect-indent": { "version": "6.1.0" }, + "detect-libc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==" + }, "detect-newline": { "version": "3.1.0" }, @@ -37404,30 +36783,14 @@ "event-target-shim": { "version": "5.0.1" }, - "eventsource": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", - "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==" - }, - "execa": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", - "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^3.0.1", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - } - }, "exit-hook": { "version": "2.2.1" }, + "expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==" + }, "expect": { "version": "29.4.3", "dev": true, @@ -37625,6 +36988,11 @@ "flat-cache": "^3.0.4" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, "filelist": { "version": "1.0.4", "requires": { @@ -38020,6 +37388,11 @@ "git-hooks-list": { "version": "1.0.3" }, + "github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" + }, "glob": { "version": "7.2.3", "requires": { @@ -38037,6 +37410,11 @@ "is-glob": "^4.0.1" } }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, "globals": { "version": "11.12.0" }, @@ -38395,11 +37773,11 @@ "@remix-run/dev": "1.19.1", "@remix-run/react": "1.19.1", "@shopify/cli": "3.48.0", - "@shopify/cli-hydrogen": "^5.1.0", - "@shopify/hydrogen": "^2023.7.0", + "@shopify/cli-hydrogen": "^5.1.1", + "@shopify/hydrogen": "^2023.7.1", "@shopify/oxygen-workers-types": "^3.17.2", "@shopify/prettier-config": "^1.1.2", - "@shopify/remix-oxygen": "^1.1.1", + "@shopify/remix-oxygen": "^1.1.2", "@total-typescript/ts-reset": "^0.4.2", "@types/eslint": "^8.4.10", "@types/react": "^18.0.20", @@ -40651,7 +40029,9 @@ } }, "mime": { - "version": "3.0.0" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==" }, "mime-db": { "version": "1.52.0" @@ -40676,6 +40056,37 @@ "version": "1.4.4", "dev": true }, + "miniflare": { + "version": "3.20230724.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230724.0.tgz", + "integrity": "sha512-YU8yUwoVJCiuzY2i9ZBJ+McjL/mqwKnMJfn23QedSCvx82Mys8GAlkHCH69mqSqzlSw8IVcdxec330meRRf9bg==", + "requires": { + "acorn": "^8.8.0", + "acorn-walk": "^8.2.0", + "better-sqlite3": "^8.1.0", + "capnp-ts": "^0.7.0", + "exit-hook": "^2.2.1", + "glob-to-regexp": "^0.4.1", + "http-cache-semantics": "^4.1.0", + "kleur": "^4.1.5", + "set-cookie-parser": "^2.6.0", + "source-map-support": "0.5.21", + "stoppable": "^1.1.0", + "undici": "^5.13.0", + "workerd": "1.20230724.0", + "ws": "^8.11.0", + "youch": "^3.2.2", + "zod": "^3.20.6" + }, + "dependencies": { + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} + } + } + }, "minimatch": { "version": "3.1.2", "requires": { @@ -40798,6 +40209,11 @@ "ms": { "version": "2.1.2" }, + "mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==" + }, "mute-stream": { "version": "0.0.8" }, @@ -40833,6 +40249,11 @@ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==" }, + "napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + }, "natural-compare": { "version": "1.4.0", "dev": true @@ -40869,6 +40290,14 @@ } } }, + "node-abi": { + "version": "3.45.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.45.0.tgz", + "integrity": "sha512-iwXuFrMAcFVi/ZoZiqq8BzAdsLw9kxDfTC0HMyjXfSL/6CSDAGD5UmR7azrAgWV1zKYq7dUUMj4owusBWKLsiQ==", + "requires": { + "semver": "^7.3.5" + } + }, "node-abort-controller": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", @@ -41116,17 +40545,6 @@ } } }, - "npx-import": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/npx-import/-/npx-import-1.1.4.tgz", - "integrity": "sha512-3ShymTWOgqGyNlh5lMJAejLuIv3W1K3fbI5Ewc6YErZU3Sp0PqsNs8UIU1O8z5+KVl/Du5ag56Gza9vdorGEoA==", - "requires": { - "execa": "^6.1.0", - "parse-package-name": "^1.0.0", - "semver": "^7.3.7", - "validate-npm-package-name": "^4.0.0" - } - }, "nullthrows": { "version": "1.1.1" }, @@ -41513,11 +40931,6 @@ "parse-ms": { "version": "2.1.0" }, - "parse-package-name": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-package-name/-/parse-package-name-1.0.0.tgz", - "integrity": "sha512-kBeTUtcj+SkyfaW4+KBe0HtsloBJ/mKTPoxpVdA57GZiPerREsUWJOhVj9anXweFiJkm5y8FG1sxFZkZ0SN6wg==" - }, "parse5": { "version": "6.0.1", "dev": true @@ -42148,6 +41561,36 @@ "postcss-value-parser": { "version": "4.2.0" }, + "prebuild-install": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", + "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "requires": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "dependencies": { + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + } + } + }, "preferred-pm": { "version": "3.0.3", "dev": true, @@ -43091,9 +42534,6 @@ "scuid": { "version": "1.1.0" }, - "semiver": { - "version": "1.1.0" - }, "semver": { "version": "7.5.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", @@ -43174,7 +42614,9 @@ "version": "2.0.0" }, "set-cookie-parser": { - "version": "2.5.1" + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" }, "set-harmonic-interval": { "version": "1.0.1" @@ -43228,6 +42670,21 @@ "signedsource": { "version": "1.0.0" }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" + }, + "simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "requires": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "simple-git": { "version": "3.19.1", "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.19.1.tgz", @@ -43261,11 +42718,11 @@ "@remix-run/dev": "1.19.1", "@remix-run/react": "1.19.1", "@shopify/cli": "3.48.0", - "@shopify/cli-hydrogen": "^5.1.0", - "@shopify/hydrogen": "^2023.7.0", + "@shopify/cli-hydrogen": "^5.1.1", + "@shopify/hydrogen": "^2023.7.1", "@shopify/oxygen-workers-types": "^3.17.2", "@shopify/prettier-config": "^1.1.2", - "@shopify/remix-oxygen": "^1.1.1", + "@shopify/remix-oxygen": "^1.1.2", "@total-typescript/ts-reset": "^0.4.2", "@types/eslint": "^8.4.10", "@types/react": "^18.0.20", @@ -43625,6 +43082,11 @@ "integrity": "sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==", "dev": true }, + "stoppable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", + "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==" + }, "stream-shift": { "version": "1.0.1" }, @@ -44757,11 +44219,6 @@ "punycode": "^2.1.0" } }, - "urlpattern-polyfill": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-4.0.3.tgz", - "integrity": "sha512-DOE84vZT2fEcl9gqCUTcnAw5ZY5Id55ikUcziSUntuEFL3pRvavg5kwDmTEUJkeCHInTlV/HexFomgYnzO5kdQ==" - }, "use-isomorphic-layout-effect": { "version": "1.1.2", "requires": {} @@ -44817,14 +44274,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "validate-npm-package-name": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz", - "integrity": "sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q==", - "requires": { - "builtins": "^5.0.0" - } - }, "value-or-promise": { "version": "1.0.12" }, @@ -45264,6 +44713,18 @@ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" }, + "workerd": { + "version": "1.20230724.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230724.0.tgz", + "integrity": "sha512-++D7JqS4/dk7zvtGpk+i/7G9bZtEl6lTtgAsIoSSGR1qJAxxEu21ktm9+FH0EYh7uKfizuM5H9lrTsR+3u44PA==", + "requires": { + "@cloudflare/workerd-darwin-64": "1.20230724.0", + "@cloudflare/workerd-darwin-arm64": "1.20230724.0", + "@cloudflare/workerd-linux-64": "1.20230724.0", + "@cloudflare/workerd-linux-arm64": "1.20230724.0", + "@cloudflare/workerd-windows-64": "1.20230724.0" + } + }, "worktop": { "version": "0.7.3", "requires": { @@ -45460,6 +44921,23 @@ } } }, + "youch": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/youch/-/youch-3.2.3.tgz", + "integrity": "sha512-ZBcWz/uzZaQVdCvfV4uk616Bbpf2ee+F/AvuKDR5EwX/Y4v06xWdtMluqTD7+KlZdM93lLm9gMZYo0sKBS0pgw==", + "requires": { + "cookie": "^0.5.0", + "mustache": "^4.2.0", + "stacktracey": "^2.1.8" + }, + "dependencies": { + "cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + } + } + }, "zip-stream": { "version": "4.1.0", "requires": { diff --git a/packages/cli/package.json b/packages/cli/package.json index b5e9883ce0..c60fb33772 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -38,12 +38,13 @@ "@remix-run/dev": "1.19.1", "@shopify/cli-kit": "3.48.0", "@shopify/hydrogen-codegen": "^0.0.2", - "@shopify/mini-oxygen": "^1.7.0", "ansi-escapes": "^6.2.0", "diff": "^5.1.0", "fast-glob": "^3.2.12", "fs-extra": "^11.1.0", "gunzip-maybe": "^1.4.2", + "mime": "^3.0.0", + "miniflare": "3.20230724.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", "tar-fs": "^2.1.1", diff --git a/packages/cli/src/commands/hydrogen/dev.ts b/packages/cli/src/commands/hydrogen/dev.ts index d7a487dbb9..8f7d3849de 100644 --- a/packages/cli/src/commands/hydrogen/dev.ts +++ b/packages/cli/src/commands/hydrogen/dev.ts @@ -227,6 +227,8 @@ async function runDev({ } await safeStartMiniOxygen(); + } else { + await miniOxygen.reload(); } }, async onFileCreated(file: string) { diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index b6da3f6827..8b5021b175 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -1,12 +1,20 @@ +import {readdir, readFile} from 'node:fs/promises'; import { outputInfo, outputToken, outputContent, } from '@shopify/cli-kit/node/output'; -import {resolvePath} from '@shopify/cli-kit/node/path'; -import {fileExists} from '@shopify/cli-kit/node/fs'; +import {resolvePath, extname} from '@shopify/cli-kit/node/path'; import colors from '@shopify/cli-kit/node/colors'; import {renderSuccess} from '@shopify/cli-kit/node/ui'; +import mime from 'mime'; +import { + Miniflare, + type MiniflareOptions, + Request, + Response, + fetch, +} from 'miniflare'; type MiniOxygenOptions = { root: string; @@ -27,51 +35,64 @@ export async function startMiniOxygen({ buildPathClient, env, }: MiniOxygenOptions) { - const {default: miniOxygenImport} = await import('@shopify/mini-oxygen'); - const miniOxygenPreview = - miniOxygenImport.default ?? - (miniOxygenImport as unknown as typeof miniOxygenImport.default); + const buildMiniOxygenOptions = async () => + ({ + cf: false, + verbose: true, + port: port, + liveReload: watch, + workers: [ + { + name: 'mini-oxygen', + modules: true, + bindings: { + initialAssets: await readdir(buildPathClient), + }, + serviceBindings: { + hydrogen: 'hydrogen', + assets: createAssetHandler(buildPathClient), + logRequest, + }, + script: `export default { fetch: ${miniOxygenHandler.toString()} }`, + }, + { + name: 'hydrogen', + modules: [ + { + type: 'ESModule', + path: resolvePath(root, buildPathWorkerFile), + contents: await readFile(resolvePath(root, buildPathWorkerFile)), + }, + ], + bindings: {...env}, + compatibilityFlags: ['streams_enable_constructors'], + compatibilityDate: '2022-10-31', + }, + ], + } satisfies MiniflareOptions); - const dotenvPath = resolvePath(root, '.env'); + let miniOxygenOptions = await buildMiniOxygenOptions(); + const miniOxygen = new Miniflare(miniOxygenOptions); - const miniOxygen = await miniOxygenPreview({ - workerFile: buildPathWorkerFile, - assetsDir: buildPathClient, - publicPath: '', - port, - watch, - autoReload: watch, - modules: true, - env: { - ...env, - ...process.env, - }, - envPath: !env && (await fileExists(dotenvPath)) ? dotenvPath : undefined, - log: () => {}, - buildWatchPaths: watch - ? [resolvePath(root, buildPathWorkerFile)] - : undefined, - onResponse: (request, response) => - // 'Request' and 'Response' types in MiniOxygen comes from - // Miniflare and are slightly different from standard types. - logResponse( - request as unknown as Request, - response as unknown as Response, - ), - }); - - const listeningAt = `http://localhost:${miniOxygen.port}`; + const listeningAt = `http://localhost:${port}`; return { + port, listeningAt, - port: miniOxygen.port, - reload(nextOptions?: Partial>) { - return miniOxygen.reload({ - env: { - ...(nextOptions?.env ?? env), - ...process.env, - }, - }); + async reload(nextOptions?: Partial>) { + miniOxygenOptions = await buildMiniOxygenOptions(); + + if (nextOptions) { + const hydrogen = miniOxygenOptions.workers.find( + (worker) => worker.name === 'hydrogen', + ); + + if (hydrogen) { + hydrogen.bindings = {...(nextOptions?.env ?? env)}; + } + } + + return miniOxygen.setOptions(miniOxygenOptions); }, showBanner(options?: { mode?: string; @@ -94,22 +115,86 @@ export async function startMiniOxygen({ }; } -export function logResponse(request: Request, response: Response) { +type Service = {fetch: typeof fetch}; +async function miniOxygenHandler( + request: Request, + env: { + hydrogen: Service; + assets: Service; + logRequest: Service; + initialAssets: string[]; + }, +) { + const pathname = new URL(request.url).pathname; + const isInInitialAssets = env.initialAssets.some( + (asset) => + pathname === '/' + asset || pathname.startsWith('/' + asset + '/'), + ); + + const extension = pathname.split('.').at(-1); + const hasAssetExtension = + extension && + /^\.(js|css|jpe?g|png|gif|webp|svg|mp4|webm|txt|pdf|ico)$/i.test(extension); + + if (isInInitialAssets || hasAssetExtension) { + const response = await env.assets.fetch(request); + if (response.status !== 404) return response; + } + + const startTimeMs = Date.now(); + const response = await env.hydrogen.fetch(request); + + const requestToLog = new Request(request); + requestToLog.headers.set('h2-response-status', String(response.status)); + requestToLog.headers.set('h2-duration-ms', String(Date.now() - startTimeMs)); + await env.logRequest.fetch(requestToLog); + + return response; +} + +function createAssetHandler(buildPathClient: string) { + return async (request: Request): Promise => { + const relativeAssetPath = new URL(request.url).pathname.replace('/', ''); + if (relativeAssetPath) { + try { + const absoluteAssetPath = resolvePath( + buildPathClient, + relativeAssetPath, + ); + const fileContent = await readFile(absoluteAssetPath); + return new Response(fileContent, { + headers: { + 'content-type': + mime.getType(extname(relativeAssetPath)) || 'text/plain', + }, + }); + } catch (error) { + if ((error as NodeJS.ErrnoException).code !== 'ENOENT') { + throw error; + } + } + } + + return new Response('Not Found', {status: 404}); + }; +} + +async function logRequest(request: Request): Promise { + const dummyResponse = new Response('ok'); + let responseStatus = 200; + try { + responseStatus = Number(request.headers.get('h2-response-status') || 200); + const durationMs = Number(request.headers.get('h2-duration-ms') || 0); + const url = new URL(request.url); - if (['/graphiql'].includes(url.pathname)) return; + if (['/graphiql'].includes(url.pathname)) return dummyResponse; - const isProxy = !!response.url && response.url !== request.url; - const isDataRequest = !isProxy && url.searchParams.has('_data'); + const isDataRequest = url.searchParams.has('_data'); let route = request.url.replace(url.origin, ''); let info = ''; let type = 'render'; - if (isProxy) { - type = 'proxy'; - info = `[${response.url}]`; - } - if (isDataRequest) { type = request.method === 'GET' ? 'loader' : 'action'; const dataParam = url.searchParams.get('_data')?.replace('routes/', ''); @@ -118,26 +203,28 @@ export function logResponse(request: Request, response: Response) { } const colorizeStatus = - response.status < 300 + responseStatus < 300 ? outputToken.green - : response.status < 400 + : responseStatus < 400 ? outputToken.cyan : outputToken.errorText; outputInfo( outputContent`${request.method.padStart(6)} ${colorizeStatus( - String(response.status), - )} ${outputToken.italic(type.padEnd(7, ' '))} ${route}${ - info ? ' ' + colors.dim(info) : '' - } ${ + String(responseStatus), + )} ${outputToken.italic(type.padEnd(7, ' '))} ${route} ${ + durationMs > 0 ? colors.dim(` ${durationMs}ms`) : '' + }${info ? ' ' + colors.dim(info) : ''}${ request.headers.get('purpose') === 'prefetch' - ? outputToken.italic('(prefetch)') + ? outputToken.italic(colors.dim(' prefetch')) : '' }`, ); } catch { - if (request && response) { - outputInfo(`${request.method} ${response.status} ${request.url}`); + if (request && responseStatus) { + outputInfo(`${request.method} ${responseStatus} ${request.url}`); } } + + return dummyResponse; } From bc793603116fb4d5220c7775adffdacc8c7ea194 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Wed, 2 Aug 2023 19:11:59 +0200 Subject: [PATCH 03/38] Cleanup logs --- packages/cli/src/lib/log.ts | 46 ++++++++++++++++------------- packages/cli/src/lib/mini-oxygen.ts | 7 +++++ 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/packages/cli/src/lib/log.ts b/packages/cli/src/lib/log.ts index 43f3b835ba..2184b25718 100644 --- a/packages/cli/src/lib/log.ts +++ b/packages/cli/src/lib/log.ts @@ -90,28 +90,32 @@ function injectLogReplacer( export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) { injectLogReplacer('log'); - let isFirstWorkerReload = true; - addMessageReplacers('dev', [ - ([first]) => typeof first === 'string' && first.includes('[mf:'), - (args: string[]) => { - const first = args[0] as string; - - if (workerReload !== false && first.includes('Worker reloaded')) { - if (isFirstWorkerReload) { - isFirstWorkerReload = false; - // return args as string[]; - return; + addMessageReplacers( + 'dev', + [ + ([first]) => typeof first === 'string' && first.includes('workerd/io/'), + (args: string[]) => { + if (args[0]?.includes('exception =')) return; + + if (args[0]) { + args[0] = args[0] + .replace(/^.*?message\(\)\s+=\s+\["(.*?)"\].*$/gi, '$1') + .replace(/\\n/g, '\n'); } - return [first.replace('[mf:inf] ', '🔄 ') + '\n', ...args.slice(1)]; - } - - if (!first.includes('[mf:err]')) { - // Hide logs except errors - return; - } - }, - ]); + return args; + }, + ], + [ + ([first]) => typeof first === 'string' && first.includes('workerd/util/'), + () => {}, + ], + [ + ([first]) => + typeof first === 'string' && first.includes('workerd/server/'), + () => {}, + ], + ); } const originalWrite = process.stdout.write; @@ -207,7 +211,7 @@ export function enhanceH2Logs(options: { addMessageReplacers('h2-warn', [ ([first]) => { const message = first?.message ?? first; - return typeof message === 'string' && message.startsWith('[h2:'); + return typeof message === 'string' && message.includes('[h2:'); }, (args: any[]) => { const firstArg = args[0]; diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index 8b5021b175..db366ddc59 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -11,6 +11,7 @@ import mime from 'mime'; import { Miniflare, type MiniflareOptions, + Log, Request, Response, fetch, @@ -35,11 +36,17 @@ export async function startMiniOxygen({ buildPathClient, env, }: MiniOxygenOptions) { + const log = new Log(2); + // @ts-ignore + log.log = () => {}; + log.warn = () => {}; + const buildMiniOxygenOptions = async () => ({ cf: false, verbose: true, port: port, + log, liveReload: watch, workers: [ { From d120a1db9ec7637eda33ea82ecc33555bec9050e Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Wed, 2 Aug 2023 20:52:12 +0200 Subject: [PATCH 04/38] Add Oxygen headers to request --- packages/cli/src/lib/mini-oxygen.ts | 40 ++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index db366ddc59..b8c0fec908 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -54,6 +54,13 @@ export async function startMiniOxygen({ modules: true, bindings: { initialAssets: await readdir(buildPathClient), + oxygenHeadersMap: Object.values(OXYGEN_HEADERS_MAP).reduce( + (acc, item) => { + acc[item.name] = item.defaultValue; + return acc; + }, + {} as Record, + ), }, serviceBindings: { hydrogen: 'hydrogen', @@ -130,6 +137,7 @@ async function miniOxygenHandler( assets: Service; logRequest: Service; initialAssets: string[]; + oxygenHeadersMap: Array<{name: string; defaultValue: string}>; }, ) { const pathname = new URL(request.url).pathname; @@ -149,7 +157,12 @@ async function miniOxygenHandler( } const startTimeMs = Date.now(); - const response = await env.hydrogen.fetch(request); + const response = await env.hydrogen.fetch(request, { + headers: { + ...env.oxygenHeadersMap, + ...request.headers, + }, + }); const requestToLog = new Request(request); requestToLog.headers.set('h2-response-status', String(response.status)); @@ -235,3 +248,28 @@ async function logRequest(request: Request): Promise { return dummyResponse; } + +// https://shopify.dev/docs/custom-storefronts/oxygen/worker-runtime-apis#custom-headers +const OXYGEN_HEADERS_MAP = { + ip: {name: 'oxygen-buyer-ip', defaultValue: '127.0.0.1'}, + longitude: {name: 'oxygen-buyer-longitude', defaultValue: '-122.40140'}, + latitude: {name: 'oxygen-buyer-latitude', defaultValue: '37.78855'}, + continent: {name: 'oxygen-buyer-continent', defaultValue: 'NA'}, + country: {name: 'oxygen-buyer-country', defaultValue: 'US'}, + region: {name: 'oxygen-buyer-region', defaultValue: 'California'}, + regionCode: {name: 'oxygen-buyer-region-code', defaultValue: 'CA'}, + city: {name: 'oxygen-buyer-city', defaultValue: 'San Francisco'}, + isEuCountry: {name: 'oxygen-buyer-is-eu-country', defaultValue: ''}, + timezone: { + name: 'oxygen-buyer-timezone', + defaultValue: 'America/Los_Angeles', + }, + + // Not documented but available in Oxygen: + deploymentId: {name: 'oxygen-buyer-deployment-id', defaultValue: 'local'}, + shopId: {name: 'oxygen-buyer-shop-id', defaultValue: 'development'}, + storefrontId: { + name: 'oxygen-buyer-storefront-id', + defaultValue: 'development', + }, +} as const; From b15b01629370adc6e754c5e78a310414ef7c77f7 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 3 Aug 2023 12:51:30 +0200 Subject: [PATCH 05/38] Setup basic inspector connection --- package-lock.json | 55 ++- packages/cli/package.json | 5 +- packages/cli/src/lib/log.ts | 30 +- packages/cli/src/lib/mini-oxygen-inspector.ts | 417 ++++++++++++++++++ packages/cli/src/lib/mini-oxygen.ts | 20 +- 5 files changed, 500 insertions(+), 27 deletions(-) create mode 100644 packages/cli/src/lib/mini-oxygen-inspector.ts diff --git a/package-lock.json b/package-lock.json index 4b69c404e9..4f086d3b2f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11852,6 +11852,12 @@ "node": ">=8" } }, + "node_modules/devtools-protocol": { + "version": "0.0.1177611", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1177611.tgz", + "integrity": "sha512-wivW6Jfe1Y75MY4PdZAaVsyeL37oMfmbodbuWkAQDuE1YAAJ5GnyrNpTfhXoQXFBoIWQdmBEf6t4U73OXctHrQ==", + "dev": true + }, "node_modules/didyoumean": { "version": "1.2.2", "dev": true, @@ -23378,7 +23384,8 @@ }, "node_modules/source-map": { "version": "0.7.4", - "license": "BSD-3-Clause", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", "engines": { "node": ">= 8" } @@ -26812,8 +26819,10 @@ "miniflare": "3.20230724.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", + "source-map": "^0.7.4", "tar-fs": "^2.1.1", - "typescript": "^4.9.5" + "typescript": "^4.9.5", + "ws": "^8.13.0" }, "bin": { "cli-hydrogen": "dist/create-app.js" @@ -26825,6 +26834,7 @@ "@types/prettier": "^2.7.2", "@types/recursive-readdir": "^2.2.1", "@types/tar-fs": "^2.0.1", + "devtools-protocol": "^0.0.1177611", "tempy": "^3.0.0", "type-fest": "^3.6.0", "vitest": "^0.33.0" @@ -27048,6 +27058,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "packages/cli/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "packages/create-hydrogen": { "name": "@shopify/create-hydrogen", "version": "4.2.0", @@ -31997,6 +32027,7 @@ "@types/recursive-readdir": "^2.2.1", "@types/tar-fs": "^2.0.1", "ansi-escapes": "^6.2.0", + "devtools-protocol": "^0.0.1177611", "diff": "^5.1.0", "fast-glob": "^3.2.12", "fs-extra": "^11.1.0", @@ -32005,11 +32036,13 @@ "miniflare": "3.20230724.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", + "source-map": "*", "tar-fs": "^2.1.1", "tempy": "^3.0.0", "type-fest": "^3.6.0", "typescript": "^4.9.5", - "vitest": "^0.33.0" + "vitest": "^0.33.0", + "ws": "*" }, "dependencies": { "@oclif/core": { @@ -32162,6 +32195,12 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.11.0.tgz", "integrity": "sha512-JaPw5U9ixP0XcpUbQoVSbxSDcK/K4nww20C3kjm9yE6cDRRhptU28AH60VWf9ltXmCrIfIbtt9J+2OUk2Uqiaw==", "dev": true + }, + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} } } }, @@ -35702,6 +35741,12 @@ "detect-newline": { "version": "3.1.0" }, + "devtools-protocol": { + "version": "0.0.1177611", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1177611.tgz", + "integrity": "sha512-wivW6Jfe1Y75MY4PdZAaVsyeL37oMfmbodbuWkAQDuE1YAAJ5GnyrNpTfhXoQXFBoIWQdmBEf6t4U73OXctHrQ==", + "dev": true + }, "didyoumean": { "version": "1.2.2", "dev": true @@ -42902,7 +42947,9 @@ } }, "source-map": { - "version": "0.7.4" + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==" }, "source-map-js": { "version": "1.0.2" diff --git a/packages/cli/package.json b/packages/cli/package.json index c60fb33772..7caa2e7b79 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -22,6 +22,7 @@ "@types/prettier": "^2.7.2", "@types/recursive-readdir": "^2.2.1", "@types/tar-fs": "^2.0.1", + "devtools-protocol": "^0.0.1177611", "tempy": "^3.0.0", "type-fest": "^3.6.0", "vitest": "^0.33.0" @@ -47,8 +48,10 @@ "miniflare": "3.20230724.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", + "source-map": "^0.7.4", "tar-fs": "^2.1.1", - "typescript": "^4.9.5" + "typescript": "^4.9.5", + "ws": "^8.13.0" }, "bin": "dist/create-app.js", "exports": { diff --git a/packages/cli/src/lib/log.ts b/packages/cli/src/lib/log.ts index 2184b25718..41577ae8bc 100644 --- a/packages/cli/src/lib/log.ts +++ b/packages/cli/src/lib/log.ts @@ -95,26 +95,26 @@ export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) { [ ([first]) => typeof first === 'string' && first.includes('workerd/io/'), (args: string[]) => { - if (args[0]?.includes('exception =')) return; + // if (args[0]?.includes('exception =')) return; - if (args[0]) { - args[0] = args[0] - .replace(/^.*?message\(\)\s+=\s+\["(.*?)"\].*$/gi, '$1') - .replace(/\\n/g, '\n'); - } + // if (args[0]) { + // args[0] = args[0] + // .replace(/^.*?message\(\)\s+=\s+\["(.*?)"\].*$/gi, '$1') + // .replace(/\\n/g, '\n'); + // } return args; }, ], - [ - ([first]) => typeof first === 'string' && first.includes('workerd/util/'), - () => {}, - ], - [ - ([first]) => - typeof first === 'string' && first.includes('workerd/server/'), - () => {}, - ], + // [ + // ([first]) => typeof first === 'string' && first.includes('workerd/util/'), + // () => {}, + // ], + // [ + // ([first]) => + // typeof first === 'string' && first.includes('workerd/server/'), + // () => {}, + // ], ); } diff --git a/packages/cli/src/lib/mini-oxygen-inspector.ts b/packages/cli/src/lib/mini-oxygen-inspector.ts new file mode 100644 index 0000000000..6f95b30f61 --- /dev/null +++ b/packages/cli/src/lib/mini-oxygen-inspector.ts @@ -0,0 +1,417 @@ +import {readFile} from 'fs/promises'; +import {SourceMapConsumer} from 'source-map'; +import WebSocket from 'ws'; +import {Protocol} from 'devtools-protocol'; +import type {MessageEvent} from 'ws'; + +// https://chromedevtools.github.io/devtools-protocol/#endpoints +interface InspectorWebSocketTarget { + id: string; + title: string; + type: 'node'; + description: string; + webSocketDebuggerUrl: string; + devtoolsFrontendUrl: string; + devtoolsFrontendUrlCompat: string; + faviconUrl: string; + url: string; +} + +export async function findInspectorUrl(inspectorPort: number) { + try { + // Fetch the inspector JSON response from the DevTools Inspector protocol + const jsonUrl = `http://127.0.0.1:${inspectorPort}/json`; + const body = (await ( + await fetch(jsonUrl) + ).json()) as InspectorWebSocketTarget[]; + + return body?.find(({id}) => id === 'core:user:hydrogen') + ?.webSocketDebuggerUrl; + } catch (error: unknown) { + console.error('Error attempting to retrieve debugger URL:', error); + } +} + +interface InspectorProps { + /** + * The websocket URL exposed by Workers that the inspector should connect to. + */ + inspectorUrl: string; + /** + * Sourcemap path, so that stacktraces can be interpretted + */ + sourceMapPath?: string | undefined; +} + +export function connectToInspector(props: InspectorProps) { + /** + * A simple decrementing id to attach to messages sent to DevTools. + * Use negative ids to void collisions with DevTools messages. + */ + const messageCounterRef = {value: -1}; + const getMessageId = () => messageCounterRef.value--; + + const ws = new WebSocket(props.inspectorUrl); + + /** + * A handle to the interval we run to keep the websocket alive + */ + let keepAliveInterval: NodeJS.Timer; + + /** + * Test if the websocket is closed + */ + const isClosed = () => + ws.readyState === WebSocket.CLOSED || ws.readyState === WebSocket.CLOSING; + + /** + * Send a message to the remote websocket + */ + const send = (event: Record) => { + if (!isClosed()) { + ws.send(JSON.stringify(event)); + } + }; + + const closeWs = () => { + if (!isClosed()) { + try { + ws.close(); + } catch (err) { + // Closing before the websocket is ready will throw an error. + } + } + }; + + ws.addEventListener('message', async (event: MessageEvent) => { + if (typeof event.data === 'string') { + const evt = JSON.parse(event.data); + console.log('MESSAGE!', evt); + if (evt.result) { + console.log(evt?.result?.result); + } + if (evt.method === 'Runtime.exceptionThrown') { + const params = evt.params as Protocol.Runtime.ExceptionThrownEvent; + + // Parse stack trace with source map. + if (props.sourceMapPath) { + // Parse in the sourcemap + const mapContent = JSON.parse( + await readFile(props.sourceMapPath, 'utf-8'), + ); + + // Create the lines for the exception details log + const exceptionLines = [ + params.exceptionDetails.exception?.description?.split('\n')[0], + ]; + + await SourceMapConsumer.with(mapContent, null, async (consumer) => { + // Pass each of the callframes into the consumer, and format the error + const stack = params.exceptionDetails.stackTrace?.callFrames; + + stack?.forEach(({functionName, lineNumber, columnNumber}, i) => { + try { + if (lineNumber) { + // The line and column numbers in the stackTrace are zero indexed, + // whereas the sourcemap consumer indexes from one. + const pos = consumer.originalPositionFor({ + line: lineNumber + 1, + column: columnNumber + 1, + }); + + // Print out line which caused error: + if (i === 0 && pos.source && pos.line) { + const fileSource = consumer.sourceContentFor(pos.source); + const fileSourceLine = + fileSource?.split('\n')[pos.line - 1] || ''; + exceptionLines.push(fileSourceLine.trim()); + + // If we have a column, we can mark the position underneath + if (pos.column) { + exceptionLines.push( + `${' '.repeat( + pos.column - fileSourceLine.search(/\S/), + )}^`, + ); + } + } + + // From the way esbuild implements the "names" field: + // > To save space, the original name is only recorded when it's different from the final name. + // however, source-map consumer does not handle this + if (pos && pos.line != null) { + const convertedFnName = pos.name || functionName || ''; + exceptionLines.push( + ` at ${convertedFnName} (${pos.source}:${pos.line}:${pos.column})`, + ); + } + } + } catch { + // Line failed to parse through the sourcemap consumer + // We should handle this better + } + }); + }); + + // Log the parsed stacktrace + console.error( + params.exceptionDetails.text, + exceptionLines.join('\n'), + ); + } else { + // We log the stacktrace to the terminal + console.error( + params.exceptionDetails.text, + params.exceptionDetails.exception?.description ?? '', + ); + } + } + if (evt.method === 'Runtime.consoleAPICalled') { + logConsoleMessage( + evt.params as Protocol.Runtime.ConsoleAPICalledEvent, + send, + getMessageId, + ); + } + } else { + // We should never get here, but who know is 2022... + console.error('Unrecognised devtools event:', event); + } + }); + + ws.once('open', () => { + send({method: 'Runtime.enable', id: getMessageId()}); + // TODO: Why does this need a timeout? + setTimeout(() => { + send({method: 'Network.enable', id: getMessageId()}); + }, 2000); + + keepAliveInterval = setInterval(() => { + send({ + method: 'Runtime.getIsolateId', + id: getMessageId(), + }); + }, 10_000); + }); + + ws.on('unexpected-response', () => { + console.log('Waiting for connection...'); + /** + * This usually means the worker is not "ready" yet + * so we'll just retry the connection process + */ + // retryRemoteWebSocketConnection(); + }); + + ws.once('close', () => { + console.log('ws close'); + clearInterval(keepAliveInterval); + }); + + return () => { + // clean up! Let's first stop the heartbeat interval + clearInterval(keepAliveInterval); + // Then we'll send a message to the devtools instance to + // tell it to clear the console. + // Finally, we'll close the websocket + if (!isClosed()) { + try { + ws.close(); + } catch (err) { + // Closing before the websocket is ready will throw an error. + } + } + }; +} + +/** + * This function converts a message serialised as a devtools event + * into arguments suitable to be called by a console method, and + * then actually calls the method with those arguments. Effectively, + * we're just doing a little bit of the work of the devtools console, + * directly in the terminal. + */ + +export const mapConsoleAPIMessageTypeToConsoleMethod: { + [key in Protocol.Runtime.ConsoleAPICalledEvent['type']]: Exclude< + keyof Console, + 'Console' + >; +} = { + log: 'log', + debug: 'debug', + info: 'info', + warning: 'warn', + error: 'error', + dir: 'dir', + dirxml: 'dirxml', + table: 'table', + trace: 'trace', + clear: 'clear', + count: 'count', + assert: 'assert', + profile: 'profile', + profileEnd: 'profileEnd', + timeEnd: 'timeEnd', + startGroup: 'group', + startGroupCollapsed: 'groupCollapsed', + endGroup: 'groupEnd', +}; + +function logConsoleMessage( + evt: Protocol.Runtime.ConsoleAPICalledEvent, + send: (message: {id: number; [key: string]: any}) => void, + getMessageId: () => number, +): void { + const args: string[] = []; + console.log('logConsoleMessage' + Math.random(), evt); + for (const ro of evt.args) { + switch (ro.type) { + case 'string': + case 'number': + case 'boolean': + case 'undefined': + case 'symbol': + case 'bigint': + args.push(ro.value); + break; + case 'function': + args.push(`[Function: ${ro.description ?? ''}]`); + break; + case 'object': + if (!ro.preview) { + args.push( + ro.subtype === 'null' + ? 'null' + : ro.description ?? '', + ); + } else { + args.push(ro.preview.description ?? ''); + + switch (ro.preview.subtype) { + case 'array': + args.push( + '[ ' + + ro.preview.properties + .map(({value}) => { + return value; + }) + .join(', ') + + (ro.preview.overflow ? '...' : '') + + ' ]', + ); + + break; + case 'weakmap': + case 'map': + ro.preview.entries === undefined + ? args.push('{}') + : args.push( + '{\n' + + ro.preview.entries + .map(({key, value}) => { + return ` ${key?.description ?? ''} => ${ + value.description + }`; + }) + .join(',\n') + + (ro.preview.overflow ? '\n ...' : '') + + '\n}', + ); + + break; + case 'weakset': + case 'set': + ro.preview.entries === undefined + ? args.push('{}') + : args.push( + '{ ' + + ro.preview.entries + .map(({value}) => { + return `${value.description}`; + }) + .join(', ') + + (ro.preview.overflow ? ', ...' : '') + + ' }', + ); + break; + case 'regexp': + break; + case 'date': + break; + case 'generator': + args.push(ro.preview?.properties[0]?.value || ''); + break; + case 'promise': + if (ro.preview?.properties[0]?.value === 'pending') { + args.push(`{<${ro.preview.properties[0].value}>}`); + } else { + args.push( + `{<${ro.preview?.properties[0]?.value}>: ${ro.preview?.properties[1]?.value}}`, + ); + } + break; + case 'node': + case 'iterator': + case 'proxy': + case 'typedarray': + case 'arraybuffer': + case 'dataview': + case 'webassemblymemory': + case 'wasmvalue': + break; + case 'error': + default: + console.log('sending...', ro.objectId); + + setTimeout(() => { + send({ + method: 'Runtime.getProperties', + id: getMessageId(), + params: { + objectId: ro.objectId!, + ownProperties: true, + }, + }); + }, 1000); + + console.log('error!', ro.preview.properties); + args.push( + '{\n' + + ro.preview.properties + .map(({name, value}) => { + return ` ${name}: ${value}`; + }) + .join(',\n') + + (ro.preview.overflow ? '\n ...' : '') + + '\n}', + ); + } + } + break; + default: + args.push(ro.description || ro.unserializableValue || '🦋'); + break; + } + } + + const method = mapConsoleAPIMessageTypeToConsoleMethod[evt.type]; + + if (method in console) { + switch (method) { + case 'dir': + console.dir(args); + break; + case 'table': + console.table(args); + break; + default: + // eslint-disable-next-line prefer-spread + console[method].apply(console, args); + break; + } + } else { + console.warn(`Unsupported console method: ${method}`); + console.warn('console event:', evt); + } +} diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index b8c0fec908..b22d61e173 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -16,6 +16,7 @@ import { Response, fetch, } from 'miniflare'; +import {connectToInspector, findInspectorUrl} from './mini-oxygen-inspector.js'; type MiniOxygenOptions = { root: string; @@ -36,18 +37,16 @@ export async function startMiniOxygen({ buildPathClient, env, }: MiniOxygenOptions) { - const log = new Log(2); - // @ts-ignore - log.log = () => {}; - log.warn = () => {}; + const inspectorPort = 8787; const buildMiniOxygenOptions = async () => ({ cf: false, verbose: true, port: port, - log, + log: new Log(5), liveReload: watch, + inspectorPort, workers: [ { name: 'mini-oxygen', @@ -87,8 +86,12 @@ export async function startMiniOxygen({ let miniOxygenOptions = await buildMiniOxygenOptions(); const miniOxygen = new Miniflare(miniOxygenOptions); + const listeningAt = await miniOxygen.ready; - const listeningAt = `http://localhost:${port}`; + let inspectorUrl = await findInspectorUrl(inspectorPort); + let cleanupInspector = inspectorUrl + ? connectToInspector({inspectorUrl}) + : undefined; return { port, @@ -106,7 +109,10 @@ export async function startMiniOxygen({ } } - return miniOxygen.setOptions(miniOxygenOptions); + cleanupInspector?.(); + await miniOxygen.setOptions(miniOxygenOptions); + inspectorUrl ??= await findInspectorUrl(inspectorPort); + if (inspectorUrl) cleanupInspector = connectToInspector({inspectorUrl}); }, showBanner(options?: { mode?: string; From 02c53a24b73d23000c067acf2866a6faf97a5860 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 3 Aug 2023 19:29:42 +0200 Subject: [PATCH 06/38] Full parity with MiniOxygen logging --- package-lock.json | 33 +- packages/cli/package.json | 2 + packages/cli/src/lib/log.ts | 46 +- packages/cli/src/lib/mini-oxygen-inspector.ts | 483 +++++++++++++----- packages/cli/src/lib/mini-oxygen.ts | 16 +- packages/hydrogen/src/storefront.ts | 4 +- 6 files changed, 416 insertions(+), 168 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4f086d3b2f..759f7df608 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8382,6 +8382,12 @@ "@types/node": "*" } }, + "node_modules/@types/stack-trace": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/@types/stack-trace/-/stack-trace-0.0.30.tgz", + "integrity": "sha512-g58ZMrK7OLAzzxqeGF/w9jYsIWMuA9I/p/d493+x5vz3LyIEhrh3swszq28poF45X0ZD8vpAznMLBTyKPYFBeA==", + "dev": true + }, "node_modules/@types/stack-utils": { "version": "2.0.1", "dev": true, @@ -23558,6 +23564,14 @@ "stackframe": "^1.3.4" } }, + "node_modules/stack-trace": { + "version": "1.0.0-pre2", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-1.0.0-pre2.tgz", + "integrity": "sha512-2ztBJRek8IVofG9DBJqdy2N5kulaacX30Nz7xmkYF6ale9WBVmIy6mFBchvGX7Vx/MyjBhx+Rcxqrj+dbOnQ6A==", + "engines": { + "node": ">=16" + } + }, "node_modules/stack-utils": { "version": "2.0.6", "license": "MIT", @@ -26820,6 +26834,7 @@ "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", "source-map": "^0.7.4", + "stack-trace": "^1.0.0-pre2", "tar-fs": "^2.1.1", "typescript": "^4.9.5", "ws": "^8.13.0" @@ -26833,6 +26848,7 @@ "@types/gunzip-maybe": "^1.4.0", "@types/prettier": "^2.7.2", "@types/recursive-readdir": "^2.2.1", + "@types/stack-trace": "^0.0.30", "@types/tar-fs": "^2.0.1", "devtools-protocol": "^0.0.1177611", "tempy": "^3.0.0", @@ -32025,6 +32041,7 @@ "@types/gunzip-maybe": "^1.4.0", "@types/prettier": "^2.7.2", "@types/recursive-readdir": "^2.2.1", + "@types/stack-trace": "*", "@types/tar-fs": "^2.0.1", "ansi-escapes": "^6.2.0", "devtools-protocol": "^0.0.1177611", @@ -32036,13 +32053,14 @@ "miniflare": "3.20230724.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", - "source-map": "*", + "source-map": "^0.7.4", + "stack-trace": "^1.0.0-pre2", "tar-fs": "^2.1.1", "tempy": "^3.0.0", "type-fest": "^3.6.0", "typescript": "^4.9.5", "vitest": "^0.33.0", - "ws": "*" + "ws": "^8.13.0" }, "dependencies": { "@oclif/core": { @@ -33507,6 +33525,12 @@ "@types/node": "*" } }, + "@types/stack-trace": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/@types/stack-trace/-/stack-trace-0.0.30.tgz", + "integrity": "sha512-g58ZMrK7OLAzzxqeGF/w9jYsIWMuA9I/p/d493+x5vz3LyIEhrh3swszq28poF45X0ZD8vpAznMLBTyKPYFBeA==", + "dev": true + }, "@types/stack-utils": { "version": "2.0.1", "dev": true @@ -43075,6 +43099,11 @@ "stackframe": "^1.3.4" } }, + "stack-trace": { + "version": "1.0.0-pre2", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-1.0.0-pre2.tgz", + "integrity": "sha512-2ztBJRek8IVofG9DBJqdy2N5kulaacX30Nz7xmkYF6ale9WBVmIy6mFBchvGX7Vx/MyjBhx+Rcxqrj+dbOnQ6A==" + }, "stack-utils": { "version": "2.0.6", "requires": { diff --git a/packages/cli/package.json b/packages/cli/package.json index 7caa2e7b79..fb50518c08 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -21,6 +21,7 @@ "@types/gunzip-maybe": "^1.4.0", "@types/prettier": "^2.7.2", "@types/recursive-readdir": "^2.2.1", + "@types/stack-trace": "^0.0.30", "@types/tar-fs": "^2.0.1", "devtools-protocol": "^0.0.1177611", "tempy": "^3.0.0", @@ -49,6 +50,7 @@ "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", "source-map": "^0.7.4", + "stack-trace": "^1.0.0-pre2", "tar-fs": "^2.1.1", "typescript": "^4.9.5", "ws": "^8.13.0" diff --git a/packages/cli/src/lib/log.ts b/packages/cli/src/lib/log.ts index 41577ae8bc..435ed3170a 100644 --- a/packages/cli/src/lib/log.ts +++ b/packages/cli/src/lib/log.ts @@ -88,34 +88,13 @@ function injectLogReplacer( * Mute logs from Miniflare */ export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) { - injectLogReplacer('log'); - - addMessageReplacers( - 'dev', - [ - ([first]) => typeof first === 'string' && first.includes('workerd/io/'), - (args: string[]) => { - // if (args[0]?.includes('exception =')) return; - - // if (args[0]) { - // args[0] = args[0] - // .replace(/^.*?message\(\)\s+=\s+\["(.*?)"\].*$/gi, '$1') - // .replace(/\\n/g, '\n'); - // } + injectLogReplacer('error'); - return args; - }, - ], - // [ - // ([first]) => typeof first === 'string' && first.includes('workerd/util/'), - // () => {}, - // ], - // [ - // ([first]) => - // typeof first === 'string' && first.includes('workerd/server/'), - // () => {}, - // ], - ); + addMessageReplacers('dev', [ + // Workerd logs + ([first]) => typeof first === 'string' && first.startsWith('\x1B[31m'), + () => {}, + ]); } const originalWrite = process.stdout.write; @@ -223,7 +202,7 @@ export function enhanceH2Logs(options: { const stringArg = errorObject?.message ?? (firstArg as string); const [, type, scope, message] = - stringArg.match(/^\[h2:([^:]+):([^\]]+)\]\s+(.*)$/ims) || []; + stringArg.match(/\[h2:([^:]+):([^\]]+)\]\s+(.*)$/ims) || []; if (!type || !scope || !message) return args; @@ -237,11 +216,18 @@ export function enhanceH2Logs(options: { if (type === 'error' || errorObject) { let tryMessage = hasLinks ? lastLine : undefined; let stack = errorObject?.stack; - const cause = errorObject?.cause as + let cause = errorObject?.cause as | {[key: string]: any; graphql?: {query: string; variables: string}} + | string | undefined; - if (!!cause?.graphql?.query) { + if (typeof cause === 'string') { + try { + cause = JSON.parse(cause); + } catch {} + } + + if (typeof cause !== 'string' && !!cause?.graphql?.query) { const {query, variables} = cause.graphql; const link = `${options.graphiqlUrl}?query=${encodeURIComponent( query, diff --git a/packages/cli/src/lib/mini-oxygen-inspector.ts b/packages/cli/src/lib/mini-oxygen-inspector.ts index 6f95b30f61..ff039ed190 100644 --- a/packages/cli/src/lib/mini-oxygen-inspector.ts +++ b/packages/cli/src/lib/mini-oxygen-inspector.ts @@ -1,8 +1,14 @@ -import {readFile} from 'fs/promises'; +/** + * Huge part of this code comes from Wrangler: + * https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/inspect.ts + */ + +import {dirname} from 'node:path'; +import {readFile} from 'node:fs/promises'; import {SourceMapConsumer} from 'source-map'; -import WebSocket from 'ws'; +import {parse as parseStackTrace} from 'stack-trace'; +import WebSocket, {type MessageEvent} from 'ws'; import {Protocol} from 'devtools-protocol'; -import type {MessageEvent} from 'ws'; // https://chromedevtools.github.io/devtools-protocol/#endpoints interface InspectorWebSocketTarget { @@ -43,15 +49,24 @@ interface InspectorProps { sourceMapPath?: string | undefined; } -export function connectToInspector(props: InspectorProps) { +interface ErrorProperties { + message?: string; + cause?: unknown; + stack?: string; +} + +export function connectToInspector({ + inspectorUrl, + sourceMapPath, +}: InspectorProps) { /** * A simple decrementing id to attach to messages sent to DevTools. * Use negative ids to void collisions with DevTools messages. */ const messageCounterRef = {value: -1}; const getMessageId = () => messageCounterRef.value--; - - const ws = new WebSocket(props.inspectorUrl); + const pendingMessages = new Map void>(); + const ws = new WebSocket(inspectorUrl); /** * A handle to the interval we run to keep the websocket alive @@ -67,111 +82,233 @@ export function connectToInspector(props: InspectorProps) { /** * Send a message to the remote websocket */ - const send = (event: Record) => { + const send = ( + method: string, + params?: Request, + ) => { if (!isClosed()) { - ws.send(JSON.stringify(event)); + const id = getMessageId(); + + let promiseResolve: ((result: Response) => void) | undefined = undefined; + const promise = new Promise( + (resolve) => (promiseResolve = resolve), + ); + + pendingMessages.set(id, promiseResolve as any); + ws.send(JSON.stringify({id, method, params})); + return promise; } + + return Promise.resolve(undefined); }; - const closeWs = () => { - if (!isClosed()) { - try { - ws.close(); - } catch (err) { - // Closing before the websocket is ready will throw an error. + const cleanupMessageQueue = (data: {id: number; result: unknown}) => { + try { + if (data?.id < 0) { + // We only use negative IDs for internal messages + const resolve = pendingMessages.get(data.id); + if (resolve !== undefined) { + pendingMessages.delete(data.id); + resolve(data.result); + } + + return true; } + } catch (error) { + console.error(error); } + + return false; }; - ws.addEventListener('message', async (event: MessageEvent) => { - if (typeof event.data === 'string') { - const evt = JSON.parse(event.data); - console.log('MESSAGE!', evt); - if (evt.result) { - console.log(evt?.result?.result); + function getPropertyValue( + name: string, + response?: Protocol.Runtime.GetPropertiesResponse, + ) { + return response?.result.find((prop) => prop.name === name)?.value; + } + + const reconstructError = async ( + initialProperties: ErrorProperties, + ro?: Protocol.Runtime.RemoteObject, + ) => { + let errorProperties = {...initialProperties}; + + // The two requests here are based on intercepted messages sent by + // the DevTools frontend to view the stack. + const objectId = ro?.objectId; + + if (objectId) { + // Get all properties + const [sourceMapConsumer, getPropertiesResponse] = await Promise.all([ + getSourceMapConsumer(), + send< + Protocol.Runtime.GetPropertiesRequest, + Protocol.Runtime.GetPropertiesResponse + >('Runtime.getProperties', { + objectId, + ownProperties: false, + accessorPropertiesOnly: false, + generatePreview: false, + nonIndexedPropertiesOnly: false, + }), + ]); + + const message = getPropertyValue('message', getPropertiesResponse); + if (message?.value) { + errorProperties.message = message.value; + } + + const stack = getPropertyValue('stack', getPropertiesResponse); + if (stack?.value) { + errorProperties.stack = sourceMapConsumer + ? formatStack(sourceMapConsumer, stack.value) + : stack.value; } - if (evt.method === 'Runtime.exceptionThrown') { - const params = evt.params as Protocol.Runtime.ExceptionThrownEvent; - // Parse stack trace with source map. - if (props.sourceMapPath) { - // Parse in the sourcemap - const mapContent = JSON.parse( - await readFile(props.sourceMapPath, 'utf-8'), + // If this error has a `cause` property, display it + const cause = getPropertyValue('cause', getPropertiesResponse); + if (cause) { + errorProperties.cause = cause.description ?? cause.value; + + if ( + cause.subtype === 'error' && + sourceMapConsumer && + cause.description !== undefined + ) { + errorProperties.stack = formatStack( + sourceMapConsumer, + cause.description, ); + } + } - // Create the lines for the exception details log - const exceptionLines = [ - params.exceptionDetails.exception?.description?.split('\n')[0], - ]; + // `DOMException`s are special, the actually useful stack trace + // is hidden behind the `stack` getter, and not included in the + // preview: https://github.com/cloudflare/workerd/blob/1b5057f2bfcfedf146f6f79ff04e99903d55412b/src/workerd/jsg/dom-exception.h#L92 + const isDomException = ro?.className === 'DOMException'; - await SourceMapConsumer.with(mapContent, null, async (consumer) => { - // Pass each of the callframes into the consumer, and format the error - const stack = params.exceptionDetails.stackTrace?.callFrames; + if (isDomException) { + // If this is a `DOMException`, get a reference to `stack` + const stackDescriptor = getPropertiesResponse?.result.find( + (prop) => prop.name === 'stack', + ); + const getObjectId = stackDescriptor?.get?.objectId; + if (getObjectId !== undefined) { + // Invoke the `stack` getter + const callFunctionResponse = await send< + Protocol.Runtime.CallFunctionOnRequest, + Protocol.Runtime.CallFunctionOnResponse + >('Runtime.callFunctionOn', { + objectId, + functionDeclaration: + 'function invokeGetter(getter) { return Reflect.apply(getter, this, []); }', + arguments: [{objectId: getObjectId}], + silent: true, + }); - stack?.forEach(({functionName, lineNumber, columnNumber}, i) => { + if (callFunctionResponse !== undefined) { + // Log the source-mapped `stack` if we have a consumer + const stack: unknown = callFunctionResponse.result.value; + if (typeof stack === 'string' && sourceMapConsumer !== undefined) { + errorProperties.stack = formatStack(sourceMapConsumer, stack); + } else { try { - if (lineNumber) { - // The line and column numbers in the stackTrace are zero indexed, - // whereas the sourcemap consumer indexes from one. - const pos = consumer.originalPositionFor({ - line: lineNumber + 1, - column: columnNumber + 1, - }); - - // Print out line which caused error: - if (i === 0 && pos.source && pos.line) { - const fileSource = consumer.sourceContentFor(pos.source); - const fileSourceLine = - fileSource?.split('\n')[pos.line - 1] || ''; - exceptionLines.push(fileSourceLine.trim()); - - // If we have a column, we can mark the position underneath - if (pos.column) { - exceptionLines.push( - `${' '.repeat( - pos.column - fileSourceLine.search(/\S/), - )}^`, - ); - } - } - - // From the way esbuild implements the "names" field: - // > To save space, the original name is only recorded when it's different from the final name. - // however, source-map consumer does not handle this - if (pos && pos.line != null) { - const convertedFnName = pos.name || functionName || ''; - exceptionLines.push( - ` at ${convertedFnName} (${pos.source}:${pos.line}:${pos.column})`, - ); - } - } - } catch { - // Line failed to parse through the sourcemap consumer - // We should handle this better - } - }); - }); + errorProperties.stack = JSON.stringify(stack); + } catch {} + } + } + } + } + } + + const error = new Error(errorProperties.message, { + cause: errorProperties.cause, + }); + + error.stack = errorProperties.stack; + + return error; + }; + + // Parse the source-map lazily when required, then store it, so we can we + // reuse the consumer for different errors without having to parse the map + // each time. Consumers must be destroyed when no longer needed, so create + // an abort controller aborted to signal destruction. + const sourceMapAbortController = new AbortController(); + let sourceMapConsumerPromise: Promise; + const getSourceMapConsumer = () => { + return (sourceMapConsumerPromise ??= (async () => { + // If we don't have a source map, or we've aborted, skip source mapping + if (!sourceMapPath || sourceMapAbortController.signal.aborted) { + return; + } - // Log the parsed stacktrace - console.error( - params.exceptionDetails.text, - exceptionLines.join('\n'), + try { + // Load and parse the source map + const mapContent = await readFile(sourceMapPath, 'utf-8'); + if (sourceMapAbortController.signal.aborted) return; + const map = JSON.parse(mapContent); + map.sourceRoot = dirname(sourceMapPath); + + // `new SourceMapConsumer(...)` returns a `Promise` + const sourceMapConsumer = await new SourceMapConsumer(map); + if (sourceMapAbortController.signal.aborted) { + sourceMapConsumer.destroy(); + return; + } + + sourceMapAbortController.signal.addEventListener('abort', () => { + sourceMapConsumerPromise = Promise.resolve(undefined); + sourceMapConsumer.destroy(); + }); + return sourceMapConsumer; + } catch {} + })()); + }; + + ws.addEventListener('message', async (event: MessageEvent) => { + if (typeof event.data === 'string') { + const evt = JSON.parse(event.data); + cleanupMessageQueue(evt); + + if (evt.method === 'Runtime.exceptionThrown') { + const params = evt.params as Protocol.Runtime.ExceptionThrownEvent; + + const errorProperties: ErrorProperties = {}; + + const sourceMapConsumer = await getSourceMapConsumer(); + if (sourceMapConsumer !== undefined) { + // Create the lines for the exception details log + const message = + params.exceptionDetails.exception?.description?.split('\n')[0]; + const stack = params.exceptionDetails.stackTrace?.callFrames; + const formatted = formatStructuredError( + sourceMapConsumer, + message, + stack, ); + + errorProperties.message = params.exceptionDetails.text; + errorProperties.stack = formatted; } else { - // We log the stacktrace to the terminal - console.error( - params.exceptionDetails.text, - params.exceptionDetails.exception?.description ?? '', - ); + errorProperties.message = + params.exceptionDetails.text + + ' ' + + (params.exceptionDetails.exception?.description ?? ''); } + + console.error( + await reconstructError( + errorProperties, + params.exceptionDetails.exception, + ), + ); } + if (evt.method === 'Runtime.consoleAPICalled') { - logConsoleMessage( - evt.params as Protocol.Runtime.ConsoleAPICalledEvent, - send, - getMessageId, - ); + const params = evt.params as Protocol.Runtime.ConsoleAPICalledEvent; + logConsoleMessage(params, reconstructError); } } else { // We should never get here, but who know is 2022... @@ -180,18 +317,11 @@ export function connectToInspector(props: InspectorProps) { }); ws.once('open', () => { - send({method: 'Runtime.enable', id: getMessageId()}); + send('Runtime.enable'); // TODO: Why does this need a timeout? - setTimeout(() => { - send({method: 'Network.enable', id: getMessageId()}); - }, 2000); - - keepAliveInterval = setInterval(() => { - send({ - method: 'Runtime.getIsolateId', - id: getMessageId(), - }); - }, 10_000); + // setTimeout(() => send('Network.enable'), 2000); + + keepAliveInterval = setInterval(() => send('Runtime.getIsolateId'), 10_000); }); ws.on('unexpected-response', () => { @@ -204,16 +334,13 @@ export function connectToInspector(props: InspectorProps) { }); ws.once('close', () => { - console.log('ws close'); clearInterval(keepAliveInterval); + sourceMapAbortController.abort(); }); return () => { - // clean up! Let's first stop the heartbeat interval clearInterval(keepAliveInterval); - // Then we'll send a message to the devtools instance to - // tell it to clear the console. - // Finally, we'll close the websocket + if (!isClosed()) { try { ws.close(); @@ -221,6 +348,8 @@ export function connectToInspector(props: InspectorProps) { // Closing before the websocket is ready will throw an error. } } + + sourceMapAbortController.abort(); }; } @@ -258,13 +387,14 @@ export const mapConsoleAPIMessageTypeToConsoleMethod: { endGroup: 'groupEnd', }; -function logConsoleMessage( +async function logConsoleMessage( evt: Protocol.Runtime.ConsoleAPICalledEvent, - send: (message: {id: number; [key: string]: any}) => void, - getMessageId: () => number, -): void { - const args: string[] = []; - console.log('logConsoleMessage' + Math.random(), evt); + reconstructError: ( + initialProperties: ErrorProperties, + ro: Protocol.Runtime.RemoteObject, + ) => Promise, +) { + const args: Array = []; for (const ro of evt.args) { switch (ro.type) { case 'string': @@ -286,7 +416,7 @@ function logConsoleMessage( : ro.description ?? '', ); } else { - args.push(ro.preview.description ?? ''); + if (ro.preview.description) args.push(ro.preview.description); switch (ro.preview.subtype) { case 'array': @@ -361,21 +491,33 @@ function logConsoleMessage( case 'wasmvalue': break; case 'error': + const errorProperties = { + message: + ro.preview.description + ?.split('\n') + .filter((line) => !/^\s+at\s/.test(line)) + .join('\n') ?? + ro.preview.properties.find(({name}) => name === 'message') + ?.value ?? + '', + stack: + ro.preview.description ?? + ro.description ?? + ro.preview.properties.find(({name}) => name === 'stack') + ?.value, + cause: ro.preview.properties.find(({name}) => name === 'cause') + ?.value as unknown, + }; + + // Even though we have gathered all the properties, they are likely + // truncated so we need to fetch their full version. + const error = await reconstructError(errorProperties, ro); + + // Replace its description in args + args.splice(-1, 1, error); + + break; default: - console.log('sending...', ro.objectId); - - setTimeout(() => { - send({ - method: 'Runtime.getProperties', - id: getMessageId(), - params: { - objectId: ro.objectId!, - ownProperties: true, - }, - }); - }, 1000); - - console.log('error!', ro.preview.properties); args.push( '{\n' + ro.preview.properties @@ -406,7 +548,7 @@ function logConsoleMessage( console.table(args); break; default: - // eslint-disable-next-line prefer-spread + // @ts-expect-error console[method].apply(console, args); break; } @@ -415,3 +557,88 @@ function logConsoleMessage( console.warn('console event:', evt); } } + +/** + * Converts a structured-error to a friendly, source-mapped error string. + * @param sourceMapConsumer source-map to use for mapping locations + * @param message first line of stack trace (e.g. `Error: message`) + * @param frames structured stack entries for error location + */ +function formatStructuredError( + sourceMapConsumer: SourceMapConsumer, + message?: string, + frames?: Protocol.Runtime.CallFrame[], +): string { + const lines: string[] = []; + if (message !== undefined) lines.push(message); + // Pass each of the callframes into the consumer, and format the error + frames?.forEach(({functionName, lineNumber, columnNumber}, i) => { + try { + if (lineNumber) { + // `Protocol.Runtime.CallFrame` uses 0-indexed line and column + // numbers, whereas `source-map` expects 1-indexing for lines and + // 0-indexing for columns; + const pos = sourceMapConsumer.originalPositionFor({ + line: lineNumber + 1, + column: columnNumber, + }); + + // Print out line which caused error: + if (i === 0 && pos.source && pos.line) { + const fileSource = sourceMapConsumer.sourceContentFor(pos.source); + const fileSourceLine = fileSource?.split('\n')[pos.line - 1] || ''; + lines.push(fileSourceLine.trim()); + + // If we have a column, we can mark the position underneath + if (pos.column) { + lines.push( + `${' '.repeat(pos.column - fileSourceLine.search(/\S/))}^`, + ); + } + } + + // From the way esbuild implements the "names" field: + // > To save space, the original name is only recorded when it's different from the final name. + // however, source-map consumer does not handle this + if (pos && pos.line !== null && pos.column !== null) { + const convertedFnName = pos.name || functionName || ''; + let convertedLocation = `${pos.source}:${pos.line}:${pos.column + 1}`; + + if (convertedFnName === '') { + lines.push(` at ${convertedLocation}`); + } else { + lines.push(` at ${convertedFnName} (${convertedLocation})`); + } + } + } + } catch { + // Line failed to parse through the sourcemap consumer + // We should handle this better + } + }); + + return lines.join('\n'); +} + +/** + * Converts an unstructured-stack to a friendly, source-mapped error string. + * @param sourceMapConsumer source-map to use for mapping locations + * @param stack string stack trace from `Error#stack` + */ +function formatStack(sourceMapConsumer: SourceMapConsumer, stack: string) { + const message = stack.split('\n')[0]; + // `stack-trace` requires an object with a `stack` property: + // https://github.com/felixge/node-stack-trace/blob/ba06dcdb50d465cd440d84a563836e293b360427/index.js#L21-L23 + const callSites = parseStackTrace({stack} as Error); + const frames = callSites.map((site) => ({ + functionName: site.getFunctionName() ?? '', + // `Protocol.Runtime.CallFrame`s line numbers are 0-indexed, hence `- 1` + lineNumber: (site.getLineNumber() ?? 1) - 1, + columnNumber: site.getColumnNumber() ?? 1, + // Unused by `formattedError` + scriptId: '', + url: '', + })); + + return formatStructuredError(sourceMapConsumer, message, frames); +} diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index b22d61e173..de8ad309cb 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -11,10 +11,10 @@ import mime from 'mime'; import { Miniflare, type MiniflareOptions, - Log, Request, Response, fetch, + NoOpLog, } from 'miniflare'; import {connectToInspector, findInspectorUrl} from './mini-oxygen-inspector.js'; @@ -42,11 +42,12 @@ export async function startMiniOxygen({ const buildMiniOxygenOptions = async () => ({ cf: false, - verbose: true, + verbose: false, port: port, - log: new Log(5), + log: new NoOpLog(), liveReload: watch, inspectorPort, + host: 'localhost', workers: [ { name: 'mini-oxygen', @@ -86,11 +87,12 @@ export async function startMiniOxygen({ let miniOxygenOptions = await buildMiniOxygenOptions(); const miniOxygen = new Miniflare(miniOxygenOptions); - const listeningAt = await miniOxygen.ready; + const listeningAt = (await miniOxygen.ready).origin; + const sourceMapPath = buildPathWorkerFile + '.map'; let inspectorUrl = await findInspectorUrl(inspectorPort); let cleanupInspector = inspectorUrl - ? connectToInspector({inspectorUrl}) + ? connectToInspector({inspectorUrl, sourceMapPath}) : undefined; return { @@ -112,7 +114,9 @@ export async function startMiniOxygen({ cleanupInspector?.(); await miniOxygen.setOptions(miniOxygenOptions); inspectorUrl ??= await findInspectorUrl(inspectorPort); - if (inspectorUrl) cleanupInspector = connectToInspector({inspectorUrl}); + if (inspectorUrl) { + cleanupInspector = connectToInspector({inspectorUrl, sourceMapPath}); + } }, showBanner(options?: { mode?: string; diff --git a/packages/hydrogen/src/storefront.ts b/packages/hydrogen/src/storefront.ts index 86129c5b87..a05945aa2b 100644 --- a/packages/hydrogen/src/storefront.ts +++ b/packages/hydrogen/src/storefront.ts @@ -480,7 +480,7 @@ function throwError({ errorMessage + (requestId ? ` - Request ID: ${requestId}` : ''), { - cause: { + cause: JSON.stringify({ errors, requestId, ...(process.env.NODE_ENV === 'development' && { @@ -489,7 +489,7 @@ function throwError({ variables: JSON.stringify(queryVariables), }, }), - }, + }), }, ); } From a4cd5d07e5336131e960ad74021cade846297a64 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 3 Aug 2023 19:51:29 +0200 Subject: [PATCH 07/38] Fix MiniOxygen entry worker --- packages/cli/src/lib/mini-oxygen.ts | 38 +++++++++++++++++------------ 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index de8ad309cb..c88ded973c 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -52,6 +52,7 @@ export async function startMiniOxygen({ { name: 'mini-oxygen', modules: true, + script: `export default { fetch: ${miniOxygenHandler.toString()} }`, bindings: { initialAssets: await readdir(buildPathClient), oxygenHeadersMap: Object.values(OXYGEN_HEADERS_MAP).reduce( @@ -67,7 +68,6 @@ export async function startMiniOxygen({ assets: createAssetHandler(buildPathClient), logRequest, }, - script: `export default { fetch: ${miniOxygenHandler.toString()} }`, }, { name: 'hydrogen', @@ -147,34 +147,40 @@ async function miniOxygenHandler( assets: Service; logRequest: Service; initialAssets: string[]; - oxygenHeadersMap: Array<{name: string; defaultValue: string}>; + oxygenHeadersMap: Record; }, ) { - const pathname = new URL(request.url).pathname; - const isInInitialAssets = env.initialAssets.some( - (asset) => - pathname === '/' + asset || pathname.startsWith('/' + asset + '/'), - ); + if (request.method === 'GET') { + const pathname = new URL(request.url).pathname; + const isInInitialAssets = env.initialAssets.some( + (asset) => + pathname === '/' + asset || pathname.startsWith('/' + asset + '/'), + ); - const extension = pathname.split('.').at(-1); - const hasAssetExtension = - extension && - /^\.(js|css|jpe?g|png|gif|webp|svg|mp4|webm|txt|pdf|ico)$/i.test(extension); + const extension = pathname.split('.').at(-1); + const hasAssetExtension = + extension && + /^\.(js|css|jpe?g|png|gif|webp|svg|mp4|webm|txt|pdf|ico)$/i.test( + extension, + ); - if (isInInitialAssets || hasAssetExtension) { - const response = await env.assets.fetch(request); - if (response.status !== 404) return response; + if (isInInitialAssets || hasAssetExtension) { + const response = await env.assets.fetch(request.clone()); + if (response.status !== 404) return response; + } } + // Clone before using body (in POST requests) + const requestToLog = new Request(request.clone()); + const startTimeMs = Date.now(); const response = await env.hydrogen.fetch(request, { headers: { ...env.oxygenHeadersMap, - ...request.headers, + ...Object.fromEntries(request.headers.entries()), }, }); - const requestToLog = new Request(request); requestToLog.headers.set('h2-response-status', String(response.status)); requestToLog.headers.set('h2-duration-ms', String(Date.now() - startTimeMs)); await env.logRequest.fetch(requestToLog); From 58848fdc1d95b2207f4745d22d4a5d4cac7057ec Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 3 Aug 2023 20:01:39 +0200 Subject: [PATCH 08/38] Fix log replacer --- packages/cli/src/lib/log.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/lib/log.ts b/packages/cli/src/lib/log.ts index 435ed3170a..ac653c8c55 100644 --- a/packages/cli/src/lib/log.ts +++ b/packages/cli/src/lib/log.ts @@ -92,7 +92,8 @@ export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) { addMessageReplacers('dev', [ // Workerd logs - ([first]) => typeof first === 'string' && first.startsWith('\x1B[31m'), + ([first]) => + typeof first === 'string' && /^\x1B\[31m(workerd\/|stack:)/.test(first), () => {}, ]); } From ca93965757d2bc732a18bc453427c0d3aa4f8a10 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 3 Aug 2023 20:12:05 +0200 Subject: [PATCH 09/38] Only serve known assets --- packages/cli/src/lib/mini-oxygen.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index c88ded973c..7e91ea6d21 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -1,10 +1,10 @@ -import {readdir, readFile} from 'node:fs/promises'; import { outputInfo, outputToken, outputContent, } from '@shopify/cli-kit/node/output'; import {resolvePath, extname} from '@shopify/cli-kit/node/path'; +import {glob, readFile} from '@shopify/cli-kit/node/fs'; import colors from '@shopify/cli-kit/node/colors'; import {renderSuccess} from '@shopify/cli-kit/node/ui'; import mime from 'mime'; @@ -54,7 +54,7 @@ export async function startMiniOxygen({ modules: true, script: `export default { fetch: ${miniOxygenHandler.toString()} }`, bindings: { - initialAssets: await readdir(buildPathClient), + initialAssets: await glob('**/*', {cwd: buildPathClient}), oxygenHeadersMap: Object.values(OXYGEN_HEADERS_MAP).reduce( (acc, item) => { acc[item.name] = item.defaultValue; @@ -152,19 +152,7 @@ async function miniOxygenHandler( ) { if (request.method === 'GET') { const pathname = new URL(request.url).pathname; - const isInInitialAssets = env.initialAssets.some( - (asset) => - pathname === '/' + asset || pathname.startsWith('/' + asset + '/'), - ); - - const extension = pathname.split('.').at(-1); - const hasAssetExtension = - extension && - /^\.(js|css|jpe?g|png|gif|webp|svg|mp4|webm|txt|pdf|ico)$/i.test( - extension, - ); - - if (isInInitialAssets || hasAssetExtension) { + if (env.initialAssets.some((asset) => pathname === '/' + asset)) { const response = await env.assets.fetch(request.clone()); if (response.status !== 404) return response; } From 2a5e00990be1b28e7bcada90314e99887f9da08b Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 7 Mar 2023 18:16:05 +0900 Subject: [PATCH 10/38] Find nearest free port --- package-lock.json | 22 ++++++++++++++++++- packages/cli/package.json | 1 + packages/cli/src/commands/hydrogen/dev.ts | 12 +++++++--- packages/cli/src/commands/hydrogen/preview.ts | 7 +++--- packages/cli/src/lib/find-port.ts | 7 ++++++ packages/cli/src/lib/flags.ts | 4 +++- packages/cli/src/lib/mini-oxygen.ts | 3 ++- 7 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 packages/cli/src/lib/find-port.ts diff --git a/package-lock.json b/package-lock.json index 759f7df608..db2e6d143c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26851,6 +26851,7 @@ "@types/stack-trace": "^0.0.30", "@types/tar-fs": "^2.0.1", "devtools-protocol": "^0.0.1177611", + "get-port": "^7.0.0", "tempy": "^3.0.0", "type-fest": "^3.6.0", "vitest": "^0.33.0" @@ -27017,6 +27018,18 @@ "node": ">=14.14" } }, + "packages/cli/node_modules/get-port": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-7.0.0.tgz", + "integrity": "sha512-mDHFgApoQd+azgMdwylJrv2DX47ywGq1i5VFJE7fZ0dttNq3iQMfsU4IvEgBHojA3KqEudyu7Vq+oN8kNaNkWw==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "packages/cli/node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -32041,13 +32054,14 @@ "@types/gunzip-maybe": "^1.4.0", "@types/prettier": "^2.7.2", "@types/recursive-readdir": "^2.2.1", - "@types/stack-trace": "*", + "@types/stack-trace": "^0.0.30", "@types/tar-fs": "^2.0.1", "ansi-escapes": "^6.2.0", "devtools-protocol": "^0.0.1177611", "diff": "^5.1.0", "fast-glob": "^3.2.12", "fs-extra": "^11.1.0", + "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", "mime": "^3.0.0", "miniflare": "3.20230724.0", @@ -32178,6 +32192,12 @@ "universalify": "^2.0.0" } }, + "get-port": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-7.0.0.tgz", + "integrity": "sha512-mDHFgApoQd+azgMdwylJrv2DX47ywGq1i5VFJE7fZ0dttNq3iQMfsU4IvEgBHojA3KqEudyu7Vq+oN8kNaNkWw==", + "dev": true + }, "js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", diff --git a/packages/cli/package.json b/packages/cli/package.json index fb50518c08..b349192972 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -24,6 +24,7 @@ "@types/stack-trace": "^0.0.30", "@types/tar-fs": "^2.0.1", "devtools-protocol": "^0.0.1177611", + "get-port": "^7.0.0", "tempy": "^3.0.0", "type-fest": "^3.6.0", "vitest": "^0.33.0" diff --git a/packages/cli/src/commands/hydrogen/dev.ts b/packages/cli/src/commands/hydrogen/dev.ts index 8f7d3849de..7ab94f4e4c 100644 --- a/packages/cli/src/commands/hydrogen/dev.ts +++ b/packages/cli/src/commands/hydrogen/dev.ts @@ -17,7 +17,12 @@ import { muteDevLogs, muteRemixLogs, } from '../../lib/log.js'; -import {deprecated, commonFlags, flagsToCamelObject} from '../../lib/flags.js'; +import { + deprecated, + commonFlags, + flagsToCamelObject, + DEFAULT_PORT, +} from '../../lib/flags.js'; import Command from '@shopify/cli-kit/node/base-command'; import {Flags} from '@oclif/core'; import {type MiniOxygen, startMiniOxygen} from '../../lib/mini-oxygen.js'; @@ -27,6 +32,7 @@ import {spawnCodegenProcess} from '../../lib/codegen.js'; import {getAllEnvironmentVariables} from '../../lib/environment-variables.js'; import {getConfig} from '../../lib/shopify-config.js'; import {checkRemixVersions} from '../../lib/remix-version-check.js'; +import {findPort} from '../../lib/find-port.js'; const LOG_REBUILDING = '🧱 Rebuilding...'; const LOG_REBUILT = '🚀 Rebuilt'; @@ -73,7 +79,7 @@ export default class Dev extends Command { } async function runDev({ - port, + port: portFlag = DEFAULT_PORT, path: appPath, useCodegen = false, codegenConfigPath, @@ -154,7 +160,7 @@ async function runDev({ miniOxygen = await startMiniOxygen({ root, - port, + port: await findPort(portFlag), watch: true, buildPathWorkerFile, buildPathClient, diff --git a/packages/cli/src/commands/hydrogen/preview.ts b/packages/cli/src/commands/hydrogen/preview.ts index b88b9a72aa..c6004bb0fa 100644 --- a/packages/cli/src/commands/hydrogen/preview.ts +++ b/packages/cli/src/commands/hydrogen/preview.ts @@ -1,8 +1,9 @@ import Command from '@shopify/cli-kit/node/base-command'; import {muteDevLogs} from '../../lib/log.js'; import {getProjectPaths} from '../../lib/remix-config.js'; -import {commonFlags} from '../../lib/flags.js'; +import {commonFlags, DEFAULT_PORT} from '../../lib/flags.js'; import {startMiniOxygen} from '../../lib/mini-oxygen.js'; +import {findPort} from '../../lib/find-port.js'; export default class Preview extends Command { static description = @@ -21,7 +22,7 @@ export default class Preview extends Command { } export async function runPreview({ - port, + port = DEFAULT_PORT, path: appPath, }: { port?: number; @@ -35,7 +36,7 @@ export async function runPreview({ const miniOxygen = await startMiniOxygen({ root, - port, + port: await findPort(port), buildPathClient, buildPathWorkerFile, }); diff --git a/packages/cli/src/lib/find-port.ts b/packages/cli/src/lib/find-port.ts new file mode 100644 index 0000000000..cd7b64cca5 --- /dev/null +++ b/packages/cli/src/lib/find-port.ts @@ -0,0 +1,7 @@ +import getPort, {portNumbers} from 'get-port'; + +export function findPort(portPreference: number, range = 100) { + return getPort({ + port: portNumbers(portPreference, portPreference + range), + }); +} diff --git a/packages/cli/src/lib/flags.ts b/packages/cli/src/lib/flags.ts index a8bc0c179e..e062528c44 100644 --- a/packages/cli/src/lib/flags.ts +++ b/packages/cli/src/lib/flags.ts @@ -7,6 +7,8 @@ import type {CamelCasedProperties} from 'type-fest'; import {SETUP_CSS_STRATEGIES} from './setups/css/index.js'; import {I18N_CHOICES} from './setups/i18n/index.js'; +export const DEFAULT_PORT = 3000; + export const commonFlags = { path: Flags.string({ description: @@ -16,7 +18,7 @@ export const commonFlags = { port: Flags.integer({ description: 'Port to run the server on.', env: 'SHOPIFY_HYDROGEN_FLAG_PORT', - default: 3000, + default: DEFAULT_PORT, }), force: Flags.boolean({ description: diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index 7e91ea6d21..4c5a6f95b8 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -17,6 +17,7 @@ import { NoOpLog, } from 'miniflare'; import {connectToInspector, findInspectorUrl} from './mini-oxygen-inspector.js'; +import {DEFAULT_PORT} from './flags.js'; type MiniOxygenOptions = { root: string; @@ -31,7 +32,7 @@ export type MiniOxygen = Awaited>; export async function startMiniOxygen({ root, - port = 3000, + port = DEFAULT_PORT, watch = false, buildPathWorkerFile, buildPathClient, From fbf1acd4a4d5bc59d32388c77650ac63027fe795 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 3 Aug 2023 20:23:21 +0200 Subject: [PATCH 11/38] Find port for inspector --- packages/cli/src/lib/mini-oxygen.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index 4c5a6f95b8..c8ff6c58d1 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -18,6 +18,7 @@ import { } from 'miniflare'; import {connectToInspector, findInspectorUrl} from './mini-oxygen-inspector.js'; import {DEFAULT_PORT} from './flags.js'; +import {findPort} from './find-port.js'; type MiniOxygenOptions = { root: string; @@ -38,7 +39,7 @@ export async function startMiniOxygen({ buildPathClient, env, }: MiniOxygenOptions) { - const inspectorPort = 8787; + const inspectorPort = await findPort(8787); const buildMiniOxygenOptions = async () => ({ From 44b9700c1739867ae08a98d9bc8b58fc5ccd1fce Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Fri, 4 Aug 2023 13:01:49 +0200 Subject: [PATCH 12/38] Use waitUntil for logger. Minor refactor --- packages/cli/src/lib/mini-oxygen-inspector.ts | 6 +++--- packages/cli/src/lib/mini-oxygen.ts | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/cli/src/lib/mini-oxygen-inspector.ts b/packages/cli/src/lib/mini-oxygen-inspector.ts index ff039ed190..d90f3e901d 100644 --- a/packages/cli/src/lib/mini-oxygen-inspector.ts +++ b/packages/cli/src/lib/mini-oxygen-inspector.ts @@ -128,10 +128,10 @@ export function connectToInspector({ return response?.result.find((prop) => prop.name === name)?.value; } - const reconstructError = async ( + async function reconstructError( initialProperties: ErrorProperties, ro?: Protocol.Runtime.RemoteObject, - ) => { + ) { let errorProperties = {...initialProperties}; // The two requests here are based on intercepted messages sent by @@ -229,7 +229,7 @@ export function connectToInspector({ error.stack = errorProperties.stack; return error; - }; + } // Parse the source-map lazily when required, then store it, so we can we // reuse the consumer for different errors without having to parse the map diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts index c8ff6c58d1..91e52f1552 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -151,6 +151,7 @@ async function miniOxygenHandler( initialAssets: string[]; oxygenHeadersMap: Record; }, + context: ExecutionContext, ) { if (request.method === 'GET') { const pathname = new URL(request.url).pathname; @@ -161,19 +162,21 @@ async function miniOxygenHandler( } // Clone before using body (in POST requests) - const requestToLog = new Request(request.clone()); - - const startTimeMs = Date.now(); - const response = await env.hydrogen.fetch(request, { + const loggerRequest = new Request(request.clone()); + const requestInit = { headers: { ...env.oxygenHeadersMap, ...Object.fromEntries(request.headers.entries()), }, - }); + }; + + const startTimeMs = Date.now(); + const response = await env.hydrogen.fetch(request, requestInit); + const durationMs = Date.now() - startTimeMs; - requestToLog.headers.set('h2-response-status', String(response.status)); - requestToLog.headers.set('h2-duration-ms', String(Date.now() - startTimeMs)); - await env.logRequest.fetch(requestToLog); + loggerRequest.headers.set('h2-duration-ms', String(durationMs)); + loggerRequest.headers.set('h2-response-status', String(response.status)); + context.waitUntil(env.logRequest.fetch(loggerRequest)); return response; } From 2b5b7552f1e928b9d46fe97984b0d8dc89f72e41 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 17 Aug 2023 13:55:32 +0900 Subject: [PATCH 13/38] Restore integrity in package-lock for turbo and ast-grep --- package-lock.json | 481 +++++++++++++++++++++++++--------------------- 1 file changed, 265 insertions(+), 216 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7abb56e1bb..3a288faded 100644 --- a/package-lock.json +++ b/package-lock.json @@ -256,7 +256,8 @@ }, "node_modules/@ast-grep/napi": { "version": "0.11.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@ast-grep/napi/-/napi-0.11.0.tgz", + "integrity": "sha512-b+R8h20+ClsYZBJqcyguLy4THfGmg2a54HgfZ0a1vdCkfe9ftjblALiZf2DsOc0+Si8BDWd09TMNn2psUuibJA==", "engines": { "node": ">= 10" }, @@ -271,10 +272,11 @@ }, "node_modules/@ast-grep/napi-darwin-arm64": { "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-darwin-arm64/-/napi-darwin-arm64-0.11.0.tgz", + "integrity": "sha512-IxY3b102tNNm+cYLngZvUKzM1fNKCpDDWz69Yt+QnKCZNx10Hvd7mqrYE2aXTtkaNalmg/p1n6kMA8KmshGgCA==", "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "darwin" @@ -283,6 +285,81 @@ "node": ">= 10" } }, + "node_modules/@ast-grep/napi-darwin-x64": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-darwin-x64/-/napi-darwin-x64-0.11.0.tgz", + "integrity": "sha512-6afu1fNUwTkyE7tknVx8+d+BPKVL3623QLI9uJbJ0SZQShzSb1+dRegT4NpzPaPtFdPkflh6KfvOQ4chTw8hUg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ast-grep/napi-linux-x64-gnu": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-linux-x64-gnu/-/napi-linux-x64-gnu-0.11.0.tgz", + "integrity": "sha512-Rm0biBfIxg14tL9yAMxW6RngAEA2vYLIq1guff6Uc9Vb7yQ3HE8dnW8WAysyieIqXdVkraTTV2ZwfoUqeKfc1Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ast-grep/napi-win32-arm64-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-arm64-msvc/-/napi-win32-arm64-msvc-0.11.0.tgz", + "integrity": "sha512-TfX6KXxtXGQS/sWzJ1wWwWbpm3OJWpqiWGttpifSGs6DJmzfwuK0b63yX5JlhNXeUVqXkZyfYqIh5RPIPOtXSA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ast-grep/napi-win32-ia32-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-ia32-msvc/-/napi-win32-ia32-msvc-0.11.0.tgz", + "integrity": "sha512-oQGbxYYfQn6LPbMKQ1T2cjQ+DelYDO06w/gFPmdWrE6M/YUIv+KfKdEscBkr3ehJyvXZW5h3vmxuApiMuCyfAQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ast-grep/napi-win32-x64-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-x64-msvc/-/napi-win32-x64-msvc-0.11.0.tgz", + "integrity": "sha512-qrXI4+S8W7IF6e1nlDYX2KfdzxGHyAOj5kGvWk+TqBuAnA0rWQ513hJzdviiGpbB5VPnJkEhOVsDets8acKd6w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@babel/code-frame": { "version": "7.22.5", "license": "MIT", @@ -3176,28 +3253,12 @@ "node": ">= 4.0.0" } }, - "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230724.0.tgz", - "integrity": "sha512-DQmFZWHhs8waQFYRb/Z8QmbitAvBMXnbUMUentp+3lS4eCYI0/iurTaQDiz5+ldUn9FTxD+1XuYZlTHzVNxoHw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=16" - } - }, "node_modules/@cloudflare/workerd-darwin-arm64": { "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20230724.0.tgz", - "integrity": "sha512-C7T0v/lMjEX7c4iROSZKgIF1eGw3+sj/gFpBD6xwxfbIcrKBjncMypeLQNpRTCdBQr1W3sNpg9jagwuVX5ByZQ==", "cpu": [ "arm64" ], + "license": "Apache-2.0", "optional": true, "os": [ "darwin" @@ -3206,51 +3267,6 @@ "node": ">=16" } }, - "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20230724.0.tgz", - "integrity": "sha512-o0F/hj73UXOQwkPkYqZuIxpjG8gAs2eoAGqxX1HSIYRf7iUhfFcPrupwjqlNqf7Oo1h46M+sClSFjr/ZU/LCjg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20230724.0.tgz", - "integrity": "sha512-UpzCoo7LOuPWxFPw84TZQTPIawIDQNSb3XnC6ffMjUH/FVwHmHdngIFZxW+xjLHKMIzGNAqSn3eRHekKgO3QqA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=16" - } - }, - "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20230724.0.tgz", - "integrity": "sha512-wVpPNu19fnvgsD8V6NiGPSuET0bzKmgn3wJ6RwAwQA+GQ0hdDIDVYd13aImhgO6jLfQvkduCDxeZluGZ7PPojQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=16" - } - }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "license": "MIT", @@ -7709,9 +7725,8 @@ }, "node_modules/@types/stack-trace": { "version": "0.0.30", - "resolved": "https://registry.npmjs.org/@types/stack-trace/-/stack-trace-0.0.30.tgz", - "integrity": "sha512-g58ZMrK7OLAzzxqeGF/w9jYsIWMuA9I/p/d493+x5vz3LyIEhrh3swszq28poF45X0ZD8vpAznMLBTyKPYFBeA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/stack-utils": { "version": "2.0.1", @@ -9151,9 +9166,8 @@ }, "node_modules/better-sqlite3": { "version": "8.5.0", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.5.0.tgz", - "integrity": "sha512-vbPcv/Hx5WYdyNg/NbcfyaBZyv9s/NVbxb7yCeC5Bq1pVocNxeL2tZmSu3Rlm4IEOTjYdGyzWQgyx0OSdORBzw==", "hasInstallScript": true, + "license": "MIT", "dependencies": { "bindings": "^1.5.0", "prebuild-install": "^7.1.0" @@ -9183,8 +9197,7 @@ }, "node_modules/bindings": { "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", "dependencies": { "file-uri-to-path": "1.0.0" } @@ -9721,8 +9734,7 @@ }, "node_modules/capnp-ts": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", - "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", + "license": "MIT", "dependencies": { "debug": "^4.3.1", "tslib": "^2.2.0" @@ -9730,8 +9742,7 @@ }, "node_modules/capnp-ts/node_modules/tslib": { "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + "license": "0BSD" }, "node_modules/cardinal": { "version": "2.1.1", @@ -11163,8 +11174,7 @@ }, "node_modules/detect-libc": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "license": "Apache-2.0", "engines": { "node": ">=8" } @@ -11178,9 +11188,8 @@ }, "node_modules/devtools-protocol": { "version": "0.0.1177611", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1177611.tgz", - "integrity": "sha512-wivW6Jfe1Y75MY4PdZAaVsyeL37oMfmbodbuWkAQDuE1YAAJ5GnyrNpTfhXoQXFBoIWQdmBEf6t4U73OXctHrQ==", - "dev": true + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/didyoumean": { "version": "1.2.2", @@ -12651,8 +12660,7 @@ }, "node_modules/expand-template": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", "engines": { "node": ">=6" } @@ -12947,8 +12955,7 @@ }, "node_modules/file-uri-to-path": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + "license": "MIT" }, "node_modules/filelist": { "version": "1.0.4", @@ -13537,8 +13544,7 @@ }, "node_modules/github-from-package": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" + "license": "MIT" }, "node_modules/glob": { "version": "7.2.3", @@ -13570,8 +13576,7 @@ }, "node_modules/glob-to-regexp": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + "license": "BSD-2-Clause" }, "node_modules/globals": { "version": "11.12.0", @@ -17780,8 +17785,7 @@ }, "node_modules/miniflare": { "version": "3.20230724.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230724.0.tgz", - "integrity": "sha512-YU8yUwoVJCiuzY2i9ZBJ+McjL/mqwKnMJfn23QedSCvx82Mys8GAlkHCH69mqSqzlSw8IVcdxec330meRRf9bg==", + "license": "MIT", "dependencies": { "acorn": "^8.8.0", "acorn-walk": "^8.2.0", @@ -17806,8 +17810,7 @@ }, "node_modules/miniflare/node_modules/ws": { "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "license": "MIT", "engines": { "node": ">=10.0.0" }, @@ -17997,8 +18000,7 @@ }, "node_modules/mustache": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", - "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "license": "MIT", "bin": { "mustache": "bin/mustache" } @@ -18061,8 +18063,7 @@ }, "node_modules/napi-build-utils": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", - "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + "license": "MIT" }, "node_modules/natural-compare": { "version": "1.4.0", @@ -18118,8 +18119,7 @@ }, "node_modules/node-abi": { "version": "3.47.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz", - "integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==", + "license": "MIT", "dependencies": { "semver": "^7.3.5" }, @@ -20269,8 +20269,7 @@ }, "node_modules/prebuild-install": { "version": "7.1.1", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", - "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "license": "MIT", "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", @@ -20294,8 +20293,7 @@ }, "node_modules/prebuild-install/node_modules/pump": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "license": "MIT", "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -21833,8 +21831,7 @@ }, "node_modules/set-cookie-parser": { "version": "2.6.0", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", - "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + "license": "MIT" }, "node_modules/set-harmonic-interval": { "version": "1.0.1", @@ -21921,8 +21918,6 @@ }, "node_modules/simple-concat": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", "funding": [ { "type": "github", @@ -21936,12 +21931,11 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/simple-get": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", "funding": [ { "type": "github", @@ -21956,6 +21950,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "decompress-response": "^6.0.0", "once": "^1.3.1", @@ -22428,8 +22423,7 @@ }, "node_modules/stack-trace": { "version": "1.0.0-pre2", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-1.0.0-pre2.tgz", - "integrity": "sha512-2ztBJRek8IVofG9DBJqdy2N5kulaacX30Nz7xmkYF6ale9WBVmIy6mFBchvGX7Vx/MyjBhx+Rcxqrj+dbOnQ6A==", + "license": "MIT", "engines": { "node": ">=16" } @@ -22506,8 +22500,7 @@ }, "node_modules/stoppable": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", - "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", + "license": "MIT", "engines": { "node": ">=4", "npm": ">=6" @@ -23714,9 +23707,10 @@ }, "node_modules/turbo": { "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo/-/turbo-1.10.12.tgz", + "integrity": "sha512-WM3+jTfQWnB9W208pmP4oeehZcC6JQNlydb/ZHMRrhmQa+htGhWLCzd6Q9rLe0MwZLPpSPFV2/bN5egCLyoKjQ==", "dev": true, "hasInstallScript": true, - "license": "MPL-2.0", "bin": { "turbo": "bin/turbo" }, @@ -23729,18 +23723,84 @@ "turbo-windows-arm64": "1.10.12" } }, + "node_modules/turbo-darwin-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-darwin-64/-/turbo-darwin-64-1.10.12.tgz", + "integrity": "sha512-vmDfGVPl5/aFenAbOj3eOx3ePNcWVUyZwYr7taRl0ZBbmv2TzjRiFotO4vrKCiTVnbqjQqAFQWY2ugbqCI1kOQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, "node_modules/turbo-darwin-arm64": { "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-darwin-arm64/-/turbo-darwin-arm64-1.10.12.tgz", + "integrity": "sha512-3JliEESLNX2s7g54SOBqqkqJ7UhcOGkS0ywMr5SNuvF6kWVTbuUq7uBU/sVbGq8RwvK1ONlhPvJne5MUqBCTCQ==", "cpu": [ "arm64" ], "dev": true, - "license": "MPL-2.0", "optional": true, "os": [ "darwin" ] }, + "node_modules/turbo-linux-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-linux-64/-/turbo-linux-64-1.10.12.tgz", + "integrity": "sha512-siYhgeX0DidIfHSgCR95b8xPee9enKSOjCzx7EjTLmPqPaCiVebRYvbOIYdQWRqiaKh9yfhUtFmtMOMScUf1gg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/turbo-linux-arm64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-linux-arm64/-/turbo-linux-arm64-1.10.12.tgz", + "integrity": "sha512-K/ZhvD9l4SslclaMkTiIrnfcACgos79YcAo4kwc8bnMQaKuUeRpM15sxLpZp3xDjDg8EY93vsKyjaOhdFG2UbA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/turbo-windows-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-windows-64/-/turbo-windows-64-1.10.12.tgz", + "integrity": "sha512-7FSgSwvktWDNOqV65l9AbZwcoueAILeE4L7JvjauNASAjjbuzXGCEq5uN8AQU3U5BOFj4TdXrVmO2dX+lLu8Zg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/turbo-windows-arm64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-windows-arm64/-/turbo-windows-arm64-1.10.12.tgz", + "integrity": "sha512-gCNXF52dwom1HLY9ry/cneBPOKTBHhzpqhMylcyvJP0vp9zeMQQkt6yjYv+6QdnmELC92CtKNp2FsNZo+z0pyw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/type-check": { "version": "0.4.0", "dev": true, @@ -24791,9 +24851,8 @@ }, "node_modules/workerd": { "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230724.0.tgz", - "integrity": "sha512-++D7JqS4/dk7zvtGpk+i/7G9bZtEl6lTtgAsIoSSGR1qJAxxEu21ktm9+FH0EYh7uKfizuM5H9lrTsR+3u44PA==", "hasInstallScript": true, + "license": "Apache-2.0", "bin": { "workerd": "bin/workerd" }, @@ -25130,8 +25189,7 @@ }, "node_modules/youch": { "version": "3.2.3", - "resolved": "https://registry.npmjs.org/youch/-/youch-3.2.3.tgz", - "integrity": "sha512-ZBcWz/uzZaQVdCvfV4uk616Bbpf2ee+F/AvuKDR5EwX/Y4v06xWdtMluqTD7+KlZdM93lLm9gMZYo0sKBS0pgw==", + "license": "MIT", "dependencies": { "cookie": "^0.5.0", "mustache": "^4.2.0", @@ -25140,8 +25198,7 @@ }, "node_modules/youch/node_modules/cookie": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -25440,8 +25497,7 @@ }, "packages/cli/node_modules/ws": { "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "license": "MIT", "engines": { "node": ">=10.0.0" }, @@ -25955,6 +26011,8 @@ }, "@ast-grep/napi": { "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi/-/napi-0.11.0.tgz", + "integrity": "sha512-b+R8h20+ClsYZBJqcyguLy4THfGmg2a54HgfZ0a1vdCkfe9ftjblALiZf2DsOc0+Si8BDWd09TMNn2psUuibJA==", "requires": { "@ast-grep/napi-darwin-arm64": "0.11.0", "@ast-grep/napi-darwin-x64": "0.11.0", @@ -25966,6 +26024,38 @@ }, "@ast-grep/napi-darwin-arm64": { "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-darwin-arm64/-/napi-darwin-arm64-0.11.0.tgz", + "integrity": "sha512-IxY3b102tNNm+cYLngZvUKzM1fNKCpDDWz69Yt+QnKCZNx10Hvd7mqrYE2aXTtkaNalmg/p1n6kMA8KmshGgCA==", + "optional": true + }, + "@ast-grep/napi-darwin-x64": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-darwin-x64/-/napi-darwin-x64-0.11.0.tgz", + "integrity": "sha512-6afu1fNUwTkyE7tknVx8+d+BPKVL3623QLI9uJbJ0SZQShzSb1+dRegT4NpzPaPtFdPkflh6KfvOQ4chTw8hUg==", + "optional": true + }, + "@ast-grep/napi-linux-x64-gnu": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-linux-x64-gnu/-/napi-linux-x64-gnu-0.11.0.tgz", + "integrity": "sha512-Rm0biBfIxg14tL9yAMxW6RngAEA2vYLIq1guff6Uc9Vb7yQ3HE8dnW8WAysyieIqXdVkraTTV2ZwfoUqeKfc1Q==", + "optional": true + }, + "@ast-grep/napi-win32-arm64-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-arm64-msvc/-/napi-win32-arm64-msvc-0.11.0.tgz", + "integrity": "sha512-TfX6KXxtXGQS/sWzJ1wWwWbpm3OJWpqiWGttpifSGs6DJmzfwuK0b63yX5JlhNXeUVqXkZyfYqIh5RPIPOtXSA==", + "optional": true + }, + "@ast-grep/napi-win32-ia32-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-ia32-msvc/-/napi-win32-ia32-msvc-0.11.0.tgz", + "integrity": "sha512-oQGbxYYfQn6LPbMKQ1T2cjQ+DelYDO06w/gFPmdWrE6M/YUIv+KfKdEscBkr3ehJyvXZW5h3vmxuApiMuCyfAQ==", + "optional": true + }, + "@ast-grep/napi-win32-x64-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-x64-msvc/-/napi-win32-x64-msvc-0.11.0.tgz", + "integrity": "sha512-qrXI4+S8W7IF6e1nlDYX2KfdzxGHyAOj5kGvWk+TqBuAnA0rWQ513hJzdviiGpbB5VPnJkEhOVsDets8acKd6w==", "optional": true }, "@babel/code-frame": { @@ -27790,34 +27880,8 @@ } } }, - "@cloudflare/workerd-darwin-64": { - "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230724.0.tgz", - "integrity": "sha512-DQmFZWHhs8waQFYRb/Z8QmbitAvBMXnbUMUentp+3lS4eCYI0/iurTaQDiz5+ldUn9FTxD+1XuYZlTHzVNxoHw==", - "optional": true - }, "@cloudflare/workerd-darwin-arm64": { "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20230724.0.tgz", - "integrity": "sha512-C7T0v/lMjEX7c4iROSZKgIF1eGw3+sj/gFpBD6xwxfbIcrKBjncMypeLQNpRTCdBQr1W3sNpg9jagwuVX5ByZQ==", - "optional": true - }, - "@cloudflare/workerd-linux-64": { - "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20230724.0.tgz", - "integrity": "sha512-o0F/hj73UXOQwkPkYqZuIxpjG8gAs2eoAGqxX1HSIYRf7iUhfFcPrupwjqlNqf7Oo1h46M+sClSFjr/ZU/LCjg==", - "optional": true - }, - "@cloudflare/workerd-linux-arm64": { - "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20230724.0.tgz", - "integrity": "sha512-UpzCoo7LOuPWxFPw84TZQTPIawIDQNSb3XnC6ffMjUH/FVwHmHdngIFZxW+xjLHKMIzGNAqSn3eRHekKgO3QqA==", - "optional": true - }, - "@cloudflare/workerd-windows-64": { - "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20230724.0.tgz", - "integrity": "sha512-wVpPNu19fnvgsD8V6NiGPSuET0bzKmgn3wJ6RwAwQA+GQ0hdDIDVYd13aImhgO6jLfQvkduCDxeZluGZ7PPojQ==", "optional": true }, "@cspotcode/source-map-support": { @@ -29934,8 +29998,6 @@ }, "ws": { "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "requires": {} } } @@ -31086,8 +31148,6 @@ }, "@types/stack-trace": { "version": "0.0.30", - "resolved": "https://registry.npmjs.org/@types/stack-trace/-/stack-trace-0.0.30.tgz", - "integrity": "sha512-g58ZMrK7OLAzzxqeGF/w9jYsIWMuA9I/p/d493+x5vz3LyIEhrh3swszq28poF45X0ZD8vpAznMLBTyKPYFBeA==", "dev": true }, "@types/stack-utils": { @@ -32002,8 +32062,6 @@ }, "better-sqlite3": { "version": "8.5.0", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-8.5.0.tgz", - "integrity": "sha512-vbPcv/Hx5WYdyNg/NbcfyaBZyv9s/NVbxb7yCeC5Bq1pVocNxeL2tZmSu3Rlm4IEOTjYdGyzWQgyx0OSdORBzw==", "requires": { "bindings": "^1.5.0", "prebuild-install": "^7.1.0" @@ -32021,8 +32079,6 @@ }, "bindings": { "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "requires": { "file-uri-to-path": "1.0.0" } @@ -32345,17 +32401,13 @@ }, "capnp-ts": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", - "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", "requires": { "debug": "^4.3.1", "tslib": "^2.2.0" }, "dependencies": { "tslib": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + "version": "2.6.1" } } }, @@ -33226,17 +33278,13 @@ "version": "6.1.0" }, "detect-libc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==" + "version": "2.0.2" }, "detect-newline": { "version": "3.1.0" }, "devtools-protocol": { "version": "0.0.1177611", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1177611.tgz", - "integrity": "sha512-wivW6Jfe1Y75MY4PdZAaVsyeL37oMfmbodbuWkAQDuE1YAAJ5GnyrNpTfhXoQXFBoIWQdmBEf6t4U73OXctHrQ==", "dev": true }, "didyoumean": { @@ -34166,9 +34214,7 @@ "version": "2.2.1" }, "expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==" + "version": "2.0.3" }, "expect": { "version": "29.4.3", @@ -34370,9 +34416,7 @@ } }, "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + "version": "1.0.0" }, "filelist": { "version": "1.0.4", @@ -34742,9 +34786,7 @@ "version": "1.0.3" }, "github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==" + "version": "0.0.0" }, "glob": { "version": "7.2.3", @@ -34764,9 +34806,7 @@ } }, "glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + "version": "0.4.1" }, "globals": { "version": "11.12.0" @@ -37301,8 +37341,6 @@ }, "miniflare": { "version": "3.20230724.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230724.0.tgz", - "integrity": "sha512-YU8yUwoVJCiuzY2i9ZBJ+McjL/mqwKnMJfn23QedSCvx82Mys8GAlkHCH69mqSqzlSw8IVcdxec330meRRf9bg==", "requires": { "acorn": "^8.8.0", "acorn-walk": "^8.2.0", @@ -37324,8 +37362,6 @@ "dependencies": { "ws": { "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "requires": {} } } @@ -37441,9 +37477,7 @@ "version": "2.1.2" }, "mustache": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", - "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==" + "version": "4.2.0" }, "mute-stream": { "version": "0.0.8" @@ -37477,9 +37511,7 @@ "version": "3.3.6" }, "napi-build-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", - "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + "version": "1.0.2" }, "natural-compare": { "version": "1.4.0", @@ -37519,8 +37551,6 @@ }, "node-abi": { "version": "3.47.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz", - "integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==", "requires": { "semver": "^7.3.5" } @@ -38728,8 +38758,6 @@ }, "prebuild-install": { "version": "7.1.1", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", - "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", "requires": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", @@ -38747,8 +38775,6 @@ "dependencies": { "pump": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -39721,9 +39747,7 @@ "version": "2.0.0" }, "set-cookie-parser": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", - "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + "version": "2.6.0" }, "set-harmonic-interval": { "version": "1.0.1" @@ -39776,14 +39800,10 @@ "version": "1.0.0" }, "simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" + "version": "1.0.1" }, "simple-get": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", "requires": { "decompress-response": "^6.0.0", "once": "^1.3.1", @@ -40139,9 +40159,7 @@ } }, "stack-trace": { - "version": "1.0.0-pre2", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-1.0.0-pre2.tgz", - "integrity": "sha512-2ztBJRek8IVofG9DBJqdy2N5kulaacX30Nz7xmkYF6ale9WBVmIy6mFBchvGX7Vx/MyjBhx+Rcxqrj+dbOnQ6A==" + "version": "1.0.0-pre2" }, "stack-utils": { "version": "2.0.6", @@ -40196,9 +40214,7 @@ "dev": true }, "stoppable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", - "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==" + "version": "1.1.0" }, "stream-shift": { "version": "1.0.1" @@ -40936,6 +40952,8 @@ }, "turbo": { "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo/-/turbo-1.10.12.tgz", + "integrity": "sha512-WM3+jTfQWnB9W208pmP4oeehZcC6JQNlydb/ZHMRrhmQa+htGhWLCzd6Q9rLe0MwZLPpSPFV2/bN5egCLyoKjQ==", "dev": true, "requires": { "turbo-darwin-64": "1.10.12", @@ -40946,8 +40964,45 @@ "turbo-windows-arm64": "1.10.12" } }, + "turbo-darwin-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-darwin-64/-/turbo-darwin-64-1.10.12.tgz", + "integrity": "sha512-vmDfGVPl5/aFenAbOj3eOx3ePNcWVUyZwYr7taRl0ZBbmv2TzjRiFotO4vrKCiTVnbqjQqAFQWY2ugbqCI1kOQ==", + "dev": true, + "optional": true + }, "turbo-darwin-arm64": { "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-darwin-arm64/-/turbo-darwin-arm64-1.10.12.tgz", + "integrity": "sha512-3JliEESLNX2s7g54SOBqqkqJ7UhcOGkS0ywMr5SNuvF6kWVTbuUq7uBU/sVbGq8RwvK1ONlhPvJne5MUqBCTCQ==", + "dev": true, + "optional": true + }, + "turbo-linux-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-linux-64/-/turbo-linux-64-1.10.12.tgz", + "integrity": "sha512-siYhgeX0DidIfHSgCR95b8xPee9enKSOjCzx7EjTLmPqPaCiVebRYvbOIYdQWRqiaKh9yfhUtFmtMOMScUf1gg==", + "dev": true, + "optional": true + }, + "turbo-linux-arm64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-linux-arm64/-/turbo-linux-arm64-1.10.12.tgz", + "integrity": "sha512-K/ZhvD9l4SslclaMkTiIrnfcACgos79YcAo4kwc8bnMQaKuUeRpM15sxLpZp3xDjDg8EY93vsKyjaOhdFG2UbA==", + "dev": true, + "optional": true + }, + "turbo-windows-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-windows-64/-/turbo-windows-64-1.10.12.tgz", + "integrity": "sha512-7FSgSwvktWDNOqV65l9AbZwcoueAILeE4L7JvjauNASAjjbuzXGCEq5uN8AQU3U5BOFj4TdXrVmO2dX+lLu8Zg==", + "dev": true, + "optional": true + }, + "turbo-windows-arm64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-windows-arm64/-/turbo-windows-arm64-1.10.12.tgz", + "integrity": "sha512-gCNXF52dwom1HLY9ry/cneBPOKTBHhzpqhMylcyvJP0vp9zeMQQkt6yjYv+6QdnmELC92CtKNp2FsNZo+z0pyw==", "dev": true, "optional": true }, @@ -41564,8 +41619,6 @@ }, "workerd": { "version": "1.20230724.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230724.0.tgz", - "integrity": "sha512-++D7JqS4/dk7zvtGpk+i/7G9bZtEl6lTtgAsIoSSGR1qJAxxEu21ktm9+FH0EYh7uKfizuM5H9lrTsR+3u44PA==", "requires": { "@cloudflare/workerd-darwin-64": "1.20230724.0", "@cloudflare/workerd-darwin-arm64": "1.20230724.0", @@ -41768,8 +41821,6 @@ }, "youch": { "version": "3.2.3", - "resolved": "https://registry.npmjs.org/youch/-/youch-3.2.3.tgz", - "integrity": "sha512-ZBcWz/uzZaQVdCvfV4uk616Bbpf2ee+F/AvuKDR5EwX/Y4v06xWdtMluqTD7+KlZdM93lLm9gMZYo0sKBS0pgw==", "requires": { "cookie": "^0.5.0", "mustache": "^4.2.0", @@ -41777,9 +41828,7 @@ }, "dependencies": { "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + "version": "0.5.0" } } }, From 7d9bacb321c3e86a750760c4ce8e261d72adebca Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 15:38:36 +0900 Subject: [PATCH 14/38] Update miniflare --- package-lock.json | 158 ++++++++++++++++++++++++++++++-------- packages/cli/package.json | 2 +- 2 files changed, 127 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3a288faded..9e44d42dbd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3253,12 +3253,28 @@ "node": ">= 4.0.0" } }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230821.0.tgz", + "integrity": "sha512-P41/PwGU09AwjIg4HyadMxFHZgpibZ7LUzpnXGU+WvgqOQwxhY05xHlsXqDDR2oVkY1IIY+ReghBzn7OEwvppw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20230724.0", + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20230821.0.tgz", + "integrity": "sha512-g0dPoHN7QOekp0zWnknkoObYCVnZ9qcpWW+VNFGG08lL/j730IQWY4dnbeho99yPHyoEW8SsiYGlB75CUL38gw==", "cpu": [ "arm64" ], - "license": "Apache-2.0", "optional": true, "os": [ "darwin" @@ -3267,6 +3283,51 @@ "node": ">=16" } }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20230821.0.tgz", + "integrity": "sha512-snHR2jzXR00XZSQ3mPBcWWMvqwSRI/ZjlJuEFU+VSkEg/SJKaftM3XApGG8fUSdcRifdd3BkSzpIrzsek8T6sg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20230821.0.tgz", + "integrity": "sha512-U/M0Aw0bPcVZn/Ok921BmAnyu9VYBJO7ToeAqXkS7+riV1QtM7awep1wvoJVfjqpicInZZu6g9bsJo1W6vzyNg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20230821.0.tgz", + "integrity": "sha512-+QRkgLp+zMBaIGcCzFidTV0gLe7w0vswxCzgvY9QAWx0DRWrR1ihvLYdOWduFtD4RxhjRydIMTK2oZgjRpA7/w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "license": "MIT", @@ -17784,8 +17845,9 @@ } }, "node_modules/miniflare": { - "version": "3.20230724.0", - "license": "MIT", + "version": "3.20230821.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230821.0.tgz", + "integrity": "sha512-V+p/f2T6Yj5n/3t1Szl+0MZFeuqRTQ7r1KcLU6bPj2cCX6woE2CoHbiMHHWkg/dIyv/yX0QuZgayr7ci+y3KwQ==", "dependencies": { "acorn": "^8.8.0", "acorn-walk": "^8.2.0", @@ -17795,11 +17857,10 @@ "glob-to-regexp": "^0.4.1", "http-cache-semantics": "^4.1.0", "kleur": "^4.1.5", - "set-cookie-parser": "^2.6.0", "source-map-support": "0.5.21", "stoppable": "^1.1.0", - "undici": "^5.13.0", - "workerd": "1.20230724.0", + "undici": "^5.22.1", + "workerd": "1.20230821.0", "ws": "^8.11.0", "youch": "^3.2.2", "zod": "^3.20.6" @@ -23999,13 +24060,14 @@ "license": "MIT" }, "node_modules/undici": { - "version": "5.20.0", - "license": "MIT", + "version": "5.23.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.23.0.tgz", + "integrity": "sha512-1D7w+fvRsqlQ9GscLBwcAJinqcZGHUKjbOmXdlE/v8BvEGXjeWAax+341q44EuTcHXXnfyKNbKRq4Lg7OzhMmg==", "dependencies": { "busboy": "^1.6.0" }, "engines": { - "node": ">=12.18" + "node": ">=14.0" } }, "node_modules/unicode-canonical-property-names-ecmascript": { @@ -24850,9 +24912,10 @@ "license": "MIT" }, "node_modules/workerd": { - "version": "1.20230724.0", + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230821.0.tgz", + "integrity": "sha512-jLqa4zjQihfgkzoNMwkq39izZ3iAHrQQISPWVLc642j/J0mCus1HuKl89U3zbMNwWytwe0lcpMXNFTRYR8PR7A==", "hasInstallScript": true, - "license": "Apache-2.0", "bin": { "workerd": "bin/workerd" }, @@ -24860,11 +24923,11 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20230724.0", - "@cloudflare/workerd-darwin-arm64": "1.20230724.0", - "@cloudflare/workerd-linux-64": "1.20230724.0", - "@cloudflare/workerd-linux-arm64": "1.20230724.0", - "@cloudflare/workerd-windows-64": "1.20230724.0" + "@cloudflare/workerd-darwin-64": "1.20230821.0", + "@cloudflare/workerd-darwin-arm64": "1.20230821.0", + "@cloudflare/workerd-linux-64": "1.20230821.0", + "@cloudflare/workerd-linux-arm64": "1.20230821.0", + "@cloudflare/workerd-windows-64": "1.20230821.0" } }, "node_modules/worktop": { @@ -25254,7 +25317,7 @@ "fs-extra": "^11.1.0", "gunzip-maybe": "^1.4.2", "mime": "^3.0.0", - "miniflare": "3.20230724.0", + "miniflare": "3.20230821.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", "source-map": "^0.7.4", @@ -27880,8 +27943,34 @@ } } }, + "@cloudflare/workerd-darwin-64": { + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230821.0.tgz", + "integrity": "sha512-P41/PwGU09AwjIg4HyadMxFHZgpibZ7LUzpnXGU+WvgqOQwxhY05xHlsXqDDR2oVkY1IIY+ReghBzn7OEwvppw==", + "optional": true + }, "@cloudflare/workerd-darwin-arm64": { - "version": "1.20230724.0", + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20230821.0.tgz", + "integrity": "sha512-g0dPoHN7QOekp0zWnknkoObYCVnZ9qcpWW+VNFGG08lL/j730IQWY4dnbeho99yPHyoEW8SsiYGlB75CUL38gw==", + "optional": true + }, + "@cloudflare/workerd-linux-64": { + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20230821.0.tgz", + "integrity": "sha512-snHR2jzXR00XZSQ3mPBcWWMvqwSRI/ZjlJuEFU+VSkEg/SJKaftM3XApGG8fUSdcRifdd3BkSzpIrzsek8T6sg==", + "optional": true + }, + "@cloudflare/workerd-linux-arm64": { + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20230821.0.tgz", + "integrity": "sha512-U/M0Aw0bPcVZn/Ok921BmAnyu9VYBJO7ToeAqXkS7+riV1QtM7awep1wvoJVfjqpicInZZu6g9bsJo1W6vzyNg==", + "optional": true + }, + "@cloudflare/workerd-windows-64": { + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20230821.0.tgz", + "integrity": "sha512-+QRkgLp+zMBaIGcCzFidTV0gLe7w0vswxCzgvY9QAWx0DRWrR1ihvLYdOWduFtD4RxhjRydIMTK2oZgjRpA7/w==", "optional": true }, "@cspotcode/source-map-support": { @@ -29859,7 +29948,7 @@ "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", "mime": "^3.0.0", - "miniflare": "3.20230724.0", + "miniflare": "3.20230821.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", "source-map": "^0.7.4", @@ -37340,7 +37429,9 @@ "dev": true }, "miniflare": { - "version": "3.20230724.0", + "version": "3.20230821.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230821.0.tgz", + "integrity": "sha512-V+p/f2T6Yj5n/3t1Szl+0MZFeuqRTQ7r1KcLU6bPj2cCX6woE2CoHbiMHHWkg/dIyv/yX0QuZgayr7ci+y3KwQ==", "requires": { "acorn": "^8.8.0", "acorn-walk": "^8.2.0", @@ -37350,11 +37441,10 @@ "glob-to-regexp": "^0.4.1", "http-cache-semantics": "^4.1.0", "kleur": "^4.1.5", - "set-cookie-parser": "^2.6.0", "source-map-support": "0.5.21", "stoppable": "^1.1.0", - "undici": "^5.13.0", - "workerd": "1.20230724.0", + "undici": "^5.22.1", + "workerd": "1.20230821.0", "ws": "^8.11.0", "youch": "^3.2.2", "zod": "^3.20.6" @@ -41133,7 +41223,9 @@ "dev": true }, "undici": { - "version": "5.20.0", + "version": "5.23.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.23.0.tgz", + "integrity": "sha512-1D7w+fvRsqlQ9GscLBwcAJinqcZGHUKjbOmXdlE/v8BvEGXjeWAax+341q44EuTcHXXnfyKNbKRq4Lg7OzhMmg==", "requires": { "busboy": "^1.6.0" } @@ -41618,13 +41710,15 @@ "version": "1.0.0" }, "workerd": { - "version": "1.20230724.0", - "requires": { - "@cloudflare/workerd-darwin-64": "1.20230724.0", - "@cloudflare/workerd-darwin-arm64": "1.20230724.0", - "@cloudflare/workerd-linux-64": "1.20230724.0", - "@cloudflare/workerd-linux-arm64": "1.20230724.0", - "@cloudflare/workerd-windows-64": "1.20230724.0" + "version": "1.20230821.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230821.0.tgz", + "integrity": "sha512-jLqa4zjQihfgkzoNMwkq39izZ3iAHrQQISPWVLc642j/J0mCus1HuKl89U3zbMNwWytwe0lcpMXNFTRYR8PR7A==", + "requires": { + "@cloudflare/workerd-darwin-64": "1.20230821.0", + "@cloudflare/workerd-darwin-arm64": "1.20230821.0", + "@cloudflare/workerd-linux-64": "1.20230821.0", + "@cloudflare/workerd-linux-arm64": "1.20230821.0", + "@cloudflare/workerd-windows-64": "1.20230821.0" } }, "worktop": { diff --git a/packages/cli/package.json b/packages/cli/package.json index 16875cdd72..c02fb61466 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -47,7 +47,7 @@ "fs-extra": "^11.1.0", "gunzip-maybe": "^1.4.2", "mime": "^3.0.0", - "miniflare": "3.20230724.0", + "miniflare": "3.20230821.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", "source-map": "^0.7.4", From 7c06e94873fce3731cbdc8cb25d27e879308fbb1 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 15:39:08 +0900 Subject: [PATCH 15/38] Do not show undefined cause in errors --- packages/cli/src/lib/mini-oxygen-inspector.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/lib/mini-oxygen-inspector.ts b/packages/cli/src/lib/mini-oxygen-inspector.ts index d90f3e901d..d4be735aa8 100644 --- a/packages/cli/src/lib/mini-oxygen-inspector.ts +++ b/packages/cli/src/lib/mini-oxygen-inspector.ts @@ -222,11 +222,11 @@ export function connectToInspector({ } } - const error = new Error(errorProperties.message, { - cause: errorProperties.cause, - }); - + const error = new Error(errorProperties.message); error.stack = errorProperties.stack; + if (errorProperties.cause) { + error.cause = errorProperties.cause; + } return error; } @@ -308,7 +308,7 @@ export function connectToInspector({ if (evt.method === 'Runtime.consoleAPICalled') { const params = evt.params as Protocol.Runtime.ConsoleAPICalledEvent; - logConsoleMessage(params, reconstructError); + await logConsoleMessage(params, reconstructError); } } else { // We should never get here, but who know is 2022... From 21e6c8ed6a14536963b3a09100de4f4fd28701fe Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 16:03:24 +0900 Subject: [PATCH 16/38] Move workerd logic --- .../workerd-inspector.ts} | 0 .../cli/src/lib/{mini-oxygen.ts => mini-oxygen/workerd.ts} | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename packages/cli/src/lib/{mini-oxygen-inspector.ts => mini-oxygen/workerd-inspector.ts} (100%) rename packages/cli/src/lib/{mini-oxygen.ts => mini-oxygen/workerd.ts} (98%) diff --git a/packages/cli/src/lib/mini-oxygen-inspector.ts b/packages/cli/src/lib/mini-oxygen/workerd-inspector.ts similarity index 100% rename from packages/cli/src/lib/mini-oxygen-inspector.ts rename to packages/cli/src/lib/mini-oxygen/workerd-inspector.ts diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts similarity index 98% rename from packages/cli/src/lib/mini-oxygen.ts rename to packages/cli/src/lib/mini-oxygen/workerd.ts index 91e52f1552..3b952efc16 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -16,9 +16,9 @@ import { fetch, NoOpLog, } from 'miniflare'; -import {connectToInspector, findInspectorUrl} from './mini-oxygen-inspector.js'; -import {DEFAULT_PORT} from './flags.js'; -import {findPort} from './find-port.js'; +import {connectToInspector, findInspectorUrl} from './workerd-inspector.js'; +import {DEFAULT_PORT} from '../flags.js'; +import {findPort} from '../find-port.js'; type MiniOxygenOptions = { root: string; From e0d6b3b03d959d11f89f91e46af7d2e38593a501 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 16:04:08 +0900 Subject: [PATCH 17/38] Restore MiniOxygen v1 --- package-lock.json | 1064 ++++++++++++++++++++++++++- packages/cli/package.json | 1 + packages/cli/src/lib/mini-oxygen.ts | 143 ++++ 3 files changed, 1200 insertions(+), 8 deletions(-) create mode 100644 packages/cli/src/lib/mini-oxygen.ts diff --git a/package-lock.json b/package-lock.json index 9e44d42dbd..b79a06c0fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5052,6 +5052,14 @@ "version": "1.4.1", "license": "BSD-3-Clause" }, + "node_modules/@ljharb/through": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.9.tgz", + "integrity": "sha512-yN599ZBuMPPK4tdoToLlvgJB4CLK8fGl7ntfy0Wn7U6ttNvHYurd81bfUiK/6sMkiIwm65R6ck4L6+Y3DfVbNQ==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/@manypkg/find-root": { "version": "1.1.0", "dev": true, @@ -5323,6 +5331,237 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/@miniflare/cache": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.14.1.tgz", + "integrity": "sha512-f/o6UBV6UX+MlhjcEch73/wjQvvNo37dgYmP6Pn2ax1/mEHhJ7allNAqenmonT4djNeyB3eEYV3zUl54wCEwrg==", + "dependencies": { + "@miniflare/core": "2.14.1", + "@miniflare/shared": "2.14.1", + "http-cache-semantics": "^4.1.0", + "undici": "5.20.0" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/cache/node_modules/undici": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.20.0.tgz", + "integrity": "sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g==", + "dependencies": { + "busboy": "^1.6.0" + }, + "engines": { + "node": ">=12.18" + } + }, + "node_modules/@miniflare/core": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.14.1.tgz", + "integrity": "sha512-d+SGAda/VoXq+SKz04oq8ATUwQw5755L87fgPR8pTdR2YbWkxdbmEm1z2olOpDiUjcR86aN6NtCjY6tUC7fqaw==", + "dependencies": { + "@iarna/toml": "^2.2.5", + "@miniflare/queues": "2.14.1", + "@miniflare/shared": "2.14.1", + "@miniflare/watcher": "2.14.1", + "busboy": "^1.6.0", + "dotenv": "^10.0.0", + "kleur": "^4.1.4", + "set-cookie-parser": "^2.4.8", + "undici": "5.20.0", + "urlpattern-polyfill": "^4.0.3" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/core/node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@miniflare/core/node_modules/undici": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.20.0.tgz", + "integrity": "sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g==", + "dependencies": { + "busboy": "^1.6.0" + }, + "engines": { + "node": ">=12.18" + } + }, + "node_modules/@miniflare/queues": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/queues/-/queues-2.14.1.tgz", + "integrity": "sha512-uBzrbBkIgtNoztDpmMMISg/brYtxLHRE7oTaN8OVnq3bG+3nF9kQC42HUz+Vg+sf65UlvhSaqkjllgx+fNtOxQ==", + "dependencies": { + "@miniflare/shared": "2.14.1" + }, + "engines": { + "node": ">=16.7" + } + }, + "node_modules/@miniflare/runner-vm": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/runner-vm/-/runner-vm-2.14.1.tgz", + "integrity": "sha512-UobsGM0ICVPDlJD54VPDSx0EXrIY3nJMXBy2zIFuuUOz4hQKXvMQ6jtAlJ8UNKer+XXI3Mb/9R/gfU8r6kxIMA==", + "dependencies": { + "@miniflare/shared": "2.14.1" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/shared": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.14.1.tgz", + "integrity": "sha512-73GnLtWn5iP936ctE6ZJrMqGu134KOoIIveq5Yd/B+NnbFfzpuzjCpkLrnqjkDdsxDbruXSb5eTR/SmAdpJxZQ==", + "dependencies": { + "@types/better-sqlite3": "^7.6.0", + "kleur": "^4.1.4", + "npx-import": "^1.1.4", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/storage-memory": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/storage-memory/-/storage-memory-2.14.1.tgz", + "integrity": "sha512-lfQbQwopVWd4W5XzrYdp0rhk3dJpvSmv1Wwn9RhNO20WrcuoxpdSzbmpBahsgYVg+OheVaEbS6RpFqdmwwLTog==", + "dependencies": { + "@miniflare/shared": "2.14.1" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/watcher": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.14.1.tgz", + "integrity": "sha512-dkFvetm5wk6pwunlYb/UkI0yFNb3otLpRm5RDywMUzqObEf+rCiNNAbJe3HUspr2ncZVAaRWcEaDh82vYK5cmw==", + "dependencies": { + "@miniflare/shared": "2.14.1" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/web-sockets": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/web-sockets/-/web-sockets-2.14.0.tgz", + "integrity": "sha512-lB1CB4rBq0mbCuh55WgIEH4L3c4/i4MNDBfrQL+6r+wGcr/BJUqF8BHpsfAt5yHWUJVtK5mlMeesS/xpg4Ao1w==", + "dependencies": { + "@miniflare/core": "2.14.0", + "@miniflare/shared": "2.14.0", + "undici": "5.20.0", + "ws": "^8.2.2" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/web-sockets/node_modules/@miniflare/core": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.14.0.tgz", + "integrity": "sha512-BjmV/ZDwsKvXnJntYHt3AQgzVKp/5ZzWPpYWoOnUSNxq6nnRCQyvFvjvBZKnhubcmJCLSqegvz0yHejMA90CTA==", + "dependencies": { + "@iarna/toml": "^2.2.5", + "@miniflare/queues": "2.14.0", + "@miniflare/shared": "2.14.0", + "@miniflare/watcher": "2.14.0", + "busboy": "^1.6.0", + "dotenv": "^10.0.0", + "kleur": "^4.1.4", + "set-cookie-parser": "^2.4.8", + "undici": "5.20.0", + "urlpattern-polyfill": "^4.0.3" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/web-sockets/node_modules/@miniflare/queues": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/queues/-/queues-2.14.0.tgz", + "integrity": "sha512-flS4MqlgBKyv6QBqKD0IofjmMDW9wP1prUNQy2wWPih9lA6bFKmml3VdFeDsPnWtE2J67K0vCTf5kj1Q0qdW1w==", + "dependencies": { + "@miniflare/shared": "2.14.0" + }, + "engines": { + "node": ">=16.7" + } + }, + "node_modules/@miniflare/web-sockets/node_modules/@miniflare/shared": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.14.0.tgz", + "integrity": "sha512-O0jAEdMkp8BzrdFCfMWZu76h4Cq+tt3/oDtcTFgzum3fRW5vUhIi/5f6bfndu6rkGbSlzxwor8CJWpzityXGug==", + "dependencies": { + "@types/better-sqlite3": "^7.6.0", + "kleur": "^4.1.4", + "npx-import": "^1.1.4", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/web-sockets/node_modules/@miniflare/watcher": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.14.0.tgz", + "integrity": "sha512-O8Abg2eHpGmcZb8WyUaA6Av1Mqt5bSrorzz4CrWwsvJHBdekZPIX0GihC9vn327d/1pKRs81YTiSAfBoSZpVIw==", + "dependencies": { + "@miniflare/shared": "2.14.0" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/web-sockets/node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@miniflare/web-sockets/node_modules/undici": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.20.0.tgz", + "integrity": "sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g==", + "dependencies": { + "busboy": "^1.6.0" + }, + "engines": { + "node": ">=12.18" + } + }, + "node_modules/@miniflare/web-sockets/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "dev": true, @@ -6971,6 +7210,212 @@ "resolved": "packages/hydrogen-react", "link": true }, + "node_modules/@shopify/mini-oxygen": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@shopify/mini-oxygen/-/mini-oxygen-1.7.0.tgz", + "integrity": "sha512-uU9d4OhwepTAtNFTDKXijD5cgGlUQN0cX9n4rY7I8UIg4kNKaV+TvBZB3UwyNloOPOfhaOJf33zRnzHKwHsXEg==", + "dependencies": { + "@miniflare/cache": "^2.14.0", + "@miniflare/core": "^2.14.0", + "@miniflare/queues": "^2.14.0", + "@miniflare/runner-vm": "^2.14.0", + "@miniflare/shared": "^2.14.0", + "@miniflare/storage-memory": "^2.14.0", + "@miniflare/web-sockets": "2.14.0", + "@types/connect": "^3.4.35", + "@types/mime": "^3.0.1", + "body-parser": "1.20.2", + "connect": "^3.7.0", + "eventsource": "^2.0.2", + "fs-extra": "^11.1.0", + "get-port": "^5.1.1", + "inquirer": "^9.0.0", + "mime": "^3.0.0", + "semiver": "^1.1.0", + "source-map-support": "^0.5.21", + "typescript": "^4.7.2" + }, + "bin": { + "oxygen-gen-config": "dist/gen-config.js", + "oxygen-preview": "dist/bootstrap.js" + }, + "engines": { + "node": ">16.7.0" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/figures": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", + "dependencies": { + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/inquirer": { + "version": "9.2.10", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.10.tgz", + "integrity": "sha512-tVVNFIXU8qNHoULiazz612GFl+yqNfjMTbLuViNJE/d860Qxrd3NMrse8dm40VUQLOQeULvaQF8lpAhvysjeyA==", + "dependencies": { + "@ljharb/through": "^2.3.9", + "ansi-escapes": "^4.3.2", + "chalk": "^5.3.0", + "cli-cursor": "^3.1.0", + "cli-width": "^4.1.0", + "external-editor": "^3.1.0", + "figures": "^5.0.0", + "lodash": "^4.17.21", + "mute-stream": "1.0.0", + "ora": "^5.4.1", + "run-async": "^3.0.0", + "rxjs": "^7.8.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/@shopify/mini-oxygen/node_modules/mute-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/run-async": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/@shopify/mini-oxygen/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@shopify/oxygen-workers-types": { "version": "3.17.3", "dev": true, @@ -7363,6 +7808,14 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/better-sqlite3": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.4.tgz", + "integrity": "sha512-dzrRZCYPXIXfSR1/surNbJ/grU3scTaygS0OMzjlGf71i9sc2fGyHPXXiXmEvNIoE0cGwsanEFMVJxPXmco9Eg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/body-parser": { "version": "1.19.2", "dev": true, @@ -7412,7 +7865,6 @@ }, "node_modules/@types/connect": { "version": "3.4.35", - "dev": true, "license": "MIT", "dependencies": { "@types/node": "*" @@ -7649,7 +8101,6 @@ }, "node_modules/@types/mime": { "version": "3.0.1", - "dev": true, "license": "MIT" }, "node_modules/@types/minimatch": { @@ -9544,6 +9995,14 @@ "version": "1.1.2", "license": "MIT" }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/bundle-name": { "version": "3.0.0", "dev": true, @@ -10269,6 +10728,69 @@ "proto-list": "~1.2.1" } }, + "node_modules/connect": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", + "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", + "dependencies": { + "debug": "2.6.9", + "finalhandler": "1.1.2", + "parseurl": "~1.3.3", + "utils-merge": "1.0.1" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/connect/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/connect/node_modules/finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/connect/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/connect/node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/connect/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/constant-case": { "version": "3.0.4", "license": "MIT", @@ -12709,6 +13231,36 @@ "node": ">=6" } }, + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/execa": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", + "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^3.0.1", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, "node_modules/exit-hook": { "version": "2.2.1", "license": "MIT", @@ -18579,6 +19131,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/npx-import": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/npx-import/-/npx-import-1.1.4.tgz", + "integrity": "sha512-3ShymTWOgqGyNlh5lMJAejLuIv3W1K3fbI5Ewc6YErZU3Sp0PqsNs8UIU1O8z5+KVl/Du5ag56Gza9vdorGEoA==", + "dependencies": { + "execa": "^6.1.0", + "parse-package-name": "^1.0.0", + "semver": "^7.3.7", + "validate-npm-package-name": "^4.0.0" + } + }, "node_modules/nullthrows": { "version": "1.1.1", "license": "MIT" @@ -19181,6 +19744,11 @@ "node": ">=6" } }, + "node_modules/parse-package-name": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-package-name/-/parse-package-name-1.0.0.tgz", + "integrity": "sha512-kBeTUtcj+SkyfaW4+KBe0HtsloBJ/mKTPoxpVdA57GZiPerREsUWJOhVj9anXweFiJkm5y8FG1sxFZkZ0SN6wg==" + }, "node_modules/parse5": { "version": "6.0.1", "dev": true, @@ -21716,8 +22284,9 @@ } }, "node_modules/rxjs": { - "version": "7.5.7", - "license": "Apache-2.0", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "dependencies": { "tslib": "^2.1.0" } @@ -21785,6 +22354,14 @@ "version": "1.1.0", "license": "MIT" }, + "node_modules/semiver": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz", + "integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==", + "engines": { + "node": ">=6" + } + }, "node_modules/semver": { "version": "7.5.3", "license": "ISC", @@ -24348,6 +24925,11 @@ "punycode": "^2.1.0" } }, + "node_modules/urlpattern-polyfill": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-4.0.3.tgz", + "integrity": "sha512-DOE84vZT2fEcl9gqCUTcnAw5ZY5Id55ikUcziSUntuEFL3pRvavg5kwDmTEUJkeCHInTlV/HexFomgYnzO5kdQ==" + }, "node_modules/use-isomorphic-layout-effect": { "version": "1.1.2", "license": "MIT", @@ -24431,6 +25013,17 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/validate-npm-package-name": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz", + "integrity": "sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q==", + "dependencies": { + "builtins": "^5.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/value-or-promise": { "version": "1.0.12", "license": "MIT", @@ -25311,6 +25904,7 @@ "@remix-run/dev": "1.19.1", "@shopify/cli-kit": "3.48.0", "@shopify/hydrogen-codegen": "^0.0.2", + "@shopify/mini-oxygen": "^1.7.0", "ansi-escapes": "^6.2.0", "diff": "^5.1.0", "fast-glob": "^3.2.12", @@ -29030,6 +29624,11 @@ "@lit/reactive-element": { "version": "1.4.1" }, + "@ljharb/through": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.9.tgz", + "integrity": "sha512-yN599ZBuMPPK4tdoToLlvgJB4CLK8fGl7ntfy0Wn7U6ttNvHYurd81bfUiK/6sMkiIwm65R6ck4L6+Y3DfVbNQ==" + }, "@manypkg/find-root": { "version": "1.1.0", "dev": true, @@ -29232,6 +29831,178 @@ } } }, + "@miniflare/cache": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.14.1.tgz", + "integrity": "sha512-f/o6UBV6UX+MlhjcEch73/wjQvvNo37dgYmP6Pn2ax1/mEHhJ7allNAqenmonT4djNeyB3eEYV3zUl54wCEwrg==", + "requires": { + "@miniflare/core": "2.14.1", + "@miniflare/shared": "2.14.1", + "http-cache-semantics": "^4.1.0", + "undici": "5.20.0" + }, + "dependencies": { + "undici": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.20.0.tgz", + "integrity": "sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g==", + "requires": { + "busboy": "^1.6.0" + } + } + } + }, + "@miniflare/core": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.14.1.tgz", + "integrity": "sha512-d+SGAda/VoXq+SKz04oq8ATUwQw5755L87fgPR8pTdR2YbWkxdbmEm1z2olOpDiUjcR86aN6NtCjY6tUC7fqaw==", + "requires": { + "@iarna/toml": "^2.2.5", + "@miniflare/queues": "2.14.1", + "@miniflare/shared": "2.14.1", + "@miniflare/watcher": "2.14.1", + "busboy": "^1.6.0", + "dotenv": "^10.0.0", + "kleur": "^4.1.4", + "set-cookie-parser": "^2.4.8", + "undici": "5.20.0", + "urlpattern-polyfill": "^4.0.3" + }, + "dependencies": { + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + }, + "undici": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.20.0.tgz", + "integrity": "sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g==", + "requires": { + "busboy": "^1.6.0" + } + } + } + }, + "@miniflare/queues": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/queues/-/queues-2.14.1.tgz", + "integrity": "sha512-uBzrbBkIgtNoztDpmMMISg/brYtxLHRE7oTaN8OVnq3bG+3nF9kQC42HUz+Vg+sf65UlvhSaqkjllgx+fNtOxQ==", + "requires": { + "@miniflare/shared": "2.14.1" + } + }, + "@miniflare/runner-vm": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/runner-vm/-/runner-vm-2.14.1.tgz", + "integrity": "sha512-UobsGM0ICVPDlJD54VPDSx0EXrIY3nJMXBy2zIFuuUOz4hQKXvMQ6jtAlJ8UNKer+XXI3Mb/9R/gfU8r6kxIMA==", + "requires": { + "@miniflare/shared": "2.14.1" + } + }, + "@miniflare/shared": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.14.1.tgz", + "integrity": "sha512-73GnLtWn5iP936ctE6ZJrMqGu134KOoIIveq5Yd/B+NnbFfzpuzjCpkLrnqjkDdsxDbruXSb5eTR/SmAdpJxZQ==", + "requires": { + "@types/better-sqlite3": "^7.6.0", + "kleur": "^4.1.4", + "npx-import": "^1.1.4", + "picomatch": "^2.3.1" + } + }, + "@miniflare/storage-memory": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/storage-memory/-/storage-memory-2.14.1.tgz", + "integrity": "sha512-lfQbQwopVWd4W5XzrYdp0rhk3dJpvSmv1Wwn9RhNO20WrcuoxpdSzbmpBahsgYVg+OheVaEbS6RpFqdmwwLTog==", + "requires": { + "@miniflare/shared": "2.14.1" + } + }, + "@miniflare/watcher": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.14.1.tgz", + "integrity": "sha512-dkFvetm5wk6pwunlYb/UkI0yFNb3otLpRm5RDywMUzqObEf+rCiNNAbJe3HUspr2ncZVAaRWcEaDh82vYK5cmw==", + "requires": { + "@miniflare/shared": "2.14.1" + } + }, + "@miniflare/web-sockets": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/web-sockets/-/web-sockets-2.14.0.tgz", + "integrity": "sha512-lB1CB4rBq0mbCuh55WgIEH4L3c4/i4MNDBfrQL+6r+wGcr/BJUqF8BHpsfAt5yHWUJVtK5mlMeesS/xpg4Ao1w==", + "requires": { + "@miniflare/core": "2.14.0", + "@miniflare/shared": "2.14.0", + "undici": "5.20.0", + "ws": "^8.2.2" + }, + "dependencies": { + "@miniflare/core": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.14.0.tgz", + "integrity": "sha512-BjmV/ZDwsKvXnJntYHt3AQgzVKp/5ZzWPpYWoOnUSNxq6nnRCQyvFvjvBZKnhubcmJCLSqegvz0yHejMA90CTA==", + "requires": { + "@iarna/toml": "^2.2.5", + "@miniflare/queues": "2.14.0", + "@miniflare/shared": "2.14.0", + "@miniflare/watcher": "2.14.0", + "busboy": "^1.6.0", + "dotenv": "^10.0.0", + "kleur": "^4.1.4", + "set-cookie-parser": "^2.4.8", + "undici": "5.20.0", + "urlpattern-polyfill": "^4.0.3" + } + }, + "@miniflare/queues": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/queues/-/queues-2.14.0.tgz", + "integrity": "sha512-flS4MqlgBKyv6QBqKD0IofjmMDW9wP1prUNQy2wWPih9lA6bFKmml3VdFeDsPnWtE2J67K0vCTf5kj1Q0qdW1w==", + "requires": { + "@miniflare/shared": "2.14.0" + } + }, + "@miniflare/shared": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.14.0.tgz", + "integrity": "sha512-O0jAEdMkp8BzrdFCfMWZu76h4Cq+tt3/oDtcTFgzum3fRW5vUhIi/5f6bfndu6rkGbSlzxwor8CJWpzityXGug==", + "requires": { + "@types/better-sqlite3": "^7.6.0", + "kleur": "^4.1.4", + "npx-import": "^1.1.4", + "picomatch": "^2.3.1" + } + }, + "@miniflare/watcher": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.14.0.tgz", + "integrity": "sha512-O8Abg2eHpGmcZb8WyUaA6Av1Mqt5bSrorzz4CrWwsvJHBdekZPIX0GihC9vn327d/1pKRs81YTiSAfBoSZpVIw==", + "requires": { + "@miniflare/shared": "2.14.0" + } + }, + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + }, + "undici": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.20.0.tgz", + "integrity": "sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g==", + "requires": { + "busboy": "^1.6.0" + } + }, + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} + } + } + }, "@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "dev": true, @@ -29932,6 +30703,7 @@ "@remix-run/dev": "1.19.1", "@shopify/cli-kit": "3.48.0", "@shopify/hydrogen-codegen": "^0.0.2", + "@shopify/mini-oxygen": "^1.7.0", "@types/diff": "^5.0.2", "@types/fs-extra": "^11.0.1", "@types/gunzip-maybe": "^1.4.0", @@ -30614,6 +31386,158 @@ } } }, + "@shopify/mini-oxygen": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@shopify/mini-oxygen/-/mini-oxygen-1.7.0.tgz", + "integrity": "sha512-uU9d4OhwepTAtNFTDKXijD5cgGlUQN0cX9n4rY7I8UIg4kNKaV+TvBZB3UwyNloOPOfhaOJf33zRnzHKwHsXEg==", + "requires": { + "@miniflare/cache": "^2.14.0", + "@miniflare/core": "^2.14.0", + "@miniflare/queues": "^2.14.0", + "@miniflare/runner-vm": "^2.14.0", + "@miniflare/shared": "^2.14.0", + "@miniflare/storage-memory": "^2.14.0", + "@miniflare/web-sockets": "2.14.0", + "@types/connect": "^3.4.35", + "@types/mime": "^3.0.1", + "body-parser": "1.20.2", + "connect": "^3.7.0", + "eventsource": "^2.0.2", + "fs-extra": "^11.1.0", + "get-port": "^5.1.1", + "inquirer": "^9.0.0", + "mime": "^3.0.0", + "semiver": "^1.1.0", + "source-map-support": "^0.5.21", + "typescript": "^4.7.2" + }, + "dependencies": { + "body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + } + }, + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" + }, + "cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==" + }, + "figures": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", + "requires": { + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + } + }, + "fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "inquirer": { + "version": "9.2.10", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.10.tgz", + "integrity": "sha512-tVVNFIXU8qNHoULiazz612GFl+yqNfjMTbLuViNJE/d860Qxrd3NMrse8dm40VUQLOQeULvaQF8lpAhvysjeyA==", + "requires": { + "@ljharb/through": "^2.3.9", + "ansi-escapes": "^4.3.2", + "chalk": "^5.3.0", + "cli-cursor": "^3.1.0", + "cli-width": "^4.1.0", + "external-editor": "^3.1.0", + "figures": "^5.0.0", + "lodash": "^4.17.21", + "mute-stream": "1.0.0", + "ora": "^5.4.1", + "run-async": "^3.0.0", + "rxjs": "^7.8.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.2.0" + } + }, + "is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "mute-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==" + }, + "raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "run-async": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==" + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, "@shopify/oxygen-workers-types": { "version": "3.17.3", "dev": true @@ -30883,6 +31807,14 @@ "version": "4.2.2", "dev": true }, + "@types/better-sqlite3": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.4.tgz", + "integrity": "sha512-dzrRZCYPXIXfSR1/surNbJ/grU3scTaygS0OMzjlGf71i9sc2fGyHPXXiXmEvNIoE0cGwsanEFMVJxPXmco9Eg==", + "requires": { + "@types/node": "*" + } + }, "@types/body-parser": { "version": "1.19.2", "dev": true, @@ -30926,7 +31858,6 @@ }, "@types/connect": { "version": "3.4.35", - "dev": true, "requires": { "@types/node": "*" } @@ -31120,8 +32051,7 @@ "dev": true }, "@types/mime": { - "version": "3.0.1", - "dev": true + "version": "3.0.1" }, "@types/minimatch": { "version": "5.1.2" @@ -32336,6 +33266,14 @@ "buffer-from": { "version": "1.1.2" }, + "builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "requires": { + "semver": "^7.0.0" + } + }, "bundle-name": { "version": "3.0.0", "dev": true, @@ -32784,6 +33722,59 @@ "proto-list": "~1.2.1" } }, + "connect": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", + "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", + "requires": { + "debug": "2.6.9", + "finalhandler": "1.1.2", + "parseurl": "~1.3.3", + "utils-merge": "1.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==", + "requires": { + "ee-first": "1.1.1" + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==" + } + } + }, "constant-case": { "version": "3.0.4", "requires": { @@ -34299,6 +35290,27 @@ "event-target-shim": { "version": "5.0.1" }, + "eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==" + }, + "execa": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", + "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^3.0.1", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + } + }, "exit-hook": { "version": "2.2.1" }, @@ -37876,6 +38888,17 @@ } } }, + "npx-import": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/npx-import/-/npx-import-1.1.4.tgz", + "integrity": "sha512-3ShymTWOgqGyNlh5lMJAejLuIv3W1K3fbI5Ewc6YErZU3Sp0PqsNs8UIU1O8z5+KVl/Du5ag56Gza9vdorGEoA==", + "requires": { + "execa": "^6.1.0", + "parse-package-name": "^1.0.0", + "semver": "^7.3.7", + "validate-npm-package-name": "^4.0.0" + } + }, "nullthrows": { "version": "1.1.1" }, @@ -38234,6 +39257,11 @@ "parse-ms": { "version": "2.1.0" }, + "parse-package-name": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-package-name/-/parse-package-name-1.0.0.tgz", + "integrity": "sha512-kBeTUtcj+SkyfaW4+KBe0HtsloBJ/mKTPoxpVdA57GZiPerREsUWJOhVj9anXweFiJkm5y8FG1sxFZkZ0SN6wg==" + }, "parse5": { "version": "6.0.1", "dev": true @@ -39714,7 +40742,9 @@ } }, "rxjs": { - "version": "7.5.7", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "requires": { "tslib": "^2.1.0" }, @@ -39761,6 +40791,11 @@ "scuid": { "version": "1.1.0" }, + "semiver": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz", + "integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==" + }, "semver": { "version": "7.5.3", "requires": { @@ -41392,6 +42427,11 @@ "punycode": "^2.1.0" } }, + "urlpattern-polyfill": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-4.0.3.tgz", + "integrity": "sha512-DOE84vZT2fEcl9gqCUTcnAw5ZY5Id55ikUcziSUntuEFL3pRvavg5kwDmTEUJkeCHInTlV/HexFomgYnzO5kdQ==" + }, "use-isomorphic-layout-effect": { "version": "1.1.2", "requires": {} @@ -41445,6 +42485,14 @@ "spdx-expression-parse": "^3.0.0" } }, + "validate-npm-package-name": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz", + "integrity": "sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q==", + "requires": { + "builtins": "^5.0.0" + } + }, "value-or-promise": { "version": "1.0.12" }, diff --git a/packages/cli/package.json b/packages/cli/package.json index c02fb61466..924ea86787 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -41,6 +41,7 @@ "@remix-run/dev": "1.19.1", "@shopify/cli-kit": "3.48.0", "@shopify/hydrogen-codegen": "^0.0.2", + "@shopify/mini-oxygen": "^1.7.0", "ansi-escapes": "^6.2.0", "diff": "^5.1.0", "fast-glob": "^3.2.12", diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen.ts new file mode 100644 index 0000000000..b6da3f6827 --- /dev/null +++ b/packages/cli/src/lib/mini-oxygen.ts @@ -0,0 +1,143 @@ +import { + outputInfo, + outputToken, + outputContent, +} from '@shopify/cli-kit/node/output'; +import {resolvePath} from '@shopify/cli-kit/node/path'; +import {fileExists} from '@shopify/cli-kit/node/fs'; +import colors from '@shopify/cli-kit/node/colors'; +import {renderSuccess} from '@shopify/cli-kit/node/ui'; + +type MiniOxygenOptions = { + root: string; + port?: number; + watch?: boolean; + buildPathClient: string; + buildPathWorkerFile: string; + env?: {[key: string]: string}; +}; + +export type MiniOxygen = Awaited>; + +export async function startMiniOxygen({ + root, + port = 3000, + watch = false, + buildPathWorkerFile, + buildPathClient, + env, +}: MiniOxygenOptions) { + const {default: miniOxygenImport} = await import('@shopify/mini-oxygen'); + const miniOxygenPreview = + miniOxygenImport.default ?? + (miniOxygenImport as unknown as typeof miniOxygenImport.default); + + const dotenvPath = resolvePath(root, '.env'); + + const miniOxygen = await miniOxygenPreview({ + workerFile: buildPathWorkerFile, + assetsDir: buildPathClient, + publicPath: '', + port, + watch, + autoReload: watch, + modules: true, + env: { + ...env, + ...process.env, + }, + envPath: !env && (await fileExists(dotenvPath)) ? dotenvPath : undefined, + log: () => {}, + buildWatchPaths: watch + ? [resolvePath(root, buildPathWorkerFile)] + : undefined, + onResponse: (request, response) => + // 'Request' and 'Response' types in MiniOxygen comes from + // Miniflare and are slightly different from standard types. + logResponse( + request as unknown as Request, + response as unknown as Response, + ), + }); + + const listeningAt = `http://localhost:${miniOxygen.port}`; + + return { + listeningAt, + port: miniOxygen.port, + reload(nextOptions?: Partial>) { + return miniOxygen.reload({ + env: { + ...(nextOptions?.env ?? env), + ...process.env, + }, + }); + }, + showBanner(options?: { + mode?: string; + headlinePrefix?: string; + extraLines?: string[]; + appName?: string; + }) { + console.log(''); + renderSuccess({ + headline: `${options?.headlinePrefix ?? ''}MiniOxygen ${ + options?.mode ?? 'development' + } server running.`, + body: [ + `View ${options?.appName ?? 'Hydrogen'} app: ${listeningAt}`, + ...(options?.extraLines ?? []), + ], + }); + console.log(''); + }, + }; +} + +export function logResponse(request: Request, response: Response) { + try { + const url = new URL(request.url); + if (['/graphiql'].includes(url.pathname)) return; + + const isProxy = !!response.url && response.url !== request.url; + const isDataRequest = !isProxy && url.searchParams.has('_data'); + let route = request.url.replace(url.origin, ''); + let info = ''; + let type = 'render'; + + if (isProxy) { + type = 'proxy'; + info = `[${response.url}]`; + } + + if (isDataRequest) { + type = request.method === 'GET' ? 'loader' : 'action'; + const dataParam = url.searchParams.get('_data')?.replace('routes/', ''); + route = url.pathname; + info = `[${dataParam}]`; + } + + const colorizeStatus = + response.status < 300 + ? outputToken.green + : response.status < 400 + ? outputToken.cyan + : outputToken.errorText; + + outputInfo( + outputContent`${request.method.padStart(6)} ${colorizeStatus( + String(response.status), + )} ${outputToken.italic(type.padEnd(7, ' '))} ${route}${ + info ? ' ' + colors.dim(info) : '' + } ${ + request.headers.get('purpose') === 'prefetch' + ? outputToken.italic('(prefetch)') + : '' + }`, + ); + } catch { + if (request && response) { + outputInfo(`${request.method} ${response.status} ${request.url}`); + } + } +} From 844bf6108bdb4a577516b166d9797d0c44d10c34 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 16:15:08 +0900 Subject: [PATCH 18/38] Restore logs for MiniOxygen --- packages/cli/src/commands/hydrogen/dev.ts | 1 - packages/cli/src/lib/log.ts | 26 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/hydrogen/dev.ts b/packages/cli/src/commands/hydrogen/dev.ts index 0b15bb5dfe..9af918c1dc 100644 --- a/packages/cli/src/commands/hydrogen/dev.ts +++ b/packages/cli/src/commands/hydrogen/dev.ts @@ -28,7 +28,6 @@ import {getAllEnvironmentVariables} from '../../lib/environment-variables.js'; import {getConfig} from '../../lib/shopify-config.js'; import {setupLiveReload} from '../../lib/live-reload.js'; import {checkRemixVersions} from '../../lib/remix-version-check.js'; -import {findPort} from '../../lib/find-port.js'; const LOG_REBUILDING = '🧱 Rebuilding...'; const LOG_REBUILT = '🚀 Rebuilt'; diff --git a/packages/cli/src/lib/log.ts b/packages/cli/src/lib/log.ts index ac653c8c55..dec95606bc 100644 --- a/packages/cli/src/lib/log.ts +++ b/packages/cli/src/lib/log.ts @@ -88,9 +88,33 @@ function injectLogReplacer( * Mute logs from Miniflare */ export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) { + injectLogReplacer('log'); injectLogReplacer('error'); - addMessageReplacers('dev', [ + let isFirstWorkerReload = true; + addMessageReplacers('dev-node', [ + ([first]) => typeof first === 'string' && first.includes('[mf:'), + (args: string[]) => { + const first = args[0] as string; + + if (workerReload !== false && first.includes('Worker reloaded')) { + if (isFirstWorkerReload) { + isFirstWorkerReload = false; + // return args as string[]; + return; + } + + return [first.replace('[mf:inf] ', '🔄 ') + '\n', ...args.slice(1)]; + } + + if (!first.includes('[mf:err]')) { + // Hide logs except errors + return; + } + }, + ]); + + addMessageReplacers('dev-workerd', [ // Workerd logs ([first]) => typeof first === 'string' && /^\x1B\[31m(workerd\/|stack:)/.test(first), From 94a4bcbe64e7d5fb1e716e2bbd87ff7acbb34dc3 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 16:15:57 +0900 Subject: [PATCH 19/38] Fix port after merge --- packages/cli/src/commands/hydrogen/preview.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/cli/src/commands/hydrogen/preview.ts b/packages/cli/src/commands/hydrogen/preview.ts index c6004bb0fa..511b304fb5 100644 --- a/packages/cli/src/commands/hydrogen/preview.ts +++ b/packages/cli/src/commands/hydrogen/preview.ts @@ -3,7 +3,6 @@ import {muteDevLogs} from '../../lib/log.js'; import {getProjectPaths} from '../../lib/remix-config.js'; import {commonFlags, DEFAULT_PORT} from '../../lib/flags.js'; import {startMiniOxygen} from '../../lib/mini-oxygen.js'; -import {findPort} from '../../lib/find-port.js'; export default class Preview extends Command { static description = @@ -36,7 +35,7 @@ export async function runPreview({ const miniOxygen = await startMiniOxygen({ root, - port: await findPort(port), + port, buildPathClient, buildPathWorkerFile, }); From 40a5d6d29e67bb559f191f8212fed03042447f0c Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 17:08:29 +0900 Subject: [PATCH 20/38] Move mini-oxygen v2 logic --- packages/cli/src/commands/hydrogen/dev.ts | 4 +- packages/cli/src/commands/hydrogen/preview.ts | 2 +- packages/cli/src/lib/mini-oxygen/index.ts | 1 + .../{mini-oxygen.ts => mini-oxygen/node.ts} | 52 ++++++------------- packages/cli/src/lib/mini-oxygen/types.ts | 22 ++++++++ 5 files changed, 43 insertions(+), 38 deletions(-) create mode 100644 packages/cli/src/lib/mini-oxygen/index.ts rename packages/cli/src/lib/{mini-oxygen.ts => mini-oxygen/node.ts} (78%) create mode 100644 packages/cli/src/lib/mini-oxygen/types.ts diff --git a/packages/cli/src/commands/hydrogen/dev.ts b/packages/cli/src/commands/hydrogen/dev.ts index 9af918c1dc..1620d9b15a 100644 --- a/packages/cli/src/commands/hydrogen/dev.ts +++ b/packages/cli/src/commands/hydrogen/dev.ts @@ -20,7 +20,7 @@ import { } from '../../lib/flags.js'; import Command from '@shopify/cli-kit/node/base-command'; import {Flags} from '@oclif/core'; -import {type MiniOxygen, startMiniOxygen} from '../../lib/mini-oxygen.js'; +import {type MiniOxygen, startMiniOxygen} from '../../lib/mini-oxygen/index.js'; import {checkHydrogenVersion} from '../../lib/check-version.js'; import {addVirtualRoutes} from '../../lib/virtual-routes.js'; import {spawnCodegenProcess} from '../../lib/codegen.js'; @@ -236,7 +236,7 @@ async function runDev({ if (!miniOxygen) { await safeStartMiniOxygen(); } else if (liveReload) { - await miniOxygen.reload({worker: true}); + await miniOxygen.reload(); } liveReload?.onAppReady(context); diff --git a/packages/cli/src/commands/hydrogen/preview.ts b/packages/cli/src/commands/hydrogen/preview.ts index 511b304fb5..c4a88af98e 100644 --- a/packages/cli/src/commands/hydrogen/preview.ts +++ b/packages/cli/src/commands/hydrogen/preview.ts @@ -2,7 +2,7 @@ import Command from '@shopify/cli-kit/node/base-command'; import {muteDevLogs} from '../../lib/log.js'; import {getProjectPaths} from '../../lib/remix-config.js'; import {commonFlags, DEFAULT_PORT} from '../../lib/flags.js'; -import {startMiniOxygen} from '../../lib/mini-oxygen.js'; +import {startMiniOxygen} from '../../lib/mini-oxygen/index.js'; export default class Preview extends Command { static description = diff --git a/packages/cli/src/lib/mini-oxygen/index.ts b/packages/cli/src/lib/mini-oxygen/index.ts new file mode 100644 index 0000000000..c751a998a7 --- /dev/null +++ b/packages/cli/src/lib/mini-oxygen/index.ts @@ -0,0 +1 @@ +export {startMiniOxygen, type MiniOxygen} from './node.js'; diff --git a/packages/cli/src/lib/mini-oxygen.ts b/packages/cli/src/lib/mini-oxygen/node.ts similarity index 78% rename from packages/cli/src/lib/mini-oxygen.ts rename to packages/cli/src/lib/mini-oxygen/node.ts index 0370f88481..47695f28eb 100644 --- a/packages/cli/src/lib/mini-oxygen.ts +++ b/packages/cli/src/lib/mini-oxygen/node.ts @@ -10,18 +10,11 @@ import {renderSuccess} from '@shopify/cli-kit/node/ui'; import { startServer, type MiniOxygenOptions as InternalMiniOxygenOptions, + type Request, + type Response, } from '@shopify/mini-oxygen'; -import {DEFAULT_PORT} from './flags.js'; - -type MiniOxygenOptions = { - root: string; - port?: number; - watch?: boolean; - autoReload?: boolean; - buildPathClient: string; - buildPathWorkerFile: string; - env?: {[key: string]: string}; -}; +import {DEFAULT_PORT} from '../flags.js'; +import type {MiniOxygenInstance, MiniOxygenOptions} from './types.js'; export type MiniOxygen = Awaited>; @@ -29,11 +22,10 @@ export async function startMiniOxygen({ root, port = DEFAULT_PORT, watch = false, - autoReload = watch, buildPathWorkerFile, buildPathClient, env, -}: MiniOxygenOptions) { +}: MiniOxygenOptions): Promise { const dotenvPath = resolvePath(root, '.env'); const miniOxygen = await startServer({ @@ -42,7 +34,7 @@ export async function startMiniOxygen({ publicPath: '', port, watch, - autoReload, + autoReload: watch, modules: true, env: { ...env, @@ -50,13 +42,11 @@ export async function startMiniOxygen({ }, envPath: !env && (await fileExists(dotenvPath)) ? dotenvPath : undefined, log: () => {}, - onResponse: (request, response) => + onResponse(request, response) { // 'Request' and 'Response' types in MiniOxygen comes from // Miniflare and are slightly different from standard types. - logResponse( - request as unknown as Request, - response as unknown as Response, - ), + return logResponse(request, response); + }, }); const listeningAt = `http://localhost:${miniOxygen.port}`; @@ -64,32 +54,21 @@ export async function startMiniOxygen({ return { listeningAt, port: miniOxygen.port, - async reload( - options: Partial> & { - worker?: boolean; - } = {}, - ) { + async reload(options) { const nextOptions: Partial = {}; - if (options.env) { + if (options?.env) { nextOptions.env = { ...options.env, ...(process.env as Record), }; } - if (options.worker) { - nextOptions.script = await readFile(buildPathWorkerFile); - } + nextOptions.script = await readFile(buildPathWorkerFile); - return miniOxygen.reload(nextOptions); + await miniOxygen.reload(nextOptions); }, - showBanner(options?: { - mode?: string; - headlinePrefix?: string; - extraLines?: string[]; - appName?: string; - }) { + showBanner(options) { console.log(''); renderSuccess({ headline: `${options?.headlinePrefix ?? ''}MiniOxygen ${ @@ -102,6 +81,9 @@ export async function startMiniOxygen({ }); console.log(''); }, + async close() { + await miniOxygen.close(); + }, }; } diff --git a/packages/cli/src/lib/mini-oxygen/types.ts b/packages/cli/src/lib/mini-oxygen/types.ts new file mode 100644 index 0000000000..064ede75e5 --- /dev/null +++ b/packages/cli/src/lib/mini-oxygen/types.ts @@ -0,0 +1,22 @@ +export type MiniOxygenOptions = { + root: string; + port?: number; + watch?: boolean; + autoReload?: boolean; + buildPathClient: string; + buildPathWorkerFile: string; + env?: {[key: string]: string}; +}; + +export type MiniOxygenInstance = { + listeningAt: string; + port: number; + reload: (options?: Partial>) => Promise; + showBanner: (options?: { + mode?: string; + headlinePrefix?: string; + extraLines?: string[]; + appName?: string; + }) => void; + close: () => Promise; +}; From 28e4835c4538efb532393d1a716b6d7fd1e371f1 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 17:13:38 +0900 Subject: [PATCH 21/38] Unify API --- packages/cli/src/lib/mini-oxygen/common.ts | 82 +++++++++++++++ packages/cli/src/lib/mini-oxygen/index.ts | 3 +- packages/cli/src/lib/mini-oxygen/node.ts | 74 +++---------- packages/cli/src/lib/mini-oxygen/workerd.ts | 109 +++----------------- 4 files changed, 109 insertions(+), 159 deletions(-) create mode 100644 packages/cli/src/lib/mini-oxygen/common.ts diff --git a/packages/cli/src/lib/mini-oxygen/common.ts b/packages/cli/src/lib/mini-oxygen/common.ts new file mode 100644 index 0000000000..9e9ee94bfa --- /dev/null +++ b/packages/cli/src/lib/mini-oxygen/common.ts @@ -0,0 +1,82 @@ +import { + outputInfo, + outputToken, + outputContent, +} from '@shopify/cli-kit/node/output'; +import colors from '@shopify/cli-kit/node/colors'; + +export function logRequestLine( + // Minimal overlap between Fetch, Miniflare@2 and Miniflare@3 request types. + request: Pick & { + headers: {get: (key: string) => string | null}; + }, + { + responseStatus = 200, + durationMs = 0, + }: {responseStatus?: number; durationMs?: number} = {}, +): void { + try { + const url = new URL(request.url); + if (['/graphiql'].includes(url.pathname)) return; + + const isDataRequest = url.searchParams.has('_data'); + let route = request.url.replace(url.origin, ''); + let info = ''; + let type = 'render'; + + if (isDataRequest) { + type = request.method === 'GET' ? 'loader' : 'action'; + const dataParam = url.searchParams.get('_data')?.replace('routes/', ''); + route = url.pathname; + info = `[${dataParam}]`; + } + + const colorizeStatus = + responseStatus < 300 + ? outputToken.green + : responseStatus < 400 + ? outputToken.cyan + : outputToken.errorText; + + outputInfo( + outputContent`${request.method.padStart(6)} ${colorizeStatus( + String(responseStatus), + )} ${outputToken.italic(type.padEnd(7, ' '))} ${route} ${ + durationMs > 0 ? colors.dim(` ${durationMs}ms`) : '' + }${info ? ' ' + colors.dim(info) : ''}${ + request.headers.get('purpose') === 'prefetch' + ? outputToken.italic(colors.dim(' prefetch')) + : '' + }`, + ); + } catch { + if (request && responseStatus) { + outputInfo(`${request.method} ${responseStatus} ${request.url}`); + } + } +} + +// https://shopify.dev/docs/custom-storefronts/oxygen/worker-runtime-apis#custom-headers +export const OXYGEN_HEADERS_MAP = { + ip: {name: 'oxygen-buyer-ip', defaultValue: '127.0.0.1'}, + longitude: {name: 'oxygen-buyer-longitude', defaultValue: '-122.40140'}, + latitude: {name: 'oxygen-buyer-latitude', defaultValue: '37.78855'}, + continent: {name: 'oxygen-buyer-continent', defaultValue: 'NA'}, + country: {name: 'oxygen-buyer-country', defaultValue: 'US'}, + region: {name: 'oxygen-buyer-region', defaultValue: 'California'}, + regionCode: {name: 'oxygen-buyer-region-code', defaultValue: 'CA'}, + city: {name: 'oxygen-buyer-city', defaultValue: 'San Francisco'}, + isEuCountry: {name: 'oxygen-buyer-is-eu-country', defaultValue: ''}, + timezone: { + name: 'oxygen-buyer-timezone', + defaultValue: 'America/Los_Angeles', + }, + + // Not documented but available in Oxygen: + deploymentId: {name: 'oxygen-buyer-deployment-id', defaultValue: 'local'}, + shopId: {name: 'oxygen-buyer-shop-id', defaultValue: 'development'}, + storefrontId: { + name: 'oxygen-buyer-storefront-id', + defaultValue: 'development', + }, +} as const; diff --git a/packages/cli/src/lib/mini-oxygen/index.ts b/packages/cli/src/lib/mini-oxygen/index.ts index c751a998a7..0c946fb515 100644 --- a/packages/cli/src/lib/mini-oxygen/index.ts +++ b/packages/cli/src/lib/mini-oxygen/index.ts @@ -1 +1,2 @@ -export {startMiniOxygen, type MiniOxygen} from './node.js'; +export {startMiniOxygen} from './node.js'; +export type {MiniOxygenInstance as MiniOxygen} from './types.js'; diff --git a/packages/cli/src/lib/mini-oxygen/node.ts b/packages/cli/src/lib/mini-oxygen/node.ts index 47695f28eb..3dcd7f56c3 100644 --- a/packages/cli/src/lib/mini-oxygen/node.ts +++ b/packages/cli/src/lib/mini-oxygen/node.ts @@ -1,22 +1,14 @@ -import { - outputInfo, - outputToken, - outputContent, -} from '@shopify/cli-kit/node/output'; import {resolvePath} from '@shopify/cli-kit/node/path'; import {fileExists, readFile} from '@shopify/cli-kit/node/fs'; -import colors from '@shopify/cli-kit/node/colors'; import {renderSuccess} from '@shopify/cli-kit/node/ui'; import { startServer, type MiniOxygenOptions as InternalMiniOxygenOptions, type Request, - type Response, } from '@shopify/mini-oxygen'; import {DEFAULT_PORT} from '../flags.js'; import type {MiniOxygenInstance, MiniOxygenOptions} from './types.js'; - -export type MiniOxygen = Awaited>; +import {logRequestLine} from './common.js'; export async function startMiniOxygen({ root, @@ -27,6 +19,7 @@ export async function startMiniOxygen({ env, }: MiniOxygenOptions): Promise { const dotenvPath = resolvePath(root, '.env'); + const requestMap = new WeakMap(); const miniOxygen = await startServer({ script: await readFile(buildPathWorkerFile), @@ -42,10 +35,17 @@ export async function startMiniOxygen({ }, envPath: !env && (await fileExists(dotenvPath)) ? dotenvPath : undefined, log: () => {}, + onRequest(request) { + requestMap.set(request, {startTime: Date.now()}); + }, onResponse(request, response) { - // 'Request' and 'Response' types in MiniOxygen comes from - // Miniflare and are slightly different from standard types. - return logResponse(request, response); + const startTimeMs = requestMap.get(request)?.startTime ?? 0; + requestMap.delete(request); + + logRequestLine(request, { + responseStatus: response.status, + durationMs: startTimeMs > 0 ? Date.now() - startTimeMs : 0, + }); }, }); @@ -86,53 +86,3 @@ export async function startMiniOxygen({ }, }; } - -export function logResponse(request: Request, response: Response) { - try { - const url = new URL(request.url); - if (['/graphiql'].includes(url.pathname)) { - return; - } - - const isProxy = !!response.url && response.url !== request.url; - const isDataRequest = !isProxy && url.searchParams.has('_data'); - let route = request.url.replace(url.origin, ''); - let info = ''; - let type = 'render'; - - if (isProxy) { - type = 'proxy'; - info = `[${response.url}]`; - } - - if (isDataRequest) { - type = request.method === 'GET' ? 'loader' : 'action'; - const dataParam = url.searchParams.get('_data')?.replace('routes/', ''); - route = url.pathname; - info = `[${dataParam}]`; - } - - const colorizeStatus = - response.status < 300 - ? outputToken.green - : response.status < 400 - ? outputToken.cyan - : outputToken.errorText; - - outputInfo( - outputContent`${request.method.padStart(6)} ${colorizeStatus( - String(response.status), - )} ${outputToken.italic(type.padEnd(7, ' '))} ${route}${ - info ? ' ' + colors.dim(info) : '' - } ${ - request.headers.get('purpose') === 'prefetch' - ? outputToken.italic('(prefetch)') - : '' - }`, - ); - } catch { - if (request && response) { - outputInfo(`${request.method} ${response.status} ${request.url}`); - } - } -} diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index 3b952efc16..d08fd60ab3 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -1,11 +1,5 @@ -import { - outputInfo, - outputToken, - outputContent, -} from '@shopify/cli-kit/node/output'; import {resolvePath, extname} from '@shopify/cli-kit/node/path'; import {glob, readFile} from '@shopify/cli-kit/node/fs'; -import colors from '@shopify/cli-kit/node/colors'; import {renderSuccess} from '@shopify/cli-kit/node/ui'; import mime from 'mime'; import { @@ -19,17 +13,8 @@ import { import {connectToInspector, findInspectorUrl} from './workerd-inspector.js'; import {DEFAULT_PORT} from '../flags.js'; import {findPort} from '../find-port.js'; - -type MiniOxygenOptions = { - root: string; - port?: number; - watch?: boolean; - buildPathClient: string; - buildPathWorkerFile: string; - env?: {[key: string]: string}; -}; - -export type MiniOxygen = Awaited>; +import type {MiniOxygenInstance, MiniOxygenOptions} from './types.js'; +import {OXYGEN_HEADERS_MAP, logRequestLine} from './common.js'; export async function startMiniOxygen({ root, @@ -38,7 +23,7 @@ export async function startMiniOxygen({ buildPathWorkerFile, buildPathClient, env, -}: MiniOxygenOptions) { +}: MiniOxygenOptions): Promise { const inspectorPort = await findPort(8787); const buildMiniOxygenOptions = async () => @@ -100,7 +85,7 @@ export async function startMiniOxygen({ return { port, listeningAt, - async reload(nextOptions?: Partial>) { + async reload(nextOptions) { miniOxygenOptions = await buildMiniOxygenOptions(); if (nextOptions) { @@ -120,12 +105,7 @@ export async function startMiniOxygen({ cleanupInspector = connectToInspector({inspectorUrl, sourceMapPath}); } }, - showBanner(options?: { - mode?: string; - headlinePrefix?: string; - extraLines?: string[]; - appName?: string; - }) { + showBanner(options) { console.log(''); renderSuccess({ headline: `${options?.headlinePrefix ?? ''}MiniOxygen ${ @@ -138,6 +118,9 @@ export async function startMiniOxygen({ }); console.log(''); }, + async close() { + await miniOxygen.dispose(); + }, }; } @@ -209,76 +192,10 @@ function createAssetHandler(buildPathClient: string) { } async function logRequest(request: Request): Promise { - const dummyResponse = new Response('ok'); - let responseStatus = 200; - - try { - responseStatus = Number(request.headers.get('h2-response-status') || 200); - const durationMs = Number(request.headers.get('h2-duration-ms') || 0); - - const url = new URL(request.url); - if (['/graphiql'].includes(url.pathname)) return dummyResponse; - - const isDataRequest = url.searchParams.has('_data'); - let route = request.url.replace(url.origin, ''); - let info = ''; - let type = 'render'; - - if (isDataRequest) { - type = request.method === 'GET' ? 'loader' : 'action'; - const dataParam = url.searchParams.get('_data')?.replace('routes/', ''); - route = url.pathname; - info = `[${dataParam}]`; - } + logRequestLine(request, { + responseStatus: Number(request.headers.get('h2-response-status') || 200), + durationMs: Number(request.headers.get('h2-duration-ms') || 0), + }); - const colorizeStatus = - responseStatus < 300 - ? outputToken.green - : responseStatus < 400 - ? outputToken.cyan - : outputToken.errorText; - - outputInfo( - outputContent`${request.method.padStart(6)} ${colorizeStatus( - String(responseStatus), - )} ${outputToken.italic(type.padEnd(7, ' '))} ${route} ${ - durationMs > 0 ? colors.dim(` ${durationMs}ms`) : '' - }${info ? ' ' + colors.dim(info) : ''}${ - request.headers.get('purpose') === 'prefetch' - ? outputToken.italic(colors.dim(' prefetch')) - : '' - }`, - ); - } catch { - if (request && responseStatus) { - outputInfo(`${request.method} ${responseStatus} ${request.url}`); - } - } - - return dummyResponse; + return new Response('ok'); } - -// https://shopify.dev/docs/custom-storefronts/oxygen/worker-runtime-apis#custom-headers -const OXYGEN_HEADERS_MAP = { - ip: {name: 'oxygen-buyer-ip', defaultValue: '127.0.0.1'}, - longitude: {name: 'oxygen-buyer-longitude', defaultValue: '-122.40140'}, - latitude: {name: 'oxygen-buyer-latitude', defaultValue: '37.78855'}, - continent: {name: 'oxygen-buyer-continent', defaultValue: 'NA'}, - country: {name: 'oxygen-buyer-country', defaultValue: 'US'}, - region: {name: 'oxygen-buyer-region', defaultValue: 'California'}, - regionCode: {name: 'oxygen-buyer-region-code', defaultValue: 'CA'}, - city: {name: 'oxygen-buyer-city', defaultValue: 'San Francisco'}, - isEuCountry: {name: 'oxygen-buyer-is-eu-country', defaultValue: ''}, - timezone: { - name: 'oxygen-buyer-timezone', - defaultValue: 'America/Los_Angeles', - }, - - // Not documented but available in Oxygen: - deploymentId: {name: 'oxygen-buyer-deployment-id', defaultValue: 'local'}, - shopId: {name: 'oxygen-buyer-shop-id', defaultValue: 'development'}, - storefrontId: { - name: 'oxygen-buyer-storefront-id', - defaultValue: 'development', - }, -} as const; From 11fcd70d239be6629525349d2cc0b5a7aa4a057f Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 17:39:02 +0900 Subject: [PATCH 22/38] Toggle between node and worker with a CLI flag --- packages/cli/oclif.manifest.json | 12 ++++++++ packages/cli/src/commands/hydrogen/dev.ts | 23 ++++++++++----- packages/cli/src/commands/hydrogen/preview.ts | 29 ++++++++++++++----- packages/cli/src/lib/flags.ts | 5 ++++ packages/cli/src/lib/mini-oxygen/index.ts | 18 ++++++++++-- packages/cli/src/lib/mini-oxygen/node.ts | 2 +- packages/cli/src/lib/mini-oxygen/workerd.ts | 6 ++-- 7 files changed, 74 insertions(+), 21 deletions(-) diff --git a/packages/cli/oclif.manifest.json b/packages/cli/oclif.manifest.json index 7410d8d656..24830a49f3 100644 --- a/packages/cli/oclif.manifest.json +++ b/packages/cli/oclif.manifest.json @@ -154,6 +154,12 @@ "multiple": false, "default": 3000 }, + "native-unstable": { + "name": "native-unstable", + "type": "boolean", + "description": "Run the app in a native environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.", + "allowNo": false + }, "codegen-unstable": { "name": "codegen-unstable", "type": "boolean", @@ -410,6 +416,12 @@ "description": "Port to run the server on.", "multiple": false, "default": 3000 + }, + "native-unstable": { + "name": "native-unstable", + "type": "boolean", + "description": "Run the app in a native environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.", + "allowNo": false } }, "args": {} diff --git a/packages/cli/src/commands/hydrogen/dev.ts b/packages/cli/src/commands/hydrogen/dev.ts index 1620d9b15a..5806cebd30 100644 --- a/packages/cli/src/commands/hydrogen/dev.ts +++ b/packages/cli/src/commands/hydrogen/dev.ts @@ -38,6 +38,7 @@ export default class Dev extends Command { static flags = { path: commonFlags.path, port: commonFlags.port, + ['native-unstable']: commonFlags.native, ['codegen-unstable']: Flags.boolean({ description: 'Generate types for the Storefront API queries found in your project. It updates the types on file save.', @@ -68,6 +69,7 @@ export default class Dev extends Command { await runDev({ ...flagsToCamelObject(flags), useCodegen: flags['codegen-unstable'], + useNative: flags['native-unstable'], path: directory, }); } @@ -77,6 +79,7 @@ async function runDev({ port: portFlag = DEFAULT_PORT, path: appPath, useCodegen = false, + useNative = false, codegenConfigPath, disableVirtualRoutes, envBranch, @@ -86,6 +89,7 @@ async function runDev({ port?: number; path?: string; useCodegen?: boolean; + useNative?: boolean; codegenConfigPath?: string; disableVirtualRoutes?: boolean; envBranch?: string; @@ -156,14 +160,17 @@ async function runDev({ async function safeStartMiniOxygen() { if (miniOxygen) return; - miniOxygen = await startMiniOxygen({ - root, - port: portFlag, - watch: !liveReload, - buildPathWorkerFile, - buildPathClient, - env: await envPromise, - }); + miniOxygen = await startMiniOxygen( + { + root, + port: portFlag, + watch: !liveReload, + buildPathWorkerFile, + buildPathClient, + env: await envPromise, + }, + useNative, + ); const graphiqlUrl = `${miniOxygen.listeningAt}/graphiql`; enhanceH2Logs({graphiqlUrl, ...remixConfig}); diff --git a/packages/cli/src/commands/hydrogen/preview.ts b/packages/cli/src/commands/hydrogen/preview.ts index c4a88af98e..755a25c0a3 100644 --- a/packages/cli/src/commands/hydrogen/preview.ts +++ b/packages/cli/src/commands/hydrogen/preview.ts @@ -1,7 +1,11 @@ import Command from '@shopify/cli-kit/node/base-command'; import {muteDevLogs} from '../../lib/log.js'; import {getProjectPaths} from '../../lib/remix-config.js'; -import {commonFlags, DEFAULT_PORT} from '../../lib/flags.js'; +import { + commonFlags, + flagsToCamelObject, + DEFAULT_PORT, +} from '../../lib/flags.js'; import {startMiniOxygen} from '../../lib/mini-oxygen/index.js'; export default class Preview extends Command { @@ -11,21 +15,27 @@ export default class Preview extends Command { static flags = { path: commonFlags.path, port: commonFlags.port, + ['native-unstable']: commonFlags.native, }; async run(): Promise { const {flags} = await this.parse(Preview); - await runPreview({...flags}); + await runPreview({ + ...flagsToCamelObject(flags), + useNative: flags['native-unstable'], + }); } } export async function runPreview({ port = DEFAULT_PORT, path: appPath, + useNative = false, }: { port?: number; path?: string; + useNative?: boolean; }) { if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production'; @@ -33,12 +43,15 @@ export async function runPreview({ const {root, buildPathWorkerFile, buildPathClient} = getProjectPaths(appPath); - const miniOxygen = await startMiniOxygen({ - root, - port, - buildPathClient, - buildPathWorkerFile, - }); + const miniOxygen = await startMiniOxygen( + { + root, + port, + buildPathClient, + buildPathWorkerFile, + }, + useNative, + ); miniOxygen.showBanner({mode: 'preview'}); } diff --git a/packages/cli/src/lib/flags.ts b/packages/cli/src/lib/flags.ts index 9f87feaecc..9b706ebc9e 100644 --- a/packages/cli/src/lib/flags.ts +++ b/packages/cli/src/lib/flags.ts @@ -20,6 +20,11 @@ export const commonFlags = { env: 'SHOPIFY_HYDROGEN_FLAG_PORT', default: DEFAULT_PORT, }), + native: Flags.boolean({ + description: + 'Run the app in a native environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.', + env: 'SHOPIFY_HYDROGEN_FLAG_UNSTABLE_NATIVE', + }), force: Flags.boolean({ description: 'Overwrite the destination directory and files if they already exist.', diff --git a/packages/cli/src/lib/mini-oxygen/index.ts b/packages/cli/src/lib/mini-oxygen/index.ts index 0c946fb515..a12e99b0b0 100644 --- a/packages/cli/src/lib/mini-oxygen/index.ts +++ b/packages/cli/src/lib/mini-oxygen/index.ts @@ -1,2 +1,16 @@ -export {startMiniOxygen} from './node.js'; -export type {MiniOxygenInstance as MiniOxygen} from './types.js'; +import type {MiniOxygenInstance, MiniOxygenOptions} from './types.js'; + +export type MiniOxygen = MiniOxygenInstance; + +export async function startMiniOxygen( + options: MiniOxygenOptions, + useWorkerd = false, +): Promise { + if (useWorkerd) { + const {startWorkerdServer} = await import('./workerd.js'); + return startWorkerdServer(options); + } else { + const {startNodeServer} = await import('./node.js'); + return startNodeServer(options); + } +} diff --git a/packages/cli/src/lib/mini-oxygen/node.ts b/packages/cli/src/lib/mini-oxygen/node.ts index 3dcd7f56c3..bc4d0047fa 100644 --- a/packages/cli/src/lib/mini-oxygen/node.ts +++ b/packages/cli/src/lib/mini-oxygen/node.ts @@ -10,7 +10,7 @@ import {DEFAULT_PORT} from '../flags.js'; import type {MiniOxygenInstance, MiniOxygenOptions} from './types.js'; import {logRequestLine} from './common.js'; -export async function startMiniOxygen({ +export async function startNodeServer({ root, port = DEFAULT_PORT, watch = false, diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index d08fd60ab3..c8047836a3 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -16,7 +16,7 @@ import {findPort} from '../find-port.js'; import type {MiniOxygenInstance, MiniOxygenOptions} from './types.js'; import {OXYGEN_HEADERS_MAP, logRequestLine} from './common.js'; -export async function startMiniOxygen({ +export async function startWorkerdServer({ root, port = DEFAULT_PORT, watch = false, @@ -108,7 +108,9 @@ export async function startMiniOxygen({ showBanner(options) { console.log(''); renderSuccess({ - headline: `${options?.headlinePrefix ?? ''}MiniOxygen ${ + headline: `${ + options?.headlinePrefix ?? '' + }MiniOxygen (native-unstable) ${ options?.mode ?? 'development' } server running.`, body: [ From d4e643b7c548957362d693fac67b169ab0212faf Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 17:47:39 +0900 Subject: [PATCH 23/38] Use Oxygen headers in Node --- packages/cli/src/lib/mini-oxygen/node.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/lib/mini-oxygen/node.ts b/packages/cli/src/lib/mini-oxygen/node.ts index bc4d0047fa..15042abdb5 100644 --- a/packages/cli/src/lib/mini-oxygen/node.ts +++ b/packages/cli/src/lib/mini-oxygen/node.ts @@ -8,7 +8,7 @@ import { } from '@shopify/mini-oxygen'; import {DEFAULT_PORT} from '../flags.js'; import type {MiniOxygenInstance, MiniOxygenOptions} from './types.js'; -import {logRequestLine} from './common.js'; +import {OXYGEN_HEADERS_MAP, logRequestLine} from './common.js'; export async function startNodeServer({ root, @@ -35,6 +35,11 @@ export async function startNodeServer({ }, envPath: !env && (await fileExists(dotenvPath)) ? dotenvPath : undefined, log: () => {}, + oxygenHeaders: Object.fromEntries( + Object.entries(OXYGEN_HEADERS_MAP).map(([key, value]) => { + return [key, value.defaultValue]; + }), + ), onRequest(request) { requestMap.set(request, {startTime: Date.now()}); }, From 24d22aa61647c229cd66a5b66b414850cbc74f86 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 20:14:42 +0900 Subject: [PATCH 24/38] Fix package-lock for turbo and ast-grep --- package-lock.json | 309 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 263 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0ab135751d..f027bb686c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -242,35 +242,6 @@ "node": ">=14" } }, - "node_modules/@ast-grep/napi": { - "version": "0.11.0", - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "optionalDependencies": { - "@ast-grep/napi-darwin-arm64": "0.11.0", - "@ast-grep/napi-darwin-x64": "0.11.0", - "@ast-grep/napi-linux-x64-gnu": "0.11.0", - "@ast-grep/napi-win32-arm64-msvc": "0.11.0", - "@ast-grep/napi-win32-ia32-msvc": "0.11.0", - "@ast-grep/napi-win32-x64-msvc": "0.11.0" - } - }, - "node_modules/@ast-grep/napi-darwin-arm64": { - "version": "0.11.0", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@babel/code-frame": { "version": "7.22.5", "license": "MIT", @@ -24169,9 +24140,10 @@ }, "node_modules/turbo": { "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo/-/turbo-1.10.12.tgz", + "integrity": "sha512-WM3+jTfQWnB9W208pmP4oeehZcC6JQNlydb/ZHMRrhmQa+htGhWLCzd6Q9rLe0MwZLPpSPFV2/bN5egCLyoKjQ==", "dev": true, "hasInstallScript": true, - "license": "MPL-2.0", "bin": { "turbo": "bin/turbo" }, @@ -24184,18 +24156,84 @@ "turbo-windows-arm64": "1.10.12" } }, + "node_modules/turbo-darwin-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-darwin-64/-/turbo-darwin-64-1.10.12.tgz", + "integrity": "sha512-vmDfGVPl5/aFenAbOj3eOx3ePNcWVUyZwYr7taRl0ZBbmv2TzjRiFotO4vrKCiTVnbqjQqAFQWY2ugbqCI1kOQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, "node_modules/turbo-darwin-arm64": { "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-darwin-arm64/-/turbo-darwin-arm64-1.10.12.tgz", + "integrity": "sha512-3JliEESLNX2s7g54SOBqqkqJ7UhcOGkS0ywMr5SNuvF6kWVTbuUq7uBU/sVbGq8RwvK1ONlhPvJne5MUqBCTCQ==", "cpu": [ "arm64" ], "dev": true, - "license": "MPL-2.0", "optional": true, "os": [ "darwin" ] }, + "node_modules/turbo-linux-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-linux-64/-/turbo-linux-64-1.10.12.tgz", + "integrity": "sha512-siYhgeX0DidIfHSgCR95b8xPee9enKSOjCzx7EjTLmPqPaCiVebRYvbOIYdQWRqiaKh9yfhUtFmtMOMScUf1gg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/turbo-linux-arm64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-linux-arm64/-/turbo-linux-arm64-1.10.12.tgz", + "integrity": "sha512-K/ZhvD9l4SslclaMkTiIrnfcACgos79YcAo4kwc8bnMQaKuUeRpM15sxLpZp3xDjDg8EY93vsKyjaOhdFG2UbA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/turbo-windows-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-windows-64/-/turbo-windows-64-1.10.12.tgz", + "integrity": "sha512-7FSgSwvktWDNOqV65l9AbZwcoueAILeE4L7JvjauNASAjjbuzXGCEq5uN8AQU3U5BOFj4TdXrVmO2dX+lLu8Zg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/turbo-windows-arm64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-windows-arm64/-/turbo-windows-arm64-1.10.12.tgz", + "integrity": "sha512-gCNXF52dwom1HLY9ry/cneBPOKTBHhzpqhMylcyvJP0vp9zeMQQkt6yjYv+6QdnmELC92CtKNp2FsNZo+z0pyw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/type-check": { "version": "0.4.0", "dev": true, @@ -25701,6 +25739,112 @@ "@shopify/remix-oxygen": "^1.1.3" } }, + "packages/cli/node_modules/@ast-grep/napi": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi/-/napi-0.11.0.tgz", + "integrity": "sha512-b+R8h20+ClsYZBJqcyguLy4THfGmg2a54HgfZ0a1vdCkfe9ftjblALiZf2DsOc0+Si8BDWd09TMNn2psUuibJA==", + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@ast-grep/napi-darwin-arm64": "0.11.0", + "@ast-grep/napi-darwin-x64": "0.11.0", + "@ast-grep/napi-linux-x64-gnu": "0.11.0", + "@ast-grep/napi-win32-arm64-msvc": "0.11.0", + "@ast-grep/napi-win32-ia32-msvc": "0.11.0", + "@ast-grep/napi-win32-x64-msvc": "0.11.0" + } + }, + "packages/cli/node_modules/@ast-grep/napi-darwin-arm64": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-darwin-arm64/-/napi-darwin-arm64-0.11.0.tgz", + "integrity": "sha512-IxY3b102tNNm+cYLngZvUKzM1fNKCpDDWz69Yt+QnKCZNx10Hvd7mqrYE2aXTtkaNalmg/p1n6kMA8KmshGgCA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "packages/cli/node_modules/@ast-grep/napi-darwin-x64": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-darwin-x64/-/napi-darwin-x64-0.11.0.tgz", + "integrity": "sha512-6afu1fNUwTkyE7tknVx8+d+BPKVL3623QLI9uJbJ0SZQShzSb1+dRegT4NpzPaPtFdPkflh6KfvOQ4chTw8hUg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "packages/cli/node_modules/@ast-grep/napi-linux-x64-gnu": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-linux-x64-gnu/-/napi-linux-x64-gnu-0.11.0.tgz", + "integrity": "sha512-Rm0biBfIxg14tL9yAMxW6RngAEA2vYLIq1guff6Uc9Vb7yQ3HE8dnW8WAysyieIqXdVkraTTV2ZwfoUqeKfc1Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "packages/cli/node_modules/@ast-grep/napi-win32-arm64-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-arm64-msvc/-/napi-win32-arm64-msvc-0.11.0.tgz", + "integrity": "sha512-TfX6KXxtXGQS/sWzJ1wWwWbpm3OJWpqiWGttpifSGs6DJmzfwuK0b63yX5JlhNXeUVqXkZyfYqIh5RPIPOtXSA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "packages/cli/node_modules/@ast-grep/napi-win32-ia32-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-ia32-msvc/-/napi-win32-ia32-msvc-0.11.0.tgz", + "integrity": "sha512-oQGbxYYfQn6LPbMKQ1T2cjQ+DelYDO06w/gFPmdWrE6M/YUIv+KfKdEscBkr3ehJyvXZW5h3vmxuApiMuCyfAQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "packages/cli/node_modules/@ast-grep/napi-win32-x64-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-x64-msvc/-/napi-win32-x64-msvc-0.11.0.tgz", + "integrity": "sha512-qrXI4+S8W7IF6e1nlDYX2KfdzxGHyAOj5kGvWk+TqBuAnA0rWQ513hJzdviiGpbB5VPnJkEhOVsDets8acKd6w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "packages/cli/node_modules/@oclif/core": { "version": "2.8.11", "license": "MIT", @@ -26434,21 +26578,6 @@ "node-fetch": "^2.6.1" } }, - "@ast-grep/napi": { - "version": "0.11.0", - "requires": { - "@ast-grep/napi-darwin-arm64": "0.11.0", - "@ast-grep/napi-darwin-x64": "0.11.0", - "@ast-grep/napi-linux-x64-gnu": "0.11.0", - "@ast-grep/napi-win32-arm64-msvc": "0.11.0", - "@ast-grep/napi-win32-ia32-msvc": "0.11.0", - "@ast-grep/napi-win32-x64-msvc": "0.11.0" - } - }, - "@ast-grep/napi-darwin-arm64": { - "version": "0.11.0", - "optional": true - }, "@babel/code-frame": { "version": "7.22.5", "requires": { @@ -30402,6 +30531,55 @@ "ws": "^8.13.0" }, "dependencies": { + "@ast-grep/napi": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi/-/napi-0.11.0.tgz", + "integrity": "sha512-b+R8h20+ClsYZBJqcyguLy4THfGmg2a54HgfZ0a1vdCkfe9ftjblALiZf2DsOc0+Si8BDWd09TMNn2psUuibJA==", + "requires": { + "@ast-grep/napi-darwin-arm64": "0.11.0", + "@ast-grep/napi-darwin-x64": "0.11.0", + "@ast-grep/napi-linux-x64-gnu": "0.11.0", + "@ast-grep/napi-win32-arm64-msvc": "0.11.0", + "@ast-grep/napi-win32-ia32-msvc": "0.11.0", + "@ast-grep/napi-win32-x64-msvc": "0.11.0" + } + }, + "@ast-grep/napi-darwin-arm64": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-darwin-arm64/-/napi-darwin-arm64-0.11.0.tgz", + "integrity": "sha512-IxY3b102tNNm+cYLngZvUKzM1fNKCpDDWz69Yt+QnKCZNx10Hvd7mqrYE2aXTtkaNalmg/p1n6kMA8KmshGgCA==", + "optional": true + }, + "@ast-grep/napi-darwin-x64": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-darwin-x64/-/napi-darwin-x64-0.11.0.tgz", + "integrity": "sha512-6afu1fNUwTkyE7tknVx8+d+BPKVL3623QLI9uJbJ0SZQShzSb1+dRegT4NpzPaPtFdPkflh6KfvOQ4chTw8hUg==", + "optional": true + }, + "@ast-grep/napi-linux-x64-gnu": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-linux-x64-gnu/-/napi-linux-x64-gnu-0.11.0.tgz", + "integrity": "sha512-Rm0biBfIxg14tL9yAMxW6RngAEA2vYLIq1guff6Uc9Vb7yQ3HE8dnW8WAysyieIqXdVkraTTV2ZwfoUqeKfc1Q==", + "optional": true + }, + "@ast-grep/napi-win32-arm64-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-arm64-msvc/-/napi-win32-arm64-msvc-0.11.0.tgz", + "integrity": "sha512-TfX6KXxtXGQS/sWzJ1wWwWbpm3OJWpqiWGttpifSGs6DJmzfwuK0b63yX5JlhNXeUVqXkZyfYqIh5RPIPOtXSA==", + "optional": true + }, + "@ast-grep/napi-win32-ia32-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-ia32-msvc/-/napi-win32-ia32-msvc-0.11.0.tgz", + "integrity": "sha512-oQGbxYYfQn6LPbMKQ1T2cjQ+DelYDO06w/gFPmdWrE6M/YUIv+KfKdEscBkr3ehJyvXZW5h3vmxuApiMuCyfAQ==", + "optional": true + }, + "@ast-grep/napi-win32-x64-msvc": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@ast-grep/napi-win32-x64-msvc/-/napi-win32-x64-msvc-0.11.0.tgz", + "integrity": "sha512-qrXI4+S8W7IF6e1nlDYX2KfdzxGHyAOj5kGvWk+TqBuAnA0rWQ513hJzdviiGpbB5VPnJkEhOVsDets8acKd6w==", + "optional": true + }, "@oclif/core": { "version": "2.8.11", "requires": { @@ -41707,6 +41885,8 @@ }, "turbo": { "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo/-/turbo-1.10.12.tgz", + "integrity": "sha512-WM3+jTfQWnB9W208pmP4oeehZcC6JQNlydb/ZHMRrhmQa+htGhWLCzd6Q9rLe0MwZLPpSPFV2/bN5egCLyoKjQ==", "dev": true, "requires": { "turbo-darwin-64": "1.10.12", @@ -41717,8 +41897,45 @@ "turbo-windows-arm64": "1.10.12" } }, + "turbo-darwin-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-darwin-64/-/turbo-darwin-64-1.10.12.tgz", + "integrity": "sha512-vmDfGVPl5/aFenAbOj3eOx3ePNcWVUyZwYr7taRl0ZBbmv2TzjRiFotO4vrKCiTVnbqjQqAFQWY2ugbqCI1kOQ==", + "dev": true, + "optional": true + }, "turbo-darwin-arm64": { "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-darwin-arm64/-/turbo-darwin-arm64-1.10.12.tgz", + "integrity": "sha512-3JliEESLNX2s7g54SOBqqkqJ7UhcOGkS0ywMr5SNuvF6kWVTbuUq7uBU/sVbGq8RwvK1ONlhPvJne5MUqBCTCQ==", + "dev": true, + "optional": true + }, + "turbo-linux-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-linux-64/-/turbo-linux-64-1.10.12.tgz", + "integrity": "sha512-siYhgeX0DidIfHSgCR95b8xPee9enKSOjCzx7EjTLmPqPaCiVebRYvbOIYdQWRqiaKh9yfhUtFmtMOMScUf1gg==", + "dev": true, + "optional": true + }, + "turbo-linux-arm64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-linux-arm64/-/turbo-linux-arm64-1.10.12.tgz", + "integrity": "sha512-K/ZhvD9l4SslclaMkTiIrnfcACgos79YcAo4kwc8bnMQaKuUeRpM15sxLpZp3xDjDg8EY93vsKyjaOhdFG2UbA==", + "dev": true, + "optional": true + }, + "turbo-windows-64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-windows-64/-/turbo-windows-64-1.10.12.tgz", + "integrity": "sha512-7FSgSwvktWDNOqV65l9AbZwcoueAILeE4L7JvjauNASAjjbuzXGCEq5uN8AQU3U5BOFj4TdXrVmO2dX+lLu8Zg==", + "dev": true, + "optional": true + }, + "turbo-windows-arm64": { + "version": "1.10.12", + "resolved": "https://registry.npmjs.org/turbo-windows-arm64/-/turbo-windows-arm64-1.10.12.tgz", + "integrity": "sha512-gCNXF52dwom1HLY9ry/cneBPOKTBHhzpqhMylcyvJP0vp9zeMQQkt6yjYv+6QdnmELC92CtKNp2FsNZo+z0pyw==", "dev": true, "optional": true }, From a00d1f51ce5ede497857047b369edb2c5d1e1d62 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 20:26:10 +0900 Subject: [PATCH 25/38] Fix package-lock for typescript --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index f027bb686c..4e634d41e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24288,9 +24288,9 @@ } }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -41970,9 +41970,9 @@ } }, "typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==" + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==" }, "typographic-apostrophes": { "version": "1.1.1" From 1d0075421f14c3f7796544b6f82364913a32ab02 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 20:31:00 +0900 Subject: [PATCH 26/38] Use mime lookup from cli-kit --- package-lock.json | 2 -- packages/cli/package.json | 1 - packages/cli/src/lib/mini-oxygen/workerd.ts | 13 ++++++------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e634d41e7..6595b5828d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25703,7 +25703,6 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "mime": "^3.0.0", "miniflare": "3.20230821.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", @@ -30518,7 +30517,6 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "mime": "^3.0.0", "miniflare": "3.20230821.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", diff --git a/packages/cli/package.json b/packages/cli/package.json index 7e2d5dfbd7..63cb257000 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -48,7 +48,6 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "mime": "^3.0.0", "miniflare": "3.20230821.0", "prettier": "^2.8.4", "recursive-readdir": "^2.2.3", diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index c8047836a3..03e2d7d393 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -1,15 +1,15 @@ -import {resolvePath, extname} from '@shopify/cli-kit/node/path'; -import {glob, readFile} from '@shopify/cli-kit/node/fs'; -import {renderSuccess} from '@shopify/cli-kit/node/ui'; -import mime from 'mime'; import { Miniflare, - type MiniflareOptions, Request, Response, fetch, NoOpLog, + type MiniflareOptions, } from 'miniflare'; +import {resolvePath} from '@shopify/cli-kit/node/path'; +import {glob, readFile} from '@shopify/cli-kit/node/fs'; +import {renderSuccess} from '@shopify/cli-kit/node/ui'; +import {lookupMimeType} from '@shopify/cli-kit/node/mimes'; import {connectToInspector, findInspectorUrl} from './workerd-inspector.js'; import {DEFAULT_PORT} from '../flags.js'; import {findPort} from '../find-port.js'; @@ -178,8 +178,7 @@ function createAssetHandler(buildPathClient: string) { const fileContent = await readFile(absoluteAssetPath); return new Response(fileContent, { headers: { - 'content-type': - mime.getType(extname(relativeAssetPath)) || 'text/plain', + 'content-type': lookupMimeType(relativeAssetPath) || 'text/plain', }, }); } catch (error) { From 8b6e88fda6219627678839bf04bc3047e679a401 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Mon, 28 Aug 2023 20:33:26 +0900 Subject: [PATCH 27/38] Extract oxygen headers logic --- packages/cli/src/lib/mini-oxygen/node.ts | 11 ++++++----- packages/cli/src/lib/mini-oxygen/workerd.ts | 15 ++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/cli/src/lib/mini-oxygen/node.ts b/packages/cli/src/lib/mini-oxygen/node.ts index 15042abdb5..566349175f 100644 --- a/packages/cli/src/lib/mini-oxygen/node.ts +++ b/packages/cli/src/lib/mini-oxygen/node.ts @@ -20,6 +20,11 @@ export async function startNodeServer({ }: MiniOxygenOptions): Promise { const dotenvPath = resolvePath(root, '.env'); const requestMap = new WeakMap(); + const oxygenHeaders = Object.fromEntries( + Object.entries(OXYGEN_HEADERS_MAP).map(([key, value]) => { + return [key, value.defaultValue]; + }), + ); const miniOxygen = await startServer({ script: await readFile(buildPathWorkerFile), @@ -35,11 +40,7 @@ export async function startNodeServer({ }, envPath: !env && (await fileExists(dotenvPath)) ? dotenvPath : undefined, log: () => {}, - oxygenHeaders: Object.fromEntries( - Object.entries(OXYGEN_HEADERS_MAP).map(([key, value]) => { - return [key, value.defaultValue]; - }), - ), + oxygenHeaders, onRequest(request) { requestMap.set(request, {startTime: Date.now()}); }, diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index 03e2d7d393..9b6b8c6cc5 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -25,6 +25,13 @@ export async function startWorkerdServer({ env, }: MiniOxygenOptions): Promise { const inspectorPort = await findPort(8787); + const oxygenHeadersMap = Object.values(OXYGEN_HEADERS_MAP).reduce( + (acc, item) => { + acc[item.name] = item.defaultValue; + return acc; + }, + {} as Record, + ); const buildMiniOxygenOptions = async () => ({ @@ -42,13 +49,7 @@ export async function startWorkerdServer({ script: `export default { fetch: ${miniOxygenHandler.toString()} }`, bindings: { initialAssets: await glob('**/*', {cwd: buildPathClient}), - oxygenHeadersMap: Object.values(OXYGEN_HEADERS_MAP).reduce( - (acc, item) => { - acc[item.name] = item.defaultValue; - return acc; - }, - {} as Record, - ), + oxygenHeadersMap, }, serviceBindings: { hydrogen: 'hydrogen', From fb23734f6b7cd1217e95c0c0656a7ff855cd12da Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Fri, 15 Sep 2023 12:16:28 +0900 Subject: [PATCH 28/38] Add notice about debug-network support --- packages/cli/src/lib/mini-oxygen/workerd.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index 9b6b8c6cc5..62e1e9cf33 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -141,6 +141,14 @@ async function miniOxygenHandler( ) { if (request.method === 'GET') { const pathname = new URL(request.url).pathname; + + if (pathname.startsWith('/debug-network')) { + // TODO implement /debug-network-server here + return new Response( + 'The Network Debugger is currently not supported in the Worker Runtime.', + ); + } + if (env.initialAssets.some((asset) => pathname === '/' + asset)) { const response = await env.assets.fetch(request.clone()); if (response.status !== 404) return response; From 509855e189cc573576178bf79dc11aec8d2d8e70 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Fri, 15 Sep 2023 12:20:56 +0900 Subject: [PATCH 29/38] Rename native-unstable flag to worker-unstable --- packages/cli/oclif.manifest.json | 12 ++++++------ packages/cli/src/commands/hydrogen/dev.ts | 10 +++++----- packages/cli/src/commands/hydrogen/preview.ts | 10 +++++----- packages/cli/src/lib/flags.ts | 6 +++--- packages/cli/src/lib/mini-oxygen/workerd.ts | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/cli/oclif.manifest.json b/packages/cli/oclif.manifest.json index 85bc848d1e..d2755e587a 100644 --- a/packages/cli/oclif.manifest.json +++ b/packages/cli/oclif.manifest.json @@ -213,10 +213,10 @@ "multiple": false, "default": 3000 }, - "native-unstable": { - "name": "native-unstable", + "worker-unstable": { + "name": "worker-unstable", "type": "boolean", - "description": "Run the app in a native environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.", + "description": "Run the app in a worker environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.", "allowNo": false }, "codegen-unstable": { @@ -476,10 +476,10 @@ "multiple": false, "default": 3000 }, - "native-unstable": { - "name": "native-unstable", + "worker-unstable": { + "name": "worker-unstable", "type": "boolean", - "description": "Run the app in a native environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.", + "description": "Run the app in a worker environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.", "allowNo": false } }, diff --git a/packages/cli/src/commands/hydrogen/dev.ts b/packages/cli/src/commands/hydrogen/dev.ts index 43b9016de4..584ffb14f0 100644 --- a/packages/cli/src/commands/hydrogen/dev.ts +++ b/packages/cli/src/commands/hydrogen/dev.ts @@ -39,7 +39,7 @@ export default class Dev extends Command { static flags = { path: commonFlags.path, port: commonFlags.port, - ['native-unstable']: commonFlags.native, + ['worker-unstable']: commonFlags.workerRuntime, ['codegen-unstable']: Flags.boolean({ description: 'Generate types for the Storefront API queries found in your project. It updates the types on file save.', @@ -70,7 +70,7 @@ export default class Dev extends Command { await runDev({ ...flagsToCamelObject(flags), useCodegen: flags['codegen-unstable'], - useNative: flags['native-unstable'], + workerRuntime: flags['worker-unstable'], path: directory, }); } @@ -80,7 +80,7 @@ async function runDev({ port: portFlag = DEFAULT_PORT, path: appPath, useCodegen = false, - useNative = false, + workerRuntime = false, codegenConfigPath, disableVirtualRoutes, envBranch, @@ -90,7 +90,7 @@ async function runDev({ port?: number; path?: string; useCodegen?: boolean; - useNative?: boolean; + workerRuntime?: boolean; codegenConfigPath?: string; disableVirtualRoutes?: boolean; envBranch?: string; @@ -170,7 +170,7 @@ async function runDev({ buildPathClient, env: await envPromise, }, - useNative, + workerRuntime, ); const graphiqlUrl = `${miniOxygen.listeningAt}/graphiql`; diff --git a/packages/cli/src/commands/hydrogen/preview.ts b/packages/cli/src/commands/hydrogen/preview.ts index 755a25c0a3..8197bae170 100644 --- a/packages/cli/src/commands/hydrogen/preview.ts +++ b/packages/cli/src/commands/hydrogen/preview.ts @@ -15,7 +15,7 @@ export default class Preview extends Command { static flags = { path: commonFlags.path, port: commonFlags.port, - ['native-unstable']: commonFlags.native, + ['worker-unstable']: commonFlags.workerRuntime, }; async run(): Promise { @@ -23,7 +23,7 @@ export default class Preview extends Command { await runPreview({ ...flagsToCamelObject(flags), - useNative: flags['native-unstable'], + workerRuntime: flags['worker-unstable'], }); } } @@ -31,11 +31,11 @@ export default class Preview extends Command { export async function runPreview({ port = DEFAULT_PORT, path: appPath, - useNative = false, + workerRuntime = false, }: { port?: number; path?: string; - useNative?: boolean; + workerRuntime?: boolean; }) { if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production'; @@ -50,7 +50,7 @@ export async function runPreview({ buildPathClient, buildPathWorkerFile, }, - useNative, + workerRuntime, ); miniOxygen.showBanner({mode: 'preview'}); diff --git a/packages/cli/src/lib/flags.ts b/packages/cli/src/lib/flags.ts index 9b706ebc9e..78420a0fbf 100644 --- a/packages/cli/src/lib/flags.ts +++ b/packages/cli/src/lib/flags.ts @@ -20,10 +20,10 @@ export const commonFlags = { env: 'SHOPIFY_HYDROGEN_FLAG_PORT', default: DEFAULT_PORT, }), - native: Flags.boolean({ + workerRuntime: Flags.boolean({ description: - 'Run the app in a native environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.', - env: 'SHOPIFY_HYDROGEN_FLAG_UNSTABLE_NATIVE', + 'Run the app in a worker environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.', + env: 'SHOPIFY_HYDROGEN_FLAG_WORKER_UNSTABLE', }), force: Flags.boolean({ description: diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index 62e1e9cf33..0196b5352f 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -111,7 +111,7 @@ export async function startWorkerdServer({ renderSuccess({ headline: `${ options?.headlinePrefix ?? '' - }MiniOxygen (native-unstable) ${ + }MiniOxygen (Unstable Worker Runtime) ${ options?.mode ?? 'development' } server running.`, body: [ From a82c09eee1f7dc85c8dddf1665329ea614d77548 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Fri, 15 Sep 2023 12:55:32 +0900 Subject: [PATCH 30/38] Filter out non-actionable warnings and errors --- packages/cli/src/lib/log.ts | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/lib/log.ts b/packages/cli/src/lib/log.ts index dec95606bc..40978c0a98 100644 --- a/packages/cli/src/lib/log.ts +++ b/packages/cli/src/lib/log.ts @@ -90,6 +90,7 @@ function injectLogReplacer( export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) { injectLogReplacer('log'); injectLogReplacer('error'); + injectLogReplacer('warn'); let isFirstWorkerReload = true; addMessageReplacers('dev-node', [ @@ -114,12 +115,32 @@ export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) { }, ]); - addMessageReplacers('dev-workerd', [ - // Workerd logs - ([first]) => - typeof first === 'string' && /^\x1B\[31m(workerd\/|stack:)/.test(first), - () => {}, - ]); + addMessageReplacers( + 'dev-workerd', + [ + // Workerd logs + ([first]) => + typeof first === 'string' && /^\x1B\[31m(workerd\/|stack:)/.test(first), + () => {}, + ], + + // Non-actionable warnings/errors: + [ + ([first]) => + typeof first === 'string' && /^A promise rejection/i.test(first), + () => {}, + ], + [ + ([first]) => { + const message = first?.message ?? first; + return ( + typeof message === 'string' && + /^Network connection lost/i.test(message) + ); + }, + () => {}, + ], + ); } const originalWrite = process.stdout.write; From 922ece1d4426197119d211bceccc48223b6c65d8 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 19 Sep 2023 16:34:28 +0900 Subject: [PATCH 31/38] Stream files --- packages/cli/src/lib/mini-oxygen/workerd.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index 0196b5352f..67870b10cb 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -7,7 +7,12 @@ import { type MiniflareOptions, } from 'miniflare'; import {resolvePath} from '@shopify/cli-kit/node/path'; -import {glob, readFile} from '@shopify/cli-kit/node/fs'; +import { + glob, + readFile, + fileSize, + createFileReadStream, +} from '@shopify/cli-kit/node/fs'; import {renderSuccess} from '@shopify/cli-kit/node/ui'; import {lookupMimeType} from '@shopify/cli-kit/node/mimes'; import {connectToInspector, findInspectorUrl} from './workerd-inspector.js'; @@ -184,10 +189,11 @@ function createAssetHandler(buildPathClient: string) { buildPathClient, relativeAssetPath, ); - const fileContent = await readFile(absoluteAssetPath); - return new Response(fileContent, { + + return new Response(createFileReadStream(absoluteAssetPath), { headers: { - 'content-type': lookupMimeType(relativeAssetPath) || 'text/plain', + 'Content-Type': lookupMimeType(relativeAssetPath) || 'text/plain', + 'Content-Length': String(await fileSize(absoluteAssetPath)), }, }); } catch (error) { From 9d4b48370c23c2b4e92db5e10243350337a4ffb3 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 19 Sep 2023 16:48:08 +0900 Subject: [PATCH 32/38] Load remote env vars in preview command --- .changeset/nervous-weeks-tap.md | 5 +++++ packages/cli/oclif.manifest.json | 7 +++++++ packages/cli/src/commands/hydrogen/preview.ts | 9 +++++++++ packages/cli/src/lib/mini-oxygen/node.ts | 3 +-- packages/cli/src/lib/mini-oxygen/types.ts | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .changeset/nervous-weeks-tap.md diff --git a/.changeset/nervous-weeks-tap.md b/.changeset/nervous-weeks-tap.md new file mode 100644 index 0000000000..ef05e44ff6 --- /dev/null +++ b/.changeset/nervous-weeks-tap.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli-hydrogen': patch +--- + +Adjust behavior of `h2 preview` command around environment variables to be more consistent with `h2 dev` command. diff --git a/packages/cli/oclif.manifest.json b/packages/cli/oclif.manifest.json index d2755e587a..7990bcf3de 100644 --- a/packages/cli/oclif.manifest.json +++ b/packages/cli/oclif.manifest.json @@ -481,6 +481,13 @@ "type": "boolean", "description": "Run the app in a worker environment closer to Oxygen production instead of a Node.js sandbox. This flag is unstable and may change without notice.", "allowNo": false + }, + "env-branch": { + "name": "env-branch", + "type": "option", + "char": "e", + "description": "Specify an environment's branch name when using remote environment variables.", + "multiple": false } }, "args": {} diff --git a/packages/cli/src/commands/hydrogen/preview.ts b/packages/cli/src/commands/hydrogen/preview.ts index 8197bae170..491ad17371 100644 --- a/packages/cli/src/commands/hydrogen/preview.ts +++ b/packages/cli/src/commands/hydrogen/preview.ts @@ -7,6 +7,8 @@ import { DEFAULT_PORT, } from '../../lib/flags.js'; import {startMiniOxygen} from '../../lib/mini-oxygen/index.js'; +import {getAllEnvironmentVariables} from '../../lib/environment-variables.js'; +import {getConfig} from '../../lib/shopify-config.js'; export default class Preview extends Command { static description = @@ -16,6 +18,7 @@ export default class Preview extends Command { path: commonFlags.path, port: commonFlags.port, ['worker-unstable']: commonFlags.workerRuntime, + ['env-branch']: commonFlags.envBranch, }; async run(): Promise { @@ -32,16 +35,21 @@ export async function runPreview({ port = DEFAULT_PORT, path: appPath, workerRuntime = false, + envBranch, }: { port?: number; path?: string; workerRuntime?: boolean; + envBranch?: string; }) { if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production'; muteDevLogs({workerReload: false}); const {root, buildPathWorkerFile, buildPathClient} = getProjectPaths(appPath); + const {shop, storefront} = await getConfig(root); + const fetchRemote = !!shop && !!storefront?.id; + const env = await getAllEnvironmentVariables({root, fetchRemote, envBranch}); const miniOxygen = await startMiniOxygen( { @@ -49,6 +57,7 @@ export async function runPreview({ port, buildPathClient, buildPathWorkerFile, + env, }, workerRuntime, ); diff --git a/packages/cli/src/lib/mini-oxygen/node.ts b/packages/cli/src/lib/mini-oxygen/node.ts index 681bc04b36..29f16db5c6 100644 --- a/packages/cli/src/lib/mini-oxygen/node.ts +++ b/packages/cli/src/lib/mini-oxygen/node.ts @@ -1,7 +1,7 @@ import {randomUUID} from 'node:crypto'; import {AsyncLocalStorage} from 'node:async_hooks'; import {resolvePath} from '@shopify/cli-kit/node/path'; -import {fileExists, readFile} from '@shopify/cli-kit/node/fs'; +import {readFile} from '@shopify/cli-kit/node/fs'; import {renderSuccess} from '@shopify/cli-kit/node/ui'; import { startServer, @@ -62,7 +62,6 @@ export async function startNodeServer({ ...process.env, ...serviceBindings, }, - envPath: !env && (await fileExists(dotenvPath)) ? dotenvPath : undefined, log: () => {}, oxygenHeaders, async onRequest(request, defaultDispatcher) { diff --git a/packages/cli/src/lib/mini-oxygen/types.ts b/packages/cli/src/lib/mini-oxygen/types.ts index 064ede75e5..91aa3abdd9 100644 --- a/packages/cli/src/lib/mini-oxygen/types.ts +++ b/packages/cli/src/lib/mini-oxygen/types.ts @@ -5,7 +5,7 @@ export type MiniOxygenOptions = { autoReload?: boolean; buildPathClient: string; buildPathWorkerFile: string; - env?: {[key: string]: string}; + env: {[key: string]: string}; }; export type MiniOxygenInstance = { From ab40e00aaf1d8438a5feef8e8360154abb1e5ef7 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 19 Sep 2023 17:05:27 +0900 Subject: [PATCH 33/38] Avoid cloning requests --- packages/cli/src/lib/mini-oxygen/workerd.ts | 27 ++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index 67870b10cb..b40446f59e 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -155,13 +155,17 @@ async function miniOxygenHandler( } if (env.initialAssets.some((asset) => pathname === '/' + asset)) { - const response = await env.assets.fetch(request.clone()); + const response = await env.assets.fetch( + new Request(request.url, { + signal: request.signal, + headers: request.headers, + }), + ); + if (response.status !== 404) return response; } } - // Clone before using body (in POST requests) - const loggerRequest = new Request(request.clone()); const requestInit = { headers: { ...env.oxygenHeadersMap, @@ -173,9 +177,20 @@ async function miniOxygenHandler( const response = await env.hydrogen.fetch(request, requestInit); const durationMs = Date.now() - startTimeMs; - loggerRequest.headers.set('h2-duration-ms', String(durationMs)); - loggerRequest.headers.set('h2-response-status', String(response.status)); - context.waitUntil(env.logRequest.fetch(loggerRequest)); + // Log the request summary to the terminal + context.waitUntil( + env.logRequest.fetch( + new Request(request.url, { + method: request.method, + signal: request.signal, + headers: { + ...Object.fromEntries(request.headers.entries()), + 'h2-duration-ms': String(durationMs), + 'h2-response-status': String(response.status), + }, + }), + ), + ); return response; } From e5120cc73ec5ed8ebbc17e14e4dffbf23ad96cad Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 19 Sep 2023 17:13:15 +0900 Subject: [PATCH 34/38] Use sets to find asset matches --- packages/cli/src/lib/mini-oxygen/workerd.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/lib/mini-oxygen/workerd.ts b/packages/cli/src/lib/mini-oxygen/workerd.ts index b40446f59e..58042394b8 100644 --- a/packages/cli/src/lib/mini-oxygen/workerd.ts +++ b/packages/cli/src/lib/mini-oxygen/workerd.ts @@ -154,7 +154,7 @@ async function miniOxygenHandler( ); } - if (env.initialAssets.some((asset) => pathname === '/' + asset)) { + if (new Set(env.initialAssets).has(pathname.slice(1))) { const response = await env.assets.fetch( new Request(request.url, { signal: request.signal, From 2d6d64f183dfb716a57da806052c60bd6ea56519 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 19 Sep 2023 17:41:49 +0900 Subject: [PATCH 35/38] Update Miniflare version --- package-lock.json | 211 ++++++++++++++++++++++++++++++++------ packages/cli/package.json | 2 +- 2 files changed, 178 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index 01739a51a7..acfc0e546c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3296,12 +3296,28 @@ "node": ">= 4.0.0" } }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230904.0.tgz", + "integrity": "sha512-/GDlmxAFbDtrQwP4zOXFbqOfaPvkDxdsCoEa+KEBcAl5uR98+7WW5/b8naBHX+t26uS7p4bLlImM8J5F1ienRQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20230821.0", + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20230904.0.tgz", + "integrity": "sha512-x8WXNc2xnDqr5y1iirnNdyx8GZY3rL5xiF7ebK3mKQeB+jFjkhO71yuPTkDCzUWtOvw1Wfd4jbwy4wxacMX4mQ==", "cpu": [ "arm64" ], - "license": "Apache-2.0", "optional": true, "os": [ "darwin" @@ -3310,6 +3326,51 @@ "node": ">=16" } }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20230904.0.tgz", + "integrity": "sha512-V58xyMS3oDpKO8Dpdh0r0BXm99OzoGgvWe9ufttVraj/1NTMGELwb6i9ySb8k3F1J9m/sO26+TV7pQc/bGC1VQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20230904.0.tgz", + "integrity": "sha512-VrDaW+pjb5IAKEnNWtEaFiG377kXKmk5Fu0Era4W+jKzPON2BW/qRb/4LNHXQ4yxg/2HLm7RiUTn7JZtt1qO6A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20230904.0.tgz", + "integrity": "sha512-/R/dE8uy+8J2YeXfDhI8/Bg7YUirdbbjH5/l/Vv00ZRE0lC3nPLcYeyBXSwXIQ6/Xht3gN+lksLQgKd0ZWRd+Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "license": "MIT", @@ -3977,6 +4038,7 @@ }, "node_modules/@gar/promisify": { "version": "1.1.3", + "devOptional": true, "license": "MIT" }, "node_modules/@google/model-viewer": { @@ -5518,6 +5580,7 @@ }, "node_modules/@npmcli/fs": { "version": "1.1.1", + "devOptional": true, "license": "ISC", "dependencies": { "@gar/promisify": "^1.0.1", @@ -5526,6 +5589,7 @@ }, "node_modules/@npmcli/move-file": { "version": "1.1.2", + "devOptional": true, "license": "MIT", "dependencies": { "mkdirp": "^1.0.4", @@ -5537,6 +5601,7 @@ }, "node_modules/@npmcli/package-json": { "version": "2.0.0", + "devOptional": true, "license": "ISC", "dependencies": { "json-parse-even-better-errors": "^2.3.1" @@ -8793,6 +8858,7 @@ }, "node_modules/abbrev": { "version": "1.1.1", + "dev": true, "license": "ISC" }, "node_modules/abort-controller": { @@ -9858,6 +9924,7 @@ }, "node_modules/cacache": { "version": "15.3.0", + "devOptional": true, "license": "ISC", "dependencies": { "@npmcli/fs": "^1.0.0", @@ -10229,6 +10296,7 @@ }, "node_modules/chownr": { "version": "2.0.0", + "devOptional": true, "license": "ISC", "engines": { "node": ">=10" @@ -10236,6 +10304,7 @@ }, "node_modules/ci-info": { "version": "1.6.0", + "dev": true, "license": "MIT" }, "node_modules/classnames": { @@ -13726,6 +13795,7 @@ }, "node_modules/fs-minipass": { "version": "2.1.0", + "devOptional": true, "license": "ISC", "dependencies": { "minipass": "^3.0.0" @@ -14684,6 +14754,7 @@ }, "node_modules/hosted-git-info": { "version": "2.8.9", + "dev": true, "license": "ISC" }, "node_modules/html-escaper": { @@ -14940,6 +15011,7 @@ }, "node_modules/imurmurhash": { "version": "0.1.4", + "devOptional": true, "license": "MIT", "engines": { "node": ">=0.8.19" @@ -14954,6 +15026,7 @@ }, "node_modules/infer-owner": { "version": "1.0.4", + "devOptional": true, "license": "ISC" }, "node_modules/inflight": { @@ -18473,8 +18546,9 @@ } }, "node_modules/miniflare": { - "version": "3.20230821.0", - "license": "MIT", + "version": "3.20230904.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230904.0.tgz", + "integrity": "sha512-+OWQqEk8hV7vZaPCoj5dk1lZr4YUy56OiyNZ45/3ITYf+ZxgQOBPWhQhpw1jCahkRKGPa9Aykz01sc+GhPZYDA==", "dependencies": { "acorn": "^8.8.0", "acorn-walk": "^8.2.0", @@ -18487,7 +18561,7 @@ "source-map-support": "0.5.21", "stoppable": "^1.1.0", "undici": "^5.22.1", - "workerd": "1.20230821.0", + "workerd": "1.20230904.0", "ws": "^8.11.0", "youch": "^3.2.2", "zod": "^3.20.6" @@ -18552,6 +18626,7 @@ }, "node_modules/minipass": { "version": "3.3.4", + "devOptional": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -18562,6 +18637,7 @@ }, "node_modules/minipass-collect": { "version": "1.0.2", + "devOptional": true, "license": "ISC", "dependencies": { "minipass": "^3.0.0" @@ -18572,6 +18648,7 @@ }, "node_modules/minipass-flush": { "version": "1.0.5", + "devOptional": true, "license": "ISC", "dependencies": { "minipass": "^3.0.0" @@ -18582,6 +18659,7 @@ }, "node_modules/minipass-pipeline": { "version": "1.2.4", + "devOptional": true, "license": "ISC", "dependencies": { "minipass": "^3.0.0" @@ -18592,6 +18670,7 @@ }, "node_modules/minizlib": { "version": "2.1.2", + "devOptional": true, "license": "MIT", "dependencies": { "minipass": "^3.0.0", @@ -18611,6 +18690,7 @@ }, "node_modules/mkdirp": { "version": "1.0.4", + "devOptional": true, "license": "MIT", "bin": { "mkdirp": "bin/cmd.js" @@ -18943,6 +19023,7 @@ }, "node_modules/nopt": { "version": "1.0.10", + "dev": true, "license": "MIT", "dependencies": { "abbrev": "1" @@ -24031,6 +24112,7 @@ }, "node_modules/promise-inflight": { "version": "1.0.1", + "devOptional": true, "license": "ISC" }, "node_modules/prop-types": { @@ -26089,6 +26171,7 @@ }, "node_modules/ssri": { "version": "8.0.1", + "devOptional": true, "license": "ISC", "dependencies": { "minipass": "^3.1.1" @@ -26697,6 +26780,7 @@ }, "node_modules/tar": { "version": "6.1.11", + "devOptional": true, "license": "ISC", "dependencies": { "chownr": "^2.0.0", @@ -26837,6 +26921,7 @@ }, "node_modules/text-table": { "version": "0.2.0", + "dev": true, "license": "MIT" }, "node_modules/textr": { @@ -27775,6 +27860,7 @@ }, "node_modules/unique-filename": { "version": "1.1.1", + "devOptional": true, "license": "ISC", "dependencies": { "unique-slug": "^2.0.0" @@ -27782,6 +27868,7 @@ }, "node_modules/unique-slug": { "version": "2.0.2", + "devOptional": true, "license": "ISC", "dependencies": { "imurmurhash": "^0.1.4" @@ -28609,9 +28696,10 @@ "license": "MIT" }, "node_modules/workerd": { - "version": "1.20230821.0", + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230904.0.tgz", + "integrity": "sha512-t9znszH0rQGK4mJGvF9L3nN0qKEaObAGx0JkywFtAwH8OkSn+YfQbHNZE+YsJ4qa1hOz1DCNEk08UDFRBaYq4g==", "hasInstallScript": true, - "license": "Apache-2.0", "bin": { "workerd": "bin/workerd" }, @@ -28619,11 +28707,11 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20230821.0", - "@cloudflare/workerd-darwin-arm64": "1.20230821.0", - "@cloudflare/workerd-linux-64": "1.20230821.0", - "@cloudflare/workerd-linux-arm64": "1.20230821.0", - "@cloudflare/workerd-windows-64": "1.20230821.0" + "@cloudflare/workerd-darwin-64": "1.20230904.0", + "@cloudflare/workerd-darwin-arm64": "1.20230904.0", + "@cloudflare/workerd-linux-64": "1.20230904.0", + "@cloudflare/workerd-linux-arm64": "1.20230904.0", + "@cloudflare/workerd-windows-64": "1.20230904.0" } }, "node_modules/worktop": { @@ -29043,7 +29131,7 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "miniflare": "3.20230821.0", + "miniflare": "3.20230904.0", "prettier": "^2.8.4", "source-map": "^0.7.4", "stack-trace": "^1.0.0-pre2", @@ -31802,8 +31890,34 @@ } } }, + "@cloudflare/workerd-darwin-64": { + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20230904.0.tgz", + "integrity": "sha512-/GDlmxAFbDtrQwP4zOXFbqOfaPvkDxdsCoEa+KEBcAl5uR98+7WW5/b8naBHX+t26uS7p4bLlImM8J5F1ienRQ==", + "optional": true + }, "@cloudflare/workerd-darwin-arm64": { - "version": "1.20230821.0", + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20230904.0.tgz", + "integrity": "sha512-x8WXNc2xnDqr5y1iirnNdyx8GZY3rL5xiF7ebK3mKQeB+jFjkhO71yuPTkDCzUWtOvw1Wfd4jbwy4wxacMX4mQ==", + "optional": true + }, + "@cloudflare/workerd-linux-64": { + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20230904.0.tgz", + "integrity": "sha512-V58xyMS3oDpKO8Dpdh0r0BXm99OzoGgvWe9ufttVraj/1NTMGELwb6i9ySb8k3F1J9m/sO26+TV7pQc/bGC1VQ==", + "optional": true + }, + "@cloudflare/workerd-linux-arm64": { + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20230904.0.tgz", + "integrity": "sha512-VrDaW+pjb5IAKEnNWtEaFiG377kXKmk5Fu0Era4W+jKzPON2BW/qRb/4LNHXQ4yxg/2HLm7RiUTn7JZtt1qO6A==", + "optional": true + }, + "@cloudflare/workerd-windows-64": { + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20230904.0.tgz", + "integrity": "sha512-/R/dE8uy+8J2YeXfDhI8/Bg7YUirdbbjH5/l/Vv00ZRE0lC3nPLcYeyBXSwXIQ6/Xht3gN+lksLQgKd0ZWRd+Q==", "optional": true }, "@cspotcode/source-map-support": { @@ -32097,7 +32211,8 @@ "dev": true }, "@gar/promisify": { - "version": "1.1.3" + "version": "1.1.3", + "devOptional": true }, "@google/model-viewer": { "version": "1.12.1", @@ -33209,6 +33324,7 @@ }, "@npmcli/fs": { "version": "1.1.1", + "devOptional": true, "requires": { "@gar/promisify": "^1.0.1", "semver": "^7.3.5" @@ -33216,6 +33332,7 @@ }, "@npmcli/move-file": { "version": "1.1.2", + "devOptional": true, "requires": { "mkdirp": "^1.0.4", "rimraf": "^3.0.2" @@ -33223,6 +33340,7 @@ }, "@npmcli/package-json": { "version": "2.0.0", + "devOptional": true, "requires": { "json-parse-even-better-errors": "^2.3.1" } @@ -33883,7 +34001,7 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "miniflare": "3.20230821.0", + "miniflare": "3.20230904.0", "prettier": "^2.8.4", "source-map": "^0.7.4", "stack-trace": "^1.0.0-pre2", @@ -35776,7 +35894,8 @@ "optional": true }, "abbrev": { - "version": "1.1.1" + "version": "1.1.1", + "dev": true }, "abort-controller": { "version": "3.0.0", @@ -36447,6 +36566,7 @@ }, "cacache": { "version": "15.3.0", + "devOptional": true, "requires": { "@npmcli/fs": "^1.0.0", "@npmcli/move-file": "^1.0.1", @@ -36692,10 +36812,12 @@ } }, "chownr": { - "version": "2.0.0" + "version": "2.0.0", + "devOptional": true }, "ci-info": { - "version": "1.6.0" + "version": "1.6.0", + "dev": true }, "classnames": { "version": "2.3.2", @@ -38956,6 +39078,7 @@ }, "fs-minipass": { "version": "2.1.0", + "devOptional": true, "requires": { "minipass": "^3.0.0" } @@ -39612,7 +39735,8 @@ } }, "hosted-git-info": { - "version": "2.8.9" + "version": "2.8.9", + "dev": true }, "html-escaper": { "version": "2.0.2", @@ -39791,13 +39915,15 @@ "version": "4.0.0" }, "imurmurhash": { - "version": "0.1.4" + "version": "0.1.4", + "devOptional": true }, "indent-string": { "version": "4.0.0" }, "infer-owner": { - "version": "1.0.4" + "version": "1.0.4", + "devOptional": true }, "inflight": { "version": "1.0.6", @@ -41933,7 +42059,9 @@ "dev": true }, "miniflare": { - "version": "3.20230821.0", + "version": "3.20230904.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230904.0.tgz", + "integrity": "sha512-+OWQqEk8hV7vZaPCoj5dk1lZr4YUy56OiyNZ45/3ITYf+ZxgQOBPWhQhpw1jCahkRKGPa9Aykz01sc+GhPZYDA==", "requires": { "acorn": "^8.8.0", "acorn-walk": "^8.2.0", @@ -41946,7 +42074,7 @@ "source-map-support": "0.5.21", "stoppable": "^1.1.0", "undici": "^5.22.1", - "workerd": "1.20230821.0", + "workerd": "1.20230904.0", "ws": "^8.11.0", "youch": "^3.2.2", "zod": "^3.20.6" @@ -41984,30 +42112,35 @@ }, "minipass": { "version": "3.3.4", + "devOptional": true, "requires": { "yallist": "^4.0.0" } }, "minipass-collect": { "version": "1.0.2", + "devOptional": true, "requires": { "minipass": "^3.0.0" } }, "minipass-flush": { "version": "1.0.5", + "devOptional": true, "requires": { "minipass": "^3.0.0" } }, "minipass-pipeline": { "version": "1.2.4", + "devOptional": true, "requires": { "minipass": "^3.0.0" } }, "minizlib": { "version": "2.1.2", + "devOptional": true, "requires": { "minipass": "^3.0.0", "yallist": "^4.0.0" @@ -42018,7 +42151,8 @@ "dev": true }, "mkdirp": { - "version": "1.0.4" + "version": "1.0.4", + "devOptional": true }, "mkdirp-classic": { "version": "0.5.3" @@ -42222,6 +42356,7 @@ }, "nopt": { "version": "1.0.10", + "dev": true, "requires": { "abbrev": "1" } @@ -45360,7 +45495,8 @@ } }, "promise-inflight": { - "version": "1.0.1" + "version": "1.0.1", + "devOptional": true }, "prop-types": { "version": "15.8.1", @@ -46736,6 +46872,7 @@ }, "ssri": { "version": "8.0.1", + "devOptional": true, "requires": { "minipass": "^3.1.1" } @@ -47123,6 +47260,7 @@ }, "tar": { "version": "6.1.11", + "devOptional": true, "requires": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -47218,7 +47356,8 @@ } }, "text-table": { - "version": "0.2.0" + "version": "0.2.0", + "dev": true }, "textr": { "version": "0.3.0" @@ -47798,12 +47937,14 @@ }, "unique-filename": { "version": "1.1.1", + "devOptional": true, "requires": { "unique-slug": "^2.0.0" } }, "unique-slug": { "version": "2.0.2", + "devOptional": true, "requires": { "imurmurhash": "^0.1.4" } @@ -48285,13 +48426,15 @@ "version": "1.0.0" }, "workerd": { - "version": "1.20230821.0", - "requires": { - "@cloudflare/workerd-darwin-64": "1.20230821.0", - "@cloudflare/workerd-darwin-arm64": "1.20230821.0", - "@cloudflare/workerd-linux-64": "1.20230821.0", - "@cloudflare/workerd-linux-arm64": "1.20230821.0", - "@cloudflare/workerd-windows-64": "1.20230821.0" + "version": "1.20230904.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20230904.0.tgz", + "integrity": "sha512-t9znszH0rQGK4mJGvF9L3nN0qKEaObAGx0JkywFtAwH8OkSn+YfQbHNZE+YsJ4qa1hOz1DCNEk08UDFRBaYq4g==", + "requires": { + "@cloudflare/workerd-darwin-64": "1.20230904.0", + "@cloudflare/workerd-darwin-arm64": "1.20230904.0", + "@cloudflare/workerd-linux-64": "1.20230904.0", + "@cloudflare/workerd-linux-arm64": "1.20230904.0", + "@cloudflare/workerd-windows-64": "1.20230904.0" } }, "worktop": { diff --git a/packages/cli/package.json b/packages/cli/package.json index 1225c7addd..8be9f8b74b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -44,7 +44,7 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "miniflare": "3.20230821.0", + "miniflare": "3.20230904.0", "prettier": "^2.8.4", "source-map": "^0.7.4", "stack-trace": "^1.0.0-pre2", From 5fffcdb5bcd525e7a4a2db980d9d05a99bbc3853 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 19 Sep 2023 17:50:09 +0900 Subject: [PATCH 36/38] Changesets --- .changeset/silver-bikes-reply.md | 5 +++++ .changeset/warm-terms-try.md | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changeset/silver-bikes-reply.md create mode 100644 .changeset/warm-terms-try.md diff --git a/.changeset/silver-bikes-reply.md b/.changeset/silver-bikes-reply.md new file mode 100644 index 0000000000..bec4d31b01 --- /dev/null +++ b/.changeset/silver-bikes-reply.md @@ -0,0 +1,5 @@ +--- +'@shopify/hydrogen': patch +--- + +The `error.cause` property throw from the Storefront client is now stringified. diff --git a/.changeset/warm-terms-try.md b/.changeset/warm-terms-try.md new file mode 100644 index 0000000000..7beaec74ec --- /dev/null +++ b/.changeset/warm-terms-try.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli-hydrogen': minor +--- + +Add `--worker-unstable` flag to `h2 dev` and `h2 preview` commands. This flag enables the use of the new experimental worker runtime for local development, which is closer to Oxygen production than the current Node.js sandbox. Please report any issues you encounter with this flag. From 288a97703334d5090ca9571808c63a62d926edb2 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 19 Sep 2023 17:50:44 +0900 Subject: [PATCH 37/38] Hide the unsupported debug-network line for worker runtime --- packages/cli/src/commands/hydrogen/dev.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/hydrogen/dev.ts b/packages/cli/src/commands/hydrogen/dev.ts index 584ffb14f0..a0aec05313 100644 --- a/packages/cli/src/commands/hydrogen/dev.ts +++ b/packages/cli/src/commands/hydrogen/dev.ts @@ -185,8 +185,12 @@ async function runDev({ : '', extraLines: [ colors.dim(`\nView GraphiQL API browser: ${graphiqlUrl}`), - colors.dim(`\nView server-side network requests: ${debugNetworkUrl}`), - ], + workerRuntime + ? '' + : colors.dim( + `\nView server-side network requests: ${debugNetworkUrl}`, + ), + ].filter(Boolean), }); if (useCodegen) { From 828a5c17bf1191ed90d90f220b48128121a0cd06 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Wed, 20 Sep 2023 09:37:08 +0900 Subject: [PATCH 38/38] Update Miniflare version to drop subdependencies --- package-lock.json | 218 ++------------------------------------ packages/cli/package.json | 2 +- 2 files changed, 9 insertions(+), 211 deletions(-) diff --git a/package-lock.json b/package-lock.json index acfc0e546c..c57dc38a06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9523,15 +9523,6 @@ "node": ">=4" } }, - "node_modules/better-sqlite3": { - "version": "8.5.0", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "bindings": "^1.5.0", - "prebuild-install": "^7.1.0" - } - }, "node_modules/big-integer": { "version": "1.6.51", "dev": true, @@ -9556,13 +9547,6 @@ "node": ">=8" } }, - "node_modules/bindings": { - "version": "1.5.0", - "license": "MIT", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bl": { "version": "4.1.0", "license": "MIT", @@ -11693,13 +11677,6 @@ "node": ">=8" } }, - "node_modules/detect-libc": { - "version": "2.0.2", - "license": "Apache-2.0", - "engines": { - "node": ">=8" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "devOptional": true, @@ -13243,13 +13220,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/expand-template": { - "version": "2.0.3", - "license": "(MIT OR WTFPL)", - "engines": { - "node": ">=6" - } - }, "node_modules/expect": { "version": "29.4.3", "dev": true, @@ -13542,10 +13512,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "license": "MIT" - }, "node_modules/filelist": { "version": "1.0.4", "license": "Apache-2.0", @@ -14179,10 +14145,6 @@ "url": "https://github.com/fisker/git-hooks-list?sponsor=1" } }, - "node_modules/github-from-package": { - "version": "0.0.0", - "license": "MIT" - }, "node_modules/glob": { "version": "7.2.3", "license": "ISC", @@ -18546,18 +18508,15 @@ } }, "node_modules/miniflare": { - "version": "3.20230904.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230904.0.tgz", - "integrity": "sha512-+OWQqEk8hV7vZaPCoj5dk1lZr4YUy56OiyNZ45/3ITYf+ZxgQOBPWhQhpw1jCahkRKGPa9Aykz01sc+GhPZYDA==", + "version": "3.20230918.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230918.0.tgz", + "integrity": "sha512-Dd29HB7ZlT1CXB2tPH8nW6fBOOXi/m7qFZHjKm2jGS+1OaGfrv0PkT5UspWW5jQi8rWI87xtordAUiIJkwWqRw==", "dependencies": { "acorn": "^8.8.0", "acorn-walk": "^8.2.0", - "better-sqlite3": "^8.1.0", "capnp-ts": "^0.7.0", "exit-hook": "^2.2.1", "glob-to-regexp": "^0.4.1", - "http-cache-semantics": "^4.1.0", - "kleur": "^4.1.5", "source-map-support": "0.5.21", "stoppable": "^1.1.0", "undici": "^5.22.1", @@ -18833,10 +18792,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/napi-build-utils": { - "version": "1.0.2", - "license": "MIT" - }, "node_modules/natural-compare": { "version": "1.4.0", "dev": true, @@ -18890,16 +18845,6 @@ "version": "2.4.0", "license": "0BSD" }, - "node_modules/node-abi": { - "version": "3.47.0", - "license": "MIT", - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/node-abort-controller": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", @@ -23971,38 +23916,6 @@ "devOptional": true, "license": "MIT" }, - "node_modules/prebuild-install": { - "version": "7.1.1", - "license": "MIT", - "dependencies": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/prebuild-install/node_modules/pump": { - "version": "3.0.0", - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/preferred-pm": { "version": "3.0.3", "dev": true, @@ -25657,47 +25570,6 @@ "version": "1.0.0", "license": "BSD-3-Clause" }, - "node_modules/simple-concat": { - "version": "1.0.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/simple-get": { - "version": "4.0.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "node_modules/simple-git": { "version": "3.19.1", "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.19.1.tgz", @@ -29131,7 +29003,7 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "miniflare": "3.20230904.0", + "miniflare": "3.20230918.0", "prettier": "^2.8.4", "source-map": "^0.7.4", "stack-trace": "^1.0.0-pre2", @@ -34001,7 +33873,7 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "miniflare": "3.20230904.0", + "miniflare": "3.20230918.0", "prettier": "^2.8.4", "source-map": "^0.7.4", "stack-trace": "^1.0.0-pre2", @@ -36328,13 +36200,6 @@ "is-windows": "^1.0.0" } }, - "better-sqlite3": { - "version": "8.5.0", - "requires": { - "bindings": "^1.5.0", - "prebuild-install": "^7.1.0" - } - }, "big-integer": { "version": "1.6.51", "dev": true @@ -36347,12 +36212,6 @@ "version": "2.2.0", "devOptional": true }, - "bindings": { - "version": "1.5.0", - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bl": { "version": "4.1.0", "requires": { @@ -37705,9 +37564,6 @@ "detect-indent": { "version": "6.1.0" }, - "detect-libc": { - "version": "2.0.2" - }, "detect-newline": { "version": "3.1.0", "devOptional": true @@ -38695,9 +38551,6 @@ "exit-hook": { "version": "2.2.1" }, - "expand-template": { - "version": "2.0.3" - }, "expect": { "version": "29.4.3", "dev": true, @@ -38902,9 +38755,6 @@ "flat-cache": "^3.0.4" } }, - "file-uri-to-path": { - "version": "1.0.0" - }, "filelist": { "version": "1.0.4", "requires": { @@ -39337,9 +39187,6 @@ "version": "1.0.3", "devOptional": true }, - "github-from-package": { - "version": "0.0.0" - }, "glob": { "version": "7.2.3", "requires": { @@ -42059,18 +41906,15 @@ "dev": true }, "miniflare": { - "version": "3.20230904.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230904.0.tgz", - "integrity": "sha512-+OWQqEk8hV7vZaPCoj5dk1lZr4YUy56OiyNZ45/3ITYf+ZxgQOBPWhQhpw1jCahkRKGPa9Aykz01sc+GhPZYDA==", + "version": "3.20230918.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20230918.0.tgz", + "integrity": "sha512-Dd29HB7ZlT1CXB2tPH8nW6fBOOXi/m7qFZHjKm2jGS+1OaGfrv0PkT5UspWW5jQi8rWI87xtordAUiIJkwWqRw==", "requires": { "acorn": "^8.8.0", "acorn-walk": "^8.2.0", - "better-sqlite3": "^8.1.0", "capnp-ts": "^0.7.0", "exit-hook": "^2.2.1", "glob-to-regexp": "^0.4.1", - "http-cache-semantics": "^4.1.0", - "kleur": "^4.1.5", "source-map-support": "0.5.21", "stoppable": "^1.1.0", "undici": "^5.22.1", @@ -42241,9 +42085,6 @@ "version": "3.3.6", "devOptional": true }, - "napi-build-utils": { - "version": "1.0.2" - }, "natural-compare": { "version": "1.4.0", "dev": true @@ -42281,12 +42122,6 @@ } } }, - "node-abi": { - "version": "3.47.0", - "requires": { - "semver": "^7.3.5" - } - }, "node-abort-controller": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", @@ -45405,32 +45240,6 @@ "version": "4.2.0", "devOptional": true }, - "prebuild-install": { - "version": "7.1.1", - "requires": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "dependencies": { - "pump": { - "version": "3.0.0", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - }, "preferred-pm": { "version": "3.0.3", "dev": true, @@ -46496,17 +46305,6 @@ "signedsource": { "version": "1.0.0" }, - "simple-concat": { - "version": "1.0.1" - }, - "simple-get": { - "version": "4.0.1", - "requires": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "simple-git": { "version": "3.19.1", "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.19.1.tgz", diff --git a/packages/cli/package.json b/packages/cli/package.json index 8be9f8b74b..d06ac2d2b8 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -44,7 +44,7 @@ "fs-extra": "^11.1.0", "get-port": "^7.0.0", "gunzip-maybe": "^1.4.2", - "miniflare": "3.20230904.0", + "miniflare": "3.20230918.0", "prettier": "^2.8.4", "source-map": "^0.7.4", "stack-trace": "^1.0.0-pre2",