@reckona/mreact-router 0.0.92 → 0.0.94
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 +9 -3
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +7 -2
- package/dist/build.js.map +1 -1
- package/dist/client-route-inference.d.ts +1 -1
- package/dist/client-route-inference.d.ts.map +1 -1
- package/dist/client-route-inference.js +1 -1
- package/dist/client-route-inference.js.map +1 -1
- package/dist/client.d.ts +12 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +124 -15
- package/dist/client.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +30 -6
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/build.ts +7 -2
- package/src/client-route-inference.ts +2 -1
- package/src/client.ts +177 -15
- package/src/vite.ts +45 -11
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;
|
|
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,K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B,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
|
@@ -4,7 +4,7 @@ import { formatDiagnostic } from "@reckona/mreact-compiler";
|
|
|
4
4
|
import { createCompilerModuleContext, transformCompilerModuleContext, } from "@reckona/mreact-compiler/internal";
|
|
5
5
|
import { normalizePath, } from "vite";
|
|
6
6
|
import { resolveAppRouterProjectOptions, } from "./config.js";
|
|
7
|
-
import { collectClientRouteReferences,
|
|
7
|
+
import { collectClientRouteReferences, createClientRouteInferenceCache, isClientRouteSource, resolveNavigationRuntime, } from "./client-route-inference.js";
|
|
8
8
|
import { buildNavigationRuntimeBundle, buildClientRouteBundle, buildClientRouteEntrySource, clientScriptForPath, navigationRuntimeScriptForDev, } from "./navigation-runtime.js";
|
|
9
9
|
import { nodeRequestToWebRequest, sendResponse } from "./http.js";
|
|
10
10
|
import { renderAppRequest } from "./render.js";
|
|
@@ -96,6 +96,11 @@ export function createAppRouterVitePlugin(options) {
|
|
|
96
96
|
packageFile("shared", "@reckona/mreact-shared", "url-safety"),
|
|
97
97
|
],
|
|
98
98
|
]);
|
|
99
|
+
// User-declared plugins captured from the resolving config. Unlike the fully
|
|
100
|
+
// resolved `server.config.plugins`, this excludes Vite internals (e.g. the
|
|
101
|
+
// built-in CSS plugin) whose `transform` requires a dev-server environment the
|
|
102
|
+
// lightweight navigation scan cannot provide. Mirrors what the build forwards.
|
|
103
|
+
let userVitePlugins;
|
|
99
104
|
const plugin = {
|
|
100
105
|
[mreactRouterConfigKey]: {
|
|
101
106
|
...project,
|
|
@@ -103,7 +108,8 @@ export function createAppRouterVitePlugin(options) {
|
|
|
103
108
|
},
|
|
104
109
|
enforce: "pre",
|
|
105
110
|
name: "mreact-router",
|
|
106
|
-
config() {
|
|
111
|
+
config(userConfig) {
|
|
112
|
+
userVitePlugins = userConfig.plugins;
|
|
107
113
|
return {
|
|
108
114
|
optimizeDeps: {
|
|
109
115
|
exclude: [
|
|
@@ -122,6 +128,7 @@ export function createAppRouterVitePlugin(options) {
|
|
|
122
128
|
return () => {
|
|
123
129
|
const middlewareOptions = {
|
|
124
130
|
...options,
|
|
131
|
+
navigationScanVitePlugins: userVitePlugins,
|
|
125
132
|
viteDevServer: server,
|
|
126
133
|
vitePlugins: server.config.plugins,
|
|
127
134
|
};
|
|
@@ -262,8 +269,17 @@ export function mreactRouterConfigFromPlugins(plugins) {
|
|
|
262
269
|
return undefined;
|
|
263
270
|
}
|
|
264
271
|
export function createAppRouterViteMiddleware(options) {
|
|
272
|
+
// Reused across requests so dev navigation-script detection memoizes module
|
|
273
|
+
// contexts/analyses instead of re-walking every route's import graph per
|
|
274
|
+
// request. The source-keyed caches keep only the latest content version per
|
|
275
|
+
// file (see setLatestModuleCacheEntry), so repeated edits do not accumulate
|
|
276
|
+
// stale entries over a long dev session.
|
|
277
|
+
const runtimeOptions = {
|
|
278
|
+
...options,
|
|
279
|
+
clientRouteInferenceCache: createClientRouteInferenceCache(),
|
|
280
|
+
};
|
|
265
281
|
return (request, response, next) => {
|
|
266
|
-
void handleAppRouterViteRequest(
|
|
282
|
+
void handleAppRouterViteRequest(runtimeOptions, request, response, next);
|
|
267
283
|
};
|
|
268
284
|
}
|
|
269
285
|
async function handleAppRouterViteRequest(options, incoming, outgoing, next) {
|
|
@@ -301,7 +317,7 @@ async function handleAppRouterViteRequest(options, incoming, outgoing, next) {
|
|
|
301
317
|
projectRoot: project.projectRoot,
|
|
302
318
|
},
|
|
303
319
|
clientStyles: await devRouteStyles(project),
|
|
304
|
-
navigationScripts: await devNavigationScripts(project.routesDir),
|
|
320
|
+
navigationScripts: await devNavigationScripts(project.routesDir, options.clientRouteInferenceCache, options.navigationScanVitePlugins),
|
|
305
321
|
request,
|
|
306
322
|
routeCache: options.routeCache,
|
|
307
323
|
serverActions: options.serverActions,
|
|
@@ -460,13 +476,21 @@ async function devRouteStyles(project) {
|
|
|
460
476
|
const routeStyles = entries.filter((entry) => entry !== undefined);
|
|
461
477
|
return new Map(routeStyles);
|
|
462
478
|
}
|
|
463
|
-
async function devNavigationScripts(appDir) {
|
|
479
|
+
async function devNavigationScripts(appDir, inferenceCache, vitePlugins) {
|
|
480
|
+
const cache = inferenceCache ?? createClientRouteInferenceCache();
|
|
464
481
|
const entries = await Promise.all((await scanAppRoutes({ appDir })).map(async (route) => {
|
|
465
482
|
if (route.kind !== "page") {
|
|
466
483
|
return undefined;
|
|
467
484
|
}
|
|
468
485
|
const source = await readFile(route.file, "utf8");
|
|
469
|
-
|
|
486
|
+
const navigation = await resolveNavigationRuntime({
|
|
487
|
+
appDir,
|
|
488
|
+
cache,
|
|
489
|
+
code: source,
|
|
490
|
+
filename: route.file,
|
|
491
|
+
vitePlugins,
|
|
492
|
+
});
|
|
493
|
+
return navigation
|
|
470
494
|
? [route.path, navigationRuntimeScriptForDev()]
|
|
471
495
|
: undefined;
|
|
472
496
|
}));
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,aAAa,GAKd,MAAM,MAAM,CAAC;AAGd,OAAO,EACL,8BAA8B,GAG/B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,6BAA6B,CA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,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO;YACT,CAAC;YACD,QAAQ,GAAG,IAAI,CAAC;YAChB,QAAQ,CAAC,GAAG,GAAG,WAAW,CAAC;YAC3B,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;gBACjC,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,cAAc,CAAC;YAC3C,CAAC;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,GAAG,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;QAC5C,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,oBAAoB,CAAC;QAC/C,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO;;;;EAIP,IAAI;;;;;;;;;;CAUL,CAAC;AACF,CAAC","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport type { ServerResponse } from \"node:http\";\nimport { dirname } from \"node:path\";\nimport { formatDiagnostic } from \"@reckona/mreact-compiler\";\nimport {\n createCompilerModuleContext,\n transformCompilerModuleContext,\n} from \"@reckona/mreact-compiler/internal\";\nimport {\n normalizePath,\n type Connect,\n type Plugin,\n type PluginOption,\n type ViteDevServer,\n} from \"vite\";\nimport type { AppRouterServerActionOptions } from \"./actions.js\";\nimport type { AppRouterCache } from \"./cache.js\";\nimport {\n resolveAppRouterProjectOptions,\n type AppRouterProjectOptions,\n type ResolvedAppRouterProject,\n} from \"./config.js\";\nimport type { AppRouterImportPolicy } from \"./import-policy.js\";\nimport {\n collectClientRouteReferences,\n detectNavigationRuntimeHint,\n isClientRouteSource,\n} from \"./client-route-inference.js\";\nimport {\n buildNavigationRuntimeBundle,\n buildClientRouteBundle,\n buildClientRouteEntrySource,\n clientScriptForPath,\n navigationRuntimeScriptForDev,\n} from \"./navigation-runtime.js\";\nimport { nodeRequestToWebRequest, sendResponse } from \"./http.js\";\nimport { renderAppRequest } from \"./render.js\";\nimport { stripRouteClientOnlyExports } from \"./route-source.js\";\nimport { collectRouteCssHrefs } from \"./route-styles.js\";\nimport { scanAppRoutes } from \"./routes.js\";\nimport { resolveRequestHost, type RequestHostPolicy } from \"./serve.js\";\nimport { hasJsxSyntax } from \"./source-jsx.js\";\nimport { workspacePackageFile } from \"./workspace-packages.js\";\n\nexport interface AppRouterViteMiddlewareOptions extends AppRouterProjectOptions {\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n vitePlugins?: readonly PluginOption[] | undefined;\n}\n\ntype AppRouterViteRuntimeMiddlewareOptions = AppRouterViteMiddlewareOptions & {\n viteDevServer?: ViteDevServer | undefined;\n};\n\nexport interface AppRouterVitePluginOptions extends AppRouterProjectOptions {\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n}\n\nconst clientPrefix = \"/_mreact/client/\";\nconst devCssPrefix = \"/_mreact/dev-css/\";\nconst clientRouteModuleQuery = \"mreact-router-client-route\";\nconst virtualClientPrefix = \"\\0mreact-router-client:\";\nconst virtualReactiveCoreId = \"\\0mreact-router-reactive-core\";\nconst virtualReactiveDevtoolsId = \"\\0mreact-router-reactive-devtools\";\nconst mreactRouterConfigKey = \"__mreactRouterConfig\";\n\ntype MreactRouterPluginConfig = ResolvedAppRouterProject & {\n importPolicy?: AppRouterImportPolicy | undefined;\n};\n\ntype MreactRouterPlugin = Plugin & {\n [mreactRouterConfigKey]: MreactRouterPluginConfig;\n};\n\nexport function createAppRouterVitePlugin(options: AppRouterVitePluginOptions): Plugin {\n const project = resolveAppRouterProjectOptions(options);\n const normalizedSourceDirs = project.allowedSourceDirs.map((directory) =>\n normalizePath(directory),\n );\n const packageFile = (monorepoDir: string, packageName: string, entry: string): string =>\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry,\n monorepoDir,\n packageName,\n });\n const reactiveCorePath = packageFile(\"reactive-core\", \"@reckona/mreact-reactive-core\", \"index\");\n const reactiveCoreDir = normalizePath(dirname(reactiveCorePath));\n const reactiveDomPath = packageFile(\"reactive-dom\", \"@reckona/mreact-reactive-dom\", \"index\");\n const reactiveDomDir = normalizePath(dirname(reactiveDomPath));\n const reactCompatPath = packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"index\");\n const reactCompatDir = normalizePath(dirname(reactCompatPath));\n const runtimePackageDirs = [reactiveCoreDir, reactiveDomDir, reactCompatDir];\n const runtimePackageNames = [\n \"@reckona/mreact-reactive-core\",\n \"@reckona/mreact-reactive-dom\",\n \"@reckona/mreact-compat\",\n ];\n const runtimePaths = new Map([\n [\"react\", reactCompatPath],\n [\"react-dom\", reactCompatPath],\n [\"react-dom/client\", reactCompatPath],\n [\"react-dom/server\", reactCompatPath],\n [\n \"react/jsx-dev-runtime\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"jsx-dev-runtime\"),\n ],\n [\"react/jsx-runtime\", packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"jsx-runtime\")],\n [\n \"@reckona/mreact-reactive-core/internal\",\n packageFile(\"reactive-core\", \"@reckona/mreact-reactive-core\", \"internal\"),\n ],\n [\"@reckona/mreact-reactive-dom\", reactiveDomPath],\n [\"@reckona/mreact-compat\", reactCompatPath],\n [\n \"@reckona/mreact-compat/event-priority\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"event-priority\"),\n ],\n [\n \"@reckona/mreact-compat/flight\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"flight\"),\n ],\n [\n \"@reckona/mreact-compat/hooks\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"hooks-entry\"),\n ],\n [\n \"@reckona/mreact-compat/internal\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"internal\"),\n ],\n [\n \"@reckona/mreact-compat/jsx-dev-runtime\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"jsx-dev-runtime\"),\n ],\n [\n \"@reckona/mreact-compat/jsx-runtime\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"jsx-runtime\"),\n ],\n [\n \"@reckona/mreact-compat/scheduler\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"scheduler\"),\n ],\n [\"@reckona/mreact-router/link\", packageFile(\"router\", \"@reckona/mreact-router\", \"link\")],\n [\n \"@reckona/mreact-router/navigation-state\",\n packageFile(\"router\", \"@reckona/mreact-router\", \"navigation-state\"),\n ],\n [\n \"@reckona/mreact-shared/url-safety\",\n packageFile(\"shared\", \"@reckona/mreact-shared\", \"url-safety\"),\n ],\n ]);\n\n const plugin: MreactRouterPlugin = {\n [mreactRouterConfigKey]: {\n ...project,\n ...(options.importPolicy === undefined ? {} : { importPolicy: options.importPolicy }),\n },\n enforce: \"pre\",\n name: \"mreact-router\",\n config() {\n return {\n optimizeDeps: {\n exclude: [\n \"react\",\n \"react-dom\",\n \"react-dom/client\",\n \"react-dom/server\",\n \"react/jsx-dev-runtime\",\n \"react/jsx-runtime\",\n ],\n },\n };\n },\n configureServer(server) {\n server.middlewares.use(createDevCssProxyMiddleware());\n\n return () => {\n const middlewareOptions: AppRouterViteRuntimeMiddlewareOptions = {\n ...options,\n viteDevServer: server,\n vitePlugins: server.config.plugins,\n };\n\n server.middlewares.use(createAppRouterViteMiddleware(middlewareOptions));\n };\n },\n handleHotUpdate(context) {\n const normalizedFile = normalizePath(context.file);\n\n if (!normalizedSourceDirs.some((directory) => normalizedFile.startsWith(directory))) {\n return;\n }\n\n const timestamp = Date.now();\n const updates = Array.from(context.server.moduleGraph.idToModuleMap.values())\n .filter((moduleNode) => isMreactClientDevModuleId(moduleNode.id))\n .map((moduleNode) => {\n context.server.moduleGraph.invalidateModule(moduleNode);\n\n return {\n acceptedPath: moduleNode.url,\n path: moduleNode.url,\n timestamp,\n type: \"js-update\" as const,\n };\n });\n\n if (updates.length > 0) {\n context.server.ws.send({ type: \"update\", updates });\n }\n\n return [];\n },\n load(id) {\n if (id === virtualReactiveCoreId) {\n return `import { cell as nativeCell } from ${JSON.stringify(reactiveCorePath)};\nexport * from ${JSON.stringify(reactiveCorePath)};\nexport function cell(initial) {\n const routeCell = globalThis.__mreactRouteCell;\n return typeof routeCell === \"function\" ? routeCell(nativeCell, initial) : nativeCell(initial);\n}`;\n }\n\n if (id === virtualReactiveDevtoolsId) {\n return `export function emitReactiveDevtoolsEvent() {}\nexport function hasReactiveDevtoolsEmitter() { return false; }\nexport function currentDevtoolsEmitter() { return undefined; }`;\n }\n\n if (id.startsWith(virtualClientPrefix)) {\n return renderAppRouterClientAsset(project.routesDir, id.slice(virtualClientPrefix.length), {\n dev: true,\n }).then(async (response) => {\n if (!response.ok) {\n const message = await response.text();\n throw new Error(message || `MReact client route asset was not found: ${id}`);\n }\n\n return response.text();\n });\n }\n\n const requestPath = clientRouteModuleRequestPath(id);\n\n return requestPath === undefined\n ? undefined\n : renderAppRouterClientRouteDevModule(project.routesDir, requestPath);\n },\n transform(code, id, options) {\n if (options?.ssr === true) {\n return undefined;\n }\n\n if (isMreactClientDevModuleId(id)) {\n return undefined;\n }\n\n const filename = clientRequestPath(id);\n\n if (!isMreactClientSourceDependency(filename, normalizedSourceDirs)) {\n return undefined;\n }\n\n const moduleContext = createCompilerModuleContext({ code, filename });\n\n if (!hasJsxSyntax(moduleContext.program)) {\n return undefined;\n }\n\n const output = transformCompilerModuleContext({\n code,\n dev: true,\n filename,\n mode: isCompatSourcePath(filename) ? \"compat\" : \"reactive\",\n moduleContext,\n target: \"client\",\n });\n\n if (output.diagnostics.length > 0) {\n throw new Error(\n output.diagnostics.map((diagnostic) => formatDiagnostic(filename, diagnostic)).join(\"\\n\"),\n );\n }\n\n return {\n code: output.code,\n map: null,\n };\n },\n async resolveId(id, importer) {\n const runtimePath = runtimePaths.get(id);\n\n if (id === \"@reckona/mreact-reactive-core\") {\n if (importerInRuntimePackage(importer, runtimePackageDirs, runtimePackageNames)) {\n return reactiveCorePath;\n }\n\n return virtualReactiveCoreId;\n }\n\n if (\n id === \"./devtools.js\" &&\n importerInRuntimePackage(importer, [reactiveCoreDir], [\"@reckona/mreact-reactive-core\"])\n ) {\n return virtualReactiveDevtoolsId;\n }\n\n if (runtimePath !== undefined) {\n return runtimePath;\n }\n\n const requestPath = clientRequestPath(id);\n\n if (requestPath === `${clientPrefix}${navigationRuntimeScriptForDev()}`) {\n return `${virtualClientPrefix}${requestPath}`;\n }\n\n if (!requestPath.startsWith(clientPrefix)) {\n return undefined;\n }\n\n const route = await clientRouteForRequestPath(project.routesDir, requestPath);\n\n return route === undefined ? undefined : clientRouteModuleId(route.file, requestPath);\n },\n };\n\n return plugin;\n}\n\nfunction isMreactClientSourceDependency(\n filename: string,\n normalizedSourceDirs: readonly string[],\n): boolean {\n const normalized = normalizePath(filename);\n\n return (\n /\\.(?:mreact\\.)?[cm]?[jt]sx?$/.test(normalized) &&\n !normalized.includes(\"/node_modules/\") &&\n normalizedSourceDirs.some(\n (directory) => normalized === directory || normalized.startsWith(`${directory}/`),\n )\n );\n}\n\nfunction isCompatSourcePath(filename: string): boolean {\n return /\\.compat(?:\\.mreact)?(?:\\.[cm]?[jt]sx?)?$/.test(filename);\n}\n\nexport const mreactRouter = createAppRouterVitePlugin;\n\nexport function mreactRouterConfigFromPlugins(\n plugins: readonly unknown[],\n): ResolvedAppRouterProject | undefined {\n for (const plugin of plugins.flat(Infinity)) {\n if (plugin !== null && typeof plugin === \"object\" && mreactRouterConfigKey in plugin) {\n const config = (plugin as MreactRouterPlugin)[mreactRouterConfigKey];\n\n if (\"project\" in config) {\n return (config as unknown as { project: ResolvedAppRouterProject }).project;\n }\n\n return config as unknown as ResolvedAppRouterProject;\n }\n }\n\n return undefined;\n}\n\nexport function createAppRouterViteMiddleware(\n options: AppRouterViteMiddlewareOptions,\n): Connect.NextHandleFunction {\n return (request, response, next) => {\n void handleAppRouterViteRequest(\n options as AppRouterViteRuntimeMiddlewareOptions,\n request,\n response,\n next,\n );\n };\n}\n\nasync function handleAppRouterViteRequest(\n options: AppRouterViteRuntimeMiddlewareOptions,\n incoming: Connect.IncomingMessage,\n outgoing: ServerResponse,\n next: Connect.NextFunction,\n): Promise<void> {\n try {\n const project = resolveAppRouterProjectOptions(options);\n const host = resolveRequestHost({\n allowedHosts: options.allowedHosts,\n fallbackHost: \"localhost\",\n hostPolicy: options.hostPolicy,\n rawHost: incoming.headers.host,\n });\n const origin = `http://${host}`;\n const url = new URL(incoming.url ?? \"/\", origin);\n\n if (url.pathname.startsWith(clientPrefix)) {\n if (options.viteDevServer !== undefined) {\n const transformed = await options.viteDevServer.transformRequest(\n `${url.pathname}${url.search}`,\n );\n\n if (transformed !== null) {\n await sendResponse(\n outgoing,\n new Response(transformed.code, {\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n }),\n );\n return;\n }\n }\n\n await sendResponse(\n outgoing,\n await renderAppRouterClientAsset(project.routesDir, url.pathname, {\n vitePlugins: options.vitePlugins,\n }),\n );\n return;\n }\n\n const request = nodeRequestToWebRequest(incoming, origin);\n\n await sendResponse(\n outgoing,\n await renderAppRequest({\n appDir: project.routesDir,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: project.allowedSourceDirs,\n projectRoot: project.projectRoot,\n },\n clientStyles: await devRouteStyles(project),\n navigationScripts: await devNavigationScripts(project.routesDir),\n request,\n routeCache: options.routeCache,\n serverActions: options.serverActions,\n }),\n );\n } catch (error) {\n next(error);\n }\n}\n\nexport async function renderAppRouterClientAsset(\n appDir: string,\n pathname: string,\n options: { dev?: boolean; vitePlugins?: readonly PluginOption[] | undefined } = {},\n): Promise<Response> {\n if (pathname === `/_mreact/client/${navigationRuntimeScriptForDev()}`) {\n const output = await buildNavigationRuntimeBundle();\n\n return new Response(options.dev === true ? withViteHmrRuntime(output.code) : output.code, {\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n });\n }\n\n const routes = await scanAppRoutes({ appDir });\n const route = routes.find(\n (candidate) =>\n candidate.kind === \"page\" &&\n `/_mreact/client/${clientScriptForPath(candidate.path)}` === pathname,\n );\n\n if (route === undefined || route.kind !== \"page\") {\n return new Response(\"Not Found\", { status: 404 });\n }\n\n const code = await readFile(route.file, \"utf8\");\n const clientSource = stripRouteClientOnlyExports(code);\n let references: Awaited<ReturnType<typeof collectClientRouteReferences>>;\n\n try {\n references = await collectClientRouteReferences({\n appDir,\n code: clientSource,\n filename: route.file,\n vitePlugins: options.vitePlugins,\n });\n } catch (error) {\n return clientAssetBuildErrorResponse(route.file, error);\n }\n\n if (!references.client) {\n if (isClientRouteSource(clientSource)) {\n return clientAssetBuildErrorResponse(\n route.file,\n new Error(\n [\n \"Client route analysis did not produce a client asset.\",\n \"Browser build cannot import Node builtins or other server-only modules.\",\n ...references.diagnostics.map((diagnostic) => diagnostic.message),\n ].join(\"\\n\"),\n ),\n );\n }\n\n return new Response(\"Not Found\", { status: 404 });\n }\n\n let bundle: string;\n\n try {\n bundle = await buildClientRouteBundle({\n code: clientSource,\n clientBoundaryImports: references.clientBoundaryImports,\n clientReferenceImports: references.clientReferenceImports,\n clientReferenceManifest: references.clientReferenceManifest,\n filename: route.file,\n routePath: route.path,\n vitePlugins: options.vitePlugins,\n });\n } catch (error) {\n return clientAssetBuildErrorResponse(route.file, error);\n }\n\n return new Response(options.dev === true ? withViteHmrRuntime(bundle) : bundle, {\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n });\n}\n\nasync function renderAppRouterClientRouteDevModule(\n appDir: string,\n pathname: string,\n options: { vitePlugins?: readonly PluginOption[] | undefined } = {},\n): Promise<string> {\n const route = await clientRouteForRequestPath(appDir, pathname);\n\n if (route === undefined) {\n throw new Error(`MReact client route asset was not found: ${pathname}`);\n }\n\n const code = await readFile(route.file, \"utf8\");\n const clientSource = stripRouteClientOnlyExports(code);\n const references = await collectClientRouteReferences({\n appDir,\n code: clientSource,\n filename: route.file,\n vitePlugins: options.vitePlugins,\n });\n\n if (!references.client) {\n throw new Error(\n isClientRouteSource(clientSource)\n ? [\n \"Client route analysis did not produce a client asset.\",\n \"Browser build cannot import Node builtins or other server-only modules.\",\n ...references.diagnostics.map((diagnostic) => diagnostic.message),\n ].join(\"\\n\")\n : `MReact client route asset was not found: ${pathname}`,\n );\n }\n\n const entry = await buildClientRouteEntrySource({\n code: clientSource,\n clientBoundaryImports: references.clientBoundaryImports,\n clientReferenceImports: references.clientReferenceImports,\n clientReferenceManifest: references.clientReferenceManifest,\n filename: route.file,\n routePath: route.path,\n vitePlugins: options.vitePlugins,\n });\n\n return withViteHmrRuntime(entry.code);\n}\n\nasync function clientRouteForRequestPath(appDir: string, pathname: string) {\n const routes = await scanAppRoutes({ appDir });\n\n return routes.find(\n (candidate) =>\n candidate.kind === \"page\" &&\n `/_mreact/client/${clientScriptForPath(candidate.path)}` === pathname,\n );\n}\n\nfunction clientRequestPath(id: string): string {\n const [path] = id.split(/[?#]/, 1);\n\n return path ?? id;\n}\n\nfunction clientRouteModuleId(filename: string, requestPath: string): string {\n return `${normalizePath(filename)}?${clientRouteModuleQuery}=${encodeURIComponent(requestPath)}`;\n}\n\nfunction clientRouteModuleRequestPath(id: string): string | undefined {\n const queryStart = id.indexOf(\"?\");\n\n if (queryStart === -1) {\n return undefined;\n }\n\n const params = new URLSearchParams(id.slice(queryStart + 1));\n const value = params.get(clientRouteModuleQuery);\n\n return value === null ? undefined : value;\n}\n\nfunction isMreactClientDevModuleId(id: string | null | undefined): boolean {\n return (\n id?.startsWith(virtualClientPrefix) === true ||\n id?.includes(`?${clientRouteModuleQuery}=`) === true ||\n id?.includes(`&${clientRouteModuleQuery}=`) === true\n );\n}\n\nfunction importerInRuntimePackage(\n importer: string | undefined,\n directories: readonly string[],\n packageNames: readonly string[],\n): boolean {\n if (importer === undefined) {\n return false;\n }\n\n const normalizedImporter = normalizePath(importer);\n return (\n directories.some((directory) => normalizedImporter.startsWith(`${directory}/`)) ||\n packageNames.some((packageName) => normalizedImporter.includes(`/node_modules/${packageName}/`))\n );\n}\n\nfunction clientAssetBuildErrorResponse(filename: string, error: unknown): Response {\n const message = [\n `Failed to build mreact client route asset for ${filename}.`,\n error instanceof Error ? error.message : String(error),\n ].join(\"\\n\");\n\n return new Response(`throw new Error(${JSON.stringify(message)});\\n`, {\n status: 500,\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n });\n}\n\nasync function devRouteStyles(\n project: ResolvedAppRouterProject,\n): Promise<ReadonlyMap<string, readonly string[]>> {\n const entries = await Promise.all(\n (await scanAppRoutes({ appDir: project.routesDir })).map(async (route) => {\n if (route.kind !== \"page\") {\n return undefined;\n }\n\n const hrefs = await collectRouteCssHrefs({\n appDir: project.routesDir,\n hrefPrefix: devCssPrefix,\n pageFile: route.file,\n projectRoot: project.projectRoot,\n });\n\n return hrefs.length === 0 ? undefined : ([route.path, hrefs as readonly string[]] as const);\n }),\n );\n const routeStyles = entries.filter(\n (entry): entry is readonly [string, readonly string[]] => entry !== undefined,\n );\n\n return new Map<string, readonly string[]>(routeStyles);\n}\n\nasync function devNavigationScripts(appDir: string): Promise<ReadonlyMap<string, string>> {\n const entries = await Promise.all(\n (await scanAppRoutes({ appDir })).map(async (route) => {\n if (route.kind !== \"page\") {\n return undefined;\n }\n\n const source = await readFile(route.file, \"utf8\");\n\n return detectNavigationRuntimeHint(source)\n ? ([route.path, navigationRuntimeScriptForDev()] as const)\n : undefined;\n }),\n );\n\n return new Map(\n entries.filter((entry): entry is readonly [string, string] => entry !== undefined),\n );\n}\n\nfunction createDevCssProxyMiddleware(): Connect.NextHandleFunction {\n return (incoming, outgoing, next) => {\n const originalUrl = incoming.url ?? \"/\";\n const url = new URL(originalUrl, \"http://mreact.local\");\n\n if (!url.pathname.startsWith(devCssPrefix)) {\n next();\n return;\n }\n\n const sourcePath = `/${url.pathname.slice(devCssPrefix.length)}`;\n\n if (sourcePath === \"/\" || sourcePath.includes(\"\\0\")) {\n next();\n return;\n }\n\n const originalAccept = incoming.headers.accept;\n let restored = false;\n const restore = () => {\n if (restored) {\n return;\n }\n restored = true;\n incoming.url = originalUrl;\n if (originalAccept === undefined) {\n delete incoming.headers.accept;\n } else {\n incoming.headers.accept = originalAccept;\n }\n };\n\n incoming.url = `${sourcePath}${url.search}`;\n incoming.headers.accept = \"text/css,*/*;q=0.1\";\n outgoing.once(\"finish\", restore);\n outgoing.once(\"close\", restore);\n next();\n };\n}\n\nfunction withViteHmrRuntime(code: string): string {\n return `import \"/@vite/client\";\nif (import.meta.hot?.data.__mreactRouteStates) {\n globalThis.__mreactRouteStates = import.meta.hot.data.__mreactRouteStates;\n}\n${code}\nif (import.meta.hot) {\n const __mreactPreserveRouteState = () => {\n import.meta.hot.data.__mreactRouteStates = globalThis.__mreactRouteStates;\n };\n import.meta.hot.dispose(__mreactPreserveRouteState);\n import.meta.hot.accept((module) => {\n module?.__mreactHydrateRoute?.();\n });\n}\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,aAAa,GAKd,MAAM,MAAM,CAAC;AAGd,OAAO,EACL,8BAA8B,GA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QAC/C,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO;;;;EAIP,IAAI;;;;;;;;;;CAUL,CAAC;AACF,CAAC","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport type { ServerResponse } from \"node:http\";\nimport { dirname } from \"node:path\";\nimport { formatDiagnostic } from \"@reckona/mreact-compiler\";\nimport {\n createCompilerModuleContext,\n transformCompilerModuleContext,\n} from \"@reckona/mreact-compiler/internal\";\nimport {\n normalizePath,\n type Connect,\n type Plugin,\n type PluginOption,\n type ViteDevServer,\n} from \"vite\";\nimport type { AppRouterServerActionOptions } from \"./actions.js\";\nimport type { AppRouterCache } from \"./cache.js\";\nimport {\n resolveAppRouterProjectOptions,\n type AppRouterProjectOptions,\n type ResolvedAppRouterProject,\n} from \"./config.js\";\nimport type { AppRouterImportPolicy } from \"./import-policy.js\";\nimport {\n collectClientRouteReferences,\n createClientRouteInferenceCache,\n isClientRouteSource,\n resolveNavigationRuntime,\n type ClientRouteInferenceCache,\n} from \"./client-route-inference.js\";\nimport {\n buildNavigationRuntimeBundle,\n buildClientRouteBundle,\n buildClientRouteEntrySource,\n clientScriptForPath,\n navigationRuntimeScriptForDev,\n} from \"./navigation-runtime.js\";\nimport { nodeRequestToWebRequest, sendResponse } from \"./http.js\";\nimport { renderAppRequest } from \"./render.js\";\nimport { stripRouteClientOnlyExports } from \"./route-source.js\";\nimport { collectRouteCssHrefs } from \"./route-styles.js\";\nimport { scanAppRoutes } from \"./routes.js\";\nimport { resolveRequestHost, type RequestHostPolicy } from \"./serve.js\";\nimport { hasJsxSyntax } from \"./source-jsx.js\";\nimport { workspacePackageFile } from \"./workspace-packages.js\";\n\nexport interface AppRouterViteMiddlewareOptions extends AppRouterProjectOptions {\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n vitePlugins?: readonly PluginOption[] | undefined;\n}\n\ntype AppRouterViteRuntimeMiddlewareOptions = AppRouterViteMiddlewareOptions & {\n clientRouteInferenceCache?: ClientRouteInferenceCache | undefined;\n navigationScanVitePlugins?: readonly PluginOption[] | undefined;\n viteDevServer?: ViteDevServer | undefined;\n};\n\nexport interface AppRouterVitePluginOptions extends AppRouterProjectOptions {\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n}\n\nconst clientPrefix = \"/_mreact/client/\";\nconst devCssPrefix = \"/_mreact/dev-css/\";\nconst clientRouteModuleQuery = \"mreact-router-client-route\";\nconst virtualClientPrefix = \"\\0mreact-router-client:\";\nconst virtualReactiveCoreId = \"\\0mreact-router-reactive-core\";\nconst virtualReactiveDevtoolsId = \"\\0mreact-router-reactive-devtools\";\nconst mreactRouterConfigKey = \"__mreactRouterConfig\";\n\ntype MreactRouterPluginConfig = ResolvedAppRouterProject & {\n importPolicy?: AppRouterImportPolicy | undefined;\n};\n\ntype MreactRouterPlugin = Plugin & {\n [mreactRouterConfigKey]: MreactRouterPluginConfig;\n};\n\nexport function createAppRouterVitePlugin(options: AppRouterVitePluginOptions): Plugin {\n const project = resolveAppRouterProjectOptions(options);\n const normalizedSourceDirs = project.allowedSourceDirs.map((directory) =>\n normalizePath(directory),\n );\n const packageFile = (monorepoDir: string, packageName: string, entry: string): string =>\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry,\n monorepoDir,\n packageName,\n });\n const reactiveCorePath = packageFile(\"reactive-core\", \"@reckona/mreact-reactive-core\", \"index\");\n const reactiveCoreDir = normalizePath(dirname(reactiveCorePath));\n const reactiveDomPath = packageFile(\"reactive-dom\", \"@reckona/mreact-reactive-dom\", \"index\");\n const reactiveDomDir = normalizePath(dirname(reactiveDomPath));\n const reactCompatPath = packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"index\");\n const reactCompatDir = normalizePath(dirname(reactCompatPath));\n const runtimePackageDirs = [reactiveCoreDir, reactiveDomDir, reactCompatDir];\n const runtimePackageNames = [\n \"@reckona/mreact-reactive-core\",\n \"@reckona/mreact-reactive-dom\",\n \"@reckona/mreact-compat\",\n ];\n const runtimePaths = new Map([\n [\"react\", reactCompatPath],\n [\"react-dom\", reactCompatPath],\n [\"react-dom/client\", reactCompatPath],\n [\"react-dom/server\", reactCompatPath],\n [\n \"react/jsx-dev-runtime\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"jsx-dev-runtime\"),\n ],\n [\"react/jsx-runtime\", packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"jsx-runtime\")],\n [\n \"@reckona/mreact-reactive-core/internal\",\n packageFile(\"reactive-core\", \"@reckona/mreact-reactive-core\", \"internal\"),\n ],\n [\"@reckona/mreact-reactive-dom\", reactiveDomPath],\n [\"@reckona/mreact-compat\", reactCompatPath],\n [\n \"@reckona/mreact-compat/event-priority\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"event-priority\"),\n ],\n [\n \"@reckona/mreact-compat/flight\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"flight\"),\n ],\n [\n \"@reckona/mreact-compat/hooks\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"hooks-entry\"),\n ],\n [\n \"@reckona/mreact-compat/internal\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"internal\"),\n ],\n [\n \"@reckona/mreact-compat/jsx-dev-runtime\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"jsx-dev-runtime\"),\n ],\n [\n \"@reckona/mreact-compat/jsx-runtime\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"jsx-runtime\"),\n ],\n [\n \"@reckona/mreact-compat/scheduler\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"scheduler\"),\n ],\n [\"@reckona/mreact-router/link\", packageFile(\"router\", \"@reckona/mreact-router\", \"link\")],\n [\n \"@reckona/mreact-router/navigation-state\",\n packageFile(\"router\", \"@reckona/mreact-router\", \"navigation-state\"),\n ],\n [\n \"@reckona/mreact-shared/url-safety\",\n packageFile(\"shared\", \"@reckona/mreact-shared\", \"url-safety\"),\n ],\n ]);\n\n // User-declared plugins captured from the resolving config. Unlike the fully\n // resolved `server.config.plugins`, this excludes Vite internals (e.g. the\n // built-in CSS plugin) whose `transform` requires a dev-server environment the\n // lightweight navigation scan cannot provide. Mirrors what the build forwards.\n let userVitePlugins: readonly PluginOption[] | undefined;\n\n const plugin: MreactRouterPlugin = {\n [mreactRouterConfigKey]: {\n ...project,\n ...(options.importPolicy === undefined ? {} : { importPolicy: options.importPolicy }),\n },\n enforce: \"pre\",\n name: \"mreact-router\",\n config(userConfig) {\n userVitePlugins = userConfig.plugins;\n\n return {\n optimizeDeps: {\n exclude: [\n \"react\",\n \"react-dom\",\n \"react-dom/client\",\n \"react-dom/server\",\n \"react/jsx-dev-runtime\",\n \"react/jsx-runtime\",\n ],\n },\n };\n },\n configureServer(server) {\n server.middlewares.use(createDevCssProxyMiddleware());\n\n return () => {\n const middlewareOptions: AppRouterViteRuntimeMiddlewareOptions = {\n ...options,\n navigationScanVitePlugins: userVitePlugins,\n viteDevServer: server,\n vitePlugins: server.config.plugins,\n };\n\n server.middlewares.use(createAppRouterViteMiddleware(middlewareOptions));\n };\n },\n handleHotUpdate(context) {\n const normalizedFile = normalizePath(context.file);\n\n if (!normalizedSourceDirs.some((directory) => normalizedFile.startsWith(directory))) {\n return;\n }\n\n const timestamp = Date.now();\n const updates = Array.from(context.server.moduleGraph.idToModuleMap.values())\n .filter((moduleNode) => isMreactClientDevModuleId(moduleNode.id))\n .map((moduleNode) => {\n context.server.moduleGraph.invalidateModule(moduleNode);\n\n return {\n acceptedPath: moduleNode.url,\n path: moduleNode.url,\n timestamp,\n type: \"js-update\" as const,\n };\n });\n\n if (updates.length > 0) {\n context.server.ws.send({ type: \"update\", updates });\n }\n\n return [];\n },\n load(id) {\n if (id === virtualReactiveCoreId) {\n return `import { cell as nativeCell } from ${JSON.stringify(reactiveCorePath)};\nexport * from ${JSON.stringify(reactiveCorePath)};\nexport function cell(initial) {\n const routeCell = globalThis.__mreactRouteCell;\n return typeof routeCell === \"function\" ? routeCell(nativeCell, initial) : nativeCell(initial);\n}`;\n }\n\n if (id === virtualReactiveDevtoolsId) {\n return `export function emitReactiveDevtoolsEvent() {}\nexport function hasReactiveDevtoolsEmitter() { return false; }\nexport function currentDevtoolsEmitter() { return undefined; }`;\n }\n\n if (id.startsWith(virtualClientPrefix)) {\n return renderAppRouterClientAsset(project.routesDir, id.slice(virtualClientPrefix.length), {\n dev: true,\n }).then(async (response) => {\n if (!response.ok) {\n const message = await response.text();\n throw new Error(message || `MReact client route asset was not found: ${id}`);\n }\n\n return response.text();\n });\n }\n\n const requestPath = clientRouteModuleRequestPath(id);\n\n return requestPath === undefined\n ? undefined\n : renderAppRouterClientRouteDevModule(project.routesDir, requestPath);\n },\n transform(code, id, options) {\n if (options?.ssr === true) {\n return undefined;\n }\n\n if (isMreactClientDevModuleId(id)) {\n return undefined;\n }\n\n const filename = clientRequestPath(id);\n\n if (!isMreactClientSourceDependency(filename, normalizedSourceDirs)) {\n return undefined;\n }\n\n const moduleContext = createCompilerModuleContext({ code, filename });\n\n if (!hasJsxSyntax(moduleContext.program)) {\n return undefined;\n }\n\n const output = transformCompilerModuleContext({\n code,\n dev: true,\n filename,\n mode: isCompatSourcePath(filename) ? \"compat\" : \"reactive\",\n moduleContext,\n target: \"client\",\n });\n\n if (output.diagnostics.length > 0) {\n throw new Error(\n output.diagnostics.map((diagnostic) => formatDiagnostic(filename, diagnostic)).join(\"\\n\"),\n );\n }\n\n return {\n code: output.code,\n map: null,\n };\n },\n async resolveId(id, importer) {\n const runtimePath = runtimePaths.get(id);\n\n if (id === \"@reckona/mreact-reactive-core\") {\n if (importerInRuntimePackage(importer, runtimePackageDirs, runtimePackageNames)) {\n return reactiveCorePath;\n }\n\n return virtualReactiveCoreId;\n }\n\n if (\n id === \"./devtools.js\" &&\n importerInRuntimePackage(importer, [reactiveCoreDir], [\"@reckona/mreact-reactive-core\"])\n ) {\n return virtualReactiveDevtoolsId;\n }\n\n if (runtimePath !== undefined) {\n return runtimePath;\n }\n\n const requestPath = clientRequestPath(id);\n\n if (requestPath === `${clientPrefix}${navigationRuntimeScriptForDev()}`) {\n return `${virtualClientPrefix}${requestPath}`;\n }\n\n if (!requestPath.startsWith(clientPrefix)) {\n return undefined;\n }\n\n const route = await clientRouteForRequestPath(project.routesDir, requestPath);\n\n return route === undefined ? undefined : clientRouteModuleId(route.file, requestPath);\n },\n };\n\n return plugin;\n}\n\nfunction isMreactClientSourceDependency(\n filename: string,\n normalizedSourceDirs: readonly string[],\n): boolean {\n const normalized = normalizePath(filename);\n\n return (\n /\\.(?:mreact\\.)?[cm]?[jt]sx?$/.test(normalized) &&\n !normalized.includes(\"/node_modules/\") &&\n normalizedSourceDirs.some(\n (directory) => normalized === directory || normalized.startsWith(`${directory}/`),\n )\n );\n}\n\nfunction isCompatSourcePath(filename: string): boolean {\n return /\\.compat(?:\\.mreact)?(?:\\.[cm]?[jt]sx?)?$/.test(filename);\n}\n\nexport const mreactRouter = createAppRouterVitePlugin;\n\nexport function mreactRouterConfigFromPlugins(\n plugins: readonly unknown[],\n): ResolvedAppRouterProject | undefined {\n for (const plugin of plugins.flat(Infinity)) {\n if (plugin !== null && typeof plugin === \"object\" && mreactRouterConfigKey in plugin) {\n const config = (plugin as MreactRouterPlugin)[mreactRouterConfigKey];\n\n if (\"project\" in config) {\n return (config as unknown as { project: ResolvedAppRouterProject }).project;\n }\n\n return config as unknown as ResolvedAppRouterProject;\n }\n }\n\n return undefined;\n}\n\nexport function createAppRouterViteMiddleware(\n options: AppRouterViteMiddlewareOptions,\n): Connect.NextHandleFunction {\n // Reused across requests so dev navigation-script detection memoizes module\n // contexts/analyses instead of re-walking every route's import graph per\n // request. The source-keyed caches keep only the latest content version per\n // file (see setLatestModuleCacheEntry), so repeated edits do not accumulate\n // stale entries over a long dev session.\n const runtimeOptions: AppRouterViteRuntimeMiddlewareOptions = {\n ...options,\n clientRouteInferenceCache: createClientRouteInferenceCache(),\n };\n\n return (request, response, next) => {\n void handleAppRouterViteRequest(runtimeOptions, request, response, next);\n };\n}\n\nasync function handleAppRouterViteRequest(\n options: AppRouterViteRuntimeMiddlewareOptions,\n incoming: Connect.IncomingMessage,\n outgoing: ServerResponse,\n next: Connect.NextFunction,\n): Promise<void> {\n try {\n const project = resolveAppRouterProjectOptions(options);\n const host = resolveRequestHost({\n allowedHosts: options.allowedHosts,\n fallbackHost: \"localhost\",\n hostPolicy: options.hostPolicy,\n rawHost: incoming.headers.host,\n });\n const origin = `http://${host}`;\n const url = new URL(incoming.url ?? \"/\", origin);\n\n if (url.pathname.startsWith(clientPrefix)) {\n if (options.viteDevServer !== undefined) {\n const transformed = await options.viteDevServer.transformRequest(\n `${url.pathname}${url.search}`,\n );\n\n if (transformed !== null) {\n await sendResponse(\n outgoing,\n new Response(transformed.code, {\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n }),\n );\n return;\n }\n }\n\n await sendResponse(\n outgoing,\n await renderAppRouterClientAsset(project.routesDir, url.pathname, {\n vitePlugins: options.vitePlugins,\n }),\n );\n return;\n }\n\n const request = nodeRequestToWebRequest(incoming, origin);\n\n await sendResponse(\n outgoing,\n await renderAppRequest({\n appDir: project.routesDir,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: project.allowedSourceDirs,\n projectRoot: project.projectRoot,\n },\n clientStyles: await devRouteStyles(project),\n navigationScripts: await devNavigationScripts(\n project.routesDir,\n options.clientRouteInferenceCache,\n options.navigationScanVitePlugins,\n ),\n request,\n routeCache: options.routeCache,\n serverActions: options.serverActions,\n }),\n );\n } catch (error) {\n next(error);\n }\n}\n\nexport async function renderAppRouterClientAsset(\n appDir: string,\n pathname: string,\n options: { dev?: boolean; vitePlugins?: readonly PluginOption[] | undefined } = {},\n): Promise<Response> {\n if (pathname === `/_mreact/client/${navigationRuntimeScriptForDev()}`) {\n const output = await buildNavigationRuntimeBundle();\n\n return new Response(options.dev === true ? withViteHmrRuntime(output.code) : output.code, {\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n });\n }\n\n const routes = await scanAppRoutes({ appDir });\n const route = routes.find(\n (candidate) =>\n candidate.kind === \"page\" &&\n `/_mreact/client/${clientScriptForPath(candidate.path)}` === pathname,\n );\n\n if (route === undefined || route.kind !== \"page\") {\n return new Response(\"Not Found\", { status: 404 });\n }\n\n const code = await readFile(route.file, \"utf8\");\n const clientSource = stripRouteClientOnlyExports(code);\n let references: Awaited<ReturnType<typeof collectClientRouteReferences>>;\n\n try {\n references = await collectClientRouteReferences({\n appDir,\n code: clientSource,\n filename: route.file,\n vitePlugins: options.vitePlugins,\n });\n } catch (error) {\n return clientAssetBuildErrorResponse(route.file, error);\n }\n\n if (!references.client) {\n if (isClientRouteSource(clientSource)) {\n return clientAssetBuildErrorResponse(\n route.file,\n new Error(\n [\n \"Client route analysis did not produce a client asset.\",\n \"Browser build cannot import Node builtins or other server-only modules.\",\n ...references.diagnostics.map((diagnostic) => diagnostic.message),\n ].join(\"\\n\"),\n ),\n );\n }\n\n return new Response(\"Not Found\", { status: 404 });\n }\n\n let bundle: string;\n\n try {\n bundle = await buildClientRouteBundle({\n code: clientSource,\n clientBoundaryImports: references.clientBoundaryImports,\n clientReferenceImports: references.clientReferenceImports,\n clientReferenceManifest: references.clientReferenceManifest,\n filename: route.file,\n routePath: route.path,\n vitePlugins: options.vitePlugins,\n });\n } catch (error) {\n return clientAssetBuildErrorResponse(route.file, error);\n }\n\n return new Response(options.dev === true ? withViteHmrRuntime(bundle) : bundle, {\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n });\n}\n\nasync function renderAppRouterClientRouteDevModule(\n appDir: string,\n pathname: string,\n options: { vitePlugins?: readonly PluginOption[] | undefined } = {},\n): Promise<string> {\n const route = await clientRouteForRequestPath(appDir, pathname);\n\n if (route === undefined) {\n throw new Error(`MReact client route asset was not found: ${pathname}`);\n }\n\n const code = await readFile(route.file, \"utf8\");\n const clientSource = stripRouteClientOnlyExports(code);\n const references = await collectClientRouteReferences({\n appDir,\n code: clientSource,\n filename: route.file,\n vitePlugins: options.vitePlugins,\n });\n\n if (!references.client) {\n throw new Error(\n isClientRouteSource(clientSource)\n ? [\n \"Client route analysis did not produce a client asset.\",\n \"Browser build cannot import Node builtins or other server-only modules.\",\n ...references.diagnostics.map((diagnostic) => diagnostic.message),\n ].join(\"\\n\")\n : `MReact client route asset was not found: ${pathname}`,\n );\n }\n\n const entry = await buildClientRouteEntrySource({\n code: clientSource,\n clientBoundaryImports: references.clientBoundaryImports,\n clientReferenceImports: references.clientReferenceImports,\n clientReferenceManifest: references.clientReferenceManifest,\n filename: route.file,\n routePath: route.path,\n vitePlugins: options.vitePlugins,\n });\n\n return withViteHmrRuntime(entry.code);\n}\n\nasync function clientRouteForRequestPath(appDir: string, pathname: string) {\n const routes = await scanAppRoutes({ appDir });\n\n return routes.find(\n (candidate) =>\n candidate.kind === \"page\" &&\n `/_mreact/client/${clientScriptForPath(candidate.path)}` === pathname,\n );\n}\n\nfunction clientRequestPath(id: string): string {\n const [path] = id.split(/[?#]/, 1);\n\n return path ?? id;\n}\n\nfunction clientRouteModuleId(filename: string, requestPath: string): string {\n return `${normalizePath(filename)}?${clientRouteModuleQuery}=${encodeURIComponent(requestPath)}`;\n}\n\nfunction clientRouteModuleRequestPath(id: string): string | undefined {\n const queryStart = id.indexOf(\"?\");\n\n if (queryStart === -1) {\n return undefined;\n }\n\n const params = new URLSearchParams(id.slice(queryStart + 1));\n const value = params.get(clientRouteModuleQuery);\n\n return value === null ? undefined : value;\n}\n\nfunction isMreactClientDevModuleId(id: string | null | undefined): boolean {\n return (\n id?.startsWith(virtualClientPrefix) === true ||\n id?.includes(`?${clientRouteModuleQuery}=`) === true ||\n id?.includes(`&${clientRouteModuleQuery}=`) === true\n );\n}\n\nfunction importerInRuntimePackage(\n importer: string | undefined,\n directories: readonly string[],\n packageNames: readonly string[],\n): boolean {\n if (importer === undefined) {\n return false;\n }\n\n const normalizedImporter = normalizePath(importer);\n return (\n directories.some((directory) => normalizedImporter.startsWith(`${directory}/`)) ||\n packageNames.some((packageName) => normalizedImporter.includes(`/node_modules/${packageName}/`))\n );\n}\n\nfunction clientAssetBuildErrorResponse(filename: string, error: unknown): Response {\n const message = [\n `Failed to build mreact client route asset for ${filename}.`,\n error instanceof Error ? error.message : String(error),\n ].join(\"\\n\");\n\n return new Response(`throw new Error(${JSON.stringify(message)});\\n`, {\n status: 500,\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n });\n}\n\nasync function devRouteStyles(\n project: ResolvedAppRouterProject,\n): Promise<ReadonlyMap<string, readonly string[]>> {\n const entries = await Promise.all(\n (await scanAppRoutes({ appDir: project.routesDir })).map(async (route) => {\n if (route.kind !== \"page\") {\n return undefined;\n }\n\n const hrefs = await collectRouteCssHrefs({\n appDir: project.routesDir,\n hrefPrefix: devCssPrefix,\n pageFile: route.file,\n projectRoot: project.projectRoot,\n });\n\n return hrefs.length === 0 ? undefined : ([route.path, hrefs as readonly string[]] as const);\n }),\n );\n const routeStyles = entries.filter(\n (entry): entry is readonly [string, readonly string[]] => entry !== undefined,\n );\n\n return new Map<string, readonly string[]>(routeStyles);\n}\n\nasync function devNavigationScripts(\n appDir: string,\n inferenceCache?: ClientRouteInferenceCache | undefined,\n vitePlugins?: readonly PluginOption[] | undefined,\n): Promise<ReadonlyMap<string, string>> {\n const cache = inferenceCache ?? createClientRouteInferenceCache();\n const entries = await Promise.all(\n (await scanAppRoutes({ appDir })).map(async (route) => {\n if (route.kind !== \"page\") {\n return undefined;\n }\n\n const source = await readFile(route.file, \"utf8\");\n const navigation = await resolveNavigationRuntime({\n appDir,\n cache,\n code: source,\n filename: route.file,\n vitePlugins,\n });\n\n return navigation\n ? ([route.path, navigationRuntimeScriptForDev()] as const)\n : undefined;\n }),\n );\n\n return new Map(\n entries.filter((entry): entry is readonly [string, string] => entry !== undefined),\n );\n}\n\nfunction createDevCssProxyMiddleware(): Connect.NextHandleFunction {\n return (incoming, outgoing, next) => {\n const originalUrl = incoming.url ?? \"/\";\n const url = new URL(originalUrl, \"http://mreact.local\");\n\n if (!url.pathname.startsWith(devCssPrefix)) {\n next();\n return;\n }\n\n const sourcePath = `/${url.pathname.slice(devCssPrefix.length)}`;\n\n if (sourcePath === \"/\" || sourcePath.includes(\"\\0\")) {\n next();\n return;\n }\n\n const originalAccept = incoming.headers.accept;\n let restored = false;\n const restore = () => {\n if (restored) {\n return;\n }\n restored = true;\n incoming.url = originalUrl;\n if (originalAccept === undefined) {\n delete incoming.headers.accept;\n } else {\n incoming.headers.accept = originalAccept;\n }\n };\n\n incoming.url = `${sourcePath}${url.search}`;\n incoming.headers.accept = \"text/css,*/*;q=0.1\";\n outgoing.once(\"finish\", restore);\n outgoing.once(\"close\", restore);\n next();\n };\n}\n\nfunction withViteHmrRuntime(code: string): string {\n return `import \"/@vite/client\";\nif (import.meta.hot?.data.__mreactRouteStates) {\n globalThis.__mreactRouteStates = import.meta.hot.data.__mreactRouteStates;\n}\n${code}\nif (import.meta.hot) {\n const __mreactPreserveRouteState = () => {\n import.meta.hot.data.__mreactRouteStates = globalThis.__mreactRouteStates;\n };\n import.meta.hot.dispose(__mreactPreserveRouteState);\n import.meta.hot.accept((module) => {\n module?.__mreactHydrateRoute?.();\n });\n}\n`;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reckona/mreact-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.94",
|
|
4
4
|
"description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -105,20 +105,20 @@
|
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"typescript": "^6.0.3",
|
|
108
|
-
"@reckona/mreact
|
|
109
|
-
"@reckona/mreact": "0.0.
|
|
110
|
-
"@reckona/mreact-compiler": "0.0.
|
|
111
|
-
"@reckona/mreact-devtools": "0.0.
|
|
112
|
-
"@reckona/mreact-
|
|
113
|
-
"@reckona/mreact-
|
|
114
|
-
"@reckona/mreact-
|
|
115
|
-
"@reckona/mreact-
|
|
116
|
-
"@reckona/mreact-shared": "0.0.
|
|
108
|
+
"@reckona/mreact": "0.0.94",
|
|
109
|
+
"@reckona/mreact-compat": "0.0.94",
|
|
110
|
+
"@reckona/mreact-compiler": "0.0.94",
|
|
111
|
+
"@reckona/mreact-devtools": "0.0.94",
|
|
112
|
+
"@reckona/mreact-reactive-core": "0.0.94",
|
|
113
|
+
"@reckona/mreact-query": "0.0.94",
|
|
114
|
+
"@reckona/mreact-reactive-dom": "0.0.94",
|
|
115
|
+
"@reckona/mreact-server": "0.0.94",
|
|
116
|
+
"@reckona/mreact-shared": "0.0.94"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
119
|
"vite": ">=8 <9"
|
|
120
120
|
},
|
|
121
121
|
"optionalDependencies": {
|
|
122
|
-
"@reckona/mreact-router-native": "0.0.
|
|
122
|
+
"@reckona/mreact-router-native": "0.0.94"
|
|
123
123
|
}
|
|
124
124
|
}
|
package/src/build.ts
CHANGED
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
collectClientRouteReferences,
|
|
18
18
|
createClientRouteInferenceCache,
|
|
19
19
|
detectClientNavigationHint,
|
|
20
|
-
detectNavigationRuntimeHint,
|
|
21
20
|
formatClientRouteInferenceDiagnostic,
|
|
22
21
|
inferClientRouteModule,
|
|
22
|
+
resolveNavigationRuntime,
|
|
23
23
|
type ClientRouteManifestEntry,
|
|
24
24
|
type ClientRouteInferenceCache,
|
|
25
25
|
} from "./client-route-inference.js";
|
|
@@ -2651,7 +2651,6 @@ async function writeClientRouteBundles(options: {
|
|
|
2651
2651
|
});
|
|
2652
2652
|
const source = await readFile(route.file, "utf8");
|
|
2653
2653
|
const clientSource = stripRouteClientSource({ code: source, filename: route.file });
|
|
2654
|
-
const navigation = detectNavigationRuntimeHint(source);
|
|
2655
2654
|
const references = await collectClientRouteReferences({
|
|
2656
2655
|
appDir: options.appDir,
|
|
2657
2656
|
cache: options.clientRouteInferenceCache,
|
|
@@ -2659,6 +2658,12 @@ async function writeClientRouteBundles(options: {
|
|
|
2659
2658
|
filename: route.file,
|
|
2660
2659
|
vitePlugins: options.vitePlugins,
|
|
2661
2660
|
});
|
|
2661
|
+
const navigation = await resolveNavigationRuntime({
|
|
2662
|
+
cache: options.clientRouteInferenceCache,
|
|
2663
|
+
code: source,
|
|
2664
|
+
filename: route.file,
|
|
2665
|
+
references,
|
|
2666
|
+
});
|
|
2662
2667
|
|
|
2663
2668
|
for (const diagnostic of references.diagnostics) {
|
|
2664
2669
|
console.warn(formatClientRouteInferenceDiagnostic(diagnostic));
|
|
@@ -3,11 +3,12 @@ export {
|
|
|
3
3
|
compilerModuleContextForSource,
|
|
4
4
|
createClientRouteInferenceCache,
|
|
5
5
|
detectClientNavigationHint,
|
|
6
|
-
|
|
6
|
+
detectNavigationRuntimeOverride,
|
|
7
7
|
formatClientRouteInferenceDiagnostic,
|
|
8
8
|
inferClientRouteModule,
|
|
9
9
|
isClientRouteModule,
|
|
10
10
|
isClientRouteSource,
|
|
11
|
+
resolveNavigationRuntime,
|
|
11
12
|
routeToClientManifestEntry,
|
|
12
13
|
type ClientReferenceImport,
|
|
13
14
|
type ClientRouteInferenceCache,
|