@reckona/mreact-router 0.0.121 → 0.0.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +53 -1
- package/dist/build.js.map +1 -1
- package/dist/render.d.ts +1 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +4 -0
- package/dist/render.js.map +1 -1
- package/dist/route-styles.d.ts +1 -0
- package/dist/route-styles.d.ts.map +1 -1
- package/dist/route-styles.js +23 -2
- package/dist/route-styles.js.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +5 -0
- package/dist/serve.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +15 -1
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/build.ts +74 -1
- package/src/render.ts +6 -0
- package/src/route-styles.ts +30 -2
- package/src/serve.ts +11 -0
- package/src/vite.ts +24 -1
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,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACnD,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,+BAA+B,EAC/B,mBAAmB,EACnB,wBAAwB,GAEzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,2BAA2B,EA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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, relative, sep } 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 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\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 = routeTransformUserVitePlugins(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 (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 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\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\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 const routeTransformPlugins = options.navigationScanVitePlugins ?? options.vitePlugins;\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 routeTransformPlugins,\n ),\n request,\n routeCache: options.routeCache,\n serverActions: options.serverActions,\n vitePlugins: routeTransformPlugins,\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, 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 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, 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 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 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 prependDevTailwindSourceDirectives({\n code,\n cssFile: options.cssFile,\n sourceDirs: options.sourceDirs,\n });\n}\n\nfunction prependDevTailwindSourceDirectives(options: {\n code: string;\n cssFile: string;\n sourceDirs: readonly string[];\n}): string {\n if (!isTailwindCssEntry(options.code)) {\n return options.code;\n }\n\n const cssDir = dirname(options.cssFile);\n const directives = [...new Set(options.sourceDirs)]\n .map((sourceDir) => `${devTailwindSourceDirective(cssDir, sourceDir)}\\n`)\n .join(\"\");\n\n return directives.length === 0 ? options.code : `${directives}${options.code}`;\n}\n\nfunction isTailwindCssEntry(code: string): boolean {\n return (\n /@import\\s+(?:url\\()?[\"']tailwindcss(?:\\/[^\"']*)?[\"']\\)?/u.test(code) ||\n /@tailwind\\s+(?:base|components|utilities)\\b/u.test(code)\n );\n}\n\nfunction devTailwindSourceDirective(cssDir: string, sourceDir: string): string {\n const relativeSourceDir = relative(cssDir, sourceDir).split(sep).join(\"/\");\n const normalizedSourceDir =\n relativeSourceDir === \"\"\n ? \".\"\n : relativeSourceDir.startsWith(\".\")\n ? relativeSourceDir\n : `./${relativeSourceDir}`;\n\n return `@source ${JSON.stringify(`${normalizedSourceDir}/**/*.{js,jsx,ts,tsx,mdx}`)};`;\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 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"]}
|
|
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,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACnD,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,+BAA+B,EAC/B,mBAAmB,EACnB,wBAAwB,GAEzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,2BAA2B,E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,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, relative, sep } 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, collectSpecialBoundaryFiles } 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 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\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 = routeTransformUserVitePlugins(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 (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 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\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\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 const routeTransformPlugins = options.navigationScanVitePlugins ?? options.vitePlugins;\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 clientStylesByFile: await devSpecialRouteStyles(project),\n navigationScripts: await devNavigationScripts(\n project.routesDir,\n options.clientRouteInferenceCache,\n routeTransformPlugins,\n ),\n request,\n routeCache: options.routeCache,\n serverActions: options.serverActions,\n vitePlugins: routeTransformPlugins,\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, 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 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, 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 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 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 prependDevTailwindSourceDirectives({\n code,\n cssFile: options.cssFile,\n sourceDirs: options.sourceDirs,\n });\n}\n\nfunction prependDevTailwindSourceDirectives(options: {\n code: string;\n cssFile: string;\n sourceDirs: readonly string[];\n}): string {\n if (!isTailwindCssEntry(options.code)) {\n return options.code;\n }\n\n const cssDir = dirname(options.cssFile);\n const directives = [...new Set(options.sourceDirs)]\n .map((sourceDir) => `${devTailwindSourceDirective(cssDir, sourceDir)}\\n`)\n .join(\"\");\n\n return directives.length === 0 ? options.code : `${directives}${options.code}`;\n}\n\nfunction isTailwindCssEntry(code: string): boolean {\n return (\n /@import\\s+(?:url\\()?[\"']tailwindcss(?:\\/[^\"']*)?[\"']\\)?/u.test(code) ||\n /@tailwind\\s+(?:base|components|utilities)\\b/u.test(code)\n );\n}\n\nfunction devTailwindSourceDirective(cssDir: string, sourceDir: string): string {\n const relativeSourceDir = relative(cssDir, sourceDir).split(sep).join(\"/\");\n const normalizedSourceDir =\n relativeSourceDir === \"\"\n ? \".\"\n : relativeSourceDir.startsWith(\".\")\n ? relativeSourceDir\n : `./${relativeSourceDir}`;\n\n return `@source ${JSON.stringify(`${normalizedSourceDir}/**/*.{js,jsx,ts,tsx,mdx}`)};`;\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 devSpecialRouteStyles(\n project: ResolvedAppRouterProject,\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 });\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 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 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.123",
|
|
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-
|
|
111
|
-
"@reckona/mreact-
|
|
112
|
-
"@reckona/mreact-
|
|
113
|
-
"@reckona/mreact-
|
|
114
|
-
"@reckona/mreact-reactive-dom": "0.0.
|
|
115
|
-
"@reckona/mreact-server": "0.0.
|
|
116
|
-
"@reckona/mreact-shared": "0.0.
|
|
108
|
+
"@reckona/mreact": "0.0.123",
|
|
109
|
+
"@reckona/mreact-compat": "0.0.123",
|
|
110
|
+
"@reckona/mreact-query": "0.0.123",
|
|
111
|
+
"@reckona/mreact-compiler": "0.0.123",
|
|
112
|
+
"@reckona/mreact-reactive-core": "0.0.123",
|
|
113
|
+
"@reckona/mreact-devtools": "0.0.123",
|
|
114
|
+
"@reckona/mreact-reactive-dom": "0.0.123",
|
|
115
|
+
"@reckona/mreact-server": "0.0.123",
|
|
116
|
+
"@reckona/mreact-shared": "0.0.123"
|
|
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.123"
|
|
123
123
|
}
|
|
124
124
|
}
|
package/src/build.ts
CHANGED
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
type RouterBundleChunkOutput,
|
|
74
74
|
type RouterBundleOutput,
|
|
75
75
|
} from "./bundle-pipeline.js";
|
|
76
|
-
import { collectRouteCssFilesFromSources } from "./route-styles.js";
|
|
76
|
+
import { collectRouteCssFilesFromSources, collectSpecialBoundaryFiles } from "./route-styles.js";
|
|
77
77
|
import { existingRouteShellCandidates } from "./route-shells.js";
|
|
78
78
|
import { sourceModuleCandidates } from "./source-modules.js";
|
|
79
79
|
import { collectBuildInferredServerActions } from "./server-action-inference.js";
|
|
@@ -491,6 +491,7 @@ export async function buildApp(options: BuildAppOptions): Promise<BuildAppResult
|
|
|
491
491
|
const clientManifestAssets = Array.from(
|
|
492
492
|
new Set([
|
|
493
493
|
...clientBundle.assets,
|
|
494
|
+
...clientBundle.styles.flatMap((style) => style.css),
|
|
494
495
|
...(navigationRuntimeScript === undefined ? [] : [navigationRuntimeScript]),
|
|
495
496
|
]),
|
|
496
497
|
).sort();
|
|
@@ -588,6 +589,7 @@ export async function buildApp(options: BuildAppOptions): Promise<BuildAppResult
|
|
|
588
589
|
...(clientManifestAssets.length === 0 ? {} : { assets: clientManifestAssets }),
|
|
589
590
|
...(publicAssets.length === 0 ? {} : { publicAssets }),
|
|
590
591
|
routes: clientManifestRoutes,
|
|
592
|
+
...(clientBundle.styles.length === 0 ? {} : { styles: clientBundle.styles }),
|
|
591
593
|
};
|
|
592
594
|
const writeManifestFiles = async () => {
|
|
593
595
|
await Promise.all([
|
|
@@ -4377,6 +4379,12 @@ function viteManifestFromClientRoutes(routes: ClientRouteManifestEntry[]): Recor
|
|
|
4377
4379
|
interface ClientRouteBundleManifest {
|
|
4378
4380
|
assets: string[];
|
|
4379
4381
|
routes: ClientRouteManifestEntry[];
|
|
4382
|
+
styles: ClientStyleManifestEntry[];
|
|
4383
|
+
}
|
|
4384
|
+
|
|
4385
|
+
interface ClientStyleManifestEntry {
|
|
4386
|
+
css: string[];
|
|
4387
|
+
file: string;
|
|
4380
4388
|
}
|
|
4381
4389
|
|
|
4382
4390
|
async function writeClientRouteBundles(options: {
|
|
@@ -4413,6 +4421,14 @@ async function writeClientRouteBundles(options: {
|
|
|
4413
4421
|
sourceAnalysis: options.sourceAnalysis,
|
|
4414
4422
|
vitePlugins: options.vitePlugins,
|
|
4415
4423
|
});
|
|
4424
|
+
const specialCssAssets = await writeSpecialRouteCssAssetBatches({
|
|
4425
|
+
appDir: options.appDir,
|
|
4426
|
+
cacheDir: options.cacheDir,
|
|
4427
|
+
clientDir: options.clientDir,
|
|
4428
|
+
projectRoot: options.projectRoot,
|
|
4429
|
+
sourceAnalysis: options.sourceAnalysis,
|
|
4430
|
+
vitePlugins: options.vitePlugins,
|
|
4431
|
+
});
|
|
4416
4432
|
const entries: PreparedRouteEntry[] = await Promise.all(
|
|
4417
4433
|
options.routes.map(async (route) => {
|
|
4418
4434
|
if (route.kind !== "page") {
|
|
@@ -4496,6 +4512,7 @@ async function writeClientRouteBundles(options: {
|
|
|
4496
4512
|
return {
|
|
4497
4513
|
assets: [],
|
|
4498
4514
|
routes: entries.flatMap((entry) => ("manifest" in entry ? [entry.manifest] : [])),
|
|
4515
|
+
styles: specialCssAssets,
|
|
4499
4516
|
};
|
|
4500
4517
|
}
|
|
4501
4518
|
|
|
@@ -4615,9 +4632,65 @@ async function writeClientRouteBundles(options: {
|
|
|
4615
4632
|
return {
|
|
4616
4633
|
assets: Array.from(generatedAssets).sort(),
|
|
4617
4634
|
routes,
|
|
4635
|
+
styles: specialCssAssets,
|
|
4618
4636
|
};
|
|
4619
4637
|
}
|
|
4620
4638
|
|
|
4639
|
+
async function writeSpecialRouteCssAssetBatches(options: {
|
|
4640
|
+
appDir: string;
|
|
4641
|
+
cacheDir?: string | undefined;
|
|
4642
|
+
clientDir: string;
|
|
4643
|
+
projectRoot: string;
|
|
4644
|
+
sourceAnalysis: BuildSourceAnalysisScope;
|
|
4645
|
+
vitePlugins?: readonly PluginOption[] | undefined;
|
|
4646
|
+
}): Promise<ClientStyleManifestEntry[]> {
|
|
4647
|
+
const boundaryFiles = await collectSpecialBoundaryFiles(options.appDir);
|
|
4648
|
+
const entries = await mapWithBuildConcurrency(boundaryFiles, async (file) => {
|
|
4649
|
+
const cssFiles = await collectRouteCssFilesFromSources({
|
|
4650
|
+
appDir: options.appDir,
|
|
4651
|
+
pageFile: file,
|
|
4652
|
+
projectRoot: options.projectRoot,
|
|
4653
|
+
readSource: (sourceFile) =>
|
|
4654
|
+
buildSourceAnalysisForFile(options.sourceAnalysis, options.projectRoot, sourceFile)?.source,
|
|
4655
|
+
});
|
|
4656
|
+
|
|
4657
|
+
if (cssFiles.length === 0) {
|
|
4658
|
+
return undefined;
|
|
4659
|
+
}
|
|
4660
|
+
|
|
4661
|
+
const css = await writeRouteCssAssetsForFiles({
|
|
4662
|
+
cacheDir: options.cacheDir,
|
|
4663
|
+
clientDir: options.clientDir,
|
|
4664
|
+
cssFiles,
|
|
4665
|
+
pageFile: file,
|
|
4666
|
+
projectRoot: options.projectRoot,
|
|
4667
|
+
routeIds: [specialBoundaryRouteId(options.appDir, file)],
|
|
4668
|
+
vitePlugins: options.vitePlugins,
|
|
4669
|
+
});
|
|
4670
|
+
|
|
4671
|
+
return css.length === 0
|
|
4672
|
+
? undefined
|
|
4673
|
+
: ({
|
|
4674
|
+
css,
|
|
4675
|
+
file: relative(options.appDir, file).split(sep).join("/"),
|
|
4676
|
+
} satisfies ClientStyleManifestEntry);
|
|
4677
|
+
});
|
|
4678
|
+
|
|
4679
|
+
return entries
|
|
4680
|
+
.filter((entry): entry is ClientStyleManifestEntry => entry !== undefined)
|
|
4681
|
+
.sort((left, right) => left.file.localeCompare(right.file));
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
function specialBoundaryRouteId(appDir: string, file: string): string {
|
|
4685
|
+
const relativeFile = relative(appDir, file).split(sep);
|
|
4686
|
+
const filename = relativeFile.pop() ?? "boundary.tsx";
|
|
4687
|
+
const boundaryName = filename.replace(/(?:\.mreact)?\.tsx$/u, "");
|
|
4688
|
+
const routeParts = relativeFile.filter((part) => !part.startsWith("(") || !part.endsWith(")"));
|
|
4689
|
+
const path = `/${[...routeParts, boundaryName].join("/")}`;
|
|
4690
|
+
|
|
4691
|
+
return routeIdForPath(path);
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4621
4694
|
async function writeRouteCssAssetBatches(options: {
|
|
4622
4695
|
appDir: string;
|
|
4623
4696
|
cacheDir?: string | undefined;
|
package/src/render.ts
CHANGED
|
@@ -159,6 +159,7 @@ export interface RenderAppRequestOptions {
|
|
|
159
159
|
appDir: string;
|
|
160
160
|
assetBaseUrl?: string | undefined;
|
|
161
161
|
clientScripts?: ReadonlyMap<string, string>;
|
|
162
|
+
clientStylesByFile?: ReadonlyMap<string, readonly string[]>;
|
|
162
163
|
clientStyles?: ReadonlyMap<string, readonly string[]>;
|
|
163
164
|
env?: unknown;
|
|
164
165
|
importPolicy?: AppRouterImportPolicy | undefined;
|
|
@@ -802,6 +803,7 @@ async function renderAppRequestInternal(options: RenderAppRequestOptions): Promi
|
|
|
802
803
|
const response = await renderSpecialRoute({
|
|
803
804
|
appDir: options.appDir,
|
|
804
805
|
assetBaseUrl: options.assetBaseUrl,
|
|
806
|
+
currentStyleSheets: options.clientStylesByFile?.get(notFoundFile),
|
|
805
807
|
error: undefined,
|
|
806
808
|
request: options.request,
|
|
807
809
|
routePath: url.pathname,
|
|
@@ -1454,6 +1456,7 @@ async function renderAppRequestInternal(options: RenderAppRequestOptions): Promi
|
|
|
1454
1456
|
const response = await renderSpecialRoute({
|
|
1455
1457
|
appDir: options.appDir,
|
|
1456
1458
|
assetBaseUrl: options.assetBaseUrl,
|
|
1459
|
+
currentStyleSheets: options.clientStylesByFile?.get(notFoundFile),
|
|
1457
1460
|
error: undefined,
|
|
1458
1461
|
request: options.request,
|
|
1459
1462
|
routePath: matched.route.path,
|
|
@@ -1480,6 +1483,7 @@ async function renderAppRequestInternal(options: RenderAppRequestOptions): Promi
|
|
|
1480
1483
|
const response = await renderSpecialRoute({
|
|
1481
1484
|
appDir: options.appDir,
|
|
1482
1485
|
assetBaseUrl: options.assetBaseUrl,
|
|
1486
|
+
currentStyleSheets: options.clientStylesByFile?.get(errorFile),
|
|
1483
1487
|
error,
|
|
1484
1488
|
request: options.request,
|
|
1485
1489
|
routePath: matched.route.path,
|
|
@@ -1742,6 +1746,7 @@ function boundaryFilenameCandidates(filename: string): string[] {
|
|
|
1742
1746
|
async function renderSpecialRoute(options: {
|
|
1743
1747
|
appDir: string;
|
|
1744
1748
|
assetBaseUrl?: string | undefined;
|
|
1749
|
+
currentStyleSheets?: readonly string[] | undefined;
|
|
1745
1750
|
error: unknown;
|
|
1746
1751
|
navigation?:
|
|
1747
1752
|
| {
|
|
@@ -1812,6 +1817,7 @@ async function renderSpecialRoute(options: {
|
|
|
1812
1817
|
return new Response(
|
|
1813
1818
|
`<!DOCTYPE html>${clientNavigationHeadTags({
|
|
1814
1819
|
assetBaseUrl: options.assetBaseUrl,
|
|
1820
|
+
currentStyleSheets: options.currentStyleSheets,
|
|
1815
1821
|
currentScript:
|
|
1816
1822
|
options.navigation?.clientRoute === true ? options.navigation.script : undefined,
|
|
1817
1823
|
routeScripts: options.routeScripts,
|
package/src/route-styles.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { access, readFile } from "node:fs/promises";
|
|
2
|
-
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
1
|
+
import { access, readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join, isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { collectStaticImportReferences } from "@reckona/mreact-compiler";
|
|
4
4
|
import { existingRouteShellCandidates } from "./route-shells.js";
|
|
5
5
|
|
|
@@ -65,6 +65,34 @@ export async function collectRouteCssHrefs(options: {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
export async function collectSpecialBoundaryFiles(directory: string): Promise<string[]> {
|
|
69
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
70
|
+
const files: string[] = [];
|
|
71
|
+
|
|
72
|
+
for (const entry of entries) {
|
|
73
|
+
const path = join(directory, entry.name);
|
|
74
|
+
|
|
75
|
+
if (entry.isDirectory()) {
|
|
76
|
+
if (entry.name === ".vite" || entry.name === "node_modules") {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
files.push(...(await collectSpecialBoundaryFiles(path)));
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (entry.isFile() && isSpecialBoundaryFilename(entry.name)) {
|
|
85
|
+
files.push(path);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return files.sort();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function isSpecialBoundaryFilename(filename: string): boolean {
|
|
93
|
+
return /^(?:error|not-found)(?:\.mreact)?\.tsx$/u.test(filename);
|
|
94
|
+
}
|
|
95
|
+
|
|
68
96
|
function resolveCssImport(options: {
|
|
69
97
|
importer: string;
|
|
70
98
|
projectRoot: string;
|
package/src/serve.ts
CHANGED
|
@@ -41,6 +41,7 @@ interface BuiltRuntime {
|
|
|
41
41
|
allowedSourceDirs: readonly string[];
|
|
42
42
|
assetBaseUrl?: string | undefined;
|
|
43
43
|
clientScripts: ReadonlyMap<string, string>;
|
|
44
|
+
clientStylesByFile: ReadonlyMap<string, readonly string[]>;
|
|
44
45
|
clientStyles: ReadonlyMap<string, readonly string[]>;
|
|
45
46
|
hasMiddleware: boolean;
|
|
46
47
|
navigationScripts: ReadonlyMap<string, string>;
|
|
@@ -763,6 +764,7 @@ async function materializeBuiltRuntime(options: {
|
|
|
763
764
|
const serverManifest = JSON.parse(options.serverManifestText) as BuiltServerManifest;
|
|
764
765
|
const clientManifest = JSON.parse(options.clientManifestText) as {
|
|
765
766
|
routes: ClientRouteManifestEntry[];
|
|
767
|
+
styles?: Array<{ css?: readonly string[]; file: string }>;
|
|
766
768
|
};
|
|
767
769
|
const appDir = await materializeBuiltServerApp(options.runtimeDir, serverManifest);
|
|
768
770
|
const projectRoot = appDir;
|
|
@@ -818,6 +820,13 @@ async function materializeBuiltRuntime(options: {
|
|
|
818
820
|
route.css !== undefined && route.css.length > 0 ? [[route.path, route.css]] : [],
|
|
819
821
|
),
|
|
820
822
|
);
|
|
823
|
+
const clientStylesByFile = new Map(
|
|
824
|
+
(clientManifest.styles ?? []).flatMap((style) =>
|
|
825
|
+
style.css !== undefined && style.css.length > 0
|
|
826
|
+
? [[join(routesDir, style.file), style.css] as const]
|
|
827
|
+
: [],
|
|
828
|
+
),
|
|
829
|
+
);
|
|
821
830
|
const navigationScripts = new Map(
|
|
822
831
|
clientManifest.routes.flatMap((route) =>
|
|
823
832
|
route.navigation === true && route.navigationScript !== undefined
|
|
@@ -846,6 +855,7 @@ async function materializeBuiltRuntime(options: {
|
|
|
846
855
|
? {}
|
|
847
856
|
: { assetBaseUrl: serverManifest.assetBaseUrl }),
|
|
848
857
|
clientScripts,
|
|
858
|
+
clientStylesByFile,
|
|
849
859
|
clientStyles,
|
|
850
860
|
hasMiddleware,
|
|
851
861
|
navigationScripts,
|
|
@@ -1156,6 +1166,7 @@ function builtRenderAppRequestOptions(
|
|
|
1156
1166
|
appDir: options.runtime.appDir,
|
|
1157
1167
|
assetBaseUrl: options.runtime.assetBaseUrl,
|
|
1158
1168
|
clientScripts: options.runtime.clientScripts,
|
|
1169
|
+
clientStylesByFile: options.runtime.clientStylesByFile,
|
|
1159
1170
|
clientStyles: options.runtime.clientStyles,
|
|
1160
1171
|
importPolicy: {
|
|
1161
1172
|
...options.importPolicy,
|
package/src/vite.ts
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
import { nodeRequestToWebRequest, sendResponse } from "./http.js";
|
|
39
39
|
import { renderAppRequest } from "./render.js";
|
|
40
40
|
import { stripRouteClientOnlyExports } from "./route-source.js";
|
|
41
|
-
import { collectRouteCssHrefs } from "./route-styles.js";
|
|
41
|
+
import { collectRouteCssHrefs, collectSpecialBoundaryFiles } from "./route-styles.js";
|
|
42
42
|
import { scanAppRoutes } from "./routes.js";
|
|
43
43
|
import { resolveRequestHost, type RequestHostPolicy } from "./serve.js";
|
|
44
44
|
import { hasJsxSyntax } from "./source-jsx.js";
|
|
@@ -504,6 +504,7 @@ async function handleAppRouterViteRequest(
|
|
|
504
504
|
projectRoot: project.projectRoot,
|
|
505
505
|
},
|
|
506
506
|
clientStyles: await devRouteStyles(project),
|
|
507
|
+
clientStylesByFile: await devSpecialRouteStyles(project),
|
|
507
508
|
navigationScripts: await devNavigationScripts(
|
|
508
509
|
project.routesDir,
|
|
509
510
|
options.clientRouteInferenceCache,
|
|
@@ -790,6 +791,28 @@ async function devRouteStyles(
|
|
|
790
791
|
return new Map<string, readonly string[]>(routeStyles);
|
|
791
792
|
}
|
|
792
793
|
|
|
794
|
+
async function devSpecialRouteStyles(
|
|
795
|
+
project: ResolvedAppRouterProject,
|
|
796
|
+
): Promise<ReadonlyMap<string, readonly string[]>> {
|
|
797
|
+
const entries = await Promise.all(
|
|
798
|
+
(await collectSpecialBoundaryFiles(project.routesDir)).map(async (file) => {
|
|
799
|
+
const hrefs = await collectRouteCssHrefs({
|
|
800
|
+
appDir: project.routesDir,
|
|
801
|
+
hrefPrefix: devCssPrefix,
|
|
802
|
+
pageFile: file,
|
|
803
|
+
projectRoot: project.projectRoot,
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
return hrefs.length === 0 ? undefined : ([file, hrefs as readonly string[]] as const);
|
|
807
|
+
}),
|
|
808
|
+
);
|
|
809
|
+
const routeStyles = entries.filter(
|
|
810
|
+
(entry): entry is readonly [string, readonly string[]] => entry !== undefined,
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
return new Map<string, readonly string[]>(routeStyles);
|
|
814
|
+
}
|
|
815
|
+
|
|
793
816
|
async function devNavigationScripts(
|
|
794
817
|
appDir: string,
|
|
795
818
|
inferenceCache?: ClientRouteInferenceCache | undefined,
|