vinext 0.0.54 → 0.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/check.js +15 -3
- package/dist/check.js.map +1 -1
- package/dist/client/navigation-runtime.d.ts +1 -0
- package/dist/client/navigation-runtime.js +1 -1
- package/dist/client/navigation-runtime.js.map +1 -1
- package/dist/config/next-config.d.ts +14 -1
- package/dist/config/next-config.js +24 -4
- package/dist/config/next-config.js.map +1 -1
- package/dist/config/tsconfig-paths.d.ts +12 -3
- package/dist/config/tsconfig-paths.js +55 -24
- package/dist/config/tsconfig-paths.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +2 -1
- package/dist/entries/app-rsc-entry.js +12 -0
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.js +22 -5
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/pages-server-entry.js +41 -4
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/index.js +81 -39
- package/dist/index.js.map +1 -1
- package/dist/plugins/import-meta-url.d.ts +16 -0
- package/dist/plugins/import-meta-url.js +193 -0
- package/dist/plugins/import-meta-url.js.map +1 -0
- package/dist/server/app-browser-action-result.d.ts +9 -16
- package/dist/server/app-browser-action-result.js +25 -14
- package/dist/server/app-browser-action-result.js.map +1 -1
- package/dist/server/app-browser-entry.js +171 -45
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-mpa-navigation.d.ts +16 -0
- package/dist/server/app-browser-mpa-navigation.js +36 -0
- package/dist/server/app-browser-mpa-navigation.js.map +1 -0
- package/dist/server/app-browser-popstate.d.ts +3 -1
- package/dist/server/app-browser-popstate.js +15 -1
- package/dist/server/app-browser-popstate.js.map +1 -1
- package/dist/server/app-browser-state.js +2 -1
- package/dist/server/app-browser-state.js.map +1 -1
- package/dist/server/app-layout-param-observation.d.ts +30 -0
- package/dist/server/app-layout-param-observation.js +130 -0
- package/dist/server/app-layout-param-observation.js.map +1 -0
- package/dist/server/app-page-boundary-render.js +2 -2
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-dispatch.js +1 -1
- package/dist/server/app-page-params.d.ts +2 -1
- package/dist/server/app-page-params.js +14 -1
- package/dist/server/app-page-params.js.map +1 -1
- package/dist/server/app-page-probe.d.ts +12 -1
- package/dist/server/app-page-probe.js +116 -1
- package/dist/server/app-page-probe.js.map +1 -1
- package/dist/server/app-route-handler-response.js +1 -1
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +3 -2
- package/dist/server/app-rsc-cache-busting.js +9 -7
- package/dist/server/app-rsc-cache-busting.js.map +1 -1
- package/dist/server/app-rsc-handler.js +11 -1
- package/dist/server/app-rsc-handler.js.map +1 -1
- package/dist/server/app-segment-config.d.ts +1 -1
- package/dist/server/app-segment-config.js +4 -1
- package/dist/server/app-segment-config.js.map +1 -1
- package/dist/server/app-server-action-execution.d.ts +5 -0
- package/dist/server/app-server-action-execution.js +198 -22
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/artifact-compatibility.d.ts +2 -1
- package/dist/server/artifact-compatibility.js +10 -1
- package/dist/server/artifact-compatibility.js.map +1 -1
- package/dist/server/client-reuse-manifest.d.ts +9 -4
- package/dist/server/client-reuse-manifest.js +2 -1
- package/dist/server/client-reuse-manifest.js.map +1 -1
- package/dist/server/dev-server.js +52 -10
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/document-initial-head.d.ts +7 -0
- package/dist/server/document-initial-head.js +35 -0
- package/dist/server/document-initial-head.js.map +1 -0
- package/dist/server/pages-document-initial-props.d.ts +84 -2
- package/dist/server/pages-document-initial-props.js +127 -1
- package/dist/server/pages-document-initial-props.js.map +1 -1
- package/dist/server/pages-node-compat.js +1 -1
- package/dist/server/pages-page-response.d.ts +14 -0
- package/dist/server/pages-page-response.js +31 -8
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prod-server.js +13 -6
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/skip-cache-proof.d.ts +23 -2
- package/dist/server/skip-cache-proof.js +81 -12
- package/dist/server/skip-cache-proof.js.map +1 -1
- package/dist/server/static-layout-client-reuse-proof.d.ts +16 -0
- package/dist/server/static-layout-client-reuse-proof.js +35 -0
- package/dist/server/static-layout-client-reuse-proof.js.map +1 -0
- package/dist/shims/cache.d.ts +21 -1
- package/dist/shims/cache.js +101 -6
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/document.d.ts +6 -0
- package/dist/shims/document.js +7 -8
- package/dist/shims/document.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +4 -4
- package/dist/shims/error-boundary.js +27 -28
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +3 -1
- package/dist/shims/fetch-cache.js +16 -5
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/hash-scroll.d.ts +4 -1
- package/dist/shims/hash-scroll.js +13 -1
- package/dist/shims/hash-scroll.js.map +1 -1
- package/dist/shims/head-state.d.ts +1 -0
- package/dist/shims/head-state.js +18 -3
- package/dist/shims/head-state.js.map +1 -1
- package/dist/shims/head.d.ts +35 -1
- package/dist/shims/head.js +113 -14
- package/dist/shims/head.js.map +1 -1
- package/dist/shims/internal/pages-data-fetch-dedup.d.ts +56 -0
- package/dist/shims/internal/pages-data-fetch-dedup.js +70 -0
- package/dist/shims/internal/pages-data-fetch-dedup.js.map +1 -0
- package/dist/shims/link.js +28 -2
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/navigation.d.ts +39 -1
- package/dist/shims/navigation.js +61 -13
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/router.js +37 -17
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/thenable-params.d.ts +5 -2
- package/dist/shims/thenable-params.js +25 -1
- package/dist/shims/thenable-params.js.map +1 -1
- package/dist/shims/unified-request-context.js +3 -0
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/utils/client-build-manifest.d.ts +15 -0
- package/dist/utils/client-build-manifest.js +54 -0
- package/dist/utils/client-build-manifest.js.map +1 -0
- package/dist/utils/hash.js +1 -1
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/lazy-chunks.d.ts +1 -1
- package/dist/utils/lazy-chunks.js.map +1 -1
- package/dist/utils/vite-version.d.ts +11 -0
- package/dist/utils/vite-version.js +36 -0
- package/dist/utils/vite-version.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-paths.js","names":[],"sources":["../../src/config/tsconfig-paths.ts"],"sourcesContent":["/**\n * tsconfig.json `compilerOptions.paths` loader.\n *\n * Used to make tsconfig path aliases (e.g. `@/foo` mapping to `./src/foo`)\n * available when vinext loads `next.config.ts
|
|
1
|
+
{"version":3,"file":"tsconfig-paths.js","names":[],"sources":["../../src/config/tsconfig-paths.ts"],"sourcesContent":["/**\n * tsconfig.json `compilerOptions.paths` loader.\n *\n * Used to make tsconfig path aliases (e.g. `@/foo` mapping to `./src/foo`)\n * and `baseUrl` bare imports available when vinext loads `next.config.ts`\n * through Vite's `runnerImport`.\n *\n * Next.js's own `next.config.ts` loader (packages/next/src/build/next-config-ts/\n * transpile-config.ts) reads `compilerOptions.paths` and\n * `compilerOptions.baseUrl` from the project's `tsconfig.json` and passes them\n * to SWC so that imports like\n * `import { foo } from '@/foo'` and `import { bar } from 'bar'` resolve at\n * config load time. We do the same here with Vite resolver settings.\n *\n * The implementation is intentionally minimal:\n * - Static JSON-style parse of tsconfig.json (handles trailing commas /\n * comments via the shared `parseStaticObjectLiteral` helper)\n * - `extends` is followed up to a small recursion depth, with cycle\n * detection — matches the subset Next.js supports\n * - Only the common `\"@/*\": [\"./src/*\"]` / `\"@/*\": [\"src/*\"]` pattern is\n * supported; non-wildcard paths and exact aliases also work\n * - Returned alias values are always absolute paths so they work with\n * `runnerImport`'s inline environment (which has its own root).\n */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { parseStaticObjectLiteral } from \"../plugins/fonts.js\";\n\nconst TSCONFIG_FILES = [\"tsconfig.json\", \"jsconfig.json\"];\n\ntype TsconfigPathResolution = {\n aliases: Record<string, string>;\n baseUrl: string | null;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction resolveTsconfigPathCandidate(candidate: string): string | null {\n const candidates = candidate.endsWith(\".json\")\n ? [candidate]\n : [candidate, `${candidate}.json`, path.join(candidate, \"tsconfig.json\")];\n\n for (const item of candidates) {\n if (fs.existsSync(item) && fs.statSync(item).isFile()) {\n return item;\n }\n }\n\n return null;\n}\n\nfunction resolveTsconfigExtends(configPath: string, specifier: string): string | null {\n const fromDir = path.dirname(configPath);\n if (specifier.startsWith(\".\") || specifier.startsWith(\"/\") || specifier.startsWith(\"\\\\\")) {\n return resolveTsconfigPathCandidate(path.resolve(fromDir, specifier));\n }\n\n const requireFromConfig = createRequire(configPath);\n const candidates = [specifier, `${specifier}.json`, path.join(specifier, \"tsconfig.json\")];\n\n for (const item of candidates) {\n try {\n return requireFromConfig.resolve(item);\n } catch {}\n }\n\n return null;\n}\n\nfunction materializeAliases(\n pathsConfig: Record<string, unknown>,\n baseUrl: string,\n): Record<string, string> {\n const aliases: Record<string, string> = {};\n\n for (const [find, rawTargets] of Object.entries(pathsConfig)) {\n const target = Array.isArray(rawTargets)\n ? rawTargets.find((value): value is string => typeof value === \"string\")\n : typeof rawTargets === \"string\"\n ? rawTargets\n : null;\n if (!target) continue;\n\n if (find.includes(\"*\") || target.includes(\"*\")) {\n // Only support trailing wildcard (the common `\"@/*\": [\"./src/*\"]` form).\n if (!find.endsWith(\"/*\") || !target.endsWith(\"/*\")) continue;\n if (find.indexOf(\"*\") !== find.length - 1 || target.indexOf(\"*\") !== target.length - 1) {\n continue;\n }\n\n const aliasKey = find.slice(0, -2);\n const targetDir = target.slice(0, -2);\n if (!aliasKey || !targetDir) continue;\n\n aliases[aliasKey] = path.resolve(baseUrl, targetDir);\n continue;\n }\n\n aliases[find] = path.resolve(baseUrl, target);\n }\n\n return aliases;\n}\n\nfunction emptyResolution(): TsconfigPathResolution {\n return { aliases: {}, baseUrl: null };\n}\n\nfunction loadResolutionFromTsconfigFile(\n configPath: string,\n seen: Set<string>,\n): TsconfigPathResolution {\n if (seen.has(configPath)) return emptyResolution();\n seen.add(configPath);\n\n let parsed: Record<string, unknown> | null = null;\n try {\n parsed = parseStaticObjectLiteral(fs.readFileSync(configPath, \"utf-8\"));\n } catch {\n return emptyResolution();\n }\n if (!parsed) return emptyResolution();\n\n let resolution = emptyResolution();\n const extendsList = typeof parsed.extends === \"string\" ? [parsed.extends] : [];\n\n for (const extendsSpecifier of extendsList) {\n const extendedPath = resolveTsconfigExtends(configPath, extendsSpecifier);\n if (extendedPath) {\n const parent = loadResolutionFromTsconfigFile(extendedPath, seen);\n resolution = {\n aliases: { ...resolution.aliases, ...parent.aliases },\n baseUrl: parent.baseUrl ?? resolution.baseUrl,\n };\n }\n }\n\n const compilerOptions = isRecord(parsed.compilerOptions) ? parsed.compilerOptions : null;\n const ownBaseUrl =\n compilerOptions && typeof compilerOptions.baseUrl === \"string\"\n ? path.resolve(path.dirname(configPath), compilerOptions.baseUrl)\n : null;\n const baseUrl = ownBaseUrl ?? resolution.baseUrl;\n\n const pathsConfig =\n compilerOptions && isRecord(compilerOptions.paths) ? compilerOptions.paths : null;\n if (!pathsConfig) {\n return {\n aliases: resolution.aliases,\n baseUrl,\n };\n }\n\n const pathsBaseUrl = baseUrl ?? path.dirname(configPath);\n\n return {\n aliases: {\n ...resolution.aliases,\n ...materializeAliases(pathsConfig, pathsBaseUrl),\n },\n baseUrl,\n };\n}\n\n/**\n * Read the project's tsconfig.json (or jsconfig.json) and return its\n * path-resolution settings as absolute paths.\n *\n * Returns an empty resolution if no config is found or no relevant compiler\n * options are configured.\n * Errors during parsing are swallowed — this is a best-effort helper that\n * must not break config loading.\n */\nexport function loadTsconfigResolutionForRoot(projectRoot: string): TsconfigPathResolution {\n for (const name of TSCONFIG_FILES) {\n const candidate = path.join(projectRoot, name);\n if (!fs.existsSync(candidate)) continue;\n return loadResolutionFromTsconfigFile(candidate, new Set());\n }\n return emptyResolution();\n}\n\n/**\n * Back-compat helper for call sites that only need `compilerOptions.paths`.\n */\nexport function loadTsconfigPathAliasesForRoot(projectRoot: string): Record<string, string> {\n return loadTsconfigResolutionForRoot(projectRoot).aliases;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,iBAAiB,CAAC,iBAAiB,gBAAgB;AAOzD,SAAS,SAAS,OAAkD;CAClE,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM;;AAGtE,SAAS,6BAA6B,WAAkC;CACtE,MAAM,aAAa,UAAU,SAAS,QAAQ,GAC1C,CAAC,UAAU,GACX;EAAC;EAAW,GAAG,UAAU;EAAQ,KAAK,KAAK,WAAW,gBAAgB;EAAC;CAE3E,KAAK,MAAM,QAAQ,YACjB,IAAI,GAAG,WAAW,KAAK,IAAI,GAAG,SAAS,KAAK,CAAC,QAAQ,EACnD,OAAO;CAIX,OAAO;;AAGT,SAAS,uBAAuB,YAAoB,WAAkC;CACpF,MAAM,UAAU,KAAK,QAAQ,WAAW;CACxC,IAAI,UAAU,WAAW,IAAI,IAAI,UAAU,WAAW,IAAI,IAAI,UAAU,WAAW,KAAK,EACtF,OAAO,6BAA6B,KAAK,QAAQ,SAAS,UAAU,CAAC;CAGvE,MAAM,oBAAoB,cAAc,WAAW;CACnD,MAAM,aAAa;EAAC;EAAW,GAAG,UAAU;EAAQ,KAAK,KAAK,WAAW,gBAAgB;EAAC;CAE1F,KAAK,MAAM,QAAQ,YACjB,IAAI;EACF,OAAO,kBAAkB,QAAQ,KAAK;SAChC;CAGV,OAAO;;AAGT,SAAS,mBACP,aACA,SAC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BAA+B,cAAc,KAAK;GACjE,aAAa;IACX,SAAS;KAAE,GAAG,WAAW;KAAS,GAAG,OAAO;KAAS;IACrD,SAAS,OAAO,WAAW,WAAW;IACvC;;;CAIL,MAAM,kBAAkB,SAAS,OAAO,gBAAgB,GAAG,OAAO,kBAAkB;CAKpF,MAAM,WAHJ,mBAAmB,OAAO,gBAAgB,YAAY,WAClD,KAAK,QAAQ,KAAK,QAAQ,WAAW,EAAE,gBAAgB,QAAQ,GAC/D,SACwB,WAAW;CAEzC,MAAM,cACJ,mBAAmB,SAAS,gBAAgB,MAAM,GAAG,gBAAgB,QAAQ;CAC/E,IAAI,CAAC,aACH,OAAO;EACL,SAAS,WAAW;EACpB;EACD;CAGH,MAAM,eAAe,WAAW,KAAK,QAAQ,WAAW;CAExD,OAAO;EACL,SAAS;GACP,GAAG,WAAW;GACd,GAAG,mBAAmB,aAAa,aAAa;GACjD;EACD;EACD;;;;;;;;;;;AAYH,SAAgB,8BAA8B,aAA6C;CACzF,KAAK,MAAM,QAAQ,gBAAgB;EACjC,MAAM,YAAY,KAAK,KAAK,aAAa,KAAK;EAC9C,IAAI,CAAC,GAAG,WAAW,UAAU,EAAE;EAC/B,OAAO,+BAA+B,2BAAW,IAAI,KAAK,CAAC;;CAE7D,OAAO,iBAAiB;;;;;AAM1B,SAAgB,+BAA+B,aAA6C;CAC1F,OAAO,8BAA8B,YAAY,CAAC"}
|
|
@@ -34,7 +34,8 @@ type AppRouterConfig = {
|
|
|
34
34
|
* @see https://nextjs.org/docs/app/api-reference/config/next-config-js/assetPrefix
|
|
35
35
|
*/
|
|
36
36
|
assetPrefix?: string; /** Route-level expire fallback in seconds for ISR entries with numeric revalidate. */
|
|
37
|
-
expireTime?: number; /**
|
|
37
|
+
expireTime?: number; /** Maximum in-memory cache size in bytes. 0 disables the default memory cache. */
|
|
38
|
+
cacheMaxMemorySize?: number; /** Inline app CSS into production HTML (from experimental.inlineCss). */
|
|
38
39
|
inlineCss?: boolean; /** Internationalization routing config for middleware matcher locale handling. */
|
|
39
40
|
i18n?: NextI18nConfig | null;
|
|
40
41
|
/**
|
|
@@ -66,6 +66,7 @@ function generateRscEntry(appDir, routes, middlewarePath, metadataRoutes, global
|
|
|
66
66
|
const clientTraceMetadata = config?.clientTraceMetadata;
|
|
67
67
|
const assetPrefix = config?.assetPrefix ?? "";
|
|
68
68
|
const expireTime = config?.expireTime ?? DEFAULT_EXPIRE_TIME;
|
|
69
|
+
const cacheMaxMemorySize = config?.cacheMaxMemorySize;
|
|
69
70
|
const inlineCss = config?.inlineCss === true;
|
|
70
71
|
const i18nConfig = config?.i18n ?? null;
|
|
71
72
|
const hasPagesDir = config?.hasPagesDir ?? false;
|
|
@@ -98,6 +99,7 @@ import { createRscRenderer } from ${JSON.stringify(rscStreamHintsPath)};
|
|
|
98
99
|
const renderToReadableStream = createRscRenderer(_renderToReadableStream);
|
|
99
100
|
import { createElement } from "react";
|
|
100
101
|
import { getNavigationContext as _getNavigationContext } from "next/navigation";
|
|
102
|
+
import { configureMemoryCacheHandler as __configureMemoryCacheHandler } from "next/cache";
|
|
101
103
|
import { headersContextFromRequest, getDraftModeCookieHeader, getAndClearPendingCookies, consumeDynamicUsage, consumeInvalidDynamicUsageError, setHeadersAccessPhase } from "next/headers";
|
|
102
104
|
import { mergeMetadata, resolveModuleMetadata, mergeViewport, resolveModuleViewport } from "vinext/metadata";
|
|
103
105
|
${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};` : ""}
|
|
@@ -179,6 +181,8 @@ ${hasPagesDir ? `// Pages Router routes are loaded lazily from the SSR environme
|
|
|
179
181
|
// so per-route dispatch can opt into suppression via .run(true, ...).
|
|
180
182
|
import { suppressHookWarningAls } from ${JSON.stringify(appHookWarningSuppressionPath)};
|
|
181
183
|
import { clearAppRequestContext as __clearRequestContext, setAppNavigationContext as setNavigationContext } from ${JSON.stringify(appRequestContextPath)};
|
|
184
|
+
|
|
185
|
+
__configureMemoryCacheHandler({ cacheMaxMemorySize: ${JSON.stringify(cacheMaxMemorySize)} });
|
|
182
186
|
import { createAppPrerenderStaticParamsResolver as __createAppPrerenderStaticParamsResolver } from ${JSON.stringify(appPrerenderStaticParamsPath)};
|
|
183
187
|
import { seedMemoryCacheFromPrerender as __seedMemoryCacheFromPrerender } from ${JSON.stringify(seedCachePath)};
|
|
184
188
|
|
|
@@ -218,6 +222,13 @@ function __resolveRouteFetchCacheMode(route) {
|
|
|
218
222
|
});
|
|
219
223
|
}
|
|
220
224
|
|
|
225
|
+
function __resolveRouteRuntime(route) {
|
|
226
|
+
return __resolveAppPageSegmentConfig({
|
|
227
|
+
layouts: route.layouts,
|
|
228
|
+
page: route.page,
|
|
229
|
+
}).runtime ?? null;
|
|
230
|
+
}
|
|
231
|
+
|
|
221
232
|
${imports.join("\n")}
|
|
222
233
|
|
|
223
234
|
${instrumentationPath ? `// Lazy instrumentation initialisation is handled by ensureInstrumentationRegistered
|
|
@@ -692,6 +703,7 @@ export default __createAppRscHandler({
|
|
|
692
703
|
readFormDataWithLimit: __readFormDataWithLimit,
|
|
693
704
|
renderToReadableStream,
|
|
694
705
|
reportRequestError: _reportRequestError,
|
|
706
|
+
resolveRouteRuntime: __resolveRouteRuntime,
|
|
695
707
|
request,
|
|
696
708
|
sanitizeErrorForClient(error) {
|
|
697
709
|
return __sanitizeErrorForClient(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-rsc-entry.js","names":[],"sources":["../../src/entries/app-rsc-entry.ts"],"sourcesContent":["/**\n * App Router RSC entry generator.\n *\n * Generates the virtual RSC entry module for the App Router.\n * The RSC entry does route matching and renders the component tree,\n * then delegates to the SSR entry for HTML generation.\n *\n * Previously housed in server/app-dev-server.ts.\n */\nimport { randomUUID } from \"node:crypto\";\nimport { buildAppRscManifestCode } from \"./app-rsc-manifest.js\";\nimport { resolveEntryPath } from \"./runtime-entry-module.js\";\nimport { normalizePathSeparators } from \"../utils/path.js\";\nimport type {\n NextHeader,\n NextI18nConfig,\n NextRedirect,\n NextRewrite,\n} from \"../config/next-config.js\";\nimport type { AppRoute } from \"../routing/app-router.js\";\nimport { generateDevOriginCheckCode } from \"../server/dev-origin-check.js\";\nimport type { MetadataFileRoute } from \"../server/metadata-routes.js\";\nimport { isProxyFile } from \"../server/middleware.js\";\n\nconst DEFAULT_EXPIRE_TIME = 31_536_000;\n\n// Pre-computed absolute paths for generated-code imports. The virtual RSC\n// entry can't use relative imports (it has no real file location), so we\n// resolve these at code-generation time and embed them as absolute paths.\nconst middlewareRequestHeadersPath = resolveEntryPath(\n \"../server/middleware-request-headers.js\",\n import.meta.url,\n);\nconst normalizePathModulePath = resolveEntryPath(\"../server/normalize-path.js\", import.meta.url);\nconst appRscHandlerPath = resolveEntryPath(\"../server/app-rsc-handler.js\", import.meta.url);\nconst appRouteHandlerDispatchPath = resolveEntryPath(\n \"../server/app-route-handler-dispatch.js\",\n import.meta.url,\n);\nconst appRouteHandlerResponsePath = resolveEntryPath(\n \"../server/app-route-handler-response.js\",\n import.meta.url,\n);\nconst appServerActionExecutionPath = resolveEntryPath(\n \"../server/app-server-action-execution.js\",\n import.meta.url,\n);\nconst appRscErrorsPath = resolveEntryPath(\"../server/app-rsc-errors.js\", import.meta.url);\nconst appPageExecutionPath = resolveEntryPath(\"../server/app-page-execution.js\", import.meta.url);\nconst appFallbackRendererPath = resolveEntryPath(\n \"../server/app-fallback-renderer.js\",\n import.meta.url,\n);\nconst appElementsPath = resolveEntryPath(\"../server/app-elements.js\", import.meta.url);\nconst appPageRouteWiringPath = resolveEntryPath(\n \"../server/app-page-route-wiring.js\",\n import.meta.url,\n);\nconst appPageProbePath = resolveEntryPath(\"../server/app-page-probe.js\", import.meta.url);\nconst appPageParamsPath = resolveEntryPath(\"../server/app-page-params.js\", import.meta.url);\nconst appPageDispatchPath = resolveEntryPath(\"../server/app-page-dispatch.js\", import.meta.url);\nconst appPageRequestPath = resolveEntryPath(\"../server/app-page-request.js\", import.meta.url);\nconst appSegmentConfigPath = resolveEntryPath(\"../server/app-segment-config.js\", import.meta.url);\nconst appRscRouteMatchingPath = resolveEntryPath(\n \"../server/app-rsc-route-matching.js\",\n import.meta.url,\n);\nconst rscStreamHintsPath = resolveEntryPath(\"../server/rsc-stream-hints.js\", import.meta.url);\nconst isrCachePath = resolveEntryPath(\"../server/isr-cache.js\", import.meta.url);\nconst thenableParamsShimPath = resolveEntryPath(\"../shims/thenable-params.js\", import.meta.url);\nconst appPageElementBuilderPath = resolveEntryPath(\n \"../server/app-page-element-builder.js\",\n import.meta.url,\n);\nconst instrumentationRuntimePath = resolveEntryPath(\n \"../server/instrumentation-runtime.js\",\n import.meta.url,\n);\nconst appRscErrorHandlerPath = resolveEntryPath(\n \"../server/app-rsc-error-handler.js\",\n import.meta.url,\n);\nconst appRequestContextPath = resolveEntryPath(\"../server/app-request-context.js\", import.meta.url);\nconst appPrerenderStaticParamsPath = resolveEntryPath(\n \"../server/app-prerender-static-params.js\",\n import.meta.url,\n);\nconst seedCachePath = resolveEntryPath(\"../server/seed-cache.js\", import.meta.url);\nconst appHookWarningSuppressionPath = resolveEntryPath(\n \"../server/app-hook-warning-suppression.js\",\n import.meta.url,\n);\nconst serverGlobalsPath = resolveEntryPath(\"../server/server-globals.js\", import.meta.url);\n\n/**\n * Resolved config options relevant to App Router request handling.\n * Passed from the Vite plugin where the full next.config.js is loaded.\n */\ntype AppRouterConfig = {\n redirects?: NextRedirect[];\n rewrites?: {\n beforeFiles: NextRewrite[];\n afterFiles: NextRewrite[];\n fallback: NextRewrite[];\n };\n headers?: NextHeader[];\n /** Extra origins allowed for server action CSRF checks (from experimental.serverActions.allowedOrigins). */\n allowedOrigins?: string[];\n /** Extra origins allowed for dev server access (from allowedDevOrigins). */\n allowedDevOrigins?: string[];\n /** Body size limit for server actions in bytes (from experimental.serverActions.bodySizeLimit). */\n bodySizeLimit?: number;\n /** Serialized next.config htmlLimitedBots regexp source. */\n htmlLimitedBots?: string;\n /**\n * Allow-list of keys (from `experimental.clientTraceMetadata`) to surface\n * from the active OpenTelemetry context as `<meta>` tags in the SSR head.\n * Undefined or empty disables emission entirely.\n */\n clientTraceMetadata?: string[] | undefined;\n /**\n * Resolved `assetPrefix` from next.config. Empty string when unset.\n * Embedded in the generated entry so the App Router prod-server reads\n * it from the imported module instead of a sidecar JSON file —\n * matches how the Pages Router entry exposes `vinextConfig.assetPrefix`.\n *\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/assetPrefix\n */\n assetPrefix?: string;\n /** Route-level expire fallback in seconds for ISR entries with numeric revalidate. */\n expireTime?: number;\n /** Inline app CSS into production HTML (from experimental.inlineCss). */\n inlineCss?: boolean;\n /** Internationalization routing config for middleware matcher locale handling. */\n i18n?: NextI18nConfig | null;\n /**\n * Absolute path to `app/global-not-found.{tsx,ts,js,jsx}` when present.\n * When provided, route-miss 404s render this module standalone (it owns its\n * own `<html>` and `<body>`) instead of wrapping the regular `not-found.tsx`\n * boundary inside the root layout. Mirrors Next.js 16's\n * `experimental.globalNotFound` behavior.\n * @see https://github.com/vercel/next.js/blob/canary/test/e2e/app-dir/global-not-found\n */\n globalNotFoundPath?: string | null;\n /**\n * When true, the project has a `pages/` directory alongside the App Router.\n * The generated RSC entry exposes `/__vinext/prerender/pages-static-paths`\n * so `prerenderPages` can call `getStaticPaths` via `wrangler unstable_startWorker`\n * in CF Workers builds. `pageRoutes` is loaded from the SSR environment via\n * `import(\"./ssr/index.js\")`, which re-exports it from\n * `virtual:vinext-server-entry` when this flag is set.\n */\n hasPagesDir?: boolean;\n /** Exact public/ file routes, using normalized leading-slash pathnames. */\n publicFiles?: string[];\n /** Server-only token used to validate the draft-mode bypass cookie. */\n draftModeSecret?: string;\n};\n\n/**\n * Generate the virtual RSC entry module.\n *\n * This runs in the `rsc` Vite environment (react-server condition).\n * It matches the incoming request URL to an app route, builds the\n * nested layout + page tree, and renders it to an RSC stream.\n */\nexport function generateRscEntry(\n appDir: string,\n routes: AppRoute[],\n middlewarePath?: string | null,\n metadataRoutes?: MetadataFileRoute[],\n globalErrorPath?: string | null,\n basePath?: string,\n trailingSlash?: boolean,\n config?: AppRouterConfig,\n instrumentationPath?: string | null,\n): string {\n const bp = basePath ?? \"\";\n const ts = trailingSlash ?? false;\n const redirects = config?.redirects ?? [];\n const rewrites = config?.rewrites ?? { beforeFiles: [], afterFiles: [], fallback: [] };\n const headers = config?.headers ?? [];\n const allowedOrigins = config?.allowedOrigins ?? [];\n const bodySizeLimit = config?.bodySizeLimit ?? 1 * 1024 * 1024;\n const htmlLimitedBots = config?.htmlLimitedBots;\n const clientTraceMetadata = config?.clientTraceMetadata;\n const assetPrefix = config?.assetPrefix ?? \"\";\n const expireTime = config?.expireTime ?? DEFAULT_EXPIRE_TIME;\n const inlineCss = config?.inlineCss === true;\n const i18nConfig = config?.i18n ?? null;\n const hasPagesDir = config?.hasPagesDir ?? false;\n const publicFiles = config?.publicFiles ?? [];\n const draftModeSecret = config?.draftModeSecret ?? randomUUID();\n const manifestCode = buildAppRscManifestCode({\n routes,\n metadataRoutes,\n globalErrorPath,\n globalNotFoundPath: config?.globalNotFoundPath ?? null,\n });\n const {\n imports,\n routeEntries,\n metaRouteEntries,\n generateStaticParamsEntries,\n rootParamNameEntries,\n rootNotFoundVar,\n rootForbiddenVar,\n rootUnauthorizedVar,\n rootLayoutVars,\n globalErrorVar,\n globalNotFoundImportSpecifier,\n } = manifestCode;\n const loadPrerenderPagesRoutesCode = hasPagesDir\n ? `\nasync function __loadPrerenderPagesRoutes() {\n const __gspSsrEntry = await import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n return __gspSsrEntry.pageRoutes;\n}\n`\n : \"\";\n\n return `\nimport ${JSON.stringify(serverGlobalsPath)};\nimport {\n renderToReadableStream as _renderToReadableStream,\n decodeAction,\n decodeFormState,\n decodeReply,\n loadServerAction,\n createTemporaryReferenceSet,\n} from \"@vitejs/plugin-rsc/rsc\";\nimport { createRscRenderer } from ${JSON.stringify(rscStreamHintsPath)};\n\nconst renderToReadableStream = createRscRenderer(_renderToReadableStream);\nimport { createElement } from \"react\";\nimport { getNavigationContext as _getNavigationContext } from \"next/navigation\";\nimport { headersContextFromRequest, getDraftModeCookieHeader, getAndClearPendingCookies, consumeDynamicUsage, consumeInvalidDynamicUsageError, setHeadersAccessPhase } from \"next/headers\";\nimport { mergeMetadata, resolveModuleMetadata, mergeViewport, resolveModuleViewport } from \"vinext/metadata\";\n${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};` : \"\"}\n${\n instrumentationPath\n ? `import * as _instrumentation from ${JSON.stringify(normalizePathSeparators(instrumentationPath))};\nimport { ensureInstrumentationRegistered as __ensureInstrumentationRegistered } from ${JSON.stringify(instrumentationRuntimePath)};`\n : \"\"\n}\nimport { createAppRscHandler as __createAppRscHandler } from ${JSON.stringify(appRscHandlerPath)};\nimport { decodePathParams as __decodePathParams } from ${JSON.stringify(normalizePathModulePath)};\nimport { buildRequestHeadersFromMiddlewareResponse as __buildRequestHeadersFromMiddlewareResponse } from ${JSON.stringify(middlewareRequestHeadersPath)};\nimport {\n dispatchAppRouteHandler as __dispatchAppRouteHandler,\n} from ${JSON.stringify(appRouteHandlerDispatchPath)};\nimport {\n applyRouteHandlerMiddlewareContext as __applyRouteHandlerMiddlewareContext,\n} from ${JSON.stringify(appRouteHandlerResponsePath)};\nimport {\n handleProgressiveServerActionRequest as __handleProgressiveServerActionRequest,\n handleServerActionRscRequest as __handleServerActionRscRequest,\n readActionBodyWithLimit as __readBodyWithLimit,\n readActionFormDataWithLimit as __readFormDataWithLimit,\n} from ${JSON.stringify(appServerActionExecutionPath)};\nimport {\n sanitizeErrorForClient as __sanitizeErrorForClient,\n} from ${JSON.stringify(appRscErrorsPath)};\nimport { createAppRscOnErrorHandler } from ${JSON.stringify(appRscErrorHandlerPath)};\nimport {\n buildAppPageFontLinkHeader as __buildAppPageFontLinkHeader,\n resolveAppPageSpecialError as __resolveAppPageSpecialError,\n} from ${JSON.stringify(appPageExecutionPath)};\nimport {\n createAppFallbackRenderer as __createAppFallbackRenderer,\n} from ${JSON.stringify(appFallbackRendererPath)};\nimport {\n AppElementsWire as __AppElementsWire,\n} from ${JSON.stringify(appElementsPath)};\nimport {\n resolveAppPageChildSegments as __resolveAppPageChildSegments,\n} from ${JSON.stringify(appPageRouteWiringPath)};\nimport { buildPageElements as __buildPageElements } from ${JSON.stringify(appPageElementBuilderPath)};\nimport {\n resolveAppPageSegmentParams as __resolveAppPageSegmentParams,\n} from ${JSON.stringify(appPageParamsPath)};\nimport { probeAppPage as __probeAppPage } from ${JSON.stringify(appPageProbePath)};\nimport {\n dispatchAppPage as __dispatchAppPage,\n} from ${JSON.stringify(appPageDispatchPath)};\nimport {\n resolveAppPageGenerateStaticParamsSources as __resolveAppPageGenerateStaticParamsSources,\n} from ${JSON.stringify(appPageRequestPath)};\nimport {\n isEdgeRuntime as __isEdgeRuntime,\n resolveAppPageFetchCacheMode as __resolveAppPageFetchCacheMode,\n resolveAppPageSegmentConfig as __resolveAppPageSegmentConfig,\n} from ${JSON.stringify(appSegmentConfigPath)};\nimport { makeThenableParams } from ${JSON.stringify(thenableParamsShimPath)};\nimport {\n createAppRscRouteMatcher as __createAppRscRouteMatcher,\n} from ${JSON.stringify(appRscRouteMatchingPath)};\nimport {\n appIsrHtmlKey as __isrHtmlKey,\n appIsrRscKey as __isrRscKey,\n appIsrRouteKey as __isrRouteKey,\n isrGet as __isrGet,\n isrSet as __isrSet,\n isrSetPrerenderedAppPage as __isrSetPrerenderedAppPage,\n triggerBackgroundRegeneration as __triggerBackgroundRegeneration,\n} from ${JSON.stringify(isrCachePath)};\n// Import server-only state module to register ALS-backed accessors.\nimport \"vinext/navigation-state\";\nimport { reportRequestError as _reportRequestError } from \"vinext/instrumentation\";\nimport { getSSRFontLinks as _getSSRFontLinks, getSSRFontStyles as _getSSRFontStylesGoogle, getSSRFontPreloads as _getSSRFontPreloadsGoogle } from \"next/font/google\";\nimport { getSSRFontStyles as _getSSRFontStylesLocal, getSSRFontPreloads as _getSSRFontPreloadsLocal } from \"next/font/local\";\nfunction _getSSRFontStyles() { return [..._getSSRFontStylesGoogle(), ..._getSSRFontStylesLocal()]; }\nfunction _getSSRFontPreloads() { return [..._getSSRFontPreloadsGoogle(), ..._getSSRFontPreloadsLocal()]; }\n${hasPagesDir ? `// Pages Router routes are loaded lazily from the SSR environment for internal prerender requests.` : \"\"}\n\n// Suppress expected \"Invalid hook call\" dev warning when layout/page\n// components are probed outside React's render cycle. The import patches\n// console.error once at module load (side-effect) and exposes the ALS\n// so per-route dispatch can opt into suppression via .run(true, ...).\nimport { suppressHookWarningAls } from ${JSON.stringify(appHookWarningSuppressionPath)};\nimport { clearAppRequestContext as __clearRequestContext, setAppNavigationContext as setNavigationContext } from ${JSON.stringify(appRequestContextPath)};\nimport { createAppPrerenderStaticParamsResolver as __createAppPrerenderStaticParamsResolver } from ${JSON.stringify(appPrerenderStaticParamsPath)};\nimport { seedMemoryCacheFromPrerender as __seedMemoryCacheFromPrerender } from ${JSON.stringify(seedCachePath)};\n\nconst __draftModeSecret = ${JSON.stringify(draftModeSecret)};\n\n// Note: cache entries are written with \\`headers: undefined\\`. Next.js stores\n// response headers (e.g. set-cookie from cookies().set() during render) in the\n// cache entry so they can be replayed on HIT. We don't do this because:\n// 1. Pages that call cookies().set() during render trigger dynamicUsedDuringRender,\n// which opts them out of ISR caching before we reach the write path.\n// 2. Custom response headers set via next/headers are not yet captured separately\n// from the live Response object in vinext's server pipeline.\n// In practice this means ISR-cached responses won't replay render-time set-cookie\n// headers — but that case is already prevented by the dynamic-usage opt-out.\n// TODO: capture render-time response headers for full Next.js parity.\n// Verbose cache logging — opt in with NEXT_PRIVATE_DEBUG_CACHE=1.\n// Matches the env var Next.js uses for its own cache debug output so operators\n// have a single knob for all cache tracing.\nconst __isrDebug = process.env.NEXT_PRIVATE_DEBUG_CACHE\n ? console.debug.bind(console, \"[vinext] ISR:\")\n : undefined;\n\n// Classification debug — opt in with VINEXT_DEBUG_CLASSIFICATION=1. Gated on\n// the env var so the hot path pays no overhead unless an operator is actively\n// tracing why a layout was flagged static or dynamic. The reason payload is\n// carried by __VINEXT_CLASS_REASONS and consumed inside probeAppPageLayouts.\nconst __classDebug = process.env.VINEXT_DEBUG_CLASSIFICATION\n ? function(layoutId, reason) {\n console.debug(\"[vinext] CLS:\", layoutId, reason);\n }\n : undefined;\n\nfunction __resolveRouteFetchCacheMode(route) {\n return __resolveAppPageFetchCacheMode({\n layouts: route.layouts,\n page: route.page,\n });\n}\n\n${imports.join(\"\\n\")}\n\n${\n instrumentationPath\n ? `// Lazy instrumentation initialisation is handled by ensureInstrumentationRegistered\n// (imported from vinext/instrumentation-runtime). The generated entry only passes\n// the user module in; all bookkeeping (initialized flag, shared promise, prerender\n// skip) lives in the typed helper so it can be unit-tested independently.`\n : \"\"\n}\n\n// Build-time layout classification dispatch. Replaced in generateBundle\n// with a switch statement that returns a pre-computed per-layout\n// Map<layoutIndex, \"static\" | \"dynamic\"> for each route. Until the\n// plugin patches this stub, every route falls back to the Layer 3\n// runtime probe, which is the current (slow) behaviour.\nfunction __VINEXT_CLASS(routeIdx) {\n return null;\n}\n\n// Build-time layout classification reasons dispatch. Sibling of\n// __VINEXT_CLASS, returning a per-route Map<layoutIndex, ClassificationReason>\n// that feeds the debug channel when VINEXT_DEBUG_CLASSIFICATION is active.\n// Replaced in generateBundle with a real dispatch table; the stub returns\n// null so the hot path never allocates reason maps when debug is off.\nfunction __VINEXT_CLASS_REASONS(routeIdx) {\n return null;\n}\n\nconst routes = [\n${routeEntries.join(\",\\n\")}\n];\nconst __routeMatcher = __createAppRscRouteMatcher(routes);\n\nconst metadataRoutes = [\n${metaRouteEntries.join(\",\\n\")}\n];\n\n// Hoisted ahead of __fallbackRenderer / buildPageElements so both can thread\n// the configured basePath through file-based metadata href emission.\n// Re-exported so the Cloudflare worker entry can strip basePath before\n// recognising /_next/static/* paths (parity with __assetPrefix below).\nexport const __basePath = ${JSON.stringify(bp)};\n\nconst rootNotFoundModule = ${rootNotFoundVar ? rootNotFoundVar : \"null\"};\nconst rootForbiddenModule = ${rootForbiddenVar ? rootForbiddenVar : \"null\"};\nconst rootUnauthorizedModule = ${rootUnauthorizedVar ? rootUnauthorizedVar : \"null\"};\nconst rootLayouts = [${rootLayoutVars.join(\", \")}];\n// Root-level app/global-not-found loader. When present, route-miss 404s render\n// this module standalone (it provides its own html/body) instead of wrapping\n// the not-found.tsx boundary inside the root layout. Page-triggered notFound()\n// calls still use the regular not-found.tsx boundary inside the layouts.\n//\n// The module is loaded via dynamic \\`import()\\` (not a static \\`import * as\\`)\n// so the bundler emits it in its own JS+CSS chunk. Without that isolation,\n// global-not-found's CSS gets concatenated with the root layout's CSS into a\n// single file, where the CSS minifier (lightningcss) drops overlapping\n// declarations as dead code — breaking the cascade for route-miss 404s.\n// See https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/app-render.tsx#L495-L520\n// See Next.js test: test/e2e/app-dir/initial-css-order/initial-css-order.test.ts\nconst __loadGlobalNotFoundModule = ${\n globalNotFoundImportSpecifier ? `() => import(${globalNotFoundImportSpecifier})` : \"null\"\n };\n\nconst createRscOnErrorHandler = (request, pathname, routePath) =>\n createAppRscOnErrorHandler(_reportRequestError, request, pathname, routePath);\n\nconst __fallbackRenderer = __createAppFallbackRenderer({\n basePath: __basePath,\n rootBoundaries: {\n rootForbiddenModule,\n rootLayouts,\n rootNotFoundModule,\n rootUnauthorizedModule,\n },\n globalErrorModule: ${globalErrorVar ? globalErrorVar : \"null\"},\n loadGlobalNotFoundModule: __loadGlobalNotFoundModule,\n metadataRoutes,\n ssrLoader() {\n return import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n },\n fontProviders: {\n buildFontLinkHeader: __buildAppPageFontLinkHeader,\n getFontLinks: _getSSRFontLinks,\n getFontPreloads: _getSSRFontPreloads,\n getFontStyles: _getSSRFontStyles,\n },\n makeThenableParams,\n sanitizer: __sanitizeErrorForClient,\n rscRenderer: renderToReadableStream,\n getNavigationContext: _getNavigationContext,\n resolveChildSegments: __resolveAppPageChildSegments,\n clearRequestContext() {\n __clearRequestContext();\n },\n createRscOnErrorHandler(request, pathname, routePath) {\n return createRscOnErrorHandler(request, pathname, routePath);\n },\n});\n\nfunction matchRoute(url) {\n return __routeMatcher.matchRoute(url);\n}\n\n/**\n * Check if a pathname matches any intercepting route.\n * Returns the match info or null.\n */\nfunction findIntercept(pathname, sourcePathname = null) {\n return __routeMatcher.findIntercept(pathname, sourcePathname);\n}\n\nasync function buildPageElements(route, params, routePath, pageRequest) {\n return __buildPageElements({\n route,\n params,\n routePath,\n pageRequest,\n globalErrorModule: ${globalErrorVar ? globalErrorVar : \"null\"},\n rootNotFoundModule: ${rootNotFoundVar ? rootNotFoundVar : \"null\"},\n rootForbiddenModule: ${rootForbiddenVar ? rootForbiddenVar : \"null\"},\n rootUnauthorizedModule: ${rootUnauthorizedVar ? rootUnauthorizedVar : \"null\"},\n metadataRoutes,\n basePath: __basePath,\n htmlLimitedBots: __htmlLimitedBots,\n });\n}\n\nconst __trailingSlash = ${JSON.stringify(ts)};\nconst __i18nConfig = ${JSON.stringify(i18nConfig)};\nconst __configRedirects = ${JSON.stringify(redirects)};\nconst __configRewrites = ${JSON.stringify(rewrites)};\nconst __configHeaders = ${JSON.stringify(headers)};\nconst __publicFiles = new Set(${JSON.stringify(publicFiles)});\nconst __allowedOrigins = ${JSON.stringify(allowedOrigins)};\nconst __expireTime = ${JSON.stringify(expireTime)};\nconst __htmlLimitedBots = ${JSON.stringify(htmlLimitedBots)};\nconst __clientTraceMetadata = ${JSON.stringify(clientTraceMetadata)};\n// Re-exported for the App Router prod-server to consume at startup —\n// mirrors the embedded \\`__basePath\\` pattern (and Pages Router's\n// \\`vinextConfig\\` export). Empty string when unset.\nexport const __assetPrefix = ${JSON.stringify(assetPrefix)};\nexport const __inlineCss = ${JSON.stringify(inlineCss)};\n\nexport function seedMemoryCacheFromPrerender(serverDir) {\n return __seedMemoryCacheFromPrerender(serverDir, {\n buildAppPageHtmlKey(pathname) {\n return __isrHtmlKey(pathname);\n },\n buildAppPageRscKey(pathname) {\n return __isrRscKey(pathname);\n },\n writeAppPageEntry(key, data, metadata) {\n return __isrSetPrerenderedAppPage(key, data, metadata);\n },\n });\n}\n\n${generateDevOriginCheckCode(config?.allowedDevOrigins)}\n\n/**\n * Maximum server-action request body size.\n * Configurable via experimental.serverActions.bodySizeLimit in next.config.\n * Defaults to 1MB, matching the Next.js default.\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/serverActions#bodysizelimit\n * Prevents unbounded request body buffering.\n */\nvar __MAX_ACTION_BODY_SIZE = ${JSON.stringify(bodySizeLimit)};\n\n// Map from route pattern to generateStaticParams function.\n// Used by the prerender phase to enumerate dynamic route URLs without\n// loading route modules via the dev server.\nexport const generateStaticParamsMap = {\n${generateStaticParamsEntries.join(\"\\n\")}\n};${loadPrerenderPagesRoutesCode}\nconst rootParamNamesMap = {\n${rootParamNameEntries.join(\"\\n\")}\n};\n\nexport default __createAppRscHandler({\n basePath: __basePath,\n clearRequestContext() {\n __clearRequestContext();\n },\n configHeaders: __configHeaders,\n configRedirects: __configRedirects,\n configRewrites: __configRewrites,\n draftModeSecret: __draftModeSecret,\n dispatchMatchedPage({\n cleanPathname,\n formState,\n actionError,\n actionFailed,\n handlerStart,\n interceptionContext,\n isProgressiveActionRender,\n isRscRequest,\n middlewareContext,\n mountedSlotsHeader,\n params,\n staticParamsValidationParams,\n rootParams,\n request,\n route,\n scriptNonce,\n searchParams,\n renderMode,\n }) {\n const PageComponent = route.page?.default;\n const __segmentConfig = __resolveAppPageSegmentConfig({\n layouts: route.layouts,\n page: route.page,\n });\n const __generateStaticParams = __resolveAppPageGenerateStaticParamsSources({\n layouts: route.layouts,\n layoutTreePositions: route.layoutTreePositions,\n page: route.page,\n routeSegments: route.routeSegments,\n });\n const _asyncRouteParams = makeThenableParams(params);\n return __dispatchAppPage({\n basePath: __basePath,\n clientTraceMetadata: __clientTraceMetadata,\n buildPageElement(targetRoute, targetParams, targetOpts, targetSearchParams) {\n return buildPageElements(targetRoute, targetParams, cleanPathname, {\n opts: targetOpts,\n searchParams: targetSearchParams,\n isRscRequest,\n request,\n mountedSlotsHeader,\n renderMode,\n });\n },\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n createRscOnErrorHandler(pathname, routePath) {\n return createRscOnErrorHandler(request, pathname, routePath);\n },\n debugClassification: __classDebug,\n draftModeSecret: __draftModeSecret,\n dynamicConfig: __segmentConfig.dynamicConfig,\n dynamicParamsConfig: __segmentConfig.dynamicParamsConfig,\n fetchCache: __segmentConfig.fetchCache ?? null,\n isEdgeRuntime: __isEdgeRuntime(__segmentConfig.runtime),\n findIntercept(pathname) {\n return findIntercept(pathname, interceptionContext);\n },\n generateStaticParams: __generateStaticParams,\n getFontLinks: _getSSRFontLinks,\n getFontPreloads: _getSSRFontPreloads,\n getFontStyles: _getSSRFontStyles,\n getNavigationContext: _getNavigationContext,\n getSourceRoute(sourceRouteIndex) {\n return routes[sourceRouteIndex];\n },\n hasGenerateStaticParams: __generateStaticParams.length > 0,\n hasPageDefaultExport: !!PageComponent,\n hasPageModule: !!route.page,\n handlerStart,\n interceptionContext,\n expireSeconds: __expireTime,\n formState,\n actionError,\n actionFailed,\n isProgressiveActionRender,\n isProduction: process.env.NODE_ENV === \"production\",\n isRscRequest,\n isrDebug: __isrDebug,\n isrGet: __isrGet,\n isrHtmlKey: __isrHtmlKey,\n isrRscKey: __isrRscKey,\n isrSet: __isrSet,\n loadSsrHandler() {\n return import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n },\n middlewareContext,\n mountedSlotsHeader,\n params,\n staticParamsValidationParams,\n rootParams,\n probeLayoutAt(li) {\n const LayoutComp = route.layouts[li]?.default;\n if (!LayoutComp) return null;\n return LayoutComp({\n params: makeThenableParams(__resolveAppPageSegmentParams(\n route.routeSegments,\n route.layoutTreePositions?.[li] ?? 0,\n params,\n )),\n children: null,\n });\n },\n probePage() {\n return __probeAppPage({\n pageComponent: PageComponent,\n asyncRouteParams: _asyncRouteParams,\n searchParams,\n });\n },\n renderErrorBoundaryPage(renderErr) {\n return __fallbackRenderer.renderErrorBoundary(route, renderErr, isRscRequest, request, params, scriptNonce, middlewareContext, { isEdgeRuntime: __isEdgeRuntime(__segmentConfig.runtime) });\n },\n renderHttpAccessFallbackPage(statusCode, opts, currentMiddlewareContext) {\n return __fallbackRenderer.renderHttpAccessFallback(route, statusCode, isRscRequest, request, opts, scriptNonce, currentMiddlewareContext, { isEdgeRuntime: __isEdgeRuntime(__segmentConfig.runtime) });\n },\n renderToReadableStream,\n request,\n revalidateSeconds: __segmentConfig.revalidateSeconds,\n resolveRouteFetchCacheMode(targetRoute) {\n return __resolveRouteFetchCacheMode(targetRoute);\n },\n rootForbiddenModule,\n rootNotFoundModule,\n rootUnauthorizedModule,\n route,\n runWithSuppressedHookWarning(probe) {\n return suppressHookWarningAls.run(true, probe);\n },\n scheduleBackgroundRegeneration(key, renderFn, errorContext) {\n __triggerBackgroundRegeneration(key, renderFn, errorContext);\n },\n scriptNonce,\n searchParams,\n setNavigationContext,\n renderMode,\n });\n },\n dispatchMatchedRouteHandler({\n cleanPathname,\n middlewareContext,\n params,\n request,\n route,\n searchParams,\n }) {\n return __dispatchAppRouteHandler({\n basePath: __basePath,\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n draftModeSecret: __draftModeSecret,\n i18n: __i18nConfig,\n isrDebug: __isrDebug,\n isrGet: __isrGet,\n isrRouteKey: __isrRouteKey,\n isrSet: __isrSet,\n middlewareContext,\n middlewareRequestHeaders: middlewareContext.requestHeaders,\n params,\n request,\n route: {\n pattern: route.pattern,\n routeHandler: route.routeHandler,\n routeSegments: route.routeSegments,\n },\n scheduleBackgroundRegeneration: __triggerBackgroundRegeneration,\n searchParams,\n });\n },\n ${\n instrumentationPath\n ? `ensureInstrumentation() {\n return __ensureInstrumentationRegistered(_instrumentation);\n },`\n : \"\"\n }\n handleProgressiveActionRequest({\n actionId,\n cleanPathname,\n contentType,\n middlewareContext,\n request,\n }) {\n return __handleProgressiveServerActionRequest({\n actionId,\n allowedOrigins: __allowedOrigins,\n basePath: __basePath,\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n contentType,\n decodeAction,\n decodeFormState,\n getAndClearPendingCookies,\n getDraftModeCookieHeader,\n maxActionBodySize: __MAX_ACTION_BODY_SIZE,\n middlewareHeaders: middlewareContext.headers,\n readFormDataWithLimit: __readFormDataWithLimit,\n reportRequestError: _reportRequestError,\n request,\n setHeadersAccessPhase,\n });\n },\n handleServerActionRequest({\n actionId,\n cleanPathname,\n contentType,\n interceptionContext,\n isRscRequest,\n middlewareContext,\n mountedSlotsHeader,\n request,\n searchParams,\n }) {\n const __actionMatch = matchRoute(cleanPathname);\n const __actionIsEdgeRuntime = __actionMatch\n ? __isEdgeRuntime(__resolveAppPageSegmentConfig({ layouts: __actionMatch.route.layouts, page: __actionMatch.route.page }).runtime)\n : false;\n return __handleServerActionRscRequest({\n actionId,\n allowedOrigins: __allowedOrigins,\n basePath: __basePath,\n isEdgeRuntime: __actionIsEdgeRuntime,\n buildPageElement({\n route: actionRoute,\n params: actionParams,\n cleanPathname: actionCleanPathname,\n interceptOpts,\n searchParams: actionSearchParams,\n isRscRequest: actionIsRscRequest,\n request: actionRequest,\n mountedSlotsHeader: actionMountedSlotsHeader,\n renderMode: actionRenderMode,\n }) {\n return buildPageElements(actionRoute, actionParams, actionCleanPathname, {\n opts: interceptOpts,\n searchParams: actionSearchParams,\n isRscRequest: actionIsRscRequest,\n request: actionRequest,\n mountedSlotsHeader: actionMountedSlotsHeader,\n renderMode: actionRenderMode,\n });\n },\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n contentType,\n createNotFoundElement(actionRouteId) {\n return {\n ...__AppElementsWire.createMetadataEntries({\n interceptionContext: null,\n rootLayoutTreePath: null,\n routeId: actionRouteId,\n }),\n [actionRouteId]: createElement(\"div\", null, \"Page not found\"),\n };\n },\n createPayloadRouteId(pathnameToRender, currentInterceptionContext) {\n return __AppElementsWire.encodeRouteId(pathnameToRender, currentInterceptionContext);\n },\n createRscOnErrorHandler(actionRequest, actionPathname, routePattern) {\n return createRscOnErrorHandler(actionRequest, actionPathname, routePattern);\n },\n createTemporaryReferenceSet,\n decodeReply,\n findIntercept(pathnameToMatch) {\n return findIntercept(pathnameToMatch, interceptionContext);\n },\n getAndClearPendingCookies,\n getDraftModeCookieHeader,\n getRouteParamNames(sourceRoute) {\n return sourceRoute.params;\n },\n getSourceRoute(sourceRouteIndex) {\n return routes[sourceRouteIndex];\n },\n isRscRequest,\n loadServerAction,\n matchRoute(pathnameToMatch) {\n return matchRoute(pathnameToMatch);\n },\n maxActionBodySize: __MAX_ACTION_BODY_SIZE,\n middlewareHeaders: middlewareContext.headers,\n middlewareStatus: middlewareContext.status,\n mountedSlotsHeader,\n readBodyWithLimit: __readBodyWithLimit,\n readFormDataWithLimit: __readFormDataWithLimit,\n renderToReadableStream,\n reportRequestError: _reportRequestError,\n request,\n sanitizeErrorForClient(error) {\n return __sanitizeErrorForClient(error);\n },\n searchParams,\n setHeadersAccessPhase,\n setNavigationContext,\n toInterceptOpts(intercept) {\n return {\n interceptionContext,\n interceptLayouts: intercept.interceptLayouts,\n interceptSlotId: intercept.slotId,\n interceptSlotKey: intercept.slotKey,\n interceptSourceMatchedUrl: interceptionContext,\n interceptPage: intercept.page,\n interceptParams: intercept.matchedParams,\n };\n },\n });\n },\n i18nConfig: __i18nConfig,\n isMiddlewareProxy: ${JSON.stringify(middlewarePath ? isProxyFile(middlewarePath) : false)},\n ${hasPagesDir ? `loadPrerenderPagesRoutes: __loadPrerenderPagesRoutes,` : \"\"}\n makeThenableParams,\n matchRoute,\n metadataRoutes,\n middlewareModule: ${middlewarePath ? \"middlewareModule\" : \"null\"},\n publicFiles: __publicFiles,\n renderNotFound({ isRscRequest, matchedParams, middlewareContext, request, route, scriptNonce }) {\n const __isEdge = route ? __isEdgeRuntime(__resolveAppPageSegmentConfig({ layouts: route.layouts, page: route.page }).runtime) : false;\n return __fallbackRenderer.renderNotFound(route, isRscRequest, request, matchedParams, scriptNonce, middlewareContext, { isEdgeRuntime: __isEdge });\n },\n ${\n hasPagesDir\n ? `async renderPagesFallback({ isRscRequest, middlewareContext, request, url }) {\n if (isRscRequest) return null;\n\n const __pagesEntry = await import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n\n const __pagesRequestHeaders = middlewareContext.requestHeaders\n ? __buildRequestHeadersFromMiddlewareResponse(request.headers, middlewareContext.requestHeaders)\n : null;\n let __pagesRequest = request;\n if (__pagesRequestHeaders) {\n const __pagesRequestInit = {\n method: request.method,\n headers: __pagesRequestHeaders,\n };\n if (request.method !== \"GET\" && request.method !== \"HEAD\") {\n __pagesRequestInit.body = request.body;\n __pagesRequestInit.duplex = \"half\";\n }\n __pagesRequest = new Request(request.url, __pagesRequestInit);\n }\n\n const __pagesUrl = __decodePathParams(url.pathname) + (url.search || \"\");\n const __pagesPathname = url.pathname;\n if (__pagesPathname.startsWith(\"/api/\") || __pagesPathname === \"/api\") {\n if (typeof __pagesEntry.handleApiRoute !== \"function\") return null;\n const __pagesApiResponse = await __pagesEntry.handleApiRoute(__pagesRequest, __pagesUrl);\n return __applyRouteHandlerMiddlewareContext(__pagesApiResponse, middlewareContext);\n }\n\n if (typeof __pagesEntry.renderPage !== \"function\") return null;\n const __pagesRes = await __pagesEntry.renderPage(\n __pagesRequest,\n __pagesUrl,\n {},\n undefined,\n middlewareContext.requestHeaders,\n );\n return __pagesRes.status !== 404 ? __pagesRes : null;\n },`\n : \"\"\n }\n rootParamNamesByPattern: rootParamNamesMap,\n setNavigationContext,\n staticParamsMap: generateStaticParamsMap,\n trailingSlash: __trailingSlash,\n validateDevRequestOrigin: __validateDevRequestOrigin,\n});\n\nif (import.meta.hot) {\n import.meta.hot.accept();\n}\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,MAAM,sBAAsB;AAK5B,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2L9B,sBACI;;QAGA,GACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAyIoB,KAAK,UAAU,iBAAiB,YAAY,eAAe,GAAG,MAAM,CAAC;IACxF,cAAc,0DAA0D,GAAG;;;;sBAIzD,iBAAiB,qBAAqB,OAAO;;;;;;IAO/D,cACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAuCA,GACL"}
|
|
1
|
+
{"version":3,"file":"app-rsc-entry.js","names":[],"sources":["../../src/entries/app-rsc-entry.ts"],"sourcesContent":["/**\n * App Router RSC entry generator.\n *\n * Generates the virtual RSC entry module for the App Router.\n * The RSC entry does route matching and renders the component tree,\n * then delegates to the SSR entry for HTML generation.\n *\n * Previously housed in server/app-dev-server.ts.\n */\nimport { randomUUID } from \"node:crypto\";\nimport { buildAppRscManifestCode } from \"./app-rsc-manifest.js\";\nimport { resolveEntryPath } from \"./runtime-entry-module.js\";\nimport { normalizePathSeparators } from \"../utils/path.js\";\nimport type {\n NextHeader,\n NextI18nConfig,\n NextRedirect,\n NextRewrite,\n} from \"../config/next-config.js\";\nimport type { AppRoute } from \"../routing/app-router.js\";\nimport { generateDevOriginCheckCode } from \"../server/dev-origin-check.js\";\nimport type { MetadataFileRoute } from \"../server/metadata-routes.js\";\nimport { isProxyFile } from \"../server/middleware.js\";\n\nconst DEFAULT_EXPIRE_TIME = 31_536_000;\n\n// Pre-computed absolute paths for generated-code imports. The virtual RSC\n// entry can't use relative imports (it has no real file location), so we\n// resolve these at code-generation time and embed them as absolute paths.\nconst middlewareRequestHeadersPath = resolveEntryPath(\n \"../server/middleware-request-headers.js\",\n import.meta.url,\n);\nconst normalizePathModulePath = resolveEntryPath(\"../server/normalize-path.js\", import.meta.url);\nconst appRscHandlerPath = resolveEntryPath(\"../server/app-rsc-handler.js\", import.meta.url);\nconst appRouteHandlerDispatchPath = resolveEntryPath(\n \"../server/app-route-handler-dispatch.js\",\n import.meta.url,\n);\nconst appRouteHandlerResponsePath = resolveEntryPath(\n \"../server/app-route-handler-response.js\",\n import.meta.url,\n);\nconst appServerActionExecutionPath = resolveEntryPath(\n \"../server/app-server-action-execution.js\",\n import.meta.url,\n);\nconst appRscErrorsPath = resolveEntryPath(\"../server/app-rsc-errors.js\", import.meta.url);\nconst appPageExecutionPath = resolveEntryPath(\"../server/app-page-execution.js\", import.meta.url);\nconst appFallbackRendererPath = resolveEntryPath(\n \"../server/app-fallback-renderer.js\",\n import.meta.url,\n);\nconst appElementsPath = resolveEntryPath(\"../server/app-elements.js\", import.meta.url);\nconst appPageRouteWiringPath = resolveEntryPath(\n \"../server/app-page-route-wiring.js\",\n import.meta.url,\n);\nconst appPageProbePath = resolveEntryPath(\"../server/app-page-probe.js\", import.meta.url);\nconst appPageParamsPath = resolveEntryPath(\"../server/app-page-params.js\", import.meta.url);\nconst appPageDispatchPath = resolveEntryPath(\"../server/app-page-dispatch.js\", import.meta.url);\nconst appPageRequestPath = resolveEntryPath(\"../server/app-page-request.js\", import.meta.url);\nconst appSegmentConfigPath = resolveEntryPath(\"../server/app-segment-config.js\", import.meta.url);\nconst appRscRouteMatchingPath = resolveEntryPath(\n \"../server/app-rsc-route-matching.js\",\n import.meta.url,\n);\nconst rscStreamHintsPath = resolveEntryPath(\"../server/rsc-stream-hints.js\", import.meta.url);\nconst isrCachePath = resolveEntryPath(\"../server/isr-cache.js\", import.meta.url);\nconst thenableParamsShimPath = resolveEntryPath(\"../shims/thenable-params.js\", import.meta.url);\nconst appPageElementBuilderPath = resolveEntryPath(\n \"../server/app-page-element-builder.js\",\n import.meta.url,\n);\nconst instrumentationRuntimePath = resolveEntryPath(\n \"../server/instrumentation-runtime.js\",\n import.meta.url,\n);\nconst appRscErrorHandlerPath = resolveEntryPath(\n \"../server/app-rsc-error-handler.js\",\n import.meta.url,\n);\nconst appRequestContextPath = resolveEntryPath(\"../server/app-request-context.js\", import.meta.url);\nconst appPrerenderStaticParamsPath = resolveEntryPath(\n \"../server/app-prerender-static-params.js\",\n import.meta.url,\n);\nconst seedCachePath = resolveEntryPath(\"../server/seed-cache.js\", import.meta.url);\nconst appHookWarningSuppressionPath = resolveEntryPath(\n \"../server/app-hook-warning-suppression.js\",\n import.meta.url,\n);\nconst serverGlobalsPath = resolveEntryPath(\"../server/server-globals.js\", import.meta.url);\n\n/**\n * Resolved config options relevant to App Router request handling.\n * Passed from the Vite plugin where the full next.config.js is loaded.\n */\ntype AppRouterConfig = {\n redirects?: NextRedirect[];\n rewrites?: {\n beforeFiles: NextRewrite[];\n afterFiles: NextRewrite[];\n fallback: NextRewrite[];\n };\n headers?: NextHeader[];\n /** Extra origins allowed for server action CSRF checks (from experimental.serverActions.allowedOrigins). */\n allowedOrigins?: string[];\n /** Extra origins allowed for dev server access (from allowedDevOrigins). */\n allowedDevOrigins?: string[];\n /** Body size limit for server actions in bytes (from experimental.serverActions.bodySizeLimit). */\n bodySizeLimit?: number;\n /** Serialized next.config htmlLimitedBots regexp source. */\n htmlLimitedBots?: string;\n /**\n * Allow-list of keys (from `experimental.clientTraceMetadata`) to surface\n * from the active OpenTelemetry context as `<meta>` tags in the SSR head.\n * Undefined or empty disables emission entirely.\n */\n clientTraceMetadata?: string[] | undefined;\n /**\n * Resolved `assetPrefix` from next.config. Empty string when unset.\n * Embedded in the generated entry so the App Router prod-server reads\n * it from the imported module instead of a sidecar JSON file —\n * matches how the Pages Router entry exposes `vinextConfig.assetPrefix`.\n *\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/assetPrefix\n */\n assetPrefix?: string;\n /** Route-level expire fallback in seconds for ISR entries with numeric revalidate. */\n expireTime?: number;\n /** Maximum in-memory cache size in bytes. 0 disables the default memory cache. */\n cacheMaxMemorySize?: number;\n /** Inline app CSS into production HTML (from experimental.inlineCss). */\n inlineCss?: boolean;\n /** Internationalization routing config for middleware matcher locale handling. */\n i18n?: NextI18nConfig | null;\n /**\n * Absolute path to `app/global-not-found.{tsx,ts,js,jsx}` when present.\n * When provided, route-miss 404s render this module standalone (it owns its\n * own `<html>` and `<body>`) instead of wrapping the regular `not-found.tsx`\n * boundary inside the root layout. Mirrors Next.js 16's\n * `experimental.globalNotFound` behavior.\n * @see https://github.com/vercel/next.js/blob/canary/test/e2e/app-dir/global-not-found\n */\n globalNotFoundPath?: string | null;\n /**\n * When true, the project has a `pages/` directory alongside the App Router.\n * The generated RSC entry exposes `/__vinext/prerender/pages-static-paths`\n * so `prerenderPages` can call `getStaticPaths` via `wrangler unstable_startWorker`\n * in CF Workers builds. `pageRoutes` is loaded from the SSR environment via\n * `import(\"./ssr/index.js\")`, which re-exports it from\n * `virtual:vinext-server-entry` when this flag is set.\n */\n hasPagesDir?: boolean;\n /** Exact public/ file routes, using normalized leading-slash pathnames. */\n publicFiles?: string[];\n /** Server-only token used to validate the draft-mode bypass cookie. */\n draftModeSecret?: string;\n};\n\n/**\n * Generate the virtual RSC entry module.\n *\n * This runs in the `rsc` Vite environment (react-server condition).\n * It matches the incoming request URL to an app route, builds the\n * nested layout + page tree, and renders it to an RSC stream.\n */\nexport function generateRscEntry(\n appDir: string,\n routes: AppRoute[],\n middlewarePath?: string | null,\n metadataRoutes?: MetadataFileRoute[],\n globalErrorPath?: string | null,\n basePath?: string,\n trailingSlash?: boolean,\n config?: AppRouterConfig,\n instrumentationPath?: string | null,\n): string {\n const bp = basePath ?? \"\";\n const ts = trailingSlash ?? false;\n const redirects = config?.redirects ?? [];\n const rewrites = config?.rewrites ?? { beforeFiles: [], afterFiles: [], fallback: [] };\n const headers = config?.headers ?? [];\n const allowedOrigins = config?.allowedOrigins ?? [];\n const bodySizeLimit = config?.bodySizeLimit ?? 1 * 1024 * 1024;\n const htmlLimitedBots = config?.htmlLimitedBots;\n const clientTraceMetadata = config?.clientTraceMetadata;\n const assetPrefix = config?.assetPrefix ?? \"\";\n const expireTime = config?.expireTime ?? DEFAULT_EXPIRE_TIME;\n const cacheMaxMemorySize = config?.cacheMaxMemorySize;\n const inlineCss = config?.inlineCss === true;\n const i18nConfig = config?.i18n ?? null;\n const hasPagesDir = config?.hasPagesDir ?? false;\n const publicFiles = config?.publicFiles ?? [];\n const draftModeSecret = config?.draftModeSecret ?? randomUUID();\n const manifestCode = buildAppRscManifestCode({\n routes,\n metadataRoutes,\n globalErrorPath,\n globalNotFoundPath: config?.globalNotFoundPath ?? null,\n });\n const {\n imports,\n routeEntries,\n metaRouteEntries,\n generateStaticParamsEntries,\n rootParamNameEntries,\n rootNotFoundVar,\n rootForbiddenVar,\n rootUnauthorizedVar,\n rootLayoutVars,\n globalErrorVar,\n globalNotFoundImportSpecifier,\n } = manifestCode;\n const loadPrerenderPagesRoutesCode = hasPagesDir\n ? `\nasync function __loadPrerenderPagesRoutes() {\n const __gspSsrEntry = await import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n return __gspSsrEntry.pageRoutes;\n}\n`\n : \"\";\n\n return `\nimport ${JSON.stringify(serverGlobalsPath)};\nimport {\n renderToReadableStream as _renderToReadableStream,\n decodeAction,\n decodeFormState,\n decodeReply,\n loadServerAction,\n createTemporaryReferenceSet,\n} from \"@vitejs/plugin-rsc/rsc\";\nimport { createRscRenderer } from ${JSON.stringify(rscStreamHintsPath)};\n\nconst renderToReadableStream = createRscRenderer(_renderToReadableStream);\nimport { createElement } from \"react\";\nimport { getNavigationContext as _getNavigationContext } from \"next/navigation\";\nimport { configureMemoryCacheHandler as __configureMemoryCacheHandler } from \"next/cache\";\nimport { headersContextFromRequest, getDraftModeCookieHeader, getAndClearPendingCookies, consumeDynamicUsage, consumeInvalidDynamicUsageError, setHeadersAccessPhase } from \"next/headers\";\nimport { mergeMetadata, resolveModuleMetadata, mergeViewport, resolveModuleViewport } from \"vinext/metadata\";\n${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};` : \"\"}\n${\n instrumentationPath\n ? `import * as _instrumentation from ${JSON.stringify(normalizePathSeparators(instrumentationPath))};\nimport { ensureInstrumentationRegistered as __ensureInstrumentationRegistered } from ${JSON.stringify(instrumentationRuntimePath)};`\n : \"\"\n}\nimport { createAppRscHandler as __createAppRscHandler } from ${JSON.stringify(appRscHandlerPath)};\nimport { decodePathParams as __decodePathParams } from ${JSON.stringify(normalizePathModulePath)};\nimport { buildRequestHeadersFromMiddlewareResponse as __buildRequestHeadersFromMiddlewareResponse } from ${JSON.stringify(middlewareRequestHeadersPath)};\nimport {\n dispatchAppRouteHandler as __dispatchAppRouteHandler,\n} from ${JSON.stringify(appRouteHandlerDispatchPath)};\nimport {\n applyRouteHandlerMiddlewareContext as __applyRouteHandlerMiddlewareContext,\n} from ${JSON.stringify(appRouteHandlerResponsePath)};\nimport {\n handleProgressiveServerActionRequest as __handleProgressiveServerActionRequest,\n handleServerActionRscRequest as __handleServerActionRscRequest,\n readActionBodyWithLimit as __readBodyWithLimit,\n readActionFormDataWithLimit as __readFormDataWithLimit,\n} from ${JSON.stringify(appServerActionExecutionPath)};\nimport {\n sanitizeErrorForClient as __sanitizeErrorForClient,\n} from ${JSON.stringify(appRscErrorsPath)};\nimport { createAppRscOnErrorHandler } from ${JSON.stringify(appRscErrorHandlerPath)};\nimport {\n buildAppPageFontLinkHeader as __buildAppPageFontLinkHeader,\n resolveAppPageSpecialError as __resolveAppPageSpecialError,\n} from ${JSON.stringify(appPageExecutionPath)};\nimport {\n createAppFallbackRenderer as __createAppFallbackRenderer,\n} from ${JSON.stringify(appFallbackRendererPath)};\nimport {\n AppElementsWire as __AppElementsWire,\n} from ${JSON.stringify(appElementsPath)};\nimport {\n resolveAppPageChildSegments as __resolveAppPageChildSegments,\n} from ${JSON.stringify(appPageRouteWiringPath)};\nimport { buildPageElements as __buildPageElements } from ${JSON.stringify(appPageElementBuilderPath)};\nimport {\n resolveAppPageSegmentParams as __resolveAppPageSegmentParams,\n} from ${JSON.stringify(appPageParamsPath)};\nimport { probeAppPage as __probeAppPage } from ${JSON.stringify(appPageProbePath)};\nimport {\n dispatchAppPage as __dispatchAppPage,\n} from ${JSON.stringify(appPageDispatchPath)};\nimport {\n resolveAppPageGenerateStaticParamsSources as __resolveAppPageGenerateStaticParamsSources,\n} from ${JSON.stringify(appPageRequestPath)};\nimport {\n isEdgeRuntime as __isEdgeRuntime,\n resolveAppPageFetchCacheMode as __resolveAppPageFetchCacheMode,\n resolveAppPageSegmentConfig as __resolveAppPageSegmentConfig,\n} from ${JSON.stringify(appSegmentConfigPath)};\nimport { makeThenableParams } from ${JSON.stringify(thenableParamsShimPath)};\nimport {\n createAppRscRouteMatcher as __createAppRscRouteMatcher,\n} from ${JSON.stringify(appRscRouteMatchingPath)};\nimport {\n appIsrHtmlKey as __isrHtmlKey,\n appIsrRscKey as __isrRscKey,\n appIsrRouteKey as __isrRouteKey,\n isrGet as __isrGet,\n isrSet as __isrSet,\n isrSetPrerenderedAppPage as __isrSetPrerenderedAppPage,\n triggerBackgroundRegeneration as __triggerBackgroundRegeneration,\n} from ${JSON.stringify(isrCachePath)};\n// Import server-only state module to register ALS-backed accessors.\nimport \"vinext/navigation-state\";\nimport { reportRequestError as _reportRequestError } from \"vinext/instrumentation\";\nimport { getSSRFontLinks as _getSSRFontLinks, getSSRFontStyles as _getSSRFontStylesGoogle, getSSRFontPreloads as _getSSRFontPreloadsGoogle } from \"next/font/google\";\nimport { getSSRFontStyles as _getSSRFontStylesLocal, getSSRFontPreloads as _getSSRFontPreloadsLocal } from \"next/font/local\";\nfunction _getSSRFontStyles() { return [..._getSSRFontStylesGoogle(), ..._getSSRFontStylesLocal()]; }\nfunction _getSSRFontPreloads() { return [..._getSSRFontPreloadsGoogle(), ..._getSSRFontPreloadsLocal()]; }\n${hasPagesDir ? `// Pages Router routes are loaded lazily from the SSR environment for internal prerender requests.` : \"\"}\n\n// Suppress expected \"Invalid hook call\" dev warning when layout/page\n// components are probed outside React's render cycle. The import patches\n// console.error once at module load (side-effect) and exposes the ALS\n// so per-route dispatch can opt into suppression via .run(true, ...).\nimport { suppressHookWarningAls } from ${JSON.stringify(appHookWarningSuppressionPath)};\nimport { clearAppRequestContext as __clearRequestContext, setAppNavigationContext as setNavigationContext } from ${JSON.stringify(appRequestContextPath)};\n\n__configureMemoryCacheHandler({ cacheMaxMemorySize: ${JSON.stringify(cacheMaxMemorySize)} });\nimport { createAppPrerenderStaticParamsResolver as __createAppPrerenderStaticParamsResolver } from ${JSON.stringify(appPrerenderStaticParamsPath)};\nimport { seedMemoryCacheFromPrerender as __seedMemoryCacheFromPrerender } from ${JSON.stringify(seedCachePath)};\n\nconst __draftModeSecret = ${JSON.stringify(draftModeSecret)};\n\n// Note: cache entries are written with \\`headers: undefined\\`. Next.js stores\n// response headers (e.g. set-cookie from cookies().set() during render) in the\n// cache entry so they can be replayed on HIT. We don't do this because:\n// 1. Pages that call cookies().set() during render trigger dynamicUsedDuringRender,\n// which opts them out of ISR caching before we reach the write path.\n// 2. Custom response headers set via next/headers are not yet captured separately\n// from the live Response object in vinext's server pipeline.\n// In practice this means ISR-cached responses won't replay render-time set-cookie\n// headers — but that case is already prevented by the dynamic-usage opt-out.\n// TODO: capture render-time response headers for full Next.js parity.\n// Verbose cache logging — opt in with NEXT_PRIVATE_DEBUG_CACHE=1.\n// Matches the env var Next.js uses for its own cache debug output so operators\n// have a single knob for all cache tracing.\nconst __isrDebug = process.env.NEXT_PRIVATE_DEBUG_CACHE\n ? console.debug.bind(console, \"[vinext] ISR:\")\n : undefined;\n\n// Classification debug — opt in with VINEXT_DEBUG_CLASSIFICATION=1. Gated on\n// the env var so the hot path pays no overhead unless an operator is actively\n// tracing why a layout was flagged static or dynamic. The reason payload is\n// carried by __VINEXT_CLASS_REASONS and consumed inside probeAppPageLayouts.\nconst __classDebug = process.env.VINEXT_DEBUG_CLASSIFICATION\n ? function(layoutId, reason) {\n console.debug(\"[vinext] CLS:\", layoutId, reason);\n }\n : undefined;\n\nfunction __resolveRouteFetchCacheMode(route) {\n return __resolveAppPageFetchCacheMode({\n layouts: route.layouts,\n page: route.page,\n });\n}\n\nfunction __resolveRouteRuntime(route) {\n return __resolveAppPageSegmentConfig({\n layouts: route.layouts,\n page: route.page,\n }).runtime ?? null;\n}\n\n${imports.join(\"\\n\")}\n\n${\n instrumentationPath\n ? `// Lazy instrumentation initialisation is handled by ensureInstrumentationRegistered\n// (imported from vinext/instrumentation-runtime). The generated entry only passes\n// the user module in; all bookkeeping (initialized flag, shared promise, prerender\n// skip) lives in the typed helper so it can be unit-tested independently.`\n : \"\"\n}\n\n// Build-time layout classification dispatch. Replaced in generateBundle\n// with a switch statement that returns a pre-computed per-layout\n// Map<layoutIndex, \"static\" | \"dynamic\"> for each route. Until the\n// plugin patches this stub, every route falls back to the Layer 3\n// runtime probe, which is the current (slow) behaviour.\nfunction __VINEXT_CLASS(routeIdx) {\n return null;\n}\n\n// Build-time layout classification reasons dispatch. Sibling of\n// __VINEXT_CLASS, returning a per-route Map<layoutIndex, ClassificationReason>\n// that feeds the debug channel when VINEXT_DEBUG_CLASSIFICATION is active.\n// Replaced in generateBundle with a real dispatch table; the stub returns\n// null so the hot path never allocates reason maps when debug is off.\nfunction __VINEXT_CLASS_REASONS(routeIdx) {\n return null;\n}\n\nconst routes = [\n${routeEntries.join(\",\\n\")}\n];\nconst __routeMatcher = __createAppRscRouteMatcher(routes);\n\nconst metadataRoutes = [\n${metaRouteEntries.join(\",\\n\")}\n];\n\n// Hoisted ahead of __fallbackRenderer / buildPageElements so both can thread\n// the configured basePath through file-based metadata href emission.\n// Re-exported so the Cloudflare worker entry can strip basePath before\n// recognising /_next/static/* paths (parity with __assetPrefix below).\nexport const __basePath = ${JSON.stringify(bp)};\n\nconst rootNotFoundModule = ${rootNotFoundVar ? rootNotFoundVar : \"null\"};\nconst rootForbiddenModule = ${rootForbiddenVar ? rootForbiddenVar : \"null\"};\nconst rootUnauthorizedModule = ${rootUnauthorizedVar ? rootUnauthorizedVar : \"null\"};\nconst rootLayouts = [${rootLayoutVars.join(\", \")}];\n// Root-level app/global-not-found loader. When present, route-miss 404s render\n// this module standalone (it provides its own html/body) instead of wrapping\n// the not-found.tsx boundary inside the root layout. Page-triggered notFound()\n// calls still use the regular not-found.tsx boundary inside the layouts.\n//\n// The module is loaded via dynamic \\`import()\\` (not a static \\`import * as\\`)\n// so the bundler emits it in its own JS+CSS chunk. Without that isolation,\n// global-not-found's CSS gets concatenated with the root layout's CSS into a\n// single file, where the CSS minifier (lightningcss) drops overlapping\n// declarations as dead code — breaking the cascade for route-miss 404s.\n// See https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/app-render.tsx#L495-L520\n// See Next.js test: test/e2e/app-dir/initial-css-order/initial-css-order.test.ts\nconst __loadGlobalNotFoundModule = ${\n globalNotFoundImportSpecifier ? `() => import(${globalNotFoundImportSpecifier})` : \"null\"\n };\n\nconst createRscOnErrorHandler = (request, pathname, routePath) =>\n createAppRscOnErrorHandler(_reportRequestError, request, pathname, routePath);\n\nconst __fallbackRenderer = __createAppFallbackRenderer({\n basePath: __basePath,\n rootBoundaries: {\n rootForbiddenModule,\n rootLayouts,\n rootNotFoundModule,\n rootUnauthorizedModule,\n },\n globalErrorModule: ${globalErrorVar ? globalErrorVar : \"null\"},\n loadGlobalNotFoundModule: __loadGlobalNotFoundModule,\n metadataRoutes,\n ssrLoader() {\n return import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n },\n fontProviders: {\n buildFontLinkHeader: __buildAppPageFontLinkHeader,\n getFontLinks: _getSSRFontLinks,\n getFontPreloads: _getSSRFontPreloads,\n getFontStyles: _getSSRFontStyles,\n },\n makeThenableParams,\n sanitizer: __sanitizeErrorForClient,\n rscRenderer: renderToReadableStream,\n getNavigationContext: _getNavigationContext,\n resolveChildSegments: __resolveAppPageChildSegments,\n clearRequestContext() {\n __clearRequestContext();\n },\n createRscOnErrorHandler(request, pathname, routePath) {\n return createRscOnErrorHandler(request, pathname, routePath);\n },\n});\n\nfunction matchRoute(url) {\n return __routeMatcher.matchRoute(url);\n}\n\n/**\n * Check if a pathname matches any intercepting route.\n * Returns the match info or null.\n */\nfunction findIntercept(pathname, sourcePathname = null) {\n return __routeMatcher.findIntercept(pathname, sourcePathname);\n}\n\nasync function buildPageElements(route, params, routePath, pageRequest) {\n return __buildPageElements({\n route,\n params,\n routePath,\n pageRequest,\n globalErrorModule: ${globalErrorVar ? globalErrorVar : \"null\"},\n rootNotFoundModule: ${rootNotFoundVar ? rootNotFoundVar : \"null\"},\n rootForbiddenModule: ${rootForbiddenVar ? rootForbiddenVar : \"null\"},\n rootUnauthorizedModule: ${rootUnauthorizedVar ? rootUnauthorizedVar : \"null\"},\n metadataRoutes,\n basePath: __basePath,\n htmlLimitedBots: __htmlLimitedBots,\n });\n}\n\nconst __trailingSlash = ${JSON.stringify(ts)};\nconst __i18nConfig = ${JSON.stringify(i18nConfig)};\nconst __configRedirects = ${JSON.stringify(redirects)};\nconst __configRewrites = ${JSON.stringify(rewrites)};\nconst __configHeaders = ${JSON.stringify(headers)};\nconst __publicFiles = new Set(${JSON.stringify(publicFiles)});\nconst __allowedOrigins = ${JSON.stringify(allowedOrigins)};\nconst __expireTime = ${JSON.stringify(expireTime)};\nconst __htmlLimitedBots = ${JSON.stringify(htmlLimitedBots)};\nconst __clientTraceMetadata = ${JSON.stringify(clientTraceMetadata)};\n// Re-exported for the App Router prod-server to consume at startup —\n// mirrors the embedded \\`__basePath\\` pattern (and Pages Router's\n// \\`vinextConfig\\` export). Empty string when unset.\nexport const __assetPrefix = ${JSON.stringify(assetPrefix)};\nexport const __inlineCss = ${JSON.stringify(inlineCss)};\n\nexport function seedMemoryCacheFromPrerender(serverDir) {\n return __seedMemoryCacheFromPrerender(serverDir, {\n buildAppPageHtmlKey(pathname) {\n return __isrHtmlKey(pathname);\n },\n buildAppPageRscKey(pathname) {\n return __isrRscKey(pathname);\n },\n writeAppPageEntry(key, data, metadata) {\n return __isrSetPrerenderedAppPage(key, data, metadata);\n },\n });\n}\n\n${generateDevOriginCheckCode(config?.allowedDevOrigins)}\n\n/**\n * Maximum server-action request body size.\n * Configurable via experimental.serverActions.bodySizeLimit in next.config.\n * Defaults to 1MB, matching the Next.js default.\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/serverActions#bodysizelimit\n * Prevents unbounded request body buffering.\n */\nvar __MAX_ACTION_BODY_SIZE = ${JSON.stringify(bodySizeLimit)};\n\n// Map from route pattern to generateStaticParams function.\n// Used by the prerender phase to enumerate dynamic route URLs without\n// loading route modules via the dev server.\nexport const generateStaticParamsMap = {\n${generateStaticParamsEntries.join(\"\\n\")}\n};${loadPrerenderPagesRoutesCode}\nconst rootParamNamesMap = {\n${rootParamNameEntries.join(\"\\n\")}\n};\n\nexport default __createAppRscHandler({\n basePath: __basePath,\n clearRequestContext() {\n __clearRequestContext();\n },\n configHeaders: __configHeaders,\n configRedirects: __configRedirects,\n configRewrites: __configRewrites,\n draftModeSecret: __draftModeSecret,\n dispatchMatchedPage({\n cleanPathname,\n formState,\n actionError,\n actionFailed,\n handlerStart,\n interceptionContext,\n isProgressiveActionRender,\n isRscRequest,\n middlewareContext,\n mountedSlotsHeader,\n params,\n staticParamsValidationParams,\n rootParams,\n request,\n route,\n scriptNonce,\n searchParams,\n renderMode,\n }) {\n const PageComponent = route.page?.default;\n const __segmentConfig = __resolveAppPageSegmentConfig({\n layouts: route.layouts,\n page: route.page,\n });\n const __generateStaticParams = __resolveAppPageGenerateStaticParamsSources({\n layouts: route.layouts,\n layoutTreePositions: route.layoutTreePositions,\n page: route.page,\n routeSegments: route.routeSegments,\n });\n const _asyncRouteParams = makeThenableParams(params);\n return __dispatchAppPage({\n basePath: __basePath,\n clientTraceMetadata: __clientTraceMetadata,\n buildPageElement(targetRoute, targetParams, targetOpts, targetSearchParams) {\n return buildPageElements(targetRoute, targetParams, cleanPathname, {\n opts: targetOpts,\n searchParams: targetSearchParams,\n isRscRequest,\n request,\n mountedSlotsHeader,\n renderMode,\n });\n },\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n createRscOnErrorHandler(pathname, routePath) {\n return createRscOnErrorHandler(request, pathname, routePath);\n },\n debugClassification: __classDebug,\n draftModeSecret: __draftModeSecret,\n dynamicConfig: __segmentConfig.dynamicConfig,\n dynamicParamsConfig: __segmentConfig.dynamicParamsConfig,\n fetchCache: __segmentConfig.fetchCache ?? null,\n isEdgeRuntime: __isEdgeRuntime(__segmentConfig.runtime),\n findIntercept(pathname) {\n return findIntercept(pathname, interceptionContext);\n },\n generateStaticParams: __generateStaticParams,\n getFontLinks: _getSSRFontLinks,\n getFontPreloads: _getSSRFontPreloads,\n getFontStyles: _getSSRFontStyles,\n getNavigationContext: _getNavigationContext,\n getSourceRoute(sourceRouteIndex) {\n return routes[sourceRouteIndex];\n },\n hasGenerateStaticParams: __generateStaticParams.length > 0,\n hasPageDefaultExport: !!PageComponent,\n hasPageModule: !!route.page,\n handlerStart,\n interceptionContext,\n expireSeconds: __expireTime,\n formState,\n actionError,\n actionFailed,\n isProgressiveActionRender,\n isProduction: process.env.NODE_ENV === \"production\",\n isRscRequest,\n isrDebug: __isrDebug,\n isrGet: __isrGet,\n isrHtmlKey: __isrHtmlKey,\n isrRscKey: __isrRscKey,\n isrSet: __isrSet,\n loadSsrHandler() {\n return import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n },\n middlewareContext,\n mountedSlotsHeader,\n params,\n staticParamsValidationParams,\n rootParams,\n probeLayoutAt(li) {\n const LayoutComp = route.layouts[li]?.default;\n if (!LayoutComp) return null;\n return LayoutComp({\n params: makeThenableParams(__resolveAppPageSegmentParams(\n route.routeSegments,\n route.layoutTreePositions?.[li] ?? 0,\n params,\n )),\n children: null,\n });\n },\n probePage() {\n return __probeAppPage({\n pageComponent: PageComponent,\n asyncRouteParams: _asyncRouteParams,\n searchParams,\n });\n },\n renderErrorBoundaryPage(renderErr) {\n return __fallbackRenderer.renderErrorBoundary(route, renderErr, isRscRequest, request, params, scriptNonce, middlewareContext, { isEdgeRuntime: __isEdgeRuntime(__segmentConfig.runtime) });\n },\n renderHttpAccessFallbackPage(statusCode, opts, currentMiddlewareContext) {\n return __fallbackRenderer.renderHttpAccessFallback(route, statusCode, isRscRequest, request, opts, scriptNonce, currentMiddlewareContext, { isEdgeRuntime: __isEdgeRuntime(__segmentConfig.runtime) });\n },\n renderToReadableStream,\n request,\n revalidateSeconds: __segmentConfig.revalidateSeconds,\n resolveRouteFetchCacheMode(targetRoute) {\n return __resolveRouteFetchCacheMode(targetRoute);\n },\n rootForbiddenModule,\n rootNotFoundModule,\n rootUnauthorizedModule,\n route,\n runWithSuppressedHookWarning(probe) {\n return suppressHookWarningAls.run(true, probe);\n },\n scheduleBackgroundRegeneration(key, renderFn, errorContext) {\n __triggerBackgroundRegeneration(key, renderFn, errorContext);\n },\n scriptNonce,\n searchParams,\n setNavigationContext,\n renderMode,\n });\n },\n dispatchMatchedRouteHandler({\n cleanPathname,\n middlewareContext,\n params,\n request,\n route,\n searchParams,\n }) {\n return __dispatchAppRouteHandler({\n basePath: __basePath,\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n draftModeSecret: __draftModeSecret,\n i18n: __i18nConfig,\n isrDebug: __isrDebug,\n isrGet: __isrGet,\n isrRouteKey: __isrRouteKey,\n isrSet: __isrSet,\n middlewareContext,\n middlewareRequestHeaders: middlewareContext.requestHeaders,\n params,\n request,\n route: {\n pattern: route.pattern,\n routeHandler: route.routeHandler,\n routeSegments: route.routeSegments,\n },\n scheduleBackgroundRegeneration: __triggerBackgroundRegeneration,\n searchParams,\n });\n },\n ${\n instrumentationPath\n ? `ensureInstrumentation() {\n return __ensureInstrumentationRegistered(_instrumentation);\n },`\n : \"\"\n }\n handleProgressiveActionRequest({\n actionId,\n cleanPathname,\n contentType,\n middlewareContext,\n request,\n }) {\n return __handleProgressiveServerActionRequest({\n actionId,\n allowedOrigins: __allowedOrigins,\n basePath: __basePath,\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n contentType,\n decodeAction,\n decodeFormState,\n getAndClearPendingCookies,\n getDraftModeCookieHeader,\n maxActionBodySize: __MAX_ACTION_BODY_SIZE,\n middlewareHeaders: middlewareContext.headers,\n readFormDataWithLimit: __readFormDataWithLimit,\n reportRequestError: _reportRequestError,\n request,\n setHeadersAccessPhase,\n });\n },\n handleServerActionRequest({\n actionId,\n cleanPathname,\n contentType,\n interceptionContext,\n isRscRequest,\n middlewareContext,\n mountedSlotsHeader,\n request,\n searchParams,\n }) {\n const __actionMatch = matchRoute(cleanPathname);\n const __actionIsEdgeRuntime = __actionMatch\n ? __isEdgeRuntime(__resolveAppPageSegmentConfig({ layouts: __actionMatch.route.layouts, page: __actionMatch.route.page }).runtime)\n : false;\n return __handleServerActionRscRequest({\n actionId,\n allowedOrigins: __allowedOrigins,\n basePath: __basePath,\n isEdgeRuntime: __actionIsEdgeRuntime,\n buildPageElement({\n route: actionRoute,\n params: actionParams,\n cleanPathname: actionCleanPathname,\n interceptOpts,\n searchParams: actionSearchParams,\n isRscRequest: actionIsRscRequest,\n request: actionRequest,\n mountedSlotsHeader: actionMountedSlotsHeader,\n renderMode: actionRenderMode,\n }) {\n return buildPageElements(actionRoute, actionParams, actionCleanPathname, {\n opts: interceptOpts,\n searchParams: actionSearchParams,\n isRscRequest: actionIsRscRequest,\n request: actionRequest,\n mountedSlotsHeader: actionMountedSlotsHeader,\n renderMode: actionRenderMode,\n });\n },\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n contentType,\n createNotFoundElement(actionRouteId) {\n return {\n ...__AppElementsWire.createMetadataEntries({\n interceptionContext: null,\n rootLayoutTreePath: null,\n routeId: actionRouteId,\n }),\n [actionRouteId]: createElement(\"div\", null, \"Page not found\"),\n };\n },\n createPayloadRouteId(pathnameToRender, currentInterceptionContext) {\n return __AppElementsWire.encodeRouteId(pathnameToRender, currentInterceptionContext);\n },\n createRscOnErrorHandler(actionRequest, actionPathname, routePattern) {\n return createRscOnErrorHandler(actionRequest, actionPathname, routePattern);\n },\n createTemporaryReferenceSet,\n decodeReply,\n findIntercept(pathnameToMatch) {\n return findIntercept(pathnameToMatch, interceptionContext);\n },\n getAndClearPendingCookies,\n getDraftModeCookieHeader,\n getRouteParamNames(sourceRoute) {\n return sourceRoute.params;\n },\n getSourceRoute(sourceRouteIndex) {\n return routes[sourceRouteIndex];\n },\n isRscRequest,\n loadServerAction,\n matchRoute(pathnameToMatch) {\n return matchRoute(pathnameToMatch);\n },\n maxActionBodySize: __MAX_ACTION_BODY_SIZE,\n middlewareHeaders: middlewareContext.headers,\n middlewareStatus: middlewareContext.status,\n mountedSlotsHeader,\n readBodyWithLimit: __readBodyWithLimit,\n readFormDataWithLimit: __readFormDataWithLimit,\n renderToReadableStream,\n reportRequestError: _reportRequestError,\n resolveRouteRuntime: __resolveRouteRuntime,\n request,\n sanitizeErrorForClient(error) {\n return __sanitizeErrorForClient(error);\n },\n searchParams,\n setHeadersAccessPhase,\n setNavigationContext,\n toInterceptOpts(intercept) {\n return {\n interceptionContext,\n interceptLayouts: intercept.interceptLayouts,\n interceptSlotId: intercept.slotId,\n interceptSlotKey: intercept.slotKey,\n interceptSourceMatchedUrl: interceptionContext,\n interceptPage: intercept.page,\n interceptParams: intercept.matchedParams,\n };\n },\n });\n },\n i18nConfig: __i18nConfig,\n isMiddlewareProxy: ${JSON.stringify(middlewarePath ? isProxyFile(middlewarePath) : false)},\n ${hasPagesDir ? `loadPrerenderPagesRoutes: __loadPrerenderPagesRoutes,` : \"\"}\n makeThenableParams,\n matchRoute,\n metadataRoutes,\n middlewareModule: ${middlewarePath ? \"middlewareModule\" : \"null\"},\n publicFiles: __publicFiles,\n renderNotFound({ isRscRequest, matchedParams, middlewareContext, request, route, scriptNonce }) {\n const __isEdge = route ? __isEdgeRuntime(__resolveAppPageSegmentConfig({ layouts: route.layouts, page: route.page }).runtime) : false;\n return __fallbackRenderer.renderNotFound(route, isRscRequest, request, matchedParams, scriptNonce, middlewareContext, { isEdgeRuntime: __isEdge });\n },\n ${\n hasPagesDir\n ? `async renderPagesFallback({ isRscRequest, middlewareContext, request, url }) {\n if (isRscRequest) return null;\n\n const __pagesEntry = await import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n\n const __pagesRequestHeaders = middlewareContext.requestHeaders\n ? __buildRequestHeadersFromMiddlewareResponse(request.headers, middlewareContext.requestHeaders)\n : null;\n let __pagesRequest = request;\n if (__pagesRequestHeaders) {\n const __pagesRequestInit = {\n method: request.method,\n headers: __pagesRequestHeaders,\n };\n if (request.method !== \"GET\" && request.method !== \"HEAD\") {\n __pagesRequestInit.body = request.body;\n __pagesRequestInit.duplex = \"half\";\n }\n __pagesRequest = new Request(request.url, __pagesRequestInit);\n }\n\n const __pagesUrl = __decodePathParams(url.pathname) + (url.search || \"\");\n const __pagesPathname = url.pathname;\n if (__pagesPathname.startsWith(\"/api/\") || __pagesPathname === \"/api\") {\n if (typeof __pagesEntry.handleApiRoute !== \"function\") return null;\n const __pagesApiResponse = await __pagesEntry.handleApiRoute(__pagesRequest, __pagesUrl);\n return __applyRouteHandlerMiddlewareContext(__pagesApiResponse, middlewareContext);\n }\n\n if (typeof __pagesEntry.renderPage !== \"function\") return null;\n const __pagesRes = await __pagesEntry.renderPage(\n __pagesRequest,\n __pagesUrl,\n {},\n undefined,\n middlewareContext.requestHeaders,\n );\n return __pagesRes.status !== 404 ? __pagesRes : null;\n },`\n : \"\"\n }\n rootParamNamesByPattern: rootParamNamesMap,\n setNavigationContext,\n staticParamsMap: generateStaticParamsMap,\n trailingSlash: __trailingSlash,\n validateDevRequestOrigin: __validateDevRequestOrigin,\n});\n\nif (import.meta.hot) {\n import.meta.hot.accept();\n}\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,MAAM,sBAAsB;AAK5B,MAAM,+BAA+B,iBACnC,2CACA,OAAO,KAAK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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2L9B,sBACI;;QAGA,GACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA0IoB,KAAK,UAAU,iBAAiB,YAAY,eAAe,GAAG,MAAM,CAAC;IACxF,cAAc,0DAA0D,GAAG;;;;sBAIzD,iBAAiB,qBAAqB,OAAO;;;;;;IAO/D,cACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAuCA,GACL"}
|
|
@@ -3,6 +3,20 @@ import { computeAppRouteStaticSiblings, convertSegmentsToRouteParts } from "../r
|
|
|
3
3
|
import "../routing/app-router.js";
|
|
4
4
|
import { createMetadataRouteEntriesSource } from "../server/metadata-route-build-data.js";
|
|
5
5
|
//#region src/entries/app-rsc-manifest.ts
|
|
6
|
+
function findRootBoundaryRoute(routes) {
|
|
7
|
+
return routes.find((route) => route.pattern === "/") ?? routes.find((route) => route.layouts.length > 0 && route.layoutTreePositions.length > 0);
|
|
8
|
+
}
|
|
9
|
+
function rootRouteLayoutPaths(route) {
|
|
10
|
+
if (!route) return [];
|
|
11
|
+
if (route.pattern === "/") return route.layouts;
|
|
12
|
+
const rootPosition = route.layoutTreePositions[0];
|
|
13
|
+
return route.layouts.filter((_, index) => route.layoutTreePositions[index] === rootPosition);
|
|
14
|
+
}
|
|
15
|
+
function rootRouteBoundaryPath(route, boundaryPaths, fallbackPath) {
|
|
16
|
+
if (!route) return null;
|
|
17
|
+
if (route.pattern === "/") return fallbackPath ?? null;
|
|
18
|
+
return boundaryPaths?.[0] ?? fallbackPath ?? null;
|
|
19
|
+
}
|
|
6
20
|
function createImportAllocator() {
|
|
7
21
|
const imports = [];
|
|
8
22
|
const importMap = /* @__PURE__ */ new Map();
|
|
@@ -184,11 +198,14 @@ function buildAppRscManifestCode(options) {
|
|
|
184
198
|
const metadataRoutes = options.metadataRoutes ?? [];
|
|
185
199
|
registerRouteModules(options.routes, imports);
|
|
186
200
|
const routeEntries = buildRouteEntries(options.routes, imports);
|
|
187
|
-
const rootRoute = options.routes
|
|
188
|
-
const
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
const
|
|
201
|
+
const rootRoute = findRootBoundaryRoute(options.routes);
|
|
202
|
+
const rootNotFoundPath = rootRouteBoundaryPath(rootRoute, rootRoute?.notFoundPaths, rootRoute?.notFoundPath);
|
|
203
|
+
const rootForbiddenPath = rootRouteBoundaryPath(rootRoute, rootRoute?.forbiddenPaths, rootRoute?.forbiddenPath);
|
|
204
|
+
const rootUnauthorizedPath = rootRouteBoundaryPath(rootRoute, rootRoute?.unauthorizedPaths, rootRoute?.unauthorizedPath);
|
|
205
|
+
const rootNotFoundVar = rootNotFoundPath ? imports.getImportVar(rootNotFoundPath) : null;
|
|
206
|
+
const rootForbiddenVar = rootForbiddenPath ? imports.getImportVar(rootForbiddenPath) : null;
|
|
207
|
+
const rootUnauthorizedVar = rootUnauthorizedPath ? imports.getImportVar(rootUnauthorizedPath) : null;
|
|
208
|
+
const rootLayoutVars = rootRouteLayoutPaths(rootRoute).map((layoutPath) => imports.getImportVar(layoutPath));
|
|
192
209
|
const globalErrorVar = options.globalErrorPath ? imports.getImportVar(options.globalErrorPath) : null;
|
|
193
210
|
const globalNotFoundImportSpecifier = options.globalNotFoundPath ? JSON.stringify(normalizePathSeparators(options.globalNotFoundPath)) : null;
|
|
194
211
|
const dynamicMetadataRoutes = metadataRoutes.filter((r) => r.isDynamic);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-rsc-manifest.js","names":[],"sources":["../../src/entries/app-rsc-manifest.ts"],"sourcesContent":["import {\n computeAppRouteStaticSiblings,\n convertSegmentsToRouteParts,\n type AppRoute,\n} from \"../routing/app-router.js\";\nimport { createMetadataRouteEntriesSource } from \"../server/metadata-route-build-data.js\";\nimport type { MetadataFileRoute } from \"../server/metadata-routes.js\";\nimport { normalizePathSeparators } from \"../utils/path.js\";\n\ntype AppRscManifestCode = {\n imports: string[];\n routeEntries: string[];\n metaRouteEntries: string[];\n generateStaticParamsEntries: string[];\n rootParamNameEntries: string[];\n rootNotFoundVar: string | null;\n rootForbiddenVar: string | null;\n rootUnauthorizedVar: string | null;\n rootLayoutVars: string[];\n globalErrorVar: string | null;\n /**\n * Path expression for the `app/global-not-found.{tsx,ts,js,jsx}` module\n * suitable for embedding in a generated `import()` call (already JSON-encoded\n * with platform path separators normalized). `null` when the user did not\n * define `global-not-found.tsx`.\n *\n * We intentionally do NOT register this module as a static `import * as`\n * in the manifest. Statically importing it puts global-not-found.tsx in\n * the same JS chunk as the root layout, which causes the CSS bundler to\n * concatenate their stylesheets into a single CSS file. The CSS minifier\n * (lightningcss) then drops overlapping declarations as dead code, so any\n * rule in global-not-found's CSS that the layout's CSS also defines gets\n * silently removed — breaking the cascade on route-miss 404s where only\n * global-not-found is supposed to render.\n *\n * By emitting a dynamic `import()` instead, the bundler gives\n * global-not-found.tsx its own chunk with its own CSS asset.\n *\n * @see Next.js test: test/e2e/app-dir/initial-css-order/initial-css-order.test.ts\n */\n globalNotFoundImportSpecifier: string | null;\n};\n\ntype BuildAppRscManifestCodeOptions = {\n routes: AppRoute[];\n metadataRoutes?: MetadataFileRoute[];\n globalErrorPath?: string | null;\n /**\n * Optional `app/global-not-found.tsx` path. When present, route-miss 404s\n * render this module standalone (it provides its own <html>/<body>) instead\n * of wrapping the regular not-found boundary inside the root layout.\n * Mirrors Next.js 16's `experimental.globalNotFound` behavior.\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/app-render.tsx\n */\n globalNotFoundPath?: string | null;\n};\n\ntype ImportAllocator = {\n getImportVar(filePath: string): string;\n importMap: ReadonlyMap<string, string>;\n imports: string[];\n};\n\nfunction createImportAllocator(): ImportAllocator {\n const imports: string[] = [];\n const importMap = new Map<string, string>();\n let importIdx = 0;\n\n return {\n importMap,\n imports,\n getImportVar(filePath) {\n const existing = importMap.get(filePath);\n if (existing) return existing;\n\n const varName = `mod_${importIdx++}`;\n const absPath = normalizePathSeparators(filePath);\n imports.push(`import * as ${varName} from ${JSON.stringify(absPath)};`);\n importMap.set(filePath, varName);\n return varName;\n },\n };\n}\n\nfunction registerRouteModules(routes: AppRoute[], imports: ImportAllocator): void {\n for (const route of routes) {\n if (route.pagePath) imports.getImportVar(route.pagePath);\n if (route.routePath) imports.getImportVar(route.routePath);\n for (const layout of route.layouts) imports.getImportVar(layout);\n for (const tmpl of route.templates) imports.getImportVar(tmpl);\n if (route.loadingPath) imports.getImportVar(route.loadingPath);\n if (route.errorPath) imports.getImportVar(route.errorPath);\n if (route.layoutErrorPaths) {\n for (const ep of route.layoutErrorPaths) {\n if (ep) imports.getImportVar(ep);\n }\n }\n if (route.errorPaths) {\n for (const ep of route.errorPaths) {\n imports.getImportVar(ep);\n }\n }\n if (route.notFoundPath) imports.getImportVar(route.notFoundPath);\n if (route.notFoundPaths) {\n for (const nfp of route.notFoundPaths) {\n if (nfp) imports.getImportVar(nfp);\n }\n }\n if (route.forbiddenPath) imports.getImportVar(route.forbiddenPath);\n if (route.forbiddenPaths) {\n for (const fp of route.forbiddenPaths) {\n if (fp) imports.getImportVar(fp);\n }\n }\n if (route.unauthorizedPath) imports.getImportVar(route.unauthorizedPath);\n if (route.unauthorizedPaths) {\n for (const up of route.unauthorizedPaths) {\n if (up) imports.getImportVar(up);\n }\n }\n for (const slot of route.parallelSlots) {\n if (slot.pagePath) imports.getImportVar(slot.pagePath);\n if (slot.defaultPath) imports.getImportVar(slot.defaultPath);\n if (slot.layoutPath) imports.getImportVar(slot.layoutPath);\n if (slot.loadingPath) imports.getImportVar(slot.loadingPath);\n if (slot.errorPath) imports.getImportVar(slot.errorPath);\n for (const ir of slot.interceptingRoutes) {\n imports.getImportVar(ir.pagePath);\n for (const layoutPath of ir.layoutPaths) {\n imports.getImportVar(layoutPath);\n }\n }\n }\n }\n}\n\nfunction buildRouteEntries(routes: AppRoute[], imports: ImportAllocator): string[] {\n return routes.map((route, routeIdx) => {\n // Pre-compute static-sibling segment names for the matched route's\n // dynamic URL levels. The client router uses this to decide if a cached\n // dynamic-route prefetch can be reused when navigating to a static\n // sibling URL (issue cloudflare/vinext#1525). Emitted only when there are\n // siblings so static routes get an empty literal and stay lean.\n const staticSiblings = route.isDynamic ? computeAppRouteStaticSiblings(routes, route) : [];\n const layoutVars = route.layouts.map((l) => imports.getImportVar(l));\n const templateVars = route.templates.map((t) => imports.getImportVar(t));\n const notFoundVars = (route.notFoundPaths ?? []).map((nf) =>\n nf ? imports.getImportVar(nf) : \"null\",\n );\n const forbiddenVars = (route.forbiddenPaths ?? []).map((fp) =>\n fp ? imports.getImportVar(fp) : \"null\",\n );\n const unauthorizedVars = (route.unauthorizedPaths ?? []).map((up) =>\n up ? imports.getImportVar(up) : \"null\",\n );\n const slotEntries = route.parallelSlots.map((slot) => {\n const interceptEntries = slot.interceptingRoutes.map(\n (ir) => ` {\n convention: ${JSON.stringify(ir.convention)},\n targetPattern: ${JSON.stringify(ir.targetPattern)},\n sourceMatchPattern: ${JSON.stringify(ir.sourceMatchPattern)},\n interceptLayouts: [${ir.layoutPaths.map((layoutPath) => imports.getImportVar(layoutPath)).join(\", \")}],\n page: ${imports.getImportVar(ir.pagePath)},\n params: ${JSON.stringify(ir.params)},\n }`,\n );\n return ` ${JSON.stringify(slot.key)}: {\n id: ${JSON.stringify(slot.id ?? null)},\n name: ${JSON.stringify(slot.name)},\n page: ${slot.pagePath ? imports.getImportVar(slot.pagePath) : \"null\"},\n default: ${slot.defaultPath ? imports.getImportVar(slot.defaultPath) : \"null\"},\n layout: ${slot.layoutPath ? imports.getImportVar(slot.layoutPath) : \"null\"},\n loading: ${slot.loadingPath ? imports.getImportVar(slot.loadingPath) : \"null\"},\n error: ${slot.errorPath ? imports.getImportVar(slot.errorPath) : \"null\"},\n layoutIndex: ${slot.layoutIndex},\n routeSegments: ${JSON.stringify(slot.routeSegments)},\n slotPatternParts: ${slot.slotPatternParts ? JSON.stringify(slot.slotPatternParts) : \"null\"},\n slotParamNames: ${slot.slotParamNames ? JSON.stringify(slot.slotParamNames) : \"null\"},\n intercepts: [\n${interceptEntries.join(\",\\n\")}\n ],\n }`;\n });\n const layoutErrorVars = (route.layoutErrorPaths || []).map((ep) =>\n ep ? imports.getImportVar(ep) : \"null\",\n );\n const errorVars = (route.errorPaths ?? []).map((ep) => imports.getImportVar(ep));\n return ` {\n __buildTimeClassifications: __VINEXT_CLASS(${routeIdx}), // evaluated once at module load\n __buildTimeReasons: __classDebug ? __VINEXT_CLASS_REASONS(${routeIdx}) : null,\n ids: ${JSON.stringify(route.ids ?? null)},\n pattern: ${JSON.stringify(route.pattern)},\n patternParts: ${JSON.stringify(route.patternParts)},\n isDynamic: ${route.isDynamic},\n params: ${JSON.stringify(route.params)},\n staticSiblings: ${JSON.stringify(staticSiblings)},\n rootParamNames: ${JSON.stringify(route.rootParamNames ?? [])},\n page: ${route.pagePath ? imports.getImportVar(route.pagePath) : \"null\"},\n routeHandler: ${route.routePath ? imports.getImportVar(route.routePath) : \"null\"},\n layouts: [${layoutVars.join(\", \")}],\n routeSegments: ${JSON.stringify(route.routeSegments)},\n templateTreePositions: ${JSON.stringify(route.templateTreePositions)},\n layoutTreePositions: ${JSON.stringify(route.layoutTreePositions)},\n templates: [${templateVars.join(\", \")}],\n errors: [${layoutErrorVars.join(\", \")}],\n errorPaths: [${errorVars.join(\", \")}],\n errorTreePositions: ${JSON.stringify(route.errorTreePositions ?? null)},\n slots: {\n${slotEntries.join(\",\\n\")}\n },\n loading: ${route.loadingPath ? imports.getImportVar(route.loadingPath) : \"null\"},\n error: ${route.errorPath ? imports.getImportVar(route.errorPath) : \"null\"},\n notFound: ${route.notFoundPath ? imports.getImportVar(route.notFoundPath) : \"null\"},\n notFounds: [${notFoundVars.join(\", \")}],\n forbidden: ${route.forbiddenPath ? imports.getImportVar(route.forbiddenPath) : \"null\"},\n forbiddens: [${forbiddenVars.join(\", \")}],\n unauthorized: ${route.unauthorizedPath ? imports.getImportVar(route.unauthorizedPath) : \"null\"},\n unauthorizeds: [${unauthorizedVars.join(\", \")}],\n }`;\n });\n}\n\ntype RoutePatternPrefix = {\n pattern: string;\n paramNames: string[];\n};\n\nfunction createRoutePatternPrefix(\n routeSegments: readonly string[],\n treePosition: number,\n): RoutePatternPrefix | null {\n // treePosition is always non-negative (represents tree depth).\n const limit = Math.min(treePosition, routeSegments.length);\n const converted = convertSegmentsToRouteParts(routeSegments.slice(0, limit));\n if (!converted) return null;\n\n return {\n pattern: converted.urlSegments.length === 0 ? \"/\" : `/${converted.urlSegments.join(\"/\")}`,\n paramNames: converted.params,\n };\n}\n\nfunction appendStaticParamSource(\n sourcesByPattern: Map<string, string[]>,\n pattern: string | null,\n sourceVar: string,\n): void {\n if (!pattern || pattern === \"/\" || !pattern.includes(\":\")) return;\n const sources = sourcesByPattern.get(pattern) ?? [];\n // ImportAllocator is path-stable, so the generated member expression is a\n // deterministic key for deduping the same module across inherited routes.\n if (!sources.includes(sourceVar)) sources.push(sourceVar);\n sourcesByPattern.set(pattern, sources);\n}\n\nfunction buildRootParamNamesByPattern(routes: AppRoute[]): Map<string, string[]> {\n const namesByPattern = new Map<string, string[]>();\n\n function append(\n pattern: string | null,\n rootParamNames: readonly string[] | undefined,\n paramNames: readonly string[],\n ): void {\n if (!pattern || pattern === \"/\" || !pattern.includes(\":\")) return;\n const patternParams = new Set(paramNames);\n const names = (rootParamNames ?? []).filter((name) => patternParams.has(name));\n if (names.length === 0) return;\n\n const existing = namesByPattern.get(pattern) ?? [];\n for (const name of names) {\n if (!existing.includes(name)) existing.push(name);\n }\n namesByPattern.set(pattern, existing);\n }\n\n for (const route of routes) {\n if (!route.isDynamic) continue;\n append(route.pattern, route.rootParamNames, route.params);\n for (const treePosition of route.layoutTreePositions) {\n const prefix = createRoutePatternPrefix(route.routeSegments, treePosition);\n append(prefix?.pattern ?? null, route.rootParamNames, prefix?.paramNames ?? []);\n }\n }\n\n return namesByPattern;\n}\n\nfunction buildGenerateStaticParamsEntries(\n routes: AppRoute[],\n imports: ImportAllocator,\n namesByPattern: Map<string, string[]>,\n): string[] {\n const sourcesByPattern = new Map<string, string[]>();\n\n for (const route of routes) {\n if (!route.isDynamic) continue;\n\n for (const [index, layoutPath] of route.layouts.entries()) {\n appendStaticParamSource(\n sourcesByPattern,\n createRoutePatternPrefix(route.routeSegments, route.layoutTreePositions[index] ?? 0)\n ?.pattern ?? null,\n `${imports.getImportVar(layoutPath)}?.generateStaticParams`,\n );\n }\n\n if (route.pagePath) {\n appendStaticParamSource(\n sourcesByPattern,\n route.pattern,\n `${imports.getImportVar(route.pagePath)}?.generateStaticParams`,\n );\n }\n }\n\n return Array.from(sourcesByPattern.entries()).map(([pattern, sources]) => {\n const rootParamNames = namesByPattern.get(pattern) ?? [];\n return ` ${JSON.stringify(pattern)}: __createAppPrerenderStaticParamsResolver([${sources.join(\n \", \",\n )}], ${JSON.stringify(rootParamNames)}),`;\n });\n}\n\nfunction buildRootParamNameEntries(namesByPattern: Map<string, string[]>): string[] {\n return Array.from(namesByPattern.entries()).map(\n ([pattern, names]) => ` ${JSON.stringify(pattern)}: ${JSON.stringify(names)},`,\n );\n}\n\nexport function buildAppRscManifestCode(\n options: BuildAppRscManifestCodeOptions,\n): AppRscManifestCode {\n const imports = createImportAllocator();\n const metadataRoutes = options.metadataRoutes ?? [];\n\n registerRouteModules(options.routes, imports);\n const routeEntries = buildRouteEntries(options.routes, imports);\n\n const rootRoute = options.routes.find((r) => r.pattern === \"/\");\n const rootNotFoundVar = rootRoute?.notFoundPath\n ? imports.getImportVar(rootRoute.notFoundPath)\n : null;\n const rootForbiddenVar = rootRoute?.forbiddenPath\n ? imports.getImportVar(rootRoute.forbiddenPath)\n : null;\n const rootUnauthorizedVar = rootRoute?.unauthorizedPath\n ? imports.getImportVar(rootRoute.unauthorizedPath)\n : null;\n const rootLayoutVars = rootRoute ? rootRoute.layouts.map((l) => imports.getImportVar(l)) : [];\n const globalErrorVar = options.globalErrorPath\n ? imports.getImportVar(options.globalErrorPath)\n : null;\n // Intentionally NOT registered as a static `import * as` — see the docstring\n // on `AppRscManifestCode.globalNotFoundImportSpecifier` for the chunk/CSS\n // isolation rationale. We emit a dynamic `import()` from the entry instead.\n const globalNotFoundImportSpecifier = options.globalNotFoundPath\n ? JSON.stringify(normalizePathSeparators(options.globalNotFoundPath))\n : null;\n\n const dynamicMetadataRoutes = metadataRoutes.filter((r) => r.isDynamic);\n for (const route of dynamicMetadataRoutes) {\n imports.getImportVar(route.filePath);\n }\n\n const namesByPattern = buildRootParamNamesByPattern(options.routes);\n\n return {\n imports: imports.imports,\n routeEntries,\n metaRouteEntries: createMetadataRouteEntriesSource(metadataRoutes, imports.importMap),\n generateStaticParamsEntries: buildGenerateStaticParamsEntries(\n options.routes,\n imports,\n namesByPattern,\n ),\n rootParamNameEntries: buildRootParamNameEntries(namesByPattern),\n rootNotFoundVar,\n rootForbiddenVar,\n rootUnauthorizedVar,\n rootLayoutVars,\n globalErrorVar,\n globalNotFoundImportSpecifier,\n };\n}\n"],"mappings":";;;;;AA+DA,SAAS,wBAAyC;CAChD,MAAM,UAAoB,EAAE;CAC5B,MAAM,4BAAY,IAAI,KAAqB;CAC3C,IAAI,YAAY;CAEhB,OAAO;EACL;EACA;EACA,aAAa,UAAU;GACrB,MAAM,WAAW,UAAU,IAAI,SAAS;GACxC,IAAI,UAAU,OAAO;GAErB,MAAM,UAAU,OAAO;GACvB,MAAM,UAAU,wBAAwB,SAAS;GACjD,QAAQ,KAAK,eAAe,QAAQ,QAAQ,KAAK,UAAU,QAAQ,CAAC,GAAG;GACvE,UAAU,IAAI,UAAU,QAAQ;GAChC,OAAO;;EA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-rsc-manifest.js","names":[],"sources":["../../src/entries/app-rsc-manifest.ts"],"sourcesContent":["import {\n computeAppRouteStaticSiblings,\n convertSegmentsToRouteParts,\n type AppRoute,\n} from \"../routing/app-router.js\";\nimport { createMetadataRouteEntriesSource } from \"../server/metadata-route-build-data.js\";\nimport type { MetadataFileRoute } from \"../server/metadata-routes.js\";\nimport { normalizePathSeparators } from \"../utils/path.js\";\n\ntype AppRscManifestCode = {\n imports: string[];\n routeEntries: string[];\n metaRouteEntries: string[];\n generateStaticParamsEntries: string[];\n rootParamNameEntries: string[];\n rootNotFoundVar: string | null;\n rootForbiddenVar: string | null;\n rootUnauthorizedVar: string | null;\n rootLayoutVars: string[];\n globalErrorVar: string | null;\n /**\n * Path expression for the `app/global-not-found.{tsx,ts,js,jsx}` module\n * suitable for embedding in a generated `import()` call (already JSON-encoded\n * with platform path separators normalized). `null` when the user did not\n * define `global-not-found.tsx`.\n *\n * We intentionally do NOT register this module as a static `import * as`\n * in the manifest. Statically importing it puts global-not-found.tsx in\n * the same JS chunk as the root layout, which causes the CSS bundler to\n * concatenate their stylesheets into a single CSS file. The CSS minifier\n * (lightningcss) then drops overlapping declarations as dead code, so any\n * rule in global-not-found's CSS that the layout's CSS also defines gets\n * silently removed — breaking the cascade on route-miss 404s where only\n * global-not-found is supposed to render.\n *\n * By emitting a dynamic `import()` instead, the bundler gives\n * global-not-found.tsx its own chunk with its own CSS asset.\n *\n * @see Next.js test: test/e2e/app-dir/initial-css-order/initial-css-order.test.ts\n */\n globalNotFoundImportSpecifier: string | null;\n};\n\ntype BuildAppRscManifestCodeOptions = {\n routes: AppRoute[];\n metadataRoutes?: MetadataFileRoute[];\n globalErrorPath?: string | null;\n /**\n * Optional `app/global-not-found.tsx` path. When present, route-miss 404s\n * render this module standalone (it provides its own <html>/<body>) instead\n * of wrapping the regular not-found boundary inside the root layout.\n * Mirrors Next.js 16's `experimental.globalNotFound` behavior.\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/app-render.tsx\n */\n globalNotFoundPath?: string | null;\n};\n\nfunction findRootBoundaryRoute(routes: readonly AppRoute[]): AppRoute | undefined {\n return (\n routes.find((route) => route.pattern === \"/\") ??\n routes.find((route) => route.layouts.length > 0 && route.layoutTreePositions.length > 0)\n );\n}\n\nfunction rootRouteLayoutPaths(route: AppRoute | undefined): readonly string[] {\n if (!route) return [];\n if (route.pattern === \"/\") return route.layouts;\n\n const rootPosition = route.layoutTreePositions[0];\n return route.layouts.filter((_, index) => route.layoutTreePositions[index] === rootPosition);\n}\n\nfunction rootRouteBoundaryPath(\n route: AppRoute | undefined,\n boundaryPaths: readonly (string | null)[] | undefined,\n fallbackPath: string | null | undefined,\n): string | null {\n if (!route) return null;\n if (route.pattern === \"/\") return fallbackPath ?? null;\n // Boundary arrays are ordered from the root layout outward by the route\n // scanner, so the first entry is the root boundary for non-root routes.\n return boundaryPaths?.[0] ?? fallbackPath ?? null;\n}\n\ntype ImportAllocator = {\n getImportVar(filePath: string): string;\n importMap: ReadonlyMap<string, string>;\n imports: string[];\n};\n\nfunction createImportAllocator(): ImportAllocator {\n const imports: string[] = [];\n const importMap = new Map<string, string>();\n let importIdx = 0;\n\n return {\n importMap,\n imports,\n getImportVar(filePath) {\n const existing = importMap.get(filePath);\n if (existing) return existing;\n\n const varName = `mod_${importIdx++}`;\n const absPath = normalizePathSeparators(filePath);\n imports.push(`import * as ${varName} from ${JSON.stringify(absPath)};`);\n importMap.set(filePath, varName);\n return varName;\n },\n };\n}\n\nfunction registerRouteModules(routes: AppRoute[], imports: ImportAllocator): void {\n for (const route of routes) {\n if (route.pagePath) imports.getImportVar(route.pagePath);\n if (route.routePath) imports.getImportVar(route.routePath);\n for (const layout of route.layouts) imports.getImportVar(layout);\n for (const tmpl of route.templates) imports.getImportVar(tmpl);\n if (route.loadingPath) imports.getImportVar(route.loadingPath);\n if (route.errorPath) imports.getImportVar(route.errorPath);\n if (route.layoutErrorPaths) {\n for (const ep of route.layoutErrorPaths) {\n if (ep) imports.getImportVar(ep);\n }\n }\n if (route.errorPaths) {\n for (const ep of route.errorPaths) {\n imports.getImportVar(ep);\n }\n }\n if (route.notFoundPath) imports.getImportVar(route.notFoundPath);\n if (route.notFoundPaths) {\n for (const nfp of route.notFoundPaths) {\n if (nfp) imports.getImportVar(nfp);\n }\n }\n if (route.forbiddenPath) imports.getImportVar(route.forbiddenPath);\n if (route.forbiddenPaths) {\n for (const fp of route.forbiddenPaths) {\n if (fp) imports.getImportVar(fp);\n }\n }\n if (route.unauthorizedPath) imports.getImportVar(route.unauthorizedPath);\n if (route.unauthorizedPaths) {\n for (const up of route.unauthorizedPaths) {\n if (up) imports.getImportVar(up);\n }\n }\n for (const slot of route.parallelSlots) {\n if (slot.pagePath) imports.getImportVar(slot.pagePath);\n if (slot.defaultPath) imports.getImportVar(slot.defaultPath);\n if (slot.layoutPath) imports.getImportVar(slot.layoutPath);\n if (slot.loadingPath) imports.getImportVar(slot.loadingPath);\n if (slot.errorPath) imports.getImportVar(slot.errorPath);\n for (const ir of slot.interceptingRoutes) {\n imports.getImportVar(ir.pagePath);\n for (const layoutPath of ir.layoutPaths) {\n imports.getImportVar(layoutPath);\n }\n }\n }\n }\n}\n\nfunction buildRouteEntries(routes: AppRoute[], imports: ImportAllocator): string[] {\n return routes.map((route, routeIdx) => {\n // Pre-compute static-sibling segment names for the matched route's\n // dynamic URL levels. The client router uses this to decide if a cached\n // dynamic-route prefetch can be reused when navigating to a static\n // sibling URL (issue cloudflare/vinext#1525). Emitted only when there are\n // siblings so static routes get an empty literal and stay lean.\n const staticSiblings = route.isDynamic ? computeAppRouteStaticSiblings(routes, route) : [];\n const layoutVars = route.layouts.map((l) => imports.getImportVar(l));\n const templateVars = route.templates.map((t) => imports.getImportVar(t));\n const notFoundVars = (route.notFoundPaths ?? []).map((nf) =>\n nf ? imports.getImportVar(nf) : \"null\",\n );\n const forbiddenVars = (route.forbiddenPaths ?? []).map((fp) =>\n fp ? imports.getImportVar(fp) : \"null\",\n );\n const unauthorizedVars = (route.unauthorizedPaths ?? []).map((up) =>\n up ? imports.getImportVar(up) : \"null\",\n );\n const slotEntries = route.parallelSlots.map((slot) => {\n const interceptEntries = slot.interceptingRoutes.map(\n (ir) => ` {\n convention: ${JSON.stringify(ir.convention)},\n targetPattern: ${JSON.stringify(ir.targetPattern)},\n sourceMatchPattern: ${JSON.stringify(ir.sourceMatchPattern)},\n interceptLayouts: [${ir.layoutPaths.map((layoutPath) => imports.getImportVar(layoutPath)).join(\", \")}],\n page: ${imports.getImportVar(ir.pagePath)},\n params: ${JSON.stringify(ir.params)},\n }`,\n );\n return ` ${JSON.stringify(slot.key)}: {\n id: ${JSON.stringify(slot.id ?? null)},\n name: ${JSON.stringify(slot.name)},\n page: ${slot.pagePath ? imports.getImportVar(slot.pagePath) : \"null\"},\n default: ${slot.defaultPath ? imports.getImportVar(slot.defaultPath) : \"null\"},\n layout: ${slot.layoutPath ? imports.getImportVar(slot.layoutPath) : \"null\"},\n loading: ${slot.loadingPath ? imports.getImportVar(slot.loadingPath) : \"null\"},\n error: ${slot.errorPath ? imports.getImportVar(slot.errorPath) : \"null\"},\n layoutIndex: ${slot.layoutIndex},\n routeSegments: ${JSON.stringify(slot.routeSegments)},\n slotPatternParts: ${slot.slotPatternParts ? JSON.stringify(slot.slotPatternParts) : \"null\"},\n slotParamNames: ${slot.slotParamNames ? JSON.stringify(slot.slotParamNames) : \"null\"},\n intercepts: [\n${interceptEntries.join(\",\\n\")}\n ],\n }`;\n });\n const layoutErrorVars = (route.layoutErrorPaths || []).map((ep) =>\n ep ? imports.getImportVar(ep) : \"null\",\n );\n const errorVars = (route.errorPaths ?? []).map((ep) => imports.getImportVar(ep));\n return ` {\n __buildTimeClassifications: __VINEXT_CLASS(${routeIdx}), // evaluated once at module load\n __buildTimeReasons: __classDebug ? __VINEXT_CLASS_REASONS(${routeIdx}) : null,\n ids: ${JSON.stringify(route.ids ?? null)},\n pattern: ${JSON.stringify(route.pattern)},\n patternParts: ${JSON.stringify(route.patternParts)},\n isDynamic: ${route.isDynamic},\n params: ${JSON.stringify(route.params)},\n staticSiblings: ${JSON.stringify(staticSiblings)},\n rootParamNames: ${JSON.stringify(route.rootParamNames ?? [])},\n page: ${route.pagePath ? imports.getImportVar(route.pagePath) : \"null\"},\n routeHandler: ${route.routePath ? imports.getImportVar(route.routePath) : \"null\"},\n layouts: [${layoutVars.join(\", \")}],\n routeSegments: ${JSON.stringify(route.routeSegments)},\n templateTreePositions: ${JSON.stringify(route.templateTreePositions)},\n layoutTreePositions: ${JSON.stringify(route.layoutTreePositions)},\n templates: [${templateVars.join(\", \")}],\n errors: [${layoutErrorVars.join(\", \")}],\n errorPaths: [${errorVars.join(\", \")}],\n errorTreePositions: ${JSON.stringify(route.errorTreePositions ?? null)},\n slots: {\n${slotEntries.join(\",\\n\")}\n },\n loading: ${route.loadingPath ? imports.getImportVar(route.loadingPath) : \"null\"},\n error: ${route.errorPath ? imports.getImportVar(route.errorPath) : \"null\"},\n notFound: ${route.notFoundPath ? imports.getImportVar(route.notFoundPath) : \"null\"},\n notFounds: [${notFoundVars.join(\", \")}],\n forbidden: ${route.forbiddenPath ? imports.getImportVar(route.forbiddenPath) : \"null\"},\n forbiddens: [${forbiddenVars.join(\", \")}],\n unauthorized: ${route.unauthorizedPath ? imports.getImportVar(route.unauthorizedPath) : \"null\"},\n unauthorizeds: [${unauthorizedVars.join(\", \")}],\n }`;\n });\n}\n\ntype RoutePatternPrefix = {\n pattern: string;\n paramNames: string[];\n};\n\nfunction createRoutePatternPrefix(\n routeSegments: readonly string[],\n treePosition: number,\n): RoutePatternPrefix | null {\n // treePosition is always non-negative (represents tree depth).\n const limit = Math.min(treePosition, routeSegments.length);\n const converted = convertSegmentsToRouteParts(routeSegments.slice(0, limit));\n if (!converted) return null;\n\n return {\n pattern: converted.urlSegments.length === 0 ? \"/\" : `/${converted.urlSegments.join(\"/\")}`,\n paramNames: converted.params,\n };\n}\n\nfunction appendStaticParamSource(\n sourcesByPattern: Map<string, string[]>,\n pattern: string | null,\n sourceVar: string,\n): void {\n if (!pattern || pattern === \"/\" || !pattern.includes(\":\")) return;\n const sources = sourcesByPattern.get(pattern) ?? [];\n // ImportAllocator is path-stable, so the generated member expression is a\n // deterministic key for deduping the same module across inherited routes.\n if (!sources.includes(sourceVar)) sources.push(sourceVar);\n sourcesByPattern.set(pattern, sources);\n}\n\nfunction buildRootParamNamesByPattern(routes: AppRoute[]): Map<string, string[]> {\n const namesByPattern = new Map<string, string[]>();\n\n function append(\n pattern: string | null,\n rootParamNames: readonly string[] | undefined,\n paramNames: readonly string[],\n ): void {\n if (!pattern || pattern === \"/\" || !pattern.includes(\":\")) return;\n const patternParams = new Set(paramNames);\n const names = (rootParamNames ?? []).filter((name) => patternParams.has(name));\n if (names.length === 0) return;\n\n const existing = namesByPattern.get(pattern) ?? [];\n for (const name of names) {\n if (!existing.includes(name)) existing.push(name);\n }\n namesByPattern.set(pattern, existing);\n }\n\n for (const route of routes) {\n if (!route.isDynamic) continue;\n append(route.pattern, route.rootParamNames, route.params);\n for (const treePosition of route.layoutTreePositions) {\n const prefix = createRoutePatternPrefix(route.routeSegments, treePosition);\n append(prefix?.pattern ?? null, route.rootParamNames, prefix?.paramNames ?? []);\n }\n }\n\n return namesByPattern;\n}\n\nfunction buildGenerateStaticParamsEntries(\n routes: AppRoute[],\n imports: ImportAllocator,\n namesByPattern: Map<string, string[]>,\n): string[] {\n const sourcesByPattern = new Map<string, string[]>();\n\n for (const route of routes) {\n if (!route.isDynamic) continue;\n\n for (const [index, layoutPath] of route.layouts.entries()) {\n appendStaticParamSource(\n sourcesByPattern,\n createRoutePatternPrefix(route.routeSegments, route.layoutTreePositions[index] ?? 0)\n ?.pattern ?? null,\n `${imports.getImportVar(layoutPath)}?.generateStaticParams`,\n );\n }\n\n if (route.pagePath) {\n appendStaticParamSource(\n sourcesByPattern,\n route.pattern,\n `${imports.getImportVar(route.pagePath)}?.generateStaticParams`,\n );\n }\n }\n\n return Array.from(sourcesByPattern.entries()).map(([pattern, sources]) => {\n const rootParamNames = namesByPattern.get(pattern) ?? [];\n return ` ${JSON.stringify(pattern)}: __createAppPrerenderStaticParamsResolver([${sources.join(\n \", \",\n )}], ${JSON.stringify(rootParamNames)}),`;\n });\n}\n\nfunction buildRootParamNameEntries(namesByPattern: Map<string, string[]>): string[] {\n return Array.from(namesByPattern.entries()).map(\n ([pattern, names]) => ` ${JSON.stringify(pattern)}: ${JSON.stringify(names)},`,\n );\n}\n\nexport function buildAppRscManifestCode(\n options: BuildAppRscManifestCodeOptions,\n): AppRscManifestCode {\n const imports = createImportAllocator();\n const metadataRoutes = options.metadataRoutes ?? [];\n\n registerRouteModules(options.routes, imports);\n const routeEntries = buildRouteEntries(options.routes, imports);\n\n const rootRoute = findRootBoundaryRoute(options.routes);\n const rootNotFoundPath = rootRouteBoundaryPath(\n rootRoute,\n rootRoute?.notFoundPaths,\n rootRoute?.notFoundPath,\n );\n const rootForbiddenPath = rootRouteBoundaryPath(\n rootRoute,\n rootRoute?.forbiddenPaths,\n rootRoute?.forbiddenPath,\n );\n const rootUnauthorizedPath = rootRouteBoundaryPath(\n rootRoute,\n rootRoute?.unauthorizedPaths,\n rootRoute?.unauthorizedPath,\n );\n const rootNotFoundVar = rootNotFoundPath ? imports.getImportVar(rootNotFoundPath) : null;\n const rootForbiddenVar = rootForbiddenPath ? imports.getImportVar(rootForbiddenPath) : null;\n const rootUnauthorizedVar = rootUnauthorizedPath\n ? imports.getImportVar(rootUnauthorizedPath)\n : null;\n const rootLayoutVars = rootRouteLayoutPaths(rootRoute).map((layoutPath) =>\n imports.getImportVar(layoutPath),\n );\n const globalErrorVar = options.globalErrorPath\n ? imports.getImportVar(options.globalErrorPath)\n : null;\n // Intentionally NOT registered as a static `import * as` — see the docstring\n // on `AppRscManifestCode.globalNotFoundImportSpecifier` for the chunk/CSS\n // isolation rationale. We emit a dynamic `import()` from the entry instead.\n const globalNotFoundImportSpecifier = options.globalNotFoundPath\n ? JSON.stringify(normalizePathSeparators(options.globalNotFoundPath))\n : null;\n\n const dynamicMetadataRoutes = metadataRoutes.filter((r) => r.isDynamic);\n for (const route of dynamicMetadataRoutes) {\n imports.getImportVar(route.filePath);\n }\n\n const namesByPattern = buildRootParamNamesByPattern(options.routes);\n\n return {\n imports: imports.imports,\n routeEntries,\n metaRouteEntries: createMetadataRouteEntriesSource(metadataRoutes, imports.importMap),\n generateStaticParamsEntries: buildGenerateStaticParamsEntries(\n options.routes,\n imports,\n namesByPattern,\n ),\n rootParamNameEntries: buildRootParamNameEntries(namesByPattern),\n rootNotFoundVar,\n rootForbiddenVar,\n rootUnauthorizedVar,\n rootLayoutVars,\n globalErrorVar,\n globalNotFoundImportSpecifier,\n };\n}\n"],"mappings":";;;;;AAyDA,SAAS,sBAAsB,QAAmD;CAChF,OACE,OAAO,MAAM,UAAU,MAAM,YAAY,IAAI,IAC7C,OAAO,MAAM,UAAU,MAAM,QAAQ,SAAS,KAAK,MAAM,oBAAoB,SAAS,EAAE;;AAI5F,SAAS,qBAAqB,OAAgD;CAC5E,IAAI,CAAC,OAAO,OAAO,EAAE;CACrB,IAAI,MAAM,YAAY,KAAK,OAAO,MAAM;CAExC,MAAM,eAAe,MAAM,oBAAoB;CAC/C,OAAO,MAAM,QAAQ,QAAQ,GAAG,UAAU,MAAM,oBAAoB,WAAW,aAAa;;AAG9F,SAAS,sBACP,OACA,eACA,cACe;CACf,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,MAAM,YAAY,KAAK,OAAO,gBAAgB;CAGlD,OAAO,gBAAgB,MAAM,gBAAgB;;AAS/C,SAAS,wBAAyC;CAChD,MAAM,UAAoB,EAAE;CAC5B,MAAM,4BAAY,IAAI,KAAqB;CAC3C,IAAI,YAAY;CAEhB,OAAO;EACL;EACA;EACA,aAAa,UAAU;GACrB,MAAM,WAAW,UAAU,IAAI,SAAS;GACxC,IAAI,UAAU,OAAO;GAErB,MAAM,UAAU,OAAO;GACvB,MAAM,UAAU,wBAAwB,SAAS;GAC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;CAEnE,OAAO;EACL,SAAS,QAAQ;EACjB;EACA,kBAAkB,iCAAiC,gBAAgB,QAAQ,UAAU;EACrF,6BAA6B,iCAC3B,QAAQ,QACR,SACA,eACD;EACD,sBAAsB,0BAA0B,eAAe;EAC/D;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -74,6 +74,7 @@ async function generateServerEntry(pagesDir, nextConfig, fileMatcher, middleware
|
|
|
74
74
|
},
|
|
75
75
|
headers: nextConfig?.headers ?? [],
|
|
76
76
|
expireTime: nextConfig?.expireTime,
|
|
77
|
+
cacheMaxMemorySize: nextConfig?.cacheMaxMemorySize,
|
|
77
78
|
i18n: nextConfig?.i18n ?? null,
|
|
78
79
|
disableOptimizedLoading: nextConfig?.disableOptimizedLoading === true,
|
|
79
80
|
clientTraceMetadata: nextConfig?.clientTraceMetadata,
|
|
@@ -144,10 +145,10 @@ export async function runMiddleware(request) {
|
|
|
144
145
|
import ${JSON.stringify(_serverGlobalsPath)};
|
|
145
146
|
import React from "react";
|
|
146
147
|
import { renderToReadableStream } from "react-dom/server.edge";
|
|
147
|
-
import { resetSSRHead, getSSRHeadHTML } from "next/head";
|
|
148
|
+
import { resetSSRHead, getSSRHeadHTML, setDocumentInitialHead } from "next/head";
|
|
148
149
|
import { flushPreloads } from "next/dynamic";
|
|
149
150
|
import { setSSRContext, wrapWithRouterContext } from "next/router";
|
|
150
|
-
import { _runWithCacheState } from "next/cache";
|
|
151
|
+
import { _runWithCacheState, configureMemoryCacheHandler as __configureMemoryCacheHandler } from "next/cache";
|
|
151
152
|
import { runWithPrivateCache } from "vinext/cache-runtime";
|
|
152
153
|
import { ensureFetchPatch, runWithFetchCache } from "vinext/fetch-cache";
|
|
153
154
|
import { runWithRequestContext as _runWithUnifiedCtx, createRequestContext as _createUnifiedCtx } from "vinext/unified-request-context";
|
|
@@ -196,6 +197,8 @@ const __hasMiddleware = ${JSON.stringify(Boolean(middlewarePath))};
|
|
|
196
197
|
// Full resolved config for production server (embedded at build time)
|
|
197
198
|
export const vinextConfig = ${vinextConfigJson};
|
|
198
199
|
|
|
200
|
+
__configureMemoryCacheHandler({ cacheMaxMemorySize: vinextConfig.cacheMaxMemorySize });
|
|
201
|
+
|
|
199
202
|
// Path to the user's pages/_app file (or null). Used to look up the
|
|
200
203
|
// _app's CSS/JS chunks in the SSR manifest so any global styles imported
|
|
201
204
|
// by _app are included in every page's <link rel="stylesheet"> set.
|
|
@@ -537,6 +540,14 @@ async function _renderPage(request, url, manifest, middlewareHeaders, options) {
|
|
|
537
540
|
? (localeInfo.domainLocale ? localeInfo.domainLocale.defaultLocale : i18nConfig.defaultLocale)
|
|
538
541
|
: undefined;
|
|
539
542
|
const domainLocales = i18nConfig ? i18nConfig.domains : undefined;
|
|
543
|
+
const i18nCacheVariant = i18nConfig
|
|
544
|
+
? (localeInfo.domainLocale
|
|
545
|
+
? "domain:" + String(localeInfo.domainLocale.domain).toLowerCase()
|
|
546
|
+
: "locale:" + String(locale))
|
|
547
|
+
: null;
|
|
548
|
+
const pageIsrCacheKey = i18nCacheVariant
|
|
549
|
+
? (router, pathname) => isrCacheKey(router, pathname + "::i18n=" + encodeURIComponent(i18nCacheVariant))
|
|
550
|
+
: isrCacheKey;
|
|
540
551
|
|
|
541
552
|
if (localeInfo.redirectUrl) {
|
|
542
553
|
return new Response(null, { status: 307, headers: { Location: localeInfo.redirectUrl } });
|
|
@@ -689,7 +700,7 @@ async function _renderPage(request, url, manifest, middlewareHeaders, options) {
|
|
|
689
700
|
defaultLocale: currentDefaultLocale,
|
|
690
701
|
domainLocales: domainLocales,
|
|
691
702
|
},
|
|
692
|
-
isrCacheKey,
|
|
703
|
+
isrCacheKey: pageIsrCacheKey,
|
|
693
704
|
isrGet,
|
|
694
705
|
isrSet,
|
|
695
706
|
expireSeconds: vinextConfig.expireTime,
|
|
@@ -822,6 +833,30 @@ async function _renderPage(request, url, manifest, middlewareHeaders, options) {
|
|
|
822
833
|
}
|
|
823
834
|
return wrapWithRouterContext(currentElement);
|
|
824
835
|
},
|
|
836
|
+
// Used by \`_document.getInitialProps\` -> \`ctx.renderPage\` to wrap
|
|
837
|
+
// App/Component with user-provided enhancers (e.g. styled-components,
|
|
838
|
+
// emotion). Falls back to identity when no enhancers are passed.
|
|
839
|
+
// \`pageProps\` is captured from the closure (unlike \`createPageElement\`
|
|
840
|
+
// which takes it as a param) — \`enhancePageElement\` is only ever invoked
|
|
841
|
+
// for this one request with this one \`pageProps\`, so there is no value to
|
|
842
|
+
// thread through; the renderPage contract only varies the enhancers.
|
|
843
|
+
enhancePageElement(renderPageOpts) {
|
|
844
|
+
var FinalApp = AppComponent;
|
|
845
|
+
var FinalComp = PageComponent;
|
|
846
|
+
if (renderPageOpts && typeof renderPageOpts.enhanceApp === "function" && FinalApp) {
|
|
847
|
+
FinalApp = renderPageOpts.enhanceApp(FinalApp);
|
|
848
|
+
}
|
|
849
|
+
if (renderPageOpts && typeof renderPageOpts.enhanceComponent === "function") {
|
|
850
|
+
FinalComp = renderPageOpts.enhanceComponent(FinalComp);
|
|
851
|
+
}
|
|
852
|
+
var enhancedElement;
|
|
853
|
+
if (FinalApp) {
|
|
854
|
+
enhancedElement = React.createElement(FinalApp, { Component: FinalComp, pageProps: pageProps });
|
|
855
|
+
} else {
|
|
856
|
+
enhancedElement = React.createElement(FinalComp, pageProps);
|
|
857
|
+
}
|
|
858
|
+
return wrapWithRouterContext(enhancedElement);
|
|
859
|
+
},
|
|
825
860
|
DocumentComponent,
|
|
826
861
|
flushPreloads: typeof flushPreloads === "function" ? flushPreloads : undefined,
|
|
827
862
|
fontLinkHeader: _fontLinkHeader,
|
|
@@ -846,7 +881,7 @@ async function _renderPage(request, url, manifest, middlewareHeaders, options) {
|
|
|
846
881
|
getSSRHeadHTML: typeof getSSRHeadHTML === "function" ? getSSRHeadHTML : undefined,
|
|
847
882
|
clientTraceMetadata: vinextConfig.clientTraceMetadata,
|
|
848
883
|
gsspRes,
|
|
849
|
-
isrCacheKey,
|
|
884
|
+
isrCacheKey: pageIsrCacheKey,
|
|
850
885
|
expireSeconds: vinextConfig.expireTime,
|
|
851
886
|
isrRevalidateSeconds,
|
|
852
887
|
isrSet,
|
|
@@ -866,6 +901,8 @@ async function _renderPage(request, url, manifest, middlewareHeaders, options) {
|
|
|
866
901
|
return renderToReadableStream(element);
|
|
867
902
|
},
|
|
868
903
|
resetSSRHead: typeof resetSSRHead === "function" ? resetSSRHead : undefined,
|
|
904
|
+
setDocumentInitialHead:
|
|
905
|
+
typeof setDocumentInitialHead === "function" ? setDocumentInitialHead : undefined,
|
|
869
906
|
routePattern,
|
|
870
907
|
routeUrl,
|
|
871
908
|
safeJsonStringify,
|