{"version":3,"sources":["../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["// Import cpu-profile first to start profiling early if enabled\nimport { saveCpuProfile } from '../../server/lib/cpu-profile'\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, getBindingsSync } from '../swc'\nimport { installBindings } from '../swc/install-bindings'\nimport {\n  handleRouteType,\n  rawEntrypointsToEntrypoints,\n} from '../handle-entrypoints'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport {\n  setGlobal,\n  trace,\n  initializeTraceState,\n  getTraceEvents,\n} from '../../trace'\nimport type { TraceState } from '../../trace'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../get-supported-browsers'\nimport { printBuildErrors } from '../print-build-errors'\nimport { normalizePath } from '../../lib/normalize-path'\nimport type {\n  ProjectOptions,\n  RawEntrypoints,\n  TurbopackResult,\n} from '../swc/types'\nimport { Bundler } from '../../lib/bundler'\n\nexport async function turbopackBuild(): Promise<{\n  duration: number\n  buildTraceContext: undefined\n  shutdownPromise: Promise<void>\n}> {\n  await validateTurboNextConfig({\n    dir: NextBuildContext.dir!,\n    configPhase: PHASE_PRODUCTION_BUILD,\n  })\n\n  const config = NextBuildContext.config!\n  const dir = NextBuildContext.dir!\n  const distDir = NextBuildContext.distDir!\n  const buildId = NextBuildContext.buildId!\n  const encryptionKey = NextBuildContext.encryptionKey!\n  const previewProps = NextBuildContext.previewProps!\n  const hasRewrites = NextBuildContext.hasRewrites!\n  const rewrites = NextBuildContext.rewrites!\n  const noMangling = NextBuildContext.noMangling!\n  const currentNodeJsVersion = process.versions.node\n\n  const startTime = process.hrtime()\n  const bindings = getBindingsSync() // our caller should have already loaded these\n\n  if (bindings.isWasm) {\n    throw new Error(\n      `Turbopack is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n        `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n        `To build on this platform, use Webpack instead:\\n` +\n        `  next build --webpack\\n\\n` +\n        `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n    )\n  }\n\n  const dev = false\n\n  const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n  const hasDeferredEntries =\n    (config.experimental.deferredEntries?.length ?? 0) > 0\n\n  const persistentCaching =\n    config.experimental?.turbopackFileSystemCacheForBuild || false\n  const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n\n  // Shared options for createProject calls\n  const sharedProjectOptions: Omit<ProjectOptions, 'debugBuildPaths'> = {\n    rootPath,\n    projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n    distDir,\n    nextConfig: config,\n    watch: {\n      enable: false,\n    },\n    dev,\n    env: process.env as Record<string, string>,\n    defineEnv: createDefineEnv({\n      isTurbopack: true,\n      clientRouterFilters: NextBuildContext.clientRouterFilters!,\n      config,\n      dev,\n      distDir,\n      projectPath: dir,\n      fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n      hasRewrites,\n      // Implemented separately in Turbopack, doesn't have to be passed here.\n      middlewareMatchers: undefined,\n      rewrites,\n    }),\n    buildId,\n    encryptionKey,\n    previewProps,\n    browserslistQuery: supportedBrowsers.join(', '),\n    noMangling,\n    writeRoutesHashesManifest:\n      !!process.env.NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST,\n    currentNodeJsVersion,\n    isPersistentCachingEnabled: persistentCaching,\n    deferredEntries: config.experimental.deferredEntries,\n    nextVersion: process.env.__NEXT_VERSION as string,\n  }\n\n  const sharedTurboOptions = {\n    memoryLimit: config.experimental?.turbopackMemoryLimit,\n    dependencyTracking: persistentCaching || hasDeferredEntries,\n    isCi: isCI,\n    isShortSession: true,\n  }\n\n  const sriEnabled = Boolean(config.experimental.sri?.algorithm)\n\n  const project = await bindings.turbo.createProject(\n    {\n      ...sharedProjectOptions,\n      debugBuildPaths: NextBuildContext.debugBuildPaths,\n    },\n    sharedTurboOptions,\n    hasDeferredEntries && config.experimental.onBeforeDeferredEntries\n      ? {\n          onBeforeDeferredEntries: async () => {\n            const workerConfig = await loadConfig(PHASE_PRODUCTION_BUILD, dir, {\n              debugPrerender: NextBuildContext.debugPrerender,\n              reactProductionProfiling:\n                NextBuildContext.reactProductionProfiling,\n              bundler: Bundler.Turbopack,\n            })\n\n            await workerConfig.experimental.onBeforeDeferredEntries?.()\n          },\n        }\n      : undefined\n  )\n  const buildEventsSpan = trace('turbopack-build-events')\n  // Stop immediately: this span is only used as a parent for\n  // manualTraceChild calls which carry their own timestamps.\n  buildEventsSpan.stop()\n  const shutdownController = new AbortController()\n  const compilationEvents = backgroundLogCompilationEvents(project, {\n    parentSpan: buildEventsSpan,\n    signal: shutdownController.signal,\n  })\n\n  try {\n    // Write an empty file in a known location to signal this was built with Turbopack\n    await fs.writeFile(path.join(distDir, 'turbopack'), '')\n\n    await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n    await fs.mkdir(path.join(distDir, 'static', buildId), {\n      recursive: true,\n    })\n    await fs.writeFile(\n      path.join(distDir, 'package.json'),\n      '{\"type\": \"commonjs\"}'\n    )\n\n    let appDirOnly = NextBuildContext.appDirOnly!\n\n    const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly)\n    printBuildErrors(entrypoints, dev)\n\n    const routes = entrypoints.routes\n    if (!routes) {\n      // This should never ever happen, there should be an error issue, or the bindings call should\n      // have thrown.\n      throw new Error(`Turbopack build failed`)\n    }\n\n    const hasPagesEntries = Array.from(routes.values()).some((route) => {\n      if (route.type === 'page' || route.type === 'page-api') {\n        return true\n      }\n      return false\n    })\n    // If there's no pages entries, then we are in app-dir-only mode\n    if (!hasPagesEntries) {\n      appDirOnly = true\n    }\n\n    const manifestLoader = new TurbopackManifestLoader({\n      buildId,\n      distDir,\n      encryptionKey,\n      dev: false,\n      sriEnabled,\n    })\n\n    const currentEntrypoints = await rawEntrypointsToEntrypoints(\n      entrypoints as TurbopackResult<RawEntrypoints>\n    )\n\n    const promises: Promise<void>[] = []\n\n    if (!appDirOnly) {\n      for (const [page, route] of currentEntrypoints.page) {\n        promises.push(\n          handleRouteType({\n            page,\n            route,\n            manifestLoader,\n          })\n        )\n      }\n    }\n\n    for (const [page, route] of currentEntrypoints.app) {\n      promises.push(\n        handleRouteType({\n          page,\n          route,\n          manifestLoader,\n        })\n      )\n    }\n\n    await Promise.all(promises)\n\n    await Promise.all([\n      // Only load pages router manifests if not app-only\n      ...(!appDirOnly\n        ? [\n            manifestLoader.loadBuildManifest('_app'),\n            manifestLoader.loadPagesManifest('_app'),\n            manifestLoader.loadFontManifest('_app'),\n            manifestLoader.loadPagesManifest('_document'),\n            manifestLoader.loadClientBuildManifest('_error'),\n            manifestLoader.loadBuildManifest('_error'),\n            manifestLoader.loadPagesManifest('_error'),\n            manifestLoader.loadFontManifest('_error'),\n          ]\n        : []),\n      entrypoints.instrumentation &&\n        manifestLoader.loadMiddlewareManifest(\n          'instrumentation',\n          'instrumentation'\n        ),\n      entrypoints.middleware &&\n        (await manifestLoader.loadMiddlewareManifest(\n          'middleware',\n          'middleware'\n        )),\n    ])\n\n    manifestLoader.writeManifests({\n      devRewrites: undefined,\n      productionRewrites: rewrites,\n      entrypoints: currentEntrypoints,\n    })\n\n    if (NextBuildContext.analyze) {\n      await project.writeAnalyzeData(appDirOnly)\n    }\n\n    // Shutdown may trigger final compilation events (e.g. persistence,\n    // compaction trace spans).  This is the last chance to capture them.\n    // After shutdown resolves we abort the signal to close the iterator\n    // and drain any remaining buffered events.\n    const shutdownPromise = project.shutdown().then(() => {\n      shutdownController.abort()\n      return compilationEvents.catch(() => {})\n    })\n\n    const time = process.hrtime(startTime)\n    return {\n      duration: time[0] + time[1] / 1e9,\n      buildTraceContext: undefined,\n      shutdownPromise,\n    }\n  } catch (err) {\n    await project.shutdown()\n    shutdownController.abort()\n    await compilationEvents.catch(() => {})\n    throw err\n  }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n  buildContext: typeof NextBuildContext\n  traceState: TraceState & { shouldSaveTraceEvents: boolean }\n}): Promise<\n  Omit<Awaited<ReturnType<typeof turbopackBuild>>, 'shutdownPromise'>\n> {\n  // setup new build context from the serialized data passed from the parent\n  Object.assign(NextBuildContext, workerData.buildContext)\n  initializeTraceState(workerData.traceState)\n\n  /// load the config because it's not serializable\n  const config = await loadConfig(\n    PHASE_PRODUCTION_BUILD,\n    NextBuildContext.dir!,\n    {\n      debugPrerender: NextBuildContext.debugPrerender,\n      reactProductionProfiling: NextBuildContext.reactProductionProfiling,\n      bundler: Bundler.Turbopack,\n    }\n  )\n  NextBuildContext.config = config\n  // Matches handling in build/index.ts\n  // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n  // Ensures the `config.distDir` option is matched.\n  if (hasCustomExportOutput(NextBuildContext.config)) {\n    NextBuildContext.config.distDir = '.next'\n  }\n\n  // Clone the telemetry for worker\n  const telemetry = new Telemetry({\n    distDir: NextBuildContext.config.distDir,\n  })\n  setGlobal('telemetry', telemetry)\n  // Install bindings early so we can access synchronously later\n  await installBindings(config.experimental?.useWasmBinary)\n\n  try {\n    const {\n      shutdownPromise: resultShutdownPromise,\n      buildTraceContext,\n      duration,\n    } = await turbopackBuild()\n    shutdownPromise = resultShutdownPromise\n    return {\n      buildTraceContext,\n      duration,\n    }\n  } finally {\n    // Always flush telemetry before worker exits (waits for async operations like setTimeout in debug mode)\n    await telemetry.flush()\n    // Save CPU profile before worker exits\n    await saveCpuProfile()\n  }\n}\n\nexport async function waitForShutdown(): Promise<{\n  debugTraceEvents?: ReturnType<typeof getTraceEvents>\n}> {\n  if (shutdownPromise) {\n    await shutdownPromise\n  }\n  // Collect trace events after shutdown completes so that all compilation\n  // events (e.g. persistence trace spans) have been processed.\n  return { debugTraceEvents: getTraceEvents() }\n}\n"],"names":["turbopackBuild","waitForShutdown","workerMain","config","validateTurboNextConfig","dir","NextBuildContext","configPhase","PHASE_PRODUCTION_BUILD","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","getBindingsSync","isWasm","Error","platform","arch","dev","supportedBrowsers","getSupportedBrowsers","hasDeferredEntries","experimental","deferredEntries","length","persistentCaching","turbopackFileSystemCacheForBuild","rootPath","turbopack","root","outputFileTracingRoot","sharedProjectOptions","projectPath","normalizePath","path","relative","nextConfig","watch","enable","env","defineEnv","createDefineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","middlewareMatchers","undefined","browserslistQuery","join","writeRoutesHashesManifest","NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","sharedTurboOptions","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isCI","isShortSession","sriEnabled","Boolean","sri","algorithm","project","turbo","createProject","debugBuildPaths","onBeforeDeferredEntries","workerConfig","loadConfig","debugPrerender","reactProductionProfiling","bundler","Bundler","Turbopack","buildEventsSpan","trace","stop","shutdownController","AbortController","compilationEvents","backgroundLogCompilationEvents","parentSpan","signal","fs","writeFile","mkdir","recursive","appDirOnly","entrypoints","writeAllEntrypointsToDisk","printBuildErrors","routes","hasPagesEntries","Array","from","values","some","route","type","manifestLoader","TurbopackManifestLoader","currentEntrypoints","rawEntrypointsToEntrypoints","promises","page","push","handleRouteType","app","Promise","all","loadBuildManifest","loadPagesManifest","loadFontManifest","loadClientBuildManifest","instrumentation","loadMiddlewareManifest","middleware","writeManifests","devRewrites","productionRewrites","analyze","writeAnalyzeData","shutdownPromise","shutdown","then","abort","catch","time","duration","buildTraceContext","err","workerData","Object","assign","buildContext","initializeTraceState","traceState","hasCustomExportOutput","telemetry","Telemetry","setGlobal","installBindings","useWasmBinary","resultShutdownPromise","flush","saveCpuProfile","debugTraceEvents","getTraceEvents"],"mappings":"AAAA,+DAA+D;;;;;;;;;;;;;;;;;IAoCzCA,cAAc;eAAdA;;IAuTAC,eAAe;eAAfA;;IAvDAC,UAAU;eAAVA;;;4BAnSS;6DACd;kCACuB;8BACP;qBACgB;iCACjB;mCAIzB;gCACiC;oBACT;2BACQ;+DAChB;uBACe;yBACZ;uBAMnB;wBAEc;mCAC0B;sCACV;kCACJ;+BACH;yBAMN;;;;;;AAEjB,eAAeF;QAuCjBG,sCAGDA,sBACeA,mBAwCFA,uBAMYA;IApF3B,MAAMC,IAAAA,yCAAuB,EAAC;QAC5BC,KAAKC,8BAAgB,CAACD,GAAG;QACzBE,aAAaC,iCAAsB;IACrC;IAEA,MAAML,SAASG,8BAAgB,CAACH,MAAM;IACtC,MAAME,MAAMC,8BAAgB,CAACD,GAAG;IAChC,MAAMI,UAAUH,8BAAgB,CAACG,OAAO;IACxC,MAAMC,UAAUJ,8BAAgB,CAACI,OAAO;IACxC,MAAMC,gBAAgBL,8BAAgB,CAACK,aAAa;IACpD,MAAMC,eAAeN,8BAAgB,CAACM,YAAY;IAClD,MAAMC,cAAcP,8BAAgB,CAACO,WAAW;IAChD,MAAMC,WAAWR,8BAAgB,CAACQ,QAAQ;IAC1C,MAAMC,aAAaT,8BAAgB,CAACS,UAAU;IAC9C,MAAMC,uBAAuBC,QAAQC,QAAQ,CAACC,IAAI;IAElD,MAAMC,YAAYH,QAAQI,MAAM;IAChC,MAAMC,WAAWC,IAAAA,oBAAe,IAAG,8CAA8C;;IAEjF,IAAID,SAASE,MAAM,EAAE;QACnB,MAAM,qBAML,CANK,IAAIC,MACR,CAAC,6CAA6C,EAAER,QAAQS,QAAQ,CAAC,CAAC,EAAET,QAAQU,IAAI,CAAC,6CAA6C,CAAC,GAC7H,CAAC,y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