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
@@ -87,7 +87,7 @@
87
87
  var chunkFilename = chunks[i],
88
88
  entry = chunkCache.get(chunkFilename);
89
89
  if (void 0 === entry) {
90
- entry = __turbopack_load__(chunkFilename);
90
+ entry = __turbopack_load_by_url__(chunkFilename);
91
91
  promises.push(entry);
92
92
  var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null);
93
93
  entry.then(resolve, ignoreReject);
@@ -73,7 +73,7 @@ function preloadModule(metadata) {
73
73
  var chunkFilename = chunks[i],
74
74
  entry = chunkCache.get(chunkFilename);
75
75
  if (void 0 === entry) {
76
- entry = __turbopack_load__(chunkFilename);
76
+ entry = __turbopack_load_by_url__(chunkFilename);
77
77
  promises.push(entry);
78
78
  var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null);
79
79
  entry.then(resolve, ignoreReject);
@@ -87,7 +87,7 @@
87
87
  var chunkFilename = chunks[i],
88
88
  entry = chunkCache.get(chunkFilename);
89
89
  if (void 0 === entry) {
90
- entry = __turbopack_load__(chunkFilename);
90
+ entry = __turbopack_load_by_url__(chunkFilename);
91
91
  promises.push(entry);
92
92
  var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null);
93
93
  entry.then(resolve, ignoreReject);
@@ -73,7 +73,7 @@ function preloadModule(metadata) {
73
73
  var chunkFilename = chunks[i],
74
74
  entry = chunkCache.get(chunkFilename);
75
75
  if (void 0 === entry) {
76
- entry = __turbopack_load__(chunkFilename);
76
+ entry = __turbopack_load_by_url__(chunkFilename);
77
77
  promises.push(entry);
78
78
  var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null);
79
79
  entry.then(resolve, ignoreReject);
@@ -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":["pluginState","resumePluginState","resumedState","Object","assign","getProxiedPluginState","initialState","Proxy","get","target","key","set","value","getPluginState","NextBuildContext"],"mappings":"AASA,4EAA4E;AAC5E,4EAA4E;AAC5E,+DAA+D;AAC/D,+CAA+C;AAC/C,IAAIA,cAAmC,CAAC;AACxC,OAAO,SAASC,kBAAkBC,YAAkC;IAClEC,OAAOC,MAAM,CAACJ,aAAaE;AAC7B;AAEA,6EAA6E;AAC7E,+EAA+E;AAC/E,gBAAgB;AAChB,OAAO,SAASG,sBACdC,YAAmB;IAEnB,OAAO,IAAIC,MAAMP,aAAa;QAC5BQ,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;AAEA,OAAO,SAASC;IACd,OAAOb;AACT;AAMA,yDAAyD;AACzD,gFAAgF;AAChF,yCAAyC;AACzC,yEAAyE;AACzE,OAAO,MAAMc,mBA6CR,CAAC,EAAC"}
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":["pluginState","resumePluginState","resumedState","Object","assign","getProxiedPluginState","initialState","Proxy","get","target","key","set","value","getPluginState","NextBuildContext"],"mappings":"AASA,4EAA4E;AAC5E,4EAA4E;AAC5E,+DAA+D;AAC/D,+CAA+C;AAC/C,IAAIA,cAAmC,CAAC;AACxC,OAAO,SAASC,kBAAkBC,YAAkC;IAClEC,OAAOC,MAAM,CAACJ,aAAaE;AAC7B;AAEA,6EAA6E;AAC7E,+EAA+E;AAC/E,gBAAgB;AAChB,OAAO,SAASG,sBACdC,YAAmB;IAEnB,OAAO,IAAIC,MAAMP,aAAa;QAC5BQ,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;AAEA,OAAO,SAASC;IACd,OAAOb;AACT;AAMA,yDAAyD;AACzD,gFAAgF;AAChF,yCAAyC;AACzC,yEAAyE;AACzE,OAAO,MAAMc,mBA8CR,CAAC,EAAC"}
@@ -75,6 +75,8 @@ import { InvariantError } from '../shared/lib/invariant-error';
75
75
  import { HTML_LIMITED_BOT_UA_RE_STRING } from '../shared/lib/router/utils/is-bot';
76
76
  import { buildPrefetchSegmentDataRoute } from '../server/lib/router-utils/build-prefetch-segment-data-route';
77
77
  import { turbopackBuild } from './turbopack-build';
78
+ import { isPersistentCachingEnabled } from '../shared/lib/turbopack/utils';
79
+ import { inlineStaticEnv, populateStaticEnv } from '../lib/inline-static-env';
78
80
  /**
79
81
  * The headers that are allowed to be used when revalidating routes. Currently
80
82
  * this includes both headers used by the pages and app routers.
@@ -291,12 +293,13 @@ async function getBuildId(isGenerateMode, distDir, nextBuildSpan, config) {
291
293
  export default async function build(dir, reactProductionProfiling = false, debugOutput = false, runLint = true, noMangling = false, appDirOnly = false, turboNextBuild = false, experimentalBuildMode, traceUploadUrl) {
292
294
  const isCompileMode = experimentalBuildMode === 'compile';
293
295
  const isGenerateMode = experimentalBuildMode === 'generate';
296
+ NextBuildContext.isCompileMode = isCompileMode;
294
297
  let loadedConfig;
295
298
  try {
296
299
  const nextBuildSpan = trace('next-build', undefined, {
297
300
  buildMode: experimentalBuildMode,
298
301
  isTurboBuild: String(turboNextBuild),
299
- version: "15.3.0-canary.0"
302
+ version: "15.3.0-canary.1"
300
303
  });
301
304
  NextBuildContext.nextBuildSpan = nextBuildSpan;
302
305
  NextBuildContext.dir = dir;
@@ -328,6 +331,11 @@ export default async function build(dir, reactProductionProfiling = false, debug
328
331
  setGlobal('distDir', distDir);
329
332
  const buildId = await getBuildId(isGenerateMode, distDir, nextBuildSpan, config);
330
333
  NextBuildContext.buildId = buildId;
334
+ // when using compile mode static env isn't inlined so we
335
+ // need to populate in normal runtime env
336
+ if (isCompileMode || isGenerateMode) {
337
+ populateStaticEnv(config);
338
+ }
331
339
  const customRoutes = await nextBuildSpan.traceChild('load-custom-routes').traceAsyncFn(()=>loadCustomRoutes(config));
332
340
  const { headers, rewrites, redirects } = customRoutes;
333
341
  const combinedRewrites = [
@@ -655,7 +663,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
655
663
  // Files outside of the distDir can be "type": "module"
656
664
  await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
657
665
  // These are written to distDir, so they need to come after creating and cleaning distDr.
658
- await recordFrameworkVersion("15.3.0-canary.0");
666
+ await recordFrameworkVersion("15.3.0-canary.1");
659
667
  await updateBuildDiagnostics({
660
668
  buildStage: 'start'
661
669
  });
@@ -1382,6 +1390,10 @@ export default async function build(dir, reactProductionProfiling = false, debug
1382
1390
  {
1383
1391
  featureName: 'experimental/ppr',
1384
1392
  invocationCount: config.experimental.ppr ? 1 : 0
1393
+ },
1394
+ {
1395
+ featureName: 'turbopackPersistentCaching',
1396
+ invocationCount: isPersistentCachingEnabled(config) ? 1 : 0
1385
1397
  }
1386
1398
  ];
1387
1399
  telemetry.record(features.map((feature)=>{
@@ -1391,6 +1403,17 @@ export default async function build(dir, reactProductionProfiling = false, debug
1391
1403
  };
1392
1404
  }));
1393
1405
  await writeRequiredServerFilesManifest(distDir, requiredServerFilesManifest);
1406
+ // we don't need to inline for turbopack build as
1407
+ // it will handle it's own caching separate of compile
1408
+ if (isGenerateMode && !turboNextBuild) {
1409
+ await nextBuildSpan.traceChild('inline-static-env').traceAsyncFn(async ()=>{
1410
+ await inlineStaticEnv({
1411
+ distDir,
1412
+ config,
1413
+ buildId
1414
+ });
1415
+ });
1416
+ }
1394
1417
  const middlewareManifest = await readManifest(path.join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST));
1395
1418
  const prerenderManifest = {
1396
1419
  version: 4,