@reckona/mreact-router 0.0.193 → 0.0.195
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +28 -2
- package/dist/build.js.map +1 -1
- package/dist/built-server-module-artifacts.d.ts +1 -0
- package/dist/built-server-module-artifacts.d.ts.map +1 -1
- package/dist/built-server-module-artifacts.js +11 -0
- package/dist/built-server-module-artifacts.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +106 -10
- package/dist/client.js.map +1 -1
- package/dist/render.d.ts +1 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +42 -3
- package/dist/render.js.map +1 -1
- package/dist/serve.d.ts +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +52 -7
- package/dist/serve.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +31 -0
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/build.ts +37 -2
- package/src/built-server-module-artifacts.ts +15 -0
- package/src/client.ts +106 -10
- package/src/render.ts +68 -3
- package/src/serve.ts +76 -7
- package/src/vite.ts +43 -0
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,GAMd,MAAM,MAAM,CAAC;AAGd,OAAO,EACL,8BAA8B,GAG/B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAC/B,wBAAwB,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,CAAC;QACrD,YAAY,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACxC,QAAQ,CAAC,GAAG,GAAG,GAAG,UAAU,IAAI,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC1D,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 UserConfig,\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 detectAnchorElementUsage,\n formatClientRouteInferenceDiagnostic,\n isClientRouteSource,\n navigationRuntimeLinkDisabledDiagnostic,\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 type { AppRouterLogger } from \"./logger.js\";\nimport { renderAppRequest } from \"./render.js\";\nimport { stripRouteClientOnlyExports } from \"./route-source.js\";\nimport {\n collectRouteCssHrefs,\n collectSpecialBoundaryFiles,\n createCachedRouteSourceReader,\n} from \"./route-styles.js\";\nimport { createRouteMatcher, scanAppRoutes, type AppRoute } from \"./routes.js\";\nimport { resolveRequestHost, type RequestHostPolicy } from \"./serve.js\";\nimport { hasJsxSyntax } from \"./source-jsx.js\";\nimport { prependTailwindSourceDirectives } from \"./tailwind-source.js\";\nimport { workspacePackageFile } from \"./workspace-packages.js\";\n\nexport type { AppRouterAllowedServerAction, AppRouterServerActionOptions } from \"./actions.js\";\nexport type { AppRouterCache, AppRouterCacheEntry } from \"./cache.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientConsoleMethod,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\n AppRouterProductionOptions,\n AppRouterProjectOptions,\n ResolvedAppRouterProject,\n} from \"./config.js\";\nexport type { AppRouterImportPolicy } from \"./import-policy.js\";\nexport type {\n AppRouterCspInlineNonceWarningLogEvent,\n AppRouterLogError,\n AppRouterLogEvent,\n AppRouterLogger,\n AppRouterRuntime,\n AppRouterRenderTimingLogEvent,\n AppRouterRequestEndLogEvent,\n AppRouterRequestErrorLogEvent,\n AppRouterRequestStartLogEvent,\n AppRouterRequestTimingLogEvent,\n} from \"./logger.js\";\nexport type { RequestHostPolicy } from \"./serve.js\";\n\n/**\n * Configures the app-router Vite middleware used by development servers.\n */\nexport interface AppRouterViteMiddlewareOptions extends AppRouterProjectOptions {\n allowedHosts?: readonly string[] | undefined;\n define?: UserConfig[\"define\"] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n logger?: AppRouterLogger | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n vitePlugins?: readonly PluginOption[] | undefined;\n}\n\ntype AppRouterViteRuntimeMiddlewareOptions = AppRouterViteMiddlewareOptions & {\n clientRouteInferenceCache?: ClientRouteInferenceCache | undefined;\n devServerModuleCacheVersion?: (() => string | undefined) | undefined;\n navigationScanVitePlugins?: readonly PluginOption[] | undefined;\n viteDevServer?: ViteDevServer | undefined;\n};\n\n/**\n * Configures the app-router Vite plugin.\n */\nexport interface AppRouterVitePluginOptions extends AppRouterProjectOptions {\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n logger?: AppRouterLogger | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n}\n\nconst clientPrefix = \"/_mreact/client/\";\nconst devCssPrefix = \"/_mreact/dev-css/\";\nconst devCssSourceQuery = \"mreact-router-dev-css-source\";\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\n/**\n * Creates the app-router Vite plugin for route compilation and development middleware.\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 reactPath = packageFile(\"react\", \"@reckona/mreact\", \"index\");\n const reactDir = normalizePath(dirname(reactPath));\n const reactCompatPath = packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"index\");\n const reactCompatDir = normalizePath(dirname(reactCompatPath));\n const runtimePackageDirs = [reactiveCoreDir, reactiveDomDir, reactDir, reactCompatDir];\n const runtimePackageNames = [\n \"@reckona/mreact\",\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 [\"@reckona/mreact\", reactPath],\n [\n \"@reckona/mreact-reactive-core/internal\",\n packageFile(\"reactive-core\", \"@reckona/mreact-reactive-core\", \"internal\"),\n ],\n [\"@reckona/mreact-reactive-dom\", reactiveDomPath],\n [\n \"@reckona/mreact-reactive-dom/internal\",\n packageFile(\"reactive-dom\", \"@reckona/mreact-reactive-dom\", \"internal\"),\n ],\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 [\n \"@reckona/mreact-compat/server\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"server\"),\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 let devServerModuleCacheVersion = 0;\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 = routeTransformUserVitePlugins(userConfig.plugins);\n\n return {\n optimizeDeps: {\n // Every client-importable mreact package must resolve through the\n // same dev module graph. Prebundling any of them inlines a second\n // reactive-core (and devtools) copy into the deps chunk, which\n // silently breaks cross-package cell tracking, and also bypasses the\n // react/react-dom alias resolution this plugin provides.\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 \"@reckona/mreact\",\n \"@reckona/mreact-auth\",\n \"@reckona/mreact-compat\",\n \"@reckona/mreact-devtools\",\n \"@reckona/mreact-dom\",\n \"@reckona/mreact-forms\",\n \"@reckona/mreact-next\",\n \"@reckona/mreact-query\",\n \"@reckona/mreact-reactive-core\",\n \"@reckona/mreact-reactive-dom\",\n \"@reckona/mreact-router\",\n \"@reckona/mreact-scheduler\",\n \"@reckona/mreact-shared\",\n \"@reckona/mreact-store\",\n \"@reckona/mreact-test-utils\",\n \"@reckona/mreact-virtual\",\n ],\n },\n };\n },\n configureServer(server) {\n server.middlewares.use(createDevCssProxyMiddleware());\n\n return () => {\n const middlewareOptions: AppRouterViteRuntimeMiddlewareOptions = {\n ...options,\n define: server.config.define,\n devServerModuleCacheVersion: () => `dev:${devServerModuleCacheVersion}`,\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 devServerModuleCacheVersion += 1;\n const timestamp = Date.now();\n const hotModules =\n context.modules.length > 0\n ? context.modules\n : Array.from(context.server.moduleGraph.idToModuleMap.values());\n const updates = hotModules\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 (isDevCssSourceModuleId(id)) {\n return loadDevCssSourceModule({\n cssFile: clientRequestPath(id),\n sourceDirs: project.allowedSourceDirs,\n });\n }\n\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 emitReactiveEffectRunDevtoolsEvent() {}\nexport function hasReactiveDevtoolsEmitter() { return false; }\nexport function currentDevtoolsEmitter() { return undefined; }\nexport function currentReactiveDevtools() { return undefined; }\nexport function invalidateReactiveDevtoolsCache() {}\nexport function prepareReactiveEffectRunDevtoolsEvent() { 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\n/**\n * Alias for `createAppRouterVitePlugin()` used by Vite config files.\n */\nexport const mreactRouter = createAppRouterVitePlugin;\n\nfunction routeTransformUserVitePlugins(\n pluginOptions: readonly PluginOption[] | undefined,\n): PluginOption[] {\n const plugins: PluginOption[] = [];\n const visit = (option: PluginOption | null | false | undefined): void => {\n if (option === false || option === null || option === undefined) {\n return;\n }\n\n if (Array.isArray(option)) {\n for (const child of option) {\n visit(child);\n }\n return;\n }\n\n if (typeof option === \"object\" && \"then\" in option) {\n return;\n }\n\n if (typeof option === \"object\" && mreactRouterConfigKey in option) {\n return;\n }\n\n plugins.push(option);\n };\n\n for (const option of pluginOptions ?? []) {\n visit(option);\n }\n\n return plugins;\n}\n\n/**\n * Reads resolved app-router project config from a Vite plugin list.\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\n/**\n * Creates Connect middleware that renders app-router requests during Vite development.\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 const routeTransformPlugins = options.navigationScanVitePlugins ?? options.vitePlugins;\n const routes = await scanAppRoutes({ appDir: project.routesDir });\n const routeMatcher = createRouteMatcher(routes);\n const readRouteSource = createCachedRouteSourceReader();\n const [clientStyles, clientStylesByFile, navigationScripts] = await Promise.all([\n devRouteStyles(project, routes, readRouteSource),\n devSpecialRouteStyles(project, readRouteSource),\n devNavigationScripts(\n project.routesDir,\n routes,\n readRouteSource,\n options.clientRouteInferenceCache,\n routeTransformPlugins,\n ),\n ]);\n\n await sendResponse(\n outgoing,\n await renderAppRequest({\n appDir: project.routesDir,\n define: options.define,\n dev: true,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: project.allowedSourceDirs,\n projectRoot: project.projectRoot,\n },\n clientStyles,\n clientStylesByFile,\n clientRouteInferenceCache: options.clientRouteInferenceCache,\n navigationScripts,\n onRenderError(error) {\n sendViteErrorOverlay(options.viteDevServer, error);\n },\n request,\n logger: options.logger,\n routeCache: options.routeCache,\n routeMatcher,\n routes,\n serverActions: options.serverActions,\n devServerModuleCacheVersion: options.devServerModuleCacheVersion?.(),\n vitePlugins: routeTransformPlugins,\n }),\n );\n } catch (error) {\n sendViteErrorOverlay(options.viteDevServer, error);\n next(error);\n }\n}\n\nfunction sendViteErrorOverlay(server: ViteDevServer | undefined, error: unknown): void {\n if (server === undefined) {\n return;\n }\n\n if (error instanceof Error) {\n server.ssrFixStacktrace(error);\n }\n server.ws.send({\n type: \"error\",\n err: viteErrorPayload(error),\n });\n}\n\nfunction viteErrorPayload(error: unknown): { message: string; stack: string } {\n if (error instanceof Error) {\n return {\n message: error.message,\n stack: error.stack ?? error.message,\n };\n }\n\n const message = String(error);\n return { message, stack: message };\n}\n\n/**\n * Renders a development client asset generated by the app-router Vite integration.\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, route.file);\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 const navigation = await resolveNavigationRuntime({\n appDir,\n code,\n filename: route.file,\n references,\n vitePlugins: options.vitePlugins,\n });\n bundle = await buildClientRouteBundle({\n code: clientSource,\n clientBoundaryImports: references.clientBoundaryImports,\n clientReferenceImports: references.clientReferenceImports,\n clientReferenceManifest: references.clientReferenceManifest,\n clientNavigation: navigation || detectAnchorElementUsage(clientSource, route.file),\n filename: route.file,\n routeMayUseOutOfOrderFragments: true,\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, route.file);\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 navigation = await resolveNavigationRuntime({\n appDir,\n code,\n filename: route.file,\n references,\n vitePlugins: options.vitePlugins,\n });\n const entry = await buildClientRouteEntrySource({\n code: clientSource,\n clientBoundaryImports: references.clientBoundaryImports,\n clientReferenceImports: references.clientReferenceImports,\n clientReferenceManifest: references.clientReferenceManifest,\n clientNavigation: navigation || detectAnchorElementUsage(clientSource, route.file),\n filename: route.file,\n routeMayUseOutOfOrderFragments: true,\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 isDevCssSourceModuleId(id: string): boolean {\n return new URLSearchParams(id.slice(id.indexOf(\"?\") + 1)).has(devCssSourceQuery);\n}\n\nasync function loadDevCssSourceModule(options: {\n cssFile: string;\n sourceDirs: readonly string[];\n}): Promise<string | undefined> {\n const code = await readFile(options.cssFile, \"utf8\");\n\n return prependTailwindSourceDirectives({\n code,\n cssFile: options.cssFile,\n sourceDirs: options.sourceDirs,\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 routes: readonly AppRoute[],\n readSource: (file: string) => Promise<string | undefined>,\n): Promise<ReadonlyMap<string, readonly string[]>> {\n const entries = await Promise.all(\n routes.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 readSource,\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 devSpecialRouteStyles(\n project: ResolvedAppRouterProject,\n readSource: (file: string) => Promise<string | undefined>,\n): Promise<ReadonlyMap<string, readonly string[]>> {\n const entries = await Promise.all(\n (await collectSpecialBoundaryFiles(project.routesDir)).map(async (file) => {\n const hrefs = await collectRouteCssHrefs({\n appDir: project.routesDir,\n hrefPrefix: devCssPrefix,\n pageFile: file,\n projectRoot: project.projectRoot,\n readSource,\n });\n\n return hrefs.length === 0 ? undefined : ([file, 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 routes: readonly AppRoute[],\n readSource: (file: string) => Promise<string | undefined>,\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 routes.map(async (route) => {\n if (route.kind !== \"page\") {\n return undefined;\n }\n\n const source = await readSource(route.file);\n if (source === undefined) {\n return undefined;\n }\n const references = await collectClientRouteReferences({\n appDir,\n cache,\n code: source,\n filename: route.file,\n routePath: route.path,\n vitePlugins,\n });\n const navigation = await resolveNavigationRuntime({\n appDir,\n cache,\n code: source,\n filename: route.file,\n references,\n vitePlugins,\n });\n\n for (const diagnostic of references.diagnostics) {\n console.warn(formatClientRouteInferenceDiagnostic(diagnostic));\n }\n const navigationRuntimeDiagnostic = navigationRuntimeLinkDisabledDiagnostic({\n filename: route.file,\n references,\n routePath: route.path,\n source,\n });\n\n if (navigationRuntimeDiagnostic !== undefined) {\n console.warn(formatClientRouteInferenceDiagnostic(navigationRuntimeDiagnostic));\n }\n\n return navigation ? ([route.path, navigationRuntimeScriptForDev()] as const) : 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 const sourceSearch = new URLSearchParams(url.search);\n sourceSearch.set(devCssSourceQuery, \"\");\n incoming.url = `${sourcePath}?${sourceSearch.toString()}`;\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"]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I,EAAE,CAAC;YACP,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;QAC/C,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,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,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrD,YAAY,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACxC,QAAQ,CAAC,GAAG,GAAG,GAAG,UAAU,IAAI,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC1D,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 UserConfig,\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 detectAnchorElementUsage,\n formatClientRouteInferenceDiagnostic,\n isClientRouteSource,\n navigationRuntimeLinkDisabledDiagnostic,\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 type { AppRouterLogger } from \"./logger.js\";\nimport { renderAppRequest } from \"./render.js\";\nimport { stripRouteClientOnlyExports } from \"./route-source.js\";\nimport {\n collectRouteCssHrefs,\n collectSpecialBoundaryFiles,\n createCachedRouteSourceReader,\n} from \"./route-styles.js\";\nimport { createRouteMatcher, scanAppRoutes, type AppRoute } from \"./routes.js\";\nimport { resolveRequestHost, type RequestHostPolicy } from \"./serve.js\";\nimport { hasJsxSyntax } from \"./source-jsx.js\";\nimport { prependTailwindSourceDirectives } from \"./tailwind-source.js\";\nimport { workspacePackageFile } from \"./workspace-packages.js\";\n\nexport type { AppRouterAllowedServerAction, AppRouterServerActionOptions } from \"./actions.js\";\nexport type { AppRouterCache, AppRouterCacheEntry } from \"./cache.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientConsoleMethod,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\n AppRouterProductionOptions,\n AppRouterProjectOptions,\n ResolvedAppRouterProject,\n} from \"./config.js\";\nexport type { AppRouterImportPolicy } from \"./import-policy.js\";\nexport type {\n AppRouterCspInlineNonceWarningLogEvent,\n AppRouterLogError,\n AppRouterLogEvent,\n AppRouterLogger,\n AppRouterRuntime,\n AppRouterRenderTimingLogEvent,\n AppRouterRequestEndLogEvent,\n AppRouterRequestErrorLogEvent,\n AppRouterRequestStartLogEvent,\n AppRouterRequestTimingLogEvent,\n} from \"./logger.js\";\nexport type { RequestHostPolicy } from \"./serve.js\";\n\n/**\n * Configures the app-router Vite middleware used by development servers.\n */\nexport interface AppRouterViteMiddlewareOptions extends AppRouterProjectOptions {\n allowedHosts?: readonly string[] | undefined;\n define?: UserConfig[\"define\"] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n logger?: AppRouterLogger | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n vitePlugins?: readonly PluginOption[] | undefined;\n}\n\ntype AppRouterViteRuntimeMiddlewareOptions = AppRouterViteMiddlewareOptions & {\n clientRouteInferenceCache?: ClientRouteInferenceCache | undefined;\n devServerModuleCacheVersion?: (() => string | undefined) | undefined;\n navigationScanVitePlugins?: readonly PluginOption[] | undefined;\n viteDevServer?: ViteDevServer | undefined;\n};\n\n/**\n * Configures the app-router Vite plugin.\n */\nexport interface AppRouterVitePluginOptions extends AppRouterProjectOptions {\n allowedHosts?: readonly string[] | undefined;\n hostPolicy?: RequestHostPolicy | undefined;\n importPolicy?: AppRouterImportPolicy | undefined;\n logger?: AppRouterLogger | undefined;\n routeCache?: AppRouterCache | undefined;\n serverActions?: AppRouterServerActionOptions | undefined;\n}\n\nconst clientPrefix = \"/_mreact/client/\";\nconst devCssPrefix = \"/_mreact/dev-css/\";\nconst devCssSourceQuery = \"mreact-router-dev-css-source\";\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\n/**\n * Creates the app-router Vite plugin for route compilation and development middleware.\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 reactPath = packageFile(\"react\", \"@reckona/mreact\", \"index\");\n const reactDir = normalizePath(dirname(reactPath));\n const reactCompatPath = packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"index\");\n const reactCompatDir = normalizePath(dirname(reactCompatPath));\n const runtimePackageDirs = [reactiveCoreDir, reactiveDomDir, reactDir, reactCompatDir];\n const runtimePackageNames = [\n \"@reckona/mreact\",\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 [\"@reckona/mreact\", reactPath],\n [\n \"@reckona/mreact-reactive-core/internal\",\n packageFile(\"reactive-core\", \"@reckona/mreact-reactive-core\", \"internal\"),\n ],\n [\"@reckona/mreact-reactive-dom\", reactiveDomPath],\n [\n \"@reckona/mreact-reactive-dom/internal\",\n packageFile(\"reactive-dom\", \"@reckona/mreact-reactive-dom\", \"internal\"),\n ],\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 [\n \"@reckona/mreact-compat/server\",\n packageFile(\"react-compat\", \"@reckona/mreact-compat\", \"server\"),\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 let devServerModuleCacheVersion = 0;\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 = routeTransformUserVitePlugins(userConfig.plugins);\n\n return {\n optimizeDeps: {\n // Every client-importable mreact package must resolve through the\n // same dev module graph. Prebundling any of them inlines a second\n // reactive-core (and devtools) copy into the deps chunk, which\n // silently breaks cross-package cell tracking, and also bypasses the\n // react/react-dom alias resolution this plugin provides.\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 \"@reckona/mreact\",\n \"@reckona/mreact-auth\",\n \"@reckona/mreact-compat\",\n \"@reckona/mreact-devtools\",\n \"@reckona/mreact-dom\",\n \"@reckona/mreact-forms\",\n \"@reckona/mreact-next\",\n \"@reckona/mreact-query\",\n \"@reckona/mreact-reactive-core\",\n \"@reckona/mreact-reactive-dom\",\n \"@reckona/mreact-router\",\n \"@reckona/mreact-scheduler\",\n \"@reckona/mreact-shared\",\n \"@reckona/mreact-store\",\n \"@reckona/mreact-test-utils\",\n \"@reckona/mreact-virtual\",\n ],\n },\n };\n },\n configureServer(server) {\n server.middlewares.use(createDevCssProxyMiddleware());\n server.middlewares.use(createClientRouteTransformMiddleware(project.routesDir, server));\n\n return () => {\n const middlewareOptions: AppRouterViteRuntimeMiddlewareOptions = {\n ...options,\n define: server.config.define,\n devServerModuleCacheVersion: () => `dev:${devServerModuleCacheVersion}`,\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 devServerModuleCacheVersion += 1;\n const timestamp = Date.now();\n const hotModules =\n context.modules.length > 0\n ? context.modules\n : Array.from(context.server.moduleGraph.idToModuleMap.values());\n const updates = hotModules\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 (isDevCssSourceModuleId(id)) {\n return loadDevCssSourceModule({\n cssFile: clientRequestPath(id),\n sourceDirs: project.allowedSourceDirs,\n });\n }\n\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 emitReactiveEffectRunDevtoolsEvent() {}\nexport function hasReactiveDevtoolsEmitter() { return false; }\nexport function currentDevtoolsEmitter() { return undefined; }\nexport function currentReactiveDevtools() { return undefined; }\nexport function invalidateReactiveDevtoolsCache() {}\nexport function prepareReactiveEffectRunDevtoolsEvent() { 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 createClientRouteTransformMiddleware(\n appDir: string,\n server: ViteDevServer,\n): Connect.NextHandleFunction {\n return (request, response, next) => {\n void (async () => {\n const url = new URL(request.url ?? \"/\", \"http://localhost\");\n\n if (!url.pathname.startsWith(`${clientPrefix}routes/`)) {\n next();\n return;\n }\n\n const route = await clientRouteForRequestPath(appDir, url.pathname);\n\n if (route === undefined) {\n next();\n return;\n }\n\n try {\n const transformed = await server.transformRequest(`${url.pathname}${url.search}`);\n\n if (transformed === null) {\n next();\n return;\n }\n\n await sendResponse(\n response,\n new Response(transformed.code, {\n headers: { \"content-type\": \"text/javascript; charset=utf-8\" },\n }),\n );\n } catch (error) {\n sendViteErrorOverlay(server, error);\n await sendResponse(response, clientAssetBuildErrorResponse(route.file, error));\n }\n })().catch(next);\n };\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\n/**\n * Alias for `createAppRouterVitePlugin()` used by Vite config files.\n */\nexport const mreactRouter = createAppRouterVitePlugin;\n\nfunction routeTransformUserVitePlugins(\n pluginOptions: readonly PluginOption[] | undefined,\n): PluginOption[] {\n const plugins: PluginOption[] = [];\n const visit = (option: PluginOption | null | false | undefined): void => {\n if (option === false || option === null || option === undefined) {\n return;\n }\n\n if (Array.isArray(option)) {\n for (const child of option) {\n visit(child);\n }\n return;\n }\n\n if (typeof option === \"object\" && \"then\" in option) {\n return;\n }\n\n if (typeof option === \"object\" && mreactRouterConfigKey in option) {\n return;\n }\n\n plugins.push(option);\n };\n\n for (const option of pluginOptions ?? []) {\n visit(option);\n }\n\n return plugins;\n}\n\n/**\n * Reads resolved app-router project config from a Vite plugin list.\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\n/**\n * Creates Connect middleware that renders app-router requests during Vite development.\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 const routeTransformPlugins = options.navigationScanVitePlugins ?? options.vitePlugins;\n const routes = await scanAppRoutes({ appDir: project.routesDir });\n const routeMatcher = createRouteMatcher(routes);\n const readRouteSource = createCachedRouteSourceReader();\n const [clientStyles, clientStylesByFile, navigationScripts] = await Promise.all([\n devRouteStyles(project, routes, readRouteSource),\n devSpecialRouteStyles(project, readRouteSource),\n devNavigationScripts(\n project.routesDir,\n routes,\n readRouteSource,\n options.clientRouteInferenceCache,\n routeTransformPlugins,\n ),\n ]);\n\n await sendResponse(\n outgoing,\n await renderAppRequest({\n appDir: project.routesDir,\n define: options.define,\n dev: true,\n importPolicy: {\n ...options.importPolicy,\n allowedSourceDirs: project.allowedSourceDirs,\n projectRoot: project.projectRoot,\n },\n clientStyles,\n clientStylesByFile,\n clientRouteInferenceCache: options.clientRouteInferenceCache,\n navigationScripts,\n onRenderError(error) {\n sendViteErrorOverlay(options.viteDevServer, error);\n },\n request,\n logger: options.logger,\n routeCache: options.routeCache,\n routeMatcher,\n routes,\n serverActions: options.serverActions,\n devServerModuleCacheVersion: options.devServerModuleCacheVersion?.(),\n vitePlugins: routeTransformPlugins,\n }),\n );\n } catch (error) {\n sendViteErrorOverlay(options.viteDevServer, error);\n next(error);\n }\n}\n\nfunction sendViteErrorOverlay(server: ViteDevServer | undefined, error: unknown): void {\n if (server === undefined) {\n return;\n }\n\n if (error instanceof Error) {\n server.ssrFixStacktrace(error);\n }\n server.ws.send({\n type: \"error\",\n err: viteErrorPayload(error),\n });\n}\n\nfunction viteErrorPayload(error: unknown): { message: string; stack: string } {\n if (error instanceof Error) {\n return {\n message: error.message,\n stack: error.stack ?? error.message,\n };\n }\n\n const message = String(error);\n return { message, stack: message };\n}\n\n/**\n * Renders a development client asset generated by the app-router Vite integration.\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, route.file);\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 const navigation = await resolveNavigationRuntime({\n appDir,\n code,\n filename: route.file,\n references,\n vitePlugins: options.vitePlugins,\n });\n bundle = await buildClientRouteBundle({\n code: clientSource,\n clientBoundaryImports: references.clientBoundaryImports,\n clientReferenceImports: references.clientReferenceImports,\n clientReferenceManifest: references.clientReferenceManifest,\n clientNavigation: navigation || detectAnchorElementUsage(clientSource, route.file),\n filename: route.file,\n routeMayUseOutOfOrderFragments: true,\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, route.file);\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 navigation = await resolveNavigationRuntime({\n appDir,\n code,\n filename: route.file,\n references,\n vitePlugins: options.vitePlugins,\n });\n const entry = await buildClientRouteEntrySource({\n code: clientSource,\n clientBoundaryImports: references.clientBoundaryImports,\n clientReferenceImports: references.clientReferenceImports,\n clientReferenceManifest: references.clientReferenceManifest,\n clientNavigation: navigation || detectAnchorElementUsage(clientSource, route.file),\n filename: route.file,\n routeMayUseOutOfOrderFragments: true,\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 isDevCssSourceModuleId(id: string): boolean {\n return new URLSearchParams(id.slice(id.indexOf(\"?\") + 1)).has(devCssSourceQuery);\n}\n\nasync function loadDevCssSourceModule(options: {\n cssFile: string;\n sourceDirs: readonly string[];\n}): Promise<string | undefined> {\n const code = await readFile(options.cssFile, \"utf8\");\n\n return prependTailwindSourceDirectives({\n code,\n cssFile: options.cssFile,\n sourceDirs: options.sourceDirs,\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 routes: readonly AppRoute[],\n readSource: (file: string) => Promise<string | undefined>,\n): Promise<ReadonlyMap<string, readonly string[]>> {\n const entries = await Promise.all(\n routes.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 readSource,\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 devSpecialRouteStyles(\n project: ResolvedAppRouterProject,\n readSource: (file: string) => Promise<string | undefined>,\n): Promise<ReadonlyMap<string, readonly string[]>> {\n const entries = await Promise.all(\n (await collectSpecialBoundaryFiles(project.routesDir)).map(async (file) => {\n const hrefs = await collectRouteCssHrefs({\n appDir: project.routesDir,\n hrefPrefix: devCssPrefix,\n pageFile: file,\n projectRoot: project.projectRoot,\n readSource,\n });\n\n return hrefs.length === 0 ? undefined : ([file, 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 routes: readonly AppRoute[],\n readSource: (file: string) => Promise<string | undefined>,\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 routes.map(async (route) => {\n if (route.kind !== \"page\") {\n return undefined;\n }\n\n const source = await readSource(route.file);\n if (source === undefined) {\n return undefined;\n }\n const references = await collectClientRouteReferences({\n appDir,\n cache,\n code: source,\n filename: route.file,\n routePath: route.path,\n vitePlugins,\n });\n const navigation = await resolveNavigationRuntime({\n appDir,\n cache,\n code: source,\n filename: route.file,\n references,\n vitePlugins,\n });\n\n for (const diagnostic of references.diagnostics) {\n console.warn(formatClientRouteInferenceDiagnostic(diagnostic));\n }\n const navigationRuntimeDiagnostic = navigationRuntimeLinkDisabledDiagnostic({\n filename: route.file,\n references,\n routePath: route.path,\n source,\n });\n\n if (navigationRuntimeDiagnostic !== undefined) {\n console.warn(formatClientRouteInferenceDiagnostic(navigationRuntimeDiagnostic));\n }\n\n return navigation ? ([route.path, navigationRuntimeScriptForDev()] as const) : 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 const sourceSearch = new URLSearchParams(url.search);\n sourceSearch.set(devCssSourceQuery, \"\");\n incoming.url = `${sourcePath}?${sourceSearch.toString()}`;\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.195",
|
|
4
4
|
"description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -111,20 +111,20 @@
|
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@typescript/typescript6": "^6.0.2",
|
|
113
113
|
"esbuild": ">=0.28.1 <0.29",
|
|
114
|
-
"@reckona/mreact": "0.0.
|
|
115
|
-
"@reckona/mreact
|
|
116
|
-
"@reckona/mreact-
|
|
117
|
-
"@reckona/mreact-
|
|
118
|
-
"@reckona/mreact-
|
|
119
|
-
"@reckona/mreact-
|
|
120
|
-
"@reckona/mreact-
|
|
121
|
-
"@reckona/mreact-
|
|
122
|
-
"@reckona/mreact-reactive-dom": "0.0.
|
|
114
|
+
"@reckona/mreact-compat": "0.0.195",
|
|
115
|
+
"@reckona/mreact": "0.0.195",
|
|
116
|
+
"@reckona/mreact-compiler": "0.0.195",
|
|
117
|
+
"@reckona/mreact-devtools": "0.0.195",
|
|
118
|
+
"@reckona/mreact-query": "0.0.195",
|
|
119
|
+
"@reckona/mreact-reactive-core": "0.0.195",
|
|
120
|
+
"@reckona/mreact-shared": "0.0.195",
|
|
121
|
+
"@reckona/mreact-server": "0.0.195",
|
|
122
|
+
"@reckona/mreact-reactive-dom": "0.0.195"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"vite": ">=8.1.4 <9"
|
|
126
126
|
},
|
|
127
127
|
"optionalDependencies": {
|
|
128
|
-
"@reckona/mreact-router-native": "0.0.
|
|
128
|
+
"@reckona/mreact-router-native": "0.0.195"
|
|
129
129
|
}
|
|
130
130
|
}
|
package/src/build.ts
CHANGED
|
@@ -1975,6 +1975,27 @@ async function buildGeneratedImportPolicy(options: {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
}
|
|
1977
1977
|
|
|
1978
|
+
const responseHookFile = ["on-response.ts", "on-response.mreact.ts"]
|
|
1979
|
+
.map((file) => (relativeRoutesDir === "" ? file : `${relativeRoutesDir}/${file}`))
|
|
1980
|
+
.find((file) => options.files[file] !== undefined);
|
|
1981
|
+
|
|
1982
|
+
if (responseHookFile !== undefined) {
|
|
1983
|
+
const packages = await collectRuntimePackagesForFile({
|
|
1984
|
+
file: responseHookFile,
|
|
1985
|
+
files: options.files,
|
|
1986
|
+
packageJsonLookupCache,
|
|
1987
|
+
projectRoot: options.projectRoot,
|
|
1988
|
+
seen: new Set(),
|
|
1989
|
+
});
|
|
1990
|
+
|
|
1991
|
+
if (packages.length > 0) {
|
|
1992
|
+
routePackages.set("on-response", packages);
|
|
1993
|
+
for (const packageName of packages) {
|
|
1994
|
+
allPackages.add(packageName);
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1978
1999
|
return {
|
|
1979
2000
|
byRoute: Object.fromEntries(
|
|
1980
2001
|
[...routePackages.entries()].sort(([left], [right]) => left.localeCompare(right)),
|
|
@@ -2685,6 +2706,10 @@ async function buildServerModuleArtifacts(options: {
|
|
|
2685
2706
|
requestArtifactFiles.add(file);
|
|
2686
2707
|
}
|
|
2687
2708
|
|
|
2709
|
+
if (isResponseHookFile(options.project.routesDir, absoluteFile)) {
|
|
2710
|
+
requestArtifactFiles.add(file);
|
|
2711
|
+
}
|
|
2712
|
+
|
|
2688
2713
|
if (route?.kind === "server" || route?.kind === "metadata") {
|
|
2689
2714
|
requestArtifactFiles.add(file);
|
|
2690
2715
|
}
|
|
@@ -2721,7 +2746,10 @@ async function buildServerModuleArtifacts(options: {
|
|
|
2721
2746
|
});
|
|
2722
2747
|
}
|
|
2723
2748
|
|
|
2724
|
-
if (
|
|
2749
|
+
if (
|
|
2750
|
+
isMiddlewareFile(options.project.routesDir, absoluteFile) ||
|
|
2751
|
+
isResponseHookFile(options.project.routesDir, absoluteFile)
|
|
2752
|
+
) {
|
|
2725
2753
|
// Middleware joins the batch when runtime packages are bundled so the
|
|
2726
2754
|
// auth/control dependency graph is shared with route loader artifacts.
|
|
2727
2755
|
if (options.bundleRequestRuntimePackages) {
|
|
@@ -3164,7 +3192,10 @@ async function buildRequestModuleArtifactCode(options: {
|
|
|
3164
3192
|
source: string;
|
|
3165
3193
|
vitePlugins?: readonly PluginOption[] | undefined;
|
|
3166
3194
|
}): Promise<string> {
|
|
3167
|
-
if (
|
|
3195
|
+
if (
|
|
3196
|
+
isMiddlewareFile(options.appDir, options.filename) ||
|
|
3197
|
+
isResponseHookFile(options.appDir, options.filename)
|
|
3198
|
+
) {
|
|
3168
3199
|
return await bundleMiddlewareModuleCode({
|
|
3169
3200
|
appDir: options.appDir,
|
|
3170
3201
|
code: options.source,
|
|
@@ -3468,6 +3499,10 @@ function isMiddlewareFile(appDir: string, file: string): boolean {
|
|
|
3468
3499
|
return file === join(appDir, "middleware.ts") || file === join(appDir, "middleware.mreact.ts");
|
|
3469
3500
|
}
|
|
3470
3501
|
|
|
3502
|
+
function isResponseHookFile(appDir: string, file: string): boolean {
|
|
3503
|
+
return file === join(appDir, "on-response.ts") || file === join(appDir, "on-response.mreact.ts");
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3471
3506
|
function hasMetadataExport(code: string): boolean {
|
|
3472
3507
|
return (
|
|
3473
3508
|
/\bexport\s+const\s+metadata\s*=/.test(code) ||
|
|
@@ -159,6 +159,8 @@ export async function loadBuiltServerModuleArtifactsForRequest(
|
|
|
159
159
|
const roots = [
|
|
160
160
|
join(runtime.appDir, "middleware.ts"),
|
|
161
161
|
join(runtime.appDir, "middleware.mreact.ts"),
|
|
162
|
+
join(runtime.appDir, "on-response.ts"),
|
|
163
|
+
join(runtime.appDir, "on-response.mreact.ts"),
|
|
162
164
|
...(routeFile === undefined
|
|
163
165
|
? []
|
|
164
166
|
: [
|
|
@@ -180,6 +182,19 @@ export async function loadBuiltServerModuleArtifactsForRequest(
|
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
184
|
|
|
185
|
+
export async function loadBuiltResponseHookArtifacts(
|
|
186
|
+
runtime: BuiltServerModuleArtifactRuntime,
|
|
187
|
+
): Promise<void> {
|
|
188
|
+
const seen = new Set<string>();
|
|
189
|
+
|
|
190
|
+
for (const file of [
|
|
191
|
+
join(runtime.appDir, "on-response.ts"),
|
|
192
|
+
join(runtime.appDir, "on-response.mreact.ts"),
|
|
193
|
+
]) {
|
|
194
|
+
await loadBuiltServerModuleArtifactClosure(runtime, file, seen, "request");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
183
198
|
async function loadBuiltServerModuleArtifactClosure(
|
|
184
199
|
runtime: BuiltServerModuleArtifactRuntime,
|
|
185
200
|
file: string,
|
package/src/client.ts
CHANGED
|
@@ -4150,13 +4150,15 @@ function __mreactHydrateClientBoundaries(marker, references, components) {
|
|
|
4150
4150
|
return false;
|
|
4151
4151
|
}
|
|
4152
4152
|
|
|
4153
|
-
|
|
4153
|
+
let hydrated = false;
|
|
4154
4154
|
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4155
|
+
while (true) {
|
|
4156
|
+
const placeholder = marker.querySelector("template[data-mreact-client-boundary]");
|
|
4157
|
+
|
|
4158
|
+
if (placeholder === null) {
|
|
4159
|
+
return hydrated;
|
|
4160
|
+
}
|
|
4158
4161
|
|
|
4159
|
-
for (const placeholder of placeholders) {
|
|
4160
4162
|
const name = placeholder.getAttribute("data-mreact-client-boundary");
|
|
4161
4163
|
const entry = name === null ? undefined : components.get(name);
|
|
4162
4164
|
const component = typeof entry === "function" ? entry : entry?.component;
|
|
@@ -4190,6 +4192,7 @@ function __mreactHydrateClientBoundaries(marker, references, components) {
|
|
|
4190
4192
|
const root = __mreactCompatCreateRoot(container);
|
|
4191
4193
|
container.__mreactCompatRoot = root;
|
|
4192
4194
|
root.render(__mreactCompatCreateElement(component, props));
|
|
4195
|
+
hydrated = true;
|
|
4193
4196
|
continue;
|
|
4194
4197
|
}
|
|
4195
4198
|
|
|
@@ -4197,9 +4200,8 @@ function __mreactHydrateClientBoundaries(marker, references, components) {
|
|
|
4197
4200
|
|
|
4198
4201
|
placeholder.replaceWith(node);
|
|
4199
4202
|
propsElement?.remove();
|
|
4203
|
+
hydrated = true;
|
|
4200
4204
|
}
|
|
4201
|
-
|
|
4202
|
-
return true;
|
|
4203
4205
|
}
|
|
4204
4206
|
|
|
4205
4207
|
function __mreactClientBoundaryParentContainer(placeholder, propsElement) {
|
|
@@ -4276,6 +4278,8 @@ function __mreactClientBoundaryPropsElement(placeholder, name) {
|
|
|
4276
4278
|
}
|
|
4277
4279
|
|
|
4278
4280
|
function __mreactClientBoundaryFallbackChildren(placeholder, propsElement) {
|
|
4281
|
+
const componentFallback =
|
|
4282
|
+
placeholder.getAttribute("data-mreact-client-boundary-fallback") === "component";
|
|
4279
4283
|
const nodes = [];
|
|
4280
4284
|
let next = placeholder.nextSibling;
|
|
4281
4285
|
|
|
@@ -4292,6 +4296,13 @@ function __mreactClientBoundaryFallbackChildren(placeholder, propsElement) {
|
|
|
4292
4296
|
nodes.push(current);
|
|
4293
4297
|
}
|
|
4294
4298
|
|
|
4299
|
+
if (componentFallback) {
|
|
4300
|
+
return __mreactExtractClientBoundaryChildren(
|
|
4301
|
+
nodes,
|
|
4302
|
+
placeholder.getAttribute("data-mreact-client-boundary"),
|
|
4303
|
+
);
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4295
4306
|
if (nodes.length === 0) {
|
|
4296
4307
|
return undefined;
|
|
4297
4308
|
}
|
|
@@ -4299,6 +4310,80 @@ function __mreactClientBoundaryFallbackChildren(placeholder, propsElement) {
|
|
|
4299
4310
|
return nodes.length === 1 ? nodes[0] : nodes;
|
|
4300
4311
|
}
|
|
4301
4312
|
|
|
4313
|
+
function __mreactExtractClientBoundaryChildren(nodes, name) {
|
|
4314
|
+
const startMarker = "mreact-client-boundary-children-start";
|
|
4315
|
+
const endMarker = "mreact-client-boundary-children-end";
|
|
4316
|
+
const archive = nodes.find(
|
|
4317
|
+
(node) =>
|
|
4318
|
+
node.nodeType === Node.ELEMENT_NODE &&
|
|
4319
|
+
node.tagName === "TEMPLATE" &&
|
|
4320
|
+
node.getAttribute("data-mreact-client-boundary-children") === name,
|
|
4321
|
+
);
|
|
4322
|
+
|
|
4323
|
+
const roots = archive === undefined ? nodes : Array.from(archive.content.childNodes);
|
|
4324
|
+
const markers = [];
|
|
4325
|
+
const visit = (node) => {
|
|
4326
|
+
if (
|
|
4327
|
+
node.nodeType === Node.COMMENT_NODE &&
|
|
4328
|
+
(node.nodeValue === startMarker || node.nodeValue === endMarker)
|
|
4329
|
+
) {
|
|
4330
|
+
markers.push(node);
|
|
4331
|
+
}
|
|
4332
|
+
|
|
4333
|
+
for (const child of Array.from(node.childNodes ?? [])) {
|
|
4334
|
+
visit(child);
|
|
4335
|
+
}
|
|
4336
|
+
};
|
|
4337
|
+
|
|
4338
|
+
for (const root of roots) {
|
|
4339
|
+
visit(root);
|
|
4340
|
+
}
|
|
4341
|
+
|
|
4342
|
+
let start;
|
|
4343
|
+
let depth = 0;
|
|
4344
|
+
|
|
4345
|
+
for (const marker of markers) {
|
|
4346
|
+
if (marker.nodeValue === startMarker) {
|
|
4347
|
+
if (depth === 0) {
|
|
4348
|
+
start = marker;
|
|
4349
|
+
}
|
|
4350
|
+
depth += 1;
|
|
4351
|
+
continue;
|
|
4352
|
+
}
|
|
4353
|
+
|
|
4354
|
+
if (depth === 0 || start === undefined) {
|
|
4355
|
+
continue;
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4358
|
+
depth -= 1;
|
|
4359
|
+
|
|
4360
|
+
if (depth !== 0) {
|
|
4361
|
+
continue;
|
|
4362
|
+
}
|
|
4363
|
+
|
|
4364
|
+
if (start.parentNode !== marker.parentNode) {
|
|
4365
|
+
start = undefined;
|
|
4366
|
+
continue;
|
|
4367
|
+
}
|
|
4368
|
+
|
|
4369
|
+
const children = [];
|
|
4370
|
+
let current = start.nextSibling;
|
|
4371
|
+
|
|
4372
|
+
while (current !== null && current !== marker) {
|
|
4373
|
+
const next = current.nextSibling;
|
|
4374
|
+
current.remove();
|
|
4375
|
+
children.push(current);
|
|
4376
|
+
current = next;
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
start.remove();
|
|
4380
|
+
marker.remove();
|
|
4381
|
+
return children.length === 0 ? "" : children.length === 1 ? children[0] : children;
|
|
4382
|
+
}
|
|
4383
|
+
|
|
4384
|
+
return undefined;
|
|
4385
|
+
}
|
|
4386
|
+
|
|
4302
4387
|
function __mreactResumeRoute(marker, nextNode) {
|
|
4303
4388
|
if (nextNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
4304
4389
|
marker.replaceChildren(nextNode);
|
|
@@ -4314,12 +4399,23 @@ function __mreactResumeRoute(marker, nextNode) {
|
|
|
4314
4399
|
|
|
4315
4400
|
__mreactResumeNode(current, nextNode);
|
|
4316
4401
|
|
|
4317
|
-
|
|
4402
|
+
const active = current.parentNode === marker
|
|
4403
|
+
? current
|
|
4404
|
+
: nextNode.parentNode === marker
|
|
4405
|
+
? nextNode
|
|
4406
|
+
: null;
|
|
4407
|
+
|
|
4408
|
+
if (active === null) {
|
|
4318
4409
|
return;
|
|
4319
4410
|
}
|
|
4320
4411
|
|
|
4321
|
-
|
|
4322
|
-
|
|
4412
|
+
for (const child of Array.from(marker.childNodes)) {
|
|
4413
|
+
if (child === active) {
|
|
4414
|
+
continue;
|
|
4415
|
+
}
|
|
4416
|
+
|
|
4417
|
+
__mreactUnmountCompatBoundaries(child);
|
|
4418
|
+
child.remove();
|
|
4323
4419
|
}
|
|
4324
4420
|
}
|
|
4325
4421
|
|