next 15.6.0-canary.37 → 15.6.0-canary.38

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 (53) hide show
  1. package/dist/bin/next +3 -3
  2. package/dist/bin/next.map +1 -1
  3. package/dist/build/index.d.ts +1 -2
  4. package/dist/build/index.js +25 -35
  5. package/dist/build/index.js.map +1 -1
  6. package/dist/build/swc/index.js +1 -1
  7. package/dist/build/webpack-config.js +2 -2
  8. package/dist/cli/next-build.d.ts +0 -1
  9. package/dist/cli/next-build.js +5 -3
  10. package/dist/cli/next-build.js.map +1 -1
  11. package/dist/cli/next-dev.d.ts +0 -1
  12. package/dist/cli/next-dev.js +13 -13
  13. package/dist/cli/next-dev.js.map +1 -1
  14. package/dist/client/app-bootstrap.js +1 -1
  15. package/dist/client/index.js +1 -1
  16. package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
  17. package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
  18. package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
  19. package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
  20. package/dist/esm/build/index.js +25 -35
  21. package/dist/esm/build/index.js.map +1 -1
  22. package/dist/esm/build/swc/index.js +1 -1
  23. package/dist/esm/build/webpack-config.js +2 -2
  24. package/dist/esm/client/app-bootstrap.js +1 -1
  25. package/dist/esm/client/index.js +1 -1
  26. package/dist/esm/lib/turbopack-warning.js +7 -19
  27. package/dist/esm/lib/turbopack-warning.js.map +1 -1
  28. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  29. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  30. package/dist/esm/server/lib/app-info-log.js +1 -1
  31. package/dist/esm/server/lib/start-server.js +1 -1
  32. package/dist/esm/server/next.js +1 -2
  33. package/dist/esm/server/next.js.map +1 -1
  34. package/dist/esm/shared/lib/canary-only.js +1 -1
  35. package/dist/lib/turbopack-warning.d.ts +2 -3
  36. package/dist/lib/turbopack-warning.js +6 -18
  37. package/dist/lib/turbopack-warning.js.map +1 -1
  38. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  39. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  40. package/dist/server/lib/app-info-log.js +1 -1
  41. package/dist/server/lib/start-server.js +1 -1
  42. package/dist/server/next.js +1 -2
  43. package/dist/server/next.js.map +1 -1
  44. package/dist/shared/lib/canary-only.js +1 -1
  45. package/dist/telemetry/anonymous-meta.js +1 -1
  46. package/dist/telemetry/events/session-stopped.js +2 -2
  47. package/dist/telemetry/events/version.js +2 -2
  48. package/package.json +15 -15
  49. package/dist/esm/lib/bundler.js +0 -81
  50. package/dist/esm/lib/bundler.js.map +0 -1
  51. package/dist/lib/bundler.d.ts +0 -25
  52. package/dist/lib/bundler.js +0 -95
  53. package/dist/lib/bundler.js.map +0 -1
@@ -20,7 +20,6 @@ import { verifyPartytownSetup } from '../lib/verify-partytown-setup';
20
20
  import { BUILD_ID_FILE, BUILD_MANIFEST, CLIENT_STATIC_FILES_PATH, EXPORT_DETAIL, EXPORT_MARKER, IMAGES_MANIFEST, PAGES_MANIFEST, PHASE_PRODUCTION_BUILD, PRERENDER_MANIFEST, REACT_LOADABLE_MANIFEST, ROUTES_MANIFEST, SERVER_DIRECTORY, SERVER_FILES_MANIFEST, STATIC_STATUS_PAGES, MIDDLEWARE_MANIFEST, APP_PATHS_MANIFEST, APP_PATH_ROUTES_MANIFEST, RSC_MODULE_TYPES, NEXT_FONT_MANIFEST, SUBRESOURCE_INTEGRITY_MANIFEST, MIDDLEWARE_BUILD_MANIFEST, MIDDLEWARE_REACT_LOADABLE_MANIFEST, SERVER_REFERENCE_MANIFEST, FUNCTIONS_CONFIG_MANIFEST, DYNAMIC_CSS_MANIFEST, TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST } from '../shared/lib/constants';
21
21
  import { UNDERSCORE_NOT_FOUND_ROUTE, UNDERSCORE_NOT_FOUND_ROUTE_ENTRY, UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY } from '../shared/lib/entry-constants';
22
22
  import { isDynamicRoute } from '../shared/lib/router/utils';
23
- import { Bundler, finalizeBundlerFromConfig } from '../lib/bundler';
24
23
  import loadConfig from '../server/config';
25
24
  import { normalizePagePath } from '../shared/lib/page-path/normalize-page-path';
26
25
  import { getPagePath } from '../server/require';
@@ -294,7 +293,7 @@ async function getBuildId(isGenerateMode, distDir, nextBuildSpan, config) {
294
293
  }
295
294
  return await nextBuildSpan.traceChild('generate-buildid').traceAsyncFn(()=>generateBuildId(config.generateBuildId, nanoid));
296
295
  }
297
- export default async function build(dir, reactProductionProfiling = false, debugOutput = false, debugPrerender = false, runLint = true, noMangling = false, appDirOnly = false, bundler = Bundler.Turbopack, experimentalBuildMode, traceUploadUrl) {
296
+ export default async function build(dir, reactProductionProfiling = false, debugOutput = false, debugPrerender = false, runLint = true, noMangling = false, appDirOnly = false, isTurbopack = false, experimentalBuildMode, traceUploadUrl) {
298
297
  const isCompileMode = experimentalBuildMode === 'compile';
299
298
  const isGenerateMode = experimentalBuildMode === 'generate';
300
299
  NextBuildContext.isCompileMode = isCompileMode;
@@ -303,7 +302,8 @@ export default async function build(dir, reactProductionProfiling = false, debug
303
302
  try {
304
303
  const nextBuildSpan = trace('next-build', undefined, {
305
304
  buildMode: experimentalBuildMode,
306
- version: "15.6.0-canary.37"
305
+ isTurboBuild: String(isTurbopack),
306
+ version: "15.6.0-canary.38"
307
307
  });
308
308
  NextBuildContext.nextBuildSpan = nextBuildSpan;
309
309
  NextBuildContext.dir = dir;
@@ -324,9 +324,6 @@ export default async function build(dir, reactProductionProfiling = false, debug
324
324
  debugPrerender
325
325
  }), turborepoAccessTraceResult));
326
326
  loadedConfig = config;
327
- // Reading the config can modify environment variables that influence the bundler selection.
328
- bundler = finalizeBundlerFromConfig(bundler);
329
- nextBuildSpan.setAttribute('bundler', getBundlerForTelemetry(bundler));
330
327
  process.env.NEXT_DEPLOYMENT_ID = config.deploymentId || '';
331
328
  NextBuildContext.config = config;
332
329
  let configOutDir = 'out';
@@ -341,7 +338,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
341
338
  const buildId = await getBuildId(isGenerateMode, distDir, nextBuildSpan, config);
342
339
  NextBuildContext.buildId = buildId;
343
340
  if (experimentalBuildMode === 'generate-env') {
344
- if (bundler === Bundler.Turbopack) {
341
+ if (isTurbopack) {
345
342
  Log.warn('generate-env is not needed with turbopack');
346
343
  process.exit(0);
347
344
  }
@@ -635,7 +632,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
635
632
  await writeValidatorFile(routeTypesManifest, validatorFilePath);
636
633
  });
637
634
  // Turbopack already handles conflicting app and page routes.
638
- if (bundler !== Bundler.Turbopack) {
635
+ if (!isTurbopack) {
639
636
  const numConflictingAppPaths = conflictingAppPagePaths.length;
640
637
  if (mappedAppPages && numConflictingAppPaths > 0) {
641
638
  Log.error(`Conflicting app and page file${numConflictingAppPaths === 1 ? ' was' : 's were'} found, please remove the conflicting files to continue:`);
@@ -785,7 +782,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
785
782
  // Files outside of the distDir can be "type": "module"
786
783
  await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
787
784
  // These are written to distDir, so they need to come after creating and cleaning distDr.
788
- await recordFrameworkVersion("15.6.0-canary.37");
785
+ await recordFrameworkVersion("15.6.0-canary.38");
789
786
  await updateBuildDiagnostics({
790
787
  buildStage: 'start'
791
788
  });
@@ -817,7 +814,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
817
814
  });
818
815
  let shutdownPromise = Promise.resolve();
819
816
  if (!isGenerateMode) {
820
- if (bundler === Bundler.Turbopack) {
817
+ if (isTurbopack) {
821
818
  const { duration: compilerDuration, shutdownPromise: p, ...rest } = await turbopackBuild(process.env.NEXT_TURBOPACK_USE_WORKER === undefined || process.env.NEXT_TURBOPACK_USE_WORKER !== '0');
822
819
  shutdownPromise = p;
823
820
  traceMemoryUsage('Finished build', nextBuildSpan);
@@ -898,7 +895,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
898
895
  const durationString = durationToString(durationInSeconds);
899
896
  Log.event(`Compiled successfully in ${durationString}`);
900
897
  telemetry.record(eventBuildCompleted(pagesPaths, {
901
- bundler: getBundlerForTelemetry(bundler),
898
+ bundler: getBundlerForTelemetry(isTurbopack),
902
899
  durationInSeconds,
903
900
  totalAppPagesCount
904
901
  }));
@@ -907,7 +904,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
907
904
  traceMemoryUsage('Finished build', nextBuildSpan);
908
905
  buildTraceContext = rest.buildTraceContext;
909
906
  telemetry.record(eventBuildCompleted(pagesPaths, {
910
- bundler: getBundlerForTelemetry(bundler),
907
+ bundler: getBundlerForTelemetry(isTurbopack),
911
908
  durationInSeconds: compilerDuration,
912
909
  totalAppPagesCount
913
910
  }));
@@ -1332,7 +1329,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
1332
1329
  instrumentationHookEntryFiles.push(path.join(SERVER_DIRECTORY, `${INSTRUMENTATION_HOOK_FILENAME}.js`));
1333
1330
  // If there's edge routes, append the edge instrumentation hook
1334
1331
  // Turbopack generates this chunk with a hashed name and references it in middleware-manifest.
1335
- if (bundler !== Bundler.Turbopack && (edgeRuntimeAppCount || edgeRuntimePagesCount)) {
1332
+ if (!isTurbopack && (edgeRuntimeAppCount || edgeRuntimePagesCount)) {
1336
1333
  instrumentationHookEntryFiles.push(path.join(SERVER_DIRECTORY, `edge-${INSTRUMENTATION_HOOK_FILENAME}.js`));
1337
1334
  }
1338
1335
  }
@@ -1369,7 +1366,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
1369
1366
  path.join(SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST),
1370
1367
  path.join(SERVER_DIRECTORY, MIDDLEWARE_MANIFEST),
1371
1368
  path.join(SERVER_DIRECTORY, MIDDLEWARE_BUILD_MANIFEST + '.js'),
1372
- ...bundler !== Bundler.Turbopack ? [
1369
+ ...!isTurbopack ? [
1373
1370
  path.join(SERVER_DIRECTORY, MIDDLEWARE_REACT_LOADABLE_MANIFEST + '.js'),
1374
1371
  REACT_LOADABLE_MANIFEST
1375
1372
  ] : [],
@@ -1383,7 +1380,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
1383
1380
  path.join(SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.js'),
1384
1381
  path.join(SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.json')
1385
1382
  ] : [],
1386
- ...pagesDir && bundler !== Bundler.Turbopack ? [
1383
+ ...pagesDir && !isTurbopack ? [
1387
1384
  DYNAMIC_CSS_MANIFEST + '.json',
1388
1385
  path.join(SERVER_DIRECTORY, DYNAMIC_CSS_MANIFEST + '.js')
1389
1386
  ] : [],
@@ -1424,13 +1421,13 @@ export default async function build(dir, reactProductionProfiling = false, debug
1424
1421
  }
1425
1422
  ]
1426
1423
  };
1427
- if (bundler === Bundler.Turbopack) {
1424
+ if (isTurbopack) {
1428
1425
  await writeManifest(path.join(distDir, 'static', buildId, TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST), functionsConfigManifest.functions['/_middleware'].matchers || []);
1429
1426
  }
1430
1427
  }
1431
1428
  }
1432
1429
  await writeFunctionsConfigManifest(distDir, functionsConfigManifest);
1433
- if (bundler !== Bundler.Turbopack && !isGenerateMode && !buildTracesPromise) {
1430
+ if (!isTurbopack && !isGenerateMode && !buildTracesPromise) {
1434
1431
  buildTracesPromise = nextBuildSpan.traceChild('collect-build-traces').traceAsyncFn(()=>{
1435
1432
  return collectBuildTraces({
1436
1433
  dir,
@@ -1529,7 +1526,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
1529
1526
  await writeRequiredServerFilesManifest(distDir, requiredServerFilesManifest);
1530
1527
  // we don't need to inline for turbopack build as
1531
1528
  // it will handle it's own caching separate of compile
1532
- if (isGenerateMode && bundler !== Bundler.Turbopack) {
1529
+ if (isGenerateMode && !isTurbopack) {
1533
1530
  Log.info('Inlining static env ...');
1534
1531
  await nextBuildSpan.traceChild('inline-static-env').traceAsyncFn(async ()=>{
1535
1532
  await inlineStaticEnv({
@@ -2419,7 +2416,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
2419
2416
  distDir,
2420
2417
  config,
2421
2418
  staticPages,
2422
- nextVersion: "15.6.0-canary.37",
2419
+ nextVersion: "15.6.0-canary.38",
2423
2420
  tracingRoot: outputFileTracingRoot,
2424
2421
  hasNodeMiddleware,
2425
2422
  hasInstrumentationHook,
@@ -2463,7 +2460,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
2463
2460
  const telemetry = traceGlobals.get('telemetry');
2464
2461
  if (telemetry) {
2465
2462
  telemetry.record(eventBuildFailed({
2466
- bundler: getBundlerForTelemetry(bundler),
2463
+ bundler: getBundlerForTelemetry(isTurbopack),
2467
2464
  errorCode: getErrorCodeForTelemetry(e),
2468
2465
  durationInSeconds: Math.floor((Date.now() - buildStartTime) / 1000)
2469
2466
  }));
@@ -2481,7 +2478,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
2481
2478
  mode: 'build',
2482
2479
  projectDir: dir,
2483
2480
  distDir: loadedConfig.distDir,
2484
- isTurboSession: bundler === Bundler.Turbopack,
2481
+ isTurboSession: isTurbopack,
2485
2482
  sync: true
2486
2483
  });
2487
2484
  }
@@ -2491,21 +2488,14 @@ function errorFromUnsupportedSegmentConfig() {
2491
2488
  Log.error(`Invalid segment configuration export detected. This can cause unexpected behavior from the configs not being applied. You should see the relevant failures in the logs above. Please fix them to continue.`);
2492
2489
  process.exit(1);
2493
2490
  }
2494
- function getBundlerForTelemetry(bundler) {
2495
- switch(bundler){
2496
- case Bundler.Turbopack:
2497
- return 'turbopack';
2498
- case Bundler.Rspack:
2499
- return 'rspack';
2500
- case Bundler.Webpack:
2501
- return 'webpack';
2502
- default:
2503
- throw Object.defineProperty(new Error(`unknown bundler: ${bundler}`), "__NEXT_ERROR_CODE", {
2504
- value: "E826",
2505
- enumerable: false,
2506
- configurable: true
2507
- });
2491
+ function getBundlerForTelemetry(isTurbopack) {
2492
+ if (isTurbopack) {
2493
+ return 'turbopack';
2494
+ }
2495
+ if (process.env.NEXT_RSPACK) {
2496
+ return 'rspack';
2508
2497
  }
2498
+ return 'webpack';
2509
2499
  }
2510
2500
  function getErrorCodeForTelemetry(err) {
2511
2501
  const code = extractNextErrorCode(err);