next 15.4.0-canary.0 → 15.4.0-canary.2

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 (35) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +37 -4
  3. package/dist/build/index.js.map +1 -1
  4. package/dist/build/swc/index.js +1 -1
  5. package/dist/build/utils.d.ts +1 -0
  6. package/dist/build/utils.js.map +1 -1
  7. package/dist/build/webpack-config.js +2 -2
  8. package/dist/client/app-bootstrap.js +1 -1
  9. package/dist/client/index.js +1 -1
  10. package/dist/esm/build/index.js +38 -5
  11. package/dist/esm/build/index.js.map +1 -1
  12. package/dist/esm/build/swc/index.js +1 -1
  13. package/dist/esm/build/utils.js.map +1 -1
  14. package/dist/esm/build/webpack-config.js +2 -2
  15. package/dist/esm/client/app-bootstrap.js +1 -1
  16. package/dist/esm/client/index.js +1 -1
  17. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  18. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  19. package/dist/esm/server/lib/app-info-log.js +1 -1
  20. package/dist/esm/server/lib/router-utils/build-prefetch-segment-data-route.js +29 -3
  21. package/dist/esm/server/lib/router-utils/build-prefetch-segment-data-route.js.map +1 -1
  22. package/dist/esm/server/lib/start-server.js +1 -1
  23. package/dist/esm/shared/lib/canary-only.js +1 -1
  24. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  25. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  26. package/dist/server/lib/app-info-log.js +1 -1
  27. package/dist/server/lib/router-utils/build-prefetch-segment-data-route.d.ts +13 -0
  28. package/dist/server/lib/router-utils/build-prefetch-segment-data-route.js +24 -2
  29. package/dist/server/lib/router-utils/build-prefetch-segment-data-route.js.map +1 -1
  30. package/dist/server/lib/start-server.js +1 -1
  31. package/dist/shared/lib/canary-only.js +1 -1
  32. package/dist/telemetry/anonymous-meta.js +1 -1
  33. package/dist/telemetry/events/session-stopped.js +2 -2
  34. package/dist/telemetry/events/version.js +2 -2
  35. package/package.json +15 -15
package/dist/bin/next CHANGED
@@ -79,7 +79,7 @@ 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.4.0-canary.0"}`, '-v, --version', 'Outputs the Next.js version.');
82
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.4.0-canary.2"}`, '-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.').option('--turbo', 'Starts development mode using Turbopack.').option('--turbopack', 'Starts development mode using Turbopack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
84
84
  'compile',
85
85
  'generate',
@@ -375,7 +375,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
375
375
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
376
376
  buildMode: experimentalBuildMode,
377
377
  isTurboBuild: String(isTurbopack),
378
- version: "15.4.0-canary.0"
378
+ version: "15.4.0-canary.2"
379
379
  });
380
380
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
381
381
  _buildcontext.NextBuildContext.dir = dir;
@@ -756,7 +756,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
756
756
  // Files outside of the distDir can be "type": "module"
757
757
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
758
758
  // These are written to distDir, so they need to come after creating and cleaning distDr.
759
- await (0, _builddiagnostics.recordFrameworkVersion)("15.4.0-canary.0");
759
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.4.0-canary.2");
760
760
  await (0, _builddiagnostics.updateBuildDiagnostics)({
761
761
  buildStage: 'start'
762
762
  });
@@ -1270,6 +1270,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
1270
1270
  }
1271
1271
  }
1272
1272
  pageInfos.set(page, {
1273
+ originalAppPath,
1273
1274
  size,
1274
1275
  totalSize,
1275
1276
  isStatic,
@@ -1925,8 +1926,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
1925
1926
  }
1926
1927
  dynamicRoute.prefetchSegmentDataRoutes ??= [];
1927
1928
  for (const segmentPath of metadata.segmentPaths){
1928
- const result = (0, _buildprefetchsegmentdataroute.buildPrefetchSegmentDataRoute)(route.pathname, segmentPath);
1929
- dynamicRoute.prefetchSegmentDataRoutes.push(result);
1929
+ dynamicRoute.prefetchSegmentDataRoutes.push((0, _buildprefetchsegmentdataroute.buildPrefetchSegmentDataRoute)(route.pathname, segmentPath));
1930
1930
  }
1931
1931
  }
1932
1932
  pageInfos.set(route.pathname, {
@@ -2174,6 +2174,39 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
2174
2174
  force: true
2175
2175
  });
2176
2176
  await writeManifest(pagesManifestPath, pagesManifest);
2177
+ if (config.experimental.clientSegmentCache) {
2178
+ for (const dynamicRoute of routesManifest.dynamicRoutes){
2179
+ var _pageInfos_get;
2180
+ // We only want to handle pages that are using the app router. We
2181
+ // need this path in order to determine if it's an app route or an
2182
+ // app page.
2183
+ const originalAppPath = (_pageInfos_get = pageInfos.get(dynamicRoute.page)) == null ? void 0 : _pageInfos_get.originalAppPath;
2184
+ if (!originalAppPath) {
2185
+ continue;
2186
+ }
2187
+ // We only want to handle app pages, not app routes.
2188
+ if ((0, _isapprouteroute.isAppRouteRoute)(originalAppPath)) {
2189
+ continue;
2190
+ }
2191
+ // We don't need to add the prefetch segment data routes if it was
2192
+ // added due to a page that was already generated. This would have
2193
+ // happened if the page was static or partially static.
2194
+ if (dynamicRoute.prefetchSegmentDataRoutes) {
2195
+ continue;
2196
+ }
2197
+ // If the segment paths aren't defined, we need to insert a
2198
+ // reverse routing rule so that there isn't any conflicts
2199
+ // with other dynamic routes for the prefetch segment
2200
+ // routes. This is only an issue for pages that do not have
2201
+ // partial prerendering enabled.
2202
+ dynamicRoute.prefetchSegmentDataRoutes = [
2203
+ (0, _buildprefetchsegmentdataroute.buildInversePrefetchSegmentDataRoute)(dynamicRoute.page, // We use the special segment path of `/_tree` because it's
2204
+ // the first one sent by the client router so it's the only
2205
+ // one we need to rewrite to the regular prefetch RSC route.
2206
+ '/_tree')
2207
+ ];
2208
+ }
2209
+ }
2177
2210
  });
2178
2211
  // We need to write the manifest with rewrites after build as it might
2179
2212
  // have been modified.