next 15.3.0-canary.5 → 15.3.0-canary.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/bin/next +3 -2
  2. package/dist/bin/next.map +1 -1
  3. package/dist/build/collect-build-traces.js +1 -1
  4. package/dist/build/collect-build-traces.js.map +1 -1
  5. package/dist/build/index.d.ts +1 -1
  6. package/dist/build/index.js +24 -11
  7. package/dist/build/index.js.map +1 -1
  8. package/dist/build/swc/index.js +1 -1
  9. package/dist/build/webpack-config.js +2 -2
  10. package/dist/cli/next-build.d.ts +1 -1
  11. package/dist/cli/next-build.js.map +1 -1
  12. package/dist/client/app-bootstrap.js +1 -1
  13. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.d.ts +1 -1
  14. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js +30 -36
  15. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js.map +1 -1
  16. package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.d.ts +8 -0
  17. package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js +90 -0
  18. package/dist/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js.map +1 -0
  19. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.d.ts +1 -1
  20. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js +1 -1
  21. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
  22. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/index.d.ts +1 -1
  23. package/dist/client/index.js +1 -1
  24. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +3 -3
  25. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  26. package/dist/compiled/next-server/app-page.runtime.dev.js +3 -3
  27. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  28. package/dist/esm/build/collect-build-traces.js +1 -1
  29. package/dist/esm/build/collect-build-traces.js.map +1 -1
  30. package/dist/esm/build/index.js +24 -11
  31. package/dist/esm/build/index.js.map +1 -1
  32. package/dist/esm/build/swc/index.js +1 -1
  33. package/dist/esm/build/webpack-config.js +2 -2
  34. package/dist/esm/client/app-bootstrap.js +1 -1
  35. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js +30 -35
  36. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/code-frame.js.map +1 -1
  37. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js +58 -0
  38. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/parse-code-frame.js.map +1 -0
  39. package/dist/esm/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js +1 -1
  40. package/dist/esm/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
  41. package/dist/esm/client/index.js +1 -1
  42. package/dist/esm/server/config-schema.js +0 -1
  43. package/dist/esm/server/config-schema.js.map +1 -1
  44. package/dist/esm/server/config-shared.js +0 -1
  45. package/dist/esm/server/config-shared.js.map +1 -1
  46. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  47. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  48. package/dist/esm/server/lib/app-info-log.js +1 -1
  49. package/dist/esm/server/lib/start-server.js +1 -1
  50. package/dist/esm/shared/lib/canary-only.js +1 -1
  51. package/dist/server/config-schema.js +0 -1
  52. package/dist/server/config-schema.js.map +1 -1
  53. package/dist/server/config-shared.d.ts +0 -1
  54. package/dist/server/config-shared.js +0 -1
  55. package/dist/server/config-shared.js.map +1 -1
  56. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  57. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  58. package/dist/server/lib/app-info-log.js +1 -1
  59. package/dist/server/lib/start-server.js +1 -1
  60. package/dist/shared/lib/canary-only.js +1 -1
  61. package/dist/telemetry/anonymous-meta.js +1 -1
  62. package/dist/telemetry/events/session-stopped.js +2 -2
  63. package/dist/telemetry/events/version.js +2 -2
  64. package/package.json +15 -15
package/dist/bin/next CHANGED
@@ -79,10 +79,11 @@ const program = new NextRootCommand();
79
79
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
80
80
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
81
81
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
82
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.3.0-canary.5"}`, '-v, --version', 'Outputs the Next.js version.');
82
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.3.0-canary.6"}`, '-v, --version', 'Outputs the Next.js version.');
83
83
  program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').addOption(new _commander.Option('--experimental-turbo').hideHelp()).addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
84
84
  'compile',
85
- 'generate'
85
+ 'generate',
86
+ 'generate-env'
86
87
  ]).default('default')).option('--experimental-debug-memory-usage', 'Enables memory profiling features to debug memory consumption.').option('--experimental-upload-trace, <traceUrl>', 'Reports a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.').action((directory, options)=>// ensure process exits after build completes so open handles/connections
87
88
  // don't cause process to hang
88
89
  import('../cli/next-build.js').then((mod)=>mod.nextBuild(options, directory).then(()=>process.exit(0)))).usage('[directory] [options]');
package/dist/bin/next.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bin/next.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport '../server/require-hook'\n\nimport { Argument, Command, Option } from 'next/dist/compiled/commander'\n\nimport { warn } from '../build/output/log'\nimport semver from 'next/dist/compiled/semver'\nimport { bold, cyan, italic } from '../lib/picocolors'\nimport { formatCliHelpOutput } from '../lib/format-cli-help-output'\nimport { NON_STANDARD_NODE_ENV } from '../lib/constants'\nimport { parseValidPositiveInteger } from '../server/lib/utils'\nimport {\n SUPPORTED_TEST_RUNNERS_LIST,\n type NextTestOptions,\n} from '../cli/next-test.js'\nimport type { NextTelemetryOptions } from '../cli/next-telemetry.js'\nimport type { NextStartOptions } from '../cli/next-start.js'\nimport type { NextLintOptions } from '../cli/next-lint.js'\nimport type { NextInfoOptions } from '../cli/next-info.js'\nimport type { NextDevOptions } from '../cli/next-dev.js'\nimport type { NextBuildOptions } from '../cli/next-build.js'\n\nif (process.env.NEXT_RSPACK) {\n // silent rspack's schema check\n process.env.RSPACK_CONFIG_VALIDATE = 'loose-silent'\n}\n\nif (\n !semver.satisfies(\n process.versions.node,\n process.env.__NEXT_REQUIRED_NODE_VERSION_RANGE!,\n { includePrerelease: true }\n )\n) {\n console.error(\n `You are using Node.js ${process.versions.node}. For Next.js, Node.js version \"${process.env.__NEXT_REQUIRED_NODE_VERSION_RANGE}\" is required.`\n )\n process.exit(1)\n}\n\n// Start performance profiling after Node.js version is checked\nperformance.mark('next-start')\n\nfor (const dependency of ['react', 'react-dom']) {\n try {\n // When 'npm link' is used it checks the clone location. Not the project.\n require.resolve(dependency)\n } catch (err) {\n console.warn(\n `The module '${dependency}' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install ${dependency}'`\n )\n }\n}\n\nclass NextRootCommand extends Command {\n createCommand(name: string) {\n const command = new Command(name)\n\n command.addOption(new Option('--inspect').hideHelp())\n\n command.hook('preAction', (event) => {\n const commandName = event.name()\n const defaultEnv = commandName === 'dev' ? 'development' : 'production'\n const standardEnv = ['production', 'development', 'test']\n\n if (process.env.NODE_ENV) {\n const isNotStandard = !standardEnv.includes(process.env.NODE_ENV)\n const shouldWarnCommands =\n process.env.NODE_ENV === 'development'\n ? ['start', 'build']\n : process.env.NODE_ENV === 'production'\n ? ['dev']\n : []\n\n if (isNotStandard || shouldWarnCommands.includes(commandName)) {\n warn(NON_STANDARD_NODE_ENV)\n }\n }\n\n ;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv\n ;(process.env as any).NEXT_RUNTIME = 'nodejs'\n\n if (event.getOptionValue('inspect') === true) {\n console.error(\n `\\`--inspect\\` flag is deprecated. Use env variable NODE_OPTIONS instead: NODE_OPTIONS='--inspect' next ${commandName}`\n )\n process.exit(1)\n }\n })\n\n return command\n }\n}\n\nconst program = new NextRootCommand()\n\nprogram\n .name('next')\n .description(\n 'The Next.js CLI allows you to develop, build, start your application, and more.'\n )\n .configureHelp({\n formatHelp: (cmd, helper) => formatCliHelpOutput(cmd, helper),\n subcommandTerm: (cmd) => `${cmd.name()} ${cmd.usage()}`,\n })\n .helpCommand(false)\n .helpOption('-h, --help', 'Displays this message.')\n .version(\n `Next.js v${process.env.__NEXT_VERSION}`,\n '-v, --version',\n 'Outputs the Next.js version.'\n )\n\nprogram\n .command('build')\n .description(\n 'Creates an optimized production build of your application. The output displays information about each route.'\n )\n .argument(\n '[directory]',\n `A directory on which to build the application. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .option('-d, --debug', 'Enables a more verbose build output.')\n\n .option('--no-lint', 'Disables linting.')\n .option('--no-mangling', 'Disables mangling.')\n .option('--profile', 'Enables production profiling for React.')\n .option('--experimental-app-only', 'Builds only App Router routes.')\n .addOption(new Option('--experimental-turbo').hideHelp())\n .addOption(\n new Option(\n '--experimental-build-mode [mode]',\n 'Uses an experimental build mode.'\n )\n .choices(['compile', 'generate'])\n .default('default')\n )\n .option(\n '--experimental-debug-memory-usage',\n 'Enables memory profiling features to debug memory consumption.'\n )\n .option(\n '--experimental-upload-trace, <traceUrl>',\n 'Reports a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.'\n )\n .action((directory: string, options: NextBuildOptions) =>\n // ensure process exits after build completes so open handles/connections\n // don't cause process to hang\n import('../cli/next-build.js').then((mod) =>\n mod.nextBuild(options, directory).then(() => process.exit(0))\n )\n )\n .usage('[directory] [options]')\n\nprogram\n .command('dev', { isDefault: true })\n .description(\n 'Starts Next.js in development mode with hot-code reloading, error reporting, and more.'\n )\n .argument(\n '[directory]',\n `A directory on which to build the application. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .option('--turbo', 'Starts development mode using Turbopack.')\n .option('--turbopack', 'Starts development mode using Turbopack.')\n .addOption(\n new Option(\n '-p, --port <port>',\n 'Specify a port number on which to start the application.'\n )\n .argParser(parseValidPositiveInteger)\n .default(3000)\n .env('PORT')\n )\n .option(\n '-H, --hostname <hostname>',\n 'Specify a hostname on which to start the application (default: 0.0.0.0).'\n )\n .option(\n '--disable-source-maps',\n \"Don't start the Dev server with `--enable-source-maps`.\",\n false\n )\n .option(\n '--experimental-https',\n 'Starts the server with HTTPS and generates a self-signed certificate.'\n )\n .option('--experimental-https-key, <path>', 'Path to a HTTPS key file.')\n .option(\n '--experimental-https-cert, <path>',\n 'Path to a HTTPS certificate file.'\n )\n .option(\n '--experimental-https-ca, <path>',\n 'Path to a HTTPS certificate authority file.'\n )\n .option(\n '--experimental-upload-trace, <traceUrl>',\n 'Reports a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.'\n )\n .action(\n (directory: string, options: NextDevOptions, { _optionValueSources }) => {\n const portSource = _optionValueSources.port\n import('../cli/next-dev.js').then((mod) =>\n mod.nextDev(options, portSource, directory)\n )\n }\n )\n .usage('[directory] [options]')\n\nprogram\n .command('export', { hidden: true })\n .action(() => import('../cli/next-export.js').then((mod) => mod.nextExport()))\n .helpOption(false)\n\nprogram\n .command('info')\n .description(\n 'Prints relevant details about the current system which can be used to report Next.js bugs.'\n )\n .addHelpText(\n 'after',\n `\\nLearn more: ${cyan('https://nextjs.org/docs/api-reference/cli#info')}`\n )\n .option('--verbose', 'Collects additional information for debugging.')\n .action((options: NextInfoOptions) =>\n import('../cli/next-info.js').then((mod) => mod.nextInfo(options))\n )\n\nprogram\n .command('lint')\n .description(\n 'Runs ESLint for all files in the `/src`, `/app`, `/pages`, `/components`, and `/lib` directories. It also provides a guided setup to install any required dependencies if ESLint is not already configured in your application.'\n )\n .argument(\n '[directory]',\n `A base directory on which to lint the application. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .option(\n '-d, --dir, <dirs...>',\n 'Include directory, or directories, to run ESLint.'\n )\n .option('--file, <files...>', 'Include file, or files, to run ESLint.')\n .addOption(\n new Option(\n '--ext, [exts...]',\n 'Specify JavaScript file extensions.'\n ).default(['.js', '.mjs', '.cjs', '.jsx', '.ts', '.mts', '.cts', '.tsx'])\n )\n .option(\n '-c, --config, <config>',\n 'Uses this configuration file, overriding all other configuration options.'\n )\n .option(\n '--resolve-plugins-relative-to, <rprt>',\n 'Specify a directory where plugins should be resolved from.'\n )\n .option(\n '--strict',\n 'Creates a `.eslintrc.json` file using the Next.js strict configuration.'\n )\n .option(\n '--rulesdir, <rulesdir...>',\n 'Uses additional rules from this directory(s).'\n )\n .option('--fix', 'Automatically fix linting issues.')\n .option(\n '--fix-type <fixType>',\n 'Specify the types of fixes to apply (e.g., problem, suggestion, layout).'\n )\n .option('--ignore-path <path>', 'Specify a file to ignore.')\n .option('--no-ignore', 'Disables the `--ignore-path` option.')\n .option('--quiet', 'Reports errors only.')\n .addOption(\n new Option(\n '--max-warnings [maxWarnings]',\n 'Specify the number of warnings before triggering a non-zero exit code.'\n )\n .argParser(parseValidPositiveInteger)\n .default(-1)\n )\n .option(\n '-o, --output-file, <outputFile>',\n 'Specify a file to write report to.'\n )\n .option('-f, --format, <format>', 'Uses a specific output format.')\n .option(\n '--no-inline-config',\n 'Prevents comments from changing config or rules.'\n )\n .addOption(\n new Option(\n '--report-unused-disable-directives-severity <level>',\n 'Specify severity level for unused eslint-disable directives.'\n ).choices(['error', 'off', 'warn'])\n )\n .option('--no-cache', 'Disables caching.')\n .option('--cache-location, <cacheLocation>', 'Specify a location for cache.')\n .addOption(\n new Option(\n '--cache-strategy, [cacheStrategy]',\n 'Specify a strategy to use for detecting changed files in the cache.'\n ).default('metadata')\n )\n .option(\n '--error-on-unmatched-pattern',\n 'Reports errors when any file patterns are unmatched.'\n )\n .action((directory: string, options: NextLintOptions) =>\n import('../cli/next-lint.js').then((mod) =>\n mod.nextLint(options, directory)\n )\n )\n .usage('[directory] [options]')\n\nprogram\n .command('start')\n .description(\n 'Starts Next.js in production mode. The application should be compiled with `next build` first.'\n )\n .argument(\n '[directory]',\n `A directory on which to start the application. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .addOption(\n new Option(\n '-p, --port <port>',\n 'Specify a port number on which to start the application.'\n )\n .argParser(parseValidPositiveInteger)\n .default(3000)\n .env('PORT')\n )\n .option(\n '-H, --hostname <hostname>',\n 'Specify a hostname on which to start the application (default: 0.0.0.0).'\n )\n .addOption(\n new Option(\n '--keepAliveTimeout <keepAliveTimeout>',\n 'Specify the maximum amount of milliseconds to wait before closing inactive connections.'\n ).argParser(parseValidPositiveInteger)\n )\n .action((directory: string, options: NextStartOptions) =>\n import('../cli/next-start.js').then((mod) =>\n mod.nextStart(options, directory)\n )\n )\n .usage('[directory] [options]')\n\nprogram\n .command('telemetry')\n .description(\n `Allows you to enable or disable Next.js' ${bold(\n 'completely anonymous'\n )} telemetry collection.`\n )\n .addArgument(new Argument('[arg]').choices(['disable', 'enable', 'status']))\n .addHelpText('after', `\\nLearn more: ${cyan('https://nextjs.org/telemetry')}`)\n .addOption(\n new Option('--enable', `Enables Next.js' telemetry collection.`).conflicts(\n 'disable'\n )\n )\n .option('--disable', `Disables Next.js' telemetry collection.`)\n .action((arg: string, options: NextTelemetryOptions) =>\n import('../cli/next-telemetry.js').then((mod) =>\n mod.nextTelemetry(options, arg)\n )\n )\n\nprogram\n .command('experimental-test')\n .description(\n `Execute \\`next/experimental/testmode\\` tests using a specified test runner. The test runner defaults to 'playwright' if the \\`experimental.defaultTestRunner\\` configuration option or the \\`--test-runner\\` option are not set.`\n )\n .argument(\n '[directory]',\n `A Next.js project directory to execute the test runner on. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .argument(\n '[test-runner-args...]',\n 'Any additional arguments or options to pass down to the test runner `test` command.'\n )\n .option(\n '--test-runner [test-runner]',\n `Any supported test runner. Options: ${bold(\n SUPPORTED_TEST_RUNNERS_LIST.join(', ')\n )}. ${italic(\n \"If no test runner is provided, the Next.js config option `experimental.defaultTestRunner`, or 'playwright' will be used.\"\n )}`\n )\n .allowUnknownOption()\n .action(\n (directory: string, testRunnerArgs: string[], options: NextTestOptions) => {\n return import('../cli/next-test.js').then((mod) => {\n mod.nextTest(directory, testRunnerArgs, options)\n })\n }\n )\n .usage('[directory] [options]')\n\nconst internal = program\n .command('internal')\n .description(\n 'Internal debugging commands. Use with caution. Not covered by semver.'\n )\n\ninternal\n .command('turbo-trace-server')\n .argument('[file]', 'Trace file to serve.')\n .action((file: string) => {\n return import('../cli/internal/turbo-trace-server.js').then((mod) =>\n mod.startTurboTraceServerCli(file)\n )\n })\n\nprogram.parse(process.argv)\n"],"names":["process","env","NEXT_RSPACK","RSPACK_CONFIG_VALIDATE","semver","satisfies","versions","node","__NEXT_REQUIRED_NODE_VERSION_RANGE","includePrerelease","console","error","exit","performance","mark","dependency","require","resolve","err","warn","NextRootCommand","Command","createCommand","name","command","addOption","Option","hideHelp","hook","event","commandName","defaultEnv","standardEnv","NODE_ENV","isNotStandard","includes","shouldWarnCommands","NON_STANDARD_NODE_ENV","NEXT_RUNTIME","getOptionValue","program","description","configureHelp","formatHelp","cmd","helper","formatCliHelpOutput","subcommandTerm","usage","helpCommand","helpOption","version","__NEXT_VERSION","argument","italic","option","choices","default","action","directory","options","then","mod","nextBuild","isDefault","argParser","parseValidPositiveInteger","_optionValueSources","portSource","port","nextDev","hidden","nextExport","addHelpText","cyan","nextInfo","nextLint","nextStart","bold","addArgument","Argument","conflicts","arg","nextTelemetry","SUPPORTED_TEST_RUNNERS_LIST","join","allowUnknownOption","testRunnerArgs","nextTest","internal","file","startTurboTraceServerCli","parse","argv"],"mappings":";;;;;QAEO;2BAEmC;qBAErB;+DACF;4BACgB;qCACC;2BACE;uBACI;0BAInC;;;;;;AAQP,IAAIA,QAAQC,GAAG,CAACC,WAAW,EAAE;IAC3B,+BAA+B;IAC/BF,QAAQC,GAAG,CAACE,sBAAsB,GAAG;AACvC;AAEA,IACE,CAACC,eAAM,CAACC,SAAS,CACfL,QAAQM,QAAQ,CAACC,IAAI,EACrBP,QAAQC,GAAG,CAACO,kCAAkC,EAC9C;IAAEC,mBAAmB;AAAK,IAE5B;IACAC,QAAQC,KAAK,CACX,CAAC,sBAAsB,EAAEX,QAAQM,QAAQ,CAACC,IAAI,CAAC,gCAAgC,EAAEP,QAAQC,GAAG,CAACO,kCAAkC,CAAC,cAAc,CAAC;IAEjJR,QAAQY,IAAI,CAAC;AACf;AAEA,+DAA+D;AAC/DC,YAAYC,IAAI,CAAC;AAEjB,KAAK,MAAMC,cAAc;IAAC;IAAS;CAAY,CAAE;IAC/C,IAAI;QACF,yEAAyE;QACzEC,QAAQC,OAAO,CAACF;IAClB,EAAE,OAAOG,KAAK;QACZR,QAAQS,IAAI,CACV,CAAC,YAAY,EAAEJ,WAAW,4HAA4H,EAAEA,WAAW,CAAC,CAAC;IAEzK;AACF;AAEA,MAAMK,wBAAwBC,kBAAO;IACnCC,cAAcC,IAAY,EAAE;QAC1B,MAAMC,UAAU,IAAIH,kBAAO,CAACE;QAE5BC,QAAQC,SAAS,CAAC,IAAIC,iBAAM,CAAC,aAAaC,QAAQ;QAElDH,QAAQI,IAAI,CAAC,aAAa,CAACC;YACzB,MAAMC,cAAcD,MAAMN,IAAI;YAC9B,MAAMQ,aAAaD,gBAAgB,QAAQ,gBAAgB;YAC3D,MAAME,cAAc;gBAAC;gB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,SAASsB;AAIjC1C,QACGhB,OAAO,CAAC,qBACRiB,WAAW,CACV,CAAC,gOAAgO,CAAC,EAEnOY,QAAQ,CACP,eACA,CAAC,2DAA2D,EAAEC,IAAAA,kBAAM,EAClE,qEACC,EAEJD,QAAQ,CACP,yBACA,uFAEDE,MAAM,CACL,+BACA,CAAC,oCAAoC,EAAEuB,IAAAA,gBAAI,EACzCM,qCAA2B,CAACC,IAAI,CAAC,OACjC,EAAE,EAAE/B,IAAAA,kBAAM,EACV,6HACC,EAEJgC,kBAAkB,GAClB5B,MAAM,CACL,CAACC,WAAmB4B,gBAA0B3B;IAC5C,OAAO,MAAM,CAAC,uBAAuBC,IAAI,CAAC,CAACC;QACzCA,IAAI0B,QAAQ,CAAC7B,WAAW4B,gBAAgB3B;IAC1C;AACF,GAEDZ,KAAK,CAAC;AAET,MAAMyC,WAAWjD,QACdhB,OAAO,CAAC,YACRiB,WAAW,CACV;AAGJgD,SACGjE,OAAO,CAAC,sBACR6B,QAAQ,CAAC,UAAU,wBACnBK,MAAM,CAAC,CAACgC;IACP,OAAO,MAAM,CAAC,yCAAyC7B,IAAI,CAAC,CAACC,MAC3DA,IAAI6B,wBAAwB,CAACD;AAEjC;AAEFlD,QAAQoD,KAAK,CAAC5F,QAAQ6F,IAAI"}
1
+ {"version":3,"sources":["../../src/bin/next.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport '../server/require-hook'\n\nimport { Argument, Command, Option } from 'next/dist/compiled/commander'\n\nimport { warn } from '../build/output/log'\nimport semver from 'next/dist/compiled/semver'\nimport { bold, cyan, italic } from '../lib/picocolors'\nimport { formatCliHelpOutput } from '../lib/format-cli-help-output'\nimport { NON_STANDARD_NODE_ENV } from '../lib/constants'\nimport { parseValidPositiveInteger } from '../server/lib/utils'\nimport {\n SUPPORTED_TEST_RUNNERS_LIST,\n type NextTestOptions,\n} from '../cli/next-test.js'\nimport type { NextTelemetryOptions } from '../cli/next-telemetry.js'\nimport type { NextStartOptions } from '../cli/next-start.js'\nimport type { NextLintOptions } from '../cli/next-lint.js'\nimport type { NextInfoOptions } from '../cli/next-info.js'\nimport type { NextDevOptions } from '../cli/next-dev.js'\nimport type { NextBuildOptions } from '../cli/next-build.js'\n\nif (process.env.NEXT_RSPACK) {\n // silent rspack's schema check\n process.env.RSPACK_CONFIG_VALIDATE = 'loose-silent'\n}\n\nif (\n !semver.satisfies(\n process.versions.node,\n process.env.__NEXT_REQUIRED_NODE_VERSION_RANGE!,\n { includePrerelease: true }\n )\n) {\n console.error(\n `You are using Node.js ${process.versions.node}. For Next.js, Node.js version \"${process.env.__NEXT_REQUIRED_NODE_VERSION_RANGE}\" is required.`\n )\n process.exit(1)\n}\n\n// Start performance profiling after Node.js version is checked\nperformance.mark('next-start')\n\nfor (const dependency of ['react', 'react-dom']) {\n try {\n // When 'npm link' is used it checks the clone location. Not the project.\n require.resolve(dependency)\n } catch (err) {\n console.warn(\n `The module '${dependency}' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install ${dependency}'`\n )\n }\n}\n\nclass NextRootCommand extends Command {\n createCommand(name: string) {\n const command = new Command(name)\n\n command.addOption(new Option('--inspect').hideHelp())\n\n command.hook('preAction', (event) => {\n const commandName = event.name()\n const defaultEnv = commandName === 'dev' ? 'development' : 'production'\n const standardEnv = ['production', 'development', 'test']\n\n if (process.env.NODE_ENV) {\n const isNotStandard = !standardEnv.includes(process.env.NODE_ENV)\n const shouldWarnCommands =\n process.env.NODE_ENV === 'development'\n ? ['start', 'build']\n : process.env.NODE_ENV === 'production'\n ? ['dev']\n : []\n\n if (isNotStandard || shouldWarnCommands.includes(commandName)) {\n warn(NON_STANDARD_NODE_ENV)\n }\n }\n\n ;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv\n ;(process.env as any).NEXT_RUNTIME = 'nodejs'\n\n if (event.getOptionValue('inspect') === true) {\n console.error(\n `\\`--inspect\\` flag is deprecated. Use env variable NODE_OPTIONS instead: NODE_OPTIONS='--inspect' next ${commandName}`\n )\n process.exit(1)\n }\n })\n\n return command\n }\n}\n\nconst program = new NextRootCommand()\n\nprogram\n .name('next')\n .description(\n 'The Next.js CLI allows you to develop, build, start your application, and more.'\n )\n .configureHelp({\n formatHelp: (cmd, helper) => formatCliHelpOutput(cmd, helper),\n subcommandTerm: (cmd) => `${cmd.name()} ${cmd.usage()}`,\n })\n .helpCommand(false)\n .helpOption('-h, --help', 'Displays this message.')\n .version(\n `Next.js v${process.env.__NEXT_VERSION}`,\n '-v, --version',\n 'Outputs the Next.js version.'\n )\n\nprogram\n .command('build')\n .description(\n 'Creates an optimized production build of your application. The output displays information about each route.'\n )\n .argument(\n '[directory]',\n `A directory on which to build the application. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .option('-d, --debug', 'Enables a more verbose build output.')\n\n .option('--no-lint', 'Disables linting.')\n .option('--no-mangling', 'Disables mangling.')\n .option('--profile', 'Enables production profiling for React.')\n .option('--experimental-app-only', 'Builds only App Router routes.')\n .addOption(new Option('--experimental-turbo').hideHelp())\n .addOption(\n new Option(\n '--experimental-build-mode [mode]',\n 'Uses an experimental build mode.'\n )\n .choices(['compile', 'generate', 'generate-env'])\n .default('default')\n )\n .option(\n '--experimental-debug-memory-usage',\n 'Enables memory profiling features to debug memory consumption.'\n )\n .option(\n '--experimental-upload-trace, <traceUrl>',\n 'Reports a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.'\n )\n .action((directory: string, options: NextBuildOptions) =>\n // ensure process exits after build completes so open handles/connections\n // don't cause process to hang\n import('../cli/next-build.js').then((mod) =>\n mod.nextBuild(options, directory).then(() => process.exit(0))\n )\n )\n .usage('[directory] [options]')\n\nprogram\n .command('dev', { isDefault: true })\n .description(\n 'Starts Next.js in development mode with hot-code reloading, error reporting, and more.'\n )\n .argument(\n '[directory]',\n `A directory on which to build the application. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .option('--turbo', 'Starts development mode using Turbopack.')\n .option('--turbopack', 'Starts development mode using Turbopack.')\n .addOption(\n new Option(\n '-p, --port <port>',\n 'Specify a port number on which to start the application.'\n )\n .argParser(parseValidPositiveInteger)\n .default(3000)\n .env('PORT')\n )\n .option(\n '-H, --hostname <hostname>',\n 'Specify a hostname on which to start the application (default: 0.0.0.0).'\n )\n .option(\n '--disable-source-maps',\n \"Don't start the Dev server with `--enable-source-maps`.\",\n false\n )\n .option(\n '--experimental-https',\n 'Starts the server with HTTPS and generates a self-signed certificate.'\n )\n .option('--experimental-https-key, <path>', 'Path to a HTTPS key file.')\n .option(\n '--experimental-https-cert, <path>',\n 'Path to a HTTPS certificate file.'\n )\n .option(\n '--experimental-https-ca, <path>',\n 'Path to a HTTPS certificate authority file.'\n )\n .option(\n '--experimental-upload-trace, <traceUrl>',\n 'Reports a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.'\n )\n .action(\n (directory: string, options: NextDevOptions, { _optionValueSources }) => {\n const portSource = _optionValueSources.port\n import('../cli/next-dev.js').then((mod) =>\n mod.nextDev(options, portSource, directory)\n )\n }\n )\n .usage('[directory] [options]')\n\nprogram\n .command('export', { hidden: true })\n .action(() => import('../cli/next-export.js').then((mod) => mod.nextExport()))\n .helpOption(false)\n\nprogram\n .command('info')\n .description(\n 'Prints relevant details about the current system which can be used to report Next.js bugs.'\n )\n .addHelpText(\n 'after',\n `\\nLearn more: ${cyan('https://nextjs.org/docs/api-reference/cli#info')}`\n )\n .option('--verbose', 'Collects additional information for debugging.')\n .action((options: NextInfoOptions) =>\n import('../cli/next-info.js').then((mod) => mod.nextInfo(options))\n )\n\nprogram\n .command('lint')\n .description(\n 'Runs ESLint for all files in the `/src`, `/app`, `/pages`, `/components`, and `/lib` directories. It also provides a guided setup to install any required dependencies if ESLint is not already configured in your application.'\n )\n .argument(\n '[directory]',\n `A base directory on which to lint the application. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .option(\n '-d, --dir, <dirs...>',\n 'Include directory, or directories, to run ESLint.'\n )\n .option('--file, <files...>', 'Include file, or files, to run ESLint.')\n .addOption(\n new Option(\n '--ext, [exts...]',\n 'Specify JavaScript file extensions.'\n ).default(['.js', '.mjs', '.cjs', '.jsx', '.ts', '.mts', '.cts', '.tsx'])\n )\n .option(\n '-c, --config, <config>',\n 'Uses this configuration file, overriding all other configuration options.'\n )\n .option(\n '--resolve-plugins-relative-to, <rprt>',\n 'Specify a directory where plugins should be resolved from.'\n )\n .option(\n '--strict',\n 'Creates a `.eslintrc.json` file using the Next.js strict configuration.'\n )\n .option(\n '--rulesdir, <rulesdir...>',\n 'Uses additional rules from this directory(s).'\n )\n .option('--fix', 'Automatically fix linting issues.')\n .option(\n '--fix-type <fixType>',\n 'Specify the types of fixes to apply (e.g., problem, suggestion, layout).'\n )\n .option('--ignore-path <path>', 'Specify a file to ignore.')\n .option('--no-ignore', 'Disables the `--ignore-path` option.')\n .option('--quiet', 'Reports errors only.')\n .addOption(\n new Option(\n '--max-warnings [maxWarnings]',\n 'Specify the number of warnings before triggering a non-zero exit code.'\n )\n .argParser(parseValidPositiveInteger)\n .default(-1)\n )\n .option(\n '-o, --output-file, <outputFile>',\n 'Specify a file to write report to.'\n )\n .option('-f, --format, <format>', 'Uses a specific output format.')\n .option(\n '--no-inline-config',\n 'Prevents comments from changing config or rules.'\n )\n .addOption(\n new Option(\n '--report-unused-disable-directives-severity <level>',\n 'Specify severity level for unused eslint-disable directives.'\n ).choices(['error', 'off', 'warn'])\n )\n .option('--no-cache', 'Disables caching.')\n .option('--cache-location, <cacheLocation>', 'Specify a location for cache.')\n .addOption(\n new Option(\n '--cache-strategy, [cacheStrategy]',\n 'Specify a strategy to use for detecting changed files in the cache.'\n ).default('metadata')\n )\n .option(\n '--error-on-unmatched-pattern',\n 'Reports errors when any file patterns are unmatched.'\n )\n .action((directory: string, options: NextLintOptions) =>\n import('../cli/next-lint.js').then((mod) =>\n mod.nextLint(options, directory)\n )\n )\n .usage('[directory] [options]')\n\nprogram\n .command('start')\n .description(\n 'Starts Next.js in production mode. The application should be compiled with `next build` first.'\n )\n .argument(\n '[directory]',\n `A directory on which to start the application. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .addOption(\n new Option(\n '-p, --port <port>',\n 'Specify a port number on which to start the application.'\n )\n .argParser(parseValidPositiveInteger)\n .default(3000)\n .env('PORT')\n )\n .option(\n '-H, --hostname <hostname>',\n 'Specify a hostname on which to start the application (default: 0.0.0.0).'\n )\n .addOption(\n new Option(\n '--keepAliveTimeout <keepAliveTimeout>',\n 'Specify the maximum amount of milliseconds to wait before closing inactive connections.'\n ).argParser(parseValidPositiveInteger)\n )\n .action((directory: string, options: NextStartOptions) =>\n import('../cli/next-start.js').then((mod) =>\n mod.nextStart(options, directory)\n )\n )\n .usage('[directory] [options]')\n\nprogram\n .command('telemetry')\n .description(\n `Allows you to enable or disable Next.js' ${bold(\n 'completely anonymous'\n )} telemetry collection.`\n )\n .addArgument(new Argument('[arg]').choices(['disable', 'enable', 'status']))\n .addHelpText('after', `\\nLearn more: ${cyan('https://nextjs.org/telemetry')}`)\n .addOption(\n new Option('--enable', `Enables Next.js' telemetry collection.`).conflicts(\n 'disable'\n )\n )\n .option('--disable', `Disables Next.js' telemetry collection.`)\n .action((arg: string, options: NextTelemetryOptions) =>\n import('../cli/next-telemetry.js').then((mod) =>\n mod.nextTelemetry(options, arg)\n )\n )\n\nprogram\n .command('experimental-test')\n .description(\n `Execute \\`next/experimental/testmode\\` tests using a specified test runner. The test runner defaults to 'playwright' if the \\`experimental.defaultTestRunner\\` configuration option or the \\`--test-runner\\` option are not set.`\n )\n .argument(\n '[directory]',\n `A Next.js project directory to execute the test runner on. ${italic(\n 'If no directory is provided, the current directory will be used.'\n )}`\n )\n .argument(\n '[test-runner-args...]',\n 'Any additional arguments or options to pass down to the test runner `test` command.'\n )\n .option(\n '--test-runner [test-runner]',\n `Any supported test runner. Options: ${bold(\n SUPPORTED_TEST_RUNNERS_LIST.join(', ')\n )}. ${italic(\n \"If no test runner is provided, the Next.js config option `experimental.defaultTestRunner`, or 'playwright' will be used.\"\n )}`\n )\n .allowUnknownOption()\n .action(\n (directory: string, testRunnerArgs: string[], options: NextTestOptions) => {\n return import('../cli/next-test.js').then((mod) => {\n mod.nextTest(directory, testRunnerArgs, options)\n })\n }\n )\n .usage('[directory] [options]')\n\nconst internal = program\n .command('internal')\n .description(\n 'Internal debugging commands. Use with caution. Not covered by semver.'\n )\n\ninternal\n .command('turbo-trace-server')\n .argument('[file]', 'Trace file to serve.')\n .action((file: string) => {\n return import('../cli/internal/turbo-trace-server.js').then((mod) =>\n mod.startTurboTraceServerCli(file)\n )\n })\n\nprogram.parse(process.argv)\n"],"names":["process","env","NEXT_RSPACK","RSPACK_CONFIG_VALIDATE","semver","satisfies","versions","node","__NEXT_REQUIRED_NODE_VERSION_RANGE","includePrerelease","console","error","exit","performance","mark","dependency","require","resolve","err","warn","NextRootCommand","Command","createCommand","name","command","addOption","Option","hideHelp","hook","event","commandName","defaultEnv","standardEnv","NODE_ENV","isNotStandard","includes","shouldWarnCommands","NON_STANDARD_NODE_ENV","NEXT_RUNTIME","getOptionValue","program","description","configureHelp","formatHelp","cmd","helper","formatCliHelpOutput","subcommandTerm","usage","helpCommand","helpOption","version","__NEXT_VERSION","argument","italic","option","choices","default","action","directory","options","then","mod","nextBuild","isDefault","argParser","parseValidPositiveInteger","_optionValueSources","portSource","port","nextDev","hidden","nextExport","addHelpText","cyan","nextInfo","nextLint","nextStart","bold","addArgument","Argument","conflicts","arg","nextTelemetry","SUPPORTED_TEST_RUNNERS_LIST","join","allowUnknownOption","testRunnerArgs","nextTest","internal","file","startTurboTraceServerCli","parse","argv"],"mappings":";;;;;QAEO;2BAEmC;qBAErB;+DACF;4BACgB;qCACC;2BACE;uBACI;0BAInC;;;;;;AAQP,IAAIA,QAAQC,GAAG,CAACC,WAAW,EAAE;IAC3B,+BAA+B;IAC/BF,QAAQC,GAAG,CAACE,sBAAsB,GAAG;AACvC;AAEA,IACE,CAACC,eAAM,CAACC,S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BAA0B3B;IAC5C,OAAO,MAAM,CAAC,uBAAuBC,IAAI,CAAC,CAACC;QACzCA,IAAI0B,QAAQ,CAAC7B,WAAW4B,gBAAgB3B;IAC1C;AACF,GAEDZ,KAAK,CAAC;AAET,MAAMyC,WAAWjD,QACdhB,OAAO,CAAC,YACRiB,WAAW,CACV;AAGJgD,SACGjE,OAAO,CAAC,sBACR6B,QAAQ,CAAC,UAAU,wBACnBK,MAAM,CAAC,CAACgC;IACP,OAAO,MAAM,CAAC,yCAAyC7B,IAAI,CAAC,CAACC,MAC3DA,IAAI6B,wBAAwB,CAACD;AAEjC;AAEFlD,QAAQoD,KAAK,CAAC5F,QAAQ6F,IAAI"}
@@ -172,7 +172,7 @@ async function collectBuildTraces({ dir, config, distDir, edgeRuntimeRoutes, sta
172
172
  ...isStandalone ? [] : [
173
173
  '**/next/dist/compiled/jest-worker/**/*'
174
174
  ],
175
- '**/next/dist/compiled/webpack/(bundle4|bundle5).js',
175
+ '**/next/dist/compiled/webpack/*',
176
176
  '**/node_modules/webpack5/**/*',
177
177
  '**/next/dist/server/lib/route-resolver*',
178
178
  'next/dist/compiled/semver/semver/**/*.js',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/build/collect-build-traces.ts"],"sourcesContent":["import { Span } from '../trace'\nimport type { NextConfigComplete } from '../server/config-shared'\n\nimport {\n TRACE_IGNORES,\n type BuildTraceContext,\n getFilesMapFromReasons,\n} from './webpack/plugins/next-trace-entrypoints-plugin'\n\nimport path from 'path'\nimport fs from 'fs/promises'\nimport { nonNullable } from '../lib/non-nullable'\nimport * as ciEnvironment from '../server/ci-info'\nimport debugOriginal from 'next/dist/compiled/debug'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport { defaultOverrides } from '../server/require-hook'\nimport { nodeFileTrace } from 'next/dist/compiled/@vercel/nft'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport isError from '../lib/is-error'\nimport type { NodeFileTraceReasons } from '@vercel/nft'\nimport type { RoutesUsingEdgeRuntime } from './utils'\n\nconst debug = debugOriginal('next:build:build-traces')\n\nfunction shouldIgnore(\n file: string,\n serverIgnoreFn: (file: string) => boolean,\n reasons: NodeFileTraceReasons,\n cachedIgnoreFiles: Map<string, boolean>,\n children: Set<string> = new Set()\n) {\n if (cachedIgnoreFiles.has(file)) {\n return cachedIgnoreFiles.get(file)\n }\n\n if (serverIgnoreFn(file)) {\n cachedIgnoreFiles.set(file, true)\n return true\n }\n children.add(file)\n\n const reason = reasons.get(file)\n if (!reason || reason.parents.size === 0 || reason.type.includes('initial')) {\n cachedIgnoreFiles.set(file, false)\n return false\n }\n\n // if all parents are ignored the child file\n // should be ignored as well\n let allParentsIgnored = true\n\n for (const parent of reason.parents.values()) {\n if (!children.has(parent)) {\n children.add(parent)\n if (\n !shouldIgnore(\n parent,\n serverIgnoreFn,\n reasons,\n cachedIgnoreFiles,\n children\n )\n ) {\n allParentsIgnored = false\n break\n }\n }\n }\n\n cachedIgnoreFiles.set(file, allParentsIgnored)\n return allParentsIgnored\n}\n\nexport async function collectBuildTraces({\n dir,\n config,\n distDir,\n edgeRuntimeRoutes,\n staticPages,\n nextBuildSpan = new Span({ name: 'build' }),\n hasSsrAmpPages,\n buildTraceContext,\n outputFileTracingRoot,\n}: {\n dir: string\n distDir: string\n staticPages: string[]\n hasSsrAmpPages: boolean\n outputFileTracingRoot: string\n // pageInfos is serialized when this function runs in a worker.\n edgeRuntimeRoutes: RoutesUsingEdgeRuntime\n nextBuildSpan?: Span\n config: NextConfigComplete\n buildTraceContext?: BuildTraceContext\n}) {\n const startTime = Date.now()\n debug('starting build traces')\n\n const { outputFileTracingIncludes = {}, outputFileTracingExcludes = {} } =\n config\n const excludeGlobKeys = Object.keys(outputFileTracingExcludes)\n const includeGlobKeys = Object.keys(outputFileTracingIncludes)\n\n await nextBuildSpan\n .traceChild('node-file-trace-build', {\n isTurbotrace: 'false', // TODO(arlyon): remove this\n })\n .traceAsyncFn(async () => {\n const nextServerTraceOutput = path.join(\n distDir,\n 'next-server.js.nft.json'\n )\n const nextMinimalTraceOutput = path.join(\n distDir,\n 'next-minimal-server.js.nft.json'\n )\n const root = outputFileTracingRoot\n\n // Under standalone mode, we need to trace the extra IPC server and\n // worker files.\n const isStandalone = config.output === 'standalone'\n const sharedEntriesSet = Object.keys(defaultOverrides).map((value) =>\n require.resolve(value, {\n paths: [require.resolve('next/dist/server/require-hook')],\n })\n )\n\n const { cacheHandler } = config\n const { cacheHandlers } = config.experimental\n\n // ensure we trace any dependencies needed for custom\n // incremental cache handler\n if (cacheHandler) {\n sharedEntriesSet.push(\n require.resolve(\n path.isAbsolute(cacheHandler)\n ? cacheHandler\n : path.join(dir, cacheHandler)\n )\n )\n }\n\n if (cacheHandlers) {\n for (const handlerPath of Object.values(cacheHandlers)) {\n if (handlerPath) {\n sharedEntriesSet.push(\n require.resolve(\n path.isAbsolute(handlerPath)\n ? handlerPath\n : path.join(dir, handlerPath)\n )\n )\n }\n }\n }\n\n const serverEntries = [\n ...sharedEntriesSet,\n ...(isStandalone\n ? [\n require.resolve('next/dist/server/lib/start-server'),\n require.resolve('next/dist/server/next'),\n require.resolve('next/dist/server/require-hook'),\n ]\n : []),\n require.resolve('next/dist/server/next-server'),\n ].filter(Boolean) as string[]\n\n const minimalServerEntries = [\n ...sharedEntriesSet,\n require.resolve('next/dist/compiled/next-server/server.runtime.prod'),\n ].filter(Boolean)\n\n const additionalIgnores = new Set<string>()\n\n for (const glob of excludeGlobKeys) {\n if (picomatch(glob)('next-server')) {\n outputFileTracingExcludes[glob].forEach((exclude) => {\n additionalIgnores.add(exclude)\n })\n }\n }\n\n const makeIgnoreFn = (ignores: string[]) => {\n // pre compile the ignore globs\n const isMatch = picomatch(ignores, {\n contains: true,\n dot: true,\n })\n\n return (pathname: string) => {\n if (path.isAbsolute(pathname) && !pathname.startsWith(root)) {\n return true\n }\n\n return isMatch(pathname)\n }\n }\n\n const sharedIgnores = [\n '**/next/dist/compiled/next-server/**/*.dev.js',\n ...(isStandalone ? [] : ['**/next/dist/compiled/jest-worker/**/*']),\n '**/next/dist/compiled/webpack/(bundle4|bundle5).js',\n '**/node_modules/webpack5/**/*',\n '**/next/dist/server/lib/route-resolver*',\n 'next/dist/compiled/semver/semver/**/*.js',\n\n ...(ciEnvironment.hasNextSupport\n ? [\n // only ignore image-optimizer code when\n // this is being handled outside of next-server\n '**/next/dist/server/image-optimizer.js',\n ]\n : []),\n\n ...(!hasSsrAmpPages\n ? ['**/next/dist/compiled/@ampproject/toolbox-optimizer/**/*']\n : []),\n\n ...(isStandalone ? [] : TRACE_IGNORES),\n ...additionalIgnores,\n ]\n\n const sharedIgnoresFn = makeIgnoreFn(sharedIgnores)\n\n const serverIgnores = [\n ...sharedIgnores,\n '**/node_modules/react{,-dom,-dom-server-turbopack}/**/*.development.js',\n '**/*.d.ts',\n '**/*.map',\n '**/next/dist/pages/**/*',\n ...(ciEnvironment.hasNextSupport\n ? ['**/node_modules/sharp/**/*', '**/@img/sharp-libvips*/**/*']\n : []),\n ].filter(nonNullable)\n const serverIgnoreFn = makeIgnoreFn(serverIgnores)\n\n const minimalServerIgnores = [\n ...serverIgnores,\n '**/next/dist/compiled/edge-runtime/**/*',\n '**/next/dist/server/web/sandbox/**/*',\n '**/next/dist/server/post-process.js',\n ]\n const minimalServerIgnoreFn = makeIgnoreFn(minimalServerIgnores)\n\n const routesIgnores = [\n ...sharedIgnores,\n // server chunks are provided via next-trace-entrypoints-plugin plugin\n // as otherwise all chunks are traced here and included for all pages\n // whether they are needed or not\n '**/.next/server/chunks/**',\n '**/next/dist/server/optimize-amp.js',\n '**/next/dist/server/post-process.js',\n ].filter(nonNullable)\n\n const routeIgnoreFn = makeIgnoreFn(routesIgnores)\n\n const serverTracedFiles = new Set<string>()\n const minimalServerTracedFiles = new Set<string>()\n\n function addToTracedFiles(base: string, file: string, dest: Set<string>) {\n dest.add(\n path.relative(distDir, path.join(base, file)).replace(/\\\\/g, '/')\n )\n }\n\n if (isStandalone) {\n addToTracedFiles(\n '',\n require.resolve('next/dist/compiled/jest-worker/processChild'),\n serverTracedFiles\n )\n addToTracedFiles(\n '',\n require.resolve('next/dist/compiled/jest-worker/threadChild'),\n serverTracedFiles\n )\n }\n\n {\n const chunksToTrace: string[] = [\n ...(buildTraceContext?.chunksTrace?.action.input || []),\n ...serverEntries,\n ...minimalServerEntries,\n ]\n const result = await nodeFileTrace(chunksToTrace, {\n base: outputFileTracingRoot,\n processCwd: dir,\n mixedModules: true,\n async readFile(p) {\n try {\n return await fs.readFile(p, 'utf8')\n } catch (e) {\n if (isError(e) && (e.code === 'ENOENT' || e.code === 'EISDIR')) {\n // since tracing runs in parallel with static generation server\n // files might be removed from that step so tolerate ENOENT\n // errors gracefully\n return ''\n }\n throw e\n }\n },\n async readlink(p) {\n try {\n return await fs.readlink(p)\n } catch (e) {\n if (\n isError(e) &&\n (e.code === 'EINVAL' ||\n e.code === 'ENOENT' ||\n e.code === 'UNKNOWN')\n ) {\n return null\n }\n throw e\n }\n },\n async stat(p) {\n try {\n return await fs.stat(p)\n } catch (e) {\n if (isError(e) && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {\n return null\n }\n throw e\n }\n },\n // handle shared ignores at top-level as it\n // avoids over-tracing when we don't need to\n // and speeds up total trace time\n ignore(p) {\n if (sharedIgnoresFn(p)) {\n return true\n }\n\n // if a chunk is attempting to be traced that isn't\n // in our initial list we need to ignore it to prevent\n // over tracing as webpack needs to be the source of\n // truth for which chunks should be included for each entry\n if (\n p.includes('.next/server/chunks') &&\n !chunksToTrace.includes(path.join(outputFileTracingRoot, p))\n ) {\n return true\n }\n return false\n },\n })\n const reasons = result.reasons\n const fileList = result.fileList\n for (const file of result.esmFileList) {\n fileList.add(file)\n }\n\n const parentFilesMap = getFilesMapFromReasons(fileList, reasons)\n const cachedLookupIgnore = new Map<string, boolean>()\n const cachedLookupIgnoreMinimal = new Map<string, boolean>()\n\n for (const [entries, tracedFiles] of [\n [serverEntries, serverTracedFiles],\n [minimalServerEntries, minimalServerTracedFiles],\n ] as Array<[string[], Set<string>]>) {\n for (const file of entries) {\n const curFiles = [\n ...(parentFilesMap\n .get(path.relative(outputFileTracingRoot, file))\n ?.keys() || []),\n ]\n tracedFiles.add(path.relative(distDir, file).replace(/\\\\/g, '/'))\n\n for (const curFile of curFiles || []) {\n const filePath = path.join(outputFileTracingRoot, curFile)\n\n if (\n !shouldIgnore(\n curFile,\n tracedFiles === minimalServerTracedFiles\n ? minimalServerIgnoreFn\n : serverIgnoreFn,\n reasons,\n tracedFiles === minimalServerTracedFiles\n ? cachedLookupIgnoreMinimal\n : cachedLookupIgnore\n )\n ) {\n tracedFiles.add(\n path.relative(distDir, filePath).replace(/\\\\/g, '/')\n )\n }\n }\n }\n }\n\n const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}\n\n const cachedLookupIgnoreRoutes = new Map<string, boolean>()\n\n await Promise.all(\n [\n ...(entryNameFilesMap\n ? Object.entries(entryNameFilesMap)\n : new Map()),\n ].map(async ([entryName, entryNameFiles]) => {\n const isApp = entryName.startsWith('app/')\n const isPages = entryName.startsWith('pages/')\n let route = entryName\n if (isApp) {\n route = normalizeAppPath(route.substring('app'.length))\n }\n if (isPages) {\n route = normalizePagePath(route.substring('pages'.length))\n }\n\n // we don't need to trace for automatically statically optimized\n // pages as they don't have server bundles, note there is\n // the caveat with flying shuttle mode as it needs this for\n // detecting changed entries\n if (staticPages.includes(route)) {\n return\n }\n const entryOutputPath = path.join(\n distDir,\n 'server',\n `${entryName}.js`\n )\n const traceOutputPath = `${entryOutputPath}.nft.json`\n const existingTrace = JSON.parse(\n await fs.readFile(traceOutputPath, 'utf8')\n ) as {\n version: number\n files: string[]\n fileHashes: Record<string, string>\n }\n const traceOutputDir = path.dirname(traceOutputPath)\n const curTracedFiles = new Set<string>()\n\n for (const file of [...entryNameFiles, entryOutputPath]) {\n const curFiles = [\n ...(parentFilesMap\n .get(path.relative(outputFileTracingRoot, file))\n ?.keys() || []),\n ]\n for (const curFile of curFiles || []) {\n if (\n !shouldIgnore(\n curFile,\n routeIgnoreFn,\n reasons,\n cachedLookupIgnoreRoutes\n )\n ) {\n const filePath = path.join(outputFileTracingRoot, curFile)\n const outputFile = path\n .relative(traceOutputDir, filePath)\n .replace(/\\\\/g, '/')\n curTracedFiles.add(outputFile)\n }\n }\n }\n\n for (const file of existingTrace.files || []) {\n curTracedFiles.add(file)\n }\n\n await fs.writeFile(\n traceOutputPath,\n JSON.stringify({\n ...existingTrace,\n files: [...curTracedFiles].sort(),\n })\n )\n })\n )\n }\n\n const moduleTypes = ['app-page', 'pages']\n\n for (const type of moduleTypes) {\n const modulePath = require.resolve(\n `next/dist/server/route-modules/${type}/module.compiled`\n )\n const relativeModulePath = path.relative(root, modulePath)\n\n const contextDir = path.join(\n path.dirname(modulePath),\n 'vendored',\n 'contexts'\n )\n\n for (const item of await fs.readdir(contextDir)) {\n const itemPath = path.relative(root, path.join(contextDir, item))\n if (!serverIgnoreFn(itemPath)) {\n addToTracedFiles(root, itemPath, serverTracedFiles)\n addToTracedFiles(root, itemPath, minimalServerTracedFiles)\n }\n }\n addToTracedFiles(root, relativeModulePath, serverTracedFiles)\n addToTracedFiles(root, relativeModulePath, minimalServerTracedFiles)\n }\n\n await Promise.all([\n fs.writeFile(\n nextServerTraceOutput,\n JSON.stringify({\n version: 1,\n files: Array.from(serverTracedFiles),\n } as {\n version: number\n files: string[]\n })\n ),\n fs.writeFile(\n nextMinimalTraceOutput,\n JSON.stringify({\n version: 1,\n files: Array.from(minimalServerTracedFiles),\n } as {\n version: number\n files: string[]\n })\n ),\n ])\n })\n\n // apply outputFileTracingIncludes/outputFileTracingExcludes after runTurbotrace\n const includeExcludeSpan = nextBuildSpan.traceChild('apply-include-excludes')\n await includeExcludeSpan.traceAsyncFn(async () => {\n const globOrig =\n require('next/dist/compiled/glob') as typeof import('next/dist/compiled/glob')\n const glob = (pattern: string): Promise<string[]> => {\n return new Promise((resolve, reject) => {\n globOrig(\n pattern,\n { cwd: dir, nodir: true, dot: true },\n (err, files) => {\n if (err) {\n return reject(err)\n }\n resolve(files)\n }\n )\n })\n }\n\n const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}\n\n await Promise.all(\n [\n ...(entryNameFilesMap ? Object.entries(entryNameFilesMap) : new Map()),\n ].map(async ([entryName]) => {\n const isApp = entryName.startsWith('app/')\n const isPages = entryName.startsWith('pages/')\n let route = entryName\n if (isApp) {\n route = normalizeAppPath(entryName)\n }\n if (isPages) {\n route = normalizePagePath(entryName)\n }\n\n if (staticPages.includes(route)) {\n return\n }\n\n // edge routes have no trace files\n if (edgeRuntimeRoutes.hasOwnProperty(route)) {\n return\n }\n\n const combinedIncludes = new Set<string>()\n const combinedExcludes = new Set<string>()\n for (const curGlob of includeGlobKeys) {\n const isMatch = picomatch(curGlob, { dot: true, contains: true })\n if (isMatch(route)) {\n for (const include of outputFileTracingIncludes[curGlob]) {\n combinedIncludes.add(include.replace(/\\\\/g, '/'))\n }\n }\n }\n\n for (const curGlob of excludeGlobKeys) {\n const isMatch = picomatch(curGlob, { dot: true, contains: true })\n if (isMatch(route)) {\n for (const exclude of outputFileTracingExcludes[curGlob]) {\n combinedExcludes.add(exclude)\n }\n }\n }\n\n if (!combinedIncludes?.size && !combinedExcludes?.size) {\n return\n }\n\n const traceFile = path.join(\n distDir,\n `server`,\n `${entryName}.js.nft.json`\n )\n const pageDir = path.dirname(traceFile)\n const traceContent = JSON.parse(await fs.readFile(traceFile, 'utf8'))\n const includes: string[] = []\n const resolvedTraceIncludes = new Map<string, string[]>()\n\n if (combinedIncludes?.size) {\n await Promise.all(\n [...combinedIncludes].map(async (includeGlob) => {\n const results = await glob(includeGlob)\n const resolvedInclude = resolvedTraceIncludes.get(\n includeGlob\n ) || [\n ...results.map((file) => {\n return path.relative(pageDir, path.join(dir, file))\n }),\n ]\n includes.push(...resolvedInclude)\n resolvedTraceIncludes.set(includeGlob, resolvedInclude)\n })\n )\n }\n const combined = new Set([...traceContent.files, ...includes])\n\n if (combinedExcludes?.size) {\n const resolvedGlobs = [...combinedExcludes].map((exclude) =>\n path.join(dir, exclude)\n )\n\n // pre compile before forEach\n const isMatch = picomatch(resolvedGlobs, {\n dot: true,\n contains: true,\n })\n\n combined.forEach((file) => {\n if (isMatch(path.join(pageDir, file))) {\n combined.delete(file)\n }\n })\n }\n\n // overwrite trace file with custom includes/excludes\n await fs.writeFile(\n traceFile,\n JSON.stringify({\n version: traceContent.version,\n files: [...combined],\n })\n )\n })\n )\n })\n\n debug(`finished build tracing ${Date.now() - startTime}ms`)\n}\n"],"names":["collectBuildTraces","debug","debugOriginal","shouldIgnore","file","serverIgnoreFn","reasons","cachedIgnoreFiles","children","Set","has","get","set","add","reason","parents","size","type","includes","allParentsIgnored","parent","values","dir","config","distDir","edgeRuntimeRoutes","staticPages","nextBuildSpan","Span","name","hasSsrAmpPages","buildTraceContext","outputFileTracingRoot","startTime","Date","now","outputFileTracingIncludes","outputFileTracingExcludes","excludeGlobKeys","Object","keys","includeGlobKeys","traceChild","isTurbotrace","traceAsyncFn","nextServerTraceOutput","path","join","nextMinimalTraceOutput","root","isStandalone","output","sharedEntriesSet","defaultOverrides","map","value","require","resolve","paths","cacheHandler","cacheHandlers","experimental","push","isAbsolute","handlerPath","serverEntries","filter","Boolean","minimalServerEntries","additionalIgnores","glob","picomatch","forEach","exclude","makeIgnoreFn","ignores","isMatch","contains","dot","pathname","startsWith","sharedIgnores","ciEnvironment","hasNextSupport","TRACE_IGNORES","sharedIgnoresFn","serverIgnores","nonNullable","minimalServerIgnores","minimalServerIgnoreFn","routesIgnores","routeIgnoreFn","serverTracedFiles","minimalServerTracedFiles","addToTracedFiles","base","dest","relative","replace","chunksToTrace","chunksTrace","action","input","result","nodeFileTrace","processCwd","mixedModules","readFile","p","fs","e","isError","code","readlink","stat","ignore","fileList","esmFileList","parentFilesMap","getFilesMapFromReasons","cachedLookupIgnore","Map","cachedLookupIgnoreMinimal","entries","tracedFiles","curFiles","curFile","filePath","entryNameFilesMap","cachedLookupIgnoreRoutes","Promise","all","entryName","entryNameFiles","isApp","isPages","route","normalizeAppPath","substring","length","normalizePagePath","entryOutputPath","traceOutputPath","existingTrace","JSON","parse","traceOutputDir","dirname","curTracedFiles","outputFile","files","writeFile","stringify","sort","moduleTypes","modulePath","relativeModulePath","contextDir","item","readdir","itemPath","version","Array","from","includeExcludeSpan","globOrig","pattern","reject","cwd","nodir","err","hasOwnProperty","combinedIncludes","combinedExcludes","curGlob","include","traceFile","pageDir","traceContent","resolvedTraceIncludes","includeGlob","results","resolvedInclude","combined","resolvedGlobs","delete"],"mappings":";;;;+BA0EsBA;;;eAAAA;;;uBA1ED;4CAOd;6DAEU;iEACF;6BACa;gEACG;8DACL;kEACJ;6BACW;qBACH;mCACI;0BACD;gEACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIpB,MAAMC,QAAQC,IAAAA,cAAa,EAAC;AAE5B,SAASC,aACPC,IAAY,EACZC,cAAyC,EACzCC,OAA6B,EAC7BC,iBAAuC,EACvCC,WAAwB,IAAIC,KAAK;IAEjC,IAAIF,kBAAkBG,GAAG,CAACN,OAAO;QAC/B,OAAOG,kBAAkBI,GAAG,CAACP;IAC/B;IAEA,IAAIC,eAAeD,OAAO;QACxBG,kBAAkBK,GAAG,CAACR,MAAM;QAC5B,OAAO;IACT;IACAI,SAASK,GAAG,CAACT;IAEb,MAAMU,SAASR,QAAQK,GAAG,CAACP;IAC3B,IAAI,CAACU,UAAUA,OAAOC,OAAO,CAACC,IAAI,KAAK,KAAKF,OAAOG,IAAI,CAACC,QAAQ,CAAC,YAAY;QAC3EX,kBAAkBK,GAAG,CAACR,MAAM;QAC5B,OAAO;IACT;IAEA,4CAA4C;IAC5C,4BAA4B;IAC5B,IAAIe,oBAAoB;IAExB,KAAK,MAAMC,UAAUN,OAAOC,OAAO,CAACM,MAAM,GAAI;QAC5C,IAAI,CAACb,SAASE,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KpI;aAAS;YAE7D,IAAI2J,oCAAAA,iBAAkB7J,IAAI,EAAE;gBAC1B,MAAMwK,gBAAgB;uBAAIX;iBAAiB,CAACvH,GAAG,CAAC,CAACmB,UAC/C3B,aAAI,CAACC,IAAI,CAACzB,KAAKmD;gBAGjB,6BAA6B;gBAC7B,MAAMG,UAAUL,IAAAA,kBAAS,EAACiH,eAAe;oBACvC1G,KAAK;oBACLD,UAAU;gBACZ;gBAEA0G,SAAS/G,OAAO,CAAC,CAACpE;oBAChB,IAAIwE,QAAQ9B,aAAI,CAACC,IAAI,CAACkI,SAAS7K,QAAQ;wBACrCmL,SAASE,MAAM,CAACrL;oBAClB;gBACF;YACF;YAEA,qDAAqD;YACrD,MAAMyG,iBAAE,CAAC0C,SAAS,CAChByB,WACAhC,KAAKQ,SAAS,CAAC;gBACbS,SAASiB,aAAajB,OAAO;gBAC7BX,OAAO;uBAAIiC;iBAAS;YACtB;QAEJ;IAEJ;IAEAtL,MAAM,CAAC,uBAAuB,EAAEiC,KAAKC,GAAG,KAAKF,UAAU,EAAE,CAAC;AAC5D"}
1
+ {"version":3,"sources":["../../src/build/collect-build-traces.ts"],"sourcesContent":["import { Span } from '../trace'\nimport type { NextConfigComplete } from '../server/config-shared'\n\nimport {\n TRACE_IGNORES,\n type BuildTraceContext,\n getFilesMapFromReasons,\n} from './webpack/plugins/next-trace-entrypoints-plugin'\n\nimport path from 'path'\nimport fs from 'fs/promises'\nimport { nonNullable } from '../lib/non-nullable'\nimport * as ciEnvironment from '../server/ci-info'\nimport debugOriginal from 'next/dist/compiled/debug'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport { defaultOverrides } from '../server/require-hook'\nimport { nodeFileTrace } from 'next/dist/compiled/@vercel/nft'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport isError from '../lib/is-error'\nimport type { NodeFileTraceReasons } from '@vercel/nft'\nimport type { RoutesUsingEdgeRuntime } from './utils'\n\nconst debug = debugOriginal('next:build:build-traces')\n\nfunction shouldIgnore(\n file: string,\n serverIgnoreFn: (file: string) => boolean,\n reasons: NodeFileTraceReasons,\n cachedIgnoreFiles: Map<string, boolean>,\n children: Set<string> = new Set()\n) {\n if (cachedIgnoreFiles.has(file)) {\n return cachedIgnoreFiles.get(file)\n }\n\n if (serverIgnoreFn(file)) {\n cachedIgnoreFiles.set(file, true)\n return true\n }\n children.add(file)\n\n const reason = reasons.get(file)\n if (!reason || reason.parents.size === 0 || reason.type.includes('initial')) {\n cachedIgnoreFiles.set(file, false)\n return false\n }\n\n // if all parents are ignored the child file\n // should be ignored as well\n let allParentsIgnored = true\n\n for (const parent of reason.parents.values()) {\n if (!children.has(parent)) {\n children.add(parent)\n if (\n !shouldIgnore(\n parent,\n serverIgnoreFn,\n reasons,\n cachedIgnoreFiles,\n children\n )\n ) {\n allParentsIgnored = false\n break\n }\n }\n }\n\n cachedIgnoreFiles.set(file, allParentsIgnored)\n return allParentsIgnored\n}\n\nexport async function collectBuildTraces({\n dir,\n config,\n distDir,\n edgeRuntimeRoutes,\n staticPages,\n nextBuildSpan = new Span({ name: 'build' }),\n hasSsrAmpPages,\n buildTraceContext,\n outputFileTracingRoot,\n}: {\n dir: string\n distDir: string\n staticPages: string[]\n hasSsrAmpPages: boolean\n outputFileTracingRoot: string\n // pageInfos is serialized when this function runs in a worker.\n edgeRuntimeRoutes: RoutesUsingEdgeRuntime\n nextBuildSpan?: Span\n config: NextConfigComplete\n buildTraceContext?: BuildTraceContext\n}) {\n const startTime = Date.now()\n debug('starting build traces')\n\n const { outputFileTracingIncludes = {}, outputFileTracingExcludes = {} } =\n config\n const excludeGlobKeys = Object.keys(outputFileTracingExcludes)\n const includeGlobKeys = Object.keys(outputFileTracingIncludes)\n\n await nextBuildSpan\n .traceChild('node-file-trace-build', {\n isTurbotrace: 'false', // TODO(arlyon): remove this\n })\n .traceAsyncFn(async () => {\n const nextServerTraceOutput = path.join(\n distDir,\n 'next-server.js.nft.json'\n )\n const nextMinimalTraceOutput = path.join(\n distDir,\n 'next-minimal-server.js.nft.json'\n )\n const root = outputFileTracingRoot\n\n // Under standalone mode, we need to trace the extra IPC server and\n // worker files.\n const isStandalone = config.output === 'standalone'\n const sharedEntriesSet = Object.keys(defaultOverrides).map((value) =>\n require.resolve(value, {\n paths: [require.resolve('next/dist/server/require-hook')],\n })\n )\n\n const { cacheHandler } = config\n const { cacheHandlers } = config.experimental\n\n // ensure we trace any dependencies needed for custom\n // incremental cache handler\n if (cacheHandler) {\n sharedEntriesSet.push(\n require.resolve(\n path.isAbsolute(cacheHandler)\n ? cacheHandler\n : path.join(dir, cacheHandler)\n )\n )\n }\n\n if (cacheHandlers) {\n for (const handlerPath of Object.values(cacheHandlers)) {\n if (handlerPath) {\n sharedEntriesSet.push(\n require.resolve(\n path.isAbsolute(handlerPath)\n ? handlerPath\n : path.join(dir, handlerPath)\n )\n )\n }\n }\n }\n\n const serverEntries = [\n ...sharedEntriesSet,\n ...(isStandalone\n ? [\n require.resolve('next/dist/server/lib/start-server'),\n require.resolve('next/dist/server/next'),\n require.resolve('next/dist/server/require-hook'),\n ]\n : []),\n require.resolve('next/dist/server/next-server'),\n ].filter(Boolean) as string[]\n\n const minimalServerEntries = [\n ...sharedEntriesSet,\n require.resolve('next/dist/compiled/next-server/server.runtime.prod'),\n ].filter(Boolean)\n\n const additionalIgnores = new Set<string>()\n\n for (const glob of excludeGlobKeys) {\n if (picomatch(glob)('next-server')) {\n outputFileTracingExcludes[glob].forEach((exclude) => {\n additionalIgnores.add(exclude)\n })\n }\n }\n\n const makeIgnoreFn = (ignores: string[]) => {\n // pre compile the ignore globs\n const isMatch = picomatch(ignores, {\n contains: true,\n dot: true,\n })\n\n return (pathname: string) => {\n if (path.isAbsolute(pathname) && !pathname.startsWith(root)) {\n return true\n }\n\n return isMatch(pathname)\n }\n }\n\n const sharedIgnores = [\n '**/next/dist/compiled/next-server/**/*.dev.js',\n ...(isStandalone ? [] : ['**/next/dist/compiled/jest-worker/**/*']),\n '**/next/dist/compiled/webpack/*',\n '**/node_modules/webpack5/**/*',\n '**/next/dist/server/lib/route-resolver*',\n 'next/dist/compiled/semver/semver/**/*.js',\n\n ...(ciEnvironment.hasNextSupport\n ? [\n // only ignore image-optimizer code when\n // this is being handled outside of next-server\n '**/next/dist/server/image-optimizer.js',\n ]\n : []),\n\n ...(!hasSsrAmpPages\n ? ['**/next/dist/compiled/@ampproject/toolbox-optimizer/**/*']\n : []),\n\n ...(isStandalone ? [] : TRACE_IGNORES),\n ...additionalIgnores,\n ]\n\n const sharedIgnoresFn = makeIgnoreFn(sharedIgnores)\n\n const serverIgnores = [\n ...sharedIgnores,\n '**/node_modules/react{,-dom,-dom-server-turbopack}/**/*.development.js',\n '**/*.d.ts',\n '**/*.map',\n '**/next/dist/pages/**/*',\n ...(ciEnvironment.hasNextSupport\n ? ['**/node_modules/sharp/**/*', '**/@img/sharp-libvips*/**/*']\n : []),\n ].filter(nonNullable)\n const serverIgnoreFn = makeIgnoreFn(serverIgnores)\n\n const minimalServerIgnores = [\n ...serverIgnores,\n '**/next/dist/compiled/edge-runtime/**/*',\n '**/next/dist/server/web/sandbox/**/*',\n '**/next/dist/server/post-process.js',\n ]\n const minimalServerIgnoreFn = makeIgnoreFn(minimalServerIgnores)\n\n const routesIgnores = [\n ...sharedIgnores,\n // server chunks are provided via next-trace-entrypoints-plugin plugin\n // as otherwise all chunks are traced here and included for all pages\n // whether they are needed or not\n '**/.next/server/chunks/**',\n '**/next/dist/server/optimize-amp.js',\n '**/next/dist/server/post-process.js',\n ].filter(nonNullable)\n\n const routeIgnoreFn = makeIgnoreFn(routesIgnores)\n\n const serverTracedFiles = new Set<string>()\n const minimalServerTracedFiles = new Set<string>()\n\n function addToTracedFiles(base: string, file: string, dest: Set<string>) {\n dest.add(\n path.relative(distDir, path.join(base, file)).replace(/\\\\/g, '/')\n )\n }\n\n if (isStandalone) {\n addToTracedFiles(\n '',\n require.resolve('next/dist/compiled/jest-worker/processChild'),\n serverTracedFiles\n )\n addToTracedFiles(\n '',\n require.resolve('next/dist/compiled/jest-worker/threadChild'),\n serverTracedFiles\n )\n }\n\n {\n const chunksToTrace: string[] = [\n ...(buildTraceContext?.chunksTrace?.action.input || []),\n ...serverEntries,\n ...minimalServerEntries,\n ]\n const result = await nodeFileTrace(chunksToTrace, {\n base: outputFileTracingRoot,\n processCwd: dir,\n mixedModules: true,\n async readFile(p) {\n try {\n return await fs.readFile(p, 'utf8')\n } catch (e) {\n if (isError(e) && (e.code === 'ENOENT' || e.code === 'EISDIR')) {\n // since tracing runs in parallel with static generation server\n // files might be removed from that step so tolerate ENOENT\n // errors gracefully\n return ''\n }\n throw e\n }\n },\n async readlink(p) {\n try {\n return await fs.readlink(p)\n } catch (e) {\n if (\n isError(e) &&\n (e.code === 'EINVAL' ||\n e.code === 'ENOENT' ||\n e.code === 'UNKNOWN')\n ) {\n return null\n }\n throw e\n }\n },\n async stat(p) {\n try {\n return await fs.stat(p)\n } catch (e) {\n if (isError(e) && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {\n return null\n }\n throw e\n }\n },\n // handle shared ignores at top-level as it\n // avoids over-tracing when we don't need to\n // and speeds up total trace time\n ignore(p) {\n if (sharedIgnoresFn(p)) {\n return true\n }\n\n // if a chunk is attempting to be traced that isn't\n // in our initial list we need to ignore it to prevent\n // over tracing as webpack needs to be the source of\n // truth for which chunks should be included for each entry\n if (\n p.includes('.next/server/chunks') &&\n !chunksToTrace.includes(path.join(outputFileTracingRoot, p))\n ) {\n return true\n }\n return false\n },\n })\n const reasons = result.reasons\n const fileList = result.fileList\n for (const file of result.esmFileList) {\n fileList.add(file)\n }\n\n const parentFilesMap = getFilesMapFromReasons(fileList, reasons)\n const cachedLookupIgnore = new Map<string, boolean>()\n const cachedLookupIgnoreMinimal = new Map<string, boolean>()\n\n for (const [entries, tracedFiles] of [\n [serverEntries, serverTracedFiles],\n [minimalServerEntries, minimalServerTracedFiles],\n ] as Array<[string[], Set<string>]>) {\n for (const file of entries) {\n const curFiles = [\n ...(parentFilesMap\n .get(path.relative(outputFileTracingRoot, file))\n ?.keys() || []),\n ]\n tracedFiles.add(path.relative(distDir, file).replace(/\\\\/g, '/'))\n\n for (const curFile of curFiles || []) {\n const filePath = path.join(outputFileTracingRoot, curFile)\n\n if (\n !shouldIgnore(\n curFile,\n tracedFiles === minimalServerTracedFiles\n ? minimalServerIgnoreFn\n : serverIgnoreFn,\n reasons,\n tracedFiles === minimalServerTracedFiles\n ? cachedLookupIgnoreMinimal\n : cachedLookupIgnore\n )\n ) {\n tracedFiles.add(\n path.relative(distDir, filePath).replace(/\\\\/g, '/')\n )\n }\n }\n }\n }\n\n const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}\n\n const cachedLookupIgnoreRoutes = new Map<string, boolean>()\n\n await Promise.all(\n [\n ...(entryNameFilesMap\n ? Object.entries(entryNameFilesMap)\n : new Map()),\n ].map(async ([entryName, entryNameFiles]) => {\n const isApp = entryName.startsWith('app/')\n const isPages = entryName.startsWith('pages/')\n let route = entryName\n if (isApp) {\n route = normalizeAppPath(route.substring('app'.length))\n }\n if (isPages) {\n route = normalizePagePath(route.substring('pages'.length))\n }\n\n // we don't need to trace for automatically statically optimized\n // pages as they don't have server bundles, note there is\n // the caveat with flying shuttle mode as it needs this for\n // detecting changed entries\n if (staticPages.includes(route)) {\n return\n }\n const entryOutputPath = path.join(\n distDir,\n 'server',\n `${entryName}.js`\n )\n const traceOutputPath = `${entryOutputPath}.nft.json`\n const existingTrace = JSON.parse(\n await fs.readFile(traceOutputPath, 'utf8')\n ) as {\n version: number\n files: string[]\n fileHashes: Record<string, string>\n }\n const traceOutputDir = path.dirname(traceOutputPath)\n const curTracedFiles = new Set<string>()\n\n for (const file of [...entryNameFiles, entryOutputPath]) {\n const curFiles = [\n ...(parentFilesMap\n .get(path.relative(outputFileTracingRoot, file))\n ?.keys() || []),\n ]\n for (const curFile of curFiles || []) {\n if (\n !shouldIgnore(\n curFile,\n routeIgnoreFn,\n reasons,\n cachedLookupIgnoreRoutes\n )\n ) {\n const filePath = path.join(outputFileTracingRoot, curFile)\n const outputFile = path\n .relative(traceOutputDir, filePath)\n .replace(/\\\\/g, '/')\n curTracedFiles.add(outputFile)\n }\n }\n }\n\n for (const file of existingTrace.files || []) {\n curTracedFiles.add(file)\n }\n\n await fs.writeFile(\n traceOutputPath,\n JSON.stringify({\n ...existingTrace,\n files: [...curTracedFiles].sort(),\n })\n )\n })\n )\n }\n\n const moduleTypes = ['app-page', 'pages']\n\n for (const type of moduleTypes) {\n const modulePath = require.resolve(\n `next/dist/server/route-modules/${type}/module.compiled`\n )\n const relativeModulePath = path.relative(root, modulePath)\n\n const contextDir = path.join(\n path.dirname(modulePath),\n 'vendored',\n 'contexts'\n )\n\n for (const item of await fs.readdir(contextDir)) {\n const itemPath = path.relative(root, path.join(contextDir, item))\n if (!serverIgnoreFn(itemPath)) {\n addToTracedFiles(root, itemPath, serverTracedFiles)\n addToTracedFiles(root, itemPath, minimalServerTracedFiles)\n }\n }\n addToTracedFiles(root, relativeModulePath, serverTracedFiles)\n addToTracedFiles(root, relativeModulePath, minimalServerTracedFiles)\n }\n\n await Promise.all([\n fs.writeFile(\n nextServerTraceOutput,\n JSON.stringify({\n version: 1,\n files: Array.from(serverTracedFiles),\n } as {\n version: number\n files: string[]\n })\n ),\n fs.writeFile(\n nextMinimalTraceOutput,\n JSON.stringify({\n version: 1,\n files: Array.from(minimalServerTracedFiles),\n } as {\n version: number\n files: string[]\n })\n ),\n ])\n })\n\n // apply outputFileTracingIncludes/outputFileTracingExcludes after runTurbotrace\n const includeExcludeSpan = nextBuildSpan.traceChild('apply-include-excludes')\n await includeExcludeSpan.traceAsyncFn(async () => {\n const globOrig =\n require('next/dist/compiled/glob') as typeof import('next/dist/compiled/glob')\n const glob = (pattern: string): Promise<string[]> => {\n return new Promise((resolve, reject) => {\n globOrig(\n pattern,\n { cwd: dir, nodir: true, dot: true },\n (err, files) => {\n if (err) {\n return reject(err)\n }\n resolve(files)\n }\n )\n })\n }\n\n const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}\n\n await Promise.all(\n [\n ...(entryNameFilesMap ? Object.entries(entryNameFilesMap) : new Map()),\n ].map(async ([entryName]) => {\n const isApp = entryName.startsWith('app/')\n const isPages = entryName.startsWith('pages/')\n let route = entryName\n if (isApp) {\n route = normalizeAppPath(entryName)\n }\n if (isPages) {\n route = normalizePagePath(entryName)\n }\n\n if (staticPages.includes(route)) {\n return\n }\n\n // edge routes have no trace files\n if (edgeRuntimeRoutes.hasOwnProperty(route)) {\n return\n }\n\n const combinedIncludes = new Set<string>()\n const combinedExcludes = new Set<string>()\n for (const curGlob of includeGlobKeys) {\n const isMatch = picomatch(curGlob, { dot: true, contains: true })\n if (isMatch(route)) {\n for (const include of outputFileTracingIncludes[curGlob]) {\n combinedIncludes.add(include.replace(/\\\\/g, '/'))\n }\n }\n }\n\n for (const curGlob of excludeGlobKeys) {\n const isMatch = picomatch(curGlob, { dot: true, contains: true })\n if (isMatch(route)) {\n for (const exclude of outputFileTracingExcludes[curGlob]) {\n combinedExcludes.add(exclude)\n }\n }\n }\n\n if (!combinedIncludes?.size && !combinedExcludes?.size) {\n return\n }\n\n const traceFile = path.join(\n distDir,\n `server`,\n `${entryName}.js.nft.json`\n )\n const pageDir = path.dirname(traceFile)\n const traceContent = JSON.parse(await fs.readFile(traceFile, 'utf8'))\n const includes: string[] = []\n const resolvedTraceIncludes = new Map<string, string[]>()\n\n if (combinedIncludes?.size) {\n await Promise.all(\n [...combinedIncludes].map(async (includeGlob) => {\n const results = await glob(includeGlob)\n const resolvedInclude = resolvedTraceIncludes.get(\n includeGlob\n ) || [\n ...results.map((file) => {\n return path.relative(pageDir, path.join(dir, file))\n }),\n ]\n includes.push(...resolvedInclude)\n resolvedTraceIncludes.set(includeGlob, resolvedInclude)\n })\n )\n }\n const combined = new Set([...traceContent.files, ...includes])\n\n if (combinedExcludes?.size) {\n const resolvedGlobs = [...combinedExcludes].map((exclude) =>\n path.join(dir, exclude)\n )\n\n // pre compile before forEach\n const isMatch = picomatch(resolvedGlobs, {\n dot: true,\n contains: true,\n })\n\n combined.forEach((file) => {\n if (isMatch(path.join(pageDir, file))) {\n combined.delete(file)\n }\n })\n }\n\n // overwrite trace file with custom includes/excludes\n await fs.writeFile(\n traceFile,\n JSON.stringify({\n version: traceContent.version,\n files: [...combined],\n })\n )\n })\n )\n })\n\n debug(`finished build tracing ${Date.now() - startTime}ms`)\n}\n"],"names":["collectBuildTraces","debug","debugOriginal","shouldIgnore","file","serverIgnoreFn","reasons","cachedIgnoreFiles","children","Set","has","get","set","add","reason","parents","size","type","includes","allParentsIgnored","parent","values","dir","config","distDir","edgeRuntimeRoutes","staticPages","nextBuildSpan","Span","name","hasSsrAmpPages","buildTraceContext","outputFileTracingRoot","startTime","Date","now","outputFileTracingIncludes","outputFileTracingExcludes","excludeGlobKeys","Object","keys","includeGlobKeys","traceChild","isTurbotrace","traceAsyncFn","nextServerTraceOutput","path","join","nextMinimalTraceOutput","root","isStandalone","output","sharedEntriesSet","defaultOverrides","map","value","require","resolve","paths","cacheHandler","cacheHandlers","experimental","push","isAbsolute","handlerPath","serverEntries","filter","Boolean","minimalServerEntries","additionalIgnores","glob","picomatch","forEach","exclude","makeIgnoreFn","ignores","isMatch","contains","dot","pathname","startsWith","sharedIgnores","ciEnvironment","hasNextSupport","TRACE_IGNORES","sharedIgnoresFn","serverIgnores","nonNullable","minimalServerIgnores","minimalServerIgnoreFn","routesIgnores","routeIgnoreFn","serverTracedFiles","minimalServerTracedFiles","addToTracedFiles","base","dest","relative","replace","chunksToTrace","chunksTrace","action","input","result","nodeFileTrace","processCwd","mixedModules","readFile","p","fs","e","isError","code","readlink","stat","ignore","fileList","esmFileList","parentFilesMap","getFilesMapFromReasons","cachedLookupIgnore","Map","cachedLookupIgnoreMinimal","entries","tracedFiles","curFiles","curFile","filePath","entryNameFilesMap","cachedLookupIgnoreRoutes","Promise","all","entryName","entryNameFiles","isApp","isPages","route","normalizeAppPath","substring","length","normalizePagePath","entryOutputPath","traceOutputPath","existingTrace","JSON","parse","traceOutputDir","dirname","curTracedFiles","outputFile","files","writeFile","stringify","sort","moduleTypes","modulePath","relativeModulePath","contextDir","item","readdir","itemPath","version","Array","from","includeExcludeSpan","globOrig","pattern","reject","cwd","nodir","err","hasOwnProperty","combinedIncludes","combinedExcludes","curGlob","include","traceFile","pageDir","traceContent","resolvedTraceIncludes","includeGlob","results","resolvedInclude","combined","resolvedGlobs","delete"],"mappings":";;;;+BA0EsBA;;;eAAAA;;;uBA1ED;4CAOd;6DAEU;iEACF;6BACa;gEACG;8DACL;kEACJ;6BACW;qBACH;mCACI;0BACD;gEACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIpB,MAAMC,QAAQC,IAAAA,cAAa,EAAC;AAE5B,SAASC,aACPC,IAAY,EACZC,cAAyC,EACzCC,OAA6B,EAC7BC,iBAAuC,EACvCC,WAAwB,IAAIC,KAAK;IAEjC,IAAIF,kBAAkBG,GAAG,CAACN,OAAO;QAC/B,OAAOG,kBAAkBI,GAAG,CAACP;IAC/B;IAEA,IAAIC,eAAeD,OAAO;QACxBG,kBAAkBK,GAAG,CAACR,MAAM;QAC5B,OAAO;IACT;IACAI,SAASK,GAAG,CAACT;IAEb,MAAMU,SAASR,QAAQK,GAAG,CAACP;IAC3B,IAAI,CAACU,UAAUA,OAAOC,OAAO,CAACC,IAAI,KAAK,KAAKF,OAAOG,IAAI,CAACC,QAAQ,CAAC,YAAY;QAC3EX,kBAAkBK,GAAG,CAACR,MAAM;QAC5B,OAAO;IACT;IAEA,4CAA4C;IAC5C,4BAA4B;IAC5B,IAAIe,oBAAoB;IAExB,KAAK,MAAMC,UAAUN,OAAOC,OAAO,CAACM,MAAM,GAAI;QAC5C,IAAI,CAACb,SAASE,GAAG,CAACU,SAAS;YACzBZ,SAASK,GAAG,CAACO;YACb,IACE,CAACjB,aACCiB,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AMwK,gBAAgB;uBAAIX;iBAAiB,CAACvH,GAAG,CAAC,CAACmB,UAC/C3B,aAAI,CAACC,IAAI,CAACzB,KAAKmD;gBAGjB,6BAA6B;gBAC7B,MAAMG,UAAUL,IAAAA,kBAAS,EAACiH,eAAe;oBACvC1G,KAAK;oBACLD,UAAU;gBACZ;gBAEA0G,SAAS/G,OAAO,CAAC,CAACpE;oBAChB,IAAIwE,QAAQ9B,aAAI,CAACC,IAAI,CAACkI,SAAS7K,QAAQ;wBACrCmL,SAASE,MAAM,CAACrL;oBAClB;gBACF;YACF;YAEA,qDAAqD;YACrD,MAAMyG,iBAAE,CAAC0C,SAAS,CAChByB,WACAhC,KAAKQ,SAAS,CAAC;gBACbS,SAASiB,aAAajB,OAAO;gBAC7BX,OAAO;uBAAIiC;iBAAS;YACtB;QAEJ;IAEJ;IAEAtL,MAAM,CAAC,uBAAuB,EAAEiC,KAAKC,GAAG,KAAKF,UAAU,EAAE,CAAC;AAC5D"}
@@ -220,5 +220,5 @@ export declare function createStaticWorker(config: NextConfigComplete, progress?
220
220
  run: () => void;
221
221
  clear: () => void;
222
222
  }): StaticWorker;
223
- export default function build(dir: string, reactProductionProfiling: boolean | undefined, debugOutput: boolean | undefined, runLint: boolean | undefined, noMangling: boolean | undefined, appDirOnly: boolean | undefined, turboNextBuild: boolean | undefined, experimentalBuildMode: 'default' | 'compile' | 'generate', traceUploadUrl: string | undefined): Promise<void>;
223
+ export default function build(dir: string, reactProductionProfiling: boolean | undefined, debugOutput: boolean | undefined, runLint: boolean | undefined, noMangling: boolean | undefined, appDirOnly: boolean | undefined, turboNextBuild: boolean | undefined, experimentalBuildMode: 'default' | 'compile' | 'generate' | 'generate-env', traceUploadUrl: string | undefined): Promise<void>;
224
224
  export {};
@@ -368,7 +368,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
368
368
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
369
369
  buildMode: experimentalBuildMode,
370
370
  isTurboBuild: String(turboNextBuild),
371
- version: "15.3.0-canary.5"
371
+ version: "15.3.0-canary.6"
372
372
  });
373
373
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
374
374
  _buildcontext.NextBuildContext.dir = dir;
@@ -400,6 +400,23 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
400
400
  (0, _trace.setGlobal)('distDir', distDir);
401
401
  const buildId = await getBuildId(isGenerateMode, distDir, nextBuildSpan, config);
402
402
  _buildcontext.NextBuildContext.buildId = buildId;
403
+ if (experimentalBuildMode === 'generate-env') {
404
+ if (turboNextBuild) {
405
+ _log.warn('generate-env is not needed with turbopack');
406
+ process.exit(0);
407
+ }
408
+ _log.info('Inlining static env ...');
409
+ await nextBuildSpan.traceChild('inline-static-env').traceAsyncFn(async ()=>{
410
+ await (0, _inlinestaticenv.inlineStaticEnv)({
411
+ distDir,
412
+ config
413
+ });
414
+ });
415
+ _log.info('Complete');
416
+ await (0, _trace.flushAllTraces)();
417
+ (0, _swc.teardownTraceSubscriber)();
418
+ process.exit(0);
419
+ }
403
420
  // when using compile mode static env isn't inlined so we
404
421
  // need to populate in normal runtime env
405
422
  if (isCompileMode || isGenerateMode) {
@@ -732,7 +749,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
732
749
  // Files outside of the distDir can be "type": "module"
733
750
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
734
751
  // These are written to distDir, so they need to come after creating and cleaning distDr.
735
- await (0, _builddiagnostics.recordFrameworkVersion)("15.3.0-canary.5");
752
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.3.0-canary.6");
736
753
  await (0, _builddiagnostics.updateBuildDiagnostics)({
737
754
  buildStage: 'start'
738
755
  });
@@ -1310,7 +1327,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
1310
1327
  cacheHandlers: normalizedCacheHandlers,
1311
1328
  trustHostHeader: _ciinfo.hasNextSupport,
1312
1329
  // @ts-expect-error internal field TODO: fix this, should use a separate mechanism to pass the info.
1313
- isExperimentalCompile: isCompileMode || isGenerateMode && config.experimental.generateOnlyEnv
1330
+ isExperimentalCompile: isCompileMode
1314
1331
  }
1315
1332
  },
1316
1333
  appDir: dir,
@@ -1475,20 +1492,13 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
1475
1492
  // we don't need to inline for turbopack build as
1476
1493
  // it will handle it's own caching separate of compile
1477
1494
  if (isGenerateMode && !turboNextBuild) {
1495
+ _log.info('Inlining static env ...');
1478
1496
  await nextBuildSpan.traceChild('inline-static-env').traceAsyncFn(async ()=>{
1479
1497
  await (0, _inlinestaticenv.inlineStaticEnv)({
1480
1498
  distDir,
1481
1499
  config
1482
1500
  });
1483
1501
  });
1484
- // users might only want to inline env during experimental generate
1485
- // instead of also prerendering e.g. for test mode so exit after
1486
- if (config.experimental.generateOnlyEnv) {
1487
- _log.info('Inlined static env, exiting due to experimental.generateOnlyEnv');
1488
- await (0, _trace.flushAllTraces)();
1489
- (0, _swc.teardownTraceSubscriber)();
1490
- process.exit(0);
1491
- }
1492
1502
  }
1493
1503
  const middlewareManifest = await readManifest(_path.default.join(distDir, _constants1.SERVER_DIRECTORY, _constants1.MIDDLEWARE_MANIFEST));
1494
1504
  const prerenderManifest = {
@@ -2260,6 +2270,9 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
2260
2270
  buildTracesSpinner.stopAndPersist();
2261
2271
  buildTracesSpinner = undefined;
2262
2272
  }
2273
+ if (isCompileMode) {
2274
+ _log.info(`Build ran with "compile" mode, to finalize the build run either "generate" or "generate-env" mode as well`);
2275
+ }
2263
2276
  if (config.output === 'export') {
2264
2277
  await writeFullyStaticExport(config, dir, enabledDirectories, configOutDir, nextBuildSpan);
2265
2278
  }