From d82a7ffaf97f862eeaf677db547cd3f729fb5b2a Mon Sep 17 00:00:00 2001
From: zoomdong <1344492820@qq.com>
Date: Thu, 24 Sep 2026 15:55:34 +0800
Subject: [PATCH 1/2] fix(pack): isolate runtime public path for async chunks
A child application can replace globalThis.publicPath after the host runtime starts. Keep the host chunk base in its own runtime and map __webpack_public_path__ assignments to that runtime-local value.
---
.../shared/transforms/webpack_public_path.rs | 20 +-
.../output/server/entries/server.5d80c3de.js | 15 +-
.../output/server/stats.json | 12 +-
...4s0q6tr63l.js.map => 3__i_dkfnyihc.js.map} | 12 +-
...3mx19_u-.js => turbopack-2-1h76jk0yd2s.js} | 17 +-
.../hmr/lazy_dynamic_imports/output/main.js | 15 +-
.../extract-comments/output/main.936466c5.js | 2 +-
.../auto/output/3u1uqq3w-6ie5.js.map} | 8 +-
...wk-o1l71.js => turbopack-377b2y52vbuvk.js} | 17 +-
.../output/3u1uqq3w-6ie5.js.map} | 8 +-
...exscik1w.js => turbopack-2jo9ezqn4ymgo.js} | 17 +-
.../{42w3jcw1a-7ac.js => 09dv9ffdzeqfw.js} | 6 +-
...vvreq9nj5m.js.map => 0ik5m9jyjydqd.js.map} | 2 +-
.../output/3u1uqq3w-6ie5.js.map} | 8 +-
...14fd6li3.js => turbopack-3mrldusdyss4m.js} | 19 +-
.../public_path/runtime_isolation/assert.js | 107 ++
.../public_path/runtime_isolation/config.json | 18 +
.../runtime_isolation/input/first.js | 1 +
.../runtime_isolation/input/index.js | 10 +
.../runtime_isolation/input/second.js | 1 +
.../output/0blwix15tn38h.js.map | 6 +
.../output/1hupm5eawvfbm.js.map | 6 +
.../runtime_isolation/output/25qxv1z5_qn_7.js | 37 +
.../runtime_isolation/output/26ncfjofcc5k3.js | 14 +
.../runtime_isolation/output/2p_19-mhwwdn6.js | 14 +
.../output/39w-q4tse4ubg.js.map | 6 +
.../output/3u1uqq3w-6ie5.js.map} | 8 +-
.../output/turbopack-2kg64dxw556de.js | 1315 +++++++++++++++++
.../output/3u1uqq3w-6ie5.js.map | 9 +
...bnha6z4d.js => turbopack-2i0rbh-zk3o8j.js} | 17 +-
...fl_nvq9hke.js.map => 0plsj1f7yxrec.js.map} | 14 +-
...53dj3tsr.js => turbopack-1vxf7ue8lan7t.js} | 17 +-
.../output/main.js | 15 +-
.../output/main.js.map | 10 +-
.../output/main.js | 15 +-
.../output/main.js.map | 12 +-
.../output/1cghx4023gj8h.js.map | 9 -
.../output/3u1uqq3w-6ie5.js.map | 9 +
...tek9-im9.js => turbopack-0q1mqk3yy-um7.js} | 17 +-
...zwt3_1_0w_.js.map => 02uzl2rzy2_qv.js.map} | 8 +-
...tkknu7kp.js => turbopack-3zflvvdl0qjhp.js} | 17 +-
.../library_build_runtime/output/main.js | 15 +-
.../library_build_runtime/output/main.js.map | 10 +-
.../output/main.js | 17 +-
.../node_library_build_runtime/output/main.js | 15 +-
.../output/main.js.map | 10 +-
.../output/_turbopack__runtime.js | 15 +-
.../output/_turbopack__runtime.js.map | 10 +-
next.js | 2 +-
49 files changed, 1837 insertions(+), 147 deletions(-)
rename crates/pack-tests/tests/snapshot/externals/basic/output/{1in4s0q6tr63l.js.map => 3__i_dkfnyihc.js.map} (85%)
rename crates/pack-tests/tests/snapshot/externals/basic/output/{turbopack-3hf0b3mx19_u-.js => turbopack-2-1h76jk0yd2s.js} (99%)
rename crates/pack-tests/tests/snapshot/{runtime/app_build_runtime/output/1cghx4023gj8h.js.map => public_path/auto/output/3u1uqq3w-6ie5.js.map} (83%)
rename crates/pack-tests/tests/snapshot/public_path/auto/output/{turbopack-16a71wk-o1l71.js => turbopack-377b2y52vbuvk.js} (98%)
rename crates/pack-tests/tests/snapshot/public_path/{runtime/output/1cghx4023gj8h.js.map => basic/output/3u1uqq3w-6ie5.js.map} (83%)
rename crates/pack-tests/tests/snapshot/public_path/basic/output/{turbopack-1prf_exscik1w.js => turbopack-2jo9ezqn4ymgo.js} (98%)
rename crates/pack-tests/tests/snapshot/public_path/runtime/output/{42w3jcw1a-7ac.js => 09dv9ffdzeqfw.js} (83%)
rename crates/pack-tests/tests/snapshot/public_path/runtime/output/{0clvvreq9nj5m.js.map => 0ik5m9jyjydqd.js.map} (81%)
rename crates/pack-tests/tests/snapshot/public_path/{auto/output/1cghx4023gj8h.js.map => runtime/output/3u1uqq3w-6ie5.js.map} (83%)
rename crates/pack-tests/tests/snapshot/public_path/runtime/output/{turbopack-0urwx14fd6li3.js => turbopack-3mrldusdyss4m.js} (98%)
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/assert.js
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/config.json
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/input/first.js
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/input/index.js
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/input/second.js
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/output/0blwix15tn38h.js.map
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/output/1hupm5eawvfbm.js.map
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/output/25qxv1z5_qn_7.js
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/output/26ncfjofcc5k3.js
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/output/2p_19-mhwwdn6.js
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/output/39w-q4tse4ubg.js.map
rename crates/pack-tests/tests/snapshot/public_path/{basic/output/1cghx4023gj8h.js.map => runtime_isolation/output/3u1uqq3w-6ie5.js.map} (83%)
create mode 100644 crates/pack-tests/tests/snapshot/public_path/runtime_isolation/output/turbopack-2kg64dxw556de.js
create mode 100644 crates/pack-tests/tests/snapshot/runtime/app_build_runtime/output/3u1uqq3w-6ie5.js.map
rename crates/pack-tests/tests/snapshot/runtime/app_build_runtime/output/{turbopack-079pfbnha6z4d.js => turbopack-2i0rbh-zk3o8j.js} (98%)
rename crates/pack-tests/tests/snapshot/runtime/app_dev_runtime/output/{1myfl_nvq9hke.js.map => 0plsj1f7yxrec.js.map} (91%)
rename crates/pack-tests/tests/snapshot/runtime/app_dev_runtime/output/{turbopack-2ivl253dj3tsr.js => turbopack-1vxf7ue8lan7t.js} (99%)
delete mode 100644 crates/pack-tests/tests/snapshot/runtime/cross_origin_loading_anonymous/output/1cghx4023gj8h.js.map
create mode 100644 crates/pack-tests/tests/snapshot/runtime/cross_origin_loading_anonymous/output/3u1uqq3w-6ie5.js.map
rename crates/pack-tests/tests/snapshot/runtime/cross_origin_loading_anonymous/output/{turbopack-286ugtek9-im9.js => turbopack-0q1mqk3yy-um7.js} (98%)
rename crates/pack-tests/tests/snapshot/runtime/export_entry_exports/output/{0r-zwt3_1_0w_.js.map => 02uzl2rzy2_qv.js.map} (83%)
rename crates/pack-tests/tests/snapshot/runtime/export_entry_exports/output/{turbopack-201tltkknu7kp.js => turbopack-3zflvvdl0qjhp.js} (98%)
diff --git a/crates/pack-core/src/shared/transforms/webpack_public_path.rs b/crates/pack-core/src/shared/transforms/webpack_public_path.rs
index afbf08d573..1a38facbd0 100644
--- a/crates/pack-core/src/shared/transforms/webpack_public_path.rs
+++ b/crates/pack-core/src/shared/transforms/webpack_public_path.rs
@@ -13,8 +13,8 @@ use turbopack_ecmascript::{CustomTransformer, TransformContext};
use super::{EcmascriptTransformStage, get_ecma_transform_rule};
-/// Returns a rule that maps webpack's runtime public path global onto utoopack's
-/// existing runtime public path hook.
+/// Returns a rule that maps webpack's runtime public path global onto the
+/// current utoopack runtime's public path.
pub fn get_webpack_public_path_transform_rule() -> ModuleRule {
get_ecma_transform_rule(
Box::new(WebpackPublicPathTransformer {}),
@@ -97,20 +97,20 @@ impl WebpackPublicPathVisitor {
sym == &atom!("__webpack_public_path__") && ctxt == self.unresolved_ctxt
}
- fn global_public_path_member(&self, span: swc_core::common::Span) -> MemberExpr {
+ fn runtime_public_path_member(&self, span: swc_core::common::Span) -> MemberExpr {
MemberExpr {
span,
obj: Box::new(Expr::Ident(Ident::new(
- atom!("globalThis"),
+ atom!("__turbopack_context__"),
span,
- self.unresolved_ctxt,
+ SyntaxContext::empty(),
))),
- prop: MemberProp::Ident(IdentName::new(atom!("publicPath"), span)),
+ prop: MemberProp::Ident(IdentName::new(atom!("runtimePublicPath"), span)),
}
}
- fn global_public_path_expr(&self, span: swc_core::common::Span) -> Expr {
- Expr::Member(self.global_public_path_member(span))
+ fn runtime_public_path_expr(&self, span: swc_core::common::Span) -> Expr {
+ Expr::Member(self.runtime_public_path_member(span))
}
}
@@ -121,7 +121,7 @@ impl VisitMut for WebpackPublicPathVisitor {
if self.is_webpack_public_path(&binding_ident.id.sym, binding_ident.id.ctxt) =>
{
assign_expr.left = AssignTarget::Simple(SimpleAssignTarget::Member(
- self.global_public_path_member(binding_ident.id.span),
+ self.runtime_public_path_member(binding_ident.id.span),
));
}
_ => {
@@ -136,7 +136,7 @@ impl VisitMut for WebpackPublicPathVisitor {
if let Expr::Ident(ident) = expr
&& self.is_webpack_public_path(&ident.sym, ident.ctxt)
{
- *expr = self.global_public_path_expr(ident.span);
+ *expr = self.runtime_public_path_expr(ident.span);
return;
}
diff --git a/crates/pack-tests/tests/snapshot/basic/multi_server_entries/output/server/entries/server.5d80c3de.js b/crates/pack-tests/tests/snapshot/basic/multi_server_entries/output/server/entries/server.5d80c3de.js
index 31a9d7b0fa..cd465292e4 100644
--- a/crates/pack-tests/tests/snapshot/basic/multi_server_entries/output/server/entries/server.5d80c3de.js
+++ b/crates/pack-tests/tests/snapshot/basic/multi_server_entries/output/server/entries/server.5d80c3de.js
@@ -531,6 +531,15 @@ contextPrototype.U = relativeURL;
contextPrototype.z = requireStub;
// Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.
contextPrototype.g = globalThis;
+// Each runtime keeps its own public path. Other applications on the page may
+// change the global path after this runtime has started.
+let runtimePublicPath = typeof globalThis !== 'undefined' ? globalThis.publicPath : undefined;
+Object.defineProperty(contextPrototype, 'runtimePublicPath', {
+ get: ()=>runtimePublicPath,
+ set: (value)=>{
+ runtimePublicPath = value;
+ }
+});
let cachedAutomaticPublicPath;
function getAutomaticPublicPath() {
if (cachedAutomaticPublicPath !== undefined) {
@@ -554,13 +563,13 @@ function getAutomaticPublicPath() {
}
/**
* Gets the public path for runtime assets.
- * Checks globalThis.publicPath and falls back to "/".
+ * Uses this runtime's public path and falls back to "/".
*/ function getPublicPath(mode) {
if (mode === 'auto') {
return getAutomaticPublicPath();
}
- if (typeof globalThis !== 'undefined' && typeof globalThis.publicPath === 'string') {
- const publicPath = globalThis.publicPath;
+ if (typeof runtimePublicPath === 'string') {
+ const publicPath = runtimePublicPath;
return publicPath.endsWith('/') ? publicPath : `${publicPath}/`;
}
return '/';
diff --git a/crates/pack-tests/tests/snapshot/basic/multi_server_entries/output/server/stats.json b/crates/pack-tests/tests/snapshot/basic/multi_server_entries/output/server/stats.json
index a2a6ae258e..60d1b165da 100644
--- a/crates/pack-tests/tests/snapshot/basic/multi_server_entries/output/server/stats.json
+++ b/crates/pack-tests/tests/snapshot/basic/multi_server_entries/output/server/stats.json
@@ -85,7 +85,7 @@
"entry": false,
"recorded": false,
"id": "entries/detail-server.5d841f26.js",
- "size": 32579,
+ "size": 32928,
"hash": "",
"files": [
"entries/detail-server.5d841f26.js"
@@ -97,7 +97,7 @@
"entry": false,
"recorded": false,
"id": "entries/index-server.5c83aa4e.js",
- "size": 32591,
+ "size": 32940,
"hash": "",
"files": [
"entries/index-server.5c83aa4e.js"
@@ -109,7 +109,7 @@
"entry": false,
"recorded": false,
"id": "entries/server.5d80c3de.js",
- "size": 32558,
+ "size": 32907,
"hash": "",
"files": [
"entries/server.5d80c3de.js"
@@ -145,7 +145,7 @@
"type": "asset",
"name": "entries/detail-server.5d841f26.js",
"info": {},
- "size": 32579,
+ "size": 32928,
"emitted": false,
"comparedForEmit": false,
"cached": false,
@@ -157,7 +157,7 @@
"type": "asset",
"name": "entries/index-server.5c83aa4e.js",
"info": {},
- "size": 32591,
+ "size": 32940,
"emitted": false,
"comparedForEmit": false,
"cached": false,
@@ -169,7 +169,7 @@
"type": "asset",
"name": "entries/server.5d80c3de.js",
"info": {},
- "size": 32558,
+ "size": 32907,
"emitted": false,
"comparedForEmit": false,
"cached": false,
diff --git a/crates/pack-tests/tests/snapshot/externals/basic/output/1in4s0q6tr63l.js.map b/crates/pack-tests/tests/snapshot/externals/basic/output/3__i_dkfnyihc.js.map
similarity index 85%
rename from crates/pack-tests/tests/snapshot/externals/basic/output/1in4s0q6tr63l.js.map
rename to crates/pack-tests/tests/snapshot/externals/basic/output/3__i_dkfnyihc.js.map
index 10f68a2648..9ebf796b23 100644
--- a/crates/pack-tests/tests/snapshot/externals/basic/output/1in4s0q6tr63l.js.map
+++ b/crates/pack-tests/tests/snapshot/externals/basic/output/3__i_dkfnyihc.js.map
@@ -2,10 +2,10 @@
"version": 3,
"sources": [],
"sections": [
- {"offset": {"line": 23, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\ntype EsmNamespaceObject = Record\n\n/**\n * Describes why a module was instantiated.\n * Shared between browser and Node.js runtimes.\n */\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\n/**\n * Flag indicating which module object type to create when a module is merged. Set to `true`\n * by each runtime that uses ModuleWithDirection (browser dev-base.ts, nodejs dev-base.ts,\n * nodejs build-base.ts). Browser production (build-base.ts) leaves it as `false` since it\n * uses plain Module objects.\n */\nlet createModuleWithDirectionFlag = false\n\nconst REEXPORTED_OBJECTS = new WeakMap()\n\n/**\n * Constructs the `__turbopack_context__` object for a module.\n */\nfunction Context(\n this: TurbopackBaseContext,\n module: Module,\n exports: Exports\n) {\n this.m = module\n // We need to store this here instead of accessing it from the module object to:\n // 1. Make it available to factories directly, since we rewrite `this` to\n // `__turbopack_context__.e` in CJS modules.\n // 2. Support async modules which rewrite `module.exports` to a promise, so we\n // can still access the original exports object from functions like\n // `esmExport`\n // Ideally we could find a new approach for async modules and drop this property altogether.\n this.e = exports\n}\nconst contextPrototype = Context.prototype as TurbopackBaseContext\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: string): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: string): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: string): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: M['id'],\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n if (createModuleWithDirectionFlag) {\n // set in development modes for hmr support\n module = createModuleWithDirection(id)\n } else {\n module = createModuleObject(id)\n }\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Creates the module object. Only done here to ensure all module objects have the same shape.\n */\nfunction createModuleObject(id: ModuleId): Module {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n }\n}\n\nfunction createModuleWithDirection(id: ModuleId): ModuleWithDirection {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n parents: [],\n children: [],\n }\n}\n\ntype BindingTag = 0\nconst BindingTag_Value = 0 as BindingTag\n\n// an arbitrary sequence of bindings as\n// - a prop name\n// - BindingTag_Value, a value to be bound directly, or\n// - 1 or 2 functions to bind as getters and sdetters\ntype EsmBindings = Array<\n string | BindingTag | (() => unknown) | ((v: unknown) => void) | unknown\n>\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(exports: Exports, bindings: EsmBindings, dynamic?: boolean) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n let i = 0\n while (i < bindings.length) {\n const propName = bindings[i++] as string\n const tagOrFunction = bindings[i++]\n if (typeof tagOrFunction === 'number') {\n if (tagOrFunction === BindingTag_Value) {\n defineProp(exports, propName, {\n value: bindings[i++],\n enumerable: true,\n writable: false,\n })\n } else {\n throw new Error(`unexpected tag: ${tagOrFunction}`)\n }\n } else {\n const getterFn = tagOrFunction as () => unknown\n if (typeof bindings[i] === 'function') {\n const setterFn = bindings[i++] as (v: unknown) => void\n defineProp(exports, propName, {\n get: getterFn,\n set: setterFn,\n enumerable: true,\n })\n } else {\n defineProp(exports, propName, {\n get: getterFn,\n enumerable: true,\n })\n }\n }\n }\n // The properties defined above are already non-configurable and\n // non-writable, so the namespace's existing exports are effectively\n // immutable. Sealing additionally makes the object non-extensible, matching\n // real ESM-namespace semantics. Modules with dynamic re-exports\n // (`export *` from a CommonJS module) must stay extensible so the dynamic\n // export proxy can surface keys discovered at runtime, so skip the seal for\n // them.\n if (!dynamic) Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n this: TurbopackBaseContext,\n bindings: EsmBindings,\n id: ModuleId | undefined,\n dynamic?: boolean\n) {\n let module: Module\n let exports: Module['exports']\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n module.namespaceObject = exports\n esm(exports, bindings, dynamic)\n}\ncontextPrototype.s = esmExport\n\ntype ReexportedObjects = Record[]\nfunction ensureDynamicExports(\n module: Module,\n exports: Exports\n): ReexportedObjects {\n let reexportedObjects: ReexportedObjects | undefined =\n REEXPORTED_OBJECTS.get(module)\n\n if (!reexportedObjects) {\n REEXPORTED_OBJECTS.set(module, (reexportedObjects = []))\n // Returns the re-exported object that provides `prop` as an own property,\n // or `undefined` if none does. The traps share this logic so they always\n // agree on which keys are synthesized from `reexportedObjects`. `default`\n // is never re-exported by `export *`, so it is never synthesized.\n const reexportOwning = (prop: PropertyKey) => {\n if (prop !== 'default') {\n for (const obj of reexportedObjects!) {\n if (hasOwnProperty.call(obj, prop)) return obj\n }\n }\n return undefined\n }\n // Modules with dynamic re-exports are not sealed by `esm()`, so the\n // target beneath the namespace stays extensible. That is what lets the\n // `ownKeys` and `getOwnPropertyDescriptor` traps legally report keys that\n // exist on `reexportedObjects` but not on the target itself.\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n const obj = reexportOwning(prop)\n return obj && Reflect.get(obj, prop)\n },\n // The namespace is read-only, like a real esm namespace object. The\n // re-exported modules can still mutate their own exports (exposed live\n // via `get`), but mutating the namespace itself is rejected. Refusing\n // here, rather than forwarding to the extensible target, also prevents an\n // assignment/definition from shadowing a dynamic re-export. It also\n // prevents delete from removing a static export.\n set() {\n return false\n },\n defineProperty() {\n return false\n },\n deleteProperty() {\n return false\n },\n // The `has` trap ensures that `'exportName' in starImports` will reflect\n // the truth of whether a key is exported.\n has(target, prop) {\n if (Reflect.has(target, prop)) return true\n if (prop === 'default' || prop === '__esModule') return false\n return reexportOwning(prop) !== undefined\n },\n // ownKeys and getOwnPropertyDescriptor together make the keys enumerable.\n // If a value is returned from `ownKeys` but its property descriptor is\n // not enumerable, it will not be visible to iterator methods.\n // Collectively, they allow code like the following:\n //\n // ```\n // // module.js re-exports dynamic CJS exports\n // export * from './legacyModule.cjs'\n //\n // // from another JS file, reference the re-exported dynamic values\n // import * as Namespace from './module.js'\n // Object.keys(Namespace)\n // ```\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n getOwnPropertyDescriptor(target, prop) {\n const own = Reflect.getOwnPropertyDescriptor(target, prop)\n if (own || prop === 'default' || prop === '__esModule') return own\n const obj = reexportOwning(prop)\n if (obj) {\n // Synthetic keys don't exist on the target, so they MUST be\n // reported as configurable. However the set/delete traps above will\n // prevent them from actually being changed\n return {\n enumerable: true,\n configurable: true,\n get: () => Reflect.get(obj, prop),\n }\n }\n return undefined\n },\n })\n }\n return reexportedObjects\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n this: TurbopackBaseContext,\n object: Record,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Exports\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n const reexportedObjects = ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n reexportedObjects.push(object)\n }\n}\ncontextPrototype.j = dynamicExport\n\nfunction exportValue(\n this: TurbopackBaseContext,\n value: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = value\n}\ncontextPrototype.v = exportValue\n\nfunction exportNamespace(\n this: TurbopackBaseContext,\n namespace: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = module.namespaceObject = namespace\n}\ncontextPrototype.n = exportNamespace\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const bindings: EsmBindings = []\n let defaultLocation = -1\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n bindings.push(key, createGetter(raw, key))\n if (defaultLocation === -1 && key === 'default') {\n defaultLocation = bindings.length - 1\n }\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && defaultLocation >= 0)) {\n // Replace the binding with one for the namespace itself in order to preserve iteration order.\n if (defaultLocation >= 0) {\n // Replace the getter with the value\n bindings.splice(defaultLocation, 1, BindingTag_Value, raw)\n } else {\n bindings.push('default', BindingTag_Value, raw)\n }\n }\n\n esm(ns, bindings)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, this.m)\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\ncontextPrototype.i = esmImport\n\nfunction asyncLoader(\n this: TurbopackBaseContext,\n moduleId: ModuleId\n): Promise {\n const loader = this.r(moduleId) as (\n importFunction: EsmImport\n ) => Promise\n return loader(esmImport.bind(this))\n}\ncontextPrototype.A = asyncLoader\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\ncontextPrototype.t = runtimeRequire\n\nfunction commonJsRequire(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exports {\n return getOrInstantiateModuleFromParent(id, this.m).exports\n}\ncontextPrototype.r = commonJsRequire\n\n/**\n * Remove fragments and query parameters since they are never part of the context map keys\n *\n * This matches how we parse patterns at resolving time. Arguably we should only do this for\n * strings passed to `import` but the resolve does it for `import` and `require` and so we do\n * here as well.\n */\nfunction parseRequest(request: string): string {\n // Per the URI spec fragments can contain `?` characters, so we should trim it off first\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.5\n const hashIndex = request.indexOf('#')\n if (hashIndex !== -1) {\n request = request.substring(0, hashIndex)\n }\n\n const queryIndex = request.indexOf('?')\n if (queryIndex !== -1) {\n request = request.substring(0, queryIndex)\n }\n\n return request\n}\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: string): Exports {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): string[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: string): ModuleId => {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: string) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\ncontextPrototype.f = moduleContext\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\n// Load the CompressedModuleFactories of a chunk into the `moduleFactories` Map.\n// The flat format alternates one or more module IDs with their factory function.\n// Strict factories can be prepended as a nested array.\nfunction installCompressedModuleFactories(\n chunkModules: CompressedModuleFactories,\n offset: number,\n moduleFactories: ModuleFactories,\n newModuleId?: (id: ModuleId) => void\n) {\n let i = offset\n const strictFactories = chunkModules[i]\n if (Array.isArray(strictFactories)) {\n installCompressedModuleFactories(\n strictFactories,\n 0,\n moduleFactories,\n newModuleId\n )\n i++\n }\n while (i < chunkModules.length) {\n let end = i + 1\n // Find our factory function\n while (\n end < chunkModules.length &&\n typeof chunkModules[end] !== 'function'\n ) {\n end++\n }\n if (end === chunkModules.length) {\n throw new Error('malformed chunk format, expected a factory function')\n }\n\n // Install the factory for each module ID that doesn't already have one.\n // When some IDs in this group already have a factory, reuse that existing\n // group factory for the missing IDs to keep all IDs in the group consistent.\n // Otherwise, install the factory from this chunk.\n const moduleFactoryFn = chunkModules[end] as Function\n let existingGroupFactory: Function | undefined = undefined\n for (let j = i; j < end; j++) {\n const id = chunkModules[j] as ModuleId\n const existingFactory = moduleFactories.get(id)\n if (existingFactory) {\n existingGroupFactory = existingFactory\n break\n }\n }\n const factoryToInstall = existingGroupFactory ?? moduleFactoryFn\n\n let didInstallFactory = false\n for (let j = i; j < end; j++) {\n const id = chunkModules[j] as ModuleId\n if (!moduleFactories.has(id)) {\n if (!didInstallFactory) {\n if (factoryToInstall === moduleFactoryFn) {\n applyModuleFactoryName(moduleFactoryFn)\n }\n didInstallFactory = true\n }\n moduleFactories.set(id, factoryToInstall)\n newModuleId?.(id)\n }\n }\n i = end + 1\n }\n}\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\nrelativeURL.prototype = URL.prototype\ncontextPrototype.U = relativeURL\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * Constructs an error message for when a module factory is not available.\n */\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\ncontextPrototype.z = requireStub\n\n// Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.\ncontextPrototype.g = globalThis\n\nlet cachedAutomaticPublicPath: string | undefined\n\nfunction getAutomaticPublicPath(): string {\n if (cachedAutomaticPublicPath !== undefined) {\n return cachedAutomaticPublicPath\n }\n\n let scriptUrl: string | undefined\n if (typeof document === 'object') {\n const currentScript = document.currentScript as HTMLScriptElement | null\n scriptUrl = currentScript?.src\n\n if (!scriptUrl) {\n const scripts = document.getElementsByTagName('script')\n const script = scripts[scripts.length - 1]\n scriptUrl = script?.src\n }\n }\n\n if (\n !scriptUrl &&\n typeof (globalThis as any).importScripts === 'function' &&\n (globalThis as any).location\n ) {\n scriptUrl = String((globalThis as any).location)\n }\n\n cachedAutomaticPublicPath = scriptUrl\n ? scriptUrl\n .replace(/^blob:/, '')\n .replace(/#.*$/, '')\n .replace(/\\?.*$/, '')\n .replace(/\\/[^/]*$/, '/')\n : ''\n\n return cachedAutomaticPublicPath\n}\n\n/**\n * Gets the public path for runtime assets.\n * Checks globalThis.publicPath and falls back to \"/\".\n */\nfunction getPublicPath(mode?: 'auto'): string {\n if (mode === 'auto') {\n return getAutomaticPublicPath()\n }\n\n if (\n typeof globalThis !== 'undefined' &&\n typeof (globalThis as any).publicPath === 'string'\n ) {\n const publicPath = (globalThis as any).publicPath as string\n return publicPath.endsWith('/') ? publicPath : `${publicPath}/`\n }\n return '/'\n}\ncontextPrototype.p = getPublicPath\n\ntype ContextConstructor = {\n new (module: Module, exports: Exports): TurbopackBaseContext\n}\n\nfunction applyModuleFactoryName(factory: Function) {\n // Give the module factory a nice name to improve stack traces.\n Object.defineProperty(factory, 'name', {\n value: 'module evaluation',\n })\n}\n"],"names":["SourceType","createModuleWithDirectionFlag","REEXPORTED_OBJECTS","WeakMap","Context","module","exports","m","e","contextPrototype","prototype","hasOwnProperty","Object","toStringTag","Symbol","defineProp","obj","name","options","call","defineProperty","getOverwrittenModule","moduleCache","id","createModuleWithDirection","createModuleObject","error","undefined","namespaceObject","parents","children","BindingTag_Value","esm","bindings","dynamic","value","i","length","propName","tagOrFunction","enumerable","writable","Error","getterFn","setterFn","get","set","seal","esmExport","c","s","ensureDynamicExports","reexportedObjects","reexportOwning","prop","Proxy","target","Reflect","deleteProperty","has","ownKeys","keys","key","includes","push","getOwnPropertyDescriptor","own","configurable","dynamicExport","object","j","exportValue","v","exportNamespace","namespace","n","createGetter","getProto","getPrototypeOf","__proto__","LEAF_PROTOTYPES","interopEsm","raw","ns","allowExportDefault","defaultLocation","current","getOwnPropertyNames","splice","createNS","args","apply","create","esmImport","getOrInstantiateModuleFromParent","__esModule","asyncLoader","moduleId","loader","r","bind","A","runtimeRequire","require","require1","t","commonJsRequire","parseRequest","request","hashIndex","indexOf","substring","queryIndex","moduleContext","map","code","resolve","import","f","getChunkPath","chunkData","path","installCompressedModuleFactories","chunkModules","offset","moduleFactories","newModuleId","strictFactories","Array","isArray","end","moduleFactoryFn","existingGroupFactory","existingFactory","factoryToInstall","didInstallFactory","applyModuleFactoryName","relativeURL","inputUrl","realUrl","URL","values","href","pathname","replace","origin","protocol","toString","toJSON","_args","U","invariant","never","computeMessage","factoryNotAvailableMessage","sourceType","sourceData","instantiationReason","requireStub","_moduleId","z","g","globalThis","cachedAutomaticPublicPath","getAutomaticPublicPath","scriptUrl","document","currentScript","src","scripts","getElementsByTagName","script","importScripts","location","String","getPublicPath","mode","publicPath","endsWith","p","factory"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,0CAA0C;AAI1C;;;CAGC,GACD,IAAA,AAAKA,oCAAAA;IACH;;;;GAIC,sCACS;IACV;;;GAGC,qCACQ;IACT;;;;GAIC,qCACQ;WAjBNA;EAAAA;AA4BL;;;;;CAKC,GACD,IAAIC,gCAAgC;AAEpC,MAAMC,qBAAqB,IAAIC;AAE/B;;CAEC,GACD,SAASC,QAEPC,MAAc,EACdC,OAAgB;IAEhB,IAAI,CAACC,CAAC,GAAGF;IACT,gF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0]}},
- {"offset": {"line": 585, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime/async-module.ts"],"sourcesContent":["/// \n/// \n\n/**\n * Top-level-await / async-module machinery. This is only included in the runtime\n * when the module graph actually contains an async module (a module with\n * top-level await, or one that transitively depends on one). When no async\n * module is present, the chunk items never reference `__turbopack_context__.a`,\n * so this whole file can be omitted.\n *\n * everything below is adapted from webpack\n * https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n */\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n this: TurbopackBaseContext,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const module = this.m\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\ncontextPrototype.a = asyncModule\n"],"names":["turbopackQueues","Symbol","turbopackExports","turbopackError","isPromise","maybePromise","then","isAsyncModuleExt","obj","createPromise","resolve","reject","promise","Promise","res","rej","resolveQueue","queue","status","forEach","fn","queueCount","wrapDeps","deps","map","dep","Object","assign","err","asyncModule","body","hasAwait","module","m","undefined","depQueues","Set","rawPromise","exports","attributes","get","set","v","defineProperty","handleAsyncDependencies","currentDeps","getResult","d","fnQueue","q","has","add","push","asyncResult","contextPrototype","a"],"mappings":"AAAA,6CAA6C;AAC7C,2CAA2C;AAE3C;;;;;;;;;CASC,GAED,MAAMA,kBAAkBC,OAAO;AAC/B,MAAMC,mBAAmBD,OAAO;AAChC,MAAME,iBAAiBF,OAAO;AAuB9B,SAASG,UAAmBC,YAAiB;IAC3C,OACEA,gBAAgB,QAChB,OAAOA,iBAAiB,YACxB,UAAUA,gBACV,OAAOA,aAAaC,IAAI,KAAK;AAEjC;AAEA,SAASC,iBAA+BC,GAAM;IAC5C,OAAOR,mBAAmBQ;AAC5B;AAEA,SAASC;IACP,IAAIC;IACJ,IAAIC;IAEJ,MAAMC,UAAU,IAAIC,QAAW,CAACC,KAAKC;QACnCJ,SAASI;QACTL,UAAUI;IACZ;IAEA,OAAO;QACLF;QACAF,SAASA;QACTC,QAAQA;IACV;AAC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QACpC,OAAO;YACLlB,QAAQE,OAAO,CAACV,iBAAiB;QACnC;QAEAc,aAAaC;IACf;IAEAa,KAAKc,yBAAyBS;IAE9B,IAAIpC,SAASA,MAAMC,MAAM,SAA0B;QACjDD,MAAMC,MAAM,GAlLD;IAmLb;AACF;AACAoC,iBAAiBC,CAAC,GAAG1B","ignoreList":[0]}},
- {"offset": {"line": 717, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_ASSET_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it\n// can't be detected via `document.currentScript`. Note it's stored in reversed\n// order to use `push` and `pop`\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n// Used in WebWorkers to override the regular chunk base path with the base\n// used for the worker entrypoint and its initial chunks.\ndeclare var TURBOPACK_CHUNK_BASE_PATH: string | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var ASSET_SUFFIX: string\ndeclare var CROSS_ORIGIN: 'anonymous' | 'use-credentials' | null\ndeclare var CHUNK_LOAD_RETRY_MAX_ATTEMPTS: number\ndeclare var CHUNK_LOAD_RETRY_BASE_DELAY_MS: number\ndeclare var CHUNK_LOAD_RETRY_MAX_JITTER_MS: number\ndeclare const SUPPORT_COMPONENT_CHUNKS: boolean\n\n// Support runtime public path modes.\nfunction getRuntimeChunkBasePath(basePath: string = CHUNK_BASE_PATH): string {\n if (basePath === '__RUNTIME_PUBLIC_PATH__') {\n return contextPrototype.p()\n }\n if (basePath === '__AUTO_PUBLIC_PATH__') {\n return contextPrototype.p('auto')\n }\n return basePath\n}\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\nconst RUNTIME_CHUNK_BASE_PATH =\n typeof TURBOPACK_CHUNK_BASE_PATH === 'string'\n ? TURBOPACK_CHUNK_BASE_PATH\n : CHUNK_BASE_PATH\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistrationChunk =\n | ChunkPath\n | { getAttribute: (name: string) => string | null }\n | undefined\n\ntype ChunkRegistration = [\n chunkPath: ChunkRegistrationChunk,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkRegistrationChunk\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\ninterface RuntimeBackend {\n /**\n * Registers a chunk. `chunk` is `undefined` for an inlined entry-only registration\n * (no source chunk): the params' other chunks are loaded and its runtime modules run\n * with no self chunk identity.\n */\n registerChunk: (\n chunk: ChunkPath | ChunkScript | undefined,\n params?: RuntimeParams\n ) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\n// Registry mapping a merged chunk's path to its constituent component chunk paths.\nconst chunkComponents: Map = new Map()\n\n// Registry mapping a component chunk's path to its size in bytes, used by the\n// split-vs-whole cost heuristic.\nconst componentChunkSizes: Map = new Map()\n\nfunction registerComponentChunkSizes(\n componentChunks: ChunkPath[],\n sizes: number[]\n): void {\n for (let i = 0; i < componentChunks.length; i++) {\n const size = sizes[i]\n if (size !== undefined) {\n componentChunkSizes.set(componentChunks[i], size)\n }\n }\n}\n\ntype ChunkUrlOrMerged = ChunkUrl | [ChunkUrl, ChunkPath[], number[]]\n\n// Memoizes the composite promise returned for a merged chunk loaded by URL, keyed by URL.\nconst splitChunkPromises: Map> = new Map()\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\n// `chunkPath` is the source chunk; it is `undefined` for entry-only registrations,\n// which have no self chunk.\nfunction loadInitialChunk(\n chunkPath: ChunkPath | undefined,\n chunkData: ChunkData\n) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n let promise: Promise\n if (SUPPORT_COMPONENT_CHUNKS) {\n const componentChunks = chunkData.moduleChunks || []\n // We already have this chunk's component list inline (chunkData.moduleChunks) and split on it\n // here, so the whole-chunk fallback uses loadChunkByUrlWhole to skip loadChunkByUrlInternal's\n // chunkComponents-registry lookup, which would just repeat the same split decision.\n promise = loadComponentChunksOrWhole(\n sourceType,\n sourceData,\n componentChunks,\n getChunkRelativeUrl(chunkData.path)\n )\n } else {\n promise = loadChunkByUrlWhole(\n sourceType,\n sourceData,\n getChunkRelativeUrl(chunkData.path)\n )\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\n/**\n * Approximate cost of an extra HTTP request, expressed in emitted (minified, uncompressed) chunk\n * bytes, used to decide whether splitting a merged chunk into individually-cached component\n * chunks is worthwhile.\n */\nconst REQUEST_COST_BYTES = 20_000\n\n/**\n * Decides whether to load a merged chunk's component chunks individually instead of the whole\n * merged chunk, weighing the bytes saved (the available components we avoid re-downloading)\n * against the extra network requests splitting incurs.\n *\n * Splitting issues one request per unavailable component vs. a single request for the merged\n * chunk, so it adds `unavailableCount - 1` extra requests. When at most one component needs the\n * network, splitting never costs more requests than the merged load (and transfers fewer bytes),\n * so it always wins. Otherwise it's only worth it when the available bytes exceed the extra\n * request cost.\n */\nfunction shouldLoadComponentChunks(\n availableBytes: number,\n unavailableCount: number\n): boolean {\n if (unavailableCount <= 1) {\n return true\n }\n return availableBytes > REQUEST_COST_BYTES * (unavailableCount - 1)\n}\n\n/**\n * Loads a chunk's component chunks individually when enough of them are already available\n * in memory (avoiding re-downloading the ones we have, per `shouldLoadComponentChunks`),\n * otherwise loads the whole chunk from `chunkUrl` and records its component chunks as available.\n */\nfunction loadComponentChunksOrWhole(\n sourceType: SourceType,\n sourceData: SourceData,\n componentChunks: ChunkPath[],\n chunkUrl: ChunkUrl\n): Promise {\n const componentChunkPromises: Array | true> = []\n let availableBytes = 0\n let unavailableCount = 0\n for (const componentChunk of componentChunks) {\n const available = availableModuleChunks.get(componentChunk)\n if (available) {\n componentChunkPromises.push(available)\n availableBytes += componentChunkSizes.get(componentChunk) ?? 0\n } else {\n unavailableCount++\n }\n }\n\n if (\n componentChunkPromises.length > 0 &&\n shouldLoadComponentChunks(availableBytes, unavailableCount)\n ) {\n // Enough component chunks are already loaded or loading that splitting saves more\n // bytes than the extra requests cost.\n for (const componentChunk of componentChunks) {\n if (!availableModuleChunks.has(componentChunk)) {\n const promise = loadChunkPath(sourceType, sourceData, componentChunk)\n availableModuleChunks.set(componentChunk, promise)\n componentChunkPromises.push(promise)\n }\n }\n return Promise.all(componentChunkPromises)\n }\n\n // Not enough is available in memory for splitting to pay off. Load the\n // whole chunk in a single request and record its component chunks as available.\n const promise = loadChunkByUrlWhole(sourceType, sourceData, chunkUrl)\n for (const componentChunk of componentChunks) {\n if (!availableModuleChunks.has(componentChunk)) {\n availableModuleChunks.set(componentChunk, promise)\n }\n }\n return promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkEntry: ChunkUrlOrMerged\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkEntry)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\nconst loadedScripts = new Map>()\n\n/**\n * Load an external script by creating a