{"version":3,"sources":["../../../src/build/webpack-build/impl.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { stringBufferUtils } from 'next/dist/compiled/webpack-sources3'\nimport { red } from '../../lib/picocolors'\nimport formatWebpackMessages from '../../shared/lib/format-webpack-messages'\nimport { nonNullable } from '../../lib/non-nullable'\nimport type { COMPILER_INDEXES } from '../../shared/lib/constants'\nimport {\n  COMPILER_NAMES,\n  CLIENT_STATIC_FILES_RUNTIME_MAIN_APP,\n  APP_CLIENT_INTERNALS,\n  PHASE_PRODUCTION_BUILD,\n} from '../../shared/lib/constants'\nimport { runCompiler } from '../compiler'\nimport * as Log from '../output/log'\nimport getBaseWebpackConfig, { loadProjectInfo } from '../webpack-config'\nimport type { NextError } from '../../lib/is-error'\nimport {\n  TelemetryPlugin,\n  type TelemetryPluginState,\n} from '../webpack/plugins/telemetry-plugin/telemetry-plugin'\nimport {\n  NextBuildContext,\n  resumePluginState,\n  getPluginState,\n} from '../build-context'\nimport { createEntrypoints } from '../entries'\nimport loadConfig from '../../server/config'\nimport {\n  getTraceEvents,\n  initializeTraceState,\n  setGlobal,\n  trace,\n  type TraceEvent,\n  type TraceState,\n} from '../../trace'\nimport { WEBPACK_LAYERS } from '../../lib/constants'\nimport { TraceEntryPointsPlugin } from '../webpack/plugins/next-trace-entrypoints-plugin'\nimport type { BuildTraceContext } from '../webpack/plugins/next-trace-entrypoints-plugin'\nimport type { UnwrapPromise } from '../../lib/coalesced-function'\n\nimport origDebug from 'next/dist/compiled/debug'\nimport { Telemetry } from '../../telemetry/storage'\nimport { durationToString } from '../duration-to-string'\n\nconst debug = origDebug('next:build:webpack-build')\n\nfunction hrtimeToSeconds(hrtime: [number, number]): number {\n  // hrtime is a tuple of [seconds, nanoseconds]\n  return hrtime[0] + hrtime[1] / 1e9\n}\n\ntype CompilerResult = {\n  errors: webpack.StatsError[]\n  warnings: webpack.StatsError[]\n  stats: (webpack.Stats | undefined)[]\n}\n\ntype SingleCompilerResult = {\n  errors: webpack.StatsError[]\n  warnings: webpack.StatsError[]\n  stats: webpack.Stats | undefined\n}\n\nfunction isTelemetryPlugin(plugin: unknown): plugin is TelemetryPlugin {\n  return plugin instanceof TelemetryPlugin\n}\n\nfunction isTraceEntryPointsPlugin(\n  plugin: unknown\n): plugin is TraceEntryPointsPlugin {\n  return plugin instanceof TraceEntryPointsPlugin\n}\n\nexport async function webpackBuildImpl(\n  compilerName: keyof typeof COMPILER_INDEXES | null\n): Promise<{\n  duration: number\n  pluginState: any\n  buildTraceContext?: BuildTraceContext\n  telemetryState?: TelemetryPluginState\n}> {\n  let result: CompilerResult | null = {\n    warnings: [],\n    errors: [],\n    stats: [],\n  }\n  let webpackBuildStart\n  const nextBuildSpan = NextBuildContext.nextBuildSpan!\n  const dir = NextBuildContext.dir!\n  const config = NextBuildContext.config!\n  process.env.NEXT_COMPILER_NAME = compilerName || 'server'\n\n  const runWebpackSpan = nextBuildSpan.traceChild('run-webpack-compiler')\n  const entrypoints = await nextBuildSpan\n    .traceChild('create-entrypoints')\n    .traceAsyncFn(() =>\n      createEntrypoints({\n        buildId: NextBuildContext.buildId!,\n        config: config,\n        envFiles: NextBuildContext.loadedEnvFiles!,\n        isDev: false,\n        rootDir: dir,\n        pageExtensions: config.pageExtensions!,\n        pagesDir: NextBuildContext.pagesDir!,\n        appDir: NextBuildContext.appDir!,\n        pages: NextBuildContext.mappedPages!,\n        appPaths: NextBuildContext.mappedAppPages!,\n        previewMode: NextBuildContext.previewProps!,\n        rootPaths: NextBuildContext.mappedRootPaths!,\n        hasInstrumentationHook: NextBuildContext.hasInstrumentationHook!,\n      })\n    )\n\n  const commonWebpackOptions = {\n    isServer: false,\n    isCompileMode: NextBuildContext.isCompileMode,\n    buildId: NextBuildContext.buildId!,\n    encryptionKey: NextBuildContext.encryptionKey!,\n    config: config,\n    appDir: NextBuildContext.appDir!,\n    pagesDir: NextBuildContext.pagesDir!,\n    rewrites: NextBuildContext.rewrites!,\n    originalRewrites: NextBuildContext.originalRewrites,\n    originalRedirects: NextBuildContext.originalRedirects,\n    reactProductionProfiling: NextBuildContext.reactProductionProfiling!,\n    noMangling: NextBuildContext.noMangling!,\n    clientRouterFilters: NextBuildContext.clientRouterFilters!,\n    previewProps: NextBuildContext.previewProps!,\n    allowedRevalidateHeaderKeys: NextBuildContext.allowedRevalidateHeaderKeys!,\n    fetchCacheKeyPrefix: NextBuildContext.fetchCacheKeyPrefix!,\n  }\n\n  const configs = await runWebpackSpan\n    .traceChild('generate-webpack-config')\n    .traceAsyncFn(async () => {\n      const info = await loadProjectInfo({\n        dir,\n        config: commonWebpackOptions.config,\n        dev: false,\n      })\n      return Promise.all([\n        getBaseWebpackConfig(dir, {\n          ...commonWebpackOptions,\n          middlewareMatchers: entrypoints.middlewareMatchers,\n          runWebpackSpan,\n          compilerType: COMPILER_NAMES.client,\n          entrypoints: entrypoints.client,\n          ...info,\n        }),\n        getBaseWebpackConfig(dir, {\n          ...commonWebpackOptions,\n          runWebpackSpan,\n          middlewareMatchers: entrypoints.middlewareMatchers,\n          compilerType: COMPILER_NAMES.server,\n          entrypoints: entrypoints.server,\n          ...info,\n        }),\n        getBaseWebpackConfig(dir, {\n          ...commonWebpackOptions,\n          runWebpackSpan,\n          middlewareMatchers: entrypoints.middlewareMatchers,\n          compilerType: COMPILER_NAMES.edgeServer,\n          entrypoints: entrypoints.edgeServer,\n          ...info,\n        }),\n      ])\n    })\n\n  const clientConfig = configs[0]\n  const serverConfig = configs[1]\n  const edgeConfig = configs[2]\n\n  if (\n    clientConfig.optimization &&\n    (clientConfig.optimization.minimize !== true ||\n      (clientConfig.optimization.minimizer &&\n        clientConfig.optimization.minimizer.length === 0))\n  ) {\n    Log.warn(\n      `Production code optimization has been disabled in your project. Read more: https://nextjs.org/docs/messages/minification-disabled`\n    )\n  }\n\n  webpackBuildStart = process.hrtime()\n\n  debug(`starting compiler`, compilerName)\n  // We run client and server compilation separately to optimize for memory usage\n  await runWebpackSpan.traceAsyncFn(async () => {\n    if (config.experimental.webpackMemoryOptimizations) {\n      stringBufferUtils.disableDualStringBufferCaching()\n      stringBufferUtils.enterStringInterningRange()\n    }\n\n    // Run the server compilers first and then the client\n    // compiler to track the boundary of server/client components.\n    let clientResult: SingleCompilerResult | null = null\n\n    // During the server compilations, entries of client components will be\n    // injected to this set and then will be consumed by the client compiler.\n    let serverResult: UnwrapPromise<ReturnType<typeof runCompiler>>[0] | null =\n      null\n    let edgeServerResult:\n      | UnwrapPromise<ReturnType<typeof runCompiler>>[0]\n      | null = null\n\n    let inputFileSystem: webpack.Compiler['inputFileSystem'] | undefined\n\n    if (!compilerName || compilerName === 'server') {\n      debug('starting server compiler')\n      const start = Date.now()\n      ;[serverResult, inputFileSystem] = await runCompiler(serverConfig, {\n        runWebpackSpan,\n        inputFileSystem,\n      })\n      debug(`server compiler finished ${Date.now() - start}ms`)\n    }\n\n    if (!compilerName || compilerName === 'edge-server') {\n      debug('starting edge-server compiler')\n      const start = Date.now()\n      ;[edgeServerResult, inputFileSystem] = edgeConfig\n        ? await runCompiler(edgeConfig, { runWebpackSpan, inputFileSystem })\n        : [null]\n      debug(`edge-server compiler finished ${Date.now() - start}ms`)\n    }\n\n    // Only continue if there were no errors\n    if (!serverResult?.errors.length && !edgeServerResult?.errors.length) {\n      const pluginState = getPluginState()\n      for (const key in pluginState.injectedClientEntries) {\n        const value = pluginState.injectedClientEntries[key]\n        const clientEntry = clientConfig.entry as webpack.EntryObject\n        if (key === APP_CLIENT_INTERNALS) {\n          clientEntry[CLIENT_STATIC_FILES_RUNTIME_MAIN_APP] = {\n            import: [\n              // TODO-APP: cast clientEntry[CLIENT_STATIC_FILES_RUNTIME_MAIN_APP] to type EntryDescription once it's available from webpack\n              // @ts-expect-error clientEntry['main-app'] is type EntryDescription { import: ... }\n              ...clientEntry[CLIENT_STATIC_FILES_RUNTIME_MAIN_APP].import,\n              value,\n            ],\n            layer: WEBPACK_LAYERS.appPagesBrowser,\n          }\n        } else {\n          clientEntry[key] = {\n            dependOn: [CLIENT_STATIC_FILES_RUNTIME_MAIN_APP],\n            import: value,\n            layer: WEBPACK_LAYERS.appPagesBrowser,\n          }\n        }\n      }\n\n      if (!compilerName || compilerName === 'client') {\n        debug('starting client compiler')\n        const start = Date.now()\n        ;[clientResult, inputFileSystem] = await runCompiler(clientConfig, {\n          runWebpackSpan,\n          inputFileSystem,\n        })\n        debug(`client compiler finished ${Date.now() - start}ms`)\n      }\n    }\n\n    if (config.experimental.webpackMemoryOptimizations) {\n      stringBufferUtils.exitStringInterningRange()\n    }\n    inputFileSystem?.purge?.()\n\n    result = {\n      warnings: [\n        ...(clientResult?.warnings ?? []),\n        ...(serverResult?.warnings ?? []),\n        ...(edgeServerResult?.warnings ?? []),\n      ].filter(nonNullable),\n      errors: [\n        ...(clientResult?.errors ?? []),\n        ...(serverResult?.errors ?? []),\n        ...(edgeServerResult?.errors ?? []),\n      ].filter(nonNullable),\n      stats: [\n        clientResult?.stats,\n        serverResult?.stats,\n        edgeServerResult?.stats,\n      ],\n    }\n  })\n  result = nextBuildSpan\n    .traceChild('format-webpack-messages')\n    .traceFn(() => formatWebpackMessages(result, true)) as CompilerResult\n\n  const telemetryPlugin = (clientConfig as webpack.Configuration).plugins?.find(\n    isTelemetryPlugin\n  )\n\n  const traceEntryPointsPlugin = (\n    serverConfig as webpack.Configuration\n  ).plugins?.find(isTraceEntryPointsPlugin)\n\n  const webpackBuildEnd = process.hrtime(webpackBuildStart)\n\n  if (result.errors.length > 0) {\n    // Only keep the first few errors. Others are often indicative\n    // of the same problem, but confuse the reader with noise.\n    if (result.errors.length > 5) {\n      result.errors.length = 5\n    }\n    let error = result.errors.filter(Boolean).join('\\n\\n')\n\n    console.error(red('Failed to compile.\\n'))\n\n    if (\n      error.indexOf('private-next-pages') > -1 &&\n      error.indexOf('does not contain a default export') > -1\n    ) {\n      const page_name_regex = /'private-next-pages\\/(?<page_name>[^']*)'/\n      const parsed = page_name_regex.exec(error)\n      const page_name = parsed && parsed.groups && parsed.groups.page_name\n      throw new Error(\n        `webpack build failed: found page without a React Component as default export in pages/${page_name}\\n\\nSee https://nextjs.org/docs/messages/page-without-valid-component for more info.`\n      )\n    }\n\n    console.error(error)\n    console.error()\n\n    if (\n      error.indexOf('private-next-pages') > -1 ||\n      error.indexOf('__next_polyfill__') > -1\n    ) {\n      const err = new Error(\n        'webpack config.resolve.alias was incorrectly overridden. https://nextjs.org/docs/messages/invalid-resolve-alias'\n      ) as NextError\n      err.code = 'INVALID_RESOLVE_ALIAS'\n      throw err\n    }\n    const err = new Error(\n      `Build failed because of ${process.env.NEXT_RSPACK ? 'rspack' : 'webpack'} errors`\n    ) as NextError\n    err.code = 'WEBPACK_ERRORS'\n    throw err\n  } else {\n    const duration = hrtimeToSeconds(webpackBuildEnd)\n    const durationString = durationToString(duration)\n\n    if (result.warnings.length > 0) {\n      Log.warn(`Compiled with warnings in ${durationString}\\n`)\n      console.warn(result.warnings.filter(Boolean).join('\\n\\n'))\n      console.warn()\n    } else if (!compilerName) {\n      Log.event(`Compiled successfully in ${durationString}`)\n    }\n\n    return {\n      duration,\n      buildTraceContext: traceEntryPointsPlugin?.buildTraceContext,\n      pluginState: getPluginState(),\n      telemetryState: {\n        usages: telemetryPlugin?.usages() || [],\n        packagesUsedInServerSideProps:\n          telemetryPlugin?.packagesUsedInServerSideProps() || [],\n        useCacheTracker: telemetryPlugin?.getUseCacheTracker() || {},\n      },\n    }\n  }\n}\n\n// the main function when this file is run as a worker\nexport async function workerMain(workerData: {\n  compilerName: keyof typeof COMPILER_INDEXES\n  buildContext: typeof NextBuildContext\n  traceState: TraceState\n}): Promise<\n  Awaited<ReturnType<typeof webpackBuildImpl>> & {\n    debugTraceEvents: TraceEvent[]\n  }\n> {\n  // Clone the telemetry for worker\n  const telemetry = new Telemetry({\n    distDir: workerData.buildContext.config!.distDir,\n  })\n  setGlobal('telemetry', telemetry)\n  // setup new build context from the serialized data passed from the parent\n  Object.assign(NextBuildContext, workerData.buildContext)\n\n  // Initialize tracer state from the parent\n  initializeTraceState(workerData.traceState)\n\n  // Resume plugin state\n  resumePluginState(NextBuildContext.pluginState)\n\n  /// load the config because it's not serializable\n  NextBuildContext.config = await loadConfig(\n    PHASE_PRODUCTION_BUILD,\n    NextBuildContext.dir!,\n    { debugPrerender: NextBuildContext.debugPrerender }\n  )\n  NextBuildContext.nextBuildSpan = trace(\n    `worker-main-${workerData.compilerName}`\n  )\n\n  const result = await webpackBuildImpl(workerData.compilerName)\n  const { entriesTrace, chunksTrace } = result.buildTraceContext ?? {}\n  if (entriesTrace) {\n    const { entryNameMap, depModArray } = entriesTrace\n    if (depModArray) {\n      result.buildTraceContext!.entriesTrace!.depModArray = depModArray\n    }\n    if (entryNameMap) {\n      const entryEntries = entryNameMap\n      result.buildTraceContext!.entriesTrace!.entryNameMap = entryEntries\n    }\n  }\n  if (chunksTrace?.entryNameFilesMap) {\n    const entryNameFilesMap = chunksTrace.entryNameFilesMap\n    result.buildTraceContext!.chunksTrace!.entryNameFilesMap = entryNameFilesMap\n  }\n  NextBuildContext.nextBuildSpan.stop()\n  return { ...result, debugTraceEvents: getTraceEvents() }\n}\n"],"names":["webpackBuildImpl","workerMain","debug","origDebug","hrtimeToSeconds","hrtime","isTelemetryPlugin","plugin","TelemetryPlugin","isTraceEntryPointsPlugin","TraceEntryPointsPlugin","compilerName","result","warnings","errors","stats","webpackBuildStart","nextBuildSpan","NextBuildContext","dir","config","process","env","NEXT_COMPILER_NAME","runWebpackSpan","traceChild","entrypoints","traceAsyncFn","createEntrypoints","buildId","envFiles","loadedEnvFiles","isDev","rootDir","pageExtensions","pagesDir","appDir","pages","mappedPages","appPaths","mappedAppPages","previewMode","previewProps","rootPaths","mappedRootPaths","hasInstrumentationHook","commonWebpackOptions","isServer","isCompileMode","encryptionKey","rewrites","originalRewrites","originalRedirects","reactProductionProfiling","noMangling","clientRouterFilters","allowedRevalidateHeaderKeys","fetchCacheKeyPrefix","configs","info","loadProjectInfo","dev","Promise","all","getBaseWebpackConfig","middlewareMatchers","compilerType","COMPILER_NAMES","client","server","edgeServer","clientConfig","serverConfig","edgeConfig","optimization","minimize","minimizer","length","Log","warn","inputFileSystem","experimental","webpackMemoryOptimizations","stringBufferUtils","disableDualStringBufferCaching","enterStringInterningRange","clientResult","serverResult","edgeServerResult","start","Date","now","runCompiler","pluginState","getPluginState","key","injectedClientEntries","value","clientEntry","entry","APP_CLIENT_INTERNALS","CLIENT_STATIC_FILES_RUNTIME_MAIN_APP","import","layer","WEBPACK_LAYERS","appPagesBrowser","dependOn","exitStringInterningRange","purge","filter","nonNullable","traceFn","formatWebpackMessages","telemetryPlugin","plugins","find","traceEntryPointsPlugin","webpackBuildEnd","error","Boolean","join","console","red","indexOf","page_name_regex","parsed","exec","page_name","groups","Error","err","code","NEXT_RSPACK","duration","durationString","durationToString","event","buildTraceContext","telemetryState","usages","packagesUsedInServerSideProps","useCacheTracker","getUseCacheTracker","workerData","telemetry","Telemetry","distDir","buildContext","setGlobal","Object","assign","initializeTraceState","traceState","resumePluginState","loadConfig","PHASE_PRODUCTION_BUILD","debugPrerender","trace","entriesTrace","chunksTrace","entryNameMap","depModArray","entryEntries","entryNameFilesMap","stop","debugTraceEvents","getTraceEvents"],"mappings":";;;;;;;;;;;;;;;IAyEsBA,gBAAgB;eAAhBA;;IAqSAC,UAAU;eAAVA;;;iCA7WY;4BACd;8EACc;6BACN;2BAOrB;0BACqB;6DACP;uEACiC;iCAK/C;8BAKA;yBAC2B;+DACX;uBAQhB;4BACwB;4CACQ;8DAIjB;yBACI;kCACO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,MAAMC,QAAQC,IAAAA,cAAS,EAAC;AAExB,SAASC,gBAAgBC,MAAwB;IAC/C,8CAA8C;IAC9C,OAAOA,MAAM,CAAC,EAAE,GAAGA,MAAM,CAAC,EAAE,GAAG;AACjC;AAcA,SAASC,kBAAkBC,MAAe;IACxC,OAAOA,kBAAkBC,gCAAe;AAC1C;AAEA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