Unverified Commit 6204bf03 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

Turbopack: preserve chunk load promise identity (#100421)

## Summary

#98836 added an on-demand `__turbopack_ensure_chunk__` hook to the
Turbopack Node dev runtime by overriding `__turbopack_context__.l`. The
override returned `ensured.then(() => loadChunkAsync(...))`, so every
call that hit a not-yet-cached chunk produced a **new promise**, and the
first caller's promise never matched the one later callers got from
`chunkCache`. That broke referential identity for `__next_chunk_load__`
(which wraps `.l`), which React relies on. It also created extra
promises for React's dev async tracking to process.

This change makes `loadChunkAsync` itself aware of
`__turbopack_ensure_chunk__`:

- The hook is called synchronously on a cache miss. If it returns
`undefined` (nothing to compile), the chunk is required synchronously
and the shared pre-resolved promise is cached, exactly as without the
hook.
- If it returns a promise (the chunk is being compiled on demand), a
single `ensure → require/install` promise is cached in `chunkCache`
immediately. Concurrent and later callers all get the same promise until
`clearChunkCache()`.
- If ensuring the chunk fails (a synchronous throw or an async
rejection), the failure is not cached, so the next load retries.
`require` failures stay cached as `ChunkLoadError`, as before.
- The separate `.l` override and `chunksBeingEnsured` map in
`dev-base.ts` are removed. The Node runtime snapshots are regenerated.

On the Next.js side, the dev hook is now a plain function. It returns
synchronously for chunks that aren't lazy-compilation chunks, or that
have no matching entries, and returns a promise only when it actually
activates a lazy chunk.

## Verification

- `pnpm test-dev-turbo
test/development/app-dir/lazy-dynamic-imports/lazy-dynamic-imports.test.ts`
(12/12 pass)
- A scratch Node script against the generated dev and build runtimes,
with a mocked ensure hook. It checks:
- async ensure: same promise for concurrent and post-settle calls,
ensure called once, modules installed only after ensure, and eviction
plus retry after an ensure failure
- sync ensure: modules installed synchronously with the shared resolved
promise, and no caching after a synchronous throw
  - cached `ChunkLoadError`, non-JS chunks, and `clearChunkCache` reset

The identity and sync-path checks fail on the previous runtime and pass
with this change.

<!-- NEXT_JS_LLM -->


<!-- fleet a53f5f3f-06ac-4812-a068-facaf3b95fe5 -->

---------
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
parent a0e452b9
......@@ -2394,11 +2394,18 @@ export async function createHotReloaderTurbopack(
if (lazyDynamicImportsSSR) {
const previousEnsureChunk = globalThis.__turbopack_ensure_chunk__
const ensureChunk = async (chunkPath: string) => {
// Synchronous when there is nothing to compile, so the runtime can load
// the chunk without creating a new promise for it.
const ensureChunk = (chunkPath: string): void | Promise<void> => {
if (!chunkPath.includes('lazy-compilation-')) return
const keys = serverAssetMapper.getKeysByAsset(chunkPath)
if (keys.length === 0 || !(await project.activateLazyChunk(chunkPath))) {
if (keys.length === 0) return
return activateLazyChunk(chunkPath, keys)
}
const activateLazyChunk = async (chunkPath: string, keys: EntryKey[]) => {
if (!(await project.activateLazyChunk(chunkPath))) {
return
}
......
......@@ -32,31 +32,6 @@ nodeDevContextPrototype.c = moduleCache
nodeDevContextPrototype.R = resolvePathFromModule
nodeDevContextPrototype.C = clearChunkCache
if (globalThis.__turbopack_ensure_chunk__ !== undefined) {
const chunksBeingEnsured = new Map<ChunkPath, Promise<void>>()
function loadChunkAsyncOnDemand<TModule extends Module>(
this: TurbopackBaseContext<TModule>,
chunkData: ChunkData
): Promise<void> {
const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path
const ensureChunk = globalThis.__turbopack_ensure_chunk__
if (ensureChunk === undefined || chunkCache.has(chunkPath)) {
return loadChunkAsync.call(this, chunkData)
}
const ensured =
chunksBeingEnsured.get(chunkPath) ??
Promise.resolve()
.then(() => ensureChunk(chunkPath))
.finally(() => chunksBeingEnsured.delete(chunkPath))
chunksBeingEnsured.set(chunkPath, ensured)
return ensured.then(() => loadChunkAsync.call(this, chunkData))
}
nodeDevContextPrototype.l = loadChunkAsyncOnDemand
}
markDevModulesLoaded = true
function interceptDevModuleExecution(
......
......@@ -108,27 +108,67 @@ function loadChunkAsync<TModule extends Module>(
let entry = chunkCache.get(chunkPath)
if (entry === undefined) {
try {
// resolve to an absolute path to simplify `require` handling
const resolved = path.resolve(RUNTIME_ROOT, chunkPath)
// TODO: consider switching to `import()` to enable concurrent chunk loading and async file io
// However this is incompatible with hot reloading (since `import` doesn't use the require cache)
const chunkModules: CompressedModuleFactories = require(resolved)
installCompressedModuleFactories(chunkModules, 0)
entry = loadedChunk
} catch (cause) {
const errorMessage = `Failed to load chunk ${chunkPath} from module ${this.m.id}`
const error = new Error(errorMessage, { cause })
error.name = 'ChunkLoadError'
// Cache the failure promise, future requests will also get this same rejection
entry = Promise.reject(error)
const sourceModuleId = this.m.id
// `ensureChunk` is conditionally installed to support lazy dynamic imports during SSR
// It can be used to call back into turbopack to compile the chunk we are about to reference.
const ensureChunk = globalThis.__turbopack_ensure_chunk__
let ensuring: void | Promise<void> = undefined
if (ensureChunk !== undefined) {
try {
// Returns `undefined` when the chunk can be required right away.
ensuring = ensureChunk(chunkPath)
} catch (error) {
// Don't cache a failure to compile the chunk, so that the next load
// retries it.
return Promise.reject(error)
}
}
if (ensuring === undefined) {
entry = requireChunk(chunkPath, sourceModuleId)
} else {
// The chunk is being compiled on demand before it can be required.
// Cache the combined promise right away so that every caller (including
// concurrent ones) gets the same promise for this chunk.
const ensured: Promise<void> = Promise.resolve(ensuring).then(
() => requireChunk(chunkPath, sourceModuleId),
(error) => {
// Don't cache a failure to compile the chunk, so that the next load
// retries it.
if (chunkCache.get(chunkPath) === ensured) {
chunkCache.delete(chunkPath)
}
throw error
}
)
entry = ensured
}
chunkCache.set(chunkPath, entry)
}
// TODO: Return an instrumented Promise that React can use instead of relying on referential equality.
return entry
}
function requireChunk(
chunkPath: ChunkPath,
sourceModuleId: ModuleId
): Promise<void> {
try {
// resolve to an absolute path to simplify `require` handling
const resolved = path.resolve(RUNTIME_ROOT, chunkPath)
// TODO: consider switching to `import()` to enable concurrent chunk loading and async file io
// However this is incompatible with hot reloading (since `import` doesn't use the require cache)
const chunkModules: CompressedModuleFactories = require(resolved)
installCompressedModuleFactories(chunkModules, 0)
return loadedChunk
} catch (cause) {
const errorMessage = `Failed to load chunk ${chunkPath} from module ${sourceModuleId}`
const error = new Error(errorMessage, { cause })
error.name = 'ChunkLoadError'
// Cache the failure promise, future requests will also get this same rejection
return Promise.reject(error)
}
}
contextPrototype.l = loadChunkAsync
function loadChunkAsyncByUrl<TModule extends Module>(
......
......@@ -818,28 +818,61 @@ function loadChunkAsync(chunkData) {
}
let entry = chunkCache.get(chunkPath);
if (entry === undefined) {
try {
// resolve to an absolute path to simplify `require` handling
const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
// TODO: consider switching to `import()` to enable concurrent chunk loading and async file io
// However this is incompatible with hot reloading (since `import` doesn't use the require cache)
const chunkModules = require(resolved);
installCompressedModuleFactories(chunkModules, 0);
entry = loadedChunk;
} catch (cause) {
const errorMessage = `Failed to load chunk ${chunkPath} from module ${this.m.id}`;
const error = new Error(errorMessage, {
cause
const sourceModuleId = this.m.id;
// `ensureChunk` is conditionally installed to support lazy dynamic imports during SSR
// It can be used to call back into turbopack to compile the chunk we are about to reference.
const ensureChunk = globalThis.__turbopack_ensure_chunk__;
let ensuring = undefined;
if (ensureChunk !== undefined) {
try {
// Returns `undefined` when the chunk can be required right away.
ensuring = ensureChunk(chunkPath);
} catch (error) {
// Don't cache a failure to compile the chunk, so that the next load
// retries it.
return Promise.reject(error);
}
}
if (ensuring === undefined) {
entry = requireChunk(chunkPath, sourceModuleId);
} else {
// The chunk is being compiled on demand before it can be required.
// Cache the combined promise right away so that every caller (including
// concurrent ones) gets the same promise for this chunk.
const ensured = Promise.resolve(ensuring).then(()=>requireChunk(chunkPath, sourceModuleId), (error)=>{
// Don't cache a failure to compile the chunk, so that the next load
// retries it.
if (chunkCache.get(chunkPath) === ensured) {
chunkCache.delete(chunkPath);
}
throw error;
});
error.name = 'ChunkLoadError';
// Cache the failure promise, future requests will also get this same rejection
entry = Promise.reject(error);
entry = ensured;
}
chunkCache.set(chunkPath, entry);
}
// TODO: Return an instrumented Promise that React can use instead of relying on referential equality.
return entry;
}
function requireChunk(chunkPath, sourceModuleId) {
try {
// resolve to an absolute path to simplify `require` handling
const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
// TODO: consider switching to `import()` to enable concurrent chunk loading and async file io
// However this is incompatible with hot reloading (since `import` doesn't use the require cache)
const chunkModules = require(resolved);
installCompressedModuleFactories(chunkModules, 0);
return loadedChunk;
} catch (cause) {
const errorMessage = `Failed to load chunk ${chunkPath} from module ${sourceModuleId}`;
const error = new Error(errorMessage, {
cause
});
error.name = 'ChunkLoadError';
// Cache the failure promise, future requests will also get this same rejection
return Promise.reject(error);
}
}
contextPrototype.l = loadChunkAsync;
function loadChunkAsyncByUrl(chunkUrl) {
const path1 = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT));
......@@ -1580,20 +1613,6 @@ nodeDevContextPrototype.q = exportUrl;
nodeDevContextPrototype.c = moduleCache;
nodeDevContextPrototype.R = resolvePathFromModule;
nodeDevContextPrototype.C = clearChunkCache;
if (globalThis.__turbopack_ensure_chunk__ !== undefined) {
const chunksBeingEnsured = new Map();
function loadChunkAsyncOnDemand(chunkData) {
const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path;
const ensureChunk = globalThis.__turbopack_ensure_chunk__;
if (ensureChunk === undefined || chunkCache.has(chunkPath)) {
return loadChunkAsync.call(this, chunkData);
}
const ensured = chunksBeingEnsured.get(chunkPath) ?? Promise.resolve().then(()=>ensureChunk(chunkPath)).finally(()=>chunksBeingEnsured.delete(chunkPath));
chunksBeingEnsured.set(chunkPath, ensured);
return ensured.then(()=>loadChunkAsync.call(this, chunkData));
}
nodeDevContextPrototype.l = loadChunkAsyncOnDemand;
}
markDevModulesLoaded = true;
function interceptDevModuleExecution(_module) {
// There are no react refresh hooks server side so this is a no-op
......
......@@ -818,28 +818,61 @@ function loadChunkAsync(chunkData) {
}
let entry = chunkCache.get(chunkPath);
if (entry === undefined) {
try {
// resolve to an absolute path to simplify `require` handling
const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
// TODO: consider switching to `import()` to enable concurrent chunk loading and async file io
// However this is incompatible with hot reloading (since `import` doesn't use the require cache)
const chunkModules = require(resolved);
installCompressedModuleFactories(chunkModules, 0);
entry = loadedChunk;
} catch (cause) {
const errorMessage = `Failed to load chunk ${chunkPath} from module ${this.m.id}`;
const error = new Error(errorMessage, {
cause
const sourceModuleId = this.m.id;
// `ensureChunk` is conditionally installed to support lazy dynamic imports during SSR
// It can be used to call back into turbopack to compile the chunk we are about to reference.
const ensureChunk = globalThis.__turbopack_ensure_chunk__;
let ensuring = undefined;
if (ensureChunk !== undefined) {
try {
// Returns `undefined` when the chunk can be required right away.
ensuring = ensureChunk(chunkPath);
} catch (error) {
// Don't cache a failure to compile the chunk, so that the next load
// retries it.
return Promise.reject(error);
}
}
if (ensuring === undefined) {
entry = requireChunk(chunkPath, sourceModuleId);
} else {
// The chunk is being compiled on demand before it can be required.
// Cache the combined promise right away so that every caller (including
// concurrent ones) gets the same promise for this chunk.
const ensured = Promise.resolve(ensuring).then(()=>requireChunk(chunkPath, sourceModuleId), (error)=>{
// Don't cache a failure to compile the chunk, so that the next load
// retries it.
if (chunkCache.get(chunkPath) === ensured) {
chunkCache.delete(chunkPath);
}
throw error;
});
error.name = 'ChunkLoadError';
// Cache the failure promise, future requests will also get this same rejection
entry = Promise.reject(error);
entry = ensured;
}
chunkCache.set(chunkPath, entry);
}
// TODO: Return an instrumented Promise that React can use instead of relying on referential equality.
return entry;
}
function requireChunk(chunkPath, sourceModuleId) {
try {
// resolve to an absolute path to simplify `require` handling
const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
// TODO: consider switching to `import()` to enable concurrent chunk loading and async file io
// However this is incompatible with hot reloading (since `import` doesn't use the require cache)
const chunkModules = require(resolved);
installCompressedModuleFactories(chunkModules, 0);
return loadedChunk;
} catch (cause) {
const errorMessage = `Failed to load chunk ${chunkPath} from module ${sourceModuleId}`;
const error = new Error(errorMessage, {
cause
});
error.name = 'ChunkLoadError';
// Cache the failure promise, future requests will also get this same rejection
return Promise.reject(error);
}
}
contextPrototype.l = loadChunkAsync;
function loadChunkAsyncByUrl(chunkUrl) {
const path1 = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT));
......
......@@ -5,6 +5,6 @@
{"offset": {"line": 3, "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/// <reference path=\"./runtime-types.d.ts\" />\n/// <reference path=\"./async-module.ts\" />\n\ntype EsmNamespaceObject = Record<string, any>\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<M>(\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\n/**\n * Maps module IDs to the factory functions that instantiate them.\n */\nconst moduleFactories: ModuleFactories = new Map()\n\nconst REEXPORTED_OBJECTS = new WeakMap<Module, ReexportedObjects>()\n\n/**\n * Constructs the `__turbopack_context__` object for a module.\n */\nfunction Context(\n this: TurbopackBaseContext<Module>,\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<Module>\ncontextPrototype.M = moduleFactories\n\ntype ModuleContextMap = Record<ModuleId, ModuleContextEntry>\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<Exports | EsmNamespaceObject>\n\n keys(): ModuleId[]\n\n resolve(moduleId: string): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent<M extends Module> = (\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<any>\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\n/**\n * Returns the cached module for `id`, or `undefined` if it has not been\n * instantiated yet. Rethrows the error if the module's factory threw.\n */\nfunction getCachedModule<M extends Module>(\n moduleCache: ModuleCache<M>,\n id: ModuleId\n): M | undefined {\n const module = moduleCache.get(id)\n if (module?.error) {\n throw module.error\n }\n return module\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache<Module>,\n id: ModuleId\n): Module {\n let module = moduleCache.get(id)\n if (module === undefined) {\n if (createModuleWithDirectionFlag) {\n // set in development modes for hmr support\n module = createModuleWithDirection(id)\n } else {\n module = createModuleObject(id)\n }\n moduleCache.set(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 * Terminates a module's group of entries in an {@link EsmReexports} list.\n */\nconst REEXPORT_GROUP_END = 0\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<Module>,\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\n/**\n * Registers re-exports that all forward to properties of other modules.\n *\n * This is a compact spelling of the pattern\n *\n * ```js\n * var ns = context.i(moduleId)\n * context.s([exportName, () => ns[importedName], ...])\n * ```\n *\n * The list is a flat sequence of groups. Each group starts with the source the exports come from,\n * followed by that group's entries, and is terminated by the `0` sentinel (or the end of the list).\n *\n * The group head is either a **module id**, which is instantiated here:\n *\n * ```js\n * context.S([\n * 76061, 'default', 'f', 'named', 'A', 0,\n * 29842, 'otherModule', 'f',\n * ])\n * ```\n *\n * or the **namespace value** of a module that has already been imported, which is used directly:\n *\n * ```js\n * var ns1 = context.i(76061)\n * context.S([ns1, 'default', 'f', 'named', 'A'])\n * ```\n *\n * The producer picks the namespace form when it has generated the import anyway -- because some\n * later import must not be reordered past it -- so nothing is instantiated twice. The two are told\n * apart by type: a module id is always a string or number. A CommonJS function export produces a\n * callable namespace value, so namespace heads can be functions as well as objects.\n *\n * Entries are `exportName, importedName` pairs, except when a group holds exactly one string. That\n * string is then a comma-joined list of the same pairs, which saves the repeated quoting:\n *\n * ```js\n * context.S([\n * 76061, 'default,f,named,A', 0,\n * 29842, 'otherModule,f',\n * ])\n * ```\n *\n * The producer picks that spelling independently for each group whose names contain no commas,\n * since that group's names are recovered by splitting on them.\n *\n * Groups whose head is a module id are instantiated in list order, at the point where the call\n * appears, so the producer must not merge such a group across an import of another module. The\n * destination reuses a source data value or getter descriptor when one exists, falling back to a\n * wrapper getter for dynamic/proxy/inherited properties.\n *\n * `id` names the module the exports belong to when this module was merged into a scope-hoisting\n * group, exactly as it does for {@link EsmExport}.\n *\n * Only the source descriptor's payload (value or getter) is reused. {@link esm} still defines a\n * fresh enumerable, non-configurable destination property, and no source setter is ever forwarded.\n */\nfunction esmReexport(\n this: TurbopackBaseContext<Module>,\n list: EsmReexports,\n id?: ModuleId\n): void {\n const bindings: EsmBindings = []\n let i = 0\n while (i < list.length) {\n const head = list[i++]\n const start = i\n while (i < list.length && list[i] !== REEXPORT_GROUP_END) i++\n const end = i\n // Skip the sentinel, if this group was terminated by one rather than by the end of the list.\n i++\n\n // Module ids are always strings or numbers. Other values are already-imported namespaces;\n // notably, interop with a CommonJS function export produces a callable namespace function.\n // `esmImport` may return a promise for an async module, but re-exports of async modules keep\n // going through `context.s`, so the producer never routes them here and this stays synchronous.\n const namespace = (\n typeof head === 'string' || typeof head === 'number'\n ? esmImport.call(this, head)\n : head\n ) as Record<string, unknown>\n if (end - start === 1) {\n const pairs = (list[start] as string).split(',')\n for (let j = 0; j < pairs.length; j += 2) {\n appendReexportBinding(bindings, pairs[j], namespace, pairs[j + 1])\n }\n } else {\n for (let j = start; j < end; j += 2) {\n appendReexportBinding(\n bindings,\n list[j] as string,\n namespace,\n list[j + 1] as string\n )\n }\n }\n }\n esmExport.call(this, bindings, id)\n}\ncontextPrototype.S = esmReexport\n\nfunction appendReexportBinding(\n bindings: EsmBindings,\n exportedName: string,\n namespace: Record<string, unknown>,\n importedName: string\n): void {\n const descriptor = Reflect.getOwnPropertyDescriptor(namespace, importedName)\n if (descriptor) {\n if ('value' in descriptor) {\n // Code generation only routes immutable imported bindings through this helper, so a data\n // descriptor is a constant export and can be captured once.\n bindings.push(exportedName, BindingTag_Value, descriptor.value)\n return\n }\n if (descriptor.get) {\n // Accessors remain live by reusing the source getter. `esmReexport` is only called by\n // generated code: every group head is either produced by\n // `this.i` or is the namespace variable from a generated `this.i` call. Every getter on such\n // a namespace is receiver-independent: ESM bindings are compiler-generated arrow functions,\n // and the CommonJS/dynamic-namespace paths create arrows in `createGetter` and\n // `getOwnPropertyDescriptor`. The destination can therefore reuse the exact function instead\n // of allocating another wrapper getter.\n bindings.push(exportedName, descriptor.get)\n return\n }\n }\n\n // Dynamic/proxy/inherited CommonJS edge cases may not expose a usable own descriptor.\n bindings.push(exportedName, () => namespace[importedName])\n}\n\ntype ReexportedObjects = Record<PropertyKey, unknown>[]\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<Module>,\n object: Record<string, any>,\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<Module>,\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<Module>,\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<string | symbol, any>, 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<Module>,\n id: ModuleId\n): Exclude<Module['namespaceObject'], undefined> {\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<Module>,\n moduleId: ModuleId\n): Promise<Exports> {\n const loader = getOrInstantiateModuleFromParent(moduleId, this.m).exports as (\n importFunction: EsmImport\n ) => Promise<Exports>\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<Module>,\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<Exports>)\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 newModuleId?: (id: ModuleId) => void\n) {\n let i = offset\n const strictFactories = chunkModules[i]\n if (Array.isArray(strictFactories)) {\n installCompressedModuleFactories(strictFactories, 0, newModuleId)\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<string, any> = {}\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<any>) => 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 * Returns a `file://` URL under a synthetic directory named after `root`\n * (`ROOT` for the project root), for when the real filesystem path is unknown.\n * The root name and path segments are percent-encoded so the result is always\n * a valid file URI.\n */\nfunction placeholderFileUrl(modulePath: string, root?: string): string {\n return `file:///${encodeURIComponent(root ?? 'ROOT')}/${modulePath\n .split('/')\n .map(encodeURIComponent)\n .join('/')}`\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\ntype ContextConstructor<M> = {\n new (module: Module, exports: Exports): TurbopackBaseContext<M>\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","moduleFactories","Map","REEXPORTED_OBJECTS","WeakMap","Context","module","exports","m","e","contextPrototype","prototype","M","hasOwnProperty","Object","toStringTag","Symbol","defineProp","obj","name","options","call","defineProperty","getCachedModule","moduleCache","id","get","error","getOverwrittenModule","undefined","createModuleWithDirection","createModuleObject","set","namespaceObject","parents","children","BindingTag_Value","REEXPORT_GROUP_END","esm","bindings","dynamic","value","i","length","propName","tagOrFunction","enumerable","writable","Error","getterFn","setterFn","seal","esmExport","c","s","esmReexport","list","head","start","end","namespace","esmImport","pairs","split","j","appendReexportBinding","S","exportedName","importedName","descriptor","Reflect","getOwnPropertyDescriptor","push","ensureDynamicExports","reexportedObjects","reexportOwning","prop","Proxy","target","deleteProperty","has","ownKeys","keys","key","includes","own","configurable","dynamicExport","object","exportValue","v","exportNamespace","n","createGetter","getProto","getPrototypeOf","__proto__","LEAF_PROTOTYPES","interopEsm","raw","ns","allowExportDefault","defaultLocation","current","getOwnPropertyNames","splice","createNS","args","apply","create","getOrInstantiateModuleFromParent","__esModule","asyncLoader","moduleId","loader","bind","A","runtimeRequire","require","require1","t","commonJsRequire","r","parseRequest","request","hashIndex","indexOf","substring","queryIndex","moduleContext","map","code","resolve","import","f","getChunkPath","chunkData","path","installCompressedModuleFactories","chunkModules","offset","newModuleId","strictFactories","Array","isArray","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","placeholderFileUrl","modulePath","root","encodeURIComponent","join","requireStub","_moduleId","z","g","globalThis","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;;CAEC,GACD,MAAMC,kBAAmC,IAAIC;AAE7C,MAAMC,qBAAqB,IAAIC;AAE/B;;CAEC,GACD,SAASC,QAEPC,MAAc,EACdC,OAAgB;IAEhB,IAAI,CAACC,CAAC,GAAGF;IACT,gFAAgF;IAChF,yEAAyE;IACzE,+CAA+C;IAC/C,8EAA8E;IAC9E,sEAAsE;IACtE,iBAAiB;IACjB,4FAA4F;IAC5F,IAAI,CAACG,CAAC,GAAGF;AACX;AACA,MAAMG,mBAAmBL,QAAQM,SAAS;AAC1CD,iBAAiBE,CAAC,GAAGX;AA+BrB,MAAMY,iBAAiBC,OAAOH,SAAS,CAACE,cAAc;AACtD,MAAME,cAAc,OAAOC,WAAW,eAAeA,OAAOD,WAAW;AAEvE,SAASE,WACPC,GAAQ,EACRC,IAAiB,EACjBC,OAA2C;IAE3C,IAAI,CAACP,eAAeQ,IAAI,CAACH,KAAKC,OAAOL,OAAOQ,cAAc,CAACJ,KAAKC,MAAMC;AACxE;AAEA;;;CAGC,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,KAhzBO;YAizBLC,sBAAsB;YACtB;QACF;YACEN,UACEI,YACA,CAACA,aAAe,CAAC,qBAAqB,EAAEA,YAAY;IAE1D;IACA,OAAO,CAAC,OAAO,EAAExD,SAAS,kBAAkB,EAAE0D,oBAAoB,0CAA0C,CAAC;AAC/G;AAEA;;;;;CAKC,GACD,SAASC,mBAAmBC,UAAkB,EAAEC,IAAa;IAC3D,OAAO,CAAC,QAAQ,EAAEC,mBAAmBD,QAAQ,QAAQ,CAAC,EAAED,WACrD9G,KAAK,CAAC,KACNmE,GAAG,CAAC6C,oBACJC,IAAI,CAAC,MAAM;AAChB;AAEA;;CAEC,GACD,SAASC,YAAYC,SAAmB;IACtC,MAAM,IAAIlI,MAAM;AAClB;AACAtC,iBAAiByK,CAAC,GAAGF;AAErB,kGAAkG;AAClGvK,iBAAiB0K,CAAC,GAAGC;AAMrB,SAAS/B,uBAAuBgC,OAAiB;IAC/C,+DAA+D;IAC/DxK,OAAOQ,cAAc,CAACgK,SAAS,QAAQ;QACrC7I,OAAO;IACT;AACF","ignoreList":[0]}},
{"offset": {"line": 665, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/base-externals-utils.ts"],"sourcesContent":["/// <reference path=\"../shared/runtime/runtime-utils.ts\" />\n\n/// A 'base' utilities to support runtime can have externals.\n/// Currently this is for node.js / edge runtime both.\n/// If a fn requires node.js specific behavior, it should be placed in `node-external-utils` instead.\n\nasync function externalImport(id: DependencySpecifier) {\n let raw\n try {\n raw = await import(id)\n } catch (err) {\n // TODO(alexkirsz) This can happen when a client-side module tries to load\n // an external module we don't provide a shim for (e.g. querystring, url).\n // For now, we fail semi-silently, but in the future this should be a\n // compilation error.\n throw new Error(`Failed to load external module ${id}: ${err}`)\n }\n\n if (raw && raw.__esModule && raw.default && 'default' in raw.default) {\n return interopEsm(raw.default, createNS(raw), true)\n }\n\n return raw\n}\ncontextPrototype.y = externalImport\n\nfunction externalRequire(\n id: ModuleId,\n thunk: () => any,\n esm: boolean = false\n): Exports | EsmNamespaceObject {\n let raw\n try {\n raw = thunk()\n } catch (err) {\n // TODO(alexkirsz) This can happen when a client-side module tries to load\n // an external module we don't provide a shim for (e.g. querystring, url).\n // For now, we fail semi-silently, but in the future this should be a\n // compilation error.\n throw new Error(`Failed to load external module ${id}: ${err}`)\n }\n\n if (!esm || raw.__esModule) {\n return raw\n }\n\n return interopEsm(raw, createNS(raw), true)\n}\n\nexternalRequire.resolve = (\n id: string,\n options?: {\n paths?: string[]\n }\n) => {\n return require.resolve(id, options)\n}\ncontextPrototype.x = externalRequire\n"],"names":["externalImport","id","raw","err","Error","__esModule","default","interopEsm","createNS","contextPrototype","y","externalRequire","thunk","esm","resolve","options","require","x"],"mappings":"AAAA,2DAA2D;AAE3D,6DAA6D;AAC7D,sDAAsD;AACtD,qGAAqG;AAErG,eAAeA,eAAeC,EAAuB;IACnD,IAAIC;IACJ,IAAI;QACFA,MAAM,MAAM,MAAM,CAACD;IACrB,EAAE,OAAOE,KAAK;QACZ,0EAA0E;QAC1E,0EAA0E;QAC1E,qEAAqE;QACrE,qBAAqB;QACrB,MAAM,IAAIC,MAAM,CAAC,+BAA+B,EAAEH,GAAG,EAAE,EAAEE,KAAK;IAChE;IAEA,IAAID,OAAOA,IAAIG,UAAU,IAAIH,IAAII,OAAO,IAAI,aAAaJ,IAAII,OAAO,EAAE;QACpE,OAAOC,WAAWL,IAAII,OAAO,EAAEE,SAASN,MAAM;IAChD;IAEA,OAAOA;AACT;AACAO,iBAAiBC,CAAC,GAAGV;AAErB,SAASW,gBACPV,EAAY,EACZW,KAAgB,EAChBC,MAAe,KAAK;IAEpB,IAAIX;IACJ,IAAI;QACFA,MAAMU;IACR,EAAE,OAAOT,KAAK;QACZ,0EAA0E;QAC1E,0EAA0E;QAC1E,qEAAqE;QACrE,qBAAqB;QACrB,MAAM,IAAIC,MAAM,CAAC,+BAA+B,EAAEH,GAAG,EAAE,EAAEE,KAAK;IAChE;IAEA,IAAI,CAACU,OAAOX,IAAIG,UAAU,EAAE;QAC1B,OAAOH;IACT;IAEA,OAAOK,WAAWL,KAAKM,SAASN,MAAM;AACxC;AAEAS,gBAAgBG,OAAO,GAAG,CACxBb,IACAc;IAIA,OAAOC,QAAQF,OAAO,CAACb,IAAIc;AAC7B;AACAN,iBAAiBQ,CAAC,GAAGN","ignoreList":[0]}},
{"offset": {"line": 706, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/node-externals-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\ndeclare var RUNTIME_PUBLIC_PATH: string\ndeclare var RELATIVE_ROOT_PATH: string\ndeclare var ASSET_PREFIX: string\n\nconst path = require('path')\n\nconst relativePathToRuntimeRoot = path.relative(RUNTIME_PUBLIC_PATH, '.')\n// Compute the relative path to the `distDir`.\nconst relativePathToDistRoot = path.join(\n relativePathToRuntimeRoot,\n RELATIVE_ROOT_PATH\n)\nconst RUNTIME_ROOT = path.resolve(__filename, relativePathToRuntimeRoot)\n// Compute the absolute path to the root, by stripping distDir from the absolute path to this file.\nconst ABSOLUTE_ROOT = path.resolve(__filename, relativePathToDistRoot)\n\n/**\n * Returns an absolute path to the given module path.\n * Module path should be relative, either path to a file or a directory.\n *\n * This fn allows to calculate an absolute path for some global static values, such as\n * `__dirname` or `import.meta.url` that Turbopack will not embeds in compile time.\n * See ImportMetaBinding::code_generation for the usage.\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n if (modulePath) {\n return path.join(ABSOLUTE_ROOT, modulePath)\n }\n return ABSOLUTE_ROOT\n}\nContext.prototype.P = resolveAbsolutePath\n\n/**\n * Returns an absolute `file://` URL for the given module path, which is\n * relative to the project root or the named `root`.\n *\n * Uses `url.pathToFileURL` so that the resulting URL is a valid file URI on\n * all platforms (forward slashes on Windows, drive letters handled\n * correctly, path segments URL-encoded).\n *\n * The location of a named `root` isn't known at runtime (the output may have\n * been moved away from the sources), so this returns a placeholder URL for it.\n */\nfunction resolveFileUrl(modulePath: string, root?: string): string {\n if (root !== undefined) {\n return placeholderFileUrl(modulePath, root)\n }\n return require('url').pathToFileURL(resolveAbsolutePath(modulePath)).href\n}\nContext.prototype.F = resolveFileUrl\n"],"names":["path","require","relativePathToRuntimeRoot","relative","RUNTIME_PUBLIC_PATH","relativePathToDistRoot","join","RELATIVE_ROOT_PATH","RUNTIME_ROOT","resolve","__filename","ABSOLUTE_ROOT","resolveAbsolutePath","modulePath","Context","prototype","P","resolveFileUrl","root","undefined","placeholderFileUrl","pathToFileURL","href","F"],"mappings":"AAAA,oDAAoD,GAMpD,MAAMA,OAAOC,QAAQ;AAErB,MAAMC,4BAA4BF,KAAKG,QAAQ,CAACC,qBAAqB;AACrE,8CAA8C;AAC9C,MAAMC,yBAAyBL,KAAKM,IAAI,CACtCJ,2BACAK;AAEF,MAAMC,eAAeR,KAAKS,OAAO,CAACC,YAAYR;AAC9C,mGAAmG;AACnG,MAAMS,gBAAgBX,KAAKS,OAAO,CAACC,YAAYL;AAE/C;;;;;;;CAOC,GACD,SAASO,oBAAoBC,UAAmB;IAC9C,IAAIA,YAAY;QACd,OAAOb,KAAKM,IAAI,CAACK,eAAeE;IAClC;IACA,OAAOF;AACT;AACAG,QAAQC,SAAS,CAACC,CAAC,GAAGJ;AAEtB;;;;;;;;;;CAUC,GACD,SAASK,eAAeJ,UAAkB,EAAEK,IAAa;IACvD,IAAIA,SAASC,WAAW;QACtB,OAAOC,mBAAmBP,YAAYK;IACxC;IACA,OAAOjB,QAAQ,OAAOoB,aAAa,CAACT,oBAAoBC,aAAaS,IAAI;AAC3E;AACAR,QAAQC,SAAS,CAACQ,CAAC,GAAGN","ignoreList":[0]}},
{"offset": {"line": 744, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime/runtime-base.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"../../shared/runtime/runtime-utils.ts\" />\n/// <reference path=\"../../shared-node/base-externals-utils.ts\" />\n/// <reference path=\"../../shared-node/node-externals-utils.ts\" />\n/// <reference path=\"./nodejs-globals.d.ts\" />\n\n/**\n * Base Node.js runtime shared between production and development.\n * Contains chunk loading, module caching, and other non-HMR functionality.\n */\n\nprocess.env.TURBOPACK = '1'\n\nconst url = require('url') as typeof import('url')\n\n/**\n * Returns an absolute path to the given module's id.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext<Module>,\n moduleId: string\n): string {\n const exported = getOrInstantiateModuleFromParent(moduleId, this.m)\n .exports as Exports\n const exportedPath = exported?.default ?? exported\n if (typeof exportedPath !== 'string') {\n return exported as any\n }\n\n const strippedAssetPrefix = exportedPath.slice(ASSET_PREFIX.length)\n const resolved = path.resolve(RUNTIME_ROOT, strippedAssetPrefix)\n\n return url.pathToFileURL(resolved).href\n}\n\n/**\n * Exports a URL value. No suffix is added in Node.js runtime.\n */\nfunction exportUrl(\n this: TurbopackBaseContext<Module>,\n urlValue: string,\n id: ModuleId | undefined\n) {\n exportValue.call(this, urlValue, id)\n}\n\nfunction loadRuntimeChunk(sourcePath: ChunkPath, chunkData: ChunkData): void {\n if (typeof chunkData === 'string') {\n loadRuntimeChunkPath(sourcePath, chunkData)\n } else {\n loadRuntimeChunkPath(sourcePath, chunkData.path)\n }\n}\n\nconst loadedChunks = new Set<ChunkPath>()\nconst unsupportedLoadChunk = Promise.resolve(undefined)\nconst loadedChunk: Promise<void> = Promise.resolve(undefined)\nconst chunkCache = new Map<ChunkPath, Promise<void>>()\n\nfunction clearChunkCache() {\n chunkCache.clear()\n loadedChunks.clear()\n}\n\nfunction loadRuntimeChunkPath(\n sourcePath: ChunkPath,\n chunkPath: ChunkPath\n): void {\n if (!isJs(chunkPath)) {\n // We only support loading JS chunks in Node.js.\n // This branch can be hit when trying to load a CSS chunk.\n return\n }\n\n if (loadedChunks.has(chunkPath)) {\n return\n }\n\n try {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n const chunkModules: CompressedModuleFactories = require(resolved)\n installCompressedModuleFactories(chunkModules, 0)\n loadedChunks.add(chunkPath)\n } catch (cause) {\n let errorMessage = `Failed to load chunk ${chunkPath}`\n\n if (sourcePath) {\n errorMessage += ` from runtime for chunk ${sourcePath}`\n }\n\n const error = new Error(errorMessage, { cause })\n error.name = 'ChunkLoadError'\n throw error\n }\n}\n\nfunction loadChunkAsync<TModule extends Module>(\n this: TurbopackBaseContext<TModule>,\n chunkData: ChunkData\n): Promise<void> {\n const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path\n if (!isJs(chunkPath)) {\n // We only support loading JS chunks in Node.js.\n // This branch can be hit when trying to load a CSS chunk.\n return unsupportedLoadChunk\n }\n\n let entry = chunkCache.get(chunkPath)\n if (entry === undefined) {\n try {\n // resolve to an absolute path to simplify `require` handling\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n // TODO: consider switching to `import()` to enable concurrent chunk loading and async file io\n // However this is incompatible with hot reloading (since `import` doesn't use the require cache)\n const chunkModules: CompressedModuleFactories = require(resolved)\n installCompressedModuleFactories(chunkModules, 0)\n entry = loadedChunk\n } catch (cause) {\n const errorMessage = `Failed to load chunk ${chunkPath} from module ${this.m.id}`\n const error = new Error(errorMessage, { cause })\n error.name = 'ChunkLoadError'\n\n // Cache the failure promise, future requests will also get this same rejection\n entry = Promise.reject(error)\n }\n chunkCache.set(chunkPath, entry)\n }\n // TODO: Return an instrumented Promise that React can use instead of relying on referential equality.\n return entry\n}\ncontextPrototype.l = loadChunkAsync\n\nfunction loadChunkAsyncByUrl<TModule extends Module>(\n this: TurbopackBaseContext<TModule>,\n chunkUrl: string\n) {\n const path = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT)) as ChunkPath\n return loadChunkAsync.call(this, path)\n}\ncontextPrototype.L = loadChunkAsyncByUrl\n\n// Shared runtime primitive: the root that on-disk chunk paths are resolved\n// against. Used by the bundled wasm helper (exposed as `__turbopack_runtime_root__`).\ncontextPrototype.w = RUNTIME_ROOT\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n"],"names":["process","env","TURBOPACK","url","require","resolvePathFromModule","moduleId","exported","getOrInstantiateModuleFromParent","m","exports","exportedPath","default","strippedAssetPrefix","slice","ASSET_PREFIX","length","resolved","path","resolve","RUNTIME_ROOT","pathToFileURL","href","exportUrl","urlValue","id","exportValue","call","loadRuntimeChunk","sourcePath","chunkData","loadRuntimeChunkPath","loadedChunks","Set","unsupportedLoadChunk","Promise","undefined","loadedChunk","chunkCache","Map","clearChunkCache","clear","chunkPath","isJs","has","chunkModules","installCompressedModuleFactories","add","cause","errorMessage","error","Error","name","loadChunkAsync","entry","get","reject","set","contextPrototype","l","loadChunkAsyncByUrl","chunkUrl","path1","fileURLToPath","URL","L","w","regexJsUrl","chunkUrlOrPath","test"],"mappings":"AAAA,oDAAoD,GAEpD,8DAA8D;AAC9D,kEAAkE;AAClE,kEAAkE;AAClE,8CAA8C;AAE9C;;;CAGC,GAEDA,QAAQC,GAAG,CAACC,SAAS,GAAG;AAExB,MAAMC,MAAMC,QAAQ;AAEpB;;CAEC,GACD,SAASC,sBAEPC,QAAgB;IAEhB,MAAMC,WAAWC,iCAAiCF,UAAU,IAAI,CAACG,CAAC,EAC/DC,OAAO;IACV,MAAMC,eAAeJ,UAAUK,WAAWL;IAC1C,IAAI,OAAOI,iBAAiB,UAAU;QACpC,OAAOJ;IACT;IAEA,MAAMM,sBAAsBF,aAAaG,KAAK,CAACC,aAAaC,MAAM;IAClE,MAAMC,WAAWC,KAAKC,OAAO,CAACC,cAAcP;IAE5C,OAAOV,IAAIkB,aAAa,CAACJ,UAAUK,IAAI;AACzC;AAEA;;CAEC,GACD,SAASC,UAEPC,QAAgB,EAChBC,EAAwB;IAExBC,YAAYC,IAAI,CAAC,IAAI,EAAEH,UAAUC;A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csB;YAC5C,8FAA8F;YAC9F,iGAAiG;YACjG,MAAMG,eAA0CzC,QAAQa;YACxD6B,iCAAiCD,cAAc;YAC/CS,QAAQjB;QACV,EAAE,OAAOW,OAAO;YACd,MAAMC,eAAe,CAAC,qBAAqB,EAAEP,UAAU,aAAa,EAAE,IAAI,CAACjC,CAAC,CAACgB,EAAE,EAAE;YACjF,MAAMyB,QAAQ,IAAIC,MAAMF,cAAc;gBAAED;YAAM;YAC9CE,MAAME,IAAI,GAAG;YAEb,+EAA+E;YAC/EE,QAAQnB,QAAQqB,MAAM,CAACN;QACzB;QACAZ,WAAWmB,GAAG,CAACf,WAAWY;IAC5B;IACA,sGAAsG;IACtG,OAAOA;AACT;AACAI,iBAAiBC,CAAC,GAAGN;AAErB,SAASO,oBAEPC,QAAgB;IAEhB,MAAMC,QAAO3D,IAAI4D,aAAa,CAAC,IAAIC,IAAIH,UAAUzC;IACjD,OAAOiC,eAAe1B,IAAI,CAAC,IAAI,EAAEmC;AACnC;AACAJ,iBAAiBO,CAAC,GAAGL;AAErB,2EAA2E;AAC3E,sFAAsF;AACtFF,iBAAiBQ,CAAC,GAAG9C;AAErB,MAAM+C,aAAa;AACnB;;CAEC,GACD,SAASxB,KAAKyB,cAAoC;IAChD,OAAOD,WAAWE,IAAI,CAACD;AACzB","ignoreList":[0]}},
{"offset": {"line": 857, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime/build-base.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"./runtime-base.ts\" />\n\n/**\n * Production Node.js runtime.\n * Uses ModuleWithDirection and simple module instantiation without HMR support.\n */\n\n// this is read in runtime-utils.ts so it creates a module with direction for hmr\ncreateModuleWithDirectionFlag = true\n\ninterface TurbopackNodeBuildContext\n extends TurbopackBaseContext<ModuleWithDirection> {\n R: ResolvePathFromModule\n x: ExternalRequire\n y: ExternalImport\n C: typeof clearChunkCache\n}\n\nconst moduleCache: ModuleCache<ModuleWithDirection> = new Map()\n\nconst nodeContextPrototype = Context.prototype as TurbopackNodeBuildContext\n\nnodeContextPrototype.q = exportUrl\nnodeContextPrototype.c = moduleCache\nnodeContextPrototype.R = resolvePathFromModule\nnodeContextPrototype.C = clearChunkCache\n\nfunction instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): ModuleWithDirection {\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n throw new Error(factoryNotAvailableMessage(id, sourceType, sourceData))\n }\n\n const module: ModuleWithDirection = createModuleWithDirection(id)\n const exports = module.exports\n moduleCache.set(id, module)\n\n const context =\n new (Context as any as ContextConstructor<ModuleWithDirection>)(\n module,\n exports\n )\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n moduleFactory(context, module, exports)\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n ;(module as any).loaded = true\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore\nfunction getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: ModuleWithDirection\n): ModuleWithDirection {\n return (\n getCachedModule(moduleCache, id) ??\n instantiateModule(id, SourceType.Parent, sourceModule.id)\n )\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): ModuleWithDirection {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it as a runtime module if it is not cached.\n */\n// @ts-ignore TypeScript doesn't separate this module space from the browser runtime\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): ModuleWithDirection {\n return (\n getCachedModule(moduleCache, moduleId) ??\n instantiateRuntimeModule(chunkPath, moduleId)\n )\n}\n\nmodule.exports = (sourcePath: ChunkPath) => ({\n m: (id: ModuleId) => getOrInstantiateRuntimeModule(sourcePath, id),\n c: (chunkData: ChunkData) => loadRuntimeChunk(sourcePath, chunkData),\n})\n"],"names":["createModuleWithDirectionFlag","moduleCache","Map","nodeContextPrototype","Context","prototype","q","exportUrl","c","R","resolvePathFromModule","C","clearChunkCache","instantiateModule","id","sourceType","sourceData","moduleFactory","moduleFactories","get","Error","factoryNotAvailableMessage","module1","createModuleWithDirection","exports","set","context","error","loaded","namespaceObject","interopEsm","getOrInstantiateModuleFromParent","sourceModule","getCachedModule","SourceType","Parent","instantiateRuntimeModule","chunkPath","moduleId","Runtime","getOrInstantiateRuntimeModule","module","sourcePath","m","chunkData","loadRuntimeChunk"],"mappings":"AAAA,oDAAoD,GAEpD,0CAA0C;AAE1C;;;CAGC,GAED,iFAAiF;AACjFA,gCAAgC;AAUhC,MAAMC,cAAgD,IAAIC;AAE1D,MAAMC,uBAAuBC,QAAQC,SAAS;AAE9CF,qBAAqBG,CAAC,GAAGC;AACzBJ,qBAAqBK,CAAC,GAAGP;AACzBE,qBAAqBM,CAAC,GAAGC;AACzBP,qBAAqBQ,CAAC,GAAGC;AAEzB,SAASC,kBACPC,EAAY,EACZC,UAAsB,EACtBC,UAAsB;IAEtB,MAAMC,gBAAgBC,gBAAgBC,GAAG,CAACL;IAC1C,IAAI,OAAOG,kBAAkB,YAAY;QACvC,sEAAsE;QACtE,0EAA0E;QAC1E,mDAAmD;QACnD,MAAM,IAAIG,MAAMC,2BAA2BP,IAAIC,YAAYC;IAC7D;IAEA,MAAMM,UAA8BC,0BAA0BT;IAC9D,MAAMU,UAAUF,QAAOE,OAAO;IAC9BvB,YAAYwB,GAAG,CAACX,IAAIQ;IAEpB,MAAMI,UACJ,IAAKtB,QACHkB,SACAE;IAEJ,4EAA4E;IAC5E,IAAI;QACFP,cAAcS,SAASJ,SAAQE;IACjC,EAAE,OAAOG,OAAO;QACdL,QAAOK,KAAK,GAAGA;QACf,MAAMA;IACR;;IAEEL,QAAeM,MAAM,GAAG;IAC1B,IAAIN,QAAOO,eAAe,IAAIP,QAAOE,OAAO,KAAKF,QAAOO,eAAe,EAAE;QACvE,yDAAyD;QACzDC,WAAWR,QAAOE,OAAO,EAAEF,QAAOO,eAAe;IACnD;IAEA,OAAOP;AACT;AAEA;;CAEC,GACD,aAAa;AACb,SAASS,iCACPjB,EAAY,EACZkB,YAAiC;IAEjC,OACEC,gBAAgBhC,aAAaa,OAC7BD,kBAAkBC,IAAIoB,WAAWC,MAAM,EAAEH,aAAalB,EAAE;AAE5D;AAEA;;CAEC,GACD,SAASsB,yBACPC,SAAoB,EACpBC,QAAkB;IAElB,OAAOzB,kBAAkByB,UAAUJ,WAAWK,OAAO,EAAEF;AACzD;AAEA;;CAEC,GACD,oFAAoF;AACpF,SAASG,8BACPH,SAAoB,EACpBC,QAAkB;IAElB,OACEL,gBAAgBhC,aAAaqC,aAC7BF,yBAAyBC,WAAWC;AAExC;AAEAG,OAAOjB,OAAO,GAAG,CAACkB,aAA0B,CAAC;QAC3CC,GAAG,CAAC7B,KAAiB0B,8BAA8BE,YAAY5B;QAC/DN,GAAG,CAACoC,YAAyBC,iBAAiBH,YAAYE;IAC5D,CAAC","ignoreList":[0]}}]
{"offset": {"line": 744, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime/runtime-base.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"../../shared/runtime/runtime-utils.ts\" />\n/// <reference path=\"../../shared-node/base-externals-utils.ts\" />\n/// <reference path=\"../../shared-node/node-externals-utils.ts\" />\n/// <reference path=\"./nodejs-globals.d.ts\" />\n\n/**\n * Base Node.js runtime shared between production and development.\n * Contains chunk loading, module caching, and other non-HMR functionality.\n */\n\nprocess.env.TURBOPACK = '1'\n\nconst url = require('url') as typeof import('url')\n\n/**\n * Returns an absolute path to the given module's id.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext<Module>,\n moduleId: string\n): string {\n const exported = getOrInstantiateModuleFromParent(moduleId, this.m)\n .exports as Exports\n const exportedPath = exported?.default ?? exported\n if (typeof exportedPath !== 'string') {\n return exported as any\n }\n\n const strippedAssetPrefix = exportedPath.slice(ASSET_PREFIX.length)\n const resolved = path.resolve(RUNTIME_ROOT, strippedAssetPrefix)\n\n return url.pathToFileURL(resolved).href\n}\n\n/**\n * Exports a URL value. No suffix is added in Node.js runtime.\n */\nfunction exportUrl(\n this: TurbopackBaseContext<Module>,\n urlValue: string,\n id: ModuleId | undefined\n) {\n exportValue.call(this, urlValue, id)\n}\n\nfunction loadRuntimeChunk(sourcePath: ChunkPath, chunkData: ChunkData): void {\n if (typeof chunkData === 'string') {\n loadRuntimeChunkPath(sourcePath, chunkData)\n } else {\n loadRuntimeChunkPath(sourcePath, chunkData.path)\n }\n}\n\nconst loadedChunks = new Set<ChunkPath>()\nconst unsupportedLoadChunk = Promise.resolve(undefined)\nconst loadedChunk: Promise<void> = Promise.resolve(undefined)\nconst chunkCache = new Map<ChunkPath, Promise<void>>()\n\nfunction clearChunkCache() {\n chunkCache.clear()\n loadedChunks.clear()\n}\n\nfunction loadRuntimeChunkPath(\n sourcePath: ChunkPath,\n chunkPath: ChunkPath\n): void {\n if (!isJs(chunkPath)) {\n // We only support loading JS chunks in Node.js.\n // This branch can be hit when trying to load a CSS chunk.\n return\n }\n\n if (loadedChunks.has(chunkPath)) {\n return\n }\n\n try {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n const chunkModules: CompressedModuleFactories = require(resolved)\n installCompressedModuleFactories(chunkModules, 0)\n loadedChunks.add(chunkPath)\n } catch (cause) {\n let errorMessage = `Failed to load chunk ${chunkPath}`\n\n if (sourcePath) {\n errorMessage += ` from runtime for chunk ${sourcePath}`\n }\n\n const error = new Error(errorMessage, { cause })\n error.name = 'ChunkLoadError'\n throw error\n }\n}\n\nfunction loadChunkAsync<TModule extends Module>(\n this: TurbopackBaseContext<TModule>,\n chunkData: ChunkData\n): Promise<void> {\n const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path\n if (!isJs(chunkPath)) {\n // We only support loading JS chunks in Node.js.\n // This branch can be hit when trying to load a CSS chunk.\n return unsupportedLoadChunk\n }\n\n let entry = chunkCache.get(chunkPath)\n if (entry === undefined) {\n const sourceModuleId = this.m.id\n // `ensureChunk` is conditionally installed to support lazy dynamic imports during SSR\n // It can be used to call back into turbopack to compile the chunk we are about to reference.\n const ensureChunk = globalThis.__turbopack_ensure_chunk__\n let ensuring: void | Promise<void> = undefined\n if (ensureChunk !== undefined) {\n try {\n // Returns `undefined` when the chunk can be required right away.\n ensuring = ensureChunk(chunkPath)\n } catch (error) {\n // Don't cache a failure to compile the chunk, so that the next load\n // retries it.\n return Promise.reject(error)\n }\n }\n if (ensuring === undefined) {\n entry = requireChunk(chunkPath, sourceModuleId)\n } else {\n // The chunk is being compiled on demand before it can be required.\n // Cache the combined promise right away so that every caller (including\n // concurrent ones) gets the same promise for this chunk.\n const ensured: Promise<void> = Promise.resolve(ensuring).then(\n () => requireChunk(chunkPath, sourceModuleId),\n (error) => {\n // Don't cache a failure to compile the chunk, so that the next load\n // retries it.\n if (chunkCache.get(chunkPath) === ensured) {\n chunkCache.delete(chunkPath)\n }\n throw error\n }\n )\n entry = ensured\n }\n chunkCache.set(chunkPath, entry)\n }\n // TODO: Return an instrumented Promise that React can use instead of relying on referential equality.\n return entry\n}\n\nfunction requireChunk(\n chunkPath: ChunkPath,\n sourceModuleId: ModuleId\n): Promise<void> {\n try {\n // resolve to an absolute path to simplify `require` handling\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n // TODO: consider switching to `import()` to enable concurrent chunk loading and async file io\n // However this is incompatible with hot reloading (since `import` doesn't use the require cache)\n const chunkModules: CompressedModuleFactories = require(resolved)\n installCompressedModuleFactories(chunkModules, 0)\n return loadedChunk\n } catch (cause) {\n const errorMessage = `Failed to load chunk ${chunkPath} from module ${sourceModuleId}`\n const error = new Error(errorMessage, { cause })\n error.name = 'ChunkLoadError'\n\n // Cache the failure promise, future requests will also get this same rejection\n return Promise.reject(error)\n }\n}\ncontextPrototype.l = loadChunkAsync\n\nfunction loadChunkAsyncByUrl<TModule extends Module>(\n this: TurbopackBaseContext<TModule>,\n chunkUrl: string\n) {\n const path = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT)) as ChunkPath\n return loadChunkAsync.call(this, path)\n}\ncontextPrototype.L = loadChunkAsyncByUrl\n\n// Shared runtime primitive: the root that on-disk chunk paths are resolved\n// against. Used by the bundled wasm helper (exposed as `__turbopack_runtime_root__`).\ncontextPrototype.w = RUNTIME_ROOT\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n"],"names":["process","env","TURBOPACK","url","require","resolvePathFromModule","moduleId","exported","getOrInstantiateModuleFromParent","m","exports","exportedPath","default","strippedAssetPrefix","slice","ASSET_PREFIX","length","resolved","path","resolve","RUNTIME_ROOT","pathToFileURL","href","exportUrl","urlValue","id","exportValue","call","loadRuntimeChunk","sourcePath","chunkData","loadRuntimeChunkPath","loadedChunks","Set","unsupportedLoadChunk","Promise","undefined","loadedChunk","chunkCache","Map","clearChunkCache","clear","chunkPath","isJs","has","chunkModules","installCompressedModuleFactories","add","cause","errorMessage","error","Error","name","loadChunkAsync","entry","get","sourceModuleId","ensureChunk","globalThis","__turbopack_ensure_chunk__","ensuring","reject","requireChunk","ensured","then","delete","set","contextPrototype","l","loadChunkAsyncByUrl","chunkUrl","path1","fileURLToPath","URL","L","w","regexJsUrl","chunkUrlOrPath","test"],"mappings":"AAAA,oDAAoD,GAE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AAW4B,GAAG,CAACxB,WAAWY;IAC5B;IACA,sGAAsG;IACtG,OAAOA;AACT;AAEA,SAASQ,aACPpB,SAAoB,EACpBc,cAAwB;IAExB,IAAI;QACF,6DAA6D;QAC7D,MAAMvC,WAAWC,KAAKC,OAAO,CAACC,cAAcsB;QAC5C,8FAA8F;QAC9F,iGAAiG;QACjG,MAAMG,eAA0CzC,QAAQa;QACxD6B,iCAAiCD,cAAc;QAC/C,OAAOR;IACT,EAAE,OAAOW,OAAO;QACd,MAAMC,eAAe,CAAC,qBAAqB,EAAEP,UAAU,aAAa,EAAEc,gBAAgB;QACtF,MAAMN,QAAQ,IAAIC,MAAMF,cAAc;YAAED;QAAM;QAC9CE,MAAME,IAAI,GAAG;QAEb,+EAA+E;QAC/E,OAAOjB,QAAQ0B,MAAM,CAACX;IACxB;AACF;AACAiB,iBAAiBC,CAAC,GAAGf;AAErB,SAASgB,oBAEPC,QAAgB;IAEhB,MAAMC,QAAOpE,IAAIqE,aAAa,CAAC,IAAIC,IAAIH,UAAUlD;IACjD,OAAOiC,eAAe1B,IAAI,CAAC,IAAI,EAAE4C;AACnC;AACAJ,iBAAiBO,CAAC,GAAGL;AAErB,2EAA2E;AAC3E,sFAAsF;AACtFF,iBAAiBQ,CAAC,GAAGvD;AAErB,MAAMwD,aAAa;AACnB;;CAEC,GACD,SAASjC,KAAKkC,cAAoC;IAChD,OAAOD,WAAWE,IAAI,CAACD;AACzB","ignoreList":[0]}},
{"offset": {"line": 890, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime/build-base.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"./runtime-base.ts\" />\n\n/**\n * Production Node.js runtime.\n * Uses ModuleWithDirection and simple module instantiation without HMR support.\n */\n\n// this is read in runtime-utils.ts so it creates a module with direction for hmr\ncreateModuleWithDirectionFlag = true\n\ninterface TurbopackNodeBuildContext\n extends TurbopackBaseContext<ModuleWithDirection> {\n R: ResolvePathFromModule\n x: ExternalRequire\n y: ExternalImport\n C: typeof clearChunkCache\n}\n\nconst moduleCache: ModuleCache<ModuleWithDirection> = new Map()\n\nconst nodeContextPrototype = Context.prototype as TurbopackNodeBuildContext\n\nnodeContextPrototype.q = exportUrl\nnodeContextPrototype.c = moduleCache\nnodeContextPrototype.R = resolvePathFromModule\nnodeContextPrototype.C = clearChunkCache\n\nfunction instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): ModuleWithDirection {\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n throw new Error(factoryNotAvailableMessage(id, sourceType, sourceData))\n }\n\n const module: ModuleWithDirection = createModuleWithDirection(id)\n const exports = module.exports\n moduleCache.set(id, module)\n\n const context =\n new (Context as any as ContextConstructor<ModuleWithDirection>)(\n module,\n exports\n )\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n moduleFactory(context, module, exports)\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n ;(module as any).loaded = true\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore\nfunction getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: ModuleWithDirection\n): ModuleWithDirection {\n return (\n getCachedModule(moduleCache, id) ??\n instantiateModule(id, SourceType.Parent, sourceModule.id)\n )\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): ModuleWithDirection {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it as a runtime module if it is not cached.\n */\n// @ts-ignore TypeScript doesn't separate this module space from the browser runtime\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): ModuleWithDirection {\n return (\n getCachedModule(moduleCache, moduleId) ??\n instantiateRuntimeModule(chunkPath, moduleId)\n )\n}\n\nmodule.exports = (sourcePath: ChunkPath) => ({\n m: (id: ModuleId) => getOrInstantiateRuntimeModule(sourcePath, id),\n c: (chunkData: ChunkData) => loadRuntimeChunk(sourcePath, chunkData),\n})\n"],"names":["createModuleWithDirectionFlag","moduleCache","Map","nodeContextPrototype","Context","prototype","q","exportUrl","c","R","resolvePathFromModule","C","clearChunkCache","instantiateModule","id","sourceType","sourceData","moduleFactory","moduleFactories","get","Error","factoryNotAvailableMessage","module1","createModuleWithDirection","exports","set","context","error","loaded","namespaceObject","interopEsm","getOrInstantiateModuleFromParent","sourceModule","getCachedModule","SourceType","Parent","instantiateRuntimeModule","chunkPath","moduleId","Runtime","getOrInstantiateRuntimeModule","module","sourcePath","m","chunkData","loadRuntimeChunk"],"mappings":"AAAA,oDAAoD,GAEpD,0CAA0C;AAE1C;;;CAGC,GAED,iFAAiF;AACjFA,gCAAgC;AAUhC,MAAMC,cAAgD,IAAIC;AAE1D,MAAMC,uBAAuBC,QAAQC,SAAS;AAE9CF,qBAAqBG,CAAC,GAAGC;AACzBJ,qBAAqBK,CAAC,GAAGP;AACzBE,qBAAqBM,CAAC,GAAGC;AACzBP,qBAAqBQ,CAAC,GAAGC;AAEzB,SAASC,kBACPC,EAAY,EACZC,UAAsB,EACtBC,UAAsB;IAEtB,MAAMC,gBAAgBC,gBAAgBC,GAAG,CAACL;IAC1C,IAAI,OAAOG,kBAAkB,YAAY;QACvC,sEAAsE;QACtE,0EAA0E;QAC1E,mDAAmD;QACnD,MAAM,IAAIG,MAAMC,2BAA2BP,IAAIC,YAAYC;IAC7D;IAEA,MAAMM,UAA8BC,0BAA0BT;IAC9D,MAAMU,UAAUF,QAAOE,OAAO;IAC9BvB,YAAYwB,GAAG,CAACX,IAAIQ;IAEpB,MAAMI,UACJ,IAAKtB,QACHkB,SACAE;IAEJ,4EAA4E;IAC5E,IAAI;QACFP,cAAcS,SAASJ,SAAQE;IACjC,EAAE,OAAOG,OAAO;QACdL,QAAOK,KAAK,GAAGA;QACf,MAAMA;IACR;;IAEEL,QAAeM,MAAM,GAAG;IAC1B,IAAIN,QAAOO,eAAe,IAAIP,QAAOE,OAAO,KAAKF,QAAOO,eAAe,EAAE;QACvE,yDAAyD;QACzDC,WAAWR,QAAOE,OAAO,EAAEF,QAAOO,eAAe;IACnD;IAEA,OAAOP;AACT;AAEA;;CAEC,GACD,aAAa;AACb,SAASS,iCACPjB,EAAY,EACZkB,YAAiC;IAEjC,OACEC,gBAAgBhC,aAAaa,OAC7BD,kBAAkBC,IAAIoB,WAAWC,MAAM,EAAEH,aAAalB,EAAE;AAE5D;AAEA;;CAEC,GACD,SAASsB,yBACPC,SAAoB,EACpBC,QAAkB;IAElB,OAAOzB,kBAAkByB,UAAUJ,WAAWK,OAAO,EAAEF;AACzD;AAEA;;CAEC,GACD,oFAAoF;AACpF,SAASG,8BACPH,SAAoB,EACpBC,QAAkB;IAElB,OACEL,gBAAgBhC,aAAaqC,aAC7BF,yBAAyBC,WAAWC;AAExC;AAEAG,OAAOjB,OAAO,GAAG,CAACkB,aAA0B,CAAC;QAC3CC,GAAG,CAAC7B,KAAiB0B,8BAA8BE,YAAY5B;QAC/DN,GAAG,CAACoC,YAAyBC,iBAAiBH,YAAYE;IAC5D,CAAC","ignoreList":[0]}}]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment