@reckona/mreact-router 0.0.120 → 0.0.122
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 -1
- package/dist/build.d.ts +1 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +117 -46
- package/dist/build.js.map +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +15 -1
- package/dist/client.js.map +1 -1
- package/dist/module-runner.js +14 -6
- package/dist/module-runner.js.map +1 -1
- package/dist/render.d.ts +1 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +23 -2
- package/dist/render.js.map +1 -1
- package/dist/route-styles.d.ts +1 -0
- package/dist/route-styles.d.ts.map +1 -1
- package/dist/route-styles.js +23 -2
- package/dist/route-styles.js.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +5 -0
- package/dist/serve.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +15 -1
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/build.ts +552 -371
- package/src/client.ts +34 -11
- package/src/module-runner.ts +26 -11
- package/src/render.ts +26 -2
- package/src/route-styles.ts +30 -2
- package/src/serve.ts +11 -0
- package/src/vite.ts +24 -1
package/dist/route-styles.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-styles.d.ts","sourceRoot":"","sources":["../src/route-styles.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAKpB;AAED,wBAAsB,+BAA+B,CAAC,OAAO,EAAE;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,M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M,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBtF"}
|
package/dist/route-styles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { access, readFile } from "node:fs/promises";
|
|
2
|
-
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
1
|
+
import { access, readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join, isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { collectStaticImportReferences } from "@reckona/mreact-compiler";
|
|
4
4
|
import { existingRouteShellCandidates } from "./route-shells.js";
|
|
5
5
|
export async function collectRouteCssFiles(options) {
|
|
@@ -40,6 +40,27 @@ export async function collectRouteCssHrefs(options) {
|
|
|
40
40
|
return options.hrefPrefix === undefined ? href : `${options.hrefPrefix}${href.slice(1)}`;
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
export async function collectSpecialBoundaryFiles(directory) {
|
|
44
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
45
|
+
const files = [];
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
const path = join(directory, entry.name);
|
|
48
|
+
if (entry.isDirectory()) {
|
|
49
|
+
if (entry.name === ".vite" || entry.name === "node_modules") {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
files.push(...(await collectSpecialBoundaryFiles(path)));
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (entry.isFile() && isSpecialBoundaryFilename(entry.name)) {
|
|
56
|
+
files.push(path);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return files.sort();
|
|
60
|
+
}
|
|
61
|
+
function isSpecialBoundaryFilename(filename) {
|
|
62
|
+
return /^(?:error|not-found)(?:\.mreact)?\.tsx$/u.test(filename);
|
|
63
|
+
}
|
|
43
64
|
function resolveCssImport(options) {
|
|
44
65
|
if (!isCssSource(options.source)) {
|
|
45
66
|
return undefined;
|
package/dist/route-styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-styles.js","sourceRoot":"","sources":["../src/route-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"route-styles.js","sourceRoot":"","sources":["../src/route-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAI1C;IACC,OAAO,MAAM,+BAA+B,CAAC;QAC3C,GAAG,OAAO;QACV,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KAC7C,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAAC,OAKrD;IACC,MAAM,UAAU,GAAG,CAAC,MAAM,4BAA4B,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SAC9F,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,CAAC,GAAG,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,U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C,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACjG,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,sBAAsB,CAAC,WAAmB,EAAE,IAAY;IAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAClC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAEhD,OAAO,YAAY,KAAK,EAAE,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC;QACrF,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,UAAU,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,qDAAqD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5E,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import { access, readdir, readFile } from \"node:fs/promises\";\nimport { dirname, join, isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { collectStaticImportReferences } from \"@reckona/mreact-compiler\";\nimport { existingRouteShellCandidates } from \"./route-shells.js\";\n\nexport async function collectRouteCssFiles(options: {\n appDir: string;\n pageFile: string;\n projectRoot: string;\n}): Promise<string[]> {\n return await collectRouteCssFilesFromSources({\n ...options,\n readSource: (file) => readFile(file, \"utf8\"),\n });\n}\n\nexport async function collectRouteCssFilesFromSources(options: {\n appDir: string;\n pageFile: string;\n projectRoot: string;\n readSource: (file: string) => Promise<string | undefined> | string | undefined;\n}): Promise<string[]> {\n const shellFiles = (await existingRouteShellCandidates(options.appDir, options.pageFile, isFile))\n .map((candidate) => candidate.file);\n const files = [...shellFiles, options.pageFile];\n const seen = new Set<string>();\n const cssFiles: string[] = [];\n\n for (const file of files) {\n const source = await options.readSource(file);\n\n if (source === undefined) {\n continue;\n }\n\n for (const reference of collectStaticImportReferences({ code: source, filename: file })) {\n const cssFile = resolveCssImport({\n importer: file,\n projectRoot: options.projectRoot,\n source: reference.source,\n });\n\n if (cssFile === undefined || seen.has(cssFile)) {\n continue;\n }\n\n seen.add(cssFile);\n cssFiles.push(cssFile);\n }\n }\n\n return cssFiles;\n}\n\nexport async function collectRouteCssHrefs(options: {\n appDir: string;\n hrefPrefix?: string | undefined;\n pageFile: string;\n projectRoot: string;\n}): Promise<string[]> {\n return (await collectRouteCssFiles(options)).map((file) => {\n const href = `/${relative(options.projectRoot, file).split(sep).join(\"/\")}`;\n\n return options.hrefPrefix === undefined ? href : `${options.hrefPrefix}${href.slice(1)}`;\n });\n}\n\nexport async function collectSpecialBoundaryFiles(directory: string): Promise<string[]> {\n const entries = await readdir(directory, { withFileTypes: true });\n const files: string[] = [];\n\n for (const entry of entries) {\n const path = join(directory, entry.name);\n\n if (entry.isDirectory()) {\n if (entry.name === \".vite\" || entry.name === \"node_modules\") {\n continue;\n }\n\n files.push(...(await collectSpecialBoundaryFiles(path)));\n continue;\n }\n\n if (entry.isFile() && isSpecialBoundaryFilename(entry.name)) {\n files.push(path);\n }\n }\n\n return files.sort();\n}\n\nfunction isSpecialBoundaryFilename(filename: string): boolean {\n return /^(?:error|not-found)(?:\\.mreact)?\\.tsx$/u.test(filename);\n}\n\nfunction resolveCssImport(options: {\n importer: string;\n projectRoot: string;\n source: string;\n}): string | undefined {\n if (!isCssSource(options.source)) {\n return undefined;\n }\n\n const resolved = isAbsolute(options.source)\n ? normalizeInsideProject(options.projectRoot, options.source)\n : options.source.startsWith(\".\")\n ? normalizeInsideProject(options.projectRoot, resolve(dirname(options.importer), options.source))\n : undefined;\n\n return resolved;\n}\n\nfunction normalizeInsideProject(projectRoot: string, file: string): string | undefined {\n const normalized = resolve(file);\n const root = resolve(projectRoot);\n const relativePath = relative(root, normalized);\n\n return relativePath === \"\" || relativePath.startsWith(\"..\") || isAbsolute(relativePath)\n ? undefined\n : normalized;\n}\n\nfunction isCssSource(source: string): boolean {\n return /\\.(?:css|pcss|postcss|scss|sass|less|styl|stylus)$/u.test(source);\n}\n\nasync function isFile(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n"]}
|
package/dist/serve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAItD,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAE3B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EAOL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAItD,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD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CAAC;CAChE;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,mBAAmB,CAAC,CA8B9B;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IACpD,YAAY,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;IACrD,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhB;AAuED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,QAAQ,CAAC,CAWnB;AA0LD,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC;IAAE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CA+FlE;AAsBD,iBAAe,oBAAoB,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAmC/B;AAED,eAAO,MAAM,6BAA6B,6BAAuB,CAAC;AAElE,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D;AAED,wBAAgB,qCAAqC,IAAI,MAAM,CAE9D"}
|
package/dist/serve.js
CHANGED
|
@@ -458,6 +458,9 @@ async function materializeBuiltRuntime(options) {
|
|
|
458
458
|
const routeMatcher = createRouteMatcher(routes);
|
|
459
459
|
const clientScripts = new Map(clientManifest.routes.flatMap((route) => route.client && route.script !== undefined ? [[route.path, route.script]] : []));
|
|
460
460
|
const clientStyles = new Map(clientManifest.routes.flatMap((route) => route.css !== undefined && route.css.length > 0 ? [[route.path, route.css]] : []));
|
|
461
|
+
const clientStylesByFile = new Map((clientManifest.styles ?? []).flatMap((style) => style.css !== undefined && style.css.length > 0
|
|
462
|
+
? [[join(routesDir, style.file), style.css]]
|
|
463
|
+
: []));
|
|
461
464
|
const navigationScripts = new Map(clientManifest.routes.flatMap((route) => route.navigation === true && route.navigationScript !== undefined
|
|
462
465
|
? [[route.path, route.navigationScript]]
|
|
463
466
|
: []));
|
|
@@ -477,6 +480,7 @@ async function materializeBuiltRuntime(options) {
|
|
|
477
480
|
? {}
|
|
478
481
|
: { assetBaseUrl: serverManifest.assetBaseUrl }),
|
|
479
482
|
clientScripts,
|
|
483
|
+
clientStylesByFile,
|
|
480
484
|
clientStyles,
|
|
481
485
|
hasMiddleware,
|
|
482
486
|
navigationScripts,
|
|
@@ -685,6 +689,7 @@ function builtRenderAppRequestOptions(options) {
|
|
|
685
689
|
appDir: options.runtime.appDir,
|
|
686
690
|
assetBaseUrl: options.runtime.assetBaseUrl,
|
|
687
691
|
clientScripts: options.runtime.clientScripts,
|
|
692
|
+
clientStylesByFile: options.runtime.clientStylesByFile,
|
|
688
693
|
clientStyles: options.runtime.clientStyles,
|
|
689
694
|
importPolicy: {
|
|
690
695
|
...options.importPolicy,
|
package/dist/serve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAQtE,OAAO,EAAE,kBAAkB,EAAoC,MAAM,aAAa,CAAC;AAGnF,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,0BAA0B,GAI3B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE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AAiC,CAAC;IACzE,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,eAAe,CAAC;IACtD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,WAAW,CAAC;IAClD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,YAAY,CAAC;IACjF,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,YAAY,CAAC;IACpD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,cAAc,CAAC;IACrD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,2BAA2B,CAAC;IAElE,OAAO,0BAA0B,CAAC;AACpC,CAAC","sourcesContent":["import { createServer, type Server } from \"node:http\";\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, normalize, sep } from \"node:path\";\nimport type {\n BuiltPrerenderedRoute,\n BuiltServerManifest,\n BuiltServerModuleArtifact,\n} from \"./build.js\";\nimport type { AppRouterCache } from \"./cache.js\";\nimport type { ClientRouteManifestEntry } from \"./client-route-inference.js\";\nimport { createRouteMatcher, type AppRoute, type RouteMatcher } from \"./routes.js\";\nimport type { AppRouterServerActionOptions } from \"./actions.js\";\nimport type { AppRouterImportPolicy } from \"./import-policy.js\";\nimport {\n preloadBuiltRequestModules,\n renderAppRequest,\n resolveAppRouterMiddleware,\n type AppRouterRenderPreload,\n type AppRouterResponseHook,\n type RenderAppRequestOptions,\n} from \"./render.js\";\nimport type { RouterInstrumentation } from \"./trace.js\";\nimport { bytesResponse, htmlResponse, nodeRequestToWebRequest, sendResponse } from \"./http.js\";\nimport {\n emitRouterLog,\n logDurationMs,\n logError,\n logNow,\n nodeRequestPath,\n requestLogFields,\n type AppRouterLogger,\n} from \"./logger.js\";\nimport { builtAppRuntimePreloadPlan } from \"./preload-policy.js\";\nimport { routeShellCandidates } from \"./route-shells.js\";\nimport { normalizeRoutePath } from \"./route-path.js\";\nimport type { HttpUpgradeHandler } from \"./upgrade.js\";\n\ninterface BuiltRuntime {\n appDir: string;\n allowedSourceDirs: readonly string[];\n assetBaseUrl?: string | undefined;\n clientScripts: ReadonlyMap<string, string>;\n clientStyles: ReadonlyMap<string, readonly string[]>;\n hasMiddleware: boolean;\n navigationScripts: ReadonlyMap<string, string>;\n projectRoot: string;\n publicAssetBaseUrl?: string | undefined;\n prerenderableRoutes: ReadonlySet<string>;\n prerenderLocks: Map<string, Promise<Response>>;\n prerenderedRoutes: Map<string, BuiltPrerenderedRoute>;\n routeMatcher: RouteMatcher;\n routes: readonly AppRoute[];\n serverActionReferencesByFile: ReadonlyMap<\n string,\n readonly {\n end: number;\n expression: string;\n expressionEnd: number;\n expressionStart: number;\n moduleId: string;\n exportName: string;\n inferred: boolean;\n sourceHash: string;\n start: number;\n }[]\n >;\n serverActionManifest?: readonly { moduleId: string; exportName: string; inferred?: boolean }[] | undefined;\n serverModuleArtifactLoads: Map<string, Promise<void>>;\n serverModuleFiles: ReadonlyMap<string, string>;\n serverModuleRenderFiles: ReadonlyMap<string, string>;\n serverModuleRequestFiles: ReadonlyMap<string, string>;\n serverModules: Map<string, BuiltServerModuleArtifact>;\n serverModuleCacheVersion: string;\n serverSourceFiles: ReadonlyMap<string, string>;\n}\n\ninterface BuiltRuntimeCacheEntry {\n clientManifestText: string;\n runtime: Promise<BuiltRuntime>;\n serverManifestText: string;\n}\n\nconst builtRuntimeCache = new Map<string, BuiltRuntimeCacheEntry>();\nconst builtPublicAssetCache = new Map<string, BuiltPublicAsset>();\n\ninterface BuiltPublicAsset {\n bytes: Uint8Array;\n headers: HeadersInit;\n}\n\n/**\n * Strategy for the final response body shape sent to the HTTP layer.\n *\n * - `\"string\"` (default, cross-runtime): body is the raw HTML string. The\n * underlying runtime encodes to UTF-8 bytes when writing to the socket.\n * - `\"buffer\"` (Node only): materialize the response body into a Buffer\n * before returning. Skips the implicit encode at the Response → socket\n * boundary and can let Node's HTTP layer write bytes directly.\n *\n * The buffer path forces full materialization of streaming responses\n * (loses TTFB streaming) — only opt in if the throughput gain outweighs\n * that on your workload.\n */\nexport type ResponseSinkStrategy = \"string\" | \"buffer\";\nexport type RequestHostPolicy = \"strict\" | \"trusted-proxy\";\n\nlet warnedImplicitHostTrust = false;\n\nexport interface RenderBuiltAppRequestOptions {\n outDir: string;\n importPolicy?: AppRouterImportPolicy | undefined;\n instrumentation?: RouterInstrumentation | undefined;\n logger?: AppRouterLogger | undefined;\n onResponse?: AppRouterResponseHook | undefined;\n prerenderStore?: AppRouterPrerenderStore | undefined;\n request: Request;\n routeCache?: AppRouterCache | undefined;\n runtimeDir?: string | undefined;\n immutableRuntime?: boolean | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n sinkStrategy?: ResponseSinkStrategy;\n preload?: AppRouterRenderPreload | undefined;\n}\n\nexport interface BuiltRequestRuntimeOptions {\n immutableRuntime?: boolean | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n outDir: string;\n runtimeDir?: string | undefined;\n}\n\nexport type BuiltRequestRuntimeRenderOptions = Omit<\n RenderBuiltAppRequestOptions,\n \"immutableRuntime\" | \"outDir\" | \"request\" | \"runtimeDir\"\n>;\n\nexport interface BuiltRequestRuntime {\n preload(preload?: BuiltAppRuntimePreloadStrategy | undefined): Promise<void>;\n render(\n request: Request,\n options?: BuiltRequestRuntimeRenderOptions | undefined,\n ): Promise<Response>;\n}\n\nexport type BuiltAppRuntimePreloadMode =\n | \"all\"\n | \"hot-route-requests\"\n | \"hot-routes\"\n | \"middleware\"\n | \"none\";\n\nexport interface BuiltAppRuntimePreloadStrategy {\n mode: BuiltAppRuntimePreloadMode;\n routes?: readonly string[] | undefined;\n}\n\nexport interface StartServerOptions {\n outDir: string;\n port: number;\n hostname?: string;\n // Optional hook for customizing the 500 response. The default returns\n // a generic \"Internal Server Error\" body and logs the stack to stderr\n // via console.error. Issue 071: stack traces must never end up in\n // production responses.\n errorHandler?: (error: unknown) => { body: string; status: number; headers?: Record<string, string> };\n // When set, an incoming Host header that does not exactly match one of\n // the listed values is replaced with the configured hostname/port for\n // origin reconstruction. Use this in front of public deployments to\n // block Host header injection (Issue 068). Undefined preserves the\n // legacy \"trust Host\" behavior for backward compatibility when\n // hostPolicy is not configured.\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n instrumentation?: RouterInstrumentation | undefined;\n logger?: AppRouterLogger | undefined;\n onResponse?: AppRouterResponseHook | undefined;\n prerenderStore?: AppRouterPrerenderStore | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n sinkStrategy?: ResponseSinkStrategy;\n onUpgrade?: HttpUpgradeHandler | undefined;\n}\n\nexport function resolveRequestHost(options: {\n allowedHosts?: readonly string[] | undefined;\n fallbackHost: string;\n hostPolicy?: RequestHostPolicy | undefined;\n rawHost: string | undefined;\n}): string {\n const raw = options.rawHost;\n if (raw === undefined || raw === \"\") return options.fallbackHost;\n if (options.allowedHosts === undefined) {\n return options.hostPolicy === \"strict\" ? options.fallbackHost : raw;\n }\n return options.allowedHosts.includes(raw) ? raw : options.fallbackHost;\n}\n\nexport function warnIfImplicitHostTrust(options: {\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n}): void {\n if (\n process.env.NODE_ENV !== \"production\" ||\n options.allowedHosts !== undefined ||\n options.hostPolicy !== undefined ||\n warnedImplicitHostTrust\n ) {\n return;\n }\n\n warnedImplicitHostTrust = true;\n console.error(\n \"[mreact] Host header trust is implicit because neither allowedHosts nor hostPolicy is configured. Set allowedHosts for public deployments, hostPolicy: \\\"strict\\\" to reject unlisted Host headers, or hostPolicy: \\\"trusted-proxy\\\" when a trusted reverse proxy normalizes Host.\",\n );\n}\n\nexport interface AppRouterPrerenderStore {\n delete(path: string): void | Promise<void>;\n get(path: string): BuiltPrerenderedRoute | undefined | Promise<BuiltPrerenderedRoute | undefined>;\n set(path: string, entry: BuiltPrerenderedRoute): void | Promise<void>;\n withLock?<T>(path: string, task: () => Promise<T>): Promise<T>;\n}\n\nexport async function createBuiltRequestRuntime(\n options: BuiltRequestRuntimeOptions,\n): Promise<BuiltRequestRuntime> {\n const runtime = await readBuiltRuntime({\n immutable: options.immutableRuntime,\n outDir: options.outDir,\n runtimeDir: options.runtimeDir,\n });\n\n return {\n preload(preload) {\n return preloadBuiltAppRuntimeWithRuntime({\n importPolicy: options.importPolicy,\n preload,\n runtime,\n });\n },\n async render(request, renderOptions = {}) {\n const response = await renderBuiltAppRequestWithRuntime({\n ...renderOptions,\n importPolicy: renderOptions.importPolicy ?? options.importPolicy,\n outDir: options.outDir,\n request,\n runtime,\n });\n\n return applyBuiltAppResponseHook(response, {\n onResponse: renderOptions.onResponse,\n request,\n });\n },\n };\n}\n\nexport async function preloadBuiltAppRuntime(options: {\n importPolicy?: AppRouterImportPolicy | undefined;\n outDir: string;\n preload?: BuiltAppRuntimePreloadStrategy | undefined;\n runtimeDir?: string | undefined;\n}): Promise<void> {\n const runtime = await readBuiltRuntime({\n outDir: options.outDir,\n runtimeDir: options.runtimeDir,\n });\n await preloadBuiltAppRuntimeWithRuntime({\n importPolicy: options.importPolicy,\n preload: options.preload,\n runtime,\n });\n}\n\nasync function preloadBuiltAppRuntimeWithRuntime(options: {\n importPolicy?: AppRouterImportPolicy | undefined;\n preload?: BuiltAppRuntimePreloadStrategy | undefined;\n runtime: BuiltRuntime;\n}): Promise<void> {\n const plan = builtAppRuntimePreloadPlan(options.preload);\n\n if (!plan.shouldPreload) {\n return;\n }\n\n const routes = builtRuntimePreloadRoutes(options.runtime, plan);\n if (plan.loadAllArtifacts) {\n await loadBuiltServerModuleArtifacts(\n options.runtime,\n allBuiltServerModuleFiles(options.runtime),\n \"all\",\n );\n } else {\n await loadBuiltServerModuleArtifactsForRequest(\n options.runtime,\n undefined,\n plan.middlewareArtifacts,\n );\n for (const route of routes) {\n await loadBuiltServerModuleArtifactsForRequest(\n options.runtime,\n route.file,\n plan.routeArtifacts,\n );\n }\n }\n await preloadBuiltRequestModules({\n appDir: options.runtime.appDir,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: options.runtime.allowedSourceDirs,\n projectRoot: options.runtime.projectRoot,\n },\n routes,\n serverModules: options.runtime.serverModules,\n serverModuleCacheVersion: options.runtime.serverModuleCacheVersion,\n serverSourceFiles: options.runtime.serverSourceFiles,\n includeRenderModules: plan.includeRenderModules,\n });\n}\n\nfunction builtRuntimePreloadRoutes(\n runtime: BuiltRuntime,\n strategy: BuiltAppRuntimePreloadStrategy,\n): readonly AppRoute[] {\n if (strategy.mode === \"all\") {\n return runtime.routes;\n }\n\n if (strategy.mode === \"middleware\" || strategy.mode === \"none\") {\n return [];\n }\n\n const routes = strategy.routes ?? [];\n return routes.map((path) => {\n const route = runtime.routeMatcher.match(normalizeRoutePath(path))?.route;\n if (route === undefined) {\n throw new Error(`Unknown hot route preload path: ${path}`);\n }\n return route;\n });\n}\n\nexport async function renderBuiltAppRequest(\n options: RenderBuiltAppRequestOptions,\n): Promise<Response> {\n const response = await renderBuiltAppRequestWithRuntime({\n ...options,\n runtime: await readBuiltRuntime({\n outDir: options.outDir,\n immutable: options.immutableRuntime,\n runtimeDir: options.runtimeDir,\n }),\n });\n\n return applyBuiltAppResponseHook(response, options);\n}\n\nasync function renderBuiltAppRequestWithRuntime(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n): Promise<Response> {\n const url = new URL(options.request.url);\n const timing = createBuiltRenderTiming(options.logger);\n\n if (url.pathname.startsWith(\"/_mreact/client/\")) {\n return readBuiltClientAsset(options.outDir, url.pathname);\n }\n\n if (options.request.method === \"GET\" || options.request.method === \"HEAD\") {\n const publicAsset = await readBuiltPublicAsset(options.outDir, url.pathname);\n\n if (publicAsset !== undefined) {\n return publicAsset;\n }\n }\n\n let request = options.request;\n let normalizedPath = normalizeRoutePath(url.pathname);\n let matched = options.runtime.routeMatcher.match(normalizedPath);\n\n if (options.request.method === \"GET\" || options.request.method === \"HEAD\") {\n // Sync fast path when no external prerender store is configured (the\n // common case): skip the Promise wrap that `readPrerenderedRoute`\n // would otherwise introduce just to satisfy the async signature.\n const prerendered =\n options.prerenderStore === undefined\n ? options.runtime.prerenderedRoutes.get(normalizedPath)\n : await readPrerenderedRoute(\n options.runtime,\n normalizedPath,\n options.prerenderStore,\n );\n\n if (prerendered !== undefined) {\n if (options.request.method === \"HEAD\") {\n return new Response(null, {\n headers: prerendered.headers,\n status: prerendered.status,\n });\n }\n return htmlResponse(prerendered.html, {\n headers: prerendered.headers,\n status: prerendered.status,\n });\n }\n }\n\n const middlewareStartedAt = builtRenderTimingPhaseStartedAt(timing);\n const middlewareResult = await resolveBuiltMiddleware({ ...options, timing }, request);\n finishBuiltRenderTimingPhase(timing, middlewareStartedAt, \"middlewareMs\");\n if (middlewareResult.type === \"response\") {\n emitBuiltRenderTiming(options, request, timing, middlewareResult.response.status);\n return middlewareResult.response;\n }\n request = middlewareResult.request;\n normalizedPath = normalizeRoutePath(new URL(request.url).pathname);\n matched = options.runtime.routeMatcher.match(normalizedPath);\n\n if (request.method === \"GET\" && options.runtime.prerenderableRoutes.has(normalizedPath)) {\n await loadBuiltServerModuleArtifactsForRequest(options.runtime, matched?.route.file, {\n includeRender: false,\n });\n return renderAndCachePrerenderWithLock({ ...options, request }, normalizedPath);\n }\n\n await loadBuiltServerModuleArtifactsForRequest(options.runtime, matched?.route.file, {\n includeRender: false,\n });\n const response = await renderBuiltDynamicResponse({ ...options, request });\n\n await applyBuiltPrerenderInvalidations(\n options.runtime,\n response,\n options.prerenderStore,\n );\n\n return options.sinkStrategy === \"buffer\"\n ? await materializeResponseAsBuffer(response)\n : response;\n}\n\nasync function resolveBuiltMiddleware(\n options: RenderBuiltAppRequestOptions & {\n runtime: BuiltRuntime;\n timing?: { phases: Record<string, number> } | undefined;\n },\n request: Request,\n): Promise<{ request: Request; type: \"continue\" } | { response: Response; type: \"response\" }> {\n if (!options.runtime.hasMiddleware) {\n return { request, type: \"continue\" };\n }\n\n await loadBuiltServerModuleArtifactsForRequest(options.runtime, undefined);\n\n return resolveAppRouterMiddleware({\n appDir: options.runtime.appDir,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: options.runtime.allowedSourceDirs,\n projectRoot: options.runtime.projectRoot,\n },\n instrumentation: options.instrumentation,\n request,\n serverModules: options.runtime.serverModules,\n serverModuleCacheVersion: options.runtime.serverModuleCacheVersion,\n serverSourceFiles: options.runtime.serverSourceFiles,\n timing: options.timing,\n });\n}\n\nfunction createBuiltRenderTiming(\n logger: AppRouterLogger | undefined,\n): { phases: Record<string, number> } | undefined {\n return logger?.debug === undefined ? undefined : { phases: {} };\n}\n\nfunction builtRenderTimingPhaseStartedAt(\n timing: { phases: Record<string, number> } | undefined,\n): number | undefined {\n return timing === undefined ? undefined : logNow();\n}\n\nfunction finishBuiltRenderTimingPhase(\n timing: { phases: Record<string, number> } | undefined,\n startedAt: number | undefined,\n phaseName: string,\n): void {\n if (timing === undefined || startedAt === undefined) {\n return;\n }\n\n timing.phases[phaseName] = logDurationMs(startedAt);\n}\n\nfunction emitBuiltRenderTiming(\n options: RenderBuiltAppRequestOptions,\n request: Request,\n timing: { phases: Record<string, number> } | undefined,\n status: number,\n): void {\n if (timing === undefined) {\n return;\n }\n\n emitRouterLog(options.logger, \"debug\", {\n method: request.method,\n path: new URL(request.url).pathname,\n phases: timing.phases,\n status,\n type: \"router:render:timing\",\n });\n}\n\nasync function applyBuiltAppResponseHook(\n response: Response,\n options: Pick<RenderBuiltAppRequestOptions, \"onResponse\" | \"request\">,\n): Promise<Response> {\n const hooked = await options.onResponse?.(response, {\n request: options.request,\n });\n\n return hooked instanceof Response ? hooked : response;\n}\n\nasync function materializeResponseAsBuffer(response: Response): Promise<Response> {\n if (response.body === null) {\n return response;\n }\n\n // Drains streaming responses into a single Buffer (loses TTFB streaming\n // by design — opt-in via sinkStrategy === \"buffer\"). Avoids the\n // string → UTF-8 encode the Response stream would otherwise do lazily\n // during the socket write. Tagged via `bytesResponse` so `sendResponse`\n // can take the raw-bytes fast path.\n const bytes = new Uint8Array(await response.arrayBuffer());\n return bytesResponse(bytes, {\n headers: response.headers,\n status: response.status,\n statusText: response.statusText,\n });\n}\n\nexport async function startServer(\n options: StartServerOptions,\n): Promise<{ close(): Promise<void>; server: Server; url: string }> {\n warnIfImplicitHostTrust(options);\n const runtime = await createBuiltRequestRuntime({\n importPolicy: options.importPolicy,\n outDir: options.outDir,\n });\n const server = createServer(async (incoming, outgoing) => {\n const startedAt = logNow();\n const fallbackRequestFields = {\n method: incoming.method ?? \"GET\",\n path: nodeRequestPath(incoming.url),\n runtime: \"node\" as const,\n };\n\n try {\n const fallbackHost = `${options.hostname ?? \"127.0.0.1\"}:${options.port}`;\n const host = resolveRequestHost({\n allowedHosts: options.allowedHosts,\n fallbackHost,\n hostPolicy: options.hostPolicy,\n rawHost: incoming.headers.host,\n });\n const origin = `http://${host}`;\n const request = nodeRequestToWebRequest(incoming, origin);\n const logFields = requestLogFields(request, \"node\");\n emitRouterLog(options.logger, \"info\", {\n ...logFields,\n type: \"router:request:start\",\n });\n const response = await runtime.render(request, {\n instrumentation: options.instrumentation,\n logger: options.logger,\n onResponse: options.onResponse,\n prerenderStore: options.prerenderStore,\n routeCache: options.routeCache,\n serverActions: options.serverActions,\n ...(options.sinkStrategy === undefined ? {} : { sinkStrategy: options.sinkStrategy }),\n });\n emitRouterLog(options.logger, \"info\", {\n ...logFields,\n durationMs: logDurationMs(startedAt),\n status: response.status,\n type: \"router:request:end\",\n });\n\n await sendResponse(outgoing, response);\n } catch (error) {\n // Log the full stack to stderr for operator visibility; never\n // place it in the response body where attackers can scrape it\n // (Issue 071). The errorHandler hook lets embedders customize\n // the public response shape while still benefiting from the\n // server-side log.\n emitRouterLog(options.logger, \"error\", {\n ...fallbackRequestFields,\n durationMs: logDurationMs(startedAt),\n error: logError(error),\n type: \"router:request:error\",\n });\n if (options.logger === undefined) {\n console.error(\"[mreact] startServer request failed:\", error);\n }\n const payload = options.errorHandler\n ? options.errorHandler(error)\n : { body: \"Internal Server Error\", status: 500 };\n outgoing.statusCode = payload.status;\n outgoing.setHeader(\n \"content-type\",\n payload.headers?.[\"content-type\"] ?? \"text/plain; charset=utf-8\",\n );\n for (const [name, value] of Object.entries(payload.headers ?? {})) {\n if (name.toLowerCase() === \"content-type\") continue;\n outgoing.setHeader(name, value);\n }\n outgoing.end(payload.body);\n }\n });\n\n if (options.onUpgrade !== undefined) {\n server.on(\"upgrade\", options.onUpgrade);\n }\n\n await new Promise<void>((resolve) =>\n server.listen(options.port, options.hostname ?? \"127.0.0.1\", resolve),\n );\n const address = server.address();\n const port = typeof address === \"object\" && address !== null ? address.port : options.port;\n\n return {\n server,\n url: `http://${options.hostname ?? \"127.0.0.1\"}:${port}`,\n close: () =>\n new Promise<void>((resolve, reject) =>\n server.close((error) => (error ? reject(error) : resolve())),\n ),\n };\n}\n\nasync function readBuiltClientAsset(outDir: string, pathname: string): Promise<Response> {\n const clientPrefix = \"/_mreact/client/\";\n const relativePath = pathname.slice(clientPrefix.length);\n const normalized = normalize(relativePath);\n\n if (normalized.startsWith(\"..\")) {\n return new Response(\"Not Found\", { status: 404 });\n }\n\n try {\n const code = await readFile(join(outDir, \"client\", normalized), \"utf8\");\n\n return new Response(code, {\n headers: clientAssetHeaders(normalized),\n });\n } catch {\n return new Response(\"Not Found\", { status: 404 });\n }\n}\n\nasync function readBuiltPublicAsset(\n outDir: string,\n pathname: string,\n): Promise<Response | undefined> {\n const relativePath = pathname.startsWith(\"/\") ? pathname.slice(1) : pathname;\n\n if (relativePath === \"\") {\n return undefined;\n }\n\n const normalized = normalize(relativePath);\n\n if (isAbsolute(normalized) || normalized === \"..\" || normalized.startsWith(\"../\")) {\n return undefined;\n }\n\n try {\n const cacheKey = `${outDir}\\0${normalized}`;\n const cached = builtPublicAssetCache.get(cacheKey);\n\n if (cached !== undefined) {\n return bytesResponse(cached.bytes, {\n headers: cached.headers,\n });\n }\n\n const bytes = await readFile(join(outDir, \"client\", \"public\", normalized));\n const headers = publicAssetHeaders(normalized);\n\n builtPublicAssetCache.set(cacheKey, {\n bytes,\n headers,\n });\n\n return bytesResponse(bytes, { headers });\n } catch {\n return undefined;\n }\n}\n\nexport const __readBuiltPublicAssetForTest = readBuiltPublicAsset;\n\nexport function __clearBuiltPublicAssetCacheForTest(): void {\n builtPublicAssetCache.clear();\n}\n\nexport function __getBuiltPublicAssetCacheSizeForTest(): number {\n return builtPublicAssetCache.size;\n}\n\nasync function readBuiltRuntime(options: {\n immutable?: boolean | undefined;\n outDir: string;\n runtimeDir?: string | undefined;\n}): Promise<BuiltRuntime> {\n const outDir = options.outDir;\n const runtimeDir = options.runtimeDir ?? join(outDir, \"server\", \"runtime\");\n const cacheKey = `${outDir}\\0${runtimeDir}`;\n const cached = builtRuntimeCache.get(cacheKey);\n\n if (options.immutable === true && cached !== undefined) {\n return cached.runtime;\n }\n\n const [serverManifestText, clientManifestText] = await Promise.all([\n readFile(join(outDir, \"server\", \"manifest.json\"), \"utf8\"),\n readFile(join(outDir, \"client\", \"manifest.json\"), \"utf8\"),\n ]);\n\n if (\n cached !== undefined &&\n cached.serverManifestText === serverManifestText &&\n cached.clientManifestText === clientManifestText\n ) {\n return cached.runtime;\n }\n\n const runtime = materializeBuiltRuntime({\n clientManifestText,\n outDir,\n runtimeDir,\n serverManifestText,\n });\n\n builtRuntimeCache.set(cacheKey, {\n clientManifestText,\n runtime,\n serverManifestText,\n });\n\n return runtime;\n}\n\nasync function materializeBuiltRuntime(options: {\n clientManifestText: string;\n outDir: string;\n runtimeDir: string;\n serverManifestText: string;\n}): Promise<BuiltRuntime> {\n const serverManifest = JSON.parse(options.serverManifestText) as BuiltServerManifest;\n const clientManifest = JSON.parse(options.clientManifestText) as {\n routes: ClientRouteManifestEntry[];\n };\n const appDir = await materializeBuiltServerApp(options.runtimeDir, serverManifest);\n const projectRoot = appDir;\n const routesDir = join(projectRoot, serverManifest.routesDir ?? \"\");\n const routes = serverManifest.routes.map((route) => ({\n ...route,\n file: join(projectRoot, route.file),\n }));\n const prerenderedRoutes = new Map(Object.entries(serverManifest.prerenderedRoutes ?? {}));\n const prerenderableRoutes = new Set(prerenderedRoutes.keys());\n const prerenderLocks = new Map<string, Promise<Response>>();\n const serverModules = new Map<string, BuiltServerModuleArtifact>(\n Object.entries(serverManifest.serverModules ?? {}).map(([file, artifact]) => [\n join(appDir, file),\n artifact,\n ]),\n );\n const serverModuleFiles = new Map(\n Object.entries(serverManifest.serverModuleFiles ?? {}).map(([file, artifactFile]) => [\n join(appDir, file),\n join(options.outDir, \"server\", safeManifestFilePath(artifactFile)),\n ]),\n );\n const serverModuleRequestFiles = new Map(\n Object.entries(serverManifest.serverModuleRequestFiles ?? {}).map(([file, artifactFile]) => [\n join(appDir, file),\n join(options.outDir, \"server\", safeManifestFilePath(artifactFile)),\n ]),\n );\n const serverModuleRenderFiles = new Map(\n Object.entries(serverManifest.serverModuleRenderFiles ?? {}).map(([file, artifactFile]) => [\n join(appDir, file),\n join(options.outDir, \"server\", safeManifestFilePath(artifactFile)),\n ]),\n );\n const serverSourceFiles = new Map(\n Object.entries(serverManifest.files).map(([file, source]) => [join(appDir, file), source]),\n );\n const serverActionReferencesByFile = new Map(\n Object.entries(serverManifest.routeServerActionReferences ?? {}).map(([file, references]) => [\n join(appDir, file),\n references,\n ]),\n );\n const routeMatcher = createRouteMatcher(routes);\n const clientScripts = new Map(\n clientManifest.routes.flatMap((route) =>\n route.client && route.script !== undefined ? [[route.path, route.script]] : [],\n ),\n );\n const clientStyles = new Map(\n clientManifest.routes.flatMap((route) =>\n route.css !== undefined && route.css.length > 0 ? [[route.path, route.css]] : [],\n ),\n );\n const navigationScripts = new Map(\n clientManifest.routes.flatMap((route) =>\n route.navigation === true && route.navigationScript !== undefined\n ? [[route.path, route.navigationScript]]\n : [],\n ),\n );\n const hasMiddleware =\n serverSourceFiles.has(join(routesDir, \"middleware.ts\")) ||\n serverSourceFiles.has(join(routesDir, \"middleware.mreact.ts\"));\n const serverModuleCacheVersion = createHash(\"sha256\")\n .update(options.serverManifestText)\n .update(\"\\0\")\n .update(options.clientManifestText)\n .digest(\"hex\")\n .slice(0, 16);\n\n const allowedSourceDirs = (serverManifest.allowedSourceDirs ?? [\"\"]).map((directory) =>\n join(projectRoot, directory),\n );\n\n return {\n appDir: routesDir,\n allowedSourceDirs,\n ...(serverManifest.assetBaseUrl === undefined\n ? {}\n : { assetBaseUrl: serverManifest.assetBaseUrl }),\n clientScripts,\n clientStyles,\n hasMiddleware,\n navigationScripts,\n projectRoot,\n ...(serverManifest.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: serverManifest.publicAssetBaseUrl }),\n prerenderableRoutes,\n prerenderLocks,\n prerenderedRoutes,\n routeMatcher,\n routes,\n serverActionReferencesByFile,\n ...(serverManifest.serverActionManifest === undefined\n ? {}\n : { serverActionManifest: serverManifest.serverActionManifest }),\n serverModuleArtifactLoads: new Map(),\n serverModuleFiles,\n serverModuleRenderFiles,\n serverModuleRequestFiles,\n serverModules,\n serverModuleCacheVersion,\n serverSourceFiles,\n };\n}\n\nasync function loadBuiltServerModuleArtifacts(\n runtime: BuiltRuntime,\n files: Iterable<string>,\n kind: BuiltServerModuleArtifactKind = \"all\",\n): Promise<void> {\n for (const file of files) {\n await loadBuiltServerModuleArtifact(runtime, file, kind);\n }\n}\n\ntype BuiltServerModuleArtifactKind = \"all\" | \"render\" | \"request\";\n\nasync function loadBuiltServerModuleArtifact(\n runtime: BuiltRuntime,\n file: string,\n kind: BuiltServerModuleArtifactKind = \"all\",\n): Promise<void> {\n if (kind === \"all\") {\n await loadBuiltServerModuleArtifact(runtime, file, \"request\");\n await loadBuiltServerModuleArtifact(runtime, file, \"render\");\n return;\n }\n\n const artifactPath =\n kind === \"request\"\n ? runtime.serverModuleRequestFiles.get(file) ?? runtime.serverModuleFiles.get(file)\n : runtime.serverModuleRenderFiles.get(file) ?? runtime.serverModuleFiles.get(file);\n\n if (artifactPath === undefined) {\n return;\n }\n\n const cached = runtime.serverModuleArtifactLoads.get(`${kind}\\0${file}`);\n\n if (cached !== undefined) {\n await cached;\n return;\n }\n\n const loaded = readFile(artifactPath, \"utf8\")\n .then((text) => {\n const existing = runtime.serverModules.get(file) ?? {};\n runtime.serverModules.set(\n file,\n mergeBuiltServerModuleArtifacts(\n existing,\n hydrateBuiltServerModuleArtifact(\n JSON.parse(text) as BuiltServerModuleArtifact,\n builtServerDirForArtifactPath(artifactPath),\n ),\n ),\n );\n })\n .catch((error) => {\n runtime.serverModuleArtifactLoads.delete(`${kind}\\0${file}`);\n throw error;\n });\n runtime.serverModuleArtifactLoads.set(`${kind}\\0${file}`, loaded);\n\n await loaded;\n}\n\nfunction allBuiltServerModuleFiles(runtime: BuiltRuntime): Iterable<string> {\n return new Set([\n ...runtime.serverModuleFiles.keys(),\n ...runtime.serverModuleRequestFiles.keys(),\n ...runtime.serverModuleRenderFiles.keys(),\n ]);\n}\n\nfunction builtServerDirForArtifactPath(artifactPath: string): string {\n const marker = `${sep}server-modules${sep}`;\n const index = artifactPath.lastIndexOf(marker);\n\n return index === -1 ? dirname(dirname(artifactPath)) : artifactPath.slice(0, index);\n}\n\nfunction hydrateBuiltServerModuleArtifact(\n artifact: BuiltServerModuleArtifact,\n serverDir: string,\n): BuiltServerModuleArtifact {\n return {\n ...(artifact.analysis === undefined ? {} : { analysis: artifact.analysis }),\n ...(artifact.loader === undefined\n ? {}\n : { loader: hydrateBuiltServerModuleOutput(artifact.loader, serverDir) }),\n ...(artifact.routeMetadata === undefined\n ? {}\n : { routeMetadata: hydrateBuiltServerModuleOutput(artifact.routeMetadata, serverDir) }),\n ...(artifact.request === undefined\n ? {}\n : { request: hydrateBuiltServerModuleOutput(artifact.request, serverDir) }),\n ...(artifact.stream === undefined\n ? {}\n : { stream: hydrateBuiltServerModuleOutput(artifact.stream, serverDir) }),\n ...(artifact.string === undefined\n ? {}\n : { string: hydrateBuiltServerModuleOutput(artifact.string, serverDir) }),\n };\n}\n\nfunction hydrateBuiltServerModuleOutput<T extends { moduleFile?: string | undefined }>(\n output: T,\n serverDir: string,\n): T {\n if (output.moduleFile === undefined || isAbsolute(output.moduleFile)) {\n return output;\n }\n\n return {\n ...output,\n moduleFile: join(serverDir, safeManifestFilePath(output.moduleFile)),\n };\n}\n\nfunction mergeBuiltServerModuleArtifacts(\n existing: BuiltServerModuleArtifact,\n loaded: BuiltServerModuleArtifact,\n): BuiltServerModuleArtifact {\n return {\n ...existing,\n ...loaded,\n };\n}\n\nasync function loadBuiltServerModuleArtifactsForRequest(\n runtime: BuiltRuntime,\n routeFile: string | undefined,\n options: {\n includeRender?: boolean | undefined;\n includeShells?: boolean | undefined;\n } = {},\n): Promise<void> {\n const roots = [\n join(runtime.appDir, \"middleware.ts\"),\n join(runtime.appDir, \"middleware.mreact.ts\"),\n ...(routeFile === undefined\n ? []\n : [\n routeFile,\n ...(options.includeShells === false ? [] : shellFilesForRoute(runtime, routeFile)),\n ]),\n ];\n const seen = new Set<string>();\n\n for (const file of roots) {\n await loadBuiltServerModuleArtifactClosure(runtime, file, seen, \"request\");\n }\n\n if (options.includeRender === true) {\n seen.clear();\n for (const file of roots) {\n await loadBuiltServerModuleArtifactClosure(runtime, file, seen, \"render\");\n }\n }\n}\n\nasync function loadBuiltServerModuleArtifactClosure(\n runtime: BuiltRuntime,\n file: string,\n seen: Set<string>,\n kind: BuiltServerModuleArtifactKind,\n): Promise<void> {\n if (seen.has(file)) {\n return;\n }\n seen.add(file);\n\n await loadBuiltServerModuleArtifact(runtime, file, kind);\n\n const source = runtime.serverSourceFiles.get(file);\n\n if (source === undefined) {\n return;\n }\n\n for (const specifier of localServerModuleSpecifiers(source)) {\n const resolved = resolveBuiltLocalServerSourceImport(runtime, file, specifier);\n\n if (resolved !== undefined) {\n await loadBuiltServerModuleArtifactClosure(runtime, resolved, seen, kind);\n }\n }\n}\n\nfunction localServerModuleSpecifiers(code: string): string[] {\n const specifiers = new Set<string>();\n const importPattern =\n /\\b(?:import|export)\\s+(?:type\\s+)?(?:[^\"']*?\\s+from\\s*)?[\"'](?<source>\\.{1,2}\\/[^\"']+)[\"']/g;\n\n for (const match of code.matchAll(importPattern)) {\n const source = match.groups?.source;\n\n if (source !== undefined) {\n specifiers.add(source);\n }\n }\n\n return Array.from(specifiers);\n}\n\nfunction resolveBuiltLocalServerSourceImport(\n runtime: BuiltRuntime,\n fromFile: string,\n specifier: string,\n): string | undefined {\n const base = join(dirname(fromFile), specifier);\n\n for (const candidate of localServerSourceImportCandidates(base)) {\n if (runtime.serverSourceFiles.has(candidate)) {\n return candidate;\n }\n }\n\n return undefined;\n}\n\nfunction localServerSourceImportCandidates(base: string): string[] {\n const candidates = [base];\n\n if (base.endsWith(\".js\")) {\n const withoutJs = base.slice(0, -\".js\".length);\n candidates.push(`${withoutJs}.ts`, `${withoutJs}.tsx`, `${withoutJs}.mreact.tsx`);\n } else if (base.endsWith(\".jsx\")) {\n const withoutJsx = base.slice(0, -\".jsx\".length);\n candidates.push(`${withoutJsx}.tsx`, `${withoutJsx}.mreact.tsx`);\n } else if (base.endsWith(\".mreact\")) {\n candidates.push(`${base}.tsx`);\n } else {\n candidates.push(\n `${base}.ts`,\n `${base}.tsx`,\n `${base}.mreact.tsx`,\n join(base, \"index.ts\"),\n join(base, \"index.tsx\"),\n join(base, \"index.mreact.tsx\"),\n );\n }\n\n return candidates;\n}\n\nfunction shellFilesForRoute(runtime: BuiltRuntime, routeFile: string): string[] {\n return routeShellCandidates(runtime.appDir, routeFile)\n .map((candidate) => candidate.file)\n .filter((file) => runtime.serverSourceFiles.has(file));\n}\n\nasync function readPrerenderedRoute(\n runtime: BuiltRuntime,\n path: string,\n store: AppRouterPrerenderStore | undefined,\n): Promise<BuiltPrerenderedRoute | undefined> {\n const stored = await store?.get(path);\n\n if (stored !== undefined) {\n runtime.prerenderedRoutes.set(path, stored);\n return stored;\n }\n\n const manifestEntry = runtime.prerenderedRoutes.get(path);\n\n if (manifestEntry !== undefined && store !== undefined) {\n await store.set(path, manifestEntry);\n }\n\n return manifestEntry;\n}\n\nfunction renderBuiltDynamicResponse(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n): Promise<Response> {\n return renderAppRequest(builtRenderAppRequestOptions(options));\n}\n\nfunction builtRenderAppRequestOptions(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n): RenderAppRequestOptions {\n const renderOptions: RenderAppRequestOptions & {\n __mreactLoadServerRenderArtifacts?: ((routeFile: string) => Promise<void>) | undefined;\n } = {\n appDir: options.runtime.appDir,\n assetBaseUrl: options.runtime.assetBaseUrl,\n clientScripts: options.runtime.clientScripts,\n clientStyles: options.runtime.clientStyles,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: options.runtime.allowedSourceDirs,\n projectRoot: options.runtime.projectRoot,\n },\n request: options.request,\n instrumentation: options.instrumentation,\n logger: options.logger,\n navigationScripts: options.runtime.navigationScripts,\n routeCache: options.routeCache,\n routeMatcher: options.runtime.routeMatcher,\n routes: options.runtime.routes,\n __mreactLoadServerRenderArtifacts: async (routeFile: string) => {\n await loadBuiltServerModuleArtifactsForRequest(options.runtime, routeFile, {\n includeRender: true,\n });\n },\n serverModules: options.runtime.serverModules,\n serverModuleCacheVersion: options.runtime.serverModuleCacheVersion,\n serverSourceFiles: options.runtime.serverSourceFiles,\n serverActionReferencesByFile: options.runtime.serverActionReferencesByFile,\n serverActions: mergeBuiltServerActionOptions(\n options.serverActions,\n options.runtime.serverActionManifest,\n ),\n skipMiddleware: true,\n ...(options.preload === undefined ? {} : { preload: options.preload }),\n };\n\n return renderOptions;\n}\n\nfunction mergeBuiltServerActionOptions(\n options: AppRouterServerActionOptions | undefined,\n allowedActions: readonly { moduleId: string; exportName: string; inferred?: boolean }[] | undefined,\n): AppRouterServerActionOptions | undefined {\n if (allowedActions === undefined) {\n return options;\n }\n\n return {\n ...options,\n allowedActions,\n };\n}\n\nasync function renderAndCachePrerenderWithLock(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n path: string,\n): Promise<Response> {\n const existing = options.runtime.prerenderLocks.get(path);\n\n if (existing !== undefined) {\n return cloneResponse(await existing);\n }\n\n const task = runPrerenderRegeneration(options, path);\n options.runtime.prerenderLocks.set(path, task);\n\n try {\n return cloneResponse(await task);\n } finally {\n options.runtime.prerenderLocks.delete(path);\n }\n}\n\nasync function runPrerenderRegeneration(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n path: string,\n): Promise<Response> {\n const regenerate = async () => {\n const stored = await readPrerenderedRoute(options.runtime, path, options.prerenderStore);\n\n if (stored !== undefined) {\n return htmlResponse(stored.html, {\n headers: stored.headers,\n status: stored.status,\n });\n }\n\n const response = await renderBuiltDynamicResponse(options);\n\n return response.ok\n ? await cacheRegeneratedPrerenderedRoute(\n options.runtime,\n path,\n response,\n options.prerenderStore,\n )\n : response;\n };\n\n return options.prerenderStore?.withLock === undefined\n ? await regenerate()\n : await options.prerenderStore.withLock(path, regenerate);\n}\n\nasync function applyBuiltPrerenderInvalidations(\n runtime: BuiltRuntime,\n response: Response,\n store: AppRouterPrerenderStore | undefined,\n): Promise<void> {\n const revalidated = response.headers.get(\"x-mreact-revalidate\");\n\n if (revalidated === null) {\n return;\n }\n\n for (const path of revalidated.split(\",\")) {\n const normalized = normalizeRoutePath(path.trim());\n runtime.prerenderedRoutes.delete(normalized);\n await store?.delete(normalized);\n }\n}\n\nasync function cacheRegeneratedPrerenderedRoute(\n runtime: BuiltRuntime,\n path: string,\n response: Response,\n store: AppRouterPrerenderStore | undefined,\n): Promise<Response> {\n const body = await response.text();\n const headers: Record<string, string> = {};\n\n response.headers.forEach((value, key) => {\n headers[key] = value;\n });\n const entry = {\n headers,\n html: body,\n status: response.status,\n };\n runtime.prerenderedRoutes.set(path, entry);\n await store?.set(path, entry);\n\n return htmlResponse(body, {\n headers: response.headers,\n status: response.status,\n });\n}\n\nasync function cloneResponse(response: Response): Promise<Response> {\n return htmlResponse(await response.clone().text(), {\n headers: response.headers,\n status: response.status,\n });\n}\n\nasync function materializeBuiltServerApp(\n runtimeDir: string,\n manifest: BuiltServerManifest,\n): Promise<string> {\n const appDir = join(runtimeDir, \"app\");\n\n await rm(appDir, { force: true, recursive: true });\n await Promise.all(\n Object.entries(manifest.files).map(async ([file, code]) => {\n const outputFile = join(appDir, safeManifestFilePath(file));\n\n await mkdir(dirname(outputFile), { recursive: true });\n await writeFile(outputFile, code);\n }),\n );\n\n return appDir;\n}\n\nfunction safeManifestFilePath(pathname: string): string {\n const normalized = normalize(pathname);\n\n if (isAbsolute(normalized) || normalized === \"..\" || normalized.startsWith(\"../\")) {\n throw new Error(`Invalid built app manifest file path: ${pathname}`);\n }\n\n return normalized;\n}\n\nfunction clientAssetHeaders(pathname: string): HeadersInit {\n if (pathname === \"manifest.json\") {\n return {\n \"cache-control\": \"no-cache\",\n \"content-type\": \"application/json; charset=utf-8\",\n };\n }\n\n return {\n \"cache-control\": \"public, max-age=31536000, immutable\",\n \"content-type\": pathname.endsWith(\".css\")\n ? \"text/css; charset=utf-8\"\n : \"text/javascript; charset=utf-8\",\n };\n}\n\nfunction publicAssetHeaders(pathname: string): HeadersInit {\n return {\n \"cache-control\": \"public, max-age=3600\",\n \"content-type\": publicAssetContentType(pathname),\n };\n}\n\nfunction publicAssetContentType(pathname: string): string {\n if (pathname.endsWith(\".css\")) return \"text/css; charset=utf-8\";\n if (pathname.endsWith(\".html\")) return \"text/html; charset=utf-8\";\n if (pathname.endsWith(\".js\")) return \"text/javascript; charset=utf-8\";\n if (pathname.endsWith(\".json\")) return \"application/json; charset=utf-8\";\n if (pathname.endsWith(\".svg\")) return \"image/svg+xml\";\n if (pathname.endsWith(\".png\")) return \"image/png\";\n if (pathname.endsWith(\".jpg\") || pathname.endsWith(\".jpeg\")) return \"image/jpeg\";\n if (pathname.endsWith(\".webp\")) return \"image/webp\";\n if (pathname.endsWith(\".ico\")) return \"image/x-icon\";\n if (pathname.endsWith(\".txt\")) return \"text/plain; charset=utf-8\";\n\n return \"application/octet-stream\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAQtE,OAAO,EAAE,kBAAkB,EAAoC,MAAM,aAAa,CAAC;AAGnF,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,0BAA0B,GAI3B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/F,OAAO,EACL,aAAa,EACb,aAAa,EACb,QAAQ,EACR,MAAM,EACN,eAAe,EACf,gBAAgB,GAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAiDrD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAkC,CAAC;AACpE,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAA4B,CAAC;AAuBlE,IAAI,uBAAuB,GAAG,KAAK,CAAC;AA8EpC,MAAM,UAAU,kBAAkB,CAAC,OAKlC;IACC,MAAM,GAAG,GAAG,O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AAQ,CAAC,MAAM,CAAC;QAAE,OAAO,WAAW,CAAC;IAClD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,YAAY,CAAC;IACjF,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,YAAY,CAAC;IACpD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,cAAc,CAAC;IACrD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,2BAA2B,CAAC;IAElE,OAAO,0BAA0B,CAAC;AACpC,CAAC","sourcesContent":["import { createServer, type Server } from \"node:http\";\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, normalize, sep } from \"node:path\";\nimport type {\n BuiltPrerenderedRoute,\n BuiltServerManifest,\n BuiltServerModuleArtifact,\n} from \"./build.js\";\nimport type { AppRouterCache } from \"./cache.js\";\nimport type { ClientRouteManifestEntry } from \"./client-route-inference.js\";\nimport { createRouteMatcher, type AppRoute, type RouteMatcher } from \"./routes.js\";\nimport type { AppRouterServerActionOptions } from \"./actions.js\";\nimport type { AppRouterImportPolicy } from \"./import-policy.js\";\nimport {\n preloadBuiltRequestModules,\n renderAppRequest,\n resolveAppRouterMiddleware,\n type AppRouterRenderPreload,\n type AppRouterResponseHook,\n type RenderAppRequestOptions,\n} from \"./render.js\";\nimport type { RouterInstrumentation } from \"./trace.js\";\nimport { bytesResponse, htmlResponse, nodeRequestToWebRequest, sendResponse } from \"./http.js\";\nimport {\n emitRouterLog,\n logDurationMs,\n logError,\n logNow,\n nodeRequestPath,\n requestLogFields,\n type AppRouterLogger,\n} from \"./logger.js\";\nimport { builtAppRuntimePreloadPlan } from \"./preload-policy.js\";\nimport { routeShellCandidates } from \"./route-shells.js\";\nimport { normalizeRoutePath } from \"./route-path.js\";\nimport type { HttpUpgradeHandler } from \"./upgrade.js\";\n\ninterface BuiltRuntime {\n appDir: string;\n allowedSourceDirs: readonly string[];\n assetBaseUrl?: string | undefined;\n clientScripts: ReadonlyMap<string, string>;\n clientStylesByFile: ReadonlyMap<string, readonly string[]>;\n clientStyles: ReadonlyMap<string, readonly string[]>;\n hasMiddleware: boolean;\n navigationScripts: ReadonlyMap<string, string>;\n projectRoot: string;\n publicAssetBaseUrl?: string | undefined;\n prerenderableRoutes: ReadonlySet<string>;\n prerenderLocks: Map<string, Promise<Response>>;\n prerenderedRoutes: Map<string, BuiltPrerenderedRoute>;\n routeMatcher: RouteMatcher;\n routes: readonly AppRoute[];\n serverActionReferencesByFile: ReadonlyMap<\n string,\n readonly {\n end: number;\n expression: string;\n expressionEnd: number;\n expressionStart: number;\n moduleId: string;\n exportName: string;\n inferred: boolean;\n sourceHash: string;\n start: number;\n }[]\n >;\n serverActionManifest?: readonly { moduleId: string; exportName: string; inferred?: boolean }[] | undefined;\n serverModuleArtifactLoads: Map<string, Promise<void>>;\n serverModuleFiles: ReadonlyMap<string, string>;\n serverModuleRenderFiles: ReadonlyMap<string, string>;\n serverModuleRequestFiles: ReadonlyMap<string, string>;\n serverModules: Map<string, BuiltServerModuleArtifact>;\n serverModuleCacheVersion: string;\n serverSourceFiles: ReadonlyMap<string, string>;\n}\n\ninterface BuiltRuntimeCacheEntry {\n clientManifestText: string;\n runtime: Promise<BuiltRuntime>;\n serverManifestText: string;\n}\n\nconst builtRuntimeCache = new Map<string, BuiltRuntimeCacheEntry>();\nconst builtPublicAssetCache = new Map<string, BuiltPublicAsset>();\n\ninterface BuiltPublicAsset {\n bytes: Uint8Array;\n headers: HeadersInit;\n}\n\n/**\n * Strategy for the final response body shape sent to the HTTP layer.\n *\n * - `\"string\"` (default, cross-runtime): body is the raw HTML string. The\n * underlying runtime encodes to UTF-8 bytes when writing to the socket.\n * - `\"buffer\"` (Node only): materialize the response body into a Buffer\n * before returning. Skips the implicit encode at the Response → socket\n * boundary and can let Node's HTTP layer write bytes directly.\n *\n * The buffer path forces full materialization of streaming responses\n * (loses TTFB streaming) — only opt in if the throughput gain outweighs\n * that on your workload.\n */\nexport type ResponseSinkStrategy = \"string\" | \"buffer\";\nexport type RequestHostPolicy = \"strict\" | \"trusted-proxy\";\n\nlet warnedImplicitHostTrust = false;\n\nexport interface RenderBuiltAppRequestOptions {\n outDir: string;\n importPolicy?: AppRouterImportPolicy | undefined;\n instrumentation?: RouterInstrumentation | undefined;\n logger?: AppRouterLogger | undefined;\n onResponse?: AppRouterResponseHook | undefined;\n prerenderStore?: AppRouterPrerenderStore | undefined;\n request: Request;\n routeCache?: AppRouterCache | undefined;\n runtimeDir?: string | undefined;\n immutableRuntime?: boolean | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n sinkStrategy?: ResponseSinkStrategy;\n preload?: AppRouterRenderPreload | undefined;\n}\n\nexport interface BuiltRequestRuntimeOptions {\n immutableRuntime?: boolean | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n outDir: string;\n runtimeDir?: string | undefined;\n}\n\nexport type BuiltRequestRuntimeRenderOptions = Omit<\n RenderBuiltAppRequestOptions,\n \"immutableRuntime\" | \"outDir\" | \"request\" | \"runtimeDir\"\n>;\n\nexport interface BuiltRequestRuntime {\n preload(preload?: BuiltAppRuntimePreloadStrategy | undefined): Promise<void>;\n render(\n request: Request,\n options?: BuiltRequestRuntimeRenderOptions | undefined,\n ): Promise<Response>;\n}\n\nexport type BuiltAppRuntimePreloadMode =\n | \"all\"\n | \"hot-route-requests\"\n | \"hot-routes\"\n | \"middleware\"\n | \"none\";\n\nexport interface BuiltAppRuntimePreloadStrategy {\n mode: BuiltAppRuntimePreloadMode;\n routes?: readonly string[] | undefined;\n}\n\nexport interface StartServerOptions {\n outDir: string;\n port: number;\n hostname?: string;\n // Optional hook for customizing the 500 response. The default returns\n // a generic \"Internal Server Error\" body and logs the stack to stderr\n // via console.error. Issue 071: stack traces must never end up in\n // production responses.\n errorHandler?: (error: unknown) => { body: string; status: number; headers?: Record<string, string> };\n // When set, an incoming Host header that does not exactly match one of\n // the listed values is replaced with the configured hostname/port for\n // origin reconstruction. Use this in front of public deployments to\n // block Host header injection (Issue 068). Undefined preserves the\n // legacy \"trust Host\" behavior for backward compatibility when\n // hostPolicy is not configured.\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n instrumentation?: RouterInstrumentation | undefined;\n logger?: AppRouterLogger | undefined;\n onResponse?: AppRouterResponseHook | undefined;\n prerenderStore?: AppRouterPrerenderStore | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n sinkStrategy?: ResponseSinkStrategy;\n onUpgrade?: HttpUpgradeHandler | undefined;\n}\n\nexport function resolveRequestHost(options: {\n allowedHosts?: readonly string[] | undefined;\n fallbackHost: string;\n hostPolicy?: RequestHostPolicy | undefined;\n rawHost: string | undefined;\n}): string {\n const raw = options.rawHost;\n if (raw === undefined || raw === \"\") return options.fallbackHost;\n if (options.allowedHosts === undefined) {\n return options.hostPolicy === \"strict\" ? options.fallbackHost : raw;\n }\n return options.allowedHosts.includes(raw) ? raw : options.fallbackHost;\n}\n\nexport function warnIfImplicitHostTrust(options: {\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n}): void {\n if (\n process.env.NODE_ENV !== \"production\" ||\n options.allowedHosts !== undefined ||\n options.hostPolicy !== undefined ||\n warnedImplicitHostTrust\n ) {\n return;\n }\n\n warnedImplicitHostTrust = true;\n console.error(\n \"[mreact] Host header trust is implicit because neither allowedHosts nor hostPolicy is configured. Set allowedHosts for public deployments, hostPolicy: \\\"strict\\\" to reject unlisted Host headers, or hostPolicy: \\\"trusted-proxy\\\" when a trusted reverse proxy normalizes Host.\",\n );\n}\n\nexport interface AppRouterPrerenderStore {\n delete(path: string): void | Promise<void>;\n get(path: string): BuiltPrerenderedRoute | undefined | Promise<BuiltPrerenderedRoute | undefined>;\n set(path: string, entry: BuiltPrerenderedRoute): void | Promise<void>;\n withLock?<T>(path: string, task: () => Promise<T>): Promise<T>;\n}\n\nexport async function createBuiltRequestRuntime(\n options: BuiltRequestRuntimeOptions,\n): Promise<BuiltRequestRuntime> {\n const runtime = await readBuiltRuntime({\n immutable: options.immutableRuntime,\n outDir: options.outDir,\n runtimeDir: options.runtimeDir,\n });\n\n return {\n preload(preload) {\n return preloadBuiltAppRuntimeWithRuntime({\n importPolicy: options.importPolicy,\n preload,\n runtime,\n });\n },\n async render(request, renderOptions = {}) {\n const response = await renderBuiltAppRequestWithRuntime({\n ...renderOptions,\n importPolicy: renderOptions.importPolicy ?? options.importPolicy,\n outDir: options.outDir,\n request,\n runtime,\n });\n\n return applyBuiltAppResponseHook(response, {\n onResponse: renderOptions.onResponse,\n request,\n });\n },\n };\n}\n\nexport async function preloadBuiltAppRuntime(options: {\n importPolicy?: AppRouterImportPolicy | undefined;\n outDir: string;\n preload?: BuiltAppRuntimePreloadStrategy | undefined;\n runtimeDir?: string | undefined;\n}): Promise<void> {\n const runtime = await readBuiltRuntime({\n outDir: options.outDir,\n runtimeDir: options.runtimeDir,\n });\n await preloadBuiltAppRuntimeWithRuntime({\n importPolicy: options.importPolicy,\n preload: options.preload,\n runtime,\n });\n}\n\nasync function preloadBuiltAppRuntimeWithRuntime(options: {\n importPolicy?: AppRouterImportPolicy | undefined;\n preload?: BuiltAppRuntimePreloadStrategy | undefined;\n runtime: BuiltRuntime;\n}): Promise<void> {\n const plan = builtAppRuntimePreloadPlan(options.preload);\n\n if (!plan.shouldPreload) {\n return;\n }\n\n const routes = builtRuntimePreloadRoutes(options.runtime, plan);\n if (plan.loadAllArtifacts) {\n await loadBuiltServerModuleArtifacts(\n options.runtime,\n allBuiltServerModuleFiles(options.runtime),\n \"all\",\n );\n } else {\n await loadBuiltServerModuleArtifactsForRequest(\n options.runtime,\n undefined,\n plan.middlewareArtifacts,\n );\n for (const route of routes) {\n await loadBuiltServerModuleArtifactsForRequest(\n options.runtime,\n route.file,\n plan.routeArtifacts,\n );\n }\n }\n await preloadBuiltRequestModules({\n appDir: options.runtime.appDir,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: options.runtime.allowedSourceDirs,\n projectRoot: options.runtime.projectRoot,\n },\n routes,\n serverModules: options.runtime.serverModules,\n serverModuleCacheVersion: options.runtime.serverModuleCacheVersion,\n serverSourceFiles: options.runtime.serverSourceFiles,\n includeRenderModules: plan.includeRenderModules,\n });\n}\n\nfunction builtRuntimePreloadRoutes(\n runtime: BuiltRuntime,\n strategy: BuiltAppRuntimePreloadStrategy,\n): readonly AppRoute[] {\n if (strategy.mode === \"all\") {\n return runtime.routes;\n }\n\n if (strategy.mode === \"middleware\" || strategy.mode === \"none\") {\n return [];\n }\n\n const routes = strategy.routes ?? [];\n return routes.map((path) => {\n const route = runtime.routeMatcher.match(normalizeRoutePath(path))?.route;\n if (route === undefined) {\n throw new Error(`Unknown hot route preload path: ${path}`);\n }\n return route;\n });\n}\n\nexport async function renderBuiltAppRequest(\n options: RenderBuiltAppRequestOptions,\n): Promise<Response> {\n const response = await renderBuiltAppRequestWithRuntime({\n ...options,\n runtime: await readBuiltRuntime({\n outDir: options.outDir,\n immutable: options.immutableRuntime,\n runtimeDir: options.runtimeDir,\n }),\n });\n\n return applyBuiltAppResponseHook(response, options);\n}\n\nasync function renderBuiltAppRequestWithRuntime(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n): Promise<Response> {\n const url = new URL(options.request.url);\n const timing = createBuiltRenderTiming(options.logger);\n\n if (url.pathname.startsWith(\"/_mreact/client/\")) {\n return readBuiltClientAsset(options.outDir, url.pathname);\n }\n\n if (options.request.method === \"GET\" || options.request.method === \"HEAD\") {\n const publicAsset = await readBuiltPublicAsset(options.outDir, url.pathname);\n\n if (publicAsset !== undefined) {\n return publicAsset;\n }\n }\n\n let request = options.request;\n let normalizedPath = normalizeRoutePath(url.pathname);\n let matched = options.runtime.routeMatcher.match(normalizedPath);\n\n if (options.request.method === \"GET\" || options.request.method === \"HEAD\") {\n // Sync fast path when no external prerender store is configured (the\n // common case): skip the Promise wrap that `readPrerenderedRoute`\n // would otherwise introduce just to satisfy the async signature.\n const prerendered =\n options.prerenderStore === undefined\n ? options.runtime.prerenderedRoutes.get(normalizedPath)\n : await readPrerenderedRoute(\n options.runtime,\n normalizedPath,\n options.prerenderStore,\n );\n\n if (prerendered !== undefined) {\n if (options.request.method === \"HEAD\") {\n return new Response(null, {\n headers: prerendered.headers,\n status: prerendered.status,\n });\n }\n return htmlResponse(prerendered.html, {\n headers: prerendered.headers,\n status: prerendered.status,\n });\n }\n }\n\n const middlewareStartedAt = builtRenderTimingPhaseStartedAt(timing);\n const middlewareResult = await resolveBuiltMiddleware({ ...options, timing }, request);\n finishBuiltRenderTimingPhase(timing, middlewareStartedAt, \"middlewareMs\");\n if (middlewareResult.type === \"response\") {\n emitBuiltRenderTiming(options, request, timing, middlewareResult.response.status);\n return middlewareResult.response;\n }\n request = middlewareResult.request;\n normalizedPath = normalizeRoutePath(new URL(request.url).pathname);\n matched = options.runtime.routeMatcher.match(normalizedPath);\n\n if (request.method === \"GET\" && options.runtime.prerenderableRoutes.has(normalizedPath)) {\n await loadBuiltServerModuleArtifactsForRequest(options.runtime, matched?.route.file, {\n includeRender: false,\n });\n return renderAndCachePrerenderWithLock({ ...options, request }, normalizedPath);\n }\n\n await loadBuiltServerModuleArtifactsForRequest(options.runtime, matched?.route.file, {\n includeRender: false,\n });\n const response = await renderBuiltDynamicResponse({ ...options, request });\n\n await applyBuiltPrerenderInvalidations(\n options.runtime,\n response,\n options.prerenderStore,\n );\n\n return options.sinkStrategy === \"buffer\"\n ? await materializeResponseAsBuffer(response)\n : response;\n}\n\nasync function resolveBuiltMiddleware(\n options: RenderBuiltAppRequestOptions & {\n runtime: BuiltRuntime;\n timing?: { phases: Record<string, number> } | undefined;\n },\n request: Request,\n): Promise<{ request: Request; type: \"continue\" } | { response: Response; type: \"response\" }> {\n if (!options.runtime.hasMiddleware) {\n return { request, type: \"continue\" };\n }\n\n await loadBuiltServerModuleArtifactsForRequest(options.runtime, undefined);\n\n return resolveAppRouterMiddleware({\n appDir: options.runtime.appDir,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: options.runtime.allowedSourceDirs,\n projectRoot: options.runtime.projectRoot,\n },\n instrumentation: options.instrumentation,\n request,\n serverModules: options.runtime.serverModules,\n serverModuleCacheVersion: options.runtime.serverModuleCacheVersion,\n serverSourceFiles: options.runtime.serverSourceFiles,\n timing: options.timing,\n });\n}\n\nfunction createBuiltRenderTiming(\n logger: AppRouterLogger | undefined,\n): { phases: Record<string, number> } | undefined {\n return logger?.debug === undefined ? undefined : { phases: {} };\n}\n\nfunction builtRenderTimingPhaseStartedAt(\n timing: { phases: Record<string, number> } | undefined,\n): number | undefined {\n return timing === undefined ? undefined : logNow();\n}\n\nfunction finishBuiltRenderTimingPhase(\n timing: { phases: Record<string, number> } | undefined,\n startedAt: number | undefined,\n phaseName: string,\n): void {\n if (timing === undefined || startedAt === undefined) {\n return;\n }\n\n timing.phases[phaseName] = logDurationMs(startedAt);\n}\n\nfunction emitBuiltRenderTiming(\n options: RenderBuiltAppRequestOptions,\n request: Request,\n timing: { phases: Record<string, number> } | undefined,\n status: number,\n): void {\n if (timing === undefined) {\n return;\n }\n\n emitRouterLog(options.logger, \"debug\", {\n method: request.method,\n path: new URL(request.url).pathname,\n phases: timing.phases,\n status,\n type: \"router:render:timing\",\n });\n}\n\nasync function applyBuiltAppResponseHook(\n response: Response,\n options: Pick<RenderBuiltAppRequestOptions, \"onResponse\" | \"request\">,\n): Promise<Response> {\n const hooked = await options.onResponse?.(response, {\n request: options.request,\n });\n\n return hooked instanceof Response ? hooked : response;\n}\n\nasync function materializeResponseAsBuffer(response: Response): Promise<Response> {\n if (response.body === null) {\n return response;\n }\n\n // Drains streaming responses into a single Buffer (loses TTFB streaming\n // by design — opt-in via sinkStrategy === \"buffer\"). Avoids the\n // string → UTF-8 encode the Response stream would otherwise do lazily\n // during the socket write. Tagged via `bytesResponse` so `sendResponse`\n // can take the raw-bytes fast path.\n const bytes = new Uint8Array(await response.arrayBuffer());\n return bytesResponse(bytes, {\n headers: response.headers,\n status: response.status,\n statusText: response.statusText,\n });\n}\n\nexport async function startServer(\n options: StartServerOptions,\n): Promise<{ close(): Promise<void>; server: Server; url: string }> {\n warnIfImplicitHostTrust(options);\n const runtime = await createBuiltRequestRuntime({\n importPolicy: options.importPolicy,\n outDir: options.outDir,\n });\n const server = createServer(async (incoming, outgoing) => {\n const startedAt = logNow();\n const fallbackRequestFields = {\n method: incoming.method ?? \"GET\",\n path: nodeRequestPath(incoming.url),\n runtime: \"node\" as const,\n };\n\n try {\n const fallbackHost = `${options.hostname ?? \"127.0.0.1\"}:${options.port}`;\n const host = resolveRequestHost({\n allowedHosts: options.allowedHosts,\n fallbackHost,\n hostPolicy: options.hostPolicy,\n rawHost: incoming.headers.host,\n });\n const origin = `http://${host}`;\n const request = nodeRequestToWebRequest(incoming, origin);\n const logFields = requestLogFields(request, \"node\");\n emitRouterLog(options.logger, \"info\", {\n ...logFields,\n type: \"router:request:start\",\n });\n const response = await runtime.render(request, {\n instrumentation: options.instrumentation,\n logger: options.logger,\n onResponse: options.onResponse,\n prerenderStore: options.prerenderStore,\n routeCache: options.routeCache,\n serverActions: options.serverActions,\n ...(options.sinkStrategy === undefined ? {} : { sinkStrategy: options.sinkStrategy }),\n });\n emitRouterLog(options.logger, \"info\", {\n ...logFields,\n durationMs: logDurationMs(startedAt),\n status: response.status,\n type: \"router:request:end\",\n });\n\n await sendResponse(outgoing, response);\n } catch (error) {\n // Log the full stack to stderr for operator visibility; never\n // place it in the response body where attackers can scrape it\n // (Issue 071). The errorHandler hook lets embedders customize\n // the public response shape while still benefiting from the\n // server-side log.\n emitRouterLog(options.logger, \"error\", {\n ...fallbackRequestFields,\n durationMs: logDurationMs(startedAt),\n error: logError(error),\n type: \"router:request:error\",\n });\n if (options.logger === undefined) {\n console.error(\"[mreact] startServer request failed:\", error);\n }\n const payload = options.errorHandler\n ? options.errorHandler(error)\n : { body: \"Internal Server Error\", status: 500 };\n outgoing.statusCode = payload.status;\n outgoing.setHeader(\n \"content-type\",\n payload.headers?.[\"content-type\"] ?? \"text/plain; charset=utf-8\",\n );\n for (const [name, value] of Object.entries(payload.headers ?? {})) {\n if (name.toLowerCase() === \"content-type\") continue;\n outgoing.setHeader(name, value);\n }\n outgoing.end(payload.body);\n }\n });\n\n if (options.onUpgrade !== undefined) {\n server.on(\"upgrade\", options.onUpgrade);\n }\n\n await new Promise<void>((resolve) =>\n server.listen(options.port, options.hostname ?? \"127.0.0.1\", resolve),\n );\n const address = server.address();\n const port = typeof address === \"object\" && address !== null ? address.port : options.port;\n\n return {\n server,\n url: `http://${options.hostname ?? \"127.0.0.1\"}:${port}`,\n close: () =>\n new Promise<void>((resolve, reject) =>\n server.close((error) => (error ? reject(error) : resolve())),\n ),\n };\n}\n\nasync function readBuiltClientAsset(outDir: string, pathname: string): Promise<Response> {\n const clientPrefix = \"/_mreact/client/\";\n const relativePath = pathname.slice(clientPrefix.length);\n const normalized = normalize(relativePath);\n\n if (normalized.startsWith(\"..\")) {\n return new Response(\"Not Found\", { status: 404 });\n }\n\n try {\n const code = await readFile(join(outDir, \"client\", normalized), \"utf8\");\n\n return new Response(code, {\n headers: clientAssetHeaders(normalized),\n });\n } catch {\n return new Response(\"Not Found\", { status: 404 });\n }\n}\n\nasync function readBuiltPublicAsset(\n outDir: string,\n pathname: string,\n): Promise<Response | undefined> {\n const relativePath = pathname.startsWith(\"/\") ? pathname.slice(1) : pathname;\n\n if (relativePath === \"\") {\n return undefined;\n }\n\n const normalized = normalize(relativePath);\n\n if (isAbsolute(normalized) || normalized === \"..\" || normalized.startsWith(\"../\")) {\n return undefined;\n }\n\n try {\n const cacheKey = `${outDir}\\0${normalized}`;\n const cached = builtPublicAssetCache.get(cacheKey);\n\n if (cached !== undefined) {\n return bytesResponse(cached.bytes, {\n headers: cached.headers,\n });\n }\n\n const bytes = await readFile(join(outDir, \"client\", \"public\", normalized));\n const headers = publicAssetHeaders(normalized);\n\n builtPublicAssetCache.set(cacheKey, {\n bytes,\n headers,\n });\n\n return bytesResponse(bytes, { headers });\n } catch {\n return undefined;\n }\n}\n\nexport const __readBuiltPublicAssetForTest = readBuiltPublicAsset;\n\nexport function __clearBuiltPublicAssetCacheForTest(): void {\n builtPublicAssetCache.clear();\n}\n\nexport function __getBuiltPublicAssetCacheSizeForTest(): number {\n return builtPublicAssetCache.size;\n}\n\nasync function readBuiltRuntime(options: {\n immutable?: boolean | undefined;\n outDir: string;\n runtimeDir?: string | undefined;\n}): Promise<BuiltRuntime> {\n const outDir = options.outDir;\n const runtimeDir = options.runtimeDir ?? join(outDir, \"server\", \"runtime\");\n const cacheKey = `${outDir}\\0${runtimeDir}`;\n const cached = builtRuntimeCache.get(cacheKey);\n\n if (options.immutable === true && cached !== undefined) {\n return cached.runtime;\n }\n\n const [serverManifestText, clientManifestText] = await Promise.all([\n readFile(join(outDir, \"server\", \"manifest.json\"), \"utf8\"),\n readFile(join(outDir, \"client\", \"manifest.json\"), \"utf8\"),\n ]);\n\n if (\n cached !== undefined &&\n cached.serverManifestText === serverManifestText &&\n cached.clientManifestText === clientManifestText\n ) {\n return cached.runtime;\n }\n\n const runtime = materializeBuiltRuntime({\n clientManifestText,\n outDir,\n runtimeDir,\n serverManifestText,\n });\n\n builtRuntimeCache.set(cacheKey, {\n clientManifestText,\n runtime,\n serverManifestText,\n });\n\n return runtime;\n}\n\nasync function materializeBuiltRuntime(options: {\n clientManifestText: string;\n outDir: string;\n runtimeDir: string;\n serverManifestText: string;\n}): Promise<BuiltRuntime> {\n const serverManifest = JSON.parse(options.serverManifestText) as BuiltServerManifest;\n const clientManifest = JSON.parse(options.clientManifestText) as {\n routes: ClientRouteManifestEntry[];\n styles?: Array<{ css?: readonly string[]; file: string }>;\n };\n const appDir = await materializeBuiltServerApp(options.runtimeDir, serverManifest);\n const projectRoot = appDir;\n const routesDir = join(projectRoot, serverManifest.routesDir ?? \"\");\n const routes = serverManifest.routes.map((route) => ({\n ...route,\n file: join(projectRoot, route.file),\n }));\n const prerenderedRoutes = new Map(Object.entries(serverManifest.prerenderedRoutes ?? {}));\n const prerenderableRoutes = new Set(prerenderedRoutes.keys());\n const prerenderLocks = new Map<string, Promise<Response>>();\n const serverModules = new Map<string, BuiltServerModuleArtifact>(\n Object.entries(serverManifest.serverModules ?? {}).map(([file, artifact]) => [\n join(appDir, file),\n artifact,\n ]),\n );\n const serverModuleFiles = new Map(\n Object.entries(serverManifest.serverModuleFiles ?? {}).map(([file, artifactFile]) => [\n join(appDir, file),\n join(options.outDir, \"server\", safeManifestFilePath(artifactFile)),\n ]),\n );\n const serverModuleRequestFiles = new Map(\n Object.entries(serverManifest.serverModuleRequestFiles ?? {}).map(([file, artifactFile]) => [\n join(appDir, file),\n join(options.outDir, \"server\", safeManifestFilePath(artifactFile)),\n ]),\n );\n const serverModuleRenderFiles = new Map(\n Object.entries(serverManifest.serverModuleRenderFiles ?? {}).map(([file, artifactFile]) => [\n join(appDir, file),\n join(options.outDir, \"server\", safeManifestFilePath(artifactFile)),\n ]),\n );\n const serverSourceFiles = new Map(\n Object.entries(serverManifest.files).map(([file, source]) => [join(appDir, file), source]),\n );\n const serverActionReferencesByFile = new Map(\n Object.entries(serverManifest.routeServerActionReferences ?? {}).map(([file, references]) => [\n join(appDir, file),\n references,\n ]),\n );\n const routeMatcher = createRouteMatcher(routes);\n const clientScripts = new Map(\n clientManifest.routes.flatMap((route) =>\n route.client && route.script !== undefined ? [[route.path, route.script]] : [],\n ),\n );\n const clientStyles = new Map(\n clientManifest.routes.flatMap((route) =>\n route.css !== undefined && route.css.length > 0 ? [[route.path, route.css]] : [],\n ),\n );\n const clientStylesByFile = new Map(\n (clientManifest.styles ?? []).flatMap((style) =>\n style.css !== undefined && style.css.length > 0\n ? [[join(routesDir, style.file), style.css] as const]\n : [],\n ),\n );\n const navigationScripts = new Map(\n clientManifest.routes.flatMap((route) =>\n route.navigation === true && route.navigationScript !== undefined\n ? [[route.path, route.navigationScript]]\n : [],\n ),\n );\n const hasMiddleware =\n serverSourceFiles.has(join(routesDir, \"middleware.ts\")) ||\n serverSourceFiles.has(join(routesDir, \"middleware.mreact.ts\"));\n const serverModuleCacheVersion = createHash(\"sha256\")\n .update(options.serverManifestText)\n .update(\"\\0\")\n .update(options.clientManifestText)\n .digest(\"hex\")\n .slice(0, 16);\n\n const allowedSourceDirs = (serverManifest.allowedSourceDirs ?? [\"\"]).map((directory) =>\n join(projectRoot, directory),\n );\n\n return {\n appDir: routesDir,\n allowedSourceDirs,\n ...(serverManifest.assetBaseUrl === undefined\n ? {}\n : { assetBaseUrl: serverManifest.assetBaseUrl }),\n clientScripts,\n clientStylesByFile,\n clientStyles,\n hasMiddleware,\n navigationScripts,\n projectRoot,\n ...(serverManifest.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: serverManifest.publicAssetBaseUrl }),\n prerenderableRoutes,\n prerenderLocks,\n prerenderedRoutes,\n routeMatcher,\n routes,\n serverActionReferencesByFile,\n ...(serverManifest.serverActionManifest === undefined\n ? {}\n : { serverActionManifest: serverManifest.serverActionManifest }),\n serverModuleArtifactLoads: new Map(),\n serverModuleFiles,\n serverModuleRenderFiles,\n serverModuleRequestFiles,\n serverModules,\n serverModuleCacheVersion,\n serverSourceFiles,\n };\n}\n\nasync function loadBuiltServerModuleArtifacts(\n runtime: BuiltRuntime,\n files: Iterable<string>,\n kind: BuiltServerModuleArtifactKind = \"all\",\n): Promise<void> {\n for (const file of files) {\n await loadBuiltServerModuleArtifact(runtime, file, kind);\n }\n}\n\ntype BuiltServerModuleArtifactKind = \"all\" | \"render\" | \"request\";\n\nasync function loadBuiltServerModuleArtifact(\n runtime: BuiltRuntime,\n file: string,\n kind: BuiltServerModuleArtifactKind = \"all\",\n): Promise<void> {\n if (kind === \"all\") {\n await loadBuiltServerModuleArtifact(runtime, file, \"request\");\n await loadBuiltServerModuleArtifact(runtime, file, \"render\");\n return;\n }\n\n const artifactPath =\n kind === \"request\"\n ? runtime.serverModuleRequestFiles.get(file) ?? runtime.serverModuleFiles.get(file)\n : runtime.serverModuleRenderFiles.get(file) ?? runtime.serverModuleFiles.get(file);\n\n if (artifactPath === undefined) {\n return;\n }\n\n const cached = runtime.serverModuleArtifactLoads.get(`${kind}\\0${file}`);\n\n if (cached !== undefined) {\n await cached;\n return;\n }\n\n const loaded = readFile(artifactPath, \"utf8\")\n .then((text) => {\n const existing = runtime.serverModules.get(file) ?? {};\n runtime.serverModules.set(\n file,\n mergeBuiltServerModuleArtifacts(\n existing,\n hydrateBuiltServerModuleArtifact(\n JSON.parse(text) as BuiltServerModuleArtifact,\n builtServerDirForArtifactPath(artifactPath),\n ),\n ),\n );\n })\n .catch((error) => {\n runtime.serverModuleArtifactLoads.delete(`${kind}\\0${file}`);\n throw error;\n });\n runtime.serverModuleArtifactLoads.set(`${kind}\\0${file}`, loaded);\n\n await loaded;\n}\n\nfunction allBuiltServerModuleFiles(runtime: BuiltRuntime): Iterable<string> {\n return new Set([\n ...runtime.serverModuleFiles.keys(),\n ...runtime.serverModuleRequestFiles.keys(),\n ...runtime.serverModuleRenderFiles.keys(),\n ]);\n}\n\nfunction builtServerDirForArtifactPath(artifactPath: string): string {\n const marker = `${sep}server-modules${sep}`;\n const index = artifactPath.lastIndexOf(marker);\n\n return index === -1 ? dirname(dirname(artifactPath)) : artifactPath.slice(0, index);\n}\n\nfunction hydrateBuiltServerModuleArtifact(\n artifact: BuiltServerModuleArtifact,\n serverDir: string,\n): BuiltServerModuleArtifact {\n return {\n ...(artifact.analysis === undefined ? {} : { analysis: artifact.analysis }),\n ...(artifact.loader === undefined\n ? {}\n : { loader: hydrateBuiltServerModuleOutput(artifact.loader, serverDir) }),\n ...(artifact.routeMetadata === undefined\n ? {}\n : { routeMetadata: hydrateBuiltServerModuleOutput(artifact.routeMetadata, serverDir) }),\n ...(artifact.request === undefined\n ? {}\n : { request: hydrateBuiltServerModuleOutput(artifact.request, serverDir) }),\n ...(artifact.stream === undefined\n ? {}\n : { stream: hydrateBuiltServerModuleOutput(artifact.stream, serverDir) }),\n ...(artifact.string === undefined\n ? {}\n : { string: hydrateBuiltServerModuleOutput(artifact.string, serverDir) }),\n };\n}\n\nfunction hydrateBuiltServerModuleOutput<T extends { moduleFile?: string | undefined }>(\n output: T,\n serverDir: string,\n): T {\n if (output.moduleFile === undefined || isAbsolute(output.moduleFile)) {\n return output;\n }\n\n return {\n ...output,\n moduleFile: join(serverDir, safeManifestFilePath(output.moduleFile)),\n };\n}\n\nfunction mergeBuiltServerModuleArtifacts(\n existing: BuiltServerModuleArtifact,\n loaded: BuiltServerModuleArtifact,\n): BuiltServerModuleArtifact {\n return {\n ...existing,\n ...loaded,\n };\n}\n\nasync function loadBuiltServerModuleArtifactsForRequest(\n runtime: BuiltRuntime,\n routeFile: string | undefined,\n options: {\n includeRender?: boolean | undefined;\n includeShells?: boolean | undefined;\n } = {},\n): Promise<void> {\n const roots = [\n join(runtime.appDir, \"middleware.ts\"),\n join(runtime.appDir, \"middleware.mreact.ts\"),\n ...(routeFile === undefined\n ? []\n : [\n routeFile,\n ...(options.includeShells === false ? [] : shellFilesForRoute(runtime, routeFile)),\n ]),\n ];\n const seen = new Set<string>();\n\n for (const file of roots) {\n await loadBuiltServerModuleArtifactClosure(runtime, file, seen, \"request\");\n }\n\n if (options.includeRender === true) {\n seen.clear();\n for (const file of roots) {\n await loadBuiltServerModuleArtifactClosure(runtime, file, seen, \"render\");\n }\n }\n}\n\nasync function loadBuiltServerModuleArtifactClosure(\n runtime: BuiltRuntime,\n file: string,\n seen: Set<string>,\n kind: BuiltServerModuleArtifactKind,\n): Promise<void> {\n if (seen.has(file)) {\n return;\n }\n seen.add(file);\n\n await loadBuiltServerModuleArtifact(runtime, file, kind);\n\n const source = runtime.serverSourceFiles.get(file);\n\n if (source === undefined) {\n return;\n }\n\n for (const specifier of localServerModuleSpecifiers(source)) {\n const resolved = resolveBuiltLocalServerSourceImport(runtime, file, specifier);\n\n if (resolved !== undefined) {\n await loadBuiltServerModuleArtifactClosure(runtime, resolved, seen, kind);\n }\n }\n}\n\nfunction localServerModuleSpecifiers(code: string): string[] {\n const specifiers = new Set<string>();\n const importPattern =\n /\\b(?:import|export)\\s+(?:type\\s+)?(?:[^\"']*?\\s+from\\s*)?[\"'](?<source>\\.{1,2}\\/[^\"']+)[\"']/g;\n\n for (const match of code.matchAll(importPattern)) {\n const source = match.groups?.source;\n\n if (source !== undefined) {\n specifiers.add(source);\n }\n }\n\n return Array.from(specifiers);\n}\n\nfunction resolveBuiltLocalServerSourceImport(\n runtime: BuiltRuntime,\n fromFile: string,\n specifier: string,\n): string | undefined {\n const base = join(dirname(fromFile), specifier);\n\n for (const candidate of localServerSourceImportCandidates(base)) {\n if (runtime.serverSourceFiles.has(candidate)) {\n return candidate;\n }\n }\n\n return undefined;\n}\n\nfunction localServerSourceImportCandidates(base: string): string[] {\n const candidates = [base];\n\n if (base.endsWith(\".js\")) {\n const withoutJs = base.slice(0, -\".js\".length);\n candidates.push(`${withoutJs}.ts`, `${withoutJs}.tsx`, `${withoutJs}.mreact.tsx`);\n } else if (base.endsWith(\".jsx\")) {\n const withoutJsx = base.slice(0, -\".jsx\".length);\n candidates.push(`${withoutJsx}.tsx`, `${withoutJsx}.mreact.tsx`);\n } else if (base.endsWith(\".mreact\")) {\n candidates.push(`${base}.tsx`);\n } else {\n candidates.push(\n `${base}.ts`,\n `${base}.tsx`,\n `${base}.mreact.tsx`,\n join(base, \"index.ts\"),\n join(base, \"index.tsx\"),\n join(base, \"index.mreact.tsx\"),\n );\n }\n\n return candidates;\n}\n\nfunction shellFilesForRoute(runtime: BuiltRuntime, routeFile: string): string[] {\n return routeShellCandidates(runtime.appDir, routeFile)\n .map((candidate) => candidate.file)\n .filter((file) => runtime.serverSourceFiles.has(file));\n}\n\nasync function readPrerenderedRoute(\n runtime: BuiltRuntime,\n path: string,\n store: AppRouterPrerenderStore | undefined,\n): Promise<BuiltPrerenderedRoute | undefined> {\n const stored = await store?.get(path);\n\n if (stored !== undefined) {\n runtime.prerenderedRoutes.set(path, stored);\n return stored;\n }\n\n const manifestEntry = runtime.prerenderedRoutes.get(path);\n\n if (manifestEntry !== undefined && store !== undefined) {\n await store.set(path, manifestEntry);\n }\n\n return manifestEntry;\n}\n\nfunction renderBuiltDynamicResponse(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n): Promise<Response> {\n return renderAppRequest(builtRenderAppRequestOptions(options));\n}\n\nfunction builtRenderAppRequestOptions(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n): RenderAppRequestOptions {\n const renderOptions: RenderAppRequestOptions & {\n __mreactLoadServerRenderArtifacts?: ((routeFile: string) => Promise<void>) | undefined;\n } = {\n appDir: options.runtime.appDir,\n assetBaseUrl: options.runtime.assetBaseUrl,\n clientScripts: options.runtime.clientScripts,\n clientStylesByFile: options.runtime.clientStylesByFile,\n clientStyles: options.runtime.clientStyles,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: options.runtime.allowedSourceDirs,\n projectRoot: options.runtime.projectRoot,\n },\n request: options.request,\n instrumentation: options.instrumentation,\n logger: options.logger,\n navigationScripts: options.runtime.navigationScripts,\n routeCache: options.routeCache,\n routeMatcher: options.runtime.routeMatcher,\n routes: options.runtime.routes,\n __mreactLoadServerRenderArtifacts: async (routeFile: string) => {\n await loadBuiltServerModuleArtifactsForRequest(options.runtime, routeFile, {\n includeRender: true,\n });\n },\n serverModules: options.runtime.serverModules,\n serverModuleCacheVersion: options.runtime.serverModuleCacheVersion,\n serverSourceFiles: options.runtime.serverSourceFiles,\n serverActionReferencesByFile: options.runtime.serverActionReferencesByFile,\n serverActions: mergeBuiltServerActionOptions(\n options.serverActions,\n options.runtime.serverActionManifest,\n ),\n skipMiddleware: true,\n ...(options.preload === undefined ? {} : { preload: options.preload }),\n };\n\n return renderOptions;\n}\n\nfunction mergeBuiltServerActionOptions(\n options: AppRouterServerActionOptions | undefined,\n allowedActions: readonly { moduleId: string; exportName: string; inferred?: boolean }[] | undefined,\n): AppRouterServerActionOptions | undefined {\n if (allowedActions === undefined) {\n return options;\n }\n\n return {\n ...options,\n allowedActions,\n };\n}\n\nasync function renderAndCachePrerenderWithLock(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n path: string,\n): Promise<Response> {\n const existing = options.runtime.prerenderLocks.get(path);\n\n if (existing !== undefined) {\n return cloneResponse(await existing);\n }\n\n const task = runPrerenderRegeneration(options, path);\n options.runtime.prerenderLocks.set(path, task);\n\n try {\n return cloneResponse(await task);\n } finally {\n options.runtime.prerenderLocks.delete(path);\n }\n}\n\nasync function runPrerenderRegeneration(\n options: RenderBuiltAppRequestOptions & { runtime: BuiltRuntime },\n path: string,\n): Promise<Response> {\n const regenerate = async () => {\n const stored = await readPrerenderedRoute(options.runtime, path, options.prerenderStore);\n\n if (stored !== undefined) {\n return htmlResponse(stored.html, {\n headers: stored.headers,\n status: stored.status,\n });\n }\n\n const response = await renderBuiltDynamicResponse(options);\n\n return response.ok\n ? await cacheRegeneratedPrerenderedRoute(\n options.runtime,\n path,\n response,\n options.prerenderStore,\n )\n : response;\n };\n\n return options.prerenderStore?.withLock === undefined\n ? await regenerate()\n : await options.prerenderStore.withLock(path, regenerate);\n}\n\nasync function applyBuiltPrerenderInvalidations(\n runtime: BuiltRuntime,\n response: Response,\n store: AppRouterPrerenderStore | undefined,\n): Promise<void> {\n const revalidated = response.headers.get(\"x-mreact-revalidate\");\n\n if (revalidated === null) {\n return;\n }\n\n for (const path of revalidated.split(\",\")) {\n const normalized = normalizeRoutePath(path.trim());\n runtime.prerenderedRoutes.delete(normalized);\n await store?.delete(normalized);\n }\n}\n\nasync function cacheRegeneratedPrerenderedRoute(\n runtime: BuiltRuntime,\n path: string,\n response: Response,\n store: AppRouterPrerenderStore | undefined,\n): Promise<Response> {\n const body = await response.text();\n const headers: Record<string, string> = {};\n\n response.headers.forEach((value, key) => {\n headers[key] = value;\n });\n const entry = {\n headers,\n html: body,\n status: response.status,\n };\n runtime.prerenderedRoutes.set(path, entry);\n await store?.set(path, entry);\n\n return htmlResponse(body, {\n headers: response.headers,\n status: response.status,\n });\n}\n\nasync function cloneResponse(response: Response): Promise<Response> {\n return htmlResponse(await response.clone().text(), {\n headers: response.headers,\n status: response.status,\n });\n}\n\nasync function materializeBuiltServerApp(\n runtimeDir: string,\n manifest: BuiltServerManifest,\n): Promise<string> {\n const appDir = join(runtimeDir, \"app\");\n\n await rm(appDir, { force: true, recursive: true });\n await Promise.all(\n Object.entries(manifest.files).map(async ([file, code]) => {\n const outputFile = join(appDir, safeManifestFilePath(file));\n\n await mkdir(dirname(outputFile), { recursive: true });\n await writeFile(outputFile, code);\n }),\n );\n\n return appDir;\n}\n\nfunction safeManifestFilePath(pathname: string): string {\n const normalized = normalize(pathname);\n\n if (isAbsolute(normalized) || normalized === \"..\" || normalized.startsWith(\"../\")) {\n throw new Error(`Invalid built app manifest file path: ${pathname}`);\n }\n\n return normalized;\n}\n\nfunction clientAssetHeaders(pathname: string): HeadersInit {\n if (pathname === \"manifest.json\") {\n return {\n \"cache-control\": \"no-cache\",\n \"content-type\": \"application/json; charset=utf-8\",\n };\n }\n\n return {\n \"cache-control\": \"public, max-age=31536000, immutable\",\n \"content-type\": pathname.endsWith(\".css\")\n ? \"text/css; charset=utf-8\"\n : \"text/javascript; charset=utf-8\",\n };\n}\n\nfunction publicAssetHeaders(pathname: string): HeadersInit {\n return {\n \"cache-control\": \"public, max-age=3600\",\n \"content-type\": publicAssetContentType(pathname),\n };\n}\n\nfunction publicAssetContentType(pathname: string): string {\n if (pathname.endsWith(\".css\")) return \"text/css; charset=utf-8\";\n if (pathname.endsWith(\".html\")) return \"text/html; charset=utf-8\";\n if (pathname.endsWith(\".js\")) return \"text/javascript; charset=utf-8\";\n if (pathname.endsWith(\".json\")) return \"application/json; charset=utf-8\";\n if (pathname.endsWith(\".svg\")) return \"image/svg+xml\";\n if (pathname.endsWith(\".png\")) return \"image/png\";\n if (pathname.endsWith(\".jpg\") || pathname.endsWith(\".jpeg\")) return \"image/jpeg\";\n if (pathname.endsWith(\".webp\")) return \"image/webp\";\n if (pathname.endsWith(\".ico\")) return \"image/x-icon\";\n if (pathname.endsWith(\".txt\")) return \"text/plain; charset=utf-8\";\n\n return \"application/octet-stream\";\n}\n"]}
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,YAAY,EAElB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAoBhE,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIxE,MAAM,WAAW,8BAA+B,SAAQ,uBAAuB;IAC7E,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7C,UAAU,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC3C,YAAY,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACjD,UAAU,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACxC,aAAa,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;IACzD,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAAC;CACnD;AAQD,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IAC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AAC;IACjD,UAAU,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACxC,aAAa,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;IACzD,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAAC;CACnD;AAQD,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7C,UAAU,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC3C,YAAY,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACjD,UAAU,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACxC,aAAa,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;CAC1D;AAmBD,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,MAAM,CA+QrF;AAqBD,eAAO,MAAM,YAAY,kCAA4B,CAAC;AAoCtD,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,SAAS,OAAO,EAAE,GAC1B,wBAAwB,GAAG,SAAS,CActC;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,kBAAkB,CAc5B;AA2ED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAAA;CAAO,GACjF,OAAO,CAAC,QAAQ,CAAC,CAuEnB"}
|
package/dist/vite.js
CHANGED
|
@@ -9,7 +9,7 @@ import { buildNavigationRuntimeBundle, buildClientRouteBundle, buildClientRouteE
|
|
|
9
9
|
import { nodeRequestToWebRequest, sendResponse } from "./http.js";
|
|
10
10
|
import { renderAppRequest } from "./render.js";
|
|
11
11
|
import { stripRouteClientOnlyExports } from "./route-source.js";
|
|
12
|
-
import { collectRouteCssHrefs } from "./route-styles.js";
|
|
12
|
+
import { collectRouteCssHrefs, collectSpecialBoundaryFiles } from "./route-styles.js";
|
|
13
13
|
import { scanAppRoutes } from "./routes.js";
|
|
14
14
|
import { resolveRequestHost } from "./serve.js";
|
|
15
15
|
import { hasJsxSyntax } from "./source-jsx.js";
|
|
@@ -350,6 +350,7 @@ async function handleAppRouterViteRequest(options, incoming, outgoing, next) {
|
|
|
350
350
|
projectRoot: project.projectRoot,
|
|
351
351
|
},
|
|
352
352
|
clientStyles: await devRouteStyles(project),
|
|
353
|
+
clientStylesByFile: await devSpecialRouteStyles(project),
|
|
353
354
|
navigationScripts: await devNavigationScripts(project.routesDir, options.clientRouteInferenceCache, routeTransformPlugins),
|
|
354
355
|
request,
|
|
355
356
|
routeCache: options.routeCache,
|
|
@@ -544,6 +545,19 @@ async function devRouteStyles(project) {
|
|
|
544
545
|
const routeStyles = entries.filter((entry) => entry !== undefined);
|
|
545
546
|
return new Map(routeStyles);
|
|
546
547
|
}
|
|
548
|
+
async function devSpecialRouteStyles(project) {
|
|
549
|
+
const entries = await Promise.all((await collectSpecialBoundaryFiles(project.routesDir)).map(async (file) => {
|
|
550
|
+
const hrefs = await collectRouteCssHrefs({
|
|
551
|
+
appDir: project.routesDir,
|
|
552
|
+
hrefPrefix: devCssPrefix,
|
|
553
|
+
pageFile: file,
|
|
554
|
+
projectRoot: project.projectRoot,
|
|
555
|
+
});
|
|
556
|
+
return hrefs.length === 0 ? undefined : [file, hrefs];
|
|
557
|
+
}));
|
|
558
|
+
const routeStyles = entries.filter((entry) => entry !== undefined);
|
|
559
|
+
return new Map(routeStyles);
|
|
560
|
+
}
|
|
547
561
|
async function devNavigationScripts(appDir, inferenceCache, vitePlugins) {
|
|
548
562
|
const cache = inferenceCache ?? createClientRouteInferenceCache();
|
|
549
563
|
const entries = await Promise.all((await scanAppRoutes({ appDir })).map(async (route) => {
|