From ff7c02a4696b74dabb7fa562d55686e984cc0189 Mon Sep 17 00:00:00 2001 From: Leah Date: Tue, 18 Oct 2022 20:37:33 +0200 Subject: [PATCH] ts HMR runtime (#38) --- .eslintrc.js | 11 +- crates/next-core/js/package.json | 22 + crates/next-core/js/src/dev/client.ts | 10 + crates/next-core/js/src/dev/hmr-client.ts | 123 + crates/next-core/js/src/dev/websocket.ts | 106 + crates/next-core/js/src/entry/index.d.ts | 4 + .../entry/next-hydrate.tsx} | 11 +- .../entry/server-renderer.tsx} | 72 +- .../shims.js => src/internal/shims.ts} | 0 crates/next-core/js/tsconfig.json | 37 + crates/next-core/js/types/globals.d.ts | 7 + crates/next-core/package.json | 11 - crates/next-core/src/embed_js.rs | 2 +- crates/next-core/src/next_client/context.rs | 12 +- crates/next-core/src/next_client/mod.rs | 4 +- .../next-core/src/server_rendered_source.rs | 13 +- crates/turbopack-core/src/resolve/origin.rs | 2 +- .../turbopack-dev-server/js/html-runtime.js | 26 +- crates/turbopack-dev-server/src/lib.rs | 49 +- crates/turbopack-dev-server/src/update/mod.rs | 1 + .../src/update/protocol.rs | 31 + .../turbopack-dev-server/src/update/server.rs | 70 +- .../turbopack-dev-server/src/update/stream.rs | 16 +- crates/turbopack-ecmascript/js/package.json | 13 + crates/turbopack-ecmascript/js/runtime.js | 799 ----- crates/turbopack-ecmascript/js/src/runtime.js | 994 ++++++ crates/turbopack-ecmascript/js/tsconfig.json | 32 + crates/turbopack-ecmascript/js/types/hot.d.ts | 66 + .../turbopack-ecmascript/js/types/index.d.ts | 100 + .../js/types/protocol.d.ts | 21 + .../js/types/runtime.d.ts | 22 + crates/turbopack-ecmascript/package.json | 7 - crates/turbopack-ecmascript/src/chunk/mod.rs | 2 +- .../src/chunk_group_files_asset.rs | 10 +- ...gration_async_chunk_input_index_68ffe6.js} | 335 +- ...nc_chunk_input_index_68ffe6.js.42b09e.map} | 0 ...nc_chunk_input_index_68ffe6.js.d841e8.map} | 0 ...nput_index_68ffe6.js.dec1154e4aeb568a.map} | 0 ...integration_chunked_input_index_3b8211.js} | 335 +- ..._chunked_input_index_3b8211.js.7c0f67.map} | 0 ...nput_index_3b8211.js.c2afc48f178d7986.map} | 0 ...hot_integration_css_input_index_e1d7af.js} | 335 +- ...tion_css_input_index_e1d7af.js.335b69.map} | 0 ...nput_index_e1d7af.js.7c2617b5834079be.map} | 0 ...tion_css_input_index_e1d7af.js.f9710f.map} | 0 ...s_snapshot_integration_env_input_72bbc2.js | 329 +- ..._integration_example_input_index_044eb4.js | 329 +- ...ot_integration_json_input_index_f603a5.js} | 335 +- ...ion_json_input_index_f603a5.js.597ae8.map} | 0 ...nput_index_f603a5.js.8b66a863c42e8716.map} | 0 ...ion_json_input_index_f603a5.js.ad3373.map} | 0 ...ion_json_input_index_f603a5.js.c6b79f.map} | 0 ...sforms_input_packages_app_index_d234db.js} | 335 +- ..._app_index_d234db.js.842bb8af45fc05ec.map} | 0 ...t_packages_app_index_d234db.js.c6b871.map} | 0 .../output/node_modules_react_jsx-runtime.js | 3041 ----------------- ...de_modules_react_jsx-runtime.js.09926b.map | 6 - ...de_modules_react_jsx-runtime.js.678978.map | 6 - ...de_modules_react_jsx-runtime.js.7bc78e.map | 6 - ...de_modules_react_jsx-runtime.js.9897c6.map | 6 - ...de_modules_react_jsx-runtime.js.b349fb.map | 6 - ..._react_jsx-runtime.js.c9fcbf31c9ecc116.map | 16 - ...de_modules_react_jsx-runtime.js.dca2bb.map | 6 - ..._@swc_helpers_src__class_call_check.mjs.js | 18 - ...ass_call_check.mjs.js.8bcaf458ac88e308.map | 6 - ...rs_src__class_call_check.mjs.js.8c683f.map | 6 - ...egration_preset_env_input_index_272dd2.js} | 343 +- ...nput_index_272dd2.js.560e25ffcad55eab.map} | 4 +- ...eset_env_input_index_272dd2.js.ad0136.map} | 4 +- ...n_resolve_error_cjs_input_index_0a82c8.js} | 335 +- ...nput_index_0a82c8.js.2f34663e6562097a.map} | 0 ...rror_cjs_input_index_0a82c8.js.ec8526.map} | 0 ...n_resolve_error_esm_input_index_486c0e.js} | 335 +- ...nput_index_486c0e.js.1cf37ac5daa5b01f.map} | 0 ...rror_esm_input_index_486c0e.js.65f1a4.map} | 0 ...ration_runtime_entry_input_index_55400d.js | 329 +- ..._integration_static_input_index_a0a0c3.js} | 335 +- ...n_static_input_index_a0a0c3.js.2e7826.map} | 0 ...n_static_input_index_a0a0c3.js.42fe58.map} | 0 ...nput_index_a0a0c3.js.caa2a16260ae9c94.map} | 0 package.json | 2 +- pnpm-lock.yaml | 170 +- pnpm-workspace.yaml | 2 +- tsconfig.json | 2 +- 84 files changed, 5059 insertions(+), 4964 deletions(-) create mode 100644 crates/next-core/js/package.json create mode 100644 crates/next-core/js/src/dev/client.ts create mode 100644 crates/next-core/js/src/dev/hmr-client.ts create mode 100644 crates/next-core/js/src/dev/websocket.ts create mode 100644 crates/next-core/js/src/entry/index.d.ts rename crates/next-core/js/{entry/next-hydrate.js => src/entry/next-hydrate.tsx} (70%) rename crates/next-core/js/{entry/server-renderer.js => src/entry/server-renderer.tsx} (75%) rename crates/next-core/js/{internal/shims.js => src/internal/shims.ts} (100%) create mode 100644 crates/next-core/js/tsconfig.json create mode 100644 crates/next-core/js/types/globals.d.ts delete mode 100644 crates/next-core/package.json create mode 100644 crates/turbopack-dev-server/src/update/protocol.rs create mode 100644 crates/turbopack-ecmascript/js/package.json delete mode 100644 crates/turbopack-ecmascript/js/runtime.js create mode 100644 crates/turbopack-ecmascript/js/src/runtime.js create mode 100644 crates/turbopack-ecmascript/js/tsconfig.json create mode 100644 crates/turbopack-ecmascript/js/types/hot.d.ts create mode 100644 crates/turbopack-ecmascript/js/types/index.d.ts create mode 100644 crates/turbopack-ecmascript/js/types/protocol.d.ts create mode 100644 crates/turbopack-ecmascript/js/types/runtime.d.ts delete mode 100644 crates/turbopack-ecmascript/package.json rename crates/turbopack/tests/snapshot/integration/async_chunk/output/{crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js => crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js} (74%) rename crates/turbopack/tests/snapshot/integration/async_chunk/output/{crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.42b09e.map => crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.42b09e.map} (100%) rename crates/turbopack/tests/snapshot/integration/async_chunk/output/{crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.d841e8.map => crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.d841e8.map} (100%) rename crates/turbopack/tests/snapshot/integration/async_chunk/output/{crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.dec1154e4aeb568a.map => crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.dec1154e4aeb568a.map} (100%) rename crates/turbopack/tests/snapshot/integration/chunked/output/{crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js => crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js} (74%) rename crates/turbopack/tests/snapshot/integration/chunked/output/{crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js.7c0f67.map => crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js.7c0f67.map} (100%) rename crates/turbopack/tests/snapshot/integration/chunked/output/{crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js.c2afc48f178d7986.map => crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js.c2afc48f178d7986.map} (100%) rename crates/turbopack/tests/snapshot/integration/css/output/{crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js => crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js} (74%) rename crates/turbopack/tests/snapshot/integration/css/output/{crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.335b69.map => crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.335b69.map} (100%) rename crates/turbopack/tests/snapshot/integration/css/output/{crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.7c2617b5834079be.map => crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.7c2617b5834079be.map} (100%) rename crates/turbopack/tests/snapshot/integration/css/output/{crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.f9710f.map => crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.f9710f.map} (100%) rename crates/turbopack/tests/snapshot/integration/json/output/{crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js => crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js} (74%) rename crates/turbopack/tests/snapshot/integration/json/output/{crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.597ae8.map => crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.597ae8.map} (100%) rename crates/turbopack/tests/snapshot/integration/json/output/{crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.8b66a863c42e8716.map => crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.8b66a863c42e8716.map} (100%) rename crates/turbopack/tests/snapshot/integration/json/output/{crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.ad3373.map => crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.ad3373.map} (100%) rename crates/turbopack/tests/snapshot/integration/json/output/{crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.c6b79f.map => crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.c6b79f.map} (100%) rename crates/turbopack/tests/snapshot/integration/mono_transforms/output/{62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js => 62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js} (74%) rename crates/turbopack/tests/snapshot/integration/mono_transforms/output/{62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js.842bb8af45fc05ec.map => 62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js.842bb8af45fc05ec.map} (100%) rename crates/turbopack/tests/snapshot/integration/mono_transforms/output/{62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js.c6b871.map => 62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js.c6b871.map} (100%) delete mode 100644 crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js delete mode 100644 crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.09926b.map delete mode 100644 crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.678978.map delete mode 100644 crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.7bc78e.map delete mode 100644 crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.9897c6.map delete mode 100644 crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.b349fb.map delete mode 100644 crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.c9fcbf31c9ecc116.map delete mode 100644 crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.dca2bb.map delete mode 100644 crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js delete mode 100644 crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js.8bcaf458ac88e308.map delete mode 100644 crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js.8c683f.map rename crates/turbopack/tests/snapshot/integration/preset_env/output/{crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js => crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js} (73%) rename crates/turbopack/tests/snapshot/integration/preset_env/output/{crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.496f26fdbe25baf2.map => crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.560e25ffcad55eab.map} (68%) rename crates/turbopack/tests/snapshot/integration/preset_env/output/{crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.d5a489.map => crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.ad0136.map} (68%) rename crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/{crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js => crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js} (73%) rename crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/{crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js.2f34663e6562097a.map => crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js.2f34663e6562097a.map} (100%) rename crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/{crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js.ec8526.map => crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js.ec8526.map} (100%) rename crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/{crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js => crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js} (73%) rename crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/{crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js.1cf37ac5daa5b01f.map => crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js.1cf37ac5daa5b01f.map} (100%) rename crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/{crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js.65f1a4.map => crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js.65f1a4.map} (100%) rename crates/turbopack/tests/snapshot/integration/static/output/{crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js => crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js} (74%) rename crates/turbopack/tests/snapshot/integration/static/output/{crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.2e7826.map => crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.2e7826.map} (100%) rename crates/turbopack/tests/snapshot/integration/static/output/{crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.42fe58.map => crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.42fe58.map} (100%) rename crates/turbopack/tests/snapshot/integration/static/output/{crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.caa2a16260ae9c94.map => crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.caa2a16260ae9c94.map} (100%) diff --git a/.eslintrc.js b/.eslintrc.js index 53cc5dc472677..642869dda22ee 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,8 @@ module.exports = { "target", "dist", "node_modules", - "crates", + "crates/*/tests", + "crates/*/benches", "packages/create-turbo/templates", "packages/turbo-tracing-next-plugin/test/with-mongodb-mongoose", ], @@ -20,10 +21,16 @@ module.exports = { }, overrides: [ { - files: ["./docs/theme.config.js"], + files: ["docs/theme.config.js"], rules: { "react-hooks/rules-of-hooks": "off", }, }, + { + files: "crates/*/js/**", + rules: { + "prefer-const": "error", + }, + }, ], }; diff --git a/crates/next-core/js/package.json b/crates/next-core/js/package.json new file mode 100644 index 0000000000000..79cc3159bb5f8 --- /dev/null +++ b/crates/next-core/js/package.json @@ -0,0 +1,22 @@ +{ + "name": "@vercel/turbopack-next", + "version": "0.0.0", + "description": "turbopack next runtime", + "license": "UNLICENSED", + "private": true, + "scripts": { + "check": "tsc --noEmit" + }, + "dependencies": { + "@next/react-refresh-utils": "^12.2.5", + "@vercel/turbopack-runtime": "latest", + "next": "^12.3.1", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/node": "^18.8.4", + "@types/react": "^18.0.21", + "@types/react-dom": "^18.0.6" + } +} diff --git a/crates/next-core/js/src/dev/client.ts b/crates/next-core/js/src/dev/client.ts new file mode 100644 index 0000000000000..b546f046f45c4 --- /dev/null +++ b/crates/next-core/js/src/dev/client.ts @@ -0,0 +1,10 @@ +import { connect } from "./hmr-client"; +import { connectHMR } from "./websocket"; + +export function initializeHMR(options: { assetPrefix: string }) { + connect(); + connectHMR({ + path: "/turbopack-hmr", + assetPrefix: options.assetPrefix, + }); +} diff --git a/crates/next-core/js/src/dev/hmr-client.ts b/crates/next-core/js/src/dev/hmr-client.ts new file mode 100644 index 0000000000000..157d4f697f977 --- /dev/null +++ b/crates/next-core/js/src/dev/hmr-client.ts @@ -0,0 +1,123 @@ +import type { + ClientMessage, + ServerMessage, +} from "@vercel/turbopack-runtime/types/protocol"; +import type { + ChunkId, + ChunkUpdateCallback, + TurbopackGlobals, +} from "@vercel/turbopack-runtime/types"; + +import { addEventListener, sendMessage } from "./websocket"; + +declare var globalThis: TurbopackGlobals; + +export function connect() { + addEventListener((event) => { + switch (event.type) { + case "connected": + handleSocketConnected(); + break; + case "message": + handleSocketMessage(event.message); + break; + } + }); + + const queued = globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS; + if (queued != null && !Array.isArray(queued)) { + throw new Error("A separate HMR handler was already registered"); + } + globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS = { + push: ([chunkId, callback]: [ChunkId, ChunkUpdateCallback]) => { + onChunkUpdate(chunkId, callback); + }, + }; + + if (Array.isArray(queued)) { + for (const [chunkId, callback] of queued) { + onChunkUpdate(chunkId, callback); + } + } + + subscribeToInitialCssChunksUpdates(); +} + +const chunkUpdateCallbacks: Map = new Map(); + +function sendJSON(message: ClientMessage) { + sendMessage(JSON.stringify(message)); +} + +function subscribeToChunkUpdates(chunkId: ChunkId) { + sendJSON({ + type: "subscribe", + chunkId, + }); +} + +function handleSocketConnected() { + for (const chunkId of chunkUpdateCallbacks.keys()) { + subscribeToChunkUpdates(chunkId); + } +} + +function handleSocketMessage(event: MessageEvent) { + const data: ServerMessage = JSON.parse(event.data); + + triggerChunkUpdate(data); +} + +export function onChunkUpdate(chunkId: ChunkId, callback: ChunkUpdateCallback) { + const callbacks = chunkUpdateCallbacks.get(chunkId); + if (!callbacks) { + chunkUpdateCallbacks.set(chunkId, [callback]); + } else { + callbacks.push(callback); + } + + subscribeToChunkUpdates(chunkId); +} + +function triggerChunkUpdate(update: ServerMessage) { + const callbacks = chunkUpdateCallbacks.get(update.chunkId); + if (!callbacks) { + return; + } + + try { + for (const callback of callbacks) { + callback(update); + } + } catch (err) { + console.error( + `An error occurred during the update of chunk \`${update.chunkId}\``, + err + ); + location.reload(); + } +} + +// Unlike ES chunks, CSS chunks cannot contain the logic to accept updates. +// They must be reloaded here instead. +function subscribeToInitialCssChunksUpdates() { + const initialCssChunkLinks: NodeListOf = + document.head.querySelectorAll("link[data-turbopack-chunk-id]"); + initialCssChunkLinks.forEach((link) => { + const chunkId = link.dataset.turbopackChunkId!; + + onChunkUpdate(chunkId, (update) => { + switch (update.type) { + case "restart": { + console.info(`Reloading CSS chunk \`${chunkId}\``); + link.replaceWith(link); + break; + } + case "partial": + throw new Error(`partial CSS chunk updates are not supported`); + default: + throw new Error(`unknown update type \`${update}\``); + } + }); + }); +} diff --git a/crates/next-core/js/src/dev/websocket.ts b/crates/next-core/js/src/dev/websocket.ts new file mode 100644 index 0000000000000..b747974613f96 --- /dev/null +++ b/crates/next-core/js/src/dev/websocket.ts @@ -0,0 +1,106 @@ +// Adapted from https://github.com/vercel/next.js/blob/canary/packages/next/client/dev/error-overlay/websocket.ts + +let source: WebSocket; +const eventCallbacks: ((event: WebsocketEvent) => void)[] = []; + +// TODO: add timeout again +// let lastActivity = Date.now() + +function getSocketProtocol(assetPrefix: string): string { + let protocol = location.protocol; + + try { + // assetPrefix is a url + protocol = new URL(assetPrefix).protocol; + } catch (_) {} + + return protocol === "http:" ? "ws" : "wss"; +} + +type WebsocketEvent = + | { + type: "connected"; + } + | { + type: "message"; + message: MessageEvent; + }; + +export function addEventListener(cb: (event: WebsocketEvent) => void) { + eventCallbacks.push(cb); +} + +export function sendMessage(data: any) { + if (!source || source.readyState !== source.OPEN) return; + return source.send(data); +} + +export type HMROptions = { + path: string; + assetPrefix: string; + timeout?: number; + log?: boolean; +}; + +export function connectHMR(options: HMROptions) { + const { timeout = 5 * 1000 } = options; + + function init() { + if (source) source.close(); + + function handleOnline() { + eventCallbacks.forEach((cb) => { + cb({ + type: "connected", + }); + }); + + if (options.log) console.log("[HMR] connected"); + // lastActivity = Date.now() + } + + function handleMessage(event: MessageEvent) { + // lastActivity = Date.now() + + eventCallbacks.forEach((cb) => { + cb({ + type: "message", + message: event, + }); + }); + } + + // let timer: NodeJS.Timeout + + function handleDisconnect() { + // clearInterval(timer) + source.close(); + setTimeout(init, timeout); + } + + // timer = setInterval(function() { + // if (Date.now() - lastActivity > timeout) { + // handleDisconnect() + // } + // }, timeout / 2) + + const { hostname, port } = location; + const protocol = getSocketProtocol(options.assetPrefix || ""); + const assetPrefix = options.assetPrefix.replace(/^\/+/, ""); + + let url = `${protocol}://${hostname}:${port}${ + assetPrefix ? `/${assetPrefix}` : "" + }`; + + if (assetPrefix.startsWith("http")) { + url = `${protocol}://${assetPrefix.split("://")[1]}`; + } + + source = new window.WebSocket(`${url}${options.path}`); + source.onopen = handleOnline; + source.onerror = handleDisconnect; + source.onmessage = handleMessage; + } + + init(); +} diff --git a/crates/next-core/js/src/entry/index.d.ts b/crates/next-core/js/src/entry/index.d.ts new file mode 100644 index 0000000000000..94904f577498d --- /dev/null +++ b/crates/next-core/js/src/entry/index.d.ts @@ -0,0 +1,4 @@ +// this file is just here to make typescript happy about the wrapped/virtual assets (import ".") + +declare var Anything: any; +export = Anything; diff --git a/crates/next-core/js/entry/next-hydrate.js b/crates/next-core/js/src/entry/next-hydrate.tsx similarity index 70% rename from crates/next-core/js/entry/next-hydrate.js rename to crates/next-core/js/src/entry/next-hydrate.tsx index 98f9da45f3f4c..ffa1e6716b275 100644 --- a/crates/next-core/js/entry/next-hydrate.js +++ b/crates/next-core/js/src/entry/next-hydrate.tsx @@ -1,11 +1,18 @@ import "@vercel/turbopack-next/internal/shims"; + import { initialize, hydrate } from "next/dist/client"; +import { initializeHMR } from "@vercel/turbopack-next/dev/client"; + import * as _app from "@vercel/turbopack-next/pages/_app"; import * as page from "."; (async () => { console.debug("Initializing Next.js"); + initializeHMR({ + assetPrefix: "", + }); + await initialize({ webpackHMR: { // Expected when `process.env.NODE_ENV === 'development'` @@ -13,8 +20,8 @@ import * as page from "."; }, }); - __NEXT_P.push(["/_app", () => _app]); - __NEXT_P.push([window.__NEXT_DATA__.page, () => page]); + window.__NEXT_P.push(["/_app", () => _app]); + window.__NEXT_P.push([window.__NEXT_DATA__.page, () => page]); console.debug("Hydrating the page"); diff --git a/crates/next-core/js/entry/server-renderer.js b/crates/next-core/js/src/entry/server-renderer.tsx similarity index 75% rename from crates/next-core/js/entry/server-renderer.js rename to crates/next-core/js/src/entry/server-renderer.tsx index a7c5886ad7acc..1b7ad117b4dce 100644 --- a/crates/next-core/js/entry/server-renderer.js +++ b/crates/next-core/js/src/entry/server-renderer.tsx @@ -1,27 +1,32 @@ -const END_OF_OPERATION = process.argv[2]; +import type { IncomingMessage, ServerResponse } from "node:http"; import "next/dist/server/node-polyfill-fetch.js"; -import { renderToHTML } from "next/dist/server/render"; +import { RenderOpts, renderToHTML } from "next/dist/server/render"; +import { NextParsedUrlQuery } from "next/dist/server/request-meta"; + import App from "@vercel/turbopack-next/pages/_app"; import Document from "@vercel/turbopack-next/pages/_document"; + import Component, * as otherExports from "."; ("TURBOPACK { transition: next-client }"); import chunkGroup from "."; +const END_OF_OPERATION = process.argv[2]; +const NEW_LINE = "\n".charCodeAt(0); + process.stdout.write("READY\n"); -const NEW_LINE = "\n".charCodeAt(0); -let buffer = []; +const buffer: Buffer[] = []; process.stdin.on("data", async (data) => { let idx = data.indexOf(NEW_LINE); while (idx >= 0) { buffer.push(data.slice(0, idx)); try { - let json = JSON.parse(Buffer.concat(buffer).toString("utf-8")); + const json = JSON.parse(Buffer.concat(buffer).toString("utf-8")); buffer.length = 0; - let result = await operation(json); + const result = await operation(json); console.log(`RESULT=${JSON.stringify(result)}`); - } catch (e) { + } catch (e: any) { console.log(`ERROR=${JSON.stringify(e.stack)}`); } console.log(END_OF_OPERATION); @@ -33,21 +38,24 @@ process.stdin.on("data", async (data) => { /** * Shim for Node.js's http.ServerResponse + * + * @type {ServerResponse} */ -class ServerResponse { +class ServerResponseShim { headersSent = false; - #headers = new Map(); + #headers: Map> = new Map(); + req: IncomingMessage; - constructor(req) { + constructor(req: IncomingMessage) { this.req = req; } - setHeader(name, value) { + setHeader(name: string, value: number | string | ReadonlyArray) { this.#headers.set(name.toLowerCase(), value); return this; } - getHeader(name) { + getHeader(name: string) { return this.#headers.get(name.toLowerCase()); } @@ -59,11 +67,11 @@ class ServerResponse { return Object.fromEntries(this.#headers); } - hasHeader(name) { + hasHeader(name: string) { return this.#headers.has(name.toLowerCase()); } - removeHeader(name) { + removeHeader(name: string) { this.#headers.delete(name.toLowerCase()); } @@ -111,7 +119,7 @@ class ServerResponse { throw new Error("addTrailers is not implemented"); } - setTimeout(_msecs, _callback) { + setTimeout(_msecs: any, _callback: any) { throw new Error("setTimeout is not implemented"); } @@ -123,7 +131,7 @@ class ServerResponse { throw new Error("writableFinished is not implemented"); } - write(_chunk, _encoding, _callback) { + write(_chunk: any, _encoding: any, _callback: any) { throw new Error("write is not implemented"); } @@ -131,7 +139,7 @@ class ServerResponse { throw new Error("writeContinue is not implemented"); } - writeHead(_statusCode, _statusMessage, _headers) { + writeHead(_statusCode: any, _statusMessage: any, _headers: any) { throw new Error("writeHead is not implemented"); } @@ -140,7 +148,23 @@ class ServerResponse { } } -async function operation(renderData) { +type QueryValue = string | QueryValue[] | Query; +interface Query { + [key: string]: QueryValue; +} + +type HeaderValue = string | string[]; + +type RenderData = { + params: Record; + method: string; + url: string; + path: string; + query: NextParsedUrlQuery; + headers: Record; +}; + +async function operation(renderData: RenderData) { // TODO(alexkirsz) This is missing *a lot* of data, but it's enough to get a // basic render working. @@ -151,7 +175,7 @@ async function operation(renderData) { // computing the chunk items of `next-hydrate.js`, so they contain both // _app and page chunks. "/_app": [], - [renderData.path]: chunkGroup, + [renderData.path]: chunkGroup.map((c: { path: string }) => c.path), }, devFiles: [], @@ -162,7 +186,7 @@ async function operation(renderData) { ampFirstPages: [], }; - const renderOpts = { + const renderOpts: RenderOpts = { /* LoadComponentsReturnType */ Component, App, @@ -212,12 +236,12 @@ async function operation(renderData) { renderOpts.getServerSideProps = otherExports.getServerSideProps; } - const req = { + const req: IncomingMessage = { url: renderData.url, method: "GET", headers: renderData.headers, - }; - const res = new ServerResponse(req); + } as any; + const res: ServerResponse = new ServerResponseShim(req) as any; const query = { ...renderData.query, ...renderData.params }; return ( @@ -233,5 +257,5 @@ async function operation(renderData) { /* renderOpts: RenderOpts */ renderOpts ) - ).toUnchunkedString(); + )?.toUnchunkedString(); } diff --git a/crates/next-core/js/internal/shims.js b/crates/next-core/js/src/internal/shims.ts similarity index 100% rename from crates/next-core/js/internal/shims.js rename to crates/next-core/js/src/internal/shims.ts diff --git a/crates/next-core/js/tsconfig.json b/crates/next-core/js/tsconfig.json new file mode 100644 index 0000000000000..07d987e0f5ab9 --- /dev/null +++ b/crates/next-core/js/tsconfig.json @@ -0,0 +1,37 @@ +{ + "compilerOptions": { + // type checking + "strict": true, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + + // interop constraints + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + + // js support + "allowJs": true, + "checkJs": true, + + // environment + "jsx": "react-jsx", + "lib": ["ESNext", "DOM"], + "target": "esnext", + + // modules + "baseUrl": ".", + "module": "esnext", + "moduleResolution": "node", + "paths": { + "@vercel/turbopack-next/*": ["src/*"], + "@vercel/turbopack-next/pages/_app": ["node_modules/next/app"], + "@vercel/turbopack-next/pages/_document": ["node_modules/next/document"], + "next/*": ["node_modules/next/*"], + }, + + // emit + "noEmit": true, + "stripInternal": true + }, + "include": ["src", "types"] +} diff --git a/crates/next-core/js/types/globals.d.ts b/crates/next-core/js/types/globals.d.ts new file mode 100644 index 0000000000000..0ab345f1d8c1e --- /dev/null +++ b/crates/next-core/js/types/globals.d.ts @@ -0,0 +1,7 @@ +declare global { + function __webpack_require__(name: any): any; + var __webpack_public_path__: string | undefined; + var __DEV_MIDDLEWARE_MATCHERS: any[]; +} + +export {}; diff --git a/crates/next-core/package.json b/crates/next-core/package.json deleted file mode 100644 index 1e50e77b16d1f..0000000000000 --- a/crates/next-core/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "@vercel/turbopack-next", - "version": "0.0.0", - "description": "turbopack next runtime", - "license": "UNLICENSED", - "private": true, - "peerDependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0" - } -} diff --git a/crates/next-core/src/embed_js.rs b/crates/next-core/src/embed_js.rs index 7ae5aa523cdd7..fa032943a3062 100644 --- a/crates/next-core/src/embed_js.rs +++ b/crates/next-core/src/embed_js.rs @@ -7,7 +7,7 @@ pub const VIRTUAL_PACKAGE_NAME: &str = "@vercel/turbopack-next"; #[turbo_tasks::function] pub(crate) fn next_js_fs() -> FileSystemVc { - embed_directory!("next", "$CARGO_MANIFEST_DIR/js") + embed_directory!("next", "$CARGO_MANIFEST_DIR/js/src") } #[turbo_tasks::function] diff --git a/crates/next-core/src/next_client/context.rs b/crates/next-core/src/next_client/context.rs index 3227140592b1d..19040744a509b 100644 --- a/crates/next-core/src/next_client/context.rs +++ b/crates/next-core/src/next_client/context.rs @@ -16,7 +16,6 @@ use turbopack_core::{ context::AssetContextVc, environment::{BrowserEnvironment, EnvironmentIntention, EnvironmentVc, ExecutionEnvironment}, }; -use turbopack_dev_server::html_runtime_asset::HtmlRuntimeAssetVc; use turbopack_ecmascript::chunk::EcmascriptChunkPlaceablesVc; use turbopack_env::ProcessEnvAssetVc; @@ -130,13 +129,10 @@ pub async fn get_client_runtime_entries( .await? .as_request(); - let mut runtime_entries = vec![ - RuntimeEntry::Ecmascript( - ProcessEnvAssetVc::new(project_root, filter_for_client(env)).into(), - ) - .cell(), - RuntimeEntry::Ecmascript(HtmlRuntimeAssetVc::new().into()).cell(), - ]; + let mut runtime_entries = vec![RuntimeEntry::Ecmascript( + ProcessEnvAssetVc::new(project_root, filter_for_client(env)).into(), + ) + .cell()]; if let Some(request) = enable_react_refresh { runtime_entries.push(RuntimeEntry::Request(request, project_root.join("_")).cell()) }; diff --git a/crates/next-core/src/next_client/mod.rs b/crates/next-core/src/next_client/mod.rs index 497c5d01693be..d7b572fe91644 100644 --- a/crates/next-core/src/next_client/mod.rs +++ b/crates/next-core/src/next_client/mod.rs @@ -41,8 +41,8 @@ impl Transition for NextClientTransition { #[turbo_tasks::function] fn process_source(&self, asset: AssetVc) -> AssetVc { VirtualAssetVc::new( - asset.path().join("next-hydrate.js"), - next_js_file("entry/next-hydrate.js").into(), + asset.path().join("next-hydrate.tsx"), + next_js_file("entry/next-hydrate.tsx").into(), ) .into() } diff --git a/crates/next-core/src/server_rendered_source.rs b/crates/next-core/src/server_rendered_source.rs index 89a532b90ecd9..540aea204d1c6 100644 --- a/crates/next-core/src/server_rendered_source.rs +++ b/crates/next-core/src/server_rendered_source.rs @@ -349,15 +349,16 @@ impl NodeRenderer for SsrRenderer { fn module(&self) -> EcmascriptModuleAssetVc { EcmascriptModuleAssetVc::new( VirtualAssetVc::new( - self.entry_asset.path().join("server-renderer.js"), - next_js_file("entry/server-renderer.js").into(), + self.entry_asset.path().join("server-renderer.tsx"), + next_js_file("entry/server-renderer.tsx").into(), ) .into(), self.context, - Value::new(EcmascriptModuleAssetType::Ecmascript), - EcmascriptInputTransformsVc::cell(vec![EcmascriptInputTransform::React { - refresh: false, - }]), + Value::new(EcmascriptModuleAssetType::Typescript), + EcmascriptInputTransformsVc::cell(vec![ + EcmascriptInputTransform::TypeScript, + EcmascriptInputTransform::React { refresh: false }, + ]), self.context.environment(), ) } diff --git a/crates/turbopack-core/src/resolve/origin.rs b/crates/turbopack-core/src/resolve/origin.rs index e6bed77bbbf9a..eb9e8bfafa474 100644 --- a/crates/turbopack-core/src/resolve/origin.rs +++ b/crates/turbopack-core/src/resolve/origin.rs @@ -3,7 +3,7 @@ use turbo_tasks_fs::FileSystemPathVc; use super::{options::ResolveOptionsVc, parse::RequestVc, ResolveResultVc}; use crate::context::AssetContextVc; -/// A location where resolving can occur from. It carries some metainformation +/// A location where resolving can occur from. It carries some meta information /// that are needed for resolving from here. #[turbo_tasks::value_trait] pub trait ResolveOrigin { diff --git a/crates/turbopack-dev-server/js/html-runtime.js b/crates/turbopack-dev-server/js/html-runtime.js index 621f0029ed063..08c5097f10618 100644 --- a/crates/turbopack-dev-server/js/html-runtime.js +++ b/crates/turbopack-dev-server/js/html-runtime.js @@ -11,14 +11,8 @@ function subscribeToChunkUpdates(chunkId) { function onSocketConnected(connectedSocket) { socket = connectedSocket; - let queued = globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS; - globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS = { - push: addChunkUpdateListener, - }; - if (Array.isArray(queued)) { - for (const job of queued) { - addChunkUpdateListener(job); - } + for (const chunkId of chunkUpdateCallbacks.keys()) { + subscribeToChunkUpdates(chunkId); } socket.onmessage = (event) => { @@ -41,7 +35,9 @@ function addChunkUpdateListener([chunkId, callback]) { if (!callbacks) { callbacks = [callback]; chunkUpdateCallbacks.set(chunkId, callbacks); - subscribeToChunkUpdates(chunkId); + if (socket) { + subscribeToChunkUpdates(chunkId); + } } else { callbacks.push(callback); } @@ -99,7 +95,15 @@ if (typeof WebSocket !== "undefined") { }; } -globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS = - globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; +const queued = globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS; +if (queued != null && !Array.isArray(queued)) { + throw new Error("A separate HMR handler was already registered"); +} +globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS = { push: addChunkUpdateListener }; +if (Array.isArray(queued)) { + for (const job of queued) { + addChunkUpdateListener(job); + } +} subscribeToInitialCssChunksUpdates(); diff --git a/crates/turbopack-dev-server/src/lib.rs b/crates/turbopack-dev-server/src/lib.rs index 152df6873590c..3dbc42e4633bb 100644 --- a/crates/turbopack-dev-server/src/lib.rs +++ b/crates/turbopack-dev-server/src/lib.rs @@ -37,7 +37,19 @@ use self::{ }; use crate::source::{ContentSourceData, ContentSourceResult, HeaderValue}; -pub trait GetContentSource = Fn() -> ContentSourceVc + Send + Clone + 'static; +pub trait SourceProvider: Send + Clone + 'static { + /// must call a turbo-tasks function internally + fn get_source(&self) -> ContentSourceVc; +} + +impl SourceProvider for T +where + T: Fn() -> ContentSourceVc + Send + Clone + 'static, +{ + fn get_source(&self) -> ContentSourceVc { + self() + } +} #[derive(TraceRawVcs)] pub struct DevServer { @@ -129,30 +141,39 @@ async fn process_request_with_content_source( } impl DevServer { - /// [get_source] argument must be from a single turbo-tasks function call - pub fn listen( + pub fn listen( turbo_tasks: Arc, - get_source: S, + source_provider: impl SourceProvider, addr: SocketAddr, console_ui: Arc, ) -> Self { let make_svc = make_service_fn(move |_| { let tt = turbo_tasks.clone(); - let get_source = get_source.clone(); + let source_provider = source_provider.clone(); let console_ui = console_ui.clone(); async move { let handler = move |request: Request| { let console_ui = console_ui.clone(); let start = Instant::now(); let tt = tt.clone(); - let get_source = get_source.clone(); + let source_provider = source_provider.clone(); let future = async move { if hyper_tungstenite::is_upgrade_request(&request) { - let (response, websocket) = hyper_tungstenite::upgrade(request, None)?; - let update_server = UpdateServer::new(websocket, get_source); - update_server.run(&*tt); - return Ok(response); + let uri = request.uri(); + let path = uri.path(); + + if path == "/turbopack-hmr" { + let (response, websocket) = + hyper_tungstenite::upgrade(request, None)?; + let update_server = UpdateServer::new(source_provider); + update_server.run(&*tt, websocket); + return Ok(response); + } + + println!("[404] {} (WebSocket)", path); + return Ok(Response::builder().status(404).body(Body::empty())?); } + let (tx, rx) = tokio::sync::oneshot::channel(); let task_id = tt.run_once(Box::pin(async move { let console_ui = (*console_ui).clone().cell(); @@ -161,7 +182,7 @@ impl DevServer { // Remove leading slash. let path = &path[1..]; let asset_path = urlencoding::decode(path)?; - let source = get_source(); + let source = source_provider.get_source(); handle_issues(source, path, "get source", console_ui).await?; let resolved_source = source.resolve_strongly_consistent().await?; let response = process_request_with_content_source( @@ -198,7 +219,11 @@ impl DevServer { match future.await { Ok(r) => Ok::<_, hyper::http::Error>(r), Err(e) => { - println!("[500] {:#} ({})", e, FormatDuration(start.elapsed())); + println!( + "[500] error: {:?} ({})", + e, + FormatDuration(start.elapsed()) + ); Ok(Response::builder() .status(500) .body(Body::from(format!("{:?}", e,)))?) diff --git a/crates/turbopack-dev-server/src/update/mod.rs b/crates/turbopack-dev-server/src/update/mod.rs index f07e04a8f32de..781760161f5a7 100644 --- a/crates/turbopack-dev-server/src/update/mod.rs +++ b/crates/turbopack-dev-server/src/update/mod.rs @@ -1,3 +1,4 @@ +pub mod protocol; pub mod server; pub mod stream; diff --git a/crates/turbopack-dev-server/src/update/protocol.rs b/crates/turbopack-dev-server/src/update/protocol.rs new file mode 100644 index 0000000000000..b6f5f572d030f --- /dev/null +++ b/crates/turbopack-dev-server/src/update/protocol.rs @@ -0,0 +1,31 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Deserialize)] +#[serde(tag = "type", rename_all = "camelCase")] +pub enum ClientMessage { + Subscribe { + #[serde(rename = "chunkId")] + chunk_id: String, + }, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ClientUpdateInstruction<'a> { + pub chunk_id: &'a str, + #[serde(flatten)] + pub ty: ClientUpdateInstructionType<'a>, +} + +impl<'a> ClientUpdateInstruction<'a> { + pub fn new(chunk_id: &'a str, ty: ClientUpdateInstructionType<'a>) -> Self { + Self { chunk_id, ty } + } +} + +#[derive(Serialize)] +#[serde(tag = "type", rename_all = "camelCase")] +pub enum ClientUpdateInstructionType<'a> { + Restart, + Partial { instruction: &'a str }, +} diff --git a/crates/turbopack-dev-server/src/update/server.rs b/crates/turbopack-dev-server/src/update/server.rs index 9addb849bd617..ab324ad5acfcc 100644 --- a/crates/turbopack-dev-server/src/update/server.rs +++ b/crates/turbopack-dev-server/src/update/server.rs @@ -5,44 +5,44 @@ use futures::{ }; use hyper::upgrade::Upgraded; use hyper_tungstenite::{tungstenite::Message, HyperWebsocket, WebSocketStream}; -use serde::{Deserialize, Serialize}; use tokio::select; use turbo_tasks::TurboTasksApi; use turbopack_core::version::Update; -use super::stream::UpdateStream; -use crate::{source::ContentSourceResult, GetContentSource}; +use super::{ + protocol::{ClientMessage, ClientUpdateInstruction, ClientUpdateInstructionType}, + stream::UpdateStream, +}; +use crate::{source::ContentSourceResult, SourceProvider}; /// A server that listens for updates and sends them to connected clients. -pub(crate) struct UpdateServer { - ws: Option, +pub(crate) struct UpdateServer { streams: FuturesUnordered>, - get_source: S, + source_provider: P, } -impl UpdateServer { +impl UpdateServer

{ /// Create a new update server with the given websocket and content source. - pub fn new(ws: HyperWebsocket, source: S) -> Self { + pub fn new(source_provider: P) -> Self { Self { - ws: Some(ws), streams: FuturesUnordered::new(), - get_source: source, + source_provider, } } /// Run the update server loop. - pub fn run(self, tt: &dyn TurboTasksApi) { + pub fn run(self, tt: &dyn TurboTasksApi, ws: HyperWebsocket) { tt.run_once_process(Box::pin(async move { - if let Err(err) = self.run_internal().await { - println!("[UpdateServer]: error {}", err); + if let Err(err) = self.run_internal(ws).await { + println!("[UpdateServer]: error {:#}", err); } Ok(()) })); } - async fn run_internal(mut self) -> Result<()> { - let source = (self.get_source)(); - let mut client: UpdateClient = self.ws.take().unwrap().await?.into(); + async fn run_internal(mut self, ws: HyperWebsocket) -> Result<()> { + let source = self.source_provider.get_source(); + let mut client: UpdateClient = ws.await?.into(); // TODO(alexkirsz) To avoid sending an empty update in the beginning, skip the // first update. Note that the first update *may not* be empty, but since we @@ -50,17 +50,17 @@ impl UpdateServer { loop { select! { message = client.recv() => { - if let Some(message) = message? { - let content = source.get_by_id(&message.id); + if let Some(ClientMessage::Subscribe { chunk_id }) = message? { + let content = source.get_by_id(&chunk_id); match *content.await? { ContentSourceResult::NotFound => { // Client requested a non-existing asset // It might be removed in meantime, reload client // TODO add special instructions for removed assets to handled it in a better way - client.send_update(&message.id, ClientUpdateInstructionType::Restart).await?; + client.send_update(&chunk_id, ClientUpdateInstructionType::Restart).await?; }, ContentSourceResult::Static(content) => { - let stream = UpdateStream::new(message.id, content).await?; + let stream = UpdateStream::new(chunk_id, content).await?; self.add_stream(stream); }, ContentSourceResult::NeedData{ .. } => { @@ -75,12 +75,12 @@ impl UpdateServer { match &*update { Update::Partial(partial) => { let partial_instruction = partial.instruction.await?; - client.send_update(stream.id(), ClientUpdateInstructionType::Partial { + client.send_update(stream.chunk_id(), ClientUpdateInstructionType::Partial { instruction: partial_instruction.as_ref(), }).await?; } Update::Total(_total) => { - client.send_update(stream.id(), ClientUpdateInstructionType::Restart).await?; + client.send_update(stream.chunk_id(), ClientUpdateInstructionType::Restart).await?; } Update::None => {} } @@ -117,10 +117,10 @@ impl UpdateClient { async fn send_update( &mut self, - id: &str, - type_: ClientUpdateInstructionType<'_>, + chunk_id: &str, + ty: ClientUpdateInstructionType<'_>, ) -> Result<()> { - let instruction = ClientUpdateInstruction { id, type_ }; + let instruction = ClientUpdateInstruction { chunk_id, ty }; self.ws .send(Message::text(serde_json::to_string(&instruction)?)) .await?; @@ -133,23 +133,3 @@ impl From> for UpdateClient { Self { ws } } } - -#[derive(Deserialize)] -#[serde(transparent)] -pub(super) struct ClientMessage { - pub(super) id: String, -} - -#[derive(Serialize)] -pub(super) struct ClientUpdateInstruction<'a> { - pub(super) id: &'a str, - #[serde(flatten, rename = "type")] - pub(super) type_: ClientUpdateInstructionType<'a>, -} - -#[derive(Serialize)] -#[serde(tag = "type", rename_all = "lowercase")] -pub(super) enum ClientUpdateInstructionType<'a> { - Restart, - Partial { instruction: &'a str }, -} diff --git a/crates/turbopack-dev-server/src/update/stream.rs b/crates/turbopack-dev-server/src/update/stream.rs index 6b2707768e28a..cbe6e1eec1e93 100644 --- a/crates/turbopack-dev-server/src/update/stream.rs +++ b/crates/turbopack-dev-server/src/update/stream.rs @@ -48,8 +48,8 @@ impl VersionStateVc { struct VersionStateId(String); impl VersionStateVc { - async fn new(inner: VersionVc, id: &str) -> Result { - let id = VersionStateId(id.to_string()); + async fn new(inner: VersionVc, chunk_id: &str) -> Result { + let id = VersionStateId(chunk_id.to_string()); let inner = inner.keyed_cell_local(id.clone()).await?; Ok(Self::cell(VersionState { inner: Mutex::new((inner, None)), @@ -69,15 +69,15 @@ impl VersionStateVc { } pub(super) struct UpdateStream { - id: String, + chunk_id: String, stream: Pin + Send + Sync>>, } impl UpdateStream { - pub async fn new(id: String, content: VersionedContentVc) -> Result { + pub async fn new(chunk_id: String, content: VersionedContentVc) -> Result { let (sx, rx) = tokio::sync::mpsc::channel(32); - let version_state = VersionStateVc::new(content.version(), &id).await?; + let version_state = VersionStateVc::new(content.version(), &chunk_id).await?; compute_update_stream( version_state, @@ -86,7 +86,7 @@ impl UpdateStream { ); Ok(UpdateStream { - id, + chunk_id, stream: Box::pin(unfold( (rx, version_state), |(mut rx, version_state)| async move { @@ -112,8 +112,8 @@ impl UpdateStream { }) } - pub fn id(&self) -> &str { - &self.id + pub fn chunk_id(&self) -> &str { + &self.chunk_id } } diff --git a/crates/turbopack-ecmascript/js/package.json b/crates/turbopack-ecmascript/js/package.json new file mode 100644 index 0000000000000..ab2f675f0e7b6 --- /dev/null +++ b/crates/turbopack-ecmascript/js/package.json @@ -0,0 +1,13 @@ +{ + "name": "@vercel/turbopack-runtime", + "version": "0.0.0", + "description": "turbopack runtime", + "license": "UNLICENSED", + "private": true, + "dependencies": { + "@next/react-refresh-utils": "^12.2.5" + }, + "devDependencies": { + "@types/node": "^18.8.4" + } +} diff --git a/crates/turbopack-ecmascript/js/runtime.js b/crates/turbopack-ecmascript/js/runtime.js deleted file mode 100644 index 37fe960ff600e..0000000000000 --- a/crates/turbopack-ecmascript/js/runtime.js +++ /dev/null @@ -1,799 +0,0 @@ -(() => { - // When a chunk is executed, it will either register itself with the current - // instance of the runtime, or it will push itself onto the list of pending - // chunks (`self.TURBOPACK`). - // - // When the runtime executes, it will pick up and register all pending chunks, - // and replace the list of pending chunks with itself so later chunks can - // register directly with it. - if (!Array.isArray(self.TURBOPACK)) { - return; - } - - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; - /** - * Contains the IDs of all chunks that have been loaded. - */ - const loadedChunks = new Set(); - /** - * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. - */ - const chunkLoaders = new Map(); - /** - * Maps module IDs to persisted data between executions of their hot module - * implementation (`hot.data`). - */ - const moduleHotData = new Map(); - /** - * Maps module instances to their hot module state. - */ - const moduleHotState = new Map(); - /** - * Module IDs that are instantiated as part of the runtime of a chunk. - */ - const runtimeModules = new Set(); - /** - * Map from module ID to the chunks that contain this module. - * - * In HMR, we need to keep track of which modules are contained in which so - * chunks. This is so we don't eagerly dispose of a module when it is removed - * from chunk A, but still exists in chunk B. - */ - const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; - const _process = - typeof process !== "undefined" - ? process - : { - env: {}, - // Some modules rely on `process.browser` to execute browser-specific code. - // NOTE: `process.browser` is specific to Webpack. - browser: true, - }; - - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; - - function defineProp(obj, name, options) { - if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); - } - - function esm(exports, getters) { - defineProp(exports, "__esModule", { value: true }); - if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { - defineProp(exports, key, { get: getters[key], enumerable: true }); - } - } - - function exportValue(module, value) { - module.exports = value; - } - - function createGetter(obj, key) { - return () => obj[key]; - } - - function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; - if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { - getters[key] = createGetter(raw, key); - } - } - if (!(allowExportDefault && "default" in getters)) { - getters["default"] = () => raw; - } - esm(ns, getters); - } - - function esmImport(sourceModule, id, allowExportDefault) { - const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; - if (raw.__esModule) return raw; - if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); - interopEsm(raw, ns, allowExportDefault); - return ns; - } - - function commonJsRequire(sourceModule, id) { - return getOrInstantiateModuleFromParent(id, sourceModule).exports; - } - - function externalRequire(id) { - let raw; - try { - raw = require(id); - } catch (err) { - // TODO(alexkirsz) This can happen when a client-side module tries to load - // an external module we don't provide a shim for (e.g. querystring, url). - // For now, we fail semi-silently, but in the future this should be a - // compilation error. - console.error(`Failed to load external module ${id}: ${err}`); - return undefined; - } - if (raw.__esModule) { - return raw; - } - const ns = {}; - interopEsm(raw, ns, true); - return ns; - } - - function loadChunk(chunkId, chunkPath) { - if (loadedChunks.has(chunkId)) { - return Promise.resolve(); - } - - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); - - return chunkLoader.promise; - } - - function getOrCreateChunkLoader(chunkId, chunkPath) { - let chunkLoader = chunkLoaders.get(chunkId); - if (chunkLoader) { - return chunkLoader; - } - - let resolve; - let reject; - const promise = new Promise((innerResolve, innerReject) => { - resolve = innerResolve; - reject = innerReject; - }); - - const onError = () => { - chunkLoaders.delete(chunkId); - reject(new Error(`Failed to load chunk ${chunkId} from ${chunkPath}`)); - }; - - const onLoad = () => { - chunkLoaders.delete(chunkId); - resolve(); - }; - - chunkLoader = { - promise, - onLoad, - }; - chunkLoaders.set(chunkId, chunkLoader); - - if (chunkPath.endsWith(".css")) { - const link = document.createElement("link"); - link.rel = "stylesheet"; - link.href = chunkPath; - link.onerror = onError; - link.onload = () => { - loadedChunks.add(chunkId); - onLoad(); - }; - document.body.appendChild(link); - } else if (chunkPath.endsWith(".js")) { - const script = document.createElement("script"); - script.src = chunkPath; - // We'll only mark the chunk as loaded once the script has been executed, - // which happens in `registerChunk`. - script.onerror = onError; - document.body.appendChild(script); - } else { - console.error("hello?"); - throw new Error( - `can't infer type of chunk ${chunkId} from path ${chunkPath}` - ); - } - - return chunkLoader; - } - - // TODO(alexkirsz) Use a TS enum. - /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. - */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; - /** - * The module was instantiated because it was included in a chunk's hot module - * update. - */ - const SOURCE_TYPE_UPDATE = 2; - function instantiateModule(id, sourceType, sourceId) { - const moduleFactory = moduleFactories[id]; - if (typeof moduleFactory !== "function") { - // This can happen if modules incorrectly handle HMR disposes/updates, - // e.g. when they keep a `setTimeout` around which still executes old code - // and contains e.g. a `require("something")` call. - let instantiationReason; - switch (sourceType) { - case SOURCE_TYPE_RUNTIME: - instantiationReason = "as a runtime entry"; - break; - case SOURCE_TYPE_PARENT: - instantiationReason = `because it was required from module ${sourceId}`; - break; - case SOURCE_TYPE_UPDATE: - instantiationReason = "because of an HMR update"; - break; - } - throw new Error( - `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available. It might have been deleted in an HMR update.` - ); - } - - const hotData = moduleHotData.get(id); - const { hot, hotState } = createModuleHot(hotData); - - const module = { - exports: {}, - loaded: false, - id, - parents: [], - children: [], - interopNamespace: undefined, - hot, - }; - moduleCache[id] = module; - moduleHotState.set(module, hotState); - - if (sourceType === SOURCE_TYPE_RUNTIME) { - runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { - module.parents.push(sourceId); - - // No need to add this module as a child of the parent module here, this - // has already been taken care of in `getOrInstantiateModuleFromParent`. - } - - runModuleExecutionHooks(module, () => { - moduleFactory.call(module.exports, { - e: module.exports, - r: commonJsRequire.bind(null, module), - x: externalRequire, - i: esmImport.bind(null, module), - s: esm.bind(null, module.exports), - v: exportValue.bind(null, module), - m: module, - c: moduleCache, - l: loadChunk, - p: _process, - }); - }); - - module.loaded = true; - if (module.interopNamespace) { - // in case of a circular dependency: cjs1 -> esm2 -> cjs1 - interopEsm(module.exports, module.interopNamespace); - } - - return module; - } - - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. - function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = - typeof self.$RefreshInterceptModuleExecution$ === "function" - ? self.$RefreshInterceptModuleExecution$(module.id) - : () => {}; - - executeModule(); - - if ("$RefreshHelpers$" in self) { - // This pattern can also be used to register the exports of - // a module with the React Refresh runtime. - registerExportsAndSetupBoundaryForReactRefresh( - module, - self.$RefreshHelpers$ - ); - } - - cleanupReactRefreshIntercept(); - } - - /** - * Retrieves a module from the cache, or instantiate it if it is not cached. - */ - function getOrInstantiateModuleFromParent(id, sourceModule) { - if (!sourceModule.hot.active) { - console.warn( - `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update` - ); - } - - const module = moduleCache[id]; - - if (sourceModule.children.indexOf(id) === -1) { - sourceModule.children.push(id); - } - - if (module) { - if (module.parents.indexOf(sourceModule.id) === -1) { - module.parents.push(sourceModule.id); - } - - return module; - } - - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); - } - - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts - function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { - const currentExports = module.exports; - const prevExports = module.hot.data.prevExports ?? null; - - helpers.registerExportsForReactRefresh(currentExports, module.id); - - // A module can be accepted automatically based on its exports, e.g. when - // it is a Refresh Boundary. - if (helpers.isReactRefreshBoundary(currentExports)) { - // Save the previous exports on update so we can compare the boundary - // signatures. - module.hot.dispose((data) => { - data.prevExports = currentExports; - }); - // Unconditionally accept an update to this module, we'll check if it's - // still a Refresh Boundary later. - module.hot.accept(); - - // This field is set when the previous version of this module was a - // Refresh Boundary, letting us know we need to check for invalidation or - // enqueue an update. - if (prevExports !== null) { - // A boundary can become ineligible if its exports are incompatible - // with the previous exports. - // - // For example, if you add/remove/change exports, we'll want to - // re-execute the importing modules, and force those components to - // re-render. Similarly, if you convert a class component to a - // function, we want to invalidate the boundary. - if ( - helpers.shouldInvalidateReactRefreshBoundary( - prevExports, - currentExports - ) - ) { - module.hot.invalidate(); - } else { - helpers.scheduleUpdate(); - } - } - } else { - // Since we just executed the code for the module, it's possible that the - // new exports made it ineligible for being a boundary. - // We only care about the case when we were _previously_ a boundary, - // because we already accepted this update (accidental side effect). - const isNoLongerABoundary = prevExports !== null; - if (isNoLongerABoundary) { - module.hot.invalidate(); - } - } - } - - function formatDependencyChain(dependencyChain) { - return `Dependency chain: ${dependencyChain.join(" -> ")}`; - } - - function _eval(factory) { - let code = factory.code; - if (factory.map) code += `\n\n//# sourceMappingURL=${factory.map}`; - return eval(code); - } - - function computeOutdatedModules(update) { - const outdatedModules = new Set(); - const newModuleFactories = new Map(); - - for (const [moduleId, factory] of Object.entries(update.added)) { - newModuleFactories.set(moduleId, _eval(factory)); - } - - for (const [moduleId, factory] of Object.entries(update.modified)) { - const effect = getAffectedModuleEffects(moduleId); - - switch (effect.type) { - case "unaccepted": - throw new Error( - `cannot apply update: unaccepted module. ${formatDependencyChain( - effect.dependencyChain - )}.` - ); - case "self-declined": - throw new Error( - `cannot apply update: self-declined module. ${formatDependencyChain( - effect.dependencyChain - )}.` - ); - case "accepted": - newModuleFactories.set(moduleId, _eval(factory)); - for (const outdatedModuleId of effect.outdatedModules) { - outdatedModules.add(outdatedModuleId); - } - break; - // TODO(alexkirsz) Dependencies: handle dependencies effects. - } - } - - return { outdatedModules, newModuleFactories }; - } - - function computeOutdatedSelfAcceptedModules(outdatedModules) { - const outdatedSelfAcceptedModules = []; - for (const moduleId of outdatedModules) { - const module = moduleCache[moduleId]; - const hotState = moduleHotState.get(module); - if (module && hotState.selfAccepted && !hotState.selfInvalidated) { - outdatedSelfAcceptedModules.push({ - moduleId, - errorHandler: hotState.selfAccepted, - }); - } - } - return outdatedSelfAcceptedModules; - } - - function disposePhase(chunkId, outdatedModules, deletedModules) { - for (const moduleId of outdatedModules) { - const module = moduleCache[moduleId]; - if (!module) { - continue; - } - - const data = disposeModule(module); - - moduleHotData.set(moduleId, data); - } - - for (const moduleId of deletedModules) { - const module = moduleCache[moduleId]; - if (!module) { - continue; - } - - const noRemainingChunks = removeModuleFromChunk(moduleId, chunkId); - - if (noRemainingChunks) { - disposeModule(module); - - moduleHotData.delete(moduleId); - } - } - - // TODO(alexkirsz) Dependencies: remove outdated dependency from module - // children. - } - - /** - * Disposes of an instance of a module. - * - * Returns the persistent hot data that should be kept for the next module - * instance. - */ - function disposeModule(module) { - const hotState = moduleHotState.get(module); - const data = {}; - - // Run the `hot.dispose` handler, if any, passing in the persistent - // `hot.data` object. - for (const disposeHandler of hotState.disposeHandlers) { - disposeHandler(data); - } - - // This used to warn in `getOrInstantiateModuleFromParent` when a disposed - // module is still importing other modules. - module.hot.active = false; - - delete moduleCache[module.id]; - moduleHotState.delete(module); - - // TODO(alexkirsz) Dependencies: delete the module from outdated deps. - - // Remove the disposed module from its children's parents list. - // It will be added back once the module re-instantiates and imports its - // children again. - for (const childId of module.children) { - const child = moduleCache[childId]; - if (!child) { - continue; - } - - const idx = child.parents.indexOf(module.id); - if (idx >= 0) { - child.parents.splice(idx, 1); - } - } - - return data; - } - - function applyPhase( - chunkId, - outdatedSelfAcceptedModules, - newModuleFactories - ) { - // Update module factories. - for (const [moduleId, factory] of newModuleFactories.entries()) { - moduleFactories[moduleId] = factory; - addModuleToChunk(moduleId, chunkId); - } - - // TODO(alexkirsz) Run new runtime entries here. - - // TODO(alexkirsz) Dependencies: call accept handlers for outdated deps. - - // Re-instantiate all outdated self-accepted modules. - for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { - try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { - if (typeof errorHandler === "function") { - try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { - // Ignore error. - } - } - } - } - } - - function applyUpdate(chunkId, update) { - const { outdatedModules, newModuleFactories } = - computeOutdatedModules(update); - - const deletedModules = new Set(update.deleted); - - const outdatedSelfAcceptedModules = - computeOutdatedSelfAcceptedModules(outdatedModules); - - disposePhase(chunkId, outdatedModules, deletedModules); - applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); - } - - function getAffectedModuleEffects(moduleId) { - const outdatedModules = new Set(); - - const queue = [ - { - moduleId, - dependencyChain: [], - }, - ]; - - while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); - outdatedModules.add(moduleId); - - // We've arrived at the runtime of the chunk, which means that nothing - // else above can accept this update. - if (moduleId === null) { - return { - type: "unaccepted", - dependencyChain, - moduleId, - }; - } - - const module = moduleCache[moduleId]; - const hotState = moduleHotState.get(module); - - if ( - // The module is not in the cache. Since this is a "modified" update, - // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. - // TODO is that right? - (hotState.selfAccepted && !hotState.selfInvalidated) - ) { - continue; - } - - if (hotState.selfDeclined) { - return { - type: "self-declined", - dependencyChain, - moduleId, - }; - } - - if (runtimeModules.has(moduleId)) { - queue.push({ - moduleId: null, - dependencyChain: [...dependencyChain, moduleId], - }); - continue; - } - - for (const parentId of module.parents) { - const parent = moduleCache[parentId]; - - if (!parent) { - // TODO(alexkirsz) Is this even possible? - continue; - } - - // TODO(alexkirsz) Dependencies: check accepted and declined - // dependencies here. - - queue.push({ - moduleId: parentId, - dependencyChain: [...dependencyChain, moduleId], - }); - } - } - - return { - type: "accepted", - moduleId, - outdatedModules, - }; - } - - function createModuleHot(hotData) { - const hotState = { - selfAccepted: false, - selfDeclined: false, - selfInvalidated: false, - disposeHandlers: [], - }; - - const hot = { - // TODO(alexkirsz) This is not defined in the HMR API. It was used to - // decide whether to warn whenever an HMR-disposed module required other - // modules. We might want to remove it. - active: true, - - data: hotData ?? {}, - - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, - - decline: (dep) => { - if (dep === undefined) { - hotState.selfDeclined = true; - } else { - throw new Error("unsupported `decline` signature"); - } - }, - - dispose: (callback) => { - hotState.disposeHandlers.push(callback); - }, - - addDisposeHandler: (callback) => { - hotState.disposeHandlers.push(callback); - }, - - removeDisposeHandler: (callback) => { - const idx = hotState.disposeHandlers.indexOf(callback); - if (idx >= 0) { - hotState.disposeHandlers.splice(idx, 1); - } - }, - - invalidate: () => { - hotState.selfInvalidated = true; - // TODO(alexkirsz) The original HMR code had management-related code - // here. - }, - - // NOTE(alexkirsz) This is part of the management API, which we don't - // implement, but the Next.js React Refresh runtime uses this to decide - // whether to schedule an update. - status: () => "idle", - }; - - return { hot, hotState }; - } - - /** - * Adds a module to a chunk. - */ - function addModuleToChunk(moduleId, chunkId) { - let moduleChunks = moduleChunksMap.get(moduleId); - if (!moduleChunks) { - moduleChunks = new Set([chunkId]); - moduleChunksMap.set(moduleId, moduleChunks); - } else { - moduleChunks.add(chunkId); - } - } - - /** - * Removes a module from a chunk. Returns true there are no remaining chunks - * including this module. - */ - function removeModuleFromChunk(moduleId, chunkId) { - const moduleChunks = moduleChunksMap.get(moduleId); - moduleChunks.delete(chunkId); - - if (moduleChunks.size > 0) { - return false; - } - - moduleChunksMap.delete(moduleId); - return true; - } - - /** - * Instantiates a runtime module. - */ - function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); - } - - /** - * Subscribes to chunk updates from the update server and applies them. - */ - function subscribeToChunkUpdates(chunkId) { - // This adds a chunk update listener once the handler code has been loaded - self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ - chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, - ]); - } - - function markChunkAsLoaded(chunkId) { - loadedChunks.add(chunkId); - - const chunkLoader = chunkLoaders.get(chunkId); - if (!chunkLoader) { - // This happens for all initial chunks that are loaded directly from - // the HTML. - return; - } - - // Only chunks that are loaded via `loadChunk` will have a loader. - chunkLoader.onLoad(); - } - - const runtime = { - loadedChunks, - modules: moduleFactories, - cache: moduleCache, - instantiateRuntimeModule, - }; - function registerChunk([chunkId, chunkModules, ...run]) { - markChunkAsLoaded(chunkId); - subscribeToChunkUpdates(chunkId); - for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) { - if (!moduleFactories[moduleId]) { - moduleFactories[moduleId] = moduleFactory; - } - addModuleToChunk(moduleId, chunkId); - } - runnable.push(...run); - runnable = runnable.filter((r) => r(runtime)); - } - self.TURBOPACK_CHUNK_UPDATE_LISTENERS = - self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; - self.TURBOPACK = { push: registerChunk }; - chunksToRegister.forEach(registerChunk); -})(); diff --git a/crates/turbopack-ecmascript/js/src/runtime.js b/crates/turbopack-ecmascript/js/src/runtime.js new file mode 100644 index 0000000000000..f93ddd7e75b43 --- /dev/null +++ b/crates/turbopack-ecmascript/js/src/runtime.js @@ -0,0 +1,994 @@ +(() => { + // When a chunk is executed, it will either register itself with the current + // instance of the runtime, or it will push itself onto the list of pending + // chunks (`self.TURBOPACK`). + // + // When the runtime executes, it will pick up and register all pending chunks, + // and replace the list of pending chunks with itself so later chunks can + // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + + if (!Array.isArray(self.TURBOPACK)) { + return; + } + + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; + /** + * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} + */ + const loadedChunks = new Set(); + /** + * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} + */ + const chunkLoaders = new Map(); + /** + * Maps module IDs to persisted data between executions of their hot module + * implementation (`hot.data`). + * + * @type {Map} + */ + const moduleHotData = new Map(); + /** + * Maps module instances to their hot module state. + */ + const moduleHotState = new Map(); + /** + * Module IDs that are instantiated as part of the runtime of a chunk. + */ + const runtimeModules = new Set(); + /** + * Map from module ID to the chunks that contain this module. + * + * In HMR, we need to keep track of which modules are contained in which so + * chunks. This is so we don't eagerly dispose of a module when it is removed + * from chunk A, but still exists in chunk B. + */ + const moduleChunksMap = new Map(); + const hOP = Object.prototype.hasOwnProperty; + const _process = + typeof process !== "undefined" + ? process + : { + env: {}, + // Some modules rely on `process.browser` to execute browser-specific code. + // NOTE: `process.browser` is specific to Webpack. + browser: true, + }; + + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ + function defineProp(obj, name, options) { + if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); + } + + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ + function esm(exports, getters) { + defineProp(exports, "__esModule", { value: true }); + if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); + for (const key in getters) { + defineProp(exports, key, { get: getters[key], enumerable: true }); + } + } + + /** + * @param {Module} module + * @param {any} value + */ + function exportValue(module, value) { + module.exports = value; + } + + /** + * @param {Record} obj + * @param {string} key + */ + function createGetter(obj, key) { + return () => obj[key]; + } + + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ + function interopEsm(raw, ns, allowExportDefault) { + /** @type {Object. any>} */ + const getters = { __proto__: null }; + if (typeof raw === "object" || typeof raw === "function") { + for (const key in raw) { + getters[key] = createGetter(raw, key); + } + } + if (!(allowExportDefault && "default" in getters)) { + getters["default"] = () => raw; + } + esm(ns, getters); + } + + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ + function esmImport(sourceModule, id, allowExportDefault) { + const module = getOrInstantiateModuleFromParent(id, sourceModule); + const raw = module.exports; + if (raw.__esModule) return raw; + if (module.interopNamespace) return module.interopNamespace; + const ns = (module.interopNamespace = {}); + interopEsm(raw, ns, allowExportDefault); + return ns; + } + + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ + function commonJsRequire(sourceModule, id) { + return getOrInstantiateModuleFromParent(id, sourceModule).exports; + } + + function externalRequire(id) { + let raw; + try { + raw = require(id); + } catch (err) { + // TODO(alexkirsz) This can happen when a client-side module tries to load + // an external module we don't provide a shim for (e.g. querystring, url). + // For now, we fail semi-silently, but in the future this should be a + // compilation error. + console.error(`Failed to load external module ${id}: ${err}`); + return undefined; + } + if (raw.__esModule) { + return raw; + } + const ns = {}; + interopEsm(raw, ns, true); + return ns; + } + + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ + function loadChunk(chunkId, chunkPath) { + if (loadedChunks.has(chunkId)) { + return Promise.resolve(); + } + + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + + return chunkLoader.promise; + } + + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ + function getOrCreateChunkLoader(chunkId, chunkPath) { + let chunkLoader = chunkLoaders.get(chunkId); + if (chunkLoader) { + return chunkLoader; + } + + let resolve; + let reject; + const promise = new Promise((innerResolve, innerReject) => { + resolve = innerResolve; + reject = innerReject; + }); + + const onError = () => { + chunkLoaders.delete(chunkId); + reject(new Error(`Failed to load chunk ${chunkId} from ${chunkPath}`)); + }; + + const onLoad = () => { + chunkLoaders.delete(chunkId); + resolve(); + }; + + chunkLoader = { + promise, + onLoad, + }; + chunkLoaders.set(chunkId, chunkLoader); + + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + + if (chunkPath.endsWith(".css")) { + const link = document.createElement("link"); + link.rel = "stylesheet"; + link.href = chunkPath; + link.onerror = onError; + link.onload = () => { + loadedChunks.add(chunkId); + onLoad(); + }; + document.body.appendChild(link); + } else if (chunkPath.endsWith(".js")) { + const script = document.createElement("script"); + script.src = chunkPath; + // We'll only mark the chunk as loaded once the script has been executed, + // which happens in `registerChunk`. + script.onerror = onError; + document.body.appendChild(script); + } else { + console.error("hello?"); + throw new Error( + `can't infer type of chunk ${chunkId} from path ${chunkPath}` + ); + } + + return chunkLoader; + } + + /** + * @enum {number} + */ + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + + /** + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} + */ + function instantiateModule(id, sourceType, sourceId) { + const moduleFactory = moduleFactories[id]; + if (typeof moduleFactory !== "function") { + // This can happen if modules incorrectly handle HMR disposes/updates, + // e.g. when they keep a `setTimeout` around which still executes old code + // and contains e.g. a `require("something")` call. + let instantiationReason; + switch (sourceType) { + case SourceType.Runtime: + instantiationReason = "as a runtime entry"; + break; + case SourceType.Parent: + instantiationReason = `because it was required from module ${sourceId}`; + break; + case SourceType.Update: + instantiationReason = "because of an HMR update"; + break; + } + throw new Error( + `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available. It might have been deleted in an HMR update.` + ); + } + + const hotData = moduleHotData.get(id); + const { hot, hotState } = createModuleHot(hotData); + + /** @type {Module} */ + const module = { + exports: {}, + loaded: false, + id, + parents: [], + children: [], + interopNamespace: undefined, + hot, + }; + moduleCache[id] = module; + moduleHotState.set(module, hotState); + + if (sourceType === SourceType.Runtime) { + runtimeModules.add(id); + } else if (sourceType === SourceType.Parent) { + module.parents.push(sourceId); + + // No need to add this module as a child of the parent module here, this + // has already been taken care of in `getOrInstantiateModuleFromParent`. + } + + runModuleExecutionHooks(module, () => { + moduleFactory.call(module.exports, { + e: module.exports, + r: commonJsRequire.bind(null, module), + x: externalRequire, + i: esmImport.bind(null, module), + s: esm.bind(null, module.exports), + v: exportValue.bind(null, module), + m: module, + c: moduleCache, + l: loadChunk, + p: _process, + }); + }); + + module.loaded = true; + if (module.interopNamespace) { + // in case of a circular dependency: cjs1 -> esm2 -> cjs1 + interopEsm(module.exports, module.interopNamespace); + } + + return module; + } + + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ + function runModuleExecutionHooks(module, executeModule) { + const cleanupReactRefreshIntercept = + typeof self.$RefreshInterceptModuleExecution$ === "function" + ? self.$RefreshInterceptModuleExecution$(module.id) + : () => {}; + + executeModule(); + + if ("$RefreshHelpers$" in self) { + // This pattern can also be used to register the exports of + // a module with the React Refresh runtime. + registerExportsAndSetupBoundaryForReactRefresh( + module, + self.$RefreshHelpers$ + ); + } + + cleanupReactRefreshIntercept(); + } + + /** + * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} + */ + function getOrInstantiateModuleFromParent(id, sourceModule) { + if (!sourceModule.hot.active) { + console.warn( + `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update` + ); + } + + const module = moduleCache[id]; + + if (sourceModule.children.indexOf(id) === -1) { + sourceModule.children.push(id); + } + + if (module) { + if (module.parents.indexOf(sourceModule.id) === -1) { + module.parents.push(sourceModule.id); + } + + return module; + } + + return instantiateModule(id, SourceType.Parent, sourceModule.id); + } + + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ + function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { + const currentExports = module.exports; + const prevExports = module.hot.data.prevExports ?? null; + + helpers.registerExportsForReactRefresh(currentExports, module.id); + + // A module can be accepted automatically based on its exports, e.g. when + // it is a Refresh Boundary. + if (helpers.isReactRefreshBoundary(currentExports)) { + // Save the previous exports on update so we can compare the boundary + // signatures. + module.hot.dispose((data) => { + data.prevExports = currentExports; + }); + // Unconditionally accept an update to this module, we'll check if it's + // still a Refresh Boundary later. + module.hot.accept(); + + // This field is set when the previous version of this module was a + // Refresh Boundary, letting us know we need to check for invalidation or + // enqueue an update. + if (prevExports !== null) { + // A boundary can become ineligible if its exports are incompatible + // with the previous exports. + // + // For example, if you add/remove/change exports, we'll want to + // re-execute the importing modules, and force those components to + // re-render. Similarly, if you convert a class component to a + // function, we want to invalidate the boundary. + if ( + helpers.shouldInvalidateReactRefreshBoundary( + prevExports, + currentExports + ) + ) { + module.hot.invalidate(); + } else { + helpers.scheduleUpdate(); + } + } + } else { + // Since we just executed the code for the module, it's possible that the + // new exports made it ineligible for being a boundary. + // We only care about the case when we were _previously_ a boundary, + // because we already accepted this update (accidental side effect). + const isNoLongerABoundary = prevExports !== null; + if (isNoLongerABoundary) { + module.hot.invalidate(); + } + } + } + + /** + * @param {string[]} dependencyChain + * @returns {string} + */ + function formatDependencyChain(dependencyChain) { + return `Dependency chain: ${dependencyChain.join(" -> ")}`; + } + + function _eval(factory) { + let code = factory.code; + if (factory.map) code += `\n\n//# sourceMappingURL=${factory.map}`; + return eval(code); + } + + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ + function computeOutdatedModules(update) { + const outdatedModules = new Set(); + const newModuleFactories = new Map(); + + for (const [moduleId, factory] of Object.entries(update.added)) { + newModuleFactories.set(moduleId, _eval(factory)); + } + + for (const [moduleId, factory] of Object.entries(update.modified)) { + const effect = getAffectedModuleEffects(moduleId); + + switch (effect.type) { + case "unaccepted": + throw new Error( + `cannot apply update: unaccepted module. ${formatDependencyChain( + effect.dependencyChain + )}.` + ); + case "self-declined": + throw new Error( + `cannot apply update: self-declined module. ${formatDependencyChain( + effect.dependencyChain + )}.` + ); + case "accepted": + newModuleFactories.set(moduleId, _eval(factory)); + for (const outdatedModuleId of effect.outdatedModules) { + outdatedModules.add(outdatedModuleId); + } + break; + // TODO(alexkirsz) Dependencies: handle dependencies effects. + } + } + + return { outdatedModules, newModuleFactories }; + } + + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ + function computeOutdatedSelfAcceptedModules(outdatedModules) { + const outdatedSelfAcceptedModules = []; + for (const moduleId of outdatedModules) { + const module = moduleCache[moduleId]; + const hotState = moduleHotState.get(module); + if (module && hotState.selfAccepted && !hotState.selfInvalidated) { + outdatedSelfAcceptedModules.push({ + moduleId, + errorHandler: hotState.selfAccepted, + }); + } + } + return outdatedSelfAcceptedModules; + } + + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ + function disposePhase(chunkId, outdatedModules, deletedModules) { + for (const moduleId of outdatedModules) { + const module = moduleCache[moduleId]; + if (!module) { + continue; + } + + const data = disposeModule(module); + + moduleHotData.set(moduleId, data); + } + + for (const moduleId of deletedModules) { + const module = moduleCache[moduleId]; + if (!module) { + continue; + } + + const noRemainingChunks = removeModuleFromChunk(moduleId, chunkId); + + if (noRemainingChunks) { + disposeModule(module); + + moduleHotData.delete(moduleId); + } + } + + // TODO(alexkirsz) Dependencies: remove outdated dependency from module + // children. + } + + /** + * Disposes of an instance of a module. + * + * Returns the persistent hot data that should be kept for the next module + * instance. + * + * @param {Module} module + * @returns {{}} + */ + function disposeModule(module) { + const hotState = moduleHotState.get(module); + const data = {}; + + // Run the `hot.dispose` handler, if any, passing in the persistent + // `hot.data` object. + for (const disposeHandler of hotState.disposeHandlers) { + disposeHandler(data); + } + + // This used to warn in `getOrInstantiateModuleFromParent` when a disposed + // module is still importing other modules. + module.hot.active = false; + + delete moduleCache[module.id]; + moduleHotState.delete(module); + + // TODO(alexkirsz) Dependencies: delete the module from outdated deps. + + // Remove the disposed module from its children's parents list. + // It will be added back once the module re-instantiates and imports its + // children again. + for (const childId of module.children) { + const child = moduleCache[childId]; + if (!child) { + continue; + } + + const idx = child.parents.indexOf(module.id); + if (idx >= 0) { + child.parents.splice(idx, 1); + } + } + + return data; + } + + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ + function applyPhase( + chunkId, + outdatedSelfAcceptedModules, + newModuleFactories + ) { + // Update module factories. + for (const [moduleId, factory] of newModuleFactories.entries()) { + moduleFactories[moduleId] = factory; + addModuleToChunk(moduleId, chunkId); + } + + // TODO(alexkirsz) Run new runtime entries here. + + // TODO(alexkirsz) Dependencies: call accept handlers for outdated deps. + + // Re-instantiate all outdated self-accepted modules. + for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { + try { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { + if (typeof errorHandler === "function") { + try { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { + // Ignore error. + } + } + } + } + } + + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ + function applyUpdate(chunkId, update) { + const { outdatedModules, newModuleFactories } = + computeOutdatedModules(update); + + const deletedModules = new Set(update.deleted); + + const outdatedSelfAcceptedModules = + computeOutdatedSelfAcceptedModules(outdatedModules); + + disposePhase(chunkId, outdatedModules, deletedModules); + applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); + } + + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ + function getAffectedModuleEffects(moduleId) { + const outdatedModules = new Set(); + + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ + const queue = [ + { + moduleId, + dependencyChain: [], + }, + ]; + + while (queue.length > 0) { + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); + outdatedModules.add(moduleId); + + // We've arrived at the runtime of the chunk, which means that nothing + // else above can accept this update. + if (moduleId === undefined) { + return { + type: "unaccepted", + dependencyChain, + }; + } + + const module = moduleCache[moduleId]; + const hotState = moduleHotState.get(module); + + if ( + // The module is not in the cache. Since this is a "modified" update, + // it means that the module was never instantiated before. + !module || // The module accepted itself without invalidating itself. + // TODO is that right? + (hotState.selfAccepted && !hotState.selfInvalidated) + ) { + continue; + } + + if (hotState.selfDeclined) { + return { + type: "self-declined", + dependencyChain, + moduleId, + }; + } + + if (runtimeModules.has(moduleId)) { + queue.push({ + moduleId: undefined, + dependencyChain: [...dependencyChain, moduleId], + }); + continue; + } + + for (const parentId of module.parents) { + const parent = moduleCache[parentId]; + + if (!parent) { + // TODO(alexkirsz) Is this even possible? + continue; + } + + // TODO(alexkirsz) Dependencies: check accepted and declined + // dependencies here. + + queue.push({ + moduleId: parentId, + dependencyChain: [...dependencyChain, moduleId], + }); + } + } + + return { + type: "accepted", + moduleId, + outdatedModules, + }; + } + + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ + function createModuleHot(hotData) { + /** @type {HotState} */ + const hotState = { + selfAccepted: false, + selfDeclined: false, + selfInvalidated: false, + disposeHandlers: [], + }; + + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ + const hot = { + // TODO(alexkirsz) This is not defined in the HMR API. It was used to + // decide whether to warn whenever an HMR-disposed module required other + // modules. We might want to remove it. + active: true, + + data: hotData ?? {}, + + accept: accept, + + decline: (dep) => { + if (dep === undefined) { + hotState.selfDeclined = true; + } else { + throw new Error("unsupported `decline` signature"); + } + }, + + dispose: (callback) => { + hotState.disposeHandlers.push(callback); + }, + + addDisposeHandler: (callback) => { + hotState.disposeHandlers.push(callback); + }, + + removeDisposeHandler: (callback) => { + const idx = hotState.disposeHandlers.indexOf(callback); + if (idx >= 0) { + hotState.disposeHandlers.splice(idx, 1); + } + }, + + invalidate: () => { + hotState.selfInvalidated = true; + // TODO(alexkirsz) The original HMR code had management-related code + // here. + }, + + // NOTE(alexkirsz) This is part of the management API, which we don't + // implement, but the Next.js React Refresh runtime uses this to decide + // whether to schedule an update. + status: () => "idle", + }; + + return { hot, hotState }; + } + + /** + * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + */ + function addModuleToChunk(moduleId, chunkId) { + let moduleChunks = moduleChunksMap.get(moduleId); + if (!moduleChunks) { + moduleChunks = new Set([chunkId]); + moduleChunksMap.set(moduleId, moduleChunks); + } else { + moduleChunks.add(chunkId); + } + } + + /** + * Removes a module from a chunk. Returns true there are no remaining chunks + * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} + */ + function removeModuleFromChunk(moduleId, chunkId) { + const moduleChunks = moduleChunksMap.get(moduleId); + moduleChunks.delete(chunkId); + + if (moduleChunks.size > 0) { + return false; + } + + moduleChunksMap.delete(moduleId); + return true; + } + + /** + * Instantiates a runtime module. + */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ + function instantiateRuntimeModule(moduleId) { + return instantiateModule(moduleId, SourceType.Runtime); + } + + /** + * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId + */ + function subscribeToChunkUpdates(chunkId) { + // This adds a chunk update listener once the handler code has been loaded + self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ + chunkId, + handleApply.bind(null, chunkId), + ]); + } + + function markChunkAsLoaded(chunkId) { + loadedChunks.add(chunkId); + + const chunkLoader = chunkLoaders.get(chunkId); + if (!chunkLoader) { + // This happens for all initial chunks that are loaded directly from + // the HTML. + return; + } + + // Only chunks that are loaded via `loadChunk` will have a loader. + chunkLoader.onLoad(); + } + + /** @type {Runtime} */ + const runtime = { + loadedChunks, + modules: moduleFactories, + cache: moduleCache, + instantiateRuntimeModule, + }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ + function registerChunk([chunkId, chunkModules, ...run]) { + markChunkAsLoaded(chunkId); + subscribeToChunkUpdates(chunkId); + for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) { + if (!moduleFactories[moduleId]) { + moduleFactories[moduleId] = moduleFactory; + } + addModuleToChunk(moduleId, chunkId); + } + runnable.push(...run); + runnable = runnable.filter((r) => r(runtime)); + } + + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = + self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; + self.TURBOPACK = { push: registerChunk }; + chunksToRegister.forEach(registerChunk); +})(); diff --git a/crates/turbopack-ecmascript/js/tsconfig.json b/crates/turbopack-ecmascript/js/tsconfig.json new file mode 100644 index 0000000000000..e07dd9e1b83c0 --- /dev/null +++ b/crates/turbopack-ecmascript/js/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + // type checking + "strict": false, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + + // interop constraints + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + + // js support + "allowJs": true, + "checkJs": true, + + // environment + "jsx": "react-jsx", + "lib": ["ESNext", "DOM"], + "target": "esnext", + + // modules + "baseUrl": ".", + "module": "esnext", + "moduleResolution": "node", + "types": ["node"], + + // emit + "noEmit": true, + "stripInternal": true + }, + "include": ["src", "types"] +} diff --git a/crates/turbopack-ecmascript/js/types/hot.d.ts b/crates/turbopack-ecmascript/js/types/hot.d.ts new file mode 100644 index 0000000000000..77d7a17e0717d --- /dev/null +++ b/crates/turbopack-ecmascript/js/types/hot.d.ts @@ -0,0 +1,66 @@ +import { Exports, ModuleFactoryString, ModuleId } from "./index"; + +export const enum HotUpdateStatus { + idle = "idle", + check = "check", + prepare = "prepare", + ready = "ready", + dispose = "dispose", + apply = "apply", + abort = "abort", + fail = "fail", +} + +export interface HotData { + prevExports?: Exports; +} + +export interface HotState { + selfAccepted: boolean | Function; + selfDeclined: boolean; + selfInvalidated: boolean; + disposeHandlers: ((data: object) => void)[]; +} + +export type AcceptErrorHandler = ( + err: Error, + context: { moduleId: ModuleId; dependencyId: string | number } +) => void; +export type AcceptCallback = (outdatedDependencies: string[]) => void; + +export interface AcceptFunction { + // accept updates for self + (errorHandler?: AcceptErrorHandler): void; + + // accept updates for the given modules + ( + modules?: string | string[], + callback?: AcceptCallback, + errorHandler?: AcceptErrorHandler + ): void; +} + +export interface Hot { + active: boolean; + data: HotData; + + status: () => keyof typeof HotUpdateStatus; + + accept: AcceptFunction; + + decline: (module?: string | string[]) => void; + + dispose: (callback: (data: HotData) => void) => void; + + addDisposeHandler: (callback: (data: object) => void) => void; + + removeDisposeHandler: (callback: (data: object) => void) => void; + + invalidate: () => void; +} + +export interface UpdateInstructions { + added: Record; + modified: Record; + deleted: ModuleId[]; +} diff --git a/crates/turbopack-ecmascript/js/types/index.d.ts b/crates/turbopack-ecmascript/js/types/index.d.ts new file mode 100644 index 0000000000000..338a773e08020 --- /dev/null +++ b/crates/turbopack-ecmascript/js/types/index.d.ts @@ -0,0 +1,100 @@ +import { RefreshRuntimeGlobals } from "@next/react-refresh-utils/dist/runtime"; +import { ServerMessage } from "./protocol"; +import { Hot } from "./hot"; + +export type RefreshHelpers = RefreshRuntimeGlobals["$RefreshHelpers$"]; + +type ChunkId = string; +type ModuleId = string; + +interface Chunk {} + +interface Exports { + __esModule?: boolean; + + [key: string]: any; +} + +export type ChunkModule = () => void; +export type Runnable = (...args: any[]) => boolean; +export declare type ChunkRegistration = [ + chunkId: string, + chunkModules: ChunkModule[], + ...run: Runnable[] +]; + +export interface ChunkRegistrations { + push: (registration: ChunkRegistration) => void; +} + +interface Module { + exports: Exports; + loaded: boolean; + id: string; + hot: Hot; + children: ModuleId[]; + parents: ModuleId[]; + interopNamespace?: EsmInteropNamespace; +} + +type ModuleCache = Record; + +type CommonJsRequire = (moduleId: ModuleId) => Exports; + +export type EsmInteropNamespace = Record; +type EsmImport = ( + moduleId: ModuleId, + allowExportDefault: boolean +) => EsmInteropNamespace; +type EsmExport = (exportGetters: Record any>) => void; +type ExportValue = (value: any) => void; + +type LoadFile = (id: ChunkId, path: string) => Promise | undefined; + +interface TurbopackContext { + e: Module["exports"]; + r: CommonJsRequire; + i: EsmImport; + s: EsmExport; + v: ExportValue; + m: Module; + c: ModuleCache; + l: LoadFile; + p: Partial & Pick; +} + +type ModuleFactory = ( + this: Module["exports"], + context: TurbopackContext +) => undefined; + +// string encoding of a module factory (used in hmr updates) +type ModuleFactoryString = string; + +interface Runtime { + loadedChunks: Set; + modules: Record; + cache: Record; + + instantiateRuntimeModule: (moduleId: ModuleId) => Module; +} + +export type ChunkUpdateCallback = (update: ServerMessage) => void; +export type ChunkUpdateProvider = { + push: (registration: [ChunkId, ChunkUpdateCallback]) => void; +}; + +export interface TurbopackGlobals { + TURBOPACK?: ChunkRegistrations | ChunkRegistration[]; + TURBOPACK_CHUNK_UPDATE_LISTENERS?: + | ChunkUpdateProvider + | [ChunkId, ChunkUpdateCallback][]; +} + +declare global { + interface Window extends TurbopackGlobals, RefreshRuntimeGlobals {} + + interface NodeModule { + hot: Hot; + } +} diff --git a/crates/turbopack-ecmascript/js/types/protocol.d.ts b/crates/turbopack-ecmascript/js/types/protocol.d.ts new file mode 100644 index 0000000000000..4d1b046a90bc7 --- /dev/null +++ b/crates/turbopack-ecmascript/js/types/protocol.d.ts @@ -0,0 +1,21 @@ +import { ChunkId } from "./index"; + +export type ServerMessage = { + chunkId: ChunkId; +} & ( + | { + type: "restart"; + } + | { + type: "partial"; + instruction: string; + } + | { + type: "future-type-marker-do-not-use-or-you-will-be-fired"; + } +); + +export type ClientMessage = { + type: "subscribe"; + chunkId: ChunkId; +}; diff --git a/crates/turbopack-ecmascript/js/types/runtime.d.ts b/crates/turbopack-ecmascript/js/types/runtime.d.ts new file mode 100644 index 0000000000000..6d52e5ed7abff --- /dev/null +++ b/crates/turbopack-ecmascript/js/types/runtime.d.ts @@ -0,0 +1,22 @@ +import { ModuleId } from "./index"; + +export interface Loader { + promise: Promise; + onLoad: () => void; +} + +export type ModuleEffect = + | { + type: "unaccepted"; + dependencyChain: ModuleId[]; + } + | { + type: "self-declined"; + dependencyChain: ModuleId[]; + moduleId: ModuleId; + } + | { + type: "accepted"; + moduleId: ModuleId; + outdatedModules: Set; + }; diff --git a/crates/turbopack-ecmascript/package.json b/crates/turbopack-ecmascript/package.json deleted file mode 100644 index e0315cb7174aa..0000000000000 --- a/crates/turbopack-ecmascript/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "@vercel/turbopack-runtime", - "version": "0.0.0", - "description": "turbopack runtime", - "license": "UNLICENSED", - "private": true -} diff --git a/crates/turbopack-ecmascript/src/chunk/mod.rs b/crates/turbopack-ecmascript/src/chunk/mod.rs index 2d7b5396abf3e..baf577afdeaa0 100644 --- a/crates/turbopack-ecmascript/src/chunk/mod.rs +++ b/crates/turbopack-ecmascript/src/chunk/mod.rs @@ -601,7 +601,7 @@ impl EcmascriptChunkContentVc { } code += "]);\n"; if this.evaluate.is_some() { - let runtime_code = embed_file!("js/runtime.js").await?; + let runtime_code = embed_file!("js/src/runtime.js").await?; let runtime_code = match &*runtime_code { FileContent::NotFound => return Err(anyhow!("runtime code is not found")), FileContent::Content(file) => String::from_utf8(file.content().to_vec()) diff --git a/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs b/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs index 564777a28c024..9966ec4c81ac8 100644 --- a/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs +++ b/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs @@ -124,9 +124,13 @@ impl EcmascriptChunkItem for ChunkGroupFilesChunkItem { let mut data = Vec::new(); let base_path = self.inner.await?.base_path.await?; for chunk in chunks.await?.iter() { - let path = &*chunk.path().await?; - if let Some(p) = base_path.get_path_to(path) { - data.push(Value::String(p.to_string())); + let chunk_id = chunk.path().to_string().await?; + let path = chunk.path().await?; + if let Some(p) = base_path.get_path_to(&path) { + data.push(serde_json::json!({ + "path": p, + "chunkId": chunk_id, + })); } } Ok(EcmascriptChunkItemContent { diff --git a/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js b/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js similarity index 74% rename from crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js rename to crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js index 2319981a98ea1..e3a0292e6c33b 100644 --- a/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js +++ b/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js @@ -1,4 +1,4 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js", { "[project]/crates/turbopack/tests/snapshot/integration/async_chunk/input/index.js (ecmascript)": (function({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process, m: module, e: exports }) { !function() { @@ -17,7 +17,7 @@ __turbopack_export_value__((__turbopack_import__) => { }); })()), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_220b53.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_ce7e34.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/async_chunk/input/index.js (ecmascript)"); }]); (() => { @@ -28,25 +28,65 @@ __turbopack_export_value__((__turbopack_import__) => { // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -65,7 +105,7 @@ __turbopack_export_value__((__turbopack_import__) => { * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -76,32 +116,57 @@ __turbopack_export_value__((__turbopack_import__) => { browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -111,16 +176,27 @@ __turbopack_export_value__((__turbopack_import__) => { esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -145,16 +221,26 @@ __turbopack_export_value__((__turbopack_import__) => { return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -184,6 +270,10 @@ __turbopack_export_value__((__turbopack_import__) => { }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -211,21 +301,33 @@ __turbopack_export_value__((__turbopack_import__) => { return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -234,13 +336,13 @@ __turbopack_export_value__((__turbopack_import__) => { // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -252,6 +354,7 @@ __turbopack_export_value__((__turbopack_import__) => { const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -264,9 +367,9 @@ __turbopack_export_value__((__turbopack_import__) => { moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -297,11 +400,16 @@ __turbopack_export_value__((__turbopack_import__) => { return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -322,6 +430,10 @@ __turbopack_export_value__((__turbopack_import__) => { /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -344,10 +456,15 @@ __turbopack_export_value__((__turbopack_import__) => { return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -400,6 +517,10 @@ __turbopack_export_value__((__turbopack_import__) => { } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -410,6 +531,10 @@ __turbopack_export_value__((__turbopack_import__) => { return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -447,6 +572,10 @@ __turbopack_export_value__((__turbopack_import__) => { return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -462,6 +591,11 @@ __turbopack_export_value__((__turbopack_import__) => { return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -498,6 +632,9 @@ __turbopack_export_value__((__turbopack_import__) => { * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -536,6 +673,12 @@ __turbopack_export_value__((__turbopack_import__) => { return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -554,12 +697,12 @@ __turbopack_export_value__((__turbopack_import__) => { // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -567,6 +710,11 @@ __turbopack_export_value__((__turbopack_import__) => { } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -580,9 +728,17 @@ __turbopack_export_value__((__turbopack_import__) => { applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -591,16 +747,16 @@ __turbopack_export_value__((__turbopack_import__) => { ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -610,8 +766,7 @@ __turbopack_export_value__((__turbopack_import__) => { if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -628,7 +783,7 @@ __turbopack_export_value__((__turbopack_import__) => { if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -659,7 +814,29 @@ __turbopack_export_value__((__turbopack_import__) => { }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -667,6 +844,24 @@ __turbopack_export_value__((__turbopack_import__) => { disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -675,16 +870,7 @@ __turbopack_export_value__((__turbopack_import__) => { data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -726,6 +912,9 @@ __turbopack_export_value__((__turbopack_import__) => { /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -740,6 +929,10 @@ __turbopack_export_value__((__turbopack_import__) => { /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -756,29 +949,25 @@ __turbopack_export_value__((__turbopack_import__) => { /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -796,12 +985,17 @@ __turbopack_export_value__((__turbopack_import__) => { chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -814,6 +1008,7 @@ __turbopack_export_value__((__turbopack_import__) => { runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -821,4 +1016,4 @@ __turbopack_export_value__((__turbopack_import__) => { })(); -//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.dec1154e4aeb568a.map \ No newline at end of file +//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.dec1154e4aeb568a.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.42b09e.map b/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.42b09e.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.42b09e.map rename to crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.42b09e.map diff --git a/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.d841e8.map b/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.d841e8.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.d841e8.map rename to crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.d841e8.map diff --git a/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.dec1154e4aeb568a.map b/crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.dec1154e4aeb568a.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_d59edf.js.dec1154e4aeb568a.map rename to crates/turbopack/tests/snapshot/integration/async_chunk/output/crates_turbopack_tests_snapshot_integration_async_chunk_input_index_68ffe6.js.dec1154e4aeb568a.map diff --git a/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js b/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js similarity index 74% rename from crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js rename to crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js index 5e537b080a0ee..13917e2993aa2 100644 --- a/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js +++ b/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js @@ -1,4 +1,4 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js", { "[project]/crates/turbopack/tests/snapshot/integration/chunked/input/index.js (ecmascript)": (({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process }) => (() => { @@ -9,7 +9,7 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ })()), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_b4070f.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/chunked/output/e686c_foo_index.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_e25a7a.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/chunked/output/e686c_foo_index.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/chunked/input/index.js (ecmascript)"); }]); (() => { @@ -20,25 +20,65 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -57,7 +97,7 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -68,32 +108,57 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -103,16 +168,27 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -137,16 +213,26 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -176,6 +262,10 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -203,21 +293,33 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -226,13 +328,13 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -244,6 +346,7 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -256,9 +359,9 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -289,11 +392,16 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -314,6 +422,10 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -336,10 +448,15 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -392,6 +509,10 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -402,6 +523,10 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -439,6 +564,10 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -454,6 +583,11 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -490,6 +624,9 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -528,6 +665,12 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -546,12 +689,12 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -559,6 +702,11 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -572,9 +720,17 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -583,16 +739,16 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -602,8 +758,7 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -620,7 +775,7 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -651,7 +806,29 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -659,6 +836,24 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -667,16 +862,7 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -718,6 +904,9 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -732,6 +921,10 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -748,29 +941,25 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -788,12 +977,17 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -806,6 +1000,7 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -813,4 +1008,4 @@ __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2f$tests$2f$ })(); -//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js.c2afc48f178d7986.map \ No newline at end of file +//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js.c2afc48f178d7986.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js.7c0f67.map b/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js.7c0f67.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js.7c0f67.map rename to crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js.7c0f67.map diff --git a/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js.c2afc48f178d7986.map b/crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js.c2afc48f178d7986.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_1e1c35.js.c2afc48f178d7986.map rename to crates/turbopack/tests/snapshot/integration/chunked/output/crates_turbopack_tests_snapshot_integration_chunked_input_index_3b8211.js.c2afc48f178d7986.map diff --git a/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js b/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js similarity index 74% rename from crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js rename to crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js index eb634841bba23..2b363e33e3407 100644 --- a/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js +++ b/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js @@ -1,4 +1,4 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js", { "[project]/crates/turbopack/tests/snapshot/integration/css/input/index.js (ecmascript)": (({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process }) => (() => { @@ -22,7 +22,7 @@ __turbopack_export_value__({ })()), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_1343d3.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/css/output/a05b1_foo_style.module.css.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_b9feb2.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/css/output/a05b1_foo_style.module.css.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/css/input/index.js (ecmascript)"); }]); (() => { @@ -33,25 +33,65 @@ __turbopack_export_value__({ // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -70,7 +110,7 @@ __turbopack_export_value__({ * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -81,32 +121,57 @@ __turbopack_export_value__({ browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -116,16 +181,27 @@ __turbopack_export_value__({ esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -150,16 +226,26 @@ __turbopack_export_value__({ return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -189,6 +275,10 @@ __turbopack_export_value__({ }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -216,21 +306,33 @@ __turbopack_export_value__({ return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -239,13 +341,13 @@ __turbopack_export_value__({ // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -257,6 +359,7 @@ __turbopack_export_value__({ const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -269,9 +372,9 @@ __turbopack_export_value__({ moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -302,11 +405,16 @@ __turbopack_export_value__({ return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -327,6 +435,10 @@ __turbopack_export_value__({ /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -349,10 +461,15 @@ __turbopack_export_value__({ return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -405,6 +522,10 @@ __turbopack_export_value__({ } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -415,6 +536,10 @@ __turbopack_export_value__({ return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -452,6 +577,10 @@ __turbopack_export_value__({ return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -467,6 +596,11 @@ __turbopack_export_value__({ return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -503,6 +637,9 @@ __turbopack_export_value__({ * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -541,6 +678,12 @@ __turbopack_export_value__({ return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -559,12 +702,12 @@ __turbopack_export_value__({ // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -572,6 +715,11 @@ __turbopack_export_value__({ } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -585,9 +733,17 @@ __turbopack_export_value__({ applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -596,16 +752,16 @@ __turbopack_export_value__({ ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -615,8 +771,7 @@ __turbopack_export_value__({ if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -633,7 +788,7 @@ __turbopack_export_value__({ if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -664,7 +819,29 @@ __turbopack_export_value__({ }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -672,6 +849,24 @@ __turbopack_export_value__({ disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -680,16 +875,7 @@ __turbopack_export_value__({ data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -731,6 +917,9 @@ __turbopack_export_value__({ /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -745,6 +934,10 @@ __turbopack_export_value__({ /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -761,29 +954,25 @@ __turbopack_export_value__({ /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -801,12 +990,17 @@ __turbopack_export_value__({ chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -819,6 +1013,7 @@ __turbopack_export_value__({ runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -826,4 +1021,4 @@ __turbopack_export_value__({ })(); -//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.7c2617b5834079be.map \ No newline at end of file +//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.7c2617b5834079be.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.335b69.map b/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.335b69.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.335b69.map rename to crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.335b69.map diff --git a/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.7c2617b5834079be.map b/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.7c2617b5834079be.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.7c2617b5834079be.map rename to crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.7c2617b5834079be.map diff --git a/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.f9710f.map b/crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.f9710f.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_ed8646.js.f9710f.map rename to crates/turbopack/tests/snapshot/integration/css/output/crates_turbopack_tests_snapshot_integration_css_input_index_e1d7af.js.f9710f.map diff --git a/crates/turbopack/tests/snapshot/integration/env/output/crates_turbopack_tests_snapshot_integration_env_input_72bbc2.js b/crates/turbopack/tests/snapshot/integration/env/output/crates_turbopack_tests_snapshot_integration_env_input_72bbc2.js index b883955ed14cd..3917b948ba32a 100644 --- a/crates/turbopack/tests/snapshot/integration/env/output/crates_turbopack_tests_snapshot_integration_env_input_72bbc2.js +++ b/crates/turbopack/tests/snapshot/integration/env/output/crates_turbopack_tests_snapshot_integration_env_input_72bbc2.js @@ -26,25 +26,65 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -63,7 +103,7 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -74,32 +114,57 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -109,16 +174,27 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -143,16 +219,26 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -182,6 +268,10 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -209,21 +299,33 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -232,13 +334,13 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -250,6 +352,7 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -262,9 +365,9 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -295,11 +398,16 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -320,6 +428,10 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -342,10 +454,15 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -398,6 +515,10 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -408,6 +529,10 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -445,6 +570,10 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -460,6 +589,11 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -496,6 +630,9 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -534,6 +671,12 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -552,12 +695,12 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -565,6 +708,11 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -578,9 +726,17 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -589,16 +745,16 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -608,8 +764,7 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -626,7 +781,7 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -657,7 +812,29 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -665,6 +842,24 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -673,16 +868,7 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -724,6 +910,9 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -738,6 +927,10 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -754,29 +947,25 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -794,12 +983,17 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -812,6 +1006,7 @@ instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/ runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; diff --git a/crates/turbopack/tests/snapshot/integration/example/output/crates_turbopack_tests_snapshot_integration_example_input_index_044eb4.js b/crates/turbopack/tests/snapshot/integration/example/output/crates_turbopack_tests_snapshot_integration_example_input_index_044eb4.js index 555817996672d..2b59bd1b2898a 100644 --- a/crates/turbopack/tests/snapshot/integration/example/output/crates_turbopack_tests_snapshot_integration_example_input_index_044eb4.js +++ b/crates/turbopack/tests/snapshot/integration/example/output/crates_turbopack_tests_snapshot_integration_example_input_index_044eb4.js @@ -17,25 +17,65 @@ console.log("hello world"); // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -54,7 +94,7 @@ console.log("hello world"); * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -65,32 +105,57 @@ console.log("hello world"); browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -100,16 +165,27 @@ console.log("hello world"); esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -134,16 +210,26 @@ console.log("hello world"); return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -173,6 +259,10 @@ console.log("hello world"); }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -200,21 +290,33 @@ console.log("hello world"); return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -223,13 +325,13 @@ console.log("hello world"); // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -241,6 +343,7 @@ console.log("hello world"); const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -253,9 +356,9 @@ console.log("hello world"); moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -286,11 +389,16 @@ console.log("hello world"); return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -311,6 +419,10 @@ console.log("hello world"); /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -333,10 +445,15 @@ console.log("hello world"); return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -389,6 +506,10 @@ console.log("hello world"); } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -399,6 +520,10 @@ console.log("hello world"); return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -436,6 +561,10 @@ console.log("hello world"); return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -451,6 +580,11 @@ console.log("hello world"); return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -487,6 +621,9 @@ console.log("hello world"); * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -525,6 +662,12 @@ console.log("hello world"); return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -543,12 +686,12 @@ console.log("hello world"); // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -556,6 +699,11 @@ console.log("hello world"); } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -569,9 +717,17 @@ console.log("hello world"); applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -580,16 +736,16 @@ console.log("hello world"); ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -599,8 +755,7 @@ console.log("hello world"); if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -617,7 +772,7 @@ console.log("hello world"); if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -648,7 +803,29 @@ console.log("hello world"); }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -656,6 +833,24 @@ console.log("hello world"); disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -664,16 +859,7 @@ console.log("hello world"); data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -715,6 +901,9 @@ console.log("hello world"); /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -729,6 +918,10 @@ console.log("hello world"); /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -745,29 +938,25 @@ console.log("hello world"); /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -785,12 +974,17 @@ console.log("hello world"); chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -803,6 +997,7 @@ console.log("hello world"); runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; diff --git a/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js b/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js similarity index 74% rename from crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js rename to crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js index e4dc5da3ae7ea..2402b35c65118 100644 --- a/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js +++ b/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js @@ -1,4 +1,4 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js", { "[project]/crates/turbopack/tests/snapshot/integration/json/input/index.js (ecmascript)": (({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process }) => (() => { @@ -20,7 +20,7 @@ __turbopack_export_value__(JSON.parse("{\"name\":\"json-snapshot\"}")); throw new Error("An error occurred while importing a JSON module: \"File is not valid JSON\"") })()), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_c1f4d7.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_e6306f.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/json/input/index.js (ecmascript)"); }]); (() => { @@ -31,25 +31,65 @@ throw new Error("An error occurred while importing a JSON module: \"File is not // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -68,7 +108,7 @@ throw new Error("An error occurred while importing a JSON module: \"File is not * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -79,32 +119,57 @@ throw new Error("An error occurred while importing a JSON module: \"File is not browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -114,16 +179,27 @@ throw new Error("An error occurred while importing a JSON module: \"File is not esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -148,16 +224,26 @@ throw new Error("An error occurred while importing a JSON module: \"File is not return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -187,6 +273,10 @@ throw new Error("An error occurred while importing a JSON module: \"File is not }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -214,21 +304,33 @@ throw new Error("An error occurred while importing a JSON module: \"File is not return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -237,13 +339,13 @@ throw new Error("An error occurred while importing a JSON module: \"File is not // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -255,6 +357,7 @@ throw new Error("An error occurred while importing a JSON module: \"File is not const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -267,9 +370,9 @@ throw new Error("An error occurred while importing a JSON module: \"File is not moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -300,11 +403,16 @@ throw new Error("An error occurred while importing a JSON module: \"File is not return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -325,6 +433,10 @@ throw new Error("An error occurred while importing a JSON module: \"File is not /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -347,10 +459,15 @@ throw new Error("An error occurred while importing a JSON module: \"File is not return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -403,6 +520,10 @@ throw new Error("An error occurred while importing a JSON module: \"File is not } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -413,6 +534,10 @@ throw new Error("An error occurred while importing a JSON module: \"File is not return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -450,6 +575,10 @@ throw new Error("An error occurred while importing a JSON module: \"File is not return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -465,6 +594,11 @@ throw new Error("An error occurred while importing a JSON module: \"File is not return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -501,6 +635,9 @@ throw new Error("An error occurred while importing a JSON module: \"File is not * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -539,6 +676,12 @@ throw new Error("An error occurred while importing a JSON module: \"File is not return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -557,12 +700,12 @@ throw new Error("An error occurred while importing a JSON module: \"File is not // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -570,6 +713,11 @@ throw new Error("An error occurred while importing a JSON module: \"File is not } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -583,9 +731,17 @@ throw new Error("An error occurred while importing a JSON module: \"File is not applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -594,16 +750,16 @@ throw new Error("An error occurred while importing a JSON module: \"File is not ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -613,8 +769,7 @@ throw new Error("An error occurred while importing a JSON module: \"File is not if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -631,7 +786,7 @@ throw new Error("An error occurred while importing a JSON module: \"File is not if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -662,7 +817,29 @@ throw new Error("An error occurred while importing a JSON module: \"File is not }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -670,6 +847,24 @@ throw new Error("An error occurred while importing a JSON module: \"File is not disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -678,16 +873,7 @@ throw new Error("An error occurred while importing a JSON module: \"File is not data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -729,6 +915,9 @@ throw new Error("An error occurred while importing a JSON module: \"File is not /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -743,6 +932,10 @@ throw new Error("An error occurred while importing a JSON module: \"File is not /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -759,29 +952,25 @@ throw new Error("An error occurred while importing a JSON module: \"File is not /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -799,12 +988,17 @@ throw new Error("An error occurred while importing a JSON module: \"File is not chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -817,6 +1011,7 @@ throw new Error("An error occurred while importing a JSON module: \"File is not runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -824,4 +1019,4 @@ throw new Error("An error occurred while importing a JSON module: \"File is not })(); -//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.8b66a863c42e8716.map \ No newline at end of file +//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.8b66a863c42e8716.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.597ae8.map b/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.597ae8.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.597ae8.map rename to crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.597ae8.map diff --git a/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.8b66a863c42e8716.map b/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.8b66a863c42e8716.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.8b66a863c42e8716.map rename to crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.8b66a863c42e8716.map diff --git a/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.ad3373.map b/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.ad3373.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.ad3373.map rename to crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.ad3373.map diff --git a/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.c6b79f.map b/crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.c6b79f.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_a640c9.js.c6b79f.map rename to crates/turbopack/tests/snapshot/integration/json/output/crates_turbopack_tests_snapshot_integration_json_input_index_f603a5.js.c6b79f.map diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js similarity index 74% rename from crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js rename to crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js index 708290a7da2f6..a60c1a4f2212d 100644 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js +++ b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js @@ -1,4 +1,4 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js", { "[project]/crates/turbopack/tests/snapshot/integration/mono_transforms/input/packages/app/index.js (ecmascript)": (({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process }) => (() => { @@ -11,7 +11,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ })()), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_b1ceb1.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/4c26b_third_party_component_index.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_component_index.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/4c26b_react_jsx-runtime.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_0eead7.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/4c26b_third_party_component_index.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_component_index.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/4c26b_react_jsx-runtime.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/mono_transforms/input/packages/app/index.js (ecmascript)"); }]); (() => { @@ -22,25 +22,65 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -59,7 +99,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -70,32 +110,57 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -105,16 +170,27 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -139,16 +215,26 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -178,6 +264,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -205,21 +295,33 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -228,13 +330,13 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -246,6 +348,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -258,9 +361,9 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -291,11 +394,16 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -316,6 +424,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -338,10 +450,15 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -394,6 +511,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -404,6 +525,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -441,6 +566,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -456,6 +585,11 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -492,6 +626,9 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -530,6 +667,12 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -548,12 +691,12 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -561,6 +704,11 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -574,9 +722,17 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -585,16 +741,16 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -604,8 +760,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -622,7 +777,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -653,7 +808,29 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -661,6 +838,24 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -669,16 +864,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -720,6 +906,9 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -734,6 +923,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -750,29 +943,25 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -790,12 +979,17 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -808,6 +1002,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -815,4 +1010,4 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ })(); -//# sourceMappingURL=62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js.842bb8af45fc05ec.map \ No newline at end of file +//# sourceMappingURL=62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js.842bb8af45fc05ec.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js.842bb8af45fc05ec.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js.842bb8af45fc05ec.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js.842bb8af45fc05ec.map rename to crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js.842bb8af45fc05ec.map diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js.c6b871.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js.c6b871.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d4a1ca.js.c6b871.map rename to crates/turbopack/tests/snapshot/integration/mono_transforms/output/62d1e_tests_snapshot_integration_mono_transforms_input_packages_app_index_d234db.js.c6b871.map diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js deleted file mode 100644 index 8c5ff05ec08b6..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js +++ /dev/null @@ -1,3041 +0,0 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js", { - -"[project]/node_modules/react/jsx-runtime.js (ecmascript)": (function({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process, m: module, e: exports }) { !function() { - -'use strict'; -if (process.env.NODE_ENV === 'production') { - module.exports = __turbopack_require__("[project]/node_modules/react/cjs/react-jsx-runtime.production.min.js (ecmascript)"); -} else { - module.exports = __turbopack_require__("[project]/node_modules/react/cjs/react-jsx-runtime.development.js (ecmascript)"); -} - -}.call(this) }), -"[project]/node_modules/react/cjs/react-jsx-runtime.production.min.js (ecmascript)": (function({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process, m: module, e: exports }) { !function() { - -'use strict'; -var f = __turbopack_require__("[project]/node_modules/react/index.js (ecmascript)"), k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { - key: !0, - ref: !0, - __self: !0, - __source: !0 -}; -function q(c, a, g) { - var b, d = {}, e = null, h = null; - void 0 !== g && (e = "" + g); - void 0 !== a.key && (e = "" + a.key); - void 0 !== a.ref && (h = a.ref); - for(b in a)m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]); - if (c && c.defaultProps) for(b in a = c.defaultProps, a)void 0 === d[b] && (d[b] = a[b]); - return { - $$typeof: k, - type: c, - key: e, - ref: h, - props: d, - _owner: n.current - }; -} -exports.Fragment = l; -exports.jsx = q; -exports.jsxs = q; - -}.call(this) }), -"[project]/node_modules/react/cjs/react-jsx-runtime.development.js (ecmascript)": (function({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process, m: module, e: exports }) { !function() { - -'use strict'; -if (process.env.NODE_ENV !== "production") { - (function() { - 'use strict'; - var React = __turbopack_require__("[project]/node_modules/react/index.js (ecmascript)"); - var REACT_ELEMENT_TYPE = Symbol.for('react.element'); - var REACT_PORTAL_TYPE = Symbol.for('react.portal'); - var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); - var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); - var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); - var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); - var REACT_CONTEXT_TYPE = Symbol.for('react.context'); - var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); - var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); - var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); - var REACT_MEMO_TYPE = Symbol.for('react.memo'); - var REACT_LAZY_TYPE = Symbol.for('react.lazy'); - var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); - var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - return null; - } - var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - function error(format) { - { - { - for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++){ - args[_key2 - 1] = arguments[_key2]; - } - printWarning('error', format, args); - } - } - } - function printWarning(level, format, args) { - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - if (stack !== '') { - format += '%s'; - args = args.concat([ - stack - ]); - } - var argsWithFormat = args.map(function(item) { - return String(item); - }); - argsWithFormat.unshift('Warning: ' + format); - Function.prototype.apply.call(console[level], console, argsWithFormat); - } - } - var enableScopeAPI = false; - var enableCacheElement = false; - var enableTransitionTracing = false; - var enableLegacyHidden = false; - var enableDebugTracing = false; - var REACT_MODULE_REFERENCE; - { - REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); - } - function isValidElementType(type) { - if (typeof type === 'string' || typeof type === 'function') { - return true; - } - if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) { - return true; - } - if (typeof type === 'object' && type !== null) { - if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { - return true; - } - } - return false; - } - function getWrappedName(outerType, innerType, wrapperName) { - var displayName = outerType.displayName; - if (displayName) { - return displayName; - } - var functionName = innerType.displayName || innerType.name || ''; - return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; - } - function getContextName(type) { - return type.displayName || 'Context'; - } - function getComponentNameFromType(type) { - if (type == null) { - return null; - } - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - if (typeof type === 'string') { - return type; - } - switch(type){ - case REACT_FRAGMENT_TYPE: - return 'Fragment'; - case REACT_PORTAL_TYPE: - return 'Portal'; - case REACT_PROFILER_TYPE: - return 'Profiler'; - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - if (typeof type === 'object') { - switch(type.$$typeof){ - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - case REACT_MEMO_TYPE: - var outerName = type.displayName || null; - if (outerName !== null) { - return outerName; - } - return getComponentNameFromType(type.type) || 'Memo'; - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - try { - return getComponentNameFromType(init(payload)); - } catch (x) { - return null; - } - } - } - } - return null; - } - var assign = Object.assign; - var disabledDepth = 0; - var prevLog; - var prevInfo; - var prevWarn; - var prevError; - var prevGroup; - var prevGroupCollapsed; - var prevGroupEnd; - function disabledLog() {} - disabledLog.__reactDisabledLog = true; - function disableLogs() { - { - if (disabledDepth === 0) { - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - } - disabledDepth++; - } - } - function reenableLogs() { - { - disabledDepth--; - if (disabledDepth === 0) { - var props = { - configurable: true, - enumerable: true, - writable: true - }; - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - } - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } - } - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; - var prefix; - function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } - return '\n' + prefix + name; - } - } - var reentry = false; - var componentFrameCache; - { - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); - } - function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) { - return ''; - } - { - var frame = componentFrameCache.get(fn); - if (frame !== undefined) { - return frame; - } - } - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = undefined; - var previousDispatcher; - { - previousDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = null; - disableLogs(); - } - try { - if (construct) { - var Fake = function() { - throw Error(); - }; - Object.defineProperty(Fake.prototype, 'props', { - set: function() { - throw Error(); - } - }); - if (typeof Reflect === 'object' && Reflect.construct) { - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - fn(); - } - } catch (sample) { - if (sample && control && typeof sample.stack === 'string') { - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - while(s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]){ - c--; - } - for(; s >= 1 && c >= 0; s--, c--){ - if (sampleLines[s] !== controlLines[c]) { - if (s !== 1 || c !== 1) { - do { - s--; - c--; - if (c < 0 || sampleLines[s] !== controlLines[c]) { - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } - return _frame; - } - }while (s >= 1 && c >= 0) - } - break; - } - } - } - } finally{ - reentry = false; - { - ReactCurrentDispatcher.current = previousDispatcher; - reenableLogs(); - } - Error.prepareStackTrace = previousPrepareStackTrace; - } - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - return syntheticFrame; - } - function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } - } - function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); - } - function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - if (type == null) { - return ''; - } - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - switch(type){ - case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame('Suspense'); - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - if (typeof type === 'object') { - switch(type.$$typeof){ - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - case REACT_MEMO_TYPE: - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - try { - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - return ''; - } - var hasOwnProperty = Object.prototype.hasOwnProperty; - var loggedTypeFailures = {}; - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame.setExtraStackFrame(null); - } - } - } - function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - var has = Function.call.bind(hasOwnProperty); - for(var typeSpecName in typeSpecs){ - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; - try { - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - setCurrentlyValidatingElement(null); - } - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - error('Failed %s type: %s', location, error$1.message); - setCurrentlyValidatingElement(null); - } - } - } - } - } - var isArrayImpl = Array.isArray; - function isArray(a) { - return isArrayImpl(a); - } - function typeName(value) { - { - var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; - var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; - return type; - } - } - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - function testStringCoercion(value) { - return '' + value; - } - function checkKeyStringCoercion(value) { - { - if (willCoercionThrow(value)) { - error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); - return testStringCoercion(value); - } - } - } - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; - var RESERVED_PROPS = { - key: true, - ref: true, - __self: true, - __source: true - }; - var specialPropKeyWarningShown; - var specialPropRefWarningShown; - var didWarnAboutStringRefs; - { - didWarnAboutStringRefs = {}; - } - function hasValidRef(config) { - { - if (hasOwnProperty.call(config, 'ref')) { - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; - if (getter && getter.isReactWarning) { - return false; - } - } - } - return config.ref !== undefined; - } - function hasValidKey(config) { - { - if (hasOwnProperty.call(config, 'key')) { - var getter = Object.getOwnPropertyDescriptor(config, 'key').get; - if (getter && getter.isReactWarning) { - return false; - } - } - } - return config.key !== undefined; - } - function warnIfStringRefCannotBeAutoConverted(config, self) { - { - if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) { - var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); - if (!didWarnAboutStringRefs[componentName]) { - error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref); - didWarnAboutStringRefs[componentName] = true; - } - } - } - } - function defineKeyPropWarningGetter(props, displayName) { - { - var warnAboutAccessingKey = function() { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; - error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - }; - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, 'key', { - get: warnAboutAccessingKey, - configurable: true - }); - } - } - function defineRefPropWarningGetter(props, displayName) { - { - var warnAboutAccessingRef = function() { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; - error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - }; - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, 'ref', { - get: warnAboutAccessingRef, - configurable: true - }); - } - } - var ReactElement = function(type, key, ref, self, source, owner, props) { - var element = { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - ref: ref, - props: props, - _owner: owner - }; - { - element._store = {}; - Object.defineProperty(element._store, 'validated', { - configurable: false, - enumerable: false, - writable: true, - value: false - }); - Object.defineProperty(element, '_self', { - configurable: false, - enumerable: false, - writable: false, - value: self - }); - Object.defineProperty(element, '_source', { - configurable: false, - enumerable: false, - writable: false, - value: source - }); - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } - } - return element; - }; - function jsxDEV(type, config, maybeKey, source, self) { - { - var propName; - var props = {}; - var key = null; - var ref = null; - if (maybeKey !== undefined) { - { - checkKeyStringCoercion(maybeKey); - } - key = '' + maybeKey; - } - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key); - } - key = '' + config.key; - } - if (hasValidRef(config)) { - ref = config.ref; - warnIfStringRefCannotBeAutoConverted(config, self); - } - for(propName in config){ - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; - } - } - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - for(propName in defaultProps){ - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - if (key || ref) { - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); - } - } - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; - var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame$1.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame$1.setExtraStackFrame(null); - } - } - } - var propTypesMisspellWarningShown; - { - propTypesMisspellWarningShown = false; - } - function isValidElement(object) { - { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; - } - } - function getDeclarationErrorAddendum() { - { - if (ReactCurrentOwner$1.current) { - var name = getComponentNameFromType(ReactCurrentOwner$1.current.type); - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - return ''; - } - } - function getSourceInfoErrorAddendum(source) { - { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ''); - var lineNumber = source.lineNumber; - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; - } - return ''; - } - } - var ownerHasKeyUseWarning = {}; - function getCurrentComponentErrorInfo(parentType) { - { - var info = getDeclarationErrorAddendum(); - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - if (parentName) { - info = "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - return info; - } - } - function validateExplicitKey(element, parentType) { - { - if (!element._store || element._store.validated || element.key != null) { - return; - } - element._store.validated = true; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; - var childOwner = ''; - if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) { - childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; - } - setCurrentlyValidatingElement$1(element); - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); - setCurrentlyValidatingElement$1(null); - } - } - function validateChildKeys(node, parentType) { - { - if (typeof node !== 'object') { - return; - } - if (isArray(node)) { - for(var i = 0; i < node.length; i++){ - var child = node[i]; - if (isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (isValidElement(node)) { - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - if (typeof iteratorFn === 'function') { - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - while(!(step = iterator.next()).done){ - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } - } - function validatePropTypes(element) { - { - var type = element.type; - if (type === null || type === undefined || typeof type === 'string') { - return; - } - var propTypes; - if (typeof type === 'function') { - propTypes = type.propTypes; - } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) { - propTypes = type.propTypes; - } else { - return; - } - if (propTypes) { - var name = getComponentNameFromType(type); - checkPropTypes(propTypes, element.props, 'prop', name, element); - } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { - propTypesMisspellWarningShown = true; - var _name = getComponentNameFromType(type); - error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); - } - if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { - error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); - } - } - } - function validateFragmentProps(fragment) { - { - var keys = Object.keys(fragment.props); - for(var i = 0; i < keys.length; i++){ - var key = keys[i]; - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement$1(fragment); - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - setCurrentlyValidatingElement$1(null); - break; - } - } - if (fragment.ref !== null) { - setCurrentlyValidatingElement$1(fragment); - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - setCurrentlyValidatingElement$1(null); - } - } - } - function jsxWithValidation(type, props, key, isStaticChildren, source, self) { - { - var validType = isValidElementType(type); - if (!validType) { - var info = ''; - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; - } - var sourceInfo = getSourceInfoErrorAddendum(source); - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - var typeString; - if (type === null) { - typeString = 'null'; - } else if (isArray(type)) { - typeString = 'array'; - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { - typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; - info = ' Did you accidentally export a JSX literal instead of a component?'; - } else { - typeString = typeof type; - } - error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); - } - var element = jsxDEV(type, props, key, source, self); - if (element == null) { - return element; - } - if (validType) { - var children = props.children; - if (children !== undefined) { - if (isStaticChildren) { - if (isArray(children)) { - for(var i = 0; i < children.length; i++){ - validateChildKeys(children[i], type); - } - if (Object.freeze) { - Object.freeze(children); - } - } else { - error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.'); - } - } else { - validateChildKeys(children, type); - } - } - } - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } else { - validatePropTypes(element); - } - return element; - } - } - function jsxWithValidationStatic(type, props, key) { - { - return jsxWithValidation(type, props, key, true); - } - } - function jsxWithValidationDynamic(type, props, key) { - { - return jsxWithValidation(type, props, key, false); - } - } - var jsx = jsxWithValidationDynamic; - var jsxs = jsxWithValidationStatic; - exports.Fragment = REACT_FRAGMENT_TYPE; - exports.jsx = jsx; - exports.jsxs = jsxs; - })(); -} - -}.call(this) }), -"[project]/node_modules/react/index.js (ecmascript)": (function({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process, m: module, e: exports }) { !function() { - -'use strict'; -if (process.env.NODE_ENV === 'production') { - module.exports = __turbopack_require__("[project]/node_modules/react/cjs/react.production.min.js (ecmascript)"); -} else { - module.exports = __turbopack_require__("[project]/node_modules/react/cjs/react.development.js (ecmascript)"); -} - -}.call(this) }), -"[project]/node_modules/react/cjs/react.production.min.js (ecmascript)": (function({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process, m: module, e: exports }) { !function() { - -'use strict'; -var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator; -function A(a) { - if (null === a || "object" !== typeof a) return null; - a = z && a[z] || a["@@iterator"]; - return "function" === typeof a ? a : null; -} -var B = { - isMounted: function() { - return !1; - }, - enqueueForceUpdate: function() {}, - enqueueReplaceState: function() {}, - enqueueSetState: function() {} -}, C = Object.assign, D = {}; -function E(a, b, e) { - this.props = a; - this.context = b; - this.refs = D; - this.updater = e || B; -} -E.prototype.isReactComponent = {}; -E.prototype.setState = function(a, b) { - if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."); - this.updater.enqueueSetState(this, a, b, "setState"); -}; -E.prototype.forceUpdate = function(a) { - this.updater.enqueueForceUpdate(this, a, "forceUpdate"); -}; -function F() {} -F.prototype = E.prototype; -function G(a, b, e) { - this.props = a; - this.context = b; - this.refs = D; - this.updater = e || B; -} -var H = G.prototype = new F; -H.constructor = G; -C(H, E.prototype); -H.isPureReactComponent = !0; -var I = Array.isArray, J = Object.prototype.hasOwnProperty, K = { - current: null -}, L = { - key: !0, - ref: !0, - __self: !0, - __source: !0 -}; -function M(a, b, e) { - var d, c = {}, k = null, h = null; - if (null != b) for(d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b)J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]); - var g = arguments.length - 2; - if (1 === g) c.children = e; - else if (1 < g) { - for(var f = Array(g), m = 0; m < g; m++)f[m] = arguments[m + 2]; - c.children = f; - } - if (a && a.defaultProps) for(d in g = a.defaultProps, g)void 0 === c[d] && (c[d] = g[d]); - return { - $$typeof: l, - type: a, - key: k, - ref: h, - props: c, - _owner: K.current - }; -} -function N(a, b) { - return { - $$typeof: l, - type: a.type, - key: b, - ref: a.ref, - props: a.props, - _owner: a._owner - }; -} -function O(a) { - return "object" === typeof a && null !== a && a.$$typeof === l; -} -function escape(a) { - var b = { - "=": "=0", - ":": "=2" - }; - return "$" + a.replace(/[=:]/g, function(a) { - return b[a]; - }); -} -var P = /\/+/g; -function Q(a, b) { - return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36); -} -function R(a, b, e, d, c) { - var k = typeof a; - if ("undefined" === k || "boolean" === k) a = null; - var h = !1; - if (null === a) h = !0; - else switch(k){ - case "string": - case "number": - h = !0; - break; - case "object": - switch(a.$$typeof){ - case l: - case n: - h = !0; - } - } - if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", function(a) { - return a; - })) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1; - h = 0; - d = "" === d ? "." : d + ":"; - if (I(a)) for(var g = 0; g < a.length; g++){ - k = a[g]; - var f = d + Q(k, g); - h += R(k, b, e, f, c); - } - else if (f = A(a), "function" === typeof f) for(a = f.call(a), g = 0; !(k = a.next()).done;)k = k.value, f = d + Q(k, g++), h += R(k, b, e, f, c); - else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead."); - return h; -} -function S(a, b, e) { - if (null == a) return a; - var d = [], c = 0; - R(a, d, "", "", function(a) { - return b.call(e, a, c++); - }); - return d; -} -function T(a) { - if (-1 === a._status) { - var b = a._result; - b = b(); - b.then(function(b) { - if (0 === a._status || -1 === a._status) a._status = 1, a._result = b; - }, function(b) { - if (0 === a._status || -1 === a._status) a._status = 2, a._result = b; - }); - -1 === a._status && (a._status = 0, a._result = b); - } - if (1 === a._status) return a._result.default; - throw a._result; -} -var U = { - current: null -}, V = { - transition: null -}, W = { - ReactCurrentDispatcher: U, - ReactCurrentBatchConfig: V, - ReactCurrentOwner: K -}; -exports.Children = { - map: S, - forEach: function(a, b, e) { - S(a, function() { - b.apply(this, arguments); - }, e); - }, - count: function(a) { - var b = 0; - S(a, function() { - b++; - }); - return b; - }, - toArray: function(a) { - return S(a, function(a) { - return a; - }) || []; - }, - only: function(a) { - if (!O(a)) throw Error("React.Children.only expected to receive a single React element child."); - return a; - } -}; -exports.Component = E; -exports.Fragment = p; -exports.Profiler = r; -exports.PureComponent = G; -exports.StrictMode = q; -exports.Suspense = w; -exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W; -exports.cloneElement = function(a, b, e) { - if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + "."); - var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner; - if (null != b) { - void 0 !== b.ref && (k = b.ref, h = K.current); - void 0 !== b.key && (c = "" + b.key); - if (a.type && a.type.defaultProps) var g = a.type.defaultProps; - for(f in b)J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]); - } - var f = arguments.length - 2; - if (1 === f) d.children = e; - else if (1 < f) { - g = Array(f); - for(var m = 0; m < f; m++)g[m] = arguments[m + 2]; - d.children = g; - } - return { - $$typeof: l, - type: a.type, - key: c, - ref: k, - props: d, - _owner: h - }; -}; -exports.createContext = function(a) { - a = { - $$typeof: u, - _currentValue: a, - _currentValue2: a, - _threadCount: 0, - Provider: null, - Consumer: null, - _defaultValue: null, - _globalName: null - }; - a.Provider = { - $$typeof: t, - _context: a - }; - return a.Consumer = a; -}; -exports.createElement = M; -exports.createFactory = function(a) { - var b = M.bind(null, a); - b.type = a; - return b; -}; -exports.createRef = function() { - return { - current: null - }; -}; -exports.forwardRef = function(a) { - return { - $$typeof: v, - render: a - }; -}; -exports.isValidElement = O; -exports.lazy = function(a) { - return { - $$typeof: y, - _payload: { - _status: -1, - _result: a - }, - _init: T - }; -}; -exports.memo = function(a, b) { - return { - $$typeof: x, - type: a, - compare: void 0 === b ? null : b - }; -}; -exports.startTransition = function(a) { - var b = V.transition; - V.transition = {}; - try { - a(); - } finally{ - V.transition = b; - } -}; -exports.unstable_act = function() { - throw Error("act(...) is not supported in production builds of React."); -}; -exports.useCallback = function(a, b) { - return U.current.useCallback(a, b); -}; -exports.useContext = function(a) { - return U.current.useContext(a); -}; -exports.useDebugValue = function() {}; -exports.useDeferredValue = function(a) { - return U.current.useDeferredValue(a); -}; -exports.useEffect = function(a, b) { - return U.current.useEffect(a, b); -}; -exports.useId = function() { - return U.current.useId(); -}; -exports.useImperativeHandle = function(a, b, e) { - return U.current.useImperativeHandle(a, b, e); -}; -exports.useInsertionEffect = function(a, b) { - return U.current.useInsertionEffect(a, b); -}; -exports.useLayoutEffect = function(a, b) { - return U.current.useLayoutEffect(a, b); -}; -exports.useMemo = function(a, b) { - return U.current.useMemo(a, b); -}; -exports.useReducer = function(a, b, e) { - return U.current.useReducer(a, b, e); -}; -exports.useRef = function(a) { - return U.current.useRef(a); -}; -exports.useState = function(a) { - return U.current.useState(a); -}; -exports.useSyncExternalStore = function(a, b, e) { - return U.current.useSyncExternalStore(a, b, e); -}; -exports.useTransition = function() { - return U.current.useTransition(); -}; -exports.version = "18.2.0"; - -}.call(this) }), -"[project]/node_modules/react/cjs/react.development.js (ecmascript)": (function({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process, m: module, e: exports }) { !function() { - -'use strict'; -if (process.env.NODE_ENV !== "production") { - (function() { - 'use strict'; - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 'function') { - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); - } - var ReactVersion = '18.2.0'; - var REACT_ELEMENT_TYPE = Symbol.for('react.element'); - var REACT_PORTAL_TYPE = Symbol.for('react.portal'); - var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); - var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); - var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); - var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); - var REACT_CONTEXT_TYPE = Symbol.for('react.context'); - var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); - var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); - var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); - var REACT_MEMO_TYPE = Symbol.for('react.memo'); - var REACT_LAZY_TYPE = Symbol.for('react.lazy'); - var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); - var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - return null; - } - var ReactCurrentDispatcher = { - current: null - }; - var ReactCurrentBatchConfig = { - transition: null - }; - var ReactCurrentActQueue = { - current: null, - isBatchingLegacy: false, - didScheduleLegacyUpdate: false - }; - var ReactCurrentOwner = { - current: null - }; - var ReactDebugCurrentFrame = {}; - var currentExtraStackFrame = null; - function setExtraStackFrame(stack) { - { - currentExtraStackFrame = stack; - } - } - { - ReactDebugCurrentFrame.setExtraStackFrame = function(stack) { - { - currentExtraStackFrame = stack; - } - }; - ReactDebugCurrentFrame.getCurrentStack = null; - ReactDebugCurrentFrame.getStackAddendum = function() { - var stack = ''; - if (currentExtraStackFrame) { - stack += currentExtraStackFrame; - } - var impl = ReactDebugCurrentFrame.getCurrentStack; - if (impl) { - stack += impl() || ''; - } - return stack; - }; - } - var enableScopeAPI = false; - var enableCacheElement = false; - var enableTransitionTracing = false; - var enableLegacyHidden = false; - var enableDebugTracing = false; - var ReactSharedInternals = { - ReactCurrentDispatcher: ReactCurrentDispatcher, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - ReactCurrentOwner: ReactCurrentOwner - }; - { - ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; - ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue; - } - function warn(format) { - { - { - for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){ - args[_key - 1] = arguments[_key]; - } - printWarning('warn', format, args); - } - } - } - function error(format) { - { - { - for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++){ - args[_key2 - 1] = arguments[_key2]; - } - printWarning('error', format, args); - } - } - } - function printWarning(level, format, args) { - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - if (stack !== '') { - format += '%s'; - args = args.concat([ - stack - ]); - } - var argsWithFormat = args.map(function(item) { - return String(item); - }); - argsWithFormat.unshift('Warning: ' + format); - Function.prototype.apply.call(console[level], console, argsWithFormat); - } - } - var didWarnStateUpdateForUnmountedComponent = {}; - function warnNoop(publicInstance, callerName) { - { - var _constructor = publicInstance.constructor; - var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; - var warningKey = componentName + "." + callerName; - if (didWarnStateUpdateForUnmountedComponent[warningKey]) { - return; - } - error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); - didWarnStateUpdateForUnmountedComponent[warningKey] = true; - } - } - var ReactNoopUpdateQueue = { - isMounted: function(publicInstance) { - return false; - }, - enqueueForceUpdate: function(publicInstance, callback, callerName) { - warnNoop(publicInstance, 'forceUpdate'); - }, - enqueueReplaceState: function(publicInstance, completeState, callback, callerName) { - warnNoop(publicInstance, 'replaceState'); - }, - enqueueSetState: function(publicInstance, partialState, callback, callerName) { - warnNoop(publicInstance, 'setState'); - } - }; - var assign = Object.assign; - var emptyObject = {}; - { - Object.freeze(emptyObject); - } - function Component(props, context, updater) { - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - } - Component.prototype.isReactComponent = {}; - Component.prototype.setState = function(partialState, callback) { - if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) { - throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.'); - } - this.updater.enqueueSetState(this, partialState, callback, 'setState'); - }; - Component.prototype.forceUpdate = function(callback) { - this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); - }; - { - var deprecatedAPIs = { - isMounted: [ - 'isMounted', - 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.' - ], - replaceState: [ - 'replaceState', - 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).' - ] - }; - var defineDeprecationWarning = function(methodName, info) { - Object.defineProperty(Component.prototype, methodName, { - get: function() { - warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); - return undefined; - } - }); - }; - for(var fnName in deprecatedAPIs){ - if (deprecatedAPIs.hasOwnProperty(fnName)) { - defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); - } - } - } - function ComponentDummy() {} - ComponentDummy.prototype = Component.prototype; - function PureComponent(props, context, updater) { - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - } - var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); - pureComponentPrototype.constructor = PureComponent; - assign(pureComponentPrototype, Component.prototype); - pureComponentPrototype.isPureReactComponent = true; - function createRef() { - var refObject = { - current: null - }; - { - Object.seal(refObject); - } - return refObject; - } - var isArrayImpl = Array.isArray; - function isArray(a) { - return isArrayImpl(a); - } - function typeName(value) { - { - var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; - var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; - return type; - } - } - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - function testStringCoercion(value) { - return '' + value; - } - function checkKeyStringCoercion(value) { - { - if (willCoercionThrow(value)) { - error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); - return testStringCoercion(value); - } - } - } - function getWrappedName(outerType, innerType, wrapperName) { - var displayName = outerType.displayName; - if (displayName) { - return displayName; - } - var functionName = innerType.displayName || innerType.name || ''; - return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; - } - function getContextName(type) { - return type.displayName || 'Context'; - } - function getComponentNameFromType(type) { - if (type == null) { - return null; - } - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - if (typeof type === 'string') { - return type; - } - switch(type){ - case REACT_FRAGMENT_TYPE: - return 'Fragment'; - case REACT_PORTAL_TYPE: - return 'Portal'; - case REACT_PROFILER_TYPE: - return 'Profiler'; - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - if (typeof type === 'object') { - switch(type.$$typeof){ - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - case REACT_MEMO_TYPE: - var outerName = type.displayName || null; - if (outerName !== null) { - return outerName; - } - return getComponentNameFromType(type.type) || 'Memo'; - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - try { - return getComponentNameFromType(init(payload)); - } catch (x) { - return null; - } - } - } - } - return null; - } - var hasOwnProperty = Object.prototype.hasOwnProperty; - var RESERVED_PROPS = { - key: true, - ref: true, - __self: true, - __source: true - }; - var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; - { - didWarnAboutStringRefs = {}; - } - function hasValidRef(config) { - { - if (hasOwnProperty.call(config, 'ref')) { - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; - if (getter && getter.isReactWarning) { - return false; - } - } - } - return config.ref !== undefined; - } - function hasValidKey(config) { - { - if (hasOwnProperty.call(config, 'key')) { - var getter = Object.getOwnPropertyDescriptor(config, 'key').get; - if (getter && getter.isReactWarning) { - return false; - } - } - } - return config.key !== undefined; - } - function defineKeyPropWarningGetter(props, displayName) { - var warnAboutAccessingKey = function() { - { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; - error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - } - }; - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, 'key', { - get: warnAboutAccessingKey, - configurable: true - }); - } - function defineRefPropWarningGetter(props, displayName) { - var warnAboutAccessingRef = function() { - { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; - error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - } - }; - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, 'ref', { - get: warnAboutAccessingRef, - configurable: true - }); - } - function warnIfStringRefCannotBeAutoConverted(config) { - { - if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { - var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); - if (!didWarnAboutStringRefs[componentName]) { - error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); - didWarnAboutStringRefs[componentName] = true; - } - } - } - } - var ReactElement = function(type, key, ref, self, source, owner, props) { - var element = { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key, - ref: ref, - props: props, - _owner: owner - }; - { - element._store = {}; - Object.defineProperty(element._store, 'validated', { - configurable: false, - enumerable: false, - writable: true, - value: false - }); - Object.defineProperty(element, '_self', { - configurable: false, - enumerable: false, - writable: false, - value: self - }); - Object.defineProperty(element, '_source', { - configurable: false, - enumerable: false, - writable: false, - value: source - }); - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } - } - return element; - }; - function createElement(type, config, children) { - var propName; - var props = {}; - var key = null; - var ref = null; - var self = null; - var source = null; - if (config != null) { - if (hasValidRef(config)) { - ref = config.ref; - { - warnIfStringRefCannotBeAutoConverted(config); - } - } - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key); - } - key = '' + config.key; - } - self = config.__self === undefined ? null : config.__self; - source = config.__source === undefined ? null : config.__source; - for(propName in config){ - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; - } - } - } - var childrenLength = arguments.length - 2; - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - for(var i = 0; i < childrenLength; i++){ - childArray[i] = arguments[i + 2]; - } - { - if (Object.freeze) { - Object.freeze(childArray); - } - } - props.children = childArray; - } - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - for(propName in defaultProps){ - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - { - if (key || ref) { - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - } - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); - } - function cloneAndReplaceKey(oldElement, newKey) { - var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); - return newElement; - } - function cloneElement(element, config, children) { - if (element === null || element === undefined) { - throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); - } - var propName; - var props = assign({}, element.props); - var key = element.key; - var ref = element.ref; - var self = element._self; - var source = element._source; - var owner = element._owner; - if (config != null) { - if (hasValidRef(config)) { - ref = config.ref; - owner = ReactCurrentOwner.current; - } - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key); - } - key = '' + config.key; - } - var defaultProps; - if (element.type && element.type.defaultProps) { - defaultProps = element.type.defaultProps; - } - for(propName in config){ - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - if (config[propName] === undefined && defaultProps !== undefined) { - props[propName] = defaultProps[propName]; - } else { - props[propName] = config[propName]; - } - } - } - } - var childrenLength = arguments.length - 2; - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - for(var i = 0; i < childrenLength; i++){ - childArray[i] = arguments[i + 2]; - } - props.children = childArray; - } - return ReactElement(element.type, key, ref, self, source, owner, props); - } - function isValidElement(object) { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; - } - var SEPARATOR = '.'; - var SUBSEPARATOR = ':'; - function escape(key) { - var escapeRegex = /[=:]/g; - var escaperLookup = { - '=': '=0', - ':': '=2' - }; - var escapedString = key.replace(escapeRegex, function(match) { - return escaperLookup[match]; - }); - return '$' + escapedString; - } - var didWarnAboutMaps = false; - var userProvidedKeyEscapeRegex = /\/+/g; - function escapeUserProvidedKey(text) { - return text.replace(userProvidedKeyEscapeRegex, '$&/'); - } - function getElementKey(element, index) { - if (typeof element === 'object' && element !== null && element.key != null) { - { - checkKeyStringCoercion(element.key); - } - return escape('' + element.key); - } - return index.toString(36); - } - function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { - var type = typeof children; - if (type === 'undefined' || type === 'boolean') { - children = null; - } - var invokeCallback = false; - if (children === null) { - invokeCallback = true; - } else { - switch(type){ - case 'string': - case 'number': - invokeCallback = true; - break; - case 'object': - switch(children.$$typeof){ - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - invokeCallback = true; - } - } - } - if (invokeCallback) { - var _child = children; - var mappedChild = callback(_child); - var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; - if (isArray(mappedChild)) { - var escapedChildKey = ''; - if (childKey != null) { - escapedChildKey = escapeUserProvidedKey(childKey) + '/'; - } - mapIntoArray(mappedChild, array, escapedChildKey, '', function(c) { - return c; - }); - } else if (mappedChild != null) { - if (isValidElement(mappedChild)) { - { - if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { - checkKeyStringCoercion(mappedChild.key); - } - } - mappedChild = cloneAndReplaceKey(mappedChild, escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey); - } - array.push(mappedChild); - } - return 1; - } - var child; - var nextName; - var subtreeCount = 0; - var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; - if (isArray(children)) { - for(var i = 0; i < children.length; i++){ - child = children[i]; - nextName = nextNamePrefix + getElementKey(child, i); - subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); - } - } else { - var iteratorFn = getIteratorFn(children); - if (typeof iteratorFn === 'function') { - var iterableChildren = children; - { - if (iteratorFn === iterableChildren.entries) { - if (!didWarnAboutMaps) { - warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); - } - didWarnAboutMaps = true; - } - } - var iterator = iteratorFn.call(iterableChildren); - var step; - var ii = 0; - while(!(step = iterator.next()).done){ - child = step.value; - nextName = nextNamePrefix + getElementKey(child, ii++); - subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); - } - } else if (type === 'object') { - var childrenString = String(children); - throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.'); - } - } - return subtreeCount; - } - function mapChildren(children, func, context) { - if (children == null) { - return children; - } - var result = []; - var count = 0; - mapIntoArray(children, result, '', '', function(child) { - return func.call(context, child, count++); - }); - return result; - } - function countChildren(children) { - var n = 0; - mapChildren(children, function() { - n++; - }); - return n; - } - function forEachChildren(children, forEachFunc, forEachContext) { - mapChildren(children, function() { - forEachFunc.apply(this, arguments); - }, forEachContext); - } - function toArray(children) { - return mapChildren(children, function(child) { - return child; - }) || []; - } - function onlyChild(children) { - if (!isValidElement(children)) { - throw new Error('React.Children.only expected to receive a single React element child.'); - } - return children; - } - function createContext(defaultValue) { - var context = { - $$typeof: REACT_CONTEXT_TYPE, - _currentValue: defaultValue, - _currentValue2: defaultValue, - _threadCount: 0, - Provider: null, - Consumer: null, - _defaultValue: null, - _globalName: null - }; - context.Provider = { - $$typeof: REACT_PROVIDER_TYPE, - _context: context - }; - var hasWarnedAboutUsingNestedContextConsumers = false; - var hasWarnedAboutUsingConsumerProvider = false; - var hasWarnedAboutDisplayNameOnConsumer = false; - { - var Consumer = { - $$typeof: REACT_CONTEXT_TYPE, - _context: context - }; - Object.defineProperties(Consumer, { - Provider: { - get: function() { - if (!hasWarnedAboutUsingConsumerProvider) { - hasWarnedAboutUsingConsumerProvider = true; - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - return context.Provider; - }, - set: function(_Provider) { - context.Provider = _Provider; - } - }, - _currentValue: { - get: function() { - return context._currentValue; - }, - set: function(_currentValue) { - context._currentValue = _currentValue; - } - }, - _currentValue2: { - get: function() { - return context._currentValue2; - }, - set: function(_currentValue2) { - context._currentValue2 = _currentValue2; - } - }, - _threadCount: { - get: function() { - return context._threadCount; - }, - set: function(_threadCount) { - context._threadCount = _threadCount; - } - }, - Consumer: { - get: function() { - if (!hasWarnedAboutUsingNestedContextConsumers) { - hasWarnedAboutUsingNestedContextConsumers = true; - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - return context.Consumer; - } - }, - displayName: { - get: function() { - return context.displayName; - }, - set: function(displayName) { - if (!hasWarnedAboutDisplayNameOnConsumer) { - warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName); - hasWarnedAboutDisplayNameOnConsumer = true; - } - } - } - }); - context.Consumer = Consumer; - } - { - context._currentRenderer = null; - context._currentRenderer2 = null; - } - return context; - } - var Uninitialized = -1; - var Pending = 0; - var Resolved = 1; - var Rejected = 2; - function lazyInitializer(payload) { - if (payload._status === Uninitialized) { - var ctor = payload._result; - var thenable = ctor(); - thenable.then(function(moduleObject) { - if (payload._status === Pending || payload._status === Uninitialized) { - var resolved = payload; - resolved._status = Resolved; - resolved._result = moduleObject; - } - }, function(error) { - if (payload._status === Pending || payload._status === Uninitialized) { - var rejected = payload; - rejected._status = Rejected; - rejected._result = error; - } - }); - if (payload._status === Uninitialized) { - var pending = payload; - pending._status = Pending; - pending._result = thenable; - } - } - if (payload._status === Resolved) { - var moduleObject = payload._result; - { - if (moduleObject === undefined) { - error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject); - } - } - { - if (!('default' in moduleObject)) { - error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject); - } - } - return moduleObject.default; - } else { - throw payload._result; - } - } - function lazy(ctor) { - var payload = { - _status: Uninitialized, - _result: ctor - }; - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: payload, - _init: lazyInitializer - }; - { - var defaultProps; - var propTypes; - Object.defineProperties(lazyType, { - defaultProps: { - configurable: true, - get: function() { - return defaultProps; - }, - set: function(newDefaultProps) { - error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - defaultProps = newDefaultProps; - Object.defineProperty(lazyType, 'defaultProps', { - enumerable: true - }); - } - }, - propTypes: { - configurable: true, - get: function() { - return propTypes; - }, - set: function(newPropTypes) { - error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - propTypes = newPropTypes; - Object.defineProperty(lazyType, 'propTypes', { - enumerable: true - }); - } - } - }); - } - return lazyType; - } - function forwardRef(render) { - { - if (render != null && render.$$typeof === REACT_MEMO_TYPE) { - error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); - } else if (typeof render !== 'function') { - error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); - } else { - if (render.length !== 0 && render.length !== 2) { - error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); - } - } - if (render != null) { - if (render.defaultProps != null || render.propTypes != null) { - error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); - } - } - } - var elementType = { - $$typeof: REACT_FORWARD_REF_TYPE, - render: render - }; - { - var ownName; - Object.defineProperty(elementType, 'displayName', { - enumerable: false, - configurable: true, - get: function() { - return ownName; - }, - set: function(name) { - ownName = name; - if (!render.name && !render.displayName) { - render.displayName = name; - } - } - }); - } - return elementType; - } - var REACT_MODULE_REFERENCE; - { - REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); - } - function isValidElementType(type) { - if (typeof type === 'string' || typeof type === 'function') { - return true; - } - if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) { - return true; - } - if (typeof type === 'object' && type !== null) { - if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { - return true; - } - } - return false; - } - function memo(type, compare) { - { - if (!isValidElementType(type)) { - error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); - } - } - var elementType = { - $$typeof: REACT_MEMO_TYPE, - type: type, - compare: compare === undefined ? null : compare - }; - { - var ownName; - Object.defineProperty(elementType, 'displayName', { - enumerable: false, - configurable: true, - get: function() { - return ownName; - }, - set: function(name) { - ownName = name; - if (!type.name && !type.displayName) { - type.displayName = name; - } - } - }); - } - return elementType; - } - function resolveDispatcher() { - var dispatcher = ReactCurrentDispatcher.current; - { - if (dispatcher === null) { - error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'); - } - } - return dispatcher; - } - function useContext(Context) { - var dispatcher = resolveDispatcher(); - { - if (Context._context !== undefined) { - var realContext = Context._context; - if (realContext.Consumer === Context) { - error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); - } else if (realContext.Provider === Context) { - error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); - } - } - } - return dispatcher.useContext(Context); - } - function useState(initialState) { - var dispatcher = resolveDispatcher(); - return dispatcher.useState(initialState); - } - function useReducer(reducer, initialArg, init) { - var dispatcher = resolveDispatcher(); - return dispatcher.useReducer(reducer, initialArg, init); - } - function useRef(initialValue) { - var dispatcher = resolveDispatcher(); - return dispatcher.useRef(initialValue); - } - function useEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useEffect(create, deps); - } - function useInsertionEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useInsertionEffect(create, deps); - } - function useLayoutEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useLayoutEffect(create, deps); - } - function useCallback(callback, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useCallback(callback, deps); - } - function useMemo(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useMemo(create, deps); - } - function useImperativeHandle(ref, create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useImperativeHandle(ref, create, deps); - } - function useDebugValue(value, formatterFn) { - { - var dispatcher = resolveDispatcher(); - return dispatcher.useDebugValue(value, formatterFn); - } - } - function useTransition() { - var dispatcher = resolveDispatcher(); - return dispatcher.useTransition(); - } - function useDeferredValue(value) { - var dispatcher = resolveDispatcher(); - return dispatcher.useDeferredValue(value); - } - function useId() { - var dispatcher = resolveDispatcher(); - return dispatcher.useId(); - } - function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var dispatcher = resolveDispatcher(); - return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); - } - var disabledDepth = 0; - var prevLog; - var prevInfo; - var prevWarn; - var prevError; - var prevGroup; - var prevGroupCollapsed; - var prevGroupEnd; - function disabledLog() {} - disabledLog.__reactDisabledLog = true; - function disableLogs() { - { - if (disabledDepth === 0) { - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - } - disabledDepth++; - } - } - function reenableLogs() { - { - disabledDepth--; - if (disabledDepth === 0) { - var props = { - configurable: true, - enumerable: true, - writable: true - }; - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - } - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } - } - var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; - var prefix; - function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } - return '\n' + prefix + name; - } - } - var reentry = false; - var componentFrameCache; - { - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); - } - function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) { - return ''; - } - { - var frame = componentFrameCache.get(fn); - if (frame !== undefined) { - return frame; - } - } - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = undefined; - var previousDispatcher; - { - previousDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = null; - disableLogs(); - } - try { - if (construct) { - var Fake = function() { - throw Error(); - }; - Object.defineProperty(Fake.prototype, 'props', { - set: function() { - throw Error(); - } - }); - if (typeof Reflect === 'object' && Reflect.construct) { - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - fn(); - } - } catch (sample) { - if (sample && control && typeof sample.stack === 'string') { - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - while(s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]){ - c--; - } - for(; s >= 1 && c >= 0; s--, c--){ - if (sampleLines[s] !== controlLines[c]) { - if (s !== 1 || c !== 1) { - do { - s--; - c--; - if (c < 0 || sampleLines[s] !== controlLines[c]) { - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } - return _frame; - } - }while (s >= 1 && c >= 0) - } - break; - } - } - } - } finally{ - reentry = false; - { - ReactCurrentDispatcher$1.current = previousDispatcher; - reenableLogs(); - } - Error.prepareStackTrace = previousPrepareStackTrace; - } - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - return syntheticFrame; - } - function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } - } - function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); - } - function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - if (type == null) { - return ''; - } - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - switch(type){ - case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame('Suspense'); - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - if (typeof type === 'object') { - switch(type.$$typeof){ - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - case REACT_MEMO_TYPE: - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - try { - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - return ''; - } - var loggedTypeFailures = {}; - var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame$1.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame$1.setExtraStackFrame(null); - } - } - } - function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - var has = Function.call.bind(hasOwnProperty); - for(var typeSpecName in typeSpecs){ - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; - try { - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - setCurrentlyValidatingElement(null); - } - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - error('Failed %s type: %s', location, error$1.message); - setCurrentlyValidatingElement(null); - } - } - } - } - } - function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - setExtraStackFrame(stack); - } else { - setExtraStackFrame(null); - } - } - } - var propTypesMisspellWarningShown; - { - propTypesMisspellWarningShown = false; - } - function getDeclarationErrorAddendum() { - if (ReactCurrentOwner.current) { - var name = getComponentNameFromType(ReactCurrentOwner.current.type); - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - return ''; - } - function getSourceInfoErrorAddendum(source) { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ''); - var lineNumber = source.lineNumber; - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; - } - return ''; - } - function getSourceInfoErrorAddendumForProps(elementProps) { - if (elementProps !== null && elementProps !== undefined) { - return getSourceInfoErrorAddendum(elementProps.__source); - } - return ''; - } - var ownerHasKeyUseWarning = {}; - function getCurrentComponentErrorInfo(parentType) { - var info = getDeclarationErrorAddendum(); - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - if (parentName) { - info = "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - return info; - } - function validateExplicitKey(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - element._store.validated = true; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; - var childOwner = ''; - if (element && element._owner && element._owner !== ReactCurrentOwner.current) { - childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; - } - { - setCurrentlyValidatingElement$1(element); - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); - setCurrentlyValidatingElement$1(null); - } - } - function validateChildKeys(node, parentType) { - if (typeof node !== 'object') { - return; - } - if (isArray(node)) { - for(var i = 0; i < node.length; i++){ - var child = node[i]; - if (isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (isValidElement(node)) { - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - if (typeof iteratorFn === 'function') { - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - while(!(step = iterator.next()).done){ - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } - function validatePropTypes(element) { - { - var type = element.type; - if (type === null || type === undefined || typeof type === 'string') { - return; - } - var propTypes; - if (typeof type === 'function') { - propTypes = type.propTypes; - } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) { - propTypes = type.propTypes; - } else { - return; - } - if (propTypes) { - var name = getComponentNameFromType(type); - checkPropTypes(propTypes, element.props, 'prop', name, element); - } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { - propTypesMisspellWarningShown = true; - var _name = getComponentNameFromType(type); - error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); - } - if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { - error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); - } - } - } - function validateFragmentProps(fragment) { - { - var keys = Object.keys(fragment.props); - for(var i = 0; i < keys.length; i++){ - var key = keys[i]; - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement$1(fragment); - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - setCurrentlyValidatingElement$1(null); - break; - } - } - if (fragment.ref !== null) { - setCurrentlyValidatingElement$1(fragment); - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - setCurrentlyValidatingElement$1(null); - } - } - } - function createElementWithValidation(type, props, children) { - var validType = isValidElementType(type); - if (!validType) { - var info = ''; - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; - } - var sourceInfo = getSourceInfoErrorAddendumForProps(props); - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - var typeString; - if (type === null) { - typeString = 'null'; - } else if (isArray(type)) { - typeString = 'array'; - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { - typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; - info = ' Did you accidentally export a JSX literal instead of a component?'; - } else { - typeString = typeof type; - } - { - error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); - } - } - var element = createElement.apply(this, arguments); - if (element == null) { - return element; - } - if (validType) { - for(var i = 2; i < arguments.length; i++){ - validateChildKeys(arguments[i], type); - } - } - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } else { - validatePropTypes(element); - } - return element; - } - var didWarnAboutDeprecatedCreateFactory = false; - function createFactoryWithValidation(type) { - var validatedFactory = createElementWithValidation.bind(null, type); - validatedFactory.type = type; - { - if (!didWarnAboutDeprecatedCreateFactory) { - didWarnAboutDeprecatedCreateFactory = true; - warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); - } - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - get: function() { - warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); - Object.defineProperty(this, 'type', { - value: type - }); - return type; - } - }); - } - return validatedFactory; - } - function cloneElementWithValidation(element, props, children) { - var newElement = cloneElement.apply(this, arguments); - for(var i = 2; i < arguments.length; i++){ - validateChildKeys(arguments[i], newElement.type); - } - validatePropTypes(newElement); - return newElement; - } - function startTransition(scope, options) { - var prevTransition = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = {}; - var currentTransition = ReactCurrentBatchConfig.transition; - { - ReactCurrentBatchConfig.transition._updatedFibers = new Set(); - } - try { - scope(); - } finally{ - ReactCurrentBatchConfig.transition = prevTransition; - { - if (prevTransition === null && currentTransition._updatedFibers) { - var updatedFibersCount = currentTransition._updatedFibers.size; - if (updatedFibersCount > 10) { - warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.'); - } - currentTransition._updatedFibers.clear(); - } - } - } - } - var didWarnAboutMessageChannel = false; - var enqueueTaskImpl = null; - function enqueueTask(task) { - if (enqueueTaskImpl === null) { - try { - var requireString = ('require' + Math.random()).slice(0, 7); - var nodeRequire = module && module[requireString]; - enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate; - } catch (_err) { - enqueueTaskImpl = function(callback) { - { - if (didWarnAboutMessageChannel === false) { - didWarnAboutMessageChannel = true; - if (typeof MessageChannel === 'undefined') { - error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); - } - } - } - var channel = new MessageChannel(); - channel.port1.onmessage = callback; - channel.port2.postMessage(undefined); - }; - } - } - return enqueueTaskImpl(task); - } - var actScopeDepth = 0; - var didWarnNoAwaitAct = false; - function act(callback) { - { - var prevActScopeDepth = actScopeDepth; - actScopeDepth++; - if (ReactCurrentActQueue.current === null) { - ReactCurrentActQueue.current = []; - } - var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy; - var result; - try { - ReactCurrentActQueue.isBatchingLegacy = true; - result = callback(); - if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) { - var queue = ReactCurrentActQueue.current; - if (queue !== null) { - ReactCurrentActQueue.didScheduleLegacyUpdate = false; - flushActQueue(queue); - } - } - } catch (error) { - popActScope(prevActScopeDepth); - throw error; - } finally{ - ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; - } - if (result !== null && typeof result === 'object' && typeof result.then === 'function') { - var thenableResult = result; - var wasAwaited = false; - var thenable = { - then: function(resolve, reject) { - wasAwaited = true; - thenableResult.then(function(returnValue) { - popActScope(prevActScopeDepth); - if (actScopeDepth === 0) { - recursivelyFlushAsyncActWork(returnValue, resolve, reject); - } else { - resolve(returnValue); - } - }, function(error) { - popActScope(prevActScopeDepth); - reject(error); - }); - } - }; - { - if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') { - Promise.resolve().then(function() {}).then(function() { - if (!wasAwaited) { - didWarnNoAwaitAct = true; - error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);'); - } - }); - } - } - return thenable; - } else { - var returnValue = result; - popActScope(prevActScopeDepth); - if (actScopeDepth === 0) { - var _queue = ReactCurrentActQueue.current; - if (_queue !== null) { - flushActQueue(_queue); - ReactCurrentActQueue.current = null; - } - var _thenable = { - then: function(resolve, reject) { - if (ReactCurrentActQueue.current === null) { - ReactCurrentActQueue.current = []; - recursivelyFlushAsyncActWork(returnValue, resolve, reject); - } else { - resolve(returnValue); - } - } - }; - return _thenable; - } else { - var _thenable2 = { - then: function(resolve, reject) { - resolve(returnValue); - } - }; - return _thenable2; - } - } - } - } - function popActScope(prevActScopeDepth) { - { - if (prevActScopeDepth !== actScopeDepth - 1) { - error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); - } - actScopeDepth = prevActScopeDepth; - } - } - function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { - { - var queue = ReactCurrentActQueue.current; - if (queue !== null) { - try { - flushActQueue(queue); - enqueueTask(function() { - if (queue.length === 0) { - ReactCurrentActQueue.current = null; - resolve(returnValue); - } else { - recursivelyFlushAsyncActWork(returnValue, resolve, reject); - } - }); - } catch (error) { - reject(error); - } - } else { - resolve(returnValue); - } - } - } - var isFlushing = false; - function flushActQueue(queue) { - { - if (!isFlushing) { - isFlushing = true; - var i = 0; - try { - for(; i < queue.length; i++){ - var callback = queue[i]; - do { - callback = callback(true); - }while (callback !== null) - } - queue.length = 0; - } catch (error) { - queue = queue.slice(i + 1); - throw error; - } finally{ - isFlushing = false; - } - } - } - } - var createElement$1 = createElementWithValidation; - var cloneElement$1 = cloneElementWithValidation; - var createFactory = createFactoryWithValidation; - var Children = { - map: mapChildren, - forEach: forEachChildren, - count: countChildren, - toArray: toArray, - only: onlyChild - }; - exports.Children = Children; - exports.Component = Component; - exports.Fragment = REACT_FRAGMENT_TYPE; - exports.Profiler = REACT_PROFILER_TYPE; - exports.PureComponent = PureComponent; - exports.StrictMode = REACT_STRICT_MODE_TYPE; - exports.Suspense = REACT_SUSPENSE_TYPE; - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; - exports.cloneElement = cloneElement$1; - exports.createContext = createContext; - exports.createElement = createElement$1; - exports.createFactory = createFactory; - exports.createRef = createRef; - exports.forwardRef = forwardRef; - exports.isValidElement = isValidElement; - exports.lazy = lazy; - exports.memo = memo; - exports.startTransition = startTransition; - exports.unstable_act = act; - exports.useCallback = useCallback; - exports.useContext = useContext; - exports.useDebugValue = useDebugValue; - exports.useDeferredValue = useDeferredValue; - exports.useEffect = useEffect; - exports.useId = useId; - exports.useImperativeHandle = useImperativeHandle; - exports.useInsertionEffect = useInsertionEffect; - exports.useLayoutEffect = useLayoutEffect; - exports.useMemo = useMemo; - exports.useReducer = useReducer; - exports.useRef = useRef; - exports.useState = useState; - exports.useSyncExternalStore = useSyncExternalStore; - exports.useTransition = useTransition; - exports.version = ReactVersion; - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 'function') { - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); - } - })(); -} - -}.call(this) }), -}]); - - -//# sourceMappingURL=node_modules_react_jsx-runtime.js.c9fcbf31c9ecc116.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.09926b.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.09926b.map deleted file mode 100644 index 24ce12a2fbf93..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.09926b.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/cjs/react-jsx-runtime.production.min.js"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n"],"names":[],"mappings":"AASA;AAAa,IAAI,IAAE,6EAAiB,IAAE,OAAO,GAAG,CAAC,kBAAiB,IAAE,OAAO,GAAG,CAAC,mBAAkB,IAAE,OAAO,SAAS,CAAC,cAAc,EAAC,IAAE,EAAE,kDAAkD,CAAC,iBAAiB,EAAC,IAAE;IAAC,KAAI,CAAC;IAAE,KAAI,CAAC;IAAE,QAAO,CAAC;IAAE,UAAS,CAAC;AAAC;AAClP,SAAS,EAAE,CAAC,EAAC,CAAC,EAAC,CAAC,EAAC;IAAC,IAAI,GAAE,IAAE,CAAC,GAAE,IAAE,IAAI,EAAC,IAAE,IAAI;IAAC,KAAK,MAAI,KAAG,CAAC,IAAE,KAAG,CAAC;IAAE,KAAK,MAAI,EAAE,GAAG,IAAE,CAAC,IAAE,KAAG,EAAE,GAAG;IAAE,KAAK,MAAI,EAAE,GAAG,IAAE,CAAC,IAAE,EAAE,GAAG;IAAE,IAAI,KAAK,EAAE,EAAE,IAAI,CAAC,GAAE,MAAI,CAAC,EAAE,cAAc,CAAC,MAAI,CAAC,CAAC,CAAC,EAAE,GAAC,CAAC,CAAC,EAAE;IAAE,IAAG,KAAG,EAAE,YAAY,EAAC,IAAI,KAAK,IAAE,EAAE,YAAY,EAAC,CAAC,CAAC,KAAK,MAAI,CAAC,CAAC,EAAE,IAAE,CAAC,CAAC,CAAC,EAAE,GAAC,CAAC,CAAC,EAAE;IAAE,OAAM;QAAC,UAAS;QAAE,MAAK;QAAE,KAAI;QAAE,KAAI;QAAE,OAAM;QAAE,QAAO,EAAE,OAAO;IAAA;AAAC;AAAC,QAAQ,QAAQ,GAAC;AAAE,QAAQ,GAAG,GAAC;AAAE,QAAQ,IAAI,GAAC"}}, - {"offset": {"line": 28, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] -} \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.678978.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.678978.map deleted file mode 100644 index 5a62da218917b..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.678978.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react.production.min.js');\n} else {\n module.exports = require('./cjs/react.development.js');\n}\n"],"names":[],"mappings":"AAAA;AAEA,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;IACzC,OAAO,OAAO,GAAG;AACnB,OAAO;IACL,OAAO,OAAO,GAAG;AACnB,CAAC"}}, - {"offset": {"line": 8, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] -} \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.7bc78e.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.7bc78e.map deleted file mode 100644 index f5cf51b19d895..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.7bc78e.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/cjs/react.development.js"],"sourcesContent":["/**\n * @license React\n * react.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var ReactVersion = '18.2.0';\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\n/**\n * Keeps track of the current dispatcher.\n */\nvar ReactCurrentDispatcher = {\n /**\n * @internal\n * @type {ReactComponent}\n */\n current: null\n};\n\n/**\n * Keeps track of the current batch's configuration such as how long an update\n * should suspend for if it needs to.\n */\nvar ReactCurrentBatchConfig = {\n transition: null\n};\n\nvar ReactCurrentActQueue = {\n current: null,\n // Used to reproduce behavior of `batchedUpdates` in legacy mode.\n isBatchingLegacy: false,\n didScheduleLegacyUpdate: false\n};\n\n/**\n * Keeps track of the current owner.\n *\n * The current owner is the component who should own any components that are\n * currently being constructed.\n */\nvar ReactCurrentOwner = {\n /**\n * @internal\n * @type {ReactComponent}\n */\n current: null\n};\n\nvar ReactDebugCurrentFrame = {};\nvar currentExtraStackFrame = null;\nfunction setExtraStackFrame(stack) {\n {\n currentExtraStackFrame = stack;\n }\n}\n\n{\n ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {\n {\n currentExtraStackFrame = stack;\n }\n }; // Stack implementation injected by the current renderer.\n\n\n ReactDebugCurrentFrame.getCurrentStack = null;\n\n ReactDebugCurrentFrame.getStackAddendum = function () {\n var stack = ''; // Add an extra top frame while an element is being validated\n\n if (currentExtraStackFrame) {\n stack += currentExtraStackFrame;\n } // Delegate to the injected renderer-specific implementation\n\n\n var impl = ReactDebugCurrentFrame.getCurrentStack;\n\n if (impl) {\n stack += impl() || '';\n }\n\n return stack;\n };\n}\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar ReactSharedInternals = {\n ReactCurrentDispatcher: ReactCurrentDispatcher,\n ReactCurrentBatchConfig: ReactCurrentBatchConfig,\n ReactCurrentOwner: ReactCurrentOwner\n};\n\n{\n ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;\n ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;\n}\n\n// by calls to these methods by a Babel plugin.\n//\n// In PROD (or in packages without access to React internals),\n// they are left as they are instead.\n\nfunction warn(format) {\n {\n {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n printWarning('warn', format, args);\n }\n }\n}\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\nvar didWarnStateUpdateForUnmountedComponent = {};\n\nfunction warnNoop(publicInstance, callerName) {\n {\n var _constructor = publicInstance.constructor;\n var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';\n var warningKey = componentName + \".\" + callerName;\n\n if (didWarnStateUpdateForUnmountedComponent[warningKey]) {\n return;\n }\n\n error(\"Can't call %s on a component that is not yet mounted. \" + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);\n\n didWarnStateUpdateForUnmountedComponent[warningKey] = true;\n }\n}\n/**\n * This is the abstract API for an update queue.\n */\n\n\nvar ReactNoopUpdateQueue = {\n /**\n * Checks whether or not this composite component is mounted.\n * @param {ReactClass} publicInstance The instance we want to test.\n * @return {boolean} True if mounted, false otherwise.\n * @protected\n * @final\n */\n isMounted: function (publicInstance) {\n return false;\n },\n\n /**\n * Forces an update. This should only be invoked when it is known with\n * certainty that we are **not** in a DOM transaction.\n *\n * You may want to call this when you know that some deeper aspect of the\n * component's state has changed but `setState` was not called.\n *\n * This will not invoke `shouldComponentUpdate`, but it will invoke\n * `componentWillUpdate` and `componentDidUpdate`.\n *\n * @param {ReactClass} publicInstance The instance that should rerender.\n * @param {?function} callback Called after component is updated.\n * @param {?string} callerName name of the calling function in the public API.\n * @internal\n */\n enqueueForceUpdate: function (publicInstance, callback, callerName) {\n warnNoop(publicInstance, 'forceUpdate');\n },\n\n /**\n * Replaces all of the state. Always use this or `setState` to mutate state.\n * You should treat `this.state` as immutable.\n *\n * There is no guarantee that `this.state` will be immediately updated, so\n * accessing `this.state` after calling this method may return the old value.\n *\n * @param {ReactClass} publicInstance The instance that should rerender.\n * @param {object} completeState Next state.\n * @param {?function} callback Called after component is updated.\n * @param {?string} callerName name of the calling function in the public API.\n * @internal\n */\n enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {\n warnNoop(publicInstance, 'replaceState');\n },\n\n /**\n * Sets a subset of the state. This only exists because _pendingState is\n * internal. This provides a merging strategy that is not available to deep\n * properties which is confusing. TODO: Expose pendingState or don't use it\n * during the merge.\n *\n * @param {ReactClass} publicInstance The instance that should rerender.\n * @param {object} partialState Next partial state to be merged with state.\n * @param {?function} callback Called after component is updated.\n * @param {?string} Name of the calling function in the public API.\n * @internal\n */\n enqueueSetState: function (publicInstance, partialState, callback, callerName) {\n warnNoop(publicInstance, 'setState');\n }\n};\n\nvar assign = Object.assign;\n\nvar emptyObject = {};\n\n{\n Object.freeze(emptyObject);\n}\n/**\n * Base class helpers for the updating state of a component.\n */\n\n\nfunction Component(props, context, updater) {\n this.props = props;\n this.context = context; // If a component has string refs, we will assign a different object later.\n\n this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the\n // renderer.\n\n this.updater = updater || ReactNoopUpdateQueue;\n}\n\nComponent.prototype.isReactComponent = {};\n/**\n * Sets a subset of the state. Always use this to mutate\n * state. You should treat `this.state` as immutable.\n *\n * There is no guarantee that `this.state` will be immediately updated, so\n * accessing `this.state` after calling this method may return the old value.\n *\n * There is no guarantee that calls to `setState` will run synchronously,\n * as they may eventually be batched together. You can provide an optional\n * callback that will be executed when the call to setState is actually\n * completed.\n *\n * When a function is provided to setState, it will be called at some point in\n * the future (not synchronously). It will be called with the up to date\n * component arguments (state, props, context). These values can be different\n * from this.* because your function may be called after receiveProps but before\n * shouldComponentUpdate, and this new state, props, and context will not yet be\n * assigned to this.\n *\n * @param {object|function} partialState Next partial state or function to\n * produce next partial state to be merged with current state.\n * @param {?function} callback Called after state is updated.\n * @final\n * @protected\n */\n\nComponent.prototype.setState = function (partialState, callback) {\n if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {\n throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');\n }\n\n this.updater.enqueueSetState(this, partialState, callback, 'setState');\n};\n/**\n * Forces an update. This should only be invoked when it is known with\n * certainty that we are **not** in a DOM transaction.\n *\n * You may want to call this when you know that some deeper aspect of the\n * component's state has changed but `setState` was not called.\n *\n * This will not invoke `shouldComponentUpdate`, but it will invoke\n * `componentWillUpdate` and `componentDidUpdate`.\n *\n * @param {?function} callback Called after update is complete.\n * @final\n * @protected\n */\n\n\nComponent.prototype.forceUpdate = function (callback) {\n this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');\n};\n/**\n * Deprecated APIs. These APIs used to exist on classic React classes but since\n * we would like to deprecate them, we're not going to move them over to this\n * modern base class. Instead, we define a getter that warns if it's accessed.\n */\n\n\n{\n var deprecatedAPIs = {\n isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],\n replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']\n };\n\n var defineDeprecationWarning = function (methodName, info) {\n Object.defineProperty(Component.prototype, methodName, {\n get: function () {\n warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);\n\n return undefined;\n }\n });\n };\n\n for (var fnName in deprecatedAPIs) {\n if (deprecatedAPIs.hasOwnProperty(fnName)) {\n defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);\n }\n }\n}\n\nfunction ComponentDummy() {}\n\nComponentDummy.prototype = Component.prototype;\n/**\n * Convenience component with default shallow equality check for sCU.\n */\n\nfunction PureComponent(props, context, updater) {\n this.props = props;\n this.context = context; // If a component has string refs, we will assign a different object later.\n\n this.refs = emptyObject;\n this.updater = updater || ReactNoopUpdateQueue;\n}\n\nvar pureComponentPrototype = PureComponent.prototype = new ComponentDummy();\npureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.\n\nassign(pureComponentPrototype, Component.prototype);\npureComponentPrototype.isPureReactComponent = true;\n\n// an immutable object with a single mutable value\nfunction createRef() {\n var refObject = {\n current: null\n };\n\n {\n Object.seal(refObject);\n }\n\n return refObject;\n}\n\nvar isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare\n\nfunction isArray(a) {\n return isArrayImpl(a);\n}\n\n/*\n * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol\n * and Temporal.* types. See https://github.com/facebook/react/pull/22064.\n *\n * The functions in this module will throw an easier-to-understand,\n * easier-to-debug exception with a clear errors message message explaining the\n * problem. (Instead of a confusing exception thrown inside the implementation\n * of the `value` object).\n */\n// $FlowFixMe only called in DEV, so void return is not possible.\nfunction typeName(value) {\n {\n // toStringTag is needed for namespaced types like Temporal.Instant\n var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;\n var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';\n return type;\n }\n} // $FlowFixMe only called in DEV, so void return is not possible.\n\n\nfunction willCoercionThrow(value) {\n {\n try {\n testStringCoercion(value);\n return false;\n } catch (e) {\n return true;\n }\n }\n}\n\nfunction testStringCoercion(value) {\n // If you ended up here by following an exception call stack, here's what's\n // happened: you supplied an object or symbol value to React (as a prop, key,\n // DOM attribute, CSS property, string ref, etc.) and when React tried to\n // coerce it to a string using `'' + value`, an exception was thrown.\n //\n // The most common types that will cause this exception are `Symbol` instances\n // and Temporal objects like `Temporal.Instant`. But any object that has a\n // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this\n // exception. (Library authors do this to prevent users from using built-in\n // numeric operators like `+` or comparison operators like `>=` because custom\n // methods are needed to perform accurate arithmetic or comparison.)\n //\n // To fix the problem, coerce this object or symbol value to a string before\n // passing it to React. The most reliable way is usually `String(value)`.\n //\n // To find which value is throwing, check the browser or debugger console.\n // Before this exception was thrown, there should be `console.error` output\n // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the\n // problem and how that type was used: key, atrribute, input value prop, etc.\n // In most cases, this console output also shows the component and its\n // ancestor components where the exception happened.\n //\n // eslint-disable-next-line react-internal/safe-string-coercion\n return '' + value;\n}\nfunction checkKeyStringCoercion(value) {\n {\n if (willCoercionThrow(value)) {\n error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));\n\n return testStringCoercion(value); // throw (to help callers find troubleshooting comments)\n }\n }\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var displayName = outerType.displayName;\n\n if (displayName) {\n return displayName;\n }\n\n var functionName = innerType.displayName || innerType.name || '';\n return functionName !== '' ? wrapperName + \"(\" + functionName + \")\" : wrapperName;\n} // Keep in sync with react-reconciler/getComponentNameFromFiber\n\n\nfunction getContextName(type) {\n return type.displayName || 'Context';\n} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.\n\n\nfunction getComponentNameFromType(type) {\n if (type == null) {\n // Host root, text node or just invalid type.\n return null;\n }\n\n {\n if (typeof type.tag === 'number') {\n error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');\n }\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || null;\n }\n\n if (typeof type === 'string') {\n return type;\n }\n\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return 'Fragment';\n\n case REACT_PORTAL_TYPE:\n return 'Portal';\n\n case REACT_PROFILER_TYPE:\n return 'Profiler';\n\n case REACT_STRICT_MODE_TYPE:\n return 'StrictMode';\n\n case REACT_SUSPENSE_TYPE:\n return 'Suspense';\n\n case REACT_SUSPENSE_LIST_TYPE:\n return 'SuspenseList';\n\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n var context = type;\n return getContextName(context) + '.Consumer';\n\n case REACT_PROVIDER_TYPE:\n var provider = type;\n return getContextName(provider._context) + '.Provider';\n\n case REACT_FORWARD_REF_TYPE:\n return getWrappedName(type, type.render, 'ForwardRef');\n\n case REACT_MEMO_TYPE:\n var outerName = type.displayName || null;\n\n if (outerName !== null) {\n return outerName;\n }\n\n return getComponentNameFromType(type.type) || 'Memo';\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n return getComponentNameFromType(init(payload));\n } catch (x) {\n return null;\n }\n }\n\n // eslint-disable-next-line no-fallthrough\n }\n }\n\n return null;\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\nvar specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;\n\n{\n didWarnAboutStringRefs = {};\n}\n\nfunction hasValidRef(config) {\n {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.key !== undefined;\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n var warnAboutAccessingKey = function () {\n {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n\n error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n }\n };\n\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n var warnAboutAccessingRef = function () {\n {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n\n error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n }\n };\n\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n}\n\nfunction warnIfStringRefCannotBeAutoConverted(config) {\n {\n if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {\n var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (!didWarnAboutStringRefs[componentName]) {\n error('Component \"%s\" contains the string ref \"%s\". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);\n\n didWarnAboutStringRefs[componentName] = true;\n }\n }\n }\n}\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, instanceof check\n * will not work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} props\n * @param {*} key\n * @param {string|object} ref\n * @param {*} owner\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @internal\n */\n\n\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allows us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {}; // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n }); // self and source are DEV only properties.\n\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n }); // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n/**\n * Create and return a new ReactElement of the given type.\n * See https://reactjs.org/docs/react-api.html#createelement\n */\n\nfunction createElement(type, config, children) {\n var propName; // Reserved names are extracted\n\n var props = {};\n var key = null;\n var ref = null;\n var self = null;\n var source = null;\n\n if (config != null) {\n if (hasValidRef(config)) {\n ref = config.ref;\n\n {\n warnIfStringRefCannotBeAutoConverted(config);\n }\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n }\n\n self = config.__self === undefined ? null : config.__self;\n source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n }\n } // Children can be more than one argument, and those are transferred onto\n // the newly allocated props object.\n\n\n var childrenLength = arguments.length - 2;\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 2];\n }\n\n {\n if (Object.freeze) {\n Object.freeze(childArray);\n }\n }\n\n props.children = childArray;\n } // Resolve default props\n\n\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n\n {\n if (key || ref) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n }\n\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n}\nfunction cloneAndReplaceKey(oldElement, newKey) {\n var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);\n return newElement;\n}\n/**\n * Clone and return a new ReactElement using element as the starting point.\n * See https://reactjs.org/docs/react-api.html#cloneelement\n */\n\nfunction cloneElement(element, config, children) {\n if (element === null || element === undefined) {\n throw new Error(\"React.cloneElement(...): The argument must be a React element, but you passed \" + element + \".\");\n }\n\n var propName; // Original props are copied\n\n var props = assign({}, element.props); // Reserved names are extracted\n\n var key = element.key;\n var ref = element.ref; // Self is preserved since the owner is preserved.\n\n var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a\n // transpiler, and the original source is probably a better indicator of the\n // true owner.\n\n var source = element._source; // Owner will be preserved, unless ref is overridden\n\n var owner = element._owner;\n\n if (config != null) {\n if (hasValidRef(config)) {\n // Silently steal the ref from the parent.\n ref = config.ref;\n owner = ReactCurrentOwner.current;\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n } // Remaining properties override existing props\n\n\n var defaultProps;\n\n if (element.type && element.type.defaultProps) {\n defaultProps = element.type.defaultProps;\n }\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n if (config[propName] === undefined && defaultProps !== undefined) {\n // Resolve default props\n props[propName] = defaultProps[propName];\n } else {\n props[propName] = config[propName];\n }\n }\n }\n } // Children can be more than one argument, and those are transferred onto\n // the newly allocated props object.\n\n\n var childrenLength = arguments.length - 2;\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 2];\n }\n\n props.children = childArray;\n }\n\n return ReactElement(element.type, key, ref, self, source, owner, props);\n}\n/**\n * Verifies the object is a ReactElement.\n * See https://reactjs.org/docs/react-api.html#isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a ReactElement.\n * @final\n */\n\nfunction isValidElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\n\nvar SEPARATOR = '.';\nvar SUBSEPARATOR = ':';\n/**\n * Escape and wrap key so it is safe to use as a reactid\n *\n * @param {string} key to be escaped.\n * @return {string} the escaped key.\n */\n\nfunction escape(key) {\n var escapeRegex = /[=:]/g;\n var escaperLookup = {\n '=': '=0',\n ':': '=2'\n };\n var escapedString = key.replace(escapeRegex, function (match) {\n return escaperLookup[match];\n });\n return '$' + escapedString;\n}\n/**\n * TODO: Test that a single child and an array with one item have the same key\n * pattern.\n */\n\n\nvar didWarnAboutMaps = false;\nvar userProvidedKeyEscapeRegex = /\\/+/g;\n\nfunction escapeUserProvidedKey(text) {\n return text.replace(userProvidedKeyEscapeRegex, '$&/');\n}\n/**\n * Generate a key string that identifies a element within a set.\n *\n * @param {*} element A element that could contain a manual key.\n * @param {number} index Index that is used if a manual key is not provided.\n * @return {string}\n */\n\n\nfunction getElementKey(element, index) {\n // Do some typechecking here since we call this blindly. We want to ensure\n // that we don't block potential future ES APIs.\n if (typeof element === 'object' && element !== null && element.key != null) {\n // Explicit key\n {\n checkKeyStringCoercion(element.key);\n }\n\n return escape('' + element.key);\n } // Implicit key determined by the index in the set\n\n\n return index.toString(36);\n}\n\nfunction mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {\n var type = typeof children;\n\n if (type === 'undefined' || type === 'boolean') {\n // All of the above are perceived as null.\n children = null;\n }\n\n var invokeCallback = false;\n\n if (children === null) {\n invokeCallback = true;\n } else {\n switch (type) {\n case 'string':\n case 'number':\n invokeCallback = true;\n break;\n\n case 'object':\n switch (children.$$typeof) {\n case REACT_ELEMENT_TYPE:\n case REACT_PORTAL_TYPE:\n invokeCallback = true;\n }\n\n }\n }\n\n if (invokeCallback) {\n var _child = children;\n var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array\n // so that it's consistent if the number of children grows:\n\n var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;\n\n if (isArray(mappedChild)) {\n var escapedChildKey = '';\n\n if (childKey != null) {\n escapedChildKey = escapeUserProvidedKey(childKey) + '/';\n }\n\n mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {\n return c;\n });\n } else if (mappedChild != null) {\n if (isValidElement(mappedChild)) {\n {\n // The `if` statement here prevents auto-disabling of the safe\n // coercion ESLint rule, so we must manually disable it below.\n // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key\n if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {\n checkKeyStringCoercion(mappedChild.key);\n }\n }\n\n mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as\n // traverseAllChildren used to do for objects as children\n escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key\n mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number\n // eslint-disable-next-line react-internal/safe-string-coercion\n escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);\n }\n\n array.push(mappedChild);\n }\n\n return 1;\n }\n\n var child;\n var nextName;\n var subtreeCount = 0; // Count of children found in the current subtree.\n\n var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;\n\n if (isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n child = children[i];\n nextName = nextNamePrefix + getElementKey(child, i);\n subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);\n }\n } else {\n var iteratorFn = getIteratorFn(children);\n\n if (typeof iteratorFn === 'function') {\n var iterableChildren = children;\n\n {\n // Warn about using Maps as children\n if (iteratorFn === iterableChildren.entries) {\n if (!didWarnAboutMaps) {\n warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');\n }\n\n didWarnAboutMaps = true;\n }\n }\n\n var iterator = iteratorFn.call(iterableChildren);\n var step;\n var ii = 0;\n\n while (!(step = iterator.next()).done) {\n child = step.value;\n nextName = nextNamePrefix + getElementKey(child, ii++);\n subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);\n }\n } else if (type === 'object') {\n // eslint-disable-next-line react-internal/safe-string-coercion\n var childrenString = String(children);\n throw new Error(\"Objects are not valid as a React child (found: \" + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + \"). \" + 'If you meant to render a collection of children, use an array ' + 'instead.');\n }\n }\n\n return subtreeCount;\n}\n\n/**\n * Maps children that are typically specified as `props.children`.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrenmap\n *\n * The provided mapFunction(child, index) will be called for each\n * leaf child.\n *\n * @param {?*} children Children tree container.\n * @param {function(*, int)} func The map function.\n * @param {*} context Context for mapFunction.\n * @return {object} Object containing the ordered map of results.\n */\nfunction mapChildren(children, func, context) {\n if (children == null) {\n return children;\n }\n\n var result = [];\n var count = 0;\n mapIntoArray(children, result, '', '', function (child) {\n return func.call(context, child, count++);\n });\n return result;\n}\n/**\n * Count the number of children that are typically specified as\n * `props.children`.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrencount\n *\n * @param {?*} children Children tree container.\n * @return {number} The number of children.\n */\n\n\nfunction countChildren(children) {\n var n = 0;\n mapChildren(children, function () {\n n++; // Don't return anything\n });\n return n;\n}\n\n/**\n * Iterates through children that are typically specified as `props.children`.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrenforeach\n *\n * The provided forEachFunc(child, index) will be called for each\n * leaf child.\n *\n * @param {?*} children Children tree container.\n * @param {function(*, int)} forEachFunc\n * @param {*} forEachContext Context for forEachContext.\n */\nfunction forEachChildren(children, forEachFunc, forEachContext) {\n mapChildren(children, function () {\n forEachFunc.apply(this, arguments); // Don't return anything.\n }, forEachContext);\n}\n/**\n * Flatten a children object (typically specified as `props.children`) and\n * return an array with appropriately re-keyed children.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrentoarray\n */\n\n\nfunction toArray(children) {\n return mapChildren(children, function (child) {\n return child;\n }) || [];\n}\n/**\n * Returns the first child in a collection of children and verifies that there\n * is only one child in the collection.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrenonly\n *\n * The current implementation of this function assumes that a single child gets\n * passed without a wrapper, but the purpose of this helper function is to\n * abstract away the particular structure of children.\n *\n * @param {?object} children Child collection structure.\n * @return {ReactElement} The first and only `ReactElement` contained in the\n * structure.\n */\n\n\nfunction onlyChild(children) {\n if (!isValidElement(children)) {\n throw new Error('React.Children.only expected to receive a single React element child.');\n }\n\n return children;\n}\n\nfunction createContext(defaultValue) {\n // TODO: Second argument used to be an optional `calculateChangedBits`\n // function. Warn to reserve for future use?\n var context = {\n $$typeof: REACT_CONTEXT_TYPE,\n // As a workaround to support multiple concurrent renderers, we categorize\n // some renderers as primary and others as secondary. We only expect\n // there to be two concurrent renderers at most: React Native (primary) and\n // Fabric (secondary); React DOM (primary) and React ART (secondary).\n // Secondary renderers store their context values on separate fields.\n _currentValue: defaultValue,\n _currentValue2: defaultValue,\n // Used to track how many concurrent renderers this context currently\n // supports within in a single renderer. Such as parallel server rendering.\n _threadCount: 0,\n // These are circular\n Provider: null,\n Consumer: null,\n // Add these to use same hidden class in VM as ServerContext\n _defaultValue: null,\n _globalName: null\n };\n context.Provider = {\n $$typeof: REACT_PROVIDER_TYPE,\n _context: context\n };\n var hasWarnedAboutUsingNestedContextConsumers = false;\n var hasWarnedAboutUsingConsumerProvider = false;\n var hasWarnedAboutDisplayNameOnConsumer = false;\n\n {\n // A separate object, but proxies back to the original context object for\n // backwards compatibility. It has a different $$typeof, so we can properly\n // warn for the incorrect usage of Context as a Consumer.\n var Consumer = {\n $$typeof: REACT_CONTEXT_TYPE,\n _context: context\n }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here\n\n Object.defineProperties(Consumer, {\n Provider: {\n get: function () {\n if (!hasWarnedAboutUsingConsumerProvider) {\n hasWarnedAboutUsingConsumerProvider = true;\n\n error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?');\n }\n\n return context.Provider;\n },\n set: function (_Provider) {\n context.Provider = _Provider;\n }\n },\n _currentValue: {\n get: function () {\n return context._currentValue;\n },\n set: function (_currentValue) {\n context._currentValue = _currentValue;\n }\n },\n _currentValue2: {\n get: function () {\n return context._currentValue2;\n },\n set: function (_currentValue2) {\n context._currentValue2 = _currentValue2;\n }\n },\n _threadCount: {\n get: function () {\n return context._threadCount;\n },\n set: function (_threadCount) {\n context._threadCount = _threadCount;\n }\n },\n Consumer: {\n get: function () {\n if (!hasWarnedAboutUsingNestedContextConsumers) {\n hasWarnedAboutUsingNestedContextConsumers = true;\n\n error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?');\n }\n\n return context.Consumer;\n }\n },\n displayName: {\n get: function () {\n return context.displayName;\n },\n set: function (displayName) {\n if (!hasWarnedAboutDisplayNameOnConsumer) {\n warn('Setting `displayName` on Context.Consumer has no effect. ' + \"You should set it directly on the context with Context.displayName = '%s'.\", displayName);\n\n hasWarnedAboutDisplayNameOnConsumer = true;\n }\n }\n }\n }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty\n\n context.Consumer = Consumer;\n }\n\n {\n context._currentRenderer = null;\n context._currentRenderer2 = null;\n }\n\n return context;\n}\n\nvar Uninitialized = -1;\nvar Pending = 0;\nvar Resolved = 1;\nvar Rejected = 2;\n\nfunction lazyInitializer(payload) {\n if (payload._status === Uninitialized) {\n var ctor = payload._result;\n var thenable = ctor(); // Transition to the next state.\n // This might throw either because it's missing or throws. If so, we treat it\n // as still uninitialized and try again next time. Which is the same as what\n // happens if the ctor or any wrappers processing the ctor throws. This might\n // end up fixing it if the resolution was a concurrency bug.\n\n thenable.then(function (moduleObject) {\n if (payload._status === Pending || payload._status === Uninitialized) {\n // Transition to the next state.\n var resolved = payload;\n resolved._status = Resolved;\n resolved._result = moduleObject;\n }\n }, function (error) {\n if (payload._status === Pending || payload._status === Uninitialized) {\n // Transition to the next state.\n var rejected = payload;\n rejected._status = Rejected;\n rejected._result = error;\n }\n });\n\n if (payload._status === Uninitialized) {\n // In case, we're still uninitialized, then we're waiting for the thenable\n // to resolve. Set it as pending in the meantime.\n var pending = payload;\n pending._status = Pending;\n pending._result = thenable;\n }\n }\n\n if (payload._status === Resolved) {\n var moduleObject = payload._result;\n\n {\n if (moduleObject === undefined) {\n error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\\n\\nYour code should look like: \\n ' + // Break up imports to avoid accidentally parsing them as dependencies.\n 'const MyComponent = lazy(() => imp' + \"ort('./MyComponent'))\\n\\n\" + 'Did you accidentally put curly braces around the import?', moduleObject);\n }\n }\n\n {\n if (!('default' in moduleObject)) {\n error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\\n\\nYour code should look like: \\n ' + // Break up imports to avoid accidentally parsing them as dependencies.\n 'const MyComponent = lazy(() => imp' + \"ort('./MyComponent'))\", moduleObject);\n }\n }\n\n return moduleObject.default;\n } else {\n throw payload._result;\n }\n}\n\nfunction lazy(ctor) {\n var payload = {\n // We use these fields to store the result.\n _status: Uninitialized,\n _result: ctor\n };\n var lazyType = {\n $$typeof: REACT_LAZY_TYPE,\n _payload: payload,\n _init: lazyInitializer\n };\n\n {\n // In production, this would just set it on the object.\n var defaultProps;\n var propTypes; // $FlowFixMe\n\n Object.defineProperties(lazyType, {\n defaultProps: {\n configurable: true,\n get: function () {\n return defaultProps;\n },\n set: function (newDefaultProps) {\n error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');\n\n defaultProps = newDefaultProps; // Match production behavior more closely:\n // $FlowFixMe\n\n Object.defineProperty(lazyType, 'defaultProps', {\n enumerable: true\n });\n }\n },\n propTypes: {\n configurable: true,\n get: function () {\n return propTypes;\n },\n set: function (newPropTypes) {\n error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');\n\n propTypes = newPropTypes; // Match production behavior more closely:\n // $FlowFixMe\n\n Object.defineProperty(lazyType, 'propTypes', {\n enumerable: true\n });\n }\n }\n });\n }\n\n return lazyType;\n}\n\nfunction forwardRef(render) {\n {\n if (render != null && render.$$typeof === REACT_MEMO_TYPE) {\n error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');\n } else if (typeof render !== 'function') {\n error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);\n } else {\n if (render.length !== 0 && render.length !== 2) {\n error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');\n }\n }\n\n if (render != null) {\n if (render.defaultProps != null || render.propTypes != null) {\n error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');\n }\n }\n }\n\n var elementType = {\n $$typeof: REACT_FORWARD_REF_TYPE,\n render: render\n };\n\n {\n var ownName;\n Object.defineProperty(elementType, 'displayName', {\n enumerable: false,\n configurable: true,\n get: function () {\n return ownName;\n },\n set: function (name) {\n ownName = name; // The inner component shouldn't inherit this display name in most cases,\n // because the component may be used elsewhere.\n // But it's nice for anonymous functions to inherit the name,\n // so that our component-stack generation logic will display their frames.\n // An anonymous function generally suggests a pattern like:\n // React.forwardRef((props, ref) => {...});\n // This kind of inner function is not used elsewhere so the side effect is okay.\n\n if (!render.name && !render.displayName) {\n render.displayName = name;\n }\n }\n });\n }\n\n return elementType;\n}\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction memo(type, compare) {\n {\n if (!isValidElementType(type)) {\n error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);\n }\n }\n\n var elementType = {\n $$typeof: REACT_MEMO_TYPE,\n type: type,\n compare: compare === undefined ? null : compare\n };\n\n {\n var ownName;\n Object.defineProperty(elementType, 'displayName', {\n enumerable: false,\n configurable: true,\n get: function () {\n return ownName;\n },\n set: function (name) {\n ownName = name; // The inner component shouldn't inherit this display name in most cases,\n // because the component may be used elsewhere.\n // But it's nice for anonymous functions to inherit the name,\n // so that our component-stack generation logic will display their frames.\n // An anonymous function generally suggests a pattern like:\n // React.memo((props) => {...});\n // This kind of inner function is not used elsewhere so the side effect is okay.\n\n if (!type.name && !type.displayName) {\n type.displayName = name;\n }\n }\n });\n }\n\n return elementType;\n}\n\nfunction resolveDispatcher() {\n var dispatcher = ReactCurrentDispatcher.current;\n\n {\n if (dispatcher === null) {\n error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\\n' + '2. You might be breaking the Rules of Hooks\\n' + '3. You might have more than one copy of React in the same app\\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');\n }\n } // Will result in a null access error if accessed outside render phase. We\n // intentionally don't throw our own error because this is in a hot path.\n // Also helps ensure this is inlined.\n\n\n return dispatcher;\n}\nfunction useContext(Context) {\n var dispatcher = resolveDispatcher();\n\n {\n // TODO: add a more generic warning for invalid values.\n if (Context._context !== undefined) {\n var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs\n // and nobody should be using this in existing code.\n\n if (realContext.Consumer === Context) {\n error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');\n } else if (realContext.Provider === Context) {\n error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');\n }\n }\n }\n\n return dispatcher.useContext(Context);\n}\nfunction useState(initialState) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useState(initialState);\n}\nfunction useReducer(reducer, initialArg, init) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useReducer(reducer, initialArg, init);\n}\nfunction useRef(initialValue) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useRef(initialValue);\n}\nfunction useEffect(create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useEffect(create, deps);\n}\nfunction useInsertionEffect(create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useInsertionEffect(create, deps);\n}\nfunction useLayoutEffect(create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useLayoutEffect(create, deps);\n}\nfunction useCallback(callback, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useCallback(callback, deps);\n}\nfunction useMemo(create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useMemo(create, deps);\n}\nfunction useImperativeHandle(ref, create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useImperativeHandle(ref, create, deps);\n}\nfunction useDebugValue(value, formatterFn) {\n {\n var dispatcher = resolveDispatcher();\n return dispatcher.useDebugValue(value, formatterFn);\n }\n}\nfunction useTransition() {\n var dispatcher = resolveDispatcher();\n return dispatcher.useTransition();\n}\nfunction useDeferredValue(value) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useDeferredValue(value);\n}\nfunction useId() {\n var dispatcher = resolveDispatcher();\n return dispatcher.useId();\n}\nfunction useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\n// Helpers to patch console.logs to avoid logging during side-effect free\n// replaying on render function. This currently only patches the object\n// lazily which won't cover if the log function was extracted eagerly.\n// We could also eagerly patch the method.\nvar disabledDepth = 0;\nvar prevLog;\nvar prevInfo;\nvar prevWarn;\nvar prevError;\nvar prevGroup;\nvar prevGroupCollapsed;\nvar prevGroupEnd;\n\nfunction disabledLog() {}\n\ndisabledLog.__reactDisabledLog = true;\nfunction disableLogs() {\n {\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099\n\n var props = {\n configurable: true,\n enumerable: true,\n value: disabledLog,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n disabledDepth++;\n }\n}\nfunction reenableLogs() {\n {\n disabledDepth--;\n\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n var props = {\n configurable: true,\n enumerable: true,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n log: assign({}, props, {\n value: prevLog\n }),\n info: assign({}, props, {\n value: prevInfo\n }),\n warn: assign({}, props, {\n value: prevWarn\n }),\n error: assign({}, props, {\n value: prevError\n }),\n group: assign({}, props, {\n value: prevGroup\n }),\n groupCollapsed: assign({}, props, {\n value: prevGroupCollapsed\n }),\n groupEnd: assign({}, props, {\n value: prevGroupEnd\n })\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n if (disabledDepth < 0) {\n error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');\n }\n }\n}\n\nvar ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;\nvar prefix;\nfunction describeBuiltInComponentFrame(name, source, ownerFn) {\n {\n if (prefix === undefined) {\n // Extract the VM specific prefix used by each line.\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = match && match[1] || '';\n }\n } // We use the prefix to ensure our stacks line up with native stack frames.\n\n\n return '\\n' + prefix + name;\n }\n}\nvar reentry = false;\nvar componentFrameCache;\n\n{\n var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;\n componentFrameCache = new PossiblyWeakMap();\n}\n\nfunction describeNativeComponentFrame(fn, construct) {\n // If something asked for a stack inside a fake render, it should get ignored.\n if ( !fn || reentry) {\n return '';\n }\n\n {\n var frame = componentFrameCache.get(fn);\n\n if (frame !== undefined) {\n return frame;\n }\n }\n\n var control;\n reentry = true;\n var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.\n\n Error.prepareStackTrace = undefined;\n var previousDispatcher;\n\n {\n previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function\n // for warnings.\n\n ReactCurrentDispatcher$1.current = null;\n disableLogs();\n }\n\n try {\n // This should throw.\n if (construct) {\n // Something should be setting the props in the constructor.\n var Fake = function () {\n throw Error();\n }; // $FlowFixMe\n\n\n Object.defineProperty(Fake.prototype, 'props', {\n set: function () {\n // We use a throwing setter instead of frozen or non-writable props\n // because that won't throw in a non-strict mode function.\n throw Error();\n }\n });\n\n if (typeof Reflect === 'object' && Reflect.construct) {\n // We construct a different control for this case to include any extra\n // frames added by the construct call.\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n control = x;\n }\n\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x) {\n control = x;\n }\n\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x) {\n control = x;\n }\n\n fn();\n }\n } catch (sample) {\n // This is inlined manually because closure doesn't do it for us.\n if (sample && control && typeof sample.stack === 'string') {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n var sampleLines = sample.stack.split('\\n');\n var controlLines = control.stack.split('\\n');\n var s = sampleLines.length - 1;\n var c = controlLines.length - 1;\n\n while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n c--;\n }\n\n for (; s >= 1 && c >= 0; s--, c--) {\n // Next we find the first one that isn't the same which should be the\n // frame that called our sample function and the control.\n if (sampleLines[s] !== controlLines[c]) {\n // In V8, the first line is describing the message but other VMs don't.\n // If we're about to return the first line, and the control is also on the same\n // line, that's a pretty good indicator that our sample threw at same line as\n // the control. I.e. before we entered the sample frame. So we ignore this result.\n // This can happen if you passed a class to function component, or non-function.\n if (s !== 1 || c !== 1) {\n do {\n s--;\n c--; // We may still have similar intermediate frames from the construct call.\n // The next one that isn't the same should be our match though.\n\n if (c < 0 || sampleLines[s] !== controlLines[c]) {\n // V8 adds a \"new\" prefix for native classes. Let's remove it to make it prettier.\n var _frame = '\\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled \"\"\n // but we have a user-provided \"displayName\"\n // splice it in to make the stack more readable.\n\n\n if (fn.displayName && _frame.includes('')) {\n _frame = _frame.replace('', fn.displayName);\n }\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, _frame);\n }\n } // Return the line we found.\n\n\n return _frame;\n }\n } while (s >= 1 && c >= 0);\n }\n\n break;\n }\n }\n }\n } finally {\n reentry = false;\n\n {\n ReactCurrentDispatcher$1.current = previousDispatcher;\n reenableLogs();\n }\n\n Error.prepareStackTrace = previousPrepareStackTrace;\n } // Fallback to just using the name if we couldn't make it throw.\n\n\n var name = fn ? fn.displayName || fn.name : '';\n var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, syntheticFrame);\n }\n }\n\n return syntheticFrame;\n}\nfunction describeFunctionComponentFrame(fn, source, ownerFn) {\n {\n return describeNativeComponentFrame(fn, false);\n }\n}\n\nfunction shouldConstruct(Component) {\n var prototype = Component.prototype;\n return !!(prototype && prototype.isReactComponent);\n}\n\nfunction describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {\n\n if (type == null) {\n return '';\n }\n\n if (typeof type === 'function') {\n {\n return describeNativeComponentFrame(type, shouldConstruct(type));\n }\n }\n\n if (typeof type === 'string') {\n return describeBuiltInComponentFrame(type);\n }\n\n switch (type) {\n case REACT_SUSPENSE_TYPE:\n return describeBuiltInComponentFrame('Suspense');\n\n case REACT_SUSPENSE_LIST_TYPE:\n return describeBuiltInComponentFrame('SuspenseList');\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_FORWARD_REF_TYPE:\n return describeFunctionComponentFrame(type.render);\n\n case REACT_MEMO_TYPE:\n // Memo may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n // Lazy may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);\n } catch (x) {}\n }\n }\n }\n\n return '';\n}\n\nvar loggedTypeFailures = {};\nvar ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame$1.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame$1.setExtraStackFrame(null);\n }\n }\n}\n\nfunction checkPropTypes(typeSpecs, values, location, componentName, element) {\n {\n // $FlowFixMe This is okay but Flow doesn't know it.\n var has = Function.call.bind(hasOwnProperty);\n\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n // eslint-disable-next-line react-internal/prod-error-codes\n var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');\n err.name = 'Invariant Violation';\n throw err;\n }\n\n error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');\n } catch (ex) {\n error$1 = ex;\n }\n\n if (error$1 && !(error$1 instanceof Error)) {\n setCurrentlyValidatingElement(element);\n\n error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);\n\n setCurrentlyValidatingElement(null);\n }\n\n if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error$1.message] = true;\n setCurrentlyValidatingElement(element);\n\n error('Failed %s type: %s', location, error$1.message);\n\n setCurrentlyValidatingElement(null);\n }\n }\n }\n }\n}\n\nfunction setCurrentlyValidatingElement$1(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n setExtraStackFrame(stack);\n } else {\n setExtraStackFrame(null);\n }\n }\n}\n\nvar propTypesMisspellWarningShown;\n\n{\n propTypesMisspellWarningShown = false;\n}\n\nfunction getDeclarationErrorAddendum() {\n if (ReactCurrentOwner.current) {\n var name = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (name) {\n return '\\n\\nCheck the render method of `' + name + '`.';\n }\n }\n\n return '';\n}\n\nfunction getSourceInfoErrorAddendum(source) {\n if (source !== undefined) {\n var fileName = source.fileName.replace(/^.*[\\\\\\/]/, '');\n var lineNumber = source.lineNumber;\n return '\\n\\nCheck your code at ' + fileName + ':' + lineNumber + '.';\n }\n\n return '';\n}\n\nfunction getSourceInfoErrorAddendumForProps(elementProps) {\n if (elementProps !== null && elementProps !== undefined) {\n return getSourceInfoErrorAddendum(elementProps.__source);\n }\n\n return '';\n}\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\n\n\nvar ownerHasKeyUseWarning = {};\n\nfunction getCurrentComponentErrorInfo(parentType) {\n var info = getDeclarationErrorAddendum();\n\n if (!info) {\n var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;\n\n if (parentName) {\n info = \"\\n\\nCheck the top-level render call using <\" + parentName + \">.\";\n }\n }\n\n return info;\n}\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it. Error statuses are cached so a warning\n * will only be shown once.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\n\n\nfunction validateExplicitKey(element, parentType) {\n if (!element._store || element._store.validated || element.key != null) {\n return;\n }\n\n element._store.validated = true;\n var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);\n\n if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {\n return;\n }\n\n ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a\n // property, it may be the creator of the child that's responsible for\n // assigning it a key.\n\n var childOwner = '';\n\n if (element && element._owner && element._owner !== ReactCurrentOwner.current) {\n // Give the component that originally created this child.\n childOwner = \" It was passed a child from \" + getComponentNameFromType(element._owner.type) + \".\";\n }\n\n {\n setCurrentlyValidatingElement$1(element);\n\n error('Each child in a list should have a unique \"key\" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);\n\n setCurrentlyValidatingElement$1(null);\n }\n}\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\n\n\nfunction validateChildKeys(node, parentType) {\n if (typeof node !== 'object') {\n return;\n }\n\n if (isArray(node)) {\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n\n if (isValidElement(child)) {\n validateExplicitKey(child, parentType);\n }\n }\n } else if (isValidElement(node)) {\n // This element was passed in a valid location.\n if (node._store) {\n node._store.validated = true;\n }\n } else if (node) {\n var iteratorFn = getIteratorFn(node);\n\n if (typeof iteratorFn === 'function') {\n // Entry iterators used to provide implicit keys,\n // but now we print a separate warning for them later.\n if (iteratorFn !== node.entries) {\n var iterator = iteratorFn.call(node);\n var step;\n\n while (!(step = iterator.next()).done) {\n if (isValidElement(step.value)) {\n validateExplicitKey(step.value, parentType);\n }\n }\n }\n }\n }\n}\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\n\n\nfunction validatePropTypes(element) {\n {\n var type = element.type;\n\n if (type === null || type === undefined || typeof type === 'string') {\n return;\n }\n\n var propTypes;\n\n if (typeof type === 'function') {\n propTypes = type.propTypes;\n } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.\n // Inner props are checked in the reconciler.\n type.$$typeof === REACT_MEMO_TYPE)) {\n propTypes = type.propTypes;\n } else {\n return;\n }\n\n if (propTypes) {\n // Intentionally inside to avoid triggering lazy initializers:\n var name = getComponentNameFromType(type);\n checkPropTypes(propTypes, element.props, 'prop', name, element);\n } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {\n propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:\n\n var _name = getComponentNameFromType(type);\n\n error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');\n }\n\n if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {\n error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');\n }\n }\n}\n/**\n * Given a fragment, validate that it can only be provided with fragment props\n * @param {ReactElement} fragment\n */\n\n\nfunction validateFragmentProps(fragment) {\n {\n var keys = Object.keys(fragment.props);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key !== 'children' && key !== 'key') {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);\n\n setCurrentlyValidatingElement$1(null);\n break;\n }\n }\n\n if (fragment.ref !== null) {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid attribute `ref` supplied to `React.Fragment`.');\n\n setCurrentlyValidatingElement$1(null);\n }\n }\n}\nfunction createElementWithValidation(type, props, children) {\n var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to\n // succeed and there will likely be errors in render.\n\n if (!validType) {\n var info = '';\n\n if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {\n info += ' You likely forgot to export your component from the file ' + \"it's defined in, or you might have mixed up default and named imports.\";\n }\n\n var sourceInfo = getSourceInfoErrorAddendumForProps(props);\n\n if (sourceInfo) {\n info += sourceInfo;\n } else {\n info += getDeclarationErrorAddendum();\n }\n\n var typeString;\n\n if (type === null) {\n typeString = 'null';\n } else if (isArray(type)) {\n typeString = 'array';\n } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {\n typeString = \"<\" + (getComponentNameFromType(type.type) || 'Unknown') + \" />\";\n info = ' Did you accidentally export a JSX literal instead of a component?';\n } else {\n typeString = typeof type;\n }\n\n {\n error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);\n }\n }\n\n var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.\n // TODO: Drop this when these are no longer allowed as the type argument.\n\n if (element == null) {\n return element;\n } // Skip key warning if the type isn't valid since our key validation logic\n // doesn't expect a non-string/function type and can throw confusing errors.\n // We don't want exception behavior to differ between dev and prod.\n // (Rendering will throw with a helpful message and as soon as the type is\n // fixed, the key warnings will appear.)\n\n\n if (validType) {\n for (var i = 2; i < arguments.length; i++) {\n validateChildKeys(arguments[i], type);\n }\n }\n\n if (type === REACT_FRAGMENT_TYPE) {\n validateFragmentProps(element);\n } else {\n validatePropTypes(element);\n }\n\n return element;\n}\nvar didWarnAboutDeprecatedCreateFactory = false;\nfunction createFactoryWithValidation(type) {\n var validatedFactory = createElementWithValidation.bind(null, type);\n validatedFactory.type = type;\n\n {\n if (!didWarnAboutDeprecatedCreateFactory) {\n didWarnAboutDeprecatedCreateFactory = true;\n\n warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');\n } // Legacy hook: remove it\n\n\n Object.defineProperty(validatedFactory, 'type', {\n enumerable: false,\n get: function () {\n warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');\n\n Object.defineProperty(this, 'type', {\n value: type\n });\n return type;\n }\n });\n }\n\n return validatedFactory;\n}\nfunction cloneElementWithValidation(element, props, children) {\n var newElement = cloneElement.apply(this, arguments);\n\n for (var i = 2; i < arguments.length; i++) {\n validateChildKeys(arguments[i], newElement.type);\n }\n\n validatePropTypes(newElement);\n return newElement;\n}\n\nfunction startTransition(scope, options) {\n var prevTransition = ReactCurrentBatchConfig.transition;\n ReactCurrentBatchConfig.transition = {};\n var currentTransition = ReactCurrentBatchConfig.transition;\n\n {\n ReactCurrentBatchConfig.transition._updatedFibers = new Set();\n }\n\n try {\n scope();\n } finally {\n ReactCurrentBatchConfig.transition = prevTransition;\n\n {\n if (prevTransition === null && currentTransition._updatedFibers) {\n var updatedFibersCount = currentTransition._updatedFibers.size;\n\n if (updatedFibersCount > 10) {\n warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');\n }\n\n currentTransition._updatedFibers.clear();\n }\n }\n }\n}\n\nvar didWarnAboutMessageChannel = false;\nvar enqueueTaskImpl = null;\nfunction enqueueTask(task) {\n if (enqueueTaskImpl === null) {\n try {\n // read require off the module object to get around the bundlers.\n // we don't want them to detect a require and bundle a Node polyfill.\n var requireString = ('require' + Math.random()).slice(0, 7);\n var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's\n // version of setImmediate, bypassing fake timers if any.\n\n enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;\n } catch (_err) {\n // we're in a browser\n // we can't use regular timers because they may still be faked\n // so we try MessageChannel+postMessage instead\n enqueueTaskImpl = function (callback) {\n {\n if (didWarnAboutMessageChannel === false) {\n didWarnAboutMessageChannel = true;\n\n if (typeof MessageChannel === 'undefined') {\n error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');\n }\n }\n }\n\n var channel = new MessageChannel();\n channel.port1.onmessage = callback;\n channel.port2.postMessage(undefined);\n };\n }\n }\n\n return enqueueTaskImpl(task);\n}\n\nvar actScopeDepth = 0;\nvar didWarnNoAwaitAct = false;\nfunction act(callback) {\n {\n // `act` calls can be nested, so we track the depth. This represents the\n // number of `act` scopes on the stack.\n var prevActScopeDepth = actScopeDepth;\n actScopeDepth++;\n\n if (ReactCurrentActQueue.current === null) {\n // This is the outermost `act` scope. Initialize the queue. The reconciler\n // will detect the queue and use it instead of Scheduler.\n ReactCurrentActQueue.current = [];\n }\n\n var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;\n var result;\n\n try {\n // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only\n // set to `true` while the given callback is executed, not for updates\n // triggered during an async event, because this is how the legacy\n // implementation of `act` behaved.\n ReactCurrentActQueue.isBatchingLegacy = true;\n result = callback(); // Replicate behavior of original `act` implementation in legacy mode,\n // which flushed updates immediately after the scope function exits, even\n // if it's an async function.\n\n if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {\n var queue = ReactCurrentActQueue.current;\n\n if (queue !== null) {\n ReactCurrentActQueue.didScheduleLegacyUpdate = false;\n flushActQueue(queue);\n }\n }\n } catch (error) {\n popActScope(prevActScopeDepth);\n throw error;\n } finally {\n ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;\n }\n\n if (result !== null && typeof result === 'object' && typeof result.then === 'function') {\n var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait\n // for it to resolve before exiting the current scope.\n\n var wasAwaited = false;\n var thenable = {\n then: function (resolve, reject) {\n wasAwaited = true;\n thenableResult.then(function (returnValue) {\n popActScope(prevActScopeDepth);\n\n if (actScopeDepth === 0) {\n // We've exited the outermost act scope. Recursively flush the\n // queue until there's no remaining work.\n recursivelyFlushAsyncActWork(returnValue, resolve, reject);\n } else {\n resolve(returnValue);\n }\n }, function (error) {\n // The callback threw an error.\n popActScope(prevActScopeDepth);\n reject(error);\n });\n }\n };\n\n {\n if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {\n // eslint-disable-next-line no-undef\n Promise.resolve().then(function () {}).then(function () {\n if (!wasAwaited) {\n didWarnNoAwaitAct = true;\n\n error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');\n }\n });\n }\n }\n\n return thenable;\n } else {\n var returnValue = result; // The callback is not an async function. Exit the current scope\n // immediately, without awaiting.\n\n popActScope(prevActScopeDepth);\n\n if (actScopeDepth === 0) {\n // Exiting the outermost act scope. Flush the queue.\n var _queue = ReactCurrentActQueue.current;\n\n if (_queue !== null) {\n flushActQueue(_queue);\n ReactCurrentActQueue.current = null;\n } // Return a thenable. If the user awaits it, we'll flush again in\n // case additional work was scheduled by a microtask.\n\n\n var _thenable = {\n then: function (resolve, reject) {\n // Confirm we haven't re-entered another `act` scope, in case\n // the user does something weird like await the thenable\n // multiple times.\n if (ReactCurrentActQueue.current === null) {\n // Recursively flush the queue until there's no remaining work.\n ReactCurrentActQueue.current = [];\n recursivelyFlushAsyncActWork(returnValue, resolve, reject);\n } else {\n resolve(returnValue);\n }\n }\n };\n return _thenable;\n } else {\n // Since we're inside a nested `act` scope, the returned thenable\n // immediately resolves. The outer scope will flush the queue.\n var _thenable2 = {\n then: function (resolve, reject) {\n resolve(returnValue);\n }\n };\n return _thenable2;\n }\n }\n }\n}\n\nfunction popActScope(prevActScopeDepth) {\n {\n if (prevActScopeDepth !== actScopeDepth - 1) {\n error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');\n }\n\n actScopeDepth = prevActScopeDepth;\n }\n}\n\nfunction recursivelyFlushAsyncActWork(returnValue, resolve, reject) {\n {\n var queue = ReactCurrentActQueue.current;\n\n if (queue !== null) {\n try {\n flushActQueue(queue);\n enqueueTask(function () {\n if (queue.length === 0) {\n // No additional work was scheduled. Finish.\n ReactCurrentActQueue.current = null;\n resolve(returnValue);\n } else {\n // Keep flushing work until there's none left.\n recursivelyFlushAsyncActWork(returnValue, resolve, reject);\n }\n });\n } catch (error) {\n reject(error);\n }\n } else {\n resolve(returnValue);\n }\n }\n}\n\nvar isFlushing = false;\n\nfunction flushActQueue(queue) {\n {\n if (!isFlushing) {\n // Prevent re-entrance.\n isFlushing = true;\n var i = 0;\n\n try {\n for (; i < queue.length; i++) {\n var callback = queue[i];\n\n do {\n callback = callback(true);\n } while (callback !== null);\n }\n\n queue.length = 0;\n } catch (error) {\n // If something throws, leave the remaining callbacks on the queue.\n queue = queue.slice(i + 1);\n throw error;\n } finally {\n isFlushing = false;\n }\n }\n }\n}\n\nvar createElement$1 = createElementWithValidation ;\nvar cloneElement$1 = cloneElementWithValidation ;\nvar createFactory = createFactoryWithValidation ;\nvar Children = {\n map: mapChildren,\n forEach: forEachChildren,\n count: countChildren,\n toArray: toArray,\n only: onlyChild\n};\n\nexports.Children = Children;\nexports.Component = Component;\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.Profiler = REACT_PROFILER_TYPE;\nexports.PureComponent = PureComponent;\nexports.StrictMode = REACT_STRICT_MODE_TYPE;\nexports.Suspense = REACT_SUSPENSE_TYPE;\nexports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;\nexports.cloneElement = cloneElement$1;\nexports.createContext = createContext;\nexports.createElement = createElement$1;\nexports.createFactory = createFactory;\nexports.createRef = createRef;\nexports.forwardRef = forwardRef;\nexports.isValidElement = isValidElement;\nexports.lazy = lazy;\nexports.memo = memo;\nexports.startTransition = startTransition;\nexports.unstable_act = act;\nexports.useCallback = useCallback;\nexports.useContext = useContext;\nexports.useDebugValue = useDebugValue;\nexports.useDeferredValue = useDeferredValue;\nexports.useEffect = useEffect;\nexports.useId = useId;\nexports.useImperativeHandle = useImperativeHandle;\nexports.useInsertionEffect = useInsertionEffect;\nexports.useLayoutEffect = useLayoutEffect;\nexports.useMemo = useMemo;\nexports.useReducer = useReducer;\nexports.useRef = useRef;\nexports.useState = useState;\nexports.useSyncExternalStore = useSyncExternalStore;\nexports.useTransition = useTransition;\nexports.version = ReactVersion;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":[],"mappings":"AAUA;AAEA,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;IACzC,CAAC,WAAW;QAEJ;QAGV,IACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,2BAA2B,KAC/D,YACF;YACA,+BAA+B,2BAA2B,CAAC,IAAI;QACjE,CAAC;QACS,IAAI,eAAe;QAM7B,IAAI,qBAAqB,OAAO,GAAG,CAAC;QACpC,IAAI,oBAAoB,OAAO,GAAG,CAAC;QACnC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,yBAAyB,OAAO,GAAG,CAAC;QACxC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,qBAAqB,OAAO,GAAG,CAAC;QACpC,IAAI,yBAAyB,OAAO,GAAG,CAAC;QACxC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,2BAA2B,OAAO,GAAG,CAAC;QAC1C,IAAI,kBAAkB,OAAO,GAAG,CAAC;QACjC,IAAI,kBAAkB,OAAO,GAAG,CAAC;QACjC,IAAI,uBAAuB,OAAO,GAAG,CAAC;QACtC,IAAI,wBAAwB,OAAO,QAAQ;QAC3C,IAAI,uBAAuB;QAC3B,SAAS,cAAc,aAAa,EAAE;YACpC,IAAI,kBAAkB,IAAI,IAAI,OAAO,kBAAkB,UAAU;gBAC/D,OAAO,IAAI;YACb,CAAC;YAED,IAAI,gBAAgB,yBAAyB,aAAa,CAAC,sBAAsB,IAAI,aAAa,CAAC,qBAAqB;YAExH,IAAI,OAAO,kBAAkB,YAAY;gBACvC,OAAO;YACT,CAAC;YAED,OAAO,IAAI;QACb;QAKA,IAAI,yBAAyB;Y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 1790, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] -} \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.9897c6.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.9897c6.map deleted file mode 100644 index 190a824fd7a5d..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.9897c6.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/cjs/react-jsx-runtime.development.js"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\nvar React = require('react');\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var displayName = outerType.displayName;\n\n if (displayName) {\n return displayName;\n }\n\n var functionName = innerType.displayName || innerType.name || '';\n return functionName !== '' ? wrapperName + \"(\" + functionName + \")\" : wrapperName;\n} // Keep in sync with react-reconciler/getComponentNameFromFiber\n\n\nfunction getContextName(type) {\n return type.displayName || 'Context';\n} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.\n\n\nfunction getComponentNameFromType(type) {\n if (type == null) {\n // Host root, text node or just invalid type.\n return null;\n }\n\n {\n if (typeof type.tag === 'number') {\n error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');\n }\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || null;\n }\n\n if (typeof type === 'string') {\n return type;\n }\n\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return 'Fragment';\n\n case REACT_PORTAL_TYPE:\n return 'Portal';\n\n case REACT_PROFILER_TYPE:\n return 'Profiler';\n\n case REACT_STRICT_MODE_TYPE:\n return 'StrictMode';\n\n case REACT_SUSPENSE_TYPE:\n return 'Suspense';\n\n case REACT_SUSPENSE_LIST_TYPE:\n return 'SuspenseList';\n\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n var context = type;\n return getContextName(context) + '.Consumer';\n\n case REACT_PROVIDER_TYPE:\n var provider = type;\n return getContextName(provider._context) + '.Provider';\n\n case REACT_FORWARD_REF_TYPE:\n return getWrappedName(type, type.render, 'ForwardRef');\n\n case REACT_MEMO_TYPE:\n var outerName = type.displayName || null;\n\n if (outerName !== null) {\n return outerName;\n }\n\n return getComponentNameFromType(type.type) || 'Memo';\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n return getComponentNameFromType(init(payload));\n } catch (x) {\n return null;\n }\n }\n\n // eslint-disable-next-line no-fallthrough\n }\n }\n\n return null;\n}\n\nvar assign = Object.assign;\n\n// Helpers to patch console.logs to avoid logging during side-effect free\n// replaying on render function. This currently only patches the object\n// lazily which won't cover if the log function was extracted eagerly.\n// We could also eagerly patch the method.\nvar disabledDepth = 0;\nvar prevLog;\nvar prevInfo;\nvar prevWarn;\nvar prevError;\nvar prevGroup;\nvar prevGroupCollapsed;\nvar prevGroupEnd;\n\nfunction disabledLog() {}\n\ndisabledLog.__reactDisabledLog = true;\nfunction disableLogs() {\n {\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099\n\n var props = {\n configurable: true,\n enumerable: true,\n value: disabledLog,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n disabledDepth++;\n }\n}\nfunction reenableLogs() {\n {\n disabledDepth--;\n\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n var props = {\n configurable: true,\n enumerable: true,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n log: assign({}, props, {\n value: prevLog\n }),\n info: assign({}, props, {\n value: prevInfo\n }),\n warn: assign({}, props, {\n value: prevWarn\n }),\n error: assign({}, props, {\n value: prevError\n }),\n group: assign({}, props, {\n value: prevGroup\n }),\n groupCollapsed: assign({}, props, {\n value: prevGroupCollapsed\n }),\n groupEnd: assign({}, props, {\n value: prevGroupEnd\n })\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n if (disabledDepth < 0) {\n error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');\n }\n }\n}\n\nvar ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;\nvar prefix;\nfunction describeBuiltInComponentFrame(name, source, ownerFn) {\n {\n if (prefix === undefined) {\n // Extract the VM specific prefix used by each line.\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = match && match[1] || '';\n }\n } // We use the prefix to ensure our stacks line up with native stack frames.\n\n\n return '\\n' + prefix + name;\n }\n}\nvar reentry = false;\nvar componentFrameCache;\n\n{\n var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;\n componentFrameCache = new PossiblyWeakMap();\n}\n\nfunction describeNativeComponentFrame(fn, construct) {\n // If something asked for a stack inside a fake render, it should get ignored.\n if ( !fn || reentry) {\n return '';\n }\n\n {\n var frame = componentFrameCache.get(fn);\n\n if (frame !== undefined) {\n return frame;\n }\n }\n\n var control;\n reentry = true;\n var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.\n\n Error.prepareStackTrace = undefined;\n var previousDispatcher;\n\n {\n previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function\n // for warnings.\n\n ReactCurrentDispatcher.current = null;\n disableLogs();\n }\n\n try {\n // This should throw.\n if (construct) {\n // Something should be setting the props in the constructor.\n var Fake = function () {\n throw Error();\n }; // $FlowFixMe\n\n\n Object.defineProperty(Fake.prototype, 'props', {\n set: function () {\n // We use a throwing setter instead of frozen or non-writable props\n // because that won't throw in a non-strict mode function.\n throw Error();\n }\n });\n\n if (typeof Reflect === 'object' && Reflect.construct) {\n // We construct a different control for this case to include any extra\n // frames added by the construct call.\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n control = x;\n }\n\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x) {\n control = x;\n }\n\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x) {\n control = x;\n }\n\n fn();\n }\n } catch (sample) {\n // This is inlined manually because closure doesn't do it for us.\n if (sample && control && typeof sample.stack === 'string') {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n var sampleLines = sample.stack.split('\\n');\n var controlLines = control.stack.split('\\n');\n var s = sampleLines.length - 1;\n var c = controlLines.length - 1;\n\n while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n c--;\n }\n\n for (; s >= 1 && c >= 0; s--, c--) {\n // Next we find the first one that isn't the same which should be the\n // frame that called our sample function and the control.\n if (sampleLines[s] !== controlLines[c]) {\n // In V8, the first line is describing the message but other VMs don't.\n // If we're about to return the first line, and the control is also on the same\n // line, that's a pretty good indicator that our sample threw at same line as\n // the control. I.e. before we entered the sample frame. So we ignore this result.\n // This can happen if you passed a class to function component, or non-function.\n if (s !== 1 || c !== 1) {\n do {\n s--;\n c--; // We may still have similar intermediate frames from the construct call.\n // The next one that isn't the same should be our match though.\n\n if (c < 0 || sampleLines[s] !== controlLines[c]) {\n // V8 adds a \"new\" prefix for native classes. Let's remove it to make it prettier.\n var _frame = '\\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled \"\"\n // but we have a user-provided \"displayName\"\n // splice it in to make the stack more readable.\n\n\n if (fn.displayName && _frame.includes('')) {\n _frame = _frame.replace('', fn.displayName);\n }\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, _frame);\n }\n } // Return the line we found.\n\n\n return _frame;\n }\n } while (s >= 1 && c >= 0);\n }\n\n break;\n }\n }\n }\n } finally {\n reentry = false;\n\n {\n ReactCurrentDispatcher.current = previousDispatcher;\n reenableLogs();\n }\n\n Error.prepareStackTrace = previousPrepareStackTrace;\n } // Fallback to just using the name if we couldn't make it throw.\n\n\n var name = fn ? fn.displayName || fn.name : '';\n var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, syntheticFrame);\n }\n }\n\n return syntheticFrame;\n}\nfunction describeFunctionComponentFrame(fn, source, ownerFn) {\n {\n return describeNativeComponentFrame(fn, false);\n }\n}\n\nfunction shouldConstruct(Component) {\n var prototype = Component.prototype;\n return !!(prototype && prototype.isReactComponent);\n}\n\nfunction describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {\n\n if (type == null) {\n return '';\n }\n\n if (typeof type === 'function') {\n {\n return describeNativeComponentFrame(type, shouldConstruct(type));\n }\n }\n\n if (typeof type === 'string') {\n return describeBuiltInComponentFrame(type);\n }\n\n switch (type) {\n case REACT_SUSPENSE_TYPE:\n return describeBuiltInComponentFrame('Suspense');\n\n case REACT_SUSPENSE_LIST_TYPE:\n return describeBuiltInComponentFrame('SuspenseList');\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_FORWARD_REF_TYPE:\n return describeFunctionComponentFrame(type.render);\n\n case REACT_MEMO_TYPE:\n // Memo may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n // Lazy may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);\n } catch (x) {}\n }\n }\n }\n\n return '';\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar loggedTypeFailures = {};\nvar ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame.setExtraStackFrame(null);\n }\n }\n}\n\nfunction checkPropTypes(typeSpecs, values, location, componentName, element) {\n {\n // $FlowFixMe This is okay but Flow doesn't know it.\n var has = Function.call.bind(hasOwnProperty);\n\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n // eslint-disable-next-line react-internal/prod-error-codes\n var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');\n err.name = 'Invariant Violation';\n throw err;\n }\n\n error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');\n } catch (ex) {\n error$1 = ex;\n }\n\n if (error$1 && !(error$1 instanceof Error)) {\n setCurrentlyValidatingElement(element);\n\n error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);\n\n setCurrentlyValidatingElement(null);\n }\n\n if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error$1.message] = true;\n setCurrentlyValidatingElement(element);\n\n error('Failed %s type: %s', location, error$1.message);\n\n setCurrentlyValidatingElement(null);\n }\n }\n }\n }\n}\n\nvar isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare\n\nfunction isArray(a) {\n return isArrayImpl(a);\n}\n\n/*\n * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol\n * and Temporal.* types. See https://github.com/facebook/react/pull/22064.\n *\n * The functions in this module will throw an easier-to-understand,\n * easier-to-debug exception with a clear errors message message explaining the\n * problem. (Instead of a confusing exception thrown inside the implementation\n * of the `value` object).\n */\n// $FlowFixMe only called in DEV, so void return is not possible.\nfunction typeName(value) {\n {\n // toStringTag is needed for namespaced types like Temporal.Instant\n var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;\n var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';\n return type;\n }\n} // $FlowFixMe only called in DEV, so void return is not possible.\n\n\nfunction willCoercionThrow(value) {\n {\n try {\n testStringCoercion(value);\n return false;\n } catch (e) {\n return true;\n }\n }\n}\n\nfunction testStringCoercion(value) {\n // If you ended up here by following an exception call stack, here's what's\n // happened: you supplied an object or symbol value to React (as a prop, key,\n // DOM attribute, CSS property, string ref, etc.) and when React tried to\n // coerce it to a string using `'' + value`, an exception was thrown.\n //\n // The most common types that will cause this exception are `Symbol` instances\n // and Temporal objects like `Temporal.Instant`. But any object that has a\n // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this\n // exception. (Library authors do this to prevent users from using built-in\n // numeric operators like `+` or comparison operators like `>=` because custom\n // methods are needed to perform accurate arithmetic or comparison.)\n //\n // To fix the problem, coerce this object or symbol value to a string before\n // passing it to React. The most reliable way is usually `String(value)`.\n //\n // To find which value is throwing, check the browser or debugger console.\n // Before this exception was thrown, there should be `console.error` output\n // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the\n // problem and how that type was used: key, atrribute, input value prop, etc.\n // In most cases, this console output also shows the component and its\n // ancestor components where the exception happened.\n //\n // eslint-disable-next-line react-internal/safe-string-coercion\n return '' + value;\n}\nfunction checkKeyStringCoercion(value) {\n {\n if (willCoercionThrow(value)) {\n error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));\n\n return testStringCoercion(value); // throw (to help callers find troubleshooting comments)\n }\n }\n}\n\nvar ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\nvar specialPropKeyWarningShown;\nvar specialPropRefWarningShown;\nvar didWarnAboutStringRefs;\n\n{\n didWarnAboutStringRefs = {};\n}\n\nfunction hasValidRef(config) {\n {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.key !== undefined;\n}\n\nfunction warnIfStringRefCannotBeAutoConverted(config, self) {\n {\n if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {\n var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (!didWarnAboutStringRefs[componentName]) {\n error('Component \"%s\" contains the string ref \"%s\". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);\n\n didWarnAboutStringRefs[componentName] = true;\n }\n }\n }\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingKey = function () {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n\n error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n }\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingRef = function () {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n\n error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n }\n}\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, instanceof check\n * will not work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} props\n * @param {*} key\n * @param {string|object} ref\n * @param {*} owner\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @internal\n */\n\n\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allows us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {}; // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n }); // self and source are DEV only properties.\n\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n }); // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n/**\n * https://github.com/reactjs/rfcs/pull/107\n * @param {*} type\n * @param {object} props\n * @param {string} key\n */\n\nfunction jsxDEV(type, config, maybeKey, source, self) {\n {\n var propName; // Reserved names are extracted\n\n var props = {};\n var key = null;\n var ref = null; // Currently, key can be spread in as a prop. This causes a potential\n // issue if key is also explicitly declared (ie.

\n // or
). We want to deprecate key spread,\n // but as an intermediary step, we will use jsxDEV for everything except\n //
, because we aren't currently able to tell if\n // key is explicitly declared to be undefined or not.\n\n if (maybeKey !== undefined) {\n {\n checkKeyStringCoercion(maybeKey);\n }\n\n key = '' + maybeKey;\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n }\n\n if (hasValidRef(config)) {\n ref = config.ref;\n warnIfStringRefCannotBeAutoConverted(config, self);\n } // Remaining properties are added to a new props object\n\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n } // Resolve default props\n\n\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n\n if (key || ref) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n }\n}\n\nvar ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;\nvar ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement$1(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame$1.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame$1.setExtraStackFrame(null);\n }\n }\n}\n\nvar propTypesMisspellWarningShown;\n\n{\n propTypesMisspellWarningShown = false;\n}\n/**\n * Verifies the object is a ReactElement.\n * See https://reactjs.org/docs/react-api.html#isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a ReactElement.\n * @final\n */\n\n\nfunction isValidElement(object) {\n {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n }\n}\n\nfunction getDeclarationErrorAddendum() {\n {\n if (ReactCurrentOwner$1.current) {\n var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);\n\n if (name) {\n return '\\n\\nCheck the render method of `' + name + '`.';\n }\n }\n\n return '';\n }\n}\n\nfunction getSourceInfoErrorAddendum(source) {\n {\n if (source !== undefined) {\n var fileName = source.fileName.replace(/^.*[\\\\\\/]/, '');\n var lineNumber = source.lineNumber;\n return '\\n\\nCheck your code at ' + fileName + ':' + lineNumber + '.';\n }\n\n return '';\n }\n}\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\n\n\nvar ownerHasKeyUseWarning = {};\n\nfunction getCurrentComponentErrorInfo(parentType) {\n {\n var info = getDeclarationErrorAddendum();\n\n if (!info) {\n var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;\n\n if (parentName) {\n info = \"\\n\\nCheck the top-level render call using <\" + parentName + \">.\";\n }\n }\n\n return info;\n }\n}\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it. Error statuses are cached so a warning\n * will only be shown once.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\n\n\nfunction validateExplicitKey(element, parentType) {\n {\n if (!element._store || element._store.validated || element.key != null) {\n return;\n }\n\n element._store.validated = true;\n var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);\n\n if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {\n return;\n }\n\n ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a\n // property, it may be the creator of the child that's responsible for\n // assigning it a key.\n\n var childOwner = '';\n\n if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {\n // Give the component that originally created this child.\n childOwner = \" It was passed a child from \" + getComponentNameFromType(element._owner.type) + \".\";\n }\n\n setCurrentlyValidatingElement$1(element);\n\n error('Each child in a list should have a unique \"key\" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);\n\n setCurrentlyValidatingElement$1(null);\n }\n}\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\n\n\nfunction validateChildKeys(node, parentType) {\n {\n if (typeof node !== 'object') {\n return;\n }\n\n if (isArray(node)) {\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n\n if (isValidElement(child)) {\n validateExplicitKey(child, parentType);\n }\n }\n } else if (isValidElement(node)) {\n // This element was passed in a valid location.\n if (node._store) {\n node._store.validated = true;\n }\n } else if (node) {\n var iteratorFn = getIteratorFn(node);\n\n if (typeof iteratorFn === 'function') {\n // Entry iterators used to provide implicit keys,\n // but now we print a separate warning for them later.\n if (iteratorFn !== node.entries) {\n var iterator = iteratorFn.call(node);\n var step;\n\n while (!(step = iterator.next()).done) {\n if (isValidElement(step.value)) {\n validateExplicitKey(step.value, parentType);\n }\n }\n }\n }\n }\n }\n}\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\n\n\nfunction validatePropTypes(element) {\n {\n var type = element.type;\n\n if (type === null || type === undefined || typeof type === 'string') {\n return;\n }\n\n var propTypes;\n\n if (typeof type === 'function') {\n propTypes = type.propTypes;\n } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.\n // Inner props are checked in the reconciler.\n type.$$typeof === REACT_MEMO_TYPE)) {\n propTypes = type.propTypes;\n } else {\n return;\n }\n\n if (propTypes) {\n // Intentionally inside to avoid triggering lazy initializers:\n var name = getComponentNameFromType(type);\n checkPropTypes(propTypes, element.props, 'prop', name, element);\n } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {\n propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:\n\n var _name = getComponentNameFromType(type);\n\n error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');\n }\n\n if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {\n error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');\n }\n }\n}\n/**\n * Given a fragment, validate that it can only be provided with fragment props\n * @param {ReactElement} fragment\n */\n\n\nfunction validateFragmentProps(fragment) {\n {\n var keys = Object.keys(fragment.props);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key !== 'children' && key !== 'key') {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);\n\n setCurrentlyValidatingElement$1(null);\n break;\n }\n }\n\n if (fragment.ref !== null) {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid attribute `ref` supplied to `React.Fragment`.');\n\n setCurrentlyValidatingElement$1(null);\n }\n }\n}\n\nfunction jsxWithValidation(type, props, key, isStaticChildren, source, self) {\n {\n var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to\n // succeed and there will likely be errors in render.\n\n if (!validType) {\n var info = '';\n\n if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {\n info += ' You likely forgot to export your component from the file ' + \"it's defined in, or you might have mixed up default and named imports.\";\n }\n\n var sourceInfo = getSourceInfoErrorAddendum(source);\n\n if (sourceInfo) {\n info += sourceInfo;\n } else {\n info += getDeclarationErrorAddendum();\n }\n\n var typeString;\n\n if (type === null) {\n typeString = 'null';\n } else if (isArray(type)) {\n typeString = 'array';\n } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {\n typeString = \"<\" + (getComponentNameFromType(type.type) || 'Unknown') + \" />\";\n info = ' Did you accidentally export a JSX literal instead of a component?';\n } else {\n typeString = typeof type;\n }\n\n error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);\n }\n\n var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.\n // TODO: Drop this when these are no longer allowed as the type argument.\n\n if (element == null) {\n return element;\n } // Skip key warning if the type isn't valid since our key validation logic\n // doesn't expect a non-string/function type and can throw confusing errors.\n // We don't want exception behavior to differ between dev and prod.\n // (Rendering will throw with a helpful message and as soon as the type is\n // fixed, the key warnings will appear.)\n\n\n if (validType) {\n var children = props.children;\n\n if (children !== undefined) {\n if (isStaticChildren) {\n if (isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n validateChildKeys(children[i], type);\n }\n\n if (Object.freeze) {\n Object.freeze(children);\n }\n } else {\n error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');\n }\n } else {\n validateChildKeys(children, type);\n }\n }\n }\n\n if (type === REACT_FRAGMENT_TYPE) {\n validateFragmentProps(element);\n } else {\n validatePropTypes(element);\n }\n\n return element;\n }\n} // These two functions exist to still get child warnings in dev\n// even with the prod transform. This means that jsxDEV is purely\n// opt-in behavior for better messages but that we won't stop\n// giving you warnings if you use production apis.\n\nfunction jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, true);\n }\n}\nfunction jsxWithValidationDynamic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, false);\n }\n}\n\nvar jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.\n// for now we can ship identical prod functions\n\nvar jsxs = jsxWithValidationStatic ;\n\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsx;\nexports.jsxs = jsxs;\n })();\n}\n"],"names":[],"mappings":"AAUA;AAEA,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;IACzC,CAAC,WAAW;QACd;QAEA,IAAI,QAAQ;QAMZ,IAAI,qBAAqB,OAAO,GAAG,CAAC;QACpC,IAAI,oBAAoB,OAAO,GAAG,CAAC;QACnC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,yBAAyB,OAAO,GA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AC;wBACH,OAAO;4BACL,kBAAkB,UAAU;wBAC9B,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,IAAI,SAAS,qBAAqB;oBAChC,sBAAsB;gBACxB,OAAO;oBACL,kBAAkB;gBACpB,CAAC;gBAED,OAAO;YACT;QACF;QAKA,SAAS,wBAAwB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;YACjD;gBACE,OAAO,kBAAkB,MAAM,OAAO,KAAK,IAAI;YACjD;QACF;QACA,SAAS,yBAAyB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;YAClD;gBACE,OAAO,kBAAkB,MAAM,OAAO,KAAK,KAAK;YAClD;QACF;QAEA,IAAI,MAAO;QAGX,IAAI,OAAQ;QAEZ,QAAQ,QAAQ,GAAG;QACnB,QAAQ,GAAG,GAAG;QACd,QAAQ,IAAI,GAAG;IACb,CAAC;AACH,CAAC"}}, - {"offset": {"line": 867, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] -} \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.b349fb.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.b349fb.map deleted file mode 100644 index 153a8c63e8ca1..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.b349fb.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/jsx-runtime.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n"],"names":[],"mappings":"AAAA;AAEA,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;IACzC,OAAO,OAAO,GAAG;AACnB,OAAO;IACL,OAAO,OAAO,GAAG;AACnB,CAAC"}}, - {"offset": {"line": 8, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] -} \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.c9fcbf31c9ecc116.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.c9fcbf31c9ecc116.map deleted file mode 100644 index c25a9266a9253..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.c9fcbf31c9ecc116.map +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/jsx-runtime.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n"],"names":[],"mappings":"AAAA;AAEA,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;IACzC,OAAO,OAAO,GAAG;AACnB,OAAO;IACL,OAAO,OAAO,GAAG;AACnB,CAAC"}}, - {"offset": {"line": 10, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}, - {"offset": {"line": 14, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/cjs/react-jsx-runtime.production.min.js"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n"],"names":[],"mappings":"AASA;AAAa,IAAI,IAAE,6EAAiB,IAAE,OAAO,GAAG,CAAC,kBAAiB,IAAE,OAAO,GAAG,CAAC,mBAAkB,IAAE,OAAO,SAAS,CAAC,cAAc,EAAC,IAAE,EAAE,kDAAkD,CAAC,iBAAiB,EAAC,IAAE;IAAC,KAAI,CAAC;IAAE,KAAI,CAAC;IAAE,QAAO,CAAC;IAAE,UAAS,CAAC;AAAC;AAClP,SAAS,EAAE,CAAC,EAAC,CAAC,EAAC,CAAC,EAAC;IAAC,IAAI,GAAE,IAAE,CAAC,GAAE,IAAE,IAAI,EAAC,IAAE,IAAI;IAAC,KAAK,MAAI,KAAG,CAAC,IAAE,KAAG,CAAC;IAAE,KAAK,MAAI,EAAE,GAAG,IAAE,CAAC,IAAE,KAAG,EAAE,GAAG;IAAE,KAAK,MAAI,EAAE,GAAG,IAAE,CAAC,IAAE,EAAE,GAAG;IAAE,IAAI,KAAK,EAAE,EAAE,IAAI,CAAC,GAAE,MAAI,CAAC,EAAE,cAAc,CAAC,MAAI,CAAC,CAAC,CAAC,EAAE,GAAC,CAAC,CAAC,EAAE;IAAE,IAAG,KAAG,EAAE,YAAY,EAAC,IAAI,KAAK,IAAE,EAAE,YAAY,EAAC,CAAC,CAAC,KAAK,MAAI,CAAC,CAAC,EAAE,IAAE,CAAC,CAAC,CAAC,EAAE,GAAC,CAAC,CAAC,EAAE;IAAE,OAAM;QAAC,UAAS;QAAE,MAAK;QAAE,KAAI;QAAE,KAAI;QAAE,OAAM;QAAE,QAAO,EAAE,OAAO;IAAA;AAAC;AAAC,QAAQ,QAAQ,GAAC;AAAE,QAAQ,GAAG,GAAC;AAAE,QAAQ,IAAI,GAAC"}}, - {"offset": {"line": 40, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}, - {"offset": {"line": 44, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/cjs/react-jsx-runtime.development.js"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\nvar React = require('react');\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var displayName = outerType.displayName;\n\n if (displayName) {\n return displayName;\n }\n\n var functionName = innerType.displayName || innerType.name || '';\n return functionName !== '' ? wrapperName + \"(\" + functionName + \")\" : wrapperName;\n} // Keep in sync with react-reconciler/getComponentNameFromFiber\n\n\nfunction getContextName(type) {\n return type.displayName || 'Context';\n} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.\n\n\nfunction getComponentNameFromType(type) {\n if (type == null) {\n // Host root, text node or just invalid type.\n return null;\n }\n\n {\n if (typeof type.tag === 'number') {\n error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');\n }\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || null;\n }\n\n if (typeof type === 'string') {\n return type;\n }\n\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return 'Fragment';\n\n case REACT_PORTAL_TYPE:\n return 'Portal';\n\n case REACT_PROFILER_TYPE:\n return 'Profiler';\n\n case REACT_STRICT_MODE_TYPE:\n return 'StrictMode';\n\n case REACT_SUSPENSE_TYPE:\n return 'Suspense';\n\n case REACT_SUSPENSE_LIST_TYPE:\n return 'SuspenseList';\n\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n var context = type;\n return getContextName(context) + '.Consumer';\n\n case REACT_PROVIDER_TYPE:\n var provider = type;\n return getContextName(provider._context) + '.Provider';\n\n case REACT_FORWARD_REF_TYPE:\n return getWrappedName(type, type.render, 'ForwardRef');\n\n case REACT_MEMO_TYPE:\n var outerName = type.displayName || null;\n\n if (outerName !== null) {\n return outerName;\n }\n\n return getComponentNameFromType(type.type) || 'Memo';\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n return getComponentNameFromType(init(payload));\n } catch (x) {\n return null;\n }\n }\n\n // eslint-disable-next-line no-fallthrough\n }\n }\n\n return null;\n}\n\nvar assign = Object.assign;\n\n// Helpers to patch console.logs to avoid logging during side-effect free\n// replaying on render function. This currently only patches the object\n// lazily which won't cover if the log function was extracted eagerly.\n// We could also eagerly patch the method.\nvar disabledDepth = 0;\nvar prevLog;\nvar prevInfo;\nvar prevWarn;\nvar prevError;\nvar prevGroup;\nvar prevGroupCollapsed;\nvar prevGroupEnd;\n\nfunction disabledLog() {}\n\ndisabledLog.__reactDisabledLog = true;\nfunction disableLogs() {\n {\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099\n\n var props = {\n configurable: true,\n enumerable: true,\n value: disabledLog,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n disabledDepth++;\n }\n}\nfunction reenableLogs() {\n {\n disabledDepth--;\n\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n var props = {\n configurable: true,\n enumerable: true,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n log: assign({}, props, {\n value: prevLog\n }),\n info: assign({}, props, {\n value: prevInfo\n }),\n warn: assign({}, props, {\n value: prevWarn\n }),\n error: assign({}, props, {\n value: prevError\n }),\n group: assign({}, props, {\n value: prevGroup\n }),\n groupCollapsed: assign({}, props, {\n value: prevGroupCollapsed\n }),\n groupEnd: assign({}, props, {\n value: prevGroupEnd\n })\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n if (disabledDepth < 0) {\n error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');\n }\n }\n}\n\nvar ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;\nvar prefix;\nfunction describeBuiltInComponentFrame(name, source, ownerFn) {\n {\n if (prefix === undefined) {\n // Extract the VM specific prefix used by each line.\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = match && match[1] || '';\n }\n } // We use the prefix to ensure our stacks line up with native stack frames.\n\n\n return '\\n' + prefix + name;\n }\n}\nvar reentry = false;\nvar componentFrameCache;\n\n{\n var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;\n componentFrameCache = new PossiblyWeakMap();\n}\n\nfunction describeNativeComponentFrame(fn, construct) {\n // If something asked for a stack inside a fake render, it should get ignored.\n if ( !fn || reentry) {\n return '';\n }\n\n {\n var frame = componentFrameCache.get(fn);\n\n if (frame !== undefined) {\n return frame;\n }\n }\n\n var control;\n reentry = true;\n var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.\n\n Error.prepareStackTrace = undefined;\n var previousDispatcher;\n\n {\n previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function\n // for warnings.\n\n ReactCurrentDispatcher.current = null;\n disableLogs();\n }\n\n try {\n // This should throw.\n if (construct) {\n // Something should be setting the props in the constructor.\n var Fake = function () {\n throw Error();\n }; // $FlowFixMe\n\n\n Object.defineProperty(Fake.prototype, 'props', {\n set: function () {\n // We use a throwing setter instead of frozen or non-writable props\n // because that won't throw in a non-strict mode function.\n throw Error();\n }\n });\n\n if (typeof Reflect === 'object' && Reflect.construct) {\n // We construct a different control for this case to include any extra\n // frames added by the construct call.\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n control = x;\n }\n\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x) {\n control = x;\n }\n\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x) {\n control = x;\n }\n\n fn();\n }\n } catch (sample) {\n // This is inlined manually because closure doesn't do it for us.\n if (sample && control && typeof sample.stack === 'string') {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n var sampleLines = sample.stack.split('\\n');\n var controlLines = control.stack.split('\\n');\n var s = sampleLines.length - 1;\n var c = controlLines.length - 1;\n\n while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n c--;\n }\n\n for (; s >= 1 && c >= 0; s--, c--) {\n // Next we find the first one that isn't the same which should be the\n // frame that called our sample function and the control.\n if (sampleLines[s] !== controlLines[c]) {\n // In V8, the first line is describing the message but other VMs don't.\n // If we're about to return the first line, and the control is also on the same\n // line, that's a pretty good indicator that our sample threw at same line as\n // the control. I.e. before we entered the sample frame. So we ignore this result.\n // This can happen if you passed a class to function component, or non-function.\n if (s !== 1 || c !== 1) {\n do {\n s--;\n c--; // We may still have similar intermediate frames from the construct call.\n // The next one that isn't the same should be our match though.\n\n if (c < 0 || sampleLines[s] !== controlLines[c]) {\n // V8 adds a \"new\" prefix for native classes. Let's remove it to make it prettier.\n var _frame = '\\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled \"\"\n // but we have a user-provided \"displayName\"\n // splice it in to make the stack more readable.\n\n\n if (fn.displayName && _frame.includes('')) {\n _frame = _frame.replace('', fn.displayName);\n }\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, _frame);\n }\n } // Return the line we found.\n\n\n return _frame;\n }\n } while (s >= 1 && c >= 0);\n }\n\n break;\n }\n }\n }\n } finally {\n reentry = false;\n\n {\n ReactCurrentDispatcher.current = previousDispatcher;\n reenableLogs();\n }\n\n Error.prepareStackTrace = previousPrepareStackTrace;\n } // Fallback to just using the name if we couldn't make it throw.\n\n\n var name = fn ? fn.displayName || fn.name : '';\n var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, syntheticFrame);\n }\n }\n\n return syntheticFrame;\n}\nfunction describeFunctionComponentFrame(fn, source, ownerFn) {\n {\n return describeNativeComponentFrame(fn, false);\n }\n}\n\nfunction shouldConstruct(Component) {\n var prototype = Component.prototype;\n return !!(prototype && prototype.isReactComponent);\n}\n\nfunction describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {\n\n if (type == null) {\n return '';\n }\n\n if (typeof type === 'function') {\n {\n return describeNativeComponentFrame(type, shouldConstruct(type));\n }\n }\n\n if (typeof type === 'string') {\n return describeBuiltInComponentFrame(type);\n }\n\n switch (type) {\n case REACT_SUSPENSE_TYPE:\n return describeBuiltInComponentFrame('Suspense');\n\n case REACT_SUSPENSE_LIST_TYPE:\n return describeBuiltInComponentFrame('SuspenseList');\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_FORWARD_REF_TYPE:\n return describeFunctionComponentFrame(type.render);\n\n case REACT_MEMO_TYPE:\n // Memo may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n // Lazy may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);\n } catch (x) {}\n }\n }\n }\n\n return '';\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar loggedTypeFailures = {};\nvar ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame.setExtraStackFrame(null);\n }\n }\n}\n\nfunction checkPropTypes(typeSpecs, values, location, componentName, element) {\n {\n // $FlowFixMe This is okay but Flow doesn't know it.\n var has = Function.call.bind(hasOwnProperty);\n\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n // eslint-disable-next-line react-internal/prod-error-codes\n var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');\n err.name = 'Invariant Violation';\n throw err;\n }\n\n error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');\n } catch (ex) {\n error$1 = ex;\n }\n\n if (error$1 && !(error$1 instanceof Error)) {\n setCurrentlyValidatingElement(element);\n\n error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);\n\n setCurrentlyValidatingElement(null);\n }\n\n if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error$1.message] = true;\n setCurrentlyValidatingElement(element);\n\n error('Failed %s type: %s', location, error$1.message);\n\n setCurrentlyValidatingElement(null);\n }\n }\n }\n }\n}\n\nvar isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare\n\nfunction isArray(a) {\n return isArrayImpl(a);\n}\n\n/*\n * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol\n * and Temporal.* types. See https://github.com/facebook/react/pull/22064.\n *\n * The functions in this module will throw an easier-to-understand,\n * easier-to-debug exception with a clear errors message message explaining the\n * problem. (Instead of a confusing exception thrown inside the implementation\n * of the `value` object).\n */\n// $FlowFixMe only called in DEV, so void return is not possible.\nfunction typeName(value) {\n {\n // toStringTag is needed for namespaced types like Temporal.Instant\n var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;\n var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';\n return type;\n }\n} // $FlowFixMe only called in DEV, so void return is not possible.\n\n\nfunction willCoercionThrow(value) {\n {\n try {\n testStringCoercion(value);\n return false;\n } catch (e) {\n return true;\n }\n }\n}\n\nfunction testStringCoercion(value) {\n // If you ended up here by following an exception call stack, here's what's\n // happened: you supplied an object or symbol value to React (as a prop, key,\n // DOM attribute, CSS property, string ref, etc.) and when React tried to\n // coerce it to a string using `'' + value`, an exception was thrown.\n //\n // The most common types that will cause this exception are `Symbol` instances\n // and Temporal objects like `Temporal.Instant`. But any object that has a\n // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this\n // exception. (Library authors do this to prevent users from using built-in\n // numeric operators like `+` or comparison operators like `>=` because custom\n // methods are needed to perform accurate arithmetic or comparison.)\n //\n // To fix the problem, coerce this object or symbol value to a string before\n // passing it to React. The most reliable way is usually `String(value)`.\n //\n // To find which value is throwing, check the browser or debugger console.\n // Before this exception was thrown, there should be `console.error` output\n // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the\n // problem and how that type was used: key, atrribute, input value prop, etc.\n // In most cases, this console output also shows the component and its\n // ancestor components where the exception happened.\n //\n // eslint-disable-next-line react-internal/safe-string-coercion\n return '' + value;\n}\nfunction checkKeyStringCoercion(value) {\n {\n if (willCoercionThrow(value)) {\n error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));\n\n return testStringCoercion(value); // throw (to help callers find troubleshooting comments)\n }\n }\n}\n\nvar ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\nvar specialPropKeyWarningShown;\nvar specialPropRefWarningShown;\nvar didWarnAboutStringRefs;\n\n{\n didWarnAboutStringRefs = {};\n}\n\nfunction hasValidRef(config) {\n {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.key !== undefined;\n}\n\nfunction warnIfStringRefCannotBeAutoConverted(config, self) {\n {\n if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {\n var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (!didWarnAboutStringRefs[componentName]) {\n error('Component \"%s\" contains the string ref \"%s\". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);\n\n didWarnAboutStringRefs[componentName] = true;\n }\n }\n }\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingKey = function () {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n\n error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n }\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingRef = function () {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n\n error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n }\n}\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, instanceof check\n * will not work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} props\n * @param {*} key\n * @param {string|object} ref\n * @param {*} owner\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @internal\n */\n\n\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allows us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {}; // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n }); // self and source are DEV only properties.\n\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n }); // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n/**\n * https://github.com/reactjs/rfcs/pull/107\n * @param {*} type\n * @param {object} props\n * @param {string} key\n */\n\nfunction jsxDEV(type, config, maybeKey, source, self) {\n {\n var propName; // Reserved names are extracted\n\n var props = {};\n var key = null;\n var ref = null; // Currently, key can be spread in as a prop. This causes a potential\n // issue if key is also explicitly declared (ie.
\n // or
). We want to deprecate key spread,\n // but as an intermediary step, we will use jsxDEV for everything except\n //
, because we aren't currently able to tell if\n // key is explicitly declared to be undefined or not.\n\n if (maybeKey !== undefined) {\n {\n checkKeyStringCoercion(maybeKey);\n }\n\n key = '' + maybeKey;\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n }\n\n if (hasValidRef(config)) {\n ref = config.ref;\n warnIfStringRefCannotBeAutoConverted(config, self);\n } // Remaining properties are added to a new props object\n\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n } // Resolve default props\n\n\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n\n if (key || ref) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n }\n}\n\nvar ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;\nvar ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement$1(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame$1.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame$1.setExtraStackFrame(null);\n }\n }\n}\n\nvar propTypesMisspellWarningShown;\n\n{\n propTypesMisspellWarningShown = false;\n}\n/**\n * Verifies the object is a ReactElement.\n * See https://reactjs.org/docs/react-api.html#isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a ReactElement.\n * @final\n */\n\n\nfunction isValidElement(object) {\n {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n }\n}\n\nfunction getDeclarationErrorAddendum() {\n {\n if (ReactCurrentOwner$1.current) {\n var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);\n\n if (name) {\n return '\\n\\nCheck the render method of `' + name + '`.';\n }\n }\n\n return '';\n }\n}\n\nfunction getSourceInfoErrorAddendum(source) {\n {\n if (source !== undefined) {\n var fileName = source.fileName.replace(/^.*[\\\\\\/]/, '');\n var lineNumber = source.lineNumber;\n return '\\n\\nCheck your code at ' + fileName + ':' + lineNumber + '.';\n }\n\n return '';\n }\n}\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\n\n\nvar ownerHasKeyUseWarning = {};\n\nfunction getCurrentComponentErrorInfo(parentType) {\n {\n var info = getDeclarationErrorAddendum();\n\n if (!info) {\n var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;\n\n if (parentName) {\n info = \"\\n\\nCheck the top-level render call using <\" + parentName + \">.\";\n }\n }\n\n return info;\n }\n}\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it. Error statuses are cached so a warning\n * will only be shown once.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\n\n\nfunction validateExplicitKey(element, parentType) {\n {\n if (!element._store || element._store.validated || element.key != null) {\n return;\n }\n\n element._store.validated = true;\n var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);\n\n if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {\n return;\n }\n\n ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a\n // property, it may be the creator of the child that's responsible for\n // assigning it a key.\n\n var childOwner = '';\n\n if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {\n // Give the component that originally created this child.\n childOwner = \" It was passed a child from \" + getComponentNameFromType(element._owner.type) + \".\";\n }\n\n setCurrentlyValidatingElement$1(element);\n\n error('Each child in a list should have a unique \"key\" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);\n\n setCurrentlyValidatingElement$1(null);\n }\n}\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\n\n\nfunction validateChildKeys(node, parentType) {\n {\n if (typeof node !== 'object') {\n return;\n }\n\n if (isArray(node)) {\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n\n if (isValidElement(child)) {\n validateExplicitKey(child, parentType);\n }\n }\n } else if (isValidElement(node)) {\n // This element was passed in a valid location.\n if (node._store) {\n node._store.validated = true;\n }\n } else if (node) {\n var iteratorFn = getIteratorFn(node);\n\n if (typeof iteratorFn === 'function') {\n // Entry iterators used to provide implicit keys,\n // but now we print a separate warning for them later.\n if (iteratorFn !== node.entries) {\n var iterator = iteratorFn.call(node);\n var step;\n\n while (!(step = iterator.next()).done) {\n if (isValidElement(step.value)) {\n validateExplicitKey(step.value, parentType);\n }\n }\n }\n }\n }\n }\n}\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\n\n\nfunction validatePropTypes(element) {\n {\n var type = element.type;\n\n if (type === null || type === undefined || typeof type === 'string') {\n return;\n }\n\n var propTypes;\n\n if (typeof type === 'function') {\n propTypes = type.propTypes;\n } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.\n // Inner props are checked in the reconciler.\n type.$$typeof === REACT_MEMO_TYPE)) {\n propTypes = type.propTypes;\n } else {\n return;\n }\n\n if (propTypes) {\n // Intentionally inside to avoid triggering lazy initializers:\n var name = getComponentNameFromType(type);\n checkPropTypes(propTypes, element.props, 'prop', name, element);\n } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {\n propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:\n\n var _name = getComponentNameFromType(type);\n\n error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');\n }\n\n if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {\n error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');\n }\n }\n}\n/**\n * Given a fragment, validate that it can only be provided with fragment props\n * @param {ReactElement} fragment\n */\n\n\nfunction validateFragmentProps(fragment) {\n {\n var keys = Object.keys(fragment.props);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key !== 'children' && key !== 'key') {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);\n\n setCurrentlyValidatingElement$1(null);\n break;\n }\n }\n\n if (fragment.ref !== null) {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid attribute `ref` supplied to `React.Fragment`.');\n\n setCurrentlyValidatingElement$1(null);\n }\n }\n}\n\nfunction jsxWithValidation(type, props, key, isStaticChildren, source, self) {\n {\n var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to\n // succeed and there will likely be errors in render.\n\n if (!validType) {\n var info = '';\n\n if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {\n info += ' You likely forgot to export your component from the file ' + \"it's defined in, or you might have mixed up default and named imports.\";\n }\n\n var sourceInfo = getSourceInfoErrorAddendum(source);\n\n if (sourceInfo) {\n info += sourceInfo;\n } else {\n info += getDeclarationErrorAddendum();\n }\n\n var typeString;\n\n if (type === null) {\n typeString = 'null';\n } else if (isArray(type)) {\n typeString = 'array';\n } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {\n typeString = \"<\" + (getComponentNameFromType(type.type) || 'Unknown') + \" />\";\n info = ' Did you accidentally export a JSX literal instead of a component?';\n } else {\n typeString = typeof type;\n }\n\n error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);\n }\n\n var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.\n // TODO: Drop this when these are no longer allowed as the type argument.\n\n if (element == null) {\n return element;\n } // Skip key warning if the type isn't valid since our key validation logic\n // doesn't expect a non-string/function type and can throw confusing errors.\n // We don't want exception behavior to differ between dev and prod.\n // (Rendering will throw with a helpful message and as soon as the type is\n // fixed, the key warnings will appear.)\n\n\n if (validType) {\n var children = props.children;\n\n if (children !== undefined) {\n if (isStaticChildren) {\n if (isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n validateChildKeys(children[i], type);\n }\n\n if (Object.freeze) {\n Object.freeze(children);\n }\n } else {\n error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');\n }\n } else {\n validateChildKeys(children, type);\n }\n }\n }\n\n if (type === REACT_FRAGMENT_TYPE) {\n validateFragmentProps(element);\n } else {\n validatePropTypes(element);\n }\n\n return element;\n }\n} // These two functions exist to still get child warnings in dev\n// even with the prod transform. This means that jsxDEV is purely\n// opt-in behavior for better messages but that we won't stop\n// giving you warnings if you use production apis.\n\nfunction jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, true);\n }\n}\nfunction jsxWithValidationDynamic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, false);\n }\n}\n\nvar jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.\n// for now we can ship identical prod functions\n\nvar jsxs = jsxWithValidationStatic ;\n\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsx;\nexports.jsxs = jsxs;\n })();\n}\n"],"names":[],"mappings":"AAUA;AAEA,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;IACzC,CAAC,WAAW;QACd;QAEA,IAAI,QAAQ;QAMZ,IAAI,qBAAqB,OAAO,GAAG,CAAC;QACpC,IAAI,oBAAoB,OAAO,GAAG,CAAC;QACnC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,yBAAyB,OAAO,GAAG,CAAC;QACxC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,qBAAqB,OAAO,GAAG,CAAC;QACpC,IAAI,yBAAyB,OAAO,GAAG,CAAC;QACxC,IAAI,sBAAsB,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,SAAS,wBAAwB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;YACjD;gBACE,OAAO,kBAAkB,MAAM,OAAO,KAAK,IAAI;YACjD;QACF;QACA,SAAS,yBAAyB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;YAClD;gBACE,OAAO,kBAAkB,MAAM,OAAO,KAAK,KAAK;YAClD;QACF;QAEA,IAAI,MAAO;QAGX,IAAI,OAAQ;QAEZ,QAAQ,QAAQ,GAAG;QACnB,QAAQ,GAAG,GAAG;QACd,QAAQ,IAAI,GAAG;IACb,CAAC;AACH,CAAC"}}, - {"offset": {"line": 909, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}, - {"offset": {"line": 913, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react.production.min.js');\n} else {\n module.exports = require('./cjs/react.development.js');\n}\n"],"names":[],"mappings":"AAAA;AAEA,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;IACzC,OAAO,OAAO,GAAG;AACnB,OAAO;IACL,OAAO,OAAO,GAAG;AACnB,CAAC"}}, - {"offset": {"line": 919, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}, - {"offset": {"line": 923, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/cjs/react.production.min.js"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n printWarning('warn', format, args);\n }\n }\n}\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\nvar didWarnStateUpdateForUnmountedComponent = {};\n\nfunction warnNoop(publicInstance, callerName) {\n {\n var _constructor = publicInstance.constructor;\n var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';\n var warningKey = componentName + \".\" + callerName;\n\n if (didWarnStateUpdateForUnmountedComponent[warningKey]) {\n return;\n }\n\n error(\"Can't call %s on a component that is not yet mounted. \" + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);\n\n didWarnStateUpdateForUnmountedComponent[warningKey] = true;\n }\n}\n/**\n * This is the abstract API for an update queue.\n */\n\n\nvar ReactNoopUpdateQueue = {\n /**\n * Checks whether or not this composite component is mounted.\n * @param {ReactClass} publicInstance The instance we want to test.\n * @return {boolean} True if mounted, false otherwise.\n * @protected\n * @final\n */\n isMounted: function (publicInstance) {\n return false;\n },\n\n /**\n * Forces an update. This should only be invoked when it is known with\n * certainty that we are **not** in a DOM transaction.\n *\n * You may want to call this when you know that some deeper aspect of the\n * component's state has changed but `setState` was not called.\n *\n * This will not invoke `shouldComponentUpdate`, but it will invoke\n * `componentWillUpdate` and `componentDidUpdate`.\n *\n * @param {ReactClass} publicInstance The instance that should rerender.\n * @param {?function} callback Called after component is updated.\n * @param {?string} callerName name of the calling function in the public API.\n * @internal\n */\n enqueueForceUpdate: function (publicInstance, callback, callerName) {\n warnNoop(publicInstance, 'forceUpdate');\n },\n\n /**\n * Replaces all of the state. Always use this or `setState` to mutate state.\n * You should treat `this.state` as immutable.\n *\n * There is no guarantee that `this.state` will be immediately updated, so\n * accessing `this.state` after calling this method may return the old value.\n *\n * @param {ReactClass} publicInstance The instance that should rerender.\n * @param {object} completeState Next state.\n * @param {?function} callback Called after component is updated.\n * @param {?string} callerName name of the calling function in the public API.\n * @internal\n */\n enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {\n warnNoop(publicInstance, 'replaceState');\n },\n\n /**\n * Sets a subset of the state. This only exists because _pendingState is\n * internal. This provides a merging strategy that is not available to deep\n * properties which is confusing. TODO: Expose pendingState or don't use it\n * during the merge.\n *\n * @param {ReactClass} publicInstance The instance that should rerender.\n * @param {object} partialState Next partial state to be merged with state.\n * @param {?function} callback Called after component is updated.\n * @param {?string} Name of the calling function in the public API.\n * @internal\n */\n enqueueSetState: function (publicInstance, partialState, callback, callerName) {\n warnNoop(publicInstance, 'setState');\n }\n};\n\nvar assign = Object.assign;\n\nvar emptyObject = {};\n\n{\n Object.freeze(emptyObject);\n}\n/**\n * Base class helpers for the updating state of a component.\n */\n\n\nfunction Component(props, context, updater) {\n this.props = props;\n this.context = context; // If a component has string refs, we will assign a different object later.\n\n this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the\n // renderer.\n\n this.updater = updater || ReactNoopUpdateQueue;\n}\n\nComponent.prototype.isReactComponent = {};\n/**\n * Sets a subset of the state. Always use this to mutate\n * state. You should treat `this.state` as immutable.\n *\n * There is no guarantee that `this.state` will be immediately updated, so\n * accessing `this.state` after calling this method may return the old value.\n *\n * There is no guarantee that calls to `setState` will run synchronously,\n * as they may eventually be batched together. You can provide an optional\n * callback that will be executed when the call to setState is actually\n * completed.\n *\n * When a function is provided to setState, it will be called at some point in\n * the future (not synchronously). It will be called with the up to date\n * component arguments (state, props, context). These values can be different\n * from this.* because your function may be called after receiveProps but before\n * shouldComponentUpdate, and this new state, props, and context will not yet be\n * assigned to this.\n *\n * @param {object|function} partialState Next partial state or function to\n * produce next partial state to be merged with current state.\n * @param {?function} callback Called after state is updated.\n * @final\n * @protected\n */\n\nComponent.prototype.setState = function (partialState, callback) {\n if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {\n throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');\n }\n\n this.updater.enqueueSetState(this, partialState, callback, 'setState');\n};\n/**\n * Forces an update. This should only be invoked when it is known with\n * certainty that we are **not** in a DOM transaction.\n *\n * You may want to call this when you know that some deeper aspect of the\n * component's state has changed but `setState` was not called.\n *\n * This will not invoke `shouldComponentUpdate`, but it will invoke\n * `componentWillUpdate` and `componentDidUpdate`.\n *\n * @param {?function} callback Called after update is complete.\n * @final\n * @protected\n */\n\n\nComponent.prototype.forceUpdate = function (callback) {\n this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');\n};\n/**\n * Deprecated APIs. These APIs used to exist on classic React classes but since\n * we would like to deprecate them, we're not going to move them over to this\n * modern base class. Instead, we define a getter that warns if it's accessed.\n */\n\n\n{\n var deprecatedAPIs = {\n isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],\n replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']\n };\n\n var defineDeprecationWarning = function (methodName, info) {\n Object.defineProperty(Component.prototype, methodName, {\n get: function () {\n warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);\n\n return undefined;\n }\n });\n };\n\n for (var fnName in deprecatedAPIs) {\n if (deprecatedAPIs.hasOwnProperty(fnName)) {\n defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);\n }\n }\n}\n\nfunction ComponentDummy() {}\n\nComponentDummy.prototype = Component.prototype;\n/**\n * Convenience component with default shallow equality check for sCU.\n */\n\nfunction PureComponent(props, context, updater) {\n this.props = props;\n this.context = context; // If a component has string refs, we will assign a different object later.\n\n this.refs = emptyObject;\n this.updater = updater || ReactNoopUpdateQueue;\n}\n\nvar pureComponentPrototype = PureComponent.prototype = new ComponentDummy();\npureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.\n\nassign(pureComponentPrototype, Component.prototype);\npureComponentPrototype.isPureReactComponent = true;\n\n// an immutable object with a single mutable value\nfunction createRef() {\n var refObject = {\n current: null\n };\n\n {\n Object.seal(refObject);\n }\n\n return refObject;\n}\n\nvar isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare\n\nfunction isArray(a) {\n return isArrayImpl(a);\n}\n\n/*\n * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol\n * and Temporal.* types. See https://github.com/facebook/react/pull/22064.\n *\n * The functions in this module will throw an easier-to-understand,\n * easier-to-debug exception with a clear errors message message explaining the\n * problem. (Instead of a confusing exception thrown inside the implementation\n * of the `value` object).\n */\n// $FlowFixMe only called in DEV, so void return is not possible.\nfunction typeName(value) {\n {\n // toStringTag is needed for namespaced types like Temporal.Instant\n var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;\n var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';\n return type;\n }\n} // $FlowFixMe only called in DEV, so void return is not possible.\n\n\nfunction willCoercionThrow(value) {\n {\n try {\n testStringCoercion(value);\n return false;\n } catch (e) {\n return true;\n }\n }\n}\n\nfunction testStringCoercion(value) {\n // If you ended up here by following an exception call stack, here's what's\n // happened: you supplied an object or symbol value to React (as a prop, key,\n // DOM attribute, CSS property, string ref, etc.) and when React tried to\n // coerce it to a string using `'' + value`, an exception was thrown.\n //\n // The most common types that will cause this exception are `Symbol` instances\n // and Temporal objects like `Temporal.Instant`. But any object that has a\n // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this\n // exception. (Library authors do this to prevent users from using built-in\n // numeric operators like `+` or comparison operators like `>=` because custom\n // methods are needed to perform accurate arithmetic or comparison.)\n //\n // To fix the problem, coerce this object or symbol value to a string before\n // passing it to React. The most reliable way is usually `String(value)`.\n //\n // To find which value is throwing, check the browser or debugger console.\n // Before this exception was thrown, there should be `console.error` output\n // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the\n // problem and how that type was used: key, atrribute, input value prop, etc.\n // In most cases, this console output also shows the component and its\n // ancestor components where the exception happened.\n //\n // eslint-disable-next-line react-internal/safe-string-coercion\n return '' + value;\n}\nfunction checkKeyStringCoercion(value) {\n {\n if (willCoercionThrow(value)) {\n error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));\n\n return testStringCoercion(value); // throw (to help callers find troubleshooting comments)\n }\n }\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var displayName = outerType.displayName;\n\n if (displayName) {\n return displayName;\n }\n\n var functionName = innerType.displayName || innerType.name || '';\n return functionName !== '' ? wrapperName + \"(\" + functionName + \")\" : wrapperName;\n} // Keep in sync with react-reconciler/getComponentNameFromFiber\n\n\nfunction getContextName(type) {\n return type.displayName || 'Context';\n} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.\n\n\nfunction getComponentNameFromType(type) {\n if (type == null) {\n // Host root, text node or just invalid type.\n return null;\n }\n\n {\n if (typeof type.tag === 'number') {\n error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');\n }\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || null;\n }\n\n if (typeof type === 'string') {\n return type;\n }\n\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return 'Fragment';\n\n case REACT_PORTAL_TYPE:\n return 'Portal';\n\n case REACT_PROFILER_TYPE:\n return 'Profiler';\n\n case REACT_STRICT_MODE_TYPE:\n return 'StrictMode';\n\n case REACT_SUSPENSE_TYPE:\n return 'Suspense';\n\n case REACT_SUSPENSE_LIST_TYPE:\n return 'SuspenseList';\n\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n var context = type;\n return getContextName(context) + '.Consumer';\n\n case REACT_PROVIDER_TYPE:\n var provider = type;\n return getContextName(provider._context) + '.Provider';\n\n case REACT_FORWARD_REF_TYPE:\n return getWrappedName(type, type.render, 'ForwardRef');\n\n case REACT_MEMO_TYPE:\n var outerName = type.displayName || null;\n\n if (outerName !== null) {\n return outerName;\n }\n\n return getComponentNameFromType(type.type) || 'Memo';\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n return getComponentNameFromType(init(payload));\n } catch (x) {\n return null;\n }\n }\n\n // eslint-disable-next-line no-fallthrough\n }\n }\n\n return null;\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\nvar specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;\n\n{\n didWarnAboutStringRefs = {};\n}\n\nfunction hasValidRef(config) {\n {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.key !== undefined;\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n var warnAboutAccessingKey = function () {\n {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n\n error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n }\n };\n\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n var warnAboutAccessingRef = function () {\n {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n\n error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n }\n };\n\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n}\n\nfunction warnIfStringRefCannotBeAutoConverted(config) {\n {\n if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {\n var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (!didWarnAboutStringRefs[componentName]) {\n error('Component \"%s\" contains the string ref \"%s\". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);\n\n didWarnAboutStringRefs[componentName] = true;\n }\n }\n }\n}\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, instanceof check\n * will not work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} props\n * @param {*} key\n * @param {string|object} ref\n * @param {*} owner\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @internal\n */\n\n\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allows us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {}; // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n }); // self and source are DEV only properties.\n\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n }); // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n/**\n * Create and return a new ReactElement of the given type.\n * See https://reactjs.org/docs/react-api.html#createelement\n */\n\nfunction createElement(type, config, children) {\n var propName; // Reserved names are extracted\n\n var props = {};\n var key = null;\n var ref = null;\n var self = null;\n var source = null;\n\n if (config != null) {\n if (hasValidRef(config)) {\n ref = config.ref;\n\n {\n warnIfStringRefCannotBeAutoConverted(config);\n }\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n }\n\n self = config.__self === undefined ? null : config.__self;\n source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n }\n } // Children can be more than one argument, and those are transferred onto\n // the newly allocated props object.\n\n\n var childrenLength = arguments.length - 2;\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 2];\n }\n\n {\n if (Object.freeze) {\n Object.freeze(childArray);\n }\n }\n\n props.children = childArray;\n } // Resolve default props\n\n\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n\n {\n if (key || ref) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n }\n\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n}\nfunction cloneAndReplaceKey(oldElement, newKey) {\n var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);\n return newElement;\n}\n/**\n * Clone and return a new ReactElement using element as the starting point.\n * See https://reactjs.org/docs/react-api.html#cloneelement\n */\n\nfunction cloneElement(element, config, children) {\n if (element === null || element === undefined) {\n throw new Error(\"React.cloneElement(...): The argument must be a React element, but you passed \" + element + \".\");\n }\n\n var propName; // Original props are copied\n\n var props = assign({}, element.props); // Reserved names are extracted\n\n var key = element.key;\n var ref = element.ref; // Self is preserved since the owner is preserved.\n\n var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a\n // transpiler, and the original source is probably a better indicator of the\n // true owner.\n\n var source = element._source; // Owner will be preserved, unless ref is overridden\n\n var owner = element._owner;\n\n if (config != null) {\n if (hasValidRef(config)) {\n // Silently steal the ref from the parent.\n ref = config.ref;\n owner = ReactCurrentOwner.current;\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n } // Remaining properties override existing props\n\n\n var defaultProps;\n\n if (element.type && element.type.defaultProps) {\n defaultProps = element.type.defaultProps;\n }\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n if (config[propName] === undefined && defaultProps !== undefined) {\n // Resolve default props\n props[propName] = defaultProps[propName];\n } else {\n props[propName] = config[propName];\n }\n }\n }\n } // Children can be more than one argument, and those are transferred onto\n // the newly allocated props object.\n\n\n var childrenLength = arguments.length - 2;\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 2];\n }\n\n props.children = childArray;\n }\n\n return ReactElement(element.type, key, ref, self, source, owner, props);\n}\n/**\n * Verifies the object is a ReactElement.\n * See https://reactjs.org/docs/react-api.html#isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a ReactElement.\n * @final\n */\n\nfunction isValidElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\n\nvar SEPARATOR = '.';\nvar SUBSEPARATOR = ':';\n/**\n * Escape and wrap key so it is safe to use as a reactid\n *\n * @param {string} key to be escaped.\n * @return {string} the escaped key.\n */\n\nfunction escape(key) {\n var escapeRegex = /[=:]/g;\n var escaperLookup = {\n '=': '=0',\n ':': '=2'\n };\n var escapedString = key.replace(escapeRegex, function (match) {\n return escaperLookup[match];\n });\n return '$' + escapedString;\n}\n/**\n * TODO: Test that a single child and an array with one item have the same key\n * pattern.\n */\n\n\nvar didWarnAboutMaps = false;\nvar userProvidedKeyEscapeRegex = /\\/+/g;\n\nfunction escapeUserProvidedKey(text) {\n return text.replace(userProvidedKeyEscapeRegex, '$&/');\n}\n/**\n * Generate a key string that identifies a element within a set.\n *\n * @param {*} element A element that could contain a manual key.\n * @param {number} index Index that is used if a manual key is not provided.\n * @return {string}\n */\n\n\nfunction getElementKey(element, index) {\n // Do some typechecking here since we call this blindly. We want to ensure\n // that we don't block potential future ES APIs.\n if (typeof element === 'object' && element !== null && element.key != null) {\n // Explicit key\n {\n checkKeyStringCoercion(element.key);\n }\n\n return escape('' + element.key);\n } // Implicit key determined by the index in the set\n\n\n return index.toString(36);\n}\n\nfunction mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {\n var type = typeof children;\n\n if (type === 'undefined' || type === 'boolean') {\n // All of the above are perceived as null.\n children = null;\n }\n\n var invokeCallback = false;\n\n if (children === null) {\n invokeCallback = true;\n } else {\n switch (type) {\n case 'string':\n case 'number':\n invokeCallback = true;\n break;\n\n case 'object':\n switch (children.$$typeof) {\n case REACT_ELEMENT_TYPE:\n case REACT_PORTAL_TYPE:\n invokeCallback = true;\n }\n\n }\n }\n\n if (invokeCallback) {\n var _child = children;\n var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array\n // so that it's consistent if the number of children grows:\n\n var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;\n\n if (isArray(mappedChild)) {\n var escapedChildKey = '';\n\n if (childKey != null) {\n escapedChildKey = escapeUserProvidedKey(childKey) + '/';\n }\n\n mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {\n return c;\n });\n } else if (mappedChild != null) {\n if (isValidElement(mappedChild)) {\n {\n // The `if` statement here prevents auto-disabling of the safe\n // coercion ESLint rule, so we must manually disable it below.\n // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key\n if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {\n checkKeyStringCoercion(mappedChild.key);\n }\n }\n\n mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as\n // traverseAllChildren used to do for objects as children\n escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key\n mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number\n // eslint-disable-next-line react-internal/safe-string-coercion\n escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);\n }\n\n array.push(mappedChild);\n }\n\n return 1;\n }\n\n var child;\n var nextName;\n var subtreeCount = 0; // Count of children found in the current subtree.\n\n var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;\n\n if (isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n child = children[i];\n nextName = nextNamePrefix + getElementKey(child, i);\n subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);\n }\n } else {\n var iteratorFn = getIteratorFn(children);\n\n if (typeof iteratorFn === 'function') {\n var iterableChildren = children;\n\n {\n // Warn about using Maps as children\n if (iteratorFn === iterableChildren.entries) {\n if (!didWarnAboutMaps) {\n warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');\n }\n\n didWarnAboutMaps = true;\n }\n }\n\n var iterator = iteratorFn.call(iterableChildren);\n var step;\n var ii = 0;\n\n while (!(step = iterator.next()).done) {\n child = step.value;\n nextName = nextNamePrefix + getElementKey(child, ii++);\n subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);\n }\n } else if (type === 'object') {\n // eslint-disable-next-line react-internal/safe-string-coercion\n var childrenString = String(children);\n throw new Error(\"Objects are not valid as a React child (found: \" + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + \"). \" + 'If you meant to render a collection of children, use an array ' + 'instead.');\n }\n }\n\n return subtreeCount;\n}\n\n/**\n * Maps children that are typically specified as `props.children`.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrenmap\n *\n * The provided mapFunction(child, index) will be called for each\n * leaf child.\n *\n * @param {?*} children Children tree container.\n * @param {function(*, int)} func The map function.\n * @param {*} context Context for mapFunction.\n * @return {object} Object containing the ordered map of results.\n */\nfunction mapChildren(children, func, context) {\n if (children == null) {\n return children;\n }\n\n var result = [];\n var count = 0;\n mapIntoArray(children, result, '', '', function (child) {\n return func.call(context, child, count++);\n });\n return result;\n}\n/**\n * Count the number of children that are typically specified as\n * `props.children`.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrencount\n *\n * @param {?*} children Children tree container.\n * @return {number} The number of children.\n */\n\n\nfunction countChildren(children) {\n var n = 0;\n mapChildren(children, function () {\n n++; // Don't return anything\n });\n return n;\n}\n\n/**\n * Iterates through children that are typically specified as `props.children`.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrenforeach\n *\n * The provided forEachFunc(child, index) will be called for each\n * leaf child.\n *\n * @param {?*} children Children tree container.\n * @param {function(*, int)} forEachFunc\n * @param {*} forEachContext Context for forEachContext.\n */\nfunction forEachChildren(children, forEachFunc, forEachContext) {\n mapChildren(children, function () {\n forEachFunc.apply(this, arguments); // Don't return anything.\n }, forEachContext);\n}\n/**\n * Flatten a children object (typically specified as `props.children`) and\n * return an array with appropriately re-keyed children.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrentoarray\n */\n\n\nfunction toArray(children) {\n return mapChildren(children, function (child) {\n return child;\n }) || [];\n}\n/**\n * Returns the first child in a collection of children and verifies that there\n * is only one child in the collection.\n *\n * See https://reactjs.org/docs/react-api.html#reactchildrenonly\n *\n * The current implementation of this function assumes that a single child gets\n * passed without a wrapper, but the purpose of this helper function is to\n * abstract away the particular structure of children.\n *\n * @param {?object} children Child collection structure.\n * @return {ReactElement} The first and only `ReactElement` contained in the\n * structure.\n */\n\n\nfunction onlyChild(children) {\n if (!isValidElement(children)) {\n throw new Error('React.Children.only expected to receive a single React element child.');\n }\n\n return children;\n}\n\nfunction createContext(defaultValue) {\n // TODO: Second argument used to be an optional `calculateChangedBits`\n // function. Warn to reserve for future use?\n var context = {\n $$typeof: REACT_CONTEXT_TYPE,\n // As a workaround to support multiple concurrent renderers, we categorize\n // some renderers as primary and others as secondary. We only expect\n // there to be two concurrent renderers at most: React Native (primary) and\n // Fabric (secondary); React DOM (primary) and React ART (secondary).\n // Secondary renderers store their context values on separate fields.\n _currentValue: defaultValue,\n _currentValue2: defaultValue,\n // Used to track how many concurrent renderers this context currently\n // supports within in a single renderer. Such as parallel server rendering.\n _threadCount: 0,\n // These are circular\n Provider: null,\n Consumer: null,\n // Add these to use same hidden class in VM as ServerContext\n _defaultValue: null,\n _globalName: null\n };\n context.Provider = {\n $$typeof: REACT_PROVIDER_TYPE,\n _context: context\n };\n var hasWarnedAboutUsingNestedContextConsumers = false;\n var hasWarnedAboutUsingConsumerProvider = false;\n var hasWarnedAboutDisplayNameOnConsumer = false;\n\n {\n // A separate object, but proxies back to the original context object for\n // backwards compatibility. It has a different $$typeof, so we can properly\n // warn for the incorrect usage of Context as a Consumer.\n var Consumer = {\n $$typeof: REACT_CONTEXT_TYPE,\n _context: context\n }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here\n\n Object.defineProperties(Consumer, {\n Provider: {\n get: function () {\n if (!hasWarnedAboutUsingConsumerProvider) {\n hasWarnedAboutUsingConsumerProvider = true;\n\n error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?');\n }\n\n return context.Provider;\n },\n set: function (_Provider) {\n context.Provider = _Provider;\n }\n },\n _currentValue: {\n get: function () {\n return context._currentValue;\n },\n set: function (_currentValue) {\n context._currentValue = _currentValue;\n }\n },\n _currentValue2: {\n get: function () {\n return context._currentValue2;\n },\n set: function (_currentValue2) {\n context._currentValue2 = _currentValue2;\n }\n },\n _threadCount: {\n get: function () {\n return context._threadCount;\n },\n set: function (_threadCount) {\n context._threadCount = _threadCount;\n }\n },\n Consumer: {\n get: function () {\n if (!hasWarnedAboutUsingNestedContextConsumers) {\n hasWarnedAboutUsingNestedContextConsumers = true;\n\n error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?');\n }\n\n return context.Consumer;\n }\n },\n displayName: {\n get: function () {\n return context.displayName;\n },\n set: function (displayName) {\n if (!hasWarnedAboutDisplayNameOnConsumer) {\n warn('Setting `displayName` on Context.Consumer has no effect. ' + \"You should set it directly on the context with Context.displayName = '%s'.\", displayName);\n\n hasWarnedAboutDisplayNameOnConsumer = true;\n }\n }\n }\n }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty\n\n context.Consumer = Consumer;\n }\n\n {\n context._currentRenderer = null;\n context._currentRenderer2 = null;\n }\n\n return context;\n}\n\nvar Uninitialized = -1;\nvar Pending = 0;\nvar Resolved = 1;\nvar Rejected = 2;\n\nfunction lazyInitializer(payload) {\n if (payload._status === Uninitialized) {\n var ctor = payload._result;\n var thenable = ctor(); // Transition to the next state.\n // This might throw either because it's missing or throws. If so, we treat it\n // as still uninitialized and try again next time. Which is the same as what\n // happens if the ctor or any wrappers processing the ctor throws. This might\n // end up fixing it if the resolution was a concurrency bug.\n\n thenable.then(function (moduleObject) {\n if (payload._status === Pending || payload._status === Uninitialized) {\n // Transition to the next state.\n var resolved = payload;\n resolved._status = Resolved;\n resolved._result = moduleObject;\n }\n }, function (error) {\n if (payload._status === Pending || payload._status === Uninitialized) {\n // Transition to the next state.\n var rejected = payload;\n rejected._status = Rejected;\n rejected._result = error;\n }\n });\n\n if (payload._status === Uninitialized) {\n // In case, we're still uninitialized, then we're waiting for the thenable\n // to resolve. Set it as pending in the meantime.\n var pending = payload;\n pending._status = Pending;\n pending._result = thenable;\n }\n }\n\n if (payload._status === Resolved) {\n var moduleObject = payload._result;\n\n {\n if (moduleObject === undefined) {\n error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\\n\\nYour code should look like: \\n ' + // Break up imports to avoid accidentally parsing them as dependencies.\n 'const MyComponent = lazy(() => imp' + \"ort('./MyComponent'))\\n\\n\" + 'Did you accidentally put curly braces around the import?', moduleObject);\n }\n }\n\n {\n if (!('default' in moduleObject)) {\n error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\\n\\nYour code should look like: \\n ' + // Break up imports to avoid accidentally parsing them as dependencies.\n 'const MyComponent = lazy(() => imp' + \"ort('./MyComponent'))\", moduleObject);\n }\n }\n\n return moduleObject.default;\n } else {\n throw payload._result;\n }\n}\n\nfunction lazy(ctor) {\n var payload = {\n // We use these fields to store the result.\n _status: Uninitialized,\n _result: ctor\n };\n var lazyType = {\n $$typeof: REACT_LAZY_TYPE,\n _payload: payload,\n _init: lazyInitializer\n };\n\n {\n // In production, this would just set it on the object.\n var defaultProps;\n var propTypes; // $FlowFixMe\n\n Object.defineProperties(lazyType, {\n defaultProps: {\n configurable: true,\n get: function () {\n return defaultProps;\n },\n set: function (newDefaultProps) {\n error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');\n\n defaultProps = newDefaultProps; // Match production behavior more closely:\n // $FlowFixMe\n\n Object.defineProperty(lazyType, 'defaultProps', {\n enumerable: true\n });\n }\n },\n propTypes: {\n configurable: true,\n get: function () {\n return propTypes;\n },\n set: function (newPropTypes) {\n error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');\n\n propTypes = newPropTypes; // Match production behavior more closely:\n // $FlowFixMe\n\n Object.defineProperty(lazyType, 'propTypes', {\n enumerable: true\n });\n }\n }\n });\n }\n\n return lazyType;\n}\n\nfunction forwardRef(render) {\n {\n if (render != null && render.$$typeof === REACT_MEMO_TYPE) {\n error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');\n } else if (typeof render !== 'function') {\n error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);\n } else {\n if (render.length !== 0 && render.length !== 2) {\n error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');\n }\n }\n\n if (render != null) {\n if (render.defaultProps != null || render.propTypes != null) {\n error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');\n }\n }\n }\n\n var elementType = {\n $$typeof: REACT_FORWARD_REF_TYPE,\n render: render\n };\n\n {\n var ownName;\n Object.defineProperty(elementType, 'displayName', {\n enumerable: false,\n configurable: true,\n get: function () {\n return ownName;\n },\n set: function (name) {\n ownName = name; // The inner component shouldn't inherit this display name in most cases,\n // because the component may be used elsewhere.\n // But it's nice for anonymous functions to inherit the name,\n // so that our component-stack generation logic will display their frames.\n // An anonymous function generally suggests a pattern like:\n // React.forwardRef((props, ref) => {...});\n // This kind of inner function is not used elsewhere so the side effect is okay.\n\n if (!render.name && !render.displayName) {\n render.displayName = name;\n }\n }\n });\n }\n\n return elementType;\n}\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction memo(type, compare) {\n {\n if (!isValidElementType(type)) {\n error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);\n }\n }\n\n var elementType = {\n $$typeof: REACT_MEMO_TYPE,\n type: type,\n compare: compare === undefined ? null : compare\n };\n\n {\n var ownName;\n Object.defineProperty(elementType, 'displayName', {\n enumerable: false,\n configurable: true,\n get: function () {\n return ownName;\n },\n set: function (name) {\n ownName = name; // The inner component shouldn't inherit this display name in most cases,\n // because the component may be used elsewhere.\n // But it's nice for anonymous functions to inherit the name,\n // so that our component-stack generation logic will display their frames.\n // An anonymous function generally suggests a pattern like:\n // React.memo((props) => {...});\n // This kind of inner function is not used elsewhere so the side effect is okay.\n\n if (!type.name && !type.displayName) {\n type.displayName = name;\n }\n }\n });\n }\n\n return elementType;\n}\n\nfunction resolveDispatcher() {\n var dispatcher = ReactCurrentDispatcher.current;\n\n {\n if (dispatcher === null) {\n error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\\n' + '2. You might be breaking the Rules of Hooks\\n' + '3. You might have more than one copy of React in the same app\\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');\n }\n } // Will result in a null access error if accessed outside render phase. We\n // intentionally don't throw our own error because this is in a hot path.\n // Also helps ensure this is inlined.\n\n\n return dispatcher;\n}\nfunction useContext(Context) {\n var dispatcher = resolveDispatcher();\n\n {\n // TODO: add a more generic warning for invalid values.\n if (Context._context !== undefined) {\n var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs\n // and nobody should be using this in existing code.\n\n if (realContext.Consumer === Context) {\n error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');\n } else if (realContext.Provider === Context) {\n error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');\n }\n }\n }\n\n return dispatcher.useContext(Context);\n}\nfunction useState(initialState) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useState(initialState);\n}\nfunction useReducer(reducer, initialArg, init) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useReducer(reducer, initialArg, init);\n}\nfunction useRef(initialValue) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useRef(initialValue);\n}\nfunction useEffect(create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useEffect(create, deps);\n}\nfunction useInsertionEffect(create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useInsertionEffect(create, deps);\n}\nfunction useLayoutEffect(create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useLayoutEffect(create, deps);\n}\nfunction useCallback(callback, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useCallback(callback, deps);\n}\nfunction useMemo(create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useMemo(create, deps);\n}\nfunction useImperativeHandle(ref, create, deps) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useImperativeHandle(ref, create, deps);\n}\nfunction useDebugValue(value, formatterFn) {\n {\n var dispatcher = resolveDispatcher();\n return dispatcher.useDebugValue(value, formatterFn);\n }\n}\nfunction useTransition() {\n var dispatcher = resolveDispatcher();\n return dispatcher.useTransition();\n}\nfunction useDeferredValue(value) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useDeferredValue(value);\n}\nfunction useId() {\n var dispatcher = resolveDispatcher();\n return dispatcher.useId();\n}\nfunction useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {\n var dispatcher = resolveDispatcher();\n return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\n// Helpers to patch console.logs to avoid logging during side-effect free\n// replaying on render function. This currently only patches the object\n// lazily which won't cover if the log function was extracted eagerly.\n// We could also eagerly patch the method.\nvar disabledDepth = 0;\nvar prevLog;\nvar prevInfo;\nvar prevWarn;\nvar prevError;\nvar prevGroup;\nvar prevGroupCollapsed;\nvar prevGroupEnd;\n\nfunction disabledLog() {}\n\ndisabledLog.__reactDisabledLog = true;\nfunction disableLogs() {\n {\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099\n\n var props = {\n configurable: true,\n enumerable: true,\n value: disabledLog,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n disabledDepth++;\n }\n}\nfunction reenableLogs() {\n {\n disabledDepth--;\n\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n var props = {\n configurable: true,\n enumerable: true,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n log: assign({}, props, {\n value: prevLog\n }),\n info: assign({}, props, {\n value: prevInfo\n }),\n warn: assign({}, props, {\n value: prevWarn\n }),\n error: assign({}, props, {\n value: prevError\n }),\n group: assign({}, props, {\n value: prevGroup\n }),\n groupCollapsed: assign({}, props, {\n value: prevGroupCollapsed\n }),\n groupEnd: assign({}, props, {\n value: prevGroupEnd\n })\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n if (disabledDepth < 0) {\n error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');\n }\n }\n}\n\nvar ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;\nvar prefix;\nfunction describeBuiltInComponentFrame(name, source, ownerFn) {\n {\n if (prefix === undefined) {\n // Extract the VM specific prefix used by each line.\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = match && match[1] || '';\n }\n } // We use the prefix to ensure our stacks line up with native stack frames.\n\n\n return '\\n' + prefix + name;\n }\n}\nvar reentry = false;\nvar componentFrameCache;\n\n{\n var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;\n componentFrameCache = new PossiblyWeakMap();\n}\n\nfunction describeNativeComponentFrame(fn, construct) {\n // If something asked for a stack inside a fake render, it should get ignored.\n if ( !fn || reentry) {\n return '';\n }\n\n {\n var frame = componentFrameCache.get(fn);\n\n if (frame !== undefined) {\n return frame;\n }\n }\n\n var control;\n reentry = true;\n var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.\n\n Error.prepareStackTrace = undefined;\n var previousDispatcher;\n\n {\n previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function\n // for warnings.\n\n ReactCurrentDispatcher$1.current = null;\n disableLogs();\n }\n\n try {\n // This should throw.\n if (construct) {\n // Something should be setting the props in the constructor.\n var Fake = function () {\n throw Error();\n }; // $FlowFixMe\n\n\n Object.defineProperty(Fake.prototype, 'props', {\n set: function () {\n // We use a throwing setter instead of frozen or non-writable props\n // because that won't throw in a non-strict mode function.\n throw Error();\n }\n });\n\n if (typeof Reflect === 'object' && Reflect.construct) {\n // We construct a different control for this case to include any extra\n // frames added by the construct call.\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n control = x;\n }\n\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x) {\n control = x;\n }\n\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x) {\n control = x;\n }\n\n fn();\n }\n } catch (sample) {\n // This is inlined manually because closure doesn't do it for us.\n if (sample && control && typeof sample.stack === 'string') {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n var sampleLines = sample.stack.split('\\n');\n var controlLines = control.stack.split('\\n');\n var s = sampleLines.length - 1;\n var c = controlLines.length - 1;\n\n while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n c--;\n }\n\n for (; s >= 1 && c >= 0; s--, c--) {\n // Next we find the first one that isn't the same which should be the\n // frame that called our sample function and the control.\n if (sampleLines[s] !== controlLines[c]) {\n // In V8, the first line is describing the message but other VMs don't.\n // If we're about to return the first line, and the control is also on the same\n // line, that's a pretty good indicator that our sample threw at same line as\n // the control. I.e. before we entered the sample frame. So we ignore this result.\n // This can happen if you passed a class to function component, or non-function.\n if (s !== 1 || c !== 1) {\n do {\n s--;\n c--; // We may still have similar intermediate frames from the construct call.\n // The next one that isn't the same should be our match though.\n\n if (c < 0 || sampleLines[s] !== controlLines[c]) {\n // V8 adds a \"new\" prefix for native classes. Let's remove it to make it prettier.\n var _frame = '\\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled \"\"\n // but we have a user-provided \"displayName\"\n // splice it in to make the stack more readable.\n\n\n if (fn.displayName && _frame.includes('')) {\n _frame = _frame.replace('', fn.displayName);\n }\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, _frame);\n }\n } // Return the line we found.\n\n\n return _frame;\n }\n } while (s >= 1 && c >= 0);\n }\n\n break;\n }\n }\n }\n } finally {\n reentry = false;\n\n {\n ReactCurrentDispatcher$1.current = previousDispatcher;\n reenableLogs();\n }\n\n Error.prepareStackTrace = previousPrepareStackTrace;\n } // Fallback to just using the name if we couldn't make it throw.\n\n\n var name = fn ? fn.displayName || fn.name : '';\n var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, syntheticFrame);\n }\n }\n\n return syntheticFrame;\n}\nfunction describeFunctionComponentFrame(fn, source, ownerFn) {\n {\n return describeNativeComponentFrame(fn, false);\n }\n}\n\nfunction shouldConstruct(Component) {\n var prototype = Component.prototype;\n return !!(prototype && prototype.isReactComponent);\n}\n\nfunction describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {\n\n if (type == null) {\n return '';\n }\n\n if (typeof type === 'function') {\n {\n return describeNativeComponentFrame(type, shouldConstruct(type));\n }\n }\n\n if (typeof type === 'string') {\n return describeBuiltInComponentFrame(type);\n }\n\n switch (type) {\n case REACT_SUSPENSE_TYPE:\n return describeBuiltInComponentFrame('Suspense');\n\n case REACT_SUSPENSE_LIST_TYPE:\n return describeBuiltInComponentFrame('SuspenseList');\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_FORWARD_REF_TYPE:\n return describeFunctionComponentFrame(type.render);\n\n case REACT_MEMO_TYPE:\n // Memo may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n // Lazy may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);\n } catch (x) {}\n }\n }\n }\n\n return '';\n}\n\nvar loggedTypeFailures = {};\nvar ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame$1.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame$1.setExtraStackFrame(null);\n }\n }\n}\n\nfunction checkPropTypes(typeSpecs, values, location, componentName, element) {\n {\n // $FlowFixMe This is okay but Flow doesn't know it.\n var has = Function.call.bind(hasOwnProperty);\n\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n // eslint-disable-next-line react-internal/prod-error-codes\n var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');\n err.name = 'Invariant Violation';\n throw err;\n }\n\n error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');\n } catch (ex) {\n error$1 = ex;\n }\n\n if (error$1 && !(error$1 instanceof Error)) {\n setCurrentlyValidatingElement(element);\n\n error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);\n\n setCurrentlyValidatingElement(null);\n }\n\n if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error$1.message] = true;\n setCurrentlyValidatingElement(element);\n\n error('Failed %s type: %s', location, error$1.message);\n\n setCurrentlyValidatingElement(null);\n }\n }\n }\n }\n}\n\nfunction setCurrentlyValidatingElement$1(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n setExtraStackFrame(stack);\n } else {\n setExtraStackFrame(null);\n }\n }\n}\n\nvar propTypesMisspellWarningShown;\n\n{\n propTypesMisspellWarningShown = false;\n}\n\nfunction getDeclarationErrorAddendum() {\n if (ReactCurrentOwner.current) {\n var name = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (name) {\n return '\\n\\nCheck the render method of `' + name + '`.';\n }\n }\n\n return '';\n}\n\nfunction getSourceInfoErrorAddendum(source) {\n if (source !== undefined) {\n var fileName = source.fileName.replace(/^.*[\\\\\\/]/, '');\n var lineNumber = source.lineNumber;\n return '\\n\\nCheck your code at ' + fileName + ':' + lineNumber + '.';\n }\n\n return '';\n}\n\nfunction getSourceInfoErrorAddendumForProps(elementProps) {\n if (elementProps !== null && elementProps !== undefined) {\n return getSourceInfoErrorAddendum(elementProps.__source);\n }\n\n return '';\n}\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\n\n\nvar ownerHasKeyUseWarning = {};\n\nfunction getCurrentComponentErrorInfo(parentType) {\n var info = getDeclarationErrorAddendum();\n\n if (!info) {\n var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;\n\n if (parentName) {\n info = \"\\n\\nCheck the top-level render call using <\" + parentName + \">.\";\n }\n }\n\n return info;\n}\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it. Error statuses are cached so a warning\n * will only be shown once.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\n\n\nfunction validateExplicitKey(element, parentType) {\n if (!element._store || element._store.validated || element.key != null) {\n return;\n }\n\n element._store.validated = true;\n var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);\n\n if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {\n return;\n }\n\n ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a\n // property, it may be the creator of the child that's responsible for\n // assigning it a key.\n\n var childOwner = '';\n\n if (element && element._owner && element._owner !== ReactCurrentOwner.current) {\n // Give the component that originally created this child.\n childOwner = \" It was passed a child from \" + getComponentNameFromType(element._owner.type) + \".\";\n }\n\n {\n setCurrentlyValidatingElement$1(element);\n\n error('Each child in a list should have a unique \"key\" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);\n\n setCurrentlyValidatingElement$1(null);\n }\n}\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\n\n\nfunction validateChildKeys(node, parentType) {\n if (typeof node !== 'object') {\n return;\n }\n\n if (isArray(node)) {\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n\n if (isValidElement(child)) {\n validateExplicitKey(child, parentType);\n }\n }\n } else if (isValidElement(node)) {\n // This element was passed in a valid location.\n if (node._store) {\n node._store.validated = true;\n }\n } else if (node) {\n var iteratorFn = getIteratorFn(node);\n\n if (typeof iteratorFn === 'function') {\n // Entry iterators used to provide implicit keys,\n // but now we print a separate warning for them later.\n if (iteratorFn !== node.entries) {\n var iterator = iteratorFn.call(node);\n var step;\n\n while (!(step = iterator.next()).done) {\n if (isValidElement(step.value)) {\n validateExplicitKey(step.value, parentType);\n }\n }\n }\n }\n }\n}\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\n\n\nfunction validatePropTypes(element) {\n {\n var type = element.type;\n\n if (type === null || type === undefined || typeof type === 'string') {\n return;\n }\n\n var propTypes;\n\n if (typeof type === 'function') {\n propTypes = type.propTypes;\n } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.\n // Inner props are checked in the reconciler.\n type.$$typeof === REACT_MEMO_TYPE)) {\n propTypes = type.propTypes;\n } else {\n return;\n }\n\n if (propTypes) {\n // Intentionally inside to avoid triggering lazy initializers:\n var name = getComponentNameFromType(type);\n checkPropTypes(propTypes, element.props, 'prop', name, element);\n } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {\n propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:\n\n var _name = getComponentNameFromType(type);\n\n error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');\n }\n\n if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {\n error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');\n }\n }\n}\n/**\n * Given a fragment, validate that it can only be provided with fragment props\n * @param {ReactElement} fragment\n */\n\n\nfunction validateFragmentProps(fragment) {\n {\n var keys = Object.keys(fragment.props);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key !== 'children' && key !== 'key') {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);\n\n setCurrentlyValidatingElement$1(null);\n break;\n }\n }\n\n if (fragment.ref !== null) {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid attribute `ref` supplied to `React.Fragment`.');\n\n setCurrentlyValidatingElement$1(null);\n }\n }\n}\nfunction createElementWithValidation(type, props, children) {\n var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to\n // succeed and there will likely be errors in render.\n\n if (!validType) {\n var info = '';\n\n if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {\n info += ' You likely forgot to export your component from the file ' + \"it's defined in, or you might have mixed up default and named imports.\";\n }\n\n var sourceInfo = getSourceInfoErrorAddendumForProps(props);\n\n if (sourceInfo) {\n info += sourceInfo;\n } else {\n info += getDeclarationErrorAddendum();\n }\n\n var typeString;\n\n if (type === null) {\n typeString = 'null';\n } else if (isArray(type)) {\n typeString = 'array';\n } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {\n typeString = \"<\" + (getComponentNameFromType(type.type) || 'Unknown') + \" />\";\n info = ' Did you accidentally export a JSX literal instead of a component?';\n } else {\n typeString = typeof type;\n }\n\n {\n error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);\n }\n }\n\n var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.\n // TODO: Drop this when these are no longer allowed as the type argument.\n\n if (element == null) {\n return element;\n } // Skip key warning if the type isn't valid since our key validation logic\n // doesn't expect a non-string/function type and can throw confusing errors.\n // We don't want exception behavior to differ between dev and prod.\n // (Rendering will throw with a helpful message and as soon as the type is\n // fixed, the key warnings will appear.)\n\n\n if (validType) {\n for (var i = 2; i < arguments.length; i++) {\n validateChildKeys(arguments[i], type);\n }\n }\n\n if (type === REACT_FRAGMENT_TYPE) {\n validateFragmentProps(element);\n } else {\n validatePropTypes(element);\n }\n\n return element;\n}\nvar didWarnAboutDeprecatedCreateFactory = false;\nfunction createFactoryWithValidation(type) {\n var validatedFactory = createElementWithValidation.bind(null, type);\n validatedFactory.type = type;\n\n {\n if (!didWarnAboutDeprecatedCreateFactory) {\n didWarnAboutDeprecatedCreateFactory = true;\n\n warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');\n } // Legacy hook: remove it\n\n\n Object.defineProperty(validatedFactory, 'type', {\n enumerable: false,\n get: function () {\n warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');\n\n Object.defineProperty(this, 'type', {\n value: type\n });\n return type;\n }\n });\n }\n\n return validatedFactory;\n}\nfunction cloneElementWithValidation(element, props, children) {\n var newElement = cloneElement.apply(this, arguments);\n\n for (var i = 2; i < arguments.length; i++) {\n validateChildKeys(arguments[i], newElement.type);\n }\n\n validatePropTypes(newElement);\n return newElement;\n}\n\nfunction startTransition(scope, options) {\n var prevTransition = ReactCurrentBatchConfig.transition;\n ReactCurrentBatchConfig.transition = {};\n var currentTransition = ReactCurrentBatchConfig.transition;\n\n {\n ReactCurrentBatchConfig.transition._updatedFibers = new Set();\n }\n\n try {\n scope();\n } finally {\n ReactCurrentBatchConfig.transition = prevTransition;\n\n {\n if (prevTransition === null && currentTransition._updatedFibers) {\n var updatedFibersCount = currentTransition._updatedFibers.size;\n\n if (updatedFibersCount > 10) {\n warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');\n }\n\n currentTransition._updatedFibers.clear();\n }\n }\n }\n}\n\nvar didWarnAboutMessageChannel = false;\nvar enqueueTaskImpl = null;\nfunction enqueueTask(task) {\n if (enqueueTaskImpl === null) {\n try {\n // read require off the module object to get around the bundlers.\n // we don't want them to detect a require and bundle a Node polyfill.\n var requireString = ('require' + Math.random()).slice(0, 7);\n var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's\n // version of setImmediate, bypassing fake timers if any.\n\n enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;\n } catch (_err) {\n // we're in a browser\n // we can't use regular timers because they may still be faked\n // so we try MessageChannel+postMessage instead\n enqueueTaskImpl = function (callback) {\n {\n if (didWarnAboutMessageChannel === false) {\n didWarnAboutMessageChannel = true;\n\n if (typeof MessageChannel === 'undefined') {\n error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');\n }\n }\n }\n\n var channel = new MessageChannel();\n channel.port1.onmessage = callback;\n channel.port2.postMessage(undefined);\n };\n }\n }\n\n return enqueueTaskImpl(task);\n}\n\nvar actScopeDepth = 0;\nvar didWarnNoAwaitAct = false;\nfunction act(callback) {\n {\n // `act` calls can be nested, so we track the depth. This represents the\n // number of `act` scopes on the stack.\n var prevActScopeDepth = actScopeDepth;\n actScopeDepth++;\n\n if (ReactCurrentActQueue.current === null) {\n // This is the outermost `act` scope. Initialize the queue. The reconciler\n // will detect the queue and use it instead of Scheduler.\n ReactCurrentActQueue.current = [];\n }\n\n var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;\n var result;\n\n try {\n // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only\n // set to `true` while the given callback is executed, not for updates\n // triggered during an async event, because this is how the legacy\n // implementation of `act` behaved.\n ReactCurrentActQueue.isBatchingLegacy = true;\n result = callback(); // Replicate behavior of original `act` implementation in legacy mode,\n // which flushed updates immediately after the scope function exits, even\n // if it's an async function.\n\n if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {\n var queue = ReactCurrentActQueue.current;\n\n if (queue !== null) {\n ReactCurrentActQueue.didScheduleLegacyUpdate = false;\n flushActQueue(queue);\n }\n }\n } catch (error) {\n popActScope(prevActScopeDepth);\n throw error;\n } finally {\n ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;\n }\n\n if (result !== null && typeof result === 'object' && typeof result.then === 'function') {\n var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait\n // for it to resolve before exiting the current scope.\n\n var wasAwaited = false;\n var thenable = {\n then: function (resolve, reject) {\n wasAwaited = true;\n thenableResult.then(function (returnValue) {\n popActScope(prevActScopeDepth);\n\n if (actScopeDepth === 0) {\n // We've exited the outermost act scope. Recursively flush the\n // queue until there's no remaining work.\n recursivelyFlushAsyncActWork(returnValue, resolve, reject);\n } else {\n resolve(returnValue);\n }\n }, function (error) {\n // The callback threw an error.\n popActScope(prevActScopeDepth);\n reject(error);\n });\n }\n };\n\n {\n if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {\n // eslint-disable-next-line no-undef\n Promise.resolve().then(function () {}).then(function () {\n if (!wasAwaited) {\n didWarnNoAwaitAct = true;\n\n error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');\n }\n });\n }\n }\n\n return thenable;\n } else {\n var returnValue = result; // The callback is not an async function. Exit the current scope\n // immediately, without awaiting.\n\n popActScope(prevActScopeDepth);\n\n if (actScopeDepth === 0) {\n // Exiting the outermost act scope. Flush the queue.\n var _queue = ReactCurrentActQueue.current;\n\n if (_queue !== null) {\n flushActQueue(_queue);\n ReactCurrentActQueue.current = null;\n } // Return a thenable. If the user awaits it, we'll flush again in\n // case additional work was scheduled by a microtask.\n\n\n var _thenable = {\n then: function (resolve, reject) {\n // Confirm we haven't re-entered another `act` scope, in case\n // the user does something weird like await the thenable\n // multiple times.\n if (ReactCurrentActQueue.current === null) {\n // Recursively flush the queue until there's no remaining work.\n ReactCurrentActQueue.current = [];\n recursivelyFlushAsyncActWork(returnValue, resolve, reject);\n } else {\n resolve(returnValue);\n }\n }\n };\n return _thenable;\n } else {\n // Since we're inside a nested `act` scope, the returned thenable\n // immediately resolves. The outer scope will flush the queue.\n var _thenable2 = {\n then: function (resolve, reject) {\n resolve(returnValue);\n }\n };\n return _thenable2;\n }\n }\n }\n}\n\nfunction popActScope(prevActScopeDepth) {\n {\n if (prevActScopeDepth !== actScopeDepth - 1) {\n error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');\n }\n\n actScopeDepth = prevActScopeDepth;\n }\n}\n\nfunction recursivelyFlushAsyncActWork(returnValue, resolve, reject) {\n {\n var queue = ReactCurrentActQueue.current;\n\n if (queue !== null) {\n try {\n flushActQueue(queue);\n enqueueTask(function () {\n if (queue.length === 0) {\n // No additional work was scheduled. Finish.\n ReactCurrentActQueue.current = null;\n resolve(returnValue);\n } else {\n // Keep flushing work until there's none left.\n recursivelyFlushAsyncActWork(returnValue, resolve, reject);\n }\n });\n } catch (error) {\n reject(error);\n }\n } else {\n resolve(returnValue);\n }\n }\n}\n\nvar isFlushing = false;\n\nfunction flushActQueue(queue) {\n {\n if (!isFlushing) {\n // Prevent re-entrance.\n isFlushing = true;\n var i = 0;\n\n try {\n for (; i < queue.length; i++) {\n var callback = queue[i];\n\n do {\n callback = callback(true);\n } while (callback !== null);\n }\n\n queue.length = 0;\n } catch (error) {\n // If something throws, leave the remaining callbacks on the queue.\n queue = queue.slice(i + 1);\n throw error;\n } finally {\n isFlushing = false;\n }\n }\n }\n}\n\nvar createElement$1 = createElementWithValidation ;\nvar cloneElement$1 = cloneElementWithValidation ;\nvar createFactory = createFactoryWithValidation ;\nvar Children = {\n map: mapChildren,\n forEach: forEachChildren,\n count: countChildren,\n toArray: toArray,\n only: onlyChild\n};\n\nexports.Children = Children;\nexports.Component = Component;\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.Profiler = REACT_PROFILER_TYPE;\nexports.PureComponent = PureComponent;\nexports.StrictMode = REACT_STRICT_MODE_TYPE;\nexports.Suspense = REACT_SUSPENSE_TYPE;\nexports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;\nexports.cloneElement = cloneElement$1;\nexports.createContext = createContext;\nexports.createElement = createElement$1;\nexports.createFactory = createFactory;\nexports.createRef = createRef;\nexports.forwardRef = forwardRef;\nexports.isValidElement = isValidElement;\nexports.lazy = lazy;\nexports.memo = memo;\nexports.startTransition = startTransition;\nexports.unstable_act = act;\nexports.useCallback = useCallback;\nexports.useContext = useContext;\nexports.useDebugValue = useDebugValue;\nexports.useDeferredValue = useDeferredValue;\nexports.useEffect = useEffect;\nexports.useId = useId;\nexports.useImperativeHandle = useImperativeHandle;\nexports.useInsertionEffect = useInsertionEffect;\nexports.useLayoutEffect = useLayoutEffect;\nexports.useMemo = useMemo;\nexports.useReducer = useReducer;\nexports.useRef = useRef;\nexports.useState = useState;\nexports.useSyncExternalStore = useSyncExternalStore;\nexports.useTransition = useTransition;\nexports.version = ReactVersion;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":[],"mappings":"AAUA;AAEA,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;IACzC,CAAC,WAAW;QAEJ;QAGV,IACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,2BAA2B,KAC/D,YACF;YACA,+BAA+B,2BAA2B,CAAC,IAAI;QACjE,CAAC;QACS,IAAI,eAAe;QAM7B,IAAI,qBAAqB,OAAO,GAAG,CAAC;QACpC,IAAI,oBAAoB,OAAO,GAAG,CAAC;QACnC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,yBAAyB,OAAO,GAAG,CAAC;QACxC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,qBAAqB,OAAO,GAAG,CAAC;QACpC,IAAI,yBAAyB,OAAO,GAAG,CAAC;QACxC,IAAI,sBAAsB,OAAO,GAAG,CAAC;QACrC,IAAI,2BAA2B,OAAO,GAAG,CAAC;QAC1C,IAAI,kBAAkB,OAAO,GAAG,CAAC;QACjC,IAAI,kBAAkB,OAAO,GAAG,CA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C9B,QAAQ,kBAAkB,GAAG;QAC7B,QAAQ,eAAe,GAAG;QAC1B,QAAQ,OAAO,GAAG;QAClB,QAAQ,UAAU,GAAG;QACrB,QAAQ,MAAM,GAAG;QACjB,QAAQ,QAAQ,GAAG;QACnB,QAAQ,oBAAoB,GAAG;QAC/B,QAAQ,aAAa,GAAG;QACxB,QAAQ,OAAO,GAAG;QAElB,IACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,0BAA0B,KAC9D,YACF;YACA,+BAA+B,0BAA0B,CAAC,IAAI;QAChE,CAAC;IAEC,CAAC;AACH,CAAC"}}, - {"offset": {"line": 3035, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] -} \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.dca2bb.map b/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.dca2bb.map deleted file mode 100644 index 53c26be29dd57..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/mono_transforms/output/node_modules_react_jsx-runtime.js.dca2bb.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/react/cjs/react.production.min.js"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1 (() => { - -__turbopack_esm__({ - "default": ()=>_classCallCheck -}); -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -})()), -}]); - - -//# sourceMappingURL=3f8b2_@swc_helpers_src__class_call_check.mjs.js.8bcaf458ac88e308.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js.8bcaf458ac88e308.map b/crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js.8bcaf458ac88e308.map deleted file mode 100644 index 5bea95fc03647..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js.8bcaf458ac88e308.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/.pnpm/@swc+helpers@0.4.11/node_modules/@swc/helpers/src/_class_call_check.mjs"],"sourcesContent":["export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}"],"names":[],"mappings":"AAAA;;;AAAe,SAAS,gBAAgB,QAAQ,EAAE,WAAW,EAAE;IAC7D,IAAI,CAAC,CAAC,oBAAoB,WAAW,GAAG;QACtC,MAAM,IAAI,UAAU,qCAAqC;IAC3D,CAAC;AACH"}}, - {"offset": {"line": 12, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] -} \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js.8c683f.map b/crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js.8c683f.map deleted file mode 100644 index f6733aded2cb5..0000000000000 --- a/crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js.8c683f.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sections": [ - {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/node_modules/.pnpm/@swc+helpers@0.4.11/node_modules/@swc/helpers/src/_class_call_check.mjs"],"sourcesContent":["export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}"],"names":[],"mappings":"AAAA;;;AAAe,SAAS,gBAAgB,QAAQ,EAAE,WAAW,EAAE;IAC7D,IAAI,CAAC,CAAC,oBAAoB,WAAW,GAAG;QACtC,MAAM,IAAI,UAAU,qCAAqC;IAC3D,CAAC;AACH"}}, - {"offset": {"line": 10, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] -} \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js b/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js similarity index 73% rename from crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js rename to crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js index b9f370628bc0b..d19e255cc3b0d 100644 --- a/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js +++ b/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js @@ -1,19 +1,23 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js", { "[project]/crates/turbopack/tests/snapshot/integration/preset_env/input/index.js (ecmascript)": (({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process }) => (() => { -var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f40$swc$2b$helpers$40$0$2e$4$2e$11$2f$node_modules$2f40$swc$2f$helpers$2f$src$2f$_class_call_check$2e$mjs__ = __turbopack_import__("[project]/node_modules/.pnpm/@swc+helpers@0.4.11/node_modules/@swc/helpers/src/_class_call_check.mjs (ecmascript)"); +(()=>{ + const e = new Error("Cannot find module '@swc/helpers/src/_class_call_check.mjs'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; +})(); "__TURBOPACK__ecmascript__hoisting__location__"; ; var Foo = function Foo() { "use strict"; - __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f40$swc$2b$helpers$40$0$2e$4$2e$11$2f$node_modules$2f40$swc$2f$helpers$2f$src$2f$_class_call_check$2e$mjs__["default"](this, Foo); + _class_call_check(this, Foo); }; console.log(Foo, [].includes("foo")); })()), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_06a225.js") && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/preset_env/output/3f8b2_@swc_helpers_src__class_call_check.mjs.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_6040c1.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/preset_env/input/index.js (ecmascript)"); }]); (() => { @@ -24,25 +28,65 @@ console.log(Foo, [].includes("foo")); // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -61,7 +105,7 @@ console.log(Foo, [].includes("foo")); * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -72,32 +116,57 @@ console.log(Foo, [].includes("foo")); browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -107,16 +176,27 @@ console.log(Foo, [].includes("foo")); esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -141,16 +221,26 @@ console.log(Foo, [].includes("foo")); return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -180,6 +270,10 @@ console.log(Foo, [].includes("foo")); }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -207,21 +301,33 @@ console.log(Foo, [].includes("foo")); return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -230,13 +336,13 @@ console.log(Foo, [].includes("foo")); // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -248,6 +354,7 @@ console.log(Foo, [].includes("foo")); const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -260,9 +367,9 @@ console.log(Foo, [].includes("foo")); moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -293,11 +400,16 @@ console.log(Foo, [].includes("foo")); return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -318,6 +430,10 @@ console.log(Foo, [].includes("foo")); /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -340,10 +456,15 @@ console.log(Foo, [].includes("foo")); return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -396,6 +517,10 @@ console.log(Foo, [].includes("foo")); } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -406,6 +531,10 @@ console.log(Foo, [].includes("foo")); return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -443,6 +572,10 @@ console.log(Foo, [].includes("foo")); return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -458,6 +591,11 @@ console.log(Foo, [].includes("foo")); return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -494,6 +632,9 @@ console.log(Foo, [].includes("foo")); * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -532,6 +673,12 @@ console.log(Foo, [].includes("foo")); return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -550,12 +697,12 @@ console.log(Foo, [].includes("foo")); // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -563,6 +710,11 @@ console.log(Foo, [].includes("foo")); } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -576,9 +728,17 @@ console.log(Foo, [].includes("foo")); applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -587,16 +747,16 @@ console.log(Foo, [].includes("foo")); ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -606,8 +766,7 @@ console.log(Foo, [].includes("foo")); if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -624,7 +783,7 @@ console.log(Foo, [].includes("foo")); if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -655,7 +814,29 @@ console.log(Foo, [].includes("foo")); }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -663,6 +844,24 @@ console.log(Foo, [].includes("foo")); disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -671,16 +870,7 @@ console.log(Foo, [].includes("foo")); data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -722,6 +912,9 @@ console.log(Foo, [].includes("foo")); /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -736,6 +929,10 @@ console.log(Foo, [].includes("foo")); /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -752,29 +949,25 @@ console.log(Foo, [].includes("foo")); /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -792,12 +985,17 @@ console.log(Foo, [].includes("foo")); chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -810,6 +1008,7 @@ console.log(Foo, [].includes("foo")); runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -817,4 +1016,4 @@ console.log(Foo, [].includes("foo")); })(); -//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.496f26fdbe25baf2.map \ No newline at end of file +//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.560e25ffcad55eab.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.496f26fdbe25baf2.map b/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.560e25ffcad55eab.map similarity index 68% rename from crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.496f26fdbe25baf2.map rename to crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.560e25ffcad55eab.map index 1f1a4c80c6e69..9e3129fd57bf5 100644 --- a/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.496f26fdbe25baf2.map +++ b/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.560e25ffcad55eab.map @@ -1,6 +1,6 @@ { "version": 3, "sections": [ - {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["/[project]/crates/turbopack/tests/snapshot/integration/preset_env/input/index.js"],"sourcesContent":["class Foo {}\n\nconsole.log(Foo, [].includes(\"foo\"));\n"],"names":[],"mappings":"AAAA;;;AAAA,IAAA,AAAM,MAAN,SAAM;;yMAAA;;AAEN,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC"}}, - {"offset": {"line": 12, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] + {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["/[project]/crates/turbopack/tests/snapshot/integration/preset_env/input/index.js"],"sourcesContent":["class Foo {}\n\nconsole.log(Foo, [].includes(\"foo\"));\n"],"names":[],"mappings":"AAAA;;;;;;;AAAA,IAAA,AAAM,MAAN,SAAM;;4BAAA;;AAEN,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC"}}, + {"offset": {"line": 16, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] } \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.d5a489.map b/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.ad0136.map similarity index 68% rename from crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.d5a489.map rename to crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.ad0136.map index 933ca4b2edcd1..1b59acb972b0b 100644 --- a/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_56c340.js.d5a489.map +++ b/crates/turbopack/tests/snapshot/integration/preset_env/output/crates_turbopack_tests_snapshot_integration_preset_env_input_index_272dd2.js.ad0136.map @@ -1,6 +1,6 @@ { "version": 3, "sections": [ - {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/crates/turbopack/tests/snapshot/integration/preset_env/input/index.js"],"sourcesContent":["class Foo {}\n\nconsole.log(Foo, [].includes(\"foo\"));\n"],"names":[],"mappings":"AAAA;;;AAAA,IAAA,AAAM,MAAN,SAAM;;yMAAA;;AAEN,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC"}}, - {"offset": {"line": 10, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] + {"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/crates/turbopack/tests/snapshot/integration/preset_env/input/index.js"],"sourcesContent":["class Foo {}\n\nconsole.log(Foo, [].includes(\"foo\"));\n"],"names":[],"mappings":"AAAA;;;;;;;AAAA,IAAA,AAAM,MAAN,SAAM;;4BAAA;;AAEN,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC"}}, + {"offset": {"line": 14, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] } \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js b/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js similarity index 73% rename from crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js rename to crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js index d17b5a3e57484..9bca3dcb08108 100644 --- a/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js +++ b/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js @@ -1,4 +1,4 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js", { "[project]/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/input/index.js (ecmascript)": (function({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process, m: module, e: exports }) { !function() { @@ -11,7 +11,7 @@ console.log(dne); }.call(this) }), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_cdf9ff.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_393f16.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/input/index.js (ecmascript)"); }]); (() => { @@ -22,25 +22,65 @@ console.log(dne); // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -59,7 +99,7 @@ console.log(dne); * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -70,32 +110,57 @@ console.log(dne); browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -105,16 +170,27 @@ console.log(dne); esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -139,16 +215,26 @@ console.log(dne); return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -178,6 +264,10 @@ console.log(dne); }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -205,21 +295,33 @@ console.log(dne); return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -228,13 +330,13 @@ console.log(dne); // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -246,6 +348,7 @@ console.log(dne); const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -258,9 +361,9 @@ console.log(dne); moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -291,11 +394,16 @@ console.log(dne); return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -316,6 +424,10 @@ console.log(dne); /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -338,10 +450,15 @@ console.log(dne); return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -394,6 +511,10 @@ console.log(dne); } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -404,6 +525,10 @@ console.log(dne); return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -441,6 +566,10 @@ console.log(dne); return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -456,6 +585,11 @@ console.log(dne); return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -492,6 +626,9 @@ console.log(dne); * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -530,6 +667,12 @@ console.log(dne); return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -548,12 +691,12 @@ console.log(dne); // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -561,6 +704,11 @@ console.log(dne); } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -574,9 +722,17 @@ console.log(dne); applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -585,16 +741,16 @@ console.log(dne); ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -604,8 +760,7 @@ console.log(dne); if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -622,7 +777,7 @@ console.log(dne); if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -653,7 +808,29 @@ console.log(dne); }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -661,6 +838,24 @@ console.log(dne); disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -669,16 +864,7 @@ console.log(dne); data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -720,6 +906,9 @@ console.log(dne); /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -734,6 +923,10 @@ console.log(dne); /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -750,29 +943,25 @@ console.log(dne); /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -790,12 +979,17 @@ console.log(dne); chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -808,6 +1002,7 @@ console.log(dne); runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -815,4 +1010,4 @@ console.log(dne); })(); -//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js.2f34663e6562097a.map \ No newline at end of file +//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js.2f34663e6562097a.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js.2f34663e6562097a.map b/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js.2f34663e6562097a.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js.2f34663e6562097a.map rename to crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js.2f34663e6562097a.map diff --git a/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js.ec8526.map b/crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js.ec8526.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_6cdf36.js.ec8526.map rename to crates/turbopack/tests/snapshot/integration/resolve_error_cjs/output/crates_turbopack_tests_snapshot_integration_resolve_error_cjs_input_index_0a82c8.js.ec8526.map diff --git a/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js b/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js similarity index 73% rename from crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js rename to crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js index 698b9853932a7..f5a290208b914 100644 --- a/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js +++ b/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js @@ -1,4 +1,4 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js", { "[project]/crates/turbopack/tests/snapshot/integration/resolve_error_esm/input/index.js (ecmascript)": (({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process }) => (() => { @@ -14,7 +14,7 @@ console.log({}[dne]); })()), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_1df277.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_d00b0c.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/resolve_error_esm/input/index.js (ecmascript)"); }]); (() => { @@ -25,25 +25,65 @@ console.log({}[dne]); // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -62,7 +102,7 @@ console.log({}[dne]); * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -73,32 +113,57 @@ console.log({}[dne]); browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -108,16 +173,27 @@ console.log({}[dne]); esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -142,16 +218,26 @@ console.log({}[dne]); return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -181,6 +267,10 @@ console.log({}[dne]); }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -208,21 +298,33 @@ console.log({}[dne]); return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -231,13 +333,13 @@ console.log({}[dne]); // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -249,6 +351,7 @@ console.log({}[dne]); const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -261,9 +364,9 @@ console.log({}[dne]); moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -294,11 +397,16 @@ console.log({}[dne]); return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -319,6 +427,10 @@ console.log({}[dne]); /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -341,10 +453,15 @@ console.log({}[dne]); return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -397,6 +514,10 @@ console.log({}[dne]); } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -407,6 +528,10 @@ console.log({}[dne]); return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -444,6 +569,10 @@ console.log({}[dne]); return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -459,6 +588,11 @@ console.log({}[dne]); return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -495,6 +629,9 @@ console.log({}[dne]); * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -533,6 +670,12 @@ console.log({}[dne]); return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -551,12 +694,12 @@ console.log({}[dne]); // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -564,6 +707,11 @@ console.log({}[dne]); } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -577,9 +725,17 @@ console.log({}[dne]); applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -588,16 +744,16 @@ console.log({}[dne]); ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -607,8 +763,7 @@ console.log({}[dne]); if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -625,7 +780,7 @@ console.log({}[dne]); if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -656,7 +811,29 @@ console.log({}[dne]); }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -664,6 +841,24 @@ console.log({}[dne]); disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -672,16 +867,7 @@ console.log({}[dne]); data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -723,6 +909,9 @@ console.log({}[dne]); /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -737,6 +926,10 @@ console.log({}[dne]); /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -753,29 +946,25 @@ console.log({}[dne]); /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -793,12 +982,17 @@ console.log({}[dne]); chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -811,6 +1005,7 @@ console.log({}[dne]); runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -818,4 +1013,4 @@ console.log({}[dne]); })(); -//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js.1cf37ac5daa5b01f.map \ No newline at end of file +//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js.1cf37ac5daa5b01f.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js.1cf37ac5daa5b01f.map b/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js.1cf37ac5daa5b01f.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js.1cf37ac5daa5b01f.map rename to crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js.1cf37ac5daa5b01f.map diff --git a/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js.65f1a4.map b/crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js.65f1a4.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_4f2d4d.js.65f1a4.map rename to crates/turbopack/tests/snapshot/integration/resolve_error_esm/output/crates_turbopack_tests_snapshot_integration_resolve_error_esm_input_index_486c0e.js.65f1a4.map diff --git a/crates/turbopack/tests/snapshot/integration/runtime_entry/output/crates_turbopack_tests_snapshot_integration_runtime_entry_input_index_55400d.js b/crates/turbopack/tests/snapshot/integration/runtime_entry/output/crates_turbopack_tests_snapshot_integration_runtime_entry_input_index_55400d.js index 2e04a8b12e38b..c38df12ba28c8 100644 --- a/crates/turbopack/tests/snapshot/integration/runtime_entry/output/crates_turbopack_tests_snapshot_integration_runtime_entry_input_index_55400d.js +++ b/crates/turbopack/tests/snapshot/integration/runtime_entry/output/crates_turbopack_tests_snapshot_integration_runtime_entry_input_index_55400d.js @@ -17,25 +17,65 @@ console.log("hello world"); // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -54,7 +94,7 @@ console.log("hello world"); * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -65,32 +105,57 @@ console.log("hello world"); browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -100,16 +165,27 @@ console.log("hello world"); esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -134,16 +210,26 @@ console.log("hello world"); return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -173,6 +259,10 @@ console.log("hello world"); }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -200,21 +290,33 @@ console.log("hello world"); return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -223,13 +325,13 @@ console.log("hello world"); // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -241,6 +343,7 @@ console.log("hello world"); const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -253,9 +356,9 @@ console.log("hello world"); moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -286,11 +389,16 @@ console.log("hello world"); return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -311,6 +419,10 @@ console.log("hello world"); /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -333,10 +445,15 @@ console.log("hello world"); return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -389,6 +506,10 @@ console.log("hello world"); } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -399,6 +520,10 @@ console.log("hello world"); return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -436,6 +561,10 @@ console.log("hello world"); return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -451,6 +580,11 @@ console.log("hello world"); return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -487,6 +621,9 @@ console.log("hello world"); * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -525,6 +662,12 @@ console.log("hello world"); return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -543,12 +686,12 @@ console.log("hello world"); // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -556,6 +699,11 @@ console.log("hello world"); } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -569,9 +717,17 @@ console.log("hello world"); applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -580,16 +736,16 @@ console.log("hello world"); ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -599,8 +755,7 @@ console.log("hello world"); if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -617,7 +772,7 @@ console.log("hello world"); if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -648,7 +803,29 @@ console.log("hello world"); }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -656,6 +833,24 @@ console.log("hello world"); disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -664,16 +859,7 @@ console.log("hello world"); data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -715,6 +901,9 @@ console.log("hello world"); /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -729,6 +918,10 @@ console.log("hello world"); /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -745,29 +938,25 @@ console.log("hello world"); /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -785,12 +974,17 @@ console.log("hello world"); chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -803,6 +997,7 @@ console.log("hello world"); runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; diff --git a/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js b/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js similarity index 74% rename from crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js rename to crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js index 3d5c17ad23852..b72dec8f504df 100644 --- a/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js +++ b/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js @@ -1,4 +1,4 @@ -(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js", { +(self.TURBOPACK = self.TURBOPACK || []).push(["[workspace]/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js", { "[project]/crates/turbopack/tests/snapshot/integration/static/input/index.js (ecmascript)": (({ r: __turbopack_require__, x: __turbopack_external_require__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, c: __turbopack_cache__, l: __turbopack_load__, p: process }) => (() => { @@ -13,7 +13,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/static/04cd41686148faf80b59f60e37c4f0ab.svg"); })()), }, ({ loadedChunks, instantiateRuntimeModule }) => { - if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_18c84f.js"))) return true; + if(!(true && loadedChunks.has("[workspace]/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_2918d8.js"))) return true; instantiateRuntimeModule("[project]/crates/turbopack/tests/snapshot/integration/static/input/index.js (ecmascript)"); }]); (() => { @@ -24,25 +24,65 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ // When the runtime executes, it will pick up and register all pending chunks, // and replace the list of pending chunks with itself so later chunks can // register directly with it. + + /* eslint-disable @next/next/no-assign-module-variable */ + if (!Array.isArray(self.TURBOPACK)) { return; } - var chunksToRegister = self.TURBOPACK; - var runnable = []; - var moduleFactories = { __proto__: null }; - var moduleCache = { __proto__: null }; + /** @typedef {import('../types').ChunkRegistration} ChunkRegistration */ + /** @typedef {import('../types').ChunkModule} ChunkModule */ + /** @typedef {import('../types').Chunk} Chunk */ + /** @typedef {import('../types').ModuleFactory} ModuleFactory */ + /** @typedef {import('../types/hot').UpdateInstructions} UpdateInstructions */ + + /** @typedef {import('../types').ChunkId} ChunkId */ + /** @typedef {import('../types').ModuleId} ModuleId */ + + /** @typedef {import('../types').Module} Module */ + /** @typedef {import('../types').Exports} Exports */ + /** @typedef {import('../types').EsmInteropNamespace} EsmInteropNamespace */ + /** @typedef {import('../types').Runnable} Runnable */ + + /** @typedef {import('../types').Runtime} Runtime */ + + /** @typedef {import('../types').RefreshHelpers} RefreshHelpers */ + /** @typedef {import('../types/hot').Hot} Hot */ + /** @typedef {import('../types/hot').HotData} HotData */ + /** @typedef {import('../types/hot').AcceptFunction} AcceptFunction */ + /** @typedef {import('../types/hot').AcceptCallback} AcceptCallback */ + /** @typedef {import('../types/hot').AcceptErrorHandler} AcceptErrorHandler */ + /** @typedef {import('../types/hot').HotState} HotState */ + + /** @typedef {import('../types/runtime').Loader} Loader */ + /** @typedef {import('../types/runtime').ModuleEffect} ModuleEffect */ + + /** @type {ChunkRegistration[]} */ + const chunksToRegister = self.TURBOPACK; + /** @type {Array} */ + let runnable = []; + /** @type {Object.} */ + const moduleFactories = { __proto__: null }; + /** @type {Object.} */ + const moduleCache = { __proto__: null }; /** * Contains the IDs of all chunks that have been loaded. + * + * @type {Set} */ const loadedChunks = new Set(); /** * Maps a chunk ID to the chunk's loader if the chunk is currently being loaded. + * + * @type {Map} */ const chunkLoaders = new Map(); /** * Maps module IDs to persisted data between executions of their hot module * implementation (`hot.data`). + * + * @type {Map} */ const moduleHotData = new Map(); /** @@ -61,7 +101,7 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ * from chunk A, but still exists in chunk B. */ const moduleChunksMap = new Map(); - var hOP = Object.prototype.hasOwnProperty; + const hOP = Object.prototype.hasOwnProperty; const _process = typeof process !== "undefined" ? process @@ -72,32 +112,57 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ browser: true, }; - var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; + /** + * @param {any} obj + * @param {PropertyKey} name + * @param {PropertyDescriptor & ThisType} options + */ function defineProp(obj, name, options) { if (!hOP.call(obj, name)) Object.defineProperty(obj, name, options); } + /** + * Adds the getters to the exports object + * + * @param {Exports} exports + * @param {Record any>} getters + */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); - for (var key in getters) { + for (const key in getters) { defineProp(exports, key, { get: getters[key], enumerable: true }); } } + /** + * @param {Module} module + * @param {any} value + */ function exportValue(module, value) { module.exports = value; } + /** + * @param {Record} obj + * @param {string} key + */ function createGetter(obj, key) { return () => obj[key]; } + /** + * @param {Exports} raw + * @param {EsmInteropNamespace} ns + * @param {boolean} [allowExportDefault] + */ function interopEsm(raw, ns, allowExportDefault) { - var getters = { __proto__: null }; + /** @type {Object. any>} */ + const getters = { __proto__: null }; if (typeof raw === "object" || typeof raw === "function") { - for (var key in raw) { + for (const key in raw) { getters[key] = createGetter(raw, key); } } @@ -107,16 +172,27 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ esm(ns, getters); } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @param {boolean} allowExportDefault + * @returns {EsmInteropNamespace} + */ function esmImport(sourceModule, id, allowExportDefault) { const module = getOrInstantiateModuleFromParent(id, sourceModule); - var raw = module.exports; + const raw = module.exports; if (raw.__esModule) return raw; if (module.interopNamespace) return module.interopNamespace; - var ns = (module.interopNamespace = {}); + const ns = (module.interopNamespace = {}); interopEsm(raw, ns, allowExportDefault); return ns; } + /** + * @param {Module} sourceModule + * @param {ModuleId} id + * @returns {Exports} + */ function commonJsRequire(sourceModule, id) { return getOrInstantiateModuleFromParent(id, sourceModule).exports; } @@ -141,16 +217,26 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ return ns; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Promise | undefined} + */ function loadChunk(chunkId, chunkPath) { if (loadedChunks.has(chunkId)) { return Promise.resolve(); } - let chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); + const chunkLoader = getOrCreateChunkLoader(chunkId, chunkPath); return chunkLoader.promise; } + /** + * @param {ChunkId} chunkId + * @param {string} chunkPath + * @returns {Loader} + */ function getOrCreateChunkLoader(chunkId, chunkPath) { let chunkLoader = chunkLoaders.get(chunkId); if (chunkLoader) { @@ -180,6 +266,10 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ }; chunkLoaders.set(chunkId, chunkLoader); + if (typeof document === "undefined") { + throw new Error("can't dynamically load scripts outside the browser"); + } + if (chunkPath.endsWith(".css")) { const link = document.createElement("link"); link.rel = "stylesheet"; @@ -207,21 +297,33 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ return chunkLoader; } - // TODO(alexkirsz) Use a TS enum. /** - * The module was instantiated because it was included in an evaluated chunk's - * runtime. + * @enum {number} */ - const SOURCE_TYPE_RUNTIME = 0; - /** - * The module was instantiated because a parent module imported it. - */ - const SOURCE_TYPE_PARENT = 1; + const SourceType = { + /** + * The module was instantiated because it was included in an evaluated chunk's + * runtime. + */ + Runtime: 0, + /** + * The module was instantiated because a parent module imported it. + */ + Parent: 1, + /** + * The module was instantiated because it was included in a chunk's hot module + * update. + */ + Update: 2, + }; + /** - * The module was instantiated because it was included in a chunk's hot module - * update. + * + * @param {ModuleId} id + * @param {SourceType} sourceType + * @param {ModuleId} [sourceId] + * @returns {Module} */ - const SOURCE_TYPE_UPDATE = 2; function instantiateModule(id, sourceType, sourceId) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { @@ -230,13 +332,13 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ // and contains e.g. a `require("something")` call. let instantiationReason; switch (sourceType) { - case SOURCE_TYPE_RUNTIME: + case SourceType.Runtime: instantiationReason = "as a runtime entry"; break; - case SOURCE_TYPE_PARENT: + case SourceType.Parent: instantiationReason = `because it was required from module ${sourceId}`; break; - case SOURCE_TYPE_UPDATE: + case SourceType.Update: instantiationReason = "because of an HMR update"; break; } @@ -248,6 +350,7 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ const hotData = moduleHotData.get(id); const { hot, hotState } = createModuleHot(hotData); + /** @type {Module} */ const module = { exports: {}, loaded: false, @@ -260,9 +363,9 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ moduleCache[id] = module; moduleHotState.set(module, hotState); - if (sourceType === SOURCE_TYPE_RUNTIME) { + if (sourceType === SourceType.Runtime) { runtimeModules.add(id); - } else if (sourceType === SOURCE_TYPE_PARENT) { + } else if (sourceType === SourceType.Parent) { module.parents.push(sourceId); // No need to add this module as a child of the parent module here, this @@ -293,11 +396,16 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ return module; } - // NOTE(alexkirsz) Webpack has an "module execution" interception hook that - // Next.js' React Refresh runtime hooks into to add module context to the - // refresh registry. + /** + * NOTE(alexkirsz) Webpack has an "module execution" interception hook that + * Next.js' React Refresh runtime hooks into to add module context to the + * refresh registry. + * + * @param {Module} module + * @param {() => void} executeModule + */ function runModuleExecutionHooks(module, executeModule) { - let cleanupReactRefreshIntercept = + const cleanupReactRefreshIntercept = typeof self.$RefreshInterceptModuleExecution$ === "function" ? self.$RefreshInterceptModuleExecution$(module.id) : () => {}; @@ -318,6 +426,10 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ /** * Retrieves a module from the cache, or instantiate it if it is not cached. + * + * @param {ModuleId} id + * @param {Module} sourceModule + * @returns {Module} */ function getOrInstantiateModuleFromParent(id, sourceModule) { if (!sourceModule.hot.active) { @@ -340,10 +452,15 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ return module; } - return instantiateModule(id, SOURCE_TYPE_PARENT, sourceModule.id); + return instantiateModule(id, SourceType.Parent, sourceModule.id); } - // This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + /** + * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts + * + * @param {Module} module + * @param {RefreshHelpers} helpers + */ function registerExportsAndSetupBoundaryForReactRefresh(module, helpers) { const currentExports = module.exports; const prevExports = module.hot.data.prevExports ?? null; @@ -396,6 +513,10 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ } } + /** + * @param {string[]} dependencyChain + * @returns {string} + */ function formatDependencyChain(dependencyChain) { return `Dependency chain: ${dependencyChain.join(" -> ")}`; } @@ -406,6 +527,10 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ return eval(code); } + /** + * @param {UpdateInstructions} update + * @returns {{outdatedModules: Set, newModuleFactories: Map}} + */ function computeOutdatedModules(update) { const outdatedModules = new Set(); const newModuleFactories = new Map(); @@ -443,6 +568,10 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ return { outdatedModules, newModuleFactories }; } + /** + * @param {Iterable} outdatedModules + * @returns {{ moduleId: ModuleId, errorHandler: Function }[]} + */ function computeOutdatedSelfAcceptedModules(outdatedModules) { const outdatedSelfAcceptedModules = []; for (const moduleId of outdatedModules) { @@ -458,6 +587,11 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ return outdatedSelfAcceptedModules; } + /** + * @param {ChunkId} chunkId + * @param {Iterable} outdatedModules + * @param {Iterable} deletedModules + */ function disposePhase(chunkId, outdatedModules, deletedModules) { for (const moduleId of outdatedModules) { const module = moduleCache[moduleId]; @@ -494,6 +628,9 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ * * Returns the persistent hot data that should be kept for the next module * instance. + * + * @param {Module} module + * @returns {{}} */ function disposeModule(module) { const hotState = moduleHotState.get(module); @@ -532,6 +669,12 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ return data; } + /** + * + * @param {ChunkId} chunkId + * @param {{ moduleId: ModuleId, errorHandler: Function }[]} outdatedSelfAcceptedModules + * @param {Map} newModuleFactories + */ function applyPhase( chunkId, outdatedSelfAcceptedModules, @@ -550,12 +693,12 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ // Re-instantiate all outdated self-accepted modules. for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) { try { - instantiateModule(moduleId, SOURCE_TYPE_UPDATE); - } catch (err1) { + instantiateModule(moduleId, SourceType.Update); + } catch (err) { if (typeof errorHandler === "function") { try { - errorHandler(err1, { moduleId, module: moduleCache[moduleId] }); - } catch (err2) { + errorHandler(err, { moduleId, module: moduleCache[moduleId] }); + } catch (_) { // Ignore error. } } @@ -563,6 +706,11 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ } } + /** + * + * @param {ChunkId} chunkId + * @param {UpdateInstructions} update + */ function applyUpdate(chunkId, update) { const { outdatedModules, newModuleFactories } = computeOutdatedModules(update); @@ -576,9 +724,17 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ applyPhase(chunkId, outdatedSelfAcceptedModules, newModuleFactories); } + /** + * + * @param {ModuleId} moduleId + * @returns {ModuleEffect} + */ function getAffectedModuleEffects(moduleId) { const outdatedModules = new Set(); + /** @typedef {{moduleId?: ModuleId, dependencyChain: ModuleId[]}} QueueItem */ + + /** @type {QueueItem[]} */ const queue = [ { moduleId, @@ -587,16 +743,16 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ ]; while (queue.length > 0) { - const { moduleId, dependencyChain } = queue.shift(); + const { moduleId, dependencyChain } = + /** @type {QueueItem} */ queue.shift(); outdatedModules.add(moduleId); // We've arrived at the runtime of the chunk, which means that nothing // else above can accept this update. - if (moduleId === null) { + if (moduleId === undefined) { return { type: "unaccepted", dependencyChain, - moduleId, }; } @@ -606,8 +762,7 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ if ( // The module is not in the cache. Since this is a "modified" update, // it means that the module was never instantiated before. - !module || - // The module accepted itself without invalidating itself. + !module || // The module accepted itself without invalidating itself. // TODO is that right? (hotState.selfAccepted && !hotState.selfInvalidated) ) { @@ -624,7 +779,7 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ if (runtimeModules.has(moduleId)) { queue.push({ - moduleId: null, + moduleId: undefined, dependencyChain: [...dependencyChain, moduleId], }); continue; @@ -655,7 +810,29 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ }; } + /** + * @param {ChunkId} chunkId + * @param {import('../types/protocol').ServerMessage} update + */ + function handleApply(chunkId, update) { + switch (update.type) { + case "partial": + applyUpdate(chunkId, JSON.parse(update.instruction)); + break; + case "restart": + self.location.reload(); + break; + default: + throw new Error(`Unknown update type: ${update.type}`); + } + } + + /** + * @param {HotData} [hotData] + * @returns {{hotState: HotState, hot: Hot}} + */ function createModuleHot(hotData) { + /** @type {HotState} */ const hotState = { selfAccepted: false, selfDeclined: false, @@ -663,6 +840,24 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ disposeHandlers: [], }; + /** + * TODO(alexkirsz) Support full (dep, callback, errorHandler) form. + * + * @param {string | string[] | AcceptErrorHandler} [dep] + * @param {AcceptCallback} [_callback] + * @param {AcceptErrorHandler} [_errorHandler] + */ + function accept(dep, _callback, _errorHandler) { + if (dep === undefined) { + hotState.selfAccepted = true; + } else if (typeof dep === "function") { + hotState.selfAccepted = dep; + } else { + throw new Error("unsupported `accept` signature"); + } + } + + /** @type {Hot} */ const hot = { // TODO(alexkirsz) This is not defined in the HMR API. It was used to // decide whether to warn whenever an HMR-disposed module required other @@ -671,16 +866,7 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ data: hotData ?? {}, - // TODO(alexkirsz) Support full (dep, callback, errorHandler) form. - accept: (dep, _callback, _errorHandler) => { - if (dep === undefined) { - hotState.selfAccepted = true; - } else if (typeof dep === "function") { - hotState.selfAccepted = dep; - } else { - throw new Error("unsupported `accept` signature"); - } - }, + accept: accept, decline: (dep) => { if (dep === undefined) { @@ -722,6 +908,9 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ /** * Adds a module to a chunk. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId */ function addModuleToChunk(moduleId, chunkId) { let moduleChunks = moduleChunksMap.get(moduleId); @@ -736,6 +925,10 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ /** * Removes a module from a chunk. Returns true there are no remaining chunks * including this module. + * + * @param {ModuleId} moduleId + * @param {ChunkId} chunkId + * @returns {boolean} */ function removeModuleFromChunk(moduleId, chunkId) { const moduleChunks = moduleChunksMap.get(moduleId); @@ -752,29 +945,25 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ /** * Instantiates a runtime module. */ + /** + * + * @param {ModuleId} moduleId + * @returns {Module} + */ function instantiateRuntimeModule(moduleId) { - return instantiateModule(moduleId, SOURCE_TYPE_RUNTIME); + return instantiateModule(moduleId, SourceType.Runtime); } /** * Subscribes to chunk updates from the update server and applies them. + * + * @param {ChunkId} chunkId */ function subscribeToChunkUpdates(chunkId) { // This adds a chunk update listener once the handler code has been loaded self.TURBOPACK_CHUNK_UPDATE_LISTENERS.push([ chunkId, - (updateType, instruction) => { - switch (updateType) { - case "partial": - applyUpdate(chunkId, JSON.parse(instruction)); - break; - case "restart": - self.location.reload(); - break; - default: - throw new Error(`Unknown update type: ${updateType}`); - } - }, + handleApply.bind(null, chunkId), ]); } @@ -792,12 +981,17 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ chunkLoader.onLoad(); } + /** @type {Runtime} */ const runtime = { loadedChunks, modules: moduleFactories, cache: moduleCache, instantiateRuntimeModule, }; + + /** + * @param {ChunkRegistration} chunkRegistration + */ function registerChunk([chunkId, chunkModules, ...run]) { markChunkAsLoaded(chunkId); subscribeToChunkUpdates(chunkId); @@ -810,6 +1004,7 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ runnable.push(...run); runnable = runnable.filter((r) => r(runtime)); } + self.TURBOPACK_CHUNK_UPDATE_LISTENERS = self.TURBOPACK_CHUNK_UPDATE_LISTENERS || []; self.TURBOPACK = { push: registerChunk }; @@ -817,4 +1012,4 @@ __turbopack_export_value__("/crates/turbopack/tests/snapshot/integration/static/ })(); -//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.caa2a16260ae9c94.map \ No newline at end of file +//# sourceMappingURL=crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.caa2a16260ae9c94.map \ No newline at end of file diff --git a/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.2e7826.map b/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.2e7826.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.2e7826.map rename to crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.2e7826.map diff --git a/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.42fe58.map b/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.42fe58.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.42fe58.map rename to crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.42fe58.map diff --git a/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.caa2a16260ae9c94.map b/crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.caa2a16260ae9c94.map similarity index 100% rename from crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_099cfa.js.caa2a16260ae9c94.map rename to crates/turbopack/tests/snapshot/integration/static/output/crates_turbopack_tests_snapshot_integration_static_input_index_a0a0c3.js.caa2a16260ae9c94.map diff --git a/package.json b/package.json index be4f5a9c04af6..945e70d752361 100644 --- a/package.json +++ b/package.json @@ -66,5 +66,5 @@ } } }, - "packageManager": "pnpm@7.12.1" + "packageManager": "pnpm@7.13.5" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8c51f980f0b4a..ef77f3a98cce3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -79,13 +79,26 @@ importers: uvu: 0.5.6 zstd-codec: 0.1.4 - crates/next-core: + crates/next-core/js: specifiers: + '@next/react-refresh-utils': ^12.2.5 + '@types/node': ^18.8.4 + '@types/react': ^18.0.21 + '@types/react-dom': ^18.0.6 + '@vercel/turbopack-runtime': latest + next: ^12.3.1 react: ^18.2.0 react-dom: ^18.2.0 dependencies: + '@next/react-refresh-utils': 12.3.1_react-refresh@0.12.0 + '@vercel/turbopack-runtime': link:../../turbopack-ecmascript/js + next: 12.3.1_biqbaboplfbrettd7655fr4n2y react: 18.2.0 react-dom: 18.2.0_react@18.2.0 + devDependencies: + '@types/node': 18.11.0 + '@types/react': 18.0.21 + '@types/react-dom': 18.0.6 crates/next-dev/tests: specifiers: @@ -101,8 +114,14 @@ importers: react-test-renderer: 18.2.0_react@18.2.0 styled-jsx: 5.0.7_react@18.2.0 - crates/turbopack-ecmascript: - specifiers: {} + crates/turbopack-ecmascript/js: + specifiers: + '@next/react-refresh-utils': ^12.2.5 + '@types/node': ^18.8.4 + dependencies: + '@next/react-refresh-utils': 12.3.1_react-refresh@0.12.0 + devDependencies: + '@types/node': 18.11.0 crates/turbopack/tests/node-file-trace: specifiers: @@ -1836,7 +1855,7 @@ packages: engines: {node: ^8.13.0 || >=10.10.0} dependencies: '@grpc/proto-loader': 0.7.3 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@grpc/grpc-js/1.7.2: @@ -1844,7 +1863,7 @@ packages: engines: {node: ^8.13.0 || >=10.10.0} dependencies: '@grpc/proto-loader': 0.7.3 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@grpc/proto-loader/0.5.6: @@ -1974,7 +1993,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 chalk: 4.1.2 jest-message-util: 27.5.1 jest-util: 27.5.1 @@ -1995,7 +2014,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.8.1 @@ -2040,7 +2059,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.8.1 @@ -2077,7 +2096,7 @@ packages: dependencies: '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 jest-mock: 27.5.1 dev: true @@ -2087,7 +2106,7 @@ packages: dependencies: '@jest/types': 27.5.1 '@sinonjs/fake-timers': 8.1.0 - '@types/node': 17.0.45 + '@types/node': 18.11.0 jest-message-util: 27.5.1 jest-mock: 27.5.1 jest-util: 27.5.1 @@ -2116,7 +2135,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 chalk: 4.1.2 collect-v8-coverage: 1.0.1 exit: 0.1.2 @@ -2227,7 +2246,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 '@types/yargs': 16.0.4 chalk: 4.1.2 dev: true @@ -2678,7 +2697,7 @@ packages: react: '>=16' dependencies: '@types/mdx': 2.0.2 - '@types/react': 17.0.50 + '@types/react': 18.0.21 react: 18.2.0 dev: false @@ -2902,6 +2921,18 @@ packages: glob: 7.1.7 dev: true + /@next/react-refresh-utils/12.3.1_react-refresh@0.12.0: + resolution: {integrity: sha512-FapIe6mEmgIT9j7dp76odIs+oixLHM43xQx2pVWqaTgdO+4TeYaCmQKT3Li/wSgM0zipYhXdxSReLUfWl6J1Tg==} + peerDependencies: + react-refresh: 0.12.0 + webpack: ^4 || ^5 + peerDependenciesMeta: + webpack: + optional: true + dependencies: + react-refresh: 0.12.0 + dev: false + /@next/swc-android-arm-eabi/12.3.1: resolution: {integrity: sha512-i+BvKA8tB//srVPPQxIQN5lvfROcfv4OB23/L1nXznP+N/TyKL8lql3l7oo2LNhnH66zWhfoemg3Q4VJZSruzQ==} engines: {node: '>= 10'} @@ -3221,7 +3252,7 @@ packages: /@rdfjs/types/1.1.0: resolution: {integrity: sha512-5zm8bN2/CC634dTcn/0AhTRLaQRjXDZs3QfcAsQKNturHT7XVWcKy/8p3P5gXl+YkZTAmy7T5M/LyiT/jbkENw==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@reach/skip-nav/0.17.0_biqbaboplfbrettd7655fr4n2y: @@ -4829,7 +4860,7 @@ packages: /@types/accepts/1.3.5: resolution: {integrity: sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/acorn/4.0.6: @@ -4870,14 +4901,14 @@ packages: /@types/bindings/1.5.1: resolution: {integrity: sha512-8HzueDeoxGXdsJ0Ep7TOXHGN+woRTWa1bAds30r5we7PCC3P5zrSTRknePLn/KYAubgQv5t/1zkonnStHLCWOg==} dependencies: - '@types/node': 16.11.56 + '@types/node': 18.11.0 dev: true /@types/body-parser/1.19.0: resolution: {integrity: sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==} dependencies: '@types/connect': 3.4.35 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/braces/3.0.1: @@ -4887,7 +4918,7 @@ packages: /@types/bson/4.0.5: resolution: {integrity: sha512-vVLwMUqhYJSQ/WKcE60eFqcyuWse5fGH+NMAXHuKrUAPoryq3ATxk5o4bgYNtg5aOM4APVg7Hnb3ASqUYG0PKg==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/cacheable-request/6.0.2: @@ -4895,7 +4926,7 @@ packages: dependencies: '@types/http-cache-semantics': 4.0.1 '@types/keyv': 3.1.4 - '@types/node': 17.0.45 + '@types/node': 18.11.0 '@types/responselike': 1.0.0 dev: true @@ -4906,7 +4937,7 @@ packages: /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/content-disposition/0.5.5: @@ -4919,7 +4950,7 @@ packages: '@types/connect': 3.4.35 '@types/express': 4.17.14 '@types/keygrip': 1.0.2 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/cors/2.8.10: @@ -4972,7 +5003,7 @@ packages: /@types/express-serve-static-core/4.17.31: resolution: {integrity: sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 dev: true @@ -4995,13 +5026,13 @@ packages: /@types/fs-capacitor/2.0.0: resolution: {integrity: sha512-FKVPOCFbhCvZxpVAMhdBdTfVfXUpsh15wFHgqOKxh9N9vzWZVuWCSijZ5T4U34XYNnuj2oduh6xcs1i+LPI+BQ==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/geojson/7946.0.10: @@ -5012,13 +5043,13 @@ packages: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: '@types/minimatch': 5.1.1 - '@types/node': 16.11.56 + '@types/node': 18.11.0 dev: true /@types/graceful-fs/4.1.5: resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} dependencies: - '@types/node': 16.11.56 + '@types/node': 18.11.0 dev: true /@types/gradient-string/1.1.2: @@ -5096,7 +5127,7 @@ packages: /@types/jsonwebtoken/8.5.9: resolution: {integrity: sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/keygrip/1.0.2: @@ -5106,7 +5137,7 @@ packages: /@types/keyv/3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/koa-compose/3.2.5: @@ -5125,7 +5156,7 @@ packages: '@types/http-errors': 1.8.2 '@types/keygrip': 1.0.2 '@types/koa-compose': 3.2.5 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/long/4.0.2: @@ -5167,7 +5198,7 @@ packages: resolution: {integrity: sha512-WcdpPJCakFzcWWD9juKoZbRtQxKIMYF/JIAM4JrNHrMcnJL6/a2NWjXxW7fo9hxboxxkg+icff8d7+WIEvKgYQ==} dependencies: '@types/bson': 4.0.5 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/ms/0.7.31: @@ -5176,7 +5207,7 @@ packages: /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 form-data: 3.0.1 dev: true @@ -5202,6 +5233,10 @@ packages: /@types/node/17.0.45: resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} + dev: true + + /@types/node/18.11.0: + resolution: {integrity: sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w==} /@types/normalize-package-data/2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -5232,24 +5267,38 @@ packages: rdf-js: 4.0.2 dev: true + /@types/react-dom/18.0.6: + resolution: {integrity: sha512-/5OFZgfIPSwy+YuIBP/FgJnQnsxhZhjjrnxudMddeblOouIodEQ75X14Rr4wGSG/bknL+Omy9iWlLo1u/9GzAA==} + dependencies: + '@types/react': 18.0.21 + dev: true + /@types/react/17.0.50: resolution: {integrity: sha512-ZCBHzpDb5skMnc1zFXAXnL3l1FAdi+xZvwxK+PkglMmBrwjpp9nKaWuEvrGnSifCJmBFGxZOOFuwC6KH/s0NuA==} dependencies: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.2 csstype: 3.1.1 + dev: true + + /@types/react/18.0.21: + resolution: {integrity: sha512-7QUCOxvFgnD5Jk8ZKlUAhVcRj7GuJRjnjjiY/IUBWKgOlnvDvTMLD4RTF7NPyVmbRhNrbomZiOepg7M/2Kj1mA==} + dependencies: + '@types/prop-types': 15.7.5 + '@types/scheduler': 0.16.2 + csstype: 3.1.1 /@types/responselike/1.0.0: resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/rimraf/3.0.2: resolution: {integrity: sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ==} dependencies: '@types/glob': 7.2.0 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/scheduler/0.16.2: @@ -5267,7 +5316,7 @@ packages: resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==} dependencies: '@types/mime': 3.0.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/stack-utils/1.0.1: @@ -5281,7 +5330,7 @@ packages: /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/tinycolor2/1.4.3: @@ -5309,7 +5358,7 @@ packages: /@types/webpack/5.28.0: resolution: {integrity: sha512-8cP0CzcxUiFuA9xGJkfeVpqmWTk9nx6CWwamRGCj95ph1SmlRRk9KlCZ6avhCbZd4L68LvYT6l1kpdEnQXrF8w==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 tapable: 2.2.1 webpack: 5.74.0 transitivePeerDependencies: @@ -5322,14 +5371,14 @@ packages: /@types/whatwg-url/8.2.2: resolution: {integrity: sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 '@types/webidl-conversions': 7.0.0 dev: false /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /@types/yargs-parser/21.0.0: @@ -7608,7 +7657,7 @@ packages: /chrome-launcher/0.10.7: resolution: {integrity: sha512-IoQLp64s2n8OQuvKZwt77CscVj3UlV2Dj7yZtd1EBMld9mSdGcsGy9fN5hd/r4vJuWZR09it78n1+A17gB+AIQ==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 is-wsl: 1.1.0 lighthouse-logger: 1.3.0 mkdirp: 0.5.1 @@ -7620,7 +7669,7 @@ packages: /chrome-launcher/0.11.2: resolution: {integrity: sha512-jx0kJDCXdB2ARcDMwNCtrf04oY1Up4rOmVu+fqJ5MTPOOIG8EhRcEU9NZfXZc6dMw9FU8o1r21PNp8V2M0zQ+g==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 is-wsl: 2.2.0 lighthouse-logger: 1.3.0 mkdirp: 0.5.1 @@ -11362,7 +11411,7 @@ packages: dependencies: '@firebase/database-compat': 0.1.8_ajhz23vnjjvarxerxqf5xxo3b4 '@firebase/database-types': 0.7.3 - '@types/node': 16.11.56 + '@types/node': 18.11.0 dicer: 0.3.1 jsonwebtoken: 8.5.1 jwks-rsa: 2.1.5 @@ -13794,7 +13843,7 @@ packages: '@jest/environment': 27.5.1 '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 chalk: 4.1.2 co: 4.6.0 dedent: 0.7.0 @@ -14000,7 +14049,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 jest-mock: 27.5.1 jest-util: 27.5.1 jsdom: 16.7.0 @@ -14018,7 +14067,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 jest-mock: 27.5.1 jest-util: 27.5.1 jsdom: 16.7.0_canvas@2.10.1 @@ -14036,7 +14085,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 jest-mock: 27.5.1 jest-util: 27.5.1 dev: true @@ -14057,7 +14106,7 @@ packages: dependencies: '@jest/types': 27.5.1 '@types/graceful-fs': 4.1.5 - '@types/node': 17.0.45 + '@types/node': 18.11.0 anymatch: 3.1.2 fb-watchman: 2.0.1 graceful-fs: 4.2.10 @@ -14079,7 +14128,7 @@ packages: '@jest/source-map': 27.5.1 '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 chalk: 4.1.2 co: 4.6.0 expect: 27.5.1 @@ -14160,7 +14209,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /jest-pnp-resolver/1.2.2_jest-resolve@27.5.1: @@ -14221,7 +14270,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 chalk: 4.1.2 emittery: 0.8.1 graceful-fs: 4.2.10 @@ -14253,7 +14302,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 chalk: 4.1.2 emittery: 0.8.1 graceful-fs: 4.2.10 @@ -14310,7 +14359,7 @@ packages: resolution: {integrity: sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 graceful-fs: 4.2.10 dev: true @@ -14349,7 +14398,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 chalk: 4.1.2 ci-info: 3.3.2 graceful-fs: 4.2.10 @@ -14374,7 +14423,7 @@ packages: dependencies: '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 17.0.45 + '@types/node': 18.11.0 ansi-escapes: 4.3.2 chalk: 4.1.2 jest-util: 27.5.1 @@ -14385,7 +14434,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true @@ -18985,7 +19034,7 @@ packages: '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 '@types/long': 4.0.2 - '@types/node': 17.0.45 + '@types/node': 18.11.0 long: 4.0.0 dev: true @@ -19004,7 +19053,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 17.0.45 + '@types/node': 18.11.0 long: 5.2.0 dev: true @@ -19395,6 +19444,11 @@ packages: resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} dev: true + /react-refresh/0.12.0: + resolution: {integrity: sha512-suLIhrU2IHKL5JEKR/fAwJv7bbeq4kJ+pJopf77jHwuR+HmJS/HbrPIGsTBUVfw7tXPOmYv7UJ7PCaN49e8x4A==} + engines: {node: '>=0.10.0'} + dev: false + /react-shallow-renderer/16.15.0_react@18.2.0: resolution: {integrity: sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==} peerDependencies: @@ -20820,7 +20874,7 @@ packages: resolution: {integrity: sha512-9/5CApkKKl6bS6jJ2D0DQllwz/1xq3cyJCR6DLgAQnkj5djCuq8NbflEdD2TI01p8qzS9qaKjzxM9cHT11ezmg==} engines: {node: '>=5.0'} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 image-ssim: 0.2.0 jpeg-js: 0.1.2 dev: true @@ -23454,7 +23508,7 @@ packages: /wkx/0.4.8: resolution: {integrity: sha512-ikPXMM9IR/gy/LwiOSqWlSL3X/J5uk9EO2hHNRXS41eTLXaUFEVw9fn/593jW/tE5tedNg8YjT5HkCa4FqQZyQ==} dependencies: - '@types/node': 17.0.45 + '@types/node': 18.11.0 dev: true /word-wrap/1.2.3: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 2af7d609b031d..a838650f4d185 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -9,4 +9,4 @@ packages: - "crates/turbopack/tests/node-file-trace" - "crates/turbopack/tests/snapshot" - "crates/next-dev/tests" - - "crates/*" + - "crates/*/js" diff --git a/tsconfig.json b/tsconfig.json index c4a63363289b0..c93710c8cddbf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,5 +13,5 @@ "@vercel/webpack-nft": ["webpack-nmt/src/index.ts"] } }, - "exclude": ["node_modules", "crates", ".yarn", "target"] + "exclude": ["node_modules", "target"] }