next 15.3.0-canary.25 → 15.3.0-canary.26
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.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack/plugins/build-manifest-plugin.d.ts +1 -0
- package/dist/build/webpack/plugins/build-manifest-plugin.js +4 -0
- package/dist/build/webpack/plugins/build-manifest-plugin.js.map +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/app-page-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack/plugins/build-manifest-plugin.js +1 -1
- package/dist/esm/build/webpack/plugins/build-manifest-plugin.js.map +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/esm/shared/lib/turbopack/manifest-loader.js +2 -2
- package/dist/esm/shared/lib/turbopack/manifest-loader.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/shared/lib/turbopack/manifest-loader.js +1 -1
- package/dist/shared/lib/turbopack/manifest-loader.js.map +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- 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.
|
82
|
+
}).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.3.0-canary.26"}`, '-v, --version', 'Outputs the Next.js version.');
|
83
83
|
program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').option('--turbo', 'Starts development mode using Turbopack.').option('--turbopack', 'Starts development mode using Turbopack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
|
84
84
|
'compile',
|
85
85
|
'generate',
|
package/dist/build/index.js
CHANGED
@@ -368,7 +368,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
|
|
368
368
|
const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
|
369
369
|
buildMode: experimentalBuildMode,
|
370
370
|
isTurboBuild: String(turboNextBuild),
|
371
|
-
version: "15.3.0-canary.
|
371
|
+
version: "15.3.0-canary.26"
|
372
372
|
});
|
373
373
|
_buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
|
374
374
|
_buildcontext.NextBuildContext.dir = dir;
|
@@ -749,7 +749,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
|
|
749
749
|
// Files outside of the distDir can be "type": "module"
|
750
750
|
await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
751
751
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
752
|
-
await (0, _builddiagnostics.recordFrameworkVersion)("15.3.0-canary.
|
752
|
+
await (0, _builddiagnostics.recordFrameworkVersion)("15.3.0-canary.26");
|
753
753
|
await (0, _builddiagnostics.updateBuildDiagnostics)({
|
754
754
|
buildStage: 'start'
|
755
755
|
});
|
package/dist/build/swc/index.js
CHANGED
@@ -119,7 +119,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
119
119
|
}
|
120
120
|
return newObj;
|
121
121
|
}
|
122
|
-
const nextVersion = "15.3.0-canary.
|
122
|
+
const nextVersion = "15.3.0-canary.26";
|
123
123
|
const ArchName = (0, _os.arch)();
|
124
124
|
const PlatformName = (0, _os.platform)();
|
125
125
|
function infoLog(...args) {
|
@@ -6,6 +6,7 @@ export type ClientBuildManifest = {
|
|
6
6
|
[key: string]: string[];
|
7
7
|
};
|
8
8
|
export declare const srcEmptySsgManifest = "self.__SSG_MANIFEST=new Set;self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()";
|
9
|
+
export declare function createEdgeRuntimeManifest(originAssetMap: Partial<BuildManifest>): string;
|
9
10
|
export declare function normalizeRewritesForBuildManifest(rewrites: CustomRoutes['rewrites']): CustomRoutes['rewrites'];
|
10
11
|
export declare function generateClientManifest(assetMap: BuildManifest, rewrites: CustomRoutes['rewrites'], clientRouterFilters?: {
|
11
12
|
staticFilter: ReturnType<BloomFilter['export']>;
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
4
4
|
});
|
5
5
|
0 && (module.exports = {
|
6
|
+
createEdgeRuntimeManifest: null,
|
6
7
|
default: null,
|
7
8
|
generateClientManifest: null,
|
8
9
|
getEntrypointFiles: null,
|
@@ -17,6 +18,9 @@ function _export(target, all) {
|
|
17
18
|
});
|
18
19
|
}
|
19
20
|
_export(exports, {
|
21
|
+
createEdgeRuntimeManifest: function() {
|
22
|
+
return createEdgeRuntimeManifest;
|
23
|
+
},
|
20
24
|
// This plugin creates a build-manifest.json for all assets that are being output
|
21
25
|
// It has a mapping of "entry" filename to real filename. Because the real filename can be hashed in production
|
22
26
|
default: function() {
|
@@ -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\nfunction createEdgeRuntimeManifest(originAssetMap: BuildManifest): string {\n const manifestFilenames = ['_buildManifest.js', '_ssgManifest.js']\n\n const assetMap: 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":["BuildManifestPlugin","generateClientManifest","getEntrypointFiles","normalizeRewritesForBuildManifest","processRoute","srcEmptySsgManifest","buildNodejsLowPriorityPath","filename","buildId","CLIENT_STATIC_FILES_PATH","createEdgeRuntimeManifest","originAssetMap","manifestFilenames","assetMap","lowPriorityFiles","manifestDefCode","JSON","stringify","lowPriorityFilesCode","map","join","normalizeRewrite","item","has","source","destination","rewrites","afterFiles","beforeFiles","fallback","clientRouterFilters","compiler","compilation","compilationSpan","getCompilationSpan","Span","name","genClientManifestSpan","traceChild","traceFn","clientManifest","__rewrites","__routerFilterStatic","staticFilter","__routerFilterDynamic","dynamicFilter","appDependencies","Set","pages","sortedPageKeys","getSortedRoutes","Object","keys","forEach","page","dependencies","filteredDeps","filter","dep","length","sortedPages","devalue","entrypoint","getFiles","file","test","replace","r","rewrite","startsWith","constructor","options","isDevFallback","appDirEnabled","createAssets","Error","createAssetsSpan","entrypoints","polyfillFiles","devFiles","ampDevFiles","rootMainFiles","rootMainFilesTree","ampFirstPages","ampFirstEntryNames","ampFirstEntryNamesMap","get","entryName","pagePath","getRouteFromEntrypoint","push","mainFiles","CLIENT_STATIC_FILES_RUNTIME_MAIN","CLIENT_STATIC_FILES_RUNTIME_MAIN_APP","compilationAssets","getAssets","p","endsWith","info","CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL","v","CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH","CLIENT_STATIC_FILES_RUNTIME_AMP","values","SYSTEM_ENTRYPOINTS","filesForPage","buildManifestPath","ssgManifestPath","emitAsset","sources","RawSource","sort","reduce","a","c","buildManifestName","BUILD_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","apply","hooks","make","tap","processAssets","stage","webpack","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS"],"mappings":";;;;;;;;;;;;;;;;;;;IA4KA,iFAAiF;IACjF,+GAA+G;IAC/G,OAgMC;eAhMoBA;;IA7ELC,sBAAsB;eAAtBA;;IAoDAC,kBAAkB;eAAlBA;;IAtEAC,iCAAiC;eAAjCA;;IAkFHC,YAAY;eAAZA;;IAlIAC,mBAAmB;eAAnBA;;;gEA7BO;yBACa;2BAW1B;+EAE4B;0CACG;uBACN;uBACX;wBACc;;;;;;AAW5B,MAAMA,sBAAsB,CAAC,4EAA4E,CAAC;AAEjH,+CAA+C;AAC/C,SAASC,2BAA2BC,QAAgB,EAAEC,OAAe;IACnE,OAAO,GAAGC,mCAAwB,CAAC,CAAC,EAAED,QAAQ,CAAC,EAAED,UAAU;AAC7D;AAEA,SAASG,0BAA0BC,cAA6B;IAC9D,MAAMC,oBAAoB;QAAC;QAAqB;KAAkB;IAElE,MAAMC,WAA0B;QAC9B,GAAGF,cAAc;QACjBG,kBAAkB,EAAE;IACtB;IAEA,wDAAwD;IACxD,4BAA4B;IAC5B,MAAMC,kBAAkB,CAAC,8BAA8B,EAAEC,KAAKC,SAAS,CACrEJ,UACA,MACA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CAAC;YAGhE;QACF;IACF;IAEAsF,MAAMvF,QAA0B,EAAE;QAChCA,SAASwF,KAAK,CAACC,IAAI,CAACC,GAAG,CAAC,uBAAuB,CAACzF;YAC9CA,YAAYuF,KAAK,CAACG,aAAa,CAACD,GAAG,CACjC;gBACErF,MAAM;gBACNuF,OAAOC,gBAAO,CAACC,WAAW,CAACC,8BAA8B;YAC3D,GACA;gBACE,IAAI,CAACpD,YAAY,CAAC3C,UAAUC;YAC9B;QAEJ;QACA;IACF;AACF"}
|
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":["createEdgeRuntimeManifest","BuildManifestPlugin","generateClientManifest","getEntrypointFiles","normalizeRewritesForBuildManifest","processRoute","srcEmptySsgManifest","buildNodejsLowPriorityPath","filename","buildId","CLIENT_STATIC_FILES_PATH","originAssetMap","manifestFilenames","assetMap","lowPriorityFiles","manifestDefCode","JSON","stringify","lowPriorityFilesCode","map","join","normalizeRewrite","item","has","source","destination","rewrites","afterFiles","beforeFiles","fallback","clientRouterFilters","compiler","compilation","compilationSpan","getCompilationSpan","Span","name","genClientManifestSpan","traceChild","traceFn","clientManifest","__rewrites","__routerFilterStatic","staticFilter","__routerFilterDynamic","dynamicFilter","appDependencies","Set","pages","sortedPageKeys","getSortedRoutes","Object","keys","forEach","page","dependencies","filteredDeps","filter","dep","length","sortedPages","devalue","entrypoint","getFiles","file","test","replace","r","rewrite","startsWith","constructor","options","isDevFallback","appDirEnabled","createAssets","Error","createAssetsSpan","entrypoints","polyfillFiles","devFiles","ampDevFiles","rootMainFiles","rootMainFilesTree","ampFirstPages","ampFirstEntryNames","ampFirstEntryNamesMap","get","entryName","pagePath","getRouteFromEntrypoint","push","mainFiles","CLIENT_STATIC_FILES_RUNTIME_MAIN","CLIENT_STATIC_FILES_RUNTIME_MAIN_APP","compilationAssets","getAssets","p","endsWith","info","CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL","v","CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH","CLIENT_STATIC_FILES_RUNTIME_AMP","values","SYSTEM_ENTRYPOINTS","filesForPage","buildManifestPath","ssgManifestPath","emitAsset","sources","RawSource","sort","reduce","a","c","buildManifestName","BUILD_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","apply","hooks","make","tap","processAssets","stage","webpack","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS"],"mappings":";;;;;;;;;;;;;;;;;;;;IAsCgBA,yBAAyB;eAAzBA;;IAwIhB,iFAAiF;IACjF,+GAA+G;IAC/G,OAgMC;eAhMoBC;;IA7ELC,sBAAsB;eAAtBA;;IAoDAC,kBAAkB;eAAlBA;;IAtEAC,iCAAiC;eAAjCA;;IAkFHC,YAAY;eAAZA;;IApIAC,mBAAmB;eAAnBA;;;gEA7BO;yBACa;2BAW1B;+EAE4B;0CACG;uBACN;uBACX;wBACc;;;;;;AAW5B,MAAMA,sBAAsB,CAAC,4EAA4E,CAAC;AAEjH,+CAA+C;AAC/C,SAASC,2BAA2BC,QAAgB,EAAEC,OAAe;IACnE,OAAO,GAAGC,mCAAwB,CAAC,CAAC,EAAED,QAAQ,CAAC,EAAED,UAAU;AAC7D;AAEO,SAASR,0BACdW,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,EAAE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BAAmB,EACxBC,UACAC,aACA,uDAAuD,CAAC;YAGhE;QACF;IACF;IAEAsF,MAAMvF,QAA0B,EAAE;QAChCA,SAASwF,KAAK,CAACC,IAAI,CAACC,GAAG,CAAC,uBAAuB,CAACzF;YAC9CA,YAAYuF,KAAK,CAACG,aAAa,CAACD,GAAG,CACjC;gBACErF,MAAM;gBACNuF,OAAOC,gBAAO,CAACC,WAAW,CAACC,8BAA8B;YAC3D,GACA;gBACE,IAAI,CAACpD,YAAY,CAAC3C,UAAUC;YAC9B;QAEJ;QACA;IACF;AACF"}
|
@@ -1640,7 +1640,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
1640
1640
|
isClient && new _copyfileplugin.CopyFilePlugin({
|
1641
1641
|
// file path to build output of `@next/polyfill-nomodule`
|
1642
1642
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
1643
|
-
cacheKey: "15.3.0-canary.
|
1643
|
+
cacheKey: "15.3.0-canary.26",
|
1644
1644
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
1645
1645
|
minimize: false,
|
1646
1646
|
info: {
|
@@ -1817,7 +1817,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
1817
1817
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
1818
1818
|
// - Next.js version
|
1819
1819
|
// - next.config.js keys that affect compilation
|
1820
|
-
version: `${__dirname}|${"15.3.0-canary.
|
1820
|
+
version: `${__dirname}|${"15.3.0-canary.26"}|${configVars}`,
|
1821
1821
|
cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
|
1822
1822
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
1823
1823
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
package/dist/client/index.js
CHANGED
@@ -61,7 +61,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
|
|
61
61
|
const _onrecoverableerror = require("./react-client-callbacks/on-recoverable-error");
|
62
62
|
const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
|
63
63
|
const _isnextroutererror = require("./components/is-next-router-error");
|
64
|
-
const version = "15.3.0-canary.
|
64
|
+
const version = "15.3.0-canary.26";
|
65
65
|
let router;
|
66
66
|
const emitter = (0, _mitt.default)();
|
67
67
|
const looseToArray = (input)=>[].slice.call(input);
|