{"version":3,"sources":["../../../src/server/dev/dev-validation-worker.ts"],"sourcesContent":["import type { AppPageModule } from '../route-modules/app-page/module'\nimport type {\n  DevValidationWorkerMessage,\n  DevValidationWorkerResult,\n} from '../app-render/dev-validation-worker-globals'\nimport type { NodeJsPartialHmrUpdate } from '../../build/swc/types'\n\nimport '../require-hook'\nimport '../node-environment'\n\nimport { isAbsolute, relative } from 'path'\nimport { readFileSync, realpathSync } from 'fs'\nimport { fileURLToPath } from 'url'\nimport { installBindings } from '../../build/swc/install-bindings'\nimport { installCodeFrameSupport } from '../lib/install-code-frame'\nimport {\n  loadClientReferenceManifestForPage,\n  loadComponents,\n} from '../load-components'\nimport { setHttpClientAndAgentOptions } from '../setup-http-agent-env'\nimport { serializeValidationErrorsToFlight } from '../app-render/dev-validation-error-delivery'\nimport { formatValidationEvent } from '../app-render/dev-validation-events'\nimport { clearManifestCache } from '../load-manifest.external'\nimport { deleteCache } from './require-cache'\nimport {\n  getServerActionsManifest,\n  setManifestsSingleton,\n} from '../app-render/manifests-singleton'\nimport { setBundlerFindSourceMapImplementation } from '../patch-error-inspect'\nimport type { ModernSourceMapPayload } from '../lib/source-maps'\n\n/**\n * Resolves a chunk's source map by reading the `.map` file the bundler emitted\n * next to it, for chunks inside `distDir`.\n *\n * The main thread answers the same question through the Turbopack project\n * handle, which cannot cross a thread boundary. Reading from disk is\n * project-free and, more importantly, does not depend on the chunk having been\n * evaluated in this thread: Node.js caches source maps per isolate, and the\n * worker never renders server components, so it holds maps only for the chunks\n * `loadComponents` pulled in. Frames arriving in the transported payload can\n * point at any chunk the main render touched.\n *\n * Reading from disk covers the chunks, because the worker only runs under\n * Turbopack (see `next-dev-server.ts`), which writes a `.map` beside every one\n * of them. A module the server updated in place has no chunk of its own and is\n * covered instead by this thread applying the same update (see\n * `applyHmrUpdate`), which leaves its inline map in Node.js' cache here. Frames\n * from dependencies that are not bundled never reach this point, because\n * `filterStackFrameDEV` drops `node_modules` and `node:` frames; bundled\n * dependencies appear as chunks inside `distDir` like any other code.\n */\nfunction createDiskSourceMapLookup(\n  distDir: string\n): (sourceURL: string) => ModernSourceMapPayload | undefined {\n  // The frames carry resolved paths, so compare against the resolved `distDir`\n  // to keep the containment check meaningful when the project sits behind a\n  // symlink.\n  let canonicalDistDir = distDir\n  try {\n    canonicalDistDir = realpathSync(distDir)\n  } catch {}\n\n  const payloads = new Map<string, ModernSourceMapPayload | undefined>()\n\n  return function findSourceMapPayloadOnDisk(sourceURL) {\n    let chunkPath = sourceURL\n\n    if (chunkPath.startsWith('file://')) {\n      try {\n        chunkPath = fileURLToPath(chunkPath)\n      } catch {\n        return undefined\n      }\n    }\n\n    if (!isAbsolute(chunkPath)) {\n      // Not an emitted chunk, e.g. `<anonymous>`.\n      return undefined\n    }\n\n    const cached = payloads.get(chunkPath)\n    if (cached !== undefined || payloads.has(chunkPath)) {\n      return cached\n    }\n\n    let payload: ModernSourceMapPayload | undefined\n    const relativePath = relative(canonicalDistDir, chunkPath)\n\n    // Only chunks emitted into `distDir` have a source map to point at, and\n    // this keeps the lookup from reading arbitrary paths off disk.\n    if (!relativePath.startsWith('..') && !isAbsolute(relativePath)) {\n      try {\n        payload = JSON.parse(readFileSync(chunkPath + '.map', 'utf8'))\n      } catch {\n        payload = undefined\n      }\n    }\n\n    payloads.set(chunkPath, payload)\n\n    return payload\n  }\n}\n\n// Match the main dev server (`next-dev-server.ts`), which raises this so the\n// server captures deeper stacks. React's owner-stack capture during the\n// validation prerenders depends on it, so without it the worker's errors lose\n// their owner-stack source attribution.\ntry {\n  Error.stackTraceLimit = 50\n} catch {}\n\n// The lifecycle markers E2E tests read from the CLI. Emitted on the worker's\n// stdout (piped to the parent) so they interleave with the parent's captured\n// output the same way the in-process `runWithDevValidationLogging` markers do.\n// Gated on the same test env that path checks.\nconst isTestLoggingEnabled = !!(\n  process.env.__NEXT_TEST_MODE && process.env.NEXT_TEST_LOG_VALIDATION\n)\n\n/**\n * Adapts the pool's supersede flag into an `AbortSignal` the validation passes\n * check at their depth/yield boundaries. The pool shares an `Int32Array`-backed\n * `SharedArrayBuffer` whose first slot the main thread flips to non-zero (with\n * `Atomics.store` + `Atomics.notify`) when a newer navigation supersedes this\n * one. We wait for that notification with `Atomics.waitAsync`, which is\n * event-driven rather than polled. A validation that finishes without being\n * superseded calls `cleanup()`, which wakes our own still-pending wait so it\n * leaves no waiter (and no retained buffer) behind.\n */\nfunction createSupersedeSignal(abortBuffer: SharedArrayBuffer): {\n  signal: AbortSignal\n  cleanup: () => void\n} {\n  const controller = new AbortController()\n  const flag = new Int32Array(abortBuffer)\n\n  if (Atomics.load(flag, 0) !== 0) {\n    controller.abort()\n    return { signal: controller.signal, cleanup: () => {} }\n  }\n\n  let settled = false\n  const wait = Atomics.waitAsync(flag, 0, 0)\n  if (wait.async) {\n    wait.value.then(() => {\n      if (settled) {\n        return\n      }\n      settled = true\n      // Woken either by a real supersede or by `cleanup()`; only the former\n      // leaves the flag set.\n      if (Atomics.load(flag, 0) !== 0) {\n        controller.abort()\n      }\n    })\n  } else if (Atomics.load(flag, 0) !== 0) {\n    // The flag flipped between the load above and the wait.\n    controller.abort()\n  }\n\n  return {\n    signal: controller.signal,\n    cleanup: () => {\n      if (!settled) {\n        Atomics.notify(flag, 0)\n      }\n    },\n  }\n}\n\n/**\n * Waits out the test-only validation delay, resolving early if the render is\n * superseded. Mirrors the delay in `runWithDevValidationLogging` so scheduler\n * tests observe the same in-flight window on the worker path.\n */\nasync function applyTestValidationDelay(signal: AbortSignal): Promise<void> {\n  const delayMs = Number(process.env.NEXT_TEST_DEV_VALIDATION_DELAY_MS)\n  if (!Number.isFinite(delayMs) || delayMs <= 0 || signal.aborted) {\n    return\n  }\n\n  await new Promise<void>((resolve) => {\n    const finishDelay = () => {\n      clearTimeout(timeout)\n      signal.removeEventListener('abort', finishDelay)\n      resolve()\n    }\n    const timeout = setTimeout(finishDelay, delayMs)\n    signal.addEventListener('abort', finishDelay, { once: true })\n  })\n}\n\n/**\n * Registers the client reference manifests of the pages that supplied client\n * references to the render being validated, beyond the validated route's own\n * manifest. This thread has its own manifests singleton, which `loadComponents`\n * seeds with only the validated route, so without these the dev-only cross-page\n * lookup in `createProxiedClientReferenceManifest` has no other manifest to\n * search and decoding the transported payload fails. Usually a no-op, since the\n * main thread only records a page when React's I/O tracking actually carried a\n * reference across pages.\n */\nasync function registerAdditionalClientReferenceManifests(\n  distDir: string,\n  pages: string[]\n): Promise<void> {\n  if (pages.length === 0) {\n    return\n  }\n\n  // Set by `loadComponents`. One server actions manifest covers the whole app,\n  // so the pages registered here share the validated route's.\n  const serverActionsManifest = getServerActionsManifest()\n\n  await Promise.all(\n    pages.map(async (page) => {\n      const clientReferenceManifest = await loadClientReferenceManifestForPage(\n        distDir,\n        page\n      )\n\n      if (clientReferenceManifest) {\n        setManifestsSingleton({\n          page,\n          clientReferenceManifest,\n          serverActionsManifest,\n        })\n      }\n    })\n  )\n}\n\ndeclare const __turbopack_server_hmr_apply__:\n  | ((update: NodeJsPartialHmrUpdate) => void)\n  | undefined\n\n/**\n * What this thread did with a forwarded HMR update.\n *\n * `no-runtime` is not a failure: no runtime the update routes to had been\n * loaded here, so there was nothing to patch, and whatever loads that route\n * later reads the updated chunk from disk.\n */\nexport type HmrApplyOutcome = 'applied' | 'no-runtime' | 'failed'\n\n/**\n * Applies a server HMR update to this thread's module registry, mirroring the\n * apply the dev server performed on its own.\n *\n * Turbopack's Node.js runtime registers the apply machinery per isolate (see\n * `dev-nodejs.ts`), and `loadComponents` evaluates that runtime here, so this\n * thread patches the same modules the dev server does. The apply also leaves\n * the updated module's inline source map in this thread's Node.js cache, which\n * is what makes a stack frame in that module source-mappable here.\n */\nexport async function applyHmrUpdate(\n  update: NodeJsPartialHmrUpdate\n): Promise<HmrApplyOutcome> {\n  if (typeof __turbopack_server_hmr_apply__ !== 'function') {\n    return 'no-runtime'\n  }\n\n  try {\n    __turbopack_server_hmr_apply__(update)\n  } catch {\n    // The dev server responds to the same failure by re-evaluating every\n    // module from disk. This thread cannot be repaired in place either, so the\n    // caller drops it.\n    return 'failed'\n  }\n\n  return 'applied'\n}\n\n/**\n * Clears the same caches the dev server cleared, for the same paths.\n *\n * `evictModules` follows the dev server's own split: an applied update patches\n * modules in place and clears only the manifest cache for the updated chunks,\n * while a recompile evicts `require.cache` as well. This thread follows both,\n * so its module state stays the dev server's module state.\n */\nexport async function invalidateCaches(\n  filePaths: string[],\n  evictModules: boolean\n): Promise<void> {\n  if (evictModules) {\n    deleteCache(filePaths)\n    return\n  }\n\n  for (const filePath of filePaths) {\n    clearManifestCache(filePath)\n  }\n}\n\n/**\n * Runs the dev instant/static-shell validation passes off the main thread.\n * Reloads the route's compiled module, then delegates the whole validation to\n * that module via `ComponentMod.routeModule.runValidationInDev`, so every\n * render (flight re-encodes and client prerenders) runs inside the app-page\n * bundle's single React instance. Logs any returned errors to the worker's\n * stderr with source-mapped code frames, then encodes them as RSC Flight bytes\n * for the main thread to forward to the dev overlay. Returns `null` when\n * validation was superseded or produced no errors.\n */\nexport async function runDevValidation(\n  message: DevValidationWorkerMessage,\n  abortBuffer: SharedArrayBuffer\n): Promise<DevValidationWorkerResult> {\n  // Load the native SWC bindings and wire the code-frame renderer so the errors\n  // logged below render with a source-mapped code frame, matching the\n  // in-process dev output (the E2E tests snapshot the CLI text between the\n  // validation markers). The `build/swc` graph these pull in is bundled as a\n  // runtime external (see `next-runtime.webpack-config.js`), so it resolves\n  // from the installed `next/dist` tree rather than being compiled into this\n  // worker bundle, the same way the unbundled build worker loads it.\n  await installBindings()\n  installCodeFrameSupport()\n  setBundlerFindSourceMapImplementation(\n    createDiskSourceMapLookup(message.distDir)\n  )\n  setHttpClientAndAgentOptions({\n    httpAgentOptions: message.nextConfigSerializable.httpAgentOptions,\n  })\n\n  // Populates the manifests singleton for the route via `setManifestsSingleton`\n  // inside `loadComponents`, exactly as a real request does. The pool tears the\n  // worker down on HMR / route recompile so the next validation reloads from a\n  // clean require cache.\n  const { ComponentMod } = await loadComponents<AppPageModule>({\n    distDir: message.distDir,\n    page: message.page,\n    isAppPath: true,\n    isDev: true,\n    sriEnabled: false,\n    needsManifestsForLegacyReasons: true,\n  })\n\n  await registerAdditionalClientReferenceManifests(\n    message.distDir,\n    message.additionalClientReferenceManifestPages\n  )\n\n  const { signal, cleanup } = createSupersedeSignal(abortBuffer)\n\n  if (isTestLoggingEnabled) {\n    console.log(\n      formatValidationEvent({\n        type: 'validation_start',\n        requestId: message.requestId,\n        url: message.request.urlPathname + message.request.urlSearch,\n        responseFinished: message.responseFinished,\n      })\n    )\n  }\n\n  try {\n    if (isTestLoggingEnabled) {\n      await applyTestValidationDelay(signal)\n    }\n\n    if (signal.aborted) {\n      return null\n    }\n\n    // Crossing into the app-page bundle: the entire validation runs there, so\n    // the client prerenders use the same React the user's client components\n    // resolve through `ComponentMod`.\n    const validationErrors = await ComponentMod.routeModule.runValidationInDev(\n      ComponentMod,\n      message,\n      signal\n    )\n\n    if (validationErrors === undefined || signal.aborted) {\n      return null\n    }\n\n    const errors: Error[] = []\n    for (const validationError of validationErrors) {\n      // Log to the worker's stderr; `node-environment` +\n      // `installCodeFrameSupport` render the source-mapped stack and code frame\n      // there, matching the in-process CLI output.\n      console.error(validationError)\n      if (validationError instanceof Error) {\n        errors.push(validationError)\n      }\n    }\n\n    if (errors.length === 0) {\n      return null\n    }\n\n    return await serializeValidationErrorsToFlight(ComponentMod, errors)\n  } finally {\n    cleanup()\n    if (isTestLoggingEnabled) {\n      console.log(\n        formatValidationEvent({\n          type: signal.aborted ? 'validation_aborted' : 'validation_end',\n          requestId: message.requestId,\n          url: message.request.urlPathname + message.request.urlSearch,\n        })\n      )\n    }\n  }\n}\n"],"names":["applyHmrUpdate","invalidateCaches","runDevValidation","createDiskSourceMapLookup","distDir","canonicalDistDir","realpathSync","payloads","Map","findSourceMapPayloadOnDisk","sourceURL","chunkPath","startsWith","fileURLToPath","undefined","isAbsolute","cached","get","has","payload","relativePath","relative","JSON","parse","readFileSync","set","Error","stackTraceLimit","isTestLoggingEnabled","process","env","__NEXT_TEST_MODE","NEXT_TEST_LOG_VALIDATION","createSupersedeSignal","abortBuffer","controller","AbortController","flag","Int32Array","Atomics","load","abort","signal","cleanup","settled","wait","waitAsync","async","value","then","notify","applyTestValidationDelay","delayMs","Number","NEXT_TEST_DEV_VALIDATION_DELAY_MS","isFinite","aborted","Promise","resolve","finishDelay","clearTimeout","timeout","removeEventListener","setTimeout","addEventListener","once","registerAdditionalClientReferenceManifests","pages","length","serverActionsManifest","getServerActionsManifest","all","map","page","clientReferenceManifest","loadClientReferenceManifestForPage","setManifestsSingleton","update","__turbopack_server_hmr_apply__","filePaths","evictModules","deleteCache","filePath","clearManifestCache","message","installBindings","installCodeFrameSupport","setBundlerFindSourceMapImplementation","setHttpClientAndAgentOptions","httpAgentOptions","nextConfigSerializable","ComponentMod","loadComponents","isAppPath","isDev","sriEnabled","needsManifestsForLegacyReasons","additionalClientReferenceManifestPages","console","log","formatValidationEvent","type","requestId","url","request","urlPathname","urlSearch","responseFinished","validationErrors","routeModule","runValidationInDev","errors","validationError","error","push","serializeValidationErrorsToFlight"],"mappings":";;;;;;;;;;;;;;;;IAiQsBA,cAAc;eAAdA;;IA2BAC,gBAAgB;eAAhBA;;IAwBAC,gBAAgB;eAAhBA;;;QA7Sf;QACA;sBAE8B;oBACM;qBACb;iCACE;kCACQ;gCAIjC;mCACsC;4CACK;qCACZ;sCACH;8BACP;oCAIrB;mCAC+C;AAGtD;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,SAASC,0BACPC,OAAe;IAEf,6EAA6E;IAC7E,0EAA0E;IAC1E,WAAW;IACX,IAAIC,mBAAmBD;IACvB,IAAI;QACFC,mBAAmBC,IAAAA,gBAAY,EAACF;IAClC,EAAE,OAAM,CAAC;IAET,MAAMG,WAAW,IAAIC;IAErB,OAAO,SAASC,2BAA2BC,SAAS;QAClD,IAAIC,YAAYD;QAEhB,IAAIC,UAAUC,UAAU,CAAC,YAAY;YACnC,IAAI;gBACFD,YAAYE,IA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