next 15.3.0-canary.0 → 15.3.0-canary.1

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 (63) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/build-context.d.ts +1 -0
  3. package/dist/build/build-context.js.map +1 -1
  4. package/dist/build/index.js +25 -2
  5. package/dist/build/index.js.map +1 -1
  6. package/dist/build/swc/index.js +1 -1
  7. package/dist/build/webpack/plugins/define-env-plugin.d.ts +2 -1
  8. package/dist/build/webpack/plugins/define-env-plugin.js +23 -2
  9. package/dist/build/webpack/plugins/define-env-plugin.js.map +1 -1
  10. package/dist/build/webpack-build/impl.js +1 -0
  11. package/dist/build/webpack-build/impl.js.map +1 -1
  12. package/dist/build/webpack-config.d.ts +2 -1
  13. package/dist/build/webpack-config.js +5 -4
  14. package/dist/build/webpack-config.js.map +1 -1
  15. package/dist/client/app-bootstrap.js +1 -1
  16. package/dist/client/index.js +1 -1
  17. package/dist/compiled/next-server/server.runtime.prod.js +8 -8
  18. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  19. package/dist/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +1 -1
  20. package/dist/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +1 -1
  21. package/dist/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js +1 -1
  22. package/dist/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js +1 -1
  23. package/dist/esm/build/build-context.js.map +1 -1
  24. package/dist/esm/build/index.js +25 -2
  25. package/dist/esm/build/index.js.map +1 -1
  26. package/dist/esm/build/swc/index.js +1 -1
  27. package/dist/esm/build/webpack/plugins/define-env-plugin.js +23 -2
  28. package/dist/esm/build/webpack/plugins/define-env-plugin.js.map +1 -1
  29. package/dist/esm/build/webpack-build/impl.js +1 -0
  30. package/dist/esm/build/webpack-build/impl.js.map +1 -1
  31. package/dist/esm/build/webpack-config.js +5 -4
  32. package/dist/esm/build/webpack-config.js.map +1 -1
  33. package/dist/esm/client/app-bootstrap.js +1 -1
  34. package/dist/esm/client/index.js +1 -1
  35. package/dist/esm/lib/inline-static-env.js +122 -0
  36. package/dist/esm/lib/inline-static-env.js.map +1 -0
  37. package/dist/esm/server/base-server.js +8 -0
  38. package/dist/esm/server/base-server.js.map +1 -1
  39. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  40. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  41. package/dist/esm/server/lib/app-info-log.js +1 -1
  42. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +10 -2
  43. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  44. package/dist/esm/server/lib/start-server.js +1 -1
  45. package/dist/esm/shared/lib/canary-only.js +1 -1
  46. package/dist/lib/inline-static-env.d.ts +7 -0
  47. package/dist/lib/inline-static-env.js +149 -0
  48. package/dist/lib/inline-static-env.js.map +1 -0
  49. package/dist/server/base-server.js +8 -0
  50. package/dist/server/base-server.js.map +1 -1
  51. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  52. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  53. package/dist/server/lib/app-info-log.js +1 -1
  54. package/dist/server/lib/router-utils/setup-dev-bundler.js +8 -0
  55. package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  56. package/dist/server/lib/start-server.js +1 -1
  57. package/dist/shared/lib/canary-only.js +1 -1
  58. package/dist/telemetry/anonymous-meta.js +1 -1
  59. package/dist/telemetry/events/build.d.ts +1 -1
  60. package/dist/telemetry/events/build.js.map +1 -1
  61. package/dist/telemetry/events/session-stopped.js +2 -2
  62. package/dist/telemetry/events/version.js +2 -2
  63. 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.3.0-canary.0"}`, '-v, --version', 'Outputs the Next.js version.');
82
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.3.0-canary.1"}`, '-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
85
  'generate'
@@ -50,4 +50,5 @@ export declare const NextBuildContext: Partial<{
50
50
  previewModeId: string;
51
51
  fetchCacheKeyPrefix?: string;
52
52
  allowedRevalidateHeaderKeys?: string[];
53
+ isCompileMode?: boolean;
53
54
  }>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/build/build-context.ts"],"sourcesContent":["import type { LoadedEnvFiles } from '@next/env'\nimport type { Rewrite, Redirect } from '../lib/load-custom-routes'\nimport type { __ApiPreviewProps } from '../server/api-utils'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport type { Span } from '../trace'\nimport type getBaseWebpackConfig from './webpack-config'\nimport type { TelemetryPluginState } from './webpack/plugins/telemetry-plugin/telemetry-plugin'\nimport type { Telemetry } from '../telemetry/storage'\n\n// A layer for storing data that is used by plugins to communicate with each\n// other between different steps of the build process. This is only internal\n// to Next.js and will not be a part of the final build output.\n// These states don't need to be deeply merged.\nlet pluginState: Record<string, any> = {}\nexport function resumePluginState(resumedState?: Record<string, any>) {\n Object.assign(pluginState, resumedState)\n}\n\n// This method gives you the plugin state with typed and mutable value fields\n// behind a proxy so we can lazily initialize the values **after** resuming the\n// plugin state.\nexport function getProxiedPluginState<State extends Record<string, any>>(\n initialState: State\n) {\n return new Proxy(pluginState, {\n get(target, key: string) {\n if (typeof target[key] === 'undefined') {\n return (target[key] = initialState[key])\n }\n return target[key]\n },\n set(target, key: string, value) {\n target[key] = value\n return true\n },\n }) as State\n}\n\nexport function getPluginState() {\n return pluginState\n}\n\nexport interface MappedPages {\n [page: string]: string\n}\n\n// a global object to store context for the current build\n// this is used to pass data between different steps of the build without having\n// to pass it through function arguments.\n// Not exhaustive, but should be extended to as needed whilst refactoring\nexport const NextBuildContext: Partial<{\n compilerIdx?: number\n pluginState: Record<string, any>\n // core fields\n dir: string\n distDir: string\n buildId: string\n encryptionKey: string\n config: NextConfigComplete\n appDir: string\n pagesDir: string\n rewrites: {\n fallback: Rewrite[]\n afterFiles: Rewrite[]\n beforeFiles: Rewrite[]\n }\n originalRewrites: {\n fallback: Rewrite[]\n afterFiles: Rewrite[]\n beforeFiles: Rewrite[]\n }\n hasRewrites: boolean\n originalRedirects: Redirect[]\n loadedEnvFiles: LoadedEnvFiles\n previewProps: __ApiPreviewProps\n mappedPages: MappedPages | undefined\n mappedAppPages: MappedPages | undefined\n mappedRootPaths: MappedPages\n hasInstrumentationHook: boolean\n\n // misc fields\n telemetry: Telemetry\n telemetryState: TelemetryPluginState\n nextBuildSpan: Span\n\n // cli fields\n reactProductionProfiling: boolean\n noMangling: boolean\n appDirOnly: boolean\n clientRouterFilters: Parameters<\n typeof getBaseWebpackConfig\n >[1]['clientRouterFilters']\n previewModeId: string\n fetchCacheKeyPrefix?: string\n allowedRevalidateHeaderKeys?: string[]\n}> = {}\n"],"names":["NextBuildContext","getPluginState","getProxiedPluginState","resumePluginState","pluginState","resumedState","Object","assign","initialState","Proxy","get","target","key","set","value"],"mappings":";;;;;;;;;;;;;;;;;IAkDaA,gBAAgB;eAAhBA;;IAZGC,cAAc;eAAdA;;IAjBAC,qBAAqB;eAArBA;;IAPAC,iBAAiB;eAAjBA;;;AALhB,4EAA4E;AAC5E,4EAA4E;AAC5E,+DAA+D;AAC/D,+CAA+C;AAC/C,IAAIC,cAAmC,CAAC;AACjC,SAASD,kBAAkBE,YAAkC;IAClEC,OAAOC,MAAM,CAACH,aAAaC;AAC7B;AAKO,SAASH,sBACdM,YAAmB;IAEnB,OAAO,IAAIC,MAAML,aAAa;QAC5BM,KAAIC,MAAM,EAAEC,GAAW;YACrB,IAAI,OAAOD,MAAM,CAACC,IAAI,KAAK,aAAa;gBACtC,OAAQD,MAAM,CAACC,IAAI,GAAGJ,YAAY,CAACI,IAAI;YACzC;YACA,OAAOD,MAAM,CAACC,IAAI;QACpB;QACAC,KAAIF,MAAM,EAAEC,GAAW,EAAEE,KAAK;YAC5BH,MAAM,CAACC,IAAI,GAAGE;YACd,OAAO;QACT;IACF;AACF;AAEO,SAASb;IACd,OAAOG;AACT;AAUO,MAAMJ,mBA6CR,CAAC"}
1
+ {"version":3,"sources":["../../src/build/build-context.ts"],"sourcesContent":["import type { LoadedEnvFiles } from '@next/env'\nimport type { Rewrite, Redirect } from '../lib/load-custom-routes'\nimport type { __ApiPreviewProps } from '../server/api-utils'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport type { Span } from '../trace'\nimport type getBaseWebpackConfig from './webpack-config'\nimport type { TelemetryPluginState } from './webpack/plugins/telemetry-plugin/telemetry-plugin'\nimport type { Telemetry } from '../telemetry/storage'\n\n// A layer for storing data that is used by plugins to communicate with each\n// other between different steps of the build process. This is only internal\n// to Next.js and will not be a part of the final build output.\n// These states don't need to be deeply merged.\nlet pluginState: Record<string, any> = {}\nexport function resumePluginState(resumedState?: Record<string, any>) {\n Object.assign(pluginState, resumedState)\n}\n\n// This method gives you the plugin state with typed and mutable value fields\n// behind a proxy so we can lazily initialize the values **after** resuming the\n// plugin state.\nexport function getProxiedPluginState<State extends Record<string, any>>(\n initialState: State\n) {\n return new Proxy(pluginState, {\n get(target, key: string) {\n if (typeof target[key] === 'undefined') {\n return (target[key] = initialState[key])\n }\n return target[key]\n },\n set(target, key: string, value) {\n target[key] = value\n return true\n },\n }) as State\n}\n\nexport function getPluginState() {\n return pluginState\n}\n\nexport interface MappedPages {\n [page: string]: string\n}\n\n// a global object to store context for the current build\n// this is used to pass data between different steps of the build without having\n// to pass it through function arguments.\n// Not exhaustive, but should be extended to as needed whilst refactoring\nexport const NextBuildContext: Partial<{\n compilerIdx?: number\n pluginState: Record<string, any>\n // core fields\n dir: string\n distDir: string\n buildId: string\n encryptionKey: string\n config: NextConfigComplete\n appDir: string\n pagesDir: string\n rewrites: {\n fallback: Rewrite[]\n afterFiles: Rewrite[]\n beforeFiles: Rewrite[]\n }\n originalRewrites: {\n fallback: Rewrite[]\n afterFiles: Rewrite[]\n beforeFiles: Rewrite[]\n }\n hasRewrites: boolean\n originalRedirects: Redirect[]\n loadedEnvFiles: LoadedEnvFiles\n previewProps: __ApiPreviewProps\n mappedPages: MappedPages | undefined\n mappedAppPages: MappedPages | undefined\n mappedRootPaths: MappedPages\n hasInstrumentationHook: boolean\n\n // misc fields\n telemetry: Telemetry\n telemetryState: TelemetryPluginState\n nextBuildSpan: Span\n\n // cli fields\n reactProductionProfiling: boolean\n noMangling: boolean\n appDirOnly: boolean\n clientRouterFilters: Parameters<\n typeof getBaseWebpackConfig\n >[1]['clientRouterFilters']\n previewModeId: string\n fetchCacheKeyPrefix?: string\n allowedRevalidateHeaderKeys?: string[]\n isCompileMode?: boolean\n}> = {}\n"],"names":["NextBuildContext","getPluginState","getProxiedPluginState","resumePluginState","pluginState","resumedState","Object","assign","initialState","Proxy","get","target","key","set","value"],"mappings":";;;;;;;;;;;;;;;;;IAkDaA,gBAAgB;eAAhBA;;IAZGC,cAAc;eAAdA;;IAjBAC,qBAAqB;eAArBA;;IAPAC,iBAAiB;eAAjBA;;;AALhB,4EAA4E;AAC5E,4EAA4E;AAC5E,+DAA+D;AAC/D,+CAA+C;AAC/C,IAAIC,cAAmC,CAAC;AACjC,SAASD,kBAAkBE,YAAkC;IAClEC,OAAOC,MAAM,CAACH,aAAaC;AAC7B;AAKO,SAASH,sBACdM,YAAmB;IAEnB,OAAO,IAAIC,MAAML,aAAa;QAC5BM,KAAIC,MAAM,EAAEC,GAAW;YACrB,IAAI,OAAOD,MAAM,CAACC,IAAI,KAAK,aAAa;gBACtC,OAAQD,MAAM,CAACC,IAAI,GAAGJ,YAAY,CAACI,IAAI;YACzC;YACA,OAAOD,MAAM,CAACC,IAAI;QACpB;QACAC,KAAIF,MAAM,EAAEC,GAAW,EAAEE,KAAK;YAC5BH,MAAM,CAACC,IAAI,GAAGE;YACd,OAAO;QACT;IACF;AACF;AAEO,SAASb;IACd,OAAOG;AACT;AAUO,MAAMJ,mBA8CR,CAAC"}
@@ -97,6 +97,8 @@ const _invarianterror = require("../shared/lib/invariant-error");
97
97
  const _isbot = require("../shared/lib/router/utils/is-bot");
98
98
  const _buildprefetchsegmentdataroute = require("../server/lib/router-utils/build-prefetch-segment-data-route");
99
99
  const _turbopackbuild = require("./turbopack-build");
100
+ const _utils4 = require("../shared/lib/turbopack/utils");
101
+ const _inlinestaticenv = require("../lib/inline-static-env");
100
102
  function _interop_require_default(obj) {
101
103
  return obj && obj.__esModule ? obj : {
102
104
  default: obj
@@ -359,12 +361,13 @@ async function getBuildId(isGenerateMode, distDir, nextBuildSpan, config) {
359
361
  async function build(dir, reactProductionProfiling = false, debugOutput = false, runLint = true, noMangling = false, appDirOnly = false, turboNextBuild = false, experimentalBuildMode, traceUploadUrl) {
360
362
  const isCompileMode = experimentalBuildMode === 'compile';
361
363
  const isGenerateMode = experimentalBuildMode === 'generate';
364
+ _buildcontext.NextBuildContext.isCompileMode = isCompileMode;
362
365
  let loadedConfig;
363
366
  try {
364
367
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
365
368
  buildMode: experimentalBuildMode,
366
369
  isTurboBuild: String(turboNextBuild),
367
- version: "15.3.0-canary.0"
370
+ version: "15.3.0-canary.1"
368
371
  });
369
372
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
370
373
  _buildcontext.NextBuildContext.dir = dir;
@@ -396,6 +399,11 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
396
399
  (0, _trace.setGlobal)('distDir', distDir);
397
400
  const buildId = await getBuildId(isGenerateMode, distDir, nextBuildSpan, config);
398
401
  _buildcontext.NextBuildContext.buildId = buildId;
402
+ // when using compile mode static env isn't inlined so we
403
+ // need to populate in normal runtime env
404
+ if (isCompileMode || isGenerateMode) {
405
+ (0, _inlinestaticenv.populateStaticEnv)(config);
406
+ }
399
407
  const customRoutes = await nextBuildSpan.traceChild('load-custom-routes').traceAsyncFn(()=>(0, _loadcustomroutes.default)(config));
400
408
  const { headers, rewrites, redirects } = customRoutes;
401
409
  const combinedRewrites = [
@@ -723,7 +731,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
723
731
  // Files outside of the distDir can be "type": "module"
724
732
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
725
733
  // These are written to distDir, so they need to come after creating and cleaning distDr.
726
- await (0, _builddiagnostics.recordFrameworkVersion)("15.3.0-canary.0");
734
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.3.0-canary.1");
727
735
  await (0, _builddiagnostics.updateBuildDiagnostics)({
728
736
  buildStage: 'start'
729
737
  });
@@ -1450,6 +1458,10 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
1450
1458
  {
1451
1459
  featureName: 'experimental/ppr',
1452
1460
  invocationCount: config.experimental.ppr ? 1 : 0
1461
+ },
1462
+ {
1463
+ featureName: 'turbopackPersistentCaching',
1464
+ invocationCount: (0, _utils4.isPersistentCachingEnabled)(config) ? 1 : 0
1453
1465
  }
1454
1466
  ];
1455
1467
  telemetry.record(features.map((feature)=>{
@@ -1459,6 +1471,17 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
1459
1471
  };
1460
1472
  }));
1461
1473
  await writeRequiredServerFilesManifest(distDir, requiredServerFilesManifest);
1474
+ // we don't need to inline for turbopack build as
1475
+ // it will handle it's own caching separate of compile
1476
+ if (isGenerateMode && !turboNextBuild) {
1477
+ await nextBuildSpan.traceChild('inline-static-env').traceAsyncFn(async ()=>{
1478
+ await (0, _inlinestaticenv.inlineStaticEnv)({
1479
+ distDir,
1480
+ config,
1481
+ buildId
1482
+ });
1483
+ });
1484
+ }
1462
1485
  const middlewareManifest = await readManifest(_path.default.join(distDir, _constants1.SERVER_DIRECTORY, _constants1.MIDDLEWARE_MANIFEST));
1463
1486
  const prerenderManifest = {
1464
1487
  version: 4,