next 13.4.2-canary.2 → 13.4.2-canary.4

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 (101) hide show
  1. package/dist/bin/next +7 -1
  2. package/dist/bin/next.map +1 -1
  3. package/dist/build/index.d.ts +1 -1
  4. package/dist/build/index.js +230 -202
  5. package/dist/build/index.js.map +1 -1
  6. package/dist/build/swc/index.js +1 -1
  7. package/dist/build/webpack/loaders/next-flight-action-entry-loader.js +1 -6
  8. package/dist/build/webpack/loaders/next-flight-action-entry-loader.js.map +1 -1
  9. package/dist/build/webpack/loaders/next-flight-loader/action-proxy.d.ts +1 -1
  10. package/dist/build/webpack/loaders/next-flight-loader/action-proxy.js +25 -7
  11. package/dist/build/webpack/loaders/next-flight-loader/action-proxy.js.map +1 -1
  12. package/dist/build/webpack/loaders/next-flight-loader/action-validate.d.ts +1 -0
  13. package/dist/build/webpack/loaders/next-flight-loader/action-validate.js +20 -0
  14. package/dist/build/webpack/loaders/next-flight-loader/action-validate.js.map +1 -0
  15. package/dist/build/webpack/loaders/next-font-loader/index.js +6 -0
  16. package/dist/build/webpack/loaders/next-font-loader/index.js.map +1 -1
  17. package/dist/build/webpack/loaders/next-metadata-route-loader.js +2 -3
  18. package/dist/build/webpack/loaders/next-metadata-route-loader.js.map +1 -1
  19. package/dist/build/webpack-config.js +5 -4
  20. package/dist/build/webpack-config.js.map +1 -1
  21. package/dist/cli/next-build.js +2 -1
  22. package/dist/cli/next-build.js.map +1 -1
  23. package/dist/client/app-bootstrap.js +1 -1
  24. package/dist/client/components/error.js.map +1 -1
  25. package/dist/client/index.js +1 -1
  26. package/dist/esm/build/index.js +230 -202
  27. package/dist/esm/build/index.js.map +1 -1
  28. package/dist/esm/build/swc/index.js +1 -1
  29. package/dist/esm/build/webpack/loaders/next-flight-action-entry-loader.js +1 -6
  30. package/dist/esm/build/webpack/loaders/next-flight-action-entry-loader.js.map +1 -1
  31. package/dist/esm/build/webpack/loaders/next-flight-loader/action-proxy.js +24 -6
  32. package/dist/esm/build/webpack/loaders/next-flight-loader/action-proxy.js.map +1 -1
  33. package/dist/esm/build/webpack/loaders/next-flight-loader/action-validate.js +10 -0
  34. package/dist/esm/build/webpack/loaders/next-flight-loader/action-validate.js.map +1 -0
  35. package/dist/esm/build/webpack/loaders/next-font-loader/index.js +6 -0
  36. package/dist/esm/build/webpack/loaders/next-font-loader/index.js.map +1 -1
  37. package/dist/esm/build/webpack/loaders/next-metadata-route-loader.js +2 -3
  38. package/dist/esm/build/webpack/loaders/next-metadata-route-loader.js.map +1 -1
  39. package/dist/esm/build/webpack-config.js +6 -5
  40. package/dist/esm/build/webpack-config.js.map +1 -1
  41. package/dist/esm/client/app-bootstrap.js +1 -1
  42. package/dist/esm/client/components/error.js.map +1 -1
  43. package/dist/esm/client/index.js +1 -1
  44. package/dist/esm/lib/commands.js +3 -1
  45. package/dist/esm/lib/commands.js.map +1 -1
  46. package/dist/esm/lib/constants.js +1 -0
  47. package/dist/esm/lib/constants.js.map +1 -1
  48. package/dist/esm/lib/turbopack-warning.js +1 -0
  49. package/dist/esm/lib/turbopack-warning.js.map +1 -1
  50. package/dist/esm/pages/_error.js.map +1 -1
  51. package/dist/esm/server/app-render/action-handler.js +8 -4
  52. package/dist/esm/server/app-render/action-handler.js.map +1 -1
  53. package/dist/esm/server/app-render/app-render.js +11 -11
  54. package/dist/esm/server/app-render/app-render.js.map +1 -1
  55. package/dist/esm/server/app-render/validate-url.js +9 -3
  56. package/dist/esm/server/app-render/validate-url.js.map +1 -1
  57. package/dist/esm/server/dev/hot-reloader.js +6 -4
  58. package/dist/esm/server/dev/hot-reloader.js.map +1 -1
  59. package/dist/esm/server/lib/patch-fetch.js +10 -11
  60. package/dist/esm/server/lib/patch-fetch.js.map +1 -1
  61. package/dist/esm/server/lib/server-ipc/utils.js +1 -1
  62. package/dist/esm/server/lib/server-ipc/utils.js.map +1 -1
  63. package/dist/esm/server/next-server.js +4 -1
  64. package/dist/esm/server/next-server.js.map +1 -1
  65. package/dist/esm/server/node-polyfill-crypto.js +10 -4
  66. package/dist/esm/server/node-polyfill-crypto.js.map +1 -1
  67. package/dist/esm/shared/lib/router/router.js +1 -0
  68. package/dist/esm/shared/lib/router/router.js.map +1 -1
  69. package/dist/lib/commands.js +3 -1
  70. package/dist/lib/commands.js.map +1 -1
  71. package/dist/lib/constants.d.ts +1 -0
  72. package/dist/lib/constants.js +5 -0
  73. package/dist/lib/constants.js.map +1 -1
  74. package/dist/lib/turbopack-warning.js +1 -0
  75. package/dist/lib/turbopack-warning.js.map +1 -1
  76. package/dist/pages/_error.js.map +1 -1
  77. package/dist/server/app-render/action-handler.js +8 -4
  78. package/dist/server/app-render/action-handler.js.map +1 -1
  79. package/dist/server/app-render/app-render.d.ts +1 -1
  80. package/dist/server/app-render/app-render.js +11 -11
  81. package/dist/server/app-render/app-render.js.map +1 -1
  82. package/dist/server/app-render/validate-url.js +9 -3
  83. package/dist/server/app-render/validate-url.js.map +1 -1
  84. package/dist/server/dev/hot-reloader.js +6 -4
  85. package/dist/server/dev/hot-reloader.js.map +1 -1
  86. package/dist/server/lib/patch-fetch.js +10 -11
  87. package/dist/server/lib/patch-fetch.js.map +1 -1
  88. package/dist/server/lib/server-ipc/utils.d.ts +1 -0
  89. package/dist/server/lib/server-ipc/utils.js +15 -3
  90. package/dist/server/lib/server-ipc/utils.js.map +1 -1
  91. package/dist/server/next-server.js +4 -1
  92. package/dist/server/next-server.js.map +1 -1
  93. package/dist/server/node-polyfill-crypto.js +10 -4
  94. package/dist/server/node-polyfill-crypto.js.map +1 -1
  95. package/dist/server/node-polyfill-crypto.test.d.ts +1 -0
  96. package/dist/shared/lib/router/router.js +1 -0
  97. package/dist/shared/lib/router/router.js.map +1 -1
  98. package/dist/telemetry/anonymous-meta.js +1 -1
  99. package/dist/telemetry/events/session-stopped.js +2 -2
  100. package/dist/telemetry/events/version.js +2 -2
  101. package/package.json +16 -16
package/dist/bin/next CHANGED
@@ -76,7 +76,7 @@ const args = (0, _index.default)({
76
76
  });
77
77
  // Version is inlined into the file using taskr build pipeline
78
78
  if (args["--version"]) {
79
- console.log(`Next.js v${"13.4.2-canary.2"}`);
79
+ console.log(`Next.js v${"13.4.2-canary.4"}`);
80
80
  process.exit(0);
81
81
  }
82
82
  // Check if we are running `next <subcommand>` or `next`
@@ -102,6 +102,12 @@ if (!foundCommand && args["--help"]) {
102
102
  process.exit(0);
103
103
  }
104
104
  const command = foundCommand ? args._[0] : defaultCommand;
105
+ if ([
106
+ "experimental-compile",
107
+ "experimental-generate"
108
+ ].includes(command)) {
109
+ args._.push("--build-mode", command);
110
+ }
105
111
  const forwardedArgs = foundCommand ? args._.slice(1) : args._;
106
112
  if (args["--inspect"]) throw new Error(`--inspect flag is deprecated. Use env variable NODE_OPTIONS instead: NODE_OPTIONS='--inspect' next ${command}`);
107
113
  // Make sure the `next <subcommand> --help` case is covered
package/dist/bin/next.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bin/next.ts"],"names":["forEach","dependency","require","resolve","err","console","warn","defaultCommand","args","arg","Boolean","permissive","log","process","env","__NEXT_VERSION","exit","foundCommand","commands","_","Object","keys","join","command","forwardedArgs","slice","Error","push","defaultEnv","standardEnv","NODE_ENV","isNotStandard","includes","shouldWarnCommands","NON_STANDARD_NODE_ENV","NEXT_RUNTIME","versions","pnp","nodeVersionParts","node","split","map","v","Number","NEXT_MANUAL_SIG_HANDLE","on","then","exec"],"mappings":";;;;;6DACqB;8DACL;2BACsB;0BACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACxB;IAAC;IAAS;CAAY,CAACA,OAAO,CAAC,CAACC,aAAe;IAC9C,IAAI;QACF,yEAAyE;QACzEC,QAAQC,OAAO,CAACF;IAClB,EAAE,OAAOG,KAAK;QACZC,QAAQC,IAAI,CACV,CAAC,YAAY,EAAEL,WAAW,4HAA4H,EAAEA,WAAW,CAAC,CAAC;IAEzK;AACF;AAE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","console","warn","defaultCommand","args","arg","Boolean","permissive","log","process","env","__NEXT_VERSION","exit","foundCommand","commands","_","Object","keys","join","command","includes","push","forwardedArgs","slice","Error","defaultEnv","standardEnv","NODE_ENV","isNotStandard","shouldWarnCommands","NON_STANDARD_NODE_ENV","NEXT_RUNTIME","versions","pnp","nodeVersionParts","node","split","map","v","Number","NEXT_MANUAL_SIG_HANDLE","on","then","exec"],"mappings":";;;;;6DACqB;8DACL;2BACsB;0BACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACxB;IAAC;IAAS;CAAY,CAACA,OAAO,CAAC,CAACC,aAAe;IAC9C,IAAI;QACF,yEAAyE;QACzEC,QAAQC,OAAO,CAACF;IAClB,EAAE,OAAOG,KAAK;QACZC,QAAQC,IAAI,CACV,CAAC,YAAY,EAAEL,WAAW,4HAA4H,EAAEA,WAAW,CAAC,CAAC;IAEzK;AACF;AAEA,MAAMM,iBAAiB;AACvB,MAAMC,OAAOC,IAAAA,cAAG,EACd;IACE,QAAQ;IACR,aAAaC;IACb,UAAUA;IACV,aAAaA;IAEb,UAAU;IACV,MAAM;IACN,MAAM;AACR,GACA;IACEC,YAAY,IAAI;AAClB;AAGF,8DAA8D;AAC9D,IAAIH,IAAI,CAAC,YAAY,EAAE;IACrBH,QAAQO,GAAG,CAAC,CAAC,SAAS,EAAEC,QAAQC,GAAG,CAACC,cAAc,CAAC,CAAC;IACpDF,QAAQG,IAAI,CAAC;AACf,CAAC;AAED,wDAAwD;AACxD,MAAMC,eAAeP,QAAQQ,kBAAQ,CAACV,KAAKW,CAAC,CAAC,EAAE,CAAC;AAEhD,+CAA+C;AAC/C,qDAAqD;AACrD,+DAA+D;AAC/D,IAAI,CAACF,gBAAgBT,IAAI,CAAC,SAAS,EAAE;IACnCH,QAAQO,GAAG,CAAC,CAAC;;;;;MAKT,EAAEQ,OAAOC,IAAI,CAACH,kBAAQ,EAAEI,IAAI,CAAC,MAAM;;;;;;;;EAQvC,CAAC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CAAC,KACNC,GAAG,CAAC,CAACC,IAAMC,OAAOD;IAErB,IACEJ,gBAAgB,CAAC,EAAE,GAAG,MACrBA,gBAAgB,CAAC,EAAE,KAAK,MAAMA,gBAAgB,CAAC,EAAE,GAAG,IACrD;QACA1B,KAAIN,IAAI,CACN;IAEJ,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,6DAA6D;AAC7D,IAAI,CAACO,QAAQC,GAAG,CAAC8B,sBAAsB,IAAIrB,YAAY,OAAO;IAC5DV,QAAQgC,EAAE,CAAC,WAAW,IAAMhC,QAAQG,IAAI,CAAC;IACzCH,QAAQgC,EAAE,CAAC,UAAU,IAAMhC,QAAQG,IAAI,CAAC;AAC1C,CAAC;AAEDE,kBAAQ,CAACK,QAAQ,GACduB,IAAI,CAAC,CAACC,OAASA,KAAKrB,gBACpBoB,IAAI,CAAC,IAAM;IACV,IAAIvB,YAAY,SAAS;QACvB,yEAAyE;QACzE,8BAA8B;QAC9BV,QAAQG,IAAI,CAAC;IACf,CAAC;AACH"}
@@ -24,4 +24,4 @@ export declare type PrerenderManifest = {
24
24
  notFoundRoutes: string[];
25
25
  preview: __ApiPreviewProps;
26
26
  };
27
- export default function build(dir: string, reactProductionProfiling?: boolean, debugOutput?: boolean, runLint?: boolean, noMangling?: boolean, appDirOnly?: boolean, turboNextBuild?: boolean): Promise<void>;
27
+ export default function build(dir: string, reactProductionProfiling: boolean | undefined, debugOutput: boolean | undefined, runLint: boolean | undefined, noMangling: boolean | undefined, appDirOnly: boolean | undefined, turboNextBuild: boolean | undefined, buildMode: 'default' | 'experimental-compile' | 'experimental-generate'): Promise<void>;
@@ -129,11 +129,13 @@ function pageToRoute(page) {
129
129
  namedRegex: routeRegex.namedRegex
130
130
  };
131
131
  }
132
- async function build(dir, reactProductionProfiling = false, debugOutput = false, runLint = true, noMangling = false, appDirOnly = false, turboNextBuild = false) {
132
+ async function build(dir, reactProductionProfiling = false, debugOutput = false, runLint = true, noMangling = false, appDirOnly = false, turboNextBuild = false, buildMode) {
133
+ const isCompile = buildMode === "experimental-compile";
134
+ const isGenerate = buildMode === "experimental-generate";
133
135
  let hasAppDir = false;
134
136
  try {
135
137
  const nextBuildSpan = (0, _trace.trace)("next-build", undefined, {
136
- version: "13.4.2-canary.2"
138
+ version: "13.4.2-canary.4"
137
139
  });
138
140
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
139
141
  _buildcontext.NextBuildContext.dir = dir;
@@ -160,7 +162,12 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
160
162
  const distDir = _path.default.join(dir, config.distDir);
161
163
  (0, _trace.setGlobal)("phase", _constants1.PHASE_PRODUCTION_BUILD);
162
164
  (0, _trace.setGlobal)("distDir", distDir);
163
- const buildId = await nextBuildSpan.traceChild("generate-buildid").traceAsyncFn(()=>(0, _generatebuildid.generateBuildId)(config.generateBuildId, _indexcjs.nanoid));
165
+ let buildId = "";
166
+ if (isGenerate) {
167
+ buildId = await _fs.promises.readFile(_path.default.join(distDir, "BUILD_ID"), "utf8");
168
+ } else {
169
+ buildId = await nextBuildSpan.traceChild("generate-buildid").traceAsyncFn(()=>(0, _generatebuildid.generateBuildId)(config.generateBuildId, _indexcjs.nanoid));
170
+ }
164
171
  _buildcontext.NextBuildContext.buildId = buildId;
165
172
  const customRoutes = await nextBuildSpan.traceChild("load-custom-routes").traceAsyncFn(()=>(0, _loadcustomroutes.default)(config));
166
173
  const { headers , rewrites , redirects } = customRoutes;
@@ -187,7 +194,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
187
194
  _buildcontext.NextBuildContext.appDir = appDir;
188
195
  hasAppDir = Boolean(appDir);
189
196
  if (isAppDirEnabled && hasAppDir) {
190
- if (!process.env.__NEXT_TEST_MODE && _ciinfo.hasNextSupport) {
197
+ if ((!process.env.__NEXT_TEST_MODE || process.env.__NEXT_TEST_MODE === "e2e") && _ciinfo.hasNextSupport) {
191
198
  const requireHook = require.resolve("../server/require-hook");
192
199
  const contents = await _fs.promises.readFile(requireHook, "utf8");
193
200
  await _fs.promises.writeFile(requireHook, `process.env.__NEXT_PRIVATE_PREBUNDLED_REACT = '${config.experimental.serverActions ? "experimental" : "next"}'\n${contents}`);
@@ -226,7 +233,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
226
233
  // For app directory, we run type checking after build. That's because
227
234
  // we dynamically generate types for each layout and page in the app
228
235
  // directory.
229
- if (!appDir) await (0, _typecheck.startTypeChecking)(typeCheckingOptions);
236
+ if (!appDir && !isCompile) await (0, _typecheck.startTypeChecking)(typeCheckingOptions);
230
237
  if (appDir && "exportPathMap" in config) {
231
238
  _log.error('The "exportPathMap" configuration cannot be used with the "app" directory. Please use generateStaticParams() instead.');
232
239
  await telemetry.flush();
@@ -240,9 +247,16 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
240
247
  eventName: _events.EVENT_BUILD_FEATURE_USAGE,
241
248
  payload: buildLintEvent
242
249
  });
243
- const buildSpinner = (0, _spinner.default)({
244
- prefixText: `${_log.prefixes.info} Creating an optimized production build`
245
- });
250
+ let buildSpinner = {
251
+ stopAndPersist () {
252
+ return this;
253
+ }
254
+ };
255
+ if (!isGenerate) {
256
+ buildSpinner = (0, _spinner.default)({
257
+ prefixText: `${_log.prefixes.info} Creating an optimized production build`
258
+ });
259
+ }
246
260
  _buildcontext.NextBuildContext.buildSpinner = buildSpinner;
247
261
  const validFileMatcher = (0, _findpagefile.createValidFileMatcher)(config.pageExtensions, appDir);
248
262
  const pagesPaths = !appDirOnly && pagesDir ? await nextBuildSpan.traceChild("collect-pages").traceAsyncFn(()=>(0, _recursivereaddir.recursiveReadDir)(pagesDir, validFileMatcher.isPageFile)) : [];
@@ -474,7 +488,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
474
488
  if (!distDirCreated || !await (0, _iswriteable.isWriteable)(distDir)) {
475
489
  throw new Error("> Build directory is not writeable. https://nextjs.org/docs/messages/build-dir-not-writeable");
476
490
  }
477
- if (config.cleanDistDir) {
491
+ if (config.cleanDistDir && !isGenerate) {
478
492
  await (0, _recursivedelete.recursiveDelete)(distDir, /^cache/);
479
493
  }
480
494
  // Ensure commonjs handling is used for files in the distDir (generally .next)
@@ -546,65 +560,68 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
546
560
  turbotraceContext: null
547
561
  };
548
562
  }
549
- const { duration: webpackBuildDuration , turbotraceContext } = turboNextBuild ? await turbopackBuild() : await (0, _webpackbuild.webpackBuild)();
550
- telemetry.record((0, _events.eventBuildCompleted)(pagesPaths, {
551
- durationInSeconds: webpackBuildDuration,
552
- totalAppPagesCount
553
- }));
563
+ let runTurbotrace = async (_staticPages)=>{};
554
564
  let turboTasksForTrace;
555
- async function runTurbotrace(staticPages) {
556
- if (!turbotraceContext) {
557
- return;
558
- }
559
- if (!(binding == null ? void 0 : binding.isWasm) && typeof binding.turbo.startTrace === "function") {
560
- var _config_experimental_turbotrace;
561
- let turbotraceOutputPath;
562
- let turbotraceFiles;
563
- turboTasksForTrace = binding.turbo.createTurboTasks((((_config_experimental_turbotrace = config.experimental.turbotrace) == null ? void 0 : _config_experimental_turbotrace.memoryLimit) ?? _constants1.TURBO_TRACE_DEFAULT_MEMORY_LIMIT) * 1024 * 1024);
564
- const { entriesTrace , chunksTrace } = turbotraceContext;
565
- if (entriesTrace) {
566
- const { appDir: turbotraceContextAppDir , depModArray , entryNameMap , outputPath , action } = entriesTrace;
567
- const depModSet = new Set(depModArray);
568
- const filesTracedInEntries = await binding.turbo.startTrace(action, turboTasksForTrace);
569
- const { contextDirectory , input: entriesToTrace } = action;
570
- // only trace the assets under the appDir
571
- // exclude files from node_modules, entries and processed by webpack
572
- const filesTracedFromEntries = filesTracedInEntries.map((f)=>_path.default.join(contextDirectory, f)).filter((f)=>!f.includes("/node_modules/") && f.startsWith(turbotraceContextAppDir) && !entriesToTrace.includes(f) && !depModSet.has(f));
573
- if (filesTracedFromEntries.length) {
574
- // The turbo trace doesn't provide the traced file type and reason at present
575
- // let's write the traced files into the first [entry].nft.json
576
- const [[, entryName]] = Array.from(entryNameMap.entries()).filter(([k])=>k.startsWith(turbotraceContextAppDir));
577
- const traceOutputPath = _path.default.join(outputPath, `../${entryName}.js.nft.json`);
578
- const traceOutputDir = _path.default.dirname(traceOutputPath);
579
- turbotraceOutputPath = traceOutputPath;
580
- turbotraceFiles = filesTracedFromEntries.map((file)=>_path.default.relative(traceOutputDir, file));
581
- }
565
+ if (!isGenerate) {
566
+ const { duration: webpackBuildDuration , turbotraceContext } = turboNextBuild ? await turbopackBuild() : await (0, _webpackbuild.webpackBuild)();
567
+ telemetry.record((0, _events.eventBuildCompleted)(pagesPaths, {
568
+ durationInSeconds: webpackBuildDuration,
569
+ totalAppPagesCount
570
+ }));
571
+ runTurbotrace = async function(staticPages) {
572
+ if (!turbotraceContext) {
573
+ return;
582
574
  }
583
- if (chunksTrace) {
584
- const { action , outputPath } = chunksTrace;
585
- action.input = action.input.filter((f)=>{
586
- const outputPagesPath = _path.default.join(outputPath, "..", "pages");
587
- return !f.startsWith(outputPagesPath) || !staticPages.has(// strip `outputPagesPath` and file ext from absolute
588
- f.substring(outputPagesPath.length, f.length - 3));
589
- });
590
- await binding.turbo.startTrace(action, turboTasksForTrace);
591
- if (turbotraceOutputPath && turbotraceFiles) {
592
- const existedNftFile = await _fs.promises.readFile(turbotraceOutputPath, "utf8").then((existedContent)=>JSON.parse(existedContent)).catch(()=>({
593
- version: _constants1.TRACE_OUTPUT_VERSION,
594
- files: []
595
- }));
596
- existedNftFile.files.push(...turbotraceFiles);
597
- const filesSet = new Set(existedNftFile.files);
598
- existedNftFile.files = [
599
- ...filesSet
600
- ];
601
- await _fs.promises.writeFile(turbotraceOutputPath, JSON.stringify(existedNftFile), "utf8");
575
+ if (!(binding == null ? void 0 : binding.isWasm) && typeof binding.turbo.startTrace === "function") {
576
+ var _config_experimental_turbotrace;
577
+ let turbotraceOutputPath;
578
+ let turbotraceFiles;
579
+ turboTasksForTrace = binding.turbo.createTurboTasks((((_config_experimental_turbotrace = config.experimental.turbotrace) == null ? void 0 : _config_experimental_turbotrace.memoryLimit) ?? _constants1.TURBO_TRACE_DEFAULT_MEMORY_LIMIT) * 1024 * 1024);
580
+ const { entriesTrace , chunksTrace } = turbotraceContext;
581
+ if (entriesTrace) {
582
+ const { appDir: turbotraceContextAppDir , depModArray , entryNameMap , outputPath , action } = entriesTrace;
583
+ const depModSet = new Set(depModArray);
584
+ const filesTracedInEntries = await binding.turbo.startTrace(action, turboTasksForTrace);
585
+ const { contextDirectory , input: entriesToTrace } = action;
586
+ // only trace the assets under the appDir
587
+ // exclude files from node_modules, entries and processed by webpack
588
+ const filesTracedFromEntries = filesTracedInEntries.map((f)=>_path.default.join(contextDirectory, f)).filter((f)=>!f.includes("/node_modules/") && f.startsWith(turbotraceContextAppDir) && !entriesToTrace.includes(f) && !depModSet.has(f));
589
+ if (filesTracedFromEntries.length) {
590
+ // The turbo trace doesn't provide the traced file type and reason at present
591
+ // let's write the traced files into the first [entry].nft.json
592
+ const [[, entryName]] = Array.from(entryNameMap.entries()).filter(([k])=>k.startsWith(turbotraceContextAppDir));
593
+ const traceOutputPath = _path.default.join(outputPath, `../${entryName}.js.nft.json`);
594
+ const traceOutputDir = _path.default.dirname(traceOutputPath);
595
+ turbotraceOutputPath = traceOutputPath;
596
+ turbotraceFiles = filesTracedFromEntries.map((file)=>_path.default.relative(traceOutputDir, file));
597
+ }
598
+ }
599
+ if (chunksTrace) {
600
+ const { action , outputPath } = chunksTrace;
601
+ action.input = action.input.filter((f)=>{
602
+ const outputPagesPath = _path.default.join(outputPath, "..", "pages");
603
+ return !f.startsWith(outputPagesPath) || !staticPages.has(// strip `outputPagesPath` and file ext from absolute
604
+ f.substring(outputPagesPath.length, f.length - 3));
605
+ });
606
+ await binding.turbo.startTrace(action, turboTasksForTrace);
607
+ if (turbotraceOutputPath && turbotraceFiles) {
608
+ const existedNftFile = await _fs.promises.readFile(turbotraceOutputPath, "utf8").then((existedContent)=>JSON.parse(existedContent)).catch(()=>({
609
+ version: _constants1.TRACE_OUTPUT_VERSION,
610
+ files: []
611
+ }));
612
+ existedNftFile.files.push(...turbotraceFiles);
613
+ const filesSet = new Set(existedNftFile.files);
614
+ existedNftFile.files = [
615
+ ...filesSet
616
+ ];
617
+ await _fs.promises.writeFile(turbotraceOutputPath, JSON.stringify(existedNftFile), "utf8");
618
+ }
602
619
  }
603
620
  }
604
- }
621
+ };
605
622
  }
606
623
  // For app directory, we run type checking after build.
607
- if (appDir) {
624
+ if (appDir && !(isCompile || isGenerate)) {
608
625
  await (0, _typecheck.startTypeChecking)(typeCheckingOptions);
609
626
  }
610
627
  const postCompileSpinner = (0, _spinner.default)({
@@ -714,6 +731,15 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
714
731
  const analysisBegin = process.hrtime();
715
732
  const staticCheckSpan = nextBuildSpan.traceChild("static-check");
716
733
  const { customAppGetInitialProps , namedExports , isNextImageImported , hasSsrAmpPages , hasNonStaticErrorPage } = await staticCheckSpan.traceAsyncFn(async ()=>{
734
+ if (isCompile) {
735
+ return {
736
+ customAppGetInitialProps: false,
737
+ namedExports: [],
738
+ isNextImageImported: true,
739
+ hasSsrAmpPages: !!pagesDir,
740
+ hasNonStaticErrorPage: true
741
+ };
742
+ }
717
743
  const { configFileName , publicRuntimeConfig , serverRuntimeConfig } = config;
718
744
  const runtimeEnvConfig = {
719
745
  publicRuntimeConfig,
@@ -812,158 +838,160 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
812
838
  pageType
813
839
  }) : undefined;
814
840
  const pageRuntime = middlewareManifest.functions[originalAppPath || page] ? "edge" : staticInfo == null ? void 0 : staticInfo.runtime;
815
- isServerComponent = pageType === "app" && (staticInfo == null ? void 0 : staticInfo.rsc) !== _constants1.RSC_MODULE_TYPES.client;
816
- if (pageType === "app" || !(0, _utils1.isReservedPage)(page)) {
817
- try {
818
- let edgeInfo;
819
- if ((0, _isedgeruntime.isEdgeRuntime)(pageRuntime)) {
820
- if (pageType === "app") {
821
- edgeRuntimeAppCount++;
822
- } else {
823
- edgeRuntimePagesCount++;
841
+ if (!isCompile) {
842
+ isServerComponent = pageType === "app" && (staticInfo == null ? void 0 : staticInfo.rsc) !== _constants1.RSC_MODULE_TYPES.client;
843
+ if (pageType === "app" || !(0, _utils1.isReservedPage)(page)) {
844
+ try {
845
+ let edgeInfo;
846
+ if ((0, _isedgeruntime.isEdgeRuntime)(pageRuntime)) {
847
+ if (pageType === "app") {
848
+ edgeRuntimeAppCount++;
849
+ } else {
850
+ edgeRuntimePagesCount++;
851
+ }
852
+ const manifestKey = pageType === "pages" ? page : originalAppPath || "";
853
+ edgeInfo = middlewareManifest.functions[manifestKey];
824
854
  }
825
- const manifestKey = pageType === "pages" ? page : originalAppPath || "";
826
- edgeInfo = middlewareManifest.functions[manifestKey];
827
- }
828
- let isPageStaticSpan = checkPageSpan.traceChild("is-page-static");
829
- let workerResult = await isPageStaticSpan.traceAsyncFn(()=>{
830
- var _config_i18n, _config_i18n1;
831
- return (pageType === "app" ? appStaticWorkers : pagesStaticWorkers).isPageStatic({
832
- page,
833
- originalAppPath,
834
- distDir,
835
- configFileName,
836
- runtimeEnvConfig,
837
- httpAgentOptions: config.httpAgentOptions,
838
- locales: (_config_i18n = config.i18n) == null ? void 0 : _config_i18n.locales,
839
- defaultLocale: (_config_i18n1 = config.i18n) == null ? void 0 : _config_i18n1.defaultLocale,
840
- parentId: isPageStaticSpan.id,
841
- pageRuntime,
842
- edgeInfo,
843
- pageType,
844
- hasServerComponents: !!appDir,
845
- incrementalCacheHandlerPath: config.experimental.incrementalCacheHandlerPath,
846
- isrFlushToDisk: config.experimental.isrFlushToDisk,
847
- maxMemoryCacheSize: config.experimental.isrMemoryCacheSize,
848
- nextConfigOutput: config.output
855
+ let isPageStaticSpan = checkPageSpan.traceChild("is-page-static");
856
+ let workerResult = await isPageStaticSpan.traceAsyncFn(()=>{
857
+ var _config_i18n, _config_i18n1;
858
+ return (pageType === "app" ? appStaticWorkers : pagesStaticWorkers).isPageStatic({
859
+ page,
860
+ originalAppPath,
861
+ distDir,
862
+ configFileName,
863
+ runtimeEnvConfig,
864
+ httpAgentOptions: config.httpAgentOptions,
865
+ locales: (_config_i18n = config.i18n) == null ? void 0 : _config_i18n.locales,
866
+ defaultLocale: (_config_i18n1 = config.i18n) == null ? void 0 : _config_i18n1.defaultLocale,
867
+ parentId: isPageStaticSpan.id,
868
+ pageRuntime,
869
+ edgeInfo,
870
+ pageType,
871
+ hasServerComponents: !!appDir,
872
+ incrementalCacheHandlerPath: config.experimental.incrementalCacheHandlerPath,
873
+ isrFlushToDisk: config.experimental.isrFlushToDisk,
874
+ maxMemoryCacheSize: config.experimental.isrMemoryCacheSize,
875
+ nextConfigOutput: config.output
876
+ });
849
877
  });
850
- });
851
- if (pageType === "app" && originalAppPath) {
852
- appNormalizedPaths.set(originalAppPath, page);
853
- // TODO-APP: handle prerendering with edge
854
- if ((0, _isedgeruntime.isEdgeRuntime)(pageRuntime)) {
855
- isStatic = false;
856
- isSsg = false;
857
- } else {
858
- // If a page has action and it is static, we need to
859
- // change it to SSG to keep the worker created.
860
- // TODO: This is a workaround for now, we should have a
861
- // dedicated worker defined in a heuristic way.
862
- const hasAction = entriesWithAction == null ? void 0 : entriesWithAction.has("app" + originalAppPath);
863
- if (workerResult.encodedPrerenderRoutes && workerResult.prerenderRoutes) {
864
- appStaticPaths.set(originalAppPath, workerResult.prerenderRoutes);
865
- appStaticPathsEncoded.set(originalAppPath, workerResult.encodedPrerenderRoutes);
866
- ssgPageRoutes = workerResult.prerenderRoutes;
867
- isSsg = true;
878
+ if (pageType === "app" && originalAppPath) {
879
+ appNormalizedPaths.set(originalAppPath, page);
880
+ // TODO-APP: handle prerendering with edge
881
+ if ((0, _isedgeruntime.isEdgeRuntime)(pageRuntime)) {
882
+ isStatic = false;
883
+ isSsg = false;
884
+ } else {
885
+ // If a page has action and it is static, we need to
886
+ // change it to SSG to keep the worker created.
887
+ // TODO: This is a workaround for now, we should have a
888
+ // dedicated worker defined in a heuristic way.
889
+ const hasAction = entriesWithAction == null ? void 0 : entriesWithAction.has("app" + originalAppPath);
890
+ if (workerResult.encodedPrerenderRoutes && workerResult.prerenderRoutes) {
891
+ appStaticPaths.set(originalAppPath, workerResult.prerenderRoutes);
892
+ appStaticPathsEncoded.set(originalAppPath, workerResult.encodedPrerenderRoutes);
893
+ ssgPageRoutes = workerResult.prerenderRoutes;
894
+ isSsg = true;
895
+ }
896
+ const appConfig = workerResult.appConfig || {};
897
+ if (appConfig.revalidate !== 0 && !hasAction) {
898
+ var _workerResult_prerenderRoutes;
899
+ const isDynamic = (0, _utils.isDynamicRoute)(page);
900
+ const hasGenerateStaticParams = !!((_workerResult_prerenderRoutes = workerResult.prerenderRoutes) == null ? void 0 : _workerResult_prerenderRoutes.length);
901
+ if (// Mark the app as static if:
902
+ // - It has no dynamic param
903
+ // - It doesn't have generateStaticParams but `dynamic` is set to
904
+ // `error` or `force-static`
905
+ !isDynamic) {
906
+ appStaticPaths.set(originalAppPath, [
907
+ page
908
+ ]);
909
+ appStaticPathsEncoded.set(originalAppPath, [
910
+ page
911
+ ]);
912
+ isStatic = true;
913
+ } else if (isDynamic && !hasGenerateStaticParams && (appConfig.dynamic === "error" || appConfig.dynamic === "force-static")) {
914
+ appStaticPaths.set(originalAppPath, []);
915
+ appStaticPathsEncoded.set(originalAppPath, []);
916
+ isStatic = true;
917
+ }
918
+ }
919
+ if (workerResult.prerenderFallback) {
920
+ // whether or not to allow requests for paths not
921
+ // returned from generateStaticParams
922
+ appDynamicParamPaths.add(originalAppPath);
923
+ }
924
+ appDefaultConfigs.set(originalAppPath, appConfig);
868
925
  }
869
- const appConfig = workerResult.appConfig || {};
870
- if (appConfig.revalidate !== 0 && !hasAction) {
871
- var _workerResult_prerenderRoutes;
872
- const isDynamic = (0, _utils.isDynamicRoute)(page);
873
- const hasGenerateStaticParams = !!((_workerResult_prerenderRoutes = workerResult.prerenderRoutes) == null ? void 0 : _workerResult_prerenderRoutes.length);
874
- if (// Mark the app as static if:
875
- // - It has no dynamic param
876
- // - It doesn't have generateStaticParams but `dynamic` is set to
877
- // `error` or `force-static`
878
- !isDynamic) {
879
- appStaticPaths.set(originalAppPath, [
880
- page
881
- ]);
882
- appStaticPathsEncoded.set(originalAppPath, [
883
- page
884
- ]);
885
- isStatic = true;
886
- } else if (isDynamic && !hasGenerateStaticParams && (appConfig.dynamic === "error" || appConfig.dynamic === "force-static")) {
887
- appStaticPaths.set(originalAppPath, []);
888
- appStaticPathsEncoded.set(originalAppPath, []);
889
- isStatic = true;
926
+ } else {
927
+ if ((0, _isedgeruntime.isEdgeRuntime)(pageRuntime)) {
928
+ if (workerResult.hasStaticProps) {
929
+ console.warn(`"getStaticProps" is not yet supported fully with "experimental-edge", detected on ${page}`);
890
930
  }
931
+ // TODO: add handling for statically rendering edge
932
+ // pages and allow edge with Prerender outputs
933
+ workerResult.isStatic = false;
934
+ workerResult.hasStaticProps = false;
891
935
  }
892
- if (workerResult.prerenderFallback) {
893
- // whether or not to allow requests for paths not
894
- // returned from generateStaticParams
895
- appDynamicParamPaths.add(originalAppPath);
936
+ if (workerResult.isStatic === false && (workerResult.isHybridAmp || workerResult.isAmpOnly)) {
937
+ hasSsrAmpPages = true;
896
938
  }
897
- appDefaultConfigs.set(originalAppPath, appConfig);
898
- }
899
- } else {
900
- if ((0, _isedgeruntime.isEdgeRuntime)(pageRuntime)) {
901
- if (workerResult.hasStaticProps) {
902
- console.warn(`"getStaticProps" is not yet supported fully with "experimental-edge", detected on ${page}`);
939
+ if (workerResult.isHybridAmp) {
940
+ isHybridAmp = true;
941
+ hybridAmpPages.add(page);
903
942
  }
904
- // TODO: add handling for statically rendering edge
905
- // pages and allow edge with Prerender outputs
906
- workerResult.isStatic = false;
907
- workerResult.hasStaticProps = false;
908
- }
909
- if (workerResult.isStatic === false && (workerResult.isHybridAmp || workerResult.isAmpOnly)) {
910
- hasSsrAmpPages = true;
911
- }
912
- if (workerResult.isHybridAmp) {
913
- isHybridAmp = true;
914
- hybridAmpPages.add(page);
915
- }
916
- if (workerResult.isNextImageImported) {
917
- isNextImageImported = true;
918
- }
919
- if (workerResult.hasStaticProps) {
920
- ssgPages.add(page);
921
- isSsg = true;
922
- if (workerResult.prerenderRoutes && workerResult.encodedPrerenderRoutes) {
923
- additionalSsgPaths.set(page, workerResult.prerenderRoutes);
924
- additionalSsgPathsEncoded.set(page, workerResult.encodedPrerenderRoutes);
925
- ssgPageRoutes = workerResult.prerenderRoutes;
943
+ if (workerResult.isNextImageImported) {
944
+ isNextImageImported = true;
926
945
  }
927
- if (workerResult.prerenderFallback === "blocking") {
928
- ssgBlockingFallbackPages.add(page);
929
- } else if (workerResult.prerenderFallback === true) {
930
- ssgStaticFallbackPages.add(page);
946
+ if (workerResult.hasStaticProps) {
947
+ ssgPages.add(page);
948
+ isSsg = true;
949
+ if (workerResult.prerenderRoutes && workerResult.encodedPrerenderRoutes) {
950
+ additionalSsgPaths.set(page, workerResult.prerenderRoutes);
951
+ additionalSsgPathsEncoded.set(page, workerResult.encodedPrerenderRoutes);
952
+ ssgPageRoutes = workerResult.prerenderRoutes;
953
+ }
954
+ if (workerResult.prerenderFallback === "blocking") {
955
+ ssgBlockingFallbackPages.add(page);
956
+ } else if (workerResult.prerenderFallback === true) {
957
+ ssgStaticFallbackPages.add(page);
958
+ }
959
+ } else if (workerResult.hasServerProps) {
960
+ serverPropsPages.add(page);
961
+ } else if (workerResult.isStatic && !isServerComponent && await customAppGetInitialPropsPromise === false) {
962
+ staticPages.add(page);
963
+ isStatic = true;
964
+ } else if (isServerComponent) {
965
+ // This is a static server component page that doesn't have
966
+ // gSP or gSSP. We still treat it as a SSG page.
967
+ ssgPages.add(page);
968
+ isSsg = true;
931
969
  }
932
- } else if (workerResult.hasServerProps) {
933
- serverPropsPages.add(page);
934
- } else if (workerResult.isStatic && !isServerComponent && await customAppGetInitialPropsPromise === false) {
935
- staticPages.add(page);
936
- isStatic = true;
937
- } else if (isServerComponent) {
938
- // This is a static server component page that doesn't have
939
- // gSP or gSSP. We still treat it as a SSG page.
940
- ssgPages.add(page);
941
- isSsg = true;
942
- }
943
- if (hasPages404 && page === "/404") {
944
- if (!workerResult.isStatic && !workerResult.hasStaticProps) {
945
- throw new Error(`\`pages/404\` ${_constants.STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`);
970
+ if (hasPages404 && page === "/404") {
971
+ if (!workerResult.isStatic && !workerResult.hasStaticProps) {
972
+ throw new Error(`\`pages/404\` ${_constants.STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`);
973
+ }
974
+ // we need to ensure the 404 lambda is present since we use
975
+ // it when _app has getInitialProps
976
+ if (await customAppGetInitialPropsPromise && !workerResult.hasStaticProps) {
977
+ staticPages.delete(page);
978
+ }
946
979
  }
947
- // we need to ensure the 404 lambda is present since we use
948
- // it when _app has getInitialProps
949
- if (await customAppGetInitialPropsPromise && !workerResult.hasStaticProps) {
950
- staticPages.delete(page);
980
+ if (_constants1.STATIC_STATUS_PAGES.includes(page) && !workerResult.isStatic && !workerResult.hasStaticProps) {
981
+ throw new Error(`\`pages${page}\` ${_constants.STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`);
951
982
  }
952
983
  }
953
- if (_constants1.STATIC_STATUS_PAGES.includes(page) && !workerResult.isStatic && !workerResult.hasStaticProps) {
954
- throw new Error(`\`pages${page}\` ${_constants.STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`);
955
- }
984
+ } catch (err) {
985
+ if (!(0, _iserror.default)(err) || err.message !== "INVALID_DEFAULT_EXPORT") throw err;
986
+ invalidPages.add(page);
956
987
  }
957
- } catch (err) {
958
- if (!(0, _iserror.default)(err) || err.message !== "INVALID_DEFAULT_EXPORT") throw err;
959
- invalidPages.add(page);
960
988
  }
961
- }
962
- if (pageType === "app") {
963
- if (isSsg || isStatic) {
964
- staticAppPagesCount++;
965
- } else {
966
- serverAppPagesCount++;
989
+ if (pageType === "app") {
990
+ if (isSsg || isStatic) {
991
+ staticAppPagesCount++;
992
+ } else {
993
+ serverAppPagesCount++;
994
+ }
967
995
  }
968
996
  }
969
997
  pageInfos.set(page, {
@@ -1004,7 +1032,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
1004
1032
  requiredServerFiles.ignore.push(_path.default.relative(dir, _path.default.join(_path.default.dirname(require.resolve("next/dist/compiled/@ampproject/toolbox-optimizer")), "**/*")));
1005
1033
  }
1006
1034
  const nextServerTraceOutput = _path.default.join(distDir, "next-server.js.nft.json");
1007
- if (config.outputFileTracing) {
1035
+ if (!isGenerate && config.outputFileTracing) {
1008
1036
  let nodeFileTrace;
1009
1037
  if (config.experimental.turbotrace) {
1010
1038
  if (!(binding == null ? void 0 : binding.isWasm)) {
@@ -1334,7 +1362,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
1334
1362
  // - static 404/500
1335
1363
  // - getStaticProps paths
1336
1364
  // - experimental app is enabled
1337
- if (combinedPages.length > 0 || useStatic404 || useDefaultStatic500 || isAppDirEnabled) {
1365
+ if (!isCompile && (combinedPages.length > 0 || useStatic404 || useDefaultStatic500 || isAppDirEnabled)) {
1338
1366
  const staticGenerationSpan = nextBuildSpan.traceChild("static-generation");
1339
1367
  await staticGenerationSpan.traceAsyncFn(async ()=>{
1340
1368
  (0, _utils1.detectConflictingPaths)([