Commit 34d65631 authored by Will Binns-Smith's avatar Will Binns-Smith

Add server-side HMR infrastructure

Add server HMR functions to enable hot module replacement for server-side
code in Turbopack:

Rust (crates/next-api/src/project.rs):
- server_hmr_content: Get server module content by identifier
- server_hmr_version: Get server module version
- server_hmr_version_state: Get version state for server HMR session
- server_hmr_update: Compute server HMR update delta
- server_hmr_identifiers: List all server HMR identifiers

NAPI bindings (crates/napi/src/next_api/project.rs):
- project_server_hmr_events: Subscribe to server HMR events
- project_server_hmr_identifiers_subscribe: Subscribe to server identifiers

TypeScript (packages/next/src/build/swc):
- serverHmrEvents(): Subscribe to server HMR events
- serverHmrIdentifiersSubscribe(): Subscribe to server identifiers

Debug test code added to hot-reloader-turbopack.ts to verify the
subscriptions work correctly during development.
parent 05da4427
......@@ -2115,6 +2115,93 @@ impl Project {
}
}
/// Get server module content by identifier (path relative to node_root).
/// This is the server-side equivalent of `hmr_content`.
#[turbo_tasks::function]
async fn server_hmr_content(
self: Vc<Self>,
identifier: RcStr,
) -> Result<Vc<OptionVersionedContent>> {
if let Some(map) = self.await?.versioned_content_map {
// Key difference from hmr_content: use node_root instead of client_relative_path
let content = map.get(self.node_root().await?.join(&identifier)?);
Ok(content)
} else {
bail!("must be in dev mode to hmr")
}
}
/// Get server module version.
/// This is the server-side equivalent of `hmr_version`.
#[turbo_tasks::function]
async fn server_hmr_version(self: Vc<Self>, identifier: RcStr) -> Result<Vc<Box<dyn Version>>> {
let content = self.server_hmr_content(identifier).await?;
if let Some(content) = &*content {
Ok(content.version())
} else {
Ok(Vc::upcast(NotFoundVersion::new()))
}
}
/// Get the version state for a server HMR session. Initialized with the first seen
/// version in that session.
/// This is the server-side equivalent of `hmr_version_state`.
#[turbo_tasks::function]
pub async fn server_hmr_version_state(
self: Vc<Self>,
identifier: RcStr,
session: TransientInstance<()>,
) -> Result<Vc<VersionState>> {
let version = self.server_hmr_version(identifier);
// The session argument is important to avoid caching this function between
// sessions.
let _ = session;
// INVALIDATION: This is intentionally untracked to avoid invalidating this
// function completely. We want to initialize the VersionState with the
// first seen version of the session.
let state = VersionState::new(
version
.into_trait_ref()
.strongly_consistent()
.untracked()
.await?,
)
.await?;
Ok(state)
}
/// Emits opaque HMR events whenever a change is detected in server-side modules
/// internally known as `identifier`.
/// This is the server-side equivalent of `hmr_update`.
#[turbo_tasks::function]
pub async fn server_hmr_update(
self: Vc<Self>,
identifier: RcStr,
from: Vc<VersionState>,
) -> Result<Vc<Update>> {
let from = from.get();
let content = self.server_hmr_content(identifier).await?;
if let Some(content) = *content {
Ok(content.update(from))
} else {
Ok(Update::Missing.cell())
}
}
/// Gets a list of all server HMR identifiers that can be subscribed to.
/// These are paths relative to node_root (e.g., "server/app/page.js").
/// This is the server-side equivalent of `hmr_identifiers`.
#[turbo_tasks::function]
pub async fn server_hmr_identifiers(self: Vc<Self>) -> Result<Vc<Vec<RcStr>>> {
if let Some(map) = self.await?.versioned_content_map {
Ok(map.keys_in_path(self.node_root().owned().await?))
} else {
bail!("must be in dev mode to hmr")
}
}
/// Completion when server side changes are detected in output assets
/// referenced from the roots
#[turbo_tasks::function]
......
......@@ -1232,6 +1232,35 @@ fn project_client_hmr_update_operation(
project.client_hmr_update(identifier, *state)
}
#[turbo_tasks::function(operation)]
fn project_server_hmr_update_operation(
project: ResolvedVc<Project>,
identifier: RcStr,
state: ResolvedVc<VersionState>,
) -> Vc<Update> {
project.server_hmr_update(identifier, *state)
}
#[turbo_tasks::function(operation)]
async fn server_hmr_update_with_issues_operation(
project: ResolvedVc<Project>,
identifier: RcStr,
state: ResolvedVc<VersionState>,
) -> Result<Vc<HmrUpdateWithIssues>> {
let update_op = project_server_hmr_update_operation(project, identifier, state);
let update = update_op.read_strongly_consistent().await?;
let issues = get_issues(update_op, NEXT_ISSUE_FILTER).await?;
let diagnostics = get_diagnostics(update_op).await?;
let effects = Arc::new(get_effects(update_op).await?);
Ok(HmrUpdateWithIssues {
update,
issues,
diagnostics,
effects,
}
.cell())
}
#[tracing::instrument(level = "info", name = "get HMR events", skip(project, func))]
#[napi(ts_return_type = "{ __napiType: \"RootTask\" }")]
pub fn project_client_hmr_events(
......@@ -1317,6 +1346,91 @@ pub fn project_client_hmr_events(
)
}
#[tracing::instrument(level = "info", name = "get server HMR events", skip(project, func))]
#[napi(ts_return_type = "{ __napiType: \"RootTask\" }")]
pub fn project_server_hmr_events(
#[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>,
identifier: RcStr,
func: JsFunction,
) -> napi::Result<External<RootTask>> {
let container = project.container;
let session = TransientInstance::new(());
subscribe(
project.turbopack_ctx.clone(),
func,
{
let outer_identifier = identifier.clone();
let session = session.clone();
move || {
let identifier: RcStr = outer_identifier.clone();
let session = session.clone();
async move {
let project = container.project().to_resolved().await?;
let state = project
.server_hmr_version_state(identifier.clone(), session)
.to_resolved()
.await?;
let update_op =
server_hmr_update_with_issues_operation(project, identifier.clone(), state);
let update = update_op.read_strongly_consistent().await?;
let HmrUpdateWithIssues {
update,
issues,
diagnostics,
effects,
} = &*update;
effects.apply().await?;
match &**update {
Update::Missing | Update::None => {}
Update::Total(TotalUpdate { to }) => {
state.set(to.clone()).await?;
}
Update::Partial(PartialUpdate { to, .. }) => {
state.set(to.clone()).await?;
}
}
Ok((Some(update.clone()), issues.clone(), diagnostics.clone()))
}
}
},
move |ctx| {
let (update, issues, diags) = ctx.value;
let napi_issues = issues
.iter()
.map(|issue| NapiIssue::from(&**issue))
.collect();
let update_issues = issues
.iter()
.map(|issue| Issue::from(&**issue))
.collect::<Vec<_>>();
let identifier = ResourceIdentifier {
path: identifier.clone(),
headers: None,
};
let update = match update.as_deref() {
None | Some(Update::Missing) | Some(Update::Total(_)) => {
ClientUpdateInstruction::restart(&identifier, &update_issues)
}
Some(Update::Partial(update)) => ClientUpdateInstruction::partial(
&identifier,
&update.instruction,
&update_issues,
),
Some(Update::None) => ClientUpdateInstruction::issues(&identifier, &update_issues),
};
Ok(vec![TurbopackResult {
result: ctx.env.to_js_value(&update)?,
issues: napi_issues,
diagnostics: diags.iter().map(|d| NapiDiagnostic::from(d)).collect(),
}])
},
)
}
#[napi(object)]
struct HmrIdentifiers {
pub identifiers: Vec<RcStr>,
......@@ -1355,6 +1469,31 @@ fn project_container_client_hmr_identifiers_operation(
container.client_hmr_identifiers()
}
#[turbo_tasks::function(operation)]
fn project_server_hmr_identifiers_operation(
container: ResolvedVc<ProjectContainer>,
) -> Vc<Vec<RcStr>> {
container.project().server_hmr_identifiers()
}
#[turbo_tasks::function(operation)]
async fn get_server_hmr_identifiers_with_issues_operation(
container: ResolvedVc<ProjectContainer>,
) -> Result<Vc<HmrIdentifiersWithIssues>> {
let hmr_identifiers_op = project_server_hmr_identifiers_operation(container);
let hmr_identifiers = hmr_identifiers_op.read_strongly_consistent().await?;
let issues = get_issues(hmr_identifiers_op, NEXT_ISSUE_FILTER).await?;
let diagnostics = get_diagnostics(hmr_identifiers_op).await?;
let effects = Arc::new(get_effects(hmr_identifiers_op).await?);
Ok(HmrIdentifiersWithIssues {
identifiers: hmr_identifiers,
issues,
diagnostics,
effects,
}
.cell())
}
#[tracing::instrument(level = "info", name = "get HMR identifiers", skip_all)]
#[napi(ts_return_type = "{ __napiType: \"RootTask\" }")]
pub fn project_client_hmr_identifiers_subscribe(
......@@ -1400,6 +1539,51 @@ pub fn project_client_hmr_identifiers_subscribe(
)
}
#[tracing::instrument(level = "info", name = "get server HMR identifiers", skip_all)]
#[napi(ts_return_type = "{ __napiType: \"RootTask\" }")]
pub fn project_server_hmr_identifiers_subscribe(
#[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>,
func: JsFunction,
) -> napi::Result<External<RootTask>> {
let container = project.container;
subscribe(
project.turbopack_ctx.clone(),
func,
move || async move {
let hmr_identifiers_with_issues_op =
get_server_hmr_identifiers_with_issues_operation(container);
let HmrIdentifiersWithIssues {
identifiers,
issues,
diagnostics,
effects,
} = &*hmr_identifiers_with_issues_op
.read_strongly_consistent()
.await?;
effects.apply().await?;
Ok((identifiers.clone(), issues.clone(), diagnostics.clone()))
},
move |ctx| {
let (identifiers, issues, diagnostics) = ctx.value;
Ok(vec![TurbopackResult {
result: HmrIdentifiers {
identifiers: ReadRef::into_owned(identifiers),
},
issues: issues
.iter()
.map(|issue| NapiIssue::from(&**issue))
.collect(),
diagnostics: diagnostics
.iter()
.map(|d| NapiDiagnostic::from(d))
.collect(),
}])
},
)
}
pub enum UpdateMessage {
Start,
End(UpdateInfo),
......
......@@ -318,6 +318,11 @@ export declare function projectClientHmrEvents(
identifier: RcStr,
func: (...args: any[]) => any
): { __napiType: 'RootTask' }
export declare function projectServerHmrEvents(
project: { __napiType: 'Project' },
identifier: RcStr,
func: (...args: any[]) => any
): { __napiType: 'RootTask' }
export interface HmrIdentifiers {
identifiers: Array<RcStr>
}
......@@ -325,6 +330,10 @@ export declare function projectClientHmrIdentifiersSubscribe(
project: { __napiType: 'Project' },
func: (...args: any[]) => any
): { __napiType: 'RootTask' }
export declare function projectServerHmrIdentifiersSubscribe(
project: { __napiType: 'Project' },
func: (...args: any[]) => any
): { __napiType: 'RootTask' }
export interface NapiUpdateMessage {
updateType: string
value?: NapiUpdateInfo
......
......@@ -29,6 +29,7 @@ import type {
Endpoint,
HmrIdentifiers,
Lockfile,
NodeJsHmrUpdate,
PartialProjectOptions,
Project,
ProjectOptions,
......@@ -756,6 +757,29 @@ function bindingToApi(
)
}
serverHmrEvents(identifier: string) {
return subscribe<TurbopackResult<NodeJsHmrUpdate>>(
true,
async (callback) =>
binding.projectServerHmrEvents(
this._nativeProject,
identifier,
callback
)
)
}
serverHmrIdentifiersSubscribe() {
return subscribe<TurbopackResult<HmrIdentifiers>>(
false,
async (callback) =>
binding.projectServerHmrIdentifiersSubscribe(
this._nativeProject,
callback
)
)
}
traceSource(
stackFrame: TurbopackStackFrame,
currentDirectoryFileUrl: string
......
......@@ -195,6 +195,20 @@ interface PartialUpdate extends BaseUpdate {
export type Update = IssuesUpdate | PartialUpdate
export interface NodeJsPartialHmrUpdate extends BaseUpdate {
type: 'partial'
instruction: {
type: 'EcmascriptMergedUpdate'
entries: Record<
string,
{ code: string; url: string; map?: string | undefined }
>
chunks?: Record<string, { type: 'partial' }>
}
}
export type NodeJsHmrUpdate = IssuesUpdate | NodeJsPartialHmrUpdate
export interface HmrIdentifiers {
identifiers: string[]
}
......@@ -254,6 +268,14 @@ export interface Project {
TurbopackResult<HmrIdentifiers>
>
serverHmrEvents(
identifier: string
): AsyncIterableIterator<TurbopackResult<NodeJsHmrUpdate>>
serverHmrIdentifiersSubscribe(): AsyncIterableIterator<
TurbopackResult<HmrIdentifiers>
>
getSourceForAsset(filePath: string): Promise<string | null>
getSourceMap(filePath: string): Promise<string | null>
......
......@@ -61,7 +61,11 @@ if (process.env.NODE_ENV === 'development') {
declare global {
var __next__clear_chunk_cache__: (() => void) | null | undefined
var __turbopack_clear_chunk_cache__: () => void | null | undefined
var __turbopack_server_hmr_apply__:
| ((update: NodeJsPartialHmrUpdate) => boolean)
| undefined
}
// hot-reloader modules are not bundled so we need to inject `__next__clear_chunk_cache__`
// into globalThis from this file which is bundled.
if (process.env.TURBOPACK) {
......
......@@ -24,6 +24,8 @@ import type {
TurbopackResult,
Project,
Entrypoints,
NodeJsHmrUpdate,
NodeJsPartialHmrUpdate,
} from '../../build/swc/types'
import { createDefineEnv, getBindingsSync } from '../../build/swc'
import * as Log from '../../build/output/log'
......@@ -144,6 +146,90 @@ const sessionId = Math.floor(Number.MAX_SAFE_INTEGER * Math.random())
declare const __next__clear_chunk_cache__: (() => void) | null | undefined
declare const __turbopack_server_hmr_apply__:
| ((update: NodeJsPartialHmrUpdate) => boolean)
| undefined
function setupServerHmr(project: Project) {
const serverHmrSubscriptions = new Map<
string,
AsyncIterableIterator<TurbopackResult<NodeJsHmrUpdate>>
>()
function subscribeToServerHmr(identifier: string) {
if (serverHmrSubscriptions.has(identifier)) {
return
}
const subscription = project.serverHmrEvents(identifier)
serverHmrSubscriptions.set(identifier, subscription)
// Start listening for changes in background
;(async () => {
// Skip initial state
await subscription.next()
for await (const result of subscription) {
const update = result as NodeJsHmrUpdate
// Only process partial updates with actual code changes
if (update.type !== 'partial') {
continue
}
const entries = update.instruction?.entries
if (!entries || Object.keys(entries).length === 0) {
continue
}
if (typeof __turbopack_server_hmr_apply__ === 'function') {
const applied = __turbopack_server_hmr_apply__(update as any)
if (applied) {
// TODO: Notify clients to refresh and get updated server content
// This will trigger the client to re-fetch the page with new server components
}
}
}
})().catch((err) => {
console.error('[Server HMR] Subscription error:', err)
serverHmrSubscriptions.delete(identifier)
})
}
// Listen to the Rust bindings update us on changing server HMR identifiers
;(async () => {
const serverHmrIdentifiers = project.serverHmrIdentifiersSubscribe()
// Process identifiers (both initial and subsequent updates)
for await (const data of serverHmrIdentifiers) {
const currentIdentifiers = new Set(
data.identifiers.filter((id) => id.endsWith('.js'))
)
// Clean up subscriptions for removed identifiers (like when pages are deleted)
const identifiersToRemove = []
for (const identifier of serverHmrSubscriptions.keys()) {
if (!currentIdentifiers.has(identifier)) {
identifiersToRemove.push(identifier)
}
}
for (const identifier of identifiersToRemove) {
const subscription = serverHmrSubscriptions.get(identifier)
subscription?.return?.()
serverHmrSubscriptions.delete(identifier)
}
// Subscribe to HMR events for new server modules
for (const identifier of currentIdentifiers) {
if (!serverHmrSubscriptions.has(identifier)) {
subscribeToServerHmr(identifier)
}
}
}
})()
}
/**
* Replaces turbopack:///[project] with the specified project in the `source` field.
*/
......@@ -511,6 +597,8 @@ export async function createHotReloaderTurbopack(
}
}
setupServerHmr(project)
let hmrEventHappened = false
let hmrHash = 0
......@@ -604,7 +692,7 @@ export async function createHotReloaderTurbopack(
sendEnqueuedMessagesDebounce()
}
async function subscribeToChanges(
async function subscribeToClientChanges(
key: EntryKey,
includeIssues: boolean,
endpoint: Endpoint,
......@@ -646,7 +734,7 @@ export async function createHotReloaderTurbopack(
changeSubscriptions.delete(key)
}
async function unsubscribeFromChanges(key: EntryKey) {
async function unsubscribeFromClientChanges(key: EntryKey) {
const subscription = await changeSubscriptions.get(key)
if (subscription) {
await subscription.return?.()
......@@ -655,7 +743,7 @@ export async function createHotReloaderTurbopack(
currentEntryIssues.delete(key)
}
async function subscribeToHmrEvents(client: ws, id: string) {
async function subscribeToClientHmrEvents(client: ws, id: string) {
const key = getEntryKey('assets', 'client', id)
if (!hasEntrypointForKey(currentEntrypoints, key, assetMapper)) {
// maybe throw an error / force the client to reload?
......@@ -696,7 +784,7 @@ export async function createHotReloaderTurbopack(
}
}
function unsubscribeFromHmrEvents(client: ws, id: string) {
function unsubscribeFromClientHmrEvents(client: ws, id: string) {
const state = clientStates.get(client)
if (!state) {
return
......@@ -773,9 +861,9 @@ export async function createHotReloaderTurbopack(
propagateServerField: propagateServerField.bind(null, opts),
sendHmr,
startBuilding,
subscribeToChanges,
unsubscribeFromChanges,
unsubscribeFromHmrEvents,
subscribeToChanges: subscribeToClientChanges,
unsubscribeFromChanges: unsubscribeFromClientChanges,
unsubscribeFromHmrEvents: unsubscribeFromClientHmrEvents,
},
},
})
......@@ -1130,11 +1218,11 @@ export async function createHotReloaderTurbopack(
// Turbopack messages
switch (parsedData.type) {
case 'turbopack-subscribe':
subscribeToHmrEvents(client, parsedData.path)
subscribeToClientHmrEvents(client, parsedData.path)
break
case 'turbopack-unsubscribe':
unsubscribeFromHmrEvents(client, parsedData.path)
unsubscribeFromClientHmrEvents(client, parsedData.path)
break
default:
......@@ -1444,7 +1532,7 @@ export async function createHotReloaderTurbopack(
productionRewrites: undefined,
logErrors: true,
hooks: {
subscribeToChanges,
subscribeToChanges: subscribeToClientChanges,
handleWrittenEndpoint: (id, result, forceDeleteCache) => {
currentWrittenEntrypoints.set(id, result)
assetMapper.setPathsForKey(id, result.clientPaths)
......@@ -1512,7 +1600,7 @@ export async function createHotReloaderTurbopack(
logErrors: true,
hooks: {
subscribeToChanges,
subscribeToChanges: subscribeToClientChanges,
handleWrittenEndpoint: (id, result, forceDeleteCache) => {
currentWrittenEntrypoints.set(id, result)
assetMapper.setPathsForKey(id, result.clientPaths)
......
......@@ -665,12 +665,12 @@ describe('next.rs api', () => {
}
}
const result = await project.hmrIdentifiersSubscribe().next()
const result = await project.clientHmrIdentifiersSubscribe().next()
expect(result.done).toBe(false)
const identifiers = result.value.identifiers
expect(identifiers).toHaveProperty('length', expect.toBePositive())
const subscriptions = identifiers.map((identifier) =>
project.hmrEvents(identifier)
project.clientHmrEvents(identifier)
)
await Promise.all(
subscriptions.map(async (subscription) => {
......@@ -792,12 +792,12 @@ describe('next.rs api', () => {
if (route.type !== 'page') throw new Error('unknown route type')
await route.htmlEndpoint.writeToDisk()
const result = await project.hmrIdentifiersSubscribe().next()
const result = await project.clientHmrIdentifiersSubscribe().next()
expect(result.done).toBe(false)
const identifiers = result.value.identifiers
const subscriptions = identifiers.map((identifier) =>
project.hmrEvents(identifier)
project.clientHmrEvents(identifier)
)
await Promise.all(
subscriptions.map(async (subscription) => {
......
......@@ -21,3 +21,9 @@ let DEV_BACKEND: DevRuntimeBackend
function _eval(_: EcmascriptModuleEntry) {
throw new Error('HMR evaluation is not implemented on this backend')
}
function __turbopack_server_hmr_apply__(_update: any): boolean {
throw new Error('Server-side HMR is not implemented for edge runtime')
}
globalThis.__turbopack_server_hmr_apply__ = __turbopack_server_hmr_apply__
......@@ -313,6 +313,14 @@ function isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {
return regexJsUrl.test(chunkUrlOrPath)
}
function __turbopack_server_hmr_apply__(_update: any): boolean {
// TODO: Implement actual HMR logic to update module factories
// For now, just return true to indicate we "accepted" the update
return true
}
globalThis.__turbopack_server_hmr_apply__ = __turbopack_server_hmr_apply__
module.exports = (sourcePath: ChunkPath) => ({
m: (id: ModuleId) => getOrInstantiateRuntimeModule(sourcePath, id),
c: (chunkData: ChunkData) => loadRuntimeChunk(sourcePath, chunkData),
......
......@@ -792,6 +792,12 @@ const regexJsUrl = /\.js(?:\?[^#]*)?(?:#.*)?$/;
*/ function isJs(chunkUrlOrPath) {
return regexJsUrl.test(chunkUrlOrPath);
}
function __turbopack_server_hmr_apply__(_update) {
// TODO: Implement actual HMR logic to update module factories
// For now, just return true to indicate we "accepted" the update
return true;
}
globalThis.__turbopack_server_hmr_apply__ = __turbopack_server_hmr_apply__;
module.exports = (sourcePath)=>({
m: (id)=>getOrInstantiateRuntimeModule(sourcePath, id),
c: (chunkData)=>loadRuntimeChunk(sourcePath, chunkData)
......
......@@ -6,5 +6,5 @@
{"offset": {"line": 504, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/base-externals-utils.ts"],"sourcesContent":["/// <reference path=\"../shared/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,mDAAmD;AAEnD,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": 545, "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"],"names":["path","require","relativePathToRuntimeRoot","relative","RUNTIME_PUBLIC_PATH","relativePathToDistRoot","join","RELATIVE_ROOT_PATH","RUNTIME_ROOT","resolve","__filename","ABSOLUTE_ROOT","resolveAbsolutePath","modulePath","Context","prototype","P"],"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","ignoreList":[0]}},
{"offset": {"line": 566, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/node-wasm-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"../shared/runtime-utils.ts\" />\n\nfunction readWebAssemblyAsResponse(path: string) {\n const { createReadStream } = require('fs') as typeof import('fs')\n const { Readable } = require('stream') as typeof import('stream')\n\n const stream = createReadStream(path)\n\n // @ts-ignore unfortunately there's a slight type mismatch with the stream.\n return new Response(Readable.toWeb(stream), {\n headers: {\n 'content-type': 'application/wasm',\n },\n })\n}\n\nasync function compileWebAssemblyFromPath(\n path: string\n): Promise<WebAssembly.Module> {\n const response = readWebAssemblyAsResponse(path)\n\n return await WebAssembly.compileStreaming(response)\n}\n\nasync function instantiateWebAssemblyFromPath(\n path: string,\n importsObj: WebAssembly.Imports\n): Promise<Exports> {\n const response = readWebAssemblyAsResponse(path)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n response,\n importsObj\n )\n\n return instance.exports\n}\n"],"names":["readWebAssemblyAsResponse","path","createReadStream","require","Readable","stream","Response","toWeb","headers","compileWebAssemblyFromPath","response","WebAssembly","compileStreaming","instantiateWebAssemblyFromPath","importsObj","instance","instantiateStreaming","exports"],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AAEnD,SAASA,0BAA0BC,IAAY;IAC7C,MAAM,EAAEC,gBAAgB,EAAE,GAAGC,QAAQ;IACrC,MAAM,EAAEC,QAAQ,EAAE,GAAGD,QAAQ;IAE7B,MAAME,SAASH,iBAAiBD;IAEhC,2EAA2E;IAC3E,OAAO,IAAIK,SAASF,SAASG,KAAK,CAACF,SAAS;QAC1CG,SAAS;YACP,gBAAgB;QAClB;IACF;AACF;AAEA,eAAeC,2BACbR,IAAY;IAEZ,MAAMS,WAAWV,0BAA0BC;IAE3C,OAAO,MAAMU,YAAYC,gBAAgB,CAACF;AAC5C;AAEA,eAAeG,+BACbZ,IAAY,EACZa,UAA+B;IAE/B,MAAMJ,WAAWV,0BAA0BC;IAE3C,MAAM,EAAEc,QAAQ,EAAE,GAAG,MAAMJ,YAAYK,oBAAoB,CACzDN,UACAI;IAGF,OAAOC,SAASE,OAAO;AACzB","ignoreList":[0]}},
{"offset": {"line": 587, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"../shared/runtime-utils.ts\" />\n/// <reference path=\"../shared-node/base-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-wasm-utils.ts\" />\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\ntype SourceData = ChunkPath | ModuleId\n\nprocess.env.TURBOPACK = '1'\n\ninterface TurbopackNodeBuildContext extends TurbopackBaseContext<Module> {\n R: ResolvePathFromModule\n x: ExternalRequire\n y: ExternalImport\n q: ExportUrl\n}\n\nconst nodeContextPrototype = Context.prototype as TurbopackNodeBuildContext\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackNodeBuildContext\n) => unknown\n\nconst url = require('url') as typeof import('url')\n\nconst moduleFactories: ModuleFactories = new Map()\nnodeContextPrototype.M = moduleFactories\nconst moduleCache: ModuleCache<Module> = Object.create(null)\nnodeContextPrototype.c = moduleCache\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 = this.r(moduleId)\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}\nnodeContextPrototype.R = resolvePathFromModule\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}\nnodeContextPrototype.q = exportUrl\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}\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, moduleFactories)\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(\n this: TurbopackBaseContext<Module>,\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, moduleFactories)\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(\n this: TurbopackBaseContext<Module>,\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\nfunction loadWebAssembly(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n imports: WebAssembly.Imports\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return instantiateWebAssemblyFromPath(resolved, imports)\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return compileWebAssemblyFromPath(resolved)\n}\ncontextPrototype.u = loadWebAssemblyModule\n\nfunction getWorkerURL(\n _entrypoint: ChunkPath,\n _moduleChunks: ChunkPath[],\n _shared: boolean\n): URL {\n throw new Error('Worker urls are not implemented yet for Node.js')\n}\n\nnodeContextPrototype.b = getWorkerURL\n\nfunction instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\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 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 default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n throw new Error(\n `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available.`\n )\n }\n\n const module: Module = createModuleObject(id)\n const exports = module.exports\n moduleCache[id] = module\n\n const context = new (Context as any as ContextConstructor<Module>)(\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.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: Module\n): Module {\n const module = moduleCache[id]\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\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): Module {\n const module = moduleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateRuntimeModule(chunkPath, moduleId)\n}\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\nmodule.exports = (sourcePath: ChunkPath) => ({\n m: (id: ModuleId) => getOrInstantiateRuntimeModule(sourcePath, id),\n c: (chunkData: ChunkData) => loadRuntimeChunk(sourcePath, chunkData),\n})\n"],"names":["SourceType","process","env","TURBOPACK","nodeContextPrototype","Context","prototype","url","require","moduleFactories","Map","M","moduleCache","Object","create","c","resolvePathFromModule","moduleId","exported","r","exportedPath","default","strippedAssetPrefix","slice","ASSET_PREFIX","length","resolved","path","resolve","RUNTIME_ROOT","pathToFileURL","href","R","exportUrl","urlValue","id","exportValue","call","q","loadRuntimeChunk","sourcePath","chunkData","loadRuntimeChunkPath","loadedChunks","Set","unsupportedLoadChunk","Promise","undefined","loadedChunk","chunkCache","clearChunkCache","clear","chunkPath","isJs","has","chunkModules","installCompressedModuleFactories","add","cause","errorMessage","error","Error","name","loadChunkAsync","entry","get","m","reject","set","contextPrototype","l","loadChunkAsyncByUrl","chunkUrl","path1","fileURLToPath","URL","L","loadWebAssembly","_edgeModule","imports","instantiateWebAssemblyFromPath","w","loadWebAssemblyModule","compileWebAssemblyFromPath","u","getWorkerURL","_entrypoint","_moduleChunks","_shared","b","instantiateModule","sourceType","sourceData","moduleFactory","instantiationReason","invariant","module1","createModuleObject","exports","context","loaded","namespaceObject","interopEsm","getOrInstantiateModuleFromParent","sourceModule","instantiateRuntimeModule","getOrInstantiateRuntimeModule","regexJsUrl","chunkUrlOrPath","test","module"],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AACnD,+DAA+D;AAC/D,+DAA+D;AAC/D,0DAA0D;AAE1D,IAAA,AAAKA,oCAAAA;IACH;;;;GAIC;IAED;;;GAGC;WAVEA;EAAAA;AAgBLC,QAAQC,GAAG,CAACC,SAAS,G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ources":["turbopack:///[turbopack]/nodejs/runtime.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"../shared/runtime-utils.ts\" />\n/// <reference path=\"../shared-node/base-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-wasm-utils.ts\" />\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\ntype SourceData = ChunkPath | ModuleId\n\nprocess.env.TURBOPACK = '1'\n\ninterface TurbopackNodeBuildContext extends TurbopackBaseContext<Module> {\n R: ResolvePathFromModule\n x: ExternalRequire\n y: ExternalImport\n q: ExportUrl\n}\n\nconst nodeContextPrototype = Context.prototype as TurbopackNodeBuildContext\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackNodeBuildContext\n) => unknown\n\nconst url = require('url') as typeof import('url')\n\nconst moduleFactories: ModuleFactories = new Map()\nnodeContextPrototype.M = moduleFactories\nconst moduleCache: ModuleCache<Module> = Object.create(null)\nnodeContextPrototype.c = moduleCache\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 = this.r(moduleId)\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}\nnodeContextPrototype.R = resolvePathFromModule\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}\nnodeContextPrototype.q = exportUrl\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}\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, moduleFactories)\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(\n this: TurbopackBaseContext<Module>,\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, moduleFactories)\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(\n this: TurbopackBaseContext<Module>,\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\nfunction loadWebAssembly(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n imports: WebAssembly.Imports\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return instantiateWebAssemblyFromPath(resolved, imports)\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return compileWebAssemblyFromPath(resolved)\n}\ncontextPrototype.u = loadWebAssemblyModule\n\nfunction getWorkerURL(\n _entrypoint: ChunkPath,\n _moduleChunks: ChunkPath[],\n _shared: boolean\n): URL {\n throw new Error('Worker urls are not implemented yet for Node.js')\n}\n\nnodeContextPrototype.b = getWorkerURL\n\nfunction instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\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 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 default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n throw new Error(\n `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available.`\n )\n }\n\n const module: Module = createModuleObject(id)\n const exports = module.exports\n moduleCache[id] = module\n\n const context = new (Context as any as ContextConstructor<Module>)(\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.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: Module\n): Module {\n const module = moduleCache[id]\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\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): Module {\n const module = moduleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateRuntimeModule(chunkPath, moduleId)\n}\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\nfunction __turbopack_server_hmr_apply__(_update: any): boolean {\n // TODO: Implement actual HMR logic to update module factories\n // For now, just return true to indicate we \"accepted\" the update\n return true\n}\n\nglobalThis.__turbopack_server_hmr_apply__ = __turbopack_server_hmr_apply__\n\nmodule.exports = (sourcePath: ChunkPath) => ({\n m: (id: ModuleId) => getOrInstantiateRuntimeModule(sourcePath, id),\n c: (chunkData: ChunkData) => loadRuntimeChunk(sourcePath, chunkData),\n})\n"],"names":["SourceType","process","env","TURBOPACK","nodeContextPrototype","Context","prototype","url","require","moduleFactories","Map","M","moduleCache","Object","create","c","resolvePathFromModule","moduleId","exported","r","exportedPath","default","strippedAssetPrefix","slice","ASSET_PREFIX","length","resolved","path","resolve","RUNTIME_ROOT","pathToFileURL","href","R","exportUrl","urlValue","id","exportValue","call","q","loadRuntimeChunk","sourcePath","chunkData","loadRuntimeChunkPath","loadedChunks","Set","unsupportedLoadChunk","Promise","undefined","loadedChunk","chunkCache","clearChunkCache","clear","chunkPath","isJs","has","chunkModules","installCompressedModuleFactories","add","cause","errorMessage","error","Error","name","loadChunkAsync","entry","get","m","reject","set","contextPrototype","l","loadChunkAsyncByUrl","chunkUrl","path1","fileURLToPath","URL","L","loadWebAssembly","_edgeModule","imports","instantiateWebAssemblyFromPath","w","loadWebAssemblyModule","compileWebAssemblyFromPath","u","getWorkerURL","_entrypoint","_moduleChunks","_shared","b","instantiateModule","sourceType","sourceData","moduleFactory","instantiationReason","invariant","module1","createModuleObject","exports","context","loaded","namespaceObject","interopEsm","getOrInstantiateModuleFromParent","sourceModule","instantiateRuntimeModule","getOrInstantiateRuntimeModule","regexJsUrl","chunkUrlOrPath","test","__turbopack_server_hmr_apply__","_update","globalThis","module"],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AACnD,+DAA+D;AAC/D,+DAA+D;AAC/D,0DAA0D;AAE1D,IAAA,AAAKA,oCAAAA;IACH;;;;GAIC;IAED;;;GAGC;WAVEA;EAAAA;AAgBLC,QAAQC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lE,YAAYL;QAC/DpB,GAAG,CAAC0B,YAAyBF,iBAAiBC,YAAYC;IAC5D,CAAC","ignoreList":[0]}}]
}
\ No newline at end of file
......@@ -792,6 +792,12 @@ const regexJsUrl = /\.js(?:\?[^#]*)?(?:#.*)?$/;
*/ function isJs(chunkUrlOrPath) {
return regexJsUrl.test(chunkUrlOrPath);
}
function __turbopack_server_hmr_apply__(_update) {
// TODO: Implement actual HMR logic to update module factories
// For now, just return true to indicate we "accepted" the update
return true;
}
globalThis.__turbopack_server_hmr_apply__ = __turbopack_server_hmr_apply__;
module.exports = (sourcePath)=>({
m: (id)=>getOrInstantiateRuntimeModule(sourcePath, id),
c: (chunkData)=>loadRuntimeChunk(sourcePath, chunkData)
......
......@@ -6,5 +6,5 @@
{"offset": {"line": 504, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/base-externals-utils.ts"],"sourcesContent":["/// <reference path=\"../shared/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,mDAAmD;AAEnD,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": 545, "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"],"names":["path","require","relativePathToRuntimeRoot","relative","RUNTIME_PUBLIC_PATH","relativePathToDistRoot","join","RELATIVE_ROOT_PATH","RUNTIME_ROOT","resolve","__filename","ABSOLUTE_ROOT","resolveAbsolutePath","modulePath","Context","prototype","P"],"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","ignoreList":[0]}},
{"offset": {"line": 566, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/node-wasm-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"../shared/runtime-utils.ts\" />\n\nfunction readWebAssemblyAsResponse(path: string) {\n const { createReadStream } = require('fs') as typeof import('fs')\n const { Readable } = require('stream') as typeof import('stream')\n\n const stream = createReadStream(path)\n\n // @ts-ignore unfortunately there's a slight type mismatch with the stream.\n return new Response(Readable.toWeb(stream), {\n headers: {\n 'content-type': 'application/wasm',\n },\n })\n}\n\nasync function compileWebAssemblyFromPath(\n path: string\n): Promise<WebAssembly.Module> {\n const response = readWebAssemblyAsResponse(path)\n\n return await WebAssembly.compileStreaming(response)\n}\n\nasync function instantiateWebAssemblyFromPath(\n path: string,\n importsObj: WebAssembly.Imports\n): Promise<Exports> {\n const response = readWebAssemblyAsResponse(path)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n response,\n importsObj\n )\n\n return instance.exports\n}\n"],"names":["readWebAssemblyAsResponse","path","createReadStream","require","Readable","stream","Response","toWeb","headers","compileWebAssemblyFromPath","response","WebAssembly","compileStreaming","instantiateWebAssemblyFromPath","importsObj","instance","instantiateStreaming","exports"],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AAEnD,SAASA,0BAA0BC,IAAY;IAC7C,MAAM,EAAEC,gBAAgB,EAAE,GAAGC,QAAQ;IACrC,MAAM,EAAEC,QAAQ,EAAE,GAAGD,QAAQ;IAE7B,MAAME,SAASH,iBAAiBD;IAEhC,2EAA2E;IAC3E,OAAO,IAAIK,SAASF,SAASG,KAAK,CAACF,SAAS;QAC1CG,SAAS;YACP,gBAAgB;QAClB;IACF;AACF;AAEA,eAAeC,2BACbR,IAAY;IAEZ,MAAMS,WAAWV,0BAA0BC;IAE3C,OAAO,MAAMU,YAAYC,gBAAgB,CAACF;AAC5C;AAEA,eAAeG,+BACbZ,IAAY,EACZa,UAA+B;IAE/B,MAAMJ,WAAWV,0BAA0BC;IAE3C,MAAM,EAAEc,QAAQ,EAAE,GAAG,MAAMJ,YAAYK,oBAAoB,CACzDN,UACAI;IAGF,OAAOC,SAASE,OAAO;AACzB","ignoreList":[0]}},
{"offset": {"line": 587, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"../shared/runtime-utils.ts\" />\n/// <reference path=\"../shared-node/base-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-wasm-utils.ts\" />\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\ntype SourceData = ChunkPath | ModuleId\n\nprocess.env.TURBOPACK = '1'\n\ninterface TurbopackNodeBuildContext extends TurbopackBaseContext<Module> {\n R: ResolvePathFromModule\n x: ExternalRequire\n y: ExternalImport\n q: ExportUrl\n}\n\nconst nodeContextPrototype = Context.prototype as TurbopackNodeBuildContext\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackNodeBuildContext\n) => unknown\n\nconst url = require('url') as typeof import('url')\n\nconst moduleFactories: ModuleFactories = new Map()\nnodeContextPrototype.M = moduleFactories\nconst moduleCache: ModuleCache<Module> = Object.create(null)\nnodeContextPrototype.c = moduleCache\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 = this.r(moduleId)\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}\nnodeContextPrototype.R = resolvePathFromModule\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}\nnodeContextPrototype.q = exportUrl\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}\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, moduleFactories)\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(\n this: TurbopackBaseContext<Module>,\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, moduleFactories)\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(\n this: TurbopackBaseContext<Module>,\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\nfunction loadWebAssembly(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n imports: WebAssembly.Imports\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return instantiateWebAssemblyFromPath(resolved, imports)\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return compileWebAssemblyFromPath(resolved)\n}\ncontextPrototype.u = loadWebAssemblyModule\n\nfunction getWorkerURL(\n _entrypoint: ChunkPath,\n _moduleChunks: ChunkPath[],\n _shared: boolean\n): URL {\n throw new Error('Worker urls are not implemented yet for Node.js')\n}\n\nnodeContextPrototype.b = getWorkerURL\n\nfunction instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\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 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 default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n throw new Error(\n `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available.`\n )\n }\n\n const module: Module = createModuleObject(id)\n const exports = module.exports\n moduleCache[id] = module\n\n const context = new (Context as any as ContextConstructor<Module>)(\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.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: Module\n): Module {\n const module = moduleCache[id]\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\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): Module {\n const module = moduleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateRuntimeModule(chunkPath, moduleId)\n}\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\nmodule.exports = (sourcePath: ChunkPath) => ({\n m: (id: ModuleId) => getOrInstantiateRuntimeModule(sourcePath, id),\n c: (chunkData: ChunkData) => loadRuntimeChunk(sourcePath, chunkData),\n})\n"],"names":["SourceType","process","env","TURBOPACK","nodeContextPrototype","Context","prototype","url","require","moduleFactories","Map","M","moduleCache","Object","create","c","resolvePathFromModule","moduleId","exported","r","exportedPath","default","strippedAssetPrefix","slice","ASSET_PREFIX","length","resolved","path","resolve","RUNTIME_ROOT","pathToFileURL","href","R","exportUrl","urlValue","id","exportValue","call","q","loadRuntimeChunk","sourcePath","chunkData","loadRuntimeChunkPath","loadedChunks","Set","unsupportedLoadChunk","Promise","undefined","loadedChunk","chunkCache","clearChunkCache","clear","chunkPath","isJs","has","chunkModules","installCompressedModuleFactories","add","cause","errorMessage","error","Error","name","loadChunkAsync","entry","get","m","reject","set","contextPrototype","l","loadChunkAsyncByUrl","chunkUrl","path1","fileURLToPath","URL","L","loadWebAssembly","_edgeModule","imports","instantiateWebAssemblyFromPath","w","loadWebAssemblyModule","compileWebAssemblyFromPath","u","getWorkerURL","_entrypoint","_moduleChunks","_shared","b","instantiateModule","sourceType","sourceData","moduleFactory","instantiationReason","invariant","module1","createModuleObject","exports","context","loaded","namespaceObject","interopEsm","getOrInstantiateModuleFromParent","sourceModule","instantiateRuntimeModule","getOrInstantiateRuntimeModule","regex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AAEAE,OAAOZ,OAAO,GAAG,CAAC1D,aAA0B,CAAC;QAC3C0B,GAAG,CAAC/B,KAAiBuE,8BAA8BlE,YAAYL;QAC/DpB,GAAG,CAAC0B,YAAyBF,iBAAiBC,YAAYC;IAC5D,CAAC","ignoreList":[0]}}]
{"offset": {"line": 587, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// <reference path=\"../shared/runtime-utils.ts\" />\n/// <reference path=\"../shared-node/base-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-wasm-utils.ts\" />\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\ntype SourceData = ChunkPath | ModuleId\n\nprocess.env.TURBOPACK = '1'\n\ninterface TurbopackNodeBuildContext extends TurbopackBaseContext<Module> {\n R: ResolvePathFromModule\n x: ExternalRequire\n y: ExternalImport\n q: ExportUrl\n}\n\nconst nodeContextPrototype = Context.prototype as TurbopackNodeBuildContext\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackNodeBuildContext\n) => unknown\n\nconst url = require('url') as typeof import('url')\n\nconst moduleFactories: ModuleFactories = new Map()\nnodeContextPrototype.M = moduleFactories\nconst moduleCache: ModuleCache<Module> = Object.create(null)\nnodeContextPrototype.c = moduleCache\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 = this.r(moduleId)\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}\nnodeContextPrototype.R = resolvePathFromModule\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}\nnodeContextPrototype.q = exportUrl\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}\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, moduleFactories)\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(\n this: TurbopackBaseContext<Module>,\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, moduleFactories)\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(\n this: TurbopackBaseContext<Module>,\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\nfunction loadWebAssembly(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n imports: WebAssembly.Imports\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return instantiateWebAssemblyFromPath(resolved, imports)\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return compileWebAssemblyFromPath(resolved)\n}\ncontextPrototype.u = loadWebAssemblyModule\n\nfunction getWorkerURL(\n _entrypoint: ChunkPath,\n _moduleChunks: ChunkPath[],\n _shared: boolean\n): URL {\n throw new Error('Worker urls are not implemented yet for Node.js')\n}\n\nnodeContextPrototype.b = getWorkerURL\n\nfunction instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\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 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 default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n throw new Error(\n `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available.`\n )\n }\n\n const module: Module = createModuleObject(id)\n const exports = module.exports\n moduleCache[id] = module\n\n const context = new (Context as any as ContextConstructor<Module>)(\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.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: Module\n): Module {\n const module = moduleCache[id]\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\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): Module {\n const module = moduleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateRuntimeModule(chunkPath, moduleId)\n}\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\nfunction __turbopack_server_hmr_apply__(_update: any): boolean {\n // TODO: Implement actual HMR logic to update module factories\n // For now, just return true to indicate we \"accepted\" the update\n return true\n}\n\nglobalThis.__turbopack_server_hmr_apply__ = __turbopack_server_hmr_apply__\n\nmodule.exports = (sourcePath: ChunkPath) => ({\n m: (id: ModuleId) => getOrInstantiateRuntimeModule(sourcePath, id),\n c: (chunkData: ChunkData) => loadRuntimeChunk(sourcePath, chunkData),\n})\n"],"names":["SourceType","process","env","TURBOPACK","nodeContextPrototype","Context","prototype","url","require","moduleFactories","Map","M","moduleCache","Object","create","c","resolvePathFromModule","moduleId","exported","r","exportedPath","default","strippedAssetPrefix","slice","ASSET_PREFIX","length","resolved","path","resolve","RUNTIME_ROOT","pathToFileURL","href","R","exportUrl","urlValue","id","exportValue","call","q","loadRuntimeChunk","sourcePath","chunkData","loadRuntimeChunkPath","loadedChunks","Set","unsupportedLoadChunk","Promise","undefined","loadedChunk","chunkCache","clearChunkCache","clear","chunkPath","isJs","has","chunkModules","installCompressedModuleFactories","add","cause","errorMessage","error","Error","name","loadChunkAsync","entry","get","m","reject","set","contextPrototype","l","loadChunkAsyncByUrl","chunkUrl","path1","fileURLToPath","URL","L","loadWebAssembly","_edgeModule","imports","instantiateWebAssemblyFromPath","w","loadWebAssemblyModule","compileWebAssemblyFromPath","u","getWorkerURL","_entrypoint","_moduleChunks","_shared","b","instantiateModule","sourceType","sourceData","moduleFactory","instantiationReason","invariant","module1","createModuleObject","exports","context","loaded","namespaceObject","interopEsm","getOrInstantiateModuleFromParent","sourceModule","instantiateRuntimeModule","getOrInstantiateRuntimeModule","regexJsUrl","ch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E,IAAI,CAACD;AACzB;AAEA,SAASE,+BAA+BC,OAAY;IAClD,8DAA8D;IAC9D,iEAAiE;IACjE,OAAO;AACT;AAEAC,WAAWF,8BAA8B,GAAGA;AAE5CG,OAAOf,OAAO,GAAG,CAAC1D,aAA0B,CAAC;QAC3C0B,GAAG,CAAC/B,KAAiBuE,8BAA8BlE,YAAYL;QAC/DpB,GAAG,CAAC0B,YAAyBF,iBAAiBC,YAAYC;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