Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

next

Package Overview
Dependencies
Maintainers
2
Versions
3661
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next - npm Package Compare versions

Comparing version
16.2.0-canary.72
to
16.2.0-canary.73
+1
dist/build/get-supported-browsers.d.ts
export declare function getSupportedBrowsers(dir: string, isDevelopment: boolean): string[];
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getSupportedBrowsers", {
enumerable: true,
get: function() {
return getSupportedBrowsers;
}
});
const _browserslist = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/browserslist"));
const _constants = require("../shared/lib/constants");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getSupportedBrowsers(dir, isDevelopment) {
let browsers;
try {
const browsersListConfig = _browserslist.default.loadConfig({
path: dir,
env: isDevelopment ? 'development' : 'production'
});
// Running `browserslist` resolves `extends` and other config features into a list of browsers
if (browsersListConfig && browsersListConfig.length > 0) {
browsers = (0, _browserslist.default)(browsersListConfig);
}
} catch {}
// When user has browserslist use that target
if (browsers && browsers.length > 0) {
return browsers;
}
// Uses modern browsers as the default.
return _constants.MODERN_BROWSERSLIST_TARGET;
}
//# sourceMappingURL=get-supported-browsers.js.map
{"version":3,"sources":["../../src/build/get-supported-browsers.ts"],"sourcesContent":["import browserslist from 'next/dist/compiled/browserslist'\nimport { MODERN_BROWSERSLIST_TARGET } from '../shared/lib/constants'\n\nexport function getSupportedBrowsers(\n dir: string,\n isDevelopment: boolean\n): string[] {\n let browsers: any\n try {\n const browsersListConfig = browserslist.loadConfig({\n path: dir,\n env: isDevelopment ? 'development' : 'production',\n })\n // Running `browserslist` resolves `extends` and other config features into a list of browsers\n if (browsersListConfig && browsersListConfig.length > 0) {\n browsers = browserslist(browsersListConfig)\n }\n } catch {}\n\n // When user has browserslist use that target\n if (browsers && browsers.length > 0) {\n return browsers\n }\n\n // Uses modern browsers as the default.\n return MODERN_BROWSERSLIST_TARGET\n}\n"],"names":["getSupportedBrowsers","dir","isDevelopment","browsers","browsersListConfig","browserslist","loadConfig","path","env","length","MODERN_BROWSERSLIST_TARGET"],"mappings":";;;;+BAGgBA;;;eAAAA;;;qEAHS;2BACkB;;;;;;AAEpC,SAASA,qBACdC,GAAW,EACXC,aAAsB;IAEtB,IAAIC;IACJ,IAAI;QACF,MAAMC,qBAAqBC,qBAAY,CAACC,UAAU,CAAC;YACjDC,MAAMN;YACNO,KAAKN,gBAAgB,gBAAgB;QACvC;QACA,8FAA8F;QAC9F,IAAIE,sBAAsBA,mBAAmBK,MAAM,GAAG,GAAG;YACvDN,WAAWE,IAAAA,qBAAY,EAACD;QAC1B;IACF,EAAE,OAAM,CAAC;IAET,6CAA6C;IAC7C,IAAID,YAAYA,SAASM,MAAM,GAAG,GAAG;QACnC,OAAON;IACT;IAEA,uCAAuC;IACvC,OAAOO,qCAA0B;AACnC","ignoreList":[0]}
import type { TurbopackResult } from './swc/types';
/**
* Processes and reports build issues from Turbopack entrypoints.
*
* @param entrypoints - The result object containing build issues to process.
* @param isDev - A flag indicating if the build is running in development mode.
* @return This function does not return a value but logs or throws errors based on the issues.
* @throws {Error} If a fatal issue is encountered, this function throws an error. In development mode, we only throw on
* 'fatal' and 'bug' issues. In production mode, we also throw on 'error' issues.
*/
export declare function printBuildErrors(entrypoints: TurbopackResult, isDev: boolean): void;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "printBuildErrors", {
enumerable: true,
get: function() {
return printBuildErrors;
}
});
const _utils = require("../shared/lib/turbopack/utils");
function printBuildErrors(entrypoints, isDev) {
// Issues that we want to stop the server from executing
const topLevelFatalIssues = [];
// Issues that are true errors, but we believe we can keep running and allow the user to address the issue
const topLevelErrors = [];
// Issues that are warnings but should not affect the running of the build
const topLevelWarnings = [];
// Track seen formatted error messages to avoid duplicates
const seenFatalIssues = new Set();
const seenErrors = new Set();
const seenWarnings = new Set();
for (const issue of entrypoints.issues){
// We only want to completely shut down the server
if (issue.severity === 'fatal' || issue.severity === 'bug') {
const formatted = (0, _utils.formatIssue)(issue);
if (!seenFatalIssues.has(formatted)) {
seenFatalIssues.add(formatted);
topLevelFatalIssues.push(formatted);
}
} else if ((0, _utils.isRelevantWarning)(issue)) {
const formatted = (0, _utils.formatIssue)(issue);
if (!seenWarnings.has(formatted)) {
seenWarnings.add(formatted);
topLevelWarnings.push(formatted);
}
} else if (issue.severity === 'error') {
const formatted = (0, _utils.formatIssue)(issue);
if (isDev) {
// We want to treat errors as recoverable in development
// so that we can show the errors in the site and allow users
// to respond to the errors when necessary. In production builds
// though we want to error out and stop the build process.
if (!seenErrors.has(formatted)) {
seenErrors.add(formatted);
topLevelErrors.push(formatted);
}
} else {
if (!seenFatalIssues.has(formatted)) {
seenFatalIssues.add(formatted);
topLevelFatalIssues.push(formatted);
}
}
}
}
// TODO: print in order by source location so issues from the same file are displayed together and then add a summary at the end about the number of warnings/errors
if (topLevelWarnings.length > 0) {
console.warn(`Turbopack build encountered ${topLevelWarnings.length} warnings:\n${topLevelWarnings.join('\n')}`);
}
if (topLevelErrors.length > 0) {
console.error(`Turbopack build encountered ${topLevelErrors.length} errors:\n${topLevelErrors.join('\n')}`);
}
if (topLevelFatalIssues.length > 0) {
throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelFatalIssues.length} errors:\n${topLevelFatalIssues.join('\n')}`), "__NEXT_ERROR_CODE", {
value: "E425",
enumerable: false,
configurable: true
});
}
}
//# sourceMappingURL=print-build-errors.js.map
{"version":3,"sources":["../../src/build/print-build-errors.ts"],"sourcesContent":["import { formatIssue, isRelevantWarning } from '../shared/lib/turbopack/utils'\nimport type { TurbopackResult } from './swc/types'\n\n/**\n * Processes and reports build issues from Turbopack entrypoints.\n *\n * @param entrypoints - The result object containing build issues to process.\n * @param isDev - A flag indicating if the build is running in development mode.\n * @return This function does not return a value but logs or throws errors based on the issues.\n * @throws {Error} If a fatal issue is encountered, this function throws an error. In development mode, we only throw on\n * 'fatal' and 'bug' issues. In production mode, we also throw on 'error' issues.\n */\nexport function printBuildErrors(\n entrypoints: TurbopackResult,\n isDev: boolean\n): void {\n // Issues that we want to stop the server from executing\n const topLevelFatalIssues = []\n // Issues that are true errors, but we believe we can keep running and allow the user to address the issue\n const topLevelErrors = []\n // Issues that are warnings but should not affect the running of the build\n const topLevelWarnings = []\n\n // Track seen formatted error messages to avoid duplicates\n const seenFatalIssues = new Set<string>()\n const seenErrors = new Set<string>()\n const seenWarnings = new Set<string>()\n\n for (const issue of entrypoints.issues) {\n // We only want to completely shut down the server\n if (issue.severity === 'fatal' || issue.severity === 'bug') {\n const formatted = formatIssue(issue)\n if (!seenFatalIssues.has(formatted)) {\n seenFatalIssues.add(formatted)\n topLevelFatalIssues.push(formatted)\n }\n } else if (isRelevantWarning(issue)) {\n const formatted = formatIssue(issue)\n if (!seenWarnings.has(formatted)) {\n seenWarnings.add(formatted)\n topLevelWarnings.push(formatted)\n }\n } else if (issue.severity === 'error') {\n const formatted = formatIssue(issue)\n if (isDev) {\n // We want to treat errors as recoverable in development\n // so that we can show the errors in the site and allow users\n // to respond to the errors when necessary. In production builds\n // though we want to error out and stop the build process.\n if (!seenErrors.has(formatted)) {\n seenErrors.add(formatted)\n topLevelErrors.push(formatted)\n }\n } else {\n if (!seenFatalIssues.has(formatted)) {\n seenFatalIssues.add(formatted)\n topLevelFatalIssues.push(formatted)\n }\n }\n }\n }\n // TODO: print in order by source location so issues from the same file are displayed together and then add a summary at the end about the number of warnings/errors\n if (topLevelWarnings.length > 0) {\n console.warn(\n `Turbopack build encountered ${\n topLevelWarnings.length\n } warnings:\\n${topLevelWarnings.join('\\n')}`\n )\n }\n\n if (topLevelErrors.length > 0) {\n console.error(\n `Turbopack build encountered ${\n topLevelErrors.length\n } errors:\\n${topLevelErrors.join('\\n')}`\n )\n }\n\n if (topLevelFatalIssues.length > 0) {\n throw new Error(\n `Turbopack build failed with ${\n topLevelFatalIssues.length\n } errors:\\n${topLevelFatalIssues.join('\\n')}`\n )\n }\n}\n"],"names":["printBuildErrors","entrypoints","isDev","topLevelFatalIssues","topLevelErrors","topLevelWarnings","seenFatalIssues","Set","seenErrors","seenWarnings","issue","issues","severity","formatted","formatIssue","has","add","push","isRelevantWarning","length","console","warn","join","error","Error"],"mappings":";;;;+BAYgBA;;;eAAAA;;;uBAZ+B;AAYxC,SAASA,iBACdC,WAA4B,EAC5BC,KAAc;IAEd,wDAAwD;IACxD,MAAMC,sBAAsB,EAAE;IAC9B,0GAA0G;IAC1G,MAAMC,iBAAiB,EAAE;IACzB,0EAA0E;IAC1E,MAAMC,mBAAmB,EAAE;IAE3B,0DAA0D;IAC1D,MAAMC,kBAAkB,IAAIC;IAC5B,MAAMC,aAAa,IAAID;IACvB,MAAME,eAAe,IAAIF;IAEzB,KAAK,MAAMG,SAAST,YAAYU,MAAM,CAAE;QACtC,kDAAkD;QAClD,IAAID,MAAME,QAAQ,KAAK,WAAWF,MAAME,QAAQ,KAAK,OAAO;YAC1D,MAAMC,YAAYC,IAAAA,kBAAW,EAACJ;YAC9B,IAAI,CAACJ,gBAAgBS,GAAG,CAACF,YAAY;gBACnCP,gBAAgBU,GAAG,CAACH;gBACpBV,oBAAoBc,IAAI,CAACJ;YAC3B;QACF,OAAO,IAAIK,IAAAA,wBAAiB,EAACR,QAAQ;YACnC,MAAMG,YAAYC,IAAAA,kBAAW,EAACJ;YAC9B,IAAI,CAACD,aAAaM,GAAG,CAACF,YAAY;gBAChCJ,aAAaO,GAAG,CAACH;gBACjBR,iBAAiBY,IAAI,CAACJ;YACxB;QACF,OAAO,IAAIH,MAAME,QAAQ,KAAK,SAAS;YACrC,MAAMC,YAAYC,IAAAA,kBAAW,EAACJ;YAC9B,IAAIR,OAAO;gBACT,wDAAwD;gBACxD,6DAA6D;gBAC7D,gEAAgE;gBAChE,0DAA0D;gBAC1D,IAAI,CAACM,WAAWO,GAAG,CAACF,YAAY;oBAC9BL,WAAWQ,GAAG,CAACH;oBACfT,eAAea,IAAI,CAACJ;gBACtB;YACF,OAAO;gBACL,IAAI,CAACP,gBAAgBS,GAAG,CAACF,YAAY;oBACnCP,gBAAgBU,GAAG,CAACH;oBACpBV,oBAAoBc,IAAI,CAACJ;gBAC3B;YACF;QACF;IACF;IACA,oKAAoK;IACpK,IAAIR,iBAAiBc,MAAM,GAAG,GAAG;QAC/BC,QAAQC,IAAI,CACV,CAAC,4BAA4B,EAC3BhB,iBAAiBc,MAAM,CACxB,YAAY,EAAEd,iBAAiBiB,IAAI,CAAC,OAAO;IAEhD;IAEA,IAAIlB,eAAee,MAAM,GAAG,GAAG;QAC7BC,QAAQG,KAAK,CACX,CAAC,4BAA4B,EAC3BnB,eAAee,MAAM,CACtB,UAAU,EAAEf,eAAekB,IAAI,CAAC,OAAO;IAE5C;IAEA,IAAInB,oBAAoBgB,MAAM,GAAG,GAAG;QAClC,MAAM,qBAIL,CAJK,IAAIK,MACR,CAAC,4BAA4B,EAC3BrB,oBAAoBgB,MAAM,CAC3B,UAAU,EAAEhB,oBAAoBmB,IAAI,CAAC,OAAO,GAHzC,qBAAA;mBAAA;wBAAA;0BAAA;QAIN;IACF;AACF","ignoreList":[0]}
self.__BUILD_MANIFEST = {
"__rewrites": {
"afterFiles": [],
"beforeFiles": [],
"fallback": []
},
"sortedPages": [
"/_app",
"/_error"
]
};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()
import browserslist from 'next/dist/compiled/browserslist';
import { MODERN_BROWSERSLIST_TARGET } from '../shared/lib/constants';
export function getSupportedBrowsers(dir, isDevelopment) {
let browsers;
try {
const browsersListConfig = browserslist.loadConfig({
path: dir,
env: isDevelopment ? 'development' : 'production'
});
// Running `browserslist` resolves `extends` and other config features into a list of browsers
if (browsersListConfig && browsersListConfig.length > 0) {
browsers = browserslist(browsersListConfig);
}
} catch {}
// When user has browserslist use that target
if (browsers && browsers.length > 0) {
return browsers;
}
// Uses modern browsers as the default.
return MODERN_BROWSERSLIST_TARGET;
}
//# sourceMappingURL=get-supported-browsers.js.map
{"version":3,"sources":["../../../src/build/get-supported-browsers.ts"],"sourcesContent":["import browserslist from 'next/dist/compiled/browserslist'\nimport { MODERN_BROWSERSLIST_TARGET } from '../shared/lib/constants'\n\nexport function getSupportedBrowsers(\n dir: string,\n isDevelopment: boolean\n): string[] {\n let browsers: any\n try {\n const browsersListConfig = browserslist.loadConfig({\n path: dir,\n env: isDevelopment ? 'development' : 'production',\n })\n // Running `browserslist` resolves `extends` and other config features into a list of browsers\n if (browsersListConfig && browsersListConfig.length > 0) {\n browsers = browserslist(browsersListConfig)\n }\n } catch {}\n\n // When user has browserslist use that target\n if (browsers && browsers.length > 0) {\n return browsers\n }\n\n // Uses modern browsers as the default.\n return MODERN_BROWSERSLIST_TARGET\n}\n"],"names":["browserslist","MODERN_BROWSERSLIST_TARGET","getSupportedBrowsers","dir","isDevelopment","browsers","browsersListConfig","loadConfig","path","env","length"],"mappings":"AAAA,OAAOA,kBAAkB,kCAAiC;AAC1D,SAASC,0BAA0B,QAAQ,0BAAyB;AAEpE,OAAO,SAASC,qBACdC,GAAW,EACXC,aAAsB;IAEtB,IAAIC;IACJ,IAAI;QACF,MAAMC,qBAAqBN,aAAaO,UAAU,CAAC;YACjDC,MAAML;YACNM,KAAKL,gBAAgB,gBAAgB;QACvC;QACA,8FAA8F;QAC9F,IAAIE,sBAAsBA,mBAAmBI,MAAM,GAAG,GAAG;YACvDL,WAAWL,aAAaM;QAC1B;IACF,EAAE,OAAM,CAAC;IAET,6CAA6C;IAC7C,IAAID,YAAYA,SAASK,MAAM,GAAG,GAAG;QACnC,OAAOL;IACT;IAEA,uCAAuC;IACvC,OAAOJ;AACT","ignoreList":[0]}
import { formatIssue, isRelevantWarning } from '../shared/lib/turbopack/utils';
/**
* Processes and reports build issues from Turbopack entrypoints.
*
* @param entrypoints - The result object containing build issues to process.
* @param isDev - A flag indicating if the build is running in development mode.
* @return This function does not return a value but logs or throws errors based on the issues.
* @throws {Error} If a fatal issue is encountered, this function throws an error. In development mode, we only throw on
* 'fatal' and 'bug' issues. In production mode, we also throw on 'error' issues.
*/ export function printBuildErrors(entrypoints, isDev) {
// Issues that we want to stop the server from executing
const topLevelFatalIssues = [];
// Issues that are true errors, but we believe we can keep running and allow the user to address the issue
const topLevelErrors = [];
// Issues that are warnings but should not affect the running of the build
const topLevelWarnings = [];
// Track seen formatted error messages to avoid duplicates
const seenFatalIssues = new Set();
const seenErrors = new Set();
const seenWarnings = new Set();
for (const issue of entrypoints.issues){
// We only want to completely shut down the server
if (issue.severity === 'fatal' || issue.severity === 'bug') {
const formatted = formatIssue(issue);
if (!seenFatalIssues.has(formatted)) {
seenFatalIssues.add(formatted);
topLevelFatalIssues.push(formatted);
}
} else if (isRelevantWarning(issue)) {
const formatted = formatIssue(issue);
if (!seenWarnings.has(formatted)) {
seenWarnings.add(formatted);
topLevelWarnings.push(formatted);
}
} else if (issue.severity === 'error') {
const formatted = formatIssue(issue);
if (isDev) {
// We want to treat errors as recoverable in development
// so that we can show the errors in the site and allow users
// to respond to the errors when necessary. In production builds
// though we want to error out and stop the build process.
if (!seenErrors.has(formatted)) {
seenErrors.add(formatted);
topLevelErrors.push(formatted);
}
} else {
if (!seenFatalIssues.has(formatted)) {
seenFatalIssues.add(formatted);
topLevelFatalIssues.push(formatted);
}
}
}
}
// TODO: print in order by source location so issues from the same file are displayed together and then add a summary at the end about the number of warnings/errors
if (topLevelWarnings.length > 0) {
console.warn(`Turbopack build encountered ${topLevelWarnings.length} warnings:\n${topLevelWarnings.join('\n')}`);
}
if (topLevelErrors.length > 0) {
console.error(`Turbopack build encountered ${topLevelErrors.length} errors:\n${topLevelErrors.join('\n')}`);
}
if (topLevelFatalIssues.length > 0) {
throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelFatalIssues.length} errors:\n${topLevelFatalIssues.join('\n')}`), "__NEXT_ERROR_CODE", {
value: "E425",
enumerable: false,
configurable: true
});
}
}
//# sourceMappingURL=print-build-errors.js.map
{"version":3,"sources":["../../../src/build/print-build-errors.ts"],"sourcesContent":["import { formatIssue, isRelevantWarning } from '../shared/lib/turbopack/utils'\nimport type { TurbopackResult } from './swc/types'\n\n/**\n * Processes and reports build issues from Turbopack entrypoints.\n *\n * @param entrypoints - The result object containing build issues to process.\n * @param isDev - A flag indicating if the build is running in development mode.\n * @return This function does not return a value but logs or throws errors based on the issues.\n * @throws {Error} If a fatal issue is encountered, this function throws an error. In development mode, we only throw on\n * 'fatal' and 'bug' issues. In production mode, we also throw on 'error' issues.\n */\nexport function printBuildErrors(\n entrypoints: TurbopackResult,\n isDev: boolean\n): void {\n // Issues that we want to stop the server from executing\n const topLevelFatalIssues = []\n // Issues that are true errors, but we believe we can keep running and allow the user to address the issue\n const topLevelErrors = []\n // Issues that are warnings but should not affect the running of the build\n const topLevelWarnings = []\n\n // Track seen formatted error messages to avoid duplicates\n const seenFatalIssues = new Set<string>()\n const seenErrors = new Set<string>()\n const seenWarnings = new Set<string>()\n\n for (const issue of entrypoints.issues) {\n // We only want to completely shut down the server\n if (issue.severity === 'fatal' || issue.severity === 'bug') {\n const formatted = formatIssue(issue)\n if (!seenFatalIssues.has(formatted)) {\n seenFatalIssues.add(formatted)\n topLevelFatalIssues.push(formatted)\n }\n } else if (isRelevantWarning(issue)) {\n const formatted = formatIssue(issue)\n if (!seenWarnings.has(formatted)) {\n seenWarnings.add(formatted)\n topLevelWarnings.push(formatted)\n }\n } else if (issue.severity === 'error') {\n const formatted = formatIssue(issue)\n if (isDev) {\n // We want to treat errors as recoverable in development\n // so that we can show the errors in the site and allow users\n // to respond to the errors when necessary. In production builds\n // though we want to error out and stop the build process.\n if (!seenErrors.has(formatted)) {\n seenErrors.add(formatted)\n topLevelErrors.push(formatted)\n }\n } else {\n if (!seenFatalIssues.has(formatted)) {\n seenFatalIssues.add(formatted)\n topLevelFatalIssues.push(formatted)\n }\n }\n }\n }\n // TODO: print in order by source location so issues from the same file are displayed together and then add a summary at the end about the number of warnings/errors\n if (topLevelWarnings.length > 0) {\n console.warn(\n `Turbopack build encountered ${\n topLevelWarnings.length\n } warnings:\\n${topLevelWarnings.join('\\n')}`\n )\n }\n\n if (topLevelErrors.length > 0) {\n console.error(\n `Turbopack build encountered ${\n topLevelErrors.length\n } errors:\\n${topLevelErrors.join('\\n')}`\n )\n }\n\n if (topLevelFatalIssues.length > 0) {\n throw new Error(\n `Turbopack build failed with ${\n topLevelFatalIssues.length\n } errors:\\n${topLevelFatalIssues.join('\\n')}`\n )\n }\n}\n"],"names":["formatIssue","isRelevantWarning","printBuildErrors","entrypoints","isDev","topLevelFatalIssues","topLevelErrors","topLevelWarnings","seenFatalIssues","Set","seenErrors","seenWarnings","issue","issues","severity","formatted","has","add","push","length","console","warn","join","error","Error"],"mappings":"AAAA,SAASA,WAAW,EAAEC,iBAAiB,QAAQ,gCAA+B;AAG9E;;;;;;;;CAQC,GACD,OAAO,SAASC,iBACdC,WAA4B,EAC5BC,KAAc;IAEd,wDAAwD;IACxD,MAAMC,sBAAsB,EAAE;IAC9B,0GAA0G;IAC1G,MAAMC,iBAAiB,EAAE;IACzB,0EAA0E;IAC1E,MAAMC,mBAAmB,EAAE;IAE3B,0DAA0D;IAC1D,MAAMC,kBAAkB,IAAIC;IAC5B,MAAMC,aAAa,IAAID;IACvB,MAAME,eAAe,IAAIF;IAEzB,KAAK,MAAMG,SAAST,YAAYU,MAAM,CAAE;QACtC,kDAAkD;QAClD,IAAID,MAAME,QAAQ,KAAK,WAAWF,MAAME,QAAQ,KAAK,OAAO;YAC1D,MAAMC,YAAYf,YAAYY;YAC9B,IAAI,CAACJ,gBAAgBQ,GAAG,CAACD,YAAY;gBACnCP,gBAAgBS,GAAG,CAACF;gBACpBV,oBAAoBa,IAAI,CAACH;YAC3B;QACF,OAAO,IAAId,kBAAkBW,QAAQ;YACnC,MAAMG,YAAYf,YAAYY;YAC9B,IAAI,CAACD,aAAaK,GAAG,CAACD,YAAY;gBAChCJ,aAAaM,GAAG,CAACF;gBACjBR,iBAAiBW,IAAI,CAACH;YACxB;QACF,OAAO,IAAIH,MAAME,QAAQ,KAAK,SAAS;YACrC,MAAMC,YAAYf,YAAYY;YAC9B,IAAIR,OAAO;gBACT,wDAAwD;gBACxD,6DAA6D;gBAC7D,gEAAgE;gBAChE,0DAA0D;gBAC1D,IAAI,CAACM,WAAWM,GAAG,CAACD,YAAY;oBAC9BL,WAAWO,GAAG,CAACF;oBACfT,eAAeY,IAAI,CAACH;gBACtB;YACF,OAAO;gBACL,IAAI,CAACP,gBAAgBQ,GAAG,CAACD,YAAY;oBACnCP,gBAAgBS,GAAG,CAACF;oBACpBV,oBAAoBa,IAAI,CAACH;gBAC3B;YACF;QACF;IACF;IACA,oKAAoK;IACpK,IAAIR,iBAAiBY,MAAM,GAAG,GAAG;QAC/BC,QAAQC,IAAI,CACV,CAAC,4BAA4B,EAC3Bd,iBAAiBY,MAAM,CACxB,YAAY,EAAEZ,iBAAiBe,IAAI,CAAC,OAAO;IAEhD;IAEA,IAAIhB,eAAea,MAAM,GAAG,GAAG;QAC7BC,QAAQG,KAAK,CACX,CAAC,4BAA4B,EAC3BjB,eAAea,MAAM,CACtB,UAAU,EAAEb,eAAegB,IAAI,CAAC,OAAO;IAE5C;IAEA,IAAIjB,oBAAoBc,MAAM,GAAG,GAAG;QAClC,MAAM,qBAIL,CAJK,IAAIK,MACR,CAAC,4BAA4B,EAC3BnB,oBAAoBc,MAAM,CAC3B,UAAU,EAAEd,oBAAoBiB,IAAI,CAAC,OAAO,GAHzC,qBAAA;mBAAA;wBAAA;0BAAA;QAIN;IACF;AACF","ignoreList":[0]}
import { NEXT_URL } from '../client/components/app-router-headers';
export function isInterceptionRouteRewrite(route) {
var _route_has_, _route_has;
// When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.
return ((_route_has = route.has) == null ? void 0 : (_route_has_ = _route_has[0]) == null ? void 0 : _route_has_.key) === NEXT_URL;
}
//# sourceMappingURL=is-interception-route-rewrite.js.map
{"version":3,"sources":["../../../src/lib/is-interception-route-rewrite.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport type { Rewrite } from './load-custom-routes'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\n\nexport function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>) {\n // When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.\n return route.has?.[0]?.key === NEXT_URL\n}\n"],"names":["NEXT_URL","isInterceptionRouteRewrite","route","has","key"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0CAAyC;AAIlE,OAAO,SAASC,2BAA2BC,KAA4B;QAE9DA,aAAAA;IADP,0HAA0H;IAC1H,OAAOA,EAAAA,aAAAA,MAAMC,GAAG,sBAATD,cAAAA,UAAW,CAAC,EAAE,qBAAdA,YAAgBE,GAAG,MAAKJ;AACjC","ignoreList":[0]}
import type { Rewrite } from './load-custom-routes';
import type { DeepReadonly } from '../shared/lib/deep-readonly';
export declare function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>): boolean;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isInterceptionRouteRewrite", {
enumerable: true,
get: function() {
return isInterceptionRouteRewrite;
}
});
const _approuterheaders = require("../client/components/app-router-headers");
function isInterceptionRouteRewrite(route) {
var _route_has_, _route_has;
// When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.
return ((_route_has = route.has) == null ? void 0 : (_route_has_ = _route_has[0]) == null ? void 0 : _route_has_.key) === _approuterheaders.NEXT_URL;
}
//# sourceMappingURL=is-interception-route-rewrite.js.map
{"version":3,"sources":["../../src/lib/is-interception-route-rewrite.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport type { Rewrite } from './load-custom-routes'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\n\nexport function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>) {\n // When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.\n return route.has?.[0]?.key === NEXT_URL\n}\n"],"names":["isInterceptionRouteRewrite","route","has","key","NEXT_URL"],"mappings":";;;;+BAIgBA;;;eAAAA;;;kCAJS;AAIlB,SAASA,2BAA2BC,KAA4B;QAE9DA,aAAAA;IADP,0HAA0H;IAC1H,OAAOA,EAAAA,aAAAA,MAAMC,GAAG,sBAATD,cAAAA,UAAW,CAAC,EAAE,qBAAdA,YAAgBE,GAAG,MAAKC,0BAAQ;AACzC","ignoreList":[0]}
+4
-4

@@ -313,5 +313,5 @@ "use strict";

}
async function tryToReadFile(filePath, shouldThrow) {
function tryToReadFile(filePath, shouldThrow) {
try {
return await _fs.promises.readFile(filePath, {
return (0, _fs.readFileSync)(filePath, {
encoding: 'utf8'

@@ -427,3 +427,3 @@ });

async function getAppPageStaticInfo({ pageFilePath, nextConfig, isDev, page }) {
const content = await tryToReadFile(pageFilePath, !isDev);
const content = tryToReadFile(pageFilePath, !isDev);
if (!content || !PARSE_PATTERN.test(content)) {

@@ -517,3 +517,3 @@ return {

var _config_config, _config_config1, _config_config2;
const content = await tryToReadFile(pageFilePath, !isDev);
const content = tryToReadFile(pageFilePath, !isDev);
if (!content || !PARSE_PATTERN.test(content)) {

@@ -520,0 +520,0 @@ return {

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../src/build/analysis/get-page-static-info.ts"],"sourcesContent":["import type { NextConfig } from '../../server/config-shared'\nimport type { RouteHas } from '../../lib/load-custom-routes'\n\nimport { promises as fs } from 'fs'\nimport { relative } from 'path'\nimport { LRUCache } from '../../server/lib/lru-cache'\nimport {\n extractExportedConstValue,\n UnsupportedValueError,\n} from './extract-const-value'\nimport { parseModule } from './parse-module'\nimport * as Log from '../output/log'\nimport {\n SERVER_RUNTIME,\n MIDDLEWARE_FILENAME,\n PROXY_FILENAME,\n} from '../../lib/constants'\nimport { tryToParsePath } from '../../lib/try-to-parse-path'\nimport { isAPIRoute } from '../../lib/is-api-route'\nimport { isEdgeRuntime } from '../../lib/is-edge-runtime'\nimport { RSC_MODULE_TYPES } from '../../shared/lib/constants'\nimport type { RSCMeta } from '../webpack/loaders/get-module-build-info'\nimport { PAGE_TYPES } from '../../lib/page-types'\nimport {\n AppSegmentConfigSchemaKeys,\n parseAppSegmentConfig,\n type AppSegmentConfig,\n} from '../segment-config/app/app-segment-config'\nimport { reportZodError } from '../../shared/lib/zod'\nimport {\n PagesSegmentConfigSchemaKeys,\n parsePagesSegmentConfig,\n type PagesSegmentConfig,\n type PagesSegmentConfigConfig,\n} from '../segment-config/pages/pages-segment-config'\nimport {\n MiddlewareConfigInputSchema,\n SourceSchema,\n type MiddlewareConfigMatcherInput,\n} from '../segment-config/middleware/middleware-config'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isProxyFile } from '../utils'\n\nconst PARSE_PATTERN =\n /(?<!(_jsx|jsx-))runtime|preferredRegion|getStaticProps|getServerSideProps|generateStaticParams|export const|generateImageMetadata|generateSitemaps|middleware|proxy/\n\nexport type ProxyMatcher = {\n regexp: string\n locale?: false\n has?: RouteHas[]\n missing?: RouteHas[]\n originalSource: string\n}\n\nexport type ProxyConfig = {\n /**\n * The matcher for the proxy. Read more: [Next.js Docs: Proxy `matcher`](https://nextjs.org/docs/app/api-reference/file-conventions/proxy#matcher),\n * [Next.js Docs: Proxy matching paths](https://nextjs.org/docs/app/building-your-application/routing/proxy#matching-paths)\n */\n matchers?: ProxyMatcher[]\n\n /**\n * The regions that the proxy should run in.\n */\n regions?: string | string[]\n\n /**\n * A glob, or an array of globs, ignoring dynamic code evaluation for specific\n * files. The globs are relative to your application root folder.\n */\n unstable_allowDynamic?: string[]\n}\n\nexport interface AppPageStaticInfo {\n type: PAGE_TYPES.APP\n ssg?: boolean\n ssr?: boolean\n rsc?: RSCModuleType\n generateStaticParams?: boolean\n generateSitemaps?: boolean\n generateImageMetadata?: boolean\n middleware?: ProxyConfig\n config: Omit<AppSegmentConfig, 'runtime' | 'maxDuration'> | undefined\n runtime: AppSegmentConfig['runtime'] | undefined\n preferredRegion: AppSegmentConfig['preferredRegion'] | undefined\n maxDuration: number | undefined\n hadUnsupportedValue: boolean\n}\n\nexport interface PagesPageStaticInfo {\n type: PAGE_TYPES.PAGES\n getStaticProps?: boolean\n getServerSideProps?: boolean\n rsc?: RSCModuleType\n generateStaticParams?: boolean\n generateSitemaps?: boolean\n generateImageMetadata?: boolean\n middleware?: ProxyConfig\n config:\n | (Omit<PagesSegmentConfig, 'runtime' | 'config' | 'maxDuration'> & {\n config?: Omit<PagesSegmentConfigConfig, 'runtime' | 'maxDuration'>\n })\n | undefined\n runtime: PagesSegmentConfig['runtime'] | undefined\n preferredRegion: PagesSegmentConfigConfig['regions'] | undefined\n maxDuration: number | undefined\n hadUnsupportedValue: boolean\n}\n\nexport type PageStaticInfo = AppPageStaticInfo | PagesPageStaticInfo\n\nconst CLIENT_MODULE_LABEL =\n /\\/\\* __next_internal_client_entry_do_not_use__ ([^ ]*) (cjs|auto) \\*\\//\n\n// Match JSON object that may contain nested objects (for loc info)\n// The JSON ends right before the closing \" */\"\nconst ACTION_MODULE_LABEL =\n /\\/\\* __next_internal_action_entry_do_not_use__ (\\{.*\\}) \\*\\//\n\nconst CLIENT_DIRECTIVE = 'use client'\nconst SERVER_ACTION_DIRECTIVE = 'use server'\n\nexport type RSCModuleType = 'server' | 'client'\nexport function getRSCModuleInformation(\n source: string,\n isReactServerLayer: boolean\n): RSCMeta {\n const actionsJson = source.match(ACTION_MODULE_LABEL)\n // Parse action metadata - supports both old format (string) and new format (object with loc)\n const parsedActionsMeta = actionsJson\n ? (JSON.parse(actionsJson[1]) as RSCMeta['actionIds'])\n : undefined\n const clientInfoMatch = source.match(CLIENT_MODULE_LABEL)\n const isClientRef = !!clientInfoMatch\n\n if (!isReactServerLayer) {\n return {\n type: RSC_MODULE_TYPES.client,\n actionIds: parsedActionsMeta,\n isClientRef,\n }\n }\n\n const clientRefsString = clientInfoMatch?.[1]\n const clientRefs = clientRefsString ? clientRefsString.split(',') : []\n const clientEntryType = clientInfoMatch?.[2] as 'cjs' | 'auto' | undefined\n\n const type = clientInfoMatch\n ? RSC_MODULE_TYPES.client\n : RSC_MODULE_TYPES.server\n\n return {\n type,\n actionIds: parsedActionsMeta,\n clientRefs,\n clientEntryType,\n isClientRef,\n }\n}\n\n/**\n * Receives a parsed AST from SWC and checks if it belongs to a module that\n * requires a runtime to be specified. Those are:\n * - Modules with `export function getStaticProps | getServerSideProps`\n * - Modules with `export { getStaticProps | getServerSideProps } <from ...>`\n * - Modules with `export const runtime = ...`\n */\nfunction checkExports(\n ast: any,\n expectedExports: string[],\n page: string\n): {\n getStaticProps?: boolean\n getServerSideProps?: boolean\n generateImageMetadata?: boolean\n generateSitemaps?: boolean\n generateStaticParams?: boolean\n directives?: Set<string>\n exports?: Set<string>\n} {\n const exportsSet = new Set<string>([\n 'getStaticProps',\n 'getServerSideProps',\n 'generateImageMetadata',\n 'generateSitemaps',\n 'generateStaticParams',\n ])\n if (!Array.isArray(ast?.body)) {\n return {}\n }\n\n try {\n let getStaticProps: boolean = false\n let getServerSideProps: boolean = false\n let generateImageMetadata: boolean = false\n let generateSitemaps: boolean = false\n let generateStaticParams = false\n let exports = new Set<string>()\n let directives = new Set<string>()\n let hasLeadingNonDirectiveNode = false\n\n for (const node of ast.body) {\n // There should be no non-string literals nodes before directives\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'StringLiteral'\n ) {\n if (!hasLeadingNonDirectiveNode) {\n const directive = node.expression.value\n if (CLIENT_DIRECTIVE === directive) {\n directives.add('client')\n }\n if (SERVER_ACTION_DIRECTIVE === directive) {\n directives.add('server')\n }\n }\n } else {\n hasLeadingNonDirectiveNode = true\n }\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n for (const declaration of node.declaration?.declarations) {\n if (expectedExports.includes(declaration.id.value)) {\n exports.add(declaration.id.value)\n }\n }\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration' &&\n exportsSet.has(node.declaration.identifier?.value)\n ) {\n const id = node.declaration.identifier.value\n getServerSideProps = id === 'getServerSideProps'\n getStaticProps = id === 'getStaticProps'\n generateImageMetadata = id === 'generateImageMetadata'\n generateSitemaps = id === 'generateSitemaps'\n generateStaticParams = id === 'generateStaticParams'\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n const id = node.declaration?.declarations[0]?.id.value\n if (exportsSet.has(id)) {\n getServerSideProps = id === 'getServerSideProps'\n getStaticProps = id === 'getStaticProps'\n generateImageMetadata = id === 'generateImageMetadata'\n generateSitemaps = id === 'generateSitemaps'\n generateStaticParams = id === 'generateStaticParams'\n }\n }\n\n if (node.type === 'ExportNamedDeclaration') {\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.orig?.type === 'Identifier'\n ) {\n const value = specifier.orig.value\n\n if (!getServerSideProps && value === 'getServerSideProps') {\n getServerSideProps = true\n }\n if (!getStaticProps && value === 'getStaticProps') {\n getStaticProps = true\n }\n if (!generateImageMetadata && value === 'generateImageMetadata') {\n generateImageMetadata = true\n }\n if (!generateSitemaps && value === 'generateSitemaps') {\n generateSitemaps = true\n }\n if (!generateStaticParams && value === 'generateStaticParams') {\n generateStaticParams = true\n }\n if (expectedExports.includes(value) && !exports.has(value)) {\n // An export was found that was actually a re-export, and not a\n // literal value. We should warn here.\n Log.warn(\n `Next.js can't recognize the exported \\`${value}\\` field in \"${page}\", it may be re-exported from another file. The default config will be used instead.`\n )\n }\n }\n }\n }\n }\n\n return {\n getStaticProps,\n getServerSideProps,\n generateImageMetadata,\n generateSitemaps,\n generateStaticParams,\n directives,\n exports,\n }\n } catch {}\n\n return {}\n}\n\nfunction validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n}: {\n ast: any\n page: string\n pageFilePath: string\n isDev: boolean\n}): void {\n // Check if this is middleware/proxy\n const isMiddleware =\n page === `/${MIDDLEWARE_FILENAME}` || page === `/src/${MIDDLEWARE_FILENAME}`\n const isProxy =\n page === `/${PROXY_FILENAME}` || page === `/src/${PROXY_FILENAME}`\n\n if (!isMiddleware && !isProxy) {\n return\n }\n\n if (!ast || !Array.isArray(ast.body)) {\n return\n }\n\n const fileName = isProxy ? PROXY_FILENAME : MIDDLEWARE_FILENAME\n\n // Parse AST to get export info (since checkExports doesn't return middleware/proxy info)\n let hasDefaultExport = false\n let hasMiddlewareExport = false\n let hasProxyExport = false\n\n for (const node of ast.body) {\n if (\n node.type === 'ExportDefaultDeclaration' ||\n node.type === 'ExportDefaultExpression'\n ) {\n hasDefaultExport = true\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration'\n ) {\n const id = node.declaration.identifier?.value\n if (id === 'middleware') {\n hasMiddlewareExport = true\n }\n if (id === 'proxy') {\n hasProxyExport = true\n }\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n const id = node.declaration?.declarations[0]?.id.value\n if (id === 'middleware') {\n hasMiddlewareExport = true\n }\n if (id === 'proxy') {\n hasProxyExport = true\n }\n }\n\n if (node.type === 'ExportNamedDeclaration') {\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.orig?.type === 'Identifier'\n ) {\n // Use the exported name if it exists (for aliased exports like `export { foo as proxy }`),\n // otherwise fall back to the original name (for simple re-exports like `export { proxy }`)\n const exportedIdentifier = specifier.exported || specifier.orig\n const value = exportedIdentifier.value\n if (value === 'middleware') {\n hasMiddlewareExport = true\n }\n if (value === 'proxy') {\n hasProxyExport = true\n }\n }\n }\n }\n }\n\n const hasValidExport =\n hasDefaultExport ||\n (isMiddleware && hasMiddlewareExport) ||\n (isProxy && hasProxyExport)\n\n const relativePath = relative(process.cwd(), pageFilePath)\n const resolvedPath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`\n\n if (!hasValidExport) {\n const message =\n `The file \"${resolvedPath}\" must export a function, either as a default export or as a named \"${fileName}\" export.\\n` +\n `This function is what Next.js runs for every request handled by this ${fileName === 'proxy' ? 'proxy (previously called middleware)' : 'middleware'}.\\n\\n` +\n `Why this happens:\\n` +\n (isProxy\n ? \"- You are migrating from `middleware` to `proxy`, but haven't updated the exported function.\\n\"\n : '') +\n `- The file exists but doesn't export a function.\\n` +\n `- The export is not a function (e.g., an object or constant).\\n` +\n `- There's a syntax error preventing the export from being recognized.\\n\\n` +\n `To fix it:\\n` +\n `- Ensure this file has either a default or \"${fileName}\" function export.\\n\\n` +\n `Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n\n if (isDev) {\n // errorOnce as proxy/middleware runs per request including multiple\n // internal _next/ routes and spams logs.\n Log.errorOnce(message)\n } else {\n throw new Error(message)\n }\n }\n}\n\nasync function tryToReadFile(filePath: string, shouldThrow: boolean) {\n try {\n return await fs.readFile(filePath, {\n encoding: 'utf8',\n })\n } catch (error: any) {\n if (shouldThrow) {\n error.message = `Next.js ERROR: Failed to read file ${filePath}:\\n${error.message}`\n throw error\n }\n }\n}\n\n/**\n * @internal - required to exclude zod types from the build\n */\nexport function getMiddlewareMatchers(\n matcherOrMatchers: MiddlewareConfigMatcherInput,\n nextConfig: Pick<NextConfig, 'basePath' | 'i18n'>\n): ProxyMatcher[] {\n const matchers = Array.isArray(matcherOrMatchers)\n ? matcherOrMatchers\n : [matcherOrMatchers]\n\n const { i18n } = nextConfig\n\n return matchers.map((matcher) => {\n matcher = typeof matcher === 'string' ? { source: matcher } : matcher\n\n const originalSource = matcher.source\n\n let { source, ...rest } = matcher\n\n const isRoot = source === '/'\n\n if (i18n?.locales && matcher.locale !== false) {\n source = `/:nextInternalLocale((?!_next/)[^/.]{1,})${\n isRoot ? '' : source\n }`\n }\n\n source = `/:nextData(_next/data/[^/]{1,})?${source}${\n isRoot\n ? `(${nextConfig.i18n ? '|\\\\.json|' : ''}/?index|/?index\\\\.json)?`\n : '{(\\\\.json)}?'\n }`\n\n if (nextConfig.basePath) {\n source = `${nextConfig.basePath}${source}`\n }\n\n // Validate that the source is still.\n const result = SourceSchema.safeParse(source)\n if (!result.success) {\n reportZodError('Failed to parse middleware source', result.error)\n\n // We need to exit here because middleware being built occurs before we\n // finish setting up the server. Exiting here is the only way to ensure\n // that we don't hang.\n process.exit(1)\n }\n\n return {\n ...rest,\n // We know that parsed.regexStr is not undefined because we already\n // checked that the source is valid.\n regexp: tryToParsePath(result.data).regexStr!,\n originalSource: originalSource || source,\n }\n })\n}\n\nfunction parseMiddlewareConfig(\n page: string,\n rawConfig: unknown,\n nextConfig: NextConfig\n): ProxyConfig {\n // If there's no config to parse, then return nothing.\n if (typeof rawConfig !== 'object' || !rawConfig) return {}\n\n const input = MiddlewareConfigInputSchema.safeParse(rawConfig)\n if (!input.success) {\n reportZodError(`${page} contains invalid middleware config`, input.error)\n\n // We need to exit here because middleware being built occurs before we\n // finish setting up the server. Exiting here is the only way to ensure\n // that we don't hang.\n process.exit(1)\n }\n\n const config: ProxyConfig = {}\n\n if (input.data.matcher) {\n config.matchers = getMiddlewareMatchers(input.data.matcher, nextConfig)\n }\n\n if (input.data.unstable_allowDynamic) {\n config.unstable_allowDynamic = Array.isArray(\n input.data.unstable_allowDynamic\n )\n ? input.data.unstable_allowDynamic\n : [input.data.unstable_allowDynamic]\n }\n\n if (input.data.regions) {\n config.regions = input.data.regions\n }\n\n return config\n}\n\nconst apiRouteWarnings = new LRUCache(250)\nfunction warnAboutExperimentalEdge(apiRoute: string | null) {\n if (\n process.env.NODE_ENV === 'production' &&\n process.env.NEXT_PRIVATE_BUILD_WORKER === '1'\n ) {\n return\n }\n\n if (apiRoute && apiRouteWarnings.has(apiRoute)) {\n return\n }\n\n Log.warn(\n apiRoute\n ? `${apiRoute} provided runtime 'experimental-edge'. It can be updated to 'edge' instead.`\n : `You are using an experimental edge runtime, the API might change.`\n )\n\n if (apiRoute) {\n apiRouteWarnings.set(apiRoute, 1)\n }\n}\n\nlet hadUnsupportedValue = false\nconst warnedUnsupportedValueMap = new LRUCache<boolean>(250, () => 1)\n\nfunction warnAboutUnsupportedValue(\n pageFilePath: string,\n page: string | undefined,\n error: UnsupportedValueError\n) {\n hadUnsupportedValue = true\n const isProductionBuild = process.env.NODE_ENV === 'production'\n if (\n // we only log for the server compilation so it's not\n // duplicated due to webpack build worker having fresh\n // module scope for each compiler\n process.env.NEXT_COMPILER_NAME !== 'server' ||\n (isProductionBuild && warnedUnsupportedValueMap.has(pageFilePath))\n ) {\n return\n }\n warnedUnsupportedValueMap.set(pageFilePath, true)\n\n const message =\n `Next.js can't recognize the exported \\`config\\` field in ` +\n (page ? `route \"${page}\"` : `\"${pageFilePath}\"`) +\n ':\\n' +\n error.message +\n (error.path ? ` at \"${error.path}\"` : '') +\n '.\\n' +\n 'Read More - https://nextjs.org/docs/messages/invalid-page-config'\n\n // for a build we use `Log.error` instead of throwing\n // so that all errors can be logged before exiting the process\n if (isProductionBuild) {\n Log.error(message)\n } else {\n throw new Error(message)\n }\n}\n\ntype GetPageStaticInfoParams = {\n pageFilePath: string\n nextConfig: Partial<NextConfig>\n isDev: boolean\n page: string\n pageType: PAGE_TYPES\n}\n\nexport async function getAppPageStaticInfo({\n pageFilePath,\n nextConfig,\n isDev,\n page,\n}: GetPageStaticInfoParams): Promise<AppPageStaticInfo> {\n const content = await tryToReadFile(pageFilePath, !isDev)\n if (!content || !PARSE_PATTERN.test(content)) {\n return {\n type: PAGE_TYPES.APP,\n config: undefined,\n runtime: undefined,\n preferredRegion: undefined,\n maxDuration: undefined,\n hadUnsupportedValue: false,\n }\n }\n\n const ast = await parseModule(pageFilePath, content)\n validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n })\n\n const {\n generateStaticParams,\n generateImageMetadata,\n generateSitemaps,\n exports,\n directives,\n } = checkExports(ast, AppSegmentConfigSchemaKeys, page)\n\n const { type: rsc } = getRSCModuleInformation(content, true)\n\n const exportedConfig: Record<string, unknown> = {}\n if (exports) {\n for (const property of exports) {\n try {\n exportedConfig[property] = extractExportedConstValue(ast, property)\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n }\n }\n }\n\n try {\n exportedConfig.config = extractExportedConstValue(ast, 'config')\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n // `export config` doesn't exist, or other unknown error thrown by swc, silence them\n }\n\n const route = normalizeAppPath(page)\n const config = parseAppSegmentConfig(exportedConfig, route)\n\n // Prevent edge runtime and generateStaticParams in the same file.\n if (isEdgeRuntime(config.runtime) && generateStaticParams) {\n throw new Error(\n `Page \"${page}\" cannot use both \\`export const runtime = 'edge'\\` and export \\`generateStaticParams\\`.`\n )\n }\n\n // Prevent use client and generateStaticParams in the same file.\n if (directives?.has('client') && generateStaticParams) {\n throw new Error(\n `Page \"${page}\" cannot use both \"use client\" and export function \"generateStaticParams()\".`\n )\n }\n\n // Prevent use client and unstable_instant in the same file.\n if (directives?.has('client') && 'unstable_instant' in config) {\n throw new Error(\n `Page \"${page}\" cannot export \"unstable_instant\" from a Client Component module. To use this API, convert this module to a Server Component by removing the \"use client\" directive.`\n )\n }\n\n if ('unstable_instant' in config && !nextConfig.cacheComponents) {\n throw new Error(\n `Page \"${page}\" cannot use \\`export const unstable_instant = ...\\` without enabling \\`cacheComponents\\`.`\n )\n }\n\n return {\n type: PAGE_TYPES.APP,\n rsc,\n generateImageMetadata,\n generateSitemaps,\n generateStaticParams,\n config,\n middleware: parseMiddlewareConfig(page, exportedConfig.config, nextConfig),\n runtime: config.runtime,\n preferredRegion: config.preferredRegion,\n maxDuration: config.maxDuration,\n hadUnsupportedValue,\n }\n}\n\nexport async function getPagesPageStaticInfo({\n pageFilePath,\n nextConfig,\n isDev,\n page,\n}: GetPageStaticInfoParams): Promise<PagesPageStaticInfo> {\n const content = await tryToReadFile(pageFilePath, !isDev)\n if (!content || !PARSE_PATTERN.test(content)) {\n return {\n type: PAGE_TYPES.PAGES,\n config: undefined,\n runtime: undefined,\n preferredRegion: undefined,\n maxDuration: undefined,\n hadUnsupportedValue: false,\n }\n }\n\n const ast = await parseModule(pageFilePath, content)\n validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n })\n\n const { getServerSideProps, getStaticProps, exports } = checkExports(\n ast,\n PagesSegmentConfigSchemaKeys,\n page\n )\n\n const { type: rsc } = getRSCModuleInformation(content, true)\n\n const exportedConfig: Record<string, unknown> = {}\n if (exports) {\n for (const property of exports) {\n try {\n exportedConfig[property] = extractExportedConstValue(ast, property)\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n }\n }\n }\n\n try {\n exportedConfig.config = extractExportedConstValue(ast, 'config')\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n // `export config` doesn't exist, or other unknown error thrown by swc, silence them\n }\n\n // Validate the config.\n const route = normalizePagePath(page)\n const config = parsePagesSegmentConfig(exportedConfig, route)\n const isAnAPIRoute = isAPIRoute(route)\n\n let resolvedRuntime = config.runtime ?? config.config?.runtime\n\n if (isProxyFile(page) && resolvedRuntime) {\n const relativePath = relative(process.cwd(), pageFilePath)\n const resolvedPath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`\n const message = `Route segment config is not allowed in Proxy file at \"${resolvedPath}\". Proxy always runs on Node.js runtime. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n\n if (isDev) {\n // errorOnce as proxy/middleware runs per request including multiple\n // internal _next/ routes and spams logs.\n Log.errorOnce(message)\n resolvedRuntime = SERVER_RUNTIME.nodejs\n } else {\n throw new Error(message)\n }\n }\n\n if (resolvedRuntime === SERVER_RUNTIME.experimentalEdge) {\n warnAboutExperimentalEdge(isAnAPIRoute ? page! : null)\n }\n\n if (\n !isProxyFile(page) &&\n resolvedRuntime === SERVER_RUNTIME.edge &&\n page &&\n !isAnAPIRoute\n ) {\n const message = `Page ${page} provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`\n if (isDev) {\n Log.error(message)\n } else {\n throw new Error(message)\n }\n }\n\n return {\n type: PAGE_TYPES.PAGES,\n getStaticProps,\n getServerSideProps,\n rsc,\n config,\n middleware: parseMiddlewareConfig(page, exportedConfig.config, nextConfig),\n runtime: resolvedRuntime,\n preferredRegion: config.config?.regions,\n maxDuration: config.maxDuration ?? config.config?.maxDuration,\n hadUnsupportedValue,\n }\n}\n\n/**\n * For a given pageFilePath and nextConfig, if the config supports it, this\n * function will read the file and return the runtime that should be used.\n * It will look into the file content only if the page *requires* a runtime\n * to be specified, that is, when gSSP or gSP is used.\n * Related discussion: https://github.com/vercel/next.js/discussions/34179\n */\nexport async function getPageStaticInfo(\n params: GetPageStaticInfoParams\n): Promise<PageStaticInfo> {\n if (params.pageType === PAGE_TYPES.APP) {\n return getAppPageStaticInfo(params)\n }\n\n return getPagesPageStaticInfo(params)\n}\n"],"names":["getAppPageStaticInfo","getMiddlewareMatchers","getPageStaticInfo","getPagesPageStaticInfo","getRSCModuleInformation","PARSE_PATTERN","CLIENT_MODULE_LABEL","ACTION_MODULE_LABEL","CLIENT_DIRECTIVE","SERVER_ACTION_DIRECTIVE","source","isReactServerLayer","actionsJson","match","parsedActionsMeta","JSON","parse","undefined","clientInfoMatch","isClientRef","type","RSC_MODULE_TYPES","client","actionIds","clientRefsString","clientRefs","split","clientEntryType","server","checkExports","ast","expectedExports","page","exportsSet","Set","Array","isArray","body","getStaticProps","getServerSideProps","generateImageMetadata","generateSitemaps","generateStaticParams","exports","directives","hasLeadingNonDirectiveNode","node","expression","directive","value","add","declaration","declarations","includes","id","has","identifier","specifier","specifiers","orig","Log","warn","validateMiddlewareProxyExports","pageFilePath","isDev","isMiddleware","MIDDLEWARE_FILENAME","isProxy","PROXY_FILENAME","fileName","hasDefaultExport","hasMiddlewareExport","hasProxyExport","exportedIdentifier","exported","hasValidExport","relativePath","relative","process","cwd","resolvedPath","startsWith","message","errorOnce","Error","tryToReadFile","filePath","shouldThrow","fs","readFile","encoding","error","matcherOrMatchers","nextConfig","matchers","i18n","map","matcher","originalSource","rest","isRoot","locales","locale","basePath","result","SourceSchema","safeParse","success","reportZodError","exit","regexp","tryToParsePath","data","regexStr","parseMiddlewareConfig","rawConfig","input","MiddlewareConfigInputSchema","config","unstable_allowDynamic","regions","apiRouteWarnings","LRUCache","warnAboutExperimentalEdge","apiRoute","env","NODE_ENV","NEXT_PRIVATE_BUILD_WORKER","set","hadUnsupportedValue","warnedUnsupportedValueMap","warnAboutUnsupportedValue","isProductionBuild","NEXT_COMPILER_NAME","path","content","test","PAGE_TYPES","APP","runtime","preferredRegion","maxDuration","parseModule","AppSegmentConfigSchemaKeys","rsc","exportedConfig","property","extractExportedConstValue","e","UnsupportedValueError","route","normalizeAppPath","parseAppSegmentConfig","isEdgeRuntime","cacheComponents","middleware","PAGES","PagesSegmentConfigSchemaKeys","normalizePagePath","parsePagesSegmentConfig","isAnAPIRoute","isAPIRoute","resolvedRuntime","isProxyFile","SERVER_RUNTIME","nodejs","experimentalEdge","edge","params","pageType"],"mappings":";;;;;;;;;;;;;;;;;;IAmmBsBA,oBAAoB;eAApBA;;IAtKNC,qBAAqB;eAArBA;;IAoYMC,iBAAiB;eAAjBA;;IAvHAC,sBAAsB;eAAtBA;;IA9kBNC,uBAAuB;eAAvBA;;;oBAzHe;sBACN;0BACA;mCAIlB;6BACqB;6DACP;2BAKd;gCACwB;4BACJ;+BACG;4BACG;2BAEN;kCAKpB;qBACwB;oCAMxB;kCAKA;0BAC0B;mCACC;uBACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE5B,MAAMC,g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BAAeuB,WAAW;QAC7DZ;IACF;AACF;AASO,eAAe/H,kBACpBsK,MAA+B;IAE/B,IAAIA,OAAOC,QAAQ,KAAKhC,qBAAU,CAACC,GAAG,EAAE;QACtC,OAAO1I,qBAAqBwK;IAC9B;IAEA,OAAOrK,uBAAuBqK;AAChC","ignoreList":[0]}
{"version":3,"sources":["../../../src/build/analysis/get-page-static-info.ts"],"sourcesContent":["import type { NextConfig } from '../../server/config-shared'\nimport type { RouteHas } from '../../lib/load-custom-routes'\n\nimport { readFileSync } from 'fs'\nimport { relative } from 'path'\nimport { LRUCache } from '../../server/lib/lru-cache'\nimport {\n extractExportedConstValue,\n UnsupportedValueError,\n} from './extract-const-value'\nimport { parseModule } from './parse-module'\nimport * as Log from '../output/log'\nimport {\n SERVER_RUNTIME,\n MIDDLEWARE_FILENAME,\n PROXY_FILENAME,\n} from '../../lib/constants'\nimport { tryToParsePath } from '../../lib/try-to-parse-path'\nimport { isAPIRoute } from '../../lib/is-api-route'\nimport { isEdgeRuntime } from '../../lib/is-edge-runtime'\nimport { RSC_MODULE_TYPES } from '../../shared/lib/constants'\nimport type { RSCMeta } from '../webpack/loaders/get-module-build-info'\nimport { PAGE_TYPES } from '../../lib/page-types'\nimport {\n AppSegmentConfigSchemaKeys,\n parseAppSegmentConfig,\n type AppSegmentConfig,\n} from '../segment-config/app/app-segment-config'\nimport { reportZodError } from '../../shared/lib/zod'\nimport {\n PagesSegmentConfigSchemaKeys,\n parsePagesSegmentConfig,\n type PagesSegmentConfig,\n type PagesSegmentConfigConfig,\n} from '../segment-config/pages/pages-segment-config'\nimport {\n MiddlewareConfigInputSchema,\n SourceSchema,\n type MiddlewareConfigMatcherInput,\n} from '../segment-config/middleware/middleware-config'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isProxyFile } from '../utils'\n\nconst PARSE_PATTERN =\n /(?<!(_jsx|jsx-))runtime|preferredRegion|getStaticProps|getServerSideProps|generateStaticParams|export const|generateImageMetadata|generateSitemaps|middleware|proxy/\n\nexport type ProxyMatcher = {\n regexp: string\n locale?: false\n has?: RouteHas[]\n missing?: RouteHas[]\n originalSource: string\n}\n\nexport type ProxyConfig = {\n /**\n * The matcher for the proxy. Read more: [Next.js Docs: Proxy `matcher`](https://nextjs.org/docs/app/api-reference/file-conventions/proxy#matcher),\n * [Next.js Docs: Proxy matching paths](https://nextjs.org/docs/app/building-your-application/routing/proxy#matching-paths)\n */\n matchers?: ProxyMatcher[]\n\n /**\n * The regions that the proxy should run in.\n */\n regions?: string | string[]\n\n /**\n * A glob, or an array of globs, ignoring dynamic code evaluation for specific\n * files. The globs are relative to your application root folder.\n */\n unstable_allowDynamic?: string[]\n}\n\nexport interface AppPageStaticInfo {\n type: PAGE_TYPES.APP\n ssg?: boolean\n ssr?: boolean\n rsc?: RSCModuleType\n generateStaticParams?: boolean\n generateSitemaps?: boolean\n generateImageMetadata?: boolean\n middleware?: ProxyConfig\n config: Omit<AppSegmentConfig, 'runtime' | 'maxDuration'> | undefined\n runtime: AppSegmentConfig['runtime'] | undefined\n preferredRegion: AppSegmentConfig['preferredRegion'] | undefined\n maxDuration: number | undefined\n hadUnsupportedValue: boolean\n}\n\nexport interface PagesPageStaticInfo {\n type: PAGE_TYPES.PAGES\n getStaticProps?: boolean\n getServerSideProps?: boolean\n rsc?: RSCModuleType\n generateStaticParams?: boolean\n generateSitemaps?: boolean\n generateImageMetadata?: boolean\n middleware?: ProxyConfig\n config:\n | (Omit<PagesSegmentConfig, 'runtime' | 'config' | 'maxDuration'> & {\n config?: Omit<PagesSegmentConfigConfig, 'runtime' | 'maxDuration'>\n })\n | undefined\n runtime: PagesSegmentConfig['runtime'] | undefined\n preferredRegion: PagesSegmentConfigConfig['regions'] | undefined\n maxDuration: number | undefined\n hadUnsupportedValue: boolean\n}\n\nexport type PageStaticInfo = AppPageStaticInfo | PagesPageStaticInfo\n\nconst CLIENT_MODULE_LABEL =\n /\\/\\* __next_internal_client_entry_do_not_use__ ([^ ]*) (cjs|auto) \\*\\//\n\n// Match JSON object that may contain nested objects (for loc info)\n// The JSON ends right before the closing \" */\"\nconst ACTION_MODULE_LABEL =\n /\\/\\* __next_internal_action_entry_do_not_use__ (\\{.*\\}) \\*\\//\n\nconst CLIENT_DIRECTIVE = 'use client'\nconst SERVER_ACTION_DIRECTIVE = 'use server'\n\nexport type RSCModuleType = 'server' | 'client'\nexport function getRSCModuleInformation(\n source: string,\n isReactServerLayer: boolean\n): RSCMeta {\n const actionsJson = source.match(ACTION_MODULE_LABEL)\n // Parse action metadata - supports both old format (string) and new format (object with loc)\n const parsedActionsMeta = actionsJson\n ? (JSON.parse(actionsJson[1]) as RSCMeta['actionIds'])\n : undefined\n const clientInfoMatch = source.match(CLIENT_MODULE_LABEL)\n const isClientRef = !!clientInfoMatch\n\n if (!isReactServerLayer) {\n return {\n type: RSC_MODULE_TYPES.client,\n actionIds: parsedActionsMeta,\n isClientRef,\n }\n }\n\n const clientRefsString = clientInfoMatch?.[1]\n const clientRefs = clientRefsString ? clientRefsString.split(',') : []\n const clientEntryType = clientInfoMatch?.[2] as 'cjs' | 'auto' | undefined\n\n const type = clientInfoMatch\n ? RSC_MODULE_TYPES.client\n : RSC_MODULE_TYPES.server\n\n return {\n type,\n actionIds: parsedActionsMeta,\n clientRefs,\n clientEntryType,\n isClientRef,\n }\n}\n\n/**\n * Receives a parsed AST from SWC and checks if it belongs to a module that\n * requires a runtime to be specified. Those are:\n * - Modules with `export function getStaticProps | getServerSideProps`\n * - Modules with `export { getStaticProps | getServerSideProps } <from ...>`\n * - Modules with `export const runtime = ...`\n */\nfunction checkExports(\n ast: any,\n expectedExports: string[],\n page: string\n): {\n getStaticProps?: boolean\n getServerSideProps?: boolean\n generateImageMetadata?: boolean\n generateSitemaps?: boolean\n generateStaticParams?: boolean\n directives?: Set<string>\n exports?: Set<string>\n} {\n const exportsSet = new Set<string>([\n 'getStaticProps',\n 'getServerSideProps',\n 'generateImageMetadata',\n 'generateSitemaps',\n 'generateStaticParams',\n ])\n if (!Array.isArray(ast?.body)) {\n return {}\n }\n\n try {\n let getStaticProps: boolean = false\n let getServerSideProps: boolean = false\n let generateImageMetadata: boolean = false\n let generateSitemaps: boolean = false\n let generateStaticParams = false\n let exports = new Set<string>()\n let directives = new Set<string>()\n let hasLeadingNonDirectiveNode = false\n\n for (const node of ast.body) {\n // There should be no non-string literals nodes before directives\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'StringLiteral'\n ) {\n if (!hasLeadingNonDirectiveNode) {\n const directive = node.expression.value\n if (CLIENT_DIRECTIVE === directive) {\n directives.add('client')\n }\n if (SERVER_ACTION_DIRECTIVE === directive) {\n directives.add('server')\n }\n }\n } else {\n hasLeadingNonDirectiveNode = true\n }\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n for (const declaration of node.declaration?.declarations) {\n if (expectedExports.includes(declaration.id.value)) {\n exports.add(declaration.id.value)\n }\n }\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration' &&\n exportsSet.has(node.declaration.identifier?.value)\n ) {\n const id = node.declaration.identifier.value\n getServerSideProps = id === 'getServerSideProps'\n getStaticProps = id === 'getStaticProps'\n generateImageMetadata = id === 'generateImageMetadata'\n generateSitemaps = id === 'generateSitemaps'\n generateStaticParams = id === 'generateStaticParams'\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n const id = node.declaration?.declarations[0]?.id.value\n if (exportsSet.has(id)) {\n getServerSideProps = id === 'getServerSideProps'\n getStaticProps = id === 'getStaticProps'\n generateImageMetadata = id === 'generateImageMetadata'\n generateSitemaps = id === 'generateSitemaps'\n generateStaticParams = id === 'generateStaticParams'\n }\n }\n\n if (node.type === 'ExportNamedDeclaration') {\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.orig?.type === 'Identifier'\n ) {\n const value = specifier.orig.value\n\n if (!getServerSideProps && value === 'getServerSideProps') {\n getServerSideProps = true\n }\n if (!getStaticProps && value === 'getStaticProps') {\n getStaticProps = true\n }\n if (!generateImageMetadata && value === 'generateImageMetadata') {\n generateImageMetadata = true\n }\n if (!generateSitemaps && value === 'generateSitemaps') {\n generateSitemaps = true\n }\n if (!generateStaticParams && value === 'generateStaticParams') {\n generateStaticParams = true\n }\n if (expectedExports.includes(value) && !exports.has(value)) {\n // An export was found that was actually a re-export, and not a\n // literal value. We should warn here.\n Log.warn(\n `Next.js can't recognize the exported \\`${value}\\` field in \"${page}\", it may be re-exported from another file. The default config will be used instead.`\n )\n }\n }\n }\n }\n }\n\n return {\n getStaticProps,\n getServerSideProps,\n generateImageMetadata,\n generateSitemaps,\n generateStaticParams,\n directives,\n exports,\n }\n } catch {}\n\n return {}\n}\n\nfunction validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n}: {\n ast: any\n page: string\n pageFilePath: string\n isDev: boolean\n}): void {\n // Check if this is middleware/proxy\n const isMiddleware =\n page === `/${MIDDLEWARE_FILENAME}` || page === `/src/${MIDDLEWARE_FILENAME}`\n const isProxy =\n page === `/${PROXY_FILENAME}` || page === `/src/${PROXY_FILENAME}`\n\n if (!isMiddleware && !isProxy) {\n return\n }\n\n if (!ast || !Array.isArray(ast.body)) {\n return\n }\n\n const fileName = isProxy ? PROXY_FILENAME : MIDDLEWARE_FILENAME\n\n // Parse AST to get export info (since checkExports doesn't return middleware/proxy info)\n let hasDefaultExport = false\n let hasMiddlewareExport = false\n let hasProxyExport = false\n\n for (const node of ast.body) {\n if (\n node.type === 'ExportDefaultDeclaration' ||\n node.type === 'ExportDefaultExpression'\n ) {\n hasDefaultExport = true\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration'\n ) {\n const id = node.declaration.identifier?.value\n if (id === 'middleware') {\n hasMiddlewareExport = true\n }\n if (id === 'proxy') {\n hasProxyExport = true\n }\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n const id = node.declaration?.declarations[0]?.id.value\n if (id === 'middleware') {\n hasMiddlewareExport = true\n }\n if (id === 'proxy') {\n hasProxyExport = true\n }\n }\n\n if (node.type === 'ExportNamedDeclaration') {\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.orig?.type === 'Identifier'\n ) {\n // Use the exported name if it exists (for aliased exports like `export { foo as proxy }`),\n // otherwise fall back to the original name (for simple re-exports like `export { proxy }`)\n const exportedIdentifier = specifier.exported || specifier.orig\n const value = exportedIdentifier.value\n if (value === 'middleware') {\n hasMiddlewareExport = true\n }\n if (value === 'proxy') {\n hasProxyExport = true\n }\n }\n }\n }\n }\n\n const hasValidExport =\n hasDefaultExport ||\n (isMiddleware && hasMiddlewareExport) ||\n (isProxy && hasProxyExport)\n\n const relativePath = relative(process.cwd(), pageFilePath)\n const resolvedPath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`\n\n if (!hasValidExport) {\n const message =\n `The file \"${resolvedPath}\" must export a function, either as a default export or as a named \"${fileName}\" export.\\n` +\n `This function is what Next.js runs for every request handled by this ${fileName === 'proxy' ? 'proxy (previously called middleware)' : 'middleware'}.\\n\\n` +\n `Why this happens:\\n` +\n (isProxy\n ? \"- You are migrating from `middleware` to `proxy`, but haven't updated the exported function.\\n\"\n : '') +\n `- The file exists but doesn't export a function.\\n` +\n `- The export is not a function (e.g., an object or constant).\\n` +\n `- There's a syntax error preventing the export from being recognized.\\n\\n` +\n `To fix it:\\n` +\n `- Ensure this file has either a default or \"${fileName}\" function export.\\n\\n` +\n `Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n\n if (isDev) {\n // errorOnce as proxy/middleware runs per request including multiple\n // internal _next/ routes and spams logs.\n Log.errorOnce(message)\n } else {\n throw new Error(message)\n }\n }\n}\n\nfunction tryToReadFile(filePath: string, shouldThrow: boolean) {\n try {\n return readFileSync(filePath, {\n encoding: 'utf8',\n })\n } catch (error: any) {\n if (shouldThrow) {\n error.message = `Next.js ERROR: Failed to read file ${filePath}:\\n${error.message}`\n throw error\n }\n }\n}\n\n/**\n * @internal - required to exclude zod types from the build\n */\nexport function getMiddlewareMatchers(\n matcherOrMatchers: MiddlewareConfigMatcherInput,\n nextConfig: Pick<NextConfig, 'basePath' | 'i18n'>\n): ProxyMatcher[] {\n const matchers = Array.isArray(matcherOrMatchers)\n ? matcherOrMatchers\n : [matcherOrMatchers]\n\n const { i18n } = nextConfig\n\n return matchers.map((matcher) => {\n matcher = typeof matcher === 'string' ? { source: matcher } : matcher\n\n const originalSource = matcher.source\n\n let { source, ...rest } = matcher\n\n const isRoot = source === '/'\n\n if (i18n?.locales && matcher.locale !== false) {\n source = `/:nextInternalLocale((?!_next/)[^/.]{1,})${\n isRoot ? '' : source\n }`\n }\n\n source = `/:nextData(_next/data/[^/]{1,})?${source}${\n isRoot\n ? `(${nextConfig.i18n ? '|\\\\.json|' : ''}/?index|/?index\\\\.json)?`\n : '{(\\\\.json)}?'\n }`\n\n if (nextConfig.basePath) {\n source = `${nextConfig.basePath}${source}`\n }\n\n // Validate that the source is still.\n const result = SourceSchema.safeParse(source)\n if (!result.success) {\n reportZodError('Failed to parse middleware source', result.error)\n\n // We need to exit here because middleware being built occurs before we\n // finish setting up the server. Exiting here is the only way to ensure\n // that we don't hang.\n process.exit(1)\n }\n\n return {\n ...rest,\n // We know that parsed.regexStr is not undefined because we already\n // checked that the source is valid.\n regexp: tryToParsePath(result.data).regexStr!,\n originalSource: originalSource || source,\n }\n })\n}\n\nfunction parseMiddlewareConfig(\n page: string,\n rawConfig: unknown,\n nextConfig: NextConfig\n): ProxyConfig {\n // If there's no config to parse, then return nothing.\n if (typeof rawConfig !== 'object' || !rawConfig) return {}\n\n const input = MiddlewareConfigInputSchema.safeParse(rawConfig)\n if (!input.success) {\n reportZodError(`${page} contains invalid middleware config`, input.error)\n\n // We need to exit here because middleware being built occurs before we\n // finish setting up the server. Exiting here is the only way to ensure\n // that we don't hang.\n process.exit(1)\n }\n\n const config: ProxyConfig = {}\n\n if (input.data.matcher) {\n config.matchers = getMiddlewareMatchers(input.data.matcher, nextConfig)\n }\n\n if (input.data.unstable_allowDynamic) {\n config.unstable_allowDynamic = Array.isArray(\n input.data.unstable_allowDynamic\n )\n ? input.data.unstable_allowDynamic\n : [input.data.unstable_allowDynamic]\n }\n\n if (input.data.regions) {\n config.regions = input.data.regions\n }\n\n return config\n}\n\nconst apiRouteWarnings = new LRUCache(250)\nfunction warnAboutExperimentalEdge(apiRoute: string | null) {\n if (\n process.env.NODE_ENV === 'production' &&\n process.env.NEXT_PRIVATE_BUILD_WORKER === '1'\n ) {\n return\n }\n\n if (apiRoute && apiRouteWarnings.has(apiRoute)) {\n return\n }\n\n Log.warn(\n apiRoute\n ? `${apiRoute} provided runtime 'experimental-edge'. It can be updated to 'edge' instead.`\n : `You are using an experimental edge runtime, the API might change.`\n )\n\n if (apiRoute) {\n apiRouteWarnings.set(apiRoute, 1)\n }\n}\n\nlet hadUnsupportedValue = false\nconst warnedUnsupportedValueMap = new LRUCache<boolean>(250, () => 1)\n\nfunction warnAboutUnsupportedValue(\n pageFilePath: string,\n page: string | undefined,\n error: UnsupportedValueError\n) {\n hadUnsupportedValue = true\n const isProductionBuild = process.env.NODE_ENV === 'production'\n if (\n // we only log for the server compilation so it's not\n // duplicated due to webpack build worker having fresh\n // module scope for each compiler\n process.env.NEXT_COMPILER_NAME !== 'server' ||\n (isProductionBuild && warnedUnsupportedValueMap.has(pageFilePath))\n ) {\n return\n }\n warnedUnsupportedValueMap.set(pageFilePath, true)\n\n const message =\n `Next.js can't recognize the exported \\`config\\` field in ` +\n (page ? `route \"${page}\"` : `\"${pageFilePath}\"`) +\n ':\\n' +\n error.message +\n (error.path ? ` at \"${error.path}\"` : '') +\n '.\\n' +\n 'Read More - https://nextjs.org/docs/messages/invalid-page-config'\n\n // for a build we use `Log.error` instead of throwing\n // so that all errors can be logged before exiting the process\n if (isProductionBuild) {\n Log.error(message)\n } else {\n throw new Error(message)\n }\n}\n\ntype GetPageStaticInfoParams = {\n pageFilePath: string\n nextConfig: Partial<NextConfig>\n isDev: boolean\n page: string\n pageType: PAGE_TYPES\n}\n\nexport async function getAppPageStaticInfo({\n pageFilePath,\n nextConfig,\n isDev,\n page,\n}: GetPageStaticInfoParams): Promise<AppPageStaticInfo> {\n const content = tryToReadFile(pageFilePath, !isDev)\n if (!content || !PARSE_PATTERN.test(content)) {\n return {\n type: PAGE_TYPES.APP,\n config: undefined,\n runtime: undefined,\n preferredRegion: undefined,\n maxDuration: undefined,\n hadUnsupportedValue: false,\n }\n }\n\n const ast = await parseModule(pageFilePath, content)\n validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n })\n\n const {\n generateStaticParams,\n generateImageMetadata,\n generateSitemaps,\n exports,\n directives,\n } = checkExports(ast, AppSegmentConfigSchemaKeys, page)\n\n const { type: rsc } = getRSCModuleInformation(content, true)\n\n const exportedConfig: Record<string, unknown> = {}\n if (exports) {\n for (const property of exports) {\n try {\n exportedConfig[property] = extractExportedConstValue(ast, property)\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n }\n }\n }\n\n try {\n exportedConfig.config = extractExportedConstValue(ast, 'config')\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n // `export config` doesn't exist, or other unknown error thrown by swc, silence them\n }\n\n const route = normalizeAppPath(page)\n const config = parseAppSegmentConfig(exportedConfig, route)\n\n // Prevent edge runtime and generateStaticParams in the same file.\n if (isEdgeRuntime(config.runtime) && generateStaticParams) {\n throw new Error(\n `Page \"${page}\" cannot use both \\`export const runtime = 'edge'\\` and export \\`generateStaticParams\\`.`\n )\n }\n\n // Prevent use client and generateStaticParams in the same file.\n if (directives?.has('client') && generateStaticParams) {\n throw new Error(\n `Page \"${page}\" cannot use both \"use client\" and export function \"generateStaticParams()\".`\n )\n }\n\n // Prevent use client and unstable_instant in the same file.\n if (directives?.has('client') && 'unstable_instant' in config) {\n throw new Error(\n `Page \"${page}\" cannot export \"unstable_instant\" from a Client Component module. To use this API, convert this module to a Server Component by removing the \"use client\" directive.`\n )\n }\n\n if ('unstable_instant' in config && !nextConfig.cacheComponents) {\n throw new Error(\n `Page \"${page}\" cannot use \\`export const unstable_instant = ...\\` without enabling \\`cacheComponents\\`.`\n )\n }\n\n return {\n type: PAGE_TYPES.APP,\n rsc,\n generateImageMetadata,\n generateSitemaps,\n generateStaticParams,\n config,\n middleware: parseMiddlewareConfig(page, exportedConfig.config, nextConfig),\n runtime: config.runtime,\n preferredRegion: config.preferredRegion,\n maxDuration: config.maxDuration,\n hadUnsupportedValue,\n }\n}\n\nexport async function getPagesPageStaticInfo({\n pageFilePath,\n nextConfig,\n isDev,\n page,\n}: GetPageStaticInfoParams): Promise<PagesPageStaticInfo> {\n const content = tryToReadFile(pageFilePath, !isDev)\n if (!content || !PARSE_PATTERN.test(content)) {\n return {\n type: PAGE_TYPES.PAGES,\n config: undefined,\n runtime: undefined,\n preferredRegion: undefined,\n maxDuration: undefined,\n hadUnsupportedValue: false,\n }\n }\n\n const ast = await parseModule(pageFilePath, content)\n validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n })\n\n const { getServerSideProps, getStaticProps, exports } = checkExports(\n ast,\n PagesSegmentConfigSchemaKeys,\n page\n )\n\n const { type: rsc } = getRSCModuleInformation(content, true)\n\n const exportedConfig: Record<string, unknown> = {}\n if (exports) {\n for (const property of exports) {\n try {\n exportedConfig[property] = extractExportedConstValue(ast, property)\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n }\n }\n }\n\n try {\n exportedConfig.config = extractExportedConstValue(ast, 'config')\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n // `export config` doesn't exist, or other unknown error thrown by swc, silence them\n }\n\n // Validate the config.\n const route = normalizePagePath(page)\n const config = parsePagesSegmentConfig(exportedConfig, route)\n const isAnAPIRoute = isAPIRoute(route)\n\n let resolvedRuntime = config.runtime ?? config.config?.runtime\n\n if (isProxyFile(page) && resolvedRuntime) {\n const relativePath = relative(process.cwd(), pageFilePath)\n const resolvedPath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`\n const message = `Route segment config is not allowed in Proxy file at \"${resolvedPath}\". Proxy always runs on Node.js runtime. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n\n if (isDev) {\n // errorOnce as proxy/middleware runs per request including multiple\n // internal _next/ routes and spams logs.\n Log.errorOnce(message)\n resolvedRuntime = SERVER_RUNTIME.nodejs\n } else {\n throw new Error(message)\n }\n }\n\n if (resolvedRuntime === SERVER_RUNTIME.experimentalEdge) {\n warnAboutExperimentalEdge(isAnAPIRoute ? page! : null)\n }\n\n if (\n !isProxyFile(page) &&\n resolvedRuntime === SERVER_RUNTIME.edge &&\n page &&\n !isAnAPIRoute\n ) {\n const message = `Page ${page} provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`\n if (isDev) {\n Log.error(message)\n } else {\n throw new Error(message)\n }\n }\n\n return {\n type: PAGE_TYPES.PAGES,\n getStaticProps,\n getServerSideProps,\n rsc,\n config,\n middleware: parseMiddlewareConfig(page, exportedConfig.config, nextConfig),\n runtime: resolvedRuntime,\n preferredRegion: config.config?.regions,\n maxDuration: config.maxDuration ?? config.config?.maxDuration,\n hadUnsupportedValue,\n }\n}\n\n/**\n * For a given pageFilePath and nextConfig, if the config supports it, this\n * function will read the file and return the runtime that should be used.\n * It will look into the file content only if the page *requires* a runtime\n * to be specified, that is, when gSSP or gSP is used.\n * Related discussion: https://github.com/vercel/next.js/discussions/34179\n */\nexport async function getPageStaticInfo(\n params: GetPageStaticInfoParams\n): Promise<PageStaticInfo> {\n if (params.pageType === PAGE_TYPES.APP) {\n return getAppPageStaticInfo(params)\n }\n\n return getPagesPageStaticInfo(params)\n}\n"],"names":["getAppPageStaticInfo","getMiddlewareMatchers","getPageStaticInfo","getPagesPageStaticInfo","getRSCModuleInformation","PARSE_PATTERN","CLIENT_MODULE_LABEL","ACTION_MODULE_LABEL","CLIENT_DIRECTIVE","SERVER_ACTION_DIRECTIVE","source","isReactServerLayer","actionsJson","match","parsedActionsMeta","JSON","parse","undefined","clientInfoMatch","isClientRef","type","RSC_MODULE_TYPES","client","actionIds","clientRefsString","clientRefs","split","clientEntryType","server","checkExports","ast","expectedExports","page","exportsSet","Set","Array","isArray","body","getStaticProps","getServerSideProps","generateImageMetadata","generateSitemaps","generateStaticParams","exports","directives","hasLeadingNonDirectiveNode","node","expression","directive","value","add","declaration","declarations","includes","id","has","identifier","specifier","specifiers","orig","Log","warn","validateMiddlewareProxyExports","pageFilePath","isDev","isMiddleware","MIDDLEWARE_FILENAME","isProxy","PROXY_FILENAME","fileName","hasDefaultExport","hasMiddlewareExport","hasProxyExport","exportedIdentifier","exported","hasValidExport","relativePath","relative","process","cwd","resolvedPath","startsWith","message","errorOnce","Error","tryToReadFile","filePath","shouldThrow","readFileSync","encoding","error","matcherOrMatchers","nextConfig","matchers","i18n","map","matcher","originalSource","rest","isRoot","locales","locale","basePath","result","SourceSchema","safeParse","success","reportZodError","exit","regexp","tryToParsePath","data","regexStr","parseMiddlewareConfig","rawConfig","input","MiddlewareConfigInputSchema","config","unstable_allowDynamic","regions","apiRouteWarnings","LRUCache","warnAboutExperimentalEdge","apiRoute","env","NODE_ENV","NEXT_PRIVATE_BUILD_WORKER","set","hadUnsupportedValue","warnedUnsupportedValueMap","warnAboutUnsupportedValue","isProductionBuild","NEXT_COMPILER_NAME","path","content","test","PAGE_TYPES","APP","runtime","preferredRegion","maxDuration","parseModule","AppSegmentConfigSchemaKeys","rsc","exportedConfig","property","extractExportedConstValue","e","UnsupportedValueError","route","normalizeAppPath","parseAppSegmentConfig","isEdgeRuntime","cacheComponents","middleware","PAGES","PagesSegmentConfigSchemaKeys","normalizePagePath","parsePagesSegmentConfig","isAnAPIRoute","isAPIRoute","resolvedRuntime","isProxyFile","SERVER_RUNTIME","nodejs","experimentalEdge","edge","params","pageType"],"mappings":";;;;;;;;;;;;;;;;;;IAmmBsBA,oBAAoB;eAApBA;;IAtKNC,qBAAqB;eAArBA;;IAoYMC,iBAAiB;eAAjBA;;IAvHAC,sBAAsB;eAAtBA;;IA9kBNC,uBAAuB;eAAvBA;;;oBAzHa;sBACJ;0BACA;mCAIlB;6BACqB;6DACP;2BAKd;gCACwB;4BACJ;+BACG;4BACG;2BAEN;kCAKpB;qBACwB;oCAMxB;kCAKA;0BAC0B;mCACC;uBACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE5B,MAAMC,gBACJ;AAmEF,MAAMC,sBACJ;AAEF,mEAAmE;AACnE,+CAA+C;AAC/C,MAAMC,sBACJ;AAEF,MAAMC,mBAAmB;AACzB,MAAMC,0BAA0B;AAGzB,SAASL,wBACdM,MAAc,EACdC,kBAA2B;IAE3B,MAAMC,cAAcF,OAAOG,KAAK,CAACN;IACjC,6FAA6F;IAC7F,MAAMO,oBAAoBF,cACrBG,KAAKC,KAAK,CAACJ,WAAW,CAAC,EAAE,IAC1BK;IACJ,MAAMC,kBAAkBR,OAAOG,KAAK,CAACP;IACrC,MAAMa,cAAc,CAAC,CAACD;IAEtB,IAAI,CAACP,oBAAoB;QACvB,OAAO;YACLS,MAAMC,4BAAgB,CAACC,MAAM;YAC7BC,WAAWT;YACXK;QACF;IACF;IAEA,MAAMK,mBAAmBN,mCAAAA,eAAiB,CAAC,EAAE;IAC7C,MAAMO,aAAaD,mBAAmBA,iBAAiBE,KAAK,CAAC,OAAO,EAAE;IACtE,MAAMC,kBAAkBT,mCAAAA,eAAiB,CAAC,EAAE;IAE5C,MAAME,OAAOF,kBACTG,4BAAgB,CAACC,MAAM,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,IACvCtI,QACA,CAAC+H,cACD;QACA,MAAM7E,UAAU,CAAC,KAAK,EAAElD,KAAK,4HAA4H,CAAC;QAC1J,IAAIgC,OAAO;YACTJ,KAAI8B,KAAK,CAACR;QACZ,OAAO;YACL,MAAM,qBAAkB,CAAlB,IAAIE,MAAMF,UAAV,qBAAA;uBAAA;4BAAA;8BAAA;YAAiB;QACzB;IACF;IAEA,OAAO;QACL9D,MAAMoH,qBAAU,CAACmB,KAAK;QACtBrH;QACAC;QACAwG;QACA1B;QACAqC,YAAYzC,sBAAsBjF,MAAMgH,eAAe3B,MAAM,EAAEzB;QAC/D8C,SAASuB;QACTtB,eAAe,GAAEtB,kBAAAA,OAAOA,MAAM,qBAAbA,gBAAeE,OAAO;QACvCqB,aAAavB,OAAOuB,WAAW,MAAIvB,kBAAAA,OAAOA,MAAM,qBAAbA,gBAAeuB,WAAW;QAC7DZ;IACF;AACF;AASO,eAAe9H,kBACpBqK,MAA+B;IAE/B,IAAIA,OAAOC,QAAQ,KAAKhC,qBAAU,CAACC,GAAG,EAAE;QACtC,OAAOzI,qBAAqBuK;IAC9B;IAEA,OAAOpK,uBAAuBoK;AAChC","ignoreList":[0]}

@@ -84,9 +84,3 @@ "use strict";

const _log = /*#__PURE__*/ _interop_require_wildcard(require("../output/log"));
const _options = require("./options");
const _swcloadfailure = require("../../telemetry/events/swc-load-failure");
const _patchincorrectlockfile = require("../../lib/patch-incorrect-lockfile");
const _downloadswc = require("../../lib/download-swc");
const _util = require("util");
const _defineenv = require("../define-env");
const _internalerror = require("../../shared/lib/turbopack/internal-error");
const _loaderWorkerPool = require("./loaderWorkerPool");

@@ -144,3 +138,3 @@ function _interop_require_default(obj) {

}({});
const nextVersion = "16.2.0-canary.72";
const nextVersion = "16.2.0-canary.73";
const ArchName = (0, _os.arch)();

@@ -283,3 +277,3 @@ const PlatformName = (0, _os.platform)();

// even if it doesn't fail to load locally
lockfilePatchPromise.cur = (0, _patchincorrectlockfile.patchIncorrectLockfile)(process.cwd()).catch(console.error);
lockfilePatchPromise.cur = require('../../lib/patch-incorrect-lockfile').patchIncorrectLockfile(process.cwd()).catch(console.error);
}

@@ -344,3 +338,3 @@ let attempts = [];

if (!downloadNativeBindingsPromise) {
downloadNativeBindingsPromise = (0, _downloadswc.downloadNativeNextSwc)(nextVersion, nativeBindingsDirectory, triples.map((triple)=>triple.platformArchABI));
downloadNativeBindingsPromise = require('../../lib/download-swc').downloadNativeNextSwc(nextVersion, nativeBindingsDirectory, triples.map((triple)=>triple.platformArchABI));
}

@@ -359,4 +353,3 @@ await downloadNativeBindingsPromise;

let bindings = await loadWasm('');
// @ts-expect-error TODO: this event has a wrong type.
(0, _swcloadfailure.eventSwcLoadFailure)({
require('../../telemetry/events/swc-load-failure').eventSwcLoadFailure({
wasm: 'enabled',

@@ -376,8 +369,7 @@ nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode

if (!downloadWasmPromise) {
downloadWasmPromise = (0, _downloadswc.downloadWasmSwc)(nextVersion, wasmDirectory);
downloadWasmPromise = require('../../lib/download-swc').downloadWasmSwc(nextVersion, wasmDirectory);
}
await downloadWasmPromise;
let bindings = await loadWasm(wasmDirectory);
// @ts-expect-error TODO: this event has a wrong type.
(0, _swcloadfailure.eventSwcLoadFailure)({
require('../../telemetry/events/swc-load-failure').eventSwcLoadFailure({
wasm: 'fallback',

@@ -427,4 +419,3 @@ nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode

}
// @ts-expect-error TODO: this event has a wrong type.
await (0, _swcloadfailure.eventSwcLoadFailure)({
await require('../../telemetry/events/swc-load-failure').eventSwcLoadFailure({
wasm: triedWasm ? 'failed' : undefined,

@@ -828,3 +819,3 @@ nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode

function checkLoaderItem(loaderItem, glob) {
if (typeof loaderItem !== 'string' && !(0, _util.isDeepStrictEqual)(loaderItem, JSON.parse(JSON.stringify(loaderItem)))) {
if (typeof loaderItem !== 'string' && !require('util').isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))) {
throw Object.defineProperty(new Error(`loader ${loaderItem.loader} for match "${glob}" does not have serializable options. ` + 'Ensure that options passed are plain JavaScript objects and values.'), "__NEXT_ERROR_CODE", {

@@ -910,3 +901,3 @@ value: "E491",

return new ProjectImpl(await binding.projectNew(await rustifyProjectOptions(options), turboEngineOptions || {}, {
throwTurbopackInternalError: _internalerror.throwTurbopackInternalError,
throwTurbopackInternalError: require('../../shared/lib/turbopack/internal-error').throwTurbopackInternalError,
onBeforeDeferredEntries: callbacks == null ? void 0 : callbacks.onBeforeDeferredEntries

@@ -1305,3 +1296,3 @@ }));

const bindings = getBindingsSync();
const parserOptions = (0, _options.getParserOptions)(options);
const parserOptions = require('./options').getParserOptions(options);
const parsed = await bindings.parse(src, parserOptions);

@@ -1308,0 +1299,0 @@ return JSON.parse(parsed);

@@ -25,7 +25,6 @@ "use strict";

const _turbopackwarning = require("../../lib/turbopack-warning");
const _utils = require("../../shared/lib/turbopack/utils");
const _swc = require("../swc");
const _ciinfo = require("../../server/ci-info");
const _compilationevents = require("../../shared/lib/turbopack/compilation-events");
const _utils1 = require("../utils");
const _getsupportedbrowsers = require("../get-supported-browsers");
const _normalizepath = require("../../lib/normalize-path");

@@ -39,3 +38,3 @@ const _constants = require("../../shared/lib/constants");

async function turbopackAnalyze(analyzeContext) {
var _config_experimental, _config_turbopack, _config_turbopack1, _config_experimental1;
var _config_experimental, _config_experimental1, _config_turbopack, _config_turbopack1, _config_experimental2;
await (0, _turbopackwarning.validateTurboNextConfig)({

@@ -57,4 +56,4 @@ dir: analyzeContext.dir,

const dev = false;
const supportedBrowsers = (0, _utils1.getSupportedBrowsers)(dir, dev);
const persistentCaching = (0, _utils.isFileSystemCacheEnabledForBuild)(config);
const supportedBrowsers = (0, _getsupportedbrowsers.getSupportedBrowsers)(dir, dev);
const persistentCaching = ((_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackFileSystemCacheForBuild) || false;
const rootPath = ((_config_turbopack = config.turbopack) == null ? void 0 : _config_turbopack.root) || config.outputFileTracingRoot || dir;

@@ -99,5 +98,5 @@ const project = await bindings.turbo.createProject({

isPersistentCachingEnabled: persistentCaching,
nextVersion: "16.2.0-canary.72"
nextVersion: "16.2.0-canary.73"
}, {
memoryLimit: (_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackMemoryLimit,
memoryLimit: (_config_experimental2 = config.experimental) == null ? void 0 : _config_experimental2.turbopackMemoryLimit,
dependencyTracking: persistentCaching,

@@ -104,0 +103,0 @@ isCi: _ciinfo.isCI,

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../src/build/turbopack-analyze/index.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport type { __ApiPreviewProps } from '../../server/api-utils'\n\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils'\nimport { createDefineEnv, loadBindings } from '../swc'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../utils'\nimport { normalizePath } from '../../lib/normalize-path'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\n\nexport type AnalyzeContext = {\n config: NextConfigComplete\n distDir: string\n dir: string\n noMangling: boolean\n appDirOnly: boolean\n}\n\nexport async function turbopackAnalyze(\n analyzeContext: AnalyzeContext\n): Promise<{\n duration: number\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: analyzeContext.dir,\n configPhase: PHASE_PRODUCTION_BUILD,\n })\n\n const { config, dir, distDir, noMangling } = analyzeContext\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = await loadBindings(config?.experimental?.useWasmBinary)\n\n if (bindings.isWasm) {\n throw new Error(\n `Turbopack analyze is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n )\n }\n\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const persistentCaching = isFileSystemCacheEnabledForBuild(config)\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n const project = await bindings.turbo.createProject(\n {\n rootPath: config.turbopack?.root || config.outputFileTracingRoot || dir,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites: false,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites: {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n }),\n buildId: 'analyze-build',\n encryptionKey: '',\n previewProps: {\n previewModeId: '',\n previewModeEncryptionKey: '',\n previewModeSigningKey: '',\n },\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n writeRoutesHashesManifest: false,\n currentNodeJsVersion,\n isPersistentCachingEnabled: persistentCaching,\n nextVersion: process.env.__NEXT_VERSION as string,\n },\n {\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching,\n isCi: isCI,\n isShortSession: true,\n }\n )\n\n try {\n backgroundLogCompilationEvents(project)\n\n await project.writeAnalyzeData(analyzeContext.appDirOnly)\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["turbopackAnalyze","waitForShutdown","analyzeContext","config","validateTurboNextConfig","dir","configPhase","PHASE_PRODUCTION_BUILD","distDir","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","loadBindings","experimental","useWasmBinary","isWasm","Error","platform","arch","dev","supportedBrowsers","getSupportedBrowsers","persistentCaching","isFileSystemCacheEnabledForBuild","rootPath","turbopack","root","outputFileTracingRoot","project","turbo","createProject","projectPath","normalizePath","path","relative","nextConfig","watch","enable","env","defineEnv","createDefineEnv","isTurbopack","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","undefined","rewrites","beforeFiles","afterFiles","fallback","buildId","encryptionKey","previewProps","previewModeId","previewModeEncryptionKey","previewModeSigningKey","browserslistQuery","join","writeRoutesHashesManifest","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isCI","isShortSession","backgroundLogCompilationEvents","writeAnalyzeData","appDirOnly","shutdownPromise","shutdown","time","duration","err"],"mappings":";;;;;;;;;;;;;;;IAqBsBA,gBAAgB;eAAhBA;;IAmGAC,eAAe;eAAfA;;;6DArHL;kCACuB;uBACS;qBACH;wBACzB;mCAC0B;wBACV;+BACP;2BACS;;;;;;AAUhC,eAAeD,iBACpBE,cAA8B;QAcMC,sBAenBA,mBAGHA,oBAwCGA;IAnEjB,MAAMC,IAAAA,yCAAuB,EAAC;QAC5BC,KAAKH,eAAeG,GAAG;QACvBC,aAAaC,iCAAsB;IACrC;IAEA,MAAM,EAAEJ,MAAM,EAAEE,GAAG,EAAEG,OAAO,EAAEC,UAAU,EAAE,GAAGP;IAC7C,MAAMQ,uBAAuBC,QAAQC,QAAQ,CAACC,IAAI;IAElD,MAAMC,YAAYH,QAAQI,MAAM;IAChC,MAAMC,WAAW,MAAMC,IAAAA,iBAAY,EAACd,2BAAAA,uBAAAA,OAAQe,YAAY,qBAApBf,qBAAsBgB,aAAa;IAEvE,IAAIH,SAASI,MAAM,EAAE;QACnB,MAAM,qBAIL,CAJK,IAA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C,GAAG,CAACuB,cAAc;IACzC,GACA;QACEC,WAAW,GAAEhE,wBAAAA,OAAOe,YAAY,qBAAnBf,sBAAqBiE,oBAAoB;QACtDC,oBAAoB1C;QACpB2C,MAAMC,YAAI;QACVC,gBAAgB;IAClB;IAGF,IAAI;QACFC,IAAAA,iDAA8B,EAACxC;QAE/B,MAAMA,QAAQyC,gBAAgB,CAACxE,eAAeyE,UAAU;QAExD,MAAMC,kBAAkB3C,QAAQ4C,QAAQ;QAExC,MAAMC,OAAOnE,QAAQI,MAAM,CAACD;QAC5B,OAAO;YACLiE,UAAUD,IAAI,CAAC,EAAE,GAAGA,IAAI,CAAC,EAAE,GAAG;YAC9BF;QACF;IACF,EAAE,OAAOI,KAAK;QACZ,MAAM/C,QAAQ4C,QAAQ;QACtB,MAAMG;IACR;AACF;AAEA,IAAIJ;AACG,eAAe3E;IACpB,IAAI2E,iBAAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../src/build/turbopack-analyze/index.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport type { __ApiPreviewProps } from '../../server/api-utils'\n\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { createDefineEnv, loadBindings } from '../swc'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../get-supported-browsers'\nimport { normalizePath } from '../../lib/normalize-path'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\n\nexport type AnalyzeContext = {\n config: NextConfigComplete\n distDir: string\n dir: string\n noMangling: boolean\n appDirOnly: boolean\n}\n\nexport async function turbopackAnalyze(\n analyzeContext: AnalyzeContext\n): Promise<{\n duration: number\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: analyzeContext.dir,\n configPhase: PHASE_PRODUCTION_BUILD,\n })\n\n const { config, dir, distDir, noMangling } = analyzeContext\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = await loadBindings(config?.experimental?.useWasmBinary)\n\n if (bindings.isWasm) {\n throw new Error(\n `Turbopack analyze is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n )\n }\n\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const persistentCaching =\n config.experimental?.turbopackFileSystemCacheForBuild || false\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n const project = await bindings.turbo.createProject(\n {\n rootPath: config.turbopack?.root || config.outputFileTracingRoot || dir,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites: false,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites: {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n }),\n buildId: 'analyze-build',\n encryptionKey: '',\n previewProps: {\n previewModeId: '',\n previewModeEncryptionKey: '',\n previewModeSigningKey: '',\n },\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n writeRoutesHashesManifest: false,\n currentNodeJsVersion,\n isPersistentCachingEnabled: persistentCaching,\n nextVersion: process.env.__NEXT_VERSION as string,\n },\n {\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching,\n isCi: isCI,\n isShortSession: true,\n }\n )\n\n try {\n backgroundLogCompilationEvents(project)\n\n await project.writeAnalyzeData(analyzeContext.appDirOnly)\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["turbopackAnalyze","waitForShutdown","analyzeContext","config","validateTurboNextConfig","dir","configPhase","PHASE_PRODUCTION_BUILD","distDir","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","loadBindings","experimental","useWasmBinary","isWasm","Error","platform","arch","dev","supportedBrowsers","getSupportedBrowsers","persistentCaching","turbopackFileSystemCacheForBuild","rootPath","turbopack","root","outputFileTracingRoot","project","turbo","createProject","projectPath","normalizePath","path","relative","nextConfig","watch","enable","env","defineEnv","createDefineEnv","isTurbopack","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","undefined","rewrites","beforeFiles","afterFiles","fallback","buildId","encryptionKey","previewProps","previewModeId","previewModeEncryptionKey","previewModeSigningKey","browserslistQuery","join","writeRoutesHashesManifest","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isCI","isShortSession","backgroundLogCompilationEvents","writeAnalyzeData","appDirOnly","shutdownPromise","shutdown","time","duration","err"],"mappings":";;;;;;;;;;;;;;;IAoBsBA,gBAAgB;eAAhBA;;IAoGAC,eAAe;eAAfA;;;6DArHL;kCACuB;qBACM;wBACzB;mCAC0B;sCACV;+BACP;2BACS;;;;;;AAUhC,eAAeD,iBACpBE,cAA8B;QAcMC,sBAelCA,uBACeA,mBAGHA,oBAwCGA;IApEjB,MAAMC,IAAAA,yCAAuB,EAAC;QAC5BC,KAAKH,eAAeG,GAAG;QACvBC,aAAaC,iCAAsB;IACrC;IAEA,MAAM,EAAEJ,MAAM,EAAEE,GAAG,EAAEG,OAAO,EAAEC,UAAU,EAAE,GAAGP;IAC7C,MAAMQ,uBAAuBC,QAAQC,QAAQ,CAACC,IAAI;IAElD,MAAMC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UAAU,EAAE;YACd;QACF;QACAC,SAAS;QACTC,eAAe;QACfC,cAAc;YACZC,eAAe;YACfC,0BAA0B;YAC1BC,uBAAuB;QACzB;QACAC,mBAAmBpC,kBAAkBqC,IAAI,CAAC;QAC1CrD;QACAsD,2BAA2B;QAC3BrD;QACAsD,4BAA4BrC;QAC5BsC,aAAatD,QAAQgC,GAAG,CAACuB,cAAc;IACzC,GACA;QACEC,WAAW,GAAEhE,wBAAAA,OAAOe,YAAY,qBAAnBf,sBAAqBiE,oBAAoB;QACtDC,oBAAoB1C;QACpB2C,MAAMC,YAAI;QACVC,gBAAgB;IAClB;IAGF,IAAI;QACFC,IAAAA,iDAA8B,EAACxC;QAE/B,MAAMA,QAAQyC,gBAAgB,CAACxE,eAAeyE,UAAU;QAExD,MAAMC,kBAAkB3C,QAAQ4C,QAAQ;QAExC,MAAMC,OAAOnE,QAAQI,MAAM,CAACD;QAC5B,OAAO;YACLiE,UAAUD,IAAI,CAAC,EAAE,GAAGA,IAAI,CAAC,EAAE,GAAG;YAC9BF;QACF;IACF,EAAE,OAAOI,KAAK;QACZ,MAAM/C,QAAQ4C,QAAQ;QACtB,MAAMG;IACR;AACF;AAEA,IAAIJ;AACG,eAAe3E;IACpB,IAAI2E,iBAAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}

@@ -31,3 +31,2 @@ // Import cpu-profile first to start profiling early if enabled

const _turbopackwarning = require("../../lib/turbopack-warning");
const _utils = require("../../shared/lib/turbopack/utils");
const _buildcontext = require("../build-context");

@@ -41,3 +40,3 @@ const _swc = require("../swc");

const _config = /*#__PURE__*/ _interop_require_default(require("../../server/config"));
const _utils1 = require("../../export/utils");
const _utils = require("../../export/utils");
const _storage = require("../../telemetry/storage");

@@ -47,3 +46,4 @@ const _trace = require("../../trace");

const _compilationevents = require("../../shared/lib/turbopack/compilation-events");
const _utils2 = require("../utils");
const _getsupportedbrowsers = require("../get-supported-browsers");
const _printbuilderrors = require("../print-build-errors");
const _normalizepath = require("../../lib/normalize-path");

@@ -57,3 +57,3 @@ const _bundler = require("../../lib/bundler");

async function turbopackBuild() {
var _config_experimental_deferredEntries, _config_turbopack, _config_experimental, _config_experimental_sri;
var _config_experimental_deferredEntries, _config_experimental, _config_turbopack, _config_experimental1, _config_experimental_sri;
await (0, _turbopackwarning.validateTurboNextConfig)({

@@ -84,5 +84,5 @@ dir: _buildcontext.NextBuildContext.dir,

const dev = false;
const supportedBrowsers = (0, _utils2.getSupportedBrowsers)(dir, dev);
const supportedBrowsers = (0, _getsupportedbrowsers.getSupportedBrowsers)(dir, dev);
const hasDeferredEntries = (((_config_experimental_deferredEntries = config.experimental.deferredEntries) == null ? void 0 : _config_experimental_deferredEntries.length) ?? 0) > 0;
const persistentCaching = (0, _utils.isFileSystemCacheEnabledForBuild)(config);
const persistentCaching = ((_config_experimental = config.experimental) == null ? void 0 : _config_experimental.turbopackFileSystemCacheForBuild) || false;
const rootPath = ((_config_turbopack = config.turbopack) == null ? void 0 : _config_turbopack.root) || config.outputFileTracingRoot || dir;

@@ -122,6 +122,6 @@ // Shared options for createProject calls

deferredEntries: config.experimental.deferredEntries,
nextVersion: "16.2.0-canary.72"
nextVersion: "16.2.0-canary.73"
};
const sharedTurboOptions = {
memoryLimit: (_config_experimental = config.experimental) == null ? void 0 : _config_experimental.turbopackMemoryLimit,
memoryLimit: (_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackMemoryLimit,
dependencyTracking: persistentCaching || hasDeferredEntries,

@@ -158,3 +158,3 @@ isCi: _ciinfo.isCI,

const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly);
(0, _utils2.printBuildErrors)(entrypoints, dev);
(0, _printbuilderrors.printBuildErrors)(entrypoints, dev);
const routes = entrypoints.routes;

@@ -256,3 +256,3 @@ if (!routes) {

// Ensures the `config.distDir` option is matched.
if ((0, _utils1.hasCustomExportOutput)(_buildcontext.NextBuildContext.config)) {
if ((0, _utils.hasCustomExportOutput)(_buildcontext.NextBuildContext.config)) {
_buildcontext.NextBuildContext.config.distDir = '.next';

@@ -259,0 +259,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["// Import cpu-profile first to start profiling early if enabled\nimport { saveCpuProfile } from '../../server/lib/cpu-profile'\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, getBindingsSync } from '../swc'\nimport { installBindings } from '../swc/install-bindings'\nimport {\n handleRouteType,\n rawEntrypointsToEntrypoints,\n} from '../handle-entrypoints'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport { setGlobal } from '../../trace'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers, printBuildErrors } from '../utils'\nimport { normalizePath } from '../../lib/normalize-path'\nimport type {\n ProjectOptions,\n RawEntrypoints,\n TurbopackResult,\n} from '../swc/types'\nimport { Bundler } from '../../lib/bundler'\n\nexport async function turbopackBuild(): Promise<{\n duration: number\n buildTraceContext: undefined\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: NextBuildContext.dir!,\n configPhase: PHASE_PRODUCTION_BUILD,\n })\n\n const config = NextBuildContext.config!\n const dir = NextBuildContext.dir!\n const distDir = NextBuildContext.distDir!\n const buildId = NextBuildContext.buildId!\n const encryptionKey = NextBuildContext.encryptionKey!\n const previewProps = NextBuildContext.previewProps!\n const hasRewrites = NextBuildContext.hasRewrites!\n const rewrites = NextBuildContext.rewrites!\n const noMangling = NextBuildContext.noMangling!\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = getBindingsSync() // our caller should have already loaded these\n\n if (bindings.isWasm) {\n throw new Error(\n `Turbopack is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n `To build on this platform, use Webpack instead:\\n` +\n ` next build --webpack\\n\\n` +\n `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n )\n }\n\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const hasDeferredEntries =\n (config.experimental.deferredEntries?.length ?? 0) > 0\n\n const persistentCaching = isFileSystemCacheEnabledForBuild(config)\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n\n // Shared options for createProject calls\n const sharedProjectOptions: Omit<ProjectOptions, 'debugBuildPaths'> = {\n rootPath,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters: NextBuildContext.clientRouterFilters!,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites,\n }),\n buildId,\n encryptionKey,\n previewProps,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n writeRoutesHashesManifest:\n !!process.env.NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST,\n currentNodeJsVersion,\n isPersistentCachingEnabled: persistentCaching,\n deferredEntries: config.experimental.deferredEntries,\n nextVersion: process.env.__NEXT_VERSION as string,\n }\n\n const sharedTurboOptions = {\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching || hasDeferredEntries,\n isCi: isCI,\n isShortSession: true,\n }\n\n const sriEnabled = Boolean(config.experimental.sri?.algorithm)\n\n const project = await bindings.turbo.createProject(\n {\n ...sharedProjectOptions,\n debugBuildPaths: NextBuildContext.debugBuildPaths,\n },\n sharedTurboOptions,\n hasDeferredEntries && config.experimental.onBeforeDeferredEntries\n ? {\n onBeforeDeferredEntries: async () => {\n const workerConfig = await loadConfig(PHASE_PRODUCTION_BUILD, dir, {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling:\n NextBuildContext.reactProductionProfiling,\n bundler: Bundler.Turbopack,\n })\n\n await workerConfig.experimental.onBeforeDeferredEntries?.()\n },\n }\n : undefined\n )\n try {\n backgroundLogCompilationEvents(project)\n\n // Write an empty file in a known location to signal this was built with Turbopack\n await fs.writeFile(path.join(distDir, 'turbopack'), '')\n\n await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n await fs.mkdir(path.join(distDir, 'static', buildId), {\n recursive: true,\n })\n await fs.writeFile(\n path.join(distDir, 'package.json'),\n '{\"type\": \"commonjs\"}'\n )\n\n let appDirOnly = NextBuildContext.appDirOnly!\n\n const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly)\n printBuildErrors(entrypoints, dev)\n\n const routes = entrypoints.routes\n if (!routes) {\n // This should never ever happen, there should be an error issue, or the bindings call should\n // have thrown.\n throw new Error(`Turbopack build failed`)\n }\n\n const hasPagesEntries = Array.from(routes.values()).some((route) => {\n if (route.type === 'page' || route.type === 'page-api') {\n return true\n }\n return false\n })\n // If there's no pages entries, then we are in app-dir-only mode\n if (!hasPagesEntries) {\n appDirOnly = true\n }\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n dev: false,\n sriEnabled,\n })\n\n const currentEntrypoints = await rawEntrypointsToEntrypoints(\n entrypoints as TurbopackResult<RawEntrypoints>\n )\n\n const promises: Promise<void>[] = []\n\n if (!appDirOnly) {\n for (const [page, route] of currentEntrypoints.page) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n }\n\n for (const [page, route] of currentEntrypoints.app) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n\n await Promise.all(promises)\n\n await Promise.all([\n // Only load pages router manifests if not app-only\n ...(!appDirOnly\n ? [\n manifestLoader.loadBuildManifest('_app'),\n manifestLoader.loadPagesManifest('_app'),\n manifestLoader.loadFontManifest('_app'),\n manifestLoader.loadPagesManifest('_document'),\n manifestLoader.loadClientBuildManifest('_error'),\n manifestLoader.loadBuildManifest('_error'),\n manifestLoader.loadPagesManifest('_error'),\n manifestLoader.loadFontManifest('_error'),\n ]\n : []),\n entrypoints.instrumentation &&\n manifestLoader.loadMiddlewareManifest(\n 'instrumentation',\n 'instrumentation'\n ),\n entrypoints.middleware &&\n (await manifestLoader.loadMiddlewareManifest(\n 'middleware',\n 'middleware'\n )),\n ])\n\n manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites: rewrites,\n entrypoints: currentEntrypoints,\n })\n\n if (NextBuildContext.analyze) {\n await project.writeAnalyzeData(appDirOnly)\n }\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n buildTraceContext: undefined,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n buildContext: typeof NextBuildContext\n}): Promise<\n Omit<Awaited<ReturnType<typeof turbopackBuild>>, 'shutdownPromise'>\n> {\n // setup new build context from the serialized data passed from the parent\n Object.assign(NextBuildContext, workerData.buildContext)\n\n /// load the config because it's not serializable\n const config = await loadConfig(\n PHASE_PRODUCTION_BUILD,\n NextBuildContext.dir!,\n {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling: NextBuildContext.reactProductionProfiling,\n bundler: Bundler.Turbopack,\n }\n )\n NextBuildContext.config = config\n // Matches handling in build/index.ts\n // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n // Ensures the `config.distDir` option is matched.\n if (hasCustomExportOutput(NextBuildContext.config)) {\n NextBuildContext.config.distDir = '.next'\n }\n\n // Clone the telemetry for worker\n const telemetry = new Telemetry({\n distDir: NextBuildContext.config.distDir,\n })\n setGlobal('telemetry', telemetry)\n // Install bindings early so we can access synchronously later\n await installBindings(config.experimental?.useWasmBinary)\n\n try {\n const {\n shutdownPromise: resultShutdownPromise,\n buildTraceContext,\n duration,\n } = await turbopackBuild()\n shutdownPromise = resultShutdownPromise\n return {\n buildTraceContext,\n duration,\n }\n } finally {\n // Always flush telemetry before worker exits (waits for async operations like setTimeout in debug mode)\n await telemetry.flush()\n // Save CPU profile before worker exits\n await saveCpuProfile()\n }\n}\n\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["turbopackBuild","waitForShutdown","workerMain","config","validateTurboNextConfig","dir","NextBuildContext","configPhase","PHASE_PRODUCTION_BUILD","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","getBindingsSync","isWasm","Error","platform","arch","dev","supportedBrowsers","getSupportedBrowsers","hasDeferredEntries","experimental","deferredEntries","length","persistentCaching","isFileSystemCacheEnabledForBuild","rootPath","turbopack","root","outputFileTracingRoot","sharedProjectOptions","projectPath","normalizePath","path","relative","nextConfig","watch","enable","env","defineEnv","createDefineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","middlewareMatchers","undefined","browserslistQuery","join","writeRoutesHashesManifest","NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","sharedTurboOptions","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isCI","isShortSession","sriEnabled","Boolean","sri","algorithm","project","turbo","createProject","debugBuildPaths","onBeforeDeferredEntries","workerConfig","loadConfig","debugPrerender","reactProductionProfiling","bundler","Bundler","Turbopack","backgroundLogCompilationEvents","fs","writeFile","mkdir","recursive","appDirOnly","entrypoints","writeAllEntrypointsToDisk","printBuildErrors","routes","hasPagesEntries","Array","from","values","some","route","type","manifestLoader","TurbopackManifestLoader","currentEntrypoints","rawEntrypointsToEntrypoints","promises","page","push","handleRouteType","app","Promise","all","loadBuildManifest","loadPagesManifest","loadFontManifest","loadClientBuildManifest","instrumentation","loadMiddlewareManifest","middleware","writeManifests","devRewrites","productionRewrites","analyze","writeAnalyzeData","shutdownPromise","shutdown","time","duration","buildTraceContext","err","workerData","Object","assign","buildContext","hasCustomExportOutput","telemetry","Telemetry","setGlobal","installBindings","useWasmBinary","resultShutdownPromise","flush","saveCpuProfile"],"mappings":"AAAA,+DAA+D;;;;;;;;;;;;;;;;;IA8BzCA,cAAc;eAAdA;;IAmSAC,eAAe;eAAfA;;IArDAC,UAAU;eAAVA;;;4BA3QS;6DACd;kCACuB;uBACS;8BAChB;qBACgB;iCACjB;mCAIzB;gCACiC;oBACT;2BACQ;+DAChB;wBACe;yBACZ;uBACA;wBACL;mCAC0B;wBACQ;+BACzB;yBAMN;;;;;;AAEjB,eAAeF;QAuCjBG,sCAGcA,mBAwCFA,sBAMYA;IAnF3B,MAAMC,IAAAA,yCAAuB,EAAC;QAC5BC,KAAKC,8BAAgB,CAACD,GAAG;QACzBE,aAAaC,iCAAsB;IACrC;IAEA,MAAML,SAASG,8BAAgB,CAACH,MAAM;IACtC,MAAME,MAAMC,8BAAgB,CAACD,GAAG;IAChC,MAAMI,UAAUH,8BAAgB,CAACG,OAAO;IACxC,MAAMC,UAAUJ,8BAAgB,CAACI,OAAO;IACxC,MAAMC,gBAAgBL,8BAAgB,CAACK,aAAa;IACpD,MAAMC,eAAeN,8BAAgB,CAACM,YAAY;IAClD,MAAMC,cAAcP,8BAAgB,CAACO,WAAW;IAChD,MAAMC,WAAWR,8BAAgB,CAACQ,QAAQ;IAC1C,MAAMC,aAAaT,8BAAgB,CAACS,UAAU;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,gBAAgB5E,8BAAgB,CAAC4E,cAAc;QAC/CC,0BAA0B7E,8BAAgB,CAAC6E,wBAAwB;QACnEC,SAASC,gBAAO,CAACC,SAAS;IAC5B;IAEFhF,8BAAgB,CAACH,MAAM,GAAGA;IAC1B,qCAAqC;IACrC,6HAA6H;IAC7H,kDAAkD;IAClD,IAAIsI,IAAAA,6BAAqB,EAACnI,8BAAgB,CAACH,MAAM,GAAG;QAClDG,8BAAgB,CAACH,MAAM,CAACM,OAAO,GAAG;IACpC;IAEA,iCAAiC;IACjC,MAAMiI,YAAY,IAAIC,kBAAS,CAAC;QAC9BlI,SAASH,8BAAgB,CAACH,MAAM,CAACM,OAAO;IAC1C;IACAmI,IAAAA,gBAAS,EAAC,aAAaF;IACvB,8DAA8D;IAC9D,MAAMG,IAAAA,gCAAe,GAAC1I,uBAAAA,OAAO6B,YAAY,qBAAnB7B,qBAAqB2I,aAAa;IAExD,IAAI;QACF,MAAM,EACJf,iBAAiBgB,qBAAqB,EACtCZ,iBAAiB,EACjBD,QAAQ,EACT,GAAG,MAAMlI;QACV+H,kBAAkBgB;QAClB,OAAO;YACLZ;YACAD;QACF;IACF,SAAU;QACR,wGAAwG;QACxG,MAAMQ,UAAUM,KAAK;QACrB,uCAAuC;QACvC,MAAMC,IAAAA,0BAAc;IACtB;AACF;AAEO,eAAehJ;IACpB,IAAI8H,iBAAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["// Import cpu-profile first to start profiling early if enabled\nimport { saveCpuProfile } from '../../server/lib/cpu-profile'\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, getBindingsSync } from '../swc'\nimport { installBindings } from '../swc/install-bindings'\nimport {\n handleRouteType,\n rawEntrypointsToEntrypoints,\n} from '../handle-entrypoints'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport { setGlobal } from '../../trace'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../get-supported-browsers'\nimport { printBuildErrors } from '../print-build-errors'\nimport { normalizePath } from '../../lib/normalize-path'\nimport type {\n ProjectOptions,\n RawEntrypoints,\n TurbopackResult,\n} from '../swc/types'\nimport { Bundler } from '../../lib/bundler'\n\nexport async function turbopackBuild(): Promise<{\n duration: number\n buildTraceContext: undefined\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: NextBuildContext.dir!,\n configPhase: PHASE_PRODUCTION_BUILD,\n })\n\n const config = NextBuildContext.config!\n const dir = NextBuildContext.dir!\n const distDir = NextBuildContext.distDir!\n const buildId = NextBuildContext.buildId!\n const encryptionKey = NextBuildContext.encryptionKey!\n const previewProps = NextBuildContext.previewProps!\n const hasRewrites = NextBuildContext.hasRewrites!\n const rewrites = NextBuildContext.rewrites!\n const noMangling = NextBuildContext.noMangling!\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = getBindingsSync() // our caller should have already loaded these\n\n if (bindings.isWasm) {\n throw new Error(\n `Turbopack is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n `To build on this platform, use Webpack instead:\\n` +\n ` next build --webpack\\n\\n` +\n `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n )\n }\n\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const hasDeferredEntries =\n (config.experimental.deferredEntries?.length ?? 0) > 0\n\n const persistentCaching =\n config.experimental?.turbopackFileSystemCacheForBuild || false\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n\n // Shared options for createProject calls\n const sharedProjectOptions: Omit<ProjectOptions, 'debugBuildPaths'> = {\n rootPath,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters: NextBuildContext.clientRouterFilters!,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites,\n }),\n buildId,\n encryptionKey,\n previewProps,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n writeRoutesHashesManifest:\n !!process.env.NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST,\n currentNodeJsVersion,\n isPersistentCachingEnabled: persistentCaching,\n deferredEntries: config.experimental.deferredEntries,\n nextVersion: process.env.__NEXT_VERSION as string,\n }\n\n const sharedTurboOptions = {\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching || hasDeferredEntries,\n isCi: isCI,\n isShortSession: true,\n }\n\n const sriEnabled = Boolean(config.experimental.sri?.algorithm)\n\n const project = await bindings.turbo.createProject(\n {\n ...sharedProjectOptions,\n debugBuildPaths: NextBuildContext.debugBuildPaths,\n },\n sharedTurboOptions,\n hasDeferredEntries && config.experimental.onBeforeDeferredEntries\n ? {\n onBeforeDeferredEntries: async () => {\n const workerConfig = await loadConfig(PHASE_PRODUCTION_BUILD, dir, {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling:\n NextBuildContext.reactProductionProfiling,\n bundler: Bundler.Turbopack,\n })\n\n await workerConfig.experimental.onBeforeDeferredEntries?.()\n },\n }\n : undefined\n )\n try {\n backgroundLogCompilationEvents(project)\n\n // Write an empty file in a known location to signal this was built with Turbopack\n await fs.writeFile(path.join(distDir, 'turbopack'), '')\n\n await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n await fs.mkdir(path.join(distDir, 'static', buildId), {\n recursive: true,\n })\n await fs.writeFile(\n path.join(distDir, 'package.json'),\n '{\"type\": \"commonjs\"}'\n )\n\n let appDirOnly = NextBuildContext.appDirOnly!\n\n const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly)\n printBuildErrors(entrypoints, dev)\n\n const routes = entrypoints.routes\n if (!routes) {\n // This should never ever happen, there should be an error issue, or the bindings call should\n // have thrown.\n throw new Error(`Turbopack build failed`)\n }\n\n const hasPagesEntries = Array.from(routes.values()).some((route) => {\n if (route.type === 'page' || route.type === 'page-api') {\n return true\n }\n return false\n })\n // If there's no pages entries, then we are in app-dir-only mode\n if (!hasPagesEntries) {\n appDirOnly = true\n }\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n dev: false,\n sriEnabled,\n })\n\n const currentEntrypoints = await rawEntrypointsToEntrypoints(\n entrypoints as TurbopackResult<RawEntrypoints>\n )\n\n const promises: Promise<void>[] = []\n\n if (!appDirOnly) {\n for (const [page, route] of currentEntrypoints.page) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n }\n\n for (const [page, route] of currentEntrypoints.app) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n\n await Promise.all(promises)\n\n await Promise.all([\n // Only load pages router manifests if not app-only\n ...(!appDirOnly\n ? [\n manifestLoader.loadBuildManifest('_app'),\n manifestLoader.loadPagesManifest('_app'),\n manifestLoader.loadFontManifest('_app'),\n manifestLoader.loadPagesManifest('_document'),\n manifestLoader.loadClientBuildManifest('_error'),\n manifestLoader.loadBuildManifest('_error'),\n manifestLoader.loadPagesManifest('_error'),\n manifestLoader.loadFontManifest('_error'),\n ]\n : []),\n entrypoints.instrumentation &&\n manifestLoader.loadMiddlewareManifest(\n 'instrumentation',\n 'instrumentation'\n ),\n entrypoints.middleware &&\n (await manifestLoader.loadMiddlewareManifest(\n 'middleware',\n 'middleware'\n )),\n ])\n\n manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites: rewrites,\n entrypoints: currentEntrypoints,\n })\n\n if (NextBuildContext.analyze) {\n await project.writeAnalyzeData(appDirOnly)\n }\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n buildTraceContext: undefined,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n buildContext: typeof NextBuildContext\n}): Promise<\n Omit<Awaited<ReturnType<typeof turbopackBuild>>, 'shutdownPromise'>\n> {\n // setup new build context from the serialized data passed from the parent\n Object.assign(NextBuildContext, workerData.buildContext)\n\n /// load the config because it's not serializable\n const config = await loadConfig(\n PHASE_PRODUCTION_BUILD,\n NextBuildContext.dir!,\n {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling: NextBuildContext.reactProductionProfiling,\n bundler: Bundler.Turbopack,\n }\n )\n NextBuildContext.config = config\n // Matches handling in build/index.ts\n // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n // Ensures the `config.distDir` option is matched.\n if (hasCustomExportOutput(NextBuildContext.config)) {\n NextBuildContext.config.distDir = '.next'\n }\n\n // Clone the telemetry for worker\n const telemetry = new Telemetry({\n distDir: NextBuildContext.config.distDir,\n })\n setGlobal('telemetry', telemetry)\n // Install bindings early so we can access synchronously later\n await installBindings(config.experimental?.useWasmBinary)\n\n try {\n const {\n shutdownPromise: resultShutdownPromise,\n buildTraceContext,\n duration,\n } = await turbopackBuild()\n shutdownPromise = resultShutdownPromise\n return {\n buildTraceContext,\n duration,\n }\n } finally {\n // Always flush telemetry before worker exits (waits for async operations like setTimeout in debug mode)\n await telemetry.flush()\n // Save CPU profile before worker exits\n await saveCpuProfile()\n }\n}\n\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["turbopackBuild","waitForShutdown","workerMain","config","validateTurboNextConfig","dir","NextBuildContext","configPhase","PHASE_PRODUCTION_BUILD","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","getBindingsSync","isWasm","Error","platform","arch","dev","supportedBrowsers","getSupportedBrowsers","hasDeferredEntries","experimental","deferredEntries","length","persistentCaching","turbopackFileSystemCacheForBuild","rootPath","turbopack","root","outputFileTracingRoot","sharedProjectOptions","projectPath","normalizePath","path","relative","nextConfig","watch","enable","env","defineEnv","createDefineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","middlewareMatchers","undefined","browserslistQuery","join","writeRoutesHashesManifest","NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","sharedTurboOptions","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isCI","isShortSession","sriEnabled","Boolean","sri","algorithm","project","turbo","createProject","debugBuildPaths","onBeforeDeferredEntries","workerConfig","loadConfig","debugPrerender","reactProductionProfiling","bundler","Bundler","Turbopack","backgroundLogCompilationEvents","fs","writeFile","mkdir","recursive","appDirOnly","entrypoints","writeAllEntrypointsToDisk","printBuildErrors","routes","hasPagesEntries","Array","from","values","some","route","type","manifestLoader","TurbopackManifestLoader","currentEntrypoints","rawEntrypointsToEntrypoints","promises","page","push","handleRouteType","app","Promise","all","loadBuildManifest","loadPagesManifest","loadFontManifest","loadClientBuildManifest","instrumentation","loadMiddlewareManifest","middleware","writeManifests","devRewrites","productionRewrites","analyze","writeAnalyzeData","shutdownPromise","shutdown","time","duration","buildTraceContext","err","workerData","Object","assign","buildContext","hasCustomExportOutput","telemetry","Telemetry","setGlobal","installBindings","useWasmBinary","resultShutdownPromise","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AAgB,CAACH,MAAM,CAACM,OAAO;IAC1C;IACAmI,IAAAA,gBAAS,EAAC,aAAaF;IACvB,8DAA8D;IAC9D,MAAMG,IAAAA,gCAAe,GAAC1I,uBAAAA,OAAO6B,YAAY,qBAAnB7B,qBAAqB2I,aAAa;IAExD,IAAI;QACF,MAAM,EACJf,iBAAiBgB,qBAAqB,EACtCZ,iBAAiB,EACjBD,QAAQ,EACT,GAAG,MAAMlI;QACV+H,kBAAkBgB;QAClB,OAAO;YACLZ;YACAD;QACF;IACF,SAAU;QACR,wGAAwG;QACxG,MAAMQ,UAAUM,KAAK;QACrB,uCAAuC;QACvC,MAAMC,IAAAA,0BAAc;IACtB;AACF;AAEO,eAAehJ;IACpB,IAAI8H,iBAAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}

@@ -18,3 +18,2 @@ import type { NextConfigComplete, NextConfigRuntime } from '../server/config-shared';

import type { CacheControl } from '../server/lib/cache-control';
import type { TurbopackResult } from './swc/types';
import type { FunctionsConfigManifest, ManifestRoute } from './index';

@@ -56,13 +55,2 @@ export type ROUTER_TYPE = 'pages' | 'app';

export declare function collectRoutesUsingEdgeRuntime(input: PageInfos): RoutesUsingEdgeRuntime;
/**
* Processes and categorizes build issues, then logs them as warnings, errors, or fatal errors.
* Stops execution if fatal issues are encountered.
*
* @param entrypoints - The result object containing build issues to process.
* @param isDev - A flag indicating if the build is running in development mode.
* @return This function does not return a value but logs or throws errors based on the issues.
* @throws {Error} If a fatal issue is encountered, this function throws an error. In development mode, we only throw on
* 'fatal' and 'bug' issues. In production mode, we also throw on 'error' issues.
*/
export declare function printBuildErrors(entrypoints: TurbopackResult, isDev: boolean): void;
export declare function printTreeView(lists: {

@@ -155,3 +143,3 @@ pages: ReadonlyArray<string>;

}
export declare function getSupportedBrowsers(dir: string, isDevelopment: boolean): string[];
export { getSupportedBrowsers } from './get-supported-browsers';
export declare function shouldUseReactServerCondition(layer: WebpackLayerName | null | undefined): boolean;

@@ -187,2 +175,1 @@ export declare function isWebpackClientOnlyLayer(layer: WebpackLayerName | null | undefined): boolean;

export declare function pageToRoute(page: string, sourcePage: string | undefined): DynamicManifestRoute;
export {};

@@ -32,3 +32,2 @@ "use strict";

pageToRoute: null,
printBuildErrors: null,
printCustomRoutes: null,

@@ -78,3 +77,3 @@ printTreeView: null,

getSupportedBrowsers: function() {
return getSupportedBrowsers;
return _getsupportedbrowsers.getSupportedBrowsers;
},

@@ -126,5 +125,2 @@ hasCustomGetInitialProps: function() {

},
printBuildErrors: function() {
return printBuildErrors;
},
printCustomRoutes: function() {

@@ -158,3 +154,2 @@ return printCustomRoutes;

const _stripansi = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/strip-ansi"));
const _browserslist = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/browserslist"));
const _constants1 = require("../shared/lib/constants");

@@ -178,3 +173,2 @@ const _isdynamic = require("../shared/lib/router/utils/is-dynamic");

const _format = require("./output/format");
const _utils = require("../shared/lib/turbopack/utils");
const _routeregex = require("../shared/lib/router/utils/route-regex");

@@ -184,2 +178,3 @@ const _app1 = require("../shared/lib/router/routes/app");

const _ismetadataroute = require("../lib/metadata/is-metadata-route");
const _getsupportedbrowsers = require("./get-supported-browsers");
function _interop_require_default(obj) {

@@ -305,61 +300,2 @@ return obj && obj.__esModule ? obj : {

}
function printBuildErrors(entrypoints, isDev) {
// Issues that we want to stop the server from executing
const topLevelFatalIssues = [];
// Issues that are true errors, but we believe we can keep running and allow the user to address the issue
const topLevelErrors = [];
// Issues that are warnings but should not affect the running of the build
const topLevelWarnings = [];
// Track seen formatted error messages to avoid duplicates
const seenFatalIssues = new Set();
const seenErrors = new Set();
const seenWarnings = new Set();
for (const issue of entrypoints.issues){
// We only want to completely shut down the server
if (issue.severity === 'fatal' || issue.severity === 'bug') {
const formatted = (0, _utils.formatIssue)(issue);
if (!seenFatalIssues.has(formatted)) {
seenFatalIssues.add(formatted);
topLevelFatalIssues.push(formatted);
}
} else if ((0, _utils.isRelevantWarning)(issue)) {
const formatted = (0, _utils.formatIssue)(issue);
if (!seenWarnings.has(formatted)) {
seenWarnings.add(formatted);
topLevelWarnings.push(formatted);
}
} else if (issue.severity === 'error') {
const formatted = (0, _utils.formatIssue)(issue);
if (isDev) {
// We want to treat errors as recoverable in development
// so that we can show the errors in the site and allow users
// to respond to the errors when necessary. In production builds
// though we want to error out and stop the build process.
if (!seenErrors.has(formatted)) {
seenErrors.add(formatted);
topLevelErrors.push(formatted);
}
} else {
if (!seenFatalIssues.has(formatted)) {
seenFatalIssues.add(formatted);
topLevelFatalIssues.push(formatted);
}
}
}
}
// TODO: print in order by source location so issues from the same file are displayed together and then add a summary at the end about the number of warnings/errors
if (topLevelWarnings.length > 0) {
console.warn(`Turbopack build encountered ${topLevelWarnings.length} warnings:\n${topLevelWarnings.join('\n')}`);
}
if (topLevelErrors.length > 0) {
console.error(`Turbopack build encountered ${topLevelErrors.length} errors:\n${topLevelErrors.join('\n')}`);
}
if (topLevelFatalIssues.length > 0) {
throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelFatalIssues.length} errors:\n${topLevelFatalIssues.join('\n')}`), "__NEXT_ERROR_CODE", {
value: "E425",
enumerable: false,
configurable: true
});
}
}
async function printTreeView(lists, pageInfos, { pagesDir, pageExtensions, middlewareManifest, functionsConfigManifest, useStaticPages404, hasGSPAndRevalidateZero }) {

@@ -1220,21 +1156,2 @@ var _lists_app, _middlewareManifest_middleware_, _middlewareManifest_middleware, // 'nodejs' runtime middleware or proxy is set to

}
function getSupportedBrowsers(dir, isDevelopment) {
let browsers;
try {
const browsersListConfig = _browserslist.default.loadConfig({
path: dir,
env: isDevelopment ? 'development' : 'production'
});
// Running `browserslist` resolves `extends` and other config features into a list of browsers
if (browsersListConfig && browsersListConfig.length > 0) {
browsers = (0, _browserslist.default)(browsersListConfig);
}
} catch {}
// When user has browserslist use that target
if (browsers && browsers.length > 0) {
return browsers;
}
// Uses modern browsers as the default.
return _constants1.MODERN_BROWSERSLIST_TARGET;
}
function shouldUseReactServerCondition(layer) {

@@ -1241,0 +1158,0 @@ return Boolean(layer && _constants.WEBPACK_LAYERS.GROUP.serverOnly.includes(layer));

@@ -42,3 +42,3 @@ "use strict";

const _constants1 = require("../../../lib/constants");
const _generateinterceptionroutesrewrites = require("../../../lib/generate-interception-routes-rewrites");
const _isinterceptionrouterewrite = require("../../../lib/is-interception-route-rewrite");
const _parsedynamiccodeevaluationerror = require("./wellknown-errors-plugin/parse-dynamic-code-evaluation-error");

@@ -107,3 +107,3 @@ const _utils1 = require("../utils");

// and we don't need to provide the entire route manifest, just the interception routes.
const interceptionRewrites = JSON.stringify(opts.rewrites.beforeFiles.filter(_generateinterceptionroutesrewrites.isInterceptionRouteRewrite));
const interceptionRewrites = JSON.stringify(opts.rewrites.beforeFiles.filter(_isinterceptionrouterewrite.isInterceptionRouteRewrite));
compilation.emitAsset(`${_constants.INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`, new _webpack.sources.RawSource(`self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(interceptionRewrites)}`));

@@ -110,0 +110,0 @@ for (const entrypoint of compilation.entrypoints.values()){

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../src/build/webpack/plugins/middleware-plugin.ts"],"sourcesContent":["import type {\n AssetBinding,\n EdgeMiddlewareMeta,\n} from '../loaders/get-module-build-info'\nimport type { EdgeSSRMeta } from '../loaders/get-module-build-info'\nimport type { ProxyMatcher } from '../../analysis/get-page-static-info'\nimport { getNamedMiddlewareRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport path from 'path'\nimport {\n EDGE_RUNTIME_WEBPACK,\n EDGE_UNSUPPORTED_NODE_APIS,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n MIDDLEWARE_MANIFEST,\n MIDDLEWARE_REACT_LOADABLE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n NEXT_FONT_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n SERVER_FILES_MANIFEST,\n} from '../../../shared/lib/constants'\nimport type { ProxyConfig } from '../../analysis/get-page-static-info'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport { traceGlobals } from '../../../trace/shared'\nimport { EVENT_BUILD_FEATURE_USAGE } from '../../../telemetry/events'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport {\n INSTRUMENTATION_HOOK_FILENAME,\n WEBPACK_LAYERS,\n} from '../../../lib/constants'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport { getDynamicCodeEvaluationError } from './wellknown-errors-plugin/parse-dynamic-code-evaluation-error'\nimport { getModuleReferencesInOrder } from '../utils'\n\nconst KNOWN_SAFE_DYNAMIC_PACKAGES =\n require('../../../lib/known-edge-safe-packages.json') as string[]\n\nexport interface EdgeFunctionDefinition {\n files: string[]\n name: string\n page: string\n matchers: ProxyMatcher[]\n env: Record<string, string>\n wasm?: AssetBinding[]\n assets?: AssetBinding[]\n regions?: string[] | string\n}\n\nexport interface MiddlewareManifest {\n version: 3\n sortedMiddleware: string[]\n middleware: { [page: string]: EdgeFunctionDefinition }\n functions: { [page: string]: EdgeFunctionDefinition }\n}\n\ninterface EntryMetadata {\n edgeMiddleware?: EdgeMiddlewareMeta\n edgeApiFunction?: EdgeMiddlewareMeta\n edgeSSR?: EdgeSSRMeta\n wasmBindings: Map<string, string>\n assetBindings: Map<string, string>\n regions?: string[] | string\n}\n\nconst NAME = 'MiddlewarePlugin'\nconst MANIFEST_VERSION = 3\n\n/**\n * Checks the value of usingIndirectEval and when it is a set of modules it\n * check if any of the modules is actually being used. If the value is\n * simply truthy it will return true.\n */\nfunction isUsingIndirectEvalAndUsedByExports(args: {\n module: webpack.Module\n moduleGraph: webpack.ModuleGraph\n runtime: any\n usingIndirectEval: true | Set<string>\n wp: typeof webpack\n}): boolean {\n const { moduleGraph, runtime, module, usingIndirectEval, wp } = args\n if (typeof usingIndirectEval === 'boolean') {\n return usingIndirectEval\n }\n\n const exportsInfo = moduleGraph.getExportsInfo(module)\n for (const exportName of usingIndirectEval) {\n if (exportsInfo.getUsed(exportName, runtime) !== wp.UsageState.Unused) {\n return true\n }\n }\n\n return false\n}\n\nfunction getEntryFiles(\n entryFiles: string[],\n meta: EntryMetadata,\n hasInstrumentationHook: boolean,\n opts: Options\n) {\n const files: string[] = []\n if (meta.edgeSSR) {\n if (meta.edgeSSR.isServerComponent) {\n files.push(`server/${SERVER_REFERENCE_MANIFEST}.js`)\n if (opts.sriEnabled) {\n files.push(`server/${SUBRESOURCE_INTEGRITY_MANIFEST}.js`)\n }\n files.push(\n ...entryFiles\n .filter(\n (file) =>\n file.startsWith('app/') && !file.endsWith('.hot-update.js')\n )\n .map(\n (file) =>\n 'server/' +\n file.replace(/\\.js$/, '_' + CLIENT_REFERENCE_MANIFEST + '.js')\n )\n )\n }\n if (!opts.dev && !meta.edgeSSR.isAppDir) {\n files.push(`server/${DYNAMIC_CSS_MANIFEST}.js`)\n }\n\n files.push(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,\n `server/${NEXT_FONT_MANIFEST}.js`,\n `server/${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n\n if (!opts.dev) {\n files.push(`${SERVER_FILES_MANIFEST}.js`)\n }\n }\n\n if (hasInstrumentationHook) {\n files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`)\n }\n\n files.push(\n ...entryFiles\n .filter((file) => !file.endsWith('.hot-update.js'))\n .map((file) => 'server/' + file)\n )\n\n return files\n}\n\nfunction getCreateAssets(params: {\n compilation: webpack.Compilation\n metadataByEntry: Map<string, EntryMetadata>\n opts: Options\n}) {\n const { compilation, metadataByEntry, opts } = params\n return () => {\n const middlewareManifest: MiddlewareManifest = {\n version: MANIFEST_VERSION,\n middleware: {},\n functions: {},\n sortedMiddleware: [],\n }\n\n const hasInstrumentationHook = compilation.entrypoints.has(\n INSTRUMENTATION_HOOK_FILENAME\n )\n\n // we only emit this entry for the edge runtime since it doesn't have access to a routes manifest\n // and we don't need to provide the entire route manifest, just the interception routes.\n const interceptionRewrites = JSON.stringify(\n opts.rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n compilation.emitAsset(\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )}`\n ) as unknown as webpack.sources.RawSource\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (!entrypoint.name) {\n continue\n }\n\n // There should always be metadata for the entrypoint.\n const metadata = metadataByEntry.get(entrypoint.name)\n const page =\n metadata?.edgeMiddleware?.page ||\n metadata?.edgeSSR?.page ||\n metadata?.edgeApiFunction?.page\n if (!page) {\n continue\n }\n\n const matcherSource = metadata.edgeSSR?.isAppDir\n ? normalizeAppPath(page)\n : page\n\n const catchAll = !metadata.edgeSSR && !metadata.edgeApiFunction\n\n const { namedRegex } = getNamedMiddlewareRegex(matcherSource, {\n catchAll,\n })\n const matchers = metadata?.edgeMiddleware?.matchers ?? [\n {\n regexp: namedRegex,\n originalSource: page === '/' && catchAll ? '/:path*' : matcherSource,\n },\n ]\n\n const isEdgeFunction = !!(metadata.edgeApiFunction || metadata.edgeSSR)\n const edgeFunctionDefinition: EdgeFunctionDefinition = {\n files: getEntryFiles(\n entrypoint.getFiles(),\n metadata,\n hasInstrumentationHook,\n opts\n ),\n name: entrypoint.name,\n page: page,\n matchers,\n wasm: Array.from(metadata.wasmBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n assets: Array.from(metadata.assetBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n env: opts.edgeEnvironments,\n ...(metadata.regions && { regions: metadata.regions }),\n }\n\n if (isEdgeFunction) {\n middlewareManifest.functions[page] = edgeFunctionDefinition\n } else {\n middlewareManifest.middleware[page] = edgeFunctionDefinition\n }\n }\n\n middlewareManifest.sortedMiddleware = getSortedRoutes(\n Object.keys(middlewareManifest.middleware)\n )\n\n compilation.emitAsset(\n MIDDLEWARE_MANIFEST,\n new sources.RawSource(\n JSON.stringify(middlewareManifest, null, 2)\n ) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction buildWebpackError({\n message,\n loc,\n compilation,\n entryModule,\n parser,\n}: {\n message: string\n loc?: any\n compilation: webpack.Compilation\n entryModule?: webpack.Module\n parser?: webpack.javascript.JavascriptParser\n}) {\n const error = new compilation.compiler.webpack.WebpackError(message)\n error.name = NAME\n const module = entryModule ?? parser?.state.current\n if (module) {\n error.module = module\n }\n error.loc = loc\n return error\n}\n\nfunction isInMiddlewareLayer(parser: webpack.javascript.JavascriptParser) {\n const layer = parser.state.module?.layer\n return layer === WEBPACK_LAYERS.middleware || layer === WEBPACK_LAYERS.apiEdge\n}\n\nfunction isNodeJsModule(moduleName: string) {\n return (require('module') as typeof import('module')).builtinModules.includes(\n moduleName\n )\n}\n\nfunction isBunModule(moduleName: string) {\n return moduleName === 'bun' || moduleName.startsWith('bun:')\n}\n\nfunction isDynamicCodeEvaluationAllowed(\n fileName: string,\n middlewareConfig?: ProxyConfig,\n rootDir?: string\n) {\n // Some packages are known to use `eval` but are safe to use in the Edge\n // Runtime because the dynamic code will never be executed.\n if (\n KNOWN_SAFE_DYNAMIC_PACKAGES.some((pkg) =>\n fileName.includes(`/node_modules/${pkg}/`.replace(/\\//g, path.sep))\n )\n ) {\n return true\n }\n\n const name = fileName.replace(rootDir ?? '', '')\n\n return picomatch(middlewareConfig?.unstable_allowDynamic ?? [], {\n dot: true,\n })(name)\n}\n\nfunction buildUnsupportedApiError({\n apiName,\n loc,\n ...rest\n}: {\n apiName: string\n loc: any\n compilation: webpack.Compilation\n parser: webpack.javascript.JavascriptParser\n}) {\n return buildWebpackError({\n message: `A Node.js API is used (${apiName} at line: ${loc.start.line}) which is not supported in the Edge Runtime.\nLearn more: https://nextjs.org/docs/api-reference/edge-runtime`,\n loc,\n ...rest,\n })\n}\n\nfunction registerUnsupportedApiHooks(\n parser: webpack.javascript.JavascriptParser,\n compilation: webpack.Compilation\n) {\n for (const expression of EDGE_UNSUPPORTED_NODE_APIS) {\n const warnForUnsupportedApi = (node: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: expression,\n ...node,\n })\n )\n return true\n }\n parser.hooks.call.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.expression.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.callMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n parser.hooks.expressionMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n }\n\n const warnForUnsupportedProcessApi = (node: any, [callee]: string[]) => {\n if (!isInMiddlewareLayer(parser) || callee === 'env') {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: `process.${callee}`,\n ...node,\n })\n )\n return true\n }\n\n parser.hooks.callMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n parser.hooks.expressionMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n}\n\nfunction getCodeAnalyzer(params: {\n dev: boolean\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n}) {\n return (parser: webpack.javascript.JavascriptParser) => {\n const {\n dev,\n compiler: { webpack: wp },\n compilation,\n } = params\n const { hooks } = parser\n\n /**\n * For an expression this will check the graph to ensure it is being used\n * by exports. Then it will store in the module buildInfo a boolean to\n * express that it contains dynamic code and, if it is available, the\n * module path that is using it.\n */\n const handleExpression = () => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n wp.optimize.InnerGraph.onUsage(parser.state, (used = true) => {\n const buildInfo = getModuleBuildInfo(parser.state.module)\n if (buildInfo.usingIndirectEval === true || used === false) {\n return\n }\n\n if (!buildInfo.usingIndirectEval || used === true) {\n buildInfo.usingIndirectEval = used\n return\n }\n\n buildInfo.usingIndirectEval = new Set([\n ...Array.from(buildInfo.usingIndirectEval),\n ...Array.from(used),\n ])\n })\n }\n\n /**\n * This expression handler allows to wrap a dynamic code expression with a\n * function call where we can warn about dynamic code not being allowed\n * but actually execute the expression.\n */\n const handleWrapExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_eval__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n return true\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.compile invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n */\n const handleWrapWasmCompileExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_compile__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.instatiate invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n *\n * Note that we don't update `usingIndirectEval`, i.e. we don't abort a production build\n * since we can't determine statically if the first parameter is a module (legit use) or\n * a buffer (dynamic code generation).\n */\n const handleWrapWasmInstantiateExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n if (dev) {\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_instantiate__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n }\n }\n\n /**\n * Handler to store original source location of static and dynamic imports into module's buildInfo.\n */\n const handleImport = (node: any) => {\n if (isInMiddlewareLayer(parser) && node.source?.value && node?.loc) {\n const { module, source } = parser.state\n const buildInfo = getModuleBuildInfo(module)\n if (!buildInfo.importLocByPath) {\n buildInfo.importLocByPath = new Map()\n }\n\n const importedModule = node.source.value?.toString()\n buildInfo.importLocByPath.set(importedModule, {\n sourcePosition: {\n ...node.loc.start,\n source: module.identifier(),\n },\n sourceContent: source.toString(),\n })\n\n if (\n !dev &&\n (isNodeJsModule(importedModule) || isBunModule(importedModule)) &&\n !SUPPORTED_NATIVE_MODULES.includes(importedModule)\n ) {\n const isBun = isBunModule(importedModule)\n compilation.warnings.push(\n buildWebpackError({\n message: `A ${isBun ? 'Bun' : 'Node.js'} module is loaded ('${importedModule}' at line ${node.loc.start.line}) which is not supported in the Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`,\n compilation,\n parser,\n ...node,\n })\n )\n }\n }\n }\n\n /**\n * A noop handler to skip analyzing some cases.\n * Order matters: for it to work, it must be registered first\n */\n const skip = () => (isInMiddlewareLayer(parser) ? true : undefined)\n\n for (const prefix of ['', 'global.']) {\n hooks.expression.for(`${prefix}Function.prototype`).tap(NAME, skip)\n hooks.expression.for(`${prefix}Function.bind`).tap(NAME, skip)\n hooks.call.for(`${prefix}eval`).tap(NAME, handleWrapExpression)\n hooks.call.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.new.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.call\n .for(`${prefix}WebAssembly.compile`)\n .tap(NAME, handleWrapWasmCompileExpression)\n hooks.call\n .for(`${prefix}WebAssembly.instantiate`)\n .tap(NAME, handleWrapWasmInstantiateExpression)\n }\n\n hooks.importCall.tap(NAME, handleImport)\n hooks.import.tap(NAME, handleImport)\n\n if (!dev) {\n // do not issue compilation warning on dev: invoking code will provide details\n registerUnsupportedApiHooks(parser, compilation)\n }\n }\n}\n\nasync function codeAnalyzerBySwc(\n compilation: webpack.Compilation,\n modules: Iterable<webpack.Module>,\n dev: boolean\n) {\n const binding = require('../../swc') as typeof import('../../swc')\n for (const module of modules) {\n if (\n module.layer !== WEBPACK_LAYERS.middleware &&\n module.layer !== WEBPACK_LAYERS.apiEdge\n ) {\n continue\n }\n if (module.constructor.name !== 'NormalModule') {\n continue\n }\n const normalModule = module as webpack.NormalModule\n if (!normalModule.type.startsWith('javascript')) {\n // Only analyze JavaScript modules\n continue\n }\n const originalSource = normalModule.originalSource()\n if (!originalSource) {\n continue\n }\n const source = originalSource.source()\n if (typeof source !== 'string') {\n continue\n }\n const diagnostics = await binding.warnForEdgeRuntime(source, !dev)\n for (const diagnostic of diagnostics) {\n const webpackError = buildWebpackError({\n message: diagnostic.message,\n loc: diagnostic.loc,\n compilation,\n entryModule: module,\n })\n if (diagnostic.severity === 'Warning') {\n compilation.warnings.push(webpackError)\n } else {\n compilation.errors.push(webpackError)\n }\n }\n }\n}\n\nfunction getExtractMetadata(params: {\n compilation: webpack.Compilation\n compiler: webpack.Compiler\n dev: boolean\n metadataByEntry: Map<string, EntryMetadata>\n}): () => Promise<void> {\n const { dev, compilation, metadataByEntry, compiler } = params\n const { webpack: wp } = compiler\n return async () => {\n metadataByEntry.clear()\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n\n for (const [entryName, entry] of compilation.entries) {\n if (entry.options.runtime !== EDGE_RUNTIME_WEBPACK) {\n // Only process edge runtime entries\n continue\n }\n const entryDependency = entry.dependencies?.[0]\n const resolvedModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)\n if (!resolvedModule) {\n continue\n }\n const { rootDir, route } = getModuleBuildInfo(resolvedModule)\n\n const { moduleGraph } = compilation\n const modules = new Set<webpack.NormalModule>()\n const addEntriesFromDependency = (dependency: any) => {\n const module = moduleGraph.getModule(dependency)\n if (module) {\n modules.add(module as webpack.NormalModule)\n }\n }\n\n entry.dependencies.forEach(addEntriesFromDependency)\n entry.includeDependencies.forEach(addEntriesFromDependency)\n\n const entryMetadata: EntryMetadata = {\n wasmBindings: new Map(),\n assetBindings: new Map(),\n }\n\n if (route?.middlewareConfig?.regions) {\n entryMetadata.regions = route.middlewareConfig.regions\n }\n\n if (route?.preferredRegion) {\n const preferredRegion = route.preferredRegion\n entryMetadata.regions =\n // Ensures preferredRegion is always an array in the manifest.\n typeof preferredRegion === 'string'\n ? [preferredRegion]\n : preferredRegion\n }\n\n let ogImageGenerationCount = 0\n\n for (const module of modules) {\n const buildInfo = getModuleBuildInfo(module)\n\n /**\n * Check if it uses the image generation feature.\n */\n if (!dev) {\n const resource = module.resource\n const hasOGImageGeneration =\n resource &&\n /[\\\\/]node_modules[\\\\/]@vercel[\\\\/]og[\\\\/]dist[\\\\/]index\\.(edge|node)\\.js$|[\\\\/]next[\\\\/]dist[\\\\/](esm[\\\\/])?server[\\\\/]og[\\\\/]image-response\\.js$/.test(\n resource\n )\n\n if (hasOGImageGeneration) {\n ogImageGenerationCount++\n }\n }\n\n /**\n * When building for production checks if the module is using `eval`\n * and in such case produces a compilation error. The module has to\n * be in use.\n */\n if (\n !dev &&\n buildInfo.usingIndirectEval &&\n isUsingIndirectEvalAndUsedByExports({\n module,\n moduleGraph,\n runtime: wp.util.runtime.getEntryRuntime(compilation, entryName),\n usingIndirectEval: buildInfo.usingIndirectEval,\n wp,\n })\n ) {\n const id = module.identifier()\n if (/node_modules[\\\\/]regenerator-runtime[\\\\/]runtime\\.js/.test(id)) {\n continue\n }\n if (route?.middlewareConfig?.unstable_allowDynamic) {\n telemetry?.record({\n eventName: 'NEXT_EDGE_ALLOW_DYNAMIC_USED',\n payload: {\n file: route?.absolutePagePath.replace(rootDir ?? '', ''),\n config: route?.middlewareConfig,\n fileWithDynamicCode: module.userRequest.replace(\n rootDir ?? '',\n ''\n ),\n },\n })\n }\n if (\n !isDynamicCodeEvaluationAllowed(\n module.userRequest,\n route?.middlewareConfig,\n rootDir\n )\n ) {\n const message = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime ${\n typeof buildInfo.usingIndirectEval !== 'boolean'\n ? `\\nUsed by ${Array.from(buildInfo.usingIndirectEval).join(\n ', '\n )}`\n : ''\n }\\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`\n compilation.errors.push(\n getDynamicCodeEvaluationError(\n message,\n module,\n compilation,\n compiler\n )\n )\n }\n }\n\n /**\n * The entry module has to be either a page or a middleware and hold\n * the corresponding metadata.\n */\n if (buildInfo?.nextEdgeSSR) {\n entryMetadata.edgeSSR = buildInfo.nextEdgeSSR\n } else if (buildInfo?.nextEdgeMiddleware) {\n entryMetadata.edgeMiddleware = buildInfo.nextEdgeMiddleware\n } else if (buildInfo?.nextEdgeApiFunction) {\n entryMetadata.edgeApiFunction = buildInfo.nextEdgeApiFunction\n }\n\n /**\n * If the module is a WASM module we read the binding information and\n * append it to the entry wasm bindings.\n */\n if (buildInfo?.nextWasmMiddlewareBinding) {\n entryMetadata.wasmBindings.set(\n buildInfo.nextWasmMiddlewareBinding.name,\n buildInfo.nextWasmMiddlewareBinding.filePath\n )\n }\n\n if (buildInfo?.nextAssetMiddlewareBinding) {\n entryMetadata.assetBindings.set(\n buildInfo.nextAssetMiddlewareBinding.name,\n buildInfo.nextAssetMiddlewareBinding.filePath\n )\n }\n\n /**\n * Append to the list of modules to process outgoingConnections from\n * the module that is being processed.\n */\n for (const conn of getModuleReferencesInOrder(module, moduleGraph)) {\n if (conn.module) {\n modules.add(conn.module as webpack.NormalModule)\n }\n }\n }\n\n telemetry?.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'vercelImageGeneration',\n invocationCount: ogImageGenerationCount,\n },\n })\n metadataByEntry.set(entryName, entryMetadata)\n }\n }\n}\n\n// These values will be replaced again in edge runtime deployment build.\n// `buildId` represents BUILD_ID to be externalized in env vars.\n// `encryptionKey` represents server action encryption key to be externalized in env vars.\ntype EdgeRuntimeEnvironments = Record<string, string> & {\n __NEXT_BUILD_ID: string\n NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: string\n}\n\ninterface Options {\n dev: boolean\n sriEnabled: boolean\n rewrites: CustomRoutes['rewrites']\n edgeEnvironments: EdgeRuntimeEnvironments\n}\n\nexport default class MiddlewarePlugin {\n private readonly dev: Options['dev']\n private readonly sriEnabled: Options['sriEnabled']\n private readonly rewrites: Options['rewrites']\n private readonly edgeEnvironments: EdgeRuntimeEnvironments\n\n constructor({ dev, sriEnabled, rewrites, edgeEnvironments }: Options) {\n this.dev = dev\n this.sriEnabled = sriEnabled\n this.rewrites = rewrites\n this.edgeEnvironments = edgeEnvironments\n }\n\n public apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(NAME, (compilation, params) => {\n // parser hooks aren't available in rspack\n if (process.env.NEXT_RSPACK) {\n compilation.hooks.finishModules.tapPromise(NAME, async (modules) => {\n await codeAnalyzerBySwc(compilation, modules, this.dev)\n })\n } else {\n const { hooks } = params.normalModuleFactory\n /**\n * This is the static code analysis phase.\n */\n const codeAnalyzer = getCodeAnalyzer({\n dev: this.dev,\n compiler,\n compilation,\n })\n\n hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)\n }\n\n /**\n * Extract all metadata for the entry points in a Map object.\n */\n const metadataByEntry = new Map<string, EntryMetadata>()\n compilation.hooks.finishModules.tapPromise(\n NAME,\n getExtractMetadata({\n compilation,\n compiler,\n dev: this.dev,\n metadataByEntry,\n })\n )\n\n /**\n * Emit the middleware manifest.\n */\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsMiddlewareManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n getCreateAssets({\n compilation,\n metadataByEntry,\n opts: {\n sriEnabled: this.sriEnabled,\n rewrites: this.rewrites,\n edgeEnvironments: this.edgeEnvironments,\n dev: this.dev,\n },\n })\n )\n })\n }\n}\n\nexport const SUPPORTED_NATIVE_MODULES = [\n 'buffer',\n 'events',\n 'assert',\n 'util',\n 'async_hooks',\n] as const\n\nconst supportedEdgePolyfills = new Set<string>(SUPPORTED_NATIVE_MODULES)\n\nexport function getEdgePolyfilledModules() {\n const records: Record<string, string> = {}\n for (const mod of SUPPORTED_NATIVE_MODULES) {\n records[mod] = `commonjs node:${mod}`\n records[`node:${mod}`] = `commonjs node:${mod}`\n }\n return records\n}\n\nexport async function handleWebpackExternalForEdgeRuntime({\n request,\n context,\n contextInfo,\n getResolve,\n}: {\n request: string\n context: string\n contextInfo: any\n getResolve: () => any\n}) {\n if (\n (contextInfo.issuerLayer === WEBPACK_LAYERS.middleware ||\n contextInfo.issuerLayer === WEBPACK_LAYERS.apiEdge) &&\n (isNodeJsModule(request) || isBunModule(request)) &&\n !supportedEdgePolyfills.has(request)\n ) {\n // allows user to provide and use their polyfills, as we do with buffer.\n try {\n await getResolve()(context, request)\n } catch {\n return `root globalThis.__import_unsupported('${request}')`\n }\n }\n}\n"],"names":["SUPPORTED_NATIVE_MODULES","MiddlewarePlugin","getEdgePolyfilledModules","handleWebpackExternalForEdgeRuntime","KNOWN_SAFE_DYNAMIC_PACKAGES","require","NAME","MANIFEST_VERSION","isUsingIndirectEvalAndUsedByExports","args","moduleGraph","runtime","module","usingIndirectEval","wp","exportsInfo","getExportsInfo","exportName","getUsed","UsageState","Unused","getEntryFiles","entryFiles","meta","hasInstrumentationHook","opts","files","edgeSSR","isServerComponent","push","SERVER_REFERENCE_MANIFEST","sriEnabled","SUBRESOURCE_INTEGRITY_MANIFEST","filter","file","startsWith","endsWith","map","replace","CLIENT_REFERENCE_MANIFEST","dev","isAppDir","DYNAMIC_CSS_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_REACT_LOADABLE_MANIFEST","NEXT_FONT_MANIFEST","INTERCEPTION_ROUTE_REWRITE_MANIFEST","SERVER_FILES_MANIFEST","INSTRUMENTATION_HOOK_FILENAME","getCreateAssets","params","compilation","metadataByEntry","middlewareManifest","version","middleware","functions","sortedMiddleware","entrypoints","has","interceptionRewrites","JSON","stringify","rewrites","beforeFiles","isInterceptionRouteRewrite","emitAsset","sources","RawSource","entrypoint","values","metadata","name","get","page","edgeMiddleware","edgeApiFunction","matcherSource","normalizeAppPath","catchAll","namedRegex","getNamedMiddlewareRegex","matchers","regexp","originalSource","isEdgeFunction","edgeFunctionDefinition","getFiles","wasm","Array","from","wasmBindings","filePath","assets","assetBindings","env","edgeEnvironments","regions","getSortedRoutes","Object","keys","MIDDLEWARE_MANIFEST","buildWebpackError","message","loc","entryModule","parser","error","compiler","webpack","WebpackError","state","current","isInMiddlewareLayer","layer","WEBPACK_LAYERS","apiEdge","isNodeJsModule","moduleName","builtinModules","includes","isBunModule","isDynamicCodeEvaluationAllowed","fileName","middlewareConfig","rootDir","some","pkg","path","sep","picomatch","unstable_allowDynamic","dot","buildUnsupportedApiError","apiName","rest","start","line","registerUnsupportedApiHooks","expression","EDGE_UNSUPPORTED_NODE_APIS","warnForUnsupportedApi","node","warnings","hooks","call","for","tap","callMemberChain","expressionMemberChain","warnForUnsupportedProcessApi","callee","getCodeAnalyzer","handleExpression","optimize","InnerGraph","onUsage","used","buildInfo","getModuleBuildInfo","Set","handleWrapExpression","expr","ConstDependency","dependencies","dep1","range","addPresentationalDependency","dep2","handleWrapWasmCompileExpression","handleWrapWasmInstantiateExpression","handleImport","source","value","importLocByPath","Map","importedModule","toString","set","sourcePosition","identifier","sourceContent","isBun","skip","undefined","prefix","new","importCall","import","codeAnalyzerBySwc","modules","binding","constructor","normalModule","type","diagnostics","warnForEdgeRuntime","diagnostic","webpackError","severity","errors","getExtractMetadata","clear","telemetry","traceGlobals","entryName","entry","entries","route","options","EDGE_RUNTIME_WEBPACK","entryDependency","resolvedModule","getResolvedModule","addEntriesFromDependency","dependency","getModule","add","forEach","includeDependencies","entryMetadata","preferredRegion","ogImageGenerationCount","resource","hasOGImageGeneration","test","util","getEntryRuntime","id","record","eventName","payload","absolutePagePath","config","fileWithDynamicCode","userRequest","join","getDynamicCodeEvaluationError","nextEdgeSSR","nextEdgeMiddleware","nextEdgeApiFunction","nextWasmMiddlewareBinding","nextAssetMiddlewareBinding","conn","getModuleReferencesInOrder","EVENT_BUILD_FEATURE_USAGE","featureName","invocationCount","apply","process","NEXT_RSPACK","finishModules","tapPromise","normalModuleFactory","codeAnalyzer","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS","supportedEdgePolyfills","records","mod","request","context","contextInfo","getResolve","issuerLayer"],"mappings":";;;;;;;;;;;;;;;;;IAo4BaA,wBAAwB;eAAxBA;;IAzEb,OAuEC;eAvEoBC;;IAmFLC,wBAAwB;eAAxBA;;IASMC,mCAAmC;eAAnCA;;;4BAj5BkB;oCACL;uBACH;yBACC;kEACX;6DACL;2BAcV;wBAGsB;wBACa;0BACT;4BAI1B;oDAEoC;iDACG;wBACH;;;;;;AAE3C,MAAMC,8BACJC,QAAQ;AA6BV,MAAMC,OAAO;AACb,MAAMC,mBAAmB;AAEzB;;;;CAIC,GACD,SAASC,oCAAoCC,IAM5C;IACC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAAA,OAAM,EAAEC,iBAAiB,EAAEC,EAAE,EAAE,GAAGL;IAChE,IAAI,OAAOI,sBAAsB,WAAW;QAC1C,OAAOA;IACT;IAEA,MAAME,cAAcL,YAAYM,cAAc,CAACJ;I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c,EAAEA,KAAK;IACjD;IACA,OAAOD;AACT;AAEO,eAAejQ,oCAAoC,EACxDmQ,OAAO,EACPC,OAAO,EACPC,WAAW,EACXC,UAAU,EAMX;IACC,IACE,AAACD,CAAAA,YAAYE,WAAW,KAAKvJ,0BAAc,CAAC5D,UAAU,IACpDiN,YAAYE,WAAW,KAAKvJ,0BAAc,CAACC,OAAO,AAAD,KAClDC,CAAAA,eAAeiJ,YAAY7I,YAAY6I,QAAO,KAC/C,CAACH,uBAAuBxM,GAAG,CAAC2M,UAC5B;QACA,wEAAwE;QACxE,IAAI;YACF,MAAMG,aAAaF,SAASD;QAC9B,EAAE,OAAM;YACN,OAAO,CAAC,sCAAsC,EAAEA,QAAQ,EAAE,CAAC;QAC7D;IACF;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../../src/build/webpack/plugins/middleware-plugin.ts"],"sourcesContent":["import type {\n AssetBinding,\n EdgeMiddlewareMeta,\n} from '../loaders/get-module-build-info'\nimport type { EdgeSSRMeta } from '../loaders/get-module-build-info'\nimport type { ProxyMatcher } from '../../analysis/get-page-static-info'\nimport { getNamedMiddlewareRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport path from 'path'\nimport {\n EDGE_RUNTIME_WEBPACK,\n EDGE_UNSUPPORTED_NODE_APIS,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n MIDDLEWARE_MANIFEST,\n MIDDLEWARE_REACT_LOADABLE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n NEXT_FONT_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n SERVER_FILES_MANIFEST,\n} from '../../../shared/lib/constants'\nimport type { ProxyConfig } from '../../analysis/get-page-static-info'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport { traceGlobals } from '../../../trace/shared'\nimport { EVENT_BUILD_FEATURE_USAGE } from '../../../telemetry/events'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport {\n INSTRUMENTATION_HOOK_FILENAME,\n WEBPACK_LAYERS,\n} from '../../../lib/constants'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { isInterceptionRouteRewrite } from '../../../lib/is-interception-route-rewrite'\nimport { getDynamicCodeEvaluationError } from './wellknown-errors-plugin/parse-dynamic-code-evaluation-error'\nimport { getModuleReferencesInOrder } from '../utils'\n\nconst KNOWN_SAFE_DYNAMIC_PACKAGES =\n require('../../../lib/known-edge-safe-packages.json') as string[]\n\nexport interface EdgeFunctionDefinition {\n files: string[]\n name: string\n page: string\n matchers: ProxyMatcher[]\n env: Record<string, string>\n wasm?: AssetBinding[]\n assets?: AssetBinding[]\n regions?: string[] | string\n}\n\nexport interface MiddlewareManifest {\n version: 3\n sortedMiddleware: string[]\n middleware: { [page: string]: EdgeFunctionDefinition }\n functions: { [page: string]: EdgeFunctionDefinition }\n}\n\ninterface EntryMetadata {\n edgeMiddleware?: EdgeMiddlewareMeta\n edgeApiFunction?: EdgeMiddlewareMeta\n edgeSSR?: EdgeSSRMeta\n wasmBindings: Map<string, string>\n assetBindings: Map<string, string>\n regions?: string[] | string\n}\n\nconst NAME = 'MiddlewarePlugin'\nconst MANIFEST_VERSION = 3\n\n/**\n * Checks the value of usingIndirectEval and when it is a set of modules it\n * check if any of the modules is actually being used. If the value is\n * simply truthy it will return true.\n */\nfunction isUsingIndirectEvalAndUsedByExports(args: {\n module: webpack.Module\n moduleGraph: webpack.ModuleGraph\n runtime: any\n usingIndirectEval: true | Set<string>\n wp: typeof webpack\n}): boolean {\n const { moduleGraph, runtime, module, usingIndirectEval, wp } = args\n if (typeof usingIndirectEval === 'boolean') {\n return usingIndirectEval\n }\n\n const exportsInfo = moduleGraph.getExportsInfo(module)\n for (const exportName of usingIndirectEval) {\n if (exportsInfo.getUsed(exportName, runtime) !== wp.UsageState.Unused) {\n return true\n }\n }\n\n return false\n}\n\nfunction getEntryFiles(\n entryFiles: string[],\n meta: EntryMetadata,\n hasInstrumentationHook: boolean,\n opts: Options\n) {\n const files: string[] = []\n if (meta.edgeSSR) {\n if (meta.edgeSSR.isServerComponent) {\n files.push(`server/${SERVER_REFERENCE_MANIFEST}.js`)\n if (opts.sriEnabled) {\n files.push(`server/${SUBRESOURCE_INTEGRITY_MANIFEST}.js`)\n }\n files.push(\n ...entryFiles\n .filter(\n (file) =>\n file.startsWith('app/') && !file.endsWith('.hot-update.js')\n )\n .map(\n (file) =>\n 'server/' +\n file.replace(/\\.js$/, '_' + CLIENT_REFERENCE_MANIFEST + '.js')\n )\n )\n }\n if (!opts.dev && !meta.edgeSSR.isAppDir) {\n files.push(`server/${DYNAMIC_CSS_MANIFEST}.js`)\n }\n\n files.push(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,\n `server/${NEXT_FONT_MANIFEST}.js`,\n `server/${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n\n if (!opts.dev) {\n files.push(`${SERVER_FILES_MANIFEST}.js`)\n }\n }\n\n if (hasInstrumentationHook) {\n files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`)\n }\n\n files.push(\n ...entryFiles\n .filter((file) => !file.endsWith('.hot-update.js'))\n .map((file) => 'server/' + file)\n )\n\n return files\n}\n\nfunction getCreateAssets(params: {\n compilation: webpack.Compilation\n metadataByEntry: Map<string, EntryMetadata>\n opts: Options\n}) {\n const { compilation, metadataByEntry, opts } = params\n return () => {\n const middlewareManifest: MiddlewareManifest = {\n version: MANIFEST_VERSION,\n middleware: {},\n functions: {},\n sortedMiddleware: [],\n }\n\n const hasInstrumentationHook = compilation.entrypoints.has(\n INSTRUMENTATION_HOOK_FILENAME\n )\n\n // we only emit this entry for the edge runtime since it doesn't have access to a routes manifest\n // and we don't need to provide the entire route manifest, just the interception routes.\n const interceptionRewrites = JSON.stringify(\n opts.rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n compilation.emitAsset(\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )}`\n ) as unknown as webpack.sources.RawSource\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (!entrypoint.name) {\n continue\n }\n\n // There should always be metadata for the entrypoint.\n const metadata = metadataByEntry.get(entrypoint.name)\n const page =\n metadata?.edgeMiddleware?.page ||\n metadata?.edgeSSR?.page ||\n metadata?.edgeApiFunction?.page\n if (!page) {\n continue\n }\n\n const matcherSource = metadata.edgeSSR?.isAppDir\n ? normalizeAppPath(page)\n : page\n\n const catchAll = !metadata.edgeSSR && !metadata.edgeApiFunction\n\n const { namedRegex } = getNamedMiddlewareRegex(matcherSource, {\n catchAll,\n })\n const matchers = metadata?.edgeMiddleware?.matchers ?? [\n {\n regexp: namedRegex,\n originalSource: page === '/' && catchAll ? '/:path*' : matcherSource,\n },\n ]\n\n const isEdgeFunction = !!(metadata.edgeApiFunction || metadata.edgeSSR)\n const edgeFunctionDefinition: EdgeFunctionDefinition = {\n files: getEntryFiles(\n entrypoint.getFiles(),\n metadata,\n hasInstrumentationHook,\n opts\n ),\n name: entrypoint.name,\n page: page,\n matchers,\n wasm: Array.from(metadata.wasmBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n assets: Array.from(metadata.assetBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n env: opts.edgeEnvironments,\n ...(metadata.regions && { regions: metadata.regions }),\n }\n\n if (isEdgeFunction) {\n middlewareManifest.functions[page] = edgeFunctionDefinition\n } else {\n middlewareManifest.middleware[page] = edgeFunctionDefinition\n }\n }\n\n middlewareManifest.sortedMiddleware = getSortedRoutes(\n Object.keys(middlewareManifest.middleware)\n )\n\n compilation.emitAsset(\n MIDDLEWARE_MANIFEST,\n new sources.RawSource(\n JSON.stringify(middlewareManifest, null, 2)\n ) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction buildWebpackError({\n message,\n loc,\n compilation,\n entryModule,\n parser,\n}: {\n message: string\n loc?: any\n compilation: webpack.Compilation\n entryModule?: webpack.Module\n parser?: webpack.javascript.JavascriptParser\n}) {\n const error = new compilation.compiler.webpack.WebpackError(message)\n error.name = NAME\n const module = entryModule ?? parser?.state.current\n if (module) {\n error.module = module\n }\n error.loc = loc\n return error\n}\n\nfunction isInMiddlewareLayer(parser: webpack.javascript.JavascriptParser) {\n const layer = parser.state.module?.layer\n return layer === WEBPACK_LAYERS.middleware || layer === WEBPACK_LAYERS.apiEdge\n}\n\nfunction isNodeJsModule(moduleName: string) {\n return (require('module') as typeof import('module')).builtinModules.includes(\n moduleName\n )\n}\n\nfunction isBunModule(moduleName: string) {\n return moduleName === 'bun' || moduleName.startsWith('bun:')\n}\n\nfunction isDynamicCodeEvaluationAllowed(\n fileName: string,\n middlewareConfig?: ProxyConfig,\n rootDir?: string\n) {\n // Some packages are known to use `eval` but are safe to use in the Edge\n // Runtime because the dynamic code will never be executed.\n if (\n KNOWN_SAFE_DYNAMIC_PACKAGES.some((pkg) =>\n fileName.includes(`/node_modules/${pkg}/`.replace(/\\//g, path.sep))\n )\n ) {\n return true\n }\n\n const name = fileName.replace(rootDir ?? '', '')\n\n return picomatch(middlewareConfig?.unstable_allowDynamic ?? [], {\n dot: true,\n })(name)\n}\n\nfunction buildUnsupportedApiError({\n apiName,\n loc,\n ...rest\n}: {\n apiName: string\n loc: any\n compilation: webpack.Compilation\n parser: webpack.javascript.JavascriptParser\n}) {\n return buildWebpackError({\n message: `A Node.js API is used (${apiName} at line: ${loc.start.line}) which is not supported in the Edge Runtime.\nLearn more: https://nextjs.org/docs/api-reference/edge-runtime`,\n loc,\n ...rest,\n })\n}\n\nfunction registerUnsupportedApiHooks(\n parser: webpack.javascript.JavascriptParser,\n compilation: webpack.Compilation\n) {\n for (const expression of EDGE_UNSUPPORTED_NODE_APIS) {\n const warnForUnsupportedApi = (node: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: expression,\n ...node,\n })\n )\n return true\n }\n parser.hooks.call.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.expression.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.callMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n parser.hooks.expressionMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n }\n\n const warnForUnsupportedProcessApi = (node: any, [callee]: string[]) => {\n if (!isInMiddlewareLayer(parser) || callee === 'env') {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: `process.${callee}`,\n ...node,\n })\n )\n return true\n }\n\n parser.hooks.callMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n parser.hooks.expressionMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n}\n\nfunction getCodeAnalyzer(params: {\n dev: boolean\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n}) {\n return (parser: webpack.javascript.JavascriptParser) => {\n const {\n dev,\n compiler: { webpack: wp },\n compilation,\n } = params\n const { hooks } = parser\n\n /**\n * For an expression this will check the graph to ensure it is being used\n * by exports. Then it will store in the module buildInfo a boolean to\n * express that it contains dynamic code and, if it is available, the\n * module path that is using it.\n */\n const handleExpression = () => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n wp.optimize.InnerGraph.onUsage(parser.state, (used = true) => {\n const buildInfo = getModuleBuildInfo(parser.state.module)\n if (buildInfo.usingIndirectEval === true || used === false) {\n return\n }\n\n if (!buildInfo.usingIndirectEval || used === true) {\n buildInfo.usingIndirectEval = used\n return\n }\n\n buildInfo.usingIndirectEval = new Set([\n ...Array.from(buildInfo.usingIndirectEval),\n ...Array.from(used),\n ])\n })\n }\n\n /**\n * This expression handler allows to wrap a dynamic code expression with a\n * function call where we can warn about dynamic code not being allowed\n * but actually execute the expression.\n */\n const handleWrapExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_eval__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n return true\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.compile invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n */\n const handleWrapWasmCompileExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_compile__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.instatiate invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n *\n * Note that we don't update `usingIndirectEval`, i.e. we don't abort a production build\n * since we can't determine statically if the first parameter is a module (legit use) or\n * a buffer (dynamic code generation).\n */\n const handleWrapWasmInstantiateExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n if (dev) {\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_instantiate__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n }\n }\n\n /**\n * Handler to store original source location of static and dynamic imports into module's buildInfo.\n */\n const handleImport = (node: any) => {\n if (isInMiddlewareLayer(parser) && node.source?.value && node?.loc) {\n const { module, source } = parser.state\n const buildInfo = getModuleBuildInfo(module)\n if (!buildInfo.importLocByPath) {\n buildInfo.importLocByPath = new Map()\n }\n\n const importedModule = node.source.value?.toString()\n buildInfo.importLocByPath.set(importedModule, {\n sourcePosition: {\n ...node.loc.start,\n source: module.identifier(),\n },\n sourceContent: source.toString(),\n })\n\n if (\n !dev &&\n (isNodeJsModule(importedModule) || isBunModule(importedModule)) &&\n !SUPPORTED_NATIVE_MODULES.includes(importedModule)\n ) {\n const isBun = isBunModule(importedModule)\n compilation.warnings.push(\n buildWebpackError({\n message: `A ${isBun ? 'Bun' : 'Node.js'} module is loaded ('${importedModule}' at line ${node.loc.start.line}) which is not supported in the Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`,\n compilation,\n parser,\n ...node,\n })\n )\n }\n }\n }\n\n /**\n * A noop handler to skip analyzing some cases.\n * Order matters: for it to work, it must be registered first\n */\n const skip = () => (isInMiddlewareLayer(parser) ? true : undefined)\n\n for (const prefix of ['', 'global.']) {\n hooks.expression.for(`${prefix}Function.prototype`).tap(NAME, skip)\n hooks.expression.for(`${prefix}Function.bind`).tap(NAME, skip)\n hooks.call.for(`${prefix}eval`).tap(NAME, handleWrapExpression)\n hooks.call.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.new.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.call\n .for(`${prefix}WebAssembly.compile`)\n .tap(NAME, handleWrapWasmCompileExpression)\n hooks.call\n .for(`${prefix}WebAssembly.instantiate`)\n .tap(NAME, handleWrapWasmInstantiateExpression)\n }\n\n hooks.importCall.tap(NAME, handleImport)\n hooks.import.tap(NAME, handleImport)\n\n if (!dev) {\n // do not issue compilation warning on dev: invoking code will provide details\n registerUnsupportedApiHooks(parser, compilation)\n }\n }\n}\n\nasync function codeAnalyzerBySwc(\n compilation: webpack.Compilation,\n modules: Iterable<webpack.Module>,\n dev: boolean\n) {\n const binding = require('../../swc') as typeof import('../../swc')\n for (const module of modules) {\n if (\n module.layer !== WEBPACK_LAYERS.middleware &&\n module.layer !== WEBPACK_LAYERS.apiEdge\n ) {\n continue\n }\n if (module.constructor.name !== 'NormalModule') {\n continue\n }\n const normalModule = module as webpack.NormalModule\n if (!normalModule.type.startsWith('javascript')) {\n // Only analyze JavaScript modules\n continue\n }\n const originalSource = normalModule.originalSource()\n if (!originalSource) {\n continue\n }\n const source = originalSource.source()\n if (typeof source !== 'string') {\n continue\n }\n const diagnostics = await binding.warnForEdgeRuntime(source, !dev)\n for (const diagnostic of diagnostics) {\n const webpackError = buildWebpackError({\n message: diagnostic.message,\n loc: diagnostic.loc,\n compilation,\n entryModule: module,\n })\n if (diagnostic.severity === 'Warning') {\n compilation.warnings.push(webpackError)\n } else {\n compilation.errors.push(webpackError)\n }\n }\n }\n}\n\nfunction getExtractMetadata(params: {\n compilation: webpack.Compilation\n compiler: webpack.Compiler\n dev: boolean\n metadataByEntry: Map<string, EntryMetadata>\n}): () => Promise<void> {\n const { dev, compilation, metadataByEntry, compiler } = params\n const { webpack: wp } = compiler\n return async () => {\n metadataByEntry.clear()\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n\n for (const [entryName, entry] of compilation.entries) {\n if (entry.options.runtime !== EDGE_RUNTIME_WEBPACK) {\n // Only process edge runtime entries\n continue\n }\n const entryDependency = entry.dependencies?.[0]\n const resolvedModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)\n if (!resolvedModule) {\n continue\n }\n const { rootDir, route } = getModuleBuildInfo(resolvedModule)\n\n const { moduleGraph } = compilation\n const modules = new Set<webpack.NormalModule>()\n const addEntriesFromDependency = (dependency: any) => {\n const module = moduleGraph.getModule(dependency)\n if (module) {\n modules.add(module as webpack.NormalModule)\n }\n }\n\n entry.dependencies.forEach(addEntriesFromDependency)\n entry.includeDependencies.forEach(addEntriesFromDependency)\n\n const entryMetadata: EntryMetadata = {\n wasmBindings: new Map(),\n assetBindings: new Map(),\n }\n\n if (route?.middlewareConfig?.regions) {\n entryMetadata.regions = route.middlewareConfig.regions\n }\n\n if (route?.preferredRegion) {\n const preferredRegion = route.preferredRegion\n entryMetadata.regions =\n // Ensures preferredRegion is always an array in the manifest.\n typeof preferredRegion === 'string'\n ? [preferredRegion]\n : preferredRegion\n }\n\n let ogImageGenerationCount = 0\n\n for (const module of modules) {\n const buildInfo = getModuleBuildInfo(module)\n\n /**\n * Check if it uses the image generation feature.\n */\n if (!dev) {\n const resource = module.resource\n const hasOGImageGeneration =\n resource &&\n /[\\\\/]node_modules[\\\\/]@vercel[\\\\/]og[\\\\/]dist[\\\\/]index\\.(edge|node)\\.js$|[\\\\/]next[\\\\/]dist[\\\\/](esm[\\\\/])?server[\\\\/]og[\\\\/]image-response\\.js$/.test(\n resource\n )\n\n if (hasOGImageGeneration) {\n ogImageGenerationCount++\n }\n }\n\n /**\n * When building for production checks if the module is using `eval`\n * and in such case produces a compilation error. The module has to\n * be in use.\n */\n if (\n !dev &&\n buildInfo.usingIndirectEval &&\n isUsingIndirectEvalAndUsedByExports({\n module,\n moduleGraph,\n runtime: wp.util.runtime.getEntryRuntime(compilation, entryName),\n usingIndirectEval: buildInfo.usingIndirectEval,\n wp,\n })\n ) {\n const id = module.identifier()\n if (/node_modules[\\\\/]regenerator-runtime[\\\\/]runtime\\.js/.test(id)) {\n continue\n }\n if (route?.middlewareConfig?.unstable_allowDynamic) {\n telemetry?.record({\n eventName: 'NEXT_EDGE_ALLOW_DYNAMIC_USED',\n payload: {\n file: route?.absolutePagePath.replace(rootDir ?? '', ''),\n config: route?.middlewareConfig,\n fileWithDynamicCode: module.userRequest.replace(\n rootDir ?? '',\n ''\n ),\n },\n })\n }\n if (\n !isDynamicCodeEvaluationAllowed(\n module.userRequest,\n route?.middlewareConfig,\n rootDir\n )\n ) {\n const message = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime ${\n typeof buildInfo.usingIndirectEval !== 'boolean'\n ? `\\nUsed by ${Array.from(buildInfo.usingIndirectEval).join(\n ', '\n )}`\n : ''\n }\\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`\n compilation.errors.push(\n getDynamicCodeEvaluationError(\n message,\n module,\n compilation,\n compiler\n )\n )\n }\n }\n\n /**\n * The entry module has to be either a page or a middleware and hold\n * the corresponding metadata.\n */\n if (buildInfo?.nextEdgeSSR) {\n entryMetadata.edgeSSR = buildInfo.nextEdgeSSR\n } else if (buildInfo?.nextEdgeMiddleware) {\n entryMetadata.edgeMiddleware = buildInfo.nextEdgeMiddleware\n } else if (buildInfo?.nextEdgeApiFunction) {\n entryMetadata.edgeApiFunction = buildInfo.nextEdgeApiFunction\n }\n\n /**\n * If the module is a WASM module we read the binding information and\n * append it to the entry wasm bindings.\n */\n if (buildInfo?.nextWasmMiddlewareBinding) {\n entryMetadata.wasmBindings.set(\n buildInfo.nextWasmMiddlewareBinding.name,\n buildInfo.nextWasmMiddlewareBinding.filePath\n )\n }\n\n if (buildInfo?.nextAssetMiddlewareBinding) {\n entryMetadata.assetBindings.set(\n buildInfo.nextAssetMiddlewareBinding.name,\n buildInfo.nextAssetMiddlewareBinding.filePath\n )\n }\n\n /**\n * Append to the list of modules to process outgoingConnections from\n * the module that is being processed.\n */\n for (const conn of getModuleReferencesInOrder(module, moduleGraph)) {\n if (conn.module) {\n modules.add(conn.module as webpack.NormalModule)\n }\n }\n }\n\n telemetry?.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'vercelImageGeneration',\n invocationCount: ogImageGenerationCount,\n },\n })\n metadataByEntry.set(entryName, entryMetadata)\n }\n }\n}\n\n// These values will be replaced again in edge runtime deployment build.\n// `buildId` represents BUILD_ID to be externalized in env vars.\n// `encryptionKey` represents server action encryption key to be externalized in env vars.\ntype EdgeRuntimeEnvironments = Record<string, string> & {\n __NEXT_BUILD_ID: string\n NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: string\n}\n\ninterface Options {\n dev: boolean\n sriEnabled: boolean\n rewrites: CustomRoutes['rewrites']\n edgeEnvironments: EdgeRuntimeEnvironments\n}\n\nexport default class MiddlewarePlugin {\n private readonly dev: Options['dev']\n private readonly sriEnabled: Options['sriEnabled']\n private readonly rewrites: Options['rewrites']\n private readonly edgeEnvironments: EdgeRuntimeEnvironments\n\n constructor({ dev, sriEnabled, rewrites, edgeEnvironments }: Options) {\n this.dev = dev\n this.sriEnabled = sriEnabled\n this.rewrites = rewrites\n this.edgeEnvironments = edgeEnvironments\n }\n\n public apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(NAME, (compilation, params) => {\n // parser hooks aren't available in rspack\n if (process.env.NEXT_RSPACK) {\n compilation.hooks.finishModules.tapPromise(NAME, async (modules) => {\n await codeAnalyzerBySwc(compilation, modules, this.dev)\n })\n } else {\n const { hooks } = params.normalModuleFactory\n /**\n * This is the static code analysis phase.\n */\n const codeAnalyzer = getCodeAnalyzer({\n dev: this.dev,\n compiler,\n compilation,\n })\n\n hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)\n }\n\n /**\n * Extract all metadata for the entry points in a Map object.\n */\n const metadataByEntry = new Map<string, EntryMetadata>()\n compilation.hooks.finishModules.tapPromise(\n NAME,\n getExtractMetadata({\n compilation,\n compiler,\n dev: this.dev,\n metadataByEntry,\n })\n )\n\n /**\n * Emit the middleware manifest.\n */\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsMiddlewareManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n getCreateAssets({\n compilation,\n metadataByEntry,\n opts: {\n sriEnabled: this.sriEnabled,\n rewrites: this.rewrites,\n edgeEnvironments: this.edgeEnvironments,\n dev: this.dev,\n },\n })\n )\n })\n }\n}\n\nexport const SUPPORTED_NATIVE_MODULES = [\n 'buffer',\n 'events',\n 'assert',\n 'util',\n 'async_hooks',\n] as const\n\nconst supportedEdgePolyfills = new Set<string>(SUPPORTED_NATIVE_MODULES)\n\nexport function getEdgePolyfilledModules() {\n const records: Record<string, string> = {}\n for (const mod of SUPPORTED_NATIVE_MODULES) {\n records[mod] = `commonjs node:${mod}`\n records[`node:${mod}`] = `commonjs node:${mod}`\n }\n return records\n}\n\nexport async function handleWebpackExternalForEdgeRuntime({\n request,\n context,\n contextInfo,\n getResolve,\n}: {\n request: string\n context: string\n contextInfo: any\n getResolve: () => any\n}) {\n if (\n (contextInfo.issuerLayer === WEBPACK_LAYERS.middleware ||\n contextInfo.issuerLayer === WEBPACK_LAYERS.apiEdge) &&\n (isNodeJsModule(request) || isBunModule(request)) &&\n !supportedEdgePolyfills.has(request)\n ) {\n // allows user to provide and use their polyfills, as we do with buffer.\n try {\n await getResolve()(context, request)\n } catch {\n return `root globalThis.__import_unsupported('${request}')`\n }\n }\n}\n"],"names":["SUPPORTED_NATIVE_MODULES","MiddlewarePlugin","getEdgePolyfilledModules","handleWebpackExternalForEdgeRuntime","KNOWN_SAFE_DYNAMIC_PACKAGES","require","NAME","MANIFEST_VERSION","isUsingIndirectEvalAndUsedByExports","args","moduleGraph","runtime","module","usingIndirectEval","wp","exportsInfo","getExportsInfo","exportName","getUsed","UsageState","Unused","getEntryFiles","entryFiles","meta","hasInstrumentationHook","opts","files","edgeSSR","isServerComponent","push","SERVER_REFERENCE_MANIFEST","sriEnabled","SUBRESOURCE_INTEGRITY_MANIFEST","filter","file","startsWith","endsWith","map","replace","CLIENT_REFERENCE_MANIFEST","dev","isAppDir","DYNAMIC_CSS_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_REACT_LOADABLE_MANIFEST","NEXT_FONT_MANIFEST","INTERCEPTION_ROUTE_REWRITE_MANIFEST","SERVER_FILES_MANIFEST","INSTRUMENTATION_HOOK_FILENAME","getCreateAssets","params","compilation","metadataByEntry","middlewareManifest","version","middleware","functions","sortedMiddleware","entrypoints","has","interceptionRewrites","JSON","stringify","rewrites","beforeFiles","isInterceptionRouteRewrite","emitAsset","sources","RawSource","entrypoint","values","metadata","name","get","page","edgeMiddleware","edgeApiFunction","matcherSource","normalizeAppPath","catchAll","namedRegex","getNamedMiddlewareRegex","matchers","regexp","originalSource","isEdgeFunction","edgeFunctionDefinition","getFiles","wasm","Array","from","wasmBindings","filePath","assets","assetBindings","env","edgeEnvironments","regions","getSortedRoutes","Object","keys","MIDDLEWARE_MANIFEST","buildWebpackError","message","loc","entryModule","parser","error","compiler","webpack","WebpackError","state","current","isInMiddlewareLayer","layer","WEBPACK_LAYERS","apiEdge","isNodeJsModule","moduleName","builtinModules","includes","isBunModule","isDynamicCodeEvaluationAllowed","fileName","middlewareConfig","rootDir","some","pkg","path","sep","picomatch","unstable_allowDynamic","dot","buildUnsupportedApiError","apiName","rest","start","line","registerUnsupportedApiHooks","expression","EDGE_UNSUPPORTED_NODE_APIS","warnForUnsupportedApi","node","warnings","hooks","call","for","tap","callMemberChain","expressionMemberChain","warnForUnsupportedProcessApi","callee","getCodeAnalyzer","handleExpression","optimize","InnerGraph","onUsage","used","buildInfo","getModuleBuildInfo","Set","handleWrapExpression","expr","ConstDependency","dependencies","dep1","range","addPresentationalDependency","dep2","handleWrapWasmCompileExpression","handleWrapWasmInstantiateExpression","handleImport","source","value","importLocByPath","Map","importedModule","toString","set","sourcePosition","identifier","sourceContent","isBun","skip","undefined","prefix","new","importCall","import","codeAnalyzerBySwc","modules","binding","constructor","normalModule","type","diagnostics","warnForEdgeRuntime","diagnostic","webpackError","severity","errors","getExtractMetadata","clear","telemetry","traceGlobals","entryName","entry","entries","route","options","EDGE_RUNTIME_WEBPACK","entryDependency","resolvedModule","getResolvedModule","addEntriesFromDependency","dependency","getModule","add","forEach","includeDependencies","entryMetadata","preferredRegion","ogImageGenerationCount","resource","hasOGImageGeneration","test","util","getEntryRuntime","id","record","eventName","payload","absolutePagePath","config","fileWithDynamicCode","userRequest","join","getDynamicCodeEvaluationError","nextEdgeSSR","nextEdgeMiddleware","nextEdgeApiFunction","nextWasmMiddlewareBinding","nextAssetMiddlewareBinding","conn","getModuleReferencesInOrder","EVENT_BUILD_FEATURE_USAGE","featureName","invocationCount","apply","process","NEXT_RSPACK","finishModules","tapPromise","normalModuleFactory","codeAnalyzer","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS","supportedEdgePolyfills","records","mod","request","context","contextInfo","getResolve","issuerLayer"],"mappings":";;;;;;;;;;;;;;;;;IAo4BaA,wBAAwB;eAAxBA;;IAzEb,OAuEC;eAvEoBC;;IAmFLC,wBAAwB;eAAxBA;;IASMC,mCAAmC;eAAnCA;;;4BAj5BkB;oCACL;uBACH;yBACC;kEACX;6DACL;2BAcV;wBAGsB;wBACa;0BACT;4BAI1B;4CAEoC;iDACG;wBACH;;;;;;AAE3C,MAAMC,8BACJC,QAAQ;AA6BV,MAAMC,OAAO;AACb,MAAMC,mBAAmB;AAEzB;;;;CAIC,GACD,SAASC,oCAAoCC,IAM5C;IACC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAAA,OAAM,EAAEC,iBAAiB,EAAEC,EAAE,EAAE,GAAGL;IAChE,IAAI,OAAOI,sBAAsB,WAAW;QAC1C,OAAOA;IACT;IAEA,MAAME,cAAcL,YAAYM,cAAc,CAACJ;IAC/C,KAAK,MAAMK,cAAcJ,kBAAmB;QAC1C,IAAIE,YAAYG,OAAO,CAACD,YAAYN,aAAaG,GAAGK,UAAU,CAACC,MAAM,EAAE;YACrE,OAAO;QACT;IACF;IAEA,OAAO;AACT;AAEA,SAASC,cACPC,UAAoB,EACpBC,IAAmB,EACnBC,sBAA+B,EAC/BC,IAAa;IAEb,MAAMC,QAAkB,EAA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C,CAAAA,eAAeiJ,YAAY7I,YAAY6I,QAAO,KAC/C,CAACH,uBAAuBxM,GAAG,CAAC2M,UAC5B;QACA,wEAAwE;QACxE,IAAI;YACF,MAAMG,aAAaF,SAASD;QAC9B,EAAE,OAAM;YACN,OAAO,CAAC,sCAAsC,EAAEA,QAAQ,EAAE,CAAC;QAC7D;IACF;AACF","ignoreList":[0]}

@@ -6,5 +6,5 @@ 1:"$Sreact.fragment"

7:"$Sreact.suspense"
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/7ad0cfe59941881a.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/7ad0cfe59941881a.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false}
4:{}
5:"$0:rsc:props:children:0:props:serverProvidedParams:params"
8:null

@@ -12,3 +12,3 @@ 1:"$Sreact.fragment"

:HL["/_next/static/chunks/adecd0ef71a11c8f.css","style"]
0:{"P":null,"b":"w96VZFVTSStw1Rrwv0Sre","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@6","$@7"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/7ad0cfe59941881a.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$","$9",null,{"name":"Next.MetadataOutlet","children":"$@a"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lb",null,{"children":"$@c"}],["$","div",null,{"hidden":true,"children":["$","$Ld",null,{"children":["$","$9",null,{"name":"Next.Metadata","children":"$@e"}]}]}],null]}],false]],"m":"$undefined","G":["$f",[]],"S":true}
0:{"P":null,"b":"QyWAb8Axbkvy9rsKOL67w","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@6","$@7"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/7ad0cfe59941881a.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$","$9",null,{"name":"Next.MetadataOutlet","children":"$@a"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lb",null,{"children":"$@c"}],["$","div",null,{"hidden":true,"children":["$","$Ld",null,{"children":["$","$9",null,{"name":"Next.Metadata","children":"$@e"}]}]}],null]}],false]],"m":"$undefined","G":["$f",[]],"S":true}
6:{}

@@ -15,0 +15,0 @@ 7:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params"

@@ -5,4 +5,4 @@ 1:"$Sreact.fragment"

5:"$Sreact.suspense"
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":"$@3"}],["$","div",null,{"hidden":true,"children":["$","$L4",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@6"}]}]}],null]}],"loading":null,"isPartial":false}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":"$@3"}],["$","div",null,{"hidden":true,"children":["$","$L4",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@6"}]}]}],null]}],"loading":null,"isPartial":false}
3:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
6:[["$","title","0",{"children":"Next.js Bundle Analyzer"}],["$","meta","1",{"name":"description","content":"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"}]]

@@ -5,2 +5,2 @@ 1:"$Sreact.fragment"

:HL["/_next/static/chunks/adecd0ef71a11c8f.css","style"]
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]]}]]}],"loading":null,"isPartial":false}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]]}]]}],"loading":null,"isPartial":false}
:HL["/_next/static/chunks/adecd0ef71a11c8f.css","style"]
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300}

@@ -1,2 +0,2 @@

<!DOCTYPE html><!--w96VZFVTSStw1Rrwv0Sre--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/adecd0ef71a11c8f.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/97a17dedf3427d39.js"/><script src="/_next/static/chunks/9be24395e3178207.js" async=""></script><script src="/_next/static/chunks/ee5f636b04419243.js" async=""></script><script src="/_next/static/chunks/turbopack-4dd24f2e148b226e.js" async=""></script><script src="/_next/static/chunks/33e2a22d0ca5f8ce.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>Next.js Bundle Analyzer</title><meta name="description" content="Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"/><script>
<!DOCTYPE html><!--QyWAb8Axbkvy9rsKOL67w--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/adecd0ef71a11c8f.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/97a17dedf3427d39.js"/><script src="/_next/static/chunks/9be24395e3178207.js" async=""></script><script src="/_next/static/chunks/ee5f636b04419243.js" async=""></script><script src="/_next/static/chunks/turbopack-4dd24f2e148b226e.js" async=""></script><script src="/_next/static/chunks/33e2a22d0ca5f8ce.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>Next.js Bundle Analyzer</title><meta name="description" content="Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"/><script>
(function() {

@@ -10,2 +10,2 @@ const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';

})();
</script><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/97a17dedf3427d39.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[71535,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n3:I[90209,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n4:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"ViewportBoundary\"]\n9:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"MetadataBoundary\"]\nb:I[61090,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n:HL[\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"w96VZFVTSStw1Rrwv0Sre\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/33e2a22d0ca5f8ce.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\\n document.documentElement.classList.toggle('dark', theme === 'dark');\\n\\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) =\u003e {\\n document.documentElement.classList.toggle('dark', e.matches);\\n });\\n })();\\n \"}}]}],[\"$\",\"body\",null,{\"className\":\"font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L7\",null,{\"children\":\"$@8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@a\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"title\",\"0\",{\"children\":\"Next.js Bundle Analyzer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis\"}]]\n6:null\n"])</script></body></html>
</script><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/97a17dedf3427d39.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[71535,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n3:I[90209,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n4:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"ViewportBoundary\"]\n9:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"MetadataBoundary\"]\nb:I[61090,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n:HL[\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"QyWAb8Axbkvy9rsKOL67w\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/33e2a22d0ca5f8ce.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\\n document.documentElement.classList.toggle('dark', theme === 'dark');\\n\\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) =\u003e {\\n document.documentElement.classList.toggle('dark', e.matches);\\n });\\n })();\\n \"}}]}],[\"$\",\"body\",null,{\"className\":\"font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L7\",null,{\"children\":\"$@8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@a\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"title\",\"0\",{\"children\":\"Next.js Bundle Analyzer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis\"}]]\n6:null\n"])</script></body></html>

@@ -10,5 +10,5 @@ 1:"$Sreact.fragment"

:HL["/_next/static/chunks/adecd0ef71a11c8f.css","style"]
0:{"P":null,"b":"w96VZFVTSStw1Rrwv0Sre","c":["","_not-found"],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/33e2a22d0ca5f8ce.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L4",null,{"children":["$","$5",null,{"name":"Next.MetadataOutlet","children":"$@6"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L7",null,{"children":"$@8"}],["$","div",null,{"hidden":true,"children":["$","$L9",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@a"}]}]}],null]}],false]],"m":"$undefined","G":["$b","$undefined"],"S":true}
0:{"P":null,"b":"QyWAb8Axbkvy9rsKOL67w","c":["","_not-found"],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/33e2a22d0ca5f8ce.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L4",null,{"children":["$","$5",null,{"name":"Next.MetadataOutlet","children":"$@6"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L7",null,{"children":"$@8"}],["$","div",null,{"hidden":true,"children":["$","$L9",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@a"}]}]}],null]}],false]],"m":"$undefined","G":["$b","$undefined"],"S":true}
8:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
a:[["$","title","0",{"children":"Next.js Bundle Analyzer"}],["$","meta","1",{"name":"description","content":"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"}]]
6:null

@@ -10,5 +10,5 @@ 1:"$Sreact.fragment"

:HL["/_next/static/chunks/adecd0ef71a11c8f.css","style"]
0:{"P":null,"b":"w96VZFVTSStw1Rrwv0Sre","c":["","_not-found"],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/33e2a22d0ca5f8ce.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L4",null,{"children":["$","$5",null,{"name":"Next.MetadataOutlet","children":"$@6"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L7",null,{"children":"$@8"}],["$","div",null,{"hidden":true,"children":["$","$L9",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@a"}]}]}],null]}],false]],"m":"$undefined","G":["$b","$undefined"],"S":true}
0:{"P":null,"b":"QyWAb8Axbkvy9rsKOL67w","c":["","_not-found"],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/33e2a22d0ca5f8ce.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L4",null,{"children":["$","$5",null,{"name":"Next.MetadataOutlet","children":"$@6"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L7",null,{"children":"$@8"}],["$","div",null,{"hidden":true,"children":["$","$L9",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@a"}]}]}],null]}],false]],"m":"$undefined","G":["$b","$undefined"],"S":true}
8:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
a:[["$","title","0",{"children":"Next.js Bundle Analyzer"}],["$","meta","1",{"name":"description","content":"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"}]]
6:null

@@ -5,4 +5,4 @@ 1:"$Sreact.fragment"

5:"$Sreact.suspense"
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L2",null,{"children":"$@3"}],["$","div",null,{"hidden":true,"children":["$","$L4",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@6"}]}]}],null]}],"loading":null,"isPartial":false}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L2",null,{"children":"$@3"}],["$","div",null,{"hidden":true,"children":["$","$L4",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@6"}]}]}],null]}],"loading":null,"isPartial":false}
3:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
6:[["$","title","0",{"children":"Next.js Bundle Analyzer"}],["$","meta","1",{"name":"description","content":"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"}]]

@@ -5,2 +5,2 @@ 1:"$Sreact.fragment"

:HL["/_next/static/chunks/adecd0ef71a11c8f.css","style"]
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next"}],["$","script","script-0",{"src":"/_next/static/chunks/33e2a22d0ca5f8ce.js","async":true}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]]}]]}],"loading":null,"isPartial":false}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next"}],["$","script","script-0",{"src":"/_next/static/chunks/33e2a22d0ca5f8ce.js","async":true}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]]}]]}],"loading":null,"isPartial":false}
1:"$Sreact.fragment"
2:I[3268,["/_next/static/chunks/33e2a22d0ca5f8ce.js"],"OutletBoundary"]
3:"$Sreact.suspense"
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","rsc":["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],null,["$","$L2",null,{"children":["$","$3",null,{"name":"Next.MetadataOutlet","children":"$@4"}]}]]}],"loading":null,"isPartial":false}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","rsc":["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],null,["$","$L2",null,{"children":["$","$3",null,{"name":"Next.MetadataOutlet","children":"$@4"}]}]]}],"loading":null,"isPartial":false}
4:null
1:"$Sreact.fragment"
2:I[71535,["/_next/static/chunks/33e2a22d0ca5f8ce.js"],"default"]
3:I[90209,["/_next/static/chunks/33e2a22d0ca5f8ce.js"],"default"]
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false}
:HL["/_next/static/chunks/adecd0ef71a11c8f.css","style"]
0:{"buildId":"w96VZFVTSStw1Rrwv0Sre","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"/_not-found","paramType":null,"paramKey":"/_not-found","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":false}},"isRootLayout":true},"staleTime":300}
0:{"buildId":"QyWAb8Axbkvy9rsKOL67w","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"/_not-found","paramType":null,"paramKey":"/_not-found","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":false}},"isRootLayout":true},"staleTime":300}

@@ -1,2 +0,2 @@

<!DOCTYPE html><!--w96VZFVTSStw1Rrwv0Sre--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/adecd0ef71a11c8f.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/97a17dedf3427d39.js"/><script src="/_next/static/chunks/9be24395e3178207.js" async=""></script><script src="/_next/static/chunks/ee5f636b04419243.js" async=""></script><script src="/_next/static/chunks/turbopack-4dd24f2e148b226e.js" async=""></script><script src="/_next/static/chunks/33e2a22d0ca5f8ce.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>Next.js Bundle Analyzer</title><meta name="description" content="Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"/><script>
<!DOCTYPE html><!--QyWAb8Axbkvy9rsKOL67w--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/adecd0ef71a11c8f.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/97a17dedf3427d39.js"/><script src="/_next/static/chunks/9be24395e3178207.js" async=""></script><script src="/_next/static/chunks/ee5f636b04419243.js" async=""></script><script src="/_next/static/chunks/turbopack-4dd24f2e148b226e.js" async=""></script><script src="/_next/static/chunks/33e2a22d0ca5f8ce.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>Next.js Bundle Analyzer</title><meta name="description" content="Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"/><script>
(function() {

@@ -10,2 +10,2 @@ const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';

})();
</script><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/97a17dedf3427d39.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[71535,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n3:I[90209,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n4:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"ViewportBoundary\"]\n9:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"MetadataBoundary\"]\nb:I[61090,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n:HL[\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"w96VZFVTSStw1Rrwv0Sre\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/33e2a22d0ca5f8ce.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\\n document.documentElement.classList.toggle('dark', theme === 'dark');\\n\\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) =\u003e {\\n document.documentElement.classList.toggle('dark', e.matches);\\n });\\n })();\\n \"}}]}],[\"$\",\"body\",null,{\"className\":\"font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L7\",null,{\"children\":\"$@8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@a\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"title\",\"0\",{\"children\":\"Next.js Bundle Analyzer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis\"}]]\n6:null\n"])</script></body></html>
</script><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/97a17dedf3427d39.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[71535,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n3:I[90209,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n4:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"ViewportBoundary\"]\n9:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"MetadataBoundary\"]\nb:I[61090,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n:HL[\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"QyWAb8Axbkvy9rsKOL67w\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/33e2a22d0ca5f8ce.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\\n document.documentElement.classList.toggle('dark', theme === 'dark');\\n\\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) =\u003e {\\n document.documentElement.classList.toggle('dark', e.matches);\\n });\\n })();\\n \"}}]}],[\"$\",\"body\",null,{\"className\":\"font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:1:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L7\",null,{\"children\":\"$@8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@a\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"title\",\"0\",{\"children\":\"Next.js Bundle Analyzer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis\"}]]\n6:null\n"])</script></body></html>

@@ -1,2 +0,2 @@

<!DOCTYPE html><!--w96VZFVTSStw1Rrwv0Sre--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/adecd0ef71a11c8f.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/97a17dedf3427d39.js"/><script src="/_next/static/chunks/9be24395e3178207.js" async=""></script><script src="/_next/static/chunks/ee5f636b04419243.js" async=""></script><script src="/_next/static/chunks/turbopack-4dd24f2e148b226e.js" async=""></script><script src="/_next/static/chunks/33e2a22d0ca5f8ce.js" async=""></script><script src="/_next/static/chunks/7ad0cfe59941881a.js" async=""></script><title>Next.js Bundle Analyzer</title><meta name="description" content="Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"/><script>
<!DOCTYPE html><!--QyWAb8Axbkvy9rsKOL67w--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/adecd0ef71a11c8f.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/97a17dedf3427d39.js"/><script src="/_next/static/chunks/9be24395e3178207.js" async=""></script><script src="/_next/static/chunks/ee5f636b04419243.js" async=""></script><script src="/_next/static/chunks/turbopack-4dd24f2e148b226e.js" async=""></script><script src="/_next/static/chunks/33e2a22d0ca5f8ce.js" async=""></script><script src="/_next/static/chunks/7ad0cfe59941881a.js" async=""></script><title>Next.js Bundle Analyzer</title><meta name="description" content="Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis"/><script>
(function() {

@@ -10,2 +10,2 @@ const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';

})();
</script><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><main class="h-screen flex flex-col bg-background"><div class="flex-none px-4 py-2 border-b border-border flex items-center gap-3"><div class="flex-1 flex"><div class="flex items-center gap-2 min-w-64 max-w-full"><button class="inline-flex items-center gap-2 whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground h-9 px-4 py-2 flex-grow-1 w-full justify-between font-mono text-sm" role="combobox" aria-expanded="false" disabled="" type="button" aria-haspopup="dialog" aria-controls="radix-_R_lbtb_" data-state="closed"><div class="flex items-center"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader mr-2 inline animate-spin" aria-hidden="true"><path d="M12 2v4"></path><path d="m16.2 7.8 2.9-2.9"></path><path d="M18 12h4"></path><path d="m16.2 16.2 2.9 2.9"></path><path d="M12 18v4"></path><path d="m4.9 19.1 2.9-2.9"></path><path d="M2 12h4"></path><path d="m4.9 4.9 2.9 2.9"></path></svg>Loading routes...</div><div class="flex items-center gap-2"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevrons-up-down h-4 w-4 shrink-0 opacity-50" aria-hidden="true"><path d="m7 15 5 5 5-5"></path><path d="m7 9 5-5 5 5"></path></svg></div></button></div></div><div class="flex items-center gap-2"></div></div><div class="flex-1 flex min-h-0"><div class="flex-1 min-w-0 p-4 bg-background"><div class="h-full w-full grid grid-cols-12 grid-rows-8 gap-2"><div class="animate-pulse rounded-md bg-muted col-span-5 row-span-4"></div><div class="animate-pulse rounded-md bg-muted col-span-4 row-span-3"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-3"></div><div class="animate-pulse rounded-md bg-muted col-span-4 row-span-1"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-4"></div><div class="animate-pulse rounded-md bg-muted col-span-2 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-2 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-4 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-2 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-2"></div></div></div><button type="button" class="flex-none w-1 bg-border cursor-col-resize transition-colors" disabled="" aria-label="Resize sidebar"></button><div class="flex-none bg-muted border-l border-border overflow-y-auto" style="width:20%"><div class="flex-1 p-3 space-y-4 overflow-y-auto"><div class="animate-pulse rounded-md bg-muted h-4 w-3/4"></div><div class="animate-pulse rounded-md bg-muted h-4 w-full"></div><div class="animate-pulse rounded-md bg-muted h-4 w-5/6"></div><div class="mt-4 space-y-2"><div class="animate-pulse rounded-md bg-muted h-3 w-full"></div><div class="animate-pulse rounded-md bg-muted h-3 w-full"></div><div class="animate-pulse rounded-md bg-muted h-3 w-4/5"></div></div></div></div></div></main><!--$--><!--/$--><script src="/_next/static/chunks/97a17dedf3427d39.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[71535,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n3:I[90209,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n4:I[34828,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"ClientPageRoot\"]\n5:I[79331,[\"/_next/static/chunks/7ad0cfe59941881a.js\"],\"default\"]\n8:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"OutletBoundary\"]\n9:\"$Sreact.suspense\"\nb:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"ViewportBoundary\"]\nd:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"MetadataBoundary\"]\nf:I[61090,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n:HL[\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"w96VZFVTSStw1Rrwv0Sre\",\"c\":[\"\",\"\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\\n document.documentElement.classList.toggle('dark', theme === 'dark');\\n\\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) =\u003e {\\n document.documentElement.classList.toggle('dark', e.matches);\\n });\\n })();\\n \"}}]}],[\"$\",\"body\",null,{\"className\":\"font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"$L4\",null,{\"Component\":\"$5\",\"serverProvidedParams\":{\"searchParams\":{},\"params\":{},\"promises\":[\"$@6\",\"$@7\"]}}],[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/7ad0cfe59941881a.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L8\",null,{\"children\":[\"$\",\"$9\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@a\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$Lb\",null,{\"children\":\"$@c\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Ld\",null,{\"children\":[\"$\",\"$9\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@e\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$f\",[]],\"S\":true}\n"])</script><script>self.__next_f.push([1,"6:{}\n7:\"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params\"\n"])</script><script>self.__next_f.push([1,"c:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"e:[[\"$\",\"title\",\"0\",{\"children\":\"Next.js Bundle Analyzer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis\"}]]\na:null\n"])</script></body></html>
</script><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><main class="h-screen flex flex-col bg-background"><div class="flex-none px-4 py-2 border-b border-border flex items-center gap-3"><div class="flex-1 flex"><div class="flex items-center gap-2 min-w-64 max-w-full"><button class="inline-flex items-center gap-2 whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg]:size-4 [&amp;_svg]:shrink-0 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground h-9 px-4 py-2 flex-grow-1 w-full justify-between font-mono text-sm" role="combobox" aria-expanded="false" disabled="" type="button" aria-haspopup="dialog" aria-controls="radix-_R_lbtb_" data-state="closed"><div class="flex items-center"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader mr-2 inline animate-spin" aria-hidden="true"><path d="M12 2v4"></path><path d="m16.2 7.8 2.9-2.9"></path><path d="M18 12h4"></path><path d="m16.2 16.2 2.9 2.9"></path><path d="M12 18v4"></path><path d="m4.9 19.1 2.9-2.9"></path><path d="M2 12h4"></path><path d="m4.9 4.9 2.9 2.9"></path></svg>Loading routes...</div><div class="flex items-center gap-2"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevrons-up-down h-4 w-4 shrink-0 opacity-50" aria-hidden="true"><path d="m7 15 5 5 5-5"></path><path d="m7 9 5-5 5 5"></path></svg></div></button></div></div><div class="flex items-center gap-2"></div></div><div class="flex-1 flex min-h-0"><div class="flex-1 min-w-0 p-4 bg-background"><div class="h-full w-full grid grid-cols-12 grid-rows-8 gap-2"><div class="animate-pulse rounded-md bg-muted col-span-5 row-span-4"></div><div class="animate-pulse rounded-md bg-muted col-span-4 row-span-3"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-3"></div><div class="animate-pulse rounded-md bg-muted col-span-4 row-span-1"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-4"></div><div class="animate-pulse rounded-md bg-muted col-span-2 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-2 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-4 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-2 row-span-2"></div><div class="animate-pulse rounded-md bg-muted col-span-3 row-span-2"></div></div></div><button type="button" class="flex-none w-1 bg-border cursor-col-resize transition-colors" disabled="" aria-label="Resize sidebar"></button><div class="flex-none bg-muted border-l border-border overflow-y-auto" style="width:20%"><div class="flex-1 p-3 space-y-4 overflow-y-auto"><div class="animate-pulse rounded-md bg-muted h-4 w-3/4"></div><div class="animate-pulse rounded-md bg-muted h-4 w-full"></div><div class="animate-pulse rounded-md bg-muted h-4 w-5/6"></div><div class="mt-4 space-y-2"><div class="animate-pulse rounded-md bg-muted h-3 w-full"></div><div class="animate-pulse rounded-md bg-muted h-3 w-full"></div><div class="animate-pulse rounded-md bg-muted h-3 w-4/5"></div></div></div></div></div></main><!--$--><!--/$--><script src="/_next/static/chunks/97a17dedf3427d39.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[71535,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n3:I[90209,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n4:I[34828,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"ClientPageRoot\"]\n5:I[79331,[\"/_next/static/chunks/7ad0cfe59941881a.js\"],\"default\"]\n8:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"OutletBoundary\"]\n9:\"$Sreact.suspense\"\nb:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"ViewportBoundary\"]\nd:I[3268,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"MetadataBoundary\"]\nf:I[61090,[\"/_next/static/chunks/33e2a22d0ca5f8ce.js\"],\"default\"]\n:HL[\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"QyWAb8Axbkvy9rsKOL67w\",\"c\":[\"\",\"\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/adecd0ef71a11c8f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\\n document.documentElement.classList.toggle('dark', theme === 'dark');\\n\\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) =\u003e {\\n document.documentElement.classList.toggle('dark', e.matches);\\n });\\n })();\\n \"}}]}],[\"$\",\"body\",null,{\"className\":\"font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"$L4\",null,{\"Component\":\"$5\",\"serverProvidedParams\":{\"searchParams\":{},\"params\":{},\"promises\":[\"$@6\",\"$@7\"]}}],[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/7ad0cfe59941881a.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L8\",null,{\"children\":[\"$\",\"$9\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@a\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$Lb\",null,{\"children\":\"$@c\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Ld\",null,{\"children\":[\"$\",\"$9\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@e\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$f\",[]],\"S\":true}\n"])</script><script>self.__next_f.push([1,"6:{}\n7:\"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params\"\n"])</script><script>self.__next_f.push([1,"c:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"e:[[\"$\",\"title\",\"0\",{\"children\":\"Next.js Bundle Analyzer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Visualize and analyze your Next.js bundle sizes with interactive treemap and dependency analysis\"}]]\na:null\n"])</script></body></html>

@@ -12,3 +12,3 @@ 1:"$Sreact.fragment"

:HL["/_next/static/chunks/adecd0ef71a11c8f.css","style"]
0:{"P":null,"b":"w96VZFVTSStw1Rrwv0Sre","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@6","$@7"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/7ad0cfe59941881a.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$","$9",null,{"name":"Next.MetadataOutlet","children":"$@a"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lb",null,{"children":"$@c"}],["$","div",null,{"hidden":true,"children":["$","$Ld",null,{"children":["$","$9",null,{"name":"Next.Metadata","children":"$@e"}]}]}],null]}],false]],"m":"$undefined","G":["$f",[]],"S":true}
0:{"P":null,"b":"QyWAb8Axbkvy9rsKOL67w","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/adecd0ef71a11c8f.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n (function() {\n const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n document.documentElement.classList.toggle('dark', theme === 'dark');\n\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {\n document.documentElement.classList.toggle('dark', e.matches);\n });\n })();\n "}}]}],["$","body",null,{"className":"font-sans antialiased","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@6","$@7"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/7ad0cfe59941881a.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$","$9",null,{"name":"Next.MetadataOutlet","children":"$@a"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lb",null,{"children":"$@c"}],["$","div",null,{"hidden":true,"children":["$","$Ld",null,{"children":["$","$9",null,{"name":"Next.Metadata","children":"$@e"}]}]}],null]}],false]],"m":"$undefined","G":["$f",[]],"S":true}
6:{}

@@ -15,0 +15,0 @@ 7:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params"

@@ -18,3 +18,3 @@ /**

const _setattributesfromprops = require("./set-attributes-from-props");
const version = "16.2.0-canary.72";
const version = "16.2.0-canary.73";
window.next = {

@@ -21,0 +21,0 @@ version,

@@ -63,3 +63,3 @@ /* global location */ // imports polyfill from `@next/polyfill-module` after build.

const _isnextroutererror = require("./components/is-next-router-error");
const version = "16.2.0-canary.72";
const version = "16.2.0-canary.73";
let router;

@@ -66,0 +66,0 @@ const emitter = (0, _mitt.default)();

@@ -1,2 +0,2 @@

import { promises as fs } from 'fs';
import { readFileSync } from 'fs';
import { relative } from 'path';

@@ -238,5 +238,5 @@ import { LRUCache } from '../../server/lib/lru-cache';

}
async function tryToReadFile(filePath, shouldThrow) {
function tryToReadFile(filePath, shouldThrow) {
try {
return await fs.readFile(filePath, {
return readFileSync(filePath, {
encoding: 'utf8'

@@ -354,3 +354,3 @@ });

export async function getAppPageStaticInfo({ pageFilePath, nextConfig, isDev, page }) {
const content = await tryToReadFile(pageFilePath, !isDev);
const content = tryToReadFile(pageFilePath, !isDev);
if (!content || !PARSE_PATTERN.test(content)) {

@@ -444,3 +444,3 @@ return {

var _config_config, _config_config1, _config_config2;
const content = await tryToReadFile(pageFilePath, !isDev);
const content = tryToReadFile(pageFilePath, !isDev);
if (!content || !PARSE_PATTERN.test(content)) {

@@ -447,0 +447,0 @@ return {

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../src/build/analysis/get-page-static-info.ts"],"sourcesContent":["import type { NextConfig } from '../../server/config-shared'\nimport type { RouteHas } from '../../lib/load-custom-routes'\n\nimport { promises as fs } from 'fs'\nimport { relative } from 'path'\nimport { LRUCache } from '../../server/lib/lru-cache'\nimport {\n extractExportedConstValue,\n UnsupportedValueError,\n} from './extract-const-value'\nimport { parseModule } from './parse-module'\nimport * as Log from '../output/log'\nimport {\n SERVER_RUNTIME,\n MIDDLEWARE_FILENAME,\n PROXY_FILENAME,\n} from '../../lib/constants'\nimport { tryToParsePath } from '../../lib/try-to-parse-path'\nimport { isAPIRoute } from '../../lib/is-api-route'\nimport { isEdgeRuntime } from '../../lib/is-edge-runtime'\nimport { RSC_MODULE_TYPES } from '../../shared/lib/constants'\nimport type { RSCMeta } from '../webpack/loaders/get-module-build-info'\nimport { PAGE_TYPES } from '../../lib/page-types'\nimport {\n AppSegmentConfigSchemaKeys,\n parseAppSegmentConfig,\n type AppSegmentConfig,\n} from '../segment-config/app/app-segment-config'\nimport { reportZodError } from '../../shared/lib/zod'\nimport {\n PagesSegmentConfigSchemaKeys,\n parsePagesSegmentConfig,\n type PagesSegmentConfig,\n type PagesSegmentConfigConfig,\n} from '../segment-config/pages/pages-segment-config'\nimport {\n MiddlewareConfigInputSchema,\n SourceSchema,\n type MiddlewareConfigMatcherInput,\n} from '../segment-config/middleware/middleware-config'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isProxyFile } from '../utils'\n\nconst PARSE_PATTERN =\n /(?<!(_jsx|jsx-))runtime|preferredRegion|getStaticProps|getServerSideProps|generateStaticParams|export const|generateImageMetadata|generateSitemaps|middleware|proxy/\n\nexport type ProxyMatcher = {\n regexp: string\n locale?: false\n has?: RouteHas[]\n missing?: RouteHas[]\n originalSource: string\n}\n\nexport type ProxyConfig = {\n /**\n * The matcher for the proxy. Read more: [Next.js Docs: Proxy `matcher`](https://nextjs.org/docs/app/api-reference/file-conventions/proxy#matcher),\n * [Next.js Docs: Proxy matching paths](https://nextjs.org/docs/app/building-your-application/routing/proxy#matching-paths)\n */\n matchers?: ProxyMatcher[]\n\n /**\n * The regions that the proxy should run in.\n */\n regions?: string | string[]\n\n /**\n * A glob, or an array of globs, ignoring dynamic code evaluation for specific\n * files. The globs are relative to your application root folder.\n */\n unstable_allowDynamic?: string[]\n}\n\nexport interface AppPageStaticInfo {\n type: PAGE_TYPES.APP\n ssg?: boolean\n ssr?: boolean\n rsc?: RSCModuleType\n generateStaticParams?: boolean\n generateSitemaps?: boolean\n generateImageMetadata?: boolean\n middleware?: ProxyConfig\n config: Omit<AppSegmentConfig, 'runtime' | 'maxDuration'> | undefined\n runtime: AppSegmentConfig['runtime'] | undefined\n preferredRegion: AppSegmentConfig['preferredRegion'] | undefined\n maxDuration: number | undefined\n hadUnsupportedValue: boolean\n}\n\nexport interface PagesPageStaticInfo {\n type: PAGE_TYPES.PAGES\n getStaticProps?: boolean\n getServerSideProps?: boolean\n rsc?: RSCModuleType\n generateStaticParams?: boolean\n generateSitemaps?: boolean\n generateImageMetadata?: boolean\n middleware?: ProxyConfig\n config:\n | (Omit<PagesSegmentConfig, 'runtime' | 'config' | 'maxDuration'> & {\n config?: Omit<PagesSegmentConfigConfig, 'runtime' | 'maxDuration'>\n })\n | undefined\n runtime: PagesSegmentConfig['runtime'] | undefined\n preferredRegion: PagesSegmentConfigConfig['regions'] | undefined\n maxDuration: number | undefined\n hadUnsupportedValue: boolean\n}\n\nexport type PageStaticInfo = AppPageStaticInfo | PagesPageStaticInfo\n\nconst CLIENT_MODULE_LABEL =\n /\\/\\* __next_internal_client_entry_do_not_use__ ([^ ]*) (cjs|auto) \\*\\//\n\n// Match JSON object that may contain nested objects (for loc info)\n// The JSON ends right before the closing \" */\"\nconst ACTION_MODULE_LABEL =\n /\\/\\* __next_internal_action_entry_do_not_use__ (\\{.*\\}) \\*\\//\n\nconst CLIENT_DIRECTIVE = 'use client'\nconst SERVER_ACTION_DIRECTIVE = 'use server'\n\nexport type RSCModuleType = 'server' | 'client'\nexport function getRSCModuleInformation(\n source: string,\n isReactServerLayer: boolean\n): RSCMeta {\n const actionsJson = source.match(ACTION_MODULE_LABEL)\n // Parse action metadata - supports both old format (string) and new format (object with loc)\n const parsedActionsMeta = actionsJson\n ? (JSON.parse(actionsJson[1]) as RSCMeta['actionIds'])\n : undefined\n const clientInfoMatch = source.match(CLIENT_MODULE_LABEL)\n const isClientRef = !!clientInfoMatch\n\n if (!isReactServerLayer) {\n return {\n type: RSC_MODULE_TYPES.client,\n actionIds: parsedActionsMeta,\n isClientRef,\n }\n }\n\n const clientRefsString = clientInfoMatch?.[1]\n const clientRefs = clientRefsString ? clientRefsString.split(',') : []\n const clientEntryType = clientInfoMatch?.[2] as 'cjs' | 'auto' | undefined\n\n const type = clientInfoMatch\n ? RSC_MODULE_TYPES.client\n : RSC_MODULE_TYPES.server\n\n return {\n type,\n actionIds: parsedActionsMeta,\n clientRefs,\n clientEntryType,\n isClientRef,\n }\n}\n\n/**\n * Receives a parsed AST from SWC and checks if it belongs to a module that\n * requires a runtime to be specified. Those are:\n * - Modules with `export function getStaticProps | getServerSideProps`\n * - Modules with `export { getStaticProps | getServerSideProps } <from ...>`\n * - Modules with `export const runtime = ...`\n */\nfunction checkExports(\n ast: any,\n expectedExports: string[],\n page: string\n): {\n getStaticProps?: boolean\n getServerSideProps?: boolean\n generateImageMetadata?: boolean\n generateSitemaps?: boolean\n generateStaticParams?: boolean\n directives?: Set<string>\n exports?: Set<string>\n} {\n const exportsSet = new Set<string>([\n 'getStaticProps',\n 'getServerSideProps',\n 'generateImageMetadata',\n 'generateSitemaps',\n 'generateStaticParams',\n ])\n if (!Array.isArray(ast?.body)) {\n return {}\n }\n\n try {\n let getStaticProps: boolean = false\n let getServerSideProps: boolean = false\n let generateImageMetadata: boolean = false\n let generateSitemaps: boolean = false\n let generateStaticParams = false\n let exports = new Set<string>()\n let directives = new Set<string>()\n let hasLeadingNonDirectiveNode = false\n\n for (const node of ast.body) {\n // There should be no non-string literals nodes before directives\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'StringLiteral'\n ) {\n if (!hasLeadingNonDirectiveNode) {\n const directive = node.expression.value\n if (CLIENT_DIRECTIVE === directive) {\n directives.add('client')\n }\n if (SERVER_ACTION_DIRECTIVE === directive) {\n directives.add('server')\n }\n }\n } else {\n hasLeadingNonDirectiveNode = true\n }\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n for (const declaration of node.declaration?.declarations) {\n if (expectedExports.includes(declaration.id.value)) {\n exports.add(declaration.id.value)\n }\n }\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration' &&\n exportsSet.has(node.declaration.identifier?.value)\n ) {\n const id = node.declaration.identifier.value\n getServerSideProps = id === 'getServerSideProps'\n getStaticProps = id === 'getStaticProps'\n generateImageMetadata = id === 'generateImageMetadata'\n generateSitemaps = id === 'generateSitemaps'\n generateStaticParams = id === 'generateStaticParams'\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n const id = node.declaration?.declarations[0]?.id.value\n if (exportsSet.has(id)) {\n getServerSideProps = id === 'getServerSideProps'\n getStaticProps = id === 'getStaticProps'\n generateImageMetadata = id === 'generateImageMetadata'\n generateSitemaps = id === 'generateSitemaps'\n generateStaticParams = id === 'generateStaticParams'\n }\n }\n\n if (node.type === 'ExportNamedDeclaration') {\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.orig?.type === 'Identifier'\n ) {\n const value = specifier.orig.value\n\n if (!getServerSideProps && value === 'getServerSideProps') {\n getServerSideProps = true\n }\n if (!getStaticProps && value === 'getStaticProps') {\n getStaticProps = true\n }\n if (!generateImageMetadata && value === 'generateImageMetadata') {\n generateImageMetadata = true\n }\n if (!generateSitemaps && value === 'generateSitemaps') {\n generateSitemaps = true\n }\n if (!generateStaticParams && value === 'generateStaticParams') {\n generateStaticParams = true\n }\n if (expectedExports.includes(value) && !exports.has(value)) {\n // An export was found that was actually a re-export, and not a\n // literal value. We should warn here.\n Log.warn(\n `Next.js can't recognize the exported \\`${value}\\` field in \"${page}\", it may be re-exported from another file. The default config will be used instead.`\n )\n }\n }\n }\n }\n }\n\n return {\n getStaticProps,\n getServerSideProps,\n generateImageMetadata,\n generateSitemaps,\n generateStaticParams,\n directives,\n exports,\n }\n } catch {}\n\n return {}\n}\n\nfunction validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n}: {\n ast: any\n page: string\n pageFilePath: string\n isDev: boolean\n}): void {\n // Check if this is middleware/proxy\n const isMiddleware =\n page === `/${MIDDLEWARE_FILENAME}` || page === `/src/${MIDDLEWARE_FILENAME}`\n const isProxy =\n page === `/${PROXY_FILENAME}` || page === `/src/${PROXY_FILENAME}`\n\n if (!isMiddleware && !isProxy) {\n return\n }\n\n if (!ast || !Array.isArray(ast.body)) {\n return\n }\n\n const fileName = isProxy ? PROXY_FILENAME : MIDDLEWARE_FILENAME\n\n // Parse AST to get export info (since checkExports doesn't return middleware/proxy info)\n let hasDefaultExport = false\n let hasMiddlewareExport = false\n let hasProxyExport = false\n\n for (const node of ast.body) {\n if (\n node.type === 'ExportDefaultDeclaration' ||\n node.type === 'ExportDefaultExpression'\n ) {\n hasDefaultExport = true\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration'\n ) {\n const id = node.declaration.identifier?.value\n if (id === 'middleware') {\n hasMiddlewareExport = true\n }\n if (id === 'proxy') {\n hasProxyExport = true\n }\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n const id = node.declaration?.declarations[0]?.id.value\n if (id === 'middleware') {\n hasMiddlewareExport = true\n }\n if (id === 'proxy') {\n hasProxyExport = true\n }\n }\n\n if (node.type === 'ExportNamedDeclaration') {\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.orig?.type === 'Identifier'\n ) {\n // Use the exported name if it exists (for aliased exports like `export { foo as proxy }`),\n // otherwise fall back to the original name (for simple re-exports like `export { proxy }`)\n const exportedIdentifier = specifier.exported || specifier.orig\n const value = exportedIdentifier.value\n if (value === 'middleware') {\n hasMiddlewareExport = true\n }\n if (value === 'proxy') {\n hasProxyExport = true\n }\n }\n }\n }\n }\n\n const hasValidExport =\n hasDefaultExport ||\n (isMiddleware && hasMiddlewareExport) ||\n (isProxy && hasProxyExport)\n\n const relativePath = relative(process.cwd(), pageFilePath)\n const resolvedPath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`\n\n if (!hasValidExport) {\n const message =\n `The file \"${resolvedPath}\" must export a function, either as a default export or as a named \"${fileName}\" export.\\n` +\n `This function is what Next.js runs for every request handled by this ${fileName === 'proxy' ? 'proxy (previously called middleware)' : 'middleware'}.\\n\\n` +\n `Why this happens:\\n` +\n (isProxy\n ? \"- You are migrating from `middleware` to `proxy`, but haven't updated the exported function.\\n\"\n : '') +\n `- The file exists but doesn't export a function.\\n` +\n `- The export is not a function (e.g., an object or constant).\\n` +\n `- There's a syntax error preventing the export from being recognized.\\n\\n` +\n `To fix it:\\n` +\n `- Ensure this file has either a default or \"${fileName}\" function export.\\n\\n` +\n `Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n\n if (isDev) {\n // errorOnce as proxy/middleware runs per request including multiple\n // internal _next/ routes and spams logs.\n Log.errorOnce(message)\n } else {\n throw new Error(message)\n }\n }\n}\n\nasync function tryToReadFile(filePath: string, shouldThrow: boolean) {\n try {\n return await fs.readFile(filePath, {\n encoding: 'utf8',\n })\n } catch (error: any) {\n if (shouldThrow) {\n error.message = `Next.js ERROR: Failed to read file ${filePath}:\\n${error.message}`\n throw error\n }\n }\n}\n\n/**\n * @internal - required to exclude zod types from the build\n */\nexport function getMiddlewareMatchers(\n matcherOrMatchers: MiddlewareConfigMatcherInput,\n nextConfig: Pick<NextConfig, 'basePath' | 'i18n'>\n): ProxyMatcher[] {\n const matchers = Array.isArray(matcherOrMatchers)\n ? matcherOrMatchers\n : [matcherOrMatchers]\n\n const { i18n } = nextConfig\n\n return matchers.map((matcher) => {\n matcher = typeof matcher === 'string' ? { source: matcher } : matcher\n\n const originalSource = matcher.source\n\n let { source, ...rest } = matcher\n\n const isRoot = source === '/'\n\n if (i18n?.locales && matcher.locale !== false) {\n source = `/:nextInternalLocale((?!_next/)[^/.]{1,})${\n isRoot ? '' : source\n }`\n }\n\n source = `/:nextData(_next/data/[^/]{1,})?${source}${\n isRoot\n ? `(${nextConfig.i18n ? '|\\\\.json|' : ''}/?index|/?index\\\\.json)?`\n : '{(\\\\.json)}?'\n }`\n\n if (nextConfig.basePath) {\n source = `${nextConfig.basePath}${source}`\n }\n\n // Validate that the source is still.\n const result = SourceSchema.safeParse(source)\n if (!result.success) {\n reportZodError('Failed to parse middleware source', result.error)\n\n // We need to exit here because middleware being built occurs before we\n // finish setting up the server. Exiting here is the only way to ensure\n // that we don't hang.\n process.exit(1)\n }\n\n return {\n ...rest,\n // We know that parsed.regexStr is not undefined because we already\n // checked that the source is valid.\n regexp: tryToParsePath(result.data).regexStr!,\n originalSource: originalSource || source,\n }\n })\n}\n\nfunction parseMiddlewareConfig(\n page: string,\n rawConfig: unknown,\n nextConfig: NextConfig\n): ProxyConfig {\n // If there's no config to parse, then return nothing.\n if (typeof rawConfig !== 'object' || !rawConfig) return {}\n\n const input = MiddlewareConfigInputSchema.safeParse(rawConfig)\n if (!input.success) {\n reportZodError(`${page} contains invalid middleware config`, input.error)\n\n // We need to exit here because middleware being built occurs before we\n // finish setting up the server. Exiting here is the only way to ensure\n // that we don't hang.\n process.exit(1)\n }\n\n const config: ProxyConfig = {}\n\n if (input.data.matcher) {\n config.matchers = getMiddlewareMatchers(input.data.matcher, nextConfig)\n }\n\n if (input.data.unstable_allowDynamic) {\n config.unstable_allowDynamic = Array.isArray(\n input.data.unstable_allowDynamic\n )\n ? input.data.unstable_allowDynamic\n : [input.data.unstable_allowDynamic]\n }\n\n if (input.data.regions) {\n config.regions = input.data.regions\n }\n\n return config\n}\n\nconst apiRouteWarnings = new LRUCache(250)\nfunction warnAboutExperimentalEdge(apiRoute: string | null) {\n if (\n process.env.NODE_ENV === 'production' &&\n process.env.NEXT_PRIVATE_BUILD_WORKER === '1'\n ) {\n return\n }\n\n if (apiRoute && apiRouteWarnings.has(apiRoute)) {\n return\n }\n\n Log.warn(\n apiRoute\n ? `${apiRoute} provided runtime 'experimental-edge'. It can be updated to 'edge' instead.`\n : `You are using an experimental edge runtime, the API might change.`\n )\n\n if (apiRoute) {\n apiRouteWarnings.set(apiRoute, 1)\n }\n}\n\nlet hadUnsupportedValue = false\nconst warnedUnsupportedValueMap = new LRUCache<boolean>(250, () => 1)\n\nfunction warnAboutUnsupportedValue(\n pageFilePath: string,\n page: string | undefined,\n error: UnsupportedValueError\n) {\n hadUnsupportedValue = true\n const isProductionBuild = process.env.NODE_ENV === 'production'\n if (\n // we only log for the server compilation so it's not\n // duplicated due to webpack build worker having fresh\n // module scope for each compiler\n process.env.NEXT_COMPILER_NAME !== 'server' ||\n (isProductionBuild && warnedUnsupportedValueMap.has(pageFilePath))\n ) {\n return\n }\n warnedUnsupportedValueMap.set(pageFilePath, true)\n\n const message =\n `Next.js can't recognize the exported \\`config\\` field in ` +\n (page ? `route \"${page}\"` : `\"${pageFilePath}\"`) +\n ':\\n' +\n error.message +\n (error.path ? ` at \"${error.path}\"` : '') +\n '.\\n' +\n 'Read More - https://nextjs.org/docs/messages/invalid-page-config'\n\n // for a build we use `Log.error` instead of throwing\n // so that all errors can be logged before exiting the process\n if (isProductionBuild) {\n Log.error(message)\n } else {\n throw new Error(message)\n }\n}\n\ntype GetPageStaticInfoParams = {\n pageFilePath: string\n nextConfig: Partial<NextConfig>\n isDev: boolean\n page: string\n pageType: PAGE_TYPES\n}\n\nexport async function getAppPageStaticInfo({\n pageFilePath,\n nextConfig,\n isDev,\n page,\n}: GetPageStaticInfoParams): Promise<AppPageStaticInfo> {\n const content = await tryToReadFile(pageFilePath, !isDev)\n if (!content || !PARSE_PATTERN.test(content)) {\n return {\n type: PAGE_TYPES.APP,\n config: undefined,\n runtime: undefined,\n preferredRegion: undefined,\n maxDuration: undefined,\n hadUnsupportedValue: false,\n }\n }\n\n const ast = await parseModule(pageFilePath, content)\n validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n })\n\n const {\n generateStaticParams,\n generateImageMetadata,\n generateSitemaps,\n exports,\n directives,\n } = checkExports(ast, AppSegmentConfigSchemaKeys, page)\n\n const { type: rsc } = getRSCModuleInformation(content, true)\n\n const exportedConfig: Record<string, unknown> = {}\n if (exports) {\n for (const property of exports) {\n try {\n exportedConfig[property] = extractExportedConstValue(ast, property)\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n }\n }\n }\n\n try {\n exportedConfig.config = extractExportedConstValue(ast, 'config')\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n // `export config` doesn't exist, or other unknown error thrown by swc, silence them\n }\n\n const route = normalizeAppPath(page)\n const config = parseAppSegmentConfig(exportedConfig, route)\n\n // Prevent edge runtime and generateStaticParams in the same file.\n if (isEdgeRuntime(config.runtime) && generateStaticParams) {\n throw new Error(\n `Page \"${page}\" cannot use both \\`export const runtime = 'edge'\\` and export \\`generateStaticParams\\`.`\n )\n }\n\n // Prevent use client and generateStaticParams in the same file.\n if (directives?.has('client') && generateStaticParams) {\n throw new Error(\n `Page \"${page}\" cannot use both \"use client\" and export function \"generateStaticParams()\".`\n )\n }\n\n // Prevent use client and unstable_instant in the same file.\n if (directives?.has('client') && 'unstable_instant' in config) {\n throw new Error(\n `Page \"${page}\" cannot export \"unstable_instant\" from a Client Component module. To use this API, convert this module to a Server Component by removing the \"use client\" directive.`\n )\n }\n\n if ('unstable_instant' in config && !nextConfig.cacheComponents) {\n throw new Error(\n `Page \"${page}\" cannot use \\`export const unstable_instant = ...\\` without enabling \\`cacheComponents\\`.`\n )\n }\n\n return {\n type: PAGE_TYPES.APP,\n rsc,\n generateImageMetadata,\n generateSitemaps,\n generateStaticParams,\n config,\n middleware: parseMiddlewareConfig(page, exportedConfig.config, nextConfig),\n runtime: config.runtime,\n preferredRegion: config.preferredRegion,\n maxDuration: config.maxDuration,\n hadUnsupportedValue,\n }\n}\n\nexport async function getPagesPageStaticInfo({\n pageFilePath,\n nextConfig,\n isDev,\n page,\n}: GetPageStaticInfoParams): Promise<PagesPageStaticInfo> {\n const content = await tryToReadFile(pageFilePath, !isDev)\n if (!content || !PARSE_PATTERN.test(content)) {\n return {\n type: PAGE_TYPES.PAGES,\n config: undefined,\n runtime: undefined,\n preferredRegion: undefined,\n maxDuration: undefined,\n hadUnsupportedValue: false,\n }\n }\n\n const ast = await parseModule(pageFilePath, content)\n validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n })\n\n const { getServerSideProps, getStaticProps, exports } = checkExports(\n ast,\n PagesSegmentConfigSchemaKeys,\n page\n )\n\n const { type: rsc } = getRSCModuleInformation(content, true)\n\n const exportedConfig: Record<string, unknown> = {}\n if (exports) {\n for (const property of exports) {\n try {\n exportedConfig[property] = extractExportedConstValue(ast, property)\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n }\n }\n }\n\n try {\n exportedConfig.config = extractExportedConstValue(ast, 'config')\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n // `export config` doesn't exist, or other unknown error thrown by swc, silence them\n }\n\n // Validate the config.\n const route = normalizePagePath(page)\n const config = parsePagesSegmentConfig(exportedConfig, route)\n const isAnAPIRoute = isAPIRoute(route)\n\n let resolvedRuntime = config.runtime ?? config.config?.runtime\n\n if (isProxyFile(page) && resolvedRuntime) {\n const relativePath = relative(process.cwd(), pageFilePath)\n const resolvedPath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`\n const message = `Route segment config is not allowed in Proxy file at \"${resolvedPath}\". Proxy always runs on Node.js runtime. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n\n if (isDev) {\n // errorOnce as proxy/middleware runs per request including multiple\n // internal _next/ routes and spams logs.\n Log.errorOnce(message)\n resolvedRuntime = SERVER_RUNTIME.nodejs\n } else {\n throw new Error(message)\n }\n }\n\n if (resolvedRuntime === SERVER_RUNTIME.experimentalEdge) {\n warnAboutExperimentalEdge(isAnAPIRoute ? page! : null)\n }\n\n if (\n !isProxyFile(page) &&\n resolvedRuntime === SERVER_RUNTIME.edge &&\n page &&\n !isAnAPIRoute\n ) {\n const message = `Page ${page} provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`\n if (isDev) {\n Log.error(message)\n } else {\n throw new Error(message)\n }\n }\n\n return {\n type: PAGE_TYPES.PAGES,\n getStaticProps,\n getServerSideProps,\n rsc,\n config,\n middleware: parseMiddlewareConfig(page, exportedConfig.config, nextConfig),\n runtime: resolvedRuntime,\n preferredRegion: config.config?.regions,\n maxDuration: config.maxDuration ?? config.config?.maxDuration,\n hadUnsupportedValue,\n }\n}\n\n/**\n * For a given pageFilePath and nextConfig, if the config supports it, this\n * function will read the file and return the runtime that should be used.\n * It will look into the file content only if the page *requires* a runtime\n * to be specified, that is, when gSSP or gSP is used.\n * Related discussion: https://github.com/vercel/next.js/discussions/34179\n */\nexport async function getPageStaticInfo(\n params: GetPageStaticInfoParams\n): Promise<PageStaticInfo> {\n if (params.pageType === PAGE_TYPES.APP) {\n return getAppPageStaticInfo(params)\n }\n\n return getPagesPageStaticInfo(params)\n}\n"],"names":["promises","fs","relative","LRUCache","extractExportedConstValue","UnsupportedValueError","parseModule","Log","SERVER_RUNTIME","MIDDLEWARE_FILENAME","PROXY_FILENAME","tryToParsePath","isAPIRoute","isEdgeRuntime","RSC_MODULE_TYPES","PAGE_TYPES","AppSegmentConfigSchemaKeys","parseAppSegmentConfig","reportZodError","PagesSegmentConfigSchemaKeys","parsePagesSegmentConfig","MiddlewareConfigInputSchema","SourceSchema","normalizeAppPath","normalizePagePath","isProxyFile","PARSE_PATTERN","CLIENT_MODULE_LABEL","ACTION_MODULE_LABEL","CLIENT_DIRECTIVE","SERVER_ACTION_DIRECTIVE","getRSCModuleInformation","source","isReactServerLayer","actionsJson","match","parsedActionsMeta","JSON","parse","undefined","clientInfoMatch","isClientRef","type","client","actionIds","clientRefsString","clientRefs","split","clientEntryType","server","checkExports","ast","expectedExports","page","exportsSet","Set","Array","isArray","body","getStaticProps","getServerSideProps","generateImageMetadata","generateSitemaps","generateStaticParams","exports","directives","hasLeadingNonDirectiveNode","node","expression","directive","value","add","declaration","declarations","includes","id","has","identifier","specifier","specifiers","orig","warn","validateMiddlewareProxyExports","pageFilePath","isDev","isMiddleware","isProxy","fileName","hasDefaultExport","hasMiddlewareExport","hasProxyExport","exportedIdentifier","exported","hasValidExport","relativePath","process","cwd","resolvedPath","startsWith","message","errorOnce","Error","tryToReadFile","filePath","shouldThrow","readFile","encoding","error","getMiddlewareMatchers","matcherOrMatchers","nextConfig","matchers","i18n","map","matcher","originalSource","rest","isRoot","locales","locale","basePath","result","safeParse","success","exit","regexp","data","regexStr","parseMiddlewareConfig","rawConfig","input","config","unstable_allowDynamic","regions","apiRouteWarnings","warnAboutExperimentalEdge","apiRoute","env","NODE_ENV","NEXT_PRIVATE_BUILD_WORKER","set","hadUnsupportedValue","warnedUnsupportedValueMap","warnAboutUnsupportedValue","isProductionBuild","NEXT_COMPILER_NAME","path","getAppPageStaticInfo","content","test","APP","runtime","preferredRegion","maxDuration","rsc","exportedConfig","property","e","route","cacheComponents","middleware","getPagesPageStaticInfo","PAGES","isAnAPIRoute","resolvedRuntime","nodejs","experimentalEdge","edge","getPageStaticInfo","params","pageType"],"mappings":"AAGA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,QAAQ,QAAQ,OAAM;AAC/B,SAASC,QAAQ,QAAQ,6BAA4B;AACrD,SACEC,yBAAyB,EACzBC,qBAAqB,QAChB,wBAAuB;AAC9B,SAASC,WAAW,QAAQ,iBAAgB;AAC5C,YAAYC,SAAS,gBAAe;AACpC,SACEC,cAAc,EACdC,mBAAmB,EACnBC,cAAc,QACT,sBAAqB;AAC5B,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SAASC,gBAAgB,QAAQ,6BAA4B;AAE7D,SAASC,UAAU,QAAQ,uBAAsB;AACjD,SACEC,0BAA0B,EAC1BC,qBAAqB,QAEhB,2CAA0C;AACjD,SAASC,cAAc,QAAQ,uBAAsB;AACrD,SACEC,4BAA4B,EAC5BC,uBAAuB,QAGlB,+CAA8C;AACrD,SACEC,2BAA2B,EAC3BC,YAAY,QAEP,iDAAgD;AACvD,SAASC,gBAAgB,QAAQ,0CAAyC;AAC1E,SAASC,iBAAiB,QAAQ,iD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vB,MAAMK,UAAU,CAAC,sDAAsD,EAAEF,aAAa,yGAAyG,CAAC;QAEhM,IAAIb,OAAO;YACT,oEAAoE;YACpE,yCAAyC;YACzC7E,IAAI6F,SAAS,CAACD;YACdiE,kBAAkB5J,eAAe6J,MAAM;QACzC,OAAO;YACL,MAAM,qBAAkB,CAAlB,IAAIhE,MAAMF,UAAV,qBAAA;uBAAA;4BAAA;8BAAA;YAAiB;QACzB;IACF;IAEA,IAAIiE,oBAAoB5J,eAAe8J,gBAAgB,EAAE;QACvD/B,0BAA0B4B,eAAe9G,OAAQ;IACnD;IAEA,IACE,CAAC5B,YAAY4B,SACb+G,oBAAoB5J,eAAe+J,IAAI,IACvClH,QACA,CAAC8G,cACD;QACA,MAAMhE,UAAU,CAAC,KAAK,EAAE9C,KAAK,4HAA4H,CAAC;QAC1J,IAAI+B,OAAO;YACT7E,IAAIoG,KAAK,CAACR;QACZ,OAAO;YACL,MAAM,qBAAkB,CAAlB,IAAIE,MAAMF,UAAV,qBAAA;uBAAA;4BAAA;8BAAA;YAAiB;QACzB;IACF;IAEA,OAAO;QACLzD,MAAM3B,WAAWmJ,KAAK;QACtBvG;QACAC;QACA8F;QACAvB;QACA6B,YAAYhC,sBAAsB3E,MAAMsG,eAAexB,MAAM,EAAErB;QAC/DyC,SAASa;QACTZ,eAAe,GAAErB,kBAAAA,OAAOA,MAAM,qBAAbA,gBAAeE,OAAO;QACvCoB,aAAatB,OAAOsB,WAAW,MAAItB,kBAAAA,OAAOA,MAAM,qBAAbA,gBAAesB,WAAW;QAC7DZ;IACF;AACF;AAEA;;;;;;CAMC,GACD,OAAO,eAAe2B,kBACpBC,MAA+B;IAE/B,IAAIA,OAAOC,QAAQ,KAAK3J,WAAWuI,GAAG,EAAE;QACtC,OAAOH,qBAAqBsB;IAC9B;IAEA,OAAOR,uBAAuBQ;AAChC","ignoreList":[0]}
{"version":3,"sources":["../../../../src/build/analysis/get-page-static-info.ts"],"sourcesContent":["import type { NextConfig } from '../../server/config-shared'\nimport type { RouteHas } from '../../lib/load-custom-routes'\n\nimport { readFileSync } from 'fs'\nimport { relative } from 'path'\nimport { LRUCache } from '../../server/lib/lru-cache'\nimport {\n extractExportedConstValue,\n UnsupportedValueError,\n} from './extract-const-value'\nimport { parseModule } from './parse-module'\nimport * as Log from '../output/log'\nimport {\n SERVER_RUNTIME,\n MIDDLEWARE_FILENAME,\n PROXY_FILENAME,\n} from '../../lib/constants'\nimport { tryToParsePath } from '../../lib/try-to-parse-path'\nimport { isAPIRoute } from '../../lib/is-api-route'\nimport { isEdgeRuntime } from '../../lib/is-edge-runtime'\nimport { RSC_MODULE_TYPES } from '../../shared/lib/constants'\nimport type { RSCMeta } from '../webpack/loaders/get-module-build-info'\nimport { PAGE_TYPES } from '../../lib/page-types'\nimport {\n AppSegmentConfigSchemaKeys,\n parseAppSegmentConfig,\n type AppSegmentConfig,\n} from '../segment-config/app/app-segment-config'\nimport { reportZodError } from '../../shared/lib/zod'\nimport {\n PagesSegmentConfigSchemaKeys,\n parsePagesSegmentConfig,\n type PagesSegmentConfig,\n type PagesSegmentConfigConfig,\n} from '../segment-config/pages/pages-segment-config'\nimport {\n MiddlewareConfigInputSchema,\n SourceSchema,\n type MiddlewareConfigMatcherInput,\n} from '../segment-config/middleware/middleware-config'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isProxyFile } from '../utils'\n\nconst PARSE_PATTERN =\n /(?<!(_jsx|jsx-))runtime|preferredRegion|getStaticProps|getServerSideProps|generateStaticParams|export const|generateImageMetadata|generateSitemaps|middleware|proxy/\n\nexport type ProxyMatcher = {\n regexp: string\n locale?: false\n has?: RouteHas[]\n missing?: RouteHas[]\n originalSource: string\n}\n\nexport type ProxyConfig = {\n /**\n * The matcher for the proxy. Read more: [Next.js Docs: Proxy `matcher`](https://nextjs.org/docs/app/api-reference/file-conventions/proxy#matcher),\n * [Next.js Docs: Proxy matching paths](https://nextjs.org/docs/app/building-your-application/routing/proxy#matching-paths)\n */\n matchers?: ProxyMatcher[]\n\n /**\n * The regions that the proxy should run in.\n */\n regions?: string | string[]\n\n /**\n * A glob, or an array of globs, ignoring dynamic code evaluation for specific\n * files. The globs are relative to your application root folder.\n */\n unstable_allowDynamic?: string[]\n}\n\nexport interface AppPageStaticInfo {\n type: PAGE_TYPES.APP\n ssg?: boolean\n ssr?: boolean\n rsc?: RSCModuleType\n generateStaticParams?: boolean\n generateSitemaps?: boolean\n generateImageMetadata?: boolean\n middleware?: ProxyConfig\n config: Omit<AppSegmentConfig, 'runtime' | 'maxDuration'> | undefined\n runtime: AppSegmentConfig['runtime'] | undefined\n preferredRegion: AppSegmentConfig['preferredRegion'] | undefined\n maxDuration: number | undefined\n hadUnsupportedValue: boolean\n}\n\nexport interface PagesPageStaticInfo {\n type: PAGE_TYPES.PAGES\n getStaticProps?: boolean\n getServerSideProps?: boolean\n rsc?: RSCModuleType\n generateStaticParams?: boolean\n generateSitemaps?: boolean\n generateImageMetadata?: boolean\n middleware?: ProxyConfig\n config:\n | (Omit<PagesSegmentConfig, 'runtime' | 'config' | 'maxDuration'> & {\n config?: Omit<PagesSegmentConfigConfig, 'runtime' | 'maxDuration'>\n })\n | undefined\n runtime: PagesSegmentConfig['runtime'] | undefined\n preferredRegion: PagesSegmentConfigConfig['regions'] | undefined\n maxDuration: number | undefined\n hadUnsupportedValue: boolean\n}\n\nexport type PageStaticInfo = AppPageStaticInfo | PagesPageStaticInfo\n\nconst CLIENT_MODULE_LABEL =\n /\\/\\* __next_internal_client_entry_do_not_use__ ([^ ]*) (cjs|auto) \\*\\//\n\n// Match JSON object that may contain nested objects (for loc info)\n// The JSON ends right before the closing \" */\"\nconst ACTION_MODULE_LABEL =\n /\\/\\* __next_internal_action_entry_do_not_use__ (\\{.*\\}) \\*\\//\n\nconst CLIENT_DIRECTIVE = 'use client'\nconst SERVER_ACTION_DIRECTIVE = 'use server'\n\nexport type RSCModuleType = 'server' | 'client'\nexport function getRSCModuleInformation(\n source: string,\n isReactServerLayer: boolean\n): RSCMeta {\n const actionsJson = source.match(ACTION_MODULE_LABEL)\n // Parse action metadata - supports both old format (string) and new format (object with loc)\n const parsedActionsMeta = actionsJson\n ? (JSON.parse(actionsJson[1]) as RSCMeta['actionIds'])\n : undefined\n const clientInfoMatch = source.match(CLIENT_MODULE_LABEL)\n const isClientRef = !!clientInfoMatch\n\n if (!isReactServerLayer) {\n return {\n type: RSC_MODULE_TYPES.client,\n actionIds: parsedActionsMeta,\n isClientRef,\n }\n }\n\n const clientRefsString = clientInfoMatch?.[1]\n const clientRefs = clientRefsString ? clientRefsString.split(',') : []\n const clientEntryType = clientInfoMatch?.[2] as 'cjs' | 'auto' | undefined\n\n const type = clientInfoMatch\n ? RSC_MODULE_TYPES.client\n : RSC_MODULE_TYPES.server\n\n return {\n type,\n actionIds: parsedActionsMeta,\n clientRefs,\n clientEntryType,\n isClientRef,\n }\n}\n\n/**\n * Receives a parsed AST from SWC and checks if it belongs to a module that\n * requires a runtime to be specified. Those are:\n * - Modules with `export function getStaticProps | getServerSideProps`\n * - Modules with `export { getStaticProps | getServerSideProps } <from ...>`\n * - Modules with `export const runtime = ...`\n */\nfunction checkExports(\n ast: any,\n expectedExports: string[],\n page: string\n): {\n getStaticProps?: boolean\n getServerSideProps?: boolean\n generateImageMetadata?: boolean\n generateSitemaps?: boolean\n generateStaticParams?: boolean\n directives?: Set<string>\n exports?: Set<string>\n} {\n const exportsSet = new Set<string>([\n 'getStaticProps',\n 'getServerSideProps',\n 'generateImageMetadata',\n 'generateSitemaps',\n 'generateStaticParams',\n ])\n if (!Array.isArray(ast?.body)) {\n return {}\n }\n\n try {\n let getStaticProps: boolean = false\n let getServerSideProps: boolean = false\n let generateImageMetadata: boolean = false\n let generateSitemaps: boolean = false\n let generateStaticParams = false\n let exports = new Set<string>()\n let directives = new Set<string>()\n let hasLeadingNonDirectiveNode = false\n\n for (const node of ast.body) {\n // There should be no non-string literals nodes before directives\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'StringLiteral'\n ) {\n if (!hasLeadingNonDirectiveNode) {\n const directive = node.expression.value\n if (CLIENT_DIRECTIVE === directive) {\n directives.add('client')\n }\n if (SERVER_ACTION_DIRECTIVE === directive) {\n directives.add('server')\n }\n }\n } else {\n hasLeadingNonDirectiveNode = true\n }\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n for (const declaration of node.declaration?.declarations) {\n if (expectedExports.includes(declaration.id.value)) {\n exports.add(declaration.id.value)\n }\n }\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration' &&\n exportsSet.has(node.declaration.identifier?.value)\n ) {\n const id = node.declaration.identifier.value\n getServerSideProps = id === 'getServerSideProps'\n getStaticProps = id === 'getStaticProps'\n generateImageMetadata = id === 'generateImageMetadata'\n generateSitemaps = id === 'generateSitemaps'\n generateStaticParams = id === 'generateStaticParams'\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n const id = node.declaration?.declarations[0]?.id.value\n if (exportsSet.has(id)) {\n getServerSideProps = id === 'getServerSideProps'\n getStaticProps = id === 'getStaticProps'\n generateImageMetadata = id === 'generateImageMetadata'\n generateSitemaps = id === 'generateSitemaps'\n generateStaticParams = id === 'generateStaticParams'\n }\n }\n\n if (node.type === 'ExportNamedDeclaration') {\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.orig?.type === 'Identifier'\n ) {\n const value = specifier.orig.value\n\n if (!getServerSideProps && value === 'getServerSideProps') {\n getServerSideProps = true\n }\n if (!getStaticProps && value === 'getStaticProps') {\n getStaticProps = true\n }\n if (!generateImageMetadata && value === 'generateImageMetadata') {\n generateImageMetadata = true\n }\n if (!generateSitemaps && value === 'generateSitemaps') {\n generateSitemaps = true\n }\n if (!generateStaticParams && value === 'generateStaticParams') {\n generateStaticParams = true\n }\n if (expectedExports.includes(value) && !exports.has(value)) {\n // An export was found that was actually a re-export, and not a\n // literal value. We should warn here.\n Log.warn(\n `Next.js can't recognize the exported \\`${value}\\` field in \"${page}\", it may be re-exported from another file. The default config will be used instead.`\n )\n }\n }\n }\n }\n }\n\n return {\n getStaticProps,\n getServerSideProps,\n generateImageMetadata,\n generateSitemaps,\n generateStaticParams,\n directives,\n exports,\n }\n } catch {}\n\n return {}\n}\n\nfunction validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n}: {\n ast: any\n page: string\n pageFilePath: string\n isDev: boolean\n}): void {\n // Check if this is middleware/proxy\n const isMiddleware =\n page === `/${MIDDLEWARE_FILENAME}` || page === `/src/${MIDDLEWARE_FILENAME}`\n const isProxy =\n page === `/${PROXY_FILENAME}` || page === `/src/${PROXY_FILENAME}`\n\n if (!isMiddleware && !isProxy) {\n return\n }\n\n if (!ast || !Array.isArray(ast.body)) {\n return\n }\n\n const fileName = isProxy ? PROXY_FILENAME : MIDDLEWARE_FILENAME\n\n // Parse AST to get export info (since checkExports doesn't return middleware/proxy info)\n let hasDefaultExport = false\n let hasMiddlewareExport = false\n let hasProxyExport = false\n\n for (const node of ast.body) {\n if (\n node.type === 'ExportDefaultDeclaration' ||\n node.type === 'ExportDefaultExpression'\n ) {\n hasDefaultExport = true\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration'\n ) {\n const id = node.declaration.identifier?.value\n if (id === 'middleware') {\n hasMiddlewareExport = true\n }\n if (id === 'proxy') {\n hasProxyExport = true\n }\n }\n\n if (\n node.type === 'ExportDeclaration' &&\n node.declaration?.type === 'VariableDeclaration'\n ) {\n const id = node.declaration?.declarations[0]?.id.value\n if (id === 'middleware') {\n hasMiddlewareExport = true\n }\n if (id === 'proxy') {\n hasProxyExport = true\n }\n }\n\n if (node.type === 'ExportNamedDeclaration') {\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.orig?.type === 'Identifier'\n ) {\n // Use the exported name if it exists (for aliased exports like `export { foo as proxy }`),\n // otherwise fall back to the original name (for simple re-exports like `export { proxy }`)\n const exportedIdentifier = specifier.exported || specifier.orig\n const value = exportedIdentifier.value\n if (value === 'middleware') {\n hasMiddlewareExport = true\n }\n if (value === 'proxy') {\n hasProxyExport = true\n }\n }\n }\n }\n }\n\n const hasValidExport =\n hasDefaultExport ||\n (isMiddleware && hasMiddlewareExport) ||\n (isProxy && hasProxyExport)\n\n const relativePath = relative(process.cwd(), pageFilePath)\n const resolvedPath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`\n\n if (!hasValidExport) {\n const message =\n `The file \"${resolvedPath}\" must export a function, either as a default export or as a named \"${fileName}\" export.\\n` +\n `This function is what Next.js runs for every request handled by this ${fileName === 'proxy' ? 'proxy (previously called middleware)' : 'middleware'}.\\n\\n` +\n `Why this happens:\\n` +\n (isProxy\n ? \"- You are migrating from `middleware` to `proxy`, but haven't updated the exported function.\\n\"\n : '') +\n `- The file exists but doesn't export a function.\\n` +\n `- The export is not a function (e.g., an object or constant).\\n` +\n `- There's a syntax error preventing the export from being recognized.\\n\\n` +\n `To fix it:\\n` +\n `- Ensure this file has either a default or \"${fileName}\" function export.\\n\\n` +\n `Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n\n if (isDev) {\n // errorOnce as proxy/middleware runs per request including multiple\n // internal _next/ routes and spams logs.\n Log.errorOnce(message)\n } else {\n throw new Error(message)\n }\n }\n}\n\nfunction tryToReadFile(filePath: string, shouldThrow: boolean) {\n try {\n return readFileSync(filePath, {\n encoding: 'utf8',\n })\n } catch (error: any) {\n if (shouldThrow) {\n error.message = `Next.js ERROR: Failed to read file ${filePath}:\\n${error.message}`\n throw error\n }\n }\n}\n\n/**\n * @internal - required to exclude zod types from the build\n */\nexport function getMiddlewareMatchers(\n matcherOrMatchers: MiddlewareConfigMatcherInput,\n nextConfig: Pick<NextConfig, 'basePath' | 'i18n'>\n): ProxyMatcher[] {\n const matchers = Array.isArray(matcherOrMatchers)\n ? matcherOrMatchers\n : [matcherOrMatchers]\n\n const { i18n } = nextConfig\n\n return matchers.map((matcher) => {\n matcher = typeof matcher === 'string' ? { source: matcher } : matcher\n\n const originalSource = matcher.source\n\n let { source, ...rest } = matcher\n\n const isRoot = source === '/'\n\n if (i18n?.locales && matcher.locale !== false) {\n source = `/:nextInternalLocale((?!_next/)[^/.]{1,})${\n isRoot ? '' : source\n }`\n }\n\n source = `/:nextData(_next/data/[^/]{1,})?${source}${\n isRoot\n ? `(${nextConfig.i18n ? '|\\\\.json|' : ''}/?index|/?index\\\\.json)?`\n : '{(\\\\.json)}?'\n }`\n\n if (nextConfig.basePath) {\n source = `${nextConfig.basePath}${source}`\n }\n\n // Validate that the source is still.\n const result = SourceSchema.safeParse(source)\n if (!result.success) {\n reportZodError('Failed to parse middleware source', result.error)\n\n // We need to exit here because middleware being built occurs before we\n // finish setting up the server. Exiting here is the only way to ensure\n // that we don't hang.\n process.exit(1)\n }\n\n return {\n ...rest,\n // We know that parsed.regexStr is not undefined because we already\n // checked that the source is valid.\n regexp: tryToParsePath(result.data).regexStr!,\n originalSource: originalSource || source,\n }\n })\n}\n\nfunction parseMiddlewareConfig(\n page: string,\n rawConfig: unknown,\n nextConfig: NextConfig\n): ProxyConfig {\n // If there's no config to parse, then return nothing.\n if (typeof rawConfig !== 'object' || !rawConfig) return {}\n\n const input = MiddlewareConfigInputSchema.safeParse(rawConfig)\n if (!input.success) {\n reportZodError(`${page} contains invalid middleware config`, input.error)\n\n // We need to exit here because middleware being built occurs before we\n // finish setting up the server. Exiting here is the only way to ensure\n // that we don't hang.\n process.exit(1)\n }\n\n const config: ProxyConfig = {}\n\n if (input.data.matcher) {\n config.matchers = getMiddlewareMatchers(input.data.matcher, nextConfig)\n }\n\n if (input.data.unstable_allowDynamic) {\n config.unstable_allowDynamic = Array.isArray(\n input.data.unstable_allowDynamic\n )\n ? input.data.unstable_allowDynamic\n : [input.data.unstable_allowDynamic]\n }\n\n if (input.data.regions) {\n config.regions = input.data.regions\n }\n\n return config\n}\n\nconst apiRouteWarnings = new LRUCache(250)\nfunction warnAboutExperimentalEdge(apiRoute: string | null) {\n if (\n process.env.NODE_ENV === 'production' &&\n process.env.NEXT_PRIVATE_BUILD_WORKER === '1'\n ) {\n return\n }\n\n if (apiRoute && apiRouteWarnings.has(apiRoute)) {\n return\n }\n\n Log.warn(\n apiRoute\n ? `${apiRoute} provided runtime 'experimental-edge'. It can be updated to 'edge' instead.`\n : `You are using an experimental edge runtime, the API might change.`\n )\n\n if (apiRoute) {\n apiRouteWarnings.set(apiRoute, 1)\n }\n}\n\nlet hadUnsupportedValue = false\nconst warnedUnsupportedValueMap = new LRUCache<boolean>(250, () => 1)\n\nfunction warnAboutUnsupportedValue(\n pageFilePath: string,\n page: string | undefined,\n error: UnsupportedValueError\n) {\n hadUnsupportedValue = true\n const isProductionBuild = process.env.NODE_ENV === 'production'\n if (\n // we only log for the server compilation so it's not\n // duplicated due to webpack build worker having fresh\n // module scope for each compiler\n process.env.NEXT_COMPILER_NAME !== 'server' ||\n (isProductionBuild && warnedUnsupportedValueMap.has(pageFilePath))\n ) {\n return\n }\n warnedUnsupportedValueMap.set(pageFilePath, true)\n\n const message =\n `Next.js can't recognize the exported \\`config\\` field in ` +\n (page ? `route \"${page}\"` : `\"${pageFilePath}\"`) +\n ':\\n' +\n error.message +\n (error.path ? ` at \"${error.path}\"` : '') +\n '.\\n' +\n 'Read More - https://nextjs.org/docs/messages/invalid-page-config'\n\n // for a build we use `Log.error` instead of throwing\n // so that all errors can be logged before exiting the process\n if (isProductionBuild) {\n Log.error(message)\n } else {\n throw new Error(message)\n }\n}\n\ntype GetPageStaticInfoParams = {\n pageFilePath: string\n nextConfig: Partial<NextConfig>\n isDev: boolean\n page: string\n pageType: PAGE_TYPES\n}\n\nexport async function getAppPageStaticInfo({\n pageFilePath,\n nextConfig,\n isDev,\n page,\n}: GetPageStaticInfoParams): Promise<AppPageStaticInfo> {\n const content = tryToReadFile(pageFilePath, !isDev)\n if (!content || !PARSE_PATTERN.test(content)) {\n return {\n type: PAGE_TYPES.APP,\n config: undefined,\n runtime: undefined,\n preferredRegion: undefined,\n maxDuration: undefined,\n hadUnsupportedValue: false,\n }\n }\n\n const ast = await parseModule(pageFilePath, content)\n validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n })\n\n const {\n generateStaticParams,\n generateImageMetadata,\n generateSitemaps,\n exports,\n directives,\n } = checkExports(ast, AppSegmentConfigSchemaKeys, page)\n\n const { type: rsc } = getRSCModuleInformation(content, true)\n\n const exportedConfig: Record<string, unknown> = {}\n if (exports) {\n for (const property of exports) {\n try {\n exportedConfig[property] = extractExportedConstValue(ast, property)\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n }\n }\n }\n\n try {\n exportedConfig.config = extractExportedConstValue(ast, 'config')\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n // `export config` doesn't exist, or other unknown error thrown by swc, silence them\n }\n\n const route = normalizeAppPath(page)\n const config = parseAppSegmentConfig(exportedConfig, route)\n\n // Prevent edge runtime and generateStaticParams in the same file.\n if (isEdgeRuntime(config.runtime) && generateStaticParams) {\n throw new Error(\n `Page \"${page}\" cannot use both \\`export const runtime = 'edge'\\` and export \\`generateStaticParams\\`.`\n )\n }\n\n // Prevent use client and generateStaticParams in the same file.\n if (directives?.has('client') && generateStaticParams) {\n throw new Error(\n `Page \"${page}\" cannot use both \"use client\" and export function \"generateStaticParams()\".`\n )\n }\n\n // Prevent use client and unstable_instant in the same file.\n if (directives?.has('client') && 'unstable_instant' in config) {\n throw new Error(\n `Page \"${page}\" cannot export \"unstable_instant\" from a Client Component module. To use this API, convert this module to a Server Component by removing the \"use client\" directive.`\n )\n }\n\n if ('unstable_instant' in config && !nextConfig.cacheComponents) {\n throw new Error(\n `Page \"${page}\" cannot use \\`export const unstable_instant = ...\\` without enabling \\`cacheComponents\\`.`\n )\n }\n\n return {\n type: PAGE_TYPES.APP,\n rsc,\n generateImageMetadata,\n generateSitemaps,\n generateStaticParams,\n config,\n middleware: parseMiddlewareConfig(page, exportedConfig.config, nextConfig),\n runtime: config.runtime,\n preferredRegion: config.preferredRegion,\n maxDuration: config.maxDuration,\n hadUnsupportedValue,\n }\n}\n\nexport async function getPagesPageStaticInfo({\n pageFilePath,\n nextConfig,\n isDev,\n page,\n}: GetPageStaticInfoParams): Promise<PagesPageStaticInfo> {\n const content = tryToReadFile(pageFilePath, !isDev)\n if (!content || !PARSE_PATTERN.test(content)) {\n return {\n type: PAGE_TYPES.PAGES,\n config: undefined,\n runtime: undefined,\n preferredRegion: undefined,\n maxDuration: undefined,\n hadUnsupportedValue: false,\n }\n }\n\n const ast = await parseModule(pageFilePath, content)\n validateMiddlewareProxyExports({\n ast,\n page,\n pageFilePath,\n isDev,\n })\n\n const { getServerSideProps, getStaticProps, exports } = checkExports(\n ast,\n PagesSegmentConfigSchemaKeys,\n page\n )\n\n const { type: rsc } = getRSCModuleInformation(content, true)\n\n const exportedConfig: Record<string, unknown> = {}\n if (exports) {\n for (const property of exports) {\n try {\n exportedConfig[property] = extractExportedConstValue(ast, property)\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n }\n }\n }\n\n try {\n exportedConfig.config = extractExportedConstValue(ast, 'config')\n } catch (e) {\n if (e instanceof UnsupportedValueError) {\n warnAboutUnsupportedValue(pageFilePath, page, e)\n }\n // `export config` doesn't exist, or other unknown error thrown by swc, silence them\n }\n\n // Validate the config.\n const route = normalizePagePath(page)\n const config = parsePagesSegmentConfig(exportedConfig, route)\n const isAnAPIRoute = isAPIRoute(route)\n\n let resolvedRuntime = config.runtime ?? config.config?.runtime\n\n if (isProxyFile(page) && resolvedRuntime) {\n const relativePath = relative(process.cwd(), pageFilePath)\n const resolvedPath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`\n const message = `Route segment config is not allowed in Proxy file at \"${resolvedPath}\". Proxy always runs on Node.js runtime. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n\n if (isDev) {\n // errorOnce as proxy/middleware runs per request including multiple\n // internal _next/ routes and spams logs.\n Log.errorOnce(message)\n resolvedRuntime = SERVER_RUNTIME.nodejs\n } else {\n throw new Error(message)\n }\n }\n\n if (resolvedRuntime === SERVER_RUNTIME.experimentalEdge) {\n warnAboutExperimentalEdge(isAnAPIRoute ? page! : null)\n }\n\n if (\n !isProxyFile(page) &&\n resolvedRuntime === SERVER_RUNTIME.edge &&\n page &&\n !isAnAPIRoute\n ) {\n const message = `Page ${page} provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`\n if (isDev) {\n Log.error(message)\n } else {\n throw new Error(message)\n }\n }\n\n return {\n type: PAGE_TYPES.PAGES,\n getStaticProps,\n getServerSideProps,\n rsc,\n config,\n middleware: parseMiddlewareConfig(page, exportedConfig.config, nextConfig),\n runtime: resolvedRuntime,\n preferredRegion: config.config?.regions,\n maxDuration: config.maxDuration ?? config.config?.maxDuration,\n hadUnsupportedValue,\n }\n}\n\n/**\n * For a given pageFilePath and nextConfig, if the config supports it, this\n * function will read the file and return the runtime that should be used.\n * It will look into the file content only if the page *requires* a runtime\n * to be specified, that is, when gSSP or gSP is used.\n * Related discussion: https://github.com/vercel/next.js/discussions/34179\n */\nexport async function getPageStaticInfo(\n params: GetPageStaticInfoParams\n): Promise<PageStaticInfo> {\n if (params.pageType === PAGE_TYPES.APP) {\n return getAppPageStaticInfo(params)\n }\n\n return getPagesPageStaticInfo(params)\n}\n"],"names":["readFileSync","relative","LRUCache","extractExportedConstValue","UnsupportedValueError","parseModule","Log","SERVER_RUNTIME","MIDDLEWARE_FILENAME","PROXY_FILENAME","tryToParsePath","isAPIRoute","isEdgeRuntime","RSC_MODULE_TYPES","PAGE_TYPES","AppSegmentConfigSchemaKeys","parseAppSegmentConfig","reportZodError","PagesSegmentConfigSchemaKeys","parsePagesSegmentConfig","MiddlewareConfigInputSchema","SourceSchema","normalizeAppPath","normalizePagePath","isProxyFile","PARSE_PATTERN","CLIENT_MODULE_LABEL","ACTION_MODULE_LABEL","CLIENT_DIRECTIVE","SERVER_ACTION_DIRECTIVE","getRSCModuleInformation","source","isReactServerLayer","actionsJson","match","parsedActionsMeta","JSON","parse","undefined","clientInfoMatch","isClientRef","type","client","actionIds","clientRefsString","clientRefs","split","clientEntryType","server","checkExports","ast","expectedExports","page","exportsSet","Set","Array","isArray","body","getStaticProps","getServerSideProps","generateImageMetadata","generateSitemaps","generateStaticParams","exports","directives","hasLeadingNonDirectiveNode","node","expression","directive","value","add","declaration","declarations","includes","id","has","identifier","specifier","specifiers","orig","warn","validateMiddlewareProxyExports","pageFilePath","isDev","isMiddleware","isProxy","fileName","hasDefaultExport","hasMiddlewareExport","hasProxyExport","exportedIdentifier","exported","hasValidExport","relativePath","process","cwd","resolvedPath","startsWith","message","errorOnce","Error","tryToReadFile","filePath","shouldThrow","encoding","error","getMiddlewareMatchers","matcherOrMatchers","nextConfig","matchers","i18n","map","matcher","originalSource","rest","isRoot","locales","locale","basePath","result","safeParse","success","exit","regexp","data","regexStr","parseMiddlewareConfig","rawConfig","input","config","unstable_allowDynamic","regions","apiRouteWarnings","warnAboutExperimentalEdge","apiRoute","env","NODE_ENV","NEXT_PRIVATE_BUILD_WORKER","set","hadUnsupportedValue","warnedUnsupportedValueMap","warnAboutUnsupportedValue","isProductionBuild","NEXT_COMPILER_NAME","path","getAppPageStaticInfo","content","test","APP","runtime","preferredRegion","maxDuration","rsc","exportedConfig","property","e","route","cacheComponents","middleware","getPagesPageStaticInfo","PAGES","isAnAPIRoute","resolvedRuntime","nodejs","experimentalEdge","edge","getPageStaticInfo","params","pageType"],"mappings":"AAGA,SAASA,YAAY,QAAQ,KAAI;AACjC,SAASC,QAAQ,QAAQ,OAAM;AAC/B,SAASC,QAAQ,QA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QACzB;IACF;IAEA,OAAO;QACLzD,MAAM3B,WAAWkJ,KAAK;QACtBtG;QACAC;QACA6F;QACAvB;QACA6B,YAAYhC,sBAAsB1E,MAAMqG,eAAexB,MAAM,EAAErB;QAC/DyC,SAASa;QACTZ,eAAe,GAAErB,kBAAAA,OAAOA,MAAM,qBAAbA,gBAAeE,OAAO;QACvCoB,aAAatB,OAAOsB,WAAW,MAAItB,kBAAAA,OAAOA,MAAM,qBAAbA,gBAAesB,WAAW;QAC7DZ;IACF;AACF;AAEA;;;;;;CAMC,GACD,OAAO,eAAe2B,kBACpBC,MAA+B;IAE/B,IAAIA,OAAOC,QAAQ,KAAK1J,WAAWsI,GAAG,EAAE;QACtC,OAAOH,qBAAqBsB;IAC9B;IAEA,OAAOR,uBAAuBQ;AAChC","ignoreList":[0]}

@@ -6,9 +6,3 @@ import path from 'path';

import * as Log from '../output/log';
import { getParserOptions } from './options';
import { eventSwcLoadFailure } from '../../telemetry/events/swc-load-failure';
import { patchIncorrectLockfile } from '../../lib/patch-incorrect-lockfile';
import { downloadNativeNextSwc, downloadWasmSwc } from '../../lib/download-swc';
import { isDeepStrictEqual } from 'util';
import { getDefineEnv } from '../define-env';
import { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error';
import { runLoaderWorkerPool } from './loaderWorkerPool';

@@ -20,3 +14,3 @@ export var HmrTarget = /*#__PURE__*/ function(HmrTarget) {

}({});
const nextVersion = "16.2.0-canary.72";
const nextVersion = "16.2.0-canary.73";
const ArchName = arch();

@@ -168,3 +162,3 @@ const PlatformName = platform();

// even if it doesn't fail to load locally
lockfilePatchPromise.cur = patchIncorrectLockfile(process.cwd()).catch(console.error);
lockfilePatchPromise.cur = require('../../lib/patch-incorrect-lockfile').patchIncorrectLockfile(process.cwd()).catch(console.error);
}

@@ -229,3 +223,3 @@ let attempts = [];

if (!downloadNativeBindingsPromise) {
downloadNativeBindingsPromise = downloadNativeNextSwc(nextVersion, nativeBindingsDirectory, triples.map((triple)=>triple.platformArchABI));
downloadNativeBindingsPromise = require('../../lib/download-swc').downloadNativeNextSwc(nextVersion, nativeBindingsDirectory, triples.map((triple)=>triple.platformArchABI));
}

@@ -244,4 +238,3 @@ await downloadNativeBindingsPromise;

let bindings = await loadWasm('');
// @ts-expect-error TODO: this event has a wrong type.
eventSwcLoadFailure({
require('../../telemetry/events/swc-load-failure').eventSwcLoadFailure({
wasm: 'enabled',

@@ -261,8 +254,7 @@ nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode

if (!downloadWasmPromise) {
downloadWasmPromise = downloadWasmSwc(nextVersion, wasmDirectory);
downloadWasmPromise = require('../../lib/download-swc').downloadWasmSwc(nextVersion, wasmDirectory);
}
await downloadWasmPromise;
let bindings = await loadWasm(wasmDirectory);
// @ts-expect-error TODO: this event has a wrong type.
eventSwcLoadFailure({
require('../../telemetry/events/swc-load-failure').eventSwcLoadFailure({
wasm: 'fallback',

@@ -312,4 +304,3 @@ nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode

}
// @ts-expect-error TODO: this event has a wrong type.
await eventSwcLoadFailure({
await require('../../telemetry/events/swc-load-failure').eventSwcLoadFailure({
wasm: triedWasm ? 'failed' : undefined,

@@ -713,3 +704,3 @@ nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode

function checkLoaderItem(loaderItem, glob) {
if (typeof loaderItem !== 'string' && !isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))) {
if (typeof loaderItem !== 'string' && !require('util').isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))) {
throw Object.defineProperty(new Error(`loader ${loaderItem.loader} for match "${glob}" does not have serializable options. ` + 'Ensure that options passed are plain JavaScript objects and values.'), "__NEXT_ERROR_CODE", {

@@ -795,3 +786,3 @@ value: "E491",

return new ProjectImpl(await binding.projectNew(await rustifyProjectOptions(options), turboEngineOptions || {}, {
throwTurbopackInternalError,
throwTurbopackInternalError: require('../../shared/lib/turbopack/internal-error').throwTurbopackInternalError,
onBeforeDeferredEntries: callbacks == null ? void 0 : callbacks.onBeforeDeferredEntries

@@ -1190,3 +1181,3 @@ }));

const bindings = getBindingsSync();
const parserOptions = getParserOptions(options);
const parserOptions = require('./options').getParserOptions(options);
const parsed = await bindings.parse(src, parserOptions);

@@ -1193,0 +1184,0 @@ return JSON.parse(parsed);

import path from 'path';
import { validateTurboNextConfig } from '../../lib/turbopack-warning';
import { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils';
import { createDefineEnv, loadBindings } from '../swc';
import { isCI } from '../../server/ci-info';
import { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events';
import { getSupportedBrowsers } from '../utils';
import { getSupportedBrowsers } from '../get-supported-browsers';
import { normalizePath } from '../../lib/normalize-path';
import { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants';
export async function turbopackAnalyze(analyzeContext) {
var _config_experimental, _config_turbopack, _config_turbopack1, _config_experimental1;
var _config_experimental, _config_experimental1, _config_turbopack, _config_turbopack1, _config_experimental2;
await validateTurboNextConfig({

@@ -29,3 +28,3 @@ dir: analyzeContext.dir,

const supportedBrowsers = getSupportedBrowsers(dir, dev);
const persistentCaching = isFileSystemCacheEnabledForBuild(config);
const persistentCaching = ((_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackFileSystemCacheForBuild) || false;
const rootPath = ((_config_turbopack = config.turbopack) == null ? void 0 : _config_turbopack.root) || config.outputFileTracingRoot || dir;

@@ -70,5 +69,5 @@ const project = await bindings.turbo.createProject({

isPersistentCachingEnabled: persistentCaching,
nextVersion: "16.2.0-canary.72"
nextVersion: "16.2.0-canary.73"
}, {
memoryLimit: (_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackMemoryLimit,
memoryLimit: (_config_experimental2 = config.experimental) == null ? void 0 : _config_experimental2.turbopackMemoryLimit,
dependencyTracking: persistentCaching,

@@ -75,0 +74,0 @@ isCi: isCI,

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../src/build/turbopack-analyze/index.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport type { __ApiPreviewProps } from '../../server/api-utils'\n\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils'\nimport { createDefineEnv, loadBindings } from '../swc'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../utils'\nimport { normalizePath } from '../../lib/normalize-path'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\n\nexport type AnalyzeContext = {\n config: NextConfigComplete\n distDir: string\n dir: string\n noMangling: boolean\n appDirOnly: boolean\n}\n\nexport async function turbopackAnalyze(\n analyzeContext: AnalyzeContext\n): Promise<{\n duration: number\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: analyzeContext.dir,\n configPhase: PHASE_PRODUCTION_BUILD,\n })\n\n const { config, dir, distDir, noMangling } = analyzeContext\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = await loadBindings(config?.experimental?.useWasmBinary)\n\n if (bindings.isWasm) {\n throw new Error(\n `Turbopack analyze is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n )\n }\n\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const persistentCaching = isFileSystemCacheEnabledForBuild(config)\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n const project = await bindings.turbo.createProject(\n {\n rootPath: config.turbopack?.root || config.outputFileTracingRoot || dir,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites: false,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites: {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n }),\n buildId: 'analyze-build',\n encryptionKey: '',\n previewProps: {\n previewModeId: '',\n previewModeEncryptionKey: '',\n previewModeSigningKey: '',\n },\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n writeRoutesHashesManifest: false,\n currentNodeJsVersion,\n isPersistentCachingEnabled: persistentCaching,\n nextVersion: process.env.__NEXT_VERSION as string,\n },\n {\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching,\n isCi: isCI,\n isShortSession: true,\n }\n )\n\n try {\n backgroundLogCompilationEvents(project)\n\n await project.writeAnalyzeData(analyzeContext.appDirOnly)\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["path","validateTurboNextConfig","isFileSystemCacheEnabledForBuild","createDefineEnv","loadBindings","isCI","backgroundLogCompilationEvents","getSupportedBrowsers","normalizePath","PHASE_PRODUCTION_BUILD","turbopackAnalyze","analyzeContext","config","dir","configPhase","distDir","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","experimental","useWasmBinary","isWasm","Error","platform","arch","dev","supportedBrowsers","persistentCaching","rootPath","turbopack","root","outputFileTracingRoot","project","turbo","createProject","projectPath","relative","nextConfig","watch","enable","env","defineEnv","isTurbopack","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","undefined","rewrites","beforeFiles","afterFiles","fallback","buildId","encryptionKey","previewProps","previewModeId","previewModeEncryptionKey","previewModeSigningKey","browserslistQuery","join","writeRoutesHashesManifest","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isShortSession","writeAnalyzeData","appDirOnly","shutdownPromise","shutdown","time","duration","err","waitForShutdown"],"mappings":"AAGA,OAAOA,UAAU,OAAM;AACvB,SAASC,uBAAuB,QAAQ,8BAA6B;AACrE,SAASC,gCAAgC,QAAQ,mCAAkC;AACnF,SAASC,eAAe,EAAEC,YAAY,QAAQ,SAAQ;AACtD,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASC,8BAA8B,QAAQ,gDAA+C;AAC9F,SAASC,oBAAoB,QAAQ,WAAU;AAC/C,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,sBAAsB,QAAQ,6BAA4B;AAUnE,OAAO,eAAeC,iBACpBC,cAA8B;QAcMC,sBAenBA,mBAGHA,oBAwCGA;IAnEjB,MAAMX,wBAAwB;QAC5BY,KAAKF,eAAeE,GAAG;QACvBC,aAAaL;IACf;IAEA,MAAM,EAAEG,MAAM,EAAEC,GAAG,EAAEE,OAAO,EAAEC,UAAU,EAAE,GAAGL;IAC7C,MAAMM,uBAAuBC,QAAQC,QAAQ,CAACC,IAAI;IAElD,MAAMC,YAAYH,QAAQI,MAAM;IAChC,MAAMC,WAAW,MAAMnB,aAAaQ,2BAAAA,uBAAAA,OAAQY,YAAY,qBAApBZ,qBAAsBa,aAAa;IAEvE,IAAIF,SAASG,MAAM,EAAE;QACnB,MAAM,qBAIL,CAJK,IAAIC,MACR,CAAC,qDAAqD,EAAET,QAAQU,QAAQ,CAAC,CAAC,EAAEV,QAAQW,IAAI,CAAC,6CAA6C,CAAC,GACrI,CAAC,yFAAyF,CAAC,GAC3F,CAAC,kGAAkG,CAAC,GAHlG,qBAAA;mBAAA;wBAAA;0BAAA;QAIN;IACF;IAEA,MAAMC,MAAM;IAEZ,MAAMC,oBAAoBxB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AAO3D,QAAQI,MAAM,CAACD;QAC5B,OAAO;YACLyD,UAAUD,IAAI,CAAC,EAAE,GAAGA,IAAI,CAAC,EAAE,GAAG;YAC9BF;QACF;IACF,EAAE,OAAOI,KAAK;QACZ,MAAM1C,QAAQuC,QAAQ;QACtB,MAAMG;IACR;AACF;AAEA,IAAIJ;AACJ,OAAO,eAAeK;IACpB,IAAIL,iBAAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../../src/build/turbopack-analyze/index.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport type { __ApiPreviewProps } from '../../server/api-utils'\n\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { createDefineEnv, loadBindings } from '../swc'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../get-supported-browsers'\nimport { normalizePath } from '../../lib/normalize-path'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\n\nexport type AnalyzeContext = {\n config: NextConfigComplete\n distDir: string\n dir: string\n noMangling: boolean\n appDirOnly: boolean\n}\n\nexport async function turbopackAnalyze(\n analyzeContext: AnalyzeContext\n): Promise<{\n duration: number\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: analyzeContext.dir,\n configPhase: PHASE_PRODUCTION_BUILD,\n })\n\n const { config, dir, distDir, noMangling } = analyzeContext\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = await loadBindings(config?.experimental?.useWasmBinary)\n\n if (bindings.isWasm) {\n throw new Error(\n `Turbopack analyze is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n )\n }\n\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const persistentCaching =\n config.experimental?.turbopackFileSystemCacheForBuild || false\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n const project = await bindings.turbo.createProject(\n {\n rootPath: config.turbopack?.root || config.outputFileTracingRoot || dir,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites: false,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites: {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n }),\n buildId: 'analyze-build',\n encryptionKey: '',\n previewProps: {\n previewModeId: '',\n previewModeEncryptionKey: '',\n previewModeSigningKey: '',\n },\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n writeRoutesHashesManifest: false,\n currentNodeJsVersion,\n isPersistentCachingEnabled: persistentCaching,\n nextVersion: process.env.__NEXT_VERSION as string,\n },\n {\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching,\n isCi: isCI,\n isShortSession: true,\n }\n )\n\n try {\n backgroundLogCompilationEvents(project)\n\n await project.writeAnalyzeData(analyzeContext.appDirOnly)\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["path","validateTurboNextConfig","createDefineEnv","loadBindings","isCI","backgroundLogCompilationEvents","getSupportedBrowsers","normalizePath","PHASE_PRODUCTION_BUILD","turbopackAnalyze","analyzeContext","config","dir","configPhase","distDir","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","experimental","useWasmBinary","isWasm","Error","platform","arch","dev","supportedBrowsers","persistentCaching","turbopackFileSystemCacheForBuild","rootPath","turbopack","root","outputFileTracingRoot","project","turbo","createProject","projectPath","relative","nextConfig","watch","enable","env","defineEnv","isTurbopack","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","undefined","rewrites","beforeFiles","afterFiles","fallback","buildId","encryptionKey","previewProps","previewModeId","previewModeEncryptionKey","previewModeSigningKey","browserslistQuery","join","writeRoutesHashesManifest","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isShortSession","writeAnalyzeData","appDirOnly","shutdownPromise","shutdown","time","duration","err","waitForShutdown"],"mappings":"AAGA,OAAOA,UAAU,OAAM;AACvB,SAASC,uBAAuB,QAAQ,8BAA6B;AACrE,SAASC,eAAe,EAAEC,YAAY,QAAQ,SAAQ;AACtD,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASC,8BAA8B,QAAQ,gDAA+C;AAC9F,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,sBAAsB,QAAQ,6BAA4B;AAUnE,OAAO,eAAeC,iBACpBC,cAA8B;QAcMC,sBAelCA,uBACeA,mBAGHA,oBAwCGA;IApEjB,MAAMV,wBAAwB;QAC5BW,KAAKF,eAAeE,GAAG;QACvBC,aAAaL;IACf;IAEA,MAAM,EAAEG,MAAM,EAAEC,GAAG,EAAEE,OAAO,EAAEC,UAAU,EAAE,GAAGL;IAC7C,MAAMM,uBAAuBC,QAAQC,QAAQ,CAACC,IAAI;IAElD,MAAMC,YAAYH,QAAQI,MAAM;IAChC,MAAMC,WAAW,MAAMnB,aAAaQ,2BAAAA,uBAAAA,OAAQY,YAAY,qBAApBZ,qBAAsBa,aAAa;IAEvE,IAAIF,SAASG,MAAM,EAAE;QACnB,MAAM,qBAIL,CAJK,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,GAAG,CAACsB,cAAc;IACzC,GACA;QACEC,WAAW,GAAEzD,wBAAAA,OAAOY,YAAY,qBAAnBZ,sBAAqB0D,oBAAoB;QACtDC,oBAAoBvC;QACpBwC,MAAMnE;QACNoE,gBAAgB;IAClB;IAGF,IAAI;QACFnE,+BAA+BgC;QAE/B,MAAMA,QAAQoC,gBAAgB,CAAC/D,eAAegE,UAAU;QAExD,MAAMC,kBAAkBtC,QAAQuC,QAAQ;QAExC,MAAMC,OAAO5D,QAAQI,MAAM,CAACD;QAC5B,OAAO;YACL0D,UAAUD,IAAI,CAAC,EAAE,GAAGA,IAAI,CAAC,EAAE,GAAG;YAC9BF;QACF;IACF,EAAE,OAAOI,KAAK;QACZ,MAAM1C,QAAQuC,QAAQ;QACtB,MAAMG;IACR;AACF;AAEA,IAAIJ;AACJ,OAAO,eAAeK;IACpB,IAAIL,iBAAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}

@@ -5,3 +5,2 @@ // Import cpu-profile first to start profiling early if enabled

import { validateTurboNextConfig } from '../../lib/turbopack-warning';
import { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils';
import { NextBuildContext } from '../build-context';

@@ -20,7 +19,8 @@ import { createDefineEnv, getBindingsSync } from '../swc';

import { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events';
import { getSupportedBrowsers, printBuildErrors } from '../utils';
import { getSupportedBrowsers } from '../get-supported-browsers';
import { printBuildErrors } from '../print-build-errors';
import { normalizePath } from '../../lib/normalize-path';
import { Bundler } from '../../lib/bundler';
export async function turbopackBuild() {
var _config_experimental_deferredEntries, _config_turbopack, _config_experimental, _config_experimental_sri;
var _config_experimental_deferredEntries, _config_experimental, _config_turbopack, _config_experimental1, _config_experimental_sri;
await validateTurboNextConfig({

@@ -53,3 +53,3 @@ dir: NextBuildContext.dir,

const hasDeferredEntries = (((_config_experimental_deferredEntries = config.experimental.deferredEntries) == null ? void 0 : _config_experimental_deferredEntries.length) ?? 0) > 0;
const persistentCaching = isFileSystemCacheEnabledForBuild(config);
const persistentCaching = ((_config_experimental = config.experimental) == null ? void 0 : _config_experimental.turbopackFileSystemCacheForBuild) || false;
const rootPath = ((_config_turbopack = config.turbopack) == null ? void 0 : _config_turbopack.root) || config.outputFileTracingRoot || dir;

@@ -89,6 +89,6 @@ // Shared options for createProject calls

deferredEntries: config.experimental.deferredEntries,
nextVersion: "16.2.0-canary.72"
nextVersion: "16.2.0-canary.73"
};
const sharedTurboOptions = {
memoryLimit: (_config_experimental = config.experimental) == null ? void 0 : _config_experimental.turbopackMemoryLimit,
memoryLimit: (_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackMemoryLimit,
dependencyTracking: persistentCaching || hasDeferredEntries,

@@ -95,0 +95,0 @@ isCi: isCI,

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["// Import cpu-profile first to start profiling early if enabled\nimport { saveCpuProfile } from '../../server/lib/cpu-profile'\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, getBindingsSync } from '../swc'\nimport { installBindings } from '../swc/install-bindings'\nimport {\n handleRouteType,\n rawEntrypointsToEntrypoints,\n} from '../handle-entrypoints'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport { setGlobal } from '../../trace'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers, printBuildErrors } from '../utils'\nimport { normalizePath } from '../../lib/normalize-path'\nimport type {\n ProjectOptions,\n RawEntrypoints,\n TurbopackResult,\n} from '../swc/types'\nimport { Bundler } from '../../lib/bundler'\n\nexport async function turbopackBuild(): Promise<{\n duration: number\n buildTraceContext: undefined\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: NextBuildContext.dir!,\n configPhase: PHASE_PRODUCTION_BUILD,\n })\n\n const config = NextBuildContext.config!\n const dir = NextBuildContext.dir!\n const distDir = NextBuildContext.distDir!\n const buildId = NextBuildContext.buildId!\n const encryptionKey = NextBuildContext.encryptionKey!\n const previewProps = NextBuildContext.previewProps!\n const hasRewrites = NextBuildContext.hasRewrites!\n const rewrites = NextBuildContext.rewrites!\n const noMangling = NextBuildContext.noMangling!\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = getBindingsSync() // our caller should have already loaded these\n\n if (bindings.isWasm) {\n throw new Error(\n `Turbopack is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n `To build on this platform, use Webpack instead:\\n` +\n ` next build --webpack\\n\\n` +\n `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n )\n }\n\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const hasDeferredEntries =\n (config.experimental.deferredEntries?.length ?? 0) > 0\n\n const persistentCaching = isFileSystemCacheEnabledForBuild(config)\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n\n // Shared options for createProject calls\n const sharedProjectOptions: Omit<ProjectOptions, 'debugBuildPaths'> = {\n rootPath,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters: NextBuildContext.clientRouterFilters!,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites,\n }),\n buildId,\n encryptionKey,\n previewProps,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n writeRoutesHashesManifest:\n !!process.env.NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST,\n currentNodeJsVersion,\n isPersistentCachingEnabled: persistentCaching,\n deferredEntries: config.experimental.deferredEntries,\n nextVersion: process.env.__NEXT_VERSION as string,\n }\n\n const sharedTurboOptions = {\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching || hasDeferredEntries,\n isCi: isCI,\n isShortSession: true,\n }\n\n const sriEnabled = Boolean(config.experimental.sri?.algorithm)\n\n const project = await bindings.turbo.createProject(\n {\n ...sharedProjectOptions,\n debugBuildPaths: NextBuildContext.debugBuildPaths,\n },\n sharedTurboOptions,\n hasDeferredEntries && config.experimental.onBeforeDeferredEntries\n ? {\n onBeforeDeferredEntries: async () => {\n const workerConfig = await loadConfig(PHASE_PRODUCTION_BUILD, dir, {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling:\n NextBuildContext.reactProductionProfiling,\n bundler: Bundler.Turbopack,\n })\n\n await workerConfig.experimental.onBeforeDeferredEntries?.()\n },\n }\n : undefined\n )\n try {\n backgroundLogCompilationEvents(project)\n\n // Write an empty file in a known location to signal this was built with Turbopack\n await fs.writeFile(path.join(distDir, 'turbopack'), '')\n\n await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n await fs.mkdir(path.join(distDir, 'static', buildId), {\n recursive: true,\n })\n await fs.writeFile(\n path.join(distDir, 'package.json'),\n '{\"type\": \"commonjs\"}'\n )\n\n let appDirOnly = NextBuildContext.appDirOnly!\n\n const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly)\n printBuildErrors(entrypoints, dev)\n\n const routes = entrypoints.routes\n if (!routes) {\n // This should never ever happen, there should be an error issue, or the bindings call should\n // have thrown.\n throw new Error(`Turbopack build failed`)\n }\n\n const hasPagesEntries = Array.from(routes.values()).some((route) => {\n if (route.type === 'page' || route.type === 'page-api') {\n return true\n }\n return false\n })\n // If there's no pages entries, then we are in app-dir-only mode\n if (!hasPagesEntries) {\n appDirOnly = true\n }\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n dev: false,\n sriEnabled,\n })\n\n const currentEntrypoints = await rawEntrypointsToEntrypoints(\n entrypoints as TurbopackResult<RawEntrypoints>\n )\n\n const promises: Promise<void>[] = []\n\n if (!appDirOnly) {\n for (const [page, route] of currentEntrypoints.page) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n }\n\n for (const [page, route] of currentEntrypoints.app) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n\n await Promise.all(promises)\n\n await Promise.all([\n // Only load pages router manifests if not app-only\n ...(!appDirOnly\n ? [\n manifestLoader.loadBuildManifest('_app'),\n manifestLoader.loadPagesManifest('_app'),\n manifestLoader.loadFontManifest('_app'),\n manifestLoader.loadPagesManifest('_document'),\n manifestLoader.loadClientBuildManifest('_error'),\n manifestLoader.loadBuildManifest('_error'),\n manifestLoader.loadPagesManifest('_error'),\n manifestLoader.loadFontManifest('_error'),\n ]\n : []),\n entrypoints.instrumentation &&\n manifestLoader.loadMiddlewareManifest(\n 'instrumentation',\n 'instrumentation'\n ),\n entrypoints.middleware &&\n (await manifestLoader.loadMiddlewareManifest(\n 'middleware',\n 'middleware'\n )),\n ])\n\n manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites: rewrites,\n entrypoints: currentEntrypoints,\n })\n\n if (NextBuildContext.analyze) {\n await project.writeAnalyzeData(appDirOnly)\n }\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n buildTraceContext: undefined,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n buildContext: typeof NextBuildContext\n}): Promise<\n Omit<Awaited<ReturnType<typeof turbopackBuild>>, 'shutdownPromise'>\n> {\n // setup new build context from the serialized data passed from the parent\n Object.assign(NextBuildContext, workerData.buildContext)\n\n /// load the config because it's not serializable\n const config = await loadConfig(\n PHASE_PRODUCTION_BUILD,\n NextBuildContext.dir!,\n {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling: NextBuildContext.reactProductionProfiling,\n bundler: Bundler.Turbopack,\n }\n )\n NextBuildContext.config = config\n // Matches handling in build/index.ts\n // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n // Ensures the `config.distDir` option is matched.\n if (hasCustomExportOutput(NextBuildContext.config)) {\n NextBuildContext.config.distDir = '.next'\n }\n\n // Clone the telemetry for worker\n const telemetry = new Telemetry({\n distDir: NextBuildContext.config.distDir,\n })\n setGlobal('telemetry', telemetry)\n // Install bindings early so we can access synchronously later\n await installBindings(config.experimental?.useWasmBinary)\n\n try {\n const {\n shutdownPromise: resultShutdownPromise,\n buildTraceContext,\n duration,\n } = await turbopackBuild()\n shutdownPromise = resultShutdownPromise\n return {\n buildTraceContext,\n duration,\n }\n } finally {\n // Always flush telemetry before worker exits (waits for async operations like setTimeout in debug mode)\n await telemetry.flush()\n // Save CPU profile before worker exits\n await saveCpuProfile()\n }\n}\n\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["saveCpuProfile","path","validateTurboNextConfig","isFileSystemCacheEnabledForBuild","NextBuildContext","createDefineEnv","getBindingsSync","installBindings","handleRouteType","rawEntrypointsToEntrypoints","TurbopackManifestLoader","promises","fs","PHASE_PRODUCTION_BUILD","loadConfig","hasCustomExportOutput","Telemetry","setGlobal","isCI","backgroundLogCompilationEvents","getSupportedBrowsers","printBuildErrors","normalizePath","Bundler","turbopackBuild","config","dir","configPhase","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","isWasm","Error","platform","arch","dev","supportedBrowsers","hasDeferredEntries","experimental","deferredEntries","length","persistentCaching","rootPath","turbopack","root","outputFileTracingRoot","sharedProjectOptions","projectPath","relative","nextConfig","watch","enable","env","defineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","middlewareMatchers","undefined","browserslistQuery","join","writeRoutesHashesManifest","NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","sharedTurboOptions","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isShortSession","sriEnabled","Boolean","sri","algorithm","project","turbo","createProject","debugBuildPaths","onBeforeDeferredEntries","workerConfig","debugPrerender","reactProductionProfiling","bundler","Turbopack","writeFile","mkdir","recursive","appDirOnly","entrypoints","writeAllEntrypointsToDisk","routes","hasPagesEntries","Array","from","values","some","route","type","manifestLoader","currentEntrypoints","page","push","app","Promise","all","loadBuildManifest","loadPagesManifest","loadFontManifest","loadClientBuildManifest","instrumentation","loadMiddlewareManifest","middleware","writeManifests","devRewrites","productionRewrites","analyze","writeAnalyzeData","shutdownPromise","shutdown","time","duration","buildTraceContext","err","workerMain","workerData","Object","assign","buildContext","telemetry","useWasmBinary","resultShutdownPromise","flush","waitForShutdown"],"mappings":"AAAA,+DAA+D;AAC/D,SAASA,cAAc,QAAQ,+BAA8B;AAC7D,OAAOC,UAAU,OAAM;AACvB,SAASC,uBAAuB,QAAQ,8BAA6B;AACrE,SAASC,gCAAgC,QAAQ,mCAAkC;AACnF,SAASC,gBAAgB,QAAQ,mBAAkB;AACnD,SAASC,eAAe,EAAEC,eAAe,QAAQ,SAAQ;AACzD,SAASC,eAAe,QAAQ,0BAAyB;AACzD,SACEC,eAAe,EACfC,2BAA2B,QACtB,wBAAuB;AAC9B,SAASC,uBAAuB,QAAQ,6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BAAiB,EACjBD,QAAQ,EACT,GAAG,MAAM7G;QACV0G,kBAAkBa;QAClB,OAAO;YACLT;YACAD;QACF;IACF,SAAU;QACR,wGAAwG;QACxG,MAAMQ,UAAUG,KAAK;QACrB,uCAAuC;QACvC,MAAMhJ;IACR;AACF;AAEA,OAAO,eAAeiJ;IACpB,IAAIf,iBAAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["// Import cpu-profile first to start profiling early if enabled\nimport { saveCpuProfile } from '../../server/lib/cpu-profile'\nimport path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, getBindingsSync } from '../swc'\nimport { installBindings } from '../swc/install-bindings'\nimport {\n handleRouteType,\n rawEntrypointsToEntrypoints,\n} from '../handle-entrypoints'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport { setGlobal } from '../../trace'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers } from '../get-supported-browsers'\nimport { printBuildErrors } from '../print-build-errors'\nimport { normalizePath } from '../../lib/normalize-path'\nimport type {\n ProjectOptions,\n RawEntrypoints,\n TurbopackResult,\n} from '../swc/types'\nimport { Bundler } from '../../lib/bundler'\n\nexport async function turbopackBuild(): Promise<{\n duration: number\n buildTraceContext: undefined\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: NextBuildContext.dir!,\n configPhase: PHASE_PRODUCTION_BUILD,\n })\n\n const config = NextBuildContext.config!\n const dir = NextBuildContext.dir!\n const distDir = NextBuildContext.distDir!\n const buildId = NextBuildContext.buildId!\n const encryptionKey = NextBuildContext.encryptionKey!\n const previewProps = NextBuildContext.previewProps!\n const hasRewrites = NextBuildContext.hasRewrites!\n const rewrites = NextBuildContext.rewrites!\n const noMangling = NextBuildContext.noMangling!\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = getBindingsSync() // our caller should have already loaded these\n\n if (bindings.isWasm) {\n throw new Error(\n `Turbopack is not supported on this platform (${process.platform}/${process.arch}) because native bindings are not available. ` +\n `Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\n` +\n `To build on this platform, use Webpack instead:\\n` +\n ` next build --webpack\\n\\n` +\n `For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms`\n )\n }\n\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const hasDeferredEntries =\n (config.experimental.deferredEntries?.length ?? 0) > 0\n\n const persistentCaching =\n config.experimental?.turbopackFileSystemCacheForBuild || false\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n\n // Shared options for createProject calls\n const sharedProjectOptions: Omit<ProjectOptions, 'debugBuildPaths'> = {\n rootPath,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters: NextBuildContext.clientRouterFilters!,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites,\n }),\n buildId,\n encryptionKey,\n previewProps,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n writeRoutesHashesManifest:\n !!process.env.NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST,\n currentNodeJsVersion,\n isPersistentCachingEnabled: persistentCaching,\n deferredEntries: config.experimental.deferredEntries,\n nextVersion: process.env.__NEXT_VERSION as string,\n }\n\n const sharedTurboOptions = {\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching || hasDeferredEntries,\n isCi: isCI,\n isShortSession: true,\n }\n\n const sriEnabled = Boolean(config.experimental.sri?.algorithm)\n\n const project = await bindings.turbo.createProject(\n {\n ...sharedProjectOptions,\n debugBuildPaths: NextBuildContext.debugBuildPaths,\n },\n sharedTurboOptions,\n hasDeferredEntries && config.experimental.onBeforeDeferredEntries\n ? {\n onBeforeDeferredEntries: async () => {\n const workerConfig = await loadConfig(PHASE_PRODUCTION_BUILD, dir, {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling:\n NextBuildContext.reactProductionProfiling,\n bundler: Bundler.Turbopack,\n })\n\n await workerConfig.experimental.onBeforeDeferredEntries?.()\n },\n }\n : undefined\n )\n try {\n backgroundLogCompilationEvents(project)\n\n // Write an empty file in a known location to signal this was built with Turbopack\n await fs.writeFile(path.join(distDir, 'turbopack'), '')\n\n await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n await fs.mkdir(path.join(distDir, 'static', buildId), {\n recursive: true,\n })\n await fs.writeFile(\n path.join(distDir, 'package.json'),\n '{\"type\": \"commonjs\"}'\n )\n\n let appDirOnly = NextBuildContext.appDirOnly!\n\n const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly)\n printBuildErrors(entrypoints, dev)\n\n const routes = entrypoints.routes\n if (!routes) {\n // This should never ever happen, there should be an error issue, or the bindings call should\n // have thrown.\n throw new Error(`Turbopack build failed`)\n }\n\n const hasPagesEntries = Array.from(routes.values()).some((route) => {\n if (route.type === 'page' || route.type === 'page-api') {\n return true\n }\n return false\n })\n // If there's no pages entries, then we are in app-dir-only mode\n if (!hasPagesEntries) {\n appDirOnly = true\n }\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n dev: false,\n sriEnabled,\n })\n\n const currentEntrypoints = await rawEntrypointsToEntrypoints(\n entrypoints as TurbopackResult<RawEntrypoints>\n )\n\n const promises: Promise<void>[] = []\n\n if (!appDirOnly) {\n for (const [page, route] of currentEntrypoints.page) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n }\n\n for (const [page, route] of currentEntrypoints.app) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n\n await Promise.all(promises)\n\n await Promise.all([\n // Only load pages router manifests if not app-only\n ...(!appDirOnly\n ? [\n manifestLoader.loadBuildManifest('_app'),\n manifestLoader.loadPagesManifest('_app'),\n manifestLoader.loadFontManifest('_app'),\n manifestLoader.loadPagesManifest('_document'),\n manifestLoader.loadClientBuildManifest('_error'),\n manifestLoader.loadBuildManifest('_error'),\n manifestLoader.loadPagesManifest('_error'),\n manifestLoader.loadFontManifest('_error'),\n ]\n : []),\n entrypoints.instrumentation &&\n manifestLoader.loadMiddlewareManifest(\n 'instrumentation',\n 'instrumentation'\n ),\n entrypoints.middleware &&\n (await manifestLoader.loadMiddlewareManifest(\n 'middleware',\n 'middleware'\n )),\n ])\n\n manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites: rewrites,\n entrypoints: currentEntrypoints,\n })\n\n if (NextBuildContext.analyze) {\n await project.writeAnalyzeData(appDirOnly)\n }\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n buildTraceContext: undefined,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n buildContext: typeof NextBuildContext\n}): Promise<\n Omit<Awaited<ReturnType<typeof turbopackBuild>>, 'shutdownPromise'>\n> {\n // setup new build context from the serialized data passed from the parent\n Object.assign(NextBuildContext, workerData.buildContext)\n\n /// load the config because it's not serializable\n const config = await loadConfig(\n PHASE_PRODUCTION_BUILD,\n NextBuildContext.dir!,\n {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling: NextBuildContext.reactProductionProfiling,\n bundler: Bundler.Turbopack,\n }\n )\n NextBuildContext.config = config\n // Matches handling in build/index.ts\n // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n // Ensures the `config.distDir` option is matched.\n if (hasCustomExportOutput(NextBuildContext.config)) {\n NextBuildContext.config.distDir = '.next'\n }\n\n // Clone the telemetry for worker\n const telemetry = new Telemetry({\n distDir: NextBuildContext.config.distDir,\n })\n setGlobal('telemetry', telemetry)\n // Install bindings early so we can access synchronously later\n await installBindings(config.experimental?.useWasmBinary)\n\n try {\n const {\n shutdownPromise: resultShutdownPromise,\n buildTraceContext,\n duration,\n } = await turbopackBuild()\n shutdownPromise = resultShutdownPromise\n return {\n buildTraceContext,\n duration,\n }\n } finally {\n // Always flush telemetry before worker exits (waits for async operations like setTimeout in debug mode)\n await telemetry.flush()\n // Save CPU profile before worker exits\n await saveCpuProfile()\n }\n}\n\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["saveCpuProfile","path","validateTurboNextConfig","NextBuildContext","createDefineEnv","getBindingsSync","installBindings","handleRouteType","rawEntrypointsToEntrypoints","TurbopackManifestLoader","promises","fs","PHASE_PRODUCTION_BUILD","loadConfig","hasCustomExportOutput","Telemetry","setGlobal","isCI","backgroundLogCompilationEvents","getSupportedBrowsers","printBuildErrors","normalizePath","Bundler","turbopackBuild","config","dir","configPhase","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","isWasm","Error","platform","arch","dev","supportedBrowsers","hasDeferredEntries","experimental","deferredEntries","length","persistentCaching","turbopackFileSystemCacheForBuild","rootPath","turbopack","root","outputFileTracingRoot","sharedProjectOptions","projectPath","relative","nextConfig","watch","enable","env","defineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","middlewareMatchers","undefined","browserslistQuery","join","writeRoutesHashesManifest","NEXT_TURBOPACK_WRITE_ROUTES_HASHES_MANIFEST","isPersistentCachingEnabled","nextVersion","__NEXT_VERSION","sharedTurboOptions","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isShortSession","sriEnabled","Boolean","sri","algorithm","project","turbo","createProject","debugBuildPaths","onBeforeDeferredEntries","workerConfig","debugPrerender","reactProductionProfiling","bundler","Turbopack","writeFile","mkdir","recursive","appDirOnly","entrypoints","writeAllEntrypointsToDisk","routes","hasPagesEntries","Array","from","values","some","route","type","manifestLoader","currentEntrypoints","page","push","app","Promise","all","loadBuildManifest","loadPagesManifest","loadFontManifest","loadClientBuildManifest","instrumentation","loadMiddlewareManifest","middleware","writeManifests","devRewrites","productionRewrites","analyze","writeAnalyzeData","shutdownPromise","shutdown","time","duration","buildTraceContext","err","workerMain","workerData","Object","assign","buildContext","telemetry","useWasmBinary","resultShutdownPromise","flush","waitForShutdown"],"mappings":"AAAA,+DAA+D;AAC/D,SAASA,cAAc,QAAQ,+BAA8B;AAC7D,OAAOC,UAAU,OAAM;AACvB,SAASC,uBAAuB,QAAQ,8BAA6B;AACrE,SAASC,gBAAgB,QAAQ,mBAAkB;AACnD,SAASC,eAAe,EAAEC,eAAe,QAAQ,SAAQ;AACzD,SAASC,eAAe,QAAQ,0BAAyB;AACzD,SACEC,eAAe,EACfC,2BAA2B,QACtB,wBAAuB;AAC9B,SAASC,uBAAuB,QAAQ,6CAA4C;AACpF,SAASC,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,sBAAsB,QAAQ,6BAA4B;AACnE,OAAOC,gBAAgB,sBAAqB;AAC5C,SAASC,qBAAqB,QAAQ,qBAAoB;AAC1D,SAASC,SAAS,QAAQ,0BAAyB;AACnD,SAASC,SAAS,QAAQ,cAAa;AACvC,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASC,8BAA8B,QAAQ,gDAA+C;AAC9F,SAASC,oBA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AAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}

@@ -13,4 +13,3 @@ import { checkIsRoutePPREnabled } from '../server/lib/experimental/ppr';

import stripAnsi from 'next/dist/compiled/strip-ansi';
import browserslist from 'next/dist/compiled/browserslist';
import { MODERN_BROWSERSLIST_TARGET, UNDERSCORE_GLOBAL_ERROR_ROUTE, UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY, UNDERSCORE_NOT_FOUND_ROUTE } from '../shared/lib/constants';
import { UNDERSCORE_GLOBAL_ERROR_ROUTE, UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY, UNDERSCORE_NOT_FOUND_ROUTE } from '../shared/lib/constants';
import { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic';

@@ -33,3 +32,2 @@ import { findPageFile } from '../server/lib/find-page-file';

import { formatExpire, formatRevalidate } from './output/format';
import { formatIssue, isRelevantWarning } from '../shared/lib/turbopack/utils';
import { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex';

@@ -113,70 +111,2 @@ import { parseAppRoute } from '../shared/lib/router/routes/app';

}
/**
* Processes and categorizes build issues, then logs them as warnings, errors, or fatal errors.
* Stops execution if fatal issues are encountered.
*
* @param entrypoints - The result object containing build issues to process.
* @param isDev - A flag indicating if the build is running in development mode.
* @return This function does not return a value but logs or throws errors based on the issues.
* @throws {Error} If a fatal issue is encountered, this function throws an error. In development mode, we only throw on
* 'fatal' and 'bug' issues. In production mode, we also throw on 'error' issues.
*/ export function printBuildErrors(entrypoints, isDev) {
// Issues that we want to stop the server from executing
const topLevelFatalIssues = [];
// Issues that are true errors, but we believe we can keep running and allow the user to address the issue
const topLevelErrors = [];
// Issues that are warnings but should not affect the running of the build
const topLevelWarnings = [];
// Track seen formatted error messages to avoid duplicates
const seenFatalIssues = new Set();
const seenErrors = new Set();
const seenWarnings = new Set();
for (const issue of entrypoints.issues){
// We only want to completely shut down the server
if (issue.severity === 'fatal' || issue.severity === 'bug') {
const formatted = formatIssue(issue);
if (!seenFatalIssues.has(formatted)) {
seenFatalIssues.add(formatted);
topLevelFatalIssues.push(formatted);
}
} else if (isRelevantWarning(issue)) {
const formatted = formatIssue(issue);
if (!seenWarnings.has(formatted)) {
seenWarnings.add(formatted);
topLevelWarnings.push(formatted);
}
} else if (issue.severity === 'error') {
const formatted = formatIssue(issue);
if (isDev) {
// We want to treat errors as recoverable in development
// so that we can show the errors in the site and allow users
// to respond to the errors when necessary. In production builds
// though we want to error out and stop the build process.
if (!seenErrors.has(formatted)) {
seenErrors.add(formatted);
topLevelErrors.push(formatted);
}
} else {
if (!seenFatalIssues.has(formatted)) {
seenFatalIssues.add(formatted);
topLevelFatalIssues.push(formatted);
}
}
}
}
// TODO: print in order by source location so issues from the same file are displayed together and then add a summary at the end about the number of warnings/errors
if (topLevelWarnings.length > 0) {
console.warn(`Turbopack build encountered ${topLevelWarnings.length} warnings:\n${topLevelWarnings.join('\n')}`);
}
if (topLevelErrors.length > 0) {
console.error(`Turbopack build encountered ${topLevelErrors.length} errors:\n${topLevelErrors.join('\n')}`);
}
if (topLevelFatalIssues.length > 0) {
throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelFatalIssues.length} errors:\n${topLevelFatalIssues.join('\n')}`), "__NEXT_ERROR_CODE", {
value: "E425",
enumerable: false,
configurable: true
});
}
}
export async function printTreeView(lists, pageInfos, { pagesDir, pageExtensions, middlewareManifest, functionsConfigManifest, useStaticPages404, hasGSPAndRevalidateZero }) {

@@ -1043,21 +973,3 @@ var _lists_app, _middlewareManifest_middleware_, _middlewareManifest_middleware, // 'nodejs' runtime middleware or proxy is set to

}
export function getSupportedBrowsers(dir, isDevelopment) {
let browsers;
try {
const browsersListConfig = browserslist.loadConfig({
path: dir,
env: isDevelopment ? 'development' : 'production'
});
// Running `browserslist` resolves `extends` and other config features into a list of browsers
if (browsersListConfig && browsersListConfig.length > 0) {
browsers = browserslist(browsersListConfig);
}
} catch {}
// When user has browserslist use that target
if (browsers && browsers.length > 0) {
return browsers;
}
// Uses modern browsers as the default.
return MODERN_BROWSERSLIST_TARGET;
}
export { getSupportedBrowsers } from './get-supported-browsers';
export function shouldUseReactServerCondition(layer) {

@@ -1064,0 +976,0 @@ return Boolean(layer && WEBPACK_LAYERS.GROUP.serverOnly.includes(layer));

@@ -12,3 +12,3 @@ import { getNamedMiddlewareRegex } from '../../../shared/lib/router/utils/route-regex';

import { INSTRUMENTATION_HOOK_FILENAME, WEBPACK_LAYERS } from '../../../lib/constants';
import { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites';
import { isInterceptionRouteRewrite } from '../../../lib/is-interception-route-rewrite';
import { getDynamicCodeEvaluationError } from './wellknown-errors-plugin/parse-dynamic-code-evaluation-error';

@@ -15,0 +15,0 @@ import { getModuleReferencesInOrder } from '../utils';

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../../src/build/webpack/plugins/middleware-plugin.ts"],"sourcesContent":["import type {\n AssetBinding,\n EdgeMiddlewareMeta,\n} from '../loaders/get-module-build-info'\nimport type { EdgeSSRMeta } from '../loaders/get-module-build-info'\nimport type { ProxyMatcher } from '../../analysis/get-page-static-info'\nimport { getNamedMiddlewareRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport path from 'path'\nimport {\n EDGE_RUNTIME_WEBPACK,\n EDGE_UNSUPPORTED_NODE_APIS,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n MIDDLEWARE_MANIFEST,\n MIDDLEWARE_REACT_LOADABLE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n NEXT_FONT_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n SERVER_FILES_MANIFEST,\n} from '../../../shared/lib/constants'\nimport type { ProxyConfig } from '../../analysis/get-page-static-info'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport { traceGlobals } from '../../../trace/shared'\nimport { EVENT_BUILD_FEATURE_USAGE } from '../../../telemetry/events'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport {\n INSTRUMENTATION_HOOK_FILENAME,\n WEBPACK_LAYERS,\n} from '../../../lib/constants'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport { getDynamicCodeEvaluationError } from './wellknown-errors-plugin/parse-dynamic-code-evaluation-error'\nimport { getModuleReferencesInOrder } from '../utils'\n\nconst KNOWN_SAFE_DYNAMIC_PACKAGES =\n require('../../../lib/known-edge-safe-packages.json') as string[]\n\nexport interface EdgeFunctionDefinition {\n files: string[]\n name: string\n page: string\n matchers: ProxyMatcher[]\n env: Record<string, string>\n wasm?: AssetBinding[]\n assets?: AssetBinding[]\n regions?: string[] | string\n}\n\nexport interface MiddlewareManifest {\n version: 3\n sortedMiddleware: string[]\n middleware: { [page: string]: EdgeFunctionDefinition }\n functions: { [page: string]: EdgeFunctionDefinition }\n}\n\ninterface EntryMetadata {\n edgeMiddleware?: EdgeMiddlewareMeta\n edgeApiFunction?: EdgeMiddlewareMeta\n edgeSSR?: EdgeSSRMeta\n wasmBindings: Map<string, string>\n assetBindings: Map<string, string>\n regions?: string[] | string\n}\n\nconst NAME = 'MiddlewarePlugin'\nconst MANIFEST_VERSION = 3\n\n/**\n * Checks the value of usingIndirectEval and when it is a set of modules it\n * check if any of the modules is actually being used. If the value is\n * simply truthy it will return true.\n */\nfunction isUsingIndirectEvalAndUsedByExports(args: {\n module: webpack.Module\n moduleGraph: webpack.ModuleGraph\n runtime: any\n usingIndirectEval: true | Set<string>\n wp: typeof webpack\n}): boolean {\n const { moduleGraph, runtime, module, usingIndirectEval, wp } = args\n if (typeof usingIndirectEval === 'boolean') {\n return usingIndirectEval\n }\n\n const exportsInfo = moduleGraph.getExportsInfo(module)\n for (const exportName of usingIndirectEval) {\n if (exportsInfo.getUsed(exportName, runtime) !== wp.UsageState.Unused) {\n return true\n }\n }\n\n return false\n}\n\nfunction getEntryFiles(\n entryFiles: string[],\n meta: EntryMetadata,\n hasInstrumentationHook: boolean,\n opts: Options\n) {\n const files: string[] = []\n if (meta.edgeSSR) {\n if (meta.edgeSSR.isServerComponent) {\n files.push(`server/${SERVER_REFERENCE_MANIFEST}.js`)\n if (opts.sriEnabled) {\n files.push(`server/${SUBRESOURCE_INTEGRITY_MANIFEST}.js`)\n }\n files.push(\n ...entryFiles\n .filter(\n (file) =>\n file.startsWith('app/') && !file.endsWith('.hot-update.js')\n )\n .map(\n (file) =>\n 'server/' +\n file.replace(/\\.js$/, '_' + CLIENT_REFERENCE_MANIFEST + '.js')\n )\n )\n }\n if (!opts.dev && !meta.edgeSSR.isAppDir) {\n files.push(`server/${DYNAMIC_CSS_MANIFEST}.js`)\n }\n\n files.push(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,\n `server/${NEXT_FONT_MANIFEST}.js`,\n `server/${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n\n if (!opts.dev) {\n files.push(`${SERVER_FILES_MANIFEST}.js`)\n }\n }\n\n if (hasInstrumentationHook) {\n files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`)\n }\n\n files.push(\n ...entryFiles\n .filter((file) => !file.endsWith('.hot-update.js'))\n .map((file) => 'server/' + file)\n )\n\n return files\n}\n\nfunction getCreateAssets(params: {\n compilation: webpack.Compilation\n metadataByEntry: Map<string, EntryMetadata>\n opts: Options\n}) {\n const { compilation, metadataByEntry, opts } = params\n return () => {\n const middlewareManifest: MiddlewareManifest = {\n version: MANIFEST_VERSION,\n middleware: {},\n functions: {},\n sortedMiddleware: [],\n }\n\n const hasInstrumentationHook = compilation.entrypoints.has(\n INSTRUMENTATION_HOOK_FILENAME\n )\n\n // we only emit this entry for the edge runtime since it doesn't have access to a routes manifest\n // and we don't need to provide the entire route manifest, just the interception routes.\n const interceptionRewrites = JSON.stringify(\n opts.rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n compilation.emitAsset(\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )}`\n ) as unknown as webpack.sources.RawSource\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (!entrypoint.name) {\n continue\n }\n\n // There should always be metadata for the entrypoint.\n const metadata = metadataByEntry.get(entrypoint.name)\n const page =\n metadata?.edgeMiddleware?.page ||\n metadata?.edgeSSR?.page ||\n metadata?.edgeApiFunction?.page\n if (!page) {\n continue\n }\n\n const matcherSource = metadata.edgeSSR?.isAppDir\n ? normalizeAppPath(page)\n : page\n\n const catchAll = !metadata.edgeSSR && !metadata.edgeApiFunction\n\n const { namedRegex } = getNamedMiddlewareRegex(matcherSource, {\n catchAll,\n })\n const matchers = metadata?.edgeMiddleware?.matchers ?? [\n {\n regexp: namedRegex,\n originalSource: page === '/' && catchAll ? '/:path*' : matcherSource,\n },\n ]\n\n const isEdgeFunction = !!(metadata.edgeApiFunction || metadata.edgeSSR)\n const edgeFunctionDefinition: EdgeFunctionDefinition = {\n files: getEntryFiles(\n entrypoint.getFiles(),\n metadata,\n hasInstrumentationHook,\n opts\n ),\n name: entrypoint.name,\n page: page,\n matchers,\n wasm: Array.from(metadata.wasmBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n assets: Array.from(metadata.assetBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n env: opts.edgeEnvironments,\n ...(metadata.regions && { regions: metadata.regions }),\n }\n\n if (isEdgeFunction) {\n middlewareManifest.functions[page] = edgeFunctionDefinition\n } else {\n middlewareManifest.middleware[page] = edgeFunctionDefinition\n }\n }\n\n middlewareManifest.sortedMiddleware = getSortedRoutes(\n Object.keys(middlewareManifest.middleware)\n )\n\n compilation.emitAsset(\n MIDDLEWARE_MANIFEST,\n new sources.RawSource(\n JSON.stringify(middlewareManifest, null, 2)\n ) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction buildWebpackError({\n message,\n loc,\n compilation,\n entryModule,\n parser,\n}: {\n message: string\n loc?: any\n compilation: webpack.Compilation\n entryModule?: webpack.Module\n parser?: webpack.javascript.JavascriptParser\n}) {\n const error = new compilation.compiler.webpack.WebpackError(message)\n error.name = NAME\n const module = entryModule ?? parser?.state.current\n if (module) {\n error.module = module\n }\n error.loc = loc\n return error\n}\n\nfunction isInMiddlewareLayer(parser: webpack.javascript.JavascriptParser) {\n const layer = parser.state.module?.layer\n return layer === WEBPACK_LAYERS.middleware || layer === WEBPACK_LAYERS.apiEdge\n}\n\nfunction isNodeJsModule(moduleName: string) {\n return (require('module') as typeof import('module')).builtinModules.includes(\n moduleName\n )\n}\n\nfunction isBunModule(moduleName: string) {\n return moduleName === 'bun' || moduleName.startsWith('bun:')\n}\n\nfunction isDynamicCodeEvaluationAllowed(\n fileName: string,\n middlewareConfig?: ProxyConfig,\n rootDir?: string\n) {\n // Some packages are known to use `eval` but are safe to use in the Edge\n // Runtime because the dynamic code will never be executed.\n if (\n KNOWN_SAFE_DYNAMIC_PACKAGES.some((pkg) =>\n fileName.includes(`/node_modules/${pkg}/`.replace(/\\//g, path.sep))\n )\n ) {\n return true\n }\n\n const name = fileName.replace(rootDir ?? '', '')\n\n return picomatch(middlewareConfig?.unstable_allowDynamic ?? [], {\n dot: true,\n })(name)\n}\n\nfunction buildUnsupportedApiError({\n apiName,\n loc,\n ...rest\n}: {\n apiName: string\n loc: any\n compilation: webpack.Compilation\n parser: webpack.javascript.JavascriptParser\n}) {\n return buildWebpackError({\n message: `A Node.js API is used (${apiName} at line: ${loc.start.line}) which is not supported in the Edge Runtime.\nLearn more: https://nextjs.org/docs/api-reference/edge-runtime`,\n loc,\n ...rest,\n })\n}\n\nfunction registerUnsupportedApiHooks(\n parser: webpack.javascript.JavascriptParser,\n compilation: webpack.Compilation\n) {\n for (const expression of EDGE_UNSUPPORTED_NODE_APIS) {\n const warnForUnsupportedApi = (node: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: expression,\n ...node,\n })\n )\n return true\n }\n parser.hooks.call.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.expression.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.callMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n parser.hooks.expressionMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n }\n\n const warnForUnsupportedProcessApi = (node: any, [callee]: string[]) => {\n if (!isInMiddlewareLayer(parser) || callee === 'env') {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: `process.${callee}`,\n ...node,\n })\n )\n return true\n }\n\n parser.hooks.callMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n parser.hooks.expressionMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n}\n\nfunction getCodeAnalyzer(params: {\n dev: boolean\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n}) {\n return (parser: webpack.javascript.JavascriptParser) => {\n const {\n dev,\n compiler: { webpack: wp },\n compilation,\n } = params\n const { hooks } = parser\n\n /**\n * For an expression this will check the graph to ensure it is being used\n * by exports. Then it will store in the module buildInfo a boolean to\n * express that it contains dynamic code and, if it is available, the\n * module path that is using it.\n */\n const handleExpression = () => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n wp.optimize.InnerGraph.onUsage(parser.state, (used = true) => {\n const buildInfo = getModuleBuildInfo(parser.state.module)\n if (buildInfo.usingIndirectEval === true || used === false) {\n return\n }\n\n if (!buildInfo.usingIndirectEval || used === true) {\n buildInfo.usingIndirectEval = used\n return\n }\n\n buildInfo.usingIndirectEval = new Set([\n ...Array.from(buildInfo.usingIndirectEval),\n ...Array.from(used),\n ])\n })\n }\n\n /**\n * This expression handler allows to wrap a dynamic code expression with a\n * function call where we can warn about dynamic code not being allowed\n * but actually execute the expression.\n */\n const handleWrapExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_eval__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n return true\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.compile invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n */\n const handleWrapWasmCompileExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_compile__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.instatiate invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n *\n * Note that we don't update `usingIndirectEval`, i.e. we don't abort a production build\n * since we can't determine statically if the first parameter is a module (legit use) or\n * a buffer (dynamic code generation).\n */\n const handleWrapWasmInstantiateExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n if (dev) {\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_instantiate__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n }\n }\n\n /**\n * Handler to store original source location of static and dynamic imports into module's buildInfo.\n */\n const handleImport = (node: any) => {\n if (isInMiddlewareLayer(parser) && node.source?.value && node?.loc) {\n const { module, source } = parser.state\n const buildInfo = getModuleBuildInfo(module)\n if (!buildInfo.importLocByPath) {\n buildInfo.importLocByPath = new Map()\n }\n\n const importedModule = node.source.value?.toString()\n buildInfo.importLocByPath.set(importedModule, {\n sourcePosition: {\n ...node.loc.start,\n source: module.identifier(),\n },\n sourceContent: source.toString(),\n })\n\n if (\n !dev &&\n (isNodeJsModule(importedModule) || isBunModule(importedModule)) &&\n !SUPPORTED_NATIVE_MODULES.includes(importedModule)\n ) {\n const isBun = isBunModule(importedModule)\n compilation.warnings.push(\n buildWebpackError({\n message: `A ${isBun ? 'Bun' : 'Node.js'} module is loaded ('${importedModule}' at line ${node.loc.start.line}) which is not supported in the Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`,\n compilation,\n parser,\n ...node,\n })\n )\n }\n }\n }\n\n /**\n * A noop handler to skip analyzing some cases.\n * Order matters: for it to work, it must be registered first\n */\n const skip = () => (isInMiddlewareLayer(parser) ? true : undefined)\n\n for (const prefix of ['', 'global.']) {\n hooks.expression.for(`${prefix}Function.prototype`).tap(NAME, skip)\n hooks.expression.for(`${prefix}Function.bind`).tap(NAME, skip)\n hooks.call.for(`${prefix}eval`).tap(NAME, handleWrapExpression)\n hooks.call.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.new.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.call\n .for(`${prefix}WebAssembly.compile`)\n .tap(NAME, handleWrapWasmCompileExpression)\n hooks.call\n .for(`${prefix}WebAssembly.instantiate`)\n .tap(NAME, handleWrapWasmInstantiateExpression)\n }\n\n hooks.importCall.tap(NAME, handleImport)\n hooks.import.tap(NAME, handleImport)\n\n if (!dev) {\n // do not issue compilation warning on dev: invoking code will provide details\n registerUnsupportedApiHooks(parser, compilation)\n }\n }\n}\n\nasync function codeAnalyzerBySwc(\n compilation: webpack.Compilation,\n modules: Iterable<webpack.Module>,\n dev: boolean\n) {\n const binding = require('../../swc') as typeof import('../../swc')\n for (const module of modules) {\n if (\n module.layer !== WEBPACK_LAYERS.middleware &&\n module.layer !== WEBPACK_LAYERS.apiEdge\n ) {\n continue\n }\n if (module.constructor.name !== 'NormalModule') {\n continue\n }\n const normalModule = module as webpack.NormalModule\n if (!normalModule.type.startsWith('javascript')) {\n // Only analyze JavaScript modules\n continue\n }\n const originalSource = normalModule.originalSource()\n if (!originalSource) {\n continue\n }\n const source = originalSource.source()\n if (typeof source !== 'string') {\n continue\n }\n const diagnostics = await binding.warnForEdgeRuntime(source, !dev)\n for (const diagnostic of diagnostics) {\n const webpackError = buildWebpackError({\n message: diagnostic.message,\n loc: diagnostic.loc,\n compilation,\n entryModule: module,\n })\n if (diagnostic.severity === 'Warning') {\n compilation.warnings.push(webpackError)\n } else {\n compilation.errors.push(webpackError)\n }\n }\n }\n}\n\nfunction getExtractMetadata(params: {\n compilation: webpack.Compilation\n compiler: webpack.Compiler\n dev: boolean\n metadataByEntry: Map<string, EntryMetadata>\n}): () => Promise<void> {\n const { dev, compilation, metadataByEntry, compiler } = params\n const { webpack: wp } = compiler\n return async () => {\n metadataByEntry.clear()\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n\n for (const [entryName, entry] of compilation.entries) {\n if (entry.options.runtime !== EDGE_RUNTIME_WEBPACK) {\n // Only process edge runtime entries\n continue\n }\n const entryDependency = entry.dependencies?.[0]\n const resolvedModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)\n if (!resolvedModule) {\n continue\n }\n const { rootDir, route } = getModuleBuildInfo(resolvedModule)\n\n const { moduleGraph } = compilation\n const modules = new Set<webpack.NormalModule>()\n const addEntriesFromDependency = (dependency: any) => {\n const module = moduleGraph.getModule(dependency)\n if (module) {\n modules.add(module as webpack.NormalModule)\n }\n }\n\n entry.dependencies.forEach(addEntriesFromDependency)\n entry.includeDependencies.forEach(addEntriesFromDependency)\n\n const entryMetadata: EntryMetadata = {\n wasmBindings: new Map(),\n assetBindings: new Map(),\n }\n\n if (route?.middlewareConfig?.regions) {\n entryMetadata.regions = route.middlewareConfig.regions\n }\n\n if (route?.preferredRegion) {\n const preferredRegion = route.preferredRegion\n entryMetadata.regions =\n // Ensures preferredRegion is always an array in the manifest.\n typeof preferredRegion === 'string'\n ? [preferredRegion]\n : preferredRegion\n }\n\n let ogImageGenerationCount = 0\n\n for (const module of modules) {\n const buildInfo = getModuleBuildInfo(module)\n\n /**\n * Check if it uses the image generation feature.\n */\n if (!dev) {\n const resource = module.resource\n const hasOGImageGeneration =\n resource &&\n /[\\\\/]node_modules[\\\\/]@vercel[\\\\/]og[\\\\/]dist[\\\\/]index\\.(edge|node)\\.js$|[\\\\/]next[\\\\/]dist[\\\\/](esm[\\\\/])?server[\\\\/]og[\\\\/]image-response\\.js$/.test(\n resource\n )\n\n if (hasOGImageGeneration) {\n ogImageGenerationCount++\n }\n }\n\n /**\n * When building for production checks if the module is using `eval`\n * and in such case produces a compilation error. The module has to\n * be in use.\n */\n if (\n !dev &&\n buildInfo.usingIndirectEval &&\n isUsingIndirectEvalAndUsedByExports({\n module,\n moduleGraph,\n runtime: wp.util.runtime.getEntryRuntime(compilation, entryName),\n usingIndirectEval: buildInfo.usingIndirectEval,\n wp,\n })\n ) {\n const id = module.identifier()\n if (/node_modules[\\\\/]regenerator-runtime[\\\\/]runtime\\.js/.test(id)) {\n continue\n }\n if (route?.middlewareConfig?.unstable_allowDynamic) {\n telemetry?.record({\n eventName: 'NEXT_EDGE_ALLOW_DYNAMIC_USED',\n payload: {\n file: route?.absolutePagePath.replace(rootDir ?? '', ''),\n config: route?.middlewareConfig,\n fileWithDynamicCode: module.userRequest.replace(\n rootDir ?? '',\n ''\n ),\n },\n })\n }\n if (\n !isDynamicCodeEvaluationAllowed(\n module.userRequest,\n route?.middlewareConfig,\n rootDir\n )\n ) {\n const message = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime ${\n typeof buildInfo.usingIndirectEval !== 'boolean'\n ? `\\nUsed by ${Array.from(buildInfo.usingIndirectEval).join(\n ', '\n )}`\n : ''\n }\\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`\n compilation.errors.push(\n getDynamicCodeEvaluationError(\n message,\n module,\n compilation,\n compiler\n )\n )\n }\n }\n\n /**\n * The entry module has to be either a page or a middleware and hold\n * the corresponding metadata.\n */\n if (buildInfo?.nextEdgeSSR) {\n entryMetadata.edgeSSR = buildInfo.nextEdgeSSR\n } else if (buildInfo?.nextEdgeMiddleware) {\n entryMetadata.edgeMiddleware = buildInfo.nextEdgeMiddleware\n } else if (buildInfo?.nextEdgeApiFunction) {\n entryMetadata.edgeApiFunction = buildInfo.nextEdgeApiFunction\n }\n\n /**\n * If the module is a WASM module we read the binding information and\n * append it to the entry wasm bindings.\n */\n if (buildInfo?.nextWasmMiddlewareBinding) {\n entryMetadata.wasmBindings.set(\n buildInfo.nextWasmMiddlewareBinding.name,\n buildInfo.nextWasmMiddlewareBinding.filePath\n )\n }\n\n if (buildInfo?.nextAssetMiddlewareBinding) {\n entryMetadata.assetBindings.set(\n buildInfo.nextAssetMiddlewareBinding.name,\n buildInfo.nextAssetMiddlewareBinding.filePath\n )\n }\n\n /**\n * Append to the list of modules to process outgoingConnections from\n * the module that is being processed.\n */\n for (const conn of getModuleReferencesInOrder(module, moduleGraph)) {\n if (conn.module) {\n modules.add(conn.module as webpack.NormalModule)\n }\n }\n }\n\n telemetry?.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'vercelImageGeneration',\n invocationCount: ogImageGenerationCount,\n },\n })\n metadataByEntry.set(entryName, entryMetadata)\n }\n }\n}\n\n// These values will be replaced again in edge runtime deployment build.\n// `buildId` represents BUILD_ID to be externalized in env vars.\n// `encryptionKey` represents server action encryption key to be externalized in env vars.\ntype EdgeRuntimeEnvironments = Record<string, string> & {\n __NEXT_BUILD_ID: string\n NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: string\n}\n\ninterface Options {\n dev: boolean\n sriEnabled: boolean\n rewrites: CustomRoutes['rewrites']\n edgeEnvironments: EdgeRuntimeEnvironments\n}\n\nexport default class MiddlewarePlugin {\n private readonly dev: Options['dev']\n private readonly sriEnabled: Options['sriEnabled']\n private readonly rewrites: Options['rewrites']\n private readonly edgeEnvironments: EdgeRuntimeEnvironments\n\n constructor({ dev, sriEnabled, rewrites, edgeEnvironments }: Options) {\n this.dev = dev\n this.sriEnabled = sriEnabled\n this.rewrites = rewrites\n this.edgeEnvironments = edgeEnvironments\n }\n\n public apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(NAME, (compilation, params) => {\n // parser hooks aren't available in rspack\n if (process.env.NEXT_RSPACK) {\n compilation.hooks.finishModules.tapPromise(NAME, async (modules) => {\n await codeAnalyzerBySwc(compilation, modules, this.dev)\n })\n } else {\n const { hooks } = params.normalModuleFactory\n /**\n * This is the static code analysis phase.\n */\n const codeAnalyzer = getCodeAnalyzer({\n dev: this.dev,\n compiler,\n compilation,\n })\n\n hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)\n }\n\n /**\n * Extract all metadata for the entry points in a Map object.\n */\n const metadataByEntry = new Map<string, EntryMetadata>()\n compilation.hooks.finishModules.tapPromise(\n NAME,\n getExtractMetadata({\n compilation,\n compiler,\n dev: this.dev,\n metadataByEntry,\n })\n )\n\n /**\n * Emit the middleware manifest.\n */\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsMiddlewareManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n getCreateAssets({\n compilation,\n metadataByEntry,\n opts: {\n sriEnabled: this.sriEnabled,\n rewrites: this.rewrites,\n edgeEnvironments: this.edgeEnvironments,\n dev: this.dev,\n },\n })\n )\n })\n }\n}\n\nexport const SUPPORTED_NATIVE_MODULES = [\n 'buffer',\n 'events',\n 'assert',\n 'util',\n 'async_hooks',\n] as const\n\nconst supportedEdgePolyfills = new Set<string>(SUPPORTED_NATIVE_MODULES)\n\nexport function getEdgePolyfilledModules() {\n const records: Record<string, string> = {}\n for (const mod of SUPPORTED_NATIVE_MODULES) {\n records[mod] = `commonjs node:${mod}`\n records[`node:${mod}`] = `commonjs node:${mod}`\n }\n return records\n}\n\nexport async function handleWebpackExternalForEdgeRuntime({\n request,\n context,\n contextInfo,\n getResolve,\n}: {\n request: string\n context: string\n contextInfo: any\n getResolve: () => any\n}) {\n if (\n (contextInfo.issuerLayer === WEBPACK_LAYERS.middleware ||\n contextInfo.issuerLayer === WEBPACK_LAYERS.apiEdge) &&\n (isNodeJsModule(request) || isBunModule(request)) &&\n !supportedEdgePolyfills.has(request)\n ) {\n // allows user to provide and use their polyfills, as we do with buffer.\n try {\n await getResolve()(context, request)\n } catch {\n return `root globalThis.__import_unsupported('${request}')`\n }\n }\n}\n"],"names":["getNamedMiddlewareRegex","getModuleBuildInfo","getSortedRoutes","webpack","sources","picomatch","path","EDGE_RUNTIME_WEBPACK","EDGE_UNSUPPORTED_NODE_APIS","MIDDLEWARE_BUILD_MANIFEST","CLIENT_REFERENCE_MANIFEST","MIDDLEWARE_MANIFEST","MIDDLEWARE_REACT_LOADABLE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","NEXT_FONT_MANIFEST","SERVER_REFERENCE_MANIFEST","INTERCEPTION_ROUTE_REWRITE_MANIFEST","DYNAMIC_CSS_MANIFEST","SERVER_FILES_MANIFEST","traceGlobals","EVENT_BUILD_FEATURE_USAGE","normalizeAppPath","INSTRUMENTATION_HOOK_FILENAME","WEBPACK_LAYERS","isInterceptionRouteRewrite","getDynamicCodeEvaluationError","getModuleReferencesInOrder","KNOWN_SAFE_DYNAMIC_PACKAGES","require","NAME","MANIFEST_VERSION","isUsingIndirectEvalAndUsedByExports","args","moduleGraph","runtime","module","usingIndirectEval","wp","exportsInfo","getExportsInfo","exportName","getUsed","UsageState","Unused","getEntryFiles","entryFiles","meta","hasInstrumentationHook","opts","files","edgeSSR","isServerComponent","push","sriEnabled","filter","file","startsWith","endsWith","map","replace","dev","isAppDir","getCreateAssets","params","compilation","metadataByEntry","middlewareManifest","version","middleware","functions","sortedMiddleware","entrypoints","has","interceptionRewrites","JSON","stringify","rewrites","beforeFiles","emitAsset","RawSource","entrypoint","values","metadata","name","get","page","edgeMiddleware","edgeApiFunction","matcherSource","catchAll","namedRegex","matchers","regexp","originalSource","isEdgeFunction","edgeFunctionDefinition","getFiles","wasm","Array","from","wasmBindings","filePath","assets","assetBindings","env","edgeEnvironments","regions","Object","keys","buildWebpackError","message","loc","entryModule","parser","error","compiler","WebpackError","state","current","isInMiddlewareLayer","layer","apiEdge","isNodeJsModule","moduleName","builtinModules","includes","isBunModule","isDynamicCodeEvaluationAllowed","fileName","middlewareConfig","rootDir","some","pkg","sep","unstable_allowDynamic","dot","buildUnsupportedApiError","apiName","rest","start","line","registerUnsupportedApiHooks","expression","warnForUnsupportedApi","node","warnings","hooks","call","for","tap","callMemberChain","expressionMemberChain","warnForUnsupportedProcessApi","callee","getCodeAnalyzer","handleExpression","optimize","InnerGraph","onUsage","used","buildInfo","Set","handleWrapExpression","expr","ConstDependency","dependencies","dep1","range","addPresentationalDependency","dep2","handleWrapWasmCompileExpression","handleWrapWasmInstantiateExpression","handleImport","source","value","importLocByPath","Map","importedModule","toString","set","sourcePosition","identifier","sourceContent","SUPPORTED_NATIVE_MODULES","isBun","skip","undefined","prefix","new","importCall","import","codeAnalyzerBySwc","modules","binding","constructor","normalModule","type","diagnostics","warnForEdgeRuntime","diagnostic","webpackError","severity","errors","getExtractMetadata","clear","telemetry","entryName","entry","entries","route","options","entryDependency","resolvedModule","getResolvedModule","addEntriesFromDependency","dependency","getModule","add","forEach","includeDependencies","entryMetadata","preferredRegion","ogImageGenerationCount","resource","hasOGImageGeneration","test","util","getEntryRuntime","id","record","eventName","payload","absolutePagePath","config","fileWithDynamicCode","userRequest","join","nextEdgeSSR","nextEdgeMiddleware","nextEdgeApiFunction","nextWasmMiddlewareBinding","nextAssetMiddlewareBinding","conn","featureName","invocationCount","MiddlewarePlugin","apply","process","NEXT_RSPACK","finishModules","tapPromise","normalModuleFactory","codeAnalyzer","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS","supportedEdgePolyfills","getEdgePolyfilledModules","records","mod","handleWebpackExternalForEdgeRuntime","request","context","contextInfo","getResolve","issuerLayer"],"mappings":"AAMA,SAASA,uBAAuB,QAAQ,+CAA8C;AACtF,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,OAAO,EAAEC,OAAO,QAAQ,qCAAoC;AACrE,OAAOC,eAAe,+BAA8B;AACpD,OAAOC,UAAU,OAAM;AACvB,SACEC,oBAAoB,EACpBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,yBAAyB,EACzBC,mBAAmB,EACnBC,kCAAkC,EAClCC,8BAA8B,EAC9BC,kBAAkB,EAClBC,yBAAyB,EACzBC,mCAAmC,EACnCC,oBAAoB,EACpBC,qBAAqB,QAChB,gCAA+B;AAGtC,SAASC,YAAY,QAAQ,wBAAuB;AACpD,SAASC,yBAAyB,QAAQ,4BAA2B;AACrE,SAASC,gBAAgB,QAAQ,6CAA4C;AAC7E,SACEC,6BAA6B,EAC7BC,cAAc,QACT,yBAAwB;AAE/B,SAASC,0BAA0B,QAAQ,qDAAoD;AAC/F,SAASC,6BAA6B,QAAQ,gEAA+D;AAC7G,SAASC,0BAA0B,QAAQ,WAAU;AAErD,MAAMC,8BACJC,QAAQ;AA6BV,MAAMC,OAAO;AACb,MAAMC,mBAAmB;AAEzB;;;;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AAU,EAMX;IACC,IACE,AAACD,CAAAA,YAAYE,WAAW,KAAKnP,eAAe6C,UAAU,IACpDoM,YAAYE,WAAW,KAAKnP,eAAekG,OAAO,AAAD,KAClDC,CAAAA,eAAe4I,YAAYxI,YAAYwI,QAAO,KAC/C,CAACL,uBAAuBzL,GAAG,CAAC8L,UAC5B;QACA,wEAAwE;QACxE,IAAI;YACF,MAAMG,aAAaF,SAASD;QAC9B,EAAE,OAAM;YACN,OAAO,CAAC,sCAAsC,EAAEA,QAAQ,EAAE,CAAC;QAC7D;IACF;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../../../src/build/webpack/plugins/middleware-plugin.ts"],"sourcesContent":["import type {\n AssetBinding,\n EdgeMiddlewareMeta,\n} from '../loaders/get-module-build-info'\nimport type { EdgeSSRMeta } from '../loaders/get-module-build-info'\nimport type { ProxyMatcher } from '../../analysis/get-page-static-info'\nimport { getNamedMiddlewareRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport picomatch from 'next/dist/compiled/picomatch'\nimport path from 'path'\nimport {\n EDGE_RUNTIME_WEBPACK,\n EDGE_UNSUPPORTED_NODE_APIS,\n MIDDLEWARE_BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n MIDDLEWARE_MANIFEST,\n MIDDLEWARE_REACT_LOADABLE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n NEXT_FONT_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n SERVER_FILES_MANIFEST,\n} from '../../../shared/lib/constants'\nimport type { ProxyConfig } from '../../analysis/get-page-static-info'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport { traceGlobals } from '../../../trace/shared'\nimport { EVENT_BUILD_FEATURE_USAGE } from '../../../telemetry/events'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport {\n INSTRUMENTATION_HOOK_FILENAME,\n WEBPACK_LAYERS,\n} from '../../../lib/constants'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { isInterceptionRouteRewrite } from '../../../lib/is-interception-route-rewrite'\nimport { getDynamicCodeEvaluationError } from './wellknown-errors-plugin/parse-dynamic-code-evaluation-error'\nimport { getModuleReferencesInOrder } from '../utils'\n\nconst KNOWN_SAFE_DYNAMIC_PACKAGES =\n require('../../../lib/known-edge-safe-packages.json') as string[]\n\nexport interface EdgeFunctionDefinition {\n files: string[]\n name: string\n page: string\n matchers: ProxyMatcher[]\n env: Record<string, string>\n wasm?: AssetBinding[]\n assets?: AssetBinding[]\n regions?: string[] | string\n}\n\nexport interface MiddlewareManifest {\n version: 3\n sortedMiddleware: string[]\n middleware: { [page: string]: EdgeFunctionDefinition }\n functions: { [page: string]: EdgeFunctionDefinition }\n}\n\ninterface EntryMetadata {\n edgeMiddleware?: EdgeMiddlewareMeta\n edgeApiFunction?: EdgeMiddlewareMeta\n edgeSSR?: EdgeSSRMeta\n wasmBindings: Map<string, string>\n assetBindings: Map<string, string>\n regions?: string[] | string\n}\n\nconst NAME = 'MiddlewarePlugin'\nconst MANIFEST_VERSION = 3\n\n/**\n * Checks the value of usingIndirectEval and when it is a set of modules it\n * check if any of the modules is actually being used. If the value is\n * simply truthy it will return true.\n */\nfunction isUsingIndirectEvalAndUsedByExports(args: {\n module: webpack.Module\n moduleGraph: webpack.ModuleGraph\n runtime: any\n usingIndirectEval: true | Set<string>\n wp: typeof webpack\n}): boolean {\n const { moduleGraph, runtime, module, usingIndirectEval, wp } = args\n if (typeof usingIndirectEval === 'boolean') {\n return usingIndirectEval\n }\n\n const exportsInfo = moduleGraph.getExportsInfo(module)\n for (const exportName of usingIndirectEval) {\n if (exportsInfo.getUsed(exportName, runtime) !== wp.UsageState.Unused) {\n return true\n }\n }\n\n return false\n}\n\nfunction getEntryFiles(\n entryFiles: string[],\n meta: EntryMetadata,\n hasInstrumentationHook: boolean,\n opts: Options\n) {\n const files: string[] = []\n if (meta.edgeSSR) {\n if (meta.edgeSSR.isServerComponent) {\n files.push(`server/${SERVER_REFERENCE_MANIFEST}.js`)\n if (opts.sriEnabled) {\n files.push(`server/${SUBRESOURCE_INTEGRITY_MANIFEST}.js`)\n }\n files.push(\n ...entryFiles\n .filter(\n (file) =>\n file.startsWith('app/') && !file.endsWith('.hot-update.js')\n )\n .map(\n (file) =>\n 'server/' +\n file.replace(/\\.js$/, '_' + CLIENT_REFERENCE_MANIFEST + '.js')\n )\n )\n }\n if (!opts.dev && !meta.edgeSSR.isAppDir) {\n files.push(`server/${DYNAMIC_CSS_MANIFEST}.js`)\n }\n\n files.push(\n `server/${MIDDLEWARE_BUILD_MANIFEST}.js`,\n `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,\n `server/${NEXT_FONT_MANIFEST}.js`,\n `server/${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n\n if (!opts.dev) {\n files.push(`${SERVER_FILES_MANIFEST}.js`)\n }\n }\n\n if (hasInstrumentationHook) {\n files.push(`server/edge-${INSTRUMENTATION_HOOK_FILENAME}.js`)\n }\n\n files.push(\n ...entryFiles\n .filter((file) => !file.endsWith('.hot-update.js'))\n .map((file) => 'server/' + file)\n )\n\n return files\n}\n\nfunction getCreateAssets(params: {\n compilation: webpack.Compilation\n metadataByEntry: Map<string, EntryMetadata>\n opts: Options\n}) {\n const { compilation, metadataByEntry, opts } = params\n return () => {\n const middlewareManifest: MiddlewareManifest = {\n version: MANIFEST_VERSION,\n middleware: {},\n functions: {},\n sortedMiddleware: [],\n }\n\n const hasInstrumentationHook = compilation.entrypoints.has(\n INSTRUMENTATION_HOOK_FILENAME\n )\n\n // we only emit this entry for the edge runtime since it doesn't have access to a routes manifest\n // and we don't need to provide the entire route manifest, just the interception routes.\n const interceptionRewrites = JSON.stringify(\n opts.rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n compilation.emitAsset(\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )}`\n ) as unknown as webpack.sources.RawSource\n )\n\n for (const entrypoint of compilation.entrypoints.values()) {\n if (!entrypoint.name) {\n continue\n }\n\n // There should always be metadata for the entrypoint.\n const metadata = metadataByEntry.get(entrypoint.name)\n const page =\n metadata?.edgeMiddleware?.page ||\n metadata?.edgeSSR?.page ||\n metadata?.edgeApiFunction?.page\n if (!page) {\n continue\n }\n\n const matcherSource = metadata.edgeSSR?.isAppDir\n ? normalizeAppPath(page)\n : page\n\n const catchAll = !metadata.edgeSSR && !metadata.edgeApiFunction\n\n const { namedRegex } = getNamedMiddlewareRegex(matcherSource, {\n catchAll,\n })\n const matchers = metadata?.edgeMiddleware?.matchers ?? [\n {\n regexp: namedRegex,\n originalSource: page === '/' && catchAll ? '/:path*' : matcherSource,\n },\n ]\n\n const isEdgeFunction = !!(metadata.edgeApiFunction || metadata.edgeSSR)\n const edgeFunctionDefinition: EdgeFunctionDefinition = {\n files: getEntryFiles(\n entrypoint.getFiles(),\n metadata,\n hasInstrumentationHook,\n opts\n ),\n name: entrypoint.name,\n page: page,\n matchers,\n wasm: Array.from(metadata.wasmBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n assets: Array.from(metadata.assetBindings, ([name, filePath]) => ({\n name,\n filePath,\n })),\n env: opts.edgeEnvironments,\n ...(metadata.regions && { regions: metadata.regions }),\n }\n\n if (isEdgeFunction) {\n middlewareManifest.functions[page] = edgeFunctionDefinition\n } else {\n middlewareManifest.middleware[page] = edgeFunctionDefinition\n }\n }\n\n middlewareManifest.sortedMiddleware = getSortedRoutes(\n Object.keys(middlewareManifest.middleware)\n )\n\n compilation.emitAsset(\n MIDDLEWARE_MANIFEST,\n new sources.RawSource(\n JSON.stringify(middlewareManifest, null, 2)\n ) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction buildWebpackError({\n message,\n loc,\n compilation,\n entryModule,\n parser,\n}: {\n message: string\n loc?: any\n compilation: webpack.Compilation\n entryModule?: webpack.Module\n parser?: webpack.javascript.JavascriptParser\n}) {\n const error = new compilation.compiler.webpack.WebpackError(message)\n error.name = NAME\n const module = entryModule ?? parser?.state.current\n if (module) {\n error.module = module\n }\n error.loc = loc\n return error\n}\n\nfunction isInMiddlewareLayer(parser: webpack.javascript.JavascriptParser) {\n const layer = parser.state.module?.layer\n return layer === WEBPACK_LAYERS.middleware || layer === WEBPACK_LAYERS.apiEdge\n}\n\nfunction isNodeJsModule(moduleName: string) {\n return (require('module') as typeof import('module')).builtinModules.includes(\n moduleName\n )\n}\n\nfunction isBunModule(moduleName: string) {\n return moduleName === 'bun' || moduleName.startsWith('bun:')\n}\n\nfunction isDynamicCodeEvaluationAllowed(\n fileName: string,\n middlewareConfig?: ProxyConfig,\n rootDir?: string\n) {\n // Some packages are known to use `eval` but are safe to use in the Edge\n // Runtime because the dynamic code will never be executed.\n if (\n KNOWN_SAFE_DYNAMIC_PACKAGES.some((pkg) =>\n fileName.includes(`/node_modules/${pkg}/`.replace(/\\//g, path.sep))\n )\n ) {\n return true\n }\n\n const name = fileName.replace(rootDir ?? '', '')\n\n return picomatch(middlewareConfig?.unstable_allowDynamic ?? [], {\n dot: true,\n })(name)\n}\n\nfunction buildUnsupportedApiError({\n apiName,\n loc,\n ...rest\n}: {\n apiName: string\n loc: any\n compilation: webpack.Compilation\n parser: webpack.javascript.JavascriptParser\n}) {\n return buildWebpackError({\n message: `A Node.js API is used (${apiName} at line: ${loc.start.line}) which is not supported in the Edge Runtime.\nLearn more: https://nextjs.org/docs/api-reference/edge-runtime`,\n loc,\n ...rest,\n })\n}\n\nfunction registerUnsupportedApiHooks(\n parser: webpack.javascript.JavascriptParser,\n compilation: webpack.Compilation\n) {\n for (const expression of EDGE_UNSUPPORTED_NODE_APIS) {\n const warnForUnsupportedApi = (node: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: expression,\n ...node,\n })\n )\n return true\n }\n parser.hooks.call.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.expression.for(expression).tap(NAME, warnForUnsupportedApi)\n parser.hooks.callMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n parser.hooks.expressionMemberChain\n .for(expression)\n .tap(NAME, warnForUnsupportedApi)\n }\n\n const warnForUnsupportedProcessApi = (node: any, [callee]: string[]) => {\n if (!isInMiddlewareLayer(parser) || callee === 'env') {\n return\n }\n compilation.warnings.push(\n buildUnsupportedApiError({\n compilation,\n parser,\n apiName: `process.${callee}`,\n ...node,\n })\n )\n return true\n }\n\n parser.hooks.callMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n parser.hooks.expressionMemberChain\n .for('process')\n .tap(NAME, warnForUnsupportedProcessApi)\n}\n\nfunction getCodeAnalyzer(params: {\n dev: boolean\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n}) {\n return (parser: webpack.javascript.JavascriptParser) => {\n const {\n dev,\n compiler: { webpack: wp },\n compilation,\n } = params\n const { hooks } = parser\n\n /**\n * For an expression this will check the graph to ensure it is being used\n * by exports. Then it will store in the module buildInfo a boolean to\n * express that it contains dynamic code and, if it is available, the\n * module path that is using it.\n */\n const handleExpression = () => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n wp.optimize.InnerGraph.onUsage(parser.state, (used = true) => {\n const buildInfo = getModuleBuildInfo(parser.state.module)\n if (buildInfo.usingIndirectEval === true || used === false) {\n return\n }\n\n if (!buildInfo.usingIndirectEval || used === true) {\n buildInfo.usingIndirectEval = used\n return\n }\n\n buildInfo.usingIndirectEval = new Set([\n ...Array.from(buildInfo.usingIndirectEval),\n ...Array.from(used),\n ])\n })\n }\n\n /**\n * This expression handler allows to wrap a dynamic code expression with a\n * function call where we can warn about dynamic code not being allowed\n * but actually execute the expression.\n */\n const handleWrapExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_eval__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n return true\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.compile invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n */\n const handleWrapWasmCompileExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_compile__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n\n handleExpression()\n }\n\n /**\n * This expression handler allows to wrap a WebAssembly.instatiate invocation with a\n * function call where we can warn about WASM code generation not being allowed\n * but actually execute the expression.\n *\n * Note that we don't update `usingIndirectEval`, i.e. we don't abort a production build\n * since we can't determine statically if the first parameter is a module (legit use) or\n * a buffer (dynamic code generation).\n */\n const handleWrapWasmInstantiateExpression = (expr: any) => {\n if (!isInMiddlewareLayer(parser)) {\n return\n }\n\n if (dev) {\n const { ConstDependency } = wp.dependencies\n const dep1 = new ConstDependency(\n '__next_webassembly_instantiate__(function() { return ',\n expr.range[0]\n )\n dep1.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep1)\n const dep2 = new ConstDependency('})', expr.range[1])\n dep2.loc = expr.loc\n parser.state.module.addPresentationalDependency(dep2)\n }\n }\n\n /**\n * Handler to store original source location of static and dynamic imports into module's buildInfo.\n */\n const handleImport = (node: any) => {\n if (isInMiddlewareLayer(parser) && node.source?.value && node?.loc) {\n const { module, source } = parser.state\n const buildInfo = getModuleBuildInfo(module)\n if (!buildInfo.importLocByPath) {\n buildInfo.importLocByPath = new Map()\n }\n\n const importedModule = node.source.value?.toString()\n buildInfo.importLocByPath.set(importedModule, {\n sourcePosition: {\n ...node.loc.start,\n source: module.identifier(),\n },\n sourceContent: source.toString(),\n })\n\n if (\n !dev &&\n (isNodeJsModule(importedModule) || isBunModule(importedModule)) &&\n !SUPPORTED_NATIVE_MODULES.includes(importedModule)\n ) {\n const isBun = isBunModule(importedModule)\n compilation.warnings.push(\n buildWebpackError({\n message: `A ${isBun ? 'Bun' : 'Node.js'} module is loaded ('${importedModule}' at line ${node.loc.start.line}) which is not supported in the Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`,\n compilation,\n parser,\n ...node,\n })\n )\n }\n }\n }\n\n /**\n * A noop handler to skip analyzing some cases.\n * Order matters: for it to work, it must be registered first\n */\n const skip = () => (isInMiddlewareLayer(parser) ? true : undefined)\n\n for (const prefix of ['', 'global.']) {\n hooks.expression.for(`${prefix}Function.prototype`).tap(NAME, skip)\n hooks.expression.for(`${prefix}Function.bind`).tap(NAME, skip)\n hooks.call.for(`${prefix}eval`).tap(NAME, handleWrapExpression)\n hooks.call.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.new.for(`${prefix}Function`).tap(NAME, handleWrapExpression)\n hooks.call\n .for(`${prefix}WebAssembly.compile`)\n .tap(NAME, handleWrapWasmCompileExpression)\n hooks.call\n .for(`${prefix}WebAssembly.instantiate`)\n .tap(NAME, handleWrapWasmInstantiateExpression)\n }\n\n hooks.importCall.tap(NAME, handleImport)\n hooks.import.tap(NAME, handleImport)\n\n if (!dev) {\n // do not issue compilation warning on dev: invoking code will provide details\n registerUnsupportedApiHooks(parser, compilation)\n }\n }\n}\n\nasync function codeAnalyzerBySwc(\n compilation: webpack.Compilation,\n modules: Iterable<webpack.Module>,\n dev: boolean\n) {\n const binding = require('../../swc') as typeof import('../../swc')\n for (const module of modules) {\n if (\n module.layer !== WEBPACK_LAYERS.middleware &&\n module.layer !== WEBPACK_LAYERS.apiEdge\n ) {\n continue\n }\n if (module.constructor.name !== 'NormalModule') {\n continue\n }\n const normalModule = module as webpack.NormalModule\n if (!normalModule.type.startsWith('javascript')) {\n // Only analyze JavaScript modules\n continue\n }\n const originalSource = normalModule.originalSource()\n if (!originalSource) {\n continue\n }\n const source = originalSource.source()\n if (typeof source !== 'string') {\n continue\n }\n const diagnostics = await binding.warnForEdgeRuntime(source, !dev)\n for (const diagnostic of diagnostics) {\n const webpackError = buildWebpackError({\n message: diagnostic.message,\n loc: diagnostic.loc,\n compilation,\n entryModule: module,\n })\n if (diagnostic.severity === 'Warning') {\n compilation.warnings.push(webpackError)\n } else {\n compilation.errors.push(webpackError)\n }\n }\n }\n}\n\nfunction getExtractMetadata(params: {\n compilation: webpack.Compilation\n compiler: webpack.Compiler\n dev: boolean\n metadataByEntry: Map<string, EntryMetadata>\n}): () => Promise<void> {\n const { dev, compilation, metadataByEntry, compiler } = params\n const { webpack: wp } = compiler\n return async () => {\n metadataByEntry.clear()\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n\n for (const [entryName, entry] of compilation.entries) {\n if (entry.options.runtime !== EDGE_RUNTIME_WEBPACK) {\n // Only process edge runtime entries\n continue\n }\n const entryDependency = entry.dependencies?.[0]\n const resolvedModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)\n if (!resolvedModule) {\n continue\n }\n const { rootDir, route } = getModuleBuildInfo(resolvedModule)\n\n const { moduleGraph } = compilation\n const modules = new Set<webpack.NormalModule>()\n const addEntriesFromDependency = (dependency: any) => {\n const module = moduleGraph.getModule(dependency)\n if (module) {\n modules.add(module as webpack.NormalModule)\n }\n }\n\n entry.dependencies.forEach(addEntriesFromDependency)\n entry.includeDependencies.forEach(addEntriesFromDependency)\n\n const entryMetadata: EntryMetadata = {\n wasmBindings: new Map(),\n assetBindings: new Map(),\n }\n\n if (route?.middlewareConfig?.regions) {\n entryMetadata.regions = route.middlewareConfig.regions\n }\n\n if (route?.preferredRegion) {\n const preferredRegion = route.preferredRegion\n entryMetadata.regions =\n // Ensures preferredRegion is always an array in the manifest.\n typeof preferredRegion === 'string'\n ? [preferredRegion]\n : preferredRegion\n }\n\n let ogImageGenerationCount = 0\n\n for (const module of modules) {\n const buildInfo = getModuleBuildInfo(module)\n\n /**\n * Check if it uses the image generation feature.\n */\n if (!dev) {\n const resource = module.resource\n const hasOGImageGeneration =\n resource &&\n /[\\\\/]node_modules[\\\\/]@vercel[\\\\/]og[\\\\/]dist[\\\\/]index\\.(edge|node)\\.js$|[\\\\/]next[\\\\/]dist[\\\\/](esm[\\\\/])?server[\\\\/]og[\\\\/]image-response\\.js$/.test(\n resource\n )\n\n if (hasOGImageGeneration) {\n ogImageGenerationCount++\n }\n }\n\n /**\n * When building for production checks if the module is using `eval`\n * and in such case produces a compilation error. The module has to\n * be in use.\n */\n if (\n !dev &&\n buildInfo.usingIndirectEval &&\n isUsingIndirectEvalAndUsedByExports({\n module,\n moduleGraph,\n runtime: wp.util.runtime.getEntryRuntime(compilation, entryName),\n usingIndirectEval: buildInfo.usingIndirectEval,\n wp,\n })\n ) {\n const id = module.identifier()\n if (/node_modules[\\\\/]regenerator-runtime[\\\\/]runtime\\.js/.test(id)) {\n continue\n }\n if (route?.middlewareConfig?.unstable_allowDynamic) {\n telemetry?.record({\n eventName: 'NEXT_EDGE_ALLOW_DYNAMIC_USED',\n payload: {\n file: route?.absolutePagePath.replace(rootDir ?? '', ''),\n config: route?.middlewareConfig,\n fileWithDynamicCode: module.userRequest.replace(\n rootDir ?? '',\n ''\n ),\n },\n })\n }\n if (\n !isDynamicCodeEvaluationAllowed(\n module.userRequest,\n route?.middlewareConfig,\n rootDir\n )\n ) {\n const message = `Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime ${\n typeof buildInfo.usingIndirectEval !== 'boolean'\n ? `\\nUsed by ${Array.from(buildInfo.usingIndirectEval).join(\n ', '\n )}`\n : ''\n }\\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`\n compilation.errors.push(\n getDynamicCodeEvaluationError(\n message,\n module,\n compilation,\n compiler\n )\n )\n }\n }\n\n /**\n * The entry module has to be either a page or a middleware and hold\n * the corresponding metadata.\n */\n if (buildInfo?.nextEdgeSSR) {\n entryMetadata.edgeSSR = buildInfo.nextEdgeSSR\n } else if (buildInfo?.nextEdgeMiddleware) {\n entryMetadata.edgeMiddleware = buildInfo.nextEdgeMiddleware\n } else if (buildInfo?.nextEdgeApiFunction) {\n entryMetadata.edgeApiFunction = buildInfo.nextEdgeApiFunction\n }\n\n /**\n * If the module is a WASM module we read the binding information and\n * append it to the entry wasm bindings.\n */\n if (buildInfo?.nextWasmMiddlewareBinding) {\n entryMetadata.wasmBindings.set(\n buildInfo.nextWasmMiddlewareBinding.name,\n buildInfo.nextWasmMiddlewareBinding.filePath\n )\n }\n\n if (buildInfo?.nextAssetMiddlewareBinding) {\n entryMetadata.assetBindings.set(\n buildInfo.nextAssetMiddlewareBinding.name,\n buildInfo.nextAssetMiddlewareBinding.filePath\n )\n }\n\n /**\n * Append to the list of modules to process outgoingConnections from\n * the module that is being processed.\n */\n for (const conn of getModuleReferencesInOrder(module, moduleGraph)) {\n if (conn.module) {\n modules.add(conn.module as webpack.NormalModule)\n }\n }\n }\n\n telemetry?.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'vercelImageGeneration',\n invocationCount: ogImageGenerationCount,\n },\n })\n metadataByEntry.set(entryName, entryMetadata)\n }\n }\n}\n\n// These values will be replaced again in edge runtime deployment build.\n// `buildId` represents BUILD_ID to be externalized in env vars.\n// `encryptionKey` represents server action encryption key to be externalized in env vars.\ntype EdgeRuntimeEnvironments = Record<string, string> & {\n __NEXT_BUILD_ID: string\n NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: string\n}\n\ninterface Options {\n dev: boolean\n sriEnabled: boolean\n rewrites: CustomRoutes['rewrites']\n edgeEnvironments: EdgeRuntimeEnvironments\n}\n\nexport default class MiddlewarePlugin {\n private readonly dev: Options['dev']\n private readonly sriEnabled: Options['sriEnabled']\n private readonly rewrites: Options['rewrites']\n private readonly edgeEnvironments: EdgeRuntimeEnvironments\n\n constructor({ dev, sriEnabled, rewrites, edgeEnvironments }: Options) {\n this.dev = dev\n this.sriEnabled = sriEnabled\n this.rewrites = rewrites\n this.edgeEnvironments = edgeEnvironments\n }\n\n public apply(compiler: webpack.Compiler) {\n compiler.hooks.compilation.tap(NAME, (compilation, params) => {\n // parser hooks aren't available in rspack\n if (process.env.NEXT_RSPACK) {\n compilation.hooks.finishModules.tapPromise(NAME, async (modules) => {\n await codeAnalyzerBySwc(compilation, modules, this.dev)\n })\n } else {\n const { hooks } = params.normalModuleFactory\n /**\n * This is the static code analysis phase.\n */\n const codeAnalyzer = getCodeAnalyzer({\n dev: this.dev,\n compiler,\n compilation,\n })\n\n hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)\n hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)\n }\n\n /**\n * Extract all metadata for the entry points in a Map object.\n */\n const metadataByEntry = new Map<string, EntryMetadata>()\n compilation.hooks.finishModules.tapPromise(\n NAME,\n getExtractMetadata({\n compilation,\n compiler,\n dev: this.dev,\n metadataByEntry,\n })\n )\n\n /**\n * Emit the middleware manifest.\n */\n compilation.hooks.processAssets.tap(\n {\n name: 'NextJsMiddlewareManifest',\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n getCreateAssets({\n compilation,\n metadataByEntry,\n opts: {\n sriEnabled: this.sriEnabled,\n rewrites: this.rewrites,\n edgeEnvironments: this.edgeEnvironments,\n dev: this.dev,\n },\n })\n )\n })\n }\n}\n\nexport const SUPPORTED_NATIVE_MODULES = [\n 'buffer',\n 'events',\n 'assert',\n 'util',\n 'async_hooks',\n] as const\n\nconst supportedEdgePolyfills = new Set<string>(SUPPORTED_NATIVE_MODULES)\n\nexport function getEdgePolyfilledModules() {\n const records: Record<string, string> = {}\n for (const mod of SUPPORTED_NATIVE_MODULES) {\n records[mod] = `commonjs node:${mod}`\n records[`node:${mod}`] = `commonjs node:${mod}`\n }\n return records\n}\n\nexport async function handleWebpackExternalForEdgeRuntime({\n request,\n context,\n contextInfo,\n getResolve,\n}: {\n request: string\n context: string\n contextInfo: any\n getResolve: () => any\n}) {\n if (\n (contextInfo.issuerLayer === WEBPACK_LAYERS.middleware ||\n contextInfo.issuerLayer === WEBPACK_LAYERS.apiEdge) &&\n (isNodeJsModule(request) || isBunModule(request)) &&\n !supportedEdgePolyfills.has(request)\n ) {\n // allows user to provide and use their polyfills, as we do with buffer.\n try {\n await getResolve()(context, request)\n } catch {\n return `root globalThis.__import_unsupported('${request}')`\n }\n }\n}\n"],"names":["getNamedMiddlewareRegex","getModuleBuildInfo","getSortedRoutes","webpack","sources","picomatch","path","EDGE_RUNTIME_WEBPACK","EDGE_UNSUPPORTED_NODE_APIS","MIDDLEWARE_BUILD_MANIFEST","CLIENT_REFERENCE_MANIFEST","MIDDLEWARE_MANIFEST","MIDDLEWARE_REACT_LOADABLE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","NEXT_FONT_MANIFEST","SERVER_REFERENCE_MANIFEST","INTERCEPTION_ROUTE_REWRITE_MANIFEST","DYNAMIC_CSS_MANIFEST","SERVER_FILES_MANIFEST","traceGlobals","EVENT_BUILD_FEATURE_USAGE","normalizeAppPath","INSTRUMENTATION_HOOK_FILENAME","WEBPACK_LAYERS","isInterceptionRouteRewrite","getDynamicCodeEvaluationError","getModuleReferencesInOrder","KNOWN_SAFE_DYNAMIC_PACKAGES","require","NAME","MANIFEST_VERSION","isUsingIndirectEvalAndUsedByExports","args","moduleGraph","runtime","module","usingIndirectEval","wp","exportsInfo","getExportsInfo","exportName","getUsed","UsageState","Unused","getEntryFiles","entryFiles","meta","hasInstrumentationHook","opts","files","edgeSSR","isServerComponent","push","sriEnabled","filter","file","startsWith","endsWith","map","replace","dev","isAppDir","getCreateAssets","params","compilation","metadataByEntry","middlewareManifest","version","middleware","functions","sortedMiddleware","entrypoints","has","interceptionRewrites","JSON","stringify","rewrites","beforeFiles","emitAsset","RawSource","entrypoint","values","metadata","name","get","page","edgeMiddleware","edgeApiFunction","matcherSource","catchAll","namedRegex","matchers","regexp","originalSource","isEdgeFunction","edgeFunctionDefinition","getFiles","wasm","Array","from","wasmBindings","filePath","assets","assetBindings","env","edgeEnvironments","regions","Object","keys","buildWebpackError","message","loc","entryModule","parser","error","compiler","WebpackError","state","current","isInMiddlewareLayer","layer","apiEdge","isNodeJsModule","moduleName","builtinModules","includes","isBunModule","isDynamicCodeEvaluationAllowed","fileName","middlewareConfig","rootDir","some","pkg","sep","unstable_allowDynamic","dot","buildUnsupportedApiError","apiName","rest","start","line","registerUnsupportedApiHooks","expression","warnForUnsupportedApi","node","warnings","hooks","call","for","tap","callMemberChain","expressionMemberChain","warnForUnsupportedProcessApi","callee","getCodeAnalyzer","handleExpression","optimize","InnerGraph","onUsage","used","buildInfo","Set","handleWrapExpression","expr","ConstDependency","dependencies","dep1","range","addPresentationalDependency","dep2","handleWrapWasmCompileExpression","handleWrapWasmInstantiateExpression","handleImport","source","value","importLocByPath","Map","importedModule","toString","set","sourcePosition","identifier","sourceContent","SUPPORTED_NATIVE_MODULES","isBun","skip","undefined","prefix","new","importCall","import","codeAnalyzerBySwc","modules","binding","constructor","normalModule","type","diagnostics","warnForEdgeRuntime","diagnostic","webpackError","severity","errors","getExtractMetadata","clear","telemetry","entryName","entry","entries","route","options","entryDependency","resolvedModule","getResolvedModule","addEntriesFromDependency","dependency","getModule","add","forEach","includeDependencies","entryMetadata","preferredRegion","ogImageGenerationCount","resource","hasOGImageGeneration","test","util","getEntryRuntime","id","record","eventName","payload","absolutePagePath","config","fileWithDynamicCode","userRequest","join","nextEdgeSSR","nextEdgeMiddleware","nextEdgeApiFunction","nextWasmMiddlewareBinding","nextAssetMiddlewareBinding","conn","featureName","invocationCount","MiddlewarePlugin","apply","process","NEXT_RSPACK","finishModules","tapPromise","normalModuleFactory","codeAnalyzer","processAssets","stage","Compilation","PROCESS_ASSETS_STAGE_ADDITIONS","supportedEdgePolyfills","getEdgePolyfilledModules","records","mod","handleWebpackExternalForEdgeRuntime","request","context","contextInfo","getResolve","issuerLayer"],"mappings":"AAMA,SAASA,uBAAuB,QAAQ,+CAA8C;AACtF,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,OAAO,EAAEC,OAAO,QAAQ,qCAAoC;AACrE,OAAOC,eAAe,+BAA8B;AACpD,OAAOC,UAAU,OAAM;AACvB,SACEC,oBAAoB,EACpBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,yBAAyB,EACzBC,mBAAmB,EACnBC,kCAAkC,EAClCC,8BAA8B,EAC9BC,kBAAkB,EAClBC,yBAAyB,EACzBC,mCAAmC,EACnCC,oBAAoB,EACpBC,qBAAqB,QAChB,gCAA+B;AAGtC,SAASC,YAAY,QAAQ,wBAAuB;AACpD,SAASC,yBAAyB,QAAQ,4BAA2B;AACrE,SAASC,gBAAgB,QAAQ,6CAA4C;AAC7E,SACEC,6BAA6B,EAC7BC,cAAc,QACT,yBAAwB;AAE/B,SAASC,0BAA0B,QAAQ,6CAA4C;AACvF,SAASC,6BAA6B,QAAQ,gEAA+D;AAC7G,SAASC,0BAA0B,QAAQ,WAAU;AAErD,MAAMC,8BACJC,QAAQ;AA6BV,MAAMC,OAAO;AACb,MAAMC,mBAAmB;AAEzB;;;;CAIC,GACD,SAASC,oCAAoCC,IAM5C;IACC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,EAAE,EAAE,GAAGL;IAChE,IAAI,OAAOI,sB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I,YAAYwI,QAAO,KAC/C,CAACL,uBAAuBzL,GAAG,CAAC8L,UAC5B;QACA,wEAAwE;QACxE,IAAI;YACF,MAAMG,aAAaF,SAASD;QAC9B,EAAE,OAAM;YACN,OAAO,CAAC,sCAAsC,EAAEA,QAAQ,EAAE,CAAC;QAC7D;IACF;AACF","ignoreList":[0]}

@@ -8,3 +8,3 @@ /**

import { setAttributesFromProps } from './set-attributes-from-props';
const version = "16.2.0-canary.72";
const version = "16.2.0-canary.73";
window.next = {

@@ -11,0 +11,0 @@ version,

@@ -28,3 +28,3 @@ /* global location */ // imports polyfill from `@next/polyfill-module` after build.

import { isNextRouterError } from './components/is-next-router-error';
export const version = "16.2.0-canary.72";
export const version = "16.2.0-canary.73";
export let router;

@@ -31,0 +31,0 @@ export const emitter = mitt();

@@ -27,3 +27,3 @@ import { createStaticWorker } from '../build';

import { createProgress } from '../build/progress';
import { isInterceptionRouteRewrite } from '../lib/generate-interception-routes-rewrites';
import { isInterceptionRouteRewrite } from '../lib/is-interception-route-rewrite';
import { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info';

@@ -30,0 +30,0 @@ import { convertSegmentPathToStaticExportFilename } from '../shared/lib/segment-cache/segment-value-encoding';

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../src/export/index.ts"],"sourcesContent":["import type {\n ExportAppResult,\n ExportAppOptions,\n WorkerRenderOptsPartial,\n ExportPagesResult,\n ExportPathEntry,\n} from './types'\nimport {\n createStaticWorker,\n type PrerenderManifest,\n type StaticWorker,\n} from '../build'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\n\nimport { bold, yellow } from '../lib/picocolors'\nimport findUp from 'next/dist/compiled/find-up'\nimport { existsSync, promises as fs } from 'fs'\n\nimport '../server/require-hook'\n\nimport { dirname, join, resolve, sep, relative } from 'path'\nimport * as Log from '../build/output/log'\nimport {\n RSC_SEGMENT_SUFFIX,\n RSC_SEGMENTS_DIR_SUFFIX,\n RSC_SUFFIX,\n SSG_FALLBACK_EXPORT_ERROR,\n} from '../lib/constants'\nimport { recursiveCopy } from '../lib/recursive-copy'\nimport {\n BUILD_ID_FILE,\n CLIENT_PUBLIC_FILES_PATH,\n CLIENT_STATIC_FILES_PATH,\n EXPORT_DETAIL,\n EXPORT_MARKER,\n NEXT_FONT_MANIFEST,\n MIDDLEWARE_MANIFEST,\n PAGES_MANIFEST,\n PHASE_EXPORT,\n PRERENDER_MANIFEST,\n SERVER_DIRECTORY,\n SERVER_REFERENCE_MANIFEST,\n APP_PATH_ROUTES_MANIFEST,\n ROUTES_MANIFEST,\n FUNCTIONS_CONFIG_MANIFEST,\n} from '../shared/lib/constants'\nimport loadConfig from '../server/config'\nimport type { ExportPathMap } from '../server/config-shared'\nimport { parseMaxPostponedStateSize } from '../server/config-shared'\nimport { eventCliSession } from '../telemetry/events'\nimport { hasNextSupport } from '../server/ci-info'\nimport { Telemetry } from '../telemetry/storage'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { loadEnvConfig } from '@next/env'\nimport { isAPIRoute } from '../lib/is-api-route'\nimport { getPagePath } from '../server/require'\nimport type { Span } from '../trace'\nimport type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { isAppPageRoute } from '../lib/is-app-page-route'\nimport isError from '../lib/is-error'\nimport { formatManifest } from '../build/manifests/formatter/format-manifest'\nimport { TurborepoAccessTraceResult } from '../build/turborepo-access-trace'\nimport { createProgress } from '../build/progress'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isInterceptionRouteRewrite } from '../lib/generate-interception-routes-rewrites'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\nimport { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info'\nimport { convertSegmentPathToStaticExportFilename } from '../shared/lib/segment-cache/segment-value-encoding'\nimport { getNextBuildDebuggerPortOffset } from '../lib/worker'\nimport { getParams } from './helpers/get-params'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport type { Params } from '../server/request/params'\n\nexport class ExportError extends Error {\n code = 'NEXT_EXPORT_ERROR'\n}\n\n/**\n * Picks an RDC seed by matching on the params that are\n * already known, so fallback shells use a seed that has already\n * computed those known params.\n */\nfunction buildRDCCacheByPage(\n results: ExportPagesResult,\n finalPhaseExportPaths: ExportPathEntry[]\n): Record<string, string> {\n const renderResumeDataCachesByPage: Record<string, string> = {}\n const seedCandidatesByPage = new Map<\n string,\n Array<{ path: string; renderResumeDataCache: string }>\n >()\n\n for (const { page, path, result } of results) {\n if (!result) {\n continue\n }\n\n if ('renderResumeDataCache' in result && result.renderResumeDataCache) {\n // Collect all RDC seeds for this page so we can pick the best match\n // for each fallback shell later (e.g. locale-specific variants).\n const candidates = seedCandidatesByPage.get(page) ?? []\n candidates.push({\n path,\n renderResumeDataCache: result.renderResumeDataCache,\n })\n seedCandidatesByPage.set(page, candidates)\n // Remove the RDC string from the result so that it can be garbage\n // collected, when there are more results for the same page.\n result.renderResumeDataCache = undefined\n }\n }\n\n const getKnownParamsKey = (\n normalizedPage: string,\n path: string,\n fallbackParamNames: Set<string>\n ): string | null => {\n let params: Params\n try {\n params = getParams(normalizedPage, path)\n } catch {\n return null\n }\n\n // Only keep params that are known, then sort\n // for a stable key so we can match a compatible seed.\n const entries = Object.entries(params).filter(\n ([key]) => !fallbackParamNames.has(key)\n )\n\n entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n return JSON.stringify(entries)\n }\n\n for (const exportPath of finalPhaseExportPaths) {\n const { page, path, _fallbackRouteParams = [] } = exportPath\n if (!isDynamicRoute(page)) {\n continue\n }\n\n // Normalize app pages before param matching.\n const normalizedPage = normalizeAppPath(page)\n const pageKey = page !== path ? `${page}: ${path}` : path\n const fallbackParamNames = new Set(\n _fallbackRouteParams.map((param) => param.paramName)\n )\n // Build a key from the known params for this fallback shell so we can\n // select a seed from a compatible prerendered route.\n const targetKey = getKnownParamsKey(\n normalizedPage,\n path,\n fallbackParamNames\n )\n\n if (!targetKey) {\n continue\n }\n\n const candidates = seedCandidatesByPage.get(page)\n\n // No suitable candidates, so there's no RDC seed to select\n if (!candidates || candidates.length === 0) {\n continue\n }\n\n let selected: string | null = null\n for (const candidate of candidates) {\n // Pick the seed whose known params match this fallback shell.\n const candidateKey = getKnownParamsKey(\n normalizedPage,\n candidate.path,\n fallbackParamNames\n )\n if (candidateKey === targetKey) {\n selected = candidate.renderResumeDataCache\n break\n }\n }\n\n if (selected) {\n renderResumeDataCachesByPage[pageKey] = selected\n }\n }\n\n return renderResumeDataCachesByPage\n}\n\nasync function exportAppImpl(\n dir: string,\n options: Readonly<ExportAppOptions>,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n dir = resolve(dir)\n\n // attempt to load global env values so they are available in next.config.js\n span.traceChild('load-dotenv').traceFn(() => loadEnvConfig(dir, false, Log))\n\n const { enabledDirectories } = options\n\n const nextConfig =\n options.nextConfig ||\n (await span.traceChild('load-next-config').traceAsyncFn(() =>\n loadConfig(PHASE_EXPORT, dir, {\n debugPrerender: options.debugPrerender,\n })\n ))\n\n const distDir = join(dir, nextConfig.distDir)\n const telemetry = options.buildExport ? null : new Telemetry({ distDir })\n\n if (telemetry) {\n telemetry.record(\n eventCliSession(nextConfig, {\n webpackVersion: null,\n cliCommand: 'export',\n isSrcDir: null,\n hasNowJson: !!(await findUp('now.json', { cwd: dir })),\n isCustomServer: null,\n turboFlag: false,\n pagesDir: null,\n appDir: null,\n })\n )\n }\n\n const subFolders = nextConfig.trailingSlash && !options.buildExport\n\n if (!options.silent && !options.buildExport) {\n Log.info(`using build directory: ${distDir}`)\n }\n\n const buildIdFile = join(distDir, BUILD_ID_FILE)\n\n if (!existsSync(buildIdFile)) {\n throw new ExportError(\n `Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`\n )\n }\n\n const customRoutes = (['rewrites', 'redirects', 'headers'] as const).filter(\n (config) => typeof nextConfig[config] === 'function'\n )\n\n if (!hasNextSupport && !options.buildExport && customRoutes.length > 0) {\n Log.warn(\n `rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(\n ', '\n )}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n const buildId = await fs.readFile(buildIdFile, 'utf8')\n\n const pagesManifest =\n !options.pages &&\n (require(join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST)) as PagesManifest)\n\n let prerenderManifest: DeepReadonly<PrerenderManifest> | undefined\n try {\n prerenderManifest = require(join(distDir, PRERENDER_MANIFEST))\n } catch {}\n\n let appRoutePathManifest: Record<string, string> | undefined\n try {\n appRoutePathManifest = require(join(distDir, APP_PATH_ROUTES_MANIFEST))\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'MODULE_NOT_FOUND')\n ) {\n // the manifest doesn't exist which will happen when using\n // \"pages\" dir instead of \"app\" dir.\n appRoutePathManifest = undefined\n } else {\n // the manifest is malformed (invalid json)\n throw err\n }\n }\n\n const excludedPrerenderRoutes = new Set<string>()\n const pages = options.pages || Object.keys(pagesManifest)\n const defaultPathMap: ExportPathMap = {}\n\n let hasApiRoutes = false\n for (const page of pages) {\n // _document and _app are not real pages\n // _error is exported as 404.html later on\n // API Routes are Node.js functions\n\n if (isAPIRoute(page)) {\n hasApiRoutes = true\n continue\n }\n\n if (page === '/_document' || page === '/_app' || page === '/_error') {\n continue\n }\n\n // iSSG pages that are dynamic should not export templated version by\n // default. In most cases, this would never work. There is no server that\n // could run `getStaticProps`. If users make their page work lazily, they\n // can manually add it to the `exportPathMap`.\n if (prerenderManifest?.dynamicRoutes[page]) {\n excludedPrerenderRoutes.add(page)\n continue\n }\n\n defaultPathMap[page] = { page }\n }\n\n const mapAppRouteToPage = new Map<string, string>()\n if (!options.buildExport && appRoutePathManifest) {\n for (const [pageName, routePath] of Object.entries(appRoutePathManifest)) {\n mapAppRouteToPage.set(routePath, pageName)\n if (\n isAppPageRoute(pageName) &&\n !prerenderManifest?.routes[routePath] &&\n !prerenderManifest?.dynamicRoutes[routePath]\n ) {\n defaultPathMap[routePath] = {\n page: pageName,\n _isAppDir: true,\n }\n }\n }\n }\n\n // Initialize the output directory\n const outDir = options.outdir\n\n if (outDir === join(dir, 'public')) {\n throw new ExportError(\n `The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-public`\n )\n }\n\n if (outDir === join(dir, 'static')) {\n throw new ExportError(\n `The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-static`\n )\n }\n\n await fs.rm(outDir, { recursive: true, force: true })\n await fs.mkdir(join(outDir, '_next', buildId), { recursive: true })\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: false,\n }),\n 'utf8'\n )\n\n // Copy static directory\n if (!options.buildExport && existsSync(join(dir, 'static'))) {\n if (!options.silent) {\n Log.info('Copying \"static\" directory')\n }\n await span\n .traceChild('copy-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(join(dir, 'static'), join(outDir, 'static'))\n )\n }\n\n // Copy .next/static directory\n if (\n !options.buildExport &&\n existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))\n ) {\n if (!options.silent) {\n Log.info('Copying \"static build\" directory')\n }\n await span\n .traceChild('copy-next-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(\n join(distDir, CLIENT_STATIC_FILES_PATH),\n join(outDir, '_next', CLIENT_STATIC_FILES_PATH)\n )\n )\n }\n\n // Get the exportPathMap from the config file\n if (typeof nextConfig.exportPathMap !== 'function') {\n nextConfig.exportPathMap = async (defaultMap) => {\n return defaultMap\n }\n }\n\n const {\n i18n,\n images: { loader = 'default', unoptimized },\n } = nextConfig\n\n if (i18n && !options.buildExport) {\n throw new ExportError(\n `i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n if (!options.buildExport) {\n const { isNextImageImported } = await span\n .traceChild('is-next-image-imported')\n .traceAsyncFn(() =>\n fs\n .readFile(join(distDir, EXPORT_MARKER), 'utf8')\n .then((text) => JSON.parse(text))\n .catch(() => ({}))\n )\n\n if (\n isNextImageImported &&\n loader === 'default' &&\n !unoptimized &&\n !hasNextSupport\n ) {\n throw new ExportError(\n `Image Optimization using the default loader is not compatible with export.\n Possible solutions:\n - Use \\`next start\\` to run a server, which includes the Image Optimization API.\n - Configure \\`images.unoptimized = true\\` in \\`next.config.js\\` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api`\n )\n }\n }\n\n let serverActionsManifest: ActionManifest | undefined\n if (enabledDirectories.app) {\n serverActionsManifest = require(\n join(distDir, SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.json')\n ) as ActionManifest\n\n if (nextConfig.output === 'export') {\n const routesManifest = require(join(distDir, ROUTES_MANIFEST))\n\n // We already prevent rewrites earlier in the process, however Next.js will insert rewrites\n // for interception routes so we need to check for that here.\n if (routesManifest?.rewrites?.beforeFiles?.length > 0) {\n const hasInterceptionRouteRewrite =\n routesManifest.rewrites.beforeFiles.some(isInterceptionRouteRewrite)\n\n if (hasInterceptionRouteRewrite) {\n throw new ExportError(\n `Intercepting routes are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n\n const actionIds = [\n ...Object.keys(serverActionsManifest.node),\n ...Object.keys(serverActionsManifest.edge),\n ]\n\n if (\n actionIds.some(\n (actionId) =>\n extractInfoFromServerReferenceId(actionId).type === 'server-action'\n )\n ) {\n throw new ExportError(\n `Server Actions are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n }\n\n // Start the rendering process\n const renderOpts: WorkerRenderOptsPartial = {\n previewProps: prerenderManifest?.preview,\n isBuildTimePrerendering: true,\n assetPrefix: nextConfig.assetPrefix.replace(/\\/$/, ''),\n distDir,\n basePath: nextConfig.basePath,\n cacheComponents: nextConfig.cacheComponents ?? false,\n trailingSlash: nextConfig.trailingSlash,\n locales: i18n?.locales,\n locale: i18n?.defaultLocale,\n defaultLocale: i18n?.defaultLocale,\n domainLocales: i18n?.domains,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n // Exported pages do not currently support dynamic HTML.\n supportsDynamicResponse: false,\n crossOrigin: nextConfig.crossOrigin,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n serverActions: nextConfig.experimental.serverActions,\n serverComponents: enabledDirectories.app,\n cacheLifeProfiles: nextConfig.cacheLife,\n nextFontManifest: require(\n join(distDir, 'server', `${NEXT_FONT_MANIFEST}.json`)\n ),\n images: nextConfig.images,\n htmlLimitedBots: nextConfig.htmlLimitedBots.source,\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\n dynamicOnHover: nextConfig.experimental.dynamicOnHover ?? false,\n optimisticRouting: nextConfig.experimental.optimisticRouting ?? false,\n inlineCss: nextConfig.experimental.inlineCss ?? false,\n prefetchInlining: nextConfig.experimental.prefetchInlining ?? false,\n authInterrupts: !!nextConfig.experimental.authInterrupts,\n maxPostponedStateSizeBytes: parseMaxPostponedStateSize(\n nextConfig.experimental.maxPostponedStateSize\n ),\n },\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n }\n\n // We need this for server rendering the Link component.\n ;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n }\n\n const exportPathMap = await span\n .traceChild('run-export-path-map')\n .traceAsyncFn(async () => {\n const exportMap = await nextConfig.exportPathMap(defaultPathMap, {\n dev: false,\n dir,\n outDir,\n distDir,\n buildId,\n })\n return exportMap\n })\n\n // During static export, remove export 404/500 of pages router\n // when only app router presents\n if (!options.buildExport && options.appDirOnly) {\n delete exportPathMap['/404']\n delete exportPathMap['/500']\n }\n\n // only add missing 404 page when `buildExport` is false\n if (!options.buildExport && !options.appDirOnly) {\n // only add missing /404 if not specified in `exportPathMap`\n if (!exportPathMap['/404']) {\n exportPathMap['/404'] = { page: '/_error' }\n }\n\n /**\n * exports 404.html for backwards compat\n * E.g. GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify\n */\n if (!exportPathMap['/404.html'] && exportPathMap['/404']) {\n // alias /404.html to /404 to be compatible with custom 404 / _error page\n exportPathMap['/404.html'] = exportPathMap['/404']\n }\n }\n\n const allExportPaths: ExportPathEntry[] = []\n const seenExportPaths = new Set<string>()\n const fallbackEnabledPages = new Set<string>()\n\n for (const [path, entry] of Object.entries(exportPathMap)) {\n // make sure to prevent duplicates\n const normalizedPath = denormalizePagePath(normalizePagePath(path))\n\n if (seenExportPaths.has(normalizedPath)) {\n continue\n }\n\n seenExportPaths.add(normalizedPath)\n\n if (!entry._isAppDir && isAPIRoute(entry.page)) {\n hasApiRoutes = true\n continue\n }\n\n allExportPaths.push({ ...entry, path: normalizedPath })\n\n if (prerenderManifest && !options.buildExport) {\n const prerenderInfo = prerenderManifest.dynamicRoutes[entry.page]\n\n if (prerenderInfo && prerenderInfo.fallback !== false) {\n fallbackEnabledPages.add(entry.page)\n }\n }\n }\n\n if (allExportPaths.length === 0) {\n if (!prerenderManifest) {\n return null\n }\n }\n\n if (fallbackEnabledPages.size > 0) {\n throw new ExportError(\n `Found pages with \\`fallback\\` enabled:\\n${[...fallbackEnabledPages].join(\n '\\n'\n )}\\n${SSG_FALLBACK_EXPORT_ERROR}\\n`\n )\n }\n\n let hasMiddleware = false\n\n if (!options.buildExport) {\n try {\n const middlewareManifest = require(\n join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST)\n ) as MiddlewareManifest\n\n const functionsConfigManifest = require(\n join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST)\n )\n\n hasMiddleware =\n Object.keys(middlewareManifest.middleware).length > 0 ||\n Boolean(functionsConfigManifest.functions?.['/_middleware'])\n } catch {}\n\n // Warn if the user defines a path for an API page\n if (hasApiRoutes || hasMiddleware) {\n if (nextConfig.output === 'export') {\n Log.warn(\n yellow(\n `Statically exporting a Next.js application via \\`next export\\` disables API routes and middleware.`\n ) +\n `\\n` +\n yellow(\n `This command is meant for static-only hosts, and is` +\n ' ' +\n bold(`not necessary to make your application static.`)\n ) +\n `\\n` +\n yellow(\n `Pages in your application without server-side data dependencies will be automatically statically exported by \\`next build\\`, including pages powered by \\`getStaticProps\\`.`\n ) +\n `\\n` +\n yellow(\n `Learn more: https://nextjs.org/docs/messages/api-routes-static-export`\n )\n )\n }\n }\n }\n\n const pagesDataDir = options.buildExport\n ? outDir\n : join(outDir, '_next/data', buildId)\n\n const publicDir = join(dir, CLIENT_PUBLIC_FILES_PATH)\n // Copy public directory\n if (!options.buildExport && existsSync(publicDir)) {\n if (!options.silent) {\n Log.info('Copying \"public\" directory')\n }\n await span.traceChild('copy-public-directory').traceAsyncFn(() =>\n recursiveCopy(publicDir, outDir, {\n filter(path) {\n // Exclude paths used by pages\n return !exportPathMap[path]\n },\n })\n )\n }\n\n const exportPagesInBatches = async (\n worker: StaticWorker,\n exportPaths: ExportPathEntry[],\n renderResumeDataCachesByPage?: Record<string, string>\n ): Promise<ExportPagesResult> => {\n // Batch filtered pages into smaller batches, and call the export worker on\n // each batch. We've set a default minimum of 25 pages per batch to ensure\n // that even setups with only a few static pages can leverage a shared\n // incremental cache, however this value can be configured.\n const minPageCountPerBatch =\n nextConfig.experimental.staticGenerationMinPagesPerWorker ?? 25\n\n // Calculate the number of workers needed to ensure each batch has at least\n // minPageCountPerBatch pages.\n const numWorkers = Math.min(\n options.numWorkers,\n Math.ceil(exportPaths.length / minPageCountPerBatch)\n )\n\n // Calculate the page count per batch based on the number of workers.\n const pageCountPerBatch = Math.ceil(exportPaths.length / numWorkers)\n\n const batches = Array.from({ length: numWorkers }, (_, i) =>\n exportPaths.slice(i * pageCountPerBatch, (i + 1) * pageCountPerBatch)\n )\n\n // Distribute remaining pages.\n const remainingPages = exportPaths.slice(numWorkers * pageCountPerBatch)\n remainingPages.forEach((page, index) => {\n batches[index % batches.length].push(page)\n })\n\n return (\n await Promise.all(\n batches.map(async (batch) =>\n worker.exportPages({\n buildId,\n deploymentId: nextConfig.deploymentId,\n clientAssetToken:\n nextConfig.experimental.immutableAssetToken ||\n nextConfig.deploymentId,\n exportPaths: batch,\n parentSpanId: span.getId(),\n pagesDataDir,\n renderOpts,\n options,\n dir,\n distDir,\n outDir,\n nextConfig,\n cacheHandler: nextConfig.cacheHandler,\n cacheMaxMemorySize: nextConfig.cacheMaxMemorySize,\n fetchCache: true,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n renderResumeDataCachesByPage,\n })\n )\n )\n ).flat()\n }\n\n let initialPhaseExportPaths: ExportPathEntry[] = []\n const finalPhaseExportPaths: ExportPathEntry[] = []\n\n if (renderOpts.cacheComponents) {\n for (const exportPath of allExportPaths) {\n if (exportPath._allowEmptyStaticShell) {\n finalPhaseExportPaths.push(exportPath)\n } else {\n initialPhaseExportPaths.push(exportPath)\n }\n }\n } else {\n initialPhaseExportPaths = allExportPaths\n }\n\n const totalExportPaths =\n initialPhaseExportPaths.length + finalPhaseExportPaths.length\n let worker: StaticWorker | null = null\n let results: ExportPagesResult = []\n\n if (totalExportPaths > 0) {\n const progress = createProgress(\n totalExportPaths,\n options.statusMessage ??\n `Exporting using ${options.numWorkers} worker${options.numWorkers > 1 ? 's' : ''}`\n )\n\n if (staticWorker) {\n // TODO: progress shouldn't rely on \"activity\" event sent from `exportPage`.\n staticWorker.setOnActivity(progress.run)\n staticWorker.setOnActivityAbort(progress.clear)\n worker = staticWorker\n } else {\n worker = createStaticWorker(nextConfig, {\n debuggerPortOffset: getNextBuildDebuggerPortOffset({\n kind: 'export-page',\n }),\n numberOfWorkers: options.numWorkers,\n progress,\n })\n }\n\n results = await exportPagesInBatches(worker, initialPhaseExportPaths)\n\n if (finalPhaseExportPaths.length > 0) {\n const renderResumeDataCachesByPage = buildRDCCacheByPage(\n results,\n finalPhaseExportPaths\n )\n\n const finalPhaseResults = await exportPagesInBatches(\n worker,\n finalPhaseExportPaths,\n renderResumeDataCachesByPage\n )\n\n results.push(...finalPhaseResults)\n }\n }\n\n const collector: ExportAppResult = {\n byPath: new Map(),\n byPage: new Map(),\n ssgNotFoundPaths: new Set(),\n turborepoAccessTraceResults: new Map(),\n }\n\n const failedExportAttemptsByPage: Map<string, boolean> = new Map()\n\n for (const { result, path, page, pageKey } of results) {\n if (!result) continue\n if ('error' in result) {\n failedExportAttemptsByPage.set(pageKey, true)\n continue\n }\n\n if (result.turborepoAccessTraceResult) {\n collector.turborepoAccessTraceResults?.set(\n path,\n TurborepoAccessTraceResult.fromSerialized(\n result.turborepoAccessTraceResult\n )\n )\n }\n\n if (options.buildExport) {\n // Update path info by path.\n const info = collector.byPath.get(path) ?? {}\n if (result.cacheControl) {\n info.cacheControl = result.cacheControl\n }\n if (typeof result.metadata !== 'undefined') {\n info.metadata = result.metadata\n }\n\n if (typeof result.hasEmptyStaticShell !== 'undefined') {\n info.hasEmptyStaticShell = result.hasEmptyStaticShell\n }\n\n if (typeof result.hasPostponed !== 'undefined') {\n info.hasPostponed = result.hasPostponed\n }\n\n if (typeof result.hasStaticRsc !== 'undefined') {\n info.hasStaticRsc = result.hasStaticRsc\n }\n\n if (typeof result.fetchMetrics !== 'undefined') {\n info.fetchMetrics = result.fetchMetrics\n }\n\n collector.byPath.set(path, info)\n\n // Update not found.\n if (result.ssgNotFound === true) {\n collector.ssgNotFoundPaths.add(path)\n }\n\n // Update durations.\n const durations = collector.byPage.get(page) ?? {\n durationsByPath: new Map<string, number>(),\n }\n durations.durationsByPath.set(path, result.duration)\n collector.byPage.set(page, durations)\n }\n }\n\n // Export mode provide static outputs that are not compatible with PPR mode.\n if (!options.buildExport && nextConfig.experimental.ppr) {\n // TODO: add message\n throw new Error('Invariant: PPR cannot be enabled in export mode')\n }\n\n // copy prerendered routes to outDir\n if (!options.buildExport && prerenderManifest) {\n await Promise.all(\n Object.keys(prerenderManifest.routes).map(async (unnormalizedRoute) => {\n // Special handling: map app /_not-found to 404.html (and 404/index.html when trailingSlash)\n if (unnormalizedRoute === '/_not-found') {\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const htmlSrc = `${orig}.html`\n\n // write 404.html at root\n const htmlDest404 = join(outDir, '404.html')\n await fs.mkdir(dirname(htmlDest404), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404)\n\n // When trailingSlash, also write 404/index.html\n if (subFolders) {\n const htmlDest404Index = join(outDir, '404', 'index.html')\n await fs.mkdir(dirname(htmlDest404Index), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404Index)\n }\n }\n // Skip 500.html in static export\n if (unnormalizedRoute === '/_global-error') {\n return\n }\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const isAppRouteHandler = appPageName && isAppRouteRoute(appPageName)\n\n // returning notFound: true from getStaticProps will not\n // output html/json files during the build\n if (prerenderManifest!.notFoundRoutes.includes(unnormalizedRoute)) {\n return\n }\n // TODO: This rewrites /index/foo to /index/index/foo. Investigate and\n // fix. I presume this was because normalizePagePath was designed for\n // some other use case and then reused here for static exports without\n // realizing the implications.\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n // strip leading / and then recurse number of nested dirs\n // to place from base folder\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const handlerSrc = `${orig}.body`\n const handlerDest = join(outDir, route)\n\n if (isAppRouteHandler && existsSync(handlerSrc)) {\n await fs.mkdir(dirname(handlerDest), { recursive: true })\n await fs.copyFile(handlerSrc, handlerDest)\n return\n }\n\n const htmlDest = join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.html`\n )\n const jsonDest = isAppPath\n ? join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.txt`\n )\n : join(pagesDataDir, `${route}.json`)\n\n await fs.mkdir(dirname(htmlDest), { recursive: true })\n await fs.mkdir(dirname(jsonDest), { recursive: true })\n\n const htmlSrc = `${orig}.html`\n const jsonSrc = `${orig}${isAppPath ? RSC_SUFFIX : '.json'}`\n\n await fs.copyFile(htmlSrc, htmlDest)\n await fs.copyFile(jsonSrc, jsonDest)\n\n const segmentsDir = `${orig}${RSC_SEGMENTS_DIR_SUFFIX}`\n\n if (isAppPath && existsSync(segmentsDir)) {\n // Output a data file for each of this page's segments\n //\n // These files are requested by the client router's internal\n // prefetcher, not the user directly. So we don't need to account for\n // things like trailing slash handling.\n //\n // To keep the protocol simple, we can use the non-normalized route\n // path instead of the normalized one (which, among other things,\n // rewrites `/` to `/index`).\n const segmentsDirDest = join(outDir, unnormalizedRoute)\n const segmentPaths = await collectSegmentPaths(segmentsDir)\n await Promise.all(\n segmentPaths.map(async (segmentFileSrc) => {\n const segmentPath =\n '/' + segmentFileSrc.slice(0, -RSC_SEGMENT_SUFFIX.length)\n const segmentFilename =\n convertSegmentPathToStaticExportFilename(segmentPath)\n const segmentFileDest = join(segmentsDirDest, segmentFilename)\n await fs.mkdir(dirname(segmentFileDest), { recursive: true })\n await fs.copyFile(\n join(segmentsDir, segmentFileSrc),\n segmentFileDest\n )\n })\n )\n }\n })\n )\n }\n\n if (failedExportAttemptsByPage.size > 0) {\n const failedPages = Array.from(failedExportAttemptsByPage.keys())\n throw new ExportError(\n `Export encountered errors on ${failedPages.length} ${failedPages.length === 1 ? 'path' : 'paths'}:\\n\\t${failedPages\n .sort()\n .join('\\n\\t')}`\n )\n }\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: true,\n }),\n 'utf8'\n )\n\n if (telemetry) {\n await telemetry.flush()\n }\n\n // Clean up activity listeners for progress.\n if (staticWorker) {\n staticWorker.setOnActivity(undefined)\n staticWorker.setOnActivityAbort(undefined)\n }\n\n if (!staticWorker && worker) {\n await worker.end()\n }\n\n return collector\n}\n\nasync function collectSegmentPaths(segmentsDirectory: string) {\n const results: Array<string> = []\n await collectSegmentPathsImpl(segmentsDirectory, segmentsDirectory, results)\n return results\n}\n\nasync function collectSegmentPathsImpl(\n segmentsDirectory: string,\n directory: string,\n results: Array<string>\n) {\n const segmentFiles = await fs.readdir(directory, {\n withFileTypes: true,\n })\n await Promise.all(\n segmentFiles.map(async (segmentFile) => {\n if (segmentFile.isDirectory()) {\n await collectSegmentPathsImpl(\n segmentsDirectory,\n join(directory, segmentFile.name),\n results\n )\n return\n }\n if (!segmentFile.name.endsWith(RSC_SEGMENT_SUFFIX)) {\n return\n }\n results.push(\n relative(segmentsDirectory, join(directory, segmentFile.name))\n )\n })\n )\n}\n\nexport default async function exportApp(\n dir: string,\n options: ExportAppOptions,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n const nextExportSpan = span.traceChild('next-export')\n\n return nextExportSpan.traceAsyncFn(async () => {\n return await exportAppImpl(dir, options, nextExportSpan, staticWorker)\n })\n}\n"],"names":["createStaticWorker","bold","yellow","findUp","existsSync","promises","fs","dirname","join","resolve","sep","relative","Log","RSC_SEGMENT_SUFFIX","RSC_SEGMENTS_DIR_SUFFIX","RSC_SUFFIX","SSG_FALLBACK_EXPORT_ERROR","recursiveCopy","BUILD_ID_FILE","CLIENT_PUBLIC_FILES_PATH","CLIENT_STATIC_FILES_PATH","EXPORT_DETAIL","EXPORT_MARKER","NEXT_FONT_MANIFEST","MIDDLEWARE_MANIFEST","PAGES_MANIFEST","PHASE_EXPORT","PRERENDER_MANIFEST","SERVER_DIRECTORY","SERVER_REFERENCE_MANIFEST","APP_PATH_ROUTES_MANIFEST","ROUTES_MANIFEST","FUNCTIONS_CONFIG_MANIFEST","loadConfig","parseMaxPostponedStateSize","eventCliSession","hasNextSupport","Telemetry","normalizePagePath","denormalizePagePath","loadEnvConfig","isAPIRoute","getPagePath","isAppRouteRoute","isAppPageRoute","isError","formatManifest","TurborepoAccessTraceResult","createProgress","isInterceptionRouteRewrite","extractInfoFromServerReferenceId","convertSegmentPathToStaticExportFilename","getNextBuildDebuggerPortOffset","getParams","isDynamicRoute","normalizeAppPath","ExportError","Error","code","buildRDCCacheByPage","results","finalPhaseExportPaths","renderResumeDataCachesByPage","seedCandidatesByPage","Map","page","path","result","renderResumeDataCache","candidates","get","push","set","undefined","getKnownParamsKey","normalizedPage","fallbackParamNames","params","entries","Object","filter","key","has","sort","a","b","JSON","stringify","exportPath","_fallbackRouteParams","pageKey","Set","map","param","paramName","targetKey","length","selected","candidate","candidateKey","exportAppImpl","dir","options","span","staticWorker","traceChild","traceFn","enabledDirectories","nextConfig","traceAsyncFn","debugPrerender","distDir","telemetry","buildExport","record","webpackVersion","cliCommand","isSrcDir","hasNowJson","cwd","isCustomServer","turboFlag","pagesDir","appDir","subFolders","trailingSlash","silent","info","buildIdFile","customRoutes","config","warn","buildId","readFile","pagesManifest","pages","require","prerenderManifest","appRoutePathManifest","err","excludedPrerenderRoutes","keys","defaultPathMap","hasApiRoutes","dynamicRoutes","add","mapAppRouteToPage","pageName","routePath","routes","_isAppDir","outDir","outdir","rm","recursive","force","mkdir","writeFile","version","outDirectory","success","exportPathMap","defaultMap","i18n","images","loader","unoptimized","isNextImageImported","then","text","parse","catch","serverActionsManifest","app","output","routesManifest","rewrites","beforeFiles","hasInterceptionRouteRewrite","some","actionIds","node","edge","actionId","type","renderOpts","previewProps","preview","isBuildTimePrerendering","assetPrefix","replace","basePath","cacheComponents","locales","locale","defaultLocale","domainLocales","domains","disableOptimizedLoading","experimental","supportsDynamicResponse","crossOrigin","optimizeCss","nextConfigOutput","nextScriptWorkers","largePageDataBytes","serverActions","serverComponents","cacheLifeProfiles","cacheLife","nextFontManifest","htmlLimitedBots","source","clientTraceMetadata","expireTime","staleTimes","clientParamParsingOrigins","dynamicOnHover","optimisticRouting","inlineCss","prefetchInlining","authInterrupts","maxPostponedStateSizeBytes","maxPostponedStateSize","reactMaxHeadersLength","globalThis","__NEXT_DATA__","nextExport","exportMap","dev","appDirOnly","allExportPaths","seenExportPaths","fallbackEnabledPages","entry","normalizedPath","prerenderInfo","fallback","size","hasMiddleware","functionsConfigManifest","middlewareManifest","middleware","Boolean","functions","pagesDataDir","publicDir","exportPagesInBatches","worker","exportPaths","minPageCountPerBatch","staticGenerationMinPagesPerWorker","numWorkers","Math","min","ceil","pageCountPerBatch","batches","Array","from","_","i","slice","remainingPages","forEach","index","Promise","all","batch","exportPages","deploymentId","clientAssetToken","immutableAssetToken","parentSpanId","getId","cacheHandler","cacheMaxMemorySize","fetchCache","fetchCacheKeyPrefix","flat","initialPhaseExportPaths","_allowEmptyStaticShell","totalExportPaths","progress","statusMessage","setOnActivity","run","setOnActivityAbort","clear","debuggerPortOffset","kind","numberOfWorkers","finalPhaseResults","collector","byPath","byPage","ssgNotFoundPaths","turborepoAccessTraceResults","failedExportAttemptsByPage","turborepoAccessTraceResult","fromSerialized","cacheControl","metadata","hasEmptyStaticShell","hasPostponed","hasStaticRsc","fetchMetrics","ssgNotFound","durations","durationsByPath","duration","ppr","unnormalizedRoute","srcRoute","appPageName","isAppPath","route","pagePath","distPagesDir","split","orig","htmlSrc","htmlDest404","copyFile","htmlDest404Index","isAppRouteHandler","notFoundRoutes","includes","handlerSrc","handlerDest","htmlDest","jsonDest","jsonSrc","segmentsDir","segmentsDirDest","segmentPaths","collectSegmentPaths","segmentFileSrc","segmentPath","segmentFilename","segmentFileDest","failedPages","flush","end","segmentsDirectory","collectSegmentPathsImpl","directory","segmentFiles","readdir","withFileTypes","segmentFile","isDirectory","name","endsWith","exportApp","nextExportSpan"],"mappings":"AAOA,SACEA,kBAAkB,QAGb,WAAU;AAGjB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAmB;AAChD,OAAOC,YAAY,6BAA4B;AAC/C,SAASC,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAE/C,OAAO,yBAAwB;AAE/B,SAASC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,GAAG,EAAEC,QAAQ,QAAQ,OAAM;AAC5D,YAAYC,SAAS,sBAAqB;AAC1C,SACEC,kBAAkB,EAClBC,uBAAuB,EACvBC,UAAU,EACVC,yBAAyB,QACpB,mBAAkB;AACzB,SAASC,aAAa,QAAQ,wBAAuB;AACrD,SACEC,aAAa,EACbC,wBAAwB,EACxBC,wBAAwB,EACxBC,aAAa,EACbC,aAAa,EACbC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,YAAY,EACZC,kBAAkB,EAClBC,gBAAgB,EAChBC,yBAAyB,EACzBC,wBAAwB,EACxBC,eAAe,EACfC,yBAAyB,QACpB,0BAAyB;AAChC,OAAOC,gBAAgB,mBAAkB;AAEzC,SAASC,0BAA0B,QAAQ,0BAAyB;AACpE,SAASC,eAAe,QAAQ,sBAAqB;AACrD,SAASC,cAAc,QAAQ,oBAAmB;AAClD,SAASC,SAAS,QA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H,SAAS;QACTC,cAAcR;QACdS,SAAS;IACX,IACA;IAGF,IAAIhD,WAAW;QACb,MAAMA,UAAUsO,KAAK;IACvB;IAEA,4CAA4C;IAC5C,IAAI9O,cAAc;QAChBA,aAAaqL,aAAa,CAACpN;QAC3B+B,aAAauL,kBAAkB,CAACtN;IAClC;IAEA,IAAI,CAAC+B,gBAAgBgJ,QAAQ;QAC3B,MAAMA,OAAO+F,GAAG;IAClB;IAEA,OAAOlD;AACT;AAEA,eAAe2C,oBAAoBQ,iBAAyB;IAC1D,MAAM5R,UAAyB,EAAE;IACjC,MAAM6R,wBAAwBD,mBAAmBA,mBAAmB5R;IACpE,OAAOA;AACT;AAEA,eAAe6R,wBACbD,iBAAyB,EACzBE,SAAiB,EACjB9R,OAAsB;IAEtB,MAAM+R,eAAe,MAAMrV,GAAGsV,OAAO,CAACF,WAAW;QAC/CG,eAAe;IACjB;IACA,MAAMnF,QAAQC,GAAG,CACfgF,aAAa/P,GAAG,CAAC,OAAOkQ;QACtB,IAAIA,YAAYC,WAAW,IAAI;YAC7B,MAAMN,wBACJD,mBACAhV,KAAKkV,WAAWI,YAAYE,IAAI,GAChCpS;YAEF;QACF;QACA,IAAI,CAACkS,YAAYE,IAAI,CAACC,QAAQ,CAACpV,qBAAqB;YAClD;QACF;QACA+C,QAAQW,IAAI,CACV5D,SAAS6U,mBAAmBhV,KAAKkV,WAAWI,YAAYE,IAAI;IAEhE;AAEJ;AAEA,eAAe,eAAeE,UAC5B7P,GAAW,EACXC,OAAyB,EACzBC,IAAU,EACVC,YAA2B;IAE3B,MAAM2P,iBAAiB5P,KAAKE,UAAU,CAAC;IAEvC,OAAO0P,eAAetP,YAAY,CAAC;QACjC,OAAO,MAAMT,cAAcC,KAAKC,SAAS6P,gBAAgB3P;IAC3D;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../src/export/index.ts"],"sourcesContent":["import type {\n ExportAppResult,\n ExportAppOptions,\n WorkerRenderOptsPartial,\n ExportPagesResult,\n ExportPathEntry,\n} from './types'\nimport {\n createStaticWorker,\n type PrerenderManifest,\n type StaticWorker,\n} from '../build'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\n\nimport { bold, yellow } from '../lib/picocolors'\nimport findUp from 'next/dist/compiled/find-up'\nimport { existsSync, promises as fs } from 'fs'\n\nimport '../server/require-hook'\n\nimport { dirname, join, resolve, sep, relative } from 'path'\nimport * as Log from '../build/output/log'\nimport {\n RSC_SEGMENT_SUFFIX,\n RSC_SEGMENTS_DIR_SUFFIX,\n RSC_SUFFIX,\n SSG_FALLBACK_EXPORT_ERROR,\n} from '../lib/constants'\nimport { recursiveCopy } from '../lib/recursive-copy'\nimport {\n BUILD_ID_FILE,\n CLIENT_PUBLIC_FILES_PATH,\n CLIENT_STATIC_FILES_PATH,\n EXPORT_DETAIL,\n EXPORT_MARKER,\n NEXT_FONT_MANIFEST,\n MIDDLEWARE_MANIFEST,\n PAGES_MANIFEST,\n PHASE_EXPORT,\n PRERENDER_MANIFEST,\n SERVER_DIRECTORY,\n SERVER_REFERENCE_MANIFEST,\n APP_PATH_ROUTES_MANIFEST,\n ROUTES_MANIFEST,\n FUNCTIONS_CONFIG_MANIFEST,\n} from '../shared/lib/constants'\nimport loadConfig from '../server/config'\nimport type { ExportPathMap } from '../server/config-shared'\nimport { parseMaxPostponedStateSize } from '../server/config-shared'\nimport { eventCliSession } from '../telemetry/events'\nimport { hasNextSupport } from '../server/ci-info'\nimport { Telemetry } from '../telemetry/storage'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { loadEnvConfig } from '@next/env'\nimport { isAPIRoute } from '../lib/is-api-route'\nimport { getPagePath } from '../server/require'\nimport type { Span } from '../trace'\nimport type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { isAppPageRoute } from '../lib/is-app-page-route'\nimport isError from '../lib/is-error'\nimport { formatManifest } from '../build/manifests/formatter/format-manifest'\nimport { TurborepoAccessTraceResult } from '../build/turborepo-access-trace'\nimport { createProgress } from '../build/progress'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isInterceptionRouteRewrite } from '../lib/is-interception-route-rewrite'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\nimport { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info'\nimport { convertSegmentPathToStaticExportFilename } from '../shared/lib/segment-cache/segment-value-encoding'\nimport { getNextBuildDebuggerPortOffset } from '../lib/worker'\nimport { getParams } from './helpers/get-params'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport type { Params } from '../server/request/params'\n\nexport class ExportError extends Error {\n code = 'NEXT_EXPORT_ERROR'\n}\n\n/**\n * Picks an RDC seed by matching on the params that are\n * already known, so fallback shells use a seed that has already\n * computed those known params.\n */\nfunction buildRDCCacheByPage(\n results: ExportPagesResult,\n finalPhaseExportPaths: ExportPathEntry[]\n): Record<string, string> {\n const renderResumeDataCachesByPage: Record<string, string> = {}\n const seedCandidatesByPage = new Map<\n string,\n Array<{ path: string; renderResumeDataCache: string }>\n >()\n\n for (const { page, path, result } of results) {\n if (!result) {\n continue\n }\n\n if ('renderResumeDataCache' in result && result.renderResumeDataCache) {\n // Collect all RDC seeds for this page so we can pick the best match\n // for each fallback shell later (e.g. locale-specific variants).\n const candidates = seedCandidatesByPage.get(page) ?? []\n candidates.push({\n path,\n renderResumeDataCache: result.renderResumeDataCache,\n })\n seedCandidatesByPage.set(page, candidates)\n // Remove the RDC string from the result so that it can be garbage\n // collected, when there are more results for the same page.\n result.renderResumeDataCache = undefined\n }\n }\n\n const getKnownParamsKey = (\n normalizedPage: string,\n path: string,\n fallbackParamNames: Set<string>\n ): string | null => {\n let params: Params\n try {\n params = getParams(normalizedPage, path)\n } catch {\n return null\n }\n\n // Only keep params that are known, then sort\n // for a stable key so we can match a compatible seed.\n const entries = Object.entries(params).filter(\n ([key]) => !fallbackParamNames.has(key)\n )\n\n entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n return JSON.stringify(entries)\n }\n\n for (const exportPath of finalPhaseExportPaths) {\n const { page, path, _fallbackRouteParams = [] } = exportPath\n if (!isDynamicRoute(page)) {\n continue\n }\n\n // Normalize app pages before param matching.\n const normalizedPage = normalizeAppPath(page)\n const pageKey = page !== path ? `${page}: ${path}` : path\n const fallbackParamNames = new Set(\n _fallbackRouteParams.map((param) => param.paramName)\n )\n // Build a key from the known params for this fallback shell so we can\n // select a seed from a compatible prerendered route.\n const targetKey = getKnownParamsKey(\n normalizedPage,\n path,\n fallbackParamNames\n )\n\n if (!targetKey) {\n continue\n }\n\n const candidates = seedCandidatesByPage.get(page)\n\n // No suitable candidates, so there's no RDC seed to select\n if (!candidates || candidates.length === 0) {\n continue\n }\n\n let selected: string | null = null\n for (const candidate of candidates) {\n // Pick the seed whose known params match this fallback shell.\n const candidateKey = getKnownParamsKey(\n normalizedPage,\n candidate.path,\n fallbackParamNames\n )\n if (candidateKey === targetKey) {\n selected = candidate.renderResumeDataCache\n break\n }\n }\n\n if (selected) {\n renderResumeDataCachesByPage[pageKey] = selected\n }\n }\n\n return renderResumeDataCachesByPage\n}\n\nasync function exportAppImpl(\n dir: string,\n options: Readonly<ExportAppOptions>,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n dir = resolve(dir)\n\n // attempt to load global env values so they are available in next.config.js\n span.traceChild('load-dotenv').traceFn(() => loadEnvConfig(dir, false, Log))\n\n const { enabledDirectories } = options\n\n const nextConfig =\n options.nextConfig ||\n (await span.traceChild('load-next-config').traceAsyncFn(() =>\n loadConfig(PHASE_EXPORT, dir, {\n debugPrerender: options.debugPrerender,\n })\n ))\n\n const distDir = join(dir, nextConfig.distDir)\n const telemetry = options.buildExport ? null : new Telemetry({ distDir })\n\n if (telemetry) {\n telemetry.record(\n eventCliSession(nextConfig, {\n webpackVersion: null,\n cliCommand: 'export',\n isSrcDir: null,\n hasNowJson: !!(await findUp('now.json', { cwd: dir })),\n isCustomServer: null,\n turboFlag: false,\n pagesDir: null,\n appDir: null,\n })\n )\n }\n\n const subFolders = nextConfig.trailingSlash && !options.buildExport\n\n if (!options.silent && !options.buildExport) {\n Log.info(`using build directory: ${distDir}`)\n }\n\n const buildIdFile = join(distDir, BUILD_ID_FILE)\n\n if (!existsSync(buildIdFile)) {\n throw new ExportError(\n `Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`\n )\n }\n\n const customRoutes = (['rewrites', 'redirects', 'headers'] as const).filter(\n (config) => typeof nextConfig[config] === 'function'\n )\n\n if (!hasNextSupport && !options.buildExport && customRoutes.length > 0) {\n Log.warn(\n `rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(\n ', '\n )}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n const buildId = await fs.readFile(buildIdFile, 'utf8')\n\n const pagesManifest =\n !options.pages &&\n (require(join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST)) as PagesManifest)\n\n let prerenderManifest: DeepReadonly<PrerenderManifest> | undefined\n try {\n prerenderManifest = require(join(distDir, PRERENDER_MANIFEST))\n } catch {}\n\n let appRoutePathManifest: Record<string, string> | undefined\n try {\n appRoutePathManifest = require(join(distDir, APP_PATH_ROUTES_MANIFEST))\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'MODULE_NOT_FOUND')\n ) {\n // the manifest doesn't exist which will happen when using\n // \"pages\" dir instead of \"app\" dir.\n appRoutePathManifest = undefined\n } else {\n // the manifest is malformed (invalid json)\n throw err\n }\n }\n\n const excludedPrerenderRoutes = new Set<string>()\n const pages = options.pages || Object.keys(pagesManifest)\n const defaultPathMap: ExportPathMap = {}\n\n let hasApiRoutes = false\n for (const page of pages) {\n // _document and _app are not real pages\n // _error is exported as 404.html later on\n // API Routes are Node.js functions\n\n if (isAPIRoute(page)) {\n hasApiRoutes = true\n continue\n }\n\n if (page === '/_document' || page === '/_app' || page === '/_error') {\n continue\n }\n\n // iSSG pages that are dynamic should not export templated version by\n // default. In most cases, this would never work. There is no server that\n // could run `getStaticProps`. If users make their page work lazily, they\n // can manually add it to the `exportPathMap`.\n if (prerenderManifest?.dynamicRoutes[page]) {\n excludedPrerenderRoutes.add(page)\n continue\n }\n\n defaultPathMap[page] = { page }\n }\n\n const mapAppRouteToPage = new Map<string, string>()\n if (!options.buildExport && appRoutePathManifest) {\n for (const [pageName, routePath] of Object.entries(appRoutePathManifest)) {\n mapAppRouteToPage.set(routePath, pageName)\n if (\n isAppPageRoute(pageName) &&\n !prerenderManifest?.routes[routePath] &&\n !prerenderManifest?.dynamicRoutes[routePath]\n ) {\n defaultPathMap[routePath] = {\n page: pageName,\n _isAppDir: true,\n }\n }\n }\n }\n\n // Initialize the output directory\n const outDir = options.outdir\n\n if (outDir === join(dir, 'public')) {\n throw new ExportError(\n `The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-public`\n )\n }\n\n if (outDir === join(dir, 'static')) {\n throw new ExportError(\n `The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-static`\n )\n }\n\n await fs.rm(outDir, { recursive: true, force: true })\n await fs.mkdir(join(outDir, '_next', buildId), { recursive: true })\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: false,\n }),\n 'utf8'\n )\n\n // Copy static directory\n if (!options.buildExport && existsSync(join(dir, 'static'))) {\n if (!options.silent) {\n Log.info('Copying \"static\" directory')\n }\n await span\n .traceChild('copy-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(join(dir, 'static'), join(outDir, 'static'))\n )\n }\n\n // Copy .next/static directory\n if (\n !options.buildExport &&\n existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))\n ) {\n if (!options.silent) {\n Log.info('Copying \"static build\" directory')\n }\n await span\n .traceChild('copy-next-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(\n join(distDir, CLIENT_STATIC_FILES_PATH),\n join(outDir, '_next', CLIENT_STATIC_FILES_PATH)\n )\n )\n }\n\n // Get the exportPathMap from the config file\n if (typeof nextConfig.exportPathMap !== 'function') {\n nextConfig.exportPathMap = async (defaultMap) => {\n return defaultMap\n }\n }\n\n const {\n i18n,\n images: { loader = 'default', unoptimized },\n } = nextConfig\n\n if (i18n && !options.buildExport) {\n throw new ExportError(\n `i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n if (!options.buildExport) {\n const { isNextImageImported } = await span\n .traceChild('is-next-image-imported')\n .traceAsyncFn(() =>\n fs\n .readFile(join(distDir, EXPORT_MARKER), 'utf8')\n .then((text) => JSON.parse(text))\n .catch(() => ({}))\n )\n\n if (\n isNextImageImported &&\n loader === 'default' &&\n !unoptimized &&\n !hasNextSupport\n ) {\n throw new ExportError(\n `Image Optimization using the default loader is not compatible with export.\n Possible solutions:\n - Use \\`next start\\` to run a server, which includes the Image Optimization API.\n - Configure \\`images.unoptimized = true\\` in \\`next.config.js\\` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api`\n )\n }\n }\n\n let serverActionsManifest: ActionManifest | undefined\n if (enabledDirectories.app) {\n serverActionsManifest = require(\n join(distDir, SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.json')\n ) as ActionManifest\n\n if (nextConfig.output === 'export') {\n const routesManifest = require(join(distDir, ROUTES_MANIFEST))\n\n // We already prevent rewrites earlier in the process, however Next.js will insert rewrites\n // for interception routes so we need to check for that here.\n if (routesManifest?.rewrites?.beforeFiles?.length > 0) {\n const hasInterceptionRouteRewrite =\n routesManifest.rewrites.beforeFiles.some(isInterceptionRouteRewrite)\n\n if (hasInterceptionRouteRewrite) {\n throw new ExportError(\n `Intercepting routes are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n\n const actionIds = [\n ...Object.keys(serverActionsManifest.node),\n ...Object.keys(serverActionsManifest.edge),\n ]\n\n if (\n actionIds.some(\n (actionId) =>\n extractInfoFromServerReferenceId(actionId).type === 'server-action'\n )\n ) {\n throw new ExportError(\n `Server Actions are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n }\n\n // Start the rendering process\n const renderOpts: WorkerRenderOptsPartial = {\n previewProps: prerenderManifest?.preview,\n isBuildTimePrerendering: true,\n assetPrefix: nextConfig.assetPrefix.replace(/\\/$/, ''),\n distDir,\n basePath: nextConfig.basePath,\n cacheComponents: nextConfig.cacheComponents ?? false,\n trailingSlash: nextConfig.trailingSlash,\n locales: i18n?.locales,\n locale: i18n?.defaultLocale,\n defaultLocale: i18n?.defaultLocale,\n domainLocales: i18n?.domains,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n // Exported pages do not currently support dynamic HTML.\n supportsDynamicResponse: false,\n crossOrigin: nextConfig.crossOrigin,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n serverActions: nextConfig.experimental.serverActions,\n serverComponents: enabledDirectories.app,\n cacheLifeProfiles: nextConfig.cacheLife,\n nextFontManifest: require(\n join(distDir, 'server', `${NEXT_FONT_MANIFEST}.json`)\n ),\n images: nextConfig.images,\n htmlLimitedBots: nextConfig.htmlLimitedBots.source,\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\n dynamicOnHover: nextConfig.experimental.dynamicOnHover ?? false,\n optimisticRouting: nextConfig.experimental.optimisticRouting ?? false,\n inlineCss: nextConfig.experimental.inlineCss ?? false,\n prefetchInlining: nextConfig.experimental.prefetchInlining ?? false,\n authInterrupts: !!nextConfig.experimental.authInterrupts,\n maxPostponedStateSizeBytes: parseMaxPostponedStateSize(\n nextConfig.experimental.maxPostponedStateSize\n ),\n },\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n }\n\n // We need this for server rendering the Link component.\n ;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n }\n\n const exportPathMap = await span\n .traceChild('run-export-path-map')\n .traceAsyncFn(async () => {\n const exportMap = await nextConfig.exportPathMap(defaultPathMap, {\n dev: false,\n dir,\n outDir,\n distDir,\n buildId,\n })\n return exportMap\n })\n\n // During static export, remove export 404/500 of pages router\n // when only app router presents\n if (!options.buildExport && options.appDirOnly) {\n delete exportPathMap['/404']\n delete exportPathMap['/500']\n }\n\n // only add missing 404 page when `buildExport` is false\n if (!options.buildExport && !options.appDirOnly) {\n // only add missing /404 if not specified in `exportPathMap`\n if (!exportPathMap['/404']) {\n exportPathMap['/404'] = { page: '/_error' }\n }\n\n /**\n * exports 404.html for backwards compat\n * E.g. GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify\n */\n if (!exportPathMap['/404.html'] && exportPathMap['/404']) {\n // alias /404.html to /404 to be compatible with custom 404 / _error page\n exportPathMap['/404.html'] = exportPathMap['/404']\n }\n }\n\n const allExportPaths: ExportPathEntry[] = []\n const seenExportPaths = new Set<string>()\n const fallbackEnabledPages = new Set<string>()\n\n for (const [path, entry] of Object.entries(exportPathMap)) {\n // make sure to prevent duplicates\n const normalizedPath = denormalizePagePath(normalizePagePath(path))\n\n if (seenExportPaths.has(normalizedPath)) {\n continue\n }\n\n seenExportPaths.add(normalizedPath)\n\n if (!entry._isAppDir && isAPIRoute(entry.page)) {\n hasApiRoutes = true\n continue\n }\n\n allExportPaths.push({ ...entry, path: normalizedPath })\n\n if (prerenderManifest && !options.buildExport) {\n const prerenderInfo = prerenderManifest.dynamicRoutes[entry.page]\n\n if (prerenderInfo && prerenderInfo.fallback !== false) {\n fallbackEnabledPages.add(entry.page)\n }\n }\n }\n\n if (allExportPaths.length === 0) {\n if (!prerenderManifest) {\n return null\n }\n }\n\n if (fallbackEnabledPages.size > 0) {\n throw new ExportError(\n `Found pages with \\`fallback\\` enabled:\\n${[...fallbackEnabledPages].join(\n '\\n'\n )}\\n${SSG_FALLBACK_EXPORT_ERROR}\\n`\n )\n }\n\n let hasMiddleware = false\n\n if (!options.buildExport) {\n try {\n const middlewareManifest = require(\n join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST)\n ) as MiddlewareManifest\n\n const functionsConfigManifest = require(\n join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST)\n )\n\n hasMiddleware =\n Object.keys(middlewareManifest.middleware).length > 0 ||\n Boolean(functionsConfigManifest.functions?.['/_middleware'])\n } catch {}\n\n // Warn if the user defines a path for an API page\n if (hasApiRoutes || hasMiddleware) {\n if (nextConfig.output === 'export') {\n Log.warn(\n yellow(\n `Statically exporting a Next.js application via \\`next export\\` disables API routes and middleware.`\n ) +\n `\\n` +\n yellow(\n `This command is meant for static-only hosts, and is` +\n ' ' +\n bold(`not necessary to make your application static.`)\n ) +\n `\\n` +\n yellow(\n `Pages in your application without server-side data dependencies will be automatically statically exported by \\`next build\\`, including pages powered by \\`getStaticProps\\`.`\n ) +\n `\\n` +\n yellow(\n `Learn more: https://nextjs.org/docs/messages/api-routes-static-export`\n )\n )\n }\n }\n }\n\n const pagesDataDir = options.buildExport\n ? outDir\n : join(outDir, '_next/data', buildId)\n\n const publicDir = join(dir, CLIENT_PUBLIC_FILES_PATH)\n // Copy public directory\n if (!options.buildExport && existsSync(publicDir)) {\n if (!options.silent) {\n Log.info('Copying \"public\" directory')\n }\n await span.traceChild('copy-public-directory').traceAsyncFn(() =>\n recursiveCopy(publicDir, outDir, {\n filter(path) {\n // Exclude paths used by pages\n return !exportPathMap[path]\n },\n })\n )\n }\n\n const exportPagesInBatches = async (\n worker: StaticWorker,\n exportPaths: ExportPathEntry[],\n renderResumeDataCachesByPage?: Record<string, string>\n ): Promise<ExportPagesResult> => {\n // Batch filtered pages into smaller batches, and call the export worker on\n // each batch. We've set a default minimum of 25 pages per batch to ensure\n // that even setups with only a few static pages can leverage a shared\n // incremental cache, however this value can be configured.\n const minPageCountPerBatch =\n nextConfig.experimental.staticGenerationMinPagesPerWorker ?? 25\n\n // Calculate the number of workers needed to ensure each batch has at least\n // minPageCountPerBatch pages.\n const numWorkers = Math.min(\n options.numWorkers,\n Math.ceil(exportPaths.length / minPageCountPerBatch)\n )\n\n // Calculate the page count per batch based on the number of workers.\n const pageCountPerBatch = Math.ceil(exportPaths.length / numWorkers)\n\n const batches = Array.from({ length: numWorkers }, (_, i) =>\n exportPaths.slice(i * pageCountPerBatch, (i + 1) * pageCountPerBatch)\n )\n\n // Distribute remaining pages.\n const remainingPages = exportPaths.slice(numWorkers * pageCountPerBatch)\n remainingPages.forEach((page, index) => {\n batches[index % batches.length].push(page)\n })\n\n return (\n await Promise.all(\n batches.map(async (batch) =>\n worker.exportPages({\n buildId,\n deploymentId: nextConfig.deploymentId,\n clientAssetToken:\n nextConfig.experimental.immutableAssetToken ||\n nextConfig.deploymentId,\n exportPaths: batch,\n parentSpanId: span.getId(),\n pagesDataDir,\n renderOpts,\n options,\n dir,\n distDir,\n outDir,\n nextConfig,\n cacheHandler: nextConfig.cacheHandler,\n cacheMaxMemorySize: nextConfig.cacheMaxMemorySize,\n fetchCache: true,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n renderResumeDataCachesByPage,\n })\n )\n )\n ).flat()\n }\n\n let initialPhaseExportPaths: ExportPathEntry[] = []\n const finalPhaseExportPaths: ExportPathEntry[] = []\n\n if (renderOpts.cacheComponents) {\n for (const exportPath of allExportPaths) {\n if (exportPath._allowEmptyStaticShell) {\n finalPhaseExportPaths.push(exportPath)\n } else {\n initialPhaseExportPaths.push(exportPath)\n }\n }\n } else {\n initialPhaseExportPaths = allExportPaths\n }\n\n const totalExportPaths =\n initialPhaseExportPaths.length + finalPhaseExportPaths.length\n let worker: StaticWorker | null = null\n let results: ExportPagesResult = []\n\n if (totalExportPaths > 0) {\n const progress = createProgress(\n totalExportPaths,\n options.statusMessage ??\n `Exporting using ${options.numWorkers} worker${options.numWorkers > 1 ? 's' : ''}`\n )\n\n if (staticWorker) {\n // TODO: progress shouldn't rely on \"activity\" event sent from `exportPage`.\n staticWorker.setOnActivity(progress.run)\n staticWorker.setOnActivityAbort(progress.clear)\n worker = staticWorker\n } else {\n worker = createStaticWorker(nextConfig, {\n debuggerPortOffset: getNextBuildDebuggerPortOffset({\n kind: 'export-page',\n }),\n numberOfWorkers: options.numWorkers,\n progress,\n })\n }\n\n results = await exportPagesInBatches(worker, initialPhaseExportPaths)\n\n if (finalPhaseExportPaths.length > 0) {\n const renderResumeDataCachesByPage = buildRDCCacheByPage(\n results,\n finalPhaseExportPaths\n )\n\n const finalPhaseResults = await exportPagesInBatches(\n worker,\n finalPhaseExportPaths,\n renderResumeDataCachesByPage\n )\n\n results.push(...finalPhaseResults)\n }\n }\n\n const collector: ExportAppResult = {\n byPath: new Map(),\n byPage: new Map(),\n ssgNotFoundPaths: new Set(),\n turborepoAccessTraceResults: new Map(),\n }\n\n const failedExportAttemptsByPage: Map<string, boolean> = new Map()\n\n for (const { result, path, page, pageKey } of results) {\n if (!result) continue\n if ('error' in result) {\n failedExportAttemptsByPage.set(pageKey, true)\n continue\n }\n\n if (result.turborepoAccessTraceResult) {\n collector.turborepoAccessTraceResults?.set(\n path,\n TurborepoAccessTraceResult.fromSerialized(\n result.turborepoAccessTraceResult\n )\n )\n }\n\n if (options.buildExport) {\n // Update path info by path.\n const info = collector.byPath.get(path) ?? {}\n if (result.cacheControl) {\n info.cacheControl = result.cacheControl\n }\n if (typeof result.metadata !== 'undefined') {\n info.metadata = result.metadata\n }\n\n if (typeof result.hasEmptyStaticShell !== 'undefined') {\n info.hasEmptyStaticShell = result.hasEmptyStaticShell\n }\n\n if (typeof result.hasPostponed !== 'undefined') {\n info.hasPostponed = result.hasPostponed\n }\n\n if (typeof result.hasStaticRsc !== 'undefined') {\n info.hasStaticRsc = result.hasStaticRsc\n }\n\n if (typeof result.fetchMetrics !== 'undefined') {\n info.fetchMetrics = result.fetchMetrics\n }\n\n collector.byPath.set(path, info)\n\n // Update not found.\n if (result.ssgNotFound === true) {\n collector.ssgNotFoundPaths.add(path)\n }\n\n // Update durations.\n const durations = collector.byPage.get(page) ?? {\n durationsByPath: new Map<string, number>(),\n }\n durations.durationsByPath.set(path, result.duration)\n collector.byPage.set(page, durations)\n }\n }\n\n // Export mode provide static outputs that are not compatible with PPR mode.\n if (!options.buildExport && nextConfig.experimental.ppr) {\n // TODO: add message\n throw new Error('Invariant: PPR cannot be enabled in export mode')\n }\n\n // copy prerendered routes to outDir\n if (!options.buildExport && prerenderManifest) {\n await Promise.all(\n Object.keys(prerenderManifest.routes).map(async (unnormalizedRoute) => {\n // Special handling: map app /_not-found to 404.html (and 404/index.html when trailingSlash)\n if (unnormalizedRoute === '/_not-found') {\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const htmlSrc = `${orig}.html`\n\n // write 404.html at root\n const htmlDest404 = join(outDir, '404.html')\n await fs.mkdir(dirname(htmlDest404), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404)\n\n // When trailingSlash, also write 404/index.html\n if (subFolders) {\n const htmlDest404Index = join(outDir, '404', 'index.html')\n await fs.mkdir(dirname(htmlDest404Index), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404Index)\n }\n }\n // Skip 500.html in static export\n if (unnormalizedRoute === '/_global-error') {\n return\n }\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const isAppRouteHandler = appPageName && isAppRouteRoute(appPageName)\n\n // returning notFound: true from getStaticProps will not\n // output html/json files during the build\n if (prerenderManifest!.notFoundRoutes.includes(unnormalizedRoute)) {\n return\n }\n // TODO: This rewrites /index/foo to /index/index/foo. Investigate and\n // fix. I presume this was because normalizePagePath was designed for\n // some other use case and then reused here for static exports without\n // realizing the implications.\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n // strip leading / and then recurse number of nested dirs\n // to place from base folder\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const handlerSrc = `${orig}.body`\n const handlerDest = join(outDir, route)\n\n if (isAppRouteHandler && existsSync(handlerSrc)) {\n await fs.mkdir(dirname(handlerDest), { recursive: true })\n await fs.copyFile(handlerSrc, handlerDest)\n return\n }\n\n const htmlDest = join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.html`\n )\n const jsonDest = isAppPath\n ? join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.txt`\n )\n : join(pagesDataDir, `${route}.json`)\n\n await fs.mkdir(dirname(htmlDest), { recursive: true })\n await fs.mkdir(dirname(jsonDest), { recursive: true })\n\n const htmlSrc = `${orig}.html`\n const jsonSrc = `${orig}${isAppPath ? RSC_SUFFIX : '.json'}`\n\n await fs.copyFile(htmlSrc, htmlDest)\n await fs.copyFile(jsonSrc, jsonDest)\n\n const segmentsDir = `${orig}${RSC_SEGMENTS_DIR_SUFFIX}`\n\n if (isAppPath && existsSync(segmentsDir)) {\n // Output a data file for each of this page's segments\n //\n // These files are requested by the client router's internal\n // prefetcher, not the user directly. So we don't need to account for\n // things like trailing slash handling.\n //\n // To keep the protocol simple, we can use the non-normalized route\n // path instead of the normalized one (which, among other things,\n // rewrites `/` to `/index`).\n const segmentsDirDest = join(outDir, unnormalizedRoute)\n const segmentPaths = await collectSegmentPaths(segmentsDir)\n await Promise.all(\n segmentPaths.map(async (segmentFileSrc) => {\n const segmentPath =\n '/' + segmentFileSrc.slice(0, -RSC_SEGMENT_SUFFIX.length)\n const segmentFilename =\n convertSegmentPathToStaticExportFilename(segmentPath)\n const segmentFileDest = join(segmentsDirDest, segmentFilename)\n await fs.mkdir(dirname(segmentFileDest), { recursive: true })\n await fs.copyFile(\n join(segmentsDir, segmentFileSrc),\n segmentFileDest\n )\n })\n )\n }\n })\n )\n }\n\n if (failedExportAttemptsByPage.size > 0) {\n const failedPages = Array.from(failedExportAttemptsByPage.keys())\n throw new ExportError(\n `Export encountered errors on ${failedPages.length} ${failedPages.length === 1 ? 'path' : 'paths'}:\\n\\t${failedPages\n .sort()\n .join('\\n\\t')}`\n )\n }\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: true,\n }),\n 'utf8'\n )\n\n if (telemetry) {\n await telemetry.flush()\n }\n\n // Clean up activity listeners for progress.\n if (staticWorker) {\n staticWorker.setOnActivity(undefined)\n staticWorker.setOnActivityAbort(undefined)\n }\n\n if (!staticWorker && worker) {\n await worker.end()\n }\n\n return collector\n}\n\nasync function collectSegmentPaths(segmentsDirectory: string) {\n const results: Array<string> = []\n await collectSegmentPathsImpl(segmentsDirectory, segmentsDirectory, results)\n return results\n}\n\nasync function collectSegmentPathsImpl(\n segmentsDirectory: string,\n directory: string,\n results: Array<string>\n) {\n const segmentFiles = await fs.readdir(directory, {\n withFileTypes: true,\n })\n await Promise.all(\n segmentFiles.map(async (segmentFile) => {\n if (segmentFile.isDirectory()) {\n await collectSegmentPathsImpl(\n segmentsDirectory,\n join(directory, segmentFile.name),\n results\n )\n return\n }\n if (!segmentFile.name.endsWith(RSC_SEGMENT_SUFFIX)) {\n return\n }\n results.push(\n relative(segmentsDirectory, join(directory, segmentFile.name))\n )\n })\n )\n}\n\nexport default async function exportApp(\n dir: string,\n options: ExportAppOptions,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n const nextExportSpan = span.traceChild('next-export')\n\n return nextExportSpan.traceAsyncFn(async () => {\n return await exportAppImpl(dir, options, nextExportSpan, staticWorker)\n })\n}\n"],"names":["createStaticWorker","bold","yellow","findUp","existsSync","promises","fs","dirname","join","resolve","sep","relative","Log","RSC_SEGMENT_SUFFIX","RSC_SEGMENTS_DIR_SUFFIX","RSC_SUFFIX","SSG_FALLBACK_EXPORT_ERROR","recursiveCopy","BUILD_ID_FILE","CLIENT_PUBLIC_FILES_PATH","CLIENT_STATIC_FILES_PATH","EXPORT_DETAIL","EXPORT_MARKER","NEXT_FONT_MANIFEST","MIDDLEWARE_MANIFEST","PAGES_MANIFEST","PHASE_EXPORT","PRERENDER_MANIFEST","SERVER_DIRECTORY","SERVER_REFERENCE_MANIFEST","APP_PATH_ROUTES_MANIFEST","ROUTES_MANIFEST","FUNCTIONS_CONFIG_MANIFEST","loadConfig","parseMaxPostponedStateSize","eventCliSession","hasNextSupport","Telemetry","normalizePagePath","denormalizePagePath","loadEnvConfig","isAPIRoute","getPagePath","isAppRouteRoute","isAppPageRoute","isError","formatManifest","TurborepoAccessTraceResult","createProgress","isInterceptionRouteRewrite","extractInfoFromServerReferenceId","convertSegmentPathToStaticExportFilename","getNextBuildDebuggerPortOffset","getParams","isDynamicRoute","normalizeAppPath","ExportError","Error","code","buildRDCCacheByPage","results","finalPhaseExportPaths","renderResumeDataCachesByPage","seedCandidatesByPage","Map","page","path","result","renderResumeDataCache","candidates","get","push","set","undefined","getKnownParamsKey","normalizedPage","fallbackParamNames","params","entries","Object","filter","key","has","sort","a","b","JSON","stringify","exportPath","_fallbackRouteParams","pageKey","Set","map","param","paramName","targetKey","length","selected","candidate","candidateKey","exportAppImpl","dir","options","span","staticWorker","traceChild","traceFn","enabledDirectories","nextConfig","traceAsyncFn","debugPrerender","distDir","telemetry","buildExport","record","webpackVersion","cliCommand","isSrcDir","hasNowJson","cwd","isCustomServer","turboFlag","pagesDir","appDir","subFolders","trailingSlash","silent","info","buildIdFile","customRoutes","config","warn","buildId","readFile","pagesManifest","pages","require","prerenderManifest","appRoutePathManifest","err","excludedPrerenderRoutes","keys","defaultPathMap","hasApiRoutes","dynamicRoutes","add","mapAppRouteToPage","pageName","routePath","routes","_isAppDir","outDir","outdir","rm","recursive","force","mkdir","writeFile","version","outDirectory","success","exportPathMap","defaultMap","i18n","images","loader","unoptimized","isNextImageImported","then","text","parse","catch","serverActionsManifest","app","output","routesManifest","rewrites","beforeFiles","hasInterceptionRouteRewrite","some","actionIds","node","edge","actionId","type","renderOpts","previewProps","preview","isBuildTimePrerendering","assetPrefix","replace","basePath","cacheComponents","locales","locale","defaultLocale","domainLocales","domains","disableOptimizedLoading","experimental","supportsDynamicResponse","crossOrigin","optimizeCss","nextConfigOutput","nextScriptWorkers","largePageDataBytes","serverActions","serverComponents","cacheLifeProfiles","cacheLife","nextFontManifest","htmlLimitedBots","source","clientTraceMetadata","expireTime","staleTimes","clientParamParsingOrigins","dynamicOnHover","optimisticRouting","inlineCss","prefetchInlining","authInterrupts","maxPostponedStateSizeBytes","maxPostponedStateSize","reactMaxHeadersLength","globalThis","__NEXT_DATA__","nextExport","exportMap","dev","appDirOnly","allExportPaths","seenExportPaths","fallbackEnabledPages","entry","normalizedPath","prerenderInfo","fallback","size","hasMiddleware","functionsConfigManifest","middlewareManifest","middleware","Boolean","functions","pagesDataDir","publicDir","exportPagesInBatches","worker","exportPaths","minPageCountPerBatch","staticGenerationMinPagesPerWorker","numWorkers","Math","min","ceil","pageCountPerBatch","batches","Array","from","_","i","slice","remainingPages","forEach","index","Promise","all","batch","exportPages","deploymentId","clientAssetToken","immutableAssetToken","parentSpanId","getId","cacheHandler","cacheMaxMemorySize","fetchCache","fetchCacheKeyPrefix","flat","initialPhaseExportPaths","_allowEmptyStaticShell","totalExportPaths","progress","statusMessage","setOnActivity","run","setOnActivityAbort","clear","debuggerPortOffset","kind","numberOfWorkers","finalPhaseResults","collector","byPath","byPage","ssgNotFoundPaths","turborepoAccessTraceResults","failedExportAttemptsByPage","turborepoAccessTraceResult","fromSerialized","cacheControl","metadata","hasEmptyStaticShell","hasPostponed","hasStaticRsc","fetchMetrics","ssgNotFound","durations","durationsByPath","duration","ppr","unnormalizedRoute","srcRoute","appPageName","isAppPath","route","pagePath","distPagesDir","split","orig","htmlSrc","htmlDest404","copyFile","htmlDest404Index","isAppRouteHandler","notFoundRoutes","includes","handlerSrc","handlerDest","htmlDest","jsonDest","jsonSrc","segmentsDir","segmentsDirDest","segmentPaths","collectSegmentPaths","segmentFileSrc","segmentPath","segmentFilename","segmentFileDest","failedPages","flush","end","segmentsDirectory","collectSegmentPathsImpl","directory","segmentFiles","readdir","withFileTypes","segmentFile","isDirectory","name","endsWith","exportApp","nextExportSpan"],"mappings":"AAOA,SACEA,kBAAkB,QAGb,WAAU;AAGjB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAmB;AAChD,OAAOC,YAAY,6BAA4B;AAC/C,SAASC,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAE/C,OAAO,yBAAwB;AAE/B,SAASC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,GAAG,EAAEC,QAAQ,QAAQ,OAAM;AAC5D,YAAYC,SAAS,sBAAqB;AAC1C,SACEC,kBAAkB,EAClBC,uBAAuB,EACvBC,UAAU,EACVC,yBAAyB,QACpB,mBAAkB;AACzB,SAASC,aAAa,QAAQ,wBAAuB;AACrD,SACEC,aAAa,EACbC,wBAAwB,EACxBC,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AAEJ;AAEA,eAAe,eAAeE,UAC5B7P,GAAW,EACXC,OAAyB,EACzBC,IAAU,EACVC,YAA2B;IAE3B,MAAM2P,iBAAiB5P,KAAKE,UAAU,CAAC;IAEvC,OAAO0P,eAAetP,YAAY,CAAC;QACjC,OAAO,MAAMT,cAAcC,KAAKC,SAAS6P,gBAAgB3P;IAC3D;AACF","ignoreList":[0]}

@@ -41,8 +41,3 @@ import { NEXT_URL } from '../client/components/app-router-headers';

}
export function isInterceptionRouteRewrite(route) {
var _route_has_, _route_has;
// When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.
return ((_route_has = route.has) == null ? void 0 : (_route_has_ = _route_has[0]) == null ? void 0 : _route_has_.key) === NEXT_URL;
}
//# sourceMappingURL=generate-interception-routes-rewrites.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../src/lib/generate-interception-routes-rewrites.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../shared/lib/router/utils/interception-routes'\nimport type { Rewrite } from './load-custom-routes'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex'\n\nexport function generateInterceptionRoutesRewrites(\n appPaths: string[],\n basePath = ''\n): Rewrite[] {\n const rewrites: Rewrite[] = []\n\n for (const appPath of appPaths) {\n if (isInterceptionRouteAppPath(appPath)) {\n const { interceptingRoute, interceptedRoute } =\n extractInterceptionRouteInformation(appPath)\n\n const destination = getNamedRouteRegex(basePath + appPath, {\n prefixRouteKeys: true,\n })\n\n const header = getNamedRouteRegex(interceptingRoute, {\n prefixRouteKeys: true,\n reference: destination.reference,\n })\n\n const source = getNamedRouteRegex(basePath + interceptedRoute, {\n prefixRouteKeys: true,\n reference: header.reference,\n })\n\n const headerRegex = header.namedRegex\n // Strip ^ and $ anchors since matchHas() will add them automatically\n .replace(/^\\^/, '')\n .replace(/\\$$/, '')\n // Replace matching the `/` with matching any route segment.\n .replace(/^\\/\\(\\?:\\/\\)\\?$/, '/.*')\n // Replace the optional trailing with slash capture group with one that\n // will match any descendants.\n .replace(/\\(\\?:\\/\\)\\?$/, '(?:/.*)?')\n\n rewrites.push({\n source: source.pathToRegexpPattern,\n destination: destination.pathToRegexpPattern,\n has: [\n {\n type: 'header',\n key: NEXT_URL,\n value: headerRegex,\n },\n ],\n regex: source.namedRegex,\n })\n }\n }\n\n return rewrites\n}\n\nexport function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>) {\n // When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.\n return route.has?.[0]?.key === NEXT_URL\n}\n"],"names":["NEXT_URL","extractInterceptionRouteInformation","isInterceptionRouteAppPath","getNamedRouteRegex","generateInterceptionRoutesRewrites","appPaths","basePath","rewrites","appPath","interceptingRoute","interceptedRoute","destination","prefixRouteKeys","header","reference","source","headerRegex","namedRegex","replace","push","pathToRegexpPattern","has","type","key","value","regex","isInterceptionRouteRewrite","route"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0CAAyC;AAClE,SACEC,mCAAmC,EACnCC,0BAA0B,QACrB,iDAAgD;AAGvD,SAASC,kBAAkB,QAAQ,yCAAwC;AAE3E,OAAO,SAASC,mCACdC,QAAkB,EAClBC,WAAW,EAAE;IAEb,MAAMC,WAAsB,EAAE;IAE9B,KAAK,MAAMC,WAAWH,SAAU;QAC9B,IAAIH,2BAA2BM,UAAU;YACvC,MAAM,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAE,GAC3CT,oCAAoCO;YAEtC,MAAMG,cAAcR,mBAAmBG,WAAWE,SAAS;gBACzDI,iBAAiB;YACnB;YAEA,MAAMC,SAASV,mBAAmBM,mBAAmB;gBACnDG,iBAAiB;gBACjBE,WAAWH,YAAYG,SAAS;YAClC;YAEA,MAAMC,SAASZ,mBAAmBG,WAAWI,kBAAkB;gBAC7DE,iBAAiB;gBACjBE,WAAWD,OAAOC,SAAS;YAC7B;YAEA,MAAME,cAAcH,OAAOI,UAAU,AACnC,qEAAqE;aACpEC,OAAO,CAAC,OAAO,IACfA,OAAO,CAAC,OAAO,GAChB,4DAA4D;aAC3DA,OAAO,CAAC,mBAAmB,MAC5B,uEAAuE;YACvE,8BAA8B;aAC7BA,OAAO,CAAC,gBAAgB;YAE3BX,SAASY,IAAI,CAAC;gBACZJ,QAAQA,OAAOK,mBAAmB;gBAClCT,aAAaA,YAAYS,mBAAmB;gBAC5CC,KAAK;oBACH;wBACEC,MAAM;wBACNC,KAAKvB;wBACLwB,OAAOR;oBACT;iBACD;gBACDS,OAAOV,OAAOE,UAAU;YAC1B;QACF;IACF;IAEA,OAAOV;AACT;AAEA,OAAO,SAASmB,2BAA2BC,KAA4B;QAE9DA,aAAAA;IADP,0HAA0H;IAC1H,OAAOA,EAAAA,aAAAA,MAAMN,GAAG,sBAATM,cAAAA,UAAW,CAAC,EAAE,qBAAdA,YAAgBJ,GAAG,MAAKvB;AACjC","ignoreList":[0]}
{"version":3,"sources":["../../../src/lib/generate-interception-routes-rewrites.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../shared/lib/router/utils/interception-routes'\nimport type { Rewrite } from './load-custom-routes'\nimport { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex'\n\nexport function generateInterceptionRoutesRewrites(\n appPaths: string[],\n basePath = ''\n): Rewrite[] {\n const rewrites: Rewrite[] = []\n\n for (const appPath of appPaths) {\n if (isInterceptionRouteAppPath(appPath)) {\n const { interceptingRoute, interceptedRoute } =\n extractInterceptionRouteInformation(appPath)\n\n const destination = getNamedRouteRegex(basePath + appPath, {\n prefixRouteKeys: true,\n })\n\n const header = getNamedRouteRegex(interceptingRoute, {\n prefixRouteKeys: true,\n reference: destination.reference,\n })\n\n const source = getNamedRouteRegex(basePath + interceptedRoute, {\n prefixRouteKeys: true,\n reference: header.reference,\n })\n\n const headerRegex = header.namedRegex\n // Strip ^ and $ anchors since matchHas() will add them automatically\n .replace(/^\\^/, '')\n .replace(/\\$$/, '')\n // Replace matching the `/` with matching any route segment.\n .replace(/^\\/\\(\\?:\\/\\)\\?$/, '/.*')\n // Replace the optional trailing with slash capture group with one that\n // will match any descendants.\n .replace(/\\(\\?:\\/\\)\\?$/, '(?:/.*)?')\n\n rewrites.push({\n source: source.pathToRegexpPattern,\n destination: destination.pathToRegexpPattern,\n has: [\n {\n type: 'header',\n key: NEXT_URL,\n value: headerRegex,\n },\n ],\n regex: source.namedRegex,\n })\n }\n }\n\n return rewrites\n}\n"],"names":["NEXT_URL","extractInterceptionRouteInformation","isInterceptionRouteAppPath","getNamedRouteRegex","generateInterceptionRoutesRewrites","appPaths","basePath","rewrites","appPath","interceptingRoute","interceptedRoute","destination","prefixRouteKeys","header","reference","source","headerRegex","namedRegex","replace","push","pathToRegexpPattern","has","type","key","value","regex"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0CAAyC;AAClE,SACEC,mCAAmC,EACnCC,0BAA0B,QACrB,iDAAgD;AAEvD,SAASC,kBAAkB,QAAQ,yCAAwC;AAE3E,OAAO,SAASC,mCACdC,QAAkB,EAClBC,WAAW,EAAE;IAEb,MAAMC,WAAsB,EAAE;IAE9B,KAAK,MAAMC,WAAWH,SAAU;QAC9B,IAAIH,2BAA2BM,UAAU;YACvC,MAAM,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAE,GAC3CT,oCAAoCO;YAEtC,MAAMG,cAAcR,mBAAmBG,WAAWE,SAAS;gBACzDI,iBAAiB;YACnB;YAEA,MAAMC,SAASV,mBAAmBM,mBAAmB;gBACnDG,iBAAiB;gBACjBE,WAAWH,YAAYG,SAAS;YAClC;YAEA,MAAMC,SAASZ,mBAAmBG,WAAWI,kBAAkB;gBAC7DE,iBAAiB;gBACjBE,WAAWD,OAAOC,SAAS;YAC7B;YAEA,MAAME,cAAcH,OAAOI,UAAU,AACnC,qEAAqE;aACpEC,OAAO,CAAC,OAAO,IACfA,OAAO,CAAC,OAAO,GAChB,4DAA4D;aAC3DA,OAAO,CAAC,mBAAmB,MAC5B,uEAAuE;YACvE,8BAA8B;aAC7BA,OAAO,CAAC,gBAAgB;YAE3BX,SAASY,IAAI,CAAC;gBACZJ,QAAQA,OAAOK,mBAAmB;gBAClCT,aAAaA,YAAYS,mBAAmB;gBAC5CC,KAAK;oBACH;wBACEC,MAAM;wBACNC,KAAKvB;wBACLwB,OAAOR;oBACT;iBACD;gBACDS,OAAOV,OAAOE,UAAU;YAC1B;QACF;IACF;IAEA,OAAOV;AACT","ignoreList":[0]}

@@ -20,3 +20,3 @@ import { promises } from 'fs';

const data = await res.json();
const versionData = data.versions["16.2.0-canary.72"];
const versionData = data.versions["16.2.0-canary.73"];
return {

@@ -54,3 +54,3 @@ os: versionData.os,

lockfileParsed.dependencies[pkg] = {
version: "16.2.0-canary.72",
version: "16.2.0-canary.73",
resolved: pkgData.tarball,

@@ -63,3 +63,3 @@ integrity: pkgData.integrity,

lockfileParsed.packages[pkg] = {
version: "16.2.0-canary.72",
version: "16.2.0-canary.73",
resolved: pkgData.tarball,

@@ -66,0 +66,0 @@ integrity: pkgData.integrity,

@@ -225,3 +225,6 @@ import os from 'os';

clientParamParsingOrigins: ex.clientParamParsingOrigins,
adapterPath: ex.adapterPath,
// The full adapterPath might be non-deterministic across builds and doesn't actually matter
// at runtime, as it's only used to determine whether the adapter was used or not, not to
// execute it again. So replace it with a placeholder if it's set.
adapterPath: ex.adapterPath ? '<ommited but set>' : undefined,
allowedRevalidateHeaderKeys: ex.allowedRevalidateHeaderKeys,

@@ -228,0 +231,0 @@ fetchCacheKeyPrefix: ex.fetchCacheKeyPrefix,

@@ -24,3 +24,3 @@ import { loadEnvConfig } from '@next/env';

}
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"16.2.0-canary.72"}`))}${versionSuffix}`);
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"16.2.0-canary.73"}`))}${versionSuffix}`);
if (appUrl) {

@@ -27,0 +27,0 @@ Log.bootstrap(`- Local: ${appUrl}`);

@@ -113,3 +113,3 @@ // Start CPU profile if it wasn't already started.

let { port } = serverOptions;
process.title = `next-server (v${"16.2.0-canary.72"})`;
process.title = `next-server (v${"16.2.0-canary.73"})`;
let handlersReady = ()=>{};

@@ -116,0 +116,0 @@ let handlersError = ()=>{};

@@ -25,3 +25,3 @@ import '../../build/adapter/setup-node-env.external';

import { removeTrailingSlash } from '../../shared/lib/router/utils/remove-trailing-slash';
import { isInterceptionRouteRewrite } from '../../lib/generate-interception-routes-rewrites';
import { isInterceptionRouteRewrite } from '../../lib/is-interception-route-rewrite';
const dynamicImportEsmDefault = (id)=>import(/* webpackIgnore: true */ /* turbopackIgnore: true */ id).then((mod)=>mod.default || mod);

@@ -28,0 +28,0 @@ /**

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../src/server/route-modules/route-module.ts"],"sourcesContent":["import '../../build/adapter/setup-node-env.external'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport type {\n InstrumentationOnRequestError,\n RequestErrorContext,\n} from '../instrumentation/types'\nimport type { ParsedUrlQuery } from 'node:querystring'\nimport type { UrlWithParsedQuery } from 'node:url'\nimport type {\n PrerenderManifest,\n RequiredServerFilesManifest,\n} from '../../build'\nimport type { DevRoutesManifest } from '../lib/router-utils/setup-dev-bundler'\nimport type { RouteDefinition } from '../route-definitions/route-definition'\nimport type { DeepReadonly } from '../../shared/lib/deep-readonly'\nimport {\n BUILD_ID_FILE,\n BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n NEXT_FONT_MANIFEST,\n PRERENDER_MANIFEST,\n REACT_LOADABLE_MANIFEST,\n ROUTES_MANIFEST,\n SERVER_FILES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n} from '../../shared/lib/constants'\nimport { parseReqUrl } from '../../lib/url'\nimport {\n normalizeLocalePath,\n type PathLocale,\n} from '../../shared/lib/i18n/normalize-locale-path'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\nimport { removePathPrefix } from '../../shared/lib/router/utils/remove-path-prefix'\nimport { getServerUtils } from '../server-utils'\nimport { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'\nimport { getHostname } from '../../shared/lib/get-hostname'\nimport { checkIsOnDemandRevalidate } from '../api-utils'\nimport type { PreviewData } from '../../types'\nimport type { BuildManifest } from '../get-page-files'\nimport type { ReactLoadableManifest } from '../load-components'\nimport type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin'\nimport { normalizeDataPath } from '../../shared/lib/page-path/normalize-data-path'\nimport { pathHasPrefix } from '../../shared/lib/router/utils/path-has-prefix'\nimport {\n addRequestMeta,\n getRequestMeta,\n type NextIncomingMessage,\n} from '../request-meta'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isStaticMetadataRoute } from '../../lib/metadata/is-metadata-route'\nimport { IncrementalCache } from '../lib/incremental-cache'\nimport { initializeCacheHandlers, setCacheHandler } from '../use-cache/handlers'\nimport { interopDefault } from '../app-render/interop-default'\nimport { RouteKind } from '../route-kind'\nimport type { BaseNextRequest } from '../base-http'\nimport type { I18NConfig, NextConfigRuntime } from '../config-shared'\nimport ResponseCache, { type ResponseGenerator } from '../response-cache'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport {\n RouterServerContextSymbol,\n routerServerGlobal,\n type RouterServerContext,\n} from '../lib/router-utils/router-server-context'\nimport { decodePathParams } from '../lib/router-utils/decode-path-params'\nimport { removeTrailingSlash } from '../../shared/lib/router/utils/remove-trailing-slash'\nimport { isInterceptionRouteRewrite } from '../../lib/generate-interception-routes-rewrites'\n\n/**\n * RouteModuleOptions is the options that are passed to the route module, other\n * route modules should extend this class to add specific options for their\n * route.\n */\nexport interface RouteModuleOptions<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n readonly definition: Readonly<D>\n readonly userland: Readonly<U>\n readonly distDir: string\n readonly relativeProjectDir: string\n}\n\n/**\n * RouteHandlerContext is the base context for a route handler.\n */\nexport interface RouteModuleHandleContext {\n /**\n * Any matched parameters for the request. This is only defined for dynamic\n * routes.\n */\n params: Record<string, string | string[] | undefined> | undefined\n}\n\nconst dynamicImportEsmDefault = (id: string) =>\n import(/* webpackIgnore: true */ /* turbopackIgnore: true */ id).then(\n (mod) => mod.default || mod\n )\n\n/**\n * RouteModule is the base class for all route modules. This class should be\n * extended by all route modules.\n */\nexport abstract class RouteModule<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n /**\n * The userland module. This is the module that is exported from the user's\n * code. This is marked as readonly to ensure that the module is not mutated\n * because the module (when compiled) only provides getters.\n */\n public readonly userland: Readonly<U>\n\n /**\n * The definition of the route.\n */\n public readonly definition: Readonly<D>\n\n /**\n * The shared modules that are exposed and required for the route module.\n */\n public static readonly sharedModules: any\n\n public isDev: boolean\n public distDir: string\n public relativeProjectDir: string\n public incrementCache?: IncrementalCache\n public responseCache?: ResponseCache\n\n constructor({\n userland,\n definition,\n distDir,\n relativeProjectDir,\n }: RouteModuleOptions<D, U>) {\n this.userland = userland\n this.definition = definition\n this.isDev = !!process.env.__NEXT_DEV_SERVER\n this.distDir = distDir\n this.relativeProjectDir = relativeProjectDir\n }\n\n public normalizeUrl(\n _req: IncomingMessage | BaseNextRequest,\n _parsedUrl: UrlWithParsedQuery\n ) {}\n\n public async instrumentationOnRequestError(\n req: IncomingMessage | BaseNextRequest,\n ...args: Parameters<InstrumentationOnRequestError>\n ) {\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgeInstrumentationModule } = await import('../web/globals')\n const instrumentation = await getEdgeInstrumentationModule()\n\n if (instrumentation) {\n await instrumentation.onRequestError?.(...args)\n }\n } else {\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const { instrumentationOnRequestError } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n\n return instrumentationOnRequestError(\n absoluteProjectDir,\n this.distDir,\n ...args\n )\n }\n }\n\n private loadManifests(\n srcPage: string,\n projectDir?: string\n ): {\n buildId: string\n buildManifest: BuildManifest\n fallbackBuildManifest: BuildManifest\n routesManifest: DeepReadonly<DevRoutesManifest>\n nextFontManifest: DeepReadonly<NextFontManifest>\n prerenderManifest: DeepReadonly<PrerenderManifest>\n serverFilesManifest: DeepReadonly<RequiredServerFilesManifest> | undefined\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n subresourceIntegrityManifest: any\n clientReferenceManifest: any\n serverActionsManifest: any\n dynamicCssManifest: any\n interceptionRoutePatterns: RegExp[]\n } {\n let result\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgePreviewProps } =\n require('../web/get-edge-preview-props') as typeof import('../web/get-edge-preview-props')\n\n const maybeJSONParse = (str?: string) =>\n str ? JSON.parse(str) : undefined\n\n result = {\n buildId: process.env.__NEXT_BUILD_ID || '',\n buildManifest: self.__BUILD_MANIFEST as any,\n fallbackBuildManifest: {} as any,\n reactLoadableManifest: maybeJSONParse(self.__REACT_LOADABLE_MANIFEST),\n nextFontManifest: maybeJSONParse(self.__NEXT_FONT_MANIFEST),\n prerenderManifest: {\n routes: {},\n dynamicRoutes: {},\n notFoundRoutes: [],\n version: 4,\n preview: getEdgePreviewProps(),\n } as const,\n routesManifest: {\n version: 4,\n caseSensitive: Boolean(process.env.__NEXT_CASE_SENSITIVE_ROUTES),\n basePath: process.env.__NEXT_BASE_PATH || '',\n rewrites: (process.env.__NEXT_REWRITES as any) || {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n redirects: [],\n headers: [],\n onMatchHeaders: [],\n i18n:\n (process.env.__NEXT_I18N_CONFIG as any as I18NConfig) || undefined,\n skipProxyUrlNormalize: Boolean(\n process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ),\n },\n serverFilesManifest: self.__SERVER_FILES_MANIFEST,\n clientReferenceManifest: self.__RSC_MANIFEST?.[srcPage],\n serverActionsManifest: maybeJSONParse(self.__RSC_SERVER_MANIFEST),\n subresourceIntegrityManifest: maybeJSONParse(\n self.__SUBRESOURCE_INTEGRITY_MANIFEST\n ),\n dynamicCssManifest: maybeJSONParse(self.__DYNAMIC_CSS_MANIFEST),\n interceptionRoutePatterns: (\n maybeJSONParse(self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST) ?? []\n ).map((rewrite: any) => new RegExp(rewrite.regex)),\n }\n } else {\n if (!projectDir) {\n throw new Error('Invariant: projectDir is required for node runtime')\n }\n const { loadManifestFromRelativePath } =\n require('../load-manifest.external') as typeof import('../load-manifest.external')\n const normalizedPagePath = normalizePagePath(srcPage)\n\n const router =\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ? 'pages'\n : 'app'\n\n const [\n routesManifest,\n prerenderManifest,\n buildManifest,\n fallbackBuildManifest,\n reactLoadableManifest,\n nextFontManifest,\n clientReferenceManifest,\n serverActionsManifest,\n subresourceIntegrityManifest,\n serverFilesManifest,\n buildId,\n dynamicCssManifest,\n ] = [\n loadManifestFromRelativePath<DevRoutesManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: ROUTES_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<PrerenderManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: PRERENDER_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<BuildManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_MANIFEST,\n shouldCache: !this.isDev,\n }),\n srcPage === '/_error'\n ? loadManifestFromRelativePath<BuildManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: `fallback-${BUILD_MANIFEST}`,\n shouldCache: !this.isDev,\n handleMissing: true,\n })\n : ({} as BuildManifest),\n loadManifestFromRelativePath<ReactLoadableManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: process.env.TURBOPACK\n ? `server/${router === 'app' ? 'app' : 'pages'}${normalizedPagePath}/${REACT_LOADABLE_MANIFEST}`\n : REACT_LOADABLE_MANIFEST,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<NextFontManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${NEXT_FONT_MANIFEST}.json`,\n shouldCache: !this.isDev,\n }),\n router === 'app' && !isStaticMetadataRoute(srcPage)\n ? loadManifestFromRelativePath({\n distDir: this.distDir,\n projectDir,\n useEval: true,\n handleMissing: true,\n manifest: `server/app${srcPage.replace(/%5F/g, '_') + '_' + CLIENT_REFERENCE_MANIFEST}.js`,\n shouldCache: !this.isDev,\n })\n : undefined,\n router === 'app'\n ? loadManifestFromRelativePath<any>({\n distDir: this.distDir,\n projectDir,\n manifest: `server/${SERVER_REFERENCE_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n })\n : {},\n loadManifestFromRelativePath<Record<string, string>>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n this.isDev\n ? undefined\n : loadManifestFromRelativePath<RequiredServerFilesManifest>({\n projectDir,\n distDir: this.distDir,\n shouldCache: true,\n manifest: `${SERVER_FILES_MANIFEST}.json`,\n }),\n this.isDev\n ? 'development'\n : loadManifestFromRelativePath<any>({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_ID_FILE,\n skipParse: true,\n shouldCache: true,\n }),\n loadManifestFromRelativePath<any>({\n projectDir,\n distDir: this.distDir,\n manifest: DYNAMIC_CSS_MANIFEST,\n shouldCache: !this.isDev,\n handleMissing: true,\n }),\n ]\n\n result = {\n buildId,\n buildManifest,\n fallbackBuildManifest,\n routesManifest,\n nextFontManifest,\n prerenderManifest,\n serverFilesManifest,\n reactLoadableManifest,\n clientReferenceManifest: (clientReferenceManifest as any)\n ?.__RSC_MANIFEST?.[srcPage.replace(/%5F/g, '_')],\n serverActionsManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n interceptionRoutePatterns: routesManifest.rewrites.beforeFiles\n .filter(isInterceptionRouteRewrite)\n .map((rewrite) => new RegExp(rewrite.regex)),\n }\n }\n\n return result\n }\n\n public async loadCustomCacheHandlers(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime\n ) {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { cacheMaxMemorySize, cacheHandlers } = nextConfig\n if (!cacheHandlers) return\n\n // If we've already initialized the cache handlers interface, don't do it\n // again.\n if (!initializeCacheHandlers(cacheMaxMemorySize)) return\n\n for (const [kind, handler] of Object.entries(cacheHandlers)) {\n if (!handler) continue\n\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n setCacheHandler(\n kind,\n interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(\n `${absoluteProjectDir}/${this.distDir}`,\n handler\n )\n )\n )\n )\n }\n }\n }\n\n public async getIncrementalCache(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime,\n prerenderManifest: DeepReadonly<PrerenderManifest>,\n isMinimalMode: boolean\n ): Promise<IncrementalCache> {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return (globalThis as any).__incrementalCache\n } else {\n let CacheHandler: any\n const { cacheHandler } = nextConfig\n\n if (cacheHandler) {\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n CacheHandler = interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(this.distDir, cacheHandler)\n )\n )\n }\n const { join } = require('node:path') as typeof import('node:path')\n const projectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n await this.loadCustomCacheHandlers(req, nextConfig)\n\n // incremental-cache is request specific\n // although can have shared caches in module scope\n // per-cache handler\n const incrementalCache = new IncrementalCache({\n fs: (\n require('../lib/node-fs-methods') as typeof import('../lib/node-fs-methods')\n ).nodeFs,\n dev: this.isDev,\n requestHeaders: req.headers,\n allowedRevalidateHeaderKeys:\n nextConfig.experimental.allowedRevalidateHeaderKeys,\n minimalMode: isMinimalMode,\n serverDistDir: `${projectDir}/${this.distDir}/server`,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n maxMemoryCacheSize: nextConfig.cacheMaxMemorySize,\n flushToDisk: !isMinimalMode && nextConfig.experimental.isrFlushToDisk,\n getPrerenderManifest: () => prerenderManifest,\n CurCacheHandler: CacheHandler,\n })\n\n // we need to expose this on globalThis as the app-render\n // workStore grabs the incrementalCache from there\n ;(globalThis as any).__incrementalCache = incrementalCache\n return incrementalCache\n }\n }\n\n public async onRequestError(\n req: IncomingMessage | BaseNextRequest,\n err: unknown,\n errorContext: RequestErrorContext,\n silenceLog: boolean,\n routerServerContext?: RouterServerContext[string]\n ) {\n if (!silenceLog) {\n if (routerServerContext?.logErrorWithOriginalStack) {\n routerServerContext.logErrorWithOriginalStack(err, 'app-dir')\n } else {\n console.error(err)\n }\n }\n await this.instrumentationOnRequestError(\n req,\n err,\n {\n path: req.url || '/',\n headers: req.headers,\n method: req.method || 'GET',\n },\n errorContext\n )\n }\n\n /** A more lightweight version of `prepare()` for only retrieving the config on edge */\n public getNextConfigEdge(req: NextIncomingMessage): {\n nextConfig: NextConfigRuntime\n deploymentId: string\n } {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n throw new Error(\n 'Invariant: getNextConfigEdge must only be called in edge runtime'\n )\n }\n\n let serverFilesManifest = self.__SERVER_FILES_MANIFEST as any as\n | RequiredServerFilesManifest\n | undefined\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return { nextConfig, deploymentId }\n }\n\n public async prepare(\n req: IncomingMessage | BaseNextRequest,\n res: ServerResponse | null,\n {\n srcPage,\n multiZoneDraftMode,\n }: {\n srcPage: string\n multiZoneDraftMode?: boolean\n }\n ): Promise<\n | {\n buildId: string\n deploymentId: string\n clientAssetToken: string\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n query: ParsedUrlQuery\n originalQuery: ParsedUrlQuery\n originalPathname: string\n params?: ParsedUrlQuery\n parsedUrl: UrlWithParsedQuery\n previewData: PreviewData\n pageIsDynamic: boolean\n isDraftMode: boolean\n resolvedPathname: string\n encodedResolvedPathname: string\n isNextDataRequest: boolean\n buildManifest: DeepReadonly<BuildManifest>\n fallbackBuildManifest: DeepReadonly<BuildManifest>\n nextFontManifest: DeepReadonly<NextFontManifest>\n serverFilesManifest:\n | DeepReadonly<RequiredServerFilesManifest>\n | undefined\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n routesManifest: DeepReadonly<DevRoutesManifest>\n prerenderManifest: DeepReadonly<PrerenderManifest>\n // we can't pull in the client reference type or it causes issues with\n // our pre-compiled types\n clientReferenceManifest?: any\n serverActionsManifest?: any\n dynamicCssManifest?: any\n subresourceIntegrityManifest?: DeepReadonly<Record<string, string>>\n isOnDemandRevalidate: boolean\n revalidateOnlyGenerated: boolean\n nextConfig: NextConfigRuntime\n routerServerContext?: RouterServerContext[string]\n interceptionRoutePatterns?: any\n }\n | undefined\n > {\n let absoluteProjectDir: string | undefined\n\n // edge runtime handles loading instrumentation at the edge adapter level\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { join, relative } =\n require('node:path') as typeof import('node:path')\n\n absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const absoluteDistDir = getRequestMeta(req, 'distDir')\n\n if (absoluteDistDir) {\n this.distDir = relative(absoluteProjectDir, absoluteDistDir)\n }\n const { ensureInstrumentationRegistered } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n // ensure instrumentation is registered and pass\n // onRequestError below\n ensureInstrumentationRegistered(absoluteProjectDir, this.distDir)\n }\n const manifests = this.loadManifests(srcPage, absoluteProjectDir)\n const { routesManifest, prerenderManifest, serverFilesManifest } = manifests\n\n const { basePath, i18n, rewrites } = routesManifest\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n // Injected in base-server.ts\n const protocol = req.headers['x-forwarded-proto']?.includes('https')\n ? 'https'\n : 'http'\n\n // When there are hostname and port we build an absolute URL\n if (!getRequestMeta(req, 'initURL')) {\n const initUrl = serverFilesManifest?.config.experimental.trustHostHeader\n ? `${protocol}://${req.headers.host || 'localhost'}${req.url}`\n : `${protocol}://${routerServerContext?.hostname || 'localhost'}${req.url}`\n\n addRequestMeta(req, 'initURL', initUrl)\n addRequestMeta(req, 'initProtocol', protocol)\n }\n\n if (basePath) {\n req.url = removePathPrefix(req.url || '/', basePath)\n }\n\n const parsedUrl = parseReqUrl(req.url || '/')\n addRequestMeta(req, 'initQuery', { ...parsedUrl?.query })\n // if we couldn't parse the URL we can't continue\n if (!parsedUrl) {\n return\n }\n let isNextDataRequest = false\n\n if (pathHasPrefix(parsedUrl.pathname || '/', '/_next/data')) {\n isNextDataRequest = true\n parsedUrl.pathname = normalizeDataPath(parsedUrl.pathname || '/')\n }\n this.normalizeUrl(req, parsedUrl)\n let originalPathname = parsedUrl.pathname || '/'\n const originalQuery = { ...parsedUrl.query }\n const pageIsDynamic = isDynamicRoute(srcPage)\n\n let localeResult: PathLocale | undefined\n let detectedLocale: string | undefined\n\n if (i18n) {\n localeResult = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n )\n\n if (localeResult.detectedLocale) {\n req.url = `${localeResult.pathname}${parsedUrl.search}`\n originalPathname = localeResult.pathname\n\n if (!detectedLocale) {\n detectedLocale = localeResult.detectedLocale\n }\n }\n }\n\n // Normalize the page path for route matching. The srcPage contains the\n // internal page path (e.g., /app/[slug]/page), but route matchers expect\n // the pathname format (e.g., /app/[slug]).\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n const serverUtils = getServerUtils({\n page: normalizedSrcPage,\n i18n,\n basePath,\n rewrites,\n pageIsDynamic,\n trailingSlash: process.env.__NEXT_TRAILING_SLASH as any as boolean,\n caseSensitive: Boolean(routesManifest.caseSensitive),\n })\n\n const domainLocale = detectDomainLocale(\n i18n?.domains,\n getHostname(parsedUrl, req.headers),\n detectedLocale\n )\n\n if (Boolean(domainLocale)) {\n addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale))\n }\n\n const defaultLocale =\n getRequestMeta(req, 'defaultLocale') ||\n domainLocale?.defaultLocale ||\n i18n?.defaultLocale\n\n // Ensure parsedUrl.pathname includes locale before processing\n // rewrites or they won't match correctly.\n if (defaultLocale && !detectedLocale) {\n parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname === '/' ? '' : parsedUrl.pathname}`\n }\n const locale =\n getRequestMeta(req, 'locale') || detectedLocale || defaultLocale\n\n // we apply rewrites against cloned URL so that we don't\n // modify the original with the rewrite destination\n const { rewriteParams, rewrittenParsedUrl } = serverUtils.handleRewrites(\n req,\n parsedUrl\n )\n const rewriteParamKeys = Object.keys(rewriteParams)\n Object.assign(parsedUrl.query, rewrittenParsedUrl.query)\n\n // after processing rewrites we want to remove locale\n // from parsedUrl pathname\n if (i18n) {\n parsedUrl.pathname = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n\n rewrittenParsedUrl.pathname = normalizeLocalePath(\n rewrittenParsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n }\n\n let params: Record<string, undefined | string | string[]> | undefined =\n getRequestMeta(req, 'params')\n\n // attempt parsing from pathname\n if (!params && serverUtils.dynamicRouteMatcher) {\n const paramsMatch = serverUtils.dynamicRouteMatcher(\n normalizeDataPath(\n rewrittenParsedUrl?.pathname || parsedUrl.pathname || '/'\n )\n )\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n paramsMatch || {},\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n\n // Local \"next start\" expects the routing parsed query values\n // to not be present in the URL although when deployed proxies\n // will add query values from resolving the routes to pass to function.\n\n // TODO: do we want to change expectations for \"next start\"\n // to include these query values in the URL which affects asPath\n // but would match deployed behavior, e.g. a rewrite from middleware\n // that adds a query param would be in asPath as query but locally\n // it won't be in the asPath but still available in the query object\n const query = getRequestMeta(req, 'query') || {\n ...parsedUrl.query,\n }\n\n const routeParamKeys = new Set<string>()\n const combinedParamKeys = []\n\n // We don't include rewriteParamKeys in the combinedParamKeys\n // for app router since the searchParams is populated from the\n // URL so we don't want to strip the rewrite params from the URL\n // so that searchParams can include them.\n if (\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ) {\n for (const key of [\n ...rewriteParamKeys,\n ...Object.keys(serverUtils.defaultRouteMatches || {}),\n ]) {\n // We only want to filter rewrite param keys from the URL\n // if they are matches from the URL e.g. the key/value matches\n // before and after applying the rewrites /:path for /hello and\n // { path: 'hello' } but not for { path: 'another' } and /hello\n // TODO: we should prefix rewrite param keys the same as we do\n // for dynamic routes so we can identify them properly\n const originalValue = Array.isArray(originalQuery[key])\n ? originalQuery[key].join('')\n : originalQuery[key]\n\n const queryValue = Array.isArray(query[key])\n ? query[key].join('')\n : query[key]\n\n if (!(key in originalQuery) || originalValue === queryValue) {\n combinedParamKeys.push(key)\n }\n }\n }\n\n serverUtils.normalizeCdnUrl(req, combinedParamKeys)\n serverUtils.normalizeQueryParams(query, routeParamKeys)\n serverUtils.filterInternalQuery(originalQuery, combinedParamKeys)\n\n if (pageIsDynamic) {\n const queryResult = serverUtils.normalizeDynamicRouteParams(query, true)\n\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n params || {},\n true\n )\n\n let paramsToInterpolate: ParsedUrlQuery\n\n if (\n // if both query and params are valid but one\n // provided more information and the query params\n // were nxtP prefixed rely on that one\n query &&\n params &&\n paramsResult.hasValidParams &&\n queryResult.hasValidParams &&\n routeParamKeys.size > 0 &&\n Object.keys(paramsResult.params).length <=\n Object.keys(queryResult.params).length\n ) {\n paramsToInterpolate = queryResult.params\n params = Object.assign(queryResult.params)\n } else {\n paramsToInterpolate =\n paramsResult.hasValidParams && params\n ? params\n : queryResult.hasValidParams\n ? query\n : {}\n }\n\n req.url = serverUtils.interpolateDynamicPath(\n req.url || '/',\n paramsToInterpolate\n )\n parsedUrl.pathname = serverUtils.interpolateDynamicPath(\n parsedUrl.pathname || '/',\n paramsToInterpolate\n )\n originalPathname = serverUtils.interpolateDynamicPath(\n originalPathname,\n paramsToInterpolate\n )\n\n // try pulling from query if valid\n if (!params) {\n if (queryResult.hasValidParams) {\n params = Object.assign({}, queryResult.params)\n\n // If we pulled from query remove it so it's\n // only in params\n for (const key in serverUtils.defaultRouteMatches) {\n delete query[key]\n }\n } else {\n // use final params from URL matching\n const paramsMatch = serverUtils.dynamicRouteMatcher?.(\n normalizeDataPath(\n localeResult?.pathname || parsedUrl.pathname || '/'\n )\n )\n // we don't normalize these as they are allowed to be\n // the literal slug matches here e.g. /blog/[slug]\n // actually being requested\n if (paramsMatch) {\n params = Object.assign({}, paramsMatch)\n }\n }\n }\n }\n\n // Remove any normalized params from the query if they\n // weren't present as non-prefixed query key e.g.\n // ?search=1&nxtPsearch=hello we don't delete search\n for (const key of routeParamKeys) {\n if (!(key in originalQuery)) {\n delete query[key]\n // handle the case where there's collision and we\n // normalized nxtPid=123 -> id=123 but user also\n // sends id=456 as separate key\n } else if (\n originalQuery[key] &&\n query[key] &&\n originalQuery[key] !== query[key]\n ) {\n query[key] = originalQuery[key]\n }\n }\n\n const { isOnDemandRevalidate, revalidateOnlyGenerated } =\n checkIsOnDemandRevalidate(req, prerenderManifest.preview)\n\n let isDraftMode = false\n let previewData: PreviewData\n\n // preview data relies on non-edge utils\n if (process.env.NEXT_RUNTIME !== 'edge' && res) {\n const { tryGetPreviewData } =\n require('../api-utils/node/try-get-preview-data') as typeof import('../api-utils/node/try-get-preview-data')\n\n previewData = tryGetPreviewData(\n req,\n res,\n prerenderManifest.preview,\n Boolean(multiZoneDraftMode)\n )\n isDraftMode = previewData !== false\n }\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { installProcessErrorHandlers } =\n require('../node-environment-extensions/process-error-handlers') as typeof import('../node-environment-extensions/process-error-handlers')\n\n installProcessErrorHandlers(\n Boolean(\n nextConfig.experimental.removeUncaughtErrorAndRejectionListeners\n )\n )\n }\n\n let resolvedPathname = normalizedSrcPage\n if (isDynamicRoute(resolvedPathname) && params) {\n resolvedPathname = serverUtils.interpolateDynamicPath(\n resolvedPathname,\n params\n )\n }\n\n if (resolvedPathname === '/index') {\n resolvedPathname = '/'\n }\n\n if (\n res &&\n Boolean(req.headers['x-nextjs-data']) &&\n (!res.statusCode || res.statusCode === 200)\n ) {\n res.setHeader(\n 'x-nextjs-matched-path',\n removeTrailingSlash(`${locale ? `/${locale}` : ''}${normalizedSrcPage}`)\n )\n }\n const encodedResolvedPathname = resolvedPathname\n\n // we decode for cache key/manifest usage encoded is\n // for URL building\n try {\n resolvedPathname = decodePathParams(resolvedPathname)\n } catch (_) {}\n\n resolvedPathname = removeTrailingSlash(resolvedPathname)\n addRequestMeta(req, 'resolvedPathname', resolvedPathname)\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return {\n query,\n originalQuery,\n originalPathname,\n params,\n parsedUrl,\n locale,\n isNextDataRequest,\n locales: i18n?.locales,\n defaultLocale,\n isDraftMode,\n previewData,\n pageIsDynamic,\n resolvedPathname,\n encodedResolvedPathname,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n ...manifests,\n // loadManifest returns a readonly object, but we don't want to propagate that throughout the\n // whole codebase (for now)\n nextConfig:\n nextConfig satisfies DeepReadonly<NextConfigRuntime> as NextConfigRuntime,\n routerServerContext,\n deploymentId,\n clientAssetToken:\n nextConfig.experimental.immutableAssetToken || deploymentId,\n }\n }\n\n public getResponseCache(req: IncomingMessage | BaseNextRequest) {\n if (!this.responseCache) {\n const minimalMode = getRequestMeta(req, 'minimalMode') ?? false\n this.responseCache = new ResponseCache(minimalMode)\n }\n return this.responseCache\n }\n\n public async handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind,\n isFallback,\n prerenderManifest,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil,\n isMinimalMode,\n }: {\n req: IncomingMessage | BaseNextRequest\n nextConfig: NextConfigRuntime\n cacheKey: string | null\n routeKind: RouteKind\n isFallback?: boolean\n prerenderManifest: DeepReadonly<PrerenderManifest>\n isRoutePPREnabled?: boolean\n isOnDemandRevalidate?: boolean\n revalidateOnlyGenerated?: boolean\n responseGenerator: ResponseGenerator\n waitUntil?: (prom: Promise<any>) => void\n isMinimalMode: boolean\n }) {\n const responseCache = this.getResponseCache(req)\n const cacheEntry = await responseCache.get(cacheKey, responseGenerator, {\n routeKind,\n isFallback,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n isPrefetch: req.headers.purpose === 'prefetch',\n // Use x-invocation-id header to scope the in-memory cache to a single\n // revalidation request in minimal mode.\n invocationID: req.headers['x-invocation-id'] as string | undefined,\n incrementalCache: await this.getIncrementalCache(\n req,\n nextConfig,\n prerenderManifest,\n isMinimalMode\n ),\n waitUntil,\n })\n\n if (!cacheEntry) {\n if (\n cacheKey &&\n // revalidate only generated can bail even if cacheKey is provided\n !(isOnDemandRevalidate && revalidateOnlyGenerated)\n ) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n }\n return cacheEntry\n }\n}\n"],"names":["BUILD_ID_FILE","BUILD_MANIFEST","CLIENT_REFERENCE_MANIFEST","DYNAMIC_CSS_MANIFEST","NEXT_FONT_MANIFEST","PRERENDER_MANIFEST","REACT_LOADABLE_MANIFEST","ROUTES_MANIFEST","SERVER_FILES_MANIFEST","SERVER_REFERENCE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","parseReqUrl","normalizeLocalePath","isDynamicRoute","removePathPrefix","getServerUtils","detectDomainLocale","getHostname","checkIsOnDemandRevalidate","normalizeDataPath","pathHasPrefix","addRequestMeta","getRequestMeta","normalizePagePath","isStaticMetadataRoute","IncrementalCache","initializeCacheHandlers","setCacheHandler","interopDefault","RouteKind","ResponseCache","normalizeAppPath","RouterServerContextSymbol","routerServerGlobal","decodePathParams","removeTrailingSlash","isInterceptionRouteRewrite","dynamicImportEsmDefault","id","then","mod","default","RouteModule","constructor","userland","definition","distDir","relativeProjectDir","isDev","process","env","__NEXT_DEV_SERVER","normalizeUrl","_req","_parsedUrl","instrumentationOnRequestError","req","args","NEXT_RUNTIME","getEdgeInstrumentationModule","instrumentation","onRequestError","join","require","absoluteProjectDir","cwd","loadManifests","srcPage","projectDir","result","self","getEdgePreviewProps","maybeJSONParse","str","JSON","parse","undefined","buildId","__NEXT_BUILD_ID","buildManifest","__BUILD_MANIFEST","fallbackBuildManifest","reactLoadableManifest","__REACT_LOADABLE_MANIFEST","nextFontManifest","__NEXT_FONT_MANIFEST","prerenderManifest","routes","dynamicRoutes","notFoundRoutes","version","preview","routesManifest","caseSensitive","Boolean","__NEXT_CASE_SENSITIVE_ROUTES","basePath","__NEXT_BASE_PATH","rewrites","__NEXT_REWRITES","beforeFiles","afterFiles","fallback","redirects","headers","onMatchHeaders","i18n","__NEXT_I18N_CONFIG","skipProxyUrlNormalize","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","serverFilesManifest","__SERVER_FILES_MANIFEST","clientReferenceManifest","__RSC_MANIFEST","serverActionsManifest","__RSC_SERVER_MANIFEST","subresourceIntegrityManifest","__SUBRESOURCE_INTEGRITY_MANIFEST","dynamicCssManifest","__DYNAMIC_CSS_MANIFEST","interceptionRoutePatterns","__INTERCEPTION_ROUTE_REWRITE_MANIFEST","map","rewrite","RegExp","regex","Error","loadManifestFromRelativePath","normalizedPagePath","router","kind","PAGES","PAGES_API","manifest","shouldCache","handleMissing","TURBOPACK","useEval","replace","skipParse","filter","loadCustomCacheHandlers","nextConfig","cacheMaxMemorySize","cacheHandlers","handler","Object","entries","formatDynamicImportPath","getIncrementalCache","isMinimalMode","globalThis","__incrementalCache","CacheHandler","cacheHandler","incrementalCache","fs","nodeFs","dev","requestHeaders","allowedRevalidateHeaderKeys","experimental","minimalMode","serverDistDir","fetchCacheKeyPrefix","maxMemoryCacheSize","flushToDisk","isrFlushToDisk","getPrerenderManifest","CurCacheHandler","err","errorContext","silenceLog","routerServerContext","logErrorWithOriginalStack","console","error","path","url","method","getNextConfigEdge","config","deploymentId","runtimeServerDeploymentId","NEXT_DEPLOYMENT_ID","prepare","res","multiZoneDraftMode","relative","absoluteDistDir","ensureInstrumentationRegistered","manifests","protocol","includes","initUrl","trustHostHeader","host","hostname","parsedUrl","query","isNextDataRequest","pathname","originalPathname","originalQuery","pageIsDynamic","localeResult","detectedLocale","locales","search","normalizedSrcPage","serverUtils","page","trailingSlash","__NEXT_TRAILING_SLASH","domainLocale","domains","defaultLocale","locale","rewriteParams","rewrittenParsedUrl","handleRewrites","rewriteParamKeys","keys","assign","params","dynamicRouteMatcher","paramsMatch","paramsResult","normalizeDynamicRouteParams","hasValidParams","routeParamKeys","Set","combinedParamKeys","key","defaultRouteMatches","originalValue","Array","isArray","queryValue","push","normalizeCdnUrl","normalizeQueryParams","filterInternalQuery","queryResult","paramsToInterpolate","size","length","interpolateDynamicPath","isOnDemandRevalidate","revalidateOnlyGenerated","isDraftMode","previewData","tryGetPreviewData","installProcessErrorHandlers","removeUncaughtErrorAndRejectionListeners","resolvedPathname","statusCode","setHeader","encodedResolvedPathname","_","clientAssetToken","immutableAssetToken","getResponseCache","responseCache","handleResponse","cacheKey","routeKind","isFallback","isRoutePPREnabled","responseGenerator","waitUntil","cacheEntry","get","isPrefetch","purpose","invocationID"],"mappings":"AAAA,OAAO,8CAA6C;AAepD,SACEA,aAAa,EACbC,cAAc,EACdC,yBAAyB,EACzBC,oBAAoB,EACpBC,kBAAkB,EAClBC,kBAAkB,EAClBC,uBAAuB,EACvBC,eAAe,EACfC,qBAAqB,EACrBC,yBAAyB,EACzBC,8BAA8B,QACzB,6BAA4B;AACnC,SAASC,WAAW,QAAQ,gBAAe;AAC3C,SACEC,mBAAmB,QAEd,8CAA6C;AACpD,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAASC,gBAAgB,QAAQ,mDAAkD;AACnF,SAASC,cAAc,QAAQ,kBAAiB;AAChD,SAASC,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IAAI,CAAC+M,aAAa,GAAG,IAAIzO,cAAcoI;QACzC;QACA,OAAO,IAAI,CAACqG,aAAa;IAC3B;IAEA,MAAaC,eAAe,EAC1BhN,GAAG,EACHsF,UAAU,EACV2H,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVrL,iBAAiB,EACjBsL,iBAAiB,EACjBpB,oBAAoB,EACpBC,uBAAuB,EACvBoB,iBAAiB,EACjBC,SAAS,EACTxH,aAAa,EAcd,EAAE;QACD,MAAMiH,gBAAgB,IAAI,CAACD,gBAAgB,CAAC9M;QAC5C,MAAMuN,aAAa,MAAMR,cAAcS,GAAG,CAACP,UAAUI,mBAAmB;YACtEH;YACAC;YACAC;YACApB;YACAyB,YAAYzN,IAAIgD,OAAO,CAAC0K,OAAO,KAAK;YACpC,sEAAsE;YACtE,wCAAwC;YACxCC,cAAc3N,IAAIgD,OAAO,CAAC,kBAAkB;YAC5CmD,kBAAkB,MAAM,IAAI,CAACN,mBAAmB,CAC9C7F,KACAsF,YACAxD,mBACAgE;YAEFwH;QACF;QAEA,IAAI,CAACC,YAAY;YACf,IACEN,YACA,kEAAkE;YAClE,CAAEjB,CAAAA,wBAAwBC,uBAAsB,GAChD;gBACA,gEAAgE;gBAChE,oEAAoE;gBACpE,kEAAkE;gBAClE,mEAAmE;gBACnE,yBAAyB;gBACzB,MAAM,qBAA8D,CAA9D,IAAI3H,MAAM,sDAAV,qBAAA;2BAAA;gCAAA;kCAAA;gBAA6D;YACrE;QACF;QACA,OAAOiJ;IACT;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../../src/server/route-modules/route-module.ts"],"sourcesContent":["import '../../build/adapter/setup-node-env.external'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport type {\n InstrumentationOnRequestError,\n RequestErrorContext,\n} from '../instrumentation/types'\nimport type { ParsedUrlQuery } from 'node:querystring'\nimport type { UrlWithParsedQuery } from 'node:url'\nimport type {\n PrerenderManifest,\n RequiredServerFilesManifest,\n} from '../../build'\nimport type { DevRoutesManifest } from '../lib/router-utils/setup-dev-bundler'\nimport type { RouteDefinition } from '../route-definitions/route-definition'\nimport type { DeepReadonly } from '../../shared/lib/deep-readonly'\nimport {\n BUILD_ID_FILE,\n BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n NEXT_FONT_MANIFEST,\n PRERENDER_MANIFEST,\n REACT_LOADABLE_MANIFEST,\n ROUTES_MANIFEST,\n SERVER_FILES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n} from '../../shared/lib/constants'\nimport { parseReqUrl } from '../../lib/url'\nimport {\n normalizeLocalePath,\n type PathLocale,\n} from '../../shared/lib/i18n/normalize-locale-path'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\nimport { removePathPrefix } from '../../shared/lib/router/utils/remove-path-prefix'\nimport { getServerUtils } from '../server-utils'\nimport { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'\nimport { getHostname } from '../../shared/lib/get-hostname'\nimport { checkIsOnDemandRevalidate } from '../api-utils'\nimport type { PreviewData } from '../../types'\nimport type { BuildManifest } from '../get-page-files'\nimport type { ReactLoadableManifest } from '../load-components'\nimport type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin'\nimport { normalizeDataPath } from '../../shared/lib/page-path/normalize-data-path'\nimport { pathHasPrefix } from '../../shared/lib/router/utils/path-has-prefix'\nimport {\n addRequestMeta,\n getRequestMeta,\n type NextIncomingMessage,\n} from '../request-meta'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isStaticMetadataRoute } from '../../lib/metadata/is-metadata-route'\nimport { IncrementalCache } from '../lib/incremental-cache'\nimport { initializeCacheHandlers, setCacheHandler } from '../use-cache/handlers'\nimport { interopDefault } from '../app-render/interop-default'\nimport { RouteKind } from '../route-kind'\nimport type { BaseNextRequest } from '../base-http'\nimport type { I18NConfig, NextConfigRuntime } from '../config-shared'\nimport ResponseCache, { type ResponseGenerator } from '../response-cache'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport {\n RouterServerContextSymbol,\n routerServerGlobal,\n type RouterServerContext,\n} from '../lib/router-utils/router-server-context'\nimport { decodePathParams } from '../lib/router-utils/decode-path-params'\nimport { removeTrailingSlash } from '../../shared/lib/router/utils/remove-trailing-slash'\nimport { isInterceptionRouteRewrite } from '../../lib/is-interception-route-rewrite'\n\n/**\n * RouteModuleOptions is the options that are passed to the route module, other\n * route modules should extend this class to add specific options for their\n * route.\n */\nexport interface RouteModuleOptions<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n readonly definition: Readonly<D>\n readonly userland: Readonly<U>\n readonly distDir: string\n readonly relativeProjectDir: string\n}\n\n/**\n * RouteHandlerContext is the base context for a route handler.\n */\nexport interface RouteModuleHandleContext {\n /**\n * Any matched parameters for the request. This is only defined for dynamic\n * routes.\n */\n params: Record<string, string | string[] | undefined> | undefined\n}\n\nconst dynamicImportEsmDefault = (id: string) =>\n import(/* webpackIgnore: true */ /* turbopackIgnore: true */ id).then(\n (mod) => mod.default || mod\n )\n\n/**\n * RouteModule is the base class for all route modules. This class should be\n * extended by all route modules.\n */\nexport abstract class RouteModule<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n /**\n * The userland module. This is the module that is exported from the user's\n * code. This is marked as readonly to ensure that the module is not mutated\n * because the module (when compiled) only provides getters.\n */\n public readonly userland: Readonly<U>\n\n /**\n * The definition of the route.\n */\n public readonly definition: Readonly<D>\n\n /**\n * The shared modules that are exposed and required for the route module.\n */\n public static readonly sharedModules: any\n\n public isDev: boolean\n public distDir: string\n public relativeProjectDir: string\n public incrementCache?: IncrementalCache\n public responseCache?: ResponseCache\n\n constructor({\n userland,\n definition,\n distDir,\n relativeProjectDir,\n }: RouteModuleOptions<D, U>) {\n this.userland = userland\n this.definition = definition\n this.isDev = !!process.env.__NEXT_DEV_SERVER\n this.distDir = distDir\n this.relativeProjectDir = relativeProjectDir\n }\n\n public normalizeUrl(\n _req: IncomingMessage | BaseNextRequest,\n _parsedUrl: UrlWithParsedQuery\n ) {}\n\n public async instrumentationOnRequestError(\n req: IncomingMessage | BaseNextRequest,\n ...args: Parameters<InstrumentationOnRequestError>\n ) {\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgeInstrumentationModule } = await import('../web/globals')\n const instrumentation = await getEdgeInstrumentationModule()\n\n if (instrumentation) {\n await instrumentation.onRequestError?.(...args)\n }\n } else {\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const { instrumentationOnRequestError } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n\n return instrumentationOnRequestError(\n absoluteProjectDir,\n this.distDir,\n ...args\n )\n }\n }\n\n private loadManifests(\n srcPage: string,\n projectDir?: string\n ): {\n buildId: string\n buildManifest: BuildManifest\n fallbackBuildManifest: BuildManifest\n routesManifest: DeepReadonly<DevRoutesManifest>\n nextFontManifest: DeepReadonly<NextFontManifest>\n prerenderManifest: DeepReadonly<PrerenderManifest>\n serverFilesManifest: DeepReadonly<RequiredServerFilesManifest> | undefined\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n subresourceIntegrityManifest: any\n clientReferenceManifest: any\n serverActionsManifest: any\n dynamicCssManifest: any\n interceptionRoutePatterns: RegExp[]\n } {\n let result\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgePreviewProps } =\n require('../web/get-edge-preview-props') as typeof import('../web/get-edge-preview-props')\n\n const maybeJSONParse = (str?: string) =>\n str ? JSON.parse(str) : undefined\n\n result = {\n buildId: process.env.__NEXT_BUILD_ID || '',\n buildManifest: self.__BUILD_MANIFEST as any,\n fallbackBuildManifest: {} as any,\n reactLoadableManifest: maybeJSONParse(self.__REACT_LOADABLE_MANIFEST),\n nextFontManifest: maybeJSONParse(self.__NEXT_FONT_MANIFEST),\n prerenderManifest: {\n routes: {},\n dynamicRoutes: {},\n notFoundRoutes: [],\n version: 4,\n preview: getEdgePreviewProps(),\n } as const,\n routesManifest: {\n version: 4,\n caseSensitive: Boolean(process.env.__NEXT_CASE_SENSITIVE_ROUTES),\n basePath: process.env.__NEXT_BASE_PATH || '',\n rewrites: (process.env.__NEXT_REWRITES as any) || {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n redirects: [],\n headers: [],\n onMatchHeaders: [],\n i18n:\n (process.env.__NEXT_I18N_CONFIG as any as I18NConfig) || undefined,\n skipProxyUrlNormalize: Boolean(\n process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ),\n },\n serverFilesManifest: self.__SERVER_FILES_MANIFEST,\n clientReferenceManifest: self.__RSC_MANIFEST?.[srcPage],\n serverActionsManifest: maybeJSONParse(self.__RSC_SERVER_MANIFEST),\n subresourceIntegrityManifest: maybeJSONParse(\n self.__SUBRESOURCE_INTEGRITY_MANIFEST\n ),\n dynamicCssManifest: maybeJSONParse(self.__DYNAMIC_CSS_MANIFEST),\n interceptionRoutePatterns: (\n maybeJSONParse(self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST) ?? []\n ).map((rewrite: any) => new RegExp(rewrite.regex)),\n }\n } else {\n if (!projectDir) {\n throw new Error('Invariant: projectDir is required for node runtime')\n }\n const { loadManifestFromRelativePath } =\n require('../load-manifest.external') as typeof import('../load-manifest.external')\n const normalizedPagePath = normalizePagePath(srcPage)\n\n const router =\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ? 'pages'\n : 'app'\n\n const [\n routesManifest,\n prerenderManifest,\n buildManifest,\n fallbackBuildManifest,\n reactLoadableManifest,\n nextFontManifest,\n clientReferenceManifest,\n serverActionsManifest,\n subresourceIntegrityManifest,\n serverFilesManifest,\n buildId,\n dynamicCssManifest,\n ] = [\n loadManifestFromRelativePath<DevRoutesManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: ROUTES_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<PrerenderManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: PRERENDER_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<BuildManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_MANIFEST,\n shouldCache: !this.isDev,\n }),\n srcPage === '/_error'\n ? loadManifestFromRelativePath<BuildManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: `fallback-${BUILD_MANIFEST}`,\n shouldCache: !this.isDev,\n handleMissing: true,\n })\n : ({} as BuildManifest),\n loadManifestFromRelativePath<ReactLoadableManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: process.env.TURBOPACK\n ? `server/${router === 'app' ? 'app' : 'pages'}${normalizedPagePath}/${REACT_LOADABLE_MANIFEST}`\n : REACT_LOADABLE_MANIFEST,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<NextFontManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${NEXT_FONT_MANIFEST}.json`,\n shouldCache: !this.isDev,\n }),\n router === 'app' && !isStaticMetadataRoute(srcPage)\n ? loadManifestFromRelativePath({\n distDir: this.distDir,\n projectDir,\n useEval: true,\n handleMissing: true,\n manifest: `server/app${srcPage.replace(/%5F/g, '_') + '_' + CLIENT_REFERENCE_MANIFEST}.js`,\n shouldCache: !this.isDev,\n })\n : undefined,\n router === 'app'\n ? loadManifestFromRelativePath<any>({\n distDir: this.distDir,\n projectDir,\n manifest: `server/${SERVER_REFERENCE_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n })\n : {},\n loadManifestFromRelativePath<Record<string, string>>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n this.isDev\n ? undefined\n : loadManifestFromRelativePath<RequiredServerFilesManifest>({\n projectDir,\n distDir: this.distDir,\n shouldCache: true,\n manifest: `${SERVER_FILES_MANIFEST}.json`,\n }),\n this.isDev\n ? 'development'\n : loadManifestFromRelativePath<any>({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_ID_FILE,\n skipParse: true,\n shouldCache: true,\n }),\n loadManifestFromRelativePath<any>({\n projectDir,\n distDir: this.distDir,\n manifest: DYNAMIC_CSS_MANIFEST,\n shouldCache: !this.isDev,\n handleMissing: true,\n }),\n ]\n\n result = {\n buildId,\n buildManifest,\n fallbackBuildManifest,\n routesManifest,\n nextFontManifest,\n prerenderManifest,\n serverFilesManifest,\n reactLoadableManifest,\n clientReferenceManifest: (clientReferenceManifest as any)\n ?.__RSC_MANIFEST?.[srcPage.replace(/%5F/g, '_')],\n serverActionsManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n interceptionRoutePatterns: routesManifest.rewrites.beforeFiles\n .filter(isInterceptionRouteRewrite)\n .map((rewrite) => new RegExp(rewrite.regex)),\n }\n }\n\n return result\n }\n\n public async loadCustomCacheHandlers(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime\n ) {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { cacheMaxMemorySize, cacheHandlers } = nextConfig\n if (!cacheHandlers) return\n\n // If we've already initialized the cache handlers interface, don't do it\n // again.\n if (!initializeCacheHandlers(cacheMaxMemorySize)) return\n\n for (const [kind, handler] of Object.entries(cacheHandlers)) {\n if (!handler) continue\n\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n setCacheHandler(\n kind,\n interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(\n `${absoluteProjectDir}/${this.distDir}`,\n handler\n )\n )\n )\n )\n }\n }\n }\n\n public async getIncrementalCache(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime,\n prerenderManifest: DeepReadonly<PrerenderManifest>,\n isMinimalMode: boolean\n ): Promise<IncrementalCache> {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return (globalThis as any).__incrementalCache\n } else {\n let CacheHandler: any\n const { cacheHandler } = nextConfig\n\n if (cacheHandler) {\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n CacheHandler = interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(this.distDir, cacheHandler)\n )\n )\n }\n const { join } = require('node:path') as typeof import('node:path')\n const projectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n await this.loadCustomCacheHandlers(req, nextConfig)\n\n // incremental-cache is request specific\n // although can have shared caches in module scope\n // per-cache handler\n const incrementalCache = new IncrementalCache({\n fs: (\n require('../lib/node-fs-methods') as typeof import('../lib/node-fs-methods')\n ).nodeFs,\n dev: this.isDev,\n requestHeaders: req.headers,\n allowedRevalidateHeaderKeys:\n nextConfig.experimental.allowedRevalidateHeaderKeys,\n minimalMode: isMinimalMode,\n serverDistDir: `${projectDir}/${this.distDir}/server`,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n maxMemoryCacheSize: nextConfig.cacheMaxMemorySize,\n flushToDisk: !isMinimalMode && nextConfig.experimental.isrFlushToDisk,\n getPrerenderManifest: () => prerenderManifest,\n CurCacheHandler: CacheHandler,\n })\n\n // we need to expose this on globalThis as the app-render\n // workStore grabs the incrementalCache from there\n ;(globalThis as any).__incrementalCache = incrementalCache\n return incrementalCache\n }\n }\n\n public async onRequestError(\n req: IncomingMessage | BaseNextRequest,\n err: unknown,\n errorContext: RequestErrorContext,\n silenceLog: boolean,\n routerServerContext?: RouterServerContext[string]\n ) {\n if (!silenceLog) {\n if (routerServerContext?.logErrorWithOriginalStack) {\n routerServerContext.logErrorWithOriginalStack(err, 'app-dir')\n } else {\n console.error(err)\n }\n }\n await this.instrumentationOnRequestError(\n req,\n err,\n {\n path: req.url || '/',\n headers: req.headers,\n method: req.method || 'GET',\n },\n errorContext\n )\n }\n\n /** A more lightweight version of `prepare()` for only retrieving the config on edge */\n public getNextConfigEdge(req: NextIncomingMessage): {\n nextConfig: NextConfigRuntime\n deploymentId: string\n } {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n throw new Error(\n 'Invariant: getNextConfigEdge must only be called in edge runtime'\n )\n }\n\n let serverFilesManifest = self.__SERVER_FILES_MANIFEST as any as\n | RequiredServerFilesManifest\n | undefined\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return { nextConfig, deploymentId }\n }\n\n public async prepare(\n req: IncomingMessage | BaseNextRequest,\n res: ServerResponse | null,\n {\n srcPage,\n multiZoneDraftMode,\n }: {\n srcPage: string\n multiZoneDraftMode?: boolean\n }\n ): Promise<\n | {\n buildId: string\n deploymentId: string\n clientAssetToken: string\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n query: ParsedUrlQuery\n originalQuery: ParsedUrlQuery\n originalPathname: string\n params?: ParsedUrlQuery\n parsedUrl: UrlWithParsedQuery\n previewData: PreviewData\n pageIsDynamic: boolean\n isDraftMode: boolean\n resolvedPathname: string\n encodedResolvedPathname: string\n isNextDataRequest: boolean\n buildManifest: DeepReadonly<BuildManifest>\n fallbackBuildManifest: DeepReadonly<BuildManifest>\n nextFontManifest: DeepReadonly<NextFontManifest>\n serverFilesManifest:\n | DeepReadonly<RequiredServerFilesManifest>\n | undefined\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n routesManifest: DeepReadonly<DevRoutesManifest>\n prerenderManifest: DeepReadonly<PrerenderManifest>\n // we can't pull in the client reference type or it causes issues with\n // our pre-compiled types\n clientReferenceManifest?: any\n serverActionsManifest?: any\n dynamicCssManifest?: any\n subresourceIntegrityManifest?: DeepReadonly<Record<string, string>>\n isOnDemandRevalidate: boolean\n revalidateOnlyGenerated: boolean\n nextConfig: NextConfigRuntime\n routerServerContext?: RouterServerContext[string]\n interceptionRoutePatterns?: any\n }\n | undefined\n > {\n let absoluteProjectDir: string | undefined\n\n // edge runtime handles loading instrumentation at the edge adapter level\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { join, relative } =\n require('node:path') as typeof import('node:path')\n\n absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const absoluteDistDir = getRequestMeta(req, 'distDir')\n\n if (absoluteDistDir) {\n this.distDir = relative(absoluteProjectDir, absoluteDistDir)\n }\n const { ensureInstrumentationRegistered } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n // ensure instrumentation is registered and pass\n // onRequestError below\n ensureInstrumentationRegistered(absoluteProjectDir, this.distDir)\n }\n const manifests = this.loadManifests(srcPage, absoluteProjectDir)\n const { routesManifest, prerenderManifest, serverFilesManifest } = manifests\n\n const { basePath, i18n, rewrites } = routesManifest\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n // Injected in base-server.ts\n const protocol = req.headers['x-forwarded-proto']?.includes('https')\n ? 'https'\n : 'http'\n\n // When there are hostname and port we build an absolute URL\n if (!getRequestMeta(req, 'initURL')) {\n const initUrl = serverFilesManifest?.config.experimental.trustHostHeader\n ? `${protocol}://${req.headers.host || 'localhost'}${req.url}`\n : `${protocol}://${routerServerContext?.hostname || 'localhost'}${req.url}`\n\n addRequestMeta(req, 'initURL', initUrl)\n addRequestMeta(req, 'initProtocol', protocol)\n }\n\n if (basePath) {\n req.url = removePathPrefix(req.url || '/', basePath)\n }\n\n const parsedUrl = parseReqUrl(req.url || '/')\n addRequestMeta(req, 'initQuery', { ...parsedUrl?.query })\n // if we couldn't parse the URL we can't continue\n if (!parsedUrl) {\n return\n }\n let isNextDataRequest = false\n\n if (pathHasPrefix(parsedUrl.pathname || '/', '/_next/data')) {\n isNextDataRequest = true\n parsedUrl.pathname = normalizeDataPath(parsedUrl.pathname || '/')\n }\n this.normalizeUrl(req, parsedUrl)\n let originalPathname = parsedUrl.pathname || '/'\n const originalQuery = { ...parsedUrl.query }\n const pageIsDynamic = isDynamicRoute(srcPage)\n\n let localeResult: PathLocale | undefined\n let detectedLocale: string | undefined\n\n if (i18n) {\n localeResult = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n )\n\n if (localeResult.detectedLocale) {\n req.url = `${localeResult.pathname}${parsedUrl.search}`\n originalPathname = localeResult.pathname\n\n if (!detectedLocale) {\n detectedLocale = localeResult.detectedLocale\n }\n }\n }\n\n // Normalize the page path for route matching. The srcPage contains the\n // internal page path (e.g., /app/[slug]/page), but route matchers expect\n // the pathname format (e.g., /app/[slug]).\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n const serverUtils = getServerUtils({\n page: normalizedSrcPage,\n i18n,\n basePath,\n rewrites,\n pageIsDynamic,\n trailingSlash: process.env.__NEXT_TRAILING_SLASH as any as boolean,\n caseSensitive: Boolean(routesManifest.caseSensitive),\n })\n\n const domainLocale = detectDomainLocale(\n i18n?.domains,\n getHostname(parsedUrl, req.headers),\n detectedLocale\n )\n\n if (Boolean(domainLocale)) {\n addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale))\n }\n\n const defaultLocale =\n getRequestMeta(req, 'defaultLocale') ||\n domainLocale?.defaultLocale ||\n i18n?.defaultLocale\n\n // Ensure parsedUrl.pathname includes locale before processing\n // rewrites or they won't match correctly.\n if (defaultLocale && !detectedLocale) {\n parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname === '/' ? '' : parsedUrl.pathname}`\n }\n const locale =\n getRequestMeta(req, 'locale') || detectedLocale || defaultLocale\n\n // we apply rewrites against cloned URL so that we don't\n // modify the original with the rewrite destination\n const { rewriteParams, rewrittenParsedUrl } = serverUtils.handleRewrites(\n req,\n parsedUrl\n )\n const rewriteParamKeys = Object.keys(rewriteParams)\n Object.assign(parsedUrl.query, rewrittenParsedUrl.query)\n\n // after processing rewrites we want to remove locale\n // from parsedUrl pathname\n if (i18n) {\n parsedUrl.pathname = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n\n rewrittenParsedUrl.pathname = normalizeLocalePath(\n rewrittenParsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n }\n\n let params: Record<string, undefined | string | string[]> | undefined =\n getRequestMeta(req, 'params')\n\n // attempt parsing from pathname\n if (!params && serverUtils.dynamicRouteMatcher) {\n const paramsMatch = serverUtils.dynamicRouteMatcher(\n normalizeDataPath(\n rewrittenParsedUrl?.pathname || parsedUrl.pathname || '/'\n )\n )\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n paramsMatch || {},\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n\n // Local \"next start\" expects the routing parsed query values\n // to not be present in the URL although when deployed proxies\n // will add query values from resolving the routes to pass to function.\n\n // TODO: do we want to change expectations for \"next start\"\n // to include these query values in the URL which affects asPath\n // but would match deployed behavior, e.g. a rewrite from middleware\n // that adds a query param would be in asPath as query but locally\n // it won't be in the asPath but still available in the query object\n const query = getRequestMeta(req, 'query') || {\n ...parsedUrl.query,\n }\n\n const routeParamKeys = new Set<string>()\n const combinedParamKeys = []\n\n // We don't include rewriteParamKeys in the combinedParamKeys\n // for app router since the searchParams is populated from the\n // URL so we don't want to strip the rewrite params from the URL\n // so that searchParams can include them.\n if (\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ) {\n for (const key of [\n ...rewriteParamKeys,\n ...Object.keys(serverUtils.defaultRouteMatches || {}),\n ]) {\n // We only want to filter rewrite param keys from the URL\n // if they are matches from the URL e.g. the key/value matches\n // before and after applying the rewrites /:path for /hello and\n // { path: 'hello' } but not for { path: 'another' } and /hello\n // TODO: we should prefix rewrite param keys the same as we do\n // for dynamic routes so we can identify them properly\n const originalValue = Array.isArray(originalQuery[key])\n ? originalQuery[key].join('')\n : originalQuery[key]\n\n const queryValue = Array.isArray(query[key])\n ? query[key].join('')\n : query[key]\n\n if (!(key in originalQuery) || originalValue === queryValue) {\n combinedParamKeys.push(key)\n }\n }\n }\n\n serverUtils.normalizeCdnUrl(req, combinedParamKeys)\n serverUtils.normalizeQueryParams(query, routeParamKeys)\n serverUtils.filterInternalQuery(originalQuery, combinedParamKeys)\n\n if (pageIsDynamic) {\n const queryResult = serverUtils.normalizeDynamicRouteParams(query, true)\n\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n params || {},\n true\n )\n\n let paramsToInterpolate: ParsedUrlQuery\n\n if (\n // if both query and params are valid but one\n // provided more information and the query params\n // were nxtP prefixed rely on that one\n query &&\n params &&\n paramsResult.hasValidParams &&\n queryResult.hasValidParams &&\n routeParamKeys.size > 0 &&\n Object.keys(paramsResult.params).length <=\n Object.keys(queryResult.params).length\n ) {\n paramsToInterpolate = queryResult.params\n params = Object.assign(queryResult.params)\n } else {\n paramsToInterpolate =\n paramsResult.hasValidParams && params\n ? params\n : queryResult.hasValidParams\n ? query\n : {}\n }\n\n req.url = serverUtils.interpolateDynamicPath(\n req.url || '/',\n paramsToInterpolate\n )\n parsedUrl.pathname = serverUtils.interpolateDynamicPath(\n parsedUrl.pathname || '/',\n paramsToInterpolate\n )\n originalPathname = serverUtils.interpolateDynamicPath(\n originalPathname,\n paramsToInterpolate\n )\n\n // try pulling from query if valid\n if (!params) {\n if (queryResult.hasValidParams) {\n params = Object.assign({}, queryResult.params)\n\n // If we pulled from query remove it so it's\n // only in params\n for (const key in serverUtils.defaultRouteMatches) {\n delete query[key]\n }\n } else {\n // use final params from URL matching\n const paramsMatch = serverUtils.dynamicRouteMatcher?.(\n normalizeDataPath(\n localeResult?.pathname || parsedUrl.pathname || '/'\n )\n )\n // we don't normalize these as they are allowed to be\n // the literal slug matches here e.g. /blog/[slug]\n // actually being requested\n if (paramsMatch) {\n params = Object.assign({}, paramsMatch)\n }\n }\n }\n }\n\n // Remove any normalized params from the query if they\n // weren't present as non-prefixed query key e.g.\n // ?search=1&nxtPsearch=hello we don't delete search\n for (const key of routeParamKeys) {\n if (!(key in originalQuery)) {\n delete query[key]\n // handle the case where there's collision and we\n // normalized nxtPid=123 -> id=123 but user also\n // sends id=456 as separate key\n } else if (\n originalQuery[key] &&\n query[key] &&\n originalQuery[key] !== query[key]\n ) {\n query[key] = originalQuery[key]\n }\n }\n\n const { isOnDemandRevalidate, revalidateOnlyGenerated } =\n checkIsOnDemandRevalidate(req, prerenderManifest.preview)\n\n let isDraftMode = false\n let previewData: PreviewData\n\n // preview data relies on non-edge utils\n if (process.env.NEXT_RUNTIME !== 'edge' && res) {\n const { tryGetPreviewData } =\n require('../api-utils/node/try-get-preview-data') as typeof import('../api-utils/node/try-get-preview-data')\n\n previewData = tryGetPreviewData(\n req,\n res,\n prerenderManifest.preview,\n Boolean(multiZoneDraftMode)\n )\n isDraftMode = previewData !== false\n }\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { installProcessErrorHandlers } =\n require('../node-environment-extensions/process-error-handlers') as typeof import('../node-environment-extensions/process-error-handlers')\n\n installProcessErrorHandlers(\n Boolean(\n nextConfig.experimental.removeUncaughtErrorAndRejectionListeners\n )\n )\n }\n\n let resolvedPathname = normalizedSrcPage\n if (isDynamicRoute(resolvedPathname) && params) {\n resolvedPathname = serverUtils.interpolateDynamicPath(\n resolvedPathname,\n params\n )\n }\n\n if (resolvedPathname === '/index') {\n resolvedPathname = '/'\n }\n\n if (\n res &&\n Boolean(req.headers['x-nextjs-data']) &&\n (!res.statusCode || res.statusCode === 200)\n ) {\n res.setHeader(\n 'x-nextjs-matched-path',\n removeTrailingSlash(`${locale ? `/${locale}` : ''}${normalizedSrcPage}`)\n )\n }\n const encodedResolvedPathname = resolvedPathname\n\n // we decode for cache key/manifest usage encoded is\n // for URL building\n try {\n resolvedPathname = decodePathParams(resolvedPathname)\n } catch (_) {}\n\n resolvedPathname = removeTrailingSlash(resolvedPathname)\n addRequestMeta(req, 'resolvedPathname', resolvedPathname)\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return {\n query,\n originalQuery,\n originalPathname,\n params,\n parsedUrl,\n locale,\n isNextDataRequest,\n locales: i18n?.locales,\n defaultLocale,\n isDraftMode,\n previewData,\n pageIsDynamic,\n resolvedPathname,\n encodedResolvedPathname,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n ...manifests,\n // loadManifest returns a readonly object, but we don't want to propagate that throughout the\n // whole codebase (for now)\n nextConfig:\n nextConfig satisfies DeepReadonly<NextConfigRuntime> as NextConfigRuntime,\n routerServerContext,\n deploymentId,\n clientAssetToken:\n nextConfig.experimental.immutableAssetToken || deploymentId,\n }\n }\n\n public getResponseCache(req: IncomingMessage | BaseNextRequest) {\n if (!this.responseCache) {\n const minimalMode = getRequestMeta(req, 'minimalMode') ?? false\n this.responseCache = new ResponseCache(minimalMode)\n }\n return this.responseCache\n }\n\n public async handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind,\n isFallback,\n prerenderManifest,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil,\n isMinimalMode,\n }: {\n req: IncomingMessage | BaseNextRequest\n nextConfig: NextConfigRuntime\n cacheKey: string | null\n routeKind: RouteKind\n isFallback?: boolean\n prerenderManifest: DeepReadonly<PrerenderManifest>\n isRoutePPREnabled?: boolean\n isOnDemandRevalidate?: boolean\n revalidateOnlyGenerated?: boolean\n responseGenerator: ResponseGenerator\n waitUntil?: (prom: Promise<any>) => void\n isMinimalMode: boolean\n }) {\n const responseCache = this.getResponseCache(req)\n const cacheEntry = await responseCache.get(cacheKey, responseGenerator, {\n routeKind,\n isFallback,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n isPrefetch: req.headers.purpose === 'prefetch',\n // Use x-invocation-id header to scope the in-memory cache to a single\n // revalidation request in minimal mode.\n invocationID: req.headers['x-invocation-id'] as string | undefined,\n incrementalCache: await this.getIncrementalCache(\n req,\n nextConfig,\n prerenderManifest,\n isMinimalMode\n ),\n waitUntil,\n })\n\n if (!cacheEntry) {\n if (\n cacheKey &&\n // revalidate only generated can bail even if cacheKey is provided\n !(isOnDemandRevalidate && revalidateOnlyGenerated)\n ) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n }\n return cacheEntry\n }\n}\n"],"names":["BUILD_ID_FILE","BUILD_MANIFEST","CLIENT_REFERENCE_MANIFEST","DYNAMIC_CSS_MANIFEST","NEXT_FONT_MANIFEST","PRERENDER_MANIFEST","REACT_LOADABLE_MANIFEST","ROUTES_MANIFEST","SERVER_FILES_MANIFEST","SERVER_REFERENCE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","parseReqUrl","normalizeLocalePath","isDynamicRoute","removePathPrefix","getServerUtils","detectDomainLocale","getHostname","checkIsOnDemandRevalidate","normalizeDataPath","pathHasPrefix","addRequestMeta","getRequestMeta","normalizePagePath","isStaticMetadataRoute","IncrementalCache","initializeCacheHandlers","setCacheHandler","interopDefault","RouteKind","ResponseCache","normalizeAppPath","RouterServerContextSymbol","routerServerGlobal","decodePathParams","removeTrailingSlash","isInterceptionRouteRewrite","dynamicImportEsmDefault","id","then","mod","default","RouteModule","constructor","userland","definition","distDir","relativeProjectDir","isDev","process","env","__NEXT_DEV_SERVER","normalizeUrl","_req","_parsedUrl","instrumentationOnRequestError","req","args","NEXT_RUNTIME","getEdgeInstrumentationModule","instrumentation","onRequestError","join","require","absoluteProjectDir","cwd","loadManifests","srcPage","projectDir","result","self","getEdgePreviewProps","maybeJSONParse","str","JSON","parse","undefined","buildId","__NEXT_BUILD_ID","buildManifest","__BUILD_MANIFEST","fallbackBuildManifest","reactLoadableManifest","__REACT_LOADABLE_MANIFEST","nextFontManifest","__NEXT_FONT_MANIFEST","prerenderManifest","routes","dynamicRoutes","notFoundRoutes","version","preview","routesManifest","caseSensitive","Boolean","__NEXT_CASE_SENSITIVE_ROUTES","basePath","__NEXT_BASE_PATH","rewrites","__NEXT_REWRITES","beforeFiles","afterFiles","fallback","redirects","headers","onMatchHeaders","i18n","__NEXT_I18N_CONFIG","skipProxyUrlNormalize","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","serverFilesManifest","__SERVER_FILES_MANIFEST","clientReferenceManifest","__RSC_MANIFEST","serverActionsManifest","__RSC_SERVER_MANIFEST","subresourceIntegrityManifest","__SUBRESOURCE_INTEGRITY_MANIFEST","dynamicCssManifest","__DYNAMIC_CSS_MANIFEST","interceptionRoutePatterns","__INTERCEPTION_ROUTE_REWRITE_MANIFEST","map","rewrite","RegExp","regex","Error","loadManifestFromRelativePath","normalizedPagePath","router","kind","PAGES","PAGES_API","manifest","shouldCache","handleMissing","TURBOPACK","useEval","replace","skipParse","filter","loadCustomCacheHandlers","nextConfig","cacheMaxMemorySize","cacheHandlers","handler","Object","entries","formatDynamicImportPath","getIncrementalCache","isMinimalMode","globalThis","__incrementalCache","CacheHandler","cacheHandler","incrementalCache","fs","nodeFs","dev","requestHeaders","allowedRevalidateHeaderKeys","experimental","minimalMode","serverDistDir","fetchCacheKeyPrefix","maxMemoryCacheSize","flushToDisk","isrFlushToDisk","getPrerenderManifest","CurCacheHandler","err","errorContext","silenceLog","routerServerContext","logErrorWithOriginalStack","console","error","path","url","method","getNextConfigEdge","config","deploymentId","runtimeServerDeploymentId","NEXT_DEPLOYMENT_ID","prepare","res","multiZoneDraftMode","relative","absoluteDistDir","ensureInstrumentationRegistered","manifests","protocol","includes","initUrl","trustHostHeader","host","hostname","parsedUrl","query","isNextDataRequest","pathname","originalPathname","originalQuery","pageIsDynamic","localeResult","detectedLocale","locales","search","normalizedSrcPage","serverUtils","page","trailingSlash","__NEXT_TRAILING_SLASH","domainLocale","domains","defaultLocale","locale","rewriteParams","rewrittenParsedUrl","handleRewrites","rewriteParamKeys","keys","assign","params","dynamicRouteMatcher","paramsMatch","paramsResult","normalizeDynamicRouteParams","hasValidParams","routeParamKeys","Set","combinedParamKeys","key","defaultRouteMatches","originalValue","Array","isArray","queryValue","push","normalizeCdnUrl","normalizeQueryParams","filterInternalQuery","queryResult","paramsToInterpolate","size","length","interpolateDynamicPath","isOnDemandRevalidate","revalidateOnlyGenerated","isDraftMode","previewData","tryGetPreviewData","installProcessErrorHandlers","removeUncaughtErrorAndRejectionListeners","resolvedPathname","statusCode","setHeader","encodedResolvedPathname","_","clientAssetToken","immutableAssetToken","getResponseCache","responseCache","handleResponse","cacheKey","routeKind","isFallback","isRoutePPREnabled","responseGenerator","waitUntil","cacheEntry","get","isP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ACzB,MAAM,qBAA8D,CAA9D,IAAI3H,MAAM,sDAAV,qBAAA;2BAAA;gCAAA;kCAAA;gBAA6D;YACrE;QACF;QACA,OAAOiJ;IACT;AACF","ignoreList":[0]}
export function isStableBuild() {
return !"16.2.0-canary.72"?.includes('canary') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
return !"16.2.0-canary.73"?.includes('canary') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
}

@@ -4,0 +4,0 @@ export class CanaryOnlyConfigError extends Error {

@@ -6,3 +6,2 @@ import { APP_PATHS_MANIFEST, BUILD_MANIFEST, CLIENT_STATIC_FILES_PATH, INTERCEPTION_ROUTE_REWRITE_MANIFEST, MIDDLEWARE_BUILD_MANIFEST, MIDDLEWARE_MANIFEST, NEXT_FONT_MANIFEST, PAGES_MANIFEST, SERVER_REFERENCE_MANIFEST, SUBRESOURCE_INTEGRITY_MANIFEST, TURBOPACK_CLIENT_BUILD_MANIFEST, TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST, WEBPACK_STATS } from '../constants';

import { writeFileAtomic } from '../../../lib/fs/write-atomic';
import { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites';
import getAssetPathFromRoute from '../router/utils/get-asset-path-from-route';

@@ -310,3 +309,3 @@ import { getEntryKey } from './entry-key';

};
const interceptionRewrites = JSON.stringify(rewrites.beforeFiles.filter(isInterceptionRouteRewrite));
const interceptionRewrites = JSON.stringify(rewrites.beforeFiles.filter(require('../../../lib/is-interception-route-rewrite').isInterceptionRouteRewrite));
if (this.cachedInterceptionRewrites === interceptionRewrites) {

@@ -313,0 +312,0 @@ return;

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../../src/shared/lib/turbopack/manifest-loader.ts"],"sourcesContent":["import type {\n EdgeFunctionDefinition,\n MiddlewareManifest,\n} from '../../../build/webpack/plugins/middleware-plugin'\nimport type {\n StatsAsset,\n StatsChunk,\n StatsChunkGroup,\n StatsModule,\n StatsCompilation as WebpackStats,\n} from 'webpack'\nimport type { BuildManifest } from '../../../server/get-page-files'\nimport type { PagesManifest } from '../../../build/webpack/plugins/pages-manifest-plugin'\nimport type { ActionManifest } from '../../../build/webpack/plugins/flight-client-entry-plugin'\nimport type { NextFontManifest } from '../../../build/webpack/plugins/next-font-manifest-plugin'\nimport type { REACT_LOADABLE_MANIFEST } from '../constants'\nimport {\n APP_PATHS_MANIFEST,\n BUILD_MANIFEST,\n CLIENT_STATIC_FILES_PATH,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n MIDDLEWARE_BUILD_MANIFEST,\n MIDDLEWARE_MANIFEST,\n NEXT_FONT_MANIFEST,\n PAGES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST,\n WEBPACK_STATS,\n} from '../constants'\nimport { join, posix } from 'path'\nimport { readFileSync } from 'fs'\nimport type { SetupOpts } from '../../../server/lib/router-utils/setup-dev-bundler'\nimport { deleteCache } from '../../../server/dev/require-cache'\nimport { writeFileAtomic } from '../../../lib/fs/write-atomic'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport getAssetPathFromRoute from '../router/utils/get-asset-path-from-route'\nimport { getEntryKey, type EntryKey } from './entry-key'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { getSortedRoutes } from '../router/utils'\nimport { existsSync } from 'fs'\nimport {\n addMetadataIdToRoute,\n addRouteSuffix,\n removeRouteSuffix,\n} from '../../../server/dev/turbopack-utils'\nimport { tryToParsePath } from '../../../lib/try-to-parse-path'\nimport { safePathToRegexp } from '../router/utils/route-match-utils'\nimport type { Entrypoints } from '../../../build/swc/types'\nimport {\n normalizeRewritesForBuildManifest,\n type ClientBuildManifest,\n srcEmptySsgManifest,\n processRoute,\n createEdgeRuntimeManifest,\n} from '../../../build/webpack/plugins/build-manifest-plugin-utils'\nimport type { SubresourceIntegrityManifest } from '../../../build'\n\ninterface InstrumentationDefinition {\n files: string[]\n name: 'instrumentation'\n}\n\ntype TurbopackMiddlewareManifest = MiddlewareManifest & {\n instrumentation?: InstrumentationDefinition\n}\n\ntype ManifestName =\n | typeof MIDDLEWARE_MANIFEST\n | typeof BUILD_MANIFEST\n | typeof PAGES_MANIFEST\n | typeof WEBPACK_STATS\n | typeof APP_PATHS_MANIFEST\n | `${typeof SERVER_REFERENCE_MANIFEST}.json`\n | `${typeof SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n | `${typeof NEXT_FONT_MANIFEST}.json`\n | typeof REACT_LOADABLE_MANIFEST\n | typeof TURBOPACK_CLIENT_BUILD_MANIFEST\n\nconst getManifestPath = (\n page: string,\n distDir: string,\n name: ManifestName,\n type: string,\n firstCall: boolean\n) => {\n let manifestPath = posix.join(\n distDir,\n `server`,\n type,\n type === 'middleware' || type === 'instrumentation'\n ? ''\n : type === 'app'\n ? page\n : getAssetPathFromRoute(page),\n name\n )\n\n if (firstCall) {\n const isSitemapRoute = /[\\\\/]sitemap(.xml)?\\/route$/.test(page)\n // Check the ambiguity of /sitemap and /sitemap.xml\n if (isSitemapRoute && !existsSync(manifestPath)) {\n manifestPath = getManifestPath(\n page.replace(/\\/sitemap\\/route$/, '/sitemap.xml/route'),\n distDir,\n name,\n type,\n false\n )\n }\n // existsSync is faster than using the async version\n if (!existsSync(manifestPath) && page.endsWith('/route')) {\n // TODO: Improve implementation of metadata routes, currently it requires this extra check for the variants of the files that can be written.\n let basePage = removeRouteSuffix(page)\n // For sitemap.xml routes with generateSitemaps, the manifest is at\n // /sitemap/[__metadata_id__]/route (without .xml), because the route\n // handler serves at /sitemap/[id] not /sitemap.xml/[id]\n if (basePage.endsWith('/sitemap.xml')) {\n basePage = basePage.slice(0, -'.xml'.length)\n }\n let metadataPage = addRouteSuffix(addMetadataIdToRoute(basePage))\n manifestPath = getManifestPath(metadataPage, distDir, name, type, false)\n }\n }\n\n return manifestPath\n}\n\nfunction readPartialManifestContent(\n distDir: string,\n name: ManifestName,\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation' = 'pages'\n): string {\n const page = pageName\n const manifestPath = getManifestPath(page, distDir, name, type, true)\n return readFileSync(posix.join(manifestPath), 'utf-8')\n}\n\n/// Helper class that stores a map of manifests and tracks if they have changed\n/// since the last time they were written to disk. This is used to avoid\n/// unnecessary writes to disk.\nclass ManifestsMap<K, V> {\n private rawMap = new Map<K, string>()\n private map = new Map<K, V>()\n private extraInvalidationKey: string | undefined = undefined\n private changed = true\n\n set(key: K, value: string) {\n if (this.rawMap.get(key) === value) return\n this.changed = true\n this.rawMap.set(key, value)\n this.map.set(key, JSON.parse(value))\n }\n\n delete(key: K) {\n if (this.map.has(key)) {\n this.changed = true\n this.rawMap.delete(key)\n this.map.delete(key)\n }\n }\n\n get(key: K) {\n return this.map.get(key)\n }\n\n takeChanged(extraInvalidationKey?: any) {\n let changed = this.changed\n if (extraInvalidationKey !== undefined) {\n const stringified = JSON.stringify(extraInvalidationKey)\n if (this.extraInvalidationKey !== stringified) {\n this.extraInvalidationKey = stringified\n changed = true\n }\n }\n this.changed = false\n return changed\n }\n\n values() {\n return this.map.values()\n }\n}\n\nexport class TurbopackManifestLoader {\n private actionManifests: ManifestsMap<EntryKey, ActionManifest> =\n new ManifestsMap()\n private appPathsManifests: ManifestsMap<EntryKey, PagesManifest> =\n new ManifestsMap()\n private buildManifests: ManifestsMap<EntryKey, BuildManifest> =\n new ManifestsMap()\n private clientBuildManifests: ManifestsMap<EntryKey, ClientBuildManifest> =\n new ManifestsMap()\n private fontManifests: ManifestsMap<EntryKey, NextFontManifest> =\n new ManifestsMap()\n private middlewareManifests: ManifestsMap<\n EntryKey,\n TurbopackMiddlewareManifest\n > = new ManifestsMap()\n private pagesManifests: ManifestsMap<string, PagesManifest> =\n new ManifestsMap()\n private webpackStats: ManifestsMap<EntryKey, WebpackStats> =\n new ManifestsMap()\n private sriManifests: ManifestsMap<EntryKey, SubresourceIntegrityManifest> =\n new ManifestsMap()\n private encryptionKey: string\n /// interceptionRewrites that have been written to disk\n /// This is used to avoid unnecessary writes if the rewrites haven't changed\n private cachedInterceptionRewrites: string | undefined = undefined\n\n private readonly distDir: string\n private readonly buildId: string\n private readonly dev: boolean\n private readonly sriEnabled: boolean\n\n constructor({\n distDir,\n buildId,\n encryptionKey,\n dev,\n sriEnabled,\n }: {\n buildId: string\n distDir: string\n encryptionKey: string\n dev: boolean\n sriEnabled: boolean\n }) {\n this.distDir = distDir\n this.buildId = buildId\n this.encryptionKey = encryptionKey\n this.dev = dev\n this.sriEnabled = sriEnabled\n }\n\n delete(key: EntryKey) {\n this.actionManifests.delete(key)\n this.appPathsManifests.delete(key)\n this.buildManifests.delete(key)\n this.clientBuildManifests.delete(key)\n this.fontManifests.delete(key)\n this.middlewareManifests.delete(key)\n this.pagesManifests.delete(key)\n this.webpackStats.delete(key)\n }\n\n loadActionManifest(pageName: string): void {\n this.actionManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SERVER_REFERENCE_MANIFEST}.json`,\n pageName,\n 'app'\n )\n )\n }\n\n private mergeActionManifests(manifests: Iterable<ActionManifest>) {\n type ActionEntries = ActionManifest['edge' | 'node']\n const manifest: ActionManifest = {\n node: {},\n edge: {},\n encryptionKey: this.encryptionKey,\n }\n\n function mergeActionIds(\n actionEntries: ActionEntries,\n other: ActionEntries\n ): void {\n for (const key in other) {\n const action = (actionEntries[key] ??= {\n workers: {},\n layer: {},\n })\n action.filename = other[key].filename\n action.exportedName = other[key].exportedName\n Object.assign(action.workers, other[key].workers)\n Object.assign(action.layer, other[key].layer)\n }\n }\n\n for (const m of manifests) {\n mergeActionIds(manifest.node, m.node)\n mergeActionIds(manifest.edge, m.edge)\n }\n for (const key in manifest.node) {\n const entry = manifest.node[key]\n entry.workers = sortObjectByKey(entry.workers)\n entry.layer = sortObjectByKey(entry.layer)\n }\n for (const key in manifest.edge) {\n const entry = manifest.edge[key]\n entry.workers = sortObjectByKey(entry.workers)\n entry.layer = sortObjectByKey(entry.layer)\n }\n\n return manifest\n }\n\n private writeActionManifest(): void {\n if (!this.actionManifests.takeChanged()) {\n return\n }\n const actionManifest = this.mergeActionManifests(\n this.actionManifests.values()\n )\n const actionManifestJsonPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.json`\n )\n const actionManifestJsPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.js`\n )\n const json = JSON.stringify(actionManifest, null, 2)\n deleteCache(actionManifestJsonPath)\n deleteCache(actionManifestJsPath)\n writeFileAtomic(actionManifestJsonPath, json)\n writeFileAtomic(\n actionManifestJsPath,\n `self.__RSC_SERVER_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n loadAppPathsManifest(pageName: string): void {\n this.appPathsManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n APP_PATHS_MANIFEST,\n pageName,\n 'app'\n )\n )\n }\n\n private writeAppPathsManifest(): void {\n if (!this.appPathsManifests.takeChanged()) {\n return\n }\n const appPathsManifest = this.mergePagesManifests(\n this.appPathsManifests.values()\n )\n const appPathsManifestPath = join(\n this.distDir,\n 'server',\n APP_PATHS_MANIFEST\n )\n deleteCache(appPathsManifestPath)\n writeFileAtomic(\n appPathsManifestPath,\n JSON.stringify(appPathsManifest, null, 2)\n )\n }\n\n private writeWebpackStats(): void {\n if (!this.webpackStats.takeChanged()) {\n return\n }\n const webpackStats = this.mergeWebpackStats(this.webpackStats.values())\n const path = join(this.distDir, 'server', WEBPACK_STATS)\n deleteCache(path)\n writeFileAtomic(path, JSON.stringify(webpackStats, null, 2))\n }\n\n private writeSriManifest(): void {\n if (!this.sriEnabled || !this.sriManifests.takeChanged()) {\n return\n }\n const sriManifest = this.mergeSriManifests(this.sriManifests.values())\n const pathJson = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n )\n const pathJs = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.js`\n )\n deleteCache(pathJson)\n deleteCache(pathJs)\n writeFileAtomic(pathJson, JSON.stringify(sriManifest, null, 2))\n writeFileAtomic(\n pathJs,\n `self.__SUBRESOURCE_INTEGRITY_MANIFEST=${JSON.stringify(\n JSON.stringify(sriManifest)\n )}`\n )\n }\n\n loadBuildManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.buildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(this.distDir, BUILD_MANIFEST, pageName, type)\n )\n }\n\n loadClientBuildManifest(\n pageName: string,\n type: 'app' | 'pages' = 'pages'\n ): void {\n this.clientBuildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n pageName,\n type\n )\n )\n }\n\n loadWebpackStats(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.webpackStats.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(this.distDir, WEBPACK_STATS, pageName, type)\n )\n }\n\n loadSriManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n if (!this.sriEnabled) return\n this.sriManifests.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeWebpackStats(statsFiles: Iterable<WebpackStats>): WebpackStats {\n const entrypoints: Record<string, StatsChunkGroup> = {}\n const assets: Map<string, StatsAsset> = new Map()\n const chunks: Map<string | number, StatsChunk> = new Map()\n const modules: Map<string | number, StatsModule> = new Map()\n\n for (const statsFile of statsFiles) {\n if (statsFile.entrypoints) {\n for (const [k, v] of Object.entries(statsFile.entrypoints)) {\n if (!entrypoints[k]) {\n entrypoints[k] = v\n }\n }\n }\n\n if (statsFile.assets) {\n for (const asset of statsFile.assets) {\n if (!assets.has(asset.name)) {\n assets.set(asset.name, asset)\n }\n }\n }\n\n if (statsFile.chunks) {\n for (const chunk of statsFile.chunks) {\n if (!chunks.has(chunk.id!)) {\n chunks.set(chunk.id!, chunk)\n }\n }\n }\n\n if (statsFile.modules) {\n for (const module of statsFile.modules) {\n const id = module.id\n if (id != null) {\n // Merge the chunk list for the module. This can vary across endpoints.\n const existing = modules.get(id)\n if (existing == null) {\n modules.set(id, module)\n } else if (module.chunks != null && existing.chunks != null) {\n for (const chunk of module.chunks) {\n if (!existing.chunks.includes(chunk)) {\n existing.chunks.push(chunk)\n }\n }\n }\n }\n }\n }\n }\n\n return {\n version: 'Turbopack',\n entrypoints,\n assets: [...assets.values()],\n chunks: [...chunks.values()],\n modules: [...modules.values()],\n }\n }\n\n private mergeBuildManifests(\n manifests: Iterable<BuildManifest>,\n lowPriorityFiles: string[]\n ) {\n const manifest: Partial<BuildManifest> & Pick<BuildManifest, 'pages'> = {\n pages: {\n '/_app': [],\n },\n // Something in next.js depends on these to exist even for app dir rendering\n devFiles: [],\n polyfillFiles: [],\n lowPriorityFiles,\n rootMainFiles: [],\n }\n for (const m of manifests) {\n Object.assign(manifest.pages, m.pages)\n if (m.rootMainFiles.length) manifest.rootMainFiles = m.rootMainFiles\n // polyfillFiles should always be the same, so we can overwrite instead of actually merging\n if (m.polyfillFiles.length) manifest.polyfillFiles = m.polyfillFiles\n }\n manifest.pages = sortObjectByKey(manifest.pages) as BuildManifest['pages']\n return manifest\n }\n\n private mergeClientBuildManifests(\n manifests: Iterable<ClientBuildManifest>,\n rewrites: CustomRoutes['rewrites'],\n sortedPageKeys: string[]\n ): ClientBuildManifest {\n const manifest = {\n __rewrites: rewrites as any,\n sortedPages: sortedPageKeys,\n }\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writeInterceptionRouteRewriteManifest(\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): void {\n const rewrites = productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n\n const interceptionRewrites = JSON.stringify(\n rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n\n if (this.cachedInterceptionRewrites === interceptionRewrites) {\n return\n }\n this.cachedInterceptionRewrites = interceptionRewrites\n\n const interceptionRewriteManifestPath = join(\n this.distDir,\n 'server',\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n deleteCache(interceptionRewriteManifestPath)\n\n writeFileAtomic(\n interceptionRewriteManifestPath,\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )};`\n )\n }\n\n private writeBuildManifest(lowPriorityFiles: string[]): void {\n if (!this.buildManifests.takeChanged()) {\n return\n }\n const buildManifest = this.mergeBuildManifests(\n this.buildManifests.values(),\n lowPriorityFiles\n )\n\n const buildManifestPath = join(this.distDir, BUILD_MANIFEST)\n const middlewareBuildManifestPath = join(\n this.distDir,\n 'server',\n `${MIDDLEWARE_BUILD_MANIFEST}.js`\n )\n\n deleteCache(buildManifestPath)\n deleteCache(middlewareBuildManifestPath)\n writeFileAtomic(buildManifestPath, JSON.stringify(buildManifest, null, 2))\n writeFileAtomic(\n middlewareBuildManifestPath,\n createEdgeRuntimeManifest(buildManifest)\n )\n\n // Write fallback build manifest\n const fallbackBuildManifest = this.mergeBuildManifests(\n [\n this.buildManifests.get(getEntryKey('pages', 'server', '_app')),\n this.buildManifests.get(getEntryKey('pages', 'server', '_error')),\n ].filter(Boolean) as BuildManifest[],\n lowPriorityFiles\n )\n const fallbackBuildManifestPath = join(\n this.distDir,\n `fallback-${BUILD_MANIFEST}`\n )\n deleteCache(fallbackBuildManifestPath)\n writeFileAtomic(\n fallbackBuildManifestPath,\n JSON.stringify(fallbackBuildManifest, null, 2)\n )\n }\n\n private writeClientBuildManifest(\n entrypoints: Entrypoints,\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): string[] {\n const rewrites = normalizeRewritesForBuildManifest(\n productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n )\n\n const pagesKeys = [...entrypoints.page.keys()]\n if (entrypoints.global.app) {\n pagesKeys.push('/_app')\n }\n if (entrypoints.global.error) {\n pagesKeys.push('/_error')\n }\n\n const sortedPageKeys = getSortedRoutes(pagesKeys)\n\n let buildManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_buildManifest.js'\n )\n let ssgManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_ssgManifest.js'\n )\n\n if (\n this.dev &&\n !this.clientBuildManifests.takeChanged({ rewrites, sortedPageKeys })\n ) {\n return [buildManifestPath, ssgManifestPath]\n }\n\n const clientBuildManifest = this.mergeClientBuildManifests(\n this.clientBuildManifests.values(),\n rewrites,\n sortedPageKeys\n )\n const clientBuildManifestJs = `self.__BUILD_MANIFEST = ${JSON.stringify(\n clientBuildManifest,\n null,\n 2\n )};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`\n\n writeFileAtomic(\n join(this.distDir, buildManifestPath),\n clientBuildManifestJs\n )\n // This is just an empty placeholder, the actual manifest is written after prerendering in\n // packages/next/src/build/index.ts\n writeFileAtomic(join(this.distDir, ssgManifestPath), srcEmptySsgManifest)\n\n return [buildManifestPath, ssgManifestPath]\n }\n\n loadFontManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.fontManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${NEXT_FONT_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeFontManifests(manifests: Iterable<NextFontManifest>) {\n const manifest: NextFontManifest = {\n app: {},\n appUsingSizeAdjust: false,\n pages: {},\n pagesUsingSizeAdjust: false,\n }\n for (const m of manifests) {\n Object.assign(manifest.app, m.app)\n Object.assign(manifest.pages, m.pages)\n\n manifest.appUsingSizeAdjust =\n manifest.appUsingSizeAdjust || m.appUsingSizeAdjust\n manifest.pagesUsingSizeAdjust =\n manifest.pagesUsingSizeAdjust || m.pagesUsingSizeAdjust\n }\n manifest.app = sortObjectByKey(manifest.app)\n manifest.pages = sortObjectByKey(manifest.pages)\n return manifest\n }\n\n private async writeNextFontManifest(): Promise<void> {\n if (!this.fontManifests.takeChanged()) {\n return\n }\n const fontManifest = this.mergeFontManifests(this.fontManifests.values())\n const json = JSON.stringify(fontManifest, null, 2)\n\n const fontManifestJsonPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.json`\n )\n const fontManifestJsPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.js`\n )\n deleteCache(fontManifestJsonPath)\n deleteCache(fontManifestJsPath)\n writeFileAtomic(fontManifestJsonPath, json)\n writeFileAtomic(\n fontManifestJsPath,\n `self.__NEXT_FONT_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n /**\n * @returns If the manifest was written or not\n */\n loadMiddlewareManifest(\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation'\n ): boolean {\n const middlewareManifestPath = getManifestPath(\n pageName,\n this.distDir,\n MIDDLEWARE_MANIFEST,\n type,\n true\n )\n\n // middlewareManifest is actually \"edge manifest\" and not all routes are edge runtime. If it is not written we skip it.\n if (!existsSync(middlewareManifestPath)) {\n return false\n }\n\n this.middlewareManifests.set(\n getEntryKey(\n type === 'middleware' || type === 'instrumentation' ? 'root' : type,\n 'server',\n pageName\n ),\n readPartialManifestContent(\n this.distDir,\n MIDDLEWARE_MANIFEST,\n pageName,\n type\n )\n )\n\n return true\n }\n\n getMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.get(key)\n }\n\n deleteMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.delete(key)\n }\n\n private mergeMiddlewareManifests(\n manifests: Iterable<TurbopackMiddlewareManifest>\n ): MiddlewareManifest {\n const manifest: MiddlewareManifest = {\n version: 3,\n middleware: {},\n sortedMiddleware: [],\n functions: {},\n }\n let instrumentation: InstrumentationDefinition | undefined = undefined\n for (const m of manifests) {\n Object.assign(manifest.functions, m.functions)\n Object.assign(manifest.middleware, m.middleware)\n if (m.instrumentation) {\n instrumentation = m.instrumentation\n }\n }\n manifest.functions = sortObjectByKey(manifest.functions)\n manifest.middleware = sortObjectByKey(manifest.middleware)\n const updateFunctionDefinition = (\n fun: EdgeFunctionDefinition\n ): EdgeFunctionDefinition => {\n return {\n ...fun,\n files: [...(instrumentation?.files ?? []), ...fun.files],\n }\n }\n for (const key of Object.keys(manifest.middleware)) {\n const value = manifest.middleware[key]\n manifest.middleware[key] = updateFunctionDefinition(value)\n }\n for (const key of Object.keys(manifest.functions)) {\n const value = manifest.functions[key]\n manifest.functions[key] = updateFunctionDefinition(value)\n }\n for (const fun of Object.values(manifest.functions).concat(\n Object.values(manifest.middleware)\n )) {\n for (const matcher of fun.matchers) {\n if (!matcher.regexp) {\n matcher.regexp = safePathToRegexp(matcher.originalSource, [], {\n delimiter: '/',\n sensitive: false,\n strict: true,\n }).source.replaceAll('\\\\/', '/')\n }\n }\n }\n manifest.sortedMiddleware = Object.keys(manifest.middleware)\n\n return manifest\n }\n\n private writeMiddlewareManifest(): {\n clientMiddlewareManifestPath: string\n } {\n let clientMiddlewareManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST\n )\n\n if (this.dev && !this.middlewareManifests.takeChanged()) {\n return {\n clientMiddlewareManifestPath,\n }\n }\n const middlewareManifest = this.mergeMiddlewareManifests(\n this.middlewareManifests.values()\n )\n\n // Server middleware manifest\n\n // Normalize regexes as it uses path-to-regexp\n for (const key in middlewareManifest.middleware) {\n middlewareManifest.middleware[key].matchers.forEach((matcher) => {\n if (!matcher.regexp.startsWith('^')) {\n const parsedPage = tryToParsePath(matcher.regexp)\n if (parsedPage.error || !parsedPage.regexStr) {\n throw new Error(`Invalid source: ${matcher.regexp}`)\n }\n matcher.regexp = parsedPage.regexStr\n }\n })\n }\n\n const middlewareManifestPath = join(\n this.distDir,\n 'server',\n MIDDLEWARE_MANIFEST\n )\n deleteCache(middlewareManifestPath)\n writeFileAtomic(\n middlewareManifestPath,\n JSON.stringify(middlewareManifest, null, 2)\n )\n\n // Client middleware manifest This is only used in dev though, packages/next/src/build/index.ts\n // writes the mainfest again for builds.\n const matchers = middlewareManifest?.middleware['/']?.matchers || []\n\n const clientMiddlewareManifestJs = `self.__MIDDLEWARE_MATCHERS = ${JSON.stringify(\n matchers,\n null,\n 2\n )};self.__MIDDLEWARE_MATCHERS_CB && self.__MIDDLEWARE_MATCHERS_CB()`\n\n deleteCache(clientMiddlewareManifestPath)\n writeFileAtomic(\n join(this.distDir, clientMiddlewareManifestPath),\n clientMiddlewareManifestJs\n )\n\n return {\n clientMiddlewareManifestPath,\n }\n }\n\n loadPagesManifest(pageName: string): void {\n this.pagesManifests.set(\n getEntryKey('pages', 'server', pageName),\n readPartialManifestContent(this.distDir, PAGES_MANIFEST, pageName)\n )\n }\n\n private mergePagesManifests(manifests: Iterable<PagesManifest>) {\n const manifest: PagesManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private mergeSriManifests(manifests: Iterable<SubresourceIntegrityManifest>) {\n const manifest: SubresourceIntegrityManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writePagesManifest(): void {\n if (!this.pagesManifests.takeChanged()) {\n return\n }\n const pagesManifest = this.mergePagesManifests(this.pagesManifests.values())\n const pagesManifestPath = join(this.distDir, 'server', PAGES_MANIFEST)\n deleteCache(pagesManifestPath)\n writeFileAtomic(pagesManifestPath, JSON.stringify(pagesManifest, null, 2))\n }\n\n writeManifests({\n devRewrites,\n productionRewrites,\n entrypoints,\n }: {\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined\n productionRewrites: CustomRoutes['rewrites'] | undefined\n entrypoints: Entrypoints\n }): void {\n this.writeActionManifest()\n this.writeAppPathsManifest()\n const lowPriorityFiles = this.writeClientBuildManifest(\n entrypoints,\n devRewrites,\n productionRewrites\n )\n const { clientMiddlewareManifestPath } = this.writeMiddlewareManifest()\n this.writeBuildManifest([...lowPriorityFiles, clientMiddlewareManifestPath])\n this.writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites)\n this.writeNextFontManifest()\n this.writePagesManifest()\n\n this.writeSriManifest()\n\n if (process.env.TURBOPACK_STATS != null) {\n this.writeWebpackStats()\n }\n }\n}\n\nfunction sortObjectByKey(obj: Record<string, any>) {\n return Object.keys(obj)\n .sort()\n .reduce(\n (acc, key) => {\n acc[key] = obj[key]\n return acc\n },\n {} as Record<string, any>\n )\n}\n"],"names":["APP_PATHS_MANIFEST","BUILD_MANIFEST","CLIENT_STATIC_FILES_PATH","INTERCEPTION_ROUTE_REWRITE_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_MANIFEST","NEXT_FONT_MANIFEST","PAGES_MANIFEST","SERVER_REFERENCE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","TURBOPACK_CLIENT_BUILD_MANIFEST","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","WEBPACK_STATS","join","posix","readFileSync","deleteCache","writeFileAtomic","isInterceptionRouteRewrite","getAssetPathFromRoute","getEntryKey","getSortedRoutes","existsSync","addMetadataIdToRoute","addRouteSuffix","removeRouteSuffix","tryToParsePath","safePathToRegexp","normalizeRewritesForBuildManifest","srcEmptySsgManifest","processRoute","createEdgeRuntimeManifest","getManifestPath","page","distDir","name","type","firstCall","manifestPath","isSitemapRoute","test","replace","endsWith","basePage","slice","length","metadataPage","readPartialManifestContent","pageName","ManifestsMap","set","key","value","rawMap","get","changed","map","JSON","parse","delete","has","takeChanged","extraInvalidationKey","undefined","stringified","stringify","values","Map","TurbopackManifestLoader","constructor","buildId","encryptionKey","dev","sriEnabled","actionManifests","appPathsManifests","buildManifests","clientBuildManifests","fontManifests","middlewareManifests","pagesManifests","webpackStats","sriManifests","cachedInterceptionRewrites","loadActionManifest","mergeActionManifests","manifests","manifest","node","edge","mergeActionIds","actionEntries","other","action","workers","layer","filename","exportedName","Object","assign","m","entry","sortObjectByKey","writeActionManifest","actionManifest","actionManifestJsonPath","actionManifestJsPath","json","loadAppPathsManifest","writeAppPathsManifest","appPathsManifest","mergePagesManifests","appPathsManifestPath","writeWebpackStats","mergeWebpackStats","path","writeSriManifest","sriManifest","mergeSriManifests","pathJson","pathJs","loadBuildManifest","loadClientBuildManifest","loadWebpackStats","loadSriManifest","statsFiles","entrypoints","assets","chunks","modules","statsFile","k","v","entries","asset","chunk","id","module","existing","includes","push","version","mergeBuildManifests","lowPriorityFiles","pages","devFiles","polyfillFiles","rootMainFiles","mergeClientBuildManifests","rewrites","sortedPageKeys","__rewrites","sortedPages","writeInterceptionRouteRewriteManifest","devRewrites","productionRewrites","beforeFiles","afterFiles","fallback","interceptionRewrites","filter","interceptionRewriteManifestPath","writeBuildManifest","buildManifest","buildManifestPath","middlewareBuildManifestPath","fallbackBuildManifest","Boolean","fallbackBuildManifestPath","writeClientBuildManifest","pagesKeys","keys","global","app","error","ssgManifestPath","clientBuildManifest","clientBuildManifestJs","loadFontManifest","mergeFontManifests","appUsingSizeAdjust","pagesUsingSizeAdjust","writeNextFontManifest","fontManifest","fontManifestJsonPath","fontManifestJsPath","loadMiddlewareManifest","middlewareManifestPath","getMiddlewareManifest","deleteMiddlewareManifest","mergeMiddlewareManifests","middleware","sortedMiddleware","functions","instrumentation","updateFunctionDefinition","fun","files","concat","matcher","matchers","regexp","originalSource","delimiter","sensitive","strict","source","replaceAll","writeMiddlewareManifest","clientMiddlewareManifestPath","middlewareManifest","forEach","startsWith","parsedPage","regexStr","Error","clientMiddlewareManifestJs","loadPagesManifest","writePagesManifest","pagesManifest","pagesManifestPath","writeManifests","process","env","TURBOPACK_STATS","obj","sort","reduce","acc"],"mappings":"AAgBA,SACEA,kBAAkB,EAClBC,cAAc,EACdC,wBAAwB,EACxBC,mCAAmC,EACnCC,yBAAyB,EACzBC,mBAAmB,EACnBC,kBAAkB,EAClBC,cAAc,EACdC,yBAAyB,EACzBC,8BAA8B,EAC9BC,+BAA+B,EAC/BC,oCAAoC,EACpCC,aAAa,QACR,eAAc;AACrB,SAASC,IAAI,EAAEC,KAAK,QAAQ,OAAM;AAClC,SAASC,YAAY,QAAQ,KAAI;AAEjC,SAASC,WAAW,QAAQ,oCAAmC;AAC/D,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,SAASC,0BAA0B,QAAQ,qDAAoD;AAC/F,OAAOC,2BAA2B,4CAA2C;AAC7E,SAASC,WAAW,QAAuB,cAAa;AAExD,SAASC,eAAe,QAAQ,kBAAiB;AACjD,SAASC,UAAU,QAAQ,KAAI;AAC/B,SACEC,oBAAoB,EACpBC,cAAc,EACdC,iBAAiB,QACZ,sCAAqC;AAC5C,SAASC,cAAc,QAAQ,iCAAgC;AAC/D,SAASC,gBAAgB,QAAQ,oCAAmC;AAEpE,SACEC,iCAAiC,EAEjCC,mBAAmB,EACnBC,YAAY,EACZC,yBAAyB,QACpB,6DAA4D;AAwBnE,MAAMC,kBAAkB,CACtBC,MACAC,SACAC,MACAC,MACAC;IAEA,IAAIC,eAAexB,MAAMD,IAAI,CAC3BqB,SACA,CAAC,MAAM,CAAC,EACRE,MACAA,SAAS,gBAAgBA,SAAS,oBAC9B,KACAA,SAAS,QACPH,OACAd,sBAAsBc,OAC5BE;IAGF,IAAIE,WAAW;QACb,MAAME,iBAAiB,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;QACF;QACA,MAAM8J,gBAAgB,IAAI,CAAC5G,mBAAmB,CAAC,IAAI,CAAC/B,cAAc,CAACd,MAAM;QACzE,MAAM0J,oBAAoB/M,KAAK,IAAI,CAACqB,OAAO,EAAE,UAAU3B;QACvDS,YAAY4M;QACZ3M,gBAAgB2M,mBAAmBnK,KAAKQ,SAAS,CAAC0J,eAAe,MAAM;IACzE;IAEAE,eAAe,EACbnE,WAAW,EACXC,kBAAkB,EAClB7B,WAAW,EAKZ,EAAQ;QACP,IAAI,CAACvB,mBAAmB;QACxB,IAAI,CAACM,qBAAqB;QAC1B,MAAMkC,mBAAmB,IAAI,CAAC0B,wBAAwB,CACpD3C,aACA4B,aACAC;QAEF,MAAM,EAAEsD,4BAA4B,EAAE,GAAG,IAAI,CAACD,uBAAuB;QACrE,IAAI,CAAC9C,kBAAkB,CAAC;eAAInB;YAAkBkE;SAA6B;QAC3E,IAAI,CAACxD,qCAAqC,CAACC,aAAaC;QACxD,IAAI,CAAC2B,qBAAqB;QAC1B,IAAI,CAACoC,kBAAkB;QAEvB,IAAI,CAACtG,gBAAgB;QAErB,IAAI0G,QAAQC,GAAG,CAACC,eAAe,IAAI,MAAM;YACvC,IAAI,CAAC/G,iBAAiB;QACxB;IACF;AACF;AAEA,SAASX,gBAAgB2H,GAAwB;IAC/C,OAAO/H,OAAOyE,IAAI,CAACsD,KAChBC,IAAI,GACJC,MAAM,CACL,CAACC,KAAKjL;QACJiL,GAAG,CAACjL,IAAI,GAAG8K,GAAG,CAAC9K,IAAI;QACnB,OAAOiL;IACT,GACA,CAAC;AAEP","ignoreList":[0]}
{"version":3,"sources":["../../../../../src/shared/lib/turbopack/manifest-loader.ts"],"sourcesContent":["import type {\n EdgeFunctionDefinition,\n MiddlewareManifest,\n} from '../../../build/webpack/plugins/middleware-plugin'\nimport type {\n StatsAsset,\n StatsChunk,\n StatsChunkGroup,\n StatsModule,\n StatsCompilation as WebpackStats,\n} from 'webpack'\nimport type { BuildManifest } from '../../../server/get-page-files'\nimport type { PagesManifest } from '../../../build/webpack/plugins/pages-manifest-plugin'\nimport type { ActionManifest } from '../../../build/webpack/plugins/flight-client-entry-plugin'\nimport type { NextFontManifest } from '../../../build/webpack/plugins/next-font-manifest-plugin'\nimport type { REACT_LOADABLE_MANIFEST } from '../constants'\nimport {\n APP_PATHS_MANIFEST,\n BUILD_MANIFEST,\n CLIENT_STATIC_FILES_PATH,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n MIDDLEWARE_BUILD_MANIFEST,\n MIDDLEWARE_MANIFEST,\n NEXT_FONT_MANIFEST,\n PAGES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST,\n WEBPACK_STATS,\n} from '../constants'\nimport { join, posix } from 'path'\nimport { readFileSync } from 'fs'\nimport type { SetupOpts } from '../../../server/lib/router-utils/setup-dev-bundler'\nimport { deleteCache } from '../../../server/dev/require-cache'\nimport { writeFileAtomic } from '../../../lib/fs/write-atomic'\nimport getAssetPathFromRoute from '../router/utils/get-asset-path-from-route'\nimport { getEntryKey, type EntryKey } from './entry-key'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { getSortedRoutes } from '../router/utils'\nimport { existsSync } from 'fs'\nimport {\n addMetadataIdToRoute,\n addRouteSuffix,\n removeRouteSuffix,\n} from '../../../server/dev/turbopack-utils'\nimport { tryToParsePath } from '../../../lib/try-to-parse-path'\nimport { safePathToRegexp } from '../router/utils/route-match-utils'\nimport type { Entrypoints } from '../../../build/swc/types'\nimport {\n normalizeRewritesForBuildManifest,\n type ClientBuildManifest,\n srcEmptySsgManifest,\n processRoute,\n createEdgeRuntimeManifest,\n} from '../../../build/webpack/plugins/build-manifest-plugin-utils'\nimport type { SubresourceIntegrityManifest } from '../../../build'\n\ninterface InstrumentationDefinition {\n files: string[]\n name: 'instrumentation'\n}\n\ntype TurbopackMiddlewareManifest = MiddlewareManifest & {\n instrumentation?: InstrumentationDefinition\n}\n\ntype ManifestName =\n | typeof MIDDLEWARE_MANIFEST\n | typeof BUILD_MANIFEST\n | typeof PAGES_MANIFEST\n | typeof WEBPACK_STATS\n | typeof APP_PATHS_MANIFEST\n | `${typeof SERVER_REFERENCE_MANIFEST}.json`\n | `${typeof SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n | `${typeof NEXT_FONT_MANIFEST}.json`\n | typeof REACT_LOADABLE_MANIFEST\n | typeof TURBOPACK_CLIENT_BUILD_MANIFEST\n\nconst getManifestPath = (\n page: string,\n distDir: string,\n name: ManifestName,\n type: string,\n firstCall: boolean\n) => {\n let manifestPath = posix.join(\n distDir,\n `server`,\n type,\n type === 'middleware' || type === 'instrumentation'\n ? ''\n : type === 'app'\n ? page\n : getAssetPathFromRoute(page),\n name\n )\n\n if (firstCall) {\n const isSitemapRoute = /[\\\\/]sitemap(.xml)?\\/route$/.test(page)\n // Check the ambiguity of /sitemap and /sitemap.xml\n if (isSitemapRoute && !existsSync(manifestPath)) {\n manifestPath = getManifestPath(\n page.replace(/\\/sitemap\\/route$/, '/sitemap.xml/route'),\n distDir,\n name,\n type,\n false\n )\n }\n // existsSync is faster than using the async version\n if (!existsSync(manifestPath) && page.endsWith('/route')) {\n // TODO: Improve implementation of metadata routes, currently it requires this extra check for the variants of the files that can be written.\n let basePage = removeRouteSuffix(page)\n // For sitemap.xml routes with generateSitemaps, the manifest is at\n // /sitemap/[__metadata_id__]/route (without .xml), because the route\n // handler serves at /sitemap/[id] not /sitemap.xml/[id]\n if (basePage.endsWith('/sitemap.xml')) {\n basePage = basePage.slice(0, -'.xml'.length)\n }\n let metadataPage = addRouteSuffix(addMetadataIdToRoute(basePage))\n manifestPath = getManifestPath(metadataPage, distDir, name, type, false)\n }\n }\n\n return manifestPath\n}\n\nfunction readPartialManifestContent(\n distDir: string,\n name: ManifestName,\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation' = 'pages'\n): string {\n const page = pageName\n const manifestPath = getManifestPath(page, distDir, name, type, true)\n return readFileSync(posix.join(manifestPath), 'utf-8')\n}\n\n/// Helper class that stores a map of manifests and tracks if they have changed\n/// since the last time they were written to disk. This is used to avoid\n/// unnecessary writes to disk.\nclass ManifestsMap<K, V> {\n private rawMap = new Map<K, string>()\n private map = new Map<K, V>()\n private extraInvalidationKey: string | undefined = undefined\n private changed = true\n\n set(key: K, value: string) {\n if (this.rawMap.get(key) === value) return\n this.changed = true\n this.rawMap.set(key, value)\n this.map.set(key, JSON.parse(value))\n }\n\n delete(key: K) {\n if (this.map.has(key)) {\n this.changed = true\n this.rawMap.delete(key)\n this.map.delete(key)\n }\n }\n\n get(key: K) {\n return this.map.get(key)\n }\n\n takeChanged(extraInvalidationKey?: any) {\n let changed = this.changed\n if (extraInvalidationKey !== undefined) {\n const stringified = JSON.stringify(extraInvalidationKey)\n if (this.extraInvalidationKey !== stringified) {\n this.extraInvalidationKey = stringified\n changed = true\n }\n }\n this.changed = false\n return changed\n }\n\n values() {\n return this.map.values()\n }\n}\n\nexport class TurbopackManifestLoader {\n private actionManifests: ManifestsMap<EntryKey, ActionManifest> =\n new ManifestsMap()\n private appPathsManifests: ManifestsMap<EntryKey, PagesManifest> =\n new ManifestsMap()\n private buildManifests: ManifestsMap<EntryKey, BuildManifest> =\n new ManifestsMap()\n private clientBuildManifests: ManifestsMap<EntryKey, ClientBuildManifest> =\n new ManifestsMap()\n private fontManifests: ManifestsMap<EntryKey, NextFontManifest> =\n new ManifestsMap()\n private middlewareManifests: ManifestsMap<\n EntryKey,\n TurbopackMiddlewareManifest\n > = new ManifestsMap()\n private pagesManifests: ManifestsMap<string, PagesManifest> =\n new ManifestsMap()\n private webpackStats: ManifestsMap<EntryKey, WebpackStats> =\n new ManifestsMap()\n private sriManifests: ManifestsMap<EntryKey, SubresourceIntegrityManifest> =\n new ManifestsMap()\n private encryptionKey: string\n /// interceptionRewrites that have been written to disk\n /// This is used to avoid unnecessary writes if the rewrites haven't changed\n private cachedInterceptionRewrites: string | undefined = undefined\n\n private readonly distDir: string\n private readonly buildId: string\n private readonly dev: boolean\n private readonly sriEnabled: boolean\n\n constructor({\n distDir,\n buildId,\n encryptionKey,\n dev,\n sriEnabled,\n }: {\n buildId: string\n distDir: string\n encryptionKey: string\n dev: boolean\n sriEnabled: boolean\n }) {\n this.distDir = distDir\n this.buildId = buildId\n this.encryptionKey = encryptionKey\n this.dev = dev\n this.sriEnabled = sriEnabled\n }\n\n delete(key: EntryKey) {\n this.actionManifests.delete(key)\n this.appPathsManifests.delete(key)\n this.buildManifests.delete(key)\n this.clientBuildManifests.delete(key)\n this.fontManifests.delete(key)\n this.middlewareManifests.delete(key)\n this.pagesManifests.delete(key)\n this.webpackStats.delete(key)\n }\n\n loadActionManifest(pageName: string): void {\n this.actionManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SERVER_REFERENCE_MANIFEST}.json`,\n pageName,\n 'app'\n )\n )\n }\n\n private mergeActionManifests(manifests: Iterable<ActionManifest>) {\n type ActionEntries = ActionManifest['edge' | 'node']\n const manifest: ActionManifest = {\n node: {},\n edge: {},\n encryptionKey: this.encryptionKey,\n }\n\n function mergeActionIds(\n actionEntries: ActionEntries,\n other: ActionEntries\n ): void {\n for (const key in other) {\n const action = (actionEntries[key] ??= {\n workers: {},\n layer: {},\n })\n action.filename = other[key].filename\n action.exportedName = other[key].exportedName\n Object.assign(action.workers, other[key].workers)\n Object.assign(action.layer, other[key].layer)\n }\n }\n\n for (const m of manifests) {\n mergeActionIds(manifest.node, m.node)\n mergeActionIds(manifest.edge, m.edge)\n }\n for (const key in manifest.node) {\n const entry = manifest.node[key]\n entry.workers = sortObjectByKey(entry.workers)\n entry.layer = sortObjectByKey(entry.layer)\n }\n for (const key in manifest.edge) {\n const entry = manifest.edge[key]\n entry.workers = sortObjectByKey(entry.workers)\n entry.layer = sortObjectByKey(entry.layer)\n }\n\n return manifest\n }\n\n private writeActionManifest(): void {\n if (!this.actionManifests.takeChanged()) {\n return\n }\n const actionManifest = this.mergeActionManifests(\n this.actionManifests.values()\n )\n const actionManifestJsonPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.json`\n )\n const actionManifestJsPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.js`\n )\n const json = JSON.stringify(actionManifest, null, 2)\n deleteCache(actionManifestJsonPath)\n deleteCache(actionManifestJsPath)\n writeFileAtomic(actionManifestJsonPath, json)\n writeFileAtomic(\n actionManifestJsPath,\n `self.__RSC_SERVER_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n loadAppPathsManifest(pageName: string): void {\n this.appPathsManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n APP_PATHS_MANIFEST,\n pageName,\n 'app'\n )\n )\n }\n\n private writeAppPathsManifest(): void {\n if (!this.appPathsManifests.takeChanged()) {\n return\n }\n const appPathsManifest = this.mergePagesManifests(\n this.appPathsManifests.values()\n )\n const appPathsManifestPath = join(\n this.distDir,\n 'server',\n APP_PATHS_MANIFEST\n )\n deleteCache(appPathsManifestPath)\n writeFileAtomic(\n appPathsManifestPath,\n JSON.stringify(appPathsManifest, null, 2)\n )\n }\n\n private writeWebpackStats(): void {\n if (!this.webpackStats.takeChanged()) {\n return\n }\n const webpackStats = this.mergeWebpackStats(this.webpackStats.values())\n const path = join(this.distDir, 'server', WEBPACK_STATS)\n deleteCache(path)\n writeFileAtomic(path, JSON.stringify(webpackStats, null, 2))\n }\n\n private writeSriManifest(): void {\n if (!this.sriEnabled || !this.sriManifests.takeChanged()) {\n return\n }\n const sriManifest = this.mergeSriManifests(this.sriManifests.values())\n const pathJson = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n )\n const pathJs = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.js`\n )\n deleteCache(pathJson)\n deleteCache(pathJs)\n writeFileAtomic(pathJson, JSON.stringify(sriManifest, null, 2))\n writeFileAtomic(\n pathJs,\n `self.__SUBRESOURCE_INTEGRITY_MANIFEST=${JSON.stringify(\n JSON.stringify(sriManifest)\n )}`\n )\n }\n\n loadBuildManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.buildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(this.distDir, BUILD_MANIFEST, pageName, type)\n )\n }\n\n loadClientBuildManifest(\n pageName: string,\n type: 'app' | 'pages' = 'pages'\n ): void {\n this.clientBuildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n pageName,\n type\n )\n )\n }\n\n loadWebpackStats(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.webpackStats.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(this.distDir, WEBPACK_STATS, pageName, type)\n )\n }\n\n loadSriManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n if (!this.sriEnabled) return\n this.sriManifests.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeWebpackStats(statsFiles: Iterable<WebpackStats>): WebpackStats {\n const entrypoints: Record<string, StatsChunkGroup> = {}\n const assets: Map<string, StatsAsset> = new Map()\n const chunks: Map<string | number, StatsChunk> = new Map()\n const modules: Map<string | number, StatsModule> = new Map()\n\n for (const statsFile of statsFiles) {\n if (statsFile.entrypoints) {\n for (const [k, v] of Object.entries(statsFile.entrypoints)) {\n if (!entrypoints[k]) {\n entrypoints[k] = v\n }\n }\n }\n\n if (statsFile.assets) {\n for (const asset of statsFile.assets) {\n if (!assets.has(asset.name)) {\n assets.set(asset.name, asset)\n }\n }\n }\n\n if (statsFile.chunks) {\n for (const chunk of statsFile.chunks) {\n if (!chunks.has(chunk.id!)) {\n chunks.set(chunk.id!, chunk)\n }\n }\n }\n\n if (statsFile.modules) {\n for (const module of statsFile.modules) {\n const id = module.id\n if (id != null) {\n // Merge the chunk list for the module. This can vary across endpoints.\n const existing = modules.get(id)\n if (existing == null) {\n modules.set(id, module)\n } else if (module.chunks != null && existing.chunks != null) {\n for (const chunk of module.chunks) {\n if (!existing.chunks.includes(chunk)) {\n existing.chunks.push(chunk)\n }\n }\n }\n }\n }\n }\n }\n\n return {\n version: 'Turbopack',\n entrypoints,\n assets: [...assets.values()],\n chunks: [...chunks.values()],\n modules: [...modules.values()],\n }\n }\n\n private mergeBuildManifests(\n manifests: Iterable<BuildManifest>,\n lowPriorityFiles: string[]\n ) {\n const manifest: Partial<BuildManifest> & Pick<BuildManifest, 'pages'> = {\n pages: {\n '/_app': [],\n },\n // Something in next.js depends on these to exist even for app dir rendering\n devFiles: [],\n polyfillFiles: [],\n lowPriorityFiles,\n rootMainFiles: [],\n }\n for (const m of manifests) {\n Object.assign(manifest.pages, m.pages)\n if (m.rootMainFiles.length) manifest.rootMainFiles = m.rootMainFiles\n // polyfillFiles should always be the same, so we can overwrite instead of actually merging\n if (m.polyfillFiles.length) manifest.polyfillFiles = m.polyfillFiles\n }\n manifest.pages = sortObjectByKey(manifest.pages) as BuildManifest['pages']\n return manifest\n }\n\n private mergeClientBuildManifests(\n manifests: Iterable<ClientBuildManifest>,\n rewrites: CustomRoutes['rewrites'],\n sortedPageKeys: string[]\n ): ClientBuildManifest {\n const manifest = {\n __rewrites: rewrites as any,\n sortedPages: sortedPageKeys,\n }\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writeInterceptionRouteRewriteManifest(\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): void {\n const rewrites = productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n\n const interceptionRewrites = JSON.stringify(\n rewrites.beforeFiles.filter(\n (\n require('../../../lib/is-interception-route-rewrite') as typeof import('../../../lib/is-interception-route-rewrite')\n ).isInterceptionRouteRewrite\n )\n )\n\n if (this.cachedInterceptionRewrites === interceptionRewrites) {\n return\n }\n this.cachedInterceptionRewrites = interceptionRewrites\n\n const interceptionRewriteManifestPath = join(\n this.distDir,\n 'server',\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n deleteCache(interceptionRewriteManifestPath)\n\n writeFileAtomic(\n interceptionRewriteManifestPath,\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )};`\n )\n }\n\n private writeBuildManifest(lowPriorityFiles: string[]): void {\n if (!this.buildManifests.takeChanged()) {\n return\n }\n const buildManifest = this.mergeBuildManifests(\n this.buildManifests.values(),\n lowPriorityFiles\n )\n\n const buildManifestPath = join(this.distDir, BUILD_MANIFEST)\n const middlewareBuildManifestPath = join(\n this.distDir,\n 'server',\n `${MIDDLEWARE_BUILD_MANIFEST}.js`\n )\n\n deleteCache(buildManifestPath)\n deleteCache(middlewareBuildManifestPath)\n writeFileAtomic(buildManifestPath, JSON.stringify(buildManifest, null, 2))\n writeFileAtomic(\n middlewareBuildManifestPath,\n createEdgeRuntimeManifest(buildManifest)\n )\n\n // Write fallback build manifest\n const fallbackBuildManifest = this.mergeBuildManifests(\n [\n this.buildManifests.get(getEntryKey('pages', 'server', '_app')),\n this.buildManifests.get(getEntryKey('pages', 'server', '_error')),\n ].filter(Boolean) as BuildManifest[],\n lowPriorityFiles\n )\n const fallbackBuildManifestPath = join(\n this.distDir,\n `fallback-${BUILD_MANIFEST}`\n )\n deleteCache(fallbackBuildManifestPath)\n writeFileAtomic(\n fallbackBuildManifestPath,\n JSON.stringify(fallbackBuildManifest, null, 2)\n )\n }\n\n private writeClientBuildManifest(\n entrypoints: Entrypoints,\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): string[] {\n const rewrites = normalizeRewritesForBuildManifest(\n productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n )\n\n const pagesKeys = [...entrypoints.page.keys()]\n if (entrypoints.global.app) {\n pagesKeys.push('/_app')\n }\n if (entrypoints.global.error) {\n pagesKeys.push('/_error')\n }\n\n const sortedPageKeys = getSortedRoutes(pagesKeys)\n\n let buildManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_buildManifest.js'\n )\n let ssgManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_ssgManifest.js'\n )\n\n if (\n this.dev &&\n !this.clientBuildManifests.takeChanged({ rewrites, sortedPageKeys })\n ) {\n return [buildManifestPath, ssgManifestPath]\n }\n\n const clientBuildManifest = this.mergeClientBuildManifests(\n this.clientBuildManifests.values(),\n rewrites,\n sortedPageKeys\n )\n const clientBuildManifestJs = `self.__BUILD_MANIFEST = ${JSON.stringify(\n clientBuildManifest,\n null,\n 2\n )};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`\n\n writeFileAtomic(\n join(this.distDir, buildManifestPath),\n clientBuildManifestJs\n )\n // This is just an empty placeholder, the actual manifest is written after prerendering in\n // packages/next/src/build/index.ts\n writeFileAtomic(join(this.distDir, ssgManifestPath), srcEmptySsgManifest)\n\n return [buildManifestPath, ssgManifestPath]\n }\n\n loadFontManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.fontManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${NEXT_FONT_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeFontManifests(manifests: Iterable<NextFontManifest>) {\n const manifest: NextFontManifest = {\n app: {},\n appUsingSizeAdjust: false,\n pages: {},\n pagesUsingSizeAdjust: false,\n }\n for (const m of manifests) {\n Object.assign(manifest.app, m.app)\n Object.assign(manifest.pages, m.pages)\n\n manifest.appUsingSizeAdjust =\n manifest.appUsingSizeAdjust || m.appUsingSizeAdjust\n manifest.pagesUsingSizeAdjust =\n manifest.pagesUsingSizeAdjust || m.pagesUsingSizeAdjust\n }\n manifest.app = sortObjectByKey(manifest.app)\n manifest.pages = sortObjectByKey(manifest.pages)\n return manifest\n }\n\n private async writeNextFontManifest(): Promise<void> {\n if (!this.fontManifests.takeChanged()) {\n return\n }\n const fontManifest = this.mergeFontManifests(this.fontManifests.values())\n const json = JSON.stringify(fontManifest, null, 2)\n\n const fontManifestJsonPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.json`\n )\n const fontManifestJsPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.js`\n )\n deleteCache(fontManifestJsonPath)\n deleteCache(fontManifestJsPath)\n writeFileAtomic(fontManifestJsonPath, json)\n writeFileAtomic(\n fontManifestJsPath,\n `self.__NEXT_FONT_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n /**\n * @returns If the manifest was written or not\n */\n loadMiddlewareManifest(\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation'\n ): boolean {\n const middlewareManifestPath = getManifestPath(\n pageName,\n this.distDir,\n MIDDLEWARE_MANIFEST,\n type,\n true\n )\n\n // middlewareManifest is actually \"edge manifest\" and not all routes are edge runtime. If it is not written we skip it.\n if (!existsSync(middlewareManifestPath)) {\n return false\n }\n\n this.middlewareManifests.set(\n getEntryKey(\n type === 'middleware' || type === 'instrumentation' ? 'root' : type,\n 'server',\n pageName\n ),\n readPartialManifestContent(\n this.distDir,\n MIDDLEWARE_MANIFEST,\n pageName,\n type\n )\n )\n\n return true\n }\n\n getMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.get(key)\n }\n\n deleteMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.delete(key)\n }\n\n private mergeMiddlewareManifests(\n manifests: Iterable<TurbopackMiddlewareManifest>\n ): MiddlewareManifest {\n const manifest: MiddlewareManifest = {\n version: 3,\n middleware: {},\n sortedMiddleware: [],\n functions: {},\n }\n let instrumentation: InstrumentationDefinition | undefined = undefined\n for (const m of manifests) {\n Object.assign(manifest.functions, m.functions)\n Object.assign(manifest.middleware, m.middleware)\n if (m.instrumentation) {\n instrumentation = m.instrumentation\n }\n }\n manifest.functions = sortObjectByKey(manifest.functions)\n manifest.middleware = sortObjectByKey(manifest.middleware)\n const updateFunctionDefinition = (\n fun: EdgeFunctionDefinition\n ): EdgeFunctionDefinition => {\n return {\n ...fun,\n files: [...(instrumentation?.files ?? []), ...fun.files],\n }\n }\n for (const key of Object.keys(manifest.middleware)) {\n const value = manifest.middleware[key]\n manifest.middleware[key] = updateFunctionDefinition(value)\n }\n for (const key of Object.keys(manifest.functions)) {\n const value = manifest.functions[key]\n manifest.functions[key] = updateFunctionDefinition(value)\n }\n for (const fun of Object.values(manifest.functions).concat(\n Object.values(manifest.middleware)\n )) {\n for (const matcher of fun.matchers) {\n if (!matcher.regexp) {\n matcher.regexp = safePathToRegexp(matcher.originalSource, [], {\n delimiter: '/',\n sensitive: false,\n strict: true,\n }).source.replaceAll('\\\\/', '/')\n }\n }\n }\n manifest.sortedMiddleware = Object.keys(manifest.middleware)\n\n return manifest\n }\n\n private writeMiddlewareManifest(): {\n clientMiddlewareManifestPath: string\n } {\n let clientMiddlewareManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST\n )\n\n if (this.dev && !this.middlewareManifests.takeChanged()) {\n return {\n clientMiddlewareManifestPath,\n }\n }\n const middlewareManifest = this.mergeMiddlewareManifests(\n this.middlewareManifests.values()\n )\n\n // Server middleware manifest\n\n // Normalize regexes as it uses path-to-regexp\n for (const key in middlewareManifest.middleware) {\n middlewareManifest.middleware[key].matchers.forEach((matcher) => {\n if (!matcher.regexp.startsWith('^')) {\n const parsedPage = tryToParsePath(matcher.regexp)\n if (parsedPage.error || !parsedPage.regexStr) {\n throw new Error(`Invalid source: ${matcher.regexp}`)\n }\n matcher.regexp = parsedPage.regexStr\n }\n })\n }\n\n const middlewareManifestPath = join(\n this.distDir,\n 'server',\n MIDDLEWARE_MANIFEST\n )\n deleteCache(middlewareManifestPath)\n writeFileAtomic(\n middlewareManifestPath,\n JSON.stringify(middlewareManifest, null, 2)\n )\n\n // Client middleware manifest This is only used in dev though, packages/next/src/build/index.ts\n // writes the mainfest again for builds.\n const matchers = middlewareManifest?.middleware['/']?.matchers || []\n\n const clientMiddlewareManifestJs = `self.__MIDDLEWARE_MATCHERS = ${JSON.stringify(\n matchers,\n null,\n 2\n )};self.__MIDDLEWARE_MATCHERS_CB && self.__MIDDLEWARE_MATCHERS_CB()`\n\n deleteCache(clientMiddlewareManifestPath)\n writeFileAtomic(\n join(this.distDir, clientMiddlewareManifestPath),\n clientMiddlewareManifestJs\n )\n\n return {\n clientMiddlewareManifestPath,\n }\n }\n\n loadPagesManifest(pageName: string): void {\n this.pagesManifests.set(\n getEntryKey('pages', 'server', pageName),\n readPartialManifestContent(this.distDir, PAGES_MANIFEST, pageName)\n )\n }\n\n private mergePagesManifests(manifests: Iterable<PagesManifest>) {\n const manifest: PagesManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private mergeSriManifests(manifests: Iterable<SubresourceIntegrityManifest>) {\n const manifest: SubresourceIntegrityManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writePagesManifest(): void {\n if (!this.pagesManifests.takeChanged()) {\n return\n }\n const pagesManifest = this.mergePagesManifests(this.pagesManifests.values())\n const pagesManifestPath = join(this.distDir, 'server', PAGES_MANIFEST)\n deleteCache(pagesManifestPath)\n writeFileAtomic(pagesManifestPath, JSON.stringify(pagesManifest, null, 2))\n }\n\n writeManifests({\n devRewrites,\n productionRewrites,\n entrypoints,\n }: {\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined\n productionRewrites: CustomRoutes['rewrites'] | undefined\n entrypoints: Entrypoints\n }): void {\n this.writeActionManifest()\n this.writeAppPathsManifest()\n const lowPriorityFiles = this.writeClientBuildManifest(\n entrypoints,\n devRewrites,\n productionRewrites\n )\n const { clientMiddlewareManifestPath } = this.writeMiddlewareManifest()\n this.writeBuildManifest([...lowPriorityFiles, clientMiddlewareManifestPath])\n this.writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites)\n this.writeNextFontManifest()\n this.writePagesManifest()\n\n this.writeSriManifest()\n\n if (process.env.TURBOPACK_STATS != null) {\n this.writeWebpackStats()\n }\n }\n}\n\nfunction sortObjectByKey(obj: Record<string, any>) {\n return Object.keys(obj)\n .sort()\n .reduce(\n (acc, key) => {\n acc[key] = obj[key]\n return acc\n },\n {} as Record<string, any>\n )\n}\n"],"names":["APP_PATHS_MANIFEST","BUILD_MANIFEST","CLIENT_STATIC_FILES_PATH","INTERCEPTION_ROUTE_REWRITE_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_MANIFEST","NEXT_FONT_MANIFEST","PAGES_MANIFEST","SERVER_REFERENCE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","TURBOPACK_CLIENT_BUILD_MANIFEST","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","WEBPACK_STATS","join","posix","readFileSync","deleteCache","writeFileAtomic","getAssetPathFromRoute","getEntryKey","getSortedRoutes","existsSync","addMetadataIdToRoute","addRouteSuffix","removeRouteSuffix","tryToParsePath","safePathToRegexp","normalizeRewritesForBuildManifest","srcEmptySsgManifest","processRoute","createEdgeRuntimeManifest","getManifestPath","page","distDir","name","type","firstCall","manifestPath","isSitemapRoute","test","replace","endsWith","basePage","slice","length","metadataPage","readPartialManifestContent","pageName","ManifestsMap","set","key","value","rawMap","get","changed","map","JSON","parse","delete","has","takeChanged","extraInvalidationKey","undefined","stringified","stringify","values","Map","TurbopackManifestLoader","constructor","buildId","encryptionKey","dev","sriEnabled","actionManifests","appPathsManifests","buildManifests","clientBuildManifests","fontManifests","middlewareManifests","pagesManifests","webpackStats","sriManifests","cachedInterceptionRewrites","loadActionManifest","mergeActionManifests","manifests","manifest","node","edge","mergeActionIds","actionEntries","other","action","workers","layer","filename","exportedName","Object","assign","m","entry","sortObjectByKey","writeActionManifest","actionManifest","actionManifestJsonPath","actionManifestJsPath","json","loadAppPathsManifest","writeAppPathsManifest","appPathsManifest","mergePagesManifests","appPathsManifestPath","writeWebpackStats","mergeWebpackStats","path","writeSriManifest","sriManifest","mergeSriManifests","pathJson","pathJs","loadBuildManifest","loadClientBuildManifest","loadWebpackStats","loadSriManifest","statsFiles","entrypoints","assets","chunks","modules","statsFile","k","v","entries","asset","chunk","id","module","existing","includes","push","version","mergeBuildManifests","lowPriorityFiles","pages","devFiles","polyfillFiles","rootMainFiles","mergeClientBuildManifests","rewrites","sortedPageKeys","__rewrites","sortedPages","writeInterceptionRouteRewriteManifest","devRewrites","productionRewrites","beforeFiles","afterFiles","fallback","interceptionRewrites","filter","require","isInterceptionRouteRewrite","interceptionRewriteManifestPath","writeBuildManifest","buildManifest","buildManifestPath","middlewareBuildManifestPath","fallbackBuildManifest","Boolean","fallbackBuildManifestPath","writeClientBuildManifest","pagesKeys","keys","global","app","error","ssgManifestPath","clientBuildManifest","clientBuildManifestJs","loadFontManifest","mergeFontManifests","appUsingSizeAdjust","pagesUsingSizeAdjust","writeNextFontManifest","fontManifest","fontManifestJsonPath","fontManifestJsPath","loadMiddlewareManifest","middlewareManifestPath","getMiddlewareManifest","deleteMiddlewareManifest","mergeMiddlewareManifests","middleware","sortedMiddleware","functions","instrumentation","updateFunctionDefinition","fun","files","concat","matcher","matchers","regexp","originalSource","delimiter","sensitive","strict","source","replaceAll","writeMiddlewareManifest","clientMiddlewareManifestPath","middlewareManifest","forEach","startsWith","parsedPage","regexStr","Error","clientMiddlewareManifestJs","loadPagesManifest","writePagesManifest","pagesManifest","pagesManifestPath","writeManifests","process","env","TURBOPACK_STATS","obj","sort","reduce","acc"],"mappings":"AAgBA,SACEA,kBAAkB,EAClBC,cAAc,EACdC,wBAAwB,EACxBC,mCAAmC,EACnCC,yBAAyB,EACzBC,mBAAmB,EACnBC,kBAAkB,EAClBC,cAAc,EACdC,yBAAyB,EACzBC,8BAA8B,EAC9BC,+BAA+B,EAC/BC,oCAAoC,EACpCC,aAAa,QACR,eAAc;AACrB,SAASC,IAAI,EAAEC,KAAK,QAAQ,OAAM;AAClC,SAASC,YAAY,QAAQ,KAAI;AAEjC,SAASC,WAAW,QAAQ,oCAAmC;AAC/D,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,OAAOC,2BAA2B,4CAA2C;AAC7E,SAASC,WAAW,QAAuB,cAAa;AAExD,SAASC,eAAe,QAAQ,kBAAiB;AACjD,SAASC,UAAU,QAAQ,KAAI;AAC/B,SACEC,oBAAoB,EACpBC,cAAc,EACdC,iBAAiB,QACZ,sCAAqC;AAC5C,SAASC,cAAc,QAAQ,iCAAgC;AAC/D,SAASC,gBAAgB,QAAQ,oCAAmC;AAEpE,SACEC,iCAAiC,EAEjCC,mBAAmB,EACnBC,YAAY,EACZC,yBAAyB,QACpB,6DAA4D;AAwBnE,MAAMC,kBAAkB,CACtBC,MACAC,SACAC,MACAC,MACAC;IAEA,IAAIC,eAAevB,MAAMD,IAAI,CAC3BoB,SACA,CAAC,MAAM,CAAC,EACRE,MACAA,SAAS,gBAAgBA,SAAS,oBAC9B,KACAA,SAAS,QACPH,OACAd,sBAAsBc,OAC5BE;IAGF,IAAIE,WAAW;QACb,MAAME,iBAAiB,8BAA8BC,IAAI,CAACP;QAC1D,mDAAmD;QACnD,IAAIM,kBAAkB,CAACjB,WAAWgB,eAAe;YAC/CA,eAAeN,g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IAAI,CAAC/B,cAAc,CAACd,MAAM;QACzE,MAAM4J,oBAAoBhN,KAAK,IAAI,CAACoB,OAAO,EAAE,UAAU1B;QACvDS,YAAY6M;QACZ5M,gBAAgB4M,mBAAmBrK,KAAKQ,SAAS,CAAC4J,eAAe,MAAM;IACzE;IAEAE,eAAe,EACbrE,WAAW,EACXC,kBAAkB,EAClB7B,WAAW,EAKZ,EAAQ;QACP,IAAI,CAACvB,mBAAmB;QACxB,IAAI,CAACM,qBAAqB;QAC1B,MAAMkC,mBAAmB,IAAI,CAAC4B,wBAAwB,CACpD7C,aACA4B,aACAC;QAEF,MAAM,EAAEwD,4BAA4B,EAAE,GAAG,IAAI,CAACD,uBAAuB;QACrE,IAAI,CAAC9C,kBAAkB,CAAC;eAAIrB;YAAkBoE;SAA6B;QAC3E,IAAI,CAAC1D,qCAAqC,CAACC,aAAaC;QACxD,IAAI,CAAC6B,qBAAqB;QAC1B,IAAI,CAACoC,kBAAkB;QAEvB,IAAI,CAACxG,gBAAgB;QAErB,IAAI4G,QAAQC,GAAG,CAACC,eAAe,IAAI,MAAM;YACvC,IAAI,CAACjH,iBAAiB;QACxB;IACF;AACF;AAEA,SAASX,gBAAgB6H,GAAwB;IAC/C,OAAOjI,OAAO2E,IAAI,CAACsD,KAChBC,IAAI,GACJC,MAAM,CACL,CAACC,KAAKnL;QACJmL,GAAG,CAACnL,IAAI,GAAGgL,GAAG,CAAChL,IAAI;QACnB,OAAOmL;IACT,GACA,CAAC;AAEP","ignoreList":[0]}

@@ -229,6 +229,3 @@ import { bold, green, magenta, red } from '../../../lib/picocolors';

}
export function isFileSystemCacheEnabledForBuild(config) {
return config.experimental?.turbopackFileSystemCacheForBuild || false;
}
//# sourceMappingURL=utils.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../../src/shared/lib/turbopack/utils.ts"],"sourcesContent":["import type {\n Issue,\n PlainTraceItem,\n StyledString,\n TurbopackResult,\n} from '../../../build/swc/types'\n\nimport { bold, green, magenta, red } from '../../../lib/picocolors'\nimport isInternal from '../is-internal'\nimport { deobfuscateText } from '../magic-identifier'\nimport type { EntryKey } from './entry-key'\nimport * as Log from '../../../build/output/log'\nimport type { NextConfigComplete } from '../../../server/config-shared'\n\ntype IssueKey = `${Issue['severity']}-${Issue['filePath']}-${string}-${string}`\nexport type IssuesMap = Map<IssueKey, Issue>\nexport type EntryIssuesMap = Map<EntryKey, IssuesMap>\nexport type TopLevelIssuesMap = IssuesMap\n\nconst VERBOSE_ISSUES = !!process.env.NEXT_TURBOPACK_VERBOSE_ISSUES\n\n/**\n * An error generated from emitted Turbopack issues. This can include build\n * errors caused by issues with user code.\n */\nexport class ModuleBuildError extends Error {\n name = 'ModuleBuildError'\n}\n\n/**\n * Thin stopgap workaround layer to mimic existing wellknown-errors-plugin in webpack's build\n * to emit certain type of errors into cli.\n */\nexport function isWellKnownError(issue: Issue): boolean {\n const { title } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title)\n // TODO: add more well known errors\n if (\n formattedTitle.includes('Module not found') ||\n formattedTitle.includes('Unknown module type')\n ) {\n return true\n }\n\n return false\n}\n\nexport function getIssueKey(issue: Issue): IssueKey {\n return `${issue.severity}-${issue.filePath}-${JSON.stringify(\n issue.title\n )}-${JSON.stringify(issue.description)}`\n}\n\nexport function processIssues(\n currentEntryIssues: EntryIssuesMap,\n key: EntryKey,\n result: TurbopackResult,\n throwIssue: boolean,\n logErrors: boolean\n) {\n const newIssues = new Map<IssueKey, Issue>()\n currentEntryIssues.set(key, newIssues)\n\n const relevantIssues = new Set()\n\n for (const issue of result.issues) {\n if (\n issue.severity !== 'error' &&\n issue.severity !== 'fatal' &&\n issue.severity !== 'warning'\n )\n continue\n\n const issueKey = getIssueKey(issue)\n newIssues.set(issueKey, issue)\n\n if (issue.severity !== 'warning') {\n if (throwIssue) {\n const formatted = formatIssue(issue)\n relevantIssues.add(formatted)\n }\n // if we throw the issue it will most likely get handed and logged elsewhere\n else if (logErrors && isWellKnownError(issue)) {\n const formatted = formatIssue(issue)\n Log.error(formatted)\n }\n }\n }\n\n if (relevantIssues.size && throwIssue) {\n throw new ModuleBuildError([...relevantIssues].join('\\n\\n'))\n }\n}\n\nexport function formatIssue(issue: Issue) {\n const { filePath, title, description, detail, source, importTraces } = issue\n let { documentationLink } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title).replace(\n /\\n/g,\n '\\n '\n )\n\n // TODO: Use error codes to identify these\n // TODO: Generalize adapting Turbopack errors to Next.js errors\n if (formattedTitle.includes('Module not found')) {\n // For compatiblity with webpack\n // TODO: include columns in webpack errors.\n documentationLink = 'https://nextjs.org/docs/messages/module-not-found'\n }\n\n const formattedFilePath = filePath\n .replace('[project]/', './')\n .replaceAll('/./', '/')\n .replace('\\\\\\\\?\\\\', '')\n\n let message = ''\n\n if (source?.range) {\n const { start } = source.range\n message = `${formattedFilePath}:${start.line + 1}:${\n start.column + 1\n }\\n${formattedTitle}`\n } else if (formattedFilePath) {\n message = `${formattedFilePath}\\n${formattedTitle}`\n } else {\n message = formattedTitle\n }\n message += '\\n'\n\n if (\n source?.range &&\n source.source.content &&\n // ignore Next.js/React internals, as these can often be huge bundled files.\n !isInternal(filePath)\n ) {\n const { start, end } = source.range\n const { codeFrameColumns } =\n require('next/dist/compiled/babel/code-frame') as typeof import('next/dist/compiled/babel/code-frame')\n\n message +=\n codeFrameColumns(\n source.source.content,\n {\n start: {\n line: start.line + 1,\n column: start.column + 1,\n },\n end: {\n line: end.line + 1,\n column: end.column + 1,\n },\n },\n { forceColor: true }\n ).trim() + '\\n\\n'\n }\n\n if (description) {\n if (\n description.type === 'text' &&\n description.value.includes(`Cannot find module 'sass'`)\n ) {\n message +=\n \"To use Next.js' built-in Sass support, you first need to install `sass`.\\n\"\n message += 'Run `npm i sass` or `yarn add sass` inside your workspace.\\n'\n message += '\\nLearn more: https://nextjs.org/docs/messages/install-sass\\n'\n } else {\n message += renderStyledStringToErrorAnsi(description) + '\\n\\n'\n }\n }\n\n // TODO: make it easier to enable this for debugging\n if (VERBOSE_ISSUES && detail) {\n message += renderStyledStringToErrorAnsi(detail) + '\\n\\n'\n }\n\n if (importTraces?.length) {\n // This is the same logic as in turbopack/crates/turbopack-cli-utils/src/issue.rs\n // We end up with multiple traces when the file with the error is reachable from multiple\n // different entry points (e.g. ssr, client)\n message += `Import trace${importTraces.length > 1 ? 's' : ''}:\\n`\n const everyTraceHasADistinctRootLayer =\n new Set(importTraces.map(leafLayerName).filter((l) => l != null)).size ===\n importTraces.length\n for (let i = 0; i < importTraces.length; i++) {\n const trace = importTraces[i]\n const layer = leafLayerName(trace)\n let traceIndent = ' '\n // If this is true, layer must be present\n if (everyTraceHasADistinctRootLayer) {\n message += ` ${layer}:\\n`\n } else {\n if (importTraces.length > 1) {\n // Otherwise use simple 1 based indices to disambiguate\n message += ` #${i + 1}`\n if (layer) {\n message += ` [${layer}]`\n }\n message += ':\\n'\n } else if (layer) {\n message += ` [${layer}]:\\n`\n } else {\n // If there is a single trace and no layer name just don't indent it.\n traceIndent = ' '\n }\n }\n message += formatIssueTrace(trace, traceIndent, !identicalLayers(trace))\n }\n }\n if (documentationLink) {\n message += documentationLink + '\\n\\n'\n }\n return message\n}\n\n/** Returns the first present layer name in the trace */\nfunction leafLayerName(items: PlainTraceItem[]): string | undefined {\n for (const item of items) {\n const layer = item.layer\n if (layer != null) return layer\n }\n return undefined\n}\n\n/**\n * Returns whether or not all items share the same layer.\n * If a layer is absent we ignore it in this analysis\n */\nfunction identicalLayers(items: PlainTraceItem[]): boolean {\n const firstPresentLayer = items.findIndex((t) => t.layer != null)\n if (firstPresentLayer === -1) return true // all layers are absent\n const layer = items[firstPresentLayer].layer\n for (let i = firstPresentLayer + 1; i < items.length; i++) {\n const itemLayer = items[i].layer\n if (itemLayer == null || itemLayer !== layer) {\n return false\n }\n }\n return true\n}\n\nfunction formatIssueTrace(\n items: PlainTraceItem[],\n indent: string,\n printLayers: boolean\n): string {\n return `${items\n .map((item) => {\n let r = indent\n if (item.fsName !== 'project') {\n r += `[${item.fsName}]/`\n } else {\n // This is consistent with webpack's output\n r += './'\n }\n r += item.path\n if (printLayers && item.layer) {\n r += ` [${item.layer}]`\n }\n return r\n })\n .join('\\n')}\\n\\n`\n}\n\nexport function isRelevantWarning(issue: Issue): boolean {\n return issue.severity === 'warning' && !isNodeModulesIssue(issue)\n}\n\nfunction isNodeModulesIssue(issue: Issue): boolean {\n if (issue.severity === 'warning' && issue.stage === 'config') {\n // Override for the externalize issue\n // `Package foo (serverExternalPackages or default list) can't be external`\n if (\n renderStyledStringToErrorAnsi(issue.title).includes(\"can't be external\")\n ) {\n return false\n }\n }\n\n return (\n issue.severity === 'warning' &&\n (issue.filePath.match(/^(?:.*[\\\\/])?node_modules(?:[\\\\/].*)?$/) !== null ||\n // Ignore Next.js itself when running next directly in the monorepo where it is not inside\n // node_modules anyway.\n // TODO(mischnic) prevent matches when this is published to npm\n issue.filePath.startsWith('[project]/packages/next/'))\n )\n}\n\nexport function renderStyledStringToErrorAnsi(string: StyledString): string {\n function applyDeobfuscation(str: string): string {\n // Use shared deobfuscate function and apply magenta color to identifiers\n const deobfuscated = deobfuscateText(str)\n // Color any {...} wrapped identifiers with magenta\n return deobfuscated.replace(/\\{([^}]+)\\}/g, (match) => magenta(match))\n }\n\n switch (string.type) {\n case 'text':\n return applyDeobfuscation(string.value)\n case 'strong':\n return bold(red(applyDeobfuscation(string.value)))\n case 'code':\n return green(applyDeobfuscation(string.value))\n case 'line':\n return string.value.map(renderStyledStringToErrorAnsi).join('')\n case 'stack':\n return string.value.map(renderStyledStringToErrorAnsi).join('\\n')\n default:\n throw new Error('Unknown StyledString type', string)\n }\n}\n\nexport function isFileSystemCacheEnabledForDev(\n config: NextConfigComplete\n): boolean {\n return config.experimental?.turbopackFileSystemCacheForDev || false\n}\n\nexport function isFileSystemCacheEnabledForBuild(\n config: NextConfigComplete\n): boolean {\n return config.experimental?.turbopackFileSystemCacheForBuild || false\n}\n"],"names":["bold","green","magenta","red","isInternal","deobfuscateText","Log","VERBOSE_ISSUES","process","env","NEXT_TURBOPACK_VERBOSE_ISSUES","ModuleBuildError","Error","name","isWellKnownError","issue","title","formattedTitle","renderStyledStringToErrorAnsi","includes","getIssueKey","severity","filePath","JSON","stringify","description","processIssues","currentEntryIssues","key","result","throwIssue","logErrors","newIssues","Map","set","relevantIssues","Set","issues","issueKey","formatted","formatIssue","add","error","size","join","detail","source","importTraces","documentationLink","replace","formattedFilePath","replaceAll","message","range","start","line","column","content","end","codeFrameColumns","require","forceColor","trim","type","value","length","everyTraceHasADistinctRootLayer","map","leafLayerName","filter","l","i","trace","layer","traceIndent","formatIssueTrace","identicalLayers","items","item","undefined","firstPresentLayer","findIndex","t","itemLayer","indent","printLayers","r","fsName","path","isRelevantWarning","isNodeModulesIssue","stage","match","startsWith","string","applyDeobfuscation","str","deobfuscated","isFileSystemCacheEnabledForDev","config","experimental","turbopackFileSystemCacheForDev","isFileSystemCacheEnabledForBuild","turbopackFileSystemCacheForBuild"],"mappings":"AAOA,SAASA,IAAI,EAAEC,KAAK,EAAEC,OAAO,EAAEC,GAAG,QAAQ,0BAAyB;AACnE,OAAOC,gBAAgB,iBAAgB;AACvC,SAASC,eAAe,QAAQ,sBAAqB;AAErD,YAAYC,SAAS,4BAA2B;AAQhD,MAAMC,iBAAiB,CAAC,CAACC,QAAQC,GAAG,CAACC,6BAA6B;AAElE;;;CAGC,GACD,OAAO,MAAMC,yBAAyBC;;QAA/B,qBACLC,OAAO;;AACT;AAEA;;;CAGC,GACD,OAAO,SAASC,iBAAiBC,KAAY;IAC3C,MAAM,EAAEC,KAAK,EAAE,GAAGD;IAClB,MAAME,iBAAiBC,8BAA8BF;IACrD,mCAAmC;IACnC,IACEC,eAAeE,QAAQ,CAAC,uBACxBF,eAAeE,QAAQ,CAAC,wBACxB;QACA,OAAO;IACT;IAEA,OAAO;AACT;AAEA,OAAO,SAASC,YAAYL,KAAY;IACtC,OAAO,GAAGA,MAAMM,QAAQ,CAAC,CAAC,EAAEN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AAO;QACT;IACF;IAEA,OACEJ,MAAMM,QAAQ,KAAK,aAClBN,CAAAA,MAAMO,QAAQ,CAACsE,KAAK,CAAC,8CAA8C,QAClE,0FAA0F;IAC1F,uBAAuB;IACvB,+DAA+D;IAC/D7E,MAAMO,QAAQ,CAACuE,UAAU,CAAC,2BAA0B;AAE1D;AAEA,OAAO,SAAS3E,8BAA8B4E,MAAoB;IAChE,SAASC,mBAAmBC,GAAW;QACrC,yEAAyE;QACzE,MAAMC,eAAe5F,gBAAgB2F;QACrC,mDAAmD;QACnD,OAAOC,aAAahD,OAAO,CAAC,gBAAgB,CAAC2C,QAAU1F,QAAQ0F;IACjE;IAEA,OAAQE,OAAO/B,IAAI;QACjB,KAAK;YACH,OAAOgC,mBAAmBD,OAAO9B,KAAK;QACxC,KAAK;YACH,OAAOhE,KAAKG,IAAI4F,mBAAmBD,OAAO9B,KAAK;QACjD,KAAK;YACH,OAAO/D,MAAM8F,mBAAmBD,OAAO9B,KAAK;QAC9C,KAAK;YACH,OAAO8B,OAAO9B,KAAK,CAACG,GAAG,CAACjD,+BAA+B0B,IAAI,CAAC;QAC9D,KAAK;YACH,OAAOkD,OAAO9B,KAAK,CAACG,GAAG,CAACjD,+BAA+B0B,IAAI,CAAC;QAC9D;YACE,MAAM,qBAA8C,CAA9C,IAAIhC,MAAM,6BAA6BkF,SAAvC,qBAAA;uBAAA;4BAAA;8BAAA;YAA6C;IACvD;AACF;AAEA,OAAO,SAASI,+BACdC,MAA0B;IAE1B,OAAOA,OAAOC,YAAY,EAAEC,kCAAkC;AAChE;AAEA,OAAO,SAASC,iCACdH,MAA0B;IAE1B,OAAOA,OAAOC,YAAY,EAAEG,oCAAoC;AAClE","ignoreList":[0]}
{"version":3,"sources":["../../../../../src/shared/lib/turbopack/utils.ts"],"sourcesContent":["import type {\n Issue,\n PlainTraceItem,\n StyledString,\n TurbopackResult,\n} from '../../../build/swc/types'\n\nimport { bold, green, magenta, red } from '../../../lib/picocolors'\nimport isInternal from '../is-internal'\nimport { deobfuscateText } from '../magic-identifier'\nimport type { EntryKey } from './entry-key'\nimport * as Log from '../../../build/output/log'\nimport type { NextConfigComplete } from '../../../server/config-shared'\n\ntype IssueKey = `${Issue['severity']}-${Issue['filePath']}-${string}-${string}`\nexport type IssuesMap = Map<IssueKey, Issue>\nexport type EntryIssuesMap = Map<EntryKey, IssuesMap>\nexport type TopLevelIssuesMap = IssuesMap\n\nconst VERBOSE_ISSUES = !!process.env.NEXT_TURBOPACK_VERBOSE_ISSUES\n\n/**\n * An error generated from emitted Turbopack issues. This can include build\n * errors caused by issues with user code.\n */\nexport class ModuleBuildError extends Error {\n name = 'ModuleBuildError'\n}\n\n/**\n * Thin stopgap workaround layer to mimic existing wellknown-errors-plugin in webpack's build\n * to emit certain type of errors into cli.\n */\nexport function isWellKnownError(issue: Issue): boolean {\n const { title } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title)\n // TODO: add more well known errors\n if (\n formattedTitle.includes('Module not found') ||\n formattedTitle.includes('Unknown module type')\n ) {\n return true\n }\n\n return false\n}\n\nexport function getIssueKey(issue: Issue): IssueKey {\n return `${issue.severity}-${issue.filePath}-${JSON.stringify(\n issue.title\n )}-${JSON.stringify(issue.description)}`\n}\n\nexport function processIssues(\n currentEntryIssues: EntryIssuesMap,\n key: EntryKey,\n result: TurbopackResult,\n throwIssue: boolean,\n logErrors: boolean\n) {\n const newIssues = new Map<IssueKey, Issue>()\n currentEntryIssues.set(key, newIssues)\n\n const relevantIssues = new Set()\n\n for (const issue of result.issues) {\n if (\n issue.severity !== 'error' &&\n issue.severity !== 'fatal' &&\n issue.severity !== 'warning'\n )\n continue\n\n const issueKey = getIssueKey(issue)\n newIssues.set(issueKey, issue)\n\n if (issue.severity !== 'warning') {\n if (throwIssue) {\n const formatted = formatIssue(issue)\n relevantIssues.add(formatted)\n }\n // if we throw the issue it will most likely get handed and logged elsewhere\n else if (logErrors && isWellKnownError(issue)) {\n const formatted = formatIssue(issue)\n Log.error(formatted)\n }\n }\n }\n\n if (relevantIssues.size && throwIssue) {\n throw new ModuleBuildError([...relevantIssues].join('\\n\\n'))\n }\n}\n\nexport function formatIssue(issue: Issue) {\n const { filePath, title, description, detail, source, importTraces } = issue\n let { documentationLink } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title).replace(\n /\\n/g,\n '\\n '\n )\n\n // TODO: Use error codes to identify these\n // TODO: Generalize adapting Turbopack errors to Next.js errors\n if (formattedTitle.includes('Module not found')) {\n // For compatiblity with webpack\n // TODO: include columns in webpack errors.\n documentationLink = 'https://nextjs.org/docs/messages/module-not-found'\n }\n\n const formattedFilePath = filePath\n .replace('[project]/', './')\n .replaceAll('/./', '/')\n .replace('\\\\\\\\?\\\\', '')\n\n let message = ''\n\n if (source?.range) {\n const { start } = source.range\n message = `${formattedFilePath}:${start.line + 1}:${\n start.column + 1\n }\\n${formattedTitle}`\n } else if (formattedFilePath) {\n message = `${formattedFilePath}\\n${formattedTitle}`\n } else {\n message = formattedTitle\n }\n message += '\\n'\n\n if (\n source?.range &&\n source.source.content &&\n // ignore Next.js/React internals, as these can often be huge bundled files.\n !isInternal(filePath)\n ) {\n const { start, end } = source.range\n const { codeFrameColumns } =\n require('next/dist/compiled/babel/code-frame') as typeof import('next/dist/compiled/babel/code-frame')\n\n message +=\n codeFrameColumns(\n source.source.content,\n {\n start: {\n line: start.line + 1,\n column: start.column + 1,\n },\n end: {\n line: end.line + 1,\n column: end.column + 1,\n },\n },\n { forceColor: true }\n ).trim() + '\\n\\n'\n }\n\n if (description) {\n if (\n description.type === 'text' &&\n description.value.includes(`Cannot find module 'sass'`)\n ) {\n message +=\n \"To use Next.js' built-in Sass support, you first need to install `sass`.\\n\"\n message += 'Run `npm i sass` or `yarn add sass` inside your workspace.\\n'\n message += '\\nLearn more: https://nextjs.org/docs/messages/install-sass\\n'\n } else {\n message += renderStyledStringToErrorAnsi(description) + '\\n\\n'\n }\n }\n\n // TODO: make it easier to enable this for debugging\n if (VERBOSE_ISSUES && detail) {\n message += renderStyledStringToErrorAnsi(detail) + '\\n\\n'\n }\n\n if (importTraces?.length) {\n // This is the same logic as in turbopack/crates/turbopack-cli-utils/src/issue.rs\n // We end up with multiple traces when the file with the error is reachable from multiple\n // different entry points (e.g. ssr, client)\n message += `Import trace${importTraces.length > 1 ? 's' : ''}:\\n`\n const everyTraceHasADistinctRootLayer =\n new Set(importTraces.map(leafLayerName).filter((l) => l != null)).size ===\n importTraces.length\n for (let i = 0; i < importTraces.length; i++) {\n const trace = importTraces[i]\n const layer = leafLayerName(trace)\n let traceIndent = ' '\n // If this is true, layer must be present\n if (everyTraceHasADistinctRootLayer) {\n message += ` ${layer}:\\n`\n } else {\n if (importTraces.length > 1) {\n // Otherwise use simple 1 based indices to disambiguate\n message += ` #${i + 1}`\n if (layer) {\n message += ` [${layer}]`\n }\n message += ':\\n'\n } else if (layer) {\n message += ` [${layer}]:\\n`\n } else {\n // If there is a single trace and no layer name just don't indent it.\n traceIndent = ' '\n }\n }\n message += formatIssueTrace(trace, traceIndent, !identicalLayers(trace))\n }\n }\n if (documentationLink) {\n message += documentationLink + '\\n\\n'\n }\n return message\n}\n\n/** Returns the first present layer name in the trace */\nfunction leafLayerName(items: PlainTraceItem[]): string | undefined {\n for (const item of items) {\n const layer = item.layer\n if (layer != null) return layer\n }\n return undefined\n}\n\n/**\n * Returns whether or not all items share the same layer.\n * If a layer is absent we ignore it in this analysis\n */\nfunction identicalLayers(items: PlainTraceItem[]): boolean {\n const firstPresentLayer = items.findIndex((t) => t.layer != null)\n if (firstPresentLayer === -1) return true // all layers are absent\n const layer = items[firstPresentLayer].layer\n for (let i = firstPresentLayer + 1; i < items.length; i++) {\n const itemLayer = items[i].layer\n if (itemLayer == null || itemLayer !== layer) {\n return false\n }\n }\n return true\n}\n\nfunction formatIssueTrace(\n items: PlainTraceItem[],\n indent: string,\n printLayers: boolean\n): string {\n return `${items\n .map((item) => {\n let r = indent\n if (item.fsName !== 'project') {\n r += `[${item.fsName}]/`\n } else {\n // This is consistent with webpack's output\n r += './'\n }\n r += item.path\n if (printLayers && item.layer) {\n r += ` [${item.layer}]`\n }\n return r\n })\n .join('\\n')}\\n\\n`\n}\n\nexport function isRelevantWarning(issue: Issue): boolean {\n return issue.severity === 'warning' && !isNodeModulesIssue(issue)\n}\n\nfunction isNodeModulesIssue(issue: Issue): boolean {\n if (issue.severity === 'warning' && issue.stage === 'config') {\n // Override for the externalize issue\n // `Package foo (serverExternalPackages or default list) can't be external`\n if (\n renderStyledStringToErrorAnsi(issue.title).includes(\"can't be external\")\n ) {\n return false\n }\n }\n\n return (\n issue.severity === 'warning' &&\n (issue.filePath.match(/^(?:.*[\\\\/])?node_modules(?:[\\\\/].*)?$/) !== null ||\n // Ignore Next.js itself when running next directly in the monorepo where it is not inside\n // node_modules anyway.\n // TODO(mischnic) prevent matches when this is published to npm\n issue.filePath.startsWith('[project]/packages/next/'))\n )\n}\n\nexport function renderStyledStringToErrorAnsi(string: StyledString): string {\n function applyDeobfuscation(str: string): string {\n // Use shared deobfuscate function and apply magenta color to identifiers\n const deobfuscated = deobfuscateText(str)\n // Color any {...} wrapped identifiers with magenta\n return deobfuscated.replace(/\\{([^}]+)\\}/g, (match) => magenta(match))\n }\n\n switch (string.type) {\n case 'text':\n return applyDeobfuscation(string.value)\n case 'strong':\n return bold(red(applyDeobfuscation(string.value)))\n case 'code':\n return green(applyDeobfuscation(string.value))\n case 'line':\n return string.value.map(renderStyledStringToErrorAnsi).join('')\n case 'stack':\n return string.value.map(renderStyledStringToErrorAnsi).join('\\n')\n default:\n throw new Error('Unknown StyledString type', string)\n }\n}\n\nexport function isFileSystemCacheEnabledForDev(\n config: NextConfigComplete\n): boolean {\n return config.experimental?.turbopackFileSystemCacheForDev || false\n}\n"],"names":["bold","green","magenta","red","isInternal","deobfuscateText","Log","VERBOSE_ISSUES","process","env","NEXT_TURBOPACK_VERBOSE_ISSUES","ModuleBuildError","Error","name","isWellKnownError","issue","title","formattedTitle","renderStyledStringToErrorAnsi","includes","getIssueKey","severity","filePath","JSON","stringify","description","processIssues","currentEntryIssues","key","result","throwIssue","logErrors","newIssues","Map","set","relevantIssues","Set","issues","issueKey","formatted","formatIssue","add","error","size","join","detail","source","importTraces","documentationLink","replace","formattedFilePath","replaceAll","message","range","start","line","column","content","end","codeFrameColumns","require","forceColor","trim","type","value","length","everyTraceHasADistinctRootLayer","map","leafLayerName","filter","l","i","trace","layer","traceIndent","formatIssueTrace","identicalLayers","items","item","undefined","firstPresentLayer","findIndex","t","itemLayer","indent","printLayers","r","fsName","path","isRelevantWarning","isNodeModulesIssue","stage","match","startsWith","string","applyDeobfuscation","str","deobfuscated","isFileSystemCacheEnabledForDev","config","experimental","turbopackFileSystemCacheForDev"],"mappings":"AAOA,SAASA,IAAI,EAAEC,KAAK,EAAEC,OAAO,EAAEC,GAAG,QAAQ,0BAAyB;AACnE,OAAOC,gBAAgB,iBAAgB;AACvC,SAASC,eAAe,QAAQ,sBAAqB;AAErD,YAAYC,SAAS,4BAA2B;AAQhD,MAAMC,iBAAiB,CAAC,CAACC,QAAQC,GAAG,CAACC,6BAA6B;AAElE;;;CAGC,GACD,OAAO,MAAMC,yBAAyBC;;QAA/B,qBACLC,OAAO;;AACT;AAEA;;;CAGC,GACD,OAAO,SAASC,iBAAiBC,KAAY;IAC3C,MAAM,EAAEC,KAAK,EAAE,GAAGD;IAClB,MAAME,iBAAiBC,8BAA8BF;IACrD,mCAAmC;IACnC,IACEC,eAAeE,QAAQ,CAAC,uBACxBF,eAAeE,QAAQ,CAAC,wBACxB;QACA,OAAO;IACT;IAEA,OAAO;AACT;AAEA,OAAO,SAASC,YAAYL,KAAY;IACtC,OAAO,GAAGA,MAAMM,QAAQ,CAAC,CAAC,EAAEN,MAAMO,QAAQ,CAAC,CAAC,EAAEC,KAAKC,SAAS,CAC1DT,MAAMC,KAAK,EACX,CAAC,EAAEO,KAAKC,SAAS,CAACT,MAAMU,WAAW,GAAG;AAC1C;AAEA,OAAO,SAASC,cACdC,kBAAkC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,QAAQ,CAACuE,UAAU,CAAC,2BAA0B;AAE1D;AAEA,OAAO,SAAS3E,8BAA8B4E,MAAoB;IAChE,SAASC,mBAAmBC,GAAW;QACrC,yEAAyE;QACzE,MAAMC,eAAe5F,gBAAgB2F;QACrC,mDAAmD;QACnD,OAAOC,aAAahD,OAAO,CAAC,gBAAgB,CAAC2C,QAAU1F,QAAQ0F;IACjE;IAEA,OAAQE,OAAO/B,IAAI;QACjB,KAAK;YACH,OAAOgC,mBAAmBD,OAAO9B,KAAK;QACxC,KAAK;YACH,OAAOhE,KAAKG,IAAI4F,mBAAmBD,OAAO9B,KAAK;QACjD,KAAK;YACH,OAAO/D,MAAM8F,mBAAmBD,OAAO9B,KAAK;QAC9C,KAAK;YACH,OAAO8B,OAAO9B,KAAK,CAACG,GAAG,CAACjD,+BAA+B0B,IAAI,CAAC;QAC9D,KAAK;YACH,OAAOkD,OAAO9B,KAAK,CAACG,GAAG,CAACjD,+BAA+B0B,IAAI,CAAC;QAC9D;YACE,MAAM,qBAA8C,CAA9C,IAAIhC,MAAM,6BAA6BkF,SAAvC,qBAAA;uBAAA;4BAAA;8BAAA;YAA6C;IACvD;AACF;AAEA,OAAO,SAASI,+BACdC,MAA0B;IAE1B,OAAOA,OAAOC,YAAY,EAAEC,kCAAkC;AAChE","ignoreList":[0]}

@@ -49,3 +49,3 @@ "use strict";

const _progress = require("../build/progress");
const _generateinterceptionroutesrewrites = require("../lib/generate-interception-routes-rewrites");
const _isinterceptionrouterewrite = require("../lib/is-interception-route-rewrite");
const _serverreferenceinfo = require("../shared/lib/server-reference-info");

@@ -364,3 +364,3 @@ const _segmentvalueencoding = require("../shared/lib/segment-cache/segment-value-encoding");

if ((routesManifest == null ? void 0 : (_routesManifest_rewrites = routesManifest.rewrites) == null ? void 0 : (_routesManifest_rewrites_beforeFiles = _routesManifest_rewrites.beforeFiles) == null ? void 0 : _routesManifest_rewrites_beforeFiles.length) > 0) {
const hasInterceptionRouteRewrite = routesManifest.rewrites.beforeFiles.some(_generateinterceptionroutesrewrites.isInterceptionRouteRewrite);
const hasInterceptionRouteRewrite = routesManifest.rewrites.beforeFiles.some(_isinterceptionrouterewrite.isInterceptionRouteRewrite);
if (hasInterceptionRouteRewrite) {

@@ -367,0 +367,0 @@ throw Object.defineProperty(new ExportError(`Intercepting routes are not supported with static export.\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`), "__NEXT_ERROR_CODE", {

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../src/export/index.ts"],"sourcesContent":["import type {\n ExportAppResult,\n ExportAppOptions,\n WorkerRenderOptsPartial,\n ExportPagesResult,\n ExportPathEntry,\n} from './types'\nimport {\n createStaticWorker,\n type PrerenderManifest,\n type StaticWorker,\n} from '../build'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\n\nimport { bold, yellow } from '../lib/picocolors'\nimport findUp from 'next/dist/compiled/find-up'\nimport { existsSync, promises as fs } from 'fs'\n\nimport '../server/require-hook'\n\nimport { dirname, join, resolve, sep, relative } from 'path'\nimport * as Log from '../build/output/log'\nimport {\n RSC_SEGMENT_SUFFIX,\n RSC_SEGMENTS_DIR_SUFFIX,\n RSC_SUFFIX,\n SSG_FALLBACK_EXPORT_ERROR,\n} from '../lib/constants'\nimport { recursiveCopy } from '../lib/recursive-copy'\nimport {\n BUILD_ID_FILE,\n CLIENT_PUBLIC_FILES_PATH,\n CLIENT_STATIC_FILES_PATH,\n EXPORT_DETAIL,\n EXPORT_MARKER,\n NEXT_FONT_MANIFEST,\n MIDDLEWARE_MANIFEST,\n PAGES_MANIFEST,\n PHASE_EXPORT,\n PRERENDER_MANIFEST,\n SERVER_DIRECTORY,\n SERVER_REFERENCE_MANIFEST,\n APP_PATH_ROUTES_MANIFEST,\n ROUTES_MANIFEST,\n FUNCTIONS_CONFIG_MANIFEST,\n} from '../shared/lib/constants'\nimport loadConfig from '../server/config'\nimport type { ExportPathMap } from '../server/config-shared'\nimport { parseMaxPostponedStateSize } from '../server/config-shared'\nimport { eventCliSession } from '../telemetry/events'\nimport { hasNextSupport } from '../server/ci-info'\nimport { Telemetry } from '../telemetry/storage'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { loadEnvConfig } from '@next/env'\nimport { isAPIRoute } from '../lib/is-api-route'\nimport { getPagePath } from '../server/require'\nimport type { Span } from '../trace'\nimport type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { isAppPageRoute } from '../lib/is-app-page-route'\nimport isError from '../lib/is-error'\nimport { formatManifest } from '../build/manifests/formatter/format-manifest'\nimport { TurborepoAccessTraceResult } from '../build/turborepo-access-trace'\nimport { createProgress } from '../build/progress'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isInterceptionRouteRewrite } from '../lib/generate-interception-routes-rewrites'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\nimport { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info'\nimport { convertSegmentPathToStaticExportFilename } from '../shared/lib/segment-cache/segment-value-encoding'\nimport { getNextBuildDebuggerPortOffset } from '../lib/worker'\nimport { getParams } from './helpers/get-params'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport type { Params } from '../server/request/params'\n\nexport class ExportError extends Error {\n code = 'NEXT_EXPORT_ERROR'\n}\n\n/**\n * Picks an RDC seed by matching on the params that are\n * already known, so fallback shells use a seed that has already\n * computed those known params.\n */\nfunction buildRDCCacheByPage(\n results: ExportPagesResult,\n finalPhaseExportPaths: ExportPathEntry[]\n): Record<string, string> {\n const renderResumeDataCachesByPage: Record<string, string> = {}\n const seedCandidatesByPage = new Map<\n string,\n Array<{ path: string; renderResumeDataCache: string }>\n >()\n\n for (const { page, path, result } of results) {\n if (!result) {\n continue\n }\n\n if ('renderResumeDataCache' in result && result.renderResumeDataCache) {\n // Collect all RDC seeds for this page so we can pick the best match\n // for each fallback shell later (e.g. locale-specific variants).\n const candidates = seedCandidatesByPage.get(page) ?? []\n candidates.push({\n path,\n renderResumeDataCache: result.renderResumeDataCache,\n })\n seedCandidatesByPage.set(page, candidates)\n // Remove the RDC string from the result so that it can be garbage\n // collected, when there are more results for the same page.\n result.renderResumeDataCache = undefined\n }\n }\n\n const getKnownParamsKey = (\n normalizedPage: string,\n path: string,\n fallbackParamNames: Set<string>\n ): string | null => {\n let params: Params\n try {\n params = getParams(normalizedPage, path)\n } catch {\n return null\n }\n\n // Only keep params that are known, then sort\n // for a stable key so we can match a compatible seed.\n const entries = Object.entries(params).filter(\n ([key]) => !fallbackParamNames.has(key)\n )\n\n entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n return JSON.stringify(entries)\n }\n\n for (const exportPath of finalPhaseExportPaths) {\n const { page, path, _fallbackRouteParams = [] } = exportPath\n if (!isDynamicRoute(page)) {\n continue\n }\n\n // Normalize app pages before param matching.\n const normalizedPage = normalizeAppPath(page)\n const pageKey = page !== path ? `${page}: ${path}` : path\n const fallbackParamNames = new Set(\n _fallbackRouteParams.map((param) => param.paramName)\n )\n // Build a key from the known params for this fallback shell so we can\n // select a seed from a compatible prerendered route.\n const targetKey = getKnownParamsKey(\n normalizedPage,\n path,\n fallbackParamNames\n )\n\n if (!targetKey) {\n continue\n }\n\n const candidates = seedCandidatesByPage.get(page)\n\n // No suitable candidates, so there's no RDC seed to select\n if (!candidates || candidates.length === 0) {\n continue\n }\n\n let selected: string | null = null\n for (const candidate of candidates) {\n // Pick the seed whose known params match this fallback shell.\n const candidateKey = getKnownParamsKey(\n normalizedPage,\n candidate.path,\n fallbackParamNames\n )\n if (candidateKey === targetKey) {\n selected = candidate.renderResumeDataCache\n break\n }\n }\n\n if (selected) {\n renderResumeDataCachesByPage[pageKey] = selected\n }\n }\n\n return renderResumeDataCachesByPage\n}\n\nasync function exportAppImpl(\n dir: string,\n options: Readonly<ExportAppOptions>,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n dir = resolve(dir)\n\n // attempt to load global env values so they are available in next.config.js\n span.traceChild('load-dotenv').traceFn(() => loadEnvConfig(dir, false, Log))\n\n const { enabledDirectories } = options\n\n const nextConfig =\n options.nextConfig ||\n (await span.traceChild('load-next-config').traceAsyncFn(() =>\n loadConfig(PHASE_EXPORT, dir, {\n debugPrerender: options.debugPrerender,\n })\n ))\n\n const distDir = join(dir, nextConfig.distDir)\n const telemetry = options.buildExport ? null : new Telemetry({ distDir })\n\n if (telemetry) {\n telemetry.record(\n eventCliSession(nextConfig, {\n webpackVersion: null,\n cliCommand: 'export',\n isSrcDir: null,\n hasNowJson: !!(await findUp('now.json', { cwd: dir })),\n isCustomServer: null,\n turboFlag: false,\n pagesDir: null,\n appDir: null,\n })\n )\n }\n\n const subFolders = nextConfig.trailingSlash && !options.buildExport\n\n if (!options.silent && !options.buildExport) {\n Log.info(`using build directory: ${distDir}`)\n }\n\n const buildIdFile = join(distDir, BUILD_ID_FILE)\n\n if (!existsSync(buildIdFile)) {\n throw new ExportError(\n `Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`\n )\n }\n\n const customRoutes = (['rewrites', 'redirects', 'headers'] as const).filter(\n (config) => typeof nextConfig[config] === 'function'\n )\n\n if (!hasNextSupport && !options.buildExport && customRoutes.length > 0) {\n Log.warn(\n `rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(\n ', '\n )}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n const buildId = await fs.readFile(buildIdFile, 'utf8')\n\n const pagesManifest =\n !options.pages &&\n (require(join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST)) as PagesManifest)\n\n let prerenderManifest: DeepReadonly<PrerenderManifest> | undefined\n try {\n prerenderManifest = require(join(distDir, PRERENDER_MANIFEST))\n } catch {}\n\n let appRoutePathManifest: Record<string, string> | undefined\n try {\n appRoutePathManifest = require(join(distDir, APP_PATH_ROUTES_MANIFEST))\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'MODULE_NOT_FOUND')\n ) {\n // the manifest doesn't exist which will happen when using\n // \"pages\" dir instead of \"app\" dir.\n appRoutePathManifest = undefined\n } else {\n // the manifest is malformed (invalid json)\n throw err\n }\n }\n\n const excludedPrerenderRoutes = new Set<string>()\n const pages = options.pages || Object.keys(pagesManifest)\n const defaultPathMap: ExportPathMap = {}\n\n let hasApiRoutes = false\n for (const page of pages) {\n // _document and _app are not real pages\n // _error is exported as 404.html later on\n // API Routes are Node.js functions\n\n if (isAPIRoute(page)) {\n hasApiRoutes = true\n continue\n }\n\n if (page === '/_document' || page === '/_app' || page === '/_error') {\n continue\n }\n\n // iSSG pages that are dynamic should not export templated version by\n // default. In most cases, this would never work. There is no server that\n // could run `getStaticProps`. If users make their page work lazily, they\n // can manually add it to the `exportPathMap`.\n if (prerenderManifest?.dynamicRoutes[page]) {\n excludedPrerenderRoutes.add(page)\n continue\n }\n\n defaultPathMap[page] = { page }\n }\n\n const mapAppRouteToPage = new Map<string, string>()\n if (!options.buildExport && appRoutePathManifest) {\n for (const [pageName, routePath] of Object.entries(appRoutePathManifest)) {\n mapAppRouteToPage.set(routePath, pageName)\n if (\n isAppPageRoute(pageName) &&\n !prerenderManifest?.routes[routePath] &&\n !prerenderManifest?.dynamicRoutes[routePath]\n ) {\n defaultPathMap[routePath] = {\n page: pageName,\n _isAppDir: true,\n }\n }\n }\n }\n\n // Initialize the output directory\n const outDir = options.outdir\n\n if (outDir === join(dir, 'public')) {\n throw new ExportError(\n `The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-public`\n )\n }\n\n if (outDir === join(dir, 'static')) {\n throw new ExportError(\n `The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-static`\n )\n }\n\n await fs.rm(outDir, { recursive: true, force: true })\n await fs.mkdir(join(outDir, '_next', buildId), { recursive: true })\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: false,\n }),\n 'utf8'\n )\n\n // Copy static directory\n if (!options.buildExport && existsSync(join(dir, 'static'))) {\n if (!options.silent) {\n Log.info('Copying \"static\" directory')\n }\n await span\n .traceChild('copy-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(join(dir, 'static'), join(outDir, 'static'))\n )\n }\n\n // Copy .next/static directory\n if (\n !options.buildExport &&\n existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))\n ) {\n if (!options.silent) {\n Log.info('Copying \"static build\" directory')\n }\n await span\n .traceChild('copy-next-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(\n join(distDir, CLIENT_STATIC_FILES_PATH),\n join(outDir, '_next', CLIENT_STATIC_FILES_PATH)\n )\n )\n }\n\n // Get the exportPathMap from the config file\n if (typeof nextConfig.exportPathMap !== 'function') {\n nextConfig.exportPathMap = async (defaultMap) => {\n return defaultMap\n }\n }\n\n const {\n i18n,\n images: { loader = 'default', unoptimized },\n } = nextConfig\n\n if (i18n && !options.buildExport) {\n throw new ExportError(\n `i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n if (!options.buildExport) {\n const { isNextImageImported } = await span\n .traceChild('is-next-image-imported')\n .traceAsyncFn(() =>\n fs\n .readFile(join(distDir, EXPORT_MARKER), 'utf8')\n .then((text) => JSON.parse(text))\n .catch(() => ({}))\n )\n\n if (\n isNextImageImported &&\n loader === 'default' &&\n !unoptimized &&\n !hasNextSupport\n ) {\n throw new ExportError(\n `Image Optimization using the default loader is not compatible with export.\n Possible solutions:\n - Use \\`next start\\` to run a server, which includes the Image Optimization API.\n - Configure \\`images.unoptimized = true\\` in \\`next.config.js\\` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api`\n )\n }\n }\n\n let serverActionsManifest: ActionManifest | undefined\n if (enabledDirectories.app) {\n serverActionsManifest = require(\n join(distDir, SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.json')\n ) as ActionManifest\n\n if (nextConfig.output === 'export') {\n const routesManifest = require(join(distDir, ROUTES_MANIFEST))\n\n // We already prevent rewrites earlier in the process, however Next.js will insert rewrites\n // for interception routes so we need to check for that here.\n if (routesManifest?.rewrites?.beforeFiles?.length > 0) {\n const hasInterceptionRouteRewrite =\n routesManifest.rewrites.beforeFiles.some(isInterceptionRouteRewrite)\n\n if (hasInterceptionRouteRewrite) {\n throw new ExportError(\n `Intercepting routes are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n\n const actionIds = [\n ...Object.keys(serverActionsManifest.node),\n ...Object.keys(serverActionsManifest.edge),\n ]\n\n if (\n actionIds.some(\n (actionId) =>\n extractInfoFromServerReferenceId(actionId).type === 'server-action'\n )\n ) {\n throw new ExportError(\n `Server Actions are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n }\n\n // Start the rendering process\n const renderOpts: WorkerRenderOptsPartial = {\n previewProps: prerenderManifest?.preview,\n isBuildTimePrerendering: true,\n assetPrefix: nextConfig.assetPrefix.replace(/\\/$/, ''),\n distDir,\n basePath: nextConfig.basePath,\n cacheComponents: nextConfig.cacheComponents ?? false,\n trailingSlash: nextConfig.trailingSlash,\n locales: i18n?.locales,\n locale: i18n?.defaultLocale,\n defaultLocale: i18n?.defaultLocale,\n domainLocales: i18n?.domains,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n // Exported pages do not currently support dynamic HTML.\n supportsDynamicResponse: false,\n crossOrigin: nextConfig.crossOrigin,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n serverActions: nextConfig.experimental.serverActions,\n serverComponents: enabledDirectories.app,\n cacheLifeProfiles: nextConfig.cacheLife,\n nextFontManifest: require(\n join(distDir, 'server', `${NEXT_FONT_MANIFEST}.json`)\n ),\n images: nextConfig.images,\n htmlLimitedBots: nextConfig.htmlLimitedBots.source,\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\n dynamicOnHover: nextConfig.experimental.dynamicOnHover ?? false,\n optimisticRouting: nextConfig.experimental.optimisticRouting ?? false,\n inlineCss: nextConfig.experimental.inlineCss ?? false,\n prefetchInlining: nextConfig.experimental.prefetchInlining ?? false,\n authInterrupts: !!nextConfig.experimental.authInterrupts,\n maxPostponedStateSizeBytes: parseMaxPostponedStateSize(\n nextConfig.experimental.maxPostponedStateSize\n ),\n },\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n }\n\n // We need this for server rendering the Link component.\n ;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n }\n\n const exportPathMap = await span\n .traceChild('run-export-path-map')\n .traceAsyncFn(async () => {\n const exportMap = await nextConfig.exportPathMap(defaultPathMap, {\n dev: false,\n dir,\n outDir,\n distDir,\n buildId,\n })\n return exportMap\n })\n\n // During static export, remove export 404/500 of pages router\n // when only app router presents\n if (!options.buildExport && options.appDirOnly) {\n delete exportPathMap['/404']\n delete exportPathMap['/500']\n }\n\n // only add missing 404 page when `buildExport` is false\n if (!options.buildExport && !options.appDirOnly) {\n // only add missing /404 if not specified in `exportPathMap`\n if (!exportPathMap['/404']) {\n exportPathMap['/404'] = { page: '/_error' }\n }\n\n /**\n * exports 404.html for backwards compat\n * E.g. GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify\n */\n if (!exportPathMap['/404.html'] && exportPathMap['/404']) {\n // alias /404.html to /404 to be compatible with custom 404 / _error page\n exportPathMap['/404.html'] = exportPathMap['/404']\n }\n }\n\n const allExportPaths: ExportPathEntry[] = []\n const seenExportPaths = new Set<string>()\n const fallbackEnabledPages = new Set<string>()\n\n for (const [path, entry] of Object.entries(exportPathMap)) {\n // make sure to prevent duplicates\n const normalizedPath = denormalizePagePath(normalizePagePath(path))\n\n if (seenExportPaths.has(normalizedPath)) {\n continue\n }\n\n seenExportPaths.add(normalizedPath)\n\n if (!entry._isAppDir && isAPIRoute(entry.page)) {\n hasApiRoutes = true\n continue\n }\n\n allExportPaths.push({ ...entry, path: normalizedPath })\n\n if (prerenderManifest && !options.buildExport) {\n const prerenderInfo = prerenderManifest.dynamicRoutes[entry.page]\n\n if (prerenderInfo && prerenderInfo.fallback !== false) {\n fallbackEnabledPages.add(entry.page)\n }\n }\n }\n\n if (allExportPaths.length === 0) {\n if (!prerenderManifest) {\n return null\n }\n }\n\n if (fallbackEnabledPages.size > 0) {\n throw new ExportError(\n `Found pages with \\`fallback\\` enabled:\\n${[...fallbackEnabledPages].join(\n '\\n'\n )}\\n${SSG_FALLBACK_EXPORT_ERROR}\\n`\n )\n }\n\n let hasMiddleware = false\n\n if (!options.buildExport) {\n try {\n const middlewareManifest = require(\n join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST)\n ) as MiddlewareManifest\n\n const functionsConfigManifest = require(\n join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST)\n )\n\n hasMiddleware =\n Object.keys(middlewareManifest.middleware).length > 0 ||\n Boolean(functionsConfigManifest.functions?.['/_middleware'])\n } catch {}\n\n // Warn if the user defines a path for an API page\n if (hasApiRoutes || hasMiddleware) {\n if (nextConfig.output === 'export') {\n Log.warn(\n yellow(\n `Statically exporting a Next.js application via \\`next export\\` disables API routes and middleware.`\n ) +\n `\\n` +\n yellow(\n `This command is meant for static-only hosts, and is` +\n ' ' +\n bold(`not necessary to make your application static.`)\n ) +\n `\\n` +\n yellow(\n `Pages in your application without server-side data dependencies will be automatically statically exported by \\`next build\\`, including pages powered by \\`getStaticProps\\`.`\n ) +\n `\\n` +\n yellow(\n `Learn more: https://nextjs.org/docs/messages/api-routes-static-export`\n )\n )\n }\n }\n }\n\n const pagesDataDir = options.buildExport\n ? outDir\n : join(outDir, '_next/data', buildId)\n\n const publicDir = join(dir, CLIENT_PUBLIC_FILES_PATH)\n // Copy public directory\n if (!options.buildExport && existsSync(publicDir)) {\n if (!options.silent) {\n Log.info('Copying \"public\" directory')\n }\n await span.traceChild('copy-public-directory').traceAsyncFn(() =>\n recursiveCopy(publicDir, outDir, {\n filter(path) {\n // Exclude paths used by pages\n return !exportPathMap[path]\n },\n })\n )\n }\n\n const exportPagesInBatches = async (\n worker: StaticWorker,\n exportPaths: ExportPathEntry[],\n renderResumeDataCachesByPage?: Record<string, string>\n ): Promise<ExportPagesResult> => {\n // Batch filtered pages into smaller batches, and call the export worker on\n // each batch. We've set a default minimum of 25 pages per batch to ensure\n // that even setups with only a few static pages can leverage a shared\n // incremental cache, however this value can be configured.\n const minPageCountPerBatch =\n nextConfig.experimental.staticGenerationMinPagesPerWorker ?? 25\n\n // Calculate the number of workers needed to ensure each batch has at least\n // minPageCountPerBatch pages.\n const numWorkers = Math.min(\n options.numWorkers,\n Math.ceil(exportPaths.length / minPageCountPerBatch)\n )\n\n // Calculate the page count per batch based on the number of workers.\n const pageCountPerBatch = Math.ceil(exportPaths.length / numWorkers)\n\n const batches = Array.from({ length: numWorkers }, (_, i) =>\n exportPaths.slice(i * pageCountPerBatch, (i + 1) * pageCountPerBatch)\n )\n\n // Distribute remaining pages.\n const remainingPages = exportPaths.slice(numWorkers * pageCountPerBatch)\n remainingPages.forEach((page, index) => {\n batches[index % batches.length].push(page)\n })\n\n return (\n await Promise.all(\n batches.map(async (batch) =>\n worker.exportPages({\n buildId,\n deploymentId: nextConfig.deploymentId,\n clientAssetToken:\n nextConfig.experimental.immutableAssetToken ||\n nextConfig.deploymentId,\n exportPaths: batch,\n parentSpanId: span.getId(),\n pagesDataDir,\n renderOpts,\n options,\n dir,\n distDir,\n outDir,\n nextConfig,\n cacheHandler: nextConfig.cacheHandler,\n cacheMaxMemorySize: nextConfig.cacheMaxMemorySize,\n fetchCache: true,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n renderResumeDataCachesByPage,\n })\n )\n )\n ).flat()\n }\n\n let initialPhaseExportPaths: ExportPathEntry[] = []\n const finalPhaseExportPaths: ExportPathEntry[] = []\n\n if (renderOpts.cacheComponents) {\n for (const exportPath of allExportPaths) {\n if (exportPath._allowEmptyStaticShell) {\n finalPhaseExportPaths.push(exportPath)\n } else {\n initialPhaseExportPaths.push(exportPath)\n }\n }\n } else {\n initialPhaseExportPaths = allExportPaths\n }\n\n const totalExportPaths =\n initialPhaseExportPaths.length + finalPhaseExportPaths.length\n let worker: StaticWorker | null = null\n let results: ExportPagesResult = []\n\n if (totalExportPaths > 0) {\n const progress = createProgress(\n totalExportPaths,\n options.statusMessage ??\n `Exporting using ${options.numWorkers} worker${options.numWorkers > 1 ? 's' : ''}`\n )\n\n if (staticWorker) {\n // TODO: progress shouldn't rely on \"activity\" event sent from `exportPage`.\n staticWorker.setOnActivity(progress.run)\n staticWorker.setOnActivityAbort(progress.clear)\n worker = staticWorker\n } else {\n worker = createStaticWorker(nextConfig, {\n debuggerPortOffset: getNextBuildDebuggerPortOffset({\n kind: 'export-page',\n }),\n numberOfWorkers: options.numWorkers,\n progress,\n })\n }\n\n results = await exportPagesInBatches(worker, initialPhaseExportPaths)\n\n if (finalPhaseExportPaths.length > 0) {\n const renderResumeDataCachesByPage = buildRDCCacheByPage(\n results,\n finalPhaseExportPaths\n )\n\n const finalPhaseResults = await exportPagesInBatches(\n worker,\n finalPhaseExportPaths,\n renderResumeDataCachesByPage\n )\n\n results.push(...finalPhaseResults)\n }\n }\n\n const collector: ExportAppResult = {\n byPath: new Map(),\n byPage: new Map(),\n ssgNotFoundPaths: new Set(),\n turborepoAccessTraceResults: new Map(),\n }\n\n const failedExportAttemptsByPage: Map<string, boolean> = new Map()\n\n for (const { result, path, page, pageKey } of results) {\n if (!result) continue\n if ('error' in result) {\n failedExportAttemptsByPage.set(pageKey, true)\n continue\n }\n\n if (result.turborepoAccessTraceResult) {\n collector.turborepoAccessTraceResults?.set(\n path,\n TurborepoAccessTraceResult.fromSerialized(\n result.turborepoAccessTraceResult\n )\n )\n }\n\n if (options.buildExport) {\n // Update path info by path.\n const info = collector.byPath.get(path) ?? {}\n if (result.cacheControl) {\n info.cacheControl = result.cacheControl\n }\n if (typeof result.metadata !== 'undefined') {\n info.metadata = result.metadata\n }\n\n if (typeof result.hasEmptyStaticShell !== 'undefined') {\n info.hasEmptyStaticShell = result.hasEmptyStaticShell\n }\n\n if (typeof result.hasPostponed !== 'undefined') {\n info.hasPostponed = result.hasPostponed\n }\n\n if (typeof result.hasStaticRsc !== 'undefined') {\n info.hasStaticRsc = result.hasStaticRsc\n }\n\n if (typeof result.fetchMetrics !== 'undefined') {\n info.fetchMetrics = result.fetchMetrics\n }\n\n collector.byPath.set(path, info)\n\n // Update not found.\n if (result.ssgNotFound === true) {\n collector.ssgNotFoundPaths.add(path)\n }\n\n // Update durations.\n const durations = collector.byPage.get(page) ?? {\n durationsByPath: new Map<string, number>(),\n }\n durations.durationsByPath.set(path, result.duration)\n collector.byPage.set(page, durations)\n }\n }\n\n // Export mode provide static outputs that are not compatible with PPR mode.\n if (!options.buildExport && nextConfig.experimental.ppr) {\n // TODO: add message\n throw new Error('Invariant: PPR cannot be enabled in export mode')\n }\n\n // copy prerendered routes to outDir\n if (!options.buildExport && prerenderManifest) {\n await Promise.all(\n Object.keys(prerenderManifest.routes).map(async (unnormalizedRoute) => {\n // Special handling: map app /_not-found to 404.html (and 404/index.html when trailingSlash)\n if (unnormalizedRoute === '/_not-found') {\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const htmlSrc = `${orig}.html`\n\n // write 404.html at root\n const htmlDest404 = join(outDir, '404.html')\n await fs.mkdir(dirname(htmlDest404), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404)\n\n // When trailingSlash, also write 404/index.html\n if (subFolders) {\n const htmlDest404Index = join(outDir, '404', 'index.html')\n await fs.mkdir(dirname(htmlDest404Index), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404Index)\n }\n }\n // Skip 500.html in static export\n if (unnormalizedRoute === '/_global-error') {\n return\n }\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const isAppRouteHandler = appPageName && isAppRouteRoute(appPageName)\n\n // returning notFound: true from getStaticProps will not\n // output html/json files during the build\n if (prerenderManifest!.notFoundRoutes.includes(unnormalizedRoute)) {\n return\n }\n // TODO: This rewrites /index/foo to /index/index/foo. Investigate and\n // fix. I presume this was because normalizePagePath was designed for\n // some other use case and then reused here for static exports without\n // realizing the implications.\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n // strip leading / and then recurse number of nested dirs\n // to place from base folder\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const handlerSrc = `${orig}.body`\n const handlerDest = join(outDir, route)\n\n if (isAppRouteHandler && existsSync(handlerSrc)) {\n await fs.mkdir(dirname(handlerDest), { recursive: true })\n await fs.copyFile(handlerSrc, handlerDest)\n return\n }\n\n const htmlDest = join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.html`\n )\n const jsonDest = isAppPath\n ? join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.txt`\n )\n : join(pagesDataDir, `${route}.json`)\n\n await fs.mkdir(dirname(htmlDest), { recursive: true })\n await fs.mkdir(dirname(jsonDest), { recursive: true })\n\n const htmlSrc = `${orig}.html`\n const jsonSrc = `${orig}${isAppPath ? RSC_SUFFIX : '.json'}`\n\n await fs.copyFile(htmlSrc, htmlDest)\n await fs.copyFile(jsonSrc, jsonDest)\n\n const segmentsDir = `${orig}${RSC_SEGMENTS_DIR_SUFFIX}`\n\n if (isAppPath && existsSync(segmentsDir)) {\n // Output a data file for each of this page's segments\n //\n // These files are requested by the client router's internal\n // prefetcher, not the user directly. So we don't need to account for\n // things like trailing slash handling.\n //\n // To keep the protocol simple, we can use the non-normalized route\n // path instead of the normalized one (which, among other things,\n // rewrites `/` to `/index`).\n const segmentsDirDest = join(outDir, unnormalizedRoute)\n const segmentPaths = await collectSegmentPaths(segmentsDir)\n await Promise.all(\n segmentPaths.map(async (segmentFileSrc) => {\n const segmentPath =\n '/' + segmentFileSrc.slice(0, -RSC_SEGMENT_SUFFIX.length)\n const segmentFilename =\n convertSegmentPathToStaticExportFilename(segmentPath)\n const segmentFileDest = join(segmentsDirDest, segmentFilename)\n await fs.mkdir(dirname(segmentFileDest), { recursive: true })\n await fs.copyFile(\n join(segmentsDir, segmentFileSrc),\n segmentFileDest\n )\n })\n )\n }\n })\n )\n }\n\n if (failedExportAttemptsByPage.size > 0) {\n const failedPages = Array.from(failedExportAttemptsByPage.keys())\n throw new ExportError(\n `Export encountered errors on ${failedPages.length} ${failedPages.length === 1 ? 'path' : 'paths'}:\\n\\t${failedPages\n .sort()\n .join('\\n\\t')}`\n )\n }\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: true,\n }),\n 'utf8'\n )\n\n if (telemetry) {\n await telemetry.flush()\n }\n\n // Clean up activity listeners for progress.\n if (staticWorker) {\n staticWorker.setOnActivity(undefined)\n staticWorker.setOnActivityAbort(undefined)\n }\n\n if (!staticWorker && worker) {\n await worker.end()\n }\n\n return collector\n}\n\nasync function collectSegmentPaths(segmentsDirectory: string) {\n const results: Array<string> = []\n await collectSegmentPathsImpl(segmentsDirectory, segmentsDirectory, results)\n return results\n}\n\nasync function collectSegmentPathsImpl(\n segmentsDirectory: string,\n directory: string,\n results: Array<string>\n) {\n const segmentFiles = await fs.readdir(directory, {\n withFileTypes: true,\n })\n await Promise.all(\n segmentFiles.map(async (segmentFile) => {\n if (segmentFile.isDirectory()) {\n await collectSegmentPathsImpl(\n segmentsDirectory,\n join(directory, segmentFile.name),\n results\n )\n return\n }\n if (!segmentFile.name.endsWith(RSC_SEGMENT_SUFFIX)) {\n return\n }\n results.push(\n relative(segmentsDirectory, join(directory, segmentFile.name))\n )\n })\n )\n}\n\nexport default async function exportApp(\n dir: string,\n options: ExportAppOptions,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n const nextExportSpan = span.traceChild('next-export')\n\n return nextExportSpan.traceAsyncFn(async () => {\n return await exportAppImpl(dir, options, nextExportSpan, staticWorker)\n })\n}\n"],"names":["ExportError","exportApp","Error","code","buildRDCCacheByPage","results","finalPhaseExportPaths","renderResumeDataCachesByPage","seedCandidatesByPage","Map","page","path","result","renderResumeDataCache","candidates","get","push","set","undefined","getKnownParamsKey","normalizedPage","fallbackParamNames","params","getParams","entries","Object","filter","key","has","sort","a","b","JSON","stringify","exportPath","_fallbackRouteParams","isDynamicRoute","normalizeAppPath","pageKey","Set","map","param","paramName","targetKey","length","selected","candidate","candidateKey","exportAppImpl","dir","options","span","staticWorker","resolve","traceChild","traceFn","loadEnvConfig","Log","enabledDirectories","nextConfig","traceAsyncFn","loadConfig","PHASE_EXPORT","debugPrerender","distDir","join","telemetry","buildExport","Telemetry","record","eventCliSession","webpackVersion","cliCommand","isSrcDir","hasNowJson","findUp","cwd","isCustomServer","turboFlag","pagesDir","appDir","subFolders","trailingSlash","silent","info","buildIdFile","BUILD_ID_FILE","existsSync","customRoutes","config","hasNextSupport","warn","buildId","fs","readFile","pagesManifest","pages","require","SERVER_DIRECTORY","PAGES_MANIFEST","prerenderManifest","PRERENDER_MANIFEST","appRoutePathManifest","APP_PATH_ROUTES_MANIFEST","err","isError","excludedPrerenderRoutes","keys","defaultPathMap","hasApiRoutes","isAPIRoute","dynamicRoutes","add","mapAppRouteToPage","pageName","routePath","isAppPageRoute","routes","_isAppDir","outDir","outdir","rm","recursive","force","mkdir","writeFile","EXPORT_DETAIL","formatManifest","version","outDirectory","success","recursiveCopy","CLIENT_STATIC_FILES_PATH","exportPathMap","defaultMap","i18n","images","loader","unoptimized","isNextImageImported","EXPORT_MARKER","then","text","parse","catch","serverActionsManifest","app","SERVER_REFERENCE_MANIFEST","output","routesManifest","ROUTES_MANIFEST","rewrites","beforeFiles","hasInterceptionRouteRewrite","some","isInterceptionRouteRewrite","actionIds","node","edge","actionId","extractInfoFromServerReferenceId","type","renderOpts","previewProps","preview","isBuildTimePrerendering","assetPrefix","replace","basePath","cacheComponents","locales","locale","defaultLocale","domainLocales","domains","disableOptimizedLoading","experimental","supportsDynamicResponse","crossOrigin","optimizeCss","nextConfigOutput","nextScriptWorkers","largePageDataBytes","serverActions","serverComponents","cacheLifeProfiles","cacheLife","nextFontManifest","NEXT_FONT_MANIFEST","htmlLimitedBots","source","clientTraceMetadata","expireTime","staleTimes","clientParamParsingOrigins","dynamicOnHover","optimisticRouting","inlineCss","prefetchInlining","authInterrupts","maxPostponedStateSizeBytes","parseMaxPostponedStateSize","maxPostponedStateSize","reactMaxHeadersLength","globalThis","__NEXT_DATA__","nextExport","exportMap","dev","appDirOnly","allExportPaths","seenExportPaths","fallbackEnabledPages","entry","normalizedPath","denormalizePagePath","normalizePagePath","prerenderInfo","fallback","size","SSG_FALLBACK_EXPORT_ERROR","hasMiddleware","functionsConfigManifest","middlewareManifest","MIDDLEWARE_MANIFEST","FUNCTIONS_CONFIG_MANIFEST","middleware","Boolean","functions","yellow","bold","pagesDataDir","publicDir","CLIENT_PUBLIC_FILES_PATH","exportPagesInBatches","worker","exportPaths","minPageCountPerBatch","staticGenerationMinPagesPerWorker","numWorkers","Math","min","ceil","pageCountPerBatch","batches","Array","from","_","i","slice","remainingPages","forEach","index","Promise","all","batch","exportPages","deploymentId","clientAssetToken","immutableAssetToken","parentSpanId","getId","cacheHandler","cacheMaxMemorySize","fetchCache","fetchCacheKeyPrefix","flat","initialPhaseExportPaths","_allowEmptyStaticShell","totalExportPaths","progress","createProgress","statusMessage","setOnActivity","run","setOnActivityAbort","clear","createStaticWorker","debuggerPortOffset","getNextBuildDebuggerPortOffset","kind","numberOfWorkers","finalPhaseResults","collector","byPath","byPage","ssgNotFoundPaths","turborepoAccessTraceResults","failedExportAttemptsByPage","turborepoAccessTraceResult","TurborepoAccessTraceResult","fromSerialized","cacheControl","metadata","hasEmptyStaticShell","hasPostponed","hasStaticRsc","fetchMetrics","ssgNotFound","durations","durationsByPath","duration","ppr","unnormalizedRoute","srcRoute","appPageName","isAppPath","route","pagePath","getPagePath","distPagesDir","split","orig","htmlSrc","htmlDest404","dirname","copyFile","htmlDest404Index","isAppRouteHandler","isAppRouteRoute","notFoundRoutes","includes","handlerSrc","handlerDest","htmlDest","sep","jsonDest","jsonSrc","RSC_SUFFIX","segmentsDir","RSC_SEGMENTS_DIR_SUFFIX","segmentsDirDest","segmentPaths","collectSegmentPaths","segmentFileSrc","segmentPath","RSC_SEGMENT_SUFFIX","segmentFilename","convertSegmentPathToStaticExportFilename","segmentFileDest","failedPages","flush","end","segmentsDirectory","collectSegmentPathsImpl","directory","segmentFiles","readdir","withFileTypes","segmentFile","isDirectory","name","endsWith","relative","nextExportSpan"],"mappings":";;;;;;;;;;;;;;;IA4EaA,WAAW;eAAXA;;IAk+Bb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;QAC3B,MAAMA,OAAO2G,GAAG;IAClB;IAEA,OAAO3D;AACT;AAEA,eAAekD,oBAAoBU,iBAAyB;IAC1D,MAAMlV,UAAyB,EAAE;IACjC,MAAMmV,wBAAwBD,mBAAmBA,mBAAmBlV;IACpE,OAAOA;AACT;AAEA,eAAemV,wBACbD,iBAAyB,EACzBE,SAAiB,EACjBpV,OAAsB;IAEtB,MAAMqV,eAAe,MAAM7P,YAAE,CAAC8P,OAAO,CAACF,WAAW;QAC/CG,eAAe;IACjB;IACA,MAAM/F,QAAQC,GAAG,CACf4F,aAAalT,GAAG,CAAC,OAAOqT;QACtB,IAAIA,YAAYC,WAAW,IAAI;YAC7B,MAAMN,wBACJD,mBACAtR,IAAAA,UAAI,EAACwR,WAAWI,YAAYE,IAAI,GAChC1V;YAEF;QACF;QACA,IAAI,CAACwV,YAAYE,IAAI,CAACC,QAAQ,CAAChB,6BAAkB,GAAG;YAClD;QACF;QACA3U,QAAQW,IAAI,CACViV,IAAAA,cAAQ,EAACV,mBAAmBtR,IAAAA,UAAI,EAACwR,WAAWI,YAAYE,IAAI;IAEhE;AAEJ;AAEe,eAAe9V,UAC5BgD,GAAW,EACXC,OAAyB,EACzBC,IAAU,EACVC,YAA2B;IAE3B,MAAM8S,iBAAiB/S,KAAKG,UAAU,CAAC;IAEvC,OAAO4S,eAAetS,YAAY,CAAC;QACjC,OAAO,MAAMZ,cAAcC,KAAKC,SAASgT,gBAAgB9S;IAC3D;AACF","ignoreList":[0]}
{"version":3,"sources":["../../src/export/index.ts"],"sourcesContent":["import type {\n ExportAppResult,\n ExportAppOptions,\n WorkerRenderOptsPartial,\n ExportPagesResult,\n ExportPathEntry,\n} from './types'\nimport {\n createStaticWorker,\n type PrerenderManifest,\n type StaticWorker,\n} from '../build'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\n\nimport { bold, yellow } from '../lib/picocolors'\nimport findUp from 'next/dist/compiled/find-up'\nimport { existsSync, promises as fs } from 'fs'\n\nimport '../server/require-hook'\n\nimport { dirname, join, resolve, sep, relative } from 'path'\nimport * as Log from '../build/output/log'\nimport {\n RSC_SEGMENT_SUFFIX,\n RSC_SEGMENTS_DIR_SUFFIX,\n RSC_SUFFIX,\n SSG_FALLBACK_EXPORT_ERROR,\n} from '../lib/constants'\nimport { recursiveCopy } from '../lib/recursive-copy'\nimport {\n BUILD_ID_FILE,\n CLIENT_PUBLIC_FILES_PATH,\n CLIENT_STATIC_FILES_PATH,\n EXPORT_DETAIL,\n EXPORT_MARKER,\n NEXT_FONT_MANIFEST,\n MIDDLEWARE_MANIFEST,\n PAGES_MANIFEST,\n PHASE_EXPORT,\n PRERENDER_MANIFEST,\n SERVER_DIRECTORY,\n SERVER_REFERENCE_MANIFEST,\n APP_PATH_ROUTES_MANIFEST,\n ROUTES_MANIFEST,\n FUNCTIONS_CONFIG_MANIFEST,\n} from '../shared/lib/constants'\nimport loadConfig from '../server/config'\nimport type { ExportPathMap } from '../server/config-shared'\nimport { parseMaxPostponedStateSize } from '../server/config-shared'\nimport { eventCliSession } from '../telemetry/events'\nimport { hasNextSupport } from '../server/ci-info'\nimport { Telemetry } from '../telemetry/storage'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { loadEnvConfig } from '@next/env'\nimport { isAPIRoute } from '../lib/is-api-route'\nimport { getPagePath } from '../server/require'\nimport type { Span } from '../trace'\nimport type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { isAppPageRoute } from '../lib/is-app-page-route'\nimport isError from '../lib/is-error'\nimport { formatManifest } from '../build/manifests/formatter/format-manifest'\nimport { TurborepoAccessTraceResult } from '../build/turborepo-access-trace'\nimport { createProgress } from '../build/progress'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isInterceptionRouteRewrite } from '../lib/is-interception-route-rewrite'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\nimport { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info'\nimport { convertSegmentPathToStaticExportFilename } from '../shared/lib/segment-cache/segment-value-encoding'\nimport { getNextBuildDebuggerPortOffset } from '../lib/worker'\nimport { getParams } from './helpers/get-params'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport type { Params } from '../server/request/params'\n\nexport class ExportError extends Error {\n code = 'NEXT_EXPORT_ERROR'\n}\n\n/**\n * Picks an RDC seed by matching on the params that are\n * already known, so fallback shells use a seed that has already\n * computed those known params.\n */\nfunction buildRDCCacheByPage(\n results: ExportPagesResult,\n finalPhaseExportPaths: ExportPathEntry[]\n): Record<string, string> {\n const renderResumeDataCachesByPage: Record<string, string> = {}\n const seedCandidatesByPage = new Map<\n string,\n Array<{ path: string; renderResumeDataCache: string }>\n >()\n\n for (const { page, path, result } of results) {\n if (!result) {\n continue\n }\n\n if ('renderResumeDataCache' in result && result.renderResumeDataCache) {\n // Collect all RDC seeds for this page so we can pick the best match\n // for each fallback shell later (e.g. locale-specific variants).\n const candidates = seedCandidatesByPage.get(page) ?? []\n candidates.push({\n path,\n renderResumeDataCache: result.renderResumeDataCache,\n })\n seedCandidatesByPage.set(page, candidates)\n // Remove the RDC string from the result so that it can be garbage\n // collected, when there are more results for the same page.\n result.renderResumeDataCache = undefined\n }\n }\n\n const getKnownParamsKey = (\n normalizedPage: string,\n path: string,\n fallbackParamNames: Set<string>\n ): string | null => {\n let params: Params\n try {\n params = getParams(normalizedPage, path)\n } catch {\n return null\n }\n\n // Only keep params that are known, then sort\n // for a stable key so we can match a compatible seed.\n const entries = Object.entries(params).filter(\n ([key]) => !fallbackParamNames.has(key)\n )\n\n entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n return JSON.stringify(entries)\n }\n\n for (const exportPath of finalPhaseExportPaths) {\n const { page, path, _fallbackRouteParams = [] } = exportPath\n if (!isDynamicRoute(page)) {\n continue\n }\n\n // Normalize app pages before param matching.\n const normalizedPage = normalizeAppPath(page)\n const pageKey = page !== path ? `${page}: ${path}` : path\n const fallbackParamNames = new Set(\n _fallbackRouteParams.map((param) => param.paramName)\n )\n // Build a key from the known params for this fallback shell so we can\n // select a seed from a compatible prerendered route.\n const targetKey = getKnownParamsKey(\n normalizedPage,\n path,\n fallbackParamNames\n )\n\n if (!targetKey) {\n continue\n }\n\n const candidates = seedCandidatesByPage.get(page)\n\n // No suitable candidates, so there's no RDC seed to select\n if (!candidates || candidates.length === 0) {\n continue\n }\n\n let selected: string | null = null\n for (const candidate of candidates) {\n // Pick the seed whose known params match this fallback shell.\n const candidateKey = getKnownParamsKey(\n normalizedPage,\n candidate.path,\n fallbackParamNames\n )\n if (candidateKey === targetKey) {\n selected = candidate.renderResumeDataCache\n break\n }\n }\n\n if (selected) {\n renderResumeDataCachesByPage[pageKey] = selected\n }\n }\n\n return renderResumeDataCachesByPage\n}\n\nasync function exportAppImpl(\n dir: string,\n options: Readonly<ExportAppOptions>,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n dir = resolve(dir)\n\n // attempt to load global env values so they are available in next.config.js\n span.traceChild('load-dotenv').traceFn(() => loadEnvConfig(dir, false, Log))\n\n const { enabledDirectories } = options\n\n const nextConfig =\n options.nextConfig ||\n (await span.traceChild('load-next-config').traceAsyncFn(() =>\n loadConfig(PHASE_EXPORT, dir, {\n debugPrerender: options.debugPrerender,\n })\n ))\n\n const distDir = join(dir, nextConfig.distDir)\n const telemetry = options.buildExport ? null : new Telemetry({ distDir })\n\n if (telemetry) {\n telemetry.record(\n eventCliSession(nextConfig, {\n webpackVersion: null,\n cliCommand: 'export',\n isSrcDir: null,\n hasNowJson: !!(await findUp('now.json', { cwd: dir })),\n isCustomServer: null,\n turboFlag: false,\n pagesDir: null,\n appDir: null,\n })\n )\n }\n\n const subFolders = nextConfig.trailingSlash && !options.buildExport\n\n if (!options.silent && !options.buildExport) {\n Log.info(`using build directory: ${distDir}`)\n }\n\n const buildIdFile = join(distDir, BUILD_ID_FILE)\n\n if (!existsSync(buildIdFile)) {\n throw new ExportError(\n `Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`\n )\n }\n\n const customRoutes = (['rewrites', 'redirects', 'headers'] as const).filter(\n (config) => typeof nextConfig[config] === 'function'\n )\n\n if (!hasNextSupport && !options.buildExport && customRoutes.length > 0) {\n Log.warn(\n `rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(\n ', '\n )}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n const buildId = await fs.readFile(buildIdFile, 'utf8')\n\n const pagesManifest =\n !options.pages &&\n (require(join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST)) as PagesManifest)\n\n let prerenderManifest: DeepReadonly<PrerenderManifest> | undefined\n try {\n prerenderManifest = require(join(distDir, PRERENDER_MANIFEST))\n } catch {}\n\n let appRoutePathManifest: Record<string, string> | undefined\n try {\n appRoutePathManifest = require(join(distDir, APP_PATH_ROUTES_MANIFEST))\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'MODULE_NOT_FOUND')\n ) {\n // the manifest doesn't exist which will happen when using\n // \"pages\" dir instead of \"app\" dir.\n appRoutePathManifest = undefined\n } else {\n // the manifest is malformed (invalid json)\n throw err\n }\n }\n\n const excludedPrerenderRoutes = new Set<string>()\n const pages = options.pages || Object.keys(pagesManifest)\n const defaultPathMap: ExportPathMap = {}\n\n let hasApiRoutes = false\n for (const page of pages) {\n // _document and _app are not real pages\n // _error is exported as 404.html later on\n // API Routes are Node.js functions\n\n if (isAPIRoute(page)) {\n hasApiRoutes = true\n continue\n }\n\n if (page === '/_document' || page === '/_app' || page === '/_error') {\n continue\n }\n\n // iSSG pages that are dynamic should not export templated version by\n // default. In most cases, this would never work. There is no server that\n // could run `getStaticProps`. If users make their page work lazily, they\n // can manually add it to the `exportPathMap`.\n if (prerenderManifest?.dynamicRoutes[page]) {\n excludedPrerenderRoutes.add(page)\n continue\n }\n\n defaultPathMap[page] = { page }\n }\n\n const mapAppRouteToPage = new Map<string, string>()\n if (!options.buildExport && appRoutePathManifest) {\n for (const [pageName, routePath] of Object.entries(appRoutePathManifest)) {\n mapAppRouteToPage.set(routePath, pageName)\n if (\n isAppPageRoute(pageName) &&\n !prerenderManifest?.routes[routePath] &&\n !prerenderManifest?.dynamicRoutes[routePath]\n ) {\n defaultPathMap[routePath] = {\n page: pageName,\n _isAppDir: true,\n }\n }\n }\n }\n\n // Initialize the output directory\n const outDir = options.outdir\n\n if (outDir === join(dir, 'public')) {\n throw new ExportError(\n `The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-public`\n )\n }\n\n if (outDir === join(dir, 'static')) {\n throw new ExportError(\n `The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-static`\n )\n }\n\n await fs.rm(outDir, { recursive: true, force: true })\n await fs.mkdir(join(outDir, '_next', buildId), { recursive: true })\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: false,\n }),\n 'utf8'\n )\n\n // Copy static directory\n if (!options.buildExport && existsSync(join(dir, 'static'))) {\n if (!options.silent) {\n Log.info('Copying \"static\" directory')\n }\n await span\n .traceChild('copy-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(join(dir, 'static'), join(outDir, 'static'))\n )\n }\n\n // Copy .next/static directory\n if (\n !options.buildExport &&\n existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))\n ) {\n if (!options.silent) {\n Log.info('Copying \"static build\" directory')\n }\n await span\n .traceChild('copy-next-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(\n join(distDir, CLIENT_STATIC_FILES_PATH),\n join(outDir, '_next', CLIENT_STATIC_FILES_PATH)\n )\n )\n }\n\n // Get the exportPathMap from the config file\n if (typeof nextConfig.exportPathMap !== 'function') {\n nextConfig.exportPathMap = async (defaultMap) => {\n return defaultMap\n }\n }\n\n const {\n i18n,\n images: { loader = 'default', unoptimized },\n } = nextConfig\n\n if (i18n && !options.buildExport) {\n throw new ExportError(\n `i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n if (!options.buildExport) {\n const { isNextImageImported } = await span\n .traceChild('is-next-image-imported')\n .traceAsyncFn(() =>\n fs\n .readFile(join(distDir, EXPORT_MARKER), 'utf8')\n .then((text) => JSON.parse(text))\n .catch(() => ({}))\n )\n\n if (\n isNextImageImported &&\n loader === 'default' &&\n !unoptimized &&\n !hasNextSupport\n ) {\n throw new ExportError(\n `Image Optimization using the default loader is not compatible with export.\n Possible solutions:\n - Use \\`next start\\` to run a server, which includes the Image Optimization API.\n - Configure \\`images.unoptimized = true\\` in \\`next.config.js\\` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api`\n )\n }\n }\n\n let serverActionsManifest: ActionManifest | undefined\n if (enabledDirectories.app) {\n serverActionsManifest = require(\n join(distDir, SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.json')\n ) as ActionManifest\n\n if (nextConfig.output === 'export') {\n const routesManifest = require(join(distDir, ROUTES_MANIFEST))\n\n // We already prevent rewrites earlier in the process, however Next.js will insert rewrites\n // for interception routes so we need to check for that here.\n if (routesManifest?.rewrites?.beforeFiles?.length > 0) {\n const hasInterceptionRouteRewrite =\n routesManifest.rewrites.beforeFiles.some(isInterceptionRouteRewrite)\n\n if (hasInterceptionRouteRewrite) {\n throw new ExportError(\n `Intercepting routes are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n\n const actionIds = [\n ...Object.keys(serverActionsManifest.node),\n ...Object.keys(serverActionsManifest.edge),\n ]\n\n if (\n actionIds.some(\n (actionId) =>\n extractInfoFromServerReferenceId(actionId).type === 'server-action'\n )\n ) {\n throw new ExportError(\n `Server Actions are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n }\n\n // Start the rendering process\n const renderOpts: WorkerRenderOptsPartial = {\n previewProps: prerenderManifest?.preview,\n isBuildTimePrerendering: true,\n assetPrefix: nextConfig.assetPrefix.replace(/\\/$/, ''),\n distDir,\n basePath: nextConfig.basePath,\n cacheComponents: nextConfig.cacheComponents ?? false,\n trailingSlash: nextConfig.trailingSlash,\n locales: i18n?.locales,\n locale: i18n?.defaultLocale,\n defaultLocale: i18n?.defaultLocale,\n domainLocales: i18n?.domains,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n // Exported pages do not currently support dynamic HTML.\n supportsDynamicResponse: false,\n crossOrigin: nextConfig.crossOrigin,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n serverActions: nextConfig.experimental.serverActions,\n serverComponents: enabledDirectories.app,\n cacheLifeProfiles: nextConfig.cacheLife,\n nextFontManifest: require(\n join(distDir, 'server', `${NEXT_FONT_MANIFEST}.json`)\n ),\n images: nextConfig.images,\n htmlLimitedBots: nextConfig.htmlLimitedBots.source,\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\n dynamicOnHover: nextConfig.experimental.dynamicOnHover ?? false,\n optimisticRouting: nextConfig.experimental.optimisticRouting ?? false,\n inlineCss: nextConfig.experimental.inlineCss ?? false,\n prefetchInlining: nextConfig.experimental.prefetchInlining ?? false,\n authInterrupts: !!nextConfig.experimental.authInterrupts,\n maxPostponedStateSizeBytes: parseMaxPostponedStateSize(\n nextConfig.experimental.maxPostponedStateSize\n ),\n },\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n }\n\n // We need this for server rendering the Link component.\n ;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n }\n\n const exportPathMap = await span\n .traceChild('run-export-path-map')\n .traceAsyncFn(async () => {\n const exportMap = await nextConfig.exportPathMap(defaultPathMap, {\n dev: false,\n dir,\n outDir,\n distDir,\n buildId,\n })\n return exportMap\n })\n\n // During static export, remove export 404/500 of pages router\n // when only app router presents\n if (!options.buildExport && options.appDirOnly) {\n delete exportPathMap['/404']\n delete exportPathMap['/500']\n }\n\n // only add missing 404 page when `buildExport` is false\n if (!options.buildExport && !options.appDirOnly) {\n // only add missing /404 if not specified in `exportPathMap`\n if (!exportPathMap['/404']) {\n exportPathMap['/404'] = { page: '/_error' }\n }\n\n /**\n * exports 404.html for backwards compat\n * E.g. GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify\n */\n if (!exportPathMap['/404.html'] && exportPathMap['/404']) {\n // alias /404.html to /404 to be compatible with custom 404 / _error page\n exportPathMap['/404.html'] = exportPathMap['/404']\n }\n }\n\n const allExportPaths: ExportPathEntry[] = []\n const seenExportPaths = new Set<string>()\n const fallbackEnabledPages = new Set<string>()\n\n for (const [path, entry] of Object.entries(exportPathMap)) {\n // make sure to prevent duplicates\n const normalizedPath = denormalizePagePath(normalizePagePath(path))\n\n if (seenExportPaths.has(normalizedPath)) {\n continue\n }\n\n seenExportPaths.add(normalizedPath)\n\n if (!entry._isAppDir && isAPIRoute(entry.page)) {\n hasApiRoutes = true\n continue\n }\n\n allExportPaths.push({ ...entry, path: normalizedPath })\n\n if (prerenderManifest && !options.buildExport) {\n const prerenderInfo = prerenderManifest.dynamicRoutes[entry.page]\n\n if (prerenderInfo && prerenderInfo.fallback !== false) {\n fallbackEnabledPages.add(entry.page)\n }\n }\n }\n\n if (allExportPaths.length === 0) {\n if (!prerenderManifest) {\n return null\n }\n }\n\n if (fallbackEnabledPages.size > 0) {\n throw new ExportError(\n `Found pages with \\`fallback\\` enabled:\\n${[...fallbackEnabledPages].join(\n '\\n'\n )}\\n${SSG_FALLBACK_EXPORT_ERROR}\\n`\n )\n }\n\n let hasMiddleware = false\n\n if (!options.buildExport) {\n try {\n const middlewareManifest = require(\n join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST)\n ) as MiddlewareManifest\n\n const functionsConfigManifest = require(\n join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST)\n )\n\n hasMiddleware =\n Object.keys(middlewareManifest.middleware).length > 0 ||\n Boolean(functionsConfigManifest.functions?.['/_middleware'])\n } catch {}\n\n // Warn if the user defines a path for an API page\n if (hasApiRoutes || hasMiddleware) {\n if (nextConfig.output === 'export') {\n Log.warn(\n yellow(\n `Statically exporting a Next.js application via \\`next export\\` disables API routes and middleware.`\n ) +\n `\\n` +\n yellow(\n `This command is meant for static-only hosts, and is` +\n ' ' +\n bold(`not necessary to make your application static.`)\n ) +\n `\\n` +\n yellow(\n `Pages in your application without server-side data dependencies will be automatically statically exported by \\`next build\\`, including pages powered by \\`getStaticProps\\`.`\n ) +\n `\\n` +\n yellow(\n `Learn more: https://nextjs.org/docs/messages/api-routes-static-export`\n )\n )\n }\n }\n }\n\n const pagesDataDir = options.buildExport\n ? outDir\n : join(outDir, '_next/data', buildId)\n\n const publicDir = join(dir, CLIENT_PUBLIC_FILES_PATH)\n // Copy public directory\n if (!options.buildExport && existsSync(publicDir)) {\n if (!options.silent) {\n Log.info('Copying \"public\" directory')\n }\n await span.traceChild('copy-public-directory').traceAsyncFn(() =>\n recursiveCopy(publicDir, outDir, {\n filter(path) {\n // Exclude paths used by pages\n return !exportPathMap[path]\n },\n })\n )\n }\n\n const exportPagesInBatches = async (\n worker: StaticWorker,\n exportPaths: ExportPathEntry[],\n renderResumeDataCachesByPage?: Record<string, string>\n ): Promise<ExportPagesResult> => {\n // Batch filtered pages into smaller batches, and call the export worker on\n // each batch. We've set a default minimum of 25 pages per batch to ensure\n // that even setups with only a few static pages can leverage a shared\n // incremental cache, however this value can be configured.\n const minPageCountPerBatch =\n nextConfig.experimental.staticGenerationMinPagesPerWorker ?? 25\n\n // Calculate the number of workers needed to ensure each batch has at least\n // minPageCountPerBatch pages.\n const numWorkers = Math.min(\n options.numWorkers,\n Math.ceil(exportPaths.length / minPageCountPerBatch)\n )\n\n // Calculate the page count per batch based on the number of workers.\n const pageCountPerBatch = Math.ceil(exportPaths.length / numWorkers)\n\n const batches = Array.from({ length: numWorkers }, (_, i) =>\n exportPaths.slice(i * pageCountPerBatch, (i + 1) * pageCountPerBatch)\n )\n\n // Distribute remaining pages.\n const remainingPages = exportPaths.slice(numWorkers * pageCountPerBatch)\n remainingPages.forEach((page, index) => {\n batches[index % batches.length].push(page)\n })\n\n return (\n await Promise.all(\n batches.map(async (batch) =>\n worker.exportPages({\n buildId,\n deploymentId: nextConfig.deploymentId,\n clientAssetToken:\n nextConfig.experimental.immutableAssetToken ||\n nextConfig.deploymentId,\n exportPaths: batch,\n parentSpanId: span.getId(),\n pagesDataDir,\n renderOpts,\n options,\n dir,\n distDir,\n outDir,\n nextConfig,\n cacheHandler: nextConfig.cacheHandler,\n cacheMaxMemorySize: nextConfig.cacheMaxMemorySize,\n fetchCache: true,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n renderResumeDataCachesByPage,\n })\n )\n )\n ).flat()\n }\n\n let initialPhaseExportPaths: ExportPathEntry[] = []\n const finalPhaseExportPaths: ExportPathEntry[] = []\n\n if (renderOpts.cacheComponents) {\n for (const exportPath of allExportPaths) {\n if (exportPath._allowEmptyStaticShell) {\n finalPhaseExportPaths.push(exportPath)\n } else {\n initialPhaseExportPaths.push(exportPath)\n }\n }\n } else {\n initialPhaseExportPaths = allExportPaths\n }\n\n const totalExportPaths =\n initialPhaseExportPaths.length + finalPhaseExportPaths.length\n let worker: StaticWorker | null = null\n let results: ExportPagesResult = []\n\n if (totalExportPaths > 0) {\n const progress = createProgress(\n totalExportPaths,\n options.statusMessage ??\n `Exporting using ${options.numWorkers} worker${options.numWorkers > 1 ? 's' : ''}`\n )\n\n if (staticWorker) {\n // TODO: progress shouldn't rely on \"activity\" event sent from `exportPage`.\n staticWorker.setOnActivity(progress.run)\n staticWorker.setOnActivityAbort(progress.clear)\n worker = staticWorker\n } else {\n worker = createStaticWorker(nextConfig, {\n debuggerPortOffset: getNextBuildDebuggerPortOffset({\n kind: 'export-page',\n }),\n numberOfWorkers: options.numWorkers,\n progress,\n })\n }\n\n results = await exportPagesInBatches(worker, initialPhaseExportPaths)\n\n if (finalPhaseExportPaths.length > 0) {\n const renderResumeDataCachesByPage = buildRDCCacheByPage(\n results,\n finalPhaseExportPaths\n )\n\n const finalPhaseResults = await exportPagesInBatches(\n worker,\n finalPhaseExportPaths,\n renderResumeDataCachesByPage\n )\n\n results.push(...finalPhaseResults)\n }\n }\n\n const collector: ExportAppResult = {\n byPath: new Map(),\n byPage: new Map(),\n ssgNotFoundPaths: new Set(),\n turborepoAccessTraceResults: new Map(),\n }\n\n const failedExportAttemptsByPage: Map<string, boolean> = new Map()\n\n for (const { result, path, page, pageKey } of results) {\n if (!result) continue\n if ('error' in result) {\n failedExportAttemptsByPage.set(pageKey, true)\n continue\n }\n\n if (result.turborepoAccessTraceResult) {\n collector.turborepoAccessTraceResults?.set(\n path,\n TurborepoAccessTraceResult.fromSerialized(\n result.turborepoAccessTraceResult\n )\n )\n }\n\n if (options.buildExport) {\n // Update path info by path.\n const info = collector.byPath.get(path) ?? {}\n if (result.cacheControl) {\n info.cacheControl = result.cacheControl\n }\n if (typeof result.metadata !== 'undefined') {\n info.metadata = result.metadata\n }\n\n if (typeof result.hasEmptyStaticShell !== 'undefined') {\n info.hasEmptyStaticShell = result.hasEmptyStaticShell\n }\n\n if (typeof result.hasPostponed !== 'undefined') {\n info.hasPostponed = result.hasPostponed\n }\n\n if (typeof result.hasStaticRsc !== 'undefined') {\n info.hasStaticRsc = result.hasStaticRsc\n }\n\n if (typeof result.fetchMetrics !== 'undefined') {\n info.fetchMetrics = result.fetchMetrics\n }\n\n collector.byPath.set(path, info)\n\n // Update not found.\n if (result.ssgNotFound === true) {\n collector.ssgNotFoundPaths.add(path)\n }\n\n // Update durations.\n const durations = collector.byPage.get(page) ?? {\n durationsByPath: new Map<string, number>(),\n }\n durations.durationsByPath.set(path, result.duration)\n collector.byPage.set(page, durations)\n }\n }\n\n // Export mode provide static outputs that are not compatible with PPR mode.\n if (!options.buildExport && nextConfig.experimental.ppr) {\n // TODO: add message\n throw new Error('Invariant: PPR cannot be enabled in export mode')\n }\n\n // copy prerendered routes to outDir\n if (!options.buildExport && prerenderManifest) {\n await Promise.all(\n Object.keys(prerenderManifest.routes).map(async (unnormalizedRoute) => {\n // Special handling: map app /_not-found to 404.html (and 404/index.html when trailingSlash)\n if (unnormalizedRoute === '/_not-found') {\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const htmlSrc = `${orig}.html`\n\n // write 404.html at root\n const htmlDest404 = join(outDir, '404.html')\n await fs.mkdir(dirname(htmlDest404), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404)\n\n // When trailingSlash, also write 404/index.html\n if (subFolders) {\n const htmlDest404Index = join(outDir, '404', 'index.html')\n await fs.mkdir(dirname(htmlDest404Index), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404Index)\n }\n }\n // Skip 500.html in static export\n if (unnormalizedRoute === '/_global-error') {\n return\n }\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const isAppRouteHandler = appPageName && isAppRouteRoute(appPageName)\n\n // returning notFound: true from getStaticProps will not\n // output html/json files during the build\n if (prerenderManifest!.notFoundRoutes.includes(unnormalizedRoute)) {\n return\n }\n // TODO: This rewrites /index/foo to /index/index/foo. Investigate and\n // fix. I presume this was because normalizePagePath was designed for\n // some other use case and then reused here for static exports without\n // realizing the implications.\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n // strip leading / and then recurse number of nested dirs\n // to place from base folder\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const handlerSrc = `${orig}.body`\n const handlerDest = join(outDir, route)\n\n if (isAppRouteHandler && existsSync(handlerSrc)) {\n await fs.mkdir(dirname(handlerDest), { recursive: true })\n await fs.copyFile(handlerSrc, handlerDest)\n return\n }\n\n const htmlDest = join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.html`\n )\n const jsonDest = isAppPath\n ? join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.txt`\n )\n : join(pagesDataDir, `${route}.json`)\n\n await fs.mkdir(dirname(htmlDest), { recursive: true })\n await fs.mkdir(dirname(jsonDest), { recursive: true })\n\n const htmlSrc = `${orig}.html`\n const jsonSrc = `${orig}${isAppPath ? RSC_SUFFIX : '.json'}`\n\n await fs.copyFile(htmlSrc, htmlDest)\n await fs.copyFile(jsonSrc, jsonDest)\n\n const segmentsDir = `${orig}${RSC_SEGMENTS_DIR_SUFFIX}`\n\n if (isAppPath && existsSync(segmentsDir)) {\n // Output a data file for each of this page's segments\n //\n // These files are requested by the client router's internal\n // prefetcher, not the user directly. So we don't need to account for\n // things like trailing slash handling.\n //\n // To keep the protocol simple, we can use the non-normalized route\n // path instead of the normalized one (which, among other things,\n // rewrites `/` to `/index`).\n const segmentsDirDest = join(outDir, unnormalizedRoute)\n const segmentPaths = await collectSegmentPaths(segmentsDir)\n await Promise.all(\n segmentPaths.map(async (segmentFileSrc) => {\n const segmentPath =\n '/' + segmentFileSrc.slice(0, -RSC_SEGMENT_SUFFIX.length)\n const segmentFilename =\n convertSegmentPathToStaticExportFilename(segmentPath)\n const segmentFileDest = join(segmentsDirDest, segmentFilename)\n await fs.mkdir(dirname(segmentFileDest), { recursive: true })\n await fs.copyFile(\n join(segmentsDir, segmentFileSrc),\n segmentFileDest\n )\n })\n )\n }\n })\n )\n }\n\n if (failedExportAttemptsByPage.size > 0) {\n const failedPages = Array.from(failedExportAttemptsByPage.keys())\n throw new ExportError(\n `Export encountered errors on ${failedPages.length} ${failedPages.length === 1 ? 'path' : 'paths'}:\\n\\t${failedPages\n .sort()\n .join('\\n\\t')}`\n )\n }\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: true,\n }),\n 'utf8'\n )\n\n if (telemetry) {\n await telemetry.flush()\n }\n\n // Clean up activity listeners for progress.\n if (staticWorker) {\n staticWorker.setOnActivity(undefined)\n staticWorker.setOnActivityAbort(undefined)\n }\n\n if (!staticWorker && worker) {\n await worker.end()\n }\n\n return collector\n}\n\nasync function collectSegmentPaths(segmentsDirectory: string) {\n const results: Array<string> = []\n await collectSegmentPathsImpl(segmentsDirectory, segmentsDirectory, results)\n return results\n}\n\nasync function collectSegmentPathsImpl(\n segmentsDirectory: string,\n directory: string,\n results: Array<string>\n) {\n const segmentFiles = await fs.readdir(directory, {\n withFileTypes: true,\n })\n await Promise.all(\n segmentFiles.map(async (segmentFile) => {\n if (segmentFile.isDirectory()) {\n await collectSegmentPathsImpl(\n segmentsDirectory,\n join(directory, segmentFile.name),\n results\n )\n return\n }\n if (!segmentFile.name.endsWith(RSC_SEGMENT_SUFFIX)) {\n return\n }\n results.push(\n relative(segmentsDirectory, join(directory, segmentFile.name))\n )\n })\n )\n}\n\nexport default async function exportApp(\n dir: string,\n options: ExportAppOptions,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n const nextExportSpan = span.traceChild('next-export')\n\n return nextExportSpan.traceAsyncFn(async () => {\n return await exportAppImpl(dir, options, nextExportSpan, staticWorker)\n })\n}\n"],"names":["ExportError","exportApp","Error","code","buildRDCCacheByPage","results","finalPhaseExportPaths","renderResumeDataCachesByPage","seedCandidatesByPage","Map","page","path","result","renderResumeDataCache","candidates","get","push","set","undefined","getKnownParamsKey","normalizedPage","fallbackParamNames","params","getParams","entries","Object","filter","key","has","sort","a","b","JSON","stringify","exportPath","_fallbackRouteParams","isDynamicRoute","normalizeAppPath","pageKey","Set","map","param","paramName","targetKey","length","selected","candidate","candidateKey","exportAppImpl","dir","options","span","staticWorker","resolve","traceChild","traceFn","loadEnvConfig","Log","enabledDirectories","nextConfig","traceAsyncFn","loadConfig","PHASE_EXPORT","debugPrerender","distDir","join","telemetry","buildExport","Telemetry","record","eventCliSession","webpackVersion","cliCommand","isSrcDir","hasNowJson","findUp","cwd","isCustomServer","turboFlag","pagesDir","appDir","subFolders","trailingSlash","silent","info","buildIdFile","BUILD_ID_FILE","existsSync","customRoutes","config","hasNextSupport","warn","buildId","fs","readFile","pagesManifest","pages","require","SERVER_DIRECTORY","PAGES_MANIFEST","prerenderManifest","PRERENDER_MANIFEST","appRoutePathManifest","APP_PATH_ROUTES_MANIFEST","err","isError","excludedPrerenderRoutes","keys","defaultPathMap","hasApiRoutes","isAPIRoute","dynamicRoutes","add","mapAppRouteToPage","pageName","routePath","isAppPageRoute","routes","_isAppDir","outDir","outdir","rm","recursive","force","mkdir","writeFile","EXPORT_DETAIL","formatManifest","version","outDirectory","success","recursiveCopy","CLIENT_STATIC_FILES_PATH","exportPathMap","defaultMap","i18n","images","loader","unoptimized","isNextImageImported","EXPORT_MARKER","then","text","parse","catch","serverActionsManifest","app","SERVER_REFERENCE_MANIFEST","output","routesManifest","ROUTES_MANIFEST","rewrites","beforeFiles","hasInterceptionRouteRewrite","some","isInterceptionRouteRewrite","actionIds","node","edge","actionId","extractInfoFromServerReferenceId","type","renderOpts","previewProps","preview","isBuildTimePrerendering","assetPrefix","replace","basePath","cacheComponents","locales","locale","defaultLocale","domainLocales","domains","disableOptimizedLoading","experimental","supportsDynamicResponse","crossOrigin","optimizeCss","nextConfigOutput","nextScriptWorkers","largePageDataBytes","serverActions","serverComponents","cacheLifeProfiles","cacheLife","nextFontManifest","NEXT_FONT_MANIFEST","htmlLimitedBots","source","clientTraceMetadata","expireTime","staleTimes","clientParamParsingOrigins","dynamicOnHover","optimisticRouting","inlineCss","prefetchInlining","authInterrupts","maxPostponedStateSizeBytes","parseMaxPostponedStateSize","maxPostponedStateSize","reactMaxHeadersLength","globalThis","__NEXT_DATA__","nextExport","exportMap","dev","appDirOnly","allExportPaths","seenExportPaths","fallbackEnabledPages","entry","normalizedPath","denormalizePagePath","normalizePagePath","prerenderInfo","fallback","size","SSG_FALLBACK_EXPORT_ERROR","hasMiddleware","functionsConfigManifest","middlewareManifest","MIDDLEWARE_MANIFEST","FUNCTIONS_CONFIG_MANIFEST","middleware","Boolean","functions","yellow","bold","pagesDataDir","publicDir","CLIENT_PUBLIC_FILES_PATH","exportPagesInBatches","worker","exportPaths","minPageCountPerBatch","staticGenerationMinPagesPerWorker","numWorkers","Math","min","ceil","pageCountPerBatch","batches","Array","from","_","i","slice","remainingPages","forEach","index","Promise","all","batch","exportPages","deploymentId","clientAssetToken","immutableAssetToken","parentSpanId","getId","cacheHandler","cacheMaxMemorySize","fetchCache","fetchCacheKeyPrefix","flat","initialPhaseExportPaths","_allowEmptyStaticShell","totalExportPaths","progress","createProgress","statusMessage","setOnActivity","run","setOnActivityAbort","clear","createStaticWorker","debuggerPortOffset","getNextBuildDebuggerPortOffset","kind","numberOfWorkers","finalPhaseResults","collector","byPath","byPage","ssgNotFoundPaths","turborepoAccessTraceResults","failedExportAttemptsByPage","turborepoAccessTraceResult","TurborepoAccessTraceResult","fromSerialized","cacheControl","metadata","hasEmptyStaticShell","hasPostponed","hasStaticRsc","fetchMetrics","ssgNotFound","durations","durationsByPath","duration","ppr","unnormalizedRoute","srcRoute","appPageName","isAppPath","route","pagePath","getPagePath","distPagesDir","split","orig","htmlSrc","htmlDest404","dirname","copyFile","htmlDest404Index","isAppRouteHandler","isAppRouteRoute","notFoundRoutes","includes","handlerSrc","handlerDest","htmlDest","sep","jsonDest","jsonSrc","RSC_SUFFIX","segmentsDir","RSC_SEGMENTS_DIR_SUFFIX","segmentsDirDest","segmentPaths","collectSegmentPaths","segmentFileSrc","segmentPath","RSC_SEGMENT_SUFFIX","segmentFilename","convertSegmentPathToStaticExportFilename","segmentFileDest","failedPages","flush","end","segmentsDirectory","collectSegmentPathsImpl","directory","segmentFiles","readdir","withFileTypes","segmentFile","isDirectory","name","endsWith","relative","nextExportSpan"],"mappings":";;;;;;;;;;;;;;;IA4EaA,WAAW;eAAXA;;IAk+Bb,OAWC;eAX6BC;;;uBAniCvB;4BAGsB;+DACV;oBACwB;QAEpC;sBAE+C;6DACjC;2BAMd;+BACuB;4BAiBvB;+DACgB;8BAEoB;wBACX;wBACD;yBACL;mCACQ;qCACE;qBACN;4BACH;yBACC;iCAGI;gCACD;gEACX;gCACW;sCACY;0BACZ;4CAEY;qCAEM;sCACQ;wBACV;2BACrB;2BACK;0BACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1B,MAAMD,oBAAoBE;;QAA1B,qBACLC,OAAO;;AACT;AAEA;;;;CAIC,GACD,SAASC,oBACPC,OAA0B,EAC1BC,qBAAwC;IAExC,MAAMC,+BAAuD,CAAC;IAC9D,MAAMC,uBAAuB,IAAIC;IAKjC,KAAK,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAE,IAAIP,QAAS;QAC5C,IAAI,CAACO,QAAQ;YACX;QACF;QAEA,IAAI,2BAA2BA,UAA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IAAAA,cAAQ,EAACV,mBAAmBtR,IAAAA,UAAI,EAACwR,WAAWI,YAAYE,IAAI;IAEhE;AAEJ;AAEe,eAAe9V,UAC5BgD,GAAW,EACXC,OAAyB,EACzBC,IAAU,EACVC,YAA2B;IAE3B,MAAM8S,iBAAiB/S,KAAKG,UAAU,CAAC;IAEvC,OAAO4S,eAAetS,YAAY,CAAC;QACjC,OAAO,MAAMZ,cAAcC,KAAKC,SAASgT,gBAAgB9S;IAC3D;AACF","ignoreList":[0]}
import type { Rewrite } from './load-custom-routes';
import type { DeepReadonly } from '../shared/lib/deep-readonly';
export declare function generateInterceptionRoutesRewrites(appPaths: string[], basePath?: string): Rewrite[];
export declare function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>): boolean;

@@ -5,18 +5,6 @@ "use strict";

});
0 && (module.exports = {
generateInterceptionRoutesRewrites: null,
isInterceptionRouteRewrite: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
generateInterceptionRoutesRewrites: function() {
Object.defineProperty(exports, "generateInterceptionRoutesRewrites", {
enumerable: true,
get: function() {
return generateInterceptionRoutesRewrites;
},
isInterceptionRouteRewrite: function() {
return isInterceptionRouteRewrite;
}

@@ -64,8 +52,3 @@ });

}
function isInterceptionRouteRewrite(route) {
var _route_has_, _route_has;
// When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.
return ((_route_has = route.has) == null ? void 0 : (_route_has_ = _route_has[0]) == null ? void 0 : _route_has_.key) === _approuterheaders.NEXT_URL;
}
//# sourceMappingURL=generate-interception-routes-rewrites.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../src/lib/generate-interception-routes-rewrites.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../shared/lib/router/utils/interception-routes'\nimport type { Rewrite } from './load-custom-routes'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex'\n\nexport function generateInterceptionRoutesRewrites(\n appPaths: string[],\n basePath = ''\n): Rewrite[] {\n const rewrites: Rewrite[] = []\n\n for (const appPath of appPaths) {\n if (isInterceptionRouteAppPath(appPath)) {\n const { interceptingRoute, interceptedRoute } =\n extractInterceptionRouteInformation(appPath)\n\n const destination = getNamedRouteRegex(basePath + appPath, {\n prefixRouteKeys: true,\n })\n\n const header = getNamedRouteRegex(interceptingRoute, {\n prefixRouteKeys: true,\n reference: destination.reference,\n })\n\n const source = getNamedRouteRegex(basePath + interceptedRoute, {\n prefixRouteKeys: true,\n reference: header.reference,\n })\n\n const headerRegex = header.namedRegex\n // Strip ^ and $ anchors since matchHas() will add them automatically\n .replace(/^\\^/, '')\n .replace(/\\$$/, '')\n // Replace matching the `/` with matching any route segment.\n .replace(/^\\/\\(\\?:\\/\\)\\?$/, '/.*')\n // Replace the optional trailing with slash capture group with one that\n // will match any descendants.\n .replace(/\\(\\?:\\/\\)\\?$/, '(?:/.*)?')\n\n rewrites.push({\n source: source.pathToRegexpPattern,\n destination: destination.pathToRegexpPattern,\n has: [\n {\n type: 'header',\n key: NEXT_URL,\n value: headerRegex,\n },\n ],\n regex: source.namedRegex,\n })\n }\n }\n\n return rewrites\n}\n\nexport function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>) {\n // When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.\n return route.has?.[0]?.key === NEXT_URL\n}\n"],"names":["generateInterceptionRoutesRewrites","isInterceptionRouteRewrite","appPaths","basePath","rewrites","appPath","isInterceptionRouteAppPath","interceptingRoute","interceptedRoute","extractInterceptionRouteInformation","destination","getNamedRouteRegex","prefixRouteKeys","header","reference","source","headerRegex","namedRegex","replace","push","pathToRegexpPattern","has","type","key","NEXT_URL","value","regex","route"],"mappings":";;;;;;;;;;;;;;;IASgBA,kCAAkC;eAAlCA;;IAqDAC,0BAA0B;eAA1BA;;;kCA9DS;oCAIlB;4BAG4B;AAE5B,SAASD,mCACdE,QAAkB,EAClBC,WAAW,EAAE;IAEb,MAAMC,WAAsB,EAAE;IAE9B,KAAK,MAAMC,WAAWH,SAAU;QAC9B,IAAII,IAAAA,8CAA0B,EAACD,UAAU;YACvC,MAAM,EAAEE,iBAAiB,EAAEC,gBAAgB,EAAE,GAC3CC,IAAAA,uDAAmC,EAACJ;YAEtC,MAAMK,cAAcC,IAAAA,8BAAkB,EAACR,WAAWE,SAAS;gBACzDO,iBAAiB;YACnB;YAEA,MAAMC,SAASF,IAAAA,8BAAkB,EAACJ,mBAAmB;gBACnDK,iBAAiB;gBACjBE,WAAWJ,YAAYI,SAAS;YAClC;YAEA,MAAMC,SAASJ,IAAAA,8BAAkB,EAACR,WAAWK,kBAAkB;gBAC7DI,iBAAiB;gBACjBE,WAAWD,OAAOC,SAAS;YAC7B;YAEA,MAAME,cAAcH,OAAOI,UAAU,AACnC,qEAAqE;aACpEC,OAAO,CAAC,OAAO,IACfA,OAAO,CAAC,OAAO,GAChB,4DAA4D;aAC3DA,OAAO,CAAC,mBAAmB,MAC5B,uEAAuE;YACvE,8BAA8B;aAC7BA,OAAO,CAAC,gBAAgB;YAE3Bd,SAASe,IAAI,CAAC;gBACZJ,QAAQA,OAAOK,mBAAmB;gBAClCV,aAAaA,YAAYU,mBAAmB;gBAC5CC,KAAK;oBACH;wBACEC,MAAM;wBACNC,KAAKC,0BAAQ;wBACbC,OAAOT;oBACT;iBACD;gBACDU,OAAOX,OAAOE,UAAU;YAC1B;QACF;IACF;IAEA,OAAOb;AACT;AAEO,SAASH,2BAA2B0B,KAA4B;QAE9DA,aAAAA;IADP,0HAA0H;IAC1H,OAAOA,EAAAA,aAAAA,MAAMN,GAAG,sBAATM,cAAAA,UAAW,CAAC,EAAE,qBAAdA,YAAgBJ,GAAG,MAAKC,0BAAQ;AACzC","ignoreList":[0]}
{"version":3,"sources":["../../src/lib/generate-interception-routes-rewrites.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../shared/lib/router/utils/interception-routes'\nimport type { Rewrite } from './load-custom-routes'\nimport { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex'\n\nexport function generateInterceptionRoutesRewrites(\n appPaths: string[],\n basePath = ''\n): Rewrite[] {\n const rewrites: Rewrite[] = []\n\n for (const appPath of appPaths) {\n if (isInterceptionRouteAppPath(appPath)) {\n const { interceptingRoute, interceptedRoute } =\n extractInterceptionRouteInformation(appPath)\n\n const destination = getNamedRouteRegex(basePath + appPath, {\n prefixRouteKeys: true,\n })\n\n const header = getNamedRouteRegex(interceptingRoute, {\n prefixRouteKeys: true,\n reference: destination.reference,\n })\n\n const source = getNamedRouteRegex(basePath + interceptedRoute, {\n prefixRouteKeys: true,\n reference: header.reference,\n })\n\n const headerRegex = header.namedRegex\n // Strip ^ and $ anchors since matchHas() will add them automatically\n .replace(/^\\^/, '')\n .replace(/\\$$/, '')\n // Replace matching the `/` with matching any route segment.\n .replace(/^\\/\\(\\?:\\/\\)\\?$/, '/.*')\n // Replace the optional trailing with slash capture group with one that\n // will match any descendants.\n .replace(/\\(\\?:\\/\\)\\?$/, '(?:/.*)?')\n\n rewrites.push({\n source: source.pathToRegexpPattern,\n destination: destination.pathToRegexpPattern,\n has: [\n {\n type: 'header',\n key: NEXT_URL,\n value: headerRegex,\n },\n ],\n regex: source.namedRegex,\n })\n }\n }\n\n return rewrites\n}\n"],"names":["generateInterceptionRoutesRewrites","appPaths","basePath","rewrites","appPath","isInterceptionRouteAppPath","interceptingRoute","interceptedRoute","extractInterceptionRouteInformation","destination","getNamedRouteRegex","prefixRouteKeys","header","reference","source","headerRegex","namedRegex","replace","push","pathToRegexpPattern","has","type","key","NEXT_URL","value","regex"],"mappings":";;;;+BAQgBA;;;eAAAA;;;kCARS;oCAIlB;4BAE4B;AAE5B,SAASA,mCACdC,QAAkB,EAClBC,WAAW,EAAE;IAEb,MAAMC,WAAsB,EAAE;IAE9B,KAAK,MAAMC,WAAWH,SAAU;QAC9B,IAAII,IAAAA,8CAA0B,EAACD,UAAU;YACvC,MAAM,EAAEE,iBAAiB,EAAEC,gBAAgB,EAAE,GAC3CC,IAAAA,uDAAmC,EAACJ;YAEtC,MAAMK,cAAcC,IAAAA,8BAAkB,EAACR,WAAWE,SAAS;gBACzDO,iBAAiB;YACnB;YAEA,MAAMC,SAASF,IAAAA,8BAAkB,EAACJ,mBAAmB;gBACnDK,iBAAiB;gBACjBE,WAAWJ,YAAYI,SAAS;YAClC;YAEA,MAAMC,SAASJ,IAAAA,8BAAkB,EAACR,WAAWK,kBAAkB;gBAC7DI,iBAAiB;gBACjBE,WAAWD,OAAOC,SAAS;YAC7B;YAEA,MAAME,cAAcH,OAAOI,UAAU,AACnC,qEAAqE;aACpEC,OAAO,CAAC,OAAO,IACfA,OAAO,CAAC,OAAO,GAChB,4DAA4D;aAC3DA,OAAO,CAAC,mBAAmB,MAC5B,uEAAuE;YACvE,8BAA8B;aAC7BA,OAAO,CAAC,gBAAgB;YAE3Bd,SAASe,IAAI,CAAC;gBACZJ,QAAQA,OAAOK,mBAAmB;gBAClCV,aAAaA,YAAYU,mBAAmB;gBAC5CC,KAAK;oBACH;wBACEC,MAAM;wBACNC,KAAKC,0BAAQ;wBACbC,OAAOT;oBACT;iBACD;gBACDU,OAAOX,OAAOE,UAAU;YAC1B;QACF;IACF;IAEA,OAAOb;AACT","ignoreList":[0]}

@@ -75,3 +75,3 @@ "use strict";

const data = await res.json();
const versionData = data.versions["16.2.0-canary.72"];
const versionData = data.versions["16.2.0-canary.73"];
return {

@@ -104,3 +104,3 @@ os: versionData.os,

lockfileParsed.dependencies[pkg] = {
version: "16.2.0-canary.72",
version: "16.2.0-canary.73",
resolved: pkgData.tarball,

@@ -113,3 +113,3 @@ integrity: pkgData.integrity,

lockfileParsed.packages[pkg] = {
version: "16.2.0-canary.72",
version: "16.2.0-canary.73",
resolved: pkgData.tarball,

@@ -116,0 +116,0 @@ integrity: pkgData.integrity,

@@ -108,5 +108,5 @@ import type { NextConfig } from './config';

}, "strip", z.ZodTypeAny, {
algorithm?: "sha256" | "sha384" | "sha512" | undefined;
algorithm?: "sha256" | "sha512" | "sha384" | undefined;
}, {
algorithm?: "sha256" | "sha384" | "sha512" | undefined;
algorithm?: "sha256" | "sha512" | "sha384" | undefined;
}>>;

@@ -113,0 +113,0 @@ swcPlugins: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>], null>, "many">>;

@@ -265,3 +265,6 @@ "use strict";

clientParamParsingOrigins: ex.clientParamParsingOrigins,
adapterPath: ex.adapterPath,
// The full adapterPath might be non-deterministic across builds and doesn't actually matter
// at runtime, as it's only used to determine whether the adapter was used or not, not to
// execute it again. So replace it with a placeholder if it's set.
adapterPath: ex.adapterPath ? '<ommited but set>' : undefined,
allowedRevalidateHeaderKeys: ex.allowedRevalidateHeaderKeys,

@@ -268,0 +271,0 @@ fetchCacheKeyPrefix: ex.fetchCacheKeyPrefix,

@@ -88,3 +88,3 @@ "use strict";

}
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"16.2.0-canary.72"}`))}${versionSuffix}`);
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"16.2.0-canary.73"}`))}${versionSuffix}`);
if (appUrl) {

@@ -91,0 +91,0 @@ _log.bootstrap(`- Local: ${appUrl}`);

@@ -18,3 +18,3 @@ import type { NextServer, RequestHandler, UpgradeHandler } from '../next';

export declare function clearModuleContext(target: string): Promise<void> | undefined;
export declare function getServerField(dir: string, field: PropagateToWorkersField): Promise<string | number | import("../route-matcher-managers/route-matcher-manager").RouteMatcherManager | ((err: unknown) => void) | ((meta: import("../request-meta").RequestMeta) => import("../next-server").NodeRequestHandler) | (() => import("../next-server").NodeRequestHandler) | (() => Promise<void>) | ((req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, pathname: string, query?: import("../request-meta").NextParsedUrlQuery, parsedUrl?: import("../request-meta").NextUrlWithParsedQuery, internal?: boolean) => Promise<void>) | ((req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, pathname: string, query?: import("querystring").ParsedUrlQuery) => Promise<string | null>) | ((err: Error | null, req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, pathname: string, query?: import("../request-meta").NextParsedUrlQuery, setHeaders?: boolean) => Promise<void>) | ((err: Error | null, req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, pathname: string, query?: import("querystring").ParsedUrlQuery) => Promise<string | null>) | ((req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, parsedUrl?: import("../request-meta").NextUrlWithParsedQuery, setHeaders?: boolean) => Promise<void>) | (() => Promise<void>) | (() => Promise<void>) | ((req: import("../base-http/node").NodeNextRequest, res: import("../base-http/node").NodeNextResponse, parsedUrl?: import("../request-meta").NextUrlWithParsedQuery) => Promise<void>) | (({ urlPath, revalidateHeaders, opts, }: {
export declare function getServerField(dir: string, field: PropagateToWorkersField): Promise<string | number | import("../route-matcher-managers/route-matcher-manager").RouteMatcherManager | ((prefix?: string) => void) | (() => Promise<void>) | ((err: unknown) => void) | ((meta: import("../request-meta").RequestMeta) => import("../next-server").NodeRequestHandler) | (() => import("../next-server").NodeRequestHandler) | (() => Promise<void>) | ((req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, pathname: string, query?: import("../request-meta").NextParsedUrlQuery, parsedUrl?: import("../request-meta").NextUrlWithParsedQuery, internal?: boolean) => Promise<void>) | ((req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, pathname: string, query?: import("querystring").ParsedUrlQuery) => Promise<string | null>) | ((err: Error | null, req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, pathname: string, query?: import("../request-meta").NextParsedUrlQuery, setHeaders?: boolean) => Promise<void>) | ((err: Error | null, req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, pathname: string, query?: import("querystring").ParsedUrlQuery) => Promise<string | null>) | ((req: import("../base-http/node").NodeNextRequest | import("http").IncomingMessage, res: import("../base-http/node").NodeNextResponse | ServerResponse, parsedUrl?: import("../request-meta").NextUrlWithParsedQuery, setHeaders?: boolean) => Promise<void>) | (() => Promise<void>) | ((req: import("../base-http/node").NodeNextRequest, res: import("../base-http/node").NodeNextResponse, parsedUrl?: import("../request-meta").NextUrlWithParsedQuery) => Promise<void>) | (({ urlPath, revalidateHeaders, opts, }: {
urlPath: string;

@@ -27,3 +27,3 @@ revalidateHeaders: {

};
}) => Promise<void>) | ((prefix?: string) => void) | undefined>;
}) => Promise<void>) | undefined>;
export declare function propagateServerField(dir: string, field: PropagateToWorkersField, value: any): Promise<void>;

@@ -30,0 +30,0 @@ declare function initializeImpl(opts: {

@@ -181,3 +181,3 @@ // Start CPU profile if it wasn't already started.

let { port } = serverOptions;
process.title = `next-server (v${"16.2.0-canary.72"})`;
process.title = `next-server (v${"16.2.0-canary.73"})`;
let handlersReady = ()=>{};

@@ -184,0 +184,0 @@ let handlersError = ()=>{};

@@ -35,3 +35,3 @@ "use strict";

const _removetrailingslash = require("../../shared/lib/router/utils/remove-trailing-slash");
const _generateinterceptionroutesrewrites = require("../../lib/generate-interception-routes-rewrites");
const _isinterceptionrouterewrite = require("../../lib/is-interception-route-rewrite");
function _interop_require_default(obj) {

@@ -214,3 +214,3 @@ return obj && obj.__esModule ? obj : {

dynamicCssManifest,
interceptionRoutePatterns: routesManifest.rewrites.beforeFiles.filter(_generateinterceptionroutesrewrites.isInterceptionRouteRewrite).map((rewrite)=>new RegExp(rewrite.regex))
interceptionRoutePatterns: routesManifest.rewrites.beforeFiles.filter(_isinterceptionrouterewrite.isInterceptionRouteRewrite).map((rewrite)=>new RegExp(rewrite.regex))
};

@@ -217,0 +217,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../src/server/route-modules/route-module.ts"],"sourcesContent":["import '../../build/adapter/setup-node-env.external'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport type {\n InstrumentationOnRequestError,\n RequestErrorContext,\n} from '../instrumentation/types'\nimport type { ParsedUrlQuery } from 'node:querystring'\nimport type { UrlWithParsedQuery } from 'node:url'\nimport type {\n PrerenderManifest,\n RequiredServerFilesManifest,\n} from '../../build'\nimport type { DevRoutesManifest } from '../lib/router-utils/setup-dev-bundler'\nimport type { RouteDefinition } from '../route-definitions/route-definition'\nimport type { DeepReadonly } from '../../shared/lib/deep-readonly'\nimport {\n BUILD_ID_FILE,\n BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n NEXT_FONT_MANIFEST,\n PRERENDER_MANIFEST,\n REACT_LOADABLE_MANIFEST,\n ROUTES_MANIFEST,\n SERVER_FILES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n} from '../../shared/lib/constants'\nimport { parseReqUrl } from '../../lib/url'\nimport {\n normalizeLocalePath,\n type PathLocale,\n} from '../../shared/lib/i18n/normalize-locale-path'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\nimport { removePathPrefix } from '../../shared/lib/router/utils/remove-path-prefix'\nimport { getServerUtils } from '../server-utils'\nimport { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'\nimport { getHostname } from '../../shared/lib/get-hostname'\nimport { checkIsOnDemandRevalidate } from '../api-utils'\nimport type { PreviewData } from '../../types'\nimport type { BuildManifest } from '../get-page-files'\nimport type { ReactLoadableManifest } from '../load-components'\nimport type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin'\nimport { normalizeDataPath } from '../../shared/lib/page-path/normalize-data-path'\nimport { pathHasPrefix } from '../../shared/lib/router/utils/path-has-prefix'\nimport {\n addRequestMeta,\n getRequestMeta,\n type NextIncomingMessage,\n} from '../request-meta'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isStaticMetadataRoute } from '../../lib/metadata/is-metadata-route'\nimport { IncrementalCache } from '../lib/incremental-cache'\nimport { initializeCacheHandlers, setCacheHandler } from '../use-cache/handlers'\nimport { interopDefault } from '../app-render/interop-default'\nimport { RouteKind } from '../route-kind'\nimport type { BaseNextRequest } from '../base-http'\nimport type { I18NConfig, NextConfigRuntime } from '../config-shared'\nimport ResponseCache, { type ResponseGenerator } from '../response-cache'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport {\n RouterServerContextSymbol,\n routerServerGlobal,\n type RouterServerContext,\n} from '../lib/router-utils/router-server-context'\nimport { decodePathParams } from '../lib/router-utils/decode-path-params'\nimport { removeTrailingSlash } from '../../shared/lib/router/utils/remove-trailing-slash'\nimport { isInterceptionRouteRewrite } from '../../lib/generate-interception-routes-rewrites'\n\n/**\n * RouteModuleOptions is the options that are passed to the route module, other\n * route modules should extend this class to add specific options for their\n * route.\n */\nexport interface RouteModuleOptions<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n readonly definition: Readonly<D>\n readonly userland: Readonly<U>\n readonly distDir: string\n readonly relativeProjectDir: string\n}\n\n/**\n * RouteHandlerContext is the base context for a route handler.\n */\nexport interface RouteModuleHandleContext {\n /**\n * Any matched parameters for the request. This is only defined for dynamic\n * routes.\n */\n params: Record<string, string | string[] | undefined> | undefined\n}\n\nconst dynamicImportEsmDefault = (id: string) =>\n import(/* webpackIgnore: true */ /* turbopackIgnore: true */ id).then(\n (mod) => mod.default || mod\n )\n\n/**\n * RouteModule is the base class for all route modules. This class should be\n * extended by all route modules.\n */\nexport abstract class RouteModule<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n /**\n * The userland module. This is the module that is exported from the user's\n * code. This is marked as readonly to ensure that the module is not mutated\n * because the module (when compiled) only provides getters.\n */\n public readonly userland: Readonly<U>\n\n /**\n * The definition of the route.\n */\n public readonly definition: Readonly<D>\n\n /**\n * The shared modules that are exposed and required for the route module.\n */\n public static readonly sharedModules: any\n\n public isDev: boolean\n public distDir: string\n public relativeProjectDir: string\n public incrementCache?: IncrementalCache\n public responseCache?: ResponseCache\n\n constructor({\n userland,\n definition,\n distDir,\n relativeProjectDir,\n }: RouteModuleOptions<D, U>) {\n this.userland = userland\n this.definition = definition\n this.isDev = !!process.env.__NEXT_DEV_SERVER\n this.distDir = distDir\n this.relativeProjectDir = relativeProjectDir\n }\n\n public normalizeUrl(\n _req: IncomingMessage | BaseNextRequest,\n _parsedUrl: UrlWithParsedQuery\n ) {}\n\n public async instrumentationOnRequestError(\n req: IncomingMessage | BaseNextRequest,\n ...args: Parameters<InstrumentationOnRequestError>\n ) {\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgeInstrumentationModule } = await import('../web/globals')\n const instrumentation = await getEdgeInstrumentationModule()\n\n if (instrumentation) {\n await instrumentation.onRequestError?.(...args)\n }\n } else {\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const { instrumentationOnRequestError } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n\n return instrumentationOnRequestError(\n absoluteProjectDir,\n this.distDir,\n ...args\n )\n }\n }\n\n private loadManifests(\n srcPage: string,\n projectDir?: string\n ): {\n buildId: string\n buildManifest: BuildManifest\n fallbackBuildManifest: BuildManifest\n routesManifest: DeepReadonly<DevRoutesManifest>\n nextFontManifest: DeepReadonly<NextFontManifest>\n prerenderManifest: DeepReadonly<PrerenderManifest>\n serverFilesManifest: DeepReadonly<RequiredServerFilesManifest> | undefined\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n subresourceIntegrityManifest: any\n clientReferenceManifest: any\n serverActionsManifest: any\n dynamicCssManifest: any\n interceptionRoutePatterns: RegExp[]\n } {\n let result\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgePreviewProps } =\n require('../web/get-edge-preview-props') as typeof import('../web/get-edge-preview-props')\n\n const maybeJSONParse = (str?: string) =>\n str ? JSON.parse(str) : undefined\n\n result = {\n buildId: process.env.__NEXT_BUILD_ID || '',\n buildManifest: self.__BUILD_MANIFEST as any,\n fallbackBuildManifest: {} as any,\n reactLoadableManifest: maybeJSONParse(self.__REACT_LOADABLE_MANIFEST),\n nextFontManifest: maybeJSONParse(self.__NEXT_FONT_MANIFEST),\n prerenderManifest: {\n routes: {},\n dynamicRoutes: {},\n notFoundRoutes: [],\n version: 4,\n preview: getEdgePreviewProps(),\n } as const,\n routesManifest: {\n version: 4,\n caseSensitive: Boolean(process.env.__NEXT_CASE_SENSITIVE_ROUTES),\n basePath: process.env.__NEXT_BASE_PATH || '',\n rewrites: (process.env.__NEXT_REWRITES as any) || {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n redirects: [],\n headers: [],\n onMatchHeaders: [],\n i18n:\n (process.env.__NEXT_I18N_CONFIG as any as I18NConfig) || undefined,\n skipProxyUrlNormalize: Boolean(\n process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ),\n },\n serverFilesManifest: self.__SERVER_FILES_MANIFEST,\n clientReferenceManifest: self.__RSC_MANIFEST?.[srcPage],\n serverActionsManifest: maybeJSONParse(self.__RSC_SERVER_MANIFEST),\n subresourceIntegrityManifest: maybeJSONParse(\n self.__SUBRESOURCE_INTEGRITY_MANIFEST\n ),\n dynamicCssManifest: maybeJSONParse(self.__DYNAMIC_CSS_MANIFEST),\n interceptionRoutePatterns: (\n maybeJSONParse(self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST) ?? []\n ).map((rewrite: any) => new RegExp(rewrite.regex)),\n }\n } else {\n if (!projectDir) {\n throw new Error('Invariant: projectDir is required for node runtime')\n }\n const { loadManifestFromRelativePath } =\n require('../load-manifest.external') as typeof import('../load-manifest.external')\n const normalizedPagePath = normalizePagePath(srcPage)\n\n const router =\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ? 'pages'\n : 'app'\n\n const [\n routesManifest,\n prerenderManifest,\n buildManifest,\n fallbackBuildManifest,\n reactLoadableManifest,\n nextFontManifest,\n clientReferenceManifest,\n serverActionsManifest,\n subresourceIntegrityManifest,\n serverFilesManifest,\n buildId,\n dynamicCssManifest,\n ] = [\n loadManifestFromRelativePath<DevRoutesManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: ROUTES_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<PrerenderManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: PRERENDER_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<BuildManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_MANIFEST,\n shouldCache: !this.isDev,\n }),\n srcPage === '/_error'\n ? loadManifestFromRelativePath<BuildManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: `fallback-${BUILD_MANIFEST}`,\n shouldCache: !this.isDev,\n handleMissing: true,\n })\n : ({} as BuildManifest),\n loadManifestFromRelativePath<ReactLoadableManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: process.env.TURBOPACK\n ? `server/${router === 'app' ? 'app' : 'pages'}${normalizedPagePath}/${REACT_LOADABLE_MANIFEST}`\n : REACT_LOADABLE_MANIFEST,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<NextFontManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${NEXT_FONT_MANIFEST}.json`,\n shouldCache: !this.isDev,\n }),\n router === 'app' && !isStaticMetadataRoute(srcPage)\n ? loadManifestFromRelativePath({\n distDir: this.distDir,\n projectDir,\n useEval: true,\n handleMissing: true,\n manifest: `server/app${srcPage.replace(/%5F/g, '_') + '_' + CLIENT_REFERENCE_MANIFEST}.js`,\n shouldCache: !this.isDev,\n })\n : undefined,\n router === 'app'\n ? loadManifestFromRelativePath<any>({\n distDir: this.distDir,\n projectDir,\n manifest: `server/${SERVER_REFERENCE_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n })\n : {},\n loadManifestFromRelativePath<Record<string, string>>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n this.isDev\n ? undefined\n : loadManifestFromRelativePath<RequiredServerFilesManifest>({\n projectDir,\n distDir: this.distDir,\n shouldCache: true,\n manifest: `${SERVER_FILES_MANIFEST}.json`,\n }),\n this.isDev\n ? 'development'\n : loadManifestFromRelativePath<any>({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_ID_FILE,\n skipParse: true,\n shouldCache: true,\n }),\n loadManifestFromRelativePath<any>({\n projectDir,\n distDir: this.distDir,\n manifest: DYNAMIC_CSS_MANIFEST,\n shouldCache: !this.isDev,\n handleMissing: true,\n }),\n ]\n\n result = {\n buildId,\n buildManifest,\n fallbackBuildManifest,\n routesManifest,\n nextFontManifest,\n prerenderManifest,\n serverFilesManifest,\n reactLoadableManifest,\n clientReferenceManifest: (clientReferenceManifest as any)\n ?.__RSC_MANIFEST?.[srcPage.replace(/%5F/g, '_')],\n serverActionsManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n interceptionRoutePatterns: routesManifest.rewrites.beforeFiles\n .filter(isInterceptionRouteRewrite)\n .map((rewrite) => new RegExp(rewrite.regex)),\n }\n }\n\n return result\n }\n\n public async loadCustomCacheHandlers(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime\n ) {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { cacheMaxMemorySize, cacheHandlers } = nextConfig\n if (!cacheHandlers) return\n\n // If we've already initialized the cache handlers interface, don't do it\n // again.\n if (!initializeCacheHandlers(cacheMaxMemorySize)) return\n\n for (const [kind, handler] of Object.entries(cacheHandlers)) {\n if (!handler) continue\n\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n setCacheHandler(\n kind,\n interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(\n `${absoluteProjectDir}/${this.distDir}`,\n handler\n )\n )\n )\n )\n }\n }\n }\n\n public async getIncrementalCache(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime,\n prerenderManifest: DeepReadonly<PrerenderManifest>,\n isMinimalMode: boolean\n ): Promise<IncrementalCache> {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return (globalThis as any).__incrementalCache\n } else {\n let CacheHandler: any\n const { cacheHandler } = nextConfig\n\n if (cacheHandler) {\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n CacheHandler = interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(this.distDir, cacheHandler)\n )\n )\n }\n const { join } = require('node:path') as typeof import('node:path')\n const projectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n await this.loadCustomCacheHandlers(req, nextConfig)\n\n // incremental-cache is request specific\n // although can have shared caches in module scope\n // per-cache handler\n const incrementalCache = new IncrementalCache({\n fs: (\n require('../lib/node-fs-methods') as typeof import('../lib/node-fs-methods')\n ).nodeFs,\n dev: this.isDev,\n requestHeaders: req.headers,\n allowedRevalidateHeaderKeys:\n nextConfig.experimental.allowedRevalidateHeaderKeys,\n minimalMode: isMinimalMode,\n serverDistDir: `${projectDir}/${this.distDir}/server`,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n maxMemoryCacheSize: nextConfig.cacheMaxMemorySize,\n flushToDisk: !isMinimalMode && nextConfig.experimental.isrFlushToDisk,\n getPrerenderManifest: () => prerenderManifest,\n CurCacheHandler: CacheHandler,\n })\n\n // we need to expose this on globalThis as the app-render\n // workStore grabs the incrementalCache from there\n ;(globalThis as any).__incrementalCache = incrementalCache\n return incrementalCache\n }\n }\n\n public async onRequestError(\n req: IncomingMessage | BaseNextRequest,\n err: unknown,\n errorContext: RequestErrorContext,\n silenceLog: boolean,\n routerServerContext?: RouterServerContext[string]\n ) {\n if (!silenceLog) {\n if (routerServerContext?.logErrorWithOriginalStack) {\n routerServerContext.logErrorWithOriginalStack(err, 'app-dir')\n } else {\n console.error(err)\n }\n }\n await this.instrumentationOnRequestError(\n req,\n err,\n {\n path: req.url || '/',\n headers: req.headers,\n method: req.method || 'GET',\n },\n errorContext\n )\n }\n\n /** A more lightweight version of `prepare()` for only retrieving the config on edge */\n public getNextConfigEdge(req: NextIncomingMessage): {\n nextConfig: NextConfigRuntime\n deploymentId: string\n } {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n throw new Error(\n 'Invariant: getNextConfigEdge must only be called in edge runtime'\n )\n }\n\n let serverFilesManifest = self.__SERVER_FILES_MANIFEST as any as\n | RequiredServerFilesManifest\n | undefined\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return { nextConfig, deploymentId }\n }\n\n public async prepare(\n req: IncomingMessage | BaseNextRequest,\n res: ServerResponse | null,\n {\n srcPage,\n multiZoneDraftMode,\n }: {\n srcPage: string\n multiZoneDraftMode?: boolean\n }\n ): Promise<\n | {\n buildId: string\n deploymentId: string\n clientAssetToken: string\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n query: ParsedUrlQuery\n originalQuery: ParsedUrlQuery\n originalPathname: string\n params?: ParsedUrlQuery\n parsedUrl: UrlWithParsedQuery\n previewData: PreviewData\n pageIsDynamic: boolean\n isDraftMode: boolean\n resolvedPathname: string\n encodedResolvedPathname: string\n isNextDataRequest: boolean\n buildManifest: DeepReadonly<BuildManifest>\n fallbackBuildManifest: DeepReadonly<BuildManifest>\n nextFontManifest: DeepReadonly<NextFontManifest>\n serverFilesManifest:\n | DeepReadonly<RequiredServerFilesManifest>\n | undefined\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n routesManifest: DeepReadonly<DevRoutesManifest>\n prerenderManifest: DeepReadonly<PrerenderManifest>\n // we can't pull in the client reference type or it causes issues with\n // our pre-compiled types\n clientReferenceManifest?: any\n serverActionsManifest?: any\n dynamicCssManifest?: any\n subresourceIntegrityManifest?: DeepReadonly<Record<string, string>>\n isOnDemandRevalidate: boolean\n revalidateOnlyGenerated: boolean\n nextConfig: NextConfigRuntime\n routerServerContext?: RouterServerContext[string]\n interceptionRoutePatterns?: any\n }\n | undefined\n > {\n let absoluteProjectDir: string | undefined\n\n // edge runtime handles loading instrumentation at the edge adapter level\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { join, relative } =\n require('node:path') as typeof import('node:path')\n\n absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const absoluteDistDir = getRequestMeta(req, 'distDir')\n\n if (absoluteDistDir) {\n this.distDir = relative(absoluteProjectDir, absoluteDistDir)\n }\n const { ensureInstrumentationRegistered } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n // ensure instrumentation is registered and pass\n // onRequestError below\n ensureInstrumentationRegistered(absoluteProjectDir, this.distDir)\n }\n const manifests = this.loadManifests(srcPage, absoluteProjectDir)\n const { routesManifest, prerenderManifest, serverFilesManifest } = manifests\n\n const { basePath, i18n, rewrites } = routesManifest\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n // Injected in base-server.ts\n const protocol = req.headers['x-forwarded-proto']?.includes('https')\n ? 'https'\n : 'http'\n\n // When there are hostname and port we build an absolute URL\n if (!getRequestMeta(req, 'initURL')) {\n const initUrl = serverFilesManifest?.config.experimental.trustHostHeader\n ? `${protocol}://${req.headers.host || 'localhost'}${req.url}`\n : `${protocol}://${routerServerContext?.hostname || 'localhost'}${req.url}`\n\n addRequestMeta(req, 'initURL', initUrl)\n addRequestMeta(req, 'initProtocol', protocol)\n }\n\n if (basePath) {\n req.url = removePathPrefix(req.url || '/', basePath)\n }\n\n const parsedUrl = parseReqUrl(req.url || '/')\n addRequestMeta(req, 'initQuery', { ...parsedUrl?.query })\n // if we couldn't parse the URL we can't continue\n if (!parsedUrl) {\n return\n }\n let isNextDataRequest = false\n\n if (pathHasPrefix(parsedUrl.pathname || '/', '/_next/data')) {\n isNextDataRequest = true\n parsedUrl.pathname = normalizeDataPath(parsedUrl.pathname || '/')\n }\n this.normalizeUrl(req, parsedUrl)\n let originalPathname = parsedUrl.pathname || '/'\n const originalQuery = { ...parsedUrl.query }\n const pageIsDynamic = isDynamicRoute(srcPage)\n\n let localeResult: PathLocale | undefined\n let detectedLocale: string | undefined\n\n if (i18n) {\n localeResult = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n )\n\n if (localeResult.detectedLocale) {\n req.url = `${localeResult.pathname}${parsedUrl.search}`\n originalPathname = localeResult.pathname\n\n if (!detectedLocale) {\n detectedLocale = localeResult.detectedLocale\n }\n }\n }\n\n // Normalize the page path for route matching. The srcPage contains the\n // internal page path (e.g., /app/[slug]/page), but route matchers expect\n // the pathname format (e.g., /app/[slug]).\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n const serverUtils = getServerUtils({\n page: normalizedSrcPage,\n i18n,\n basePath,\n rewrites,\n pageIsDynamic,\n trailingSlash: process.env.__NEXT_TRAILING_SLASH as any as boolean,\n caseSensitive: Boolean(routesManifest.caseSensitive),\n })\n\n const domainLocale = detectDomainLocale(\n i18n?.domains,\n getHostname(parsedUrl, req.headers),\n detectedLocale\n )\n\n if (Boolean(domainLocale)) {\n addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale))\n }\n\n const defaultLocale =\n getRequestMeta(req, 'defaultLocale') ||\n domainLocale?.defaultLocale ||\n i18n?.defaultLocale\n\n // Ensure parsedUrl.pathname includes locale before processing\n // rewrites or they won't match correctly.\n if (defaultLocale && !detectedLocale) {\n parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname === '/' ? '' : parsedUrl.pathname}`\n }\n const locale =\n getRequestMeta(req, 'locale') || detectedLocale || defaultLocale\n\n // we apply rewrites against cloned URL so that we don't\n // modify the original with the rewrite destination\n const { rewriteParams, rewrittenParsedUrl } = serverUtils.handleRewrites(\n req,\n parsedUrl\n )\n const rewriteParamKeys = Object.keys(rewriteParams)\n Object.assign(parsedUrl.query, rewrittenParsedUrl.query)\n\n // after processing rewrites we want to remove locale\n // from parsedUrl pathname\n if (i18n) {\n parsedUrl.pathname = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n\n rewrittenParsedUrl.pathname = normalizeLocalePath(\n rewrittenParsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n }\n\n let params: Record<string, undefined | string | string[]> | undefined =\n getRequestMeta(req, 'params')\n\n // attempt parsing from pathname\n if (!params && serverUtils.dynamicRouteMatcher) {\n const paramsMatch = serverUtils.dynamicRouteMatcher(\n normalizeDataPath(\n rewrittenParsedUrl?.pathname || parsedUrl.pathname || '/'\n )\n )\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n paramsMatch || {},\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n\n // Local \"next start\" expects the routing parsed query values\n // to not be present in the URL although when deployed proxies\n // will add query values from resolving the routes to pass to function.\n\n // TODO: do we want to change expectations for \"next start\"\n // to include these query values in the URL which affects asPath\n // but would match deployed behavior, e.g. a rewrite from middleware\n // that adds a query param would be in asPath as query but locally\n // it won't be in the asPath but still available in the query object\n const query = getRequestMeta(req, 'query') || {\n ...parsedUrl.query,\n }\n\n const routeParamKeys = new Set<string>()\n const combinedParamKeys = []\n\n // We don't include rewriteParamKeys in the combinedParamKeys\n // for app router since the searchParams is populated from the\n // URL so we don't want to strip the rewrite params from the URL\n // so that searchParams can include them.\n if (\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ) {\n for (const key of [\n ...rewriteParamKeys,\n ...Object.keys(serverUtils.defaultRouteMatches || {}),\n ]) {\n // We only want to filter rewrite param keys from the URL\n // if they are matches from the URL e.g. the key/value matches\n // before and after applying the rewrites /:path for /hello and\n // { path: 'hello' } but not for { path: 'another' } and /hello\n // TODO: we should prefix rewrite param keys the same as we do\n // for dynamic routes so we can identify them properly\n const originalValue = Array.isArray(originalQuery[key])\n ? originalQuery[key].join('')\n : originalQuery[key]\n\n const queryValue = Array.isArray(query[key])\n ? query[key].join('')\n : query[key]\n\n if (!(key in originalQuery) || originalValue === queryValue) {\n combinedParamKeys.push(key)\n }\n }\n }\n\n serverUtils.normalizeCdnUrl(req, combinedParamKeys)\n serverUtils.normalizeQueryParams(query, routeParamKeys)\n serverUtils.filterInternalQuery(originalQuery, combinedParamKeys)\n\n if (pageIsDynamic) {\n const queryResult = serverUtils.normalizeDynamicRouteParams(query, true)\n\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n params || {},\n true\n )\n\n let paramsToInterpolate: ParsedUrlQuery\n\n if (\n // if both query and params are valid but one\n // provided more information and the query params\n // were nxtP prefixed rely on that one\n query &&\n params &&\n paramsResult.hasValidParams &&\n queryResult.hasValidParams &&\n routeParamKeys.size > 0 &&\n Object.keys(paramsResult.params).length <=\n Object.keys(queryResult.params).length\n ) {\n paramsToInterpolate = queryResult.params\n params = Object.assign(queryResult.params)\n } else {\n paramsToInterpolate =\n paramsResult.hasValidParams && params\n ? params\n : queryResult.hasValidParams\n ? query\n : {}\n }\n\n req.url = serverUtils.interpolateDynamicPath(\n req.url || '/',\n paramsToInterpolate\n )\n parsedUrl.pathname = serverUtils.interpolateDynamicPath(\n parsedUrl.pathname || '/',\n paramsToInterpolate\n )\n originalPathname = serverUtils.interpolateDynamicPath(\n originalPathname,\n paramsToInterpolate\n )\n\n // try pulling from query if valid\n if (!params) {\n if (queryResult.hasValidParams) {\n params = Object.assign({}, queryResult.params)\n\n // If we pulled from query remove it so it's\n // only in params\n for (const key in serverUtils.defaultRouteMatches) {\n delete query[key]\n }\n } else {\n // use final params from URL matching\n const paramsMatch = serverUtils.dynamicRouteMatcher?.(\n normalizeDataPath(\n localeResult?.pathname || parsedUrl.pathname || '/'\n )\n )\n // we don't normalize these as they are allowed to be\n // the literal slug matches here e.g. /blog/[slug]\n // actually being requested\n if (paramsMatch) {\n params = Object.assign({}, paramsMatch)\n }\n }\n }\n }\n\n // Remove any normalized params from the query if they\n // weren't present as non-prefixed query key e.g.\n // ?search=1&nxtPsearch=hello we don't delete search\n for (const key of routeParamKeys) {\n if (!(key in originalQuery)) {\n delete query[key]\n // handle the case where there's collision and we\n // normalized nxtPid=123 -> id=123 but user also\n // sends id=456 as separate key\n } else if (\n originalQuery[key] &&\n query[key] &&\n originalQuery[key] !== query[key]\n ) {\n query[key] = originalQuery[key]\n }\n }\n\n const { isOnDemandRevalidate, revalidateOnlyGenerated } =\n checkIsOnDemandRevalidate(req, prerenderManifest.preview)\n\n let isDraftMode = false\n let previewData: PreviewData\n\n // preview data relies on non-edge utils\n if (process.env.NEXT_RUNTIME !== 'edge' && res) {\n const { tryGetPreviewData } =\n require('../api-utils/node/try-get-preview-data') as typeof import('../api-utils/node/try-get-preview-data')\n\n previewData = tryGetPreviewData(\n req,\n res,\n prerenderManifest.preview,\n Boolean(multiZoneDraftMode)\n )\n isDraftMode = previewData !== false\n }\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { installProcessErrorHandlers } =\n require('../node-environment-extensions/process-error-handlers') as typeof import('../node-environment-extensions/process-error-handlers')\n\n installProcessErrorHandlers(\n Boolean(\n nextConfig.experimental.removeUncaughtErrorAndRejectionListeners\n )\n )\n }\n\n let resolvedPathname = normalizedSrcPage\n if (isDynamicRoute(resolvedPathname) && params) {\n resolvedPathname = serverUtils.interpolateDynamicPath(\n resolvedPathname,\n params\n )\n }\n\n if (resolvedPathname === '/index') {\n resolvedPathname = '/'\n }\n\n if (\n res &&\n Boolean(req.headers['x-nextjs-data']) &&\n (!res.statusCode || res.statusCode === 200)\n ) {\n res.setHeader(\n 'x-nextjs-matched-path',\n removeTrailingSlash(`${locale ? `/${locale}` : ''}${normalizedSrcPage}`)\n )\n }\n const encodedResolvedPathname = resolvedPathname\n\n // we decode for cache key/manifest usage encoded is\n // for URL building\n try {\n resolvedPathname = decodePathParams(resolvedPathname)\n } catch (_) {}\n\n resolvedPathname = removeTrailingSlash(resolvedPathname)\n addRequestMeta(req, 'resolvedPathname', resolvedPathname)\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return {\n query,\n originalQuery,\n originalPathname,\n params,\n parsedUrl,\n locale,\n isNextDataRequest,\n locales: i18n?.locales,\n defaultLocale,\n isDraftMode,\n previewData,\n pageIsDynamic,\n resolvedPathname,\n encodedResolvedPathname,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n ...manifests,\n // loadManifest returns a readonly object, but we don't want to propagate that throughout the\n // whole codebase (for now)\n nextConfig:\n nextConfig satisfies DeepReadonly<NextConfigRuntime> as NextConfigRuntime,\n routerServerContext,\n deploymentId,\n clientAssetToken:\n nextConfig.experimental.immutableAssetToken || deploymentId,\n }\n }\n\n public getResponseCache(req: IncomingMessage | BaseNextRequest) {\n if (!this.responseCache) {\n const minimalMode = getRequestMeta(req, 'minimalMode') ?? false\n this.responseCache = new ResponseCache(minimalMode)\n }\n return this.responseCache\n }\n\n public async handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind,\n isFallback,\n prerenderManifest,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil,\n isMinimalMode,\n }: {\n req: IncomingMessage | BaseNextRequest\n nextConfig: NextConfigRuntime\n cacheKey: string | null\n routeKind: RouteKind\n isFallback?: boolean\n prerenderManifest: DeepReadonly<PrerenderManifest>\n isRoutePPREnabled?: boolean\n isOnDemandRevalidate?: boolean\n revalidateOnlyGenerated?: boolean\n responseGenerator: ResponseGenerator\n waitUntil?: (prom: Promise<any>) => void\n isMinimalMode: boolean\n }) {\n const responseCache = this.getResponseCache(req)\n const cacheEntry = await responseCache.get(cacheKey, responseGenerator, {\n routeKind,\n isFallback,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n isPrefetch: req.headers.purpose === 'prefetch',\n // Use x-invocation-id header to scope the in-memory cache to a single\n // revalidation request in minimal mode.\n invocationID: req.headers['x-invocation-id'] as string | undefined,\n incrementalCache: await this.getIncrementalCache(\n req,\n nextConfig,\n prerenderManifest,\n isMinimalMode\n ),\n waitUntil,\n })\n\n if (!cacheEntry) {\n if (\n cacheKey &&\n // revalidate only generated can bail even if cacheKey is provided\n !(isOnDemandRevalidate && revalidateOnlyGenerated)\n ) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n }\n return cacheEntry\n }\n}\n"],"names":["RouteModule","dynamicImportEsmDefault","id","then","mod","default","constructor","userland","definition","distDir","relativeProjectDir","isDev","process","env","__NEXT_DEV_SERVER","normalizeUrl","_req","_parsedUrl","instrumentationOnRequestError","req","args","NEXT_RUNTIME","getEdgeInstrumentationModule","instrumentation","onRequestError","join","require","absoluteProjectDir","cwd","getRequestMeta","loadManifests","srcPage","projectDir","result","self","getEdgePreviewProps","maybeJSONParse","str","JSON","parse","undefined","buildId","__NEXT_BUILD_ID","buildManifest","__BUILD_MANIFEST","fallbackBuildManifest","reactLoadableManifest","__REACT_LOADABLE_MANIFEST","nextFontManifest","__NEXT_FONT_MANIFEST","prerenderManifest","routes","dynamicRoutes","notFoundRoutes","version","preview","routesManifest","caseSensitive","Boolean","__NEXT_CASE_SENSITIVE_ROUTES","basePath","__NEXT_BASE_PATH","rewrites","__NEXT_REWRITES","beforeFiles","afterFiles","fallback","redirects","headers","onMatchHeaders","i18n","__NEXT_I18N_CONFIG","skipProxyUrlNormalize","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","serverFilesManifest","__SERVER_FILES_MANIFEST","clientReferenceManifest","__RSC_MANIFEST","serverActionsManifest","__RSC_SERVER_MANIFEST","subresourceIntegrityManifest","__SUBRESOURCE_INTEGRITY_MANIFEST","dynamicCssManifest","__DYNAMIC_CSS_MANIFEST","interceptionRoutePatterns","__INTERCEPTION_ROUTE_REWRITE_MANIFEST","map","rewrite","RegExp","regex","Error","loadManifestFromRelativePath","normalizedPagePath","normalizePagePath","router","kind","RouteKind","PAGES","PAGES_API","manifest","ROUTES_MANIFEST","shouldCache","PRERENDER_MANIFEST","BUILD_MANIFEST","handleMissing","TURBOPACK","REACT_LOADABLE_MANIFEST","NEXT_FONT_MANIFEST","isStaticMetadataRoute","useEval","replace","CLIENT_REFERENCE_MANIFEST","SERVER_REFERENCE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","SERVER_FILES_MANIFEST","BUILD_ID_FILE","skipParse","DYNAMIC_CSS_MANIFEST","filter","isInterceptionRouteRewrite","loadCustomCacheHandlers","nextConfig","cacheMaxMemorySize","cacheHandlers","initializeCacheHandlers","handler","Object","entries","formatDynamicImportPath","setCacheHandler","interopDefault","getIncrementalCache","isMinimalMode","globalThis","__incrementalCache","CacheHandler","cacheHandler","incrementalCache","IncrementalCache","fs","nodeFs","dev","requestHeaders","allowedRevalidateHeaderKeys","experimental","minimalMode","serverDistDir","fetchCacheKeyPrefix","maxMemoryCacheSize","flushToDisk","isrFlushToDisk","getPrerenderManifest","CurCacheHandler","err","errorContext","silenceLog","routerServerContext","logErrorWithOriginalStack","console","error","path","url","method","getNextConfigEdge","routerServerGlobal","RouterServerContextSymbol","config","deploymentId","runtimeServerDeploymentId","NEXT_DEPLOYMENT_ID","prepare","res","multiZoneDraftMode","relative","absoluteDistDir","ensureInstrumentationRegistered","manifests","protocol","includes","initUrl","trustHostHeader","host","hostname","addRequestMeta","removePathPrefix","parsedUrl","parseReqUrl","query","isNextDataRequest","pathHasPrefix","pathname","normalizeDataPath","originalPathname","originalQuery","pageIsDynamic","isDynamicRoute","localeResult","detectedLocale","normalizeLocalePath","locales","search","normalizedSrcPage","normalizeAppPath","serverUtils","getServerUtils","page","trailingSlash","__NEXT_TRAILING_SLASH","domainLocale","detectDomainLocale","domains","getHostname","defaultLocale","locale","rewriteParams","rewrittenParsedUrl","handleRewrites","rewriteParamKeys","keys","assign","params","dynamicRouteMatcher","paramsMatch","paramsResult","normalizeDynamicRouteParams","hasValidParams","routeParamKeys","Set","combinedParamKeys","key","defaultRouteMatches","originalValue","Array","isArray","queryValue","push","normalizeCdnUrl","normalizeQueryParams","filterInternalQuery","queryResult","paramsToInterpolate","size","length","interpolateDynamicPath","isOnDemandRevalidate","revalidateOnlyGenerated","checkIsOnDemandRevalidate","isDraftMode","previewData","tryGetPreviewData","installProcessErrorHandlers","removeUncaughtErrorAndRejectionListeners","resolvedPathname","statusCode","setHeader","removeTrailingSlash","encodedResolvedPathname","decodePathParams","_","clientAssetToken","immutableAssetToken","getResponseCache","responseCache","ResponseCache","handleResponse","cacheKey","routeKind","isFallback","isRoutePPREnabled","responseGenerator","waitUntil","cacheEntry","get","isPrefetch","purpose","invocationID"],"mappings":";;;;+BAwGsBA;;;eAAAA;;;QAxGf;2BA2BA;qBACqB;qCAIrB;uBACwB;kCACE;6BACF;oCACI;6BACP;0BACc;mCAKR;+BACJ;6BAKvB;mCAC2B;iCACI;kCACL;0BACwB;gCAC1B;2BACL;sEAG4B;0BACrB;qCAK1B;kCAC0B;qCACG;oDACO;;;;;;AA4B3C,MAAMC,0BAA0B,CAACC,KAC/B,MAAM,CAAC,uBAAuB,GAAG,yBAAyB,GAAGA,IAAIC,IAAI,CACnE,CAACC,MAAQA,IAAIC,OAAO,IAAID;AAOrB,MAAeJ;IA2BpBM,YAAY,EACVC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,kBAAkB,EACO,CAAE;QAC3B,IAAI,CAACH,QAAQ,GAAGA;QAChB,IAAI,CAACC,UAAU,GAAGA;QAClB,IAAI,CAACG,KAAK,GAAG,CAAC,CAACC,QAAQC,GAAG,CAACC,iBAAiB;QAC5C,IAAI,CAACL,OAAO,GAAGA;QACf,IAAI,CAACC,kBAAkB,GAAGA;IAC5B;IAEOK,aACLC,IAAuC,EACvCC,UAA8B,EAC9B,CAAC;IAEH,MAA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B,YAAY9P,IAAIiD,OAAO,CAAC8M,OAAO,KAAK;YACpC,sEAAsE;YACtE,wCAAwC;YACxCC,cAAchQ,IAAIiD,OAAO,CAAC,kBAAkB;YAC5CqE,kBAAkB,MAAM,IAAI,CAACN,mBAAmB,CAC9ChH,KACAsG,YACAvE,mBACAkF;YAEF0I;QACF;QAEA,IAAI,CAACC,YAAY;YACf,IACEN,YACA,kEAAkE;YAClE,CAAErB,CAAAA,wBAAwBC,uBAAsB,GAChD;gBACA,gEAAgE;gBAChE,oEAAoE;gBACpE,kEAAkE;gBAClE,mEAAmE;gBACnE,yBAAyB;gBACzB,MAAM,qBAA8D,CAA9D,IAAI3J,MAAM,sDAAV,qBAAA;2BAAA;gCAAA;kCAAA;gBAA6D;YACrE;QACF;QACA,OAAOqL;IACT;AACF","ignoreList":[0]}
{"version":3,"sources":["../../../src/server/route-modules/route-module.ts"],"sourcesContent":["import '../../build/adapter/setup-node-env.external'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport type {\n InstrumentationOnRequestError,\n RequestErrorContext,\n} from '../instrumentation/types'\nimport type { ParsedUrlQuery } from 'node:querystring'\nimport type { UrlWithParsedQuery } from 'node:url'\nimport type {\n PrerenderManifest,\n RequiredServerFilesManifest,\n} from '../../build'\nimport type { DevRoutesManifest } from '../lib/router-utils/setup-dev-bundler'\nimport type { RouteDefinition } from '../route-definitions/route-definition'\nimport type { DeepReadonly } from '../../shared/lib/deep-readonly'\nimport {\n BUILD_ID_FILE,\n BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n NEXT_FONT_MANIFEST,\n PRERENDER_MANIFEST,\n REACT_LOADABLE_MANIFEST,\n ROUTES_MANIFEST,\n SERVER_FILES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n} from '../../shared/lib/constants'\nimport { parseReqUrl } from '../../lib/url'\nimport {\n normalizeLocalePath,\n type PathLocale,\n} from '../../shared/lib/i18n/normalize-locale-path'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\nimport { removePathPrefix } from '../../shared/lib/router/utils/remove-path-prefix'\nimport { getServerUtils } from '../server-utils'\nimport { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'\nimport { getHostname } from '../../shared/lib/get-hostname'\nimport { checkIsOnDemandRevalidate } from '../api-utils'\nimport type { PreviewData } from '../../types'\nimport type { BuildManifest } from '../get-page-files'\nimport type { ReactLoadableManifest } from '../load-components'\nimport type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin'\nimport { normalizeDataPath } from '../../shared/lib/page-path/normalize-data-path'\nimport { pathHasPrefix } from '../../shared/lib/router/utils/path-has-prefix'\nimport {\n addRequestMeta,\n getRequestMeta,\n type NextIncomingMessage,\n} from '../request-meta'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isStaticMetadataRoute } from '../../lib/metadata/is-metadata-route'\nimport { IncrementalCache } from '../lib/incremental-cache'\nimport { initializeCacheHandlers, setCacheHandler } from '../use-cache/handlers'\nimport { interopDefault } from '../app-render/interop-default'\nimport { RouteKind } from '../route-kind'\nimport type { BaseNextRequest } from '../base-http'\nimport type { I18NConfig, NextConfigRuntime } from '../config-shared'\nimport ResponseCache, { type ResponseGenerator } from '../response-cache'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport {\n RouterServerContextSymbol,\n routerServerGlobal,\n type RouterServerContext,\n} from '../lib/router-utils/router-server-context'\nimport { decodePathParams } from '../lib/router-utils/decode-path-params'\nimport { removeTrailingSlash } from '../../shared/lib/router/utils/remove-trailing-slash'\nimport { isInterceptionRouteRewrite } from '../../lib/is-interception-route-rewrite'\n\n/**\n * RouteModuleOptions is the options that are passed to the route module, other\n * route modules should extend this class to add specific options for their\n * route.\n */\nexport interface RouteModuleOptions<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n readonly definition: Readonly<D>\n readonly userland: Readonly<U>\n readonly distDir: string\n readonly relativeProjectDir: string\n}\n\n/**\n * RouteHandlerContext is the base context for a route handler.\n */\nexport interface RouteModuleHandleContext {\n /**\n * Any matched parameters for the request. This is only defined for dynamic\n * routes.\n */\n params: Record<string, string | string[] | undefined> | undefined\n}\n\nconst dynamicImportEsmDefault = (id: string) =>\n import(/* webpackIgnore: true */ /* turbopackIgnore: true */ id).then(\n (mod) => mod.default || mod\n )\n\n/**\n * RouteModule is the base class for all route modules. This class should be\n * extended by all route modules.\n */\nexport abstract class RouteModule<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n /**\n * The userland module. This is the module that is exported from the user's\n * code. This is marked as readonly to ensure that the module is not mutated\n * because the module (when compiled) only provides getters.\n */\n public readonly userland: Readonly<U>\n\n /**\n * The definition of the route.\n */\n public readonly definition: Readonly<D>\n\n /**\n * The shared modules that are exposed and required for the route module.\n */\n public static readonly sharedModules: any\n\n public isDev: boolean\n public distDir: string\n public relativeProjectDir: string\n public incrementCache?: IncrementalCache\n public responseCache?: ResponseCache\n\n constructor({\n userland,\n definition,\n distDir,\n relativeProjectDir,\n }: RouteModuleOptions<D, U>) {\n this.userland = userland\n this.definition = definition\n this.isDev = !!process.env.__NEXT_DEV_SERVER\n this.distDir = distDir\n this.relativeProjectDir = relativeProjectDir\n }\n\n public normalizeUrl(\n _req: IncomingMessage | BaseNextRequest,\n _parsedUrl: UrlWithParsedQuery\n ) {}\n\n public async instrumentationOnRequestError(\n req: IncomingMessage | BaseNextRequest,\n ...args: Parameters<InstrumentationOnRequestError>\n ) {\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgeInstrumentationModule } = await import('../web/globals')\n const instrumentation = await getEdgeInstrumentationModule()\n\n if (instrumentation) {\n await instrumentation.onRequestError?.(...args)\n }\n } else {\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const { instrumentationOnRequestError } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n\n return instrumentationOnRequestError(\n absoluteProjectDir,\n this.distDir,\n ...args\n )\n }\n }\n\n private loadManifests(\n srcPage: string,\n projectDir?: string\n ): {\n buildId: string\n buildManifest: BuildManifest\n fallbackBuildManifest: BuildManifest\n routesManifest: DeepReadonly<DevRoutesManifest>\n nextFontManifest: DeepReadonly<NextFontManifest>\n prerenderManifest: DeepReadonly<PrerenderManifest>\n serverFilesManifest: DeepReadonly<RequiredServerFilesManifest> | undefined\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n subresourceIntegrityManifest: any\n clientReferenceManifest: any\n serverActionsManifest: any\n dynamicCssManifest: any\n interceptionRoutePatterns: RegExp[]\n } {\n let result\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgePreviewProps } =\n require('../web/get-edge-preview-props') as typeof import('../web/get-edge-preview-props')\n\n const maybeJSONParse = (str?: string) =>\n str ? JSON.parse(str) : undefined\n\n result = {\n buildId: process.env.__NEXT_BUILD_ID || '',\n buildManifest: self.__BUILD_MANIFEST as any,\n fallbackBuildManifest: {} as any,\n reactLoadableManifest: maybeJSONParse(self.__REACT_LOADABLE_MANIFEST),\n nextFontManifest: maybeJSONParse(self.__NEXT_FONT_MANIFEST),\n prerenderManifest: {\n routes: {},\n dynamicRoutes: {},\n notFoundRoutes: [],\n version: 4,\n preview: getEdgePreviewProps(),\n } as const,\n routesManifest: {\n version: 4,\n caseSensitive: Boolean(process.env.__NEXT_CASE_SENSITIVE_ROUTES),\n basePath: process.env.__NEXT_BASE_PATH || '',\n rewrites: (process.env.__NEXT_REWRITES as any) || {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n redirects: [],\n headers: [],\n onMatchHeaders: [],\n i18n:\n (process.env.__NEXT_I18N_CONFIG as any as I18NConfig) || undefined,\n skipProxyUrlNormalize: Boolean(\n process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ),\n },\n serverFilesManifest: self.__SERVER_FILES_MANIFEST,\n clientReferenceManifest: self.__RSC_MANIFEST?.[srcPage],\n serverActionsManifest: maybeJSONParse(self.__RSC_SERVER_MANIFEST),\n subresourceIntegrityManifest: maybeJSONParse(\n self.__SUBRESOURCE_INTEGRITY_MANIFEST\n ),\n dynamicCssManifest: maybeJSONParse(self.__DYNAMIC_CSS_MANIFEST),\n interceptionRoutePatterns: (\n maybeJSONParse(self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST) ?? []\n ).map((rewrite: any) => new RegExp(rewrite.regex)),\n }\n } else {\n if (!projectDir) {\n throw new Error('Invariant: projectDir is required for node runtime')\n }\n const { loadManifestFromRelativePath } =\n require('../load-manifest.external') as typeof import('../load-manifest.external')\n const normalizedPagePath = normalizePagePath(srcPage)\n\n const router =\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ? 'pages'\n : 'app'\n\n const [\n routesManifest,\n prerenderManifest,\n buildManifest,\n fallbackBuildManifest,\n reactLoadableManifest,\n nextFontManifest,\n clientReferenceManifest,\n serverActionsManifest,\n subresourceIntegrityManifest,\n serverFilesManifest,\n buildId,\n dynamicCssManifest,\n ] = [\n loadManifestFromRelativePath<DevRoutesManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: ROUTES_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<PrerenderManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: PRERENDER_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<BuildManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_MANIFEST,\n shouldCache: !this.isDev,\n }),\n srcPage === '/_error'\n ? loadManifestFromRelativePath<BuildManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: `fallback-${BUILD_MANIFEST}`,\n shouldCache: !this.isDev,\n handleMissing: true,\n })\n : ({} as BuildManifest),\n loadManifestFromRelativePath<ReactLoadableManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: process.env.TURBOPACK\n ? `server/${router === 'app' ? 'app' : 'pages'}${normalizedPagePath}/${REACT_LOADABLE_MANIFEST}`\n : REACT_LOADABLE_MANIFEST,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath<NextFontManifest>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${NEXT_FONT_MANIFEST}.json`,\n shouldCache: !this.isDev,\n }),\n router === 'app' && !isStaticMetadataRoute(srcPage)\n ? loadManifestFromRelativePath({\n distDir: this.distDir,\n projectDir,\n useEval: true,\n handleMissing: true,\n manifest: `server/app${srcPage.replace(/%5F/g, '_') + '_' + CLIENT_REFERENCE_MANIFEST}.js`,\n shouldCache: !this.isDev,\n })\n : undefined,\n router === 'app'\n ? loadManifestFromRelativePath<any>({\n distDir: this.distDir,\n projectDir,\n manifest: `server/${SERVER_REFERENCE_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n })\n : {},\n loadManifestFromRelativePath<Record<string, string>>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n this.isDev\n ? undefined\n : loadManifestFromRelativePath<RequiredServerFilesManifest>({\n projectDir,\n distDir: this.distDir,\n shouldCache: true,\n manifest: `${SERVER_FILES_MANIFEST}.json`,\n }),\n this.isDev\n ? 'development'\n : loadManifestFromRelativePath<any>({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_ID_FILE,\n skipParse: true,\n shouldCache: true,\n }),\n loadManifestFromRelativePath<any>({\n projectDir,\n distDir: this.distDir,\n manifest: DYNAMIC_CSS_MANIFEST,\n shouldCache: !this.isDev,\n handleMissing: true,\n }),\n ]\n\n result = {\n buildId,\n buildManifest,\n fallbackBuildManifest,\n routesManifest,\n nextFontManifest,\n prerenderManifest,\n serverFilesManifest,\n reactLoadableManifest,\n clientReferenceManifest: (clientReferenceManifest as any)\n ?.__RSC_MANIFEST?.[srcPage.replace(/%5F/g, '_')],\n serverActionsManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n interceptionRoutePatterns: routesManifest.rewrites.beforeFiles\n .filter(isInterceptionRouteRewrite)\n .map((rewrite) => new RegExp(rewrite.regex)),\n }\n }\n\n return result\n }\n\n public async loadCustomCacheHandlers(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime\n ) {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { cacheMaxMemorySize, cacheHandlers } = nextConfig\n if (!cacheHandlers) return\n\n // If we've already initialized the cache handlers interface, don't do it\n // again.\n if (!initializeCacheHandlers(cacheMaxMemorySize)) return\n\n for (const [kind, handler] of Object.entries(cacheHandlers)) {\n if (!handler) continue\n\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n setCacheHandler(\n kind,\n interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(\n `${absoluteProjectDir}/${this.distDir}`,\n handler\n )\n )\n )\n )\n }\n }\n }\n\n public async getIncrementalCache(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime,\n prerenderManifest: DeepReadonly<PrerenderManifest>,\n isMinimalMode: boolean\n ): Promise<IncrementalCache> {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return (globalThis as any).__incrementalCache\n } else {\n let CacheHandler: any\n const { cacheHandler } = nextConfig\n\n if (cacheHandler) {\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n CacheHandler = interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(this.distDir, cacheHandler)\n )\n )\n }\n const { join } = require('node:path') as typeof import('node:path')\n const projectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n await this.loadCustomCacheHandlers(req, nextConfig)\n\n // incremental-cache is request specific\n // although can have shared caches in module scope\n // per-cache handler\n const incrementalCache = new IncrementalCache({\n fs: (\n require('../lib/node-fs-methods') as typeof import('../lib/node-fs-methods')\n ).nodeFs,\n dev: this.isDev,\n requestHeaders: req.headers,\n allowedRevalidateHeaderKeys:\n nextConfig.experimental.allowedRevalidateHeaderKeys,\n minimalMode: isMinimalMode,\n serverDistDir: `${projectDir}/${this.distDir}/server`,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n maxMemoryCacheSize: nextConfig.cacheMaxMemorySize,\n flushToDisk: !isMinimalMode && nextConfig.experimental.isrFlushToDisk,\n getPrerenderManifest: () => prerenderManifest,\n CurCacheHandler: CacheHandler,\n })\n\n // we need to expose this on globalThis as the app-render\n // workStore grabs the incrementalCache from there\n ;(globalThis as any).__incrementalCache = incrementalCache\n return incrementalCache\n }\n }\n\n public async onRequestError(\n req: IncomingMessage | BaseNextRequest,\n err: unknown,\n errorContext: RequestErrorContext,\n silenceLog: boolean,\n routerServerContext?: RouterServerContext[string]\n ) {\n if (!silenceLog) {\n if (routerServerContext?.logErrorWithOriginalStack) {\n routerServerContext.logErrorWithOriginalStack(err, 'app-dir')\n } else {\n console.error(err)\n }\n }\n await this.instrumentationOnRequestError(\n req,\n err,\n {\n path: req.url || '/',\n headers: req.headers,\n method: req.method || 'GET',\n },\n errorContext\n )\n }\n\n /** A more lightweight version of `prepare()` for only retrieving the config on edge */\n public getNextConfigEdge(req: NextIncomingMessage): {\n nextConfig: NextConfigRuntime\n deploymentId: string\n } {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n throw new Error(\n 'Invariant: getNextConfigEdge must only be called in edge runtime'\n )\n }\n\n let serverFilesManifest = self.__SERVER_FILES_MANIFEST as any as\n | RequiredServerFilesManifest\n | undefined\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return { nextConfig, deploymentId }\n }\n\n public async prepare(\n req: IncomingMessage | BaseNextRequest,\n res: ServerResponse | null,\n {\n srcPage,\n multiZoneDraftMode,\n }: {\n srcPage: string\n multiZoneDraftMode?: boolean\n }\n ): Promise<\n | {\n buildId: string\n deploymentId: string\n clientAssetToken: string\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n query: ParsedUrlQuery\n originalQuery: ParsedUrlQuery\n originalPathname: string\n params?: ParsedUrlQuery\n parsedUrl: UrlWithParsedQuery\n previewData: PreviewData\n pageIsDynamic: boolean\n isDraftMode: boolean\n resolvedPathname: string\n encodedResolvedPathname: string\n isNextDataRequest: boolean\n buildManifest: DeepReadonly<BuildManifest>\n fallbackBuildManifest: DeepReadonly<BuildManifest>\n nextFontManifest: DeepReadonly<NextFontManifest>\n serverFilesManifest:\n | DeepReadonly<RequiredServerFilesManifest>\n | undefined\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n routesManifest: DeepReadonly<DevRoutesManifest>\n prerenderManifest: DeepReadonly<PrerenderManifest>\n // we can't pull in the client reference type or it causes issues with\n // our pre-compiled types\n clientReferenceManifest?: any\n serverActionsManifest?: any\n dynamicCssManifest?: any\n subresourceIntegrityManifest?: DeepReadonly<Record<string, string>>\n isOnDemandRevalidate: boolean\n revalidateOnlyGenerated: boolean\n nextConfig: NextConfigRuntime\n routerServerContext?: RouterServerContext[string]\n interceptionRoutePatterns?: any\n }\n | undefined\n > {\n let absoluteProjectDir: string | undefined\n\n // edge runtime handles loading instrumentation at the edge adapter level\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { join, relative } =\n require('node:path') as typeof import('node:path')\n\n absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const absoluteDistDir = getRequestMeta(req, 'distDir')\n\n if (absoluteDistDir) {\n this.distDir = relative(absoluteProjectDir, absoluteDistDir)\n }\n const { ensureInstrumentationRegistered } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n // ensure instrumentation is registered and pass\n // onRequestError below\n ensureInstrumentationRegistered(absoluteProjectDir, this.distDir)\n }\n const manifests = this.loadManifests(srcPage, absoluteProjectDir)\n const { routesManifest, prerenderManifest, serverFilesManifest } = manifests\n\n const { basePath, i18n, rewrites } = routesManifest\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n // Injected in base-server.ts\n const protocol = req.headers['x-forwarded-proto']?.includes('https')\n ? 'https'\n : 'http'\n\n // When there are hostname and port we build an absolute URL\n if (!getRequestMeta(req, 'initURL')) {\n const initUrl = serverFilesManifest?.config.experimental.trustHostHeader\n ? `${protocol}://${req.headers.host || 'localhost'}${req.url}`\n : `${protocol}://${routerServerContext?.hostname || 'localhost'}${req.url}`\n\n addRequestMeta(req, 'initURL', initUrl)\n addRequestMeta(req, 'initProtocol', protocol)\n }\n\n if (basePath) {\n req.url = removePathPrefix(req.url || '/', basePath)\n }\n\n const parsedUrl = parseReqUrl(req.url || '/')\n addRequestMeta(req, 'initQuery', { ...parsedUrl?.query })\n // if we couldn't parse the URL we can't continue\n if (!parsedUrl) {\n return\n }\n let isNextDataRequest = false\n\n if (pathHasPrefix(parsedUrl.pathname || '/', '/_next/data')) {\n isNextDataRequest = true\n parsedUrl.pathname = normalizeDataPath(parsedUrl.pathname || '/')\n }\n this.normalizeUrl(req, parsedUrl)\n let originalPathname = parsedUrl.pathname || '/'\n const originalQuery = { ...parsedUrl.query }\n const pageIsDynamic = isDynamicRoute(srcPage)\n\n let localeResult: PathLocale | undefined\n let detectedLocale: string | undefined\n\n if (i18n) {\n localeResult = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n )\n\n if (localeResult.detectedLocale) {\n req.url = `${localeResult.pathname}${parsedUrl.search}`\n originalPathname = localeResult.pathname\n\n if (!detectedLocale) {\n detectedLocale = localeResult.detectedLocale\n }\n }\n }\n\n // Normalize the page path for route matching. The srcPage contains the\n // internal page path (e.g., /app/[slug]/page), but route matchers expect\n // the pathname format (e.g., /app/[slug]).\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n const serverUtils = getServerUtils({\n page: normalizedSrcPage,\n i18n,\n basePath,\n rewrites,\n pageIsDynamic,\n trailingSlash: process.env.__NEXT_TRAILING_SLASH as any as boolean,\n caseSensitive: Boolean(routesManifest.caseSensitive),\n })\n\n const domainLocale = detectDomainLocale(\n i18n?.domains,\n getHostname(parsedUrl, req.headers),\n detectedLocale\n )\n\n if (Boolean(domainLocale)) {\n addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale))\n }\n\n const defaultLocale =\n getRequestMeta(req, 'defaultLocale') ||\n domainLocale?.defaultLocale ||\n i18n?.defaultLocale\n\n // Ensure parsedUrl.pathname includes locale before processing\n // rewrites or they won't match correctly.\n if (defaultLocale && !detectedLocale) {\n parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname === '/' ? '' : parsedUrl.pathname}`\n }\n const locale =\n getRequestMeta(req, 'locale') || detectedLocale || defaultLocale\n\n // we apply rewrites against cloned URL so that we don't\n // modify the original with the rewrite destination\n const { rewriteParams, rewrittenParsedUrl } = serverUtils.handleRewrites(\n req,\n parsedUrl\n )\n const rewriteParamKeys = Object.keys(rewriteParams)\n Object.assign(parsedUrl.query, rewrittenParsedUrl.query)\n\n // after processing rewrites we want to remove locale\n // from parsedUrl pathname\n if (i18n) {\n parsedUrl.pathname = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n\n rewrittenParsedUrl.pathname = normalizeLocalePath(\n rewrittenParsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n }\n\n let params: Record<string, undefined | string | string[]> | undefined =\n getRequestMeta(req, 'params')\n\n // attempt parsing from pathname\n if (!params && serverUtils.dynamicRouteMatcher) {\n const paramsMatch = serverUtils.dynamicRouteMatcher(\n normalizeDataPath(\n rewrittenParsedUrl?.pathname || parsedUrl.pathname || '/'\n )\n )\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n paramsMatch || {},\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n\n // Local \"next start\" expects the routing parsed query values\n // to not be present in the URL although when deployed proxies\n // will add query values from resolving the routes to pass to function.\n\n // TODO: do we want to change expectations for \"next start\"\n // to include these query values in the URL which affects asPath\n // but would match deployed behavior, e.g. a rewrite from middleware\n // that adds a query param would be in asPath as query but locally\n // it won't be in the asPath but still available in the query object\n const query = getRequestMeta(req, 'query') || {\n ...parsedUrl.query,\n }\n\n const routeParamKeys = new Set<string>()\n const combinedParamKeys = []\n\n // We don't include rewriteParamKeys in the combinedParamKeys\n // for app router since the searchParams is populated from the\n // URL so we don't want to strip the rewrite params from the URL\n // so that searchParams can include them.\n if (\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ) {\n for (const key of [\n ...rewriteParamKeys,\n ...Object.keys(serverUtils.defaultRouteMatches || {}),\n ]) {\n // We only want to filter rewrite param keys from the URL\n // if they are matches from the URL e.g. the key/value matches\n // before and after applying the rewrites /:path for /hello and\n // { path: 'hello' } but not for { path: 'another' } and /hello\n // TODO: we should prefix rewrite param keys the same as we do\n // for dynamic routes so we can identify them properly\n const originalValue = Array.isArray(originalQuery[key])\n ? originalQuery[key].join('')\n : originalQuery[key]\n\n const queryValue = Array.isArray(query[key])\n ? query[key].join('')\n : query[key]\n\n if (!(key in originalQuery) || originalValue === queryValue) {\n combinedParamKeys.push(key)\n }\n }\n }\n\n serverUtils.normalizeCdnUrl(req, combinedParamKeys)\n serverUtils.normalizeQueryParams(query, routeParamKeys)\n serverUtils.filterInternalQuery(originalQuery, combinedParamKeys)\n\n if (pageIsDynamic) {\n const queryResult = serverUtils.normalizeDynamicRouteParams(query, true)\n\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n params || {},\n true\n )\n\n let paramsToInterpolate: ParsedUrlQuery\n\n if (\n // if both query and params are valid but one\n // provided more information and the query params\n // were nxtP prefixed rely on that one\n query &&\n params &&\n paramsResult.hasValidParams &&\n queryResult.hasValidParams &&\n routeParamKeys.size > 0 &&\n Object.keys(paramsResult.params).length <=\n Object.keys(queryResult.params).length\n ) {\n paramsToInterpolate = queryResult.params\n params = Object.assign(queryResult.params)\n } else {\n paramsToInterpolate =\n paramsResult.hasValidParams && params\n ? params\n : queryResult.hasValidParams\n ? query\n : {}\n }\n\n req.url = serverUtils.interpolateDynamicPath(\n req.url || '/',\n paramsToInterpolate\n )\n parsedUrl.pathname = serverUtils.interpolateDynamicPath(\n parsedUrl.pathname || '/',\n paramsToInterpolate\n )\n originalPathname = serverUtils.interpolateDynamicPath(\n originalPathname,\n paramsToInterpolate\n )\n\n // try pulling from query if valid\n if (!params) {\n if (queryResult.hasValidParams) {\n params = Object.assign({}, queryResult.params)\n\n // If we pulled from query remove it so it's\n // only in params\n for (const key in serverUtils.defaultRouteMatches) {\n delete query[key]\n }\n } else {\n // use final params from URL matching\n const paramsMatch = serverUtils.dynamicRouteMatcher?.(\n normalizeDataPath(\n localeResult?.pathname || parsedUrl.pathname || '/'\n )\n )\n // we don't normalize these as they are allowed to be\n // the literal slug matches here e.g. /blog/[slug]\n // actually being requested\n if (paramsMatch) {\n params = Object.assign({}, paramsMatch)\n }\n }\n }\n }\n\n // Remove any normalized params from the query if they\n // weren't present as non-prefixed query key e.g.\n // ?search=1&nxtPsearch=hello we don't delete search\n for (const key of routeParamKeys) {\n if (!(key in originalQuery)) {\n delete query[key]\n // handle the case where there's collision and we\n // normalized nxtPid=123 -> id=123 but user also\n // sends id=456 as separate key\n } else if (\n originalQuery[key] &&\n query[key] &&\n originalQuery[key] !== query[key]\n ) {\n query[key] = originalQuery[key]\n }\n }\n\n const { isOnDemandRevalidate, revalidateOnlyGenerated } =\n checkIsOnDemandRevalidate(req, prerenderManifest.preview)\n\n let isDraftMode = false\n let previewData: PreviewData\n\n // preview data relies on non-edge utils\n if (process.env.NEXT_RUNTIME !== 'edge' && res) {\n const { tryGetPreviewData } =\n require('../api-utils/node/try-get-preview-data') as typeof import('../api-utils/node/try-get-preview-data')\n\n previewData = tryGetPreviewData(\n req,\n res,\n prerenderManifest.preview,\n Boolean(multiZoneDraftMode)\n )\n isDraftMode = previewData !== false\n }\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { installProcessErrorHandlers } =\n require('../node-environment-extensions/process-error-handlers') as typeof import('../node-environment-extensions/process-error-handlers')\n\n installProcessErrorHandlers(\n Boolean(\n nextConfig.experimental.removeUncaughtErrorAndRejectionListeners\n )\n )\n }\n\n let resolvedPathname = normalizedSrcPage\n if (isDynamicRoute(resolvedPathname) && params) {\n resolvedPathname = serverUtils.interpolateDynamicPath(\n resolvedPathname,\n params\n )\n }\n\n if (resolvedPathname === '/index') {\n resolvedPathname = '/'\n }\n\n if (\n res &&\n Boolean(req.headers['x-nextjs-data']) &&\n (!res.statusCode || res.statusCode === 200)\n ) {\n res.setHeader(\n 'x-nextjs-matched-path',\n removeTrailingSlash(`${locale ? `/${locale}` : ''}${normalizedSrcPage}`)\n )\n }\n const encodedResolvedPathname = resolvedPathname\n\n // we decode for cache key/manifest usage encoded is\n // for URL building\n try {\n resolvedPathname = decodePathParams(resolvedPathname)\n } catch (_) {}\n\n resolvedPathname = removeTrailingSlash(resolvedPathname)\n addRequestMeta(req, 'resolvedPathname', resolvedPathname)\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return {\n query,\n originalQuery,\n originalPathname,\n params,\n parsedUrl,\n locale,\n isNextDataRequest,\n locales: i18n?.locales,\n defaultLocale,\n isDraftMode,\n previewData,\n pageIsDynamic,\n resolvedPathname,\n encodedResolvedPathname,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n ...manifests,\n // loadManifest returns a readonly object, but we don't want to propagate that throughout the\n // whole codebase (for now)\n nextConfig:\n nextConfig satisfies DeepReadonly<NextConfigRuntime> as NextConfigRuntime,\n routerServerContext,\n deploymentId,\n clientAssetToken:\n nextConfig.experimental.immutableAssetToken || deploymentId,\n }\n }\n\n public getResponseCache(req: IncomingMessage | BaseNextRequest) {\n if (!this.responseCache) {\n const minimalMode = getRequestMeta(req, 'minimalMode') ?? false\n this.responseCache = new ResponseCache(minimalMode)\n }\n return this.responseCache\n }\n\n public async handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind,\n isFallback,\n prerenderManifest,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil,\n isMinimalMode,\n }: {\n req: IncomingMessage | BaseNextRequest\n nextConfig: NextConfigRuntime\n cacheKey: string | null\n routeKind: RouteKind\n isFallback?: boolean\n prerenderManifest: DeepReadonly<PrerenderManifest>\n isRoutePPREnabled?: boolean\n isOnDemandRevalidate?: boolean\n revalidateOnlyGenerated?: boolean\n responseGenerator: ResponseGenerator\n waitUntil?: (prom: Promise<any>) => void\n isMinimalMode: boolean\n }) {\n const responseCache = this.getResponseCache(req)\n const cacheEntry = await responseCache.get(cacheKey, responseGenerator, {\n routeKind,\n isFallback,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n isPrefetch: req.headers.purpose === 'prefetch',\n // Use x-invocation-id header to scope the in-memory cache to a single\n // revalidation request in minimal mode.\n invocationID: req.headers['x-invocation-id'] as string | undefined,\n incrementalCache: await this.getIncrementalCache(\n req,\n nextConfig,\n prerenderManifest,\n isMinimalMode\n ),\n waitUntil,\n })\n\n if (!cacheEntry) {\n if (\n cacheKey &&\n // revalidate only generated can bail even if cacheKey is provided\n !(isOnDemandRevalidate && revalidateOnlyGenerated)\n ) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n }\n return cacheEntry\n }\n}\n"],"names":["RouteModule","dynamicImportEsmDefault","id","then","mod","default","constructor","userland","definition","distDir","relativeProjectDir","isDev","process","env","__NEXT_DEV_SERVER","normalizeUrl","_req","_parsedUrl","instrumentationOnRequestError","req","args","NEXT_RUNTIME","getEdgeInstrumentationModule","instrumentation","onRequestError","join","require","absoluteProjectDir","cwd","getRequestMeta","loadManifests","srcPage","projectDir","result","self","getEdgePreviewProps","maybeJSONParse","str","JSON","parse","undefined","buildId","__NEXT_BUILD_ID","buildManifest","__BUILD_MANIFEST","fallbackBuildManifest","reactLoadableManifest","__REACT_LOADABLE_MANIFEST","nextFontManifest","__NEXT_FONT_MANIFEST","prerenderManifest","routes","dynamicRoutes","notFoundRoutes","version","preview","routesManifest","caseSensitive","Boolean","__NEXT_CASE_SENSITIVE_ROUTES","basePath","__NEXT_BASE_PATH","rewrites","__NEXT_REWRITES","beforeFiles","afterFiles","fallback","redirects","headers","onMatchHeaders","i18n","__NEXT_I18N_CONFIG","skipProxyUrlNormalize","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","serverFilesManifest","__SERVER_FILES_MANIFEST","clientReferenceManifest","__RSC_MANIFEST","serverActionsManifest","__RSC_SERVER_MANIFEST","subresourceIntegrityManifest","__SUBRESOURCE_INTEGRITY_MANIFEST","dynamicCssManifest","__DYNAMIC_CSS_MANIFEST","interceptionRoutePatterns","__INTERCEPTION_ROUTE_REWRITE_MANIFEST","map","rewrite","RegExp","regex","Error","loadManifestFromRelativePath","normalizedPagePath","normalizePagePath","router","kind","RouteKind","PAGES","PAGES_API","manifest","ROUTES_MANIFEST","shouldCache","PRERENDER_MANIFEST","BUILD_MANIFEST","handleMissing","TURBOPACK","REACT_LOADABLE_MANIFEST","NEXT_FONT_MANIFEST","isStaticMetadataRoute","useEval","replace","CLIENT_REFERENCE_MANIFEST","SERVER_REFERENCE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","SERVER_FILES_MANIFEST","BUILD_ID_FILE","skipParse","DYNAMIC_CSS_MANIFEST","filter","isInterceptionRouteRewrite","loadCustomCacheHandlers","nextConfig","cacheMaxMemorySize","cacheHandlers","initializeCacheHandlers","handler","Object","entries","formatDynamicImportPath","setCacheHandler","interopDefault","getIncrementalCache","isMinimalMode","globalThis","__incrementalCache","CacheHandler","cacheHandler","incrementalCache","IncrementalCache","fs","nodeFs","dev","requestHeaders","allowedRevalidateHeaderKeys","experimental","minimalMode","serverDistDir","fetchCacheKeyPrefix","maxMemoryCacheSize","flushToDisk","isrFlushToDisk","getPrerenderManifest","CurCacheHandler","err","errorContext","silenceLog","routerServerContext","logErrorWithOriginalStack","console","error","path","url","method","getNextConfigEdge","routerServerGlobal","RouterServerContextSymbol","config","deploymentId","runtimeServerDeploymentId","NEXT_DEPLOYMENT_ID","prepare","res","multiZoneDraftMode","relative","absoluteDistDir","ensureInstrumentationRegistered","manifests","protocol","includes","initUrl","trustHostHeader","host","hostname","addRequestMeta","removePathPrefix","parsedUrl","parseReqUrl","query","isNextDataRequest","pathHasPrefix","pathname","normalizeDataPath","originalPathname","originalQuery","pageIsDynamic","isDynamicRoute","localeResult","detectedLocale","normalizeLocalePath","locales","search","normalizedSrcPage","normalizeAppPath","serverUtils","getServerUtils","page","trailingSlash","__NEXT_TRAILING_SLASH","domainLocale","detectDomainLocale","domains","getHostname","defaultLocale","locale","rewriteParams","rewrittenParsedUrl","handleRewrites","rewriteParamKeys","keys","assign","params","dynamicRouteMatcher","paramsMatch","paramsResult","normalizeDynamicRouteParams","hasValidParams","routeParamKeys","Set","combinedParamKeys","key","defaultRouteMatches","originalValue","Array","isArray","queryValue","push","normalizeCdnUrl","normalizeQueryParams","filterInternalQuery","queryResult","paramsToInterpolate","size","length","interpolateDynamicPath","isOnDemandRevalidate","revalidateOnlyGenerated","checkIsOnDemandRevalidate","isDraftMode","previewData","tryGetPreviewData","installProcessErrorHandlers","removeUncaughtErrorAndRejectionListeners","resolvedPathname","statusCode","setHeader","removeTrailingSlash","encodedResolvedPathname","decodePathParams","_","clientAssetToken","immutableAssetToken","getResponseCache","responseCache","ResponseCache","handleResponse","cacheKey","routeKind","isFallback","isRoutePPREnabled","responseGenerator","waitUntil","cacheEntry","get","isPrefetch","purpose","invocationID"],"mappings":";;;;+BAwGsBA;;;eAAAA;;;QAxGf;2BA2BA;qBACqB;qCAIrB;uBACwB;kCACE;6BACF;oCACI;6BACP;0BACc;mCAKR;+BACJ;6BAKvB;mCAC2B;iCACI;kCACL;0BACwB;gCAC1B;2BACL;sEAG4B;0BACrB;qCAK1B;kCAC0B;qCACG;4CACO;;;;;;AA4B3C,MAAMC,0BAA0B,CAACC,KAC/B,MAAM,CAAC,uBAAuB,GAAG,yBAAyB,GAAGA,IAAIC,IAAI,CACnE,CAACC,MAAQA,IAAIC,OAAO,IAAID;AAOrB,MAAeJ;IA2BpBM,YAAY,EACVC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,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,SAAS,EACTC,UAAU,EACVzN,iBAAiB,EACjB0N,iBAAiB,EACjBxB,oBAAoB,EACpBC,uBAAuB,EACvBwB,iBAAiB,EACjBC,SAAS,EACT1I,aAAa,EAcd,EAAE;QACD,MAAMkI,gBAAgB,IAAI,CAACD,gBAAgB,CAAClP;QAC5C,MAAM4P,aAAa,MAAMT,cAAcU,GAAG,CAACP,UAAUI,mBAAmB;YACtEH;YACAC;YACAC;YACAxB;YACA6B,YAAY9P,IAAIiD,OAAO,CAAC8M,OAAO,KAAK;YACpC,sEAAsE;YACtE,wCAAwC;YACxCC,cAAchQ,IAAIiD,OAAO,CAAC,kBAAkB;YAC5CqE,kBAAkB,MAAM,IAAI,CAACN,mBAAmB,CAC9ChH,KACAsG,YACAvE,mBACAkF;YAEF0I;QACF;QAEA,IAAI,CAACC,YAAY;YACf,IACEN,YACA,kEAAkE;YAClE,CAAErB,CAAAA,wBAAwBC,uBAAsB,GAChD;gBACA,gEAAgE;gBAChE,oEAAoE;gBACpE,kEAAkE;gBAClE,mEAAmE;gBACnE,yBAAyB;gBACzB,MAAM,qBAA8D,CAA9D,IAAI3J,MAAM,sDAAV,qBAAA;2BAAA;gCAAA;kCAAA;gBAA6D;YACrE;QACF;QACA,OAAOqL;IACT;AACF","ignoreList":[0]}

@@ -24,3 +24,3 @@ "use strict";

function isStableBuild() {
return !"16.2.0-canary.72"?.includes('canary') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
return !"16.2.0-canary.73"?.includes('canary') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
}

@@ -27,0 +27,0 @@ class CanaryOnlyConfigError extends Error {

@@ -17,3 +17,2 @@ "use strict";

const _writeatomic = require("../../../lib/fs/write-atomic");
const _generateinterceptionroutesrewrites = require("../../../lib/generate-interception-routes-rewrites");
const _getassetpathfromroute = /*#__PURE__*/ _interop_require_default._(require("../router/utils/get-asset-path-from-route"));

@@ -320,3 +319,3 @@ const _entrykey = require("./entry-key");

};
const interceptionRewrites = JSON.stringify(rewrites.beforeFiles.filter(_generateinterceptionroutesrewrites.isInterceptionRouteRewrite));
const interceptionRewrites = JSON.stringify(rewrites.beforeFiles.filter(require('../../../lib/is-interception-route-rewrite').isInterceptionRouteRewrite));
if (this.cachedInterceptionRewrites === interceptionRewrites) {

@@ -323,0 +322,0 @@ return;

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../src/shared/lib/turbopack/manifest-loader.ts"],"sourcesContent":["import type {\n EdgeFunctionDefinition,\n MiddlewareManifest,\n} from '../../../build/webpack/plugins/middleware-plugin'\nimport type {\n StatsAsset,\n StatsChunk,\n StatsChunkGroup,\n StatsModule,\n StatsCompilation as WebpackStats,\n} from 'webpack'\nimport type { BuildManifest } from '../../../server/get-page-files'\nimport type { PagesManifest } from '../../../build/webpack/plugins/pages-manifest-plugin'\nimport type { ActionManifest } from '../../../build/webpack/plugins/flight-client-entry-plugin'\nimport type { NextFontManifest } from '../../../build/webpack/plugins/next-font-manifest-plugin'\nimport type { REACT_LOADABLE_MANIFEST } from '../constants'\nimport {\n APP_PATHS_MANIFEST,\n BUILD_MANIFEST,\n CLIENT_STATIC_FILES_PATH,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n MIDDLEWARE_BUILD_MANIFEST,\n MIDDLEWARE_MANIFEST,\n NEXT_FONT_MANIFEST,\n PAGES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST,\n WEBPACK_STATS,\n} from '../constants'\nimport { join, posix } from 'path'\nimport { readFileSync } from 'fs'\nimport type { SetupOpts } from '../../../server/lib/router-utils/setup-dev-bundler'\nimport { deleteCache } from '../../../server/dev/require-cache'\nimport { writeFileAtomic } from '../../../lib/fs/write-atomic'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport getAssetPathFromRoute from '../router/utils/get-asset-path-from-route'\nimport { getEntryKey, type EntryKey } from './entry-key'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { getSortedRoutes } from '../router/utils'\nimport { existsSync } from 'fs'\nimport {\n addMetadataIdToRoute,\n addRouteSuffix,\n removeRouteSuffix,\n} from '../../../server/dev/turbopack-utils'\nimport { tryToParsePath } from '../../../lib/try-to-parse-path'\nimport { safePathToRegexp } from '../router/utils/route-match-utils'\nimport type { Entrypoints } from '../../../build/swc/types'\nimport {\n normalizeRewritesForBuildManifest,\n type ClientBuildManifest,\n srcEmptySsgManifest,\n processRoute,\n createEdgeRuntimeManifest,\n} from '../../../build/webpack/plugins/build-manifest-plugin-utils'\nimport type { SubresourceIntegrityManifest } from '../../../build'\n\ninterface InstrumentationDefinition {\n files: string[]\n name: 'instrumentation'\n}\n\ntype TurbopackMiddlewareManifest = MiddlewareManifest & {\n instrumentation?: InstrumentationDefinition\n}\n\ntype ManifestName =\n | typeof MIDDLEWARE_MANIFEST\n | typeof BUILD_MANIFEST\n | typeof PAGES_MANIFEST\n | typeof WEBPACK_STATS\n | typeof APP_PATHS_MANIFEST\n | `${typeof SERVER_REFERENCE_MANIFEST}.json`\n | `${typeof SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n | `${typeof NEXT_FONT_MANIFEST}.json`\n | typeof REACT_LOADABLE_MANIFEST\n | typeof TURBOPACK_CLIENT_BUILD_MANIFEST\n\nconst getManifestPath = (\n page: string,\n distDir: string,\n name: ManifestName,\n type: string,\n firstCall: boolean\n) => {\n let manifestPath = posix.join(\n distDir,\n `server`,\n type,\n type === 'middleware' || type === 'instrumentation'\n ? ''\n : type === 'app'\n ? page\n : getAssetPathFromRoute(page),\n name\n )\n\n if (firstCall) {\n const isSitemapRoute = /[\\\\/]sitemap(.xml)?\\/route$/.test(page)\n // Check the ambiguity of /sitemap and /sitemap.xml\n if (isSitemapRoute && !existsSync(manifestPath)) {\n manifestPath = getManifestPath(\n page.replace(/\\/sitemap\\/route$/, '/sitemap.xml/route'),\n distDir,\n name,\n type,\n false\n )\n }\n // existsSync is faster than using the async version\n if (!existsSync(manifestPath) && page.endsWith('/route')) {\n // TODO: Improve implementation of metadata routes, currently it requires this extra check for the variants of the files that can be written.\n let basePage = removeRouteSuffix(page)\n // For sitemap.xml routes with generateSitemaps, the manifest is at\n // /sitemap/[__metadata_id__]/route (without .xml), because the route\n // handler serves at /sitemap/[id] not /sitemap.xml/[id]\n if (basePage.endsWith('/sitemap.xml')) {\n basePage = basePage.slice(0, -'.xml'.length)\n }\n let metadataPage = addRouteSuffix(addMetadataIdToRoute(basePage))\n manifestPath = getManifestPath(metadataPage, distDir, name, type, false)\n }\n }\n\n return manifestPath\n}\n\nfunction readPartialManifestContent(\n distDir: string,\n name: ManifestName,\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation' = 'pages'\n): string {\n const page = pageName\n const manifestPath = getManifestPath(page, distDir, name, type, true)\n return readFileSync(posix.join(manifestPath), 'utf-8')\n}\n\n/// Helper class that stores a map of manifests and tracks if they have changed\n/// since the last time they were written to disk. This is used to avoid\n/// unnecessary writes to disk.\nclass ManifestsMap<K, V> {\n private rawMap = new Map<K, string>()\n private map = new Map<K, V>()\n private extraInvalidationKey: string | undefined = undefined\n private changed = true\n\n set(key: K, value: string) {\n if (this.rawMap.get(key) === value) return\n this.changed = true\n this.rawMap.set(key, value)\n this.map.set(key, JSON.parse(value))\n }\n\n delete(key: K) {\n if (this.map.has(key)) {\n this.changed = true\n this.rawMap.delete(key)\n this.map.delete(key)\n }\n }\n\n get(key: K) {\n return this.map.get(key)\n }\n\n takeChanged(extraInvalidationKey?: any) {\n let changed = this.changed\n if (extraInvalidationKey !== undefined) {\n const stringified = JSON.stringify(extraInvalidationKey)\n if (this.extraInvalidationKey !== stringified) {\n this.extraInvalidationKey = stringified\n changed = true\n }\n }\n this.changed = false\n return changed\n }\n\n values() {\n return this.map.values()\n }\n}\n\nexport class TurbopackManifestLoader {\n private actionManifests: ManifestsMap<EntryKey, ActionManifest> =\n new ManifestsMap()\n private appPathsManifests: ManifestsMap<EntryKey, PagesManifest> =\n new ManifestsMap()\n private buildManifests: ManifestsMap<EntryKey, BuildManifest> =\n new ManifestsMap()\n private clientBuildManifests: ManifestsMap<EntryKey, ClientBuildManifest> =\n new ManifestsMap()\n private fontManifests: ManifestsMap<EntryKey, NextFontManifest> =\n new ManifestsMap()\n private middlewareManifests: ManifestsMap<\n EntryKey,\n TurbopackMiddlewareManifest\n > = new ManifestsMap()\n private pagesManifests: ManifestsMap<string, PagesManifest> =\n new ManifestsMap()\n private webpackStats: ManifestsMap<EntryKey, WebpackStats> =\n new ManifestsMap()\n private sriManifests: ManifestsMap<EntryKey, SubresourceIntegrityManifest> =\n new ManifestsMap()\n private encryptionKey: string\n /// interceptionRewrites that have been written to disk\n /// This is used to avoid unnecessary writes if the rewrites haven't changed\n private cachedInterceptionRewrites: string | undefined = undefined\n\n private readonly distDir: string\n private readonly buildId: string\n private readonly dev: boolean\n private readonly sriEnabled: boolean\n\n constructor({\n distDir,\n buildId,\n encryptionKey,\n dev,\n sriEnabled,\n }: {\n buildId: string\n distDir: string\n encryptionKey: string\n dev: boolean\n sriEnabled: boolean\n }) {\n this.distDir = distDir\n this.buildId = buildId\n this.encryptionKey = encryptionKey\n this.dev = dev\n this.sriEnabled = sriEnabled\n }\n\n delete(key: EntryKey) {\n this.actionManifests.delete(key)\n this.appPathsManifests.delete(key)\n this.buildManifests.delete(key)\n this.clientBuildManifests.delete(key)\n this.fontManifests.delete(key)\n this.middlewareManifests.delete(key)\n this.pagesManifests.delete(key)\n this.webpackStats.delete(key)\n }\n\n loadActionManifest(pageName: string): void {\n this.actionManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SERVER_REFERENCE_MANIFEST}.json`,\n pageName,\n 'app'\n )\n )\n }\n\n private mergeActionManifests(manifests: Iterable<ActionManifest>) {\n type ActionEntries = ActionManifest['edge' | 'node']\n const manifest: ActionManifest = {\n node: {},\n edge: {},\n encryptionKey: this.encryptionKey,\n }\n\n function mergeActionIds(\n actionEntries: ActionEntries,\n other: ActionEntries\n ): void {\n for (const key in other) {\n const action = (actionEntries[key] ??= {\n workers: {},\n layer: {},\n })\n action.filename = other[key].filename\n action.exportedName = other[key].exportedName\n Object.assign(action.workers, other[key].workers)\n Object.assign(action.layer, other[key].layer)\n }\n }\n\n for (const m of manifests) {\n mergeActionIds(manifest.node, m.node)\n mergeActionIds(manifest.edge, m.edge)\n }\n for (const key in manifest.node) {\n const entry = manifest.node[key]\n entry.workers = sortObjectByKey(entry.workers)\n entry.layer = sortObjectByKey(entry.layer)\n }\n for (const key in manifest.edge) {\n const entry = manifest.edge[key]\n entry.workers = sortObjectByKey(entry.workers)\n entry.layer = sortObjectByKey(entry.layer)\n }\n\n return manifest\n }\n\n private writeActionManifest(): void {\n if (!this.actionManifests.takeChanged()) {\n return\n }\n const actionManifest = this.mergeActionManifests(\n this.actionManifests.values()\n )\n const actionManifestJsonPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.json`\n )\n const actionManifestJsPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.js`\n )\n const json = JSON.stringify(actionManifest, null, 2)\n deleteCache(actionManifestJsonPath)\n deleteCache(actionManifestJsPath)\n writeFileAtomic(actionManifestJsonPath, json)\n writeFileAtomic(\n actionManifestJsPath,\n `self.__RSC_SERVER_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n loadAppPathsManifest(pageName: string): void {\n this.appPathsManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n APP_PATHS_MANIFEST,\n pageName,\n 'app'\n )\n )\n }\n\n private writeAppPathsManifest(): void {\n if (!this.appPathsManifests.takeChanged()) {\n return\n }\n const appPathsManifest = this.mergePagesManifests(\n this.appPathsManifests.values()\n )\n const appPathsManifestPath = join(\n this.distDir,\n 'server',\n APP_PATHS_MANIFEST\n )\n deleteCache(appPathsManifestPath)\n writeFileAtomic(\n appPathsManifestPath,\n JSON.stringify(appPathsManifest, null, 2)\n )\n }\n\n private writeWebpackStats(): void {\n if (!this.webpackStats.takeChanged()) {\n return\n }\n const webpackStats = this.mergeWebpackStats(this.webpackStats.values())\n const path = join(this.distDir, 'server', WEBPACK_STATS)\n deleteCache(path)\n writeFileAtomic(path, JSON.stringify(webpackStats, null, 2))\n }\n\n private writeSriManifest(): void {\n if (!this.sriEnabled || !this.sriManifests.takeChanged()) {\n return\n }\n const sriManifest = this.mergeSriManifests(this.sriManifests.values())\n const pathJson = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n )\n const pathJs = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.js`\n )\n deleteCache(pathJson)\n deleteCache(pathJs)\n writeFileAtomic(pathJson, JSON.stringify(sriManifest, null, 2))\n writeFileAtomic(\n pathJs,\n `self.__SUBRESOURCE_INTEGRITY_MANIFEST=${JSON.stringify(\n JSON.stringify(sriManifest)\n )}`\n )\n }\n\n loadBuildManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.buildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(this.distDir, BUILD_MANIFEST, pageName, type)\n )\n }\n\n loadClientBuildManifest(\n pageName: string,\n type: 'app' | 'pages' = 'pages'\n ): void {\n this.clientBuildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n pageName,\n type\n )\n )\n }\n\n loadWebpackStats(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.webpackStats.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(this.distDir, WEBPACK_STATS, pageName, type)\n )\n }\n\n loadSriManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n if (!this.sriEnabled) return\n this.sriManifests.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeWebpackStats(statsFiles: Iterable<WebpackStats>): WebpackStats {\n const entrypoints: Record<string, StatsChunkGroup> = {}\n const assets: Map<string, StatsAsset> = new Map()\n const chunks: Map<string | number, StatsChunk> = new Map()\n const modules: Map<string | number, StatsModule> = new Map()\n\n for (const statsFile of statsFiles) {\n if (statsFile.entrypoints) {\n for (const [k, v] of Object.entries(statsFile.entrypoints)) {\n if (!entrypoints[k]) {\n entrypoints[k] = v\n }\n }\n }\n\n if (statsFile.assets) {\n for (const asset of statsFile.assets) {\n if (!assets.has(asset.name)) {\n assets.set(asset.name, asset)\n }\n }\n }\n\n if (statsFile.chunks) {\n for (const chunk of statsFile.chunks) {\n if (!chunks.has(chunk.id!)) {\n chunks.set(chunk.id!, chunk)\n }\n }\n }\n\n if (statsFile.modules) {\n for (const module of statsFile.modules) {\n const id = module.id\n if (id != null) {\n // Merge the chunk list for the module. This can vary across endpoints.\n const existing = modules.get(id)\n if (existing == null) {\n modules.set(id, module)\n } else if (module.chunks != null && existing.chunks != null) {\n for (const chunk of module.chunks) {\n if (!existing.chunks.includes(chunk)) {\n existing.chunks.push(chunk)\n }\n }\n }\n }\n }\n }\n }\n\n return {\n version: 'Turbopack',\n entrypoints,\n assets: [...assets.values()],\n chunks: [...chunks.values()],\n modules: [...modules.values()],\n }\n }\n\n private mergeBuildManifests(\n manifests: Iterable<BuildManifest>,\n lowPriorityFiles: string[]\n ) {\n const manifest: Partial<BuildManifest> & Pick<BuildManifest, 'pages'> = {\n pages: {\n '/_app': [],\n },\n // Something in next.js depends on these to exist even for app dir rendering\n devFiles: [],\n polyfillFiles: [],\n lowPriorityFiles,\n rootMainFiles: [],\n }\n for (const m of manifests) {\n Object.assign(manifest.pages, m.pages)\n if (m.rootMainFiles.length) manifest.rootMainFiles = m.rootMainFiles\n // polyfillFiles should always be the same, so we can overwrite instead of actually merging\n if (m.polyfillFiles.length) manifest.polyfillFiles = m.polyfillFiles\n }\n manifest.pages = sortObjectByKey(manifest.pages) as BuildManifest['pages']\n return manifest\n }\n\n private mergeClientBuildManifests(\n manifests: Iterable<ClientBuildManifest>,\n rewrites: CustomRoutes['rewrites'],\n sortedPageKeys: string[]\n ): ClientBuildManifest {\n const manifest = {\n __rewrites: rewrites as any,\n sortedPages: sortedPageKeys,\n }\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writeInterceptionRouteRewriteManifest(\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): void {\n const rewrites = productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n\n const interceptionRewrites = JSON.stringify(\n rewrites.beforeFiles.filter(isInterceptionRouteRewrite)\n )\n\n if (this.cachedInterceptionRewrites === interceptionRewrites) {\n return\n }\n this.cachedInterceptionRewrites = interceptionRewrites\n\n const interceptionRewriteManifestPath = join(\n this.distDir,\n 'server',\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n deleteCache(interceptionRewriteManifestPath)\n\n writeFileAtomic(\n interceptionRewriteManifestPath,\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )};`\n )\n }\n\n private writeBuildManifest(lowPriorityFiles: string[]): void {\n if (!this.buildManifests.takeChanged()) {\n return\n }\n const buildManifest = this.mergeBuildManifests(\n this.buildManifests.values(),\n lowPriorityFiles\n )\n\n const buildManifestPath = join(this.distDir, BUILD_MANIFEST)\n const middlewareBuildManifestPath = join(\n this.distDir,\n 'server',\n `${MIDDLEWARE_BUILD_MANIFEST}.js`\n )\n\n deleteCache(buildManifestPath)\n deleteCache(middlewareBuildManifestPath)\n writeFileAtomic(buildManifestPath, JSON.stringify(buildManifest, null, 2))\n writeFileAtomic(\n middlewareBuildManifestPath,\n createEdgeRuntimeManifest(buildManifest)\n )\n\n // Write fallback build manifest\n const fallbackBuildManifest = this.mergeBuildManifests(\n [\n this.buildManifests.get(getEntryKey('pages', 'server', '_app')),\n this.buildManifests.get(getEntryKey('pages', 'server', '_error')),\n ].filter(Boolean) as BuildManifest[],\n lowPriorityFiles\n )\n const fallbackBuildManifestPath = join(\n this.distDir,\n `fallback-${BUILD_MANIFEST}`\n )\n deleteCache(fallbackBuildManifestPath)\n writeFileAtomic(\n fallbackBuildManifestPath,\n JSON.stringify(fallbackBuildManifest, null, 2)\n )\n }\n\n private writeClientBuildManifest(\n entrypoints: Entrypoints,\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): string[] {\n const rewrites = normalizeRewritesForBuildManifest(\n productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n )\n\n const pagesKeys = [...entrypoints.page.keys()]\n if (entrypoints.global.app) {\n pagesKeys.push('/_app')\n }\n if (entrypoints.global.error) {\n pagesKeys.push('/_error')\n }\n\n const sortedPageKeys = getSortedRoutes(pagesKeys)\n\n let buildManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_buildManifest.js'\n )\n let ssgManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_ssgManifest.js'\n )\n\n if (\n this.dev &&\n !this.clientBuildManifests.takeChanged({ rewrites, sortedPageKeys })\n ) {\n return [buildManifestPath, ssgManifestPath]\n }\n\n const clientBuildManifest = this.mergeClientBuildManifests(\n this.clientBuildManifests.values(),\n rewrites,\n sortedPageKeys\n )\n const clientBuildManifestJs = `self.__BUILD_MANIFEST = ${JSON.stringify(\n clientBuildManifest,\n null,\n 2\n )};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`\n\n writeFileAtomic(\n join(this.distDir, buildManifestPath),\n clientBuildManifestJs\n )\n // This is just an empty placeholder, the actual manifest is written after prerendering in\n // packages/next/src/build/index.ts\n writeFileAtomic(join(this.distDir, ssgManifestPath), srcEmptySsgManifest)\n\n return [buildManifestPath, ssgManifestPath]\n }\n\n loadFontManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.fontManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${NEXT_FONT_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeFontManifests(manifests: Iterable<NextFontManifest>) {\n const manifest: NextFontManifest = {\n app: {},\n appUsingSizeAdjust: false,\n pages: {},\n pagesUsingSizeAdjust: false,\n }\n for (const m of manifests) {\n Object.assign(manifest.app, m.app)\n Object.assign(manifest.pages, m.pages)\n\n manifest.appUsingSizeAdjust =\n manifest.appUsingSizeAdjust || m.appUsingSizeAdjust\n manifest.pagesUsingSizeAdjust =\n manifest.pagesUsingSizeAdjust || m.pagesUsingSizeAdjust\n }\n manifest.app = sortObjectByKey(manifest.app)\n manifest.pages = sortObjectByKey(manifest.pages)\n return manifest\n }\n\n private async writeNextFontManifest(): Promise<void> {\n if (!this.fontManifests.takeChanged()) {\n return\n }\n const fontManifest = this.mergeFontManifests(this.fontManifests.values())\n const json = JSON.stringify(fontManifest, null, 2)\n\n const fontManifestJsonPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.json`\n )\n const fontManifestJsPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.js`\n )\n deleteCache(fontManifestJsonPath)\n deleteCache(fontManifestJsPath)\n writeFileAtomic(fontManifestJsonPath, json)\n writeFileAtomic(\n fontManifestJsPath,\n `self.__NEXT_FONT_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n /**\n * @returns If the manifest was written or not\n */\n loadMiddlewareManifest(\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation'\n ): boolean {\n const middlewareManifestPath = getManifestPath(\n pageName,\n this.distDir,\n MIDDLEWARE_MANIFEST,\n type,\n true\n )\n\n // middlewareManifest is actually \"edge manifest\" and not all routes are edge runtime. If it is not written we skip it.\n if (!existsSync(middlewareManifestPath)) {\n return false\n }\n\n this.middlewareManifests.set(\n getEntryKey(\n type === 'middleware' || type === 'instrumentation' ? 'root' : type,\n 'server',\n pageName\n ),\n readPartialManifestContent(\n this.distDir,\n MIDDLEWARE_MANIFEST,\n pageName,\n type\n )\n )\n\n return true\n }\n\n getMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.get(key)\n }\n\n deleteMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.delete(key)\n }\n\n private mergeMiddlewareManifests(\n manifests: Iterable<TurbopackMiddlewareManifest>\n ): MiddlewareManifest {\n const manifest: MiddlewareManifest = {\n version: 3,\n middleware: {},\n sortedMiddleware: [],\n functions: {},\n }\n let instrumentation: InstrumentationDefinition | undefined = undefined\n for (const m of manifests) {\n Object.assign(manifest.functions, m.functions)\n Object.assign(manifest.middleware, m.middleware)\n if (m.instrumentation) {\n instrumentation = m.instrumentation\n }\n }\n manifest.functions = sortObjectByKey(manifest.functions)\n manifest.middleware = sortObjectByKey(manifest.middleware)\n const updateFunctionDefinition = (\n fun: EdgeFunctionDefinition\n ): EdgeFunctionDefinition => {\n return {\n ...fun,\n files: [...(instrumentation?.files ?? []), ...fun.files],\n }\n }\n for (const key of Object.keys(manifest.middleware)) {\n const value = manifest.middleware[key]\n manifest.middleware[key] = updateFunctionDefinition(value)\n }\n for (const key of Object.keys(manifest.functions)) {\n const value = manifest.functions[key]\n manifest.functions[key] = updateFunctionDefinition(value)\n }\n for (const fun of Object.values(manifest.functions).concat(\n Object.values(manifest.middleware)\n )) {\n for (const matcher of fun.matchers) {\n if (!matcher.regexp) {\n matcher.regexp = safePathToRegexp(matcher.originalSource, [], {\n delimiter: '/',\n sensitive: false,\n strict: true,\n }).source.replaceAll('\\\\/', '/')\n }\n }\n }\n manifest.sortedMiddleware = Object.keys(manifest.middleware)\n\n return manifest\n }\n\n private writeMiddlewareManifest(): {\n clientMiddlewareManifestPath: string\n } {\n let clientMiddlewareManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST\n )\n\n if (this.dev && !this.middlewareManifests.takeChanged()) {\n return {\n clientMiddlewareManifestPath,\n }\n }\n const middlewareManifest = this.mergeMiddlewareManifests(\n this.middlewareManifests.values()\n )\n\n // Server middleware manifest\n\n // Normalize regexes as it uses path-to-regexp\n for (const key in middlewareManifest.middleware) {\n middlewareManifest.middleware[key].matchers.forEach((matcher) => {\n if (!matcher.regexp.startsWith('^')) {\n const parsedPage = tryToParsePath(matcher.regexp)\n if (parsedPage.error || !parsedPage.regexStr) {\n throw new Error(`Invalid source: ${matcher.regexp}`)\n }\n matcher.regexp = parsedPage.regexStr\n }\n })\n }\n\n const middlewareManifestPath = join(\n this.distDir,\n 'server',\n MIDDLEWARE_MANIFEST\n )\n deleteCache(middlewareManifestPath)\n writeFileAtomic(\n middlewareManifestPath,\n JSON.stringify(middlewareManifest, null, 2)\n )\n\n // Client middleware manifest This is only used in dev though, packages/next/src/build/index.ts\n // writes the mainfest again for builds.\n const matchers = middlewareManifest?.middleware['/']?.matchers || []\n\n const clientMiddlewareManifestJs = `self.__MIDDLEWARE_MATCHERS = ${JSON.stringify(\n matchers,\n null,\n 2\n )};self.__MIDDLEWARE_MATCHERS_CB && self.__MIDDLEWARE_MATCHERS_CB()`\n\n deleteCache(clientMiddlewareManifestPath)\n writeFileAtomic(\n join(this.distDir, clientMiddlewareManifestPath),\n clientMiddlewareManifestJs\n )\n\n return {\n clientMiddlewareManifestPath,\n }\n }\n\n loadPagesManifest(pageName: string): void {\n this.pagesManifests.set(\n getEntryKey('pages', 'server', pageName),\n readPartialManifestContent(this.distDir, PAGES_MANIFEST, pageName)\n )\n }\n\n private mergePagesManifests(manifests: Iterable<PagesManifest>) {\n const manifest: PagesManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private mergeSriManifests(manifests: Iterable<SubresourceIntegrityManifest>) {\n const manifest: SubresourceIntegrityManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writePagesManifest(): void {\n if (!this.pagesManifests.takeChanged()) {\n return\n }\n const pagesManifest = this.mergePagesManifests(this.pagesManifests.values())\n const pagesManifestPath = join(this.distDir, 'server', PAGES_MANIFEST)\n deleteCache(pagesManifestPath)\n writeFileAtomic(pagesManifestPath, JSON.stringify(pagesManifest, null, 2))\n }\n\n writeManifests({\n devRewrites,\n productionRewrites,\n entrypoints,\n }: {\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined\n productionRewrites: CustomRoutes['rewrites'] | undefined\n entrypoints: Entrypoints\n }): void {\n this.writeActionManifest()\n this.writeAppPathsManifest()\n const lowPriorityFiles = this.writeClientBuildManifest(\n entrypoints,\n devRewrites,\n productionRewrites\n )\n const { clientMiddlewareManifestPath } = this.writeMiddlewareManifest()\n this.writeBuildManifest([...lowPriorityFiles, clientMiddlewareManifestPath])\n this.writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites)\n this.writeNextFontManifest()\n this.writePagesManifest()\n\n this.writeSriManifest()\n\n if (process.env.TURBOPACK_STATS != null) {\n this.writeWebpackStats()\n }\n }\n}\n\nfunction sortObjectByKey(obj: Record<string, any>) {\n return Object.keys(obj)\n .sort()\n .reduce(\n (acc, key) => {\n acc[key] = obj[key]\n return acc\n },\n {} as Record<string, any>\n )\n}\n"],"names":["TurbopackManifestLoader","getManifestPath","page","distDir","name","type","firstCall","manifestPath","posix","join","getAssetPathFromRoute","isSitemapRoute","test","existsSync","replace","endsWith","basePage","removeRouteSuffix","slice","length","metadataPage","addRouteSuffix","addMetadataIdToRoute","readPartialManifestContent","pageName","readFileSync","ManifestsMap","set","key","value","rawMap","get","changed","map","JSON","parse","delete","has","takeChanged","extraInvalidationKey","undefined","stringified","stringify","values","Map","constructor","buildId","encryptionKey","dev","sriEnabled","actionManifests","appPathsManifests","buildManifests","clientBuildManifests","fontManifests","middlewareManifests","pagesManifests","webpackStats","sriManifests","cachedInterceptionRewrites","loadActionManifest","getEntryKey","SERVER_REFERENCE_MANIFEST","mergeActionManifests","manifests","manifest","node","edge","mergeActionIds","actionEntries","other","action","workers","layer","filename","exportedName","Object","assign","m","entry","sortObjectByKey","writeActionManifest","actionManifest","actionManifestJsonPath","actionManifestJsPath","json","deleteCache","writeFileAtomic","loadAppPathsManifest","APP_PATHS_MANIFEST","writeAppPathsManifest","appPathsManifest","mergePagesManifests","appPathsManifestPath","writeWebpackStats","mergeWebpackStats","path","WEBPACK_STATS","writeSriManifest","sriManifest","mergeSriManifests","pathJson","SUBRESOURCE_INTEGRITY_MANIFEST","pathJs","loadBuildManifest","BUILD_MANIFEST","loadClientBuildManifest","TURBOPACK_CLIENT_BUILD_MANIFEST","loadWebpackStats","loadSriManifest","statsFiles","entrypoints","assets","chunks","modules","statsFile","k","v","entries","asset","chunk","id","module","existing","includes","push","version","mergeBuildManifests","lowPriorityFiles","pages","devFiles","polyfillFiles","rootMainFiles","mergeClientBuildManifests","rewrites","sortedPageKeys","__rewrites","sortedPages","writeInterceptionRouteRewriteManifest","devRewrites","productionRewrites","beforeFiles","processRoute","afterFiles","fallback","interceptionRewrites","filter","isInterceptionRouteRewrite","interceptionRewriteManifestPath","INTERCEPTION_ROUTE_REWRITE_MANIFEST","writeBuildManifest","buildManifest","buildManifestPath","middlewareBuildManifestPath","MIDDLEWARE_BUILD_MANIFEST","createEdgeRuntimeManifest","fallbackBuildManifest","Boolean","fallbackBuildManifestPath","writeClientBuildManifest","normalizeRewritesForBuildManifest","pagesKeys","keys","global","app","error","getSortedRoutes","CLIENT_STATIC_FILES_PATH","ssgManifestPath","clientBuildManifest","clientBuildManifestJs","srcEmptySsgManifest","loadFontManifest","NEXT_FONT_MANIFEST","mergeFontManifests","appUsingSizeAdjust","pagesUsingSizeAdjust","writeNextFontManifest","fontManifest","fontManifestJsonPath","fontManifestJsPath","loadMiddlewareManifest","middlewareManifestPath","MIDDLEWARE_MANIFEST","getMiddlewareManifest","deleteMiddlewareManifest","mergeMiddlewareManifests","middleware","sortedMiddleware","functions","instrumentation","updateFunctionDefinition","fun","files","concat","matcher","matchers","regexp","safePathToRegexp","originalSource","delimiter","sensitive","strict","source","replaceAll","writeMiddlewareManifest","clientMiddlewareManifestPath","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","middlewareManifest","forEach","startsWith","parsedPage","tryToParsePath","regexStr","Error","clientMiddlewareManifestJs","loadPagesManifest","PAGES_MANIFEST","writePagesManifest","pagesManifest","pagesManifestPath","writeManifests","process","env","TURBOPACK_STATS","obj","sort","reduce","acc"],"mappings":";;;;+BA0LaA;;;eAAAA;;;;2BA5JN;sBACqB;oBACC;8BAED;6BACI;oDACW;gFACT;0BACS;uBAEX;gCAMzB;gCACwB;iCACE;0CAQ1B;AAwBP,MAAMC,kBAAkB,CACtBC,MACAC,SACAC,MACAC,MACAC;IAEA,IAAIC,eAAeC,WAAK,CAACC,IAAI,CAC3BN,SACA,CAAC,MAAM,CAAC,EACRE,MACAA,SAAS,gBAAgBA,SAAS,oBAC9B,KACAA,SAAS,QACPH,OACAQ,IAAAA,8BAAqB,EAACR,OAC5BE;IAGF,IAAIE,WAAW;QACb,MAAMK,iBAAiB,8BAA8BC,IAAI,CAACV;QAC1D,mDAAmD;QACnD,IAAIS,kBAAkB,CAACE,IAAAA,cAAU,EAACN,eAAe;YAC/CA,eAAeN,gBACbC,KAAKY,OAAO,CAAC,qBAAqB,uBAClCX,SACAC,MACAC,MACA;QAEJ;QACA,oDAAoD;Q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F,WAAW,EACXC,kBAAkB,EAClB7B,WAAW,EAKZ,EAAQ;QACP,IAAI,CAAC9B,mBAAmB;QACxB,IAAI,CAACS,qBAAqB;QAC1B,MAAMsC,mBAAmB,IAAI,CAAC+B,wBAAwB,CACpDhD,aACA4B,aACAC;QAEF,MAAM,EAAEkE,4BAA4B,EAAE,GAAG,IAAI,CAACD,uBAAuB;QACrE,IAAI,CAACvD,kBAAkB,CAAC;eAAItB;YAAkB8E;SAA6B;QAC3E,IAAI,CAACpE,qCAAqC,CAACC,aAAaC;QACxD,IAAI,CAACqC,qBAAqB;QAC1B,IAAI,CAACyC,kBAAkB;QAEvB,IAAI,CAACxH,gBAAgB;QAErB,IAAI4H,QAAQC,GAAG,CAACC,eAAe,IAAI,MAAM;YACvC,IAAI,CAAClI,iBAAiB;QACxB;IACF;AACF;AAEA,SAASd,gBAAgBiJ,GAAwB;IAC/C,OAAOrJ,OAAOsF,IAAI,CAAC+D,KAChBC,IAAI,GACJC,MAAM,CACL,CAACC,KAAKxM;QACJwM,GAAG,CAACxM,IAAI,GAAGqM,GAAG,CAACrM,IAAI;QACnB,OAAOwM;IACT,GACA,CAAC;AAEP","ignoreList":[0]}
{"version":3,"sources":["../../../../src/shared/lib/turbopack/manifest-loader.ts"],"sourcesContent":["import type {\n EdgeFunctionDefinition,\n MiddlewareManifest,\n} from '../../../build/webpack/plugins/middleware-plugin'\nimport type {\n StatsAsset,\n StatsChunk,\n StatsChunkGroup,\n StatsModule,\n StatsCompilation as WebpackStats,\n} from 'webpack'\nimport type { BuildManifest } from '../../../server/get-page-files'\nimport type { PagesManifest } from '../../../build/webpack/plugins/pages-manifest-plugin'\nimport type { ActionManifest } from '../../../build/webpack/plugins/flight-client-entry-plugin'\nimport type { NextFontManifest } from '../../../build/webpack/plugins/next-font-manifest-plugin'\nimport type { REACT_LOADABLE_MANIFEST } from '../constants'\nimport {\n APP_PATHS_MANIFEST,\n BUILD_MANIFEST,\n CLIENT_STATIC_FILES_PATH,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n MIDDLEWARE_BUILD_MANIFEST,\n MIDDLEWARE_MANIFEST,\n NEXT_FONT_MANIFEST,\n PAGES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST,\n WEBPACK_STATS,\n} from '../constants'\nimport { join, posix } from 'path'\nimport { readFileSync } from 'fs'\nimport type { SetupOpts } from '../../../server/lib/router-utils/setup-dev-bundler'\nimport { deleteCache } from '../../../server/dev/require-cache'\nimport { writeFileAtomic } from '../../../lib/fs/write-atomic'\nimport getAssetPathFromRoute from '../router/utils/get-asset-path-from-route'\nimport { getEntryKey, type EntryKey } from './entry-key'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { getSortedRoutes } from '../router/utils'\nimport { existsSync } from 'fs'\nimport {\n addMetadataIdToRoute,\n addRouteSuffix,\n removeRouteSuffix,\n} from '../../../server/dev/turbopack-utils'\nimport { tryToParsePath } from '../../../lib/try-to-parse-path'\nimport { safePathToRegexp } from '../router/utils/route-match-utils'\nimport type { Entrypoints } from '../../../build/swc/types'\nimport {\n normalizeRewritesForBuildManifest,\n type ClientBuildManifest,\n srcEmptySsgManifest,\n processRoute,\n createEdgeRuntimeManifest,\n} from '../../../build/webpack/plugins/build-manifest-plugin-utils'\nimport type { SubresourceIntegrityManifest } from '../../../build'\n\ninterface InstrumentationDefinition {\n files: string[]\n name: 'instrumentation'\n}\n\ntype TurbopackMiddlewareManifest = MiddlewareManifest & {\n instrumentation?: InstrumentationDefinition\n}\n\ntype ManifestName =\n | typeof MIDDLEWARE_MANIFEST\n | typeof BUILD_MANIFEST\n | typeof PAGES_MANIFEST\n | typeof WEBPACK_STATS\n | typeof APP_PATHS_MANIFEST\n | `${typeof SERVER_REFERENCE_MANIFEST}.json`\n | `${typeof SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n | `${typeof NEXT_FONT_MANIFEST}.json`\n | typeof REACT_LOADABLE_MANIFEST\n | typeof TURBOPACK_CLIENT_BUILD_MANIFEST\n\nconst getManifestPath = (\n page: string,\n distDir: string,\n name: ManifestName,\n type: string,\n firstCall: boolean\n) => {\n let manifestPath = posix.join(\n distDir,\n `server`,\n type,\n type === 'middleware' || type === 'instrumentation'\n ? ''\n : type === 'app'\n ? page\n : getAssetPathFromRoute(page),\n name\n )\n\n if (firstCall) {\n const isSitemapRoute = /[\\\\/]sitemap(.xml)?\\/route$/.test(page)\n // Check the ambiguity of /sitemap and /sitemap.xml\n if (isSitemapRoute && !existsSync(manifestPath)) {\n manifestPath = getManifestPath(\n page.replace(/\\/sitemap\\/route$/, '/sitemap.xml/route'),\n distDir,\n name,\n type,\n false\n )\n }\n // existsSync is faster than using the async version\n if (!existsSync(manifestPath) && page.endsWith('/route')) {\n // TODO: Improve implementation of metadata routes, currently it requires this extra check for the variants of the files that can be written.\n let basePage = removeRouteSuffix(page)\n // For sitemap.xml routes with generateSitemaps, the manifest is at\n // /sitemap/[__metadata_id__]/route (without .xml), because the route\n // handler serves at /sitemap/[id] not /sitemap.xml/[id]\n if (basePage.endsWith('/sitemap.xml')) {\n basePage = basePage.slice(0, -'.xml'.length)\n }\n let metadataPage = addRouteSuffix(addMetadataIdToRoute(basePage))\n manifestPath = getManifestPath(metadataPage, distDir, name, type, false)\n }\n }\n\n return manifestPath\n}\n\nfunction readPartialManifestContent(\n distDir: string,\n name: ManifestName,\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation' = 'pages'\n): string {\n const page = pageName\n const manifestPath = getManifestPath(page, distDir, name, type, true)\n return readFileSync(posix.join(manifestPath), 'utf-8')\n}\n\n/// Helper class that stores a map of manifests and tracks if they have changed\n/// since the last time they were written to disk. This is used to avoid\n/// unnecessary writes to disk.\nclass ManifestsMap<K, V> {\n private rawMap = new Map<K, string>()\n private map = new Map<K, V>()\n private extraInvalidationKey: string | undefined = undefined\n private changed = true\n\n set(key: K, value: string) {\n if (this.rawMap.get(key) === value) return\n this.changed = true\n this.rawMap.set(key, value)\n this.map.set(key, JSON.parse(value))\n }\n\n delete(key: K) {\n if (this.map.has(key)) {\n this.changed = true\n this.rawMap.delete(key)\n this.map.delete(key)\n }\n }\n\n get(key: K) {\n return this.map.get(key)\n }\n\n takeChanged(extraInvalidationKey?: any) {\n let changed = this.changed\n if (extraInvalidationKey !== undefined) {\n const stringified = JSON.stringify(extraInvalidationKey)\n if (this.extraInvalidationKey !== stringified) {\n this.extraInvalidationKey = stringified\n changed = true\n }\n }\n this.changed = false\n return changed\n }\n\n values() {\n return this.map.values()\n }\n}\n\nexport class TurbopackManifestLoader {\n private actionManifests: ManifestsMap<EntryKey, ActionManifest> =\n new ManifestsMap()\n private appPathsManifests: ManifestsMap<EntryKey, PagesManifest> =\n new ManifestsMap()\n private buildManifests: ManifestsMap<EntryKey, BuildManifest> =\n new ManifestsMap()\n private clientBuildManifests: ManifestsMap<EntryKey, ClientBuildManifest> =\n new ManifestsMap()\n private fontManifests: ManifestsMap<EntryKey, NextFontManifest> =\n new ManifestsMap()\n private middlewareManifests: ManifestsMap<\n EntryKey,\n TurbopackMiddlewareManifest\n > = new ManifestsMap()\n private pagesManifests: ManifestsMap<string, PagesManifest> =\n new ManifestsMap()\n private webpackStats: ManifestsMap<EntryKey, WebpackStats> =\n new ManifestsMap()\n private sriManifests: ManifestsMap<EntryKey, SubresourceIntegrityManifest> =\n new ManifestsMap()\n private encryptionKey: string\n /// interceptionRewrites that have been written to disk\n /// This is used to avoid unnecessary writes if the rewrites haven't changed\n private cachedInterceptionRewrites: string | undefined = undefined\n\n private readonly distDir: string\n private readonly buildId: string\n private readonly dev: boolean\n private readonly sriEnabled: boolean\n\n constructor({\n distDir,\n buildId,\n encryptionKey,\n dev,\n sriEnabled,\n }: {\n buildId: string\n distDir: string\n encryptionKey: string\n dev: boolean\n sriEnabled: boolean\n }) {\n this.distDir = distDir\n this.buildId = buildId\n this.encryptionKey = encryptionKey\n this.dev = dev\n this.sriEnabled = sriEnabled\n }\n\n delete(key: EntryKey) {\n this.actionManifests.delete(key)\n this.appPathsManifests.delete(key)\n this.buildManifests.delete(key)\n this.clientBuildManifests.delete(key)\n this.fontManifests.delete(key)\n this.middlewareManifests.delete(key)\n this.pagesManifests.delete(key)\n this.webpackStats.delete(key)\n }\n\n loadActionManifest(pageName: string): void {\n this.actionManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SERVER_REFERENCE_MANIFEST}.json`,\n pageName,\n 'app'\n )\n )\n }\n\n private mergeActionManifests(manifests: Iterable<ActionManifest>) {\n type ActionEntries = ActionManifest['edge' | 'node']\n const manifest: ActionManifest = {\n node: {},\n edge: {},\n encryptionKey: this.encryptionKey,\n }\n\n function mergeActionIds(\n actionEntries: ActionEntries,\n other: ActionEntries\n ): void {\n for (const key in other) {\n const action = (actionEntries[key] ??= {\n workers: {},\n layer: {},\n })\n action.filename = other[key].filename\n action.exportedName = other[key].exportedName\n Object.assign(action.workers, other[key].workers)\n Object.assign(action.layer, other[key].layer)\n }\n }\n\n for (const m of manifests) {\n mergeActionIds(manifest.node, m.node)\n mergeActionIds(manifest.edge, m.edge)\n }\n for (const key in manifest.node) {\n const entry = manifest.node[key]\n entry.workers = sortObjectByKey(entry.workers)\n entry.layer = sortObjectByKey(entry.layer)\n }\n for (const key in manifest.edge) {\n const entry = manifest.edge[key]\n entry.workers = sortObjectByKey(entry.workers)\n entry.layer = sortObjectByKey(entry.layer)\n }\n\n return manifest\n }\n\n private writeActionManifest(): void {\n if (!this.actionManifests.takeChanged()) {\n return\n }\n const actionManifest = this.mergeActionManifests(\n this.actionManifests.values()\n )\n const actionManifestJsonPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.json`\n )\n const actionManifestJsPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.js`\n )\n const json = JSON.stringify(actionManifest, null, 2)\n deleteCache(actionManifestJsonPath)\n deleteCache(actionManifestJsPath)\n writeFileAtomic(actionManifestJsonPath, json)\n writeFileAtomic(\n actionManifestJsPath,\n `self.__RSC_SERVER_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n loadAppPathsManifest(pageName: string): void {\n this.appPathsManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n APP_PATHS_MANIFEST,\n pageName,\n 'app'\n )\n )\n }\n\n private writeAppPathsManifest(): void {\n if (!this.appPathsManifests.takeChanged()) {\n return\n }\n const appPathsManifest = this.mergePagesManifests(\n this.appPathsManifests.values()\n )\n const appPathsManifestPath = join(\n this.distDir,\n 'server',\n APP_PATHS_MANIFEST\n )\n deleteCache(appPathsManifestPath)\n writeFileAtomic(\n appPathsManifestPath,\n JSON.stringify(appPathsManifest, null, 2)\n )\n }\n\n private writeWebpackStats(): void {\n if (!this.webpackStats.takeChanged()) {\n return\n }\n const webpackStats = this.mergeWebpackStats(this.webpackStats.values())\n const path = join(this.distDir, 'server', WEBPACK_STATS)\n deleteCache(path)\n writeFileAtomic(path, JSON.stringify(webpackStats, null, 2))\n }\n\n private writeSriManifest(): void {\n if (!this.sriEnabled || !this.sriManifests.takeChanged()) {\n return\n }\n const sriManifest = this.mergeSriManifests(this.sriManifests.values())\n const pathJson = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n )\n const pathJs = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.js`\n )\n deleteCache(pathJson)\n deleteCache(pathJs)\n writeFileAtomic(pathJson, JSON.stringify(sriManifest, null, 2))\n writeFileAtomic(\n pathJs,\n `self.__SUBRESOURCE_INTEGRITY_MANIFEST=${JSON.stringify(\n JSON.stringify(sriManifest)\n )}`\n )\n }\n\n loadBuildManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.buildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(this.distDir, BUILD_MANIFEST, pageName, type)\n )\n }\n\n loadClientBuildManifest(\n pageName: string,\n type: 'app' | 'pages' = 'pages'\n ): void {\n this.clientBuildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n pageName,\n type\n )\n )\n }\n\n loadWebpackStats(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.webpackStats.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(this.distDir, WEBPACK_STATS, pageName, type)\n )\n }\n\n loadSriManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n if (!this.sriEnabled) return\n this.sriManifests.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeWebpackStats(statsFiles: Iterable<WebpackStats>): WebpackStats {\n const entrypoints: Record<string, StatsChunkGroup> = {}\n const assets: Map<string, StatsAsset> = new Map()\n const chunks: Map<string | number, StatsChunk> = new Map()\n const modules: Map<string | number, StatsModule> = new Map()\n\n for (const statsFile of statsFiles) {\n if (statsFile.entrypoints) {\n for (const [k, v] of Object.entries(statsFile.entrypoints)) {\n if (!entrypoints[k]) {\n entrypoints[k] = v\n }\n }\n }\n\n if (statsFile.assets) {\n for (const asset of statsFile.assets) {\n if (!assets.has(asset.name)) {\n assets.set(asset.name, asset)\n }\n }\n }\n\n if (statsFile.chunks) {\n for (const chunk of statsFile.chunks) {\n if (!chunks.has(chunk.id!)) {\n chunks.set(chunk.id!, chunk)\n }\n }\n }\n\n if (statsFile.modules) {\n for (const module of statsFile.modules) {\n const id = module.id\n if (id != null) {\n // Merge the chunk list for the module. This can vary across endpoints.\n const existing = modules.get(id)\n if (existing == null) {\n modules.set(id, module)\n } else if (module.chunks != null && existing.chunks != null) {\n for (const chunk of module.chunks) {\n if (!existing.chunks.includes(chunk)) {\n existing.chunks.push(chunk)\n }\n }\n }\n }\n }\n }\n }\n\n return {\n version: 'Turbopack',\n entrypoints,\n assets: [...assets.values()],\n chunks: [...chunks.values()],\n modules: [...modules.values()],\n }\n }\n\n private mergeBuildManifests(\n manifests: Iterable<BuildManifest>,\n lowPriorityFiles: string[]\n ) {\n const manifest: Partial<BuildManifest> & Pick<BuildManifest, 'pages'> = {\n pages: {\n '/_app': [],\n },\n // Something in next.js depends on these to exist even for app dir rendering\n devFiles: [],\n polyfillFiles: [],\n lowPriorityFiles,\n rootMainFiles: [],\n }\n for (const m of manifests) {\n Object.assign(manifest.pages, m.pages)\n if (m.rootMainFiles.length) manifest.rootMainFiles = m.rootMainFiles\n // polyfillFiles should always be the same, so we can overwrite instead of actually merging\n if (m.polyfillFiles.length) manifest.polyfillFiles = m.polyfillFiles\n }\n manifest.pages = sortObjectByKey(manifest.pages) as BuildManifest['pages']\n return manifest\n }\n\n private mergeClientBuildManifests(\n manifests: Iterable<ClientBuildManifest>,\n rewrites: CustomRoutes['rewrites'],\n sortedPageKeys: string[]\n ): ClientBuildManifest {\n const manifest = {\n __rewrites: rewrites as any,\n sortedPages: sortedPageKeys,\n }\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writeInterceptionRouteRewriteManifest(\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): void {\n const rewrites = productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n\n const interceptionRewrites = JSON.stringify(\n rewrites.beforeFiles.filter(\n (\n require('../../../lib/is-interception-route-rewrite') as typeof import('../../../lib/is-interception-route-rewrite')\n ).isInterceptionRouteRewrite\n )\n )\n\n if (this.cachedInterceptionRewrites === interceptionRewrites) {\n return\n }\n this.cachedInterceptionRewrites = interceptionRewrites\n\n const interceptionRewriteManifestPath = join(\n this.distDir,\n 'server',\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n deleteCache(interceptionRewriteManifestPath)\n\n writeFileAtomic(\n interceptionRewriteManifestPath,\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )};`\n )\n }\n\n private writeBuildManifest(lowPriorityFiles: string[]): void {\n if (!this.buildManifests.takeChanged()) {\n return\n }\n const buildManifest = this.mergeBuildManifests(\n this.buildManifests.values(),\n lowPriorityFiles\n )\n\n const buildManifestPath = join(this.distDir, BUILD_MANIFEST)\n const middlewareBuildManifestPath = join(\n this.distDir,\n 'server',\n `${MIDDLEWARE_BUILD_MANIFEST}.js`\n )\n\n deleteCache(buildManifestPath)\n deleteCache(middlewareBuildManifestPath)\n writeFileAtomic(buildManifestPath, JSON.stringify(buildManifest, null, 2))\n writeFileAtomic(\n middlewareBuildManifestPath,\n createEdgeRuntimeManifest(buildManifest)\n )\n\n // Write fallback build manifest\n const fallbackBuildManifest = this.mergeBuildManifests(\n [\n this.buildManifests.get(getEntryKey('pages', 'server', '_app')),\n this.buildManifests.get(getEntryKey('pages', 'server', '_error')),\n ].filter(Boolean) as BuildManifest[],\n lowPriorityFiles\n )\n const fallbackBuildManifestPath = join(\n this.distDir,\n `fallback-${BUILD_MANIFEST}`\n )\n deleteCache(fallbackBuildManifestPath)\n writeFileAtomic(\n fallbackBuildManifestPath,\n JSON.stringify(fallbackBuildManifest, null, 2)\n )\n }\n\n private writeClientBuildManifest(\n entrypoints: Entrypoints,\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): string[] {\n const rewrites = normalizeRewritesForBuildManifest(\n productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n )\n\n const pagesKeys = [...entrypoints.page.keys()]\n if (entrypoints.global.app) {\n pagesKeys.push('/_app')\n }\n if (entrypoints.global.error) {\n pagesKeys.push('/_error')\n }\n\n const sortedPageKeys = getSortedRoutes(pagesKeys)\n\n let buildManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_buildManifest.js'\n )\n let ssgManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_ssgManifest.js'\n )\n\n if (\n this.dev &&\n !this.clientBuildManifests.takeChanged({ rewrites, sortedPageKeys })\n ) {\n return [buildManifestPath, ssgManifestPath]\n }\n\n const clientBuildManifest = this.mergeClientBuildManifests(\n this.clientBuildManifests.values(),\n rewrites,\n sortedPageKeys\n )\n const clientBuildManifestJs = `self.__BUILD_MANIFEST = ${JSON.stringify(\n clientBuildManifest,\n null,\n 2\n )};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`\n\n writeFileAtomic(\n join(this.distDir, buildManifestPath),\n clientBuildManifestJs\n )\n // This is just an empty placeholder, the actual manifest is written after prerendering in\n // packages/next/src/build/index.ts\n writeFileAtomic(join(this.distDir, ssgManifestPath), srcEmptySsgManifest)\n\n return [buildManifestPath, ssgManifestPath]\n }\n\n loadFontManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.fontManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${NEXT_FONT_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeFontManifests(manifests: Iterable<NextFontManifest>) {\n const manifest: NextFontManifest = {\n app: {},\n appUsingSizeAdjust: false,\n pages: {},\n pagesUsingSizeAdjust: false,\n }\n for (const m of manifests) {\n Object.assign(manifest.app, m.app)\n Object.assign(manifest.pages, m.pages)\n\n manifest.appUsingSizeAdjust =\n manifest.appUsingSizeAdjust || m.appUsingSizeAdjust\n manifest.pagesUsingSizeAdjust =\n manifest.pagesUsingSizeAdjust || m.pagesUsingSizeAdjust\n }\n manifest.app = sortObjectByKey(manifest.app)\n manifest.pages = sortObjectByKey(manifest.pages)\n return manifest\n }\n\n private async writeNextFontManifest(): Promise<void> {\n if (!this.fontManifests.takeChanged()) {\n return\n }\n const fontManifest = this.mergeFontManifests(this.fontManifests.values())\n const json = JSON.stringify(fontManifest, null, 2)\n\n const fontManifestJsonPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.json`\n )\n const fontManifestJsPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.js`\n )\n deleteCache(fontManifestJsonPath)\n deleteCache(fontManifestJsPath)\n writeFileAtomic(fontManifestJsonPath, json)\n writeFileAtomic(\n fontManifestJsPath,\n `self.__NEXT_FONT_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n /**\n * @returns If the manifest was written or not\n */\n loadMiddlewareManifest(\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation'\n ): boolean {\n const middlewareManifestPath = getManifestPath(\n pageName,\n this.distDir,\n MIDDLEWARE_MANIFEST,\n type,\n true\n )\n\n // middlewareManifest is actually \"edge manifest\" and not all routes are edge runtime. If it is not written we skip it.\n if (!existsSync(middlewareManifestPath)) {\n return false\n }\n\n this.middlewareManifests.set(\n getEntryKey(\n type === 'middleware' || type === 'instrumentation' ? 'root' : type,\n 'server',\n pageName\n ),\n readPartialManifestContent(\n this.distDir,\n MIDDLEWARE_MANIFEST,\n pageName,\n type\n )\n )\n\n return true\n }\n\n getMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.get(key)\n }\n\n deleteMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.delete(key)\n }\n\n private mergeMiddlewareManifests(\n manifests: Iterable<TurbopackMiddlewareManifest>\n ): MiddlewareManifest {\n const manifest: MiddlewareManifest = {\n version: 3,\n middleware: {},\n sortedMiddleware: [],\n functions: {},\n }\n let instrumentation: InstrumentationDefinition | undefined = undefined\n for (const m of manifests) {\n Object.assign(manifest.functions, m.functions)\n Object.assign(manifest.middleware, m.middleware)\n if (m.instrumentation) {\n instrumentation = m.instrumentation\n }\n }\n manifest.functions = sortObjectByKey(manifest.functions)\n manifest.middleware = sortObjectByKey(manifest.middleware)\n const updateFunctionDefinition = (\n fun: EdgeFunctionDefinition\n ): EdgeFunctionDefinition => {\n return {\n ...fun,\n files: [...(instrumentation?.files ?? []), ...fun.files],\n }\n }\n for (const key of Object.keys(manifest.middleware)) {\n const value = manifest.middleware[key]\n manifest.middleware[key] = updateFunctionDefinition(value)\n }\n for (const key of Object.keys(manifest.functions)) {\n const value = manifest.functions[key]\n manifest.functions[key] = updateFunctionDefinition(value)\n }\n for (const fun of Object.values(manifest.functions).concat(\n Object.values(manifest.middleware)\n )) {\n for (const matcher of fun.matchers) {\n if (!matcher.regexp) {\n matcher.regexp = safePathToRegexp(matcher.originalSource, [], {\n delimiter: '/',\n sensitive: false,\n strict: true,\n }).source.replaceAll('\\\\/', '/')\n }\n }\n }\n manifest.sortedMiddleware = Object.keys(manifest.middleware)\n\n return manifest\n }\n\n private writeMiddlewareManifest(): {\n clientMiddlewareManifestPath: string\n } {\n let clientMiddlewareManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST\n )\n\n if (this.dev && !this.middlewareManifests.takeChanged()) {\n return {\n clientMiddlewareManifestPath,\n }\n }\n const middlewareManifest = this.mergeMiddlewareManifests(\n this.middlewareManifests.values()\n )\n\n // Server middleware manifest\n\n // Normalize regexes as it uses path-to-regexp\n for (const key in middlewareManifest.middleware) {\n middlewareManifest.middleware[key].matchers.forEach((matcher) => {\n if (!matcher.regexp.startsWith('^')) {\n const parsedPage = tryToParsePath(matcher.regexp)\n if (parsedPage.error || !parsedPage.regexStr) {\n throw new Error(`Invalid source: ${matcher.regexp}`)\n }\n matcher.regexp = parsedPage.regexStr\n }\n })\n }\n\n const middlewareManifestPath = join(\n this.distDir,\n 'server',\n MIDDLEWARE_MANIFEST\n )\n deleteCache(middlewareManifestPath)\n writeFileAtomic(\n middlewareManifestPath,\n JSON.stringify(middlewareManifest, null, 2)\n )\n\n // Client middleware manifest This is only used in dev though, packages/next/src/build/index.ts\n // writes the mainfest again for builds.\n const matchers = middlewareManifest?.middleware['/']?.matchers || []\n\n const clientMiddlewareManifestJs = `self.__MIDDLEWARE_MATCHERS = ${JSON.stringify(\n matchers,\n null,\n 2\n )};self.__MIDDLEWARE_MATCHERS_CB && self.__MIDDLEWARE_MATCHERS_CB()`\n\n deleteCache(clientMiddlewareManifestPath)\n writeFileAtomic(\n join(this.distDir, clientMiddlewareManifestPath),\n clientMiddlewareManifestJs\n )\n\n return {\n clientMiddlewareManifestPath,\n }\n }\n\n loadPagesManifest(pageName: string): void {\n this.pagesManifests.set(\n getEntryKey('pages', 'server', pageName),\n readPartialManifestContent(this.distDir, PAGES_MANIFEST, pageName)\n )\n }\n\n private mergePagesManifests(manifests: Iterable<PagesManifest>) {\n const manifest: PagesManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private mergeSriManifests(manifests: Iterable<SubresourceIntegrityManifest>) {\n const manifest: SubresourceIntegrityManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writePagesManifest(): void {\n if (!this.pagesManifests.takeChanged()) {\n return\n }\n const pagesManifest = this.mergePagesManifests(this.pagesManifests.values())\n const pagesManifestPath = join(this.distDir, 'server', PAGES_MANIFEST)\n deleteCache(pagesManifestPath)\n writeFileAtomic(pagesManifestPath, JSON.stringify(pagesManifest, null, 2))\n }\n\n writeManifests({\n devRewrites,\n productionRewrites,\n entrypoints,\n }: {\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined\n productionRewrites: CustomRoutes['rewrites'] | undefined\n entrypoints: Entrypoints\n }): void {\n this.writeActionManifest()\n this.writeAppPathsManifest()\n const lowPriorityFiles = this.writeClientBuildManifest(\n entrypoints,\n devRewrites,\n productionRewrites\n )\n const { clientMiddlewareManifestPath } = this.writeMiddlewareManifest()\n this.writeBuildManifest([...lowPriorityFiles, clientMiddlewareManifestPath])\n this.writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites)\n this.writeNextFontManifest()\n this.writePagesManifest()\n\n this.writeSriManifest()\n\n if (process.env.TURBOPACK_STATS != null) {\n this.writeWebpackStats()\n }\n }\n}\n\nfunction sortObjectByKey(obj: Record<string, any>) {\n return Object.keys(obj)\n .sort()\n .reduce(\n (acc, key) => {\n acc[key] = obj[key]\n return acc\n },\n {} as Record<string, any>\n )\n}\n"],"names":["TurbopackManifestLoader","getManifestPath","page","distDir","name","type","firstCall","manifestPath","posix","join","getAssetPathFromRoute","isSitemapRoute","test","existsSync","replace","endsWith","basePage","removeRouteSuffix","slice","length","metadataPage","addRouteSuffix","addMetadataIdToRoute","readPartialManifestContent","pageName","readFileSync","ManifestsMap","set","key","value","rawMap","get","changed","map","JSON","parse","delete","has","takeChanged","extraInvalidationKey","undefined","stringified","stringify","values","Map","constructor","buildId","encryptionKey","dev","sriEnabled","actionManifests","appPathsManifests","buildManifests","clientBuildManifests","fontManifests","middlewareManifests","pagesManifests","webpackStats","sriManifests","cachedInterceptionRewrites","loadActionManifest","getEntryKey","SERVER_REFERENCE_MANIFEST","mergeActionManifests","manifests","manifest","node","edge","mergeActionIds","actionEntries","other","action","workers","layer","filename","exportedName","Object","assign","m","entry","sortObjectByKey","writeActionManifest","actionManifest","actionManifestJsonPath","actionManifestJsPath","json","deleteCache","writeFileAtomic","loadAppPathsManifest","APP_PATHS_MANIFEST","writeAppPathsManifest","appPathsManifest","mergePagesManifests","appPathsManifestPath","writeWebpackStats","mergeWebpackStats","path","WEBPACK_STATS","writeSriManifest","sriManifest","mergeSriManifests","pathJson","SUBRESOURCE_INTEGRITY_MANIFEST","pathJs","loadBuildManifest","BUILD_MANIFEST","loadClientBuildManifest","TURBOPACK_CLIENT_BUILD_MANIFEST","loadWebpackStats","loadSriManifest","statsFiles","entrypoints","assets","chunks","modules","statsFile","k","v","entries","asset","chunk","id","module","existing","includes","push","version","mergeBuildManifests","lowPriorityFiles","pages","devFiles","polyfillFiles","rootMainFiles","mergeClientBuildManifests","rewrites","sortedPageKeys","__rewrites","sortedPages","writeInterceptionRouteRewriteManifest","devRewrites","productionRewrites","beforeFiles","processRoute","afterFiles","fallback","interceptionRewrites","filter","require","isInterceptionRouteRewrite","interceptionRewriteManifestPath","INTERCEPTION_ROUTE_REWRITE_MANIFEST","writeBuildManifest","buildManifest","buildManifestPath","middlewareBuildManifestPath","MIDDLEWARE_BUILD_MANIFEST","createEdgeRuntimeManifest","fallbackBuildManifest","Boolean","fallbackBuildManifestPath","writeClientBuildManifest","normalizeRewritesForBuildManifest","pagesKeys","keys","global","app","error","getSortedRoutes","CLIENT_STATIC_FILES_PATH","ssgManifestPath","clientBuildManifest","clientBuildManifestJs","srcEmptySsgManifest","loadFontManifest","NEXT_FONT_MANIFEST","mergeFontManifests","appUsingSizeAdjust","pagesUsingSizeAdjust","writeNextFontManifest","fontManifest","fontManifestJsonPath","fontManifestJsPath","loadMiddlewareManifest","middlewareManifestPath","MIDDLEWARE_MANIFEST","getMiddlewareManifest","deleteMiddlewareManifest","mergeMiddlewareManifests","middleware","sortedMiddleware","functions","instrumentation","updateFunctionDefinition","fun","files","concat","matcher","matchers","regexp","safePathToRegexp","originalSource","delimiter","sensitive","strict","source","replaceAll","writeMiddlewareManifest","clientMiddlewareManifestPath","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","middlewareManifest","forEach","startsWith","parsedPage","tryToParsePath","regexStr","Error","clientMiddlewareManifestJs","loadPagesManifest","PAGES_MANIFEST","writePagesManifest","pagesManifest","pagesManifestPath","writeManifests","process","env","TURBOPACK_STATS","obj","sort","reduce","acc"],"mappings":";;;;+BAyLaA;;;eAAAA;;;;2BA3JN;sBACqB;oBACC;8BAED;6BACI;gFACE;0BACS;u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List":[0]}

@@ -26,3 +26,2 @@ import type { Issue, StyledString, TurbopackResult } from '../../../build/swc/types';

export declare function isFileSystemCacheEnabledForDev(config: NextConfigComplete): boolean;
export declare function isFileSystemCacheEnabledForBuild(config: NextConfigComplete): boolean;
export {};

@@ -9,3 +9,2 @@ "use strict";

getIssueKey: null,
isFileSystemCacheEnabledForBuild: null,
isFileSystemCacheEnabledForDev: null,

@@ -33,5 +32,2 @@ isRelevantWarning: null,

},
isFileSystemCacheEnabledForBuild: function() {
return isFileSystemCacheEnabledForBuild;
},
isFileSystemCacheEnabledForDev: function() {

@@ -277,6 +273,3 @@ return isFileSystemCacheEnabledForDev;

}
function isFileSystemCacheEnabledForBuild(config) {
return config.experimental?.turbopackFileSystemCacheForBuild || false;
}
//# sourceMappingURL=utils.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../../src/shared/lib/turbopack/utils.ts"],"sourcesContent":["import type {\n Issue,\n PlainTraceItem,\n StyledString,\n TurbopackResult,\n} from '../../../build/swc/types'\n\nimport { bold, green, magenta, red } from '../../../lib/picocolors'\nimport isInternal from '../is-internal'\nimport { deobfuscateText } from '../magic-identifier'\nimport type { EntryKey } from './entry-key'\nimport * as Log from '../../../build/output/log'\nimport type { NextConfigComplete } from '../../../server/config-shared'\n\ntype IssueKey = `${Issue['severity']}-${Issue['filePath']}-${string}-${string}`\nexport type IssuesMap = Map<IssueKey, Issue>\nexport type EntryIssuesMap = Map<EntryKey, IssuesMap>\nexport type TopLevelIssuesMap = IssuesMap\n\nconst VERBOSE_ISSUES = !!process.env.NEXT_TURBOPACK_VERBOSE_ISSUES\n\n/**\n * An error generated from emitted Turbopack issues. This can include build\n * errors caused by issues with user code.\n */\nexport class ModuleBuildError extends Error {\n name = 'ModuleBuildError'\n}\n\n/**\n * Thin stopgap workaround layer to mimic existing wellknown-errors-plugin in webpack's build\n * to emit certain type of errors into cli.\n */\nexport function isWellKnownError(issue: Issue): boolean {\n const { title } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title)\n // TODO: add more well known errors\n if (\n formattedTitle.includes('Module not found') ||\n formattedTitle.includes('Unknown module type')\n ) {\n return true\n }\n\n return false\n}\n\nexport function getIssueKey(issue: Issue): IssueKey {\n return `${issue.severity}-${issue.filePath}-${JSON.stringify(\n issue.title\n )}-${JSON.stringify(issue.description)}`\n}\n\nexport function processIssues(\n currentEntryIssues: EntryIssuesMap,\n key: EntryKey,\n result: TurbopackResult,\n throwIssue: boolean,\n logErrors: boolean\n) {\n const newIssues = new Map<IssueKey, Issue>()\n currentEntryIssues.set(key, newIssues)\n\n const relevantIssues = new Set()\n\n for (const issue of result.issues) {\n if (\n issue.severity !== 'error' &&\n issue.severity !== 'fatal' &&\n issue.severity !== 'warning'\n )\n continue\n\n const issueKey = getIssueKey(issue)\n newIssues.set(issueKey, issue)\n\n if (issue.severity !== 'warning') {\n if (throwIssue) {\n const formatted = formatIssue(issue)\n relevantIssues.add(formatted)\n }\n // if we throw the issue it will most likely get handed and logged elsewhere\n else if (logErrors && isWellKnownError(issue)) {\n const formatted = formatIssue(issue)\n Log.error(formatted)\n }\n }\n }\n\n if (relevantIssues.size && throwIssue) {\n throw new ModuleBuildError([...relevantIssues].join('\\n\\n'))\n }\n}\n\nexport function formatIssue(issue: Issue) {\n const { filePath, title, description, detail, source, importTraces } = issue\n let { documentationLink } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title).replace(\n /\\n/g,\n '\\n '\n )\n\n // TODO: Use error codes to identify these\n // TODO: Generalize adapting Turbopack errors to Next.js errors\n if (formattedTitle.includes('Module not found')) {\n // For compatiblity with webpack\n // TODO: include columns in webpack errors.\n documentationLink = 'https://nextjs.org/docs/messages/module-not-found'\n }\n\n const formattedFilePath = filePath\n .replace('[project]/', './')\n .replaceAll('/./', '/')\n .replace('\\\\\\\\?\\\\', '')\n\n let message = ''\n\n if (source?.range) {\n const { start } = source.range\n message = `${formattedFilePath}:${start.line + 1}:${\n start.column + 1\n }\\n${formattedTitle}`\n } else if (formattedFilePath) {\n message = `${formattedFilePath}\\n${formattedTitle}`\n } else {\n message = formattedTitle\n }\n message += '\\n'\n\n if (\n source?.range &&\n source.source.content &&\n // ignore Next.js/React internals, as these can often be huge bundled files.\n !isInternal(filePath)\n ) {\n const { start, end } = source.range\n const { codeFrameColumns } =\n require('next/dist/compiled/babel/code-frame') as typeof import('next/dist/compiled/babel/code-frame')\n\n message +=\n codeFrameColumns(\n source.source.content,\n {\n start: {\n line: start.line + 1,\n column: start.column + 1,\n },\n end: {\n line: end.line + 1,\n column: end.column + 1,\n },\n },\n { forceColor: true }\n ).trim() + '\\n\\n'\n }\n\n if (description) {\n if (\n description.type === 'text' &&\n description.value.includes(`Cannot find module 'sass'`)\n ) {\n message +=\n \"To use Next.js' built-in Sass support, you first need to install `sass`.\\n\"\n message += 'Run `npm i sass` or `yarn add sass` inside your workspace.\\n'\n message += '\\nLearn more: https://nextjs.org/docs/messages/install-sass\\n'\n } else {\n message += renderStyledStringToErrorAnsi(description) + '\\n\\n'\n }\n }\n\n // TODO: make it easier to enable this for debugging\n if (VERBOSE_ISSUES && detail) {\n message += renderStyledStringToErrorAnsi(detail) + '\\n\\n'\n }\n\n if (importTraces?.length) {\n // This is the same logic as in turbopack/crates/turbopack-cli-utils/src/issue.rs\n // We end up with multiple traces when the file with the error is reachable from multiple\n // different entry points (e.g. ssr, client)\n message += `Import trace${importTraces.length > 1 ? 's' : ''}:\\n`\n const everyTraceHasADistinctRootLayer =\n new Set(importTraces.map(leafLayerName).filter((l) => l != null)).size ===\n importTraces.length\n for (let i = 0; i < importTraces.length; i++) {\n const trace = importTraces[i]\n const layer = leafLayerName(trace)\n let traceIndent = ' '\n // If this is true, layer must be present\n if (everyTraceHasADistinctRootLayer) {\n message += ` ${layer}:\\n`\n } else {\n if (importTraces.length > 1) {\n // Otherwise use simple 1 based indices to disambiguate\n message += ` #${i + 1}`\n if (layer) {\n message += ` [${layer}]`\n }\n message += ':\\n'\n } else if (layer) {\n message += ` [${layer}]:\\n`\n } else {\n // If there is a single trace and no layer name just don't indent it.\n traceIndent = ' '\n }\n }\n message += formatIssueTrace(trace, traceIndent, !identicalLayers(trace))\n }\n }\n if (documentationLink) {\n message += documentationLink + '\\n\\n'\n }\n return message\n}\n\n/** Returns the first present layer name in the trace */\nfunction leafLayerName(items: PlainTraceItem[]): string | undefined {\n for (const item of items) {\n const layer = item.layer\n if (layer != null) return layer\n }\n return undefined\n}\n\n/**\n * Returns whether or not all items share the same layer.\n * If a layer is absent we ignore it in this analysis\n */\nfunction identicalLayers(items: PlainTraceItem[]): boolean {\n const firstPresentLayer = items.findIndex((t) => t.layer != null)\n if (firstPresentLayer === -1) return true // all layers are absent\n const layer = items[firstPresentLayer].layer\n for (let i = firstPresentLayer + 1; i < items.length; i++) {\n const itemLayer = items[i].layer\n if (itemLayer == null || itemLayer !== layer) {\n return false\n }\n }\n return true\n}\n\nfunction formatIssueTrace(\n items: PlainTraceItem[],\n indent: string,\n printLayers: boolean\n): string {\n return `${items\n .map((item) => {\n let r = indent\n if (item.fsName !== 'project') {\n r += `[${item.fsName}]/`\n } else {\n // This is consistent with webpack's output\n r += './'\n }\n r += item.path\n if (printLayers && item.layer) {\n r += ` [${item.layer}]`\n }\n return r\n })\n .join('\\n')}\\n\\n`\n}\n\nexport function isRelevantWarning(issue: Issue): boolean {\n return issue.severity === 'warning' && !isNodeModulesIssue(issue)\n}\n\nfunction isNodeModulesIssue(issue: Issue): boolean {\n if (issue.severity === 'warning' && issue.stage === 'config') {\n // Override for the externalize issue\n // `Package foo (serverExternalPackages or default list) can't be external`\n if (\n renderStyledStringToErrorAnsi(issue.title).includes(\"can't be external\")\n ) {\n return false\n }\n }\n\n return (\n issue.severity === 'warning' &&\n (issue.filePath.match(/^(?:.*[\\\\/])?node_modules(?:[\\\\/].*)?$/) !== null ||\n // Ignore Next.js itself when running next directly in the monorepo where it is not inside\n // node_modules anyway.\n // TODO(mischnic) prevent matches when this is published to npm\n issue.filePath.startsWith('[project]/packages/next/'))\n )\n}\n\nexport function renderStyledStringToErrorAnsi(string: StyledString): string {\n function applyDeobfuscation(str: string): string {\n // Use shared deobfuscate function and apply magenta color to identifiers\n const deobfuscated = deobfuscateText(str)\n // Color any {...} wrapped identifiers with magenta\n return deobfuscated.replace(/\\{([^}]+)\\}/g, (match) => magenta(match))\n }\n\n switch (string.type) {\n case 'text':\n return applyDeobfuscation(string.value)\n case 'strong':\n return bold(red(applyDeobfuscation(string.value)))\n case 'code':\n return green(applyDeobfuscation(string.value))\n case 'line':\n return string.value.map(renderStyledStringToErrorAnsi).join('')\n case 'stack':\n return string.value.map(renderStyledStringToErrorAnsi).join('\\n')\n default:\n throw new Error('Unknown StyledString type', string)\n }\n}\n\nexport function isFileSystemCacheEnabledForDev(\n config: NextConfigComplete\n): boolean {\n return config.experimental?.turbopackFileSystemCacheForDev || false\n}\n\nexport function isFileSystemCacheEnabledForBuild(\n config: NextConfigComplete\n): boolean {\n return config.experimental?.turbopackFileSystemCacheForBuild || false\n}\n"],"names":["ModuleBuildError","formatIssue","getIssueKey","isFileSystemCacheEnabledForBuild","isFileSystemCacheEnabledForDev","isRelevantWarning","isWellKnownError","processIssues","renderStyledStringToErrorAnsi","VERBOSE_ISSUES","process","env","NEXT_TURBOPACK_VERBOSE_ISSUES","Error","name","issue","title","formattedTitle","includes","severity","filePath","JSON","stringify","description","currentEntryIssues","key","result","throwIssue","logErrors","newIssues","Map","set","relevantIssues","Set","issues","issueKey","formatted","add","Log","error","size","join","detail","source","importTraces","documentationLink","replace","formattedFilePath","replaceAll","message","range","start","line","column","content","isInternal","end","codeFrameColumns","require","forceColor","trim","type","value","length","everyTraceHasADistinctRootLayer","map","leafLayerName","filter","l","i","trace","layer","traceIndent","formatIssueTrace","identicalLayers","items","item","undefined","firstPresentLayer","findIndex","t","itemLayer","indent","printLayers","r","fsName","path","isNodeModulesIssue","stage","match","startsWith","string","applyDeobfuscation","str","deobfuscated","deobfuscateText","magenta","bold","red","green","config","experimental","turbopackFileSystemCache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ACxC,KAAK;YACH,OAAOmC,IAAAA,gBAAI,EAACC,IAAAA,eAAG,EAACN,mBAAmBD,OAAO7B,KAAK;QACjD,KAAK;YACH,OAAOqC,IAAAA,iBAAK,EAACP,mBAAmBD,OAAO7B,KAAK;QAC9C,KAAK;YACH,OAAO6B,OAAO7B,KAAK,CAACG,GAAG,CAACzD,+BAA+BiC,IAAI,CAAC;QAC9D,KAAK;YACH,OAAOkD,OAAO7B,KAAK,CAACG,GAAG,CAACzD,+BAA+BiC,IAAI,CAAC;QAC9D;YACE,MAAM,qBAA8C,CAA9C,IAAI5B,MAAM,6BAA6B8E,SAAvC,qBAAA;uBAAA;4BAAA;8BAAA;YAA6C;IACvD;AACF;AAEO,SAASvF,+BACdgG,MAA0B;IAE1B,OAAOA,OAAOC,YAAY,EAAEC,kCAAkC;AAChE;AAEO,SAASnG,iCACdiG,MAA0B;IAE1B,OAAOA,OAAOC,YAAY,EAAEE,oCAAoC;AAClE","ignoreList":[0]}
{"version":3,"sources":["../../../../src/shared/lib/turbopack/utils.ts"],"sourcesContent":["import type {\n Issue,\n PlainTraceItem,\n StyledString,\n TurbopackResult,\n} from '../../../build/swc/types'\n\nimport { bold, green, magenta, red } from '../../../lib/picocolors'\nimport isInternal from '../is-internal'\nimport { deobfuscateText } from '../magic-identifier'\nimport type { EntryKey } from './entry-key'\nimport * as Log from '../../../build/output/log'\nimport type { NextConfigComplete } from '../../../server/config-shared'\n\ntype IssueKey = `${Issue['severity']}-${Issue['filePath']}-${string}-${string}`\nexport type IssuesMap = Map<IssueKey, Issue>\nexport type EntryIssuesMap = Map<EntryKey, IssuesMap>\nexport type TopLevelIssuesMap = IssuesMap\n\nconst VERBOSE_ISSUES = !!process.env.NEXT_TURBOPACK_VERBOSE_ISSUES\n\n/**\n * An error generated from emitted Turbopack issues. This can include build\n * errors caused by issues with user code.\n */\nexport class ModuleBuildError extends Error {\n name = 'ModuleBuildError'\n}\n\n/**\n * Thin stopgap workaround layer to mimic existing wellknown-errors-plugin in webpack's build\n * to emit certain type of errors into cli.\n */\nexport function isWellKnownError(issue: Issue): boolean {\n const { title } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title)\n // TODO: add more well known errors\n if (\n formattedTitle.includes('Module not found') ||\n formattedTitle.includes('Unknown module type')\n ) {\n return true\n }\n\n return false\n}\n\nexport function getIssueKey(issue: Issue): IssueKey {\n return `${issue.severity}-${issue.filePath}-${JSON.stringify(\n issue.title\n )}-${JSON.stringify(issue.description)}`\n}\n\nexport function processIssues(\n currentEntryIssues: EntryIssuesMap,\n key: EntryKey,\n result: TurbopackResult,\n throwIssue: boolean,\n logErrors: boolean\n) {\n const newIssues = new Map<IssueKey, Issue>()\n currentEntryIssues.set(key, newIssues)\n\n const relevantIssues = new Set()\n\n for (const issue of result.issues) {\n if (\n issue.severity !== 'error' &&\n issue.severity !== 'fatal' &&\n issue.severity !== 'warning'\n )\n continue\n\n const issueKey = getIssueKey(issue)\n newIssues.set(issueKey, issue)\n\n if (issue.severity !== 'warning') {\n if (throwIssue) {\n const formatted = formatIssue(issue)\n relevantIssues.add(formatted)\n }\n // if we throw the issue it will most likely get handed and logged elsewhere\n else if (logErrors && isWellKnownError(issue)) {\n const formatted = formatIssue(issue)\n Log.error(formatted)\n }\n }\n }\n\n if (relevantIssues.size && throwIssue) {\n throw new ModuleBuildError([...relevantIssues].join('\\n\\n'))\n }\n}\n\nexport function formatIssue(issue: Issue) {\n const { filePath, title, description, detail, source, importTraces } = issue\n let { documentationLink } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title).replace(\n /\\n/g,\n '\\n '\n )\n\n // TODO: Use error codes to identify these\n // TODO: Generalize adapting Turbopack errors to Next.js errors\n if (formattedTitle.includes('Module not found')) {\n // For compatiblity with webpack\n // TODO: include columns in webpack errors.\n documentationLink = 'https://nextjs.org/docs/messages/module-not-found'\n }\n\n const formattedFilePath = filePath\n .replace('[project]/', './')\n .replaceAll('/./', '/')\n .replace('\\\\\\\\?\\\\', '')\n\n let message = ''\n\n if (source?.range) {\n const { start } = source.range\n message = `${formattedFilePath}:${start.line + 1}:${\n start.column + 1\n }\\n${formattedTitle}`\n } else if (formattedFilePath) {\n message = `${formattedFilePath}\\n${formattedTitle}`\n } else {\n message = formattedTitle\n }\n message += '\\n'\n\n if (\n source?.range &&\n source.source.content &&\n // ignore Next.js/React internals, as these can often be huge bundled files.\n !isInternal(filePath)\n ) {\n const { start, end } = source.range\n const { codeFrameColumns } =\n require('next/dist/compiled/babel/code-frame') as typeof import('next/dist/compiled/babel/code-frame')\n\n message +=\n codeFrameColumns(\n source.source.content,\n {\n start: {\n line: start.line + 1,\n column: start.column + 1,\n },\n end: {\n line: end.line + 1,\n column: end.column + 1,\n },\n },\n { forceColor: true }\n ).trim() + '\\n\\n'\n }\n\n if (description) {\n if (\n description.type === 'text' &&\n description.value.includes(`Cannot find module 'sass'`)\n ) {\n message +=\n \"To use Next.js' built-in Sass support, you first need to install `sass`.\\n\"\n message += 'Run `npm i sass` or `yarn add sass` inside your workspace.\\n'\n message += '\\nLearn more: https://nextjs.org/docs/messages/install-sass\\n'\n } else {\n message += renderStyledStringToErrorAnsi(description) + '\\n\\n'\n }\n }\n\n // TODO: make it easier to enable this for debugging\n if (VERBOSE_ISSUES && detail) {\n message += renderStyledStringToErrorAnsi(detail) + '\\n\\n'\n }\n\n if (importTraces?.length) {\n // This is the same logic as in turbopack/crates/turbopack-cli-utils/src/issue.rs\n // We end up with multiple traces when the file with the error is reachable from multiple\n // different entry points (e.g. ssr, client)\n message += `Import trace${importTraces.length > 1 ? 's' : ''}:\\n`\n const everyTraceHasADistinctRootLayer =\n new Set(importTraces.map(leafLayerName).filter((l) => l != null)).size ===\n importTraces.length\n for (let i = 0; i < importTraces.length; i++) {\n const trace = importTraces[i]\n const layer = leafLayerName(trace)\n let traceIndent = ' '\n // If this is true, layer must be present\n if (everyTraceHasADistinctRootLayer) {\n message += ` ${layer}:\\n`\n } else {\n if (importTraces.length > 1) {\n // Otherwise use simple 1 based indices to disambiguate\n message += ` #${i + 1}`\n if (layer) {\n message += ` [${layer}]`\n }\n message += ':\\n'\n } else if (layer) {\n message += ` [${layer}]:\\n`\n } else {\n // If there is a single trace and no layer name just don't indent it.\n traceIndent = ' '\n }\n }\n message += formatIssueTrace(trace, traceIndent, !identicalLayers(trace))\n }\n }\n if (documentationLink) {\n message += documentationLink + '\\n\\n'\n }\n return message\n}\n\n/** Returns the first present layer name in the trace */\nfunction leafLayerName(items: PlainTraceItem[]): string | undefined {\n for (const item of items) {\n const layer = item.layer\n if (layer != null) return layer\n }\n return undefined\n}\n\n/**\n * Returns whether or not all items share the same layer.\n * If a layer is absent we ignore it in this analysis\n */\nfunction identicalLayers(items: PlainTraceItem[]): boolean {\n const firstPresentLayer = items.findIndex((t) => t.layer != null)\n if (firstPresentLayer === -1) return true // all layers are absent\n const layer = items[firstPresentLayer].layer\n for (let i = firstPresentLayer + 1; i < items.length; i++) {\n const itemLayer = items[i].layer\n if (itemLayer == null || itemLayer !== layer) {\n return false\n }\n }\n return true\n}\n\nfunction formatIssueTrace(\n items: PlainTraceItem[],\n indent: string,\n printLayers: boolean\n): string {\n return `${items\n .map((item) => {\n let r = indent\n if (item.fsName !== 'project') {\n r += `[${item.fsName}]/`\n } else {\n // This is consistent with webpack's output\n r += './'\n }\n r += item.path\n if (printLayers && item.layer) {\n r += ` [${item.layer}]`\n }\n return r\n })\n .join('\\n')}\\n\\n`\n}\n\nexport function isRelevantWarning(issue: Issue): boolean {\n return issue.severity === 'warning' && !isNodeModulesIssue(issue)\n}\n\nfunction isNodeModulesIssue(issue: Issue): boolean {\n if (issue.severity === 'warning' && issue.stage === 'config') {\n // Override for the externalize issue\n // `Package foo (serverExternalPackages or default list) can't be external`\n if (\n renderStyledStringToErrorAnsi(issue.title).includes(\"can't be external\")\n ) {\n return false\n }\n }\n\n return (\n issue.severity === 'warning' &&\n (issue.filePath.match(/^(?:.*[\\\\/])?node_modules(?:[\\\\/].*)?$/) !== null ||\n // Ignore Next.js itself when running next directly in the monorepo where it is not inside\n // node_modules anyway.\n // TODO(mischnic) prevent matches when this is published to npm\n issue.filePath.startsWith('[project]/packages/next/'))\n )\n}\n\nexport function renderStyledStringToErrorAnsi(string: StyledString): string {\n function applyDeobfuscation(str: string): string {\n // Use shared deobfuscate function and apply magenta color to identifiers\n const deobfuscated = deobfuscateText(str)\n // Color any {...} wrapped identifiers with magenta\n return deobfuscated.replace(/\\{([^}]+)\\}/g, (match) => magenta(match))\n }\n\n switch (string.type) {\n case 'text':\n return applyDeobfuscation(string.value)\n case 'strong':\n return bold(red(applyDeobfuscation(string.value)))\n case 'code':\n return green(applyDeobfuscation(string.value))\n case 'line':\n return string.value.map(renderStyledStringToErrorAnsi).join('')\n case 'stack':\n return string.value.map(renderStyledStringToErrorAnsi).join('\\n')\n default:\n throw new Error('Unknown StyledString type', string)\n }\n}\n\nexport function isFileSystemCacheEnabledForDev(\n config: NextConfigComplete\n): boolean {\n return config.experimental?.turbopackFileSystemCacheForDev || false\n}\n"],"names":["ModuleBuildError","formatIssue","getIssueKey","isFileSystemCacheEnabledForDev","isRelevantWarning","isWellKnownError","processIssues","renderStyledStringToErrorAnsi","VERBOSE_ISSUES","process","env","NEXT_TURBOPACK_VERBOSE_ISSUES","Error","name","issue","title","formattedTitle","includes","severity","filePath","JSON","stringify","description","currentEntryIssues","key","result","throwIssue","logErrors","newIssues","Map","set","relevantIssues","Set","issues","issueKey","formatted","add","Log","error","size","join","detail","source","importTraces","documentationLink","replace","formattedFilePath","replaceAll","message","range","start","line","column","content","isInternal","end","codeFrameColumns","require","forceColor","trim","type","value","length","everyTraceHasADistinctRootLayer","map","leafLayerName","filter","l","i","trace","layer","traceIndent","formatIssueTrace","identicalLayers","items","item","undefined","firstPresentLayer","findIndex","t","itemLayer","indent","printLayers","r","fsName","path","isNodeModulesIssue","stage","match","startsWith","string","applyDeobfuscation","str","deobfuscated","deobfuscateText","magenta","bold","red","green","config","experimental","turbopackFileSystemCacheForDev"],"mappings":";;;;;;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AmBD,OAAO7B,KAAK;QACjD,KAAK;YACH,OAAOqC,IAAAA,iBAAK,EAACP,mBAAmBD,OAAO7B,KAAK;QAC9C,KAAK;YACH,OAAO6B,OAAO7B,KAAK,CAACG,GAAG,CAACzD,+BAA+BiC,IAAI,CAAC;QAC9D,KAAK;YACH,OAAOkD,OAAO7B,KAAK,CAACG,GAAG,CAACzD,+BAA+BiC,IAAI,CAAC;QAC9D;YACE,MAAM,qBAA8C,CAA9C,IAAI5B,MAAM,6BAA6B8E,SAAvC,qBAAA;uBAAA;4BAAA;8BAAA;YAA6C;IACvD;AACF;AAEO,SAASvF,+BACdgG,MAA0B;IAE1B,OAAOA,OAAOC,YAAY,EAAEC,kCAAkC;AAChE","ignoreList":[0]}

@@ -84,3 +84,3 @@ "use strict";

ciName: _ciinfo.isCI && _ciinfo.name || null,
nextVersion: "16.2.0-canary.72"
nextVersion: "16.2.0-canary.73"
};

@@ -87,0 +87,0 @@ return traits;

@@ -14,7 +14,7 @@ "use strict";

// This should be an invariant, if it fails our build tooling is broken.
if (typeof "16.2.0-canary.72" !== 'string') {
if (typeof "16.2.0-canary.73" !== 'string') {
return [];
}
const payload = {
nextVersion: "16.2.0-canary.72",
nextVersion: "16.2.0-canary.73",
nodeVersion: process.version,

@@ -21,0 +21,0 @@ cliCommand: event.cliCommand,

@@ -14,2 +14,2 @@ export type EventSwcLoadFailure = {

};
export declare function eventSwcLoadFailure(event?: EventSwcLoadFailure['payload']): Promise<void>;
export declare function eventSwcLoadFailure(event?: Pick<EventSwcLoadFailure['payload'], 'wasm' | 'nativeBindingsErrorCode'>): Promise<void>;

@@ -41,3 +41,3 @@ "use strict";

payload: {
nextVersion: "16.2.0-canary.72",
nextVersion: "16.2.0-canary.73",
glibcVersion,

@@ -44,0 +44,0 @@ installedSwcPackages,

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../src/telemetry/events/swc-load-failure.ts"],"sourcesContent":["import { traceGlobals } from '../../trace/shared'\nimport type { Telemetry } from '../storage'\n// @ts-ignore JSON\nimport { optionalDependencies } from 'next/package.json'\n\nconst EVENT_PLUGIN_PRESENT = 'NEXT_SWC_LOAD_FAILURE'\nexport type EventSwcLoadFailure = {\n eventName: string\n payload: {\n platform: string\n arch: string\n nodeVersion: string\n nextVersion: string\n wasm?: 'enabled' | 'fallback' | 'failed'\n glibcVersion?: string\n installedSwcPackages?: string\n nativeBindingsErrorCode?: string\n }\n}\n\nexport async function eventSwcLoadFailure(\n event?: EventSwcLoadFailure['payload']\n): Promise<void> {\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n // can't continue if telemetry isn't set\n if (!telemetry) return\n\n let glibcVersion\n let installedSwcPackages\n\n try {\n // @ts-ignore\n glibcVersion = process.report?.getReport().header.glibcVersionRuntime\n } catch {}\n\n try {\n const pkgNames = Object.keys(optionalDependencies || {}).filter((pkg) =>\n pkg.startsWith('@next/swc')\n )\n const installedPkgs = []\n\n for (const pkg of pkgNames) {\n try {\n const { version } = require(`${pkg}/package.json`)\n installedPkgs.push(`${pkg}@${version}`)\n } catch {}\n }\n\n if (installedPkgs.length > 0) {\n installedSwcPackages = installedPkgs.sort().join(',')\n }\n } catch {}\n\n telemetry.record({\n eventName: EVENT_PLUGIN_PRESENT,\n payload: {\n nextVersion: process.env.__NEXT_VERSION as string,\n glibcVersion,\n installedSwcPackages,\n arch: process.arch,\n platform: process.platform,\n nodeVersion: process.versions.node,\n wasm: event?.wasm,\n nativeBindingsErrorCode: event?.nativeBindingsErrorCode,\n },\n })\n // ensure this event is flushed before process exits\n await telemetry.flush()\n}\n"],"names":["eventSwcLoadFailure","EVENT_PLUGIN_PRESENT","event","telemetry","traceGlobals","get","glibcVersion","installedSwcPackages","process","report","getReport","header","glibcVersionRuntime","pkgNames","Object","keys","optionalDependencies","filter","pkg","startsWith","installedPkgs","version","require","push","length","sort","join","record","eventName","payload","nextVersion","env","__NEXT_VERSION","arch","platform","nodeVersion","versions","node","wasm","nativeBindingsErrorCode","flush"],"mappings":";;;;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/events/swc-load-failure.ts"],"sourcesContent":["import { traceGlobals } from '../../trace/shared'\nimport type { Telemetry } from '../storage'\n// @ts-ignore JSON\nimport { optionalDependencies } from 'next/package.json'\n\nconst EVENT_PLUGIN_PRESENT = 'NEXT_SWC_LOAD_FAILURE'\nexport type EventSwcLoadFailure = {\n eventName: string\n payload: {\n platform: string\n arch: string\n nodeVersion: string\n nextVersion: string\n wasm?: 'enabled' | 'fallback' | 'failed'\n glibcVersion?: string\n installedSwcPackages?: string\n nativeBindingsErrorCode?: string\n }\n}\n\nexport async function eventSwcLoadFailure(\n event?: Pick<\n EventSwcLoadFailure['payload'],\n 'wasm' | 'nativeBindingsErrorCode'\n >\n): Promise<void> {\n const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')\n // can't continue if telemetry isn't set\n if (!telemetry) return\n\n let glibcVersion\n let installedSwcPackages\n\n try {\n // @ts-ignore\n glibcVersion = process.report?.getReport().header.glibcVersionRuntime\n } catch {}\n\n try {\n const pkgNames = Object.keys(optionalDependencies || {}).filter((pkg) =>\n pkg.startsWith('@next/swc')\n )\n const installedPkgs = []\n\n for (const pkg of pkgNames) {\n try {\n const { version } = require(`${pkg}/package.json`)\n installedPkgs.push(`${pkg}@${version}`)\n } catch {}\n }\n\n if (installedPkgs.length > 0) {\n installedSwcPackages = installedPkgs.sort().join(',')\n }\n } catch {}\n\n telemetry.record({\n eventName: EVENT_PLUGIN_PRESENT,\n payload: {\n nextVersion: process.env.__NEXT_VERSION as string,\n glibcVersion,\n installedSwcPackages,\n arch: process.arch,\n platform: process.platform,\n nodeVersion: process.versions.node,\n wasm: event?.wasm,\n nativeBindingsErrorCode: event?.nativeBindingsErrorCode,\n },\n })\n // ensure this event is flushed before process exits\n await telemetry.flush()\n}\n"],"names":["eventSwcLoadFailure","EVENT_PLUGIN_PRESENT","event","telemetry","traceGlobals","get","glibcVersion","installedSwcPackages","process","report","getReport","header","glibcVersionRuntime","pkgNames","Object","keys","optionalDependencies","filter","pkg","startsWith","installedPkgs","version","require","push","length","sort","join","record","eventName","payload","nextVersion","env","__NEXT_VERSION","arch","platform","nodeVersion","versions","node","wasm","nativeBindingsErrorCode","flush"],"mappings":";;;;+BAoBsBA;;;eAAAA;;;wBApBO;6BAGQ;AAErC,MAAMC,uBAAuB;AAetB,eAAeD,oBACpBE,KAGC;IAED,MAAMC,YAAmCC,oBAAY,CAACC,GAAG,CAAC;IAC1D,wCAAwC;IACxC,IAAI,CAACF,WAAW;IAEhB,IAAIG;IACJ,IAAIC;IAEJ,IAAI;YAEaC;QADf,aAAa;QACbF,gBAAeE,kBAAAA,QAAQC,MAAM,qBAAdD,gBAAgBE,SAAS,GAAGC,MAAM,CAACC,mBAAmB;IACvE,EAAE,OAAM,CAAC;IAET,IAAI;QACF,MAAMC,WAAWC,OAAOC,IAAI,CAACC,iCAAoB,IAAI,CAAC,GAAGC,MAAM,CAAC,CAACC,MAC/DA,IAAIC,UAAU,CAAC;QAEjB,MAAMC,gBAAgB,EAAE;QAExB,KAAK,MAAMF,OAAOL,SAAU;YAC1B,IAAI;gBACF,MAAM,EAAEQ,OAAO,EAAE,GAAGC,QAAQ,GAAGJ,IAAI,aAAa,CAAC;gBACjDE,cAAcG,IAAI,CAAC,GAAGL,IAAI,CAAC,EAAEG,SAAS;YACxC,EAAE,OAAM,CAAC;QACX;QAEA,IAAID,cAAcI,MAAM,GAAG,GAAG;YAC5BjB,uBAAuBa,cAAcK,IAAI,GAAGC,IAAI,CAAC;QACnD;IACF,EAAE,OAAM,CAAC;IAETvB,UAAUwB,MAAM,CAAC;QACfC,WAAW3B;QACX4B,SAAS;YACPC,aAAatB,QAAQuB,GAAG,CAACC,cAAc;YACvC1B;YACAC;YACA0B,MAAMzB,QAAQyB,IAAI;YAClBC,UAAU1B,QAAQ0B,QAAQ;YAC1BC,aAAa3B,QAAQ4B,QAAQ,CAACC,IAAI;YAClCC,IAAI,EAAEpC,yBAAAA,MAAOoC,IAAI;YACjBC,uBAAuB,EAAErC,yBAAAA,MAAOqC,uBAAuB;QACzD;IACF;IACA,oDAAoD;IACpD,MAAMpC,UAAUqC,KAAK;AACvB","ignoreList":[0]}

@@ -15,3 +15,3 @@ "use strict";

// This should be an invariant, if it fails our build tooling is broken.
if (typeof "16.2.0-canary.72" !== 'string') {
if (typeof "16.2.0-canary.73" !== 'string') {
return [];

@@ -21,3 +21,3 @@ }

const payload = {
nextVersion: "16.2.0-canary.72",
nextVersion: "16.2.0-canary.73",
nodeVersion: process.version,

@@ -24,0 +24,0 @@ cliCommand: event.cliCommand,

{
"name": "next",
"version": "16.2.0-canary.72",
"version": "16.2.0-canary.73",
"description": "The React Framework",

@@ -100,3 +100,3 @@ "main": "./dist/server/next.js",

"dependencies": {
"@next/env": "16.2.0-canary.72",
"@next/env": "16.2.0-canary.73",
"@swc/helpers": "0.5.15",

@@ -132,10 +132,10 @@ "baseline-browser-mapping": "^2.9.19",

"sharp": "^0.34.5",
"@next/swc-darwin-arm64": "16.2.0-canary.72",
"@next/swc-darwin-x64": "16.2.0-canary.72",
"@next/swc-linux-arm64-gnu": "16.2.0-canary.72",
"@next/swc-linux-arm64-musl": "16.2.0-canary.72",
"@next/swc-linux-x64-gnu": "16.2.0-canary.72",
"@next/swc-linux-x64-musl": "16.2.0-canary.72",
"@next/swc-win32-arm64-msvc": "16.2.0-canary.72",
"@next/swc-win32-x64-msvc": "16.2.0-canary.72"
"@next/swc-darwin-arm64": "16.2.0-canary.73",
"@next/swc-darwin-x64": "16.2.0-canary.73",
"@next/swc-linux-arm64-gnu": "16.2.0-canary.73",
"@next/swc-linux-arm64-musl": "16.2.0-canary.73",
"@next/swc-linux-x64-gnu": "16.2.0-canary.73",
"@next/swc-linux-x64-musl": "16.2.0-canary.73",
"@next/swc-win32-arm64-msvc": "16.2.0-canary.73",
"@next/swc-win32-x64-msvc": "16.2.0-canary.73"
},

@@ -175,7 +175,7 @@ "devDependencies": {

"@napi-rs/triples": "1.2.0",
"@next/font": "16.2.0-canary.72",
"@next/polyfill-module": "16.2.0-canary.72",
"@next/polyfill-nomodule": "16.2.0-canary.72",
"@next/react-refresh-utils": "16.2.0-canary.72",
"@next/swc": "16.2.0-canary.72",
"@next/font": "16.2.0-canary.73",
"@next/polyfill-module": "16.2.0-canary.73",
"@next/polyfill-nomodule": "16.2.0-canary.73",
"@next/react-refresh-utils": "16.2.0-canary.73",
"@next/swc": "16.2.0-canary.73",
"@opentelemetry/api": "1.6.0",

@@ -182,0 +182,0 @@ "@playwright/test": "1.51.1",

self.__BUILD_MANIFEST = {
"__rewrites": {
"afterFiles": [],
"beforeFiles": [],
"fallback": []
},
"sortedPages": [
"/_app",
"/_error"
]
};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display