next 15.6.0-canary.22 → 15.6.0-canary.23

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 (48) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +3 -3
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack/plugins/build-manifest-plugin-utils.d.ts +17 -0
  5. package/dist/build/webpack/plugins/build-manifest-plugin-utils.js +79 -0
  6. package/dist/build/webpack/plugins/build-manifest-plugin-utils.js.map +1 -0
  7. package/dist/build/webpack/plugins/build-manifest-plugin.d.ts +1 -16
  8. package/dist/build/webpack/plugins/build-manifest-plugin.js +8 -70
  9. package/dist/build/webpack/plugins/build-manifest-plugin.js.map +1 -1
  10. package/dist/build/webpack-config.js +2 -2
  11. package/dist/client/app-bootstrap.js +1 -1
  12. package/dist/client/index.js +1 -1
  13. package/dist/compiled/webpack/webpack.js +34 -37
  14. package/dist/esm/build/index.js +3 -3
  15. package/dist/esm/build/swc/index.js +1 -1
  16. package/dist/esm/build/webpack/plugins/build-manifest-plugin-utils.js +52 -0
  17. package/dist/esm/build/webpack/plugins/build-manifest-plugin-utils.js.map +1 -0
  18. package/dist/esm/build/webpack/plugins/build-manifest-plugin.js +1 -50
  19. package/dist/esm/build/webpack/plugins/build-manifest-plugin.js.map +1 -1
  20. package/dist/esm/build/webpack-config.js +2 -2
  21. package/dist/esm/client/app-bootstrap.js +1 -1
  22. package/dist/esm/client/index.js +1 -1
  23. package/dist/esm/server/config-utils.js +0 -2
  24. package/dist/esm/server/config-utils.js.map +1 -1
  25. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  26. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  27. package/dist/esm/server/lib/app-info-log.js +1 -1
  28. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +1 -1
  29. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  30. package/dist/esm/server/lib/start-server.js +1 -1
  31. package/dist/esm/shared/lib/canary-only.js +1 -1
  32. package/dist/esm/shared/lib/turbopack/manifest-loader.js +1 -1
  33. package/dist/esm/shared/lib/turbopack/manifest-loader.js.map +1 -1
  34. package/dist/server/config-utils.js +0 -2
  35. package/dist/server/config-utils.js.map +1 -1
  36. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  37. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  38. package/dist/server/lib/app-info-log.js +1 -1
  39. package/dist/server/lib/router-utils/setup-dev-bundler.js +2 -2
  40. package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  41. package/dist/server/lib/start-server.js +1 -1
  42. package/dist/shared/lib/canary-only.js +1 -1
  43. package/dist/shared/lib/turbopack/manifest-loader.js +7 -7
  44. package/dist/shared/lib/turbopack/manifest-loader.js.map +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
@@ -0,0 +1,52 @@
1
+ // Add the runtime ssg manifest file as a lazy-loaded file dependency.
2
+ // We also stub this file out for development mode (when it is not
3
+ // generated).
4
+ export const srcEmptySsgManifest = `self.__SSG_MANIFEST=new Set;self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()`;
5
+ function normalizeRewrite(item) {
6
+ return {
7
+ has: item.has,
8
+ source: item.source,
9
+ destination: item.destination
10
+ };
11
+ }
12
+ export const processRoute = (r)=>{
13
+ var _rewrite_destination;
14
+ const rewrite = {
15
+ ...r
16
+ };
17
+ // omit external rewrite destinations since these aren't
18
+ // handled client-side
19
+ if (!(rewrite == null ? void 0 : (_rewrite_destination = rewrite.destination) == null ? void 0 : _rewrite_destination.startsWith('/'))) {
20
+ delete rewrite.destination;
21
+ }
22
+ return rewrite;
23
+ };
24
+ export function normalizeRewritesForBuildManifest(rewrites) {
25
+ var _rewrites_afterFiles_map, _rewrites_afterFiles, _rewrites_beforeFiles_map, _rewrites_beforeFiles, _rewrites_fallback_map, _rewrites_fallback;
26
+ return {
27
+ afterFiles: (_rewrites_afterFiles = rewrites.afterFiles) == null ? void 0 : (_rewrites_afterFiles_map = _rewrites_afterFiles.map(processRoute)) == null ? void 0 : _rewrites_afterFiles_map.map((item)=>normalizeRewrite(item)),
28
+ beforeFiles: (_rewrites_beforeFiles = rewrites.beforeFiles) == null ? void 0 : (_rewrites_beforeFiles_map = _rewrites_beforeFiles.map(processRoute)) == null ? void 0 : _rewrites_beforeFiles_map.map((item)=>normalizeRewrite(item)),
29
+ fallback: (_rewrites_fallback = rewrites.fallback) == null ? void 0 : (_rewrites_fallback_map = _rewrites_fallback.map(processRoute)) == null ? void 0 : _rewrites_fallback_map.map((item)=>normalizeRewrite(item))
30
+ };
31
+ }
32
+ export function createEdgeRuntimeManifest(originAssetMap) {
33
+ const manifestFilenames = [
34
+ '_buildManifest.js',
35
+ '_ssgManifest.js'
36
+ ];
37
+ const assetMap = {
38
+ ...originAssetMap,
39
+ lowPriorityFiles: []
40
+ };
41
+ // we use globalThis here because middleware can be node
42
+ // which doesn't have "self"
43
+ const manifestDefCode = `globalThis.__BUILD_MANIFEST = ${JSON.stringify(assetMap, null, 2)};\n`;
44
+ // edge lowPriorityFiles item: '"/static/" + process.env.__NEXT_BUILD_ID + "/low-priority.js"'.
45
+ // Since lowPriorityFiles is not fixed and relying on `process.env.__NEXT_BUILD_ID`, we'll produce code creating it dynamically.
46
+ const lowPriorityFilesCode = `globalThis.__BUILD_MANIFEST.lowPriorityFiles = [\n` + manifestFilenames.map((filename)=>{
47
+ return `"/static/" + process.env.__NEXT_BUILD_ID + "/${filename}",\n`;
48
+ }).join(',') + `\n];`;
49
+ return manifestDefCode + lowPriorityFilesCode;
50
+ }
51
+
52
+ //# sourceMappingURL=build-manifest-plugin-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/build/webpack/plugins/build-manifest-plugin-utils.ts"],"sourcesContent":["import type { CustomRoutes, Rewrite } from '../../../lib/load-custom-routes'\nimport type { BuildManifest } from '../../../server/get-page-files'\n\nexport type ClientBuildManifest = {\n [key: string]: string[]\n}\n\n// Add the runtime ssg manifest file as a lazy-loaded file dependency.\n// We also stub this file out for development mode (when it is not\n// generated).\nexport const srcEmptySsgManifest = `self.__SSG_MANIFEST=new Set;self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()`\n\nfunction normalizeRewrite(item: {\n source: string\n destination: string\n has?: any\n}): CustomRoutes['rewrites']['beforeFiles'][0] {\n return {\n has: item.has,\n source: item.source,\n destination: item.destination,\n }\n}\n\nexport const processRoute = (r: Rewrite) => {\n const rewrite = { ...r }\n\n // omit external rewrite destinations since these aren't\n // handled client-side\n if (!rewrite?.destination?.startsWith('/')) {\n delete (rewrite as any).destination\n }\n return rewrite\n}\n\nexport function normalizeRewritesForBuildManifest(\n rewrites: CustomRoutes['rewrites']\n): CustomRoutes['rewrites'] {\n return {\n afterFiles: rewrites.afterFiles\n ?.map(processRoute)\n ?.map((item) => normalizeRewrite(item)),\n beforeFiles: rewrites.beforeFiles\n ?.map(processRoute)\n ?.map((item) => normalizeRewrite(item)),\n fallback: rewrites.fallback\n ?.map(processRoute)\n ?.map((item) => normalizeRewrite(item)),\n }\n}\n\nexport function createEdgeRuntimeManifest(\n originAssetMap: Partial<BuildManifest>\n): string {\n const manifestFilenames = ['_buildManifest.js', '_ssgManifest.js']\n\n const assetMap: Partial<BuildManifest> = {\n ...originAssetMap,\n lowPriorityFiles: [],\n }\n\n // we use globalThis here because middleware can be node\n // which doesn't have \"self\"\n const manifestDefCode = `globalThis.__BUILD_MANIFEST = ${JSON.stringify(\n assetMap,\n null,\n 2\n )};\\n`\n // edge lowPriorityFiles item: '\"/static/\" + process.env.__NEXT_BUILD_ID + \"/low-priority.js\"'.\n // Since lowPriorityFiles is not fixed and relying on `process.env.__NEXT_BUILD_ID`, we'll produce code creating it dynamically.\n const lowPriorityFilesCode =\n `globalThis.__BUILD_MANIFEST.lowPriorityFiles = [\\n` +\n manifestFilenames\n .map((filename) => {\n return `\"/static/\" + process.env.__NEXT_BUILD_ID + \"/${filename}\",\\n`\n })\n .join(',') +\n `\\n];`\n\n return manifestDefCode + lowPriorityFilesCode\n}\n"],"names":["srcEmptySsgManifest","normalizeRewrite","item","has","source","destination","processRoute","r","rewrite","startsWith","normalizeRewritesForBuildManifest","rewrites","afterFiles","map","beforeFiles","fallback","createEdgeRuntimeManifest","originAssetMap","manifestFilenames","assetMap","lowPriorityFiles","manifestDefCode","JSON","stringify","lowPriorityFilesCode","filename","join"],"mappings":"AAOA,sEAAsE;AACtE,kEAAkE;AAClE,cAAc;AACd,OAAO,MAAMA,sBAAsB,CAAC,4EAA4E,CAAC,CAAA;AAEjH,SAASC,iBAAiBC,IAIzB;IACC,OAAO;QACLC,KAAKD,KAAKC,GAAG;QACbC,QAAQF,KAAKE,MAAM;QACnBC,aAAaH,KAAKG,WAAW;IAC/B;AACF;AAEA,OAAO,MAAMC,eAAe,CAACC;QAKtBC;IAJL,MAAMA,UAAU;QAAE,GAAGD,CAAC;IAAC;IAEvB,wDAAwD;IACxD,sBAAsB;IACtB,IAAI,EAACC,4BAAAA,uBAAAA,QAASH,WAAW,qBAApBG,qBAAsBC,UAAU,CAAC,OAAM;QAC1C,OAAO,AAACD,QAAgBH,WAAW;IACrC;IACA,OAAOG;AACT,EAAC;AAED,OAAO,SAASE,kCACdC,QAAkC;QAGpBA,0BAAAA,sBAGCA,2BAAAA,uBAGHA,wBAAAA;IAPZ,OAAO;QACLC,UAAU,GAAED,uBAAAA,SAASC,UAAU,sBAAnBD,2BAAAA,qBACRE,GAAG,CAACP,kCADIK,yBAERE,GAAG,CAAC,CAACX,OAASD,iBAAiBC;QACnCY,WAAW,GAAEH,wBAAAA,SAASG,WAAW,sBAApBH,4BAAAA,sBACTE,GAAG,CAACP,kCADKK,0BAETE,GAAG,CAAC,CAACX,OAASD,iBAAiBC;QACnCa,QAAQ,GAAEJ,qBAAAA,SAASI,QAAQ,sBAAjBJ,yBAAAA,mBACNE,GAAG,CAACP,kCADEK,uBAENE,GAAG,CAAC,CAACX,OAASD,iBAAiBC;IACrC;AACF;AAEA,OAAO,SAASc,0BACdC,cAAsC;IAEtC,MAAMC,oBAAoB;QAAC;QAAqB;KAAkB;IAElE,MAAMC,WAAmC;QACvC,GAAGF,cAAc;QACjBG,kBAAkB,EAAE;IACtB;IAEA,wDAAwD;IACxD,4BAA4B;IAC5B,MAAMC,kBAAkB,CAAC,8BAA8B,EAAEC,KAAKC,SAAS,CACrEJ,UACA,MACA,GACA,GAAG,CAAC;IACN,+FAA+F;IAC/F,gIAAgI;IAChI,MAAMK,uBACJ,CAAC,kDAAkD,CAAC,GACpDN,kBACGL,GAAG,CAAC,CAACY;QACJ,OAAO,CAAC,6CAA6C,EAAEA,SAAS,IAAI,CAAC;IACvE,GACCC,IAAI,CAAC,OACR,CAAC,IAAI,CAAC;IAER,OAAOL,kBAAkBG;AAC3B","ignoreList":[0]}
@@ -6,48 +6,11 @@ import { ampFirstEntryNamesMap } from './next-drop-client-page-plugin';
6
6
  import { getSortedRoutes } from '../../../shared/lib/router/utils';
7
7
  import { Span } from '../../../trace';
8
8
  import { getCompilationSpan } from '../utils';
9
- // Add the runtime ssg manifest file as a lazy-loaded file dependency.
10
- // We also stub this file out for development mode (when it is not
11
- // generated).
12
- export const srcEmptySsgManifest = `self.__SSG_MANIFEST=new Set;self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()`;
9
+ import { createEdgeRuntimeManifest, normalizeRewritesForBuildManifest, processRoute, srcEmptySsgManifest } from './build-manifest-plugin-utils';
13
10
  // nodejs: '/static/<build id>/low-priority.js'
14
11
  function buildNodejsLowPriorityPath(filename, buildId) {
15
12
  return `${CLIENT_STATIC_FILES_PATH}/${buildId}/${filename}`;
16
13
  }
17
- export function createEdgeRuntimeManifest(originAssetMap) {
18
- const manifestFilenames = [
19
- '_buildManifest.js',
20
- '_ssgManifest.js'
21
- ];
22
- const assetMap = {
23
- ...originAssetMap,
24
- lowPriorityFiles: []
25
- };
26
- // we use globalThis here because middleware can be node
27
- // which doesn't have "self"
28
- const manifestDefCode = `globalThis.__BUILD_MANIFEST = ${JSON.stringify(assetMap, null, 2)};\n`;
29
- // edge lowPriorityFiles item: '"/static/" + process.env.__NEXT_BUILD_ID + "/low-priority.js"'.
30
- // Since lowPriorityFiles is not fixed and relying on `process.env.__NEXT_BUILD_ID`, we'll produce code creating it dynamically.
31
- const lowPriorityFilesCode = `globalThis.__BUILD_MANIFEST.lowPriorityFiles = [\n` + manifestFilenames.map((filename)=>{
32
- return `"/static/" + process.env.__NEXT_BUILD_ID + "/${filename}",\n`;
33
- }).join(',') + `\n];`;
34
- return manifestDefCode + lowPriorityFilesCode;
35
- }
36
- function normalizeRewrite(item) {
37
- return {
38
- has: item.has,
39
- source: item.source,
40
- destination: item.destination
41
- };
42
- }
43
- export function normalizeRewritesForBuildManifest(rewrites) {
44
- var _rewrites_afterFiles_map, _rewrites_afterFiles, _rewrites_beforeFiles_map, _rewrites_beforeFiles, _rewrites_fallback_map, _rewrites_fallback;
45
- return {
46
- afterFiles: (_rewrites_afterFiles = rewrites.afterFiles) == null ? void 0 : (_rewrites_afterFiles_map = _rewrites_afterFiles.map(processRoute)) == null ? void 0 : _rewrites_afterFiles_map.map((item)=>normalizeRewrite(item)),
47
- beforeFiles: (_rewrites_beforeFiles = rewrites.beforeFiles) == null ? void 0 : (_rewrites_beforeFiles_map = _rewrites_beforeFiles.map(processRoute)) == null ? void 0 : _rewrites_beforeFiles_map.map((item)=>normalizeRewrite(item)),
48
- fallback: (_rewrites_fallback = rewrites.fallback) == null ? void 0 : (_rewrites_fallback_map = _rewrites_fallback.map(processRoute)) == null ? void 0 : _rewrites_fallback_map.map((item)=>normalizeRewrite(item))
49
- };
50
- }
51
14
  // This function takes the asset map generated in BuildManifestPlugin and creates a
52
15
  // reduced version to send to the client.
53
16
  export function generateClientManifest(assetMap, rewrites, clientRouterFilters, compiler, compilation) {
@@ -86,18 +49,6 @@ export function getEntrypointFiles(entrypoint) {
86
49
  return /(?<!\.hot-update)\.(js|css)($|\?)/.test(file);
87
50
  }).map((file)=>file.replace(/\\/g, '/'))) ?? [];
88
51
  }
89
- export const processRoute = (r)=>{
90
- var _rewrite_destination;
91
- const rewrite = {
92
- ...r
93
- };
94
- // omit external rewrite destinations since these aren't
95
- // handled client-side
96
- if (!(rewrite == null ? void 0 : (_rewrite_destination = rewrite.destination) == null ? void 0 : _rewrite_destination.startsWith('/'))) {
97
- delete rewrite.destination;
98
- }
99
- return rewrite;
100
- };
101
52
  // This plugin creates a build-manifest.json for all assets that are being output
102
53
  // It has a mapping of "entry" filename to real filename. Because the real filename can be hashed in production
103
54
  export default class BuildManifestPlugin {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/build/webpack/plugins/build-manifest-plugin.ts"],"sourcesContent":["import type { BloomFilter } from '../../../shared/lib/bloom-filter'\nimport type { Rewrite, CustomRoutes } from '../../../lib/load-custom-routes'\nimport devalue from 'next/dist/compiled/devalue'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport {\n BUILD_MANIFEST,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_STATIC_FILES_PATH,\n CLIENT_STATIC_FILES_RUNTIME_MAIN,\n CLIENT_STATIC_FILES_RUNTIME_MAIN_APP,\n CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL,\n CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH,\n CLIENT_STATIC_FILES_RUNTIME_AMP,\n SYSTEM_ENTRYPOINTS,\n} from '../../../shared/lib/constants'\nimport type { BuildManifest } from '../../../server/get-page-files'\nimport getRouteFromEntrypoint from '../../../server/get-route-from-entrypoint'\nimport { ampFirstEntryNamesMap } from './next-drop-client-page-plugin'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { Span } from '../../../trace'\nimport { getCompilationSpan } from '../utils'\n\ntype DeepMutable<T> = { -readonly [P in keyof T]: DeepMutable<T[P]> }\n\nexport type ClientBuildManifest = {\n [key: string]: string[]\n}\n\n// Add the runtime ssg manifest file as a lazy-loaded file dependency.\n// We also stub this file out for development mode (when it is not\n// generated).\nexport const srcEmptySsgManifest = `self.__SSG_MANIFEST=new Set;self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()`\n\n// nodejs: '/static/<build id>/low-priority.js'\nfunction buildNodejsLowPriorityPath(filename: string, buildId: string) {\n return `${CLIENT_STATIC_FILES_PATH}/${buildId}/${filename}`\n}\n\nexport function createEdgeRuntimeManifest(\n originAssetMap: Partial<BuildManifest>\n): string {\n const manifestFilenames = ['_buildManifest.js', '_ssgManifest.js']\n\n const assetMap: Partial<BuildManifest> = {\n ...originAssetMap,\n lowPriorityFiles: [],\n }\n\n // we use globalThis here because middleware can be node\n // which doesn't have \"self\"\n const manifestDefCode = `globalThis.__BUILD_MANIFEST = ${JSON.stringify(\n assetMap,\n null,\n 2\n )};\\n`\n // edge lowPriorityFiles item: '\"/static/\" + process.env.__NEXT_BUILD_ID + \"/low-priority.js\"'.\n // Since lowPriorityFiles is not fixed and relying on `process.env.__NEXT_BUILD_ID`, we'll produce code creating it dynamically.\n const lowPriorityFilesCode =\n `globalThis.__BUILD_MANIFEST.lowPriorityFiles = [\\n` +\n manifestFilenames\n .map((filename) => {\n return `\"/static/\" + process.env.__NEXT_BUILD_ID + \"/${filename}\",\\n`\n })\n .join(',') +\n `\\n];`\n\n return manifestDefCode + lowPriorityFilesCode\n}\n\nfunction normalizeRewrite(item: {\n source: string\n destination: string\n has?: any\n}): CustomRoutes['rewrites']['beforeFiles'][0] {\n return {\n has: item.has,\n source: item.source,\n destination: item.destination,\n }\n}\n\nexport function normalizeRewritesForBuildManifest(\n rewrites: CustomRoutes['rewrites']\n): CustomRoutes['rewrites'] {\n return {\n afterFiles: rewrites.afterFiles\n ?.map(processRoute)\n ?.map((item) => normalizeRewrite(item)),\n beforeFiles: rewrites.beforeFiles\n ?.map(processRoute)\n ?.map((item) => normalizeRewrite(item)),\n fallback: rewrites.fallback\n ?.map(processRoute)\n ?.map((item) => normalizeRewrite(item)),\n }\n}\n\n// This function takes the asset map generated in BuildManifestPlugin and creates a\n// reduced version to send to the client.\nexport function generateClientManifest(\n assetMap: BuildManifest,\n rewrites: CustomRoutes['rewrites'],\n clientRouterFilters?: {\n staticFilter: ReturnType<BloomFilter['export']>\n dynamicFilter: ReturnType<BloomFilter['export']>\n },\n compiler?: any,\n compilation?: any\n): string | undefined {\n const compilationSpan = compilation\n ? getCompilationSpan(compilation)\n : compiler\n ? getCompilationSpan(compiler)\n : new Span({ name: 'client-manifest' })\n\n const genClientManifestSpan = compilationSpan?.traceChild(\n 'NextJsBuildManifest-generateClientManifest'\n )\n\n return genClientManifestSpan?.traceFn(() => {\n const clientManifest: ClientBuildManifest = {\n __rewrites: normalizeRewritesForBuildManifest(rewrites) as any,\n __routerFilterStatic: clientRouterFilters?.staticFilter as any,\n __routerFilterDynamic: clientRouterFilters?.dynamicFilter as any,\n }\n const appDependencies = new Set(assetMap.pages['/_app'])\n const sortedPageKeys = getSortedRoutes(Object.keys(assetMap.pages))\n\n sortedPageKeys.forEach((page) => {\n const dependencies = assetMap.pages[page]\n\n if (page === '/_app') return\n // Filter out dependencies in the _app entry, because those will have already\n // been loaded by the client prior to a navigation event\n const filteredDeps = dependencies.filter(\n (dep) => !appDependencies.has(dep)\n )\n\n // The manifest can omit the page if it has no requirements\n if (filteredDeps.length) {\n clientManifest[page] = filteredDeps\n }\n })\n // provide the sorted pages as an array so we don't rely on the object's keys\n // being in order and we don't slow down look-up time for page assets\n clientManifest.sortedPages = sortedPageKeys\n\n return devalue(clientManifest)\n })\n}\n\nexport function getEntrypointFiles(entrypoint: any): string[] {\n return (\n entrypoint\n ?.getFiles()\n .filter((file: string) => {\n // We don't want to include `.hot-update.js` files into the initial page\n return /(?<!\\.hot-update)\\.(js|css)($|\\?)/.test(file)\n })\n .map((file: string) => file.replace(/\\\\/g, '/')) ?? []\n )\n}\n\nexport const processRoute = (r: Rewrite) => {\n const rewrite = { ...r }\n\n // omit external rewrite destinations since these aren't\n // handled client-side\n if (!rewrite?.destination?.startsWith('/')) {\n delete (rewrite as any).destination\n }\n return rewrite\n}\n\n// This plugin creates a build-manifest.json for all assets that are being output\n// It has a mapping of \"entry\" filename to real filename. Because the real filename can be hashed in production\nexport default class BuildManifestPlugin {\n private buildId: string\n private rewrites: CustomRoutes['rewrites']\n private isDevFallback: boolean\n private appDirEnabled: boolean\n private clientRouterFilters?: Parameters<typeof generateClientManifest>[2]\n\n constructor(options: {\n buildId: string\n rewrites: CustomRoutes['rewrites']\n isDevFallback?: boolean\n appDirEnabled: boolean\n clientRouterFilters?: Parameters<typeof generateClientManifest>[2]\n }) {\n this.buildId = options.buildId\n this.isDevFallback = !!options.isDevFallback\n this.rewrites = {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n }\n this.appDirEnabled = options.appDirEnabled\n this.clientRouterFilters = options.clientRouterFilters\n this.rewrites.beforeFiles = options.rewrites.beforeFiles.map(processRoute)\n this.rewrites.afterFiles = options.rewrites.afterFiles.map(processRoute)\n this.rewrites.fallback = options.rewrites.fallback.map(processRoute)\n }\n\n createAssets(compiler: any, compilation: any) {\n const compilationSpan =\n getCompilationSpan(compilation) ?? getCompilationSpan(compiler)\n if (!compilationSpan) {\n throw new Error('No span found for compilation')\n }\n\n const createAssetsSpan = compilationSpan.traceChild(\n 'NextJsBuildManifest-createassets'\n )\n\n return createAssetsSpan.traceFn(() => {\n const entrypoints: Map<string, any> = compilation.entrypoints\n const assetMap: DeepMutable<BuildManifest> = {\n polyfillFiles: [],\n devFiles: [],\n ampDevFiles: [],\n lowPriorityFiles: [],\n rootMainFiles: [],\n rootMainFilesTree: {},\n pages: { '/_app': [] },\n ampFirstPages: [],\n }\n\n const ampFirstEntryNames = ampFirstEntryNamesMap.get(compilation)\n if (ampFirstEntryNames) {\n for (const entryName of ampFirstEntryNames) {\n const pagePath = getRouteFromEntrypoint(entryName)\n if (!pagePath) {\n continue\n }\n\n assetMap.ampFirstPages.push(pagePath)\n }\n }\n\n const mainFiles = new Set(\n getEntrypointFiles(entrypoints.get(CLIENT_STATIC_FILES_RUNTIME_MAIN))\n )\n\n if (this.appDirEnabled) {\n assetMap.rootMainFiles = [\n ...new Set(\n getEntrypointFiles(\n entrypoints.get(CLIENT_STATIC_FILES_RUNTIME_MAIN_APP)\n )\n ),\n ]\n }\n\n const compilationAssets: {\n name: string\n source: typeof sources.RawSource\n info: object\n }[] = compilation.getAssets()\n\n assetMap.polyfillFiles = compilationAssets\n .filter((p) => {\n // Ensure only .js files are passed through\n if (!p.name.endsWith('.js')) {\n return false\n }\n\n return (\n p.info && CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL in p.info\n )\n })\n .map((v) => v.name)\n\n assetMap.devFiles = getEntrypointFiles(\n entrypoints.get(CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH)\n ).filter((file) => !mainFiles.has(file))\n\n assetMap.ampDevFiles = getEntrypointFiles(\n entrypoints.get(CLIENT_STATIC_FILES_RUNTIME_AMP)\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (SYSTEM_ENTRYPOINTS.has(entrypoint.name)) continue\n const pagePath = getRouteFromEntrypoint(entrypoint.name)\n\n if (!pagePath) {\n continue\n }\n\n const filesForPage = getEntrypointFiles(entrypoint)\n\n assetMap.pages[pagePath] = [...new Set([...mainFiles, ...filesForPage])]\n }\n\n if (!this.isDevFallback) {\n // Add the runtime build manifest file (generated later in this file)\n // as a dependency for the app. If the flag is false, the file won't be\n // downloaded by the client.\n const buildManifestPath = buildNodejsLowPriorityPath(\n '_buildManifest.js',\n this.buildId\n )\n const ssgManifestPath = buildNodejsLowPriorityPath(\n '_ssgManifest.js',\n this.buildId\n )\n assetMap.lowPriorityFiles.push(buildManifestPath, ssgManifestPath)\n compilation.emitAsset(\n ssgManifestPath,\n new sources.RawSource(srcEmptySsgManifest)\n )\n }\n\n assetMap.pages = Object.keys(assetMap.pages)\n .sort()\n .reduce(\n // eslint-disable-next-line\n (a, c) => ((a[c] = assetMap.pages[c]), a),\n {} as typeof assetMap.pages\n )\n\n let buildManifestName = BUILD_MANIFEST\n\n if (this.isDevFallback) {\n buildManifestName = `fallback-${BUILD_MANIFEST}`\n }\n\n compilation.emitAsset(\n buildManifestName,\n new sources.RawSource(JSON.stringify(assetMap, null, 2))\n )\n\n compilation.emitAsset(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n new sources.RawSource(`${createEdgeRuntimeManifest(assetMap)}`)\n )\n\n if (!this.isDevFallback) {\n compilation.emitAsset(\n `${CLIENT_STATIC_FILES_PATH}/${this.buildId}/_buildManifest.js`,\n new sources.RawSource(\n `self.__BUILD_MANIFEST = ${generateClientManifest(\n assetMap,\n this.rewrites,\n this.clientRouterFilters,\n compiler,\n compilation\n )};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`\n )\n )\n }\n })\n }\n\n apply(compiler: webpack.Compiler) {\n compiler.hooks.make.tap('NextJsBuildManifest', (compilation: any) => {\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsBuildManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n () => {\n this.createAssets(compiler, compilation)\n }\n )\n })\n return\n }\n}\n"],"names":["devalue","webpack","sources","BUILD_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","CLIENT_STATIC_FILES_PATH","CLIENT_STATIC_FILES_RUNTIME_MAIN","CLIENT_STATIC_FILES_RUNTIME_MAIN_APP","CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL","CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH","CLIENT_STATIC_FILES_RUNTIME_AMP","SYSTEM_ENTRYPOINTS","getRouteFromEntrypoint","ampFirstEntryNamesMap","getSortedRoutes","Span","getCompilationSpan","srcEmptySsgManifest","buildNodejsLowPriorityPath","filename","buildId","createEdgeRuntimeManifest","originAssetMap","manifestFilenames","assetMap","lowPriorityFiles","manifestDefCode","JSON","stringify","lowPriorityFilesCode","map","join","normalizeRewrite","item","has","source","destination","normalizeRewritesForBuildManifest","rewrites","afterFiles","processRoute","beforeFiles","fallback","generateClientManifest","clientRouterFilters","compiler","compilation","compilationSpan","name","genClientManifestSpan","traceChild","traceFn","clientManifest","__rewrites","__routerFilterStatic","staticFilter","__routerFilterDynamic","dynamicFilter","appDependencies","Set","pages","sortedPageKeys","Object","keys","forEach","page","dependencies","filteredDeps","filter","dep","length","sortedPages","getEntrypointFiles","entrypoint","getFiles","file","test","replace","r","rewrite","startsWith","BuildManifestPlugin","constructor","options","isDevFallback","appDirEnabled","createAssets","Error","createAssetsSpan","entrypoints","polyfillFiles","devFiles","ampDevFiles","rootMainFiles","rootMainFilesTree","ampFirstPages","ampFirstEntryNames","get","entryName","pagePath","push","mainFiles","compilationAssets","getAssets","p","endsWith","info","v","values","filesForPage","buildManifestPath","ssgManifestPath","emitAsset","RawSource","sort","reduce","a","c","buildManifestName","apply","hooks","make","tap","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS"],"mappings":"AAEA,OAAOA,aAAa,6BAA4B;AAChD,SAASC,OAAO,EAAEC,OAAO,QAAQ,qCAAoC;AACrE,SACEC,cAAc,EACdC,yBAAyB,EACzBC,wBAAwB,EACxBC,gCAAgC,EAChCC,oCAAoC,EACpCC,4CAA4C,EAC5CC,yCAAyC,EACzCC,+BAA+B,EAC/BC,kBAAkB,QACb,gCAA+B;AAEtC,OAAOC,4BAA4B,4CAA2C;AAC9E,SAASC,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,IAAI,QAAQ,iBAAgB;AACrC,SAASC,kBAAkB,QAAQ,WAAU;AAQ7C,sEAAsE;AACtE,kEAAkE;AAClE,cAAc;AACd,OAAO,MAAMC,sBAAsB,CAAC,4EAA4E,CAAC,CAAA;AAEjH,+CAA+C;AAC/C,S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AAC,IAAI,CAAC4D,aAAa,EAAE;gBACvBtC,YAAYkE,SAAS,CACnB,GAAG3G,yBAAyB,CAAC,EAAE,IAAI,CAACe,OAAO,CAAC,kBAAkB,CAAC,EAC/D,IAAIlB,QAAQ+G,SAAS,CACnB,CAAC,wBAAwB,EAAEtE,uBACzBnB,UACA,IAAI,CAACc,QAAQ,EACb,IAAI,CAACM,mBAAmB,EACxBC,UACAC,aACA,uDAAuD,CAAC;YAGhE;QACF;IACF;IAEAyE,MAAM1E,QAA0B,EAAE;QAChCA,SAAS2E,KAAK,CAACC,IAAI,CAACC,GAAG,CAAC,uBAAuB,CAAC5E;YAC9CA,YAAY0E,KAAK,CAACG,aAAa,CAACD,GAAG,CACjC;gBACE1E,MAAM;gBACN4E,OAAO3H,QAAQ4H,WAAW,CAACC,8BAA8B;YAC3D,GACA;gBACE,IAAI,CAACxC,YAAY,CAACzC,UAAUC;YAC9B;QAEJ;QACA;IACF;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../src/build/webpack/plugins/build-manifest-plugin.ts"],"sourcesContent":["import type { BloomFilter } from '../../../shared/lib/bloom-filter'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport devalue from 'next/dist/compiled/devalue'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport {\n BUILD_MANIFEST,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_STATIC_FILES_PATH,\n CLIENT_STATIC_FILES_RUNTIME_MAIN,\n CLIENT_STATIC_FILES_RUNTIME_MAIN_APP,\n CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL,\n CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH,\n CLIENT_STATIC_FILES_RUNTIME_AMP,\n SYSTEM_ENTRYPOINTS,\n} from '../../../shared/lib/constants'\nimport type { BuildManifest } from '../../../server/get-page-files'\nimport getRouteFromEntrypoint from '../../../server/get-route-from-entrypoint'\nimport { ampFirstEntryNamesMap } from './next-drop-client-page-plugin'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { Span } from '../../../trace'\nimport { getCompilationSpan } from '../utils'\nimport {\n createEdgeRuntimeManifest,\n normalizeRewritesForBuildManifest,\n processRoute,\n srcEmptySsgManifest,\n type ClientBuildManifest,\n} from './build-manifest-plugin-utils'\n\ntype DeepMutable<T> = { -readonly [P in keyof T]: DeepMutable<T[P]> }\n\n// nodejs: '/static/<build id>/low-priority.js'\nfunction buildNodejsLowPriorityPath(filename: string, buildId: string) {\n return `${CLIENT_STATIC_FILES_PATH}/${buildId}/${filename}`\n}\n\n// This function takes the asset map generated in BuildManifestPlugin and creates a\n// reduced version to send to the client.\nexport function generateClientManifest(\n assetMap: BuildManifest,\n rewrites: CustomRoutes['rewrites'],\n clientRouterFilters?: {\n staticFilter: ReturnType<BloomFilter['export']>\n dynamicFilter: ReturnType<BloomFilter['export']>\n },\n compiler?: any,\n compilation?: any\n): string | undefined {\n const compilationSpan = compilation\n ? getCompilationSpan(compilation)\n : compiler\n ? getCompilationSpan(compiler)\n : new Span({ name: 'client-manifest' })\n\n const genClientManifestSpan = compilationSpan?.traceChild(\n 'NextJsBuildManifest-generateClientManifest'\n )\n\n return genClientManifestSpan?.traceFn(() => {\n const clientManifest: ClientBuildManifest = {\n __rewrites: normalizeRewritesForBuildManifest(rewrites) as any,\n __routerFilterStatic: clientRouterFilters?.staticFilter as any,\n __routerFilterDynamic: clientRouterFilters?.dynamicFilter as any,\n }\n const appDependencies = new Set(assetMap.pages['/_app'])\n const sortedPageKeys = getSortedRoutes(Object.keys(assetMap.pages))\n\n sortedPageKeys.forEach((page) => {\n const dependencies = assetMap.pages[page]\n\n if (page === '/_app') return\n // Filter out dependencies in the _app entry, because those will have already\n // been loaded by the client prior to a navigation event\n const filteredDeps = dependencies.filter(\n (dep) => !appDependencies.has(dep)\n )\n\n // The manifest can omit the page if it has no requirements\n if (filteredDeps.length) {\n clientManifest[page] = filteredDeps\n }\n })\n // provide the sorted pages as an array so we don't rely on the object's keys\n // being in order and we don't slow down look-up time for page assets\n clientManifest.sortedPages = sortedPageKeys\n\n return devalue(clientManifest)\n })\n}\n\nexport function getEntrypointFiles(entrypoint: any): string[] {\n return (\n entrypoint\n ?.getFiles()\n .filter((file: string) => {\n // We don't want to include `.hot-update.js` files into the initial page\n return /(?<!\\.hot-update)\\.(js|css)($|\\?)/.test(file)\n })\n .map((file: string) => file.replace(/\\\\/g, '/')) ?? []\n )\n}\n\n// This plugin creates a build-manifest.json for all assets that are being output\n// It has a mapping of \"entry\" filename to real filename. Because the real filename can be hashed in production\nexport default class BuildManifestPlugin {\n private buildId: string\n private rewrites: CustomRoutes['rewrites']\n private isDevFallback: boolean\n private appDirEnabled: boolean\n private clientRouterFilters?: Parameters<typeof generateClientManifest>[2]\n\n constructor(options: {\n buildId: string\n rewrites: CustomRoutes['rewrites']\n isDevFallback?: boolean\n appDirEnabled: boolean\n clientRouterFilters?: Parameters<typeof generateClientManifest>[2]\n }) {\n this.buildId = options.buildId\n this.isDevFallback = !!options.isDevFallback\n this.rewrites = {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n }\n this.appDirEnabled = options.appDirEnabled\n this.clientRouterFilters = options.clientRouterFilters\n this.rewrites.beforeFiles = options.rewrites.beforeFiles.map(processRoute)\n this.rewrites.afterFiles = options.rewrites.afterFiles.map(processRoute)\n this.rewrites.fallback = options.rewrites.fallback.map(processRoute)\n }\n\n createAssets(compiler: any, compilation: any) {\n const compilationSpan =\n getCompilationSpan(compilation) ?? getCompilationSpan(compiler)\n if (!compilationSpan) {\n throw new Error('No span found for compilation')\n }\n\n const createAssetsSpan = compilationSpan.traceChild(\n 'NextJsBuildManifest-createassets'\n )\n\n return createAssetsSpan.traceFn(() => {\n const entrypoints: Map<string, any> = compilation.entrypoints\n const assetMap: DeepMutable<BuildManifest> = {\n polyfillFiles: [],\n devFiles: [],\n ampDevFiles: [],\n lowPriorityFiles: [],\n rootMainFiles: [],\n rootMainFilesTree: {},\n pages: { '/_app': [] },\n ampFirstPages: [],\n }\n\n const ampFirstEntryNames = ampFirstEntryNamesMap.get(compilation)\n if (ampFirstEntryNames) {\n for (const entryName of ampFirstEntryNames) {\n const pagePath = getRouteFromEntrypoint(entryName)\n if (!pagePath) {\n continue\n }\n\n assetMap.ampFirstPages.push(pagePath)\n }\n }\n\n const mainFiles = new Set(\n getEntrypointFiles(entrypoints.get(CLIENT_STATIC_FILES_RUNTIME_MAIN))\n )\n\n if (this.appDirEnabled) {\n assetMap.rootMainFiles = [\n ...new Set(\n getEntrypointFiles(\n entrypoints.get(CLIENT_STATIC_FILES_RUNTIME_MAIN_APP)\n )\n ),\n ]\n }\n\n const compilationAssets: {\n name: string\n source: typeof sources.RawSource\n info: object\n }[] = compilation.getAssets()\n\n assetMap.polyfillFiles = compilationAssets\n .filter((p) => {\n // Ensure only .js files are passed through\n if (!p.name.endsWith('.js')) {\n return false\n }\n\n return (\n p.info && CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL in p.info\n )\n })\n .map((v) => v.name)\n\n assetMap.devFiles = getEntrypointFiles(\n entrypoints.get(CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH)\n ).filter((file) => !mainFiles.has(file))\n\n assetMap.ampDevFiles = getEntrypointFiles(\n entrypoints.get(CLIENT_STATIC_FILES_RUNTIME_AMP)\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (SYSTEM_ENTRYPOINTS.has(entrypoint.name)) continue\n const pagePath = getRouteFromEntrypoint(entrypoint.name)\n\n if (!pagePath) {\n continue\n }\n\n const filesForPage = getEntrypointFiles(entrypoint)\n\n assetMap.pages[pagePath] = [...new Set([...mainFiles, ...filesForPage])]\n }\n\n if (!this.isDevFallback) {\n // Add the runtime build manifest file (generated later in this file)\n // as a dependency for the app. If the flag is false, the file won't be\n // downloaded by the client.\n const buildManifestPath = buildNodejsLowPriorityPath(\n '_buildManifest.js',\n this.buildId\n )\n const ssgManifestPath = buildNodejsLowPriorityPath(\n '_ssgManifest.js',\n this.buildId\n )\n assetMap.lowPriorityFiles.push(buildManifestPath, ssgManifestPath)\n compilation.emitAsset(\n ssgManifestPath,\n new sources.RawSource(srcEmptySsgManifest)\n )\n }\n\n assetMap.pages = Object.keys(assetMap.pages)\n .sort()\n .reduce(\n // eslint-disable-next-line\n (a, c) => ((a[c] = assetMap.pages[c]), a),\n {} as typeof assetMap.pages\n )\n\n let buildManifestName = BUILD_MANIFEST\n\n if (this.isDevFallback) {\n buildManifestName = `fallback-${BUILD_MANIFEST}`\n }\n\n compilation.emitAsset(\n buildManifestName,\n new sources.RawSource(JSON.stringify(assetMap, null, 2))\n )\n\n compilation.emitAsset(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n new sources.RawSource(`${createEdgeRuntimeManifest(assetMap)}`)\n )\n\n if (!this.isDevFallback) {\n compilation.emitAsset(\n `${CLIENT_STATIC_FILES_PATH}/${this.buildId}/_buildManifest.js`,\n new sources.RawSource(\n `self.__BUILD_MANIFEST = ${generateClientManifest(\n assetMap,\n this.rewrites,\n this.clientRouterFilters,\n compiler,\n compilation\n )};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`\n )\n )\n }\n })\n }\n\n apply(compiler: webpack.Compiler) {\n compiler.hooks.make.tap('NextJsBuildManifest', (compilation: any) => {\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsBuildManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n () => {\n this.createAssets(compiler, compilation)\n }\n )\n })\n return\n }\n}\n"],"names":["devalue","webpack","sources","BUILD_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","CLIENT_STATIC_FILES_PATH","CLIENT_STATIC_FILES_RUNTIME_MAIN","CLIENT_STATIC_FILES_RUNTIME_MAIN_APP","CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL","CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH","CLIENT_STATIC_FILES_RUNTIME_AMP","SYSTEM_ENTRYPOINTS","getRouteFromEntrypoint","ampFirstEntryNamesMap","getSortedRoutes","Span","getCompilationSpan","createEdgeRuntimeManifest","normalizeRewritesForBuildManifest","processRoute","srcEmptySsgManifest","buildNodejsLowPriorityPath","filename","buildId","generateClientManifest","assetMap","rewrites","clientRouterFilters","compiler","compilation","compilationSpan","name","genClientManifestSpan","traceChild","traceFn","clientManifest","__rewrites","__routerFilterStatic","staticFilter","__routerFilterDynamic","dynamicFilter","appDependencies","Set","pages","sortedPageKeys","Object","keys","forEach","page","dependencies","filteredDeps","filter","dep","has","length","sortedPages","getEntrypointFiles","entrypoint","getFiles","file","test","map","replace","BuildManifestPlugin","constructor","options","isDevFallback","beforeFiles","afterFiles","fallback","appDirEnabled","createAssets","Error","createAssetsSpan","entrypoints","polyfillFiles","devFiles","ampDevFiles","lowPriorityFiles","rootMainFiles","rootMainFilesTree","ampFirstPages","ampFirstEntryNames","get","entryName","pagePath","push","mainFiles","compilationAssets","getAssets","p","endsWith","info","v","values","filesForPage","buildManifestPath","ssgManifestPath","emitAsset","RawSource","sort","reduce","a","c","buildManifestName","JSON","stringify","apply","hooks","make","tap","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS"],"mappings":"AAEA,OAAOA,aAAa,6BAA4B;AAChD,SAASC,OAAO,EAAEC,OAAO,QAAQ,qCAAoC;AACrE,SACEC,cAAc,EACdC,yBAAyB,EACzBC,wBAAwB,EACxBC,gCAAgC,EAChCC,oCAAoC,EACpCC,4CAA4C,EAC5CC,yCAAyC,EACzCC,+BAA+B,EAC/BC,kBAAkB,QACb,gCAA+B;AAEtC,OAAOC,4BAA4B,4CAA2C;AAC9E,SAASC,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,IAAI,QAAQ,iBAAgB;AACrC,SAASC,kBAAkB,QAAQ,WAAU;AAC7C,SACEC,yBAAyB,EACzBC,iCAAiC,EACjCC,YAAY,EACZC,mBAAmB,QAEd,g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/D,IAAIrB,QAAQiG,SAAS,CACnB,CAAC,wBAAwB,EAAE3E,uBACzBC,UACA,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,mBAAmB,EACxBC,UACAC,aACA,uDAAuD,CAAC;YAGhE;QACF;IACF;IAEA8E,MAAM/E,QAA0B,EAAE;QAChCA,SAASgF,KAAK,CAACC,IAAI,CAACC,GAAG,CAAC,uBAAuB,CAACjF;YAC9CA,YAAY+E,KAAK,CAACG,aAAa,CAACD,GAAG,CACjC;gBACE/E,MAAM;gBACNiF,OAAO/G,QAAQgH,WAAW,CAACC,8BAA8B;YAC3D,GACA;gBACE,IAAI,CAAC3C,YAAY,CAAC3C,UAAUC;YAC9B;QAEJ;QACA;IACF;AACF","ignoreList":[0]}
@@ -1603,7 +1603,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1603
1603
  isClient && new CopyFilePlugin({
1604
1604
  // file path to build output of `@next/polyfill-nomodule`
1605
1605
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1606
- cacheKey: "15.6.0-canary.22",
1606
+ cacheKey: "15.6.0-canary.23",
1607
1607
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1608
1608
  minimize: false,
1609
1609
  info: {
@@ -1786,7 +1786,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1786
1786
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1787
1787
  // - Next.js version
1788
1788
  // - next.config.js keys that affect compilation
1789
- version: `${__dirname}|${"15.6.0-canary.22"}|${configVars}`,
1789
+ version: `${__dirname}|${"15.6.0-canary.23"}|${configVars}`,
1790
1790
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1791
1791
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1792
1792
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -5,7 +5,7 @@
5
5
  * - next/script with `beforeInteractive` strategy
6
6
  */ import { getAssetPrefix } from './asset-prefix';
7
7
  import { setAttributesFromProps } from './set-attributes-from-props';
8
- const version = "15.6.0-canary.22";
8
+ const version = "15.6.0-canary.23";
9
9
  window.next = {
10
10
  version,
11
11
  appDir: true
@@ -25,7 +25,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
25
25
  import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
26
26
  import tracer from './tracing/tracer';
27
27
  import { isNextRouterError } from './components/is-next-router-error';
28
- export const version = "15.6.0-canary.22";
28
+ export const version = "15.6.0-canary.23";
29
29
  export let router;
30
30
  export const emitter = mitt();
31
31
  const looseToArray = (input)=>[].slice.call(input);
@@ -1,11 +1,9 @@
1
1
  let installed = false;
2
2
  export function loadWebpackHook() {
3
- const { init: initWebpack } = require('next/dist/compiled/webpack/webpack');
4
3
  if (installed) {
5
4
  return;
6
5
  }
7
6
  installed = true;
8
- initWebpack();
9
7
  require('../server/require-hook').addHookAliases([
10
8
  [
11
9
  'webpack',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/server/config-utils.ts"],"sourcesContent":["let installed: boolean = false\n\nexport function loadWebpackHook() {\n const { init: initWebpack } =\n require('next/dist/compiled/webpack/webpack') as typeof import('next/dist/compiled/webpack/webpack')\n if (installed) {\n return\n }\n installed = true\n initWebpack()\n\n // hook the Node.js require so that webpack requires are\n // routed to the bundled and now initialized webpack version\n ;(\n require('../server/require-hook') as typeof import('../server/require-hook')\n ).addHookAliases(\n [\n ['webpack', 'next/dist/compiled/webpack/webpack-lib'],\n ['webpack/package', 'next/dist/compiled/webpack/package'],\n ['webpack/package.json', 'next/dist/compiled/webpack/package'],\n ['webpack/lib/webpack', 'next/dist/compiled/webpack/webpack-lib'],\n ['webpack/lib/webpack.js', 'next/dist/compiled/webpack/webpack-lib'],\n [\n 'webpack/lib/node/NodeEnvironmentPlugin',\n 'next/dist/compiled/webpack/NodeEnvironmentPlugin',\n ],\n [\n 'webpack/lib/node/NodeEnvironmentPlugin.js',\n 'next/dist/compiled/webpack/NodeEnvironmentPlugin',\n ],\n [\n 'webpack/lib/BasicEvaluatedExpression',\n 'next/dist/compiled/webpack/BasicEvaluatedExpression',\n ],\n [\n 'webpack/lib/BasicEvaluatedExpression.js',\n 'next/dist/compiled/webpack/BasicEvaluatedExpression',\n ],\n [\n 'webpack/lib/node/NodeTargetPlugin',\n 'next/dist/compiled/webpack/NodeTargetPlugin',\n ],\n [\n 'webpack/lib/node/NodeTargetPlugin.js',\n 'next/dist/compiled/webpack/NodeTargetPlugin',\n ],\n [\n 'webpack/lib/node/NodeTemplatePlugin',\n 'next/dist/compiled/webpack/NodeTemplatePlugin',\n ],\n [\n 'webpack/lib/node/NodeTemplatePlugin.js',\n 'next/dist/compiled/webpack/NodeTemplatePlugin',\n ],\n [\n 'webpack/lib/LibraryTemplatePlugin',\n 'next/dist/compiled/webpack/LibraryTemplatePlugin',\n ],\n [\n 'webpack/lib/LibraryTemplatePlugin.js',\n 'next/dist/compiled/webpack/LibraryTemplatePlugin',\n ],\n [\n 'webpack/lib/SingleEntryPlugin',\n 'next/dist/compiled/webpack/SingleEntryPlugin',\n ],\n [\n 'webpack/lib/SingleEntryPlugin.js',\n 'next/dist/compiled/webpack/SingleEntryPlugin',\n ],\n [\n 'webpack/lib/optimize/LimitChunkCountPlugin',\n 'next/dist/compiled/webpack/LimitChunkCountPlugin',\n ],\n [\n 'webpack/lib/optimize/LimitChunkCountPlugin.js',\n 'next/dist/compiled/webpack/LimitChunkCountPlugin',\n ],\n [\n 'webpack/lib/webworker/WebWorkerTemplatePlugin',\n 'next/dist/compiled/webpack/WebWorkerTemplatePlugin',\n ],\n [\n 'webpack/lib/webworker/WebWorkerTemplatePlugin.js',\n 'next/dist/compiled/webpack/WebWorkerTemplatePlugin',\n ],\n [\n 'webpack/lib/ExternalsPlugin',\n 'next/dist/compiled/webpack/ExternalsPlugin',\n ],\n [\n 'webpack/lib/ExternalsPlugin.js',\n 'next/dist/compiled/webpack/ExternalsPlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileWasmTemplatePlugin',\n 'next/dist/compiled/webpack/FetchCompileWasmTemplatePlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileWasmTemplatePlugin.js',\n 'next/dist/compiled/webpack/FetchCompileWasmTemplatePlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileWasmPlugin',\n 'next/dist/compiled/webpack/FetchCompileWasmPlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileWasmPlugin.js',\n 'next/dist/compiled/webpack/FetchCompileWasmPlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileAsyncWasmPlugin',\n 'next/dist/compiled/webpack/FetchCompileAsyncWasmPlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileAsyncWasmPlugin.js',\n 'next/dist/compiled/webpack/FetchCompileAsyncWasmPlugin',\n ],\n [\n 'webpack/lib/ModuleFilenameHelpers',\n 'next/dist/compiled/webpack/ModuleFilenameHelpers',\n ],\n [\n 'webpack/lib/ModuleFilenameHelpers.js',\n 'next/dist/compiled/webpack/ModuleFilenameHelpers',\n ],\n ['webpack/lib/GraphHelpers', 'next/dist/compiled/webpack/GraphHelpers'],\n [\n 'webpack/lib/GraphHelpers.js',\n 'next/dist/compiled/webpack/GraphHelpers',\n ],\n ['webpack/lib/NormalModule', 'next/dist/compiled/webpack/NormalModule'],\n ['webpack-sources', 'next/dist/compiled/webpack/sources'],\n ['webpack-sources/lib', 'next/dist/compiled/webpack/sources'],\n ['webpack-sources/lib/index', 'next/dist/compiled/webpack/sources'],\n ['webpack-sources/lib/index.js', 'next/dist/compiled/webpack/sources'],\n ['@babel/runtime', 'next/dist/compiled/@babel/runtime/package.json'],\n [\n '@babel/runtime/package.json',\n 'next/dist/compiled/@babel/runtime/package.json',\n ],\n ].map(\n // Use dynamic require.resolve to avoid statically analyzable since they're only for build time\n ([request, replacement]) => [request, require.resolve(replacement)]\n )\n )\n}\n"],"names":["installed","loadWebpackHook","init","initWebpack","require","addHookAliases","map","request","replacement","resolve"],"mappings":"AAAA,IAAIA,YAAqB;AAEzB,OAAO,SAASC;IACd,MAAM,EAAEC,MAAMC,WAAW,EAAE,GACzBC,QAAQ;IACV,IAAIJ,WAAW;QACb;IACF;IACAA,YAAY;IACZG;IAKEC,QAAQ,0BACRC,cAAc,CACd;QACE;YAAC;YAAW;SAAyC;QACrD;YAAC;YAAmB;SAAqC;QACzD;YAAC;YAAwB;SAAqC;QAC9D;YAAC;YAAuB;SAAyC;QACjE;YAAC;YAA0B;SAAyC;QACpE;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YAAC;YAA4B;SAA0C;QACvE;YACE;YACA;SACD;QACD;YAAC;YAA4B;SAA0C;QACvE;YAAC;YAAmB;SAAqC;QACzD;YAAC;YAAuB;SAAqC;QAC7D;YAAC;YAA6B;SAAqC;QACnE;YAAC;YAAgC;SAAqC;QACtE;YAAC;YAAkB;SAAiD;QACpE;YACE;YACA;SACD;KACF,CAACC,GAAG,CACH,+FAA+F;IAC/F,CAAC,CAACC,SAASC,YAAY,GAAK;YAACD;YAASH,QAAQK,OAAO,CAACD;SAAa;AAGzE","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/server/config-utils.ts"],"sourcesContent":["let installed: boolean = false\n\nexport function loadWebpackHook() {\n if (installed) {\n return\n }\n installed = true\n\n // hook the Node.js require so that webpack requires are\n // routed to the bundled and now initialized webpack version\n ;(\n require('../server/require-hook') as typeof import('../server/require-hook')\n ).addHookAliases(\n [\n ['webpack', 'next/dist/compiled/webpack/webpack-lib'],\n ['webpack/package', 'next/dist/compiled/webpack/package'],\n ['webpack/package.json', 'next/dist/compiled/webpack/package'],\n ['webpack/lib/webpack', 'next/dist/compiled/webpack/webpack-lib'],\n ['webpack/lib/webpack.js', 'next/dist/compiled/webpack/webpack-lib'],\n [\n 'webpack/lib/node/NodeEnvironmentPlugin',\n 'next/dist/compiled/webpack/NodeEnvironmentPlugin',\n ],\n [\n 'webpack/lib/node/NodeEnvironmentPlugin.js',\n 'next/dist/compiled/webpack/NodeEnvironmentPlugin',\n ],\n [\n 'webpack/lib/BasicEvaluatedExpression',\n 'next/dist/compiled/webpack/BasicEvaluatedExpression',\n ],\n [\n 'webpack/lib/BasicEvaluatedExpression.js',\n 'next/dist/compiled/webpack/BasicEvaluatedExpression',\n ],\n [\n 'webpack/lib/node/NodeTargetPlugin',\n 'next/dist/compiled/webpack/NodeTargetPlugin',\n ],\n [\n 'webpack/lib/node/NodeTargetPlugin.js',\n 'next/dist/compiled/webpack/NodeTargetPlugin',\n ],\n [\n 'webpack/lib/node/NodeTemplatePlugin',\n 'next/dist/compiled/webpack/NodeTemplatePlugin',\n ],\n [\n 'webpack/lib/node/NodeTemplatePlugin.js',\n 'next/dist/compiled/webpack/NodeTemplatePlugin',\n ],\n [\n 'webpack/lib/LibraryTemplatePlugin',\n 'next/dist/compiled/webpack/LibraryTemplatePlugin',\n ],\n [\n 'webpack/lib/LibraryTemplatePlugin.js',\n 'next/dist/compiled/webpack/LibraryTemplatePlugin',\n ],\n [\n 'webpack/lib/SingleEntryPlugin',\n 'next/dist/compiled/webpack/SingleEntryPlugin',\n ],\n [\n 'webpack/lib/SingleEntryPlugin.js',\n 'next/dist/compiled/webpack/SingleEntryPlugin',\n ],\n [\n 'webpack/lib/optimize/LimitChunkCountPlugin',\n 'next/dist/compiled/webpack/LimitChunkCountPlugin',\n ],\n [\n 'webpack/lib/optimize/LimitChunkCountPlugin.js',\n 'next/dist/compiled/webpack/LimitChunkCountPlugin',\n ],\n [\n 'webpack/lib/webworker/WebWorkerTemplatePlugin',\n 'next/dist/compiled/webpack/WebWorkerTemplatePlugin',\n ],\n [\n 'webpack/lib/webworker/WebWorkerTemplatePlugin.js',\n 'next/dist/compiled/webpack/WebWorkerTemplatePlugin',\n ],\n [\n 'webpack/lib/ExternalsPlugin',\n 'next/dist/compiled/webpack/ExternalsPlugin',\n ],\n [\n 'webpack/lib/ExternalsPlugin.js',\n 'next/dist/compiled/webpack/ExternalsPlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileWasmTemplatePlugin',\n 'next/dist/compiled/webpack/FetchCompileWasmTemplatePlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileWasmTemplatePlugin.js',\n 'next/dist/compiled/webpack/FetchCompileWasmTemplatePlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileWasmPlugin',\n 'next/dist/compiled/webpack/FetchCompileWasmPlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileWasmPlugin.js',\n 'next/dist/compiled/webpack/FetchCompileWasmPlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileAsyncWasmPlugin',\n 'next/dist/compiled/webpack/FetchCompileAsyncWasmPlugin',\n ],\n [\n 'webpack/lib/web/FetchCompileAsyncWasmPlugin.js',\n 'next/dist/compiled/webpack/FetchCompileAsyncWasmPlugin',\n ],\n [\n 'webpack/lib/ModuleFilenameHelpers',\n 'next/dist/compiled/webpack/ModuleFilenameHelpers',\n ],\n [\n 'webpack/lib/ModuleFilenameHelpers.js',\n 'next/dist/compiled/webpack/ModuleFilenameHelpers',\n ],\n ['webpack/lib/GraphHelpers', 'next/dist/compiled/webpack/GraphHelpers'],\n [\n 'webpack/lib/GraphHelpers.js',\n 'next/dist/compiled/webpack/GraphHelpers',\n ],\n ['webpack/lib/NormalModule', 'next/dist/compiled/webpack/NormalModule'],\n ['webpack-sources', 'next/dist/compiled/webpack/sources'],\n ['webpack-sources/lib', 'next/dist/compiled/webpack/sources'],\n ['webpack-sources/lib/index', 'next/dist/compiled/webpack/sources'],\n ['webpack-sources/lib/index.js', 'next/dist/compiled/webpack/sources'],\n ['@babel/runtime', 'next/dist/compiled/@babel/runtime/package.json'],\n [\n '@babel/runtime/package.json',\n 'next/dist/compiled/@babel/runtime/package.json',\n ],\n ].map(\n // Use dynamic require.resolve to avoid statically analyzable since they're only for build time\n ([request, replacement]) => [request, require.resolve(replacement)]\n )\n )\n}\n"],"names":["installed","loadWebpackHook","require","addHookAliases","map","request","replacement","resolve"],"mappings":"AAAA,IAAIA,YAAqB;AAEzB,OAAO,SAASC;IACd,IAAID,WAAW;QACb;IACF;IACAA,YAAY;IAKVE,QAAQ,0BACRC,cAAc,CACd;QACE;YAAC;YAAW;SAAyC;QACrD;YAAC;YAAmB;SAAqC;QACzD;YAAC;YAAwB;SAAqC;QAC9D;YAAC;YAAuB;SAAyC;QACjE;YAAC;YAA0B;SAAyC;QACpE;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YACE;YACA;SACD;QACD;YAAC;YAA4B;SAA0C;QACvE;YACE;YACA;SACD;QACD;YAAC;YAA4B;SAA0C;QACvE;YAAC;YAAmB;SAAqC;QACzD;YAAC;YAAuB;SAAqC;QAC7D;YAAC;YAA6B;SAAqC;QACnE;YAAC;YAAgC;SAAqC;QACtE;YAAC;YAAkB;SAAiD;QACpE;YACE;YACA;SACD;KACF,CAACC,GAAG,CACH,+FAA+F;IAC/F,CAAC,CAACC,SAASC,YAAY,GAAK;YAACD;YAASH,QAAQK,OAAO,CAACD;SAAa;AAGzE","ignoreList":[0]}
@@ -90,7 +90,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
90
90
  }
91
91
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
92
92
  const hotReloaderSpan = trace('hot-reloader', undefined, {
93
- version: "15.6.0-canary.22"
93
+ version: "15.6.0-canary.23"
94
94
  });
95
95
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
96
96
  // of the current `next dev` invocation.
@@ -158,7 +158,7 @@ export default class HotReloaderWebpack {
158
158
  this.previewProps = previewProps;
159
159
  this.rewrites = rewrites;
160
160
  this.hotReloaderSpan = trace('hot-reloader', undefined, {
161
- version: "15.6.0-canary.22"
161
+ version: "15.6.0-canary.23"
162
162
  });
163
163
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
164
164
  // of the current `next dev` invocation.
@@ -14,7 +14,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
14
14
  bundlerSuffix = ' (webpack)';
15
15
  }
16
16
  }
17
- Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-canary.22"}`))}${bundlerSuffix}`);
17
+ Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-canary.23"}`))}${bundlerSuffix}`);
18
18
  if (appUrl) {
19
19
  Log.bootstrap(`- Local: ${appUrl}`);
20
20
  }
@@ -31,7 +31,6 @@ import { PAGE_TYPES } from '../../../lib/page-types';
31
31
  import { generateEncryptionKeyBase64 } from '../../app-render/encryption-utils-server';
32
32
  import { isMetadataRouteFile, isStaticMetadataFile } from '../../../lib/metadata/is-metadata-route';
33
33
  import { normalizeMetadataPageToRoute } from '../../../lib/metadata/get-metadata-route';
34
- import { createEnvDefinitions } from '../experimental/create-env-definitions';
35
34
  import { JsConfigPathsPlugin } from '../../../build/webpack/plugins/jsconfig-paths-plugin';
36
35
  import { store as consoleStore } from '../../../build/output/store';
37
36
  import { isPersistentCachingEnabled, ModuleBuildError } from '../../../shared/lib/turbopack/utils';
@@ -708,6 +707,7 @@ async function startWatcher(opts) {
708
707
  const loadEnvConfig = require('@next/env').loadEnvConfig;
709
708
  const { loadedEnvFiles } = loadEnvConfig(dir, process.env.NODE_ENV === 'development', // Silent as it's the second time `loadEnvConfig` is called in this pass.
710
709
  undefined, true);
710
+ const createEnvDefinitions = require('../experimental/create-env-definitions').createEnvDefinitions;
711
711
  await createEnvDefinitions({
712
712
  distDir,
713
713
  loadedEnvFiles: [