{"version":3,"file":"index.mjs","names":["NULL_BYTE_PLACEHOLDER","cssFileRegExp","nonAmbientQueryRegExp","MANIFEST_ID","STORAGE_SOURCE","HANDLER_ID","path","pathToFileURL"],"sources":["../../src/http.ts","../../src/tsrx.ts","../../src/dev-manifest.ts","../../src/hook-filters.ts","../../src/environment.ts","../../src/boundary-modules.ts","../../src/diagnostics/index.ts","../../src/performance-tracks/index.ts","../../src/build-files.ts","../../src/server-functions/compile.ts","../../src/server-functions/server-styles.ts","../../src/server-functions/xxhash32.ts","../../src/server-functions/index.ts","../../src/devtools/index.ts","../../src/devtools/protocol.ts","../../src/devtools/server.ts","../../src/node-entry/encoding.ts","../../src/precompress.ts","../../src/ssr/index.ts","../../src/env.ts","../../src/source-names.ts","../../src/asset-urls.ts","../../src/css-module-classes.ts","../../src/index.ts"],"sourcesContent":["// Node <-> web-standard request/response bridging shared by the plugin's dev\n// and preview middlewares (server functions and SSR) and by the Node server\n// entry `start.nodeServer` emits into users' builds (src/node-entry). The virtual\n// production handlers speak web Request/Response only; this is the node:http\n// glue that talks to them. Keep it free of vite and plugin imports — it is\n// bundled verbatim into dist/server/node.js.\nimport type { IncomingMessage, ServerResponse } from 'node:http';\nimport { Readable } from 'node:stream';\n\n/**\n * `urlPath` overrides `req.url` when the middleware needs to dispatch a\n * different URL than the one node saw — the dev middlewares use it to\n * restore the configured Vite `base` that the dev/preview base middleware\n * stripped, so the handler always sees production-shaped URLs.\n *\n * Handles plain HTTP/1 *and* the HTTP/2 compat API: Vite's dev server uses\n * `http2.createSecureServer({ allowHTTP1: true })` whenever `server.https`\n * is set without a proxy, so under https the middlewares receive\n * `Http2ServerRequest`s. The h2/protocol/abort techniques here are\n * reimplemented from srvx's Node adapter (github.com/h3js/srvx,\n * src/adapters/_node) — reference, not copied code.\n */\nexport function webRequestFromNode(\n  req: IncomingMessage,\n  urlPath?: string,\n  res?: ServerResponse,\n): Request {\n  // TLS sockets (https and h2) expose `encrypted`; a Request whose url says\n  // http: on a TLS connection breaks secure-cookie logic, absolute\n  // redirects, and origin checks in application code.\n  const protocol = (req.socket as { encrypted?: boolean } | undefined)?.encrypted\n    ? 'https'\n    : 'http';\n  // HTTP/2 has no Host header — the authority travels in the `:authority`\n  // pseudo-header instead.\n  const host = req.headers.host ?? (req.headers[':authority'] as string | undefined) ?? 'localhost';\n  const url = parseRequestTarget(urlPath ?? req.url ?? '/', `${protocol}://${host}`);\n  const headers = new Headers();\n  for (const [key, value] of Object.entries(req.headers)) {\n    if (value === undefined) continue;\n    // HTTP/2 pseudo-headers (:method, :path, :authority, :scheme) are not\n    // legal field names — Headers#append throws a TypeError on them.\n    if (key[0] === ':') continue;\n    if (Array.isArray(value)) {\n      for (const item of value) headers.append(key, item);\n    } else {\n      headers.append(key, value);\n    }\n  }\n  // Surface client disconnects as the request's AbortSignal so handlers can\n  // cancel work (streamed SSR renders, in-flight fetches). The response's\n  // 'close' fires on normal completion too; `writableEnded` distinguishes a\n  // finished response from a client that went away.\n  let signal: AbortSignal | undefined;\n  if (res) {\n    const controller = new AbortController();\n    res.once('close', () => {\n      if (!res.writableEnded) controller.abort();\n    });\n    signal = controller.signal;\n  }\n  const method = req.method || 'GET';\n  // Only attach a body when the request actually carries one. A web Request\n  // built by the browser for a bodyless POST has `body === null`, and the\n  // runtime keys off that (a present body that decodes to nothing is a 400\n  // since @solidjs/web 2.0.0-rc.5) — so an unconditionally attached (empty)\n  // stream misparses bodyless calls. HTTP/1 signals a body via\n  // Content-Length/Transfer-Encoding (RFC 9112 §6); the h2 compat API sets\n  // `stream.endAfterHeaders` when END_STREAM rode the headers frame.\n  const h2Stream = (req as { stream?: { endAfterHeaders?: boolean } }).stream;\n  const hasBody =\n    method !== 'GET' &&\n    method !== 'HEAD' &&\n    (h2Stream\n      ? !h2Stream.endAfterHeaders\n      : req.headers['transfer-encoding'] !== undefined ||\n        (req.headers['content-length'] !== undefined && req.headers['content-length'] !== '0'));\n  const body = hasBody ? (Readable.toWeb(req) as unknown as ReadableStream) : undefined;\n  return new Request(url, {\n    method,\n    headers,\n    body,\n    signal,\n    // undici requires half-duplex for streamed request bodies.\n    ...(body ? { duplex: 'half' } : {}),\n  } as RequestInit);\n}\n\nexport async function sendWebResponse(res: ServerResponse, response: Response): Promise<void> {\n  res.statusCode = response.status;\n  // set-cookie is the one header that must not be comma-joined.\n  const cookies: string[] | undefined = (response.headers as any).getSetCookie?.();\n  response.headers.forEach((value, key) => {\n    if (key !== 'set-cookie') res.setHeader(key, value);\n  });\n  if (cookies && cookies.length) res.setHeader('set-cookie', cookies);\n  // HEAD gets the head only — and the body must be *cancelled*, not pumped:\n  // node discards HEAD body writes, so streaming a long (or endless) body\n  // into the void just burns the render. (Technique from srvx.)\n  if (!response.body || res.req?.method === 'HEAD') {\n    response.body?.cancel().catch(() => {});\n    res.end();\n    return;\n  }\n  const reader = response.body.getReader();\n  res.on('close', () => {\n    reader.cancel().catch(() => {});\n  });\n  try {\n    while (true) {\n      const { done, value } = await reader.read();\n      if (done) break;\n      // A response whose client already went away never emits 'drain'\n      // (writes are no-ops), so a backpressure wait must also settle on\n      // 'close'/'error' or an aborted streaming response parks this promise\n      // — and the reader and Response it holds — forever.\n      if (res.destroyed) return;\n      if (!res.write(value)) {\n        const drained = await new Promise<boolean>((resolve) => {\n          const settle = (ok: boolean) => {\n            res.off('drain', onDrain);\n            res.off('close', onGone);\n            res.off('error', onGone);\n            resolve(ok);\n          };\n          const onDrain = () => settle(true);\n          const onGone = () => settle(false);\n          res.once('drain', onDrain);\n          res.once('close', onGone);\n          res.once('error', onGone);\n        });\n        // Client gone mid-stream; the 'close' handler cancels the reader.\n        if (!drained) return;\n      }\n    }\n    res.end();\n  } catch {\n    res.destroy();\n  }\n}\n\n// Concatenated, not resolved: `//evil.example/x` would otherwise become the authority.\nexport function parseRequestTarget(target: string, origin: string): URL {\n  return target.startsWith('/')\n    ? new URL(new URL(origin).origin + target)\n    : new URL(target, origin);\n}\n\nexport function joinBase(base: string, pathname: string): string {\n  // Absolute-URL or relative bases (CDN deploys, './') don't prefix\n  // same-origin server paths.\n  if (!base.startsWith('/')) return pathname;\n  return (base.endsWith('/') ? base.slice(0, -1) : base) + pathname;\n}\n","export const TSRX_CSS_QUERY = '?solid-tsrx-css&lang.css';\n// Hook filter for the stylesheet modules (see isTsrxCssModule).\nexport const TSRX_CSS_IDS = /[?&]solid-tsrx-css(?:&|$)/;\nconst NULL_BYTE_PLACEHOLDER = '/@id/__x00__';\n\nexport function cleanModuleId(id: string): string {\n  const query = id.indexOf('?');\n  return query === -1 ? id : id.slice(0, query);\n}\n\nexport function isTsrxModule(id: string): boolean {\n  return cleanModuleId(id).toLowerCase().endsWith('.tsrx');\n}\n\nexport function isTsrxCssModule(id: string): boolean {\n  const unwrapped = id.startsWith('\\0')\n    ? id.slice(1)\n    : id.startsWith(NULL_BYTE_PLACEHOLDER)\n      ? id.slice(NULL_BYTE_PLACEHOLDER.length)\n      : id;\n  // The query alone names the stylesheet module: `.tsrx` and other front\n  // ends' modules (`Options.frontends`) take it alike.\n  const queryIndex = unwrapped.indexOf('?');\n  if (queryIndex === -1) return false;\n  const params = unwrapped.slice(queryIndex + 1).split('&');\n  return params.includes('solid-tsrx-css') && params.includes('lang.css');\n}\n\nexport function resolveTsrxCssModule(id: string): string | null {\n  if (!isTsrxCssModule(id)) return null;\n  if (id.startsWith('\\0')) return id;\n  if (id.startsWith(NULL_BYTE_PLACEHOLDER)) {\n    return '\\0' + id.slice(NULL_BYTE_PLACEHOLDER.length);\n  }\n  return '\\0' + id;\n}\n\nexport function tsrxCssModuleId(id: string): string {\n  return cleanModuleId(id) + TSRX_CSS_QUERY;\n}\n\nexport function resolvedTsrxCssModuleId(id: string): string {\n  return '\\0' + tsrxCssModuleId(id);\n}\n\nexport function tsrxCssSourceId(id: string): string | null {\n  if (!id.startsWith('\\0') || !isTsrxCssModule(id)) return null;\n  return cleanModuleId(id.slice(1));\n}\n\nexport function updateTsrxCss(\n  cache: Map<string, string>,\n  id: string,\n  css: string | null | undefined,\n): void {\n  const key = cleanModuleId(id);\n  if (css) {\n    cache.set(key, css);\n  } else {\n    cache.delete(key);\n  }\n}\n\nexport function prependTsrxCssImport(code: string, id: string): string {\n  return `import ${JSON.stringify(tsrxCssModuleId(id))};\\n${code}`;\n}\n\nexport function offsetSourceMapLine<T>(map: T): T {\n  if (\n    map &&\n    typeof map === 'object' &&\n    'mappings' in map &&\n    typeof (map as { mappings?: unknown }).mappings === 'string'\n  ) {\n    return {\n      ...map,\n      mappings: ';' + (map as { mappings: string }).mappings,\n    };\n  }\n  if (\n    map &&\n    typeof map === 'object' &&\n    'sections' in map &&\n    Array.isArray((map as { sections?: unknown }).sections)\n  ) {\n    return {\n      ...map,\n      sections: (\n        map as { sections: Array<{ offset: { line: number; column: number } }> }\n      ).sections.map((section) => ({\n        ...section,\n        offset: { ...section.offset, line: section.offset.line + 1 },\n      })),\n    };\n  }\n  return map;\n}\n","import path from 'path';\nimport type { DevEnvironment, EnvironmentModuleNode, ViteDevServer } from 'vite';\nimport { joinBase, parseRequestTarget } from './http.js';\nimport { isTsrxCssModule } from './tsrx.js';\n\n/**\n * Dev-mode asset resolution: the `virtual:solid-manifest` module exports a\n * resolver function in dev (instead of the static object a build produces),\n * and the runtime installs it as `context.resolveAssets` verbatim. When\n * server-side `lazy()` resolves a module key, the resolver walks the SSR\n * environment's live module graph collecting transitively imported CSS and\n * answers with inline-style descriptors — SSR'd `<style data-vite-dev-id>`\n * tags that Vite's HMR client adopts on startup, so dev CSS is styled from\n * the first streamed byte without fighting Vite's own style injection.\n *\n * The walk design follows SolidStart's collect-styles (by @katywings): crawl\n * `transformResult.deps` on the SSR environment (the client environment's\n * transform results don't list CSS deps), skipping dynamic imports since\n * dynamically imported modules register their own styles when they render.\n */\n\nexport type DevStyleDescriptor = { id: string; content: string; attrs?: Record<string, string> };\nexport type DevStyleSource = { id: string; url: string };\nexport type DevStyleFilter = (id: string) => boolean;\n\nconst defaultStyleFilter: DevStyleFilter = (id) => !id.includes('node_modules');\n\nexport type ResolvedAssets = {\n  js: string[];\n  css: (string | DevStyleDescriptor)[];\n};\n\nexport type DevAssetResolver = {\n  /**\n   * Answers synchronously (a plain object) once the key's assets are known.\n   * The sync answer is load-bearing for SSR convergence: the runtime retries\n   * a suspended render pass by re-creating the lazy component, which\n   * re-requests its assets — if every answer is a fresh pending promise the\n   * pass suspends again on a promise that did not exist when the retry\n   * began, and never converges (see `createDevAssetResolver`).\n   */\n  resolve: (key: string) => ResolvedAssets | null | Promise<ResolvedAssets | null>;\n  /**\n   * Synchronous fast path used by sync consumers (a lazy component's\n   * `moduleUrl` getter for islands): the module's dev URL is knowable\n   * without the async CSS graph walk.\n   */\n  resolveSync: (key: string) => ResolvedAssets;\n};\n\ntype InvalidatableDevAssetResolver = DevAssetResolver & { invalidate: () => void };\n\n// The resolver is created plugin-side (it closes over the dev server) but is\n// called from the SSR module runner, which only shares `globalThis` with the\n// plugin when it runs in-process (the default). The primary channel is a\n// `Symbol.for`-keyed registry mapping project roots to resolvers; isolated\n// runners (nitro's dev worker, workerd) won't find it and instead fall back\n// to fetching the HTTP bridge endpoint below.\nexport const DEV_MANIFEST_REGISTRY_KEY = '@solidjs/vite-plugin:dev-manifest';\n\nexport function registerDevAssetResolver(root: string, resolver: DevAssetResolver): void {\n  const key = Symbol.for(DEV_MANIFEST_REGISTRY_KEY);\n  const registry: Record<string, DevAssetResolver> = ((globalThis as any)[key] ??= {});\n  registry[root] = resolver;\n}\n\n/**\n * HTTP bridge endpoint for isolated SSR runners. Hosts that evaluate server\n * modules outside the Vite process (nitro's dev worker, workerd via\n * @cloudflare/vite-plugin) can't see the `globalThis` registry, so the dev\n * server itself serves asset resolution: `GET\n * /@solidjs/vite-plugin/dev-manifest?key=<module key>` answers with the\n * resolver's `ResolvedAssets` JSON (`null` when the key can't be resolved).\n * The dev flavor of `virtual:solid-manifest` falls back to fetching it when\n * the registry has no entry for the root — in-process consumers hit the\n * registry and never touch HTTP.\n */\nexport const DEV_MANIFEST_ENDPOINT = '/@solidjs/vite-plugin/dev-manifest';\nexport const DEV_MANIFEST_INVALIDATE_EVENT = 'solid:dev-manifest-invalidate';\n\nexport function installDevManifestBridge(server: ViteDevServer): void {\n  // configureServer middlewares run ahead of Vite's internals, so `req.url`\n  // may or may not still carry the configured `base` — accept both forms.\n  const base = (server.config.base || '/').replace(/\\/$/, '');\n  const basedEndpoint = base + DEV_MANIFEST_ENDPOINT;\n  server.middlewares.use(async (req, res, next) => {\n    const url = parseRequestTarget(req.url || '/', 'http://localhost');\n    if (url.pathname !== DEV_MANIFEST_ENDPOINT && url.pathname !== basedEndpoint) return next();\n\n    const key = url.searchParams.get('key');\n    if (!key) {\n      res.statusCode = 400;\n      return res.end('Missing asset key');\n    }\n\n    try {\n      const registry: Record<string, DevAssetResolver> | undefined = (globalThis as any)[\n        Symbol.for(DEV_MANIFEST_REGISTRY_KEY)\n      ];\n      const resolver = registry?.[server.config.root];\n      if (!resolver) {\n        // A silent null strips the module's client assets from the SSR'd\n        // hydration asset map and hydration fails much later with a cryptic\n        // client-side error — report the miss where it happens.\n        console.error(\n          `[@solidjs/vite-plugin] The dev manifest registry has no resolver for root \"${server.config.root}\" ` +\n            `(requested asset key \"${key}\"). The module's client assets cannot be resolved and hydration ` +\n            'will fail for it. Typical causes: the dev server was not restarted after dependency changes, ' +\n            'or the install is stale.',\n        );\n      }\n      const assets = resolver ? await resolver.resolve(key) : null;\n      if (resolver && assets == null) {\n        console.error(\n          `[@solidjs/vite-plugin] Dev manifest resolver returned no assets for key \"${key}\" (root \"${server.config.root}\"). ` +\n            \"The module's hydration preload entry will be missing.\",\n        );\n      }\n      res.setHeader('content-type', 'application/json');\n      res.setHeader('cache-control', 'no-store');\n      return res.end(JSON.stringify(assets));\n    } catch (error) {\n      return next(error);\n    }\n  });\n}\n\n/**\n * The absolute URL isolated runners should fetch the bridge from, baked into\n * the dev flavor of `virtual:solid-manifest` when its code is generated.\n * Once the server is listening `resolvedUrls` carries the real origin (a\n * config-time define could only guess the port). Before that it returns\n * null and the manifest module defers the lookup (#414). Middleware-mode\n * servers have no origin of their own: null there too, and the manifest\n * module keeps the js-only fallback (registry hits are unaffected).\n */\nexport function devManifestBridgeUrl(server: ViteDevServer): string | null {\n  const local = server.resolvedUrls?.local?.[0];\n  let origin: string | null = null;\n  if (local) {\n    origin = new URL(local).origin;\n  } else if (!server.config.server.middlewareMode) {\n    const address = server.httpServer?.address();\n    if (address && typeof address === 'object') {\n      const https = !!server.config.server.https;\n      origin = `${https ? 'https' : 'http'}://localhost:${address.port}`;\n    }\n  }\n  if (!origin) return null;\n  const base = (server.config.base || '/').replace(/\\/$/, '');\n  return origin + base + DEV_MANIFEST_ENDPOINT;\n}\n\n// https://github.com/vitejs/vite/blob/main/packages/vite/src/node/constants.ts\nconst cssFileRegExp = /\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/;\n// Queried css imports (?url, ?inline, ?raw) are not ambient styles — the\n// importer controls them — so they must not be SSR'd as style tags.\nconst nonAmbientQueryRegExp = /[?&](url|inline|raw)\\b/;\n\nconst NULL_BYTE_PLACEHOLDER = '/@id/__x00__';\n\nfunction isCssModuleUrl(url: string): boolean {\n  return cssFileRegExp.test(url.split('?')[0]!) || isTsrxCssModule(url);\n}\n\n// Per Vite's convention virtual module ids are prefixed with `\\0`, which\n// cannot appear in an HTML attribute (the parser replaces it). Serialize the\n// same placeholder form Vite's own URLs use. Adoption of virtual-module\n// styles additionally needs `devStylePatch` (below) to run client-side;\n// fs-backed CSS (the overwhelmingly common case) adopts without it.\nfunction wrapId(id: string): string {\n  return id.replace(/^\\0/, NULL_BYTE_PLACEHOLDER);\n}\n\n/**\n * Inline dev script reconciling SSR'd style tags with Vite's HMR client.\n * Frameworks that server-render whole documents should inline this in dev,\n * in `<head>` before any module script. It does two things, via a\n * MutationObserver so styles appended by streamed boundaries are handled as\n * they arrive (Vite's client seeds its stylesheet registry from the DOM only\n * once, when its module evaluates):\n *\n * - Rewrites serialized virtual-module ids (`/@id/__x00__…`) back to Vite's\n *   null-byte form so seeding matches (a raw `\\0` can't survive HTML).\n * - Dedupes twins: a style tag that streams in after Vite's client has\n *   seeded is missed by the scan, so the CSS module injects its own copy\n *   client-side. Whenever two style tags share a `data-vite-dev-id`, the\n *   SSR'd one (marked `data-asset`) is removed in favor of the Vite-owned\n *   one, which is the tag HMR updates. When both are SSR'd (a stylesheet\n *   shared by the entry graph and a lazy component), the later one is\n *   removed so the sheet keeps its first position, as in production.\n *\n * Observation is two-phase to stay cheap: a document-wide subtree observer\n * only for the streaming window (SSR tags can only arrive while the parser\n * is consuming the stream; DOMContentLoaded marks its end), then a\n * childList-only observer on `document.head` for the page lifetime — Vite\n * injects twins into the head during hydration, which continues past\n * DOMContentLoaded, and a non-subtree head observer never fires on app DOM\n * churn, only on head insertions.\n *\n * Descends from SolidStart's PatchVirtualDevStyles (by @katywings); this\n * belongs in Vite itself eventually.\n */\nexport const devStylePatch = `(function(){var P=${JSON.stringify(\n  NULL_BYTE_PLACEHOLDER,\n)};var handle=function(el){var v=el.isConnected&&el.getAttribute(\"data-vite-dev-id\");if(!v)return;if(v.indexOf(P)===0){v=\"\\\\0\"+v.slice(P.length);el.setAttribute(\"data-vite-dev-id\",v)}var all=document.querySelectorAll(\"style[data-vite-dev-id]\");for(var i=0;i<all.length;i++){var o=all[i];if(o!==el&&o.getAttribute(\"data-vite-dev-id\")===v){var oa=o.hasAttribute(\"data-asset\"),ea=el.hasAttribute(\"data-asset\");var ssr=oa&&ea?(o.compareDocumentPosition(el)&4?el:o):oa?o:ea?el:null;if(ssr)ssr.remove();break}}};var scan=function(n){if(n.nodeType!==1)return;if(n.tagName===\"STYLE\")handle(n);else if(n.querySelectorAll)n.querySelectorAll(\"style[data-vite-dev-id]\").forEach(handle)};var onMuts=function(muts){for(var i=0;i<muts.length;i++)muts[i].addedNodes.forEach(scan)};var headPhase=function(){scan(document.documentElement);new MutationObserver(onMuts).observe(document.head,{childList:true})};scan(document.documentElement);if(document.readyState===\"loading\"){var mo=new MutationObserver(onMuts);mo.observe(document.documentElement,{childList:true,subtree:true});document.addEventListener(\"DOMContentLoaded\",function(){mo.disconnect();headPhase()})}else headPhase()})();`;\n\nasync function getModuleNode(\n  env: DevEnvironment,\n  file: string,\n  importer?: string,\n): Promise<EnvironmentModuleNode | undefined> {\n  try {\n    // fetchModule resolves through the plugin container with importer\n    // context, so dep strings that are placeholder-wrapped virtual URLs\n    // (`/@id/__x00__…`) or importer-relative specifiers land on the right\n    // module id — a raw moduleGraph/transformRequest lookup would miss them.\n    const resolved = await env.fetchModule(file, importer);\n    if (!('id' in resolved)) return;\n    return env.moduleGraph.getModuleById(resolved.id);\n  } catch {\n    return;\n  }\n}\n\nasync function collectModuleDeps(\n  env: DevEnvironment,\n  file: string,\n  deps: Set<EnvironmentModuleNode>,\n  crawled: Set<string>,\n  filter: DevStyleFilter,\n  onFile?: (file: string) => void,\n  importer?: string,\n): Promise<void> {\n  crawled.add(file);\n  const node = await getModuleNode(env, file, importer);\n  if (!node?.id || deps.has(node)) return;\n  deps.add(node);\n\n  const isCss = isCssModuleUrl(node.url);\n  if (!isCss && node.file && !node.id.startsWith('\\0') && !filter(node.file)) return;\n  if (node.file) onFile?.(node.file);\n  if (isCss) return;\n\n  if (!node.transformResult) {\n    await env.transformRequest(node.url).catch(() => {});\n  }\n  const directDeps = node.transformResult?.deps;\n  if (!directDeps) return;\n\n  // transformResult.deps (unlike importedModules) separates static imports\n  // from dynamicDeps — dynamic imports load their own styles when rendered.\n  for (const dep of directDeps) {\n    if (crawled.has(dep)) continue;\n    await collectModuleDeps(env, dep, deps, crawled, filter, onFile, node.id);\n  }\n}\n\nfunction injectQuery(url: string, query: string): string {\n  return url.includes('?') ? `${url}&${query}` : `${url}?${query}`;\n}\n\n/** Discovers ambient CSS in an entry graph without choosing how it is transported. */\nexport async function collectDevStyleSources(\n  env: DevEnvironment,\n  files: string[],\n  onFile?: (file: string) => void,\n  filter: DevStyleFilter = defaultStyleFilter,\n): Promise<DevStyleSource[]> {\n  const deps = new Set<EnvironmentModuleNode>();\n  const crawled = new Set<string>();\n  for (const file of files) {\n    await collectModuleDeps(env, file, deps, crawled, filter, onFile);\n  }\n\n  const css: DevStyleSource[] = [];\n  const seen = new Set<string>();\n  for (const node of deps) {\n    if (!node.id) continue;\n    if (!isCssModuleUrl(node.url) || nonAmbientQueryRegExp.test(node.url)) continue;\n    const id = wrapId(node.id);\n    if (seen.has(id)) continue;\n    seen.add(id);\n    css.push({ id, url: node.url });\n  }\n  return css;\n}\n\n/**\n * Walks the SSR module graph from `files` (root-relative or absolute) and\n * returns inline-style descriptors for every transitively imported CSS\n * module — the same shape the dev asset resolver answers with for lazy\n * modules. Used by SSR start mode's dev middleware to inline the root entry's\n * CSS into `<head>` so server-painted content is styled from the first byte\n * (no FOUC while waiting for Vite's client-side style injection).\n */\nexport async function collectDevStyles(\n  server: ViteDevServer,\n  files: string[],\n  filter: DevStyleFilter = defaultStyleFilter,\n): Promise<DevStyleDescriptor[]> {\n  const ssrEnv = server.environments?.ssr;\n  const clientEnv = server.environments?.client;\n  if (!ssrEnv || !clientEnv) return [];\n\n  const sources = await collectDevStyleSources(\n    ssrEnv,\n    files.map((file) => path.resolve(server.config.root, file)),\n    undefined,\n    filter,\n  );\n\n  const css: DevStyleDescriptor[] = [];\n  for (const source of sources) {\n    // `?direct` yields the compiled stylesheet text (what Vite serves for\n    // <link> requests) — through the client environment, whose css\n    // pipeline matches what the browser will run for HMR updates.\n    const result = await clientEnv\n      .transformRequest(injectQuery(source.url, 'direct'))\n      .catch(() => null);\n    if (result?.code == null) continue;\n    css.push({\n      id: source.id,\n      content: result.code,\n      attrs: { 'data-vite-dev-id': source.id },\n    });\n  }\n  return css;\n}\n\nfunction escapeAttr(value: string): string {\n  return value.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;');\n}\n\n/**\n * Serializes a dev style descriptor to the exact tag shape the SSR runtime\n * emits for lazy-registered assets (`data-asset` marks the SSR'd copy so\n * `devStylePatch` knows which twin to drop when Vite's client injects its\n * own), so the dedup story is identical for entry styles and lazy styles.\n */\nexport function renderDevStyleTag(desc: DevStyleDescriptor): string {\n  let attrs = '';\n  for (const name in desc.attrs) {\n    attrs += ` ${name}=\"${escapeAttr(String(desc.attrs![name]))}\"`;\n  }\n  const content = desc.content.replace(/<\\/(style)/gi, '<\\\\/$1');\n  return `<style data-asset=\"${escapeAttr(desc.id)}\"${attrs}>${content}</style>`;\n}\n\n/**\n * Module keys are project-root-relative (`src/Page.tsx`), but a hand-written\n * `lazy()` moduleUrl often carries a leading slash (`/src/Page.tsx`) — the\n * compiler only rewrites one- and two-argument calls, so the string reaches\n * the resolvers as written. Both spellings name the same module (#390).\n */\nexport function normalizeModuleKey(key: string): string {\n  return key.replace(/^\\/+/, '');\n}\n\n/**\n * Browser URL for a lazy module's dev asset key (a project-root-relative\n * path, query included when the module identity carries one). Vite only\n * serves module URLs under the configured `base`, so it is always applied;\n * root-external keys (`../…`, e.g. sibling workspace packages) can't be\n * expressed as root-relative URLs at all — they get Vite's `/@fs/` form on\n * the resolved absolute path instead. Mirrored by the generated fallback in\n * `devManifestCode` (src/index.ts) — keep the two in sync.\n */\nexport function devModuleUrl(root: string, base: string, key: string): string {\n  key = normalizeModuleKey(key);\n  const queryIndex = key.indexOf('?');\n  const file = queryIndex === -1 ? key : key.slice(0, queryIndex);\n  const query = queryIndex === -1 ? '' : key.slice(queryIndex);\n  if (!file.startsWith('..')) return joinBase(base, '/' + key);\n  const absolute = path.resolve(root, file).split(path.sep).join('/');\n  // Vite's fs URLs collapse the leading slash: /@fs/Users/… (and keep the\n  // drive letter on Windows: /@fs/C:/…).\n  return joinBase(base, '/@fs/' + absolute.replace(/^\\//, '') + query);\n}\n\nexport function createDevAssetResolver(\n  server: ViteDevServer,\n  filter: DevStyleFilter = defaultStyleFilter,\n): InvalidatableDevAssetResolver {\n  // Server-side lazy() re-requests a module's assets on every retry of a\n  // suspended render pass (retries re-create the component). The build\n  // manifest answers those repeats synchronously and the pass converges; an\n  // always-async resolver instead suspends every retry on a brand-new\n  // promise, so a pass whose retry path re-creates the lazy component (a\n  // nested route's outlet does) loops forever — each cycle nests one resume\n  // closure until the render stack overflows and the escaped rejection kills\n  // the dev server. So: dedupe in-flight walks per key and answer\n  // synchronously once a key's assets are known. Any watcher event drops the\n  // cache — the next request re-walks the updated module graph, keeping dev\n  // CSS fresh.\n  const resolved = new Map<string, ResolvedAssets>();\n  const pending = new Map<string, Promise<ResolvedAssets | null>>();\n  const { root, base } = server.config;\n  let generation = 0;\n  const invalidate = () => {\n    generation++;\n    resolved.clear();\n    pending.clear();\n  };\n  server.watcher.on('all', invalidate);\n\n  const resolve = function resolveDevAssets(\n    key: string,\n  ): ResolvedAssets | Promise<ResolvedAssets | null> {\n    key = normalizeModuleKey(key);\n    const cached = resolved.get(key);\n    if (cached) return cached;\n    let walk = pending.get(key);\n    if (!walk) {\n      const startedAt = generation;\n      walk = (async (): Promise<ResolvedAssets> => {\n        // The module's dev URL doubles as its client entry: modulepreload\n        // hint and hydration module-map value.\n        const js = [devModuleUrl(root, base, key)];\n        const css = await collectDevStyles(server, [key], filter);\n        return { js, css };\n      })().then(\n        (assets) => {\n          if (generation === startedAt) {\n            resolved.set(key, assets);\n            pending.delete(key);\n          }\n          return assets;\n        },\n        (error) => {\n          if (generation === startedAt) pending.delete(key);\n          throw error;\n        },\n      );\n      pending.set(key, walk);\n    }\n    return walk;\n  };\n  return {\n    invalidate,\n    resolve,\n    resolveSync: (key: string) =>\n      resolved.get(normalizeModuleKey(key)) ?? { js: [devModuleUrl(root, base, key)], css: [] },\n  };\n}\n","// Vite hook filters (`{ filter, handler }` hooks). Under Rolldown a hook\n// whose filter rejects a module is never called from Rust, so the plugin's\n// virtual-module hooks and transforms skip the JavaScript call for every\n// module they would only return null for. Each handler keeps its own\n// checks: a filter only has to let through everything the handler acts on.\n\nexport function escapeRegExp(value: string): string {\n  return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/** Matches exactly these ids. */\nexport function exactIds(...ids: string[]): RegExp {\n  return new RegExp(`^(?:${ids.map(escapeRegExp).join('|')})$`);\n}\n\n/** Matches ids with one of these extensions (leading dot optional), query allowed. */\nexport function extensionIds(extensions: string[]): RegExp {\n  const names = extensions.map((extension) => escapeRegExp(extension.replace(/^\\./, '')));\n  return new RegExp(`\\\\.(?:${names.join('|')})(?:$|\\\\?)`, 'i');\n}\n","import type { RunnableDevEnvironment } from 'vite';\n\n/**\n * Cross-instance-safe stand-in for vite's `isRunnableDevEnvironment`.\n *\n * Vite's helper is an `instanceof RunnableDevEnvironment` check against the\n * class of whichever `vite` module the CALLER imported. When this plugin is\n * consumed through a workspace/`link:` install, its own `vite` import can\n * resolve to a different physical copy than the one running the dev server —\n * and then the `instanceof` is false for every environment, silently standing\n * the SSR/dev middlewares down. The `runner` accessor is the type's defining\n * member (`RunnableDevEnvironment` is exactly \"a DevEnvironment with a\n * runner\"), so presence-check it instead of trusting class identity.\n */\nexport function isRunnableEnvironment(\n  environment: unknown,\n): environment is RunnableDevEnvironment {\n  return !!environment && typeof environment === 'object' && 'runner' in environment;\n}\n\nexport function getEnvironmentConsumer(\n  environment: unknown,\n  options?: { ssr?: boolean },\n): 'client' | 'server' {\n  const consumer = (environment as { config?: { consumer?: string } } | undefined)?.config\n    ?.consumer;\n  if (consumer === 'client' || consumer === 'server') return consumer;\n  return options?.ssr ? 'server' : 'client';\n}\n","import { type Plugin, withFilter } from 'vite';\nimport { exactIds } from './hook-filters.js';\nimport { getEnvironmentConsumer } from './environment';\n\nconst VIRTUAL_ID = '\\0@solidjs/vite-plugin:boundary-modules';\n\n/**\n * `server-only` and `client-only` marker modules: importing `server-only`\n * from a module bundled for the client fails the build at resolve time with\n * a descriptive error (and vice versa for `client-only`); in the allowed\n * environment the marker resolves to an empty module.\n *\n * Server-only code pulled into a client bundle otherwise ships silently and\n * crashes at runtime (in hydrating apps, typically as a cryptic hydration\n * failure far from the real cause) — the marker turns that into a build\n * error naming the importer.\n *\n * Always on (`enforce: 'pre'`), so the bare specifiers are claimed by this\n * plugin even when React's `server-only`/`client-only` npm packages are\n * installed — the environment semantics are the same, and claiming them\n * keeps the behavior deterministic and the errors identifiable as ours.\n */\nexport function boundaryModules(): Plugin {\n  const plugin: Plugin = {\n    name: 'solid:boundary-modules',\n    enforce: 'pre',\n    resolveId(id, importer, options) {\n      // The dep scanner (`vite:dep-scan`) crawls the client entries' RAW\n      // import graph — no directive transforms have run, so it walks\n      // straight through 'use server' modules into genuinely server-only\n      // code. That graph is legal once transforms split it, so the guard\n      // must not fire on the scan pass (`options.scan`, set by Rolldown's\n      // dependency scanner). Still claim the specifier: resolving to the empty\n      // virtual module keeps the scanner from chasing `server-only` /\n      // `client-only` as missing bare dependencies, which would abort the\n      // scan all the same. Real dev/build module graphs resolve without\n      // the flag and stay fully guarded.\n      const scan = !!(options as { scan?: boolean } | undefined)?.scan;\n      const server = getEnvironmentConsumer(this.environment, options) === 'server';\n      if (id === 'server-only') {\n        if (!server && !scan)\n          this.error(\n            `[@solidjs/vite-plugin] Attempt to import 'server-only' in a client module: ${importer}. ` +\n              `Code that uses this module must run only on the server — make sure it is only ` +\n              `imported by server code (e.g. a server entry, a \"use server\" module, or code ` +\n              `reached exclusively from them).`,\n          );\n      } else if (id === 'client-only') {\n        if (server && !scan)\n          this.error(\n            `[@solidjs/vite-plugin] Attempt to import 'client-only' in a server module: ${importer}. ` +\n              `Code that uses this module must run only in the browser — make sure it is only ` +\n              `imported by client code (e.g. behind a client-only lazy boundary).`,\n          );\n      } else {\n        return null;\n      }\n      return VIRTUAL_ID;\n    },\n    load(id) {\n      if (id === VIRTUAL_ID) return 'export {}';\n    },\n  };\n  // Hook filters (src/hook-filters.ts).\n  withFilter(plugin, {\n    resolveId: { id: exactIds('server-only', 'client-only') },\n    load: { id: exactIds(VIRTUAL_ID) },\n  });\n  return plugin;\n}\n","/**\n * Agent diagnostics surface (dev serve only).\n *\n * Enabled automatically when the app declares `@solidjs/diagnostics` in\n * its package.json (the `diagnostics` option overrides: `true` forces it\n * on and errors if the package is missing, `false` opts out entirely).\n *\n * Three pieces:\n * - an injected client module (virtual, imported by index.html or the\n *   start-mode client entry) that installs the in-page bridge from the\n *   app's own `@solidjs/diagnostics` and answers requests over Vite's\n *   WebSocket custom events;\n * - a collector that forwards requests to the page and correlates\n *   responses by id;\n * - an HTTP endpoint (`/__solid/diagnostics`) fronting that round-trip so\n *   any out-of-process consumer (agent, MCP tool, curl) can drive capture\n *   sessions without holding a WebSocket.\n *\n * `@solidjs/diagnostics` is deliberately a type-only dependency of this\n * plugin: the runtime bridge always comes from the app's own installed\n * copy, so plugin releases and diagnostics releases stay uncoupled. The\n * wire constants are re-declared here with types imported from the\n * package, so drift fails the plugin's own compile.\n */\nimport fs from 'fs';\nimport path from 'path';\nimport type { IncomingMessage, ServerResponse } from 'http';\nimport { type Plugin, withFilter } from 'vite';\nimport { escapeRegExp, exactIds } from '../hook-filters.js';\nimport { joinBase } from '../http.js';\n\ntype Protocol = typeof import('@solidjs/diagnostics/protocol');\nconst DIAGNOSTICS_ENDPOINT: Protocol['DIAGNOSTICS_ENDPOINT'] = '/__solid/diagnostics';\nconst REQUEST_EVENT: Protocol['DIAGNOSTICS_REQUEST_EVENT'] = 'solid:diagnostics:request';\nconst RESPONSE_EVENT: Protocol['DIAGNOSTICS_RESPONSE_EVENT'] = 'solid:diagnostics:response';\n\ntype DiagnosticsResponse = import('@solidjs/diagnostics/protocol').DiagnosticsResponse;\n\nexport const DIAGNOSTICS_PACKAGE = '@solidjs/diagnostics';\nexport const DIAGNOSTICS_CLIENT_ID = 'virtual:solid-diagnostics/client';\n\nconst METHODS = ['begin', 'end', 'active', 'whyDidRun', 'costs'] as const satisfies readonly (\n  | import('@solidjs/diagnostics/protocol').DiagnosticsMethod\n)[];\n\n/** How long the endpoint waits for a page to answer before failing the call. */\nconst RESPONSE_TIMEOUT_MS = 10_000;\n\n/**\n * Whether the app *declares* `@solidjs/diagnostics` — the auto-enable\n * signal. Declaration in the nearest package.json (walking up from the\n * Vite root, so a `client/` root still finds the app manifest) rather\n * than node_modules presence: presence-based detection escapes the app\n * into ancestor installs, which surprise-enables the surface for every\n * fixture app inside a monorepo that happens to have the package\n * somewhere above it (this broke the plugin's own example suites). A\n * declared dependency is unambiguous intent, and resolution then works\n * regardless of hoisting. `diagnostics: true` remains the override for\n * setups the heuristic can't see.\n */\nexport function detectDiagnosticsPackage(root: string): boolean {\n  let dir = path.resolve(root);\n  while (true) {\n    const manifestPath = path.join(dir, 'package.json');\n    if (fs.existsSync(manifestPath)) {\n      try {\n        const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as Record<\n          string,\n          Record<string, string> | undefined\n        >;\n        return !!(\n          manifest.dependencies?.[DIAGNOSTICS_PACKAGE] ??\n          manifest.devDependencies?.[DIAGNOSTICS_PACKAGE] ??\n          manifest.optionalDependencies?.[DIAGNOSTICS_PACKAGE]\n        );\n      } catch {\n        return false;\n      }\n    }\n    const parent = path.dirname(dir);\n    if (parent === dir) return false;\n    dir = parent;\n  }\n}\n\nexport function diagnosticsClientModuleCode(): string {\n  // Runtime imports resolve to the APP's diagnostics package (see the\n  // resolveId assist below) — the page speaks its own package's protocol.\n  return [\n    `import { installDiagnosticsBridge } from '${DIAGNOSTICS_PACKAGE}/browser';`,\n    `import {`,\n    `  DIAGNOSTICS_REQUEST_EVENT,`,\n    `  DIAGNOSTICS_RESPONSE_EVENT,`,\n    `} from '${DIAGNOSTICS_PACKAGE}/protocol';`,\n    ``,\n    `const bridge = installDiagnosticsBridge();`,\n    ``,\n    `async function dispatch(request) {`,\n    `  switch (request.method) {`,\n    `    case 'begin': bridge.begin(request.params); return true;`,\n    `    case 'end': return bridge.end();`,\n    `    case 'active': return bridge.active();`,\n    `    case 'whyDidRun': return bridge.whyDidRun(request.params.name);`,\n    `    case 'costs': return bridge.costs();`,\n    `    default: throw new Error('Unknown diagnostics method: ' + request.method);`,\n    `  }`,\n    `}`,\n    ``,\n    `if (import.meta.hot) {`,\n    `  import.meta.hot.on(DIAGNOSTICS_REQUEST_EVENT, async (request) => {`,\n    `    let response;`,\n    `    try {`,\n    `      response = { id: request.id, result: await dispatch(request) };`,\n    `    } catch (error) {`,\n    `      response = {`,\n    `        id: request.id,`,\n    `        error: error instanceof Error ? error.message : String(error),`,\n    `      };`,\n    `    }`,\n    `    import.meta.hot.send(DIAGNOSTICS_RESPONSE_EVENT, response);`,\n    `  });`,\n    `}`,\n  ].join('\\n');\n}\n\nfunction sendJson(res: ServerResponse, status: number, body: unknown): void {\n  res.statusCode = status;\n  res.setHeader('Content-Type', 'application/json');\n  res.end(JSON.stringify(body));\n}\n\nfunction readJsonBody(req: IncomingMessage): Promise<unknown> {\n  return new Promise((resolve, reject) => {\n    const chunks: Buffer[] = [];\n    req.on('data', (chunk) => chunks.push(chunk));\n    req.on('end', () => {\n      const text = Buffer.concat(chunks).toString('utf8');\n      if (!text) return resolve({});\n      try {\n        resolve(JSON.parse(text));\n      } catch {\n        reject(new Error('Request body is not valid JSON'));\n      }\n    });\n    req.on('error', reject);\n  });\n}\n\nexport function solidDiagnostics(mode: true | 'auto' = 'auto'): Plugin {\n  let root = process.cwd();\n  let base = '/';\n  // Resolved at configResolved: explicit `true` is unconditional (missing\n  // package becomes a hard error at bridge resolution); `'auto'` enables\n  // only when the app has the package installed.\n  let enabled = mode === true;\n\n  const plugin: Plugin = {\n    name: 'solid:diagnostics',\n    // Dev-serve only: the channels this fronts exist in dev builds only.\n    // Test mode excluded — vitest (including browser mode) runs a dev\n    // serve, and injecting the bridge into test pages perturbs suites\n    // that never asked for it.\n    apply(_config, env) {\n      return env.command === 'serve' && !env.isPreview && env.mode !== 'test';\n    },\n\n    // The bridge module is virtual and reaches the page behind the\n    // scanner's back (a script injected into index.html at transform time,\n    // or an import the generated start entry adds), so the optimizer never\n    // sees its two package imports up front. Pre-bundle them: otherwise the\n    // first page load discovers them, re-optimizes and full-reloads — a\n    // flash at best, and a broken page whenever anything else on the page\n    // was resolved against the first optimizer pass.\n    config(userConfig) {\n      const rootDir = path.resolve(userConfig.root || process.cwd());\n      if (mode !== true && !detectDiagnosticsPackage(rootDir)) return;\n      return {\n        optimizeDeps: {\n          include: [`${DIAGNOSTICS_PACKAGE}/browser`, `${DIAGNOSTICS_PACKAGE}/protocol`],\n        },\n      };\n    },\n\n    configResolved(config) {\n      root = config.root;\n      base = config.base;\n      if (mode === 'auto') enabled = detectDiagnosticsPackage(root);\n    },\n\n    async resolveId(source, importer) {\n      if (source === DIAGNOSTICS_CLIENT_ID) {\n        return { id: DIAGNOSTICS_CLIENT_ID, moduleSideEffects: true };\n      }\n      // The virtual module has no directory to resolve bare imports from;\n      // resolve the app's diagnostics package from the project root.\n      if (importer === DIAGNOSTICS_CLIENT_ID && source.startsWith(DIAGNOSTICS_PACKAGE)) {\n        const resolved = await this.resolve(source, path.resolve(root, 'index.html'), {\n          skipSelf: true,\n        });\n        if (!resolved || resolved.id.startsWith('__vite-optional-peer-dep:')) {\n          this.error(\n            `[@solidjs/vite-plugin] the diagnostics surface requires ${DIAGNOSTICS_PACKAGE} ` +\n              'installed in the app (it provides the in-page bridge). Install it as a ' +\n              'development dependency, or set `diagnostics: false` to opt out.',\n          );\n        }\n        return resolved;\n      }\n      return null;\n    },\n\n    load(id) {\n      if (id === DIAGNOSTICS_CLIENT_ID) return diagnosticsClientModuleCode();\n      return null;\n    },\n\n    // Plain (index.html) apps get the client module injected here;\n    // start-mode apps import it from the generated client entry instead.\n    transformIndexHtml() {\n      if (!enabled) return undefined;\n      return [\n        {\n          tag: 'script',\n          attrs: { type: 'module', src: joinBase(base, '/@id/' + DIAGNOSTICS_CLIENT_ID) },\n          injectTo: 'head' as const,\n        },\n      ];\n    },\n\n    configureServer(server) {\n      // The whole surface (announcement, middleware, bridge injection) only\n      // exists when enabled, so the discovery breadcrumb never lies about\n      // a dead endpoint.\n      if (!enabled) return;\n\n      // Announce the surface in the startup block. This is a discovery\n      // channel: agents watching dev-server output learn the endpoint and\n      // the skill documents without any project-level pointer (AGENTS.md).\n      const originalPrintUrls = server.printUrls.bind(server);\n      server.printUrls = () => {\n        originalPrintUrls();\n        const local = server.resolvedUrls?.local[0];\n        const endpoint = local\n          ? new URL(DIAGNOSTICS_ENDPOINT, local).href\n          : DIAGNOSTICS_ENDPOINT;\n        server.config.logger.info(\n          `  ➜  Solid diagnostics: ${endpoint} ` +\n            `(GET status; POST {\"method\":\"begin\"|\"end\"|\"whyDidRun\"|\"costs\"})` +\n            (mode === 'auto' ? ' — auto-enabled; `diagnostics: false` opts out' : '') +\n            `\\n  ➜  Agent skills: node_modules/${DIAGNOSTICS_PACKAGE}/skills/agent-loops/SKILL.md, ` +\n            `node_modules/solid-js/skills/reactivity-diagnostics/SKILL.md`,\n        );\n      };\n\n      interface Pending {\n        resolve: (response: DiagnosticsResponse) => void;\n        timer: ReturnType<typeof setTimeout>;\n      }\n      const pending = new Map<number, Pending>();\n      let nextId = 1;\n\n      server.ws.on(RESPONSE_EVENT, (data: DiagnosticsResponse) => {\n        const entry = pending.get(data?.id as number);\n        if (!entry) return;\n        pending.delete(data.id);\n        clearTimeout(entry.timer);\n        entry.resolve(data);\n      });\n\n      // No host/origin validation here: on all supported Vite versions\n      // (peer range ^8) Vite's own DNS-rebinding host check runs ahead of\n      // plugin middleware — verified: requests with a disallowed Host\n      // header get Vite's 403 before reaching this handler.\n      server.middlewares.use(DIAGNOSTICS_ENDPOINT, async (req, res) => {\n        // The middleware mounts on the exact path; anything deeper is 404.\n        if (req.url && req.url !== '/' && req.url !== '') {\n          sendJson(res, 404, { error: `Unknown diagnostics path ${req.url}` });\n          return;\n        }\n        if (req.method === 'GET') {\n          sendJson(res, 200, {\n            ok: true,\n            methods: METHODS,\n            clients: server.ws.clients.size,\n          });\n          return;\n        }\n        if (req.method !== 'POST') {\n          sendJson(res, 405, { error: 'Use GET for status or POST { method, params }' });\n          return;\n        }\n\n        let body: { method?: string; params?: unknown };\n        try {\n          body = (await readJsonBody(req)) as { method?: string; params?: unknown };\n        } catch (error) {\n          sendJson(res, 400, { error: (error as Error).message });\n          return;\n        }\n        if (!body.method || !(METHODS as readonly string[]).includes(body.method)) {\n          sendJson(res, 400, {\n            error: `Unknown method ${JSON.stringify(body.method)}; expected one of: ${METHODS.join(', ')}`,\n          });\n          return;\n        }\n        if (server.ws.clients.size === 0) {\n          sendJson(res, 503, {\n            error:\n              'No connected page. Open the app in a browser (dev server) so the ' +\n              'diagnostics bridge can answer.',\n          });\n          return;\n        }\n\n        const id = nextId++;\n        // Broadcast; with several open tabs the first responder wins. Good\n        // enough for the agent loop (one page under test); revisit with\n        // client targeting if multi-page capture ever matters.\n        const response = await new Promise<DiagnosticsResponse | { timeout: string }>(\n          (resolve) => {\n            const timer = setTimeout(() => {\n              pending.delete(id);\n              resolve({\n                timeout:\n                  `No page answered within ${RESPONSE_TIMEOUT_MS}ms. The connected page ` +\n                  'may predate `diagnostics: true` — reload it.',\n              });\n            }, RESPONSE_TIMEOUT_MS);\n            pending.set(id, { resolve, timer });\n            server.ws.send(REQUEST_EVENT, { id, method: body.method, params: body.params });\n          },\n        );\n\n        if ('timeout' in response) {\n          sendJson(res, 504, { error: response.timeout });\n        } else if (response.error !== undefined) {\n          sendJson(res, 400, { error: response.error });\n        } else {\n          sendJson(res, 200, { result: response.result });\n        }\n      });\n    },\n  };\n  // Hook filters (src/hook-filters.ts).\n  withFilter(plugin, {\n    resolveId: {\n      id: [exactIds(DIAGNOSTICS_CLIENT_ID), new RegExp(`^${escapeRegExp(DIAGNOSTICS_PACKAGE)}`)],\n    },\n    load: { id: exactIds(DIAGNOSTICS_CLIENT_ID) },\n  });\n  return plugin;\n}\n","/**\n * Chrome Performance panel tracks, on by default under `vite dev`.\n *\n * `@solidjs/web/performance-tracks` paints Solid's records — re-runs,\n * interactions, holds, async flights, navigations, server-function calls —\n * as custom tracks in the Performance panel. It has to be enabled before\n * the app renders or hydrates for the first paint and the first\n * interaction to be on the timeline (and for the dev component wrapper to\n * capture each component's JSX site while an attribution engine is\n * installed), so the plugin injects a small virtual module that calls\n * `enablePerformanceTracks(<options>)` ahead of the client entry, the same\n * way the diagnostics bridge reaches the page:\n * - plain (index.html) apps: a `<script type=\"module\">` prepended to\n *   `<head>` by `transformIndexHtml` (module scripts run in document order,\n *   so it evaluates before the app's own entry script);\n * - start mode: an import the generated client entry emits, or the\n *   authored client entry is given, ahead of every other import (see\n *   `src/ssr/index.ts`).\n *\n * Dev serve only, by decision: the tracks are a dev-server feature. Never\n * on `vite build` — not for `dev: true` builds, not for `observe` builds\n * (an observe app that wants tracks in production calls\n * `enablePerformanceTracks()` itself); never in test mode (vitest runs a\n * dev serve) or preview.\n *\n * The server needs nothing from this plugin: the dev server runtime writes\n * the request's timed work as `Server-Timing` metrics on its own\n * (`solid-shell`, `solid-boundary`, `solid-invocation` — `@solidjs/web`'s\n * `server.ts`, the trace context appended before the head freezes), and the\n * adapter in the page reads them back onto the `Server` track.\n *\n * `@solidjs/web` is the app's peer: the runtime import always resolves to\n * the app's own copy (the resolveId assist below), so the tracks share the\n * `@solidjs/signals` core the app renders with.\n */\nimport fs from 'fs';\nimport path from 'path';\nimport { type Plugin, withFilter } from 'vite';\nimport { exactIds } from '../hook-filters.js';\nimport type { PerformanceTracksOptions } from '@solidjs/web/performance-tracks';\nimport { joinBase } from '../http.js';\n\nexport const PERFORMANCE_TRACKS_PACKAGE = '@solidjs/web/performance-tracks';\nexport const PERFORMANCE_TRACKS_CLIENT_ID = 'virtual:solid-performance-tracks';\n\n/** The plugin option: `true`/omitted enables with defaults, an object passes options through, `false` opts out. */\nexport type PerformanceTracksOption = boolean | PerformanceTracksOptions;\n\n/**\n * The options the injected module enables the tracks with, or `null` when\n * the option opts out. Omitted and `true` are the adapter's defaults.\n */\nexport function resolvePerformanceTracksOptions(\n  option: PerformanceTracksOption | undefined,\n): PerformanceTracksOptions | null {\n  if (option === false) return null;\n  if (option === true || option === undefined) return {};\n  return option;\n}\n\n/**\n * Whether the app's `@solidjs/web` exports the `./performance-tracks`\n * subpath. The peer range (^2.0.0-rc.10) always has it, so this should be\n * unreachable — but an app pinned outside the range would otherwise get a\n * broken page (an unresolvable import in the entry) instead of a warning.\n * Located the way Vite resolves a bare package — `node_modules/@solidjs/web`\n * walking up from the root — and read off the manifest's `exports` map\n * directly, so no resolver condition (`node`, `browser`, `development`)\n * colours the answer. A package that can't be found at all is reported as\n * present: `@solidjs/web` is the runtime the app renders with, and its\n * absence is Vite's clear error to give, not this plugin's to guess at.\n */\nexport function detectPerformanceTracksSubpath(root: string): boolean {\n  let dir = path.resolve(root);\n  while (true) {\n    const manifestPath = path.join(dir, 'node_modules', '@solidjs', 'web', 'package.json');\n    if (fs.existsSync(manifestPath)) {\n      try {\n        const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as {\n          exports?: Record<string, unknown>;\n        };\n        return (\n          !!manifest.exports &&\n          Object.prototype.hasOwnProperty.call(manifest.exports, './performance-tracks')\n        );\n      } catch {\n        return false;\n      }\n    }\n    const parent = path.dirname(dir);\n    if (parent === dir) return true;\n    dir = parent;\n  }\n}\n\n/**\n * The injected module. Options are plain data only (`minMs`, `rich`, and\n * `attribution`'s thresholds/levels — every field of `PerformanceTracksOptions`\n * is a number, boolean, string literal or a plain object of those), so they\n * serialize as JSON into the call. A second evaluation of this module (an\n * HMR re-import of the entry) joins the running instance: the adapter keeps\n * one painter per page.\n */\nexport function performanceTracksClientModuleCode(options: PerformanceTracksOptions): string {\n  return [\n    `import { enablePerformanceTracks } from '${PERFORMANCE_TRACKS_PACKAGE}';`,\n    ``,\n    `enablePerformanceTracks(${JSON.stringify(options)});`,\n  ].join('\\n');\n}\n\nexport function solidPerformanceTracks(options: PerformanceTracksOptions): Plugin {\n  let root = process.cwd();\n  let base = '/';\n  // Resolved at configResolved: the installed `@solidjs/web` must export\n  // the subpath the injected module imports.\n  let enabled = false;\n\n  const plugin: Plugin = {\n    name: 'solid:performance-tracks',\n    // Dev-serve only (see the module comment). Test mode excluded for the\n    // same reason as the diagnostics surface: vitest runs a dev serve, and\n    // an engine hold taken in test pages perturbs suites that never asked\n    // for it.\n    apply(_config, env) {\n      return env.command === 'serve' && !env.isPreview && env.mode !== 'test';\n    },\n\n    configResolved(config) {\n      root = config.root;\n      base = config.base;\n      enabled = detectPerformanceTracksSubpath(root);\n      if (!enabled) {\n        config.logger.warn(\n          `[@solidjs/vite-plugin] the installed @solidjs/web does not export ${PERFORMANCE_TRACKS_PACKAGE} ` +\n            '(added in 2.0.0-rc.10); the Chrome Performance panel tracks are not enabled. ' +\n            'Update @solidjs/web, or set `performanceTracks: false` to silence this warning.',\n        );\n      }\n    },\n\n    // `@solidjs/web/performance-tracks` is already in `optimizeDeps.include`\n    // under serve (the main plugin adds it alongside `solid-js/attribution`,\n    // whether or not this module imports it), so the virtual module's import\n    // — which reaches the page behind the scanner's back — is pre-bundled\n    // in the first optimizer pass and shares the app's `@solidjs/signals`\n    // core.\n    async resolveId(source, importer) {\n      if (source === PERFORMANCE_TRACKS_CLIENT_ID) {\n        return { id: PERFORMANCE_TRACKS_CLIENT_ID, moduleSideEffects: true };\n      }\n      // The virtual module has no directory to resolve bare imports from;\n      // resolve the app's `@solidjs/web` from the project root.\n      if (importer === PERFORMANCE_TRACKS_CLIENT_ID && source === PERFORMANCE_TRACKS_PACKAGE) {\n        return this.resolve(source, path.resolve(root, 'index.html'), { skipSelf: true });\n      }\n      return null;\n    },\n\n    load(id) {\n      if (id === PERFORMANCE_TRACKS_CLIENT_ID) return performanceTracksClientModuleCode(options);\n      return null;\n    },\n\n    // Plain (index.html) apps get the module injected here; start-mode apps\n    // import it from the client entry instead (generated or authored). Head\n    // *prepend*, unlike the diagnostics bridge's `head`: this module has an\n    // ordering requirement — it must evaluate before the app's entry module\n    // (wherever that script sits in the document) so the render/hydration\n    // is on the timeline. Module scripts execute in document order.\n    transformIndexHtml() {\n      if (!enabled) return undefined;\n      return [\n        {\n          tag: 'script',\n          attrs: { type: 'module', src: joinBase(base, '/@id/' + PERFORMANCE_TRACKS_CLIENT_ID) },\n          injectTo: 'head-prepend' as const,\n        },\n      ];\n    },\n  };\n  // Hook filters (src/hook-filters.ts).\n  withFilter(plugin, {\n    resolveId: { id: exactIds(PERFORMANCE_TRACKS_CLIENT_ID, PERFORMANCE_TRACKS_PACKAGE) },\n    load: { id: exactIds(PERFORMANCE_TRACKS_CLIENT_ID) },\n  });\n  return plugin;\n}\n","import { rmdirSync, rmSync } from 'fs';\nimport path from 'path';\n\n/**\n * Removes a build-only file from the client output once a server build in\n * the same process has read it, and its `.vite/` directory when nothing else\n * is left there. Hosts may publish the whole client output (#511).\n */\nexport function removeClientBuildFile(file: string): void {\n  rmSync(file, { force: true });\n  try {\n    rmdirSync(path.dirname(file));\n  } catch {\n    // Not empty, or already gone.\n  }\n}\n","// The `\"use server\"` directive compiler. This wraps the native\n// `transformDirectives` pass from @solidjs/compiler (Rust/Oxc); the\n// original Babel implementation (hoisted from solid-start) lived in this\n// directory through vite-plugin-solid@c052963e and remains the frozen\n// reference for the native pass's fixture suite.\n\nexport interface NamedImportDefinition {\n  kind: 'named';\n  name: string;\n  source: string;\n}\n\nexport interface DefaultImportDefinition {\n  kind: 'default';\n  source: string;\n}\n\nexport type ImportDefinition = DefaultImportDefinition | NamedImportDefinition;\n\nexport interface CompileOptions {\n  mode: 'server' | 'client';\n  env: 'production' | 'development';\n  /** The directive text (default \"use server\" upstream). */\n  directive: string;\n  /** Project root; function IDs hash the root-relative path. */\n  root: string;\n  /** Whether to emit a map for this pass. Defaults to true. */\n  sourceMap?: boolean;\n  definitions: {\n    register: ImportDefinition;\n    create: ImportDefinition;\n  };\n}\n\nexport interface CompileResult {\n  valid: boolean;\n  code: string;\n  map: string | null;\n  functions: import('@solidjs/compiler').ServerFunctionMeta[];\n}\n\ntype NativeCompiler = typeof import('@solidjs/compiler');\nlet compilerPromise: Promise<NativeCompiler> | undefined;\n\n// Loaded lazily so importing the plugin never pays for the native binding —\n// only setups that enable server functions load it (mirrors the JSX\n// compiler's opt-in loader in index.ts).\nasync function loadCompiler(): Promise<NativeCompiler> {\n  try {\n    return await (compilerPromise ??= import('@solidjs/compiler'));\n  } catch (error) {\n    compilerPromise = undefined;\n    const reason = error instanceof Error ? `\\n\\nCause: ${error.message}` : '';\n    throw new Error(\n      '@solidjs/vite-plugin: failed to load @solidjs/compiler (the \"use server\" ' +\n        'transform). Your platform should get a prebuilt native binary or the ' +\n        '@solidjs/compiler-wasm32-wasi fallback — check that optional ' +\n        'dependencies were installed.' +\n        reason,\n    );\n  }\n}\n\n/**\n * Runs the directive transform over one module. Function IDs are\n * `hash(relative path)-<counter>`, so the client and server builds of the\n * same checkout agree on every ID (the wire contract) without baking\n * machine-specific absolute paths into the output. A `valid: false` result\n * means the module contained no matching directive and must be left\n * untransformed. Invalid closure captures (a server function referencing a\n * non-top-level binding) throw with the variable name and location.\n */\nexport async function compile(\n  id: string,\n  code: string,\n  options: CompileOptions,\n): Promise<CompileResult> {\n  const { transformDirectives } = await loadCompiler();\n  const result = transformDirectives(code, {\n    filename: id,\n    root: options.root,\n    mode: options.mode,\n    env: options.env,\n    directive: options.directive,\n    sourceMap: options.sourceMap !== false,\n    register: options.definitions.register,\n    create: options.definitions.create,\n  });\n  return {\n    valid: result.valid,\n    code: result.code,\n    map: result.map ?? null,\n    functions: result.functions,\n  };\n}\n","// Stylesheets below a `'use server'` boundary, for the client build (#456).\n//\n// The client compile replaces a server module with references, so nothing it\n// imported reaches the client graph: a server component's stylesheet gets no\n// client asset and the SSR document links nothing for it. Dev never notices,\n// since its CSS crawl walks the SSR graph. The walk below finds what the\n// module reaches in the client environment and returns those stylesheets for\n// the client module to import. Script modules are only loaded (which runs\n// their transforms, so compile-time CSS such as StyleX records its rules),\n// never imported, so no server code joins the client bundle.\n\nimport { isTsrxCssModule } from '../tsrx.js';\n\nconst cssFileRegExp = /\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/;\n// The importer controls a queried stylesheet; it is not an ambient style.\nconst nonAmbientQueryRegExp = /[?&](url|inline|raw)\\b/;\n\nconst isStylesheet = (id: string) =>\n  (cssFileRegExp.test(id.split('?')[0]!) || isTsrxCssModule(id)) && !nonAmbientQueryRegExp.test(id);\n\n/** The module's runtime import specifiers (type-only ones dropped). */\nfunction importSources(ctx: any, code: string): string[] {\n  let program;\n  try {\n    program = ctx.parse(code, { lang: 'tsx' });\n  } catch {\n    return [];\n  }\n  const sources: string[] = [];\n  for (const node of program.body) {\n    if (\n      (node.type === 'ImportDeclaration' ||\n        node.type === 'ExportNamedDeclaration' ||\n        node.type === 'ExportAllDeclaration') &&\n      node.source &&\n      node.importKind !== 'type' &&\n      node.exportKind !== 'type'\n    ) {\n      sources.push(node.source.value);\n    }\n  }\n  return sources;\n}\n\n/** Side-effect imports of the stylesheets a server module reaches. */\nexport async function serverModuleStyles(ctx: any, id: string, code: string): Promise<string> {\n  const seen = new Set([id]);\n  const styles = new Set<string>();\n  const visit = async (resolved: string) => {\n    if (seen.has(resolved)) return;\n    seen.add(resolved);\n    if (isStylesheet(resolved)) {\n      styles.add(resolved);\n      return;\n    }\n    let info;\n    try {\n      info = await ctx.load({ id: resolved });\n    } catch {\n      // A module the client environment can't load has no client styles.\n      return;\n    }\n    for (const next of info?.importedIds ?? []) await visit(next);\n  };\n  for (const source of importSources(ctx, code)) {\n    const resolved = await ctx.resolve(source, id).catch(() => null);\n    if (resolved && !resolved.external) await visit(resolved.id);\n  }\n  let out = '';\n  for (const style of styles) out += `\\nimport ${JSON.stringify(style)};`;\n  return out;\n}\n","// @ts-nocheck\n/**\n * Hoisted from solid-start (packages/start/src/directives/xxhash32.ts).\n *\n * Copyright (c) 2019 Jason Dent\n * https://github.com/Jason3S/xxhash\n */\nconst PRIME32_1 = 2654435761;\nconst PRIME32_2 = 2246822519;\nconst PRIME32_3 = 3266489917;\nconst PRIME32_4 = 668265263;\nconst PRIME32_5 = 374761393;\n\nfunction toUtf8(text: string): Uint8Array {\n  const bytes: number[] = [];\n  for (let i = 0, n = text.length; i < n; ++i) {\n    const c = text.charCodeAt(i);\n    if (c < 0x80) {\n      bytes.push(c);\n    } else if (c < 0x800) {\n      bytes.push(0xc0 | (c >> 6), 0x80 | (c & 0x3f));\n    } else if (c < 0xd800 || c >= 0xe000) {\n      bytes.push(0xe0 | (c >> 12), 0x80 | ((c >> 6) & 0x3f), 0x80 | (c & 0x3f));\n    } else {\n      const cp = 0x10000 + (((c & 0x3ff) << 10) | (text.charCodeAt(++i) & 0x3ff));\n      bytes.push(\n        0xf0 | ((cp >> 18) & 0x7),\n        0x80 | ((cp >> 12) & 0x3f),\n        0x80 | ((cp >> 6) & 0x3f),\n        0x80 | (cp & 0x3f),\n      );\n    }\n  }\n  return new Uint8Array(bytes);\n}\n\n/**\n * @param buffer - byte array or string\n * @param seed - optional seed (32-bit unsigned)\n */\nexport default function xxHash32(buffer: Uint8Array | string, seed = 0): number {\n  buffer = typeof buffer === 'string' ? toUtf8(buffer) : buffer;\n  const b = buffer;\n\n  // Step 1. Initialize internal accumulators\n  let acc = (seed + PRIME32_5) & 0xffffffff;\n  let offset = 0;\n\n  if (b.length >= 16) {\n    const accN = [\n      (seed + PRIME32_1 + PRIME32_2) & 0xffffffff,\n      (seed + PRIME32_2) & 0xffffffff,\n      (seed + 0) & 0xffffffff,\n      (seed - PRIME32_1) & 0xffffffff,\n    ];\n\n    // Step 2. Process stripes (16 bytes = 4 lanes of 4 bytes)\n    const b = buffer;\n    const limit = b.length - 16;\n    let lane = 0;\n    for (offset = 0; (offset & 0xfffffff0) <= limit; offset += 4) {\n      const i = offset;\n      const laneN0 = b[i + 0] + (b[i + 1] << 8);\n      const laneN1 = b[i + 2] + (b[i + 3] << 8);\n      const laneNP = laneN0 * PRIME32_2 + ((laneN1 * PRIME32_2) << 16);\n      let acc = (accN[lane] + laneNP) & 0xffffffff;\n      acc = (acc << 13) | (acc >>> 19);\n      const acc0 = acc & 0xffff;\n      const acc1 = acc >>> 16;\n      accN[lane] = (acc0 * PRIME32_1 + ((acc1 * PRIME32_1) << 16)) & 0xffffffff;\n      lane = (lane + 1) & 0x3;\n    }\n\n    // Step 3. Accumulator convergence\n    acc =\n      (((accN[0] << 1) | (accN[0] >>> 31)) +\n        ((accN[1] << 7) | (accN[1] >>> 25)) +\n        ((accN[2] << 12) | (accN[2] >>> 20)) +\n        ((accN[3] << 18) | (accN[3] >>> 14))) &\n      0xffffffff;\n  }\n\n  // Step 4. Add input length\n  acc = (acc + buffer.length) & 0xffffffff;\n\n  // Step 5. Consume remaining input (up to 15 bytes)\n  const limit = buffer.length - 4;\n  for (; offset <= limit; offset += 4) {\n    const i = offset;\n    const laneN0 = b[i + 0] + (b[i + 1] << 8);\n    const laneN1 = b[i + 2] + (b[i + 3] << 8);\n    const laneP = laneN0 * PRIME32_3 + ((laneN1 * PRIME32_3) << 16);\n    acc = (acc + laneP) & 0xffffffff;\n    acc = (acc << 17) | (acc >>> 15);\n    acc = ((acc & 0xffff) * PRIME32_4 + (((acc >>> 16) * PRIME32_4) << 16)) & 0xffffffff;\n  }\n\n  for (; offset < b.length; ++offset) {\n    const lane = b[offset];\n    acc += lane * PRIME32_5;\n    acc = (acc << 11) | (acc >>> 21);\n    acc = ((acc & 0xffff) * PRIME32_1 + (((acc >>> 16) * PRIME32_1) << 16)) & 0xffffffff;\n  }\n\n  // Step 6. Final mix (avalanche)\n  acc ^= acc >>> 15;\n  acc = (((acc & 0xffff) * PRIME32_2) & 0xffffffff) + (((acc >>> 16) * PRIME32_2) << 16);\n  acc ^= acc >>> 13;\n  acc = (((acc & 0xffff) * PRIME32_3) & 0xffffffff) + (((acc >>> 16) * PRIME32_3) << 16);\n  acc ^= acc >>> 16;\n\n  // turn any negatives back into a positive number;\n  return acc < 0 ? acc + 4294967296 : acc;\n}\n","// Hoisted from solid-start (packages/start/src/directives/index.ts).\n//\n// Standalone `\"use server\"` support for Vite. The compiler half of server\n// functions lives here; the runtime half (registration on the server, a\n// transport on the client) is @solidjs/web/server-functions by default —\n// the compiled output imports `registerServerReference` /\n// `createServerReference` from that specifier and the package's export\n// conditions resolve the right half per environment. Any runtime satisfying\n// that contract can be swapped in through `options.runtime` (SolidStart's,\n// or your own).\nimport { randomBytes } from 'crypto';\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';\nimport path from 'path';\nimport {\n  createFilter,\n  type EnvironmentModuleGraph,\n  type FilterPattern,\n  type Plugin,\n  type ViteDevServer,\n  withFilter,\n} from 'vite';\nimport { removeClientBuildFile } from '../build-files.js';\nimport { getEnvironmentConsumer, isRunnableEnvironment } from '../environment.js';\nimport { exactIds } from '../hook-filters.js';\nimport { joinBase, parseRequestTarget, sendWebResponse, webRequestFromNode } from '../http.js';\nimport { isTsrxModule } from '../tsrx.js';\nimport { compile, type CompileOptions } from './compile.js';\nimport { serverModuleStyles } from './server-styles.js';\nimport xxHash32 from './xxhash32.js';\n\n/**\n * Picomatch patterns selecting the modules the directive compiler runs on.\n * Relative patterns (the defaults included) are resolved against the Vite\n * root — not the invocation directory — so running `vite` from outside the\n * project keeps compiling the same files. Absolute patterns are used as-is.\n *\n * @default include \"src/**\\/*.{jsx,tsx,tsrx,ts,js,mjs,cjs}\", exclude \"node_modules/**\\/*.{jsx,tsx,tsrx,ts,js,mjs,cjs}\"\n */\nexport interface ServerFunctionsFilter {\n  include?: FilterPattern;\n  exclude?: FilterPattern;\n}\n\nexport interface ServerFunctionsOptions {\n  /**\n   * Module specifiers the compiled output imports the runtime from.\n   * Each must export `registerServerReference(id, fn)` (server) and\n   * `createServerReference(...)` (both sides).\n   *\n   * @default \"@solidjs/web/server-functions\" for both (the package's export\n   * conditions resolve the client or server half per environment)\n   */\n  runtime?: {\n    server: string;\n    client: string;\n  };\n  filter?: ServerFunctionsFilter;\n  /**\n   * @default \"use server\"\n   */\n  directive?: string;\n  /**\n   * Path the server-function transport posts to. Joined with Vite `base`.\n   * Threaded to the built-in dev middleware, the\n   * `virtual:solid-server-function-handler` module, and — whenever the\n   * resolved path differs from the runtime default (`/_server`) — runtime\n   * `configureServerFunctions{Client,Server}` calls appended to compiled\n   * modules (so custom runtimes used with a custom endpoint must export\n   * those).\n   *\n   * @default \"/_server\"\n   */\n  endpoint?: string;\n  /**\n   * Whether the built-in dev middleware owns the server-function endpoint on\n   * the Vite dev server. Only meaningful through the main plugin's\n   * `serverFunctions` option (the standalone `serverFunctions()` export\n   * never installs the middleware).\n   *\n   * Set `false` when another plugin's server environment should own\n   * dispatch in dev — e.g. @cloudflare/vite-plugin, whose workerd\n   * environment carries the bindings (`env`/`ctx`) your server functions\n   * need: the middleware executes functions in Vite's node-side SSR\n   * environment, so with it installed those requests never reach the\n   * worker. With the middleware off, everything else keeps working —\n   * compilation, the manifest and handler virtual modules — and endpoint\n   * requests fall through to whatever the host serves; the host loads\n   * `virtual:solid-server-function-handler` itself and dispatches through\n   * its `handleServerFunctionRequest` export, exactly like production.\n   * Functions referenced only by client code register on demand through\n   * the middleware in dev, so a host owning dispatch should side-effect\n   * import the manifest module in its server entry to cover them.\n   *\n   * When a provider owns the dev server's `ssr` environment (it isn't\n   * runnable), the middleware already stands down automatically — no need\n   * to set this. See `start.externalServer` for the whole-server switch.\n   *\n   * @default true (stands down automatically when the `ssr` dev environment isn't runnable)\n   */\n  devMiddleware?: boolean;\n  /**\n   * Path to a server-only module (resolved relative to the Vite root, like\n   * `start.document`) that the generated\n   * `virtual:solid-server-function-handler` module side-effect imports\n   * before configuring the runtime. A guaranteed pre-dispatch home for\n   * server-side registration — typically `configureServerFunctionsServer`\n   * calls whose config the app graph can't reliably install first, e.g. a\n   * router's single-flight collector:\n   *\n   * ```ts\n   * // src/server-functions-setup.ts\n   * import { configureServerFunctionsServer } from '@solidjs/web/server-functions/server';\n   * configureServerFunctionsServer({ collectFlightData: createFlightDataCollector(router) });\n   * ```\n   *\n   * Because the module lives in the handler graph, it is evaluated before\n   * any dispatch on every surface — the dev middleware and the production\n   * handler alike — and is immune to the dev-restart race where\n   * registration living in the app graph only loads with the first page\n   * render (the handler graph loads before the first mutation). Config\n   * calls merge per key, so it composes with the plugin's own\n   * `configureServerFunctionsServer` call in the same module.\n   *\n   * @default undefined\n   */\n  serverSetup?: string;\n  /**\n   * Enable server components (experimental): `\"use server\"` functions that\n   * return a component. Responses for them are served over the\n   * server-function endpoint as streamed HTML that the client runtime\n   * applies in place of the boundary (instead of decoding it as data).\n   *\n   * The plugin's dispatch surfaces — the built-in dev middleware and the\n   * `virtual:solid-server-function-handler` module — install the response\n   * transform on the server runtime automatically, so this needs no\n   * per-request wiring or server code.\n   *\n   * Document SSR of server components (rendered inline at t=0 and adopted\n   * at boot with zero endpoint requests) needs two more pieces: the render\n   * must run with the server-component render plugin (plus the direct-call\n   * transform), and the client must call `installServerComponents()` before\n   * hydrating (the serialized references self-bootstrap the registry, so no\n   * separate bootstrap script is involved). With SSR start mode (the main\n   * plugin's `start` option with `ssr: true`) and generated entries the\n   * plugin emits both. With authored entries those pieces live in your\n   * entry files — import them from `@solidjs/web/frames` (see the README).\n   *\n   * `'external'` behaves exactly like `true`, and additionally declares\n   * that a composing host (e.g. a meta-framework adapter such as Astro's or\n   * TanStack Start's) owns that document wiring itself, so the plugin skips\n   * the without-SSR-start-mode warning.\n   *\n   * All of this is pure codegen: when the option is off, no reference to\n   * the server-component runtime is emitted anywhere.\n   *\n   * @default false\n   */\n  components?: boolean | 'external';\n}\n\nconst DEFAULT_INCLUDE = 'src/**/*.{jsx,tsx,tsrx,ts,js,mjs,cjs}';\nconst DEFAULT_EXCLUDE = 'node_modules/**/*.{jsx,tsx,tsrx,ts,js,mjs,cjs}';\nconst MANIFEST_ID = 'virtual:solid-server-function-manifest';\nconst DEFAULT_DIRECTIVE = 'use server';\nconst DEFAULT_RUNTIME = '@solidjs/web/server-functions';\n// Must match the runtime's built-in default — when the resolved endpoint\n// equals it, no configure calls need to be emitted at all.\nconst DEFAULT_ENDPOINT = '/_server';\nconst STORAGE_SOURCE = '@solidjs/web/storage';\n\n/**\n * The endpoint mount as the runtime is configured with it — the option (or\n * the runtime's default) with its leading slash guaranteed, before Vite's\n * `base` is applied. Shared with the start-mode plugin, whose preview\n * middleware classifies responses by this mount.\n * @internal\n */\nexport function normalizeServerFunctionsEndpoint(endpoint?: string): string {\n  const option = endpoint || DEFAULT_ENDPOINT;\n  return option.startsWith('/') ? option : '/' + option;\n}\n// Server-only handler: importing it wires the endpoint in one line\n// (registrations via the manifest, request-event scoping, endpoint config).\nconst HANDLER_ID = 'virtual:solid-server-function-handler';\n// The client runtime as a production client build sees it: the default\n// runtime with the build-id header installed (see BUILD_HEADER below).\nconst CLIENT_RUNTIME_ID = '\\0solid:server-functions-client';\n// solidjs/solid#4215. The client runtime never sends it; the build does.\nconst BUILD_HEADER = 'X-Server-Function-Build';\n\n// Server functions referenced only from client-side code (e.g. event\n// handlers, which the SSR JSX compile drops) never get imported — or even\n// transformed — by the server build, so their registrations would be missing\n// at runtime. That's why the client transform records modules into the\n// *server* manifest set. The dev server and Vite's builder mode share one\n// process where that just works; the classic two-invocation build\n// (`vite build` then `vite build --ssr`) does not, so the client build\n// persists its findings for the SSR build to merge (mirroring the plugin's\n// dist/client/.vite/manifest.json convention).\n//\n// The file doubles as the build's statement of which server functions the\n// CLIENT can reach — every reference the client compile emitted, by wire id\n// — for build tooling that needs that set without re-deriving it from\n// compiled output (a static-site prerenderer checking that each reachable\n// function was captured, for example). Paths are root-relative, posix.\nconst PERSISTED_MANIFEST_PATH = '.vite/solid-server-functions.json';\n\n/**\n * `.vite/solid-server-functions.json` in the client build's output\n * directory (`dist/client` in start mode), written when the client build\n * finishes. A server build in the same process then moves it into its own\n * output directory. Paths are relative to the Vite root, with `/` separators.\n */\nexport interface PersistedServerFunctionManifest {\n  /** Modules containing server functions. */\n  modules: string[];\n  /** Every server function the client build emitted a reference to, by wire id. */\n  functions: Array<{ id: string; name: string; module: string }>;\n  /** The id the client build stamps on its calls, for the server build to check. */\n  buildId?: string;\n}\n\n/**\n * Reads the client build's file from the client environment's configured\n * `outDir`, then the `dist/client` convention.\n */\nfunction readPersistedFile(\n  root: string,\n  clientOutDir: string | null,\n): string[] | PersistedServerFunctionManifest | undefined {\n  for (const dir of [clientOutDir, 'dist/client']) {\n    if (!dir) continue;\n    const file = path.resolve(root, dir, PERSISTED_MANIFEST_PATH);\n    if (!existsSync(file)) continue;\n    try {\n      return JSON.parse(readFileSync(file, 'utf-8'));\n    } catch {\n      return undefined;\n    }\n  }\n  return undefined;\n}\n\nfunction readPersistedManifest(root: string, clientOutDir: string | null): Set<string> {\n  const parsed = readPersistedFile(root, clientOutDir);\n  if (!parsed) return new Set();\n  // Builds from before `functions` existed wrote a bare module list.\n  const entries = Array.isArray(parsed) ? parsed : parsed.modules;\n  return new Set(\n    entries.map((entry) => path.resolve(root, entry)).filter((entry) => existsSync(entry)),\n  );\n}\n\nfunction readPersistedBuildId(root: string, clientOutDir: string | null): string | undefined {\n  const parsed = readPersistedFile(root, clientOutDir);\n  return parsed && !Array.isArray(parsed) ? parsed.buildId : undefined;\n}\n\nfunction persistedManifestJson(\n  root: string,\n  entries: Set<string>,\n  functions: Map<string, FunctionRecord>,\n  buildId: string,\n): string {\n  const relative = (entry: string) => path.relative(root, entry).split(path.sep).join('/');\n  const manifest: PersistedServerFunctionManifest = {\n    modules: [...entries].map(relative),\n    functions: [...functions].map(([id, record]) => ({\n      id,\n      name: record.name,\n      module: relative(record.module),\n    })),\n    buildId,\n  };\n  return JSON.stringify(manifest, null, 2);\n}\n\n/** Writes the file into `outDir` and returns its path. */\nfunction writePersistedManifest(root: string, outDir: string, json: string): string {\n  const file = path.resolve(root, outDir, PERSISTED_MANIFEST_PATH);\n  mkdirSync(path.dirname(file), { recursive: true });\n  writeFileSync(file, json);\n  return file;\n}\n\ninterface FunctionRecord {\n  name: string;\n  /** Absolute path of the declaring module. */\n  module: string;\n}\n\ninterface Manifest {\n  /** Modules with server functions, per consumer. */\n  modules: Record<CompileOptions['mode'], Set<string>>;\n  /** Wire id -> declaring function, for every reference the CLIENT compile emitted. */\n  clientFunctions: Map<string, FunctionRecord>;\n}\n\nfunction createManifest(): Manifest {\n  return {\n    modules: {\n      server: new Set(),\n      client: new Set(),\n    },\n    clientFunctions: new Map(),\n  };\n}\n\ninterface DeferredPromise<T> {\n  reference: Promise<T>;\n  resolve: (value: T) => void;\n  reject: (value: any) => void;\n}\n\nfunction createDeferredPromise<T>(): DeferredPromise<T> {\n  let resolve: DeferredPromise<T>['resolve'];\n  let reject: DeferredPromise<T>['reject'];\n\n  return {\n    reference: new Promise((res, rej) => {\n      resolve = res;\n      reject = rej;\n    }),\n    resolve(value) {\n      resolve(value);\n    },\n    reject(value) {\n      reject(value);\n    },\n  };\n}\n\n// The manifest can only be emitted once every module has been transformed\n// (each transform may register new entries), but Vite gives no such signal —\n// so the manifest load resolves a debounced snapshot that transforms keep\n// pushing back while they are still landing.\nclass Debouncer<T> {\n  promise: DeferredPromise<T>;\n\n  private timeout: ReturnType<typeof setTimeout> | undefined;\n\n  constructor(private source: () => T) {\n    this.promise = createDeferredPromise();\n    this.defer();\n  }\n\n  defer(): void {\n    if (this.timeout) {\n      clearTimeout(this.timeout);\n      this.timeout = undefined;\n    }\n    this.timeout = setTimeout(() => {\n      this.promise.resolve(this.source());\n    }, 1000);\n  }\n}\n\nfunction mergeManifestRecord(\n  source: Set<string>,\n  target: Set<string>,\n): { invalidPreload: boolean; invalidated: string[] } {\n  const current = source.size;\n  for (const entry of target) {\n    source.add(entry);\n  }\n  return {\n    invalidPreload: current !== source.size,\n    invalidated: [...source],\n  };\n}\n\nfunction invalidateModule(moduleGraph: EnvironmentModuleGraph, path: string) {\n  const target = moduleGraph.getModuleById(path);\n  if (target) {\n    moduleGraph.invalidateModule(target);\n  }\n}\n\nfunction invalidateModules(\n  server: ViteDevServer | undefined,\n  result: ReturnType<typeof mergeManifestRecord>,\n  manifest: string,\n): void {\n  if (server?.environments && result.invalidPreload) {\n    // Every environment, not just `client` and `ssr`: a host can load the\n    // manifest from a server environment of its own (`void_worker`, a\n    // Cloudflare worker), and one with no `ssr` environment at all would\n    // otherwise throw here.\n    for (const environment of Object.values(server.environments)) {\n      invalidateModule(environment.moduleGraph, manifest);\n    }\n  }\n}\n\nfunction removeManifestRecord(\n  source: Set<string>,\n  target: string,\n): ReturnType<typeof mergeManifestRecord> {\n  return { invalidPreload: source.delete(target), invalidated: [...source] };\n}\n\n/**\n * The standalone server-functions plugins, for meta-frameworks that order\n * plugins themselves (e.g. relative to a file-system router) and dispatch\n * the endpoint to `handleServerFunctionRequest` through their own server.\n * It never installs the built-in dev middleware, so it cannot race the\n * host for the endpoint.\n */\nexport function serverFunctions(options: ServerFunctionsOptions = {}): Plugin[] {\n  const plugins = createServerFunctionsPlugins(options);\n  // Vite evaluates a config file once per environment build; keep one instance's state.\n  for (const plugin of plugins) plugin.sharedDuringBuild = true;\n  return plugins;\n}\n\n/**\n * Shared implementation of the standalone `serverFunctions()` export and\n * the main plugin's `serverFunctions` option. The second parameter is\n * internal wiring for the latter (not part of the package API): the\n * built-in dev middleware is only installed through that path, where the\n * public `options.devMiddleware` (default true) can opt back out of it.\n */\nexport function createServerFunctionsPlugins(\n  options: ServerFunctionsOptions = {},\n  internal: {\n    devMiddleware?: boolean;\n    externalDevServer?: boolean;\n    ssrHandler?: string;\n    tsrxAfterSolid?: boolean;\n    tsrxSourceMap?: boolean;\n    /**\n     * Other front ends' extensions (`Options.frontends`): their modules are\n     * in the default filter and, like `.tsrx`, compiled after Solid's.\n     */\n    frontendExtensions?: string[];\n  } = {},\n): Plugin[] {\n  if ('configure' in options) {\n    // Renamed before the stable release, without an alias.\n    throw new Error(\n      '[@solidjs/vite-plugin] `serverFunctions.configure` has been renamed to `serverFunctions.serverSetup`.',\n    );\n  }\n  if ('manifest' in options) {\n    // Removed before the stable release, without an alias.\n    throw new Error(\n      `[@solidjs/vite-plugin] \\`serverFunctions.manifest\\` has been removed: the module id is always \\`${MANIFEST_ID}\\`.`,\n    );\n  }\n  const frontendExtensions = internal.frontendExtensions ?? [];\n  const withFrontends = (pattern: string) =>\n    frontendExtensions.length\n      ? pattern.replace('tsrx,', `tsrx,${frontendExtensions.map((e) => e.slice(1)).join(',')},`)\n      : pattern;\n  const filterInclude = options.filter?.include || withFrontends(DEFAULT_INCLUDE);\n  const filterExclude = options.filter?.exclude || withFrontends(DEFAULT_EXCLUDE);\n  // Lowered before this pass sees it: `.tsrx`, or another front end's module.\n  const isLowered = (id: string) =>\n    isTsrxModule(id) || frontendExtensions.some((e) => id.toLowerCase().endsWith(e));\n  // Recreated in configResolved: relative patterns (the defaults included)\n  // must resolve against the Vite root, not process.cwd() — running `vite`\n  // from outside the project would otherwise silently skip every module.\n  let filter = createFilter(filterInclude, filterExclude);\n  const directive = options.directive || DEFAULT_DIRECTIVE;\n  const runtime = options.runtime || { server: DEFAULT_RUNTIME, client: DEFAULT_RUNTIME };\n  const endpoint = normalizeServerFunctionsEndpoint(options.endpoint);\n  const components = !!options.components;\n  // The middleware only exists on the main plugin's path to begin with (see the\n  // `internal` parameter doc); the public option opts out of it there.\n  const installDevMiddleware = !!internal.devMiddleware && options.devMiddleware !== false;\n\n  let env: CompileOptions['env'];\n  let root = process.cwd();\n  let base = '/';\n  let isBuild = false;\n  let isSsrBuild = false;\n  let outDir = 'dist';\n  // Where a server build in another process looks for the persisted\n  // manifest: the client environment's configured outDir, then the\n  // `dist/client` convention. In one process it reads memory instead.\n  let configuredClientOutDir: string | null = null;\n  // Set once this plugin instance has built the client (an app build in one\n  // process, nitro's included). The server build then uses this build's id\n  // and discoveries from memory: a persisted file can be stale, or live in a\n  // directory the host moved (#511).\n  let builtClient = false;\n  // The file that client build wrote, and the server environments that\n  // then loaded the manifest from memory. When one of them writes its\n  // bundle, the file moves beside it, out of the client output that hosts\n  // may publish (#511).\n  let clientPersisted: { json: string; file: string } | null = null;\n  const clientPersistedReaders = new Set<string>();\n  // Endpoint with Vite `base` applied; final after configResolved, which\n  // runs before every transform/load/middleware that reads it.\n  let resolvedEndpoint = endpoint;\n  // Absolute path of the user's `serverSetup` module; resolved (and\n  // existence-checked) in configResolved, before any handler load can read it.\n  let serverSetupModulePath: string | null = null;\n\n  const manifest = createManifest();\n\n  const preload: Record<CompileOptions['mode'], Debouncer<string> | undefined> = {\n    server: undefined,\n    client: undefined,\n  };\n  let currentServer: ViteDevServer | undefined;\n\n  // THE DEPLOYMENT SECRET (solidjs/solid#3239): the runtime's flash cookie\n  // — the no-JS form outcome — carries the submitted input, so it is\n  // AES-GCM encrypted under a key derived from a deployment-wide secret,\n  // and without one the outcome is withheld entirely. This plugin provides\n  // that secret with zero configuration through the internal\n  // `globalThis.__SOLID_SECRET__ ??=` contract: generated once per plugin\n  // instance, so a production build bakes one value into the emitted server\n  // chunk — every instance of that deployment shares it (a per-process\n  // value would silently lose flashes behind a load balancer) — and a dev\n  // session holds one for its lifetime (a restart invalidates in-flight\n  // flashes, which are 60-second one-shot cookies; the next render just\n  // reads \"no flash\"). Server output only, never the client graph. The\n  // `??=` keeps an explicit `configureServerFunctionsServer({ secret })` —\n  // or a value injected by an outer harness — authoritative.\n  const deploymentSecret = randomBytes(32).toString('hex');\n  const deploymentSecretSnippet = `globalThis.__SOLID_SECRET__ ??= ${JSON.stringify(deploymentSecret)};`;\n\n  // THE BUILD ID (solidjs/solid#4215): a tab still running the previous\n  // deploy's client can call a function whose id survived the deploy but\n  // whose arguments or result changed shape. A production client build\n  // stamps every non-GET call with this id, and the server build configures\n  // the runtime with the id the client build persisted, so the server answers\n  // a call from another build with 409 (`unknownFunction: true` on the\n  // client) instead of running it. The server reads the id from the\n  // persisted manifest, not this closure, so the classic two-invocation\n  // build agrees with itself; with no client build there is no id and the\n  // server checks nothing. GET calls stay bare: their identity is the url\n  // (caches, preload matching). Only the default runtime is wrapped, whether\n  // `runtime` is unset or spells out the default: a custom runtime's\n  // configure contract is its own.\n  const buildId = randomBytes(8).toString('hex');\n  const stampsBuild = runtime.server === DEFAULT_RUNTIME && runtime.client === DEFAULT_RUNTIME;\n\n  // The client runtime's `configureServerFunctionsClient` replaces\n  // `prepareRequest` rather than composing it, so the build's hook can't\n  // simply be installed: the app's own hook would drop it. Every client\n  // import of the runtime resolves here instead, where the configure export\n  // is wrapped to run the build's stamp before the app's hook. That covers\n  // the package root, which compiled references import, and its `/client`\n  // subpath, which apps configure the client through (#511): both are the\n  // same module in the browser.\n  const clientRuntimes = new Map([\n    [runtime.client, CLIENT_RUNTIME_ID],\n    [`${runtime.client}/client`, `${CLIENT_RUNTIME_ID}/client`],\n  ]);\n  const clientRuntimeIds = new Set(clientRuntimes.values());\n  function clientRuntimeCode(specifier: string): string {\n    const source = JSON.stringify(specifier);\n    return [\n      `import { configureServerFunctionsClient as configure } from ${source};`,\n      `export * from ${source};`,\n      `const stamp = (hook) => (init, context) => {`,\n      `  if (init.method != 'GET') init.headers[${JSON.stringify(BUILD_HEADER)}] = ${JSON.stringify(buildId)};`,\n      `  return hook ? hook(init, context) : init;`,\n      `};`,\n      `configure({ prepareRequest: stamp() });`,\n      `export function configureServerFunctionsClient(config) {`,\n      `  configure(config && config.prepareRequest ? { ...config, prepareRequest: stamp(config.prepareRequest) } : config);`,\n      `}`,\n    ].join('\\n');\n  }\n\n  const clientOptions: Pick<CompileOptions, 'directive' | 'definitions'> = {\n    directive,\n    definitions: {\n      register: {\n        kind: 'named',\n        name: 'registerServerReference',\n        source: runtime.client,\n      },\n      create: {\n        kind: 'named',\n        name: 'createServerReference',\n        source: runtime.client,\n      },\n    },\n  };\n  const serverOptions: Pick<CompileOptions, 'directive' | 'definitions'> = {\n    directive,\n    definitions: {\n      register: {\n        kind: 'named',\n        name: 'registerServerReference',\n        source: runtime.server,\n      },\n      create: {\n        kind: 'named',\n        name: 'createServerReference',\n        source: runtime.server,\n      },\n    },\n  };\n\n  // A non-default endpoint (custom option, or Vite `base` prefixing the\n  // default) must reach the runtime on both sides — the client transport\n  // reads it for every fetch, the server for rendered reference `.url`s.\n  // References are only reachable through compiled modules, so appending the\n  // configure call to each guarantees it runs before any reference is used.\n  // The default endpoint appends nothing, keeping compiled output byte-\n  // identical for setups that wire the runtime themselves.\n  function endpointConfigureSnippet(mode: CompileOptions['mode']): string {\n    if (resolvedEndpoint === DEFAULT_ENDPOINT) return '';\n    const name =\n      mode === 'server' ? 'configureServerFunctionsServer' : 'configureServerFunctionsClient';\n    const source = mode === 'server' ? runtime.server : runtime.client;\n    return (\n      `\\nimport { ${name} as $$configureServerFunctions } from ${JSON.stringify(source)};` +\n      `\\n$$configureServerFunctions({ endpoint: ${JSON.stringify(resolvedEndpoint)} });\\n`\n    );\n  }\n\n  // Dev omits the manifest import: the middleware loads the referenced\n  // module on demand instead (importing the debounced manifest would stall\n  // the first request and eagerly SSR-load every server-function module).\n  // Builds import it so tree-shaking can't drop registrations for functions\n  // only client code references.\n  function handlerModuleCode(includeManifest: boolean): string {\n    const serverBuildId =\n      isBuild && stampsBuild\n        ? builtClient\n          ? buildId\n          : readPersistedBuildId(root, configuredClientOutDir)\n        : undefined;\n    // Server components ride the frame-stream wire protocol: the transform\n    // serves a function's component result as streamed HTML instead of data.\n    // Installing it here (config-level, merged with the other keys) covers\n    // both dispatch surfaces — the dev middleware and the prod handler load\n    // this module before dispatching — with zero per-request wiring. The\n    // import is only emitted when the option is on, so disabled setups keep\n    // a server-component-free graph.\n    return [\n      // The deployment secret. Imports are hoisted above it, but nothing\n      // reads the global at module evaluation — the runtime resolves it\n      // lazily per encode/decode — so leading textually is just the honest\n      // placement. This module is loaded before any dispatch on both\n      // surfaces, and the generated SSR handler imports it at module load,\n      // so the secret is in place for the flash's encode (the form POST)\n      // and its decode (the render that follows the redirect) alike.\n      deploymentSecretSnippet,\n      // The user's `serverSetup` module comes first: a side-effect import in\n      // the handler graph, evaluated before any dispatch on both surfaces\n      // (dev middleware and prod handler) and bundled into the handler\n      // chunk by production builds. Order relative to the configure call\n      // below doesn't actually matter — runtime config merges per key —\n      // import-first is just the cleaner shape.\n      ...(serverSetupModulePath ? [`import ${JSON.stringify(serverSetupModulePath)};`] : []),\n      ...(includeManifest ? [`import ${JSON.stringify(MANIFEST_ID)};`] : []),\n      `import { handleServerFunctionRequest as handle, configureServerFunctionsServer } from ${JSON.stringify(runtime.server)};`,\n      `import { provideRequestEvent } from ${JSON.stringify(STORAGE_SOURCE)};`,\n      ...(components\n        ? [\n            `import { frameTransformResult, frameTransformFlightResult, frameTransformDirectResult } from '@solidjs/web/frames';`,\n          ]\n        : []),\n      // `transformFlightResult` is the single-flight leg of the same wire\n      // protocol: a mutation whose invalidated payload includes markup gets\n      // the frame stream as its carrier (regions + envelope in one\n      // response). It only runs when a router registered a collectFlightData\n      // hook, so installing it unconditionally alongside the result\n      // transform costs disabled setups nothing.\n      //\n      // `transformDirectResult` is ALSO installed here — not just in the\n      // generated SSR entry — because flight collection makes direct\n      // (in-process) calls during handler dispatch, and the transform is what\n      // brands their results with the call address the client matches showing\n      // boundaries against. The SSR entry usually loads first and installs\n      // the same value (config merges per key), but the handler graph cannot\n      // depend on that: in dev, a mutation from an already-open page can be\n      // the first request after a server restart.\n      `configureServerFunctionsServer({ provideEvent: provideRequestEvent, endpoint: ${JSON.stringify(resolvedEndpoint)}${\n        serverBuildId ? `, buildId: ${JSON.stringify(serverBuildId)}` : ''\n      }${\n        components\n          ? ', transformResult: frameTransformResult, transformFlightResult: frameTransformFlightResult, transformDirectResult: frameTransformDirectResult'\n          : ''\n      } });`,\n      `export const endpoint = ${JSON.stringify(resolvedEndpoint)};`,\n      // `options.event` is the same wrapper->event extension seam the SSR\n      // handler's handleRequest carries (conventionally `nativeEvent`, the\n      // platform's raw request object). The runtime's standalone handler\n      // creates its own event (`{ request, locals }`) with no init\n      // parameter, so the extension threads through its existing\n      // `createEvent` option instead — spread before `...options` so an\n      // explicit host-provided createEvent still wins.\n      `export function handleServerFunctionRequest(request, options) {`,\n      `  const { event: eventInit, ...rest } = options || {};`,\n      `  return handle(request, {`,\n      `    provideEvent: provideRequestEvent,`,\n      `    ...(eventInit ? { createEvent: (req) => ({ request: req, locals: {}, ...eventInit }) } : {}),`,\n      `    ...rest,`,\n      `  });`,\n      `}`,\n    ].join('\\n');\n  }\n\n  // Function IDs are `<name>-<xxHash32(root-relative path)>[-<ordinal>]`\n  // (identity-keyed, solidjs/solid#3109). The name is a JS identifier and\n  // never contains `-`, so the hash is always the second segment and maps\n  // an incoming ID back to its module. Rebuilt whenever a transform has\n  // grown the manifest.\n  const hashIndex = new Map<string, string>();\n  let hashIndexSize = -1;\n  function moduleForFunctionId(functionId: string): string | undefined {\n    if (manifest.modules.server.size !== hashIndexSize) {\n      hashIndex.clear();\n      for (const entry of manifest.modules.server) {\n        const relative = path.relative(root, entry).split(path.sep).join('/');\n        hashIndex.set(xxHash32(relative).toString(16), entry);\n      }\n      hashIndexSize = manifest.modules.server.size;\n    }\n    return hashIndex.get(functionId.split('-')[1]!);\n  }\n\n  // Dev only: drops a module that was deleted or no longer declares server\n  // functions, so the manifest stops importing it. A build transforms each\n  // module once, so its manifest never needs this.\n  function forgetModule(id: string): void {\n    if (isBuild || !manifest.modules.server.has(id)) return;\n    for (const [functionId, record] of manifest.clientFunctions) {\n      if (record.module === id) manifest.clientFunctions.delete(functionId);\n    }\n    hashIndexSize = -1;\n    const result = removeManifestRecord(manifest.modules.server, id);\n    invalidateModules(currentServer, result, MANIFEST_ID);\n  }\n\n  function moduleDevUrl(entry: string): string {\n    const relative = path.relative(root, entry).split(path.sep).join('/');\n    return relative.startsWith('..') ? '/@fs/' + entry : '/' + relative;\n  }\n\n  const clientRuntimePlugin: Plugin = {\n    name: 'solid:server-functions/client-runtime',\n    enforce: 'pre',\n    apply: 'build',\n    resolveId(source, importer, opts) {\n      const id = clientRuntimes.get(source);\n      if (\n        stampsBuild &&\n        id &&\n        !(importer && clientRuntimeIds.has(importer)) &&\n        getEnvironmentConsumer(this.environment, opts) === 'client'\n      ) {\n        return id;\n      }\n      return null;\n    },\n    load(id) {\n      for (const [specifier, runtimeId] of clientRuntimes) {\n        if (id === runtimeId) return clientRuntimeCode(specifier);\n      }\n      return null;\n    },\n  };\n\n  const startPlugins: Plugin[] = [\n    {\n      name: 'solid:server-functions/handler',\n      enforce: 'pre',\n      resolveId(source, _importer, opts) {\n        if (source === HANDLER_ID) {\n          if (getEnvironmentConsumer(this.environment, opts) !== 'server') {\n            this.error(\n              `${HANDLER_ID} is server-only; import it from your server entry (SSR build).`,\n            );\n          }\n          return { id: HANDLER_ID, moduleSideEffects: true };\n        }\n        return null;\n      },\n      load(id, opts) {\n        if (id === HANDLER_ID && getEnvironmentConsumer(this.environment, opts) === 'server') {\n          const externalDev =\n            this.environment.mode === 'dev' &&\n            (internal.externalDevServer || !isRunnableEnvironment(this.environment));\n          return handlerModuleCode(isBuild || externalDev);\n        }\n        return null;\n      },\n    },\n  ];\n\n  if (installDevMiddleware) {\n    startPlugins.push({\n      name: 'solid:server-functions/dev-middleware',\n      apply: 'serve',\n      configureServer(server) {\n        const ssrEnvironment = server.environments.ssr;\n        if (internal.externalDevServer || !isRunnableEnvironment(ssrEnvironment)) {\n          return;\n        }\n        // A call's address takes one of three shapes: `<endpoint>/<id>`\n        // (plain HTTP), `<endpoint>/data/<id>` (the scripted transport's own\n        // path, solidjs/solid#3076, #3094) or `<endpoint>/live/<id>` (a\n        // `live` loop's connection, answered as an event stream; @solidjs/web\n        // 2.0.0-rc.10). Bare-mount requests still reach the runtime handler\n        // (it answers 404), so misdirected posts fail through the endpoint\n        // rather than falling through to SSR.\n        const underMount = (pathname: string, mount: string) =>\n          pathname === mount || pathname.startsWith(mount + '/');\n        server.middlewares.use((req, res, next) => {\n          const url = parseRequestTarget(req.url || '/', 'http://localhost');\n          // Match with and without `base` — middleware-mode hosts may mount\n          // vite.middlewares below the base themselves.\n          if (!underMount(url.pathname, resolvedEndpoint) && !underMount(url.pathname, endpoint)) {\n            return next();\n          }\n          const basePrefixed = underMount(url.pathname, resolvedEndpoint);\n          // When the stripped form matched, restore the base for dispatch:\n          // the generated handler compares the request pathname against the\n          // base-prefixed endpoint, and production handlers only ever see\n          // base-prefixed URLs.\n          const dispatchUrl = basePrefixed ? undefined : joinBase(base, req.url || '/');\n          (async () => {\n            // Dispatch through a module evaluated in the SSR environment so\n            // the handler shares the registry instance with the app modules.\n            // With SSR start mode active the main plugin threads its handler id\n            // in, and dispatch goes through `handleRequest` instead: one\n            // middleware chain and one stub-backed request event front the\n            // endpoint exactly as they front page SSR.\n            // Loaded before the function's module below: with\n            // `start.serverSetup` the handler is the wrapper that runs the\n            // server setup module first, and a server-function call can be the\n            // first request this runner sees, so nothing may load ahead of it.\n            const handler = await ssrEnvironment.runner.import(internal.ssrHandler ?? HANDLER_ID);\n            // Make sure the referenced module has been evaluated in the SSR\n            // environment so its registration exists — functions only client\n            // code references are never loaded by the SSR render itself.\n            // The id lives in the path segment after the mount — behind a\n            // literal `data` segment on the scripted transport's address\n            // (solidjs/solid#3094) or a literal `live` segment on a live\n            // loop's. Mirrors the runtime's `parseServerFunctionAddress`:\n            // one kind segment at most is stripped, and segment count keeps\n            // the shapes apart — an id occupies exactly one segment, so\n            // `data/<id>` / `live/<id>` are only ever kind-prefixed\n            // addresses, a function id spelled `data` or `live` still parses\n            // at the bare one, and `data/live/<id>` is a miss (the runtime\n            // 404s it too).\n            const mount = basePrefixed ? resolvedEndpoint : endpoint;\n            let segment = url.pathname.slice(mount.length + 1);\n            if (segment.startsWith('data/') || segment.startsWith('live/')) {\n              segment = segment.slice(5);\n            }\n            let functionId: string | null = null;\n            if (segment && !segment.includes('/')) {\n              try {\n                functionId = decodeURIComponent(segment);\n              } catch {\n                // not an address; the runtime handler answers the 404\n              }\n            }\n            if (functionId) {\n              const entry = moduleForFunctionId(functionId);\n              if (entry) await ssrEnvironment.runner.import(moduleDevUrl(entry));\n            }\n            // Both dispatch shapes carry the raw Node request on the event\n            // (the `options.event` seam), matching the SSR dev middleware\n            // and what a production Node entry passes.\n            const dispatchOptions = { event: { nativeEvent: req } };\n            const response: Response = internal.ssrHandler\n              ? await handler.handleRequest(\n                  webRequestFromNode(req, dispatchUrl, res),\n                  dispatchOptions,\n                )\n              : await handler.handleServerFunctionRequest(\n                  webRequestFromNode(req, dispatchUrl, res),\n                  dispatchOptions,\n                );\n            await sendWebResponse(res, response);\n          })().catch((error) => {\n            next(error);\n          });\n        });\n      },\n    });\n  }\n\n  async function transformModule(\n    ctx: any,\n    code: string,\n    fileId: string,\n    opts: unknown,\n    tsrx: boolean,\n  ) {\n    const mode = getEnvironmentConsumer(ctx.environment, opts);\n    const [id] = fileId.split('?');\n    if (!id || !filter(id) || isLowered(id) !== tsrx) return null;\n\n    // The directive has to appear literally, so anything without the\n    // substring can skip the native parse entirely.\n    if (!code.includes(directive)) {\n      forgetModule(id);\n      return null;\n    }\n\n    const result = await compile(id, code, {\n      ...(mode === 'server' ? serverOptions : clientOptions),\n      mode,\n      env,\n      root,\n      // A front end's module arrives with its map (native `.tsrx` does not).\n      sourceMap: !tsrx || !!internal.tsrxSourceMap || !isTsrxModule(id),\n    });\n\n    if (!result.valid) {\n      forgetModule(id);\n      return null;\n    }\n\n    // The client compile is the authority on what the browser can dispatch:\n    // record every reference it emitted, by wire id, for the persisted\n    // manifest. A module is re-transformed on change, so its previous ids\n    // are dropped first (a renamed function must not linger as reachable).\n    if (mode === 'client') {\n      for (const [functionId, record] of manifest.clientFunctions) {\n        if (record.module === id) manifest.clientFunctions.delete(functionId);\n      }\n      for (const fn of result.functions) {\n        manifest.clientFunctions.set(fn.id, { name: fn.name, module: id });\n      }\n    }\n\n    const preloader = preload[mode];\n    if (preloader) preloader.defer();\n    invalidateModules(\n      currentServer,\n      mergeManifestRecord(manifest.modules.server, new Set([id])),\n      MANIFEST_ID,\n    );\n\n    // A client build has no other way to learn a server component's\n    // stylesheets (dev's CSS crawl walks the SSR graph instead).\n    const styles =\n      components && isBuild && mode === 'client' ? await serverModuleStyles(ctx, id, code) : '';\n\n    return {\n      // Appended (not prepended) so the source map for the compiled module\n      // stays valid; imports hoist and the endpoint is only read at call time.\n      code: (result.code || '') + endpointConfigureSnippet(mode) + styles,\n      map: result.map,\n    };\n  }\n\n  const compilerPlugin: Plugin = {\n    name: 'solid:server-functions/compiler',\n    enforce: 'pre',\n    transform(code, fileId, opts) {\n      return transformModule(this, code, fileId, opts, false);\n    },\n  };\n\n  const tsrxCompilerPlugin: Plugin = {\n    name: 'solid:server-functions/tsrx-compiler',\n    enforce: 'pre',\n    transform(code, fileId, opts) {\n      return transformModule(this, code, fileId, opts, true);\n    },\n  };\n\n  // A compiler as two plugins: the build one filters on the directive\n  // (src/hook-filters.ts), so Rolldown skips the call for every module\n  // without it. Dev keeps every call, since transformModule forgets a\n  // module whose directive was edited away.\n  const serveAndBuild = (plugin: Plugin): Plugin[] => [\n    { ...plugin, apply: 'serve' },\n    withFilter({ ...plugin, apply: 'build' }, { transform: { code: directive } }),\n  ];\n\n  const plugins: Plugin[] = [\n    {\n      name: 'solid:server-functions/setup',\n      enforce: 'pre',\n      configResolved(config) {\n        env = config.mode !== 'production' ? 'development' : 'production';\n        root = config.root;\n        base = config.base;\n        filter = createFilter(filterInclude, filterExclude, { resolve: root });\n        isBuild = config.command === 'build';\n        isSsrBuild = !!config.build.ssr;\n        outDir = config.build.outDir;\n        configuredClientOutDir =\n          (config as { environments?: Record<string, { build?: { outDir?: string } }> })\n            .environments?.client?.build?.outDir ?? null;\n        resolvedEndpoint = joinBase(config.base, endpoint);\n        if (options.serverSetup) {\n          const absolute = path.isAbsolute(options.serverSetup)\n            ? options.serverSetup\n            : path.resolve(root, options.serverSetup);\n          if (!existsSync(absolute)) {\n            throw new Error(\n              `[@solidjs/vite-plugin] serverFunctions.serverSetup does not exist: ${options.serverSetup}`,\n            );\n          }\n          serverSetupModulePath = absolute;\n        }\n        if (isBuild && isSsrBuild) {\n          // Classic two-invocation build: pick up the modules the client\n          // build discovered so the server manifest registers them even when\n          // the SSR module graph never imports them.\n          for (const entry of readPersistedManifest(root, configuredClientOutDir)) {\n            manifest.modules.server.add(entry);\n          }\n        }\n      },\n      configureServer(server) {\n        currentServer = server;\n      },\n      watchChange(id, change) {\n        if (change.event === 'delete') forgetModule(id);\n      },\n      writeBundle(outputOptions) {\n        // Same client-build detection as the main plugin: builder-mode builds\n        // run both environments in one process, so prefer the per-environment\n        // consumer over the process-wide --ssr flag.\n        const ctx = this as {\n          environment?: { name?: string; config?: { consumer?: string } };\n        };\n        const consumer = ctx.environment?.config?.consumer;\n        const isClient = consumer ? consumer === 'client' : !isSsrBuild;\n        if (isBuild && isClient) {\n          builtClient = true;\n          const json = persistedManifestJson(\n            root,\n            manifest.modules.server,\n            manifest.clientFunctions,\n            buildId,\n          );\n          // The directory this build actually wrote, which a host may have\n          // moved away from the top-level `build.outDir`.\n          const file = writePersistedManifest(root, outputOptions.dir ?? outDir, json);\n          clientPersisted = { json, file };\n        } else if (\n          isBuild &&\n          clientPersisted &&\n          clientPersistedReaders.has(ctx.environment?.name ?? '')\n        ) {\n          writePersistedManifest(root, outputOptions.dir ?? outDir, clientPersisted.json);\n          removeClientBuildFile(clientPersisted.file);\n        }\n      },\n    },\n    {\n      name: 'solid:server-functions/manifest',\n      enforce: 'pre',\n      resolveId(source) {\n        if (source === MANIFEST_ID) {\n          return { id: MANIFEST_ID, moduleSideEffects: true };\n        }\n        return null;\n      },\n      async load(id, opts) {\n        const mode = getEnvironmentConsumer(this.environment, opts);\n        if (id === MANIFEST_ID) {\n          // After a client build in this process, its discoveries are\n          // already in memory (see `builtClient`).\n          if (isBuild && mode === 'server' && builtClient) {\n            clientPersistedReaders.add(this.environment.name);\n          } else if (isBuild && mode === 'server') {\n            // Merge the client build's persisted discoveries at load time,\n            // not just configResolved: in builder mode (single process,\n            // `vite build` with the environments API) all environment\n            // configs resolve before the client build has written the file,\n            // but this load runs once the SSR environment builds — after it.\n            for (const entry of readPersistedManifest(root, configuredClientOutDir)) {\n              manifest.modules.server.add(entry);\n            }\n          }\n          const source = () =>\n            [...manifest.modules[mode]]\n              .map((entry) => `import ${JSON.stringify(entry)};`)\n              .join('\\n');\n          // In dev, each transform that registers a new module invalidates\n          // the manifest, and a function's module is always transformed\n          // before anything can call it. So the current list is enough, and\n          // waiting would only delay every load.\n          if (!isBuild) return source();\n          const current = new Debouncer(source);\n          preload[mode] = current;\n          const result = await current.promise.reference;\n          return result;\n        }\n        return null;\n      },\n    },\n    clientRuntimePlugin,\n    ...serveAndBuild(compilerPlugin),\n    ...(internal.tsrxAfterSolid ? serveAndBuild(tsrxCompilerPlugin) : []),\n    ...startPlugins,\n  ];\n  // Hook filters (src/hook-filters.ts) for the virtual modules.\n  withFilter(plugins, [\n    {\n      pluginNamePattern: ['solid:server-functions/client-runtime'],\n      resolveId: { id: exactIds(...clientRuntimes.keys()) },\n      load: { id: exactIds(...clientRuntimeIds) },\n    },\n    {\n      pluginNamePattern: ['solid:server-functions/handler'],\n      resolveId: { id: exactIds(HANDLER_ID) },\n      load: { id: exactIds(HANDLER_ID) },\n    },\n    {\n      pluginNamePattern: ['solid:server-functions/manifest'],\n      resolveId: { id: exactIds(MANIFEST_ID) },\n      load: { id: exactIds(MANIFEST_ID) },\n    },\n  ]);\n  return plugins;\n}\n","export const DEVTOOLS_PACKAGE = '@solidjs/start-devtools';\nexport const DEVTOOLS_MOUNT_ID = 'virtual:solid-devtools/mount';\n\n/**\n * Connects the toolbar to the dev server (see `./server.ts`). The toolbar\n * is pre-bundled and has no `import.meta.hot` of its own, so the generated\n * module passes its own. A namespace import, because a devtools release\n * older than `connectDevServer` does not export it.\n */\nexport function devtoolsConnectCode(): string[] {\n  return [\n    `import * as __solidDevtools from '${DEVTOOLS_PACKAGE}';`,\n    `if (import.meta.hot && typeof __solidDevtools.connectDevServer === 'function') {`,\n    `  __solidDevtools.connectDevServer(import.meta.hot);`,\n    `}`,\n  ];\n}\n\nexport function devtoolsMountModuleCode(): string {\n  return [\n    `import { mountDevToolbar } from '${DEVTOOLS_PACKAGE}';`,\n    ...devtoolsConnectCode(),\n    `mountDevToolbar();`,\n  ].join('\\n');\n}\n","/**\n * The messages and endpoints the dev server and the devtools toolbar share.\n *\n * `@solidjs/start-devtools/protocol` defines them (solidjs/solid-start-devtools#48).\n * They are copied here until a devtools release ships that entry. Then the\n * constants take the types of the package's, as `src/diagnostics` does with\n * `@solidjs/diagnostics/protocol`, so drift fails this plugin's compile.\n */\n\n/** Opens a file in the editor: `GET /__solid/devtools/open-in-editor?file=src/App.tsx:12:5`. */\nexport const OPEN_IN_EDITOR_PATH = '/__solid/devtools/open-in-editor';\n\n/** Toolbar to server, once it connects. The payload is a `DevServerHello`. */\nexport const DEVTOOLS_HELLO_EVENT = 'solid:devtools:hello';\n\n/** Server to toolbar, the answer to the hello. The payload is a `DevServerInfo`. */\nexport const DEVTOOLS_INFO_EVENT = 'solid:devtools:info';\n\n/** Server to toolbar, each server error after the hello. The payload is a `ServerErrorMessage`. */\nexport const DEVTOOLS_SERVER_ERROR_EVENT = 'solid:devtools:server-error';\n\nexport interface DevServerHello {\n  /** When the page started loading, in milliseconds since the epoch. */\n  since: number;\n}\n\n/** Package versions resolved from the app root. A package that was not found is left out. */\nexport interface DevServerVersions {\n  'solid-js'?: string;\n  '@solidjs/web'?: string;\n  '@solidjs/vite-plugin'?: string;\n  vite?: string;\n}\n\nexport interface DevServerInfo {\n  versions: DevServerVersions;\n  /** The server errors kept since the hello's `since`, oldest first. */\n  errors: ServerErrorMessage[];\n}\n\n/** A failure the server runtime reported, as `configureServerErrors` hears it. */\nexport interface ServerErrorMessage {\n  /** Unique for the life of the dev server. */\n  id: number;\n  /** When the server heard it, in milliseconds since the epoch. */\n  at: number;\n  name: string;\n  message: string;\n  stack?: string;\n  kind: 'render' | 'server-function' | 'request';\n  handling: string;\n  functionId?: string;\n  ownerPath?: string[];\n  method?: string;\n  url?: string;\n}\n","/**\n * The dev server side of the devtools toolbar (dev serve only).\n *\n * The toolbar runs in the page and cannot see what happens in the server\n * process or on disk. This plugin sends it:\n * - the errors the server runtime reports through `configureServerErrors`,\n *   over Vite's WebSocket;\n * - the versions of the packages the app resolves;\n * - an open-in-editor endpoint that resolves paths against the Vite root.\n *\n * The toolbar connects from the client entry this plugin generates, which\n * calls `connectDevServer(import.meta.hot)` (see `devtoolsConnectCode`).\n */\nimport { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { DEVTOOLS_PACKAGE } from './index.js';\nimport {\n  DEVTOOLS_HELLO_EVENT,\n  DEVTOOLS_INFO_EVENT,\n  DEVTOOLS_SERVER_ERROR_EVENT,\n  OPEN_IN_EDITOR_PATH,\n  type DevServerHello,\n  type DevServerInfo,\n  type DevServerVersions,\n  type ServerErrorMessage,\n} from './protocol.js';\n\n/** The registered symbol `@solidjs/web` keeps the ambient server error hook under. */\nconst SERVER_ERRORS = Symbol.for('solid-js/server/errors');\n\n/** Errors kept for a page that connects after the render that served it. */\nconst KEPT_ERRORS = 50;\n\nconst VERSIONED_PACKAGES = ['solid-js', '@solidjs/web', '@solidjs/vite-plugin', 'vite'] as const;\n\ntype ServerErrorHook = (error: unknown, context: ServerErrorContext) => unknown;\n\ninterface ServerErrorContext {\n  kind: ServerErrorMessage['kind'];\n  handling: string;\n  functionId?: string;\n  ownerPath?: string[];\n  event?: { request?: Request };\n}\n\n/** The `version` of a package installed at or above `root`, or nothing when it is not found. */\nexport function readPackageVersion(root: string, name: string): string | undefined {\n  let dir = path.resolve(root);\n  while (true) {\n    const manifest = path.join(dir, 'node_modules', name, 'package.json');\n    if (existsSync(manifest)) {\n      try {\n        const version = (JSON.parse(readFileSync(manifest, 'utf8')) as { version?: unknown })\n          .version;\n        return typeof version === 'string' ? version : undefined;\n      } catch {\n        return undefined;\n      }\n    }\n    const parent = path.dirname(dir);\n    if (parent === dir) return undefined;\n    dir = parent;\n  }\n}\n\n/**\n * Whether the app uses `@solidjs/start-devtools`: the nearest package.json\n * declares it or is the package itself, or it is installed at or above the\n * root. Declared or installed, the toolbar can resolve it.\n */\nexport function detectDevtoolsPackage(root: string): boolean {\n  let dir = path.resolve(root);\n  while (true) {\n    const manifestPath = path.join(dir, 'package.json');\n    if (existsSync(manifestPath)) {\n      try {\n        const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as {\n          name?: string;\n          dependencies?: Record<string, string>;\n          devDependencies?: Record<string, string>;\n        };\n        if (\n          manifest.name === DEVTOOLS_PACKAGE ||\n          manifest.dependencies?.[DEVTOOLS_PACKAGE] ||\n          manifest.devDependencies?.[DEVTOOLS_PACKAGE]\n        ) {\n          return true;\n        }\n      } catch {\n        // An unreadable manifest declares nothing.\n      }\n      break;\n    }\n    const parent = path.dirname(dir);\n    if (parent === dir) break;\n    dir = parent;\n  }\n  return readPackageVersion(root, DEVTOOLS_PACKAGE) !== undefined;\n}\n\nexport function readVersions(root: string): DevServerVersions {\n  const versions: DevServerVersions = {};\n  for (const name of VERSIONED_PACKAGES) {\n    const version = readPackageVersion(root, name);\n    if (version) versions[name] = version;\n  }\n  return versions;\n}\n\n/**\n * The file an editor location points at, keeping its `:line:col`.\n *\n * Locations the compiler emits are relative to the Vite root. A location\n * written from a parent folder, such as `examples/app/src/App.tsx` when the\n * root is `examples/app`, still resolves: leading folders are dropped until\n * the file exists. Nothing when no candidate exists.\n */\nexport function resolveEditorLocation(root: string, location: string): string | undefined {\n  const match = /^(.*?)((?::\\d+){0,2})$/.exec(location);\n  const file = match?.[1] ?? location;\n  const position = match?.[2] ?? '';\n  if (!file) return undefined;\n  if (path.isAbsolute(file) && existsSync(file)) return file + position;\n\n  const parts = file.split(/[/\\\\]/);\n  for (let index = 0; index < parts.length; index++) {\n    const candidate = path.resolve(root, ...parts.slice(index));\n    if (existsSync(candidate)) return candidate + position;\n  }\n  return undefined;\n}\n\n/** The message the toolbar gets for one reported failure. */\nexport function serverErrorMessage(\n  id: number,\n  error: unknown,\n  context: ServerErrorContext,\n): ServerErrorMessage {\n  const isError = error instanceof Error;\n  const message: ServerErrorMessage = {\n    id,\n    at: Date.now(),\n    name: isError ? error.name : 'Error',\n    message: isError ? error.message : String(error),\n    kind: context.kind,\n    handling: context.handling,\n  };\n  if (isError && error.stack) message.stack = error.stack;\n  if (context.functionId) message.functionId = context.functionId;\n  if (context.ownerPath) message.ownerPath = [...context.ownerPath];\n  const request = context.event?.request;\n  if (request) {\n    message.method = request.method;\n    message.url = request.url;\n  }\n  return message;\n}\n\n/**\n * Hears every failure the server runtime reports, beside the app's own hook.\n *\n * `configureServerErrors` keeps one hook on `globalThis`, so registering a\n * second one would replace the app's. Instead the slot's `hook` becomes an\n * accessor: the app's `configureServerErrors` call sets the app hook, and\n * the runtime reads a hook that reports the failure, then calls the app's.\n * The server modules run in this process under Vite's module runner, so they\n * share this `globalThis`. A server environment in a worker or another process\n * is not heard.\n */\nexport function listenToServerErrors(\n  report: (error: unknown, context: ServerErrorContext) => void,\n): () => void {\n  const scope = globalThis as Record<symbol, { hook?: ServerErrorHook } | undefined>;\n  const slot = (scope[SERVER_ERRORS] ??= {});\n  let appHook = slot.hook;\n\n  function forward(error: unknown, context: ServerErrorContext): unknown {\n    try {\n      report(error, context);\n    } catch {\n      // The toolbar's copy must never change how the app handles the failure.\n    }\n    if (appHook) return appHook(error, context);\n    // With no hook registered the runtime prints a failure that fails the\n    // request. A hook is now always registered, so it prints it here instead.\n    if (context.handling === 'failed') console.error(error);\n    return undefined;\n  }\n\n  Object.defineProperty(slot, 'hook', {\n    configurable: true,\n    enumerable: true,\n    get: () => forward,\n    set(value: ServerErrorHook | undefined) {\n      appHook = value;\n    },\n  });\n\n  return () => {\n    Object.defineProperty(slot, 'hook', {\n      configurable: true,\n      enumerable: true,\n      writable: true,\n      value: appHook,\n    });\n  };\n}\n\nexport function solidDevtoolsServer(): Plugin {\n  let root = process.cwd();\n  let versions: DevServerVersions = {};\n  let enabled = false;\n\n  return {\n    name: 'solid:devtools/server',\n    // Like the diagnostics surface: the toolbar exists in dev serve only, and\n    // test runs (Vitest serves too) never render it.\n    apply(_config, env) {\n      return env.command === 'serve' && !env.isPreview && env.mode !== 'test';\n    },\n\n    configResolved(config) {\n      root = config.root;\n      enabled = detectDevtoolsPackage(root);\n      if (enabled) versions = readVersions(root);\n    },\n\n    configureServer(server) {\n      if (!enabled) return;\n\n      // Kept so a page that loads after an error still gets it: the render\n      // that serves a page fails before the page can connect.\n      const kept: ServerErrorMessage[] = [];\n      let nextId = 1;\n\n      const stopListening = listenToServerErrors((error, context) => {\n        const message = serverErrorMessage(nextId++, error, context);\n        kept.push(message);\n        if (kept.length > KEPT_ERRORS) kept.shift();\n        server.ws.send(DEVTOOLS_SERVER_ERROR_EVENT, message);\n      });\n      server.httpServer?.once('close', stopListening);\n\n      server.ws.on(DEVTOOLS_HELLO_EVENT, (hello: DevServerHello, client) => {\n        const since = typeof hello?.since === 'number' ? hello.since : 0;\n        const errors: ServerErrorMessage[] = [];\n        for (const message of kept) {\n          if (message.at >= since) errors.push(message);\n        }\n        const info: DevServerInfo = { versions, errors };\n        client.send(DEVTOOLS_INFO_EVENT, info);\n      });\n\n      // Hands the resolved path to Vite's own `/__open-in-editor`, which\n      // launches the editor. Mounted without a path, so connect does not put\n      // the original URL back before Vite's middleware reads it.\n      server.middlewares.use((req, res, next) => {\n        const url = req.url;\n        if (!url || !url.startsWith(OPEN_IN_EDITOR_PATH + '?')) return next();\n        const file = new URL(url, 'http://localhost').searchParams.get('file');\n        const resolved = file ? resolveEditorLocation(root, file) : undefined;\n        if (!resolved) {\n          res.statusCode = 404;\n          res.end(`No file found for ${JSON.stringify(file)}`);\n          return;\n        }\n        req.url = `/__open-in-editor?file=${encodeURIComponent(resolved)}`;\n        next();\n      });\n    },\n  };\n}\n","// Shared by the build-time precompression and the Node entry's static handler.\n\n/** Text-like extensions; images and woff2 are compressed already, maps only reach devtools. */\nexport const PRECOMPRESSIBLE_EXTENSIONS = new Set([\n  '.js',\n  '.mjs',\n  '.css',\n  '.html',\n  '.json',\n  '.svg',\n  '.txt',\n  '.xml',\n  '.webmanifest',\n  '.wasm',\n  '.ico',\n  '.ttf',\n  '.otf',\n]);\n\n/** Files smaller than this are served as they are. */\nexport const PRECOMPRESS_MIN_BYTES = 1024;\n\n/** Content-Encoding token and file suffix, in server preference order. */\nexport const ENCODINGS = [\n  { name: 'br', suffix: '.br' },\n  { name: 'gzip', suffix: '.gz' },\n] as const;\n\nexport type Encoding = (typeof ENCODINGS)[number];\n\n/** Encodings an `Accept-Encoding` header prefers over identity, by q-value, br first on ties. */\nexport function acceptedEncodings(header: string | string[] | undefined): Encoding[] {\n  if (!header) return [];\n  const weights = new Map<string, number>();\n  for (const part of String(header).split(',')) {\n    const [token, ...params] = part.split(';');\n    const name = token.trim().toLowerCase();\n    if (!name) continue;\n    let q = 1;\n    for (const param of params) {\n      const [key, value] = param.split('=');\n      if (key.trim().toLowerCase() === 'q') q = Number(value);\n    }\n    weights.set(name, Number.isFinite(q) ? q : 0);\n  }\n  const wildcard = weights.get('*') ?? 0;\n  const identity = weights.get('identity') ?? 0;\n  const weightOf = (encoding: Encoding) => weights.get(encoding.name) ?? wildcard;\n  return ENCODINGS.filter(\n    (encoding) => weightOf(encoding) > 0 && weightOf(encoding) >= identity,\n  ).sort((a, b) => weightOf(b) - weightOf(a));\n}\n","// Client build variants for `start.nodeServer`, like Nitro's `compressPublicAssets`.\nimport { readdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport { availableParallelism } from 'node:os';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\nimport { brotliCompress, constants, gzip } from 'node:zlib';\nimport {\n  ENCODINGS,\n  PRECOMPRESS_MIN_BYTES,\n  PRECOMPRESSIBLE_EXTENSIONS,\n  type Encoding,\n} from './node-entry/encoding.js';\n\nconst brotliAsync = promisify(brotliCompress);\nconst gzipAsync = promisify(gzip);\n\nfunction compress(encoding: Encoding, source: Buffer): Promise<Buffer> {\n  if (encoding.name === 'br') {\n    return brotliAsync(source, {\n      params: {\n        [constants.BROTLI_PARAM_QUALITY]: constants.BROTLI_MAX_QUALITY,\n        [constants.BROTLI_PARAM_MODE]: constants.BROTLI_MODE_TEXT,\n        [constants.BROTLI_PARAM_SIZE_HINT]: source.length,\n      },\n    });\n  }\n  return gzipAsync(source, { level: constants.Z_BEST_COMPRESSION });\n}\n\n/** Writes the variants worth having and removes stale ones, which the server would prefer. */\nexport async function precompressFile(file: string): Promise<void> {\n  const source = await readFile(file);\n  await Promise.all(\n    ENCODINGS.map(async (encoding) => {\n      const variant = file + encoding.suffix;\n      const compressed =\n        source.length >= PRECOMPRESS_MIN_BYTES ? await compress(encoding, source) : null;\n      if (compressed && compressed.length < source.length) {\n        await writeFile(variant, compressed);\n      } else {\n        await rm(variant, { force: true });\n      }\n    }),\n  );\n}\n\n/** Precompresses every eligible file under `dir`, skipping dot segments (.vite/). */\nexport async function precompressDir(dir: string): Promise<void> {\n  const entries = await readdir(dir, { recursive: true, withFileTypes: true });\n  const files = entries\n    .filter(\n      (entry) =>\n        entry.isFile() && PRECOMPRESSIBLE_EXTENSIONS.has(path.extname(entry.name).toLowerCase()),\n    )\n    .map((entry) => path.join(entry.parentPath, entry.name))\n    .filter((file) =>\n      path\n        .relative(dir, file)\n        .split(path.sep)\n        .every((segment) => !segment.startsWith('.')),\n    );\n  let next = 0;\n  const worker = async () => {\n    while (next < files.length) await precompressFile(files[next++]);\n  };\n  await Promise.all(Array.from({ length: Math.min(files.length, availableParallelism()) }, worker));\n}\n","// Start-mode serving for plain Vite apps: `solid({ start: {...} })` (or the\n// zero-config sugar `start: true`) adds a serving layer with conventional\n// entries so no hand-rolled wiring is needed, and the plugin's `ssr`\n// boolean picks the mode — `ssr: true` server-renders the app per request;\n// `ssr: false`/omitted is client mode (the same conventions, but the\n// document shell is served/prerendered empty and the app `render()`s\n// client-side). The flip between them is that one boolean.\n//\n// SSR mode (`start` + `ssr: true`):\n// - Dev: runnable SSR environments are served by a Vite middleware. Provider-\n//   owned environments serve through `virtual:solid-ssr-handler` instead.\n//   Both paths inject the Vite client, dev style patch, and entry CSS as\n//   `<style data-vite-dev-id>` tags before the body can paint.\n// - Prod: the plugin configures a full-app build (client + server bundles\n//   via the Vite environments/builder API — a single `vite build` builds\n//   both) whose server entry is `virtual:solid-ssr-handler`: an\n//   adapter-agnostic named `handleRequest(Request) => Promise<Response>` plus\n//   a default Fetchable `{ fetch(request) }` export. Both scope each request\n//   with `provideRequestEvent`, stream the render, and resolve hashed client\n//   assets through `virtual:solid-manifest`.\n// - Entries are conventional with escape hatches: `src/entry-server.*` /\n//   `src/entry-client.*` are used when present (or set explicitly); when\n//   absent, default entries are generated from a single root component\n//   (`start.app`, defaulting to `src/App.*`) wrapped in a document shell\n//   (`start.document`, defaulting to `src/Document.*`, else a built-in one).\n// - When `serverFunctions` is also enabled, the handler composes the\n//   endpoint on every surface; the runnable-dev server-function middleware\n//   pre-loads the referenced module, then dispatches through this handler.\n// - Every dispatch runs under a stub-backed request event\n//   (`createRequestEvent`) with the optional `start.middleware` chain fronting\n//   it, and page responses go through the runtime's `createSSRResponse`\n//   head lifecycle (commit at shell flush, real pre-flush redirects, the\n//   script fallback post-flush).\n// - Per-request render inputs live on the request event: middleware sets\n//   `event.nonce` (the CSP nonce, read by @solidjs/web's renderer and by the\n//   tags the handler injects) and `event.renderMode` (`'stream'` flushes the\n//   shell with fallbacks and streams boundaries in behind it; `'async'`\n//   awaits the settled document — complete for no-JS clients) before\n//   calling `next()`. `start.renderMode` is the static default, and\n//   `handleRequest(request, { nonce, renderMode })` seeds and overrides both.\n// - `vite preview` serves dist/client statically and dispatches everything\n//   else through the built handler — the production path, middleware\n//   included, with no server file needed.\n//\n// Client mode (`start` without `ssr: true`) rides the same machinery with\n// three deltas: the generated server entry renders the document shell\n// WITHOUT the app (dev serving doubles as history fallback, and a\n// post-build hook prerenders it once into the client emit directory), the\n// generated client entry render()s instead of hydrating, and the server\n// bundle is dropped unless `serverFunctions` needs it or another plugin\n// owns the app build. Client code compiles non-hydratable, exactly like a\n// plain SPA.\nimport { existsSync, readFileSync, rmSync, writeFileSync } from 'fs';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport {\n  type DevEnvironment,\n  normalizePath,\n  type Plugin,\n  type PreviewServer,\n  type ViteDevServer,\n  withFilter,\n} from 'vite';\nimport { getEnvironmentConsumer, isRunnableEnvironment } from '../environment.js';\nimport { exactIds } from '../hook-filters.js';\nimport {\n  DEVTOOLS_MOUNT_ID,\n  DEVTOOLS_PACKAGE,\n  devtoolsConnectCode,\n  devtoolsMountModuleCode,\n} from '../devtools/index.js';\nimport { solidDevtoolsServer } from '../devtools/server.js';\nimport { DIAGNOSTICS_CLIENT_ID, detectDiagnosticsPackage } from '../diagnostics/index.js';\nimport {\n  PERFORMANCE_TRACKS_CLIENT_ID,\n  detectPerformanceTracksSubpath,\n} from '../performance-tracks/index.js';\nimport {\n  collectDevStyles,\n  collectDevStyleSources,\n  type DevStyleFilter,\n  devStylePatch,\n  renderDevStyleTag,\n} from '../dev-manifest.js';\nimport { joinBase, parseRequestTarget, sendWebResponse, webRequestFromNode } from '../http.js';\nimport { precompressDir, precompressFile } from '../precompress.js';\n\n/**\n * Options for the main plugin's `start` option (`start: true` is\n * sugar for the empty bag). One bag serves both modes — the plugin's `ssr`\n * boolean picks between them, so flipping a project between\n * client-rendered and server-rendered is toggling that boolean, never\n * reshaping this object. Server-only options (`entries.server`, `externalServer`)\n * are documented no-ops in client mode: they stay in the config across a\n * flip instead of erroring.\n */\nexport interface StartOptions {\n  /**\n   * Root component module for generated entries (the zero-config path).\n   * Resolved relative to the Vite root.\n   *\n   * @default \"src/App.{tsx,jsx,ts,js,tsrx}\" (also probes lowercase \"src/app.*\")\n   */\n  app?: string;\n  /** Explicit rendering entries. Conventional entry files are used when omitted. */\n  entries?: {\n    /**\n     * Client entry module. In SSR mode it hydrates; in client mode it mounts\n     * (a generated one calls `render()`), and it stands alone — no pairing\n     * rule with a server entry.\n     *\n     * @default \"src/entry-client.{tsx,jsx,ts,js,mjs,tsrx}\" when present, else a\n     * generated entry\n     */\n    client?: string;\n    /**\n     * Server entry module. Must export `render(request?, context?)` returning\n     * a `renderToStream` result, an HTML string, or a `Response`.\n     * `context` (typed `StartServerRenderContext`) carries the resolved\n     * client entry URL as `context.clientEntry` and this request's CSP nonce\n     * as `context.nonce`: forward it into `renderToStream`.\n     *\n     * Server mode only — ignored in client mode, where the server entry is\n     * always generated (it renders the document shell without the app, for\n     * dev serving and the build-time prerender). Conventional\n     * `src/entry-server.*` files are likewise ignored there.\n     *\n     * @default \"src/entry-server.{tsx,jsx,ts,js,mjs,tsrx}\" when present, else a\n     * generated entry rendering `<Document><App /></Document>`\n     */\n    server?: string;\n  };\n  /**\n   * Document shell component wrapping the app in generated entries. Receives\n   * `props.children` and must render the full `<html>` document including\n   * `<HydrationScript />` (in client mode, where nothing hydrates, the\n   * handler strips its output from the served/prerendered shell — a shared\n   * Document costs nothing across the flip; the built-in shell omits it per\n   * mode). Only used when the server entry is generated.\n   *\n   * @default \"src/Document.{tsx,jsx,tsrx}\" when present, else a built-in shell\n   */\n  document?: string;\n  /**\n   * Path to a server-only module (resolved relative to the Vite root) whose\n   * default export is one middleware function — `(event, next) => Response\n   * | Promise<Response>`, the request at `event.request` — or an array of\n   * them, composed in order. The chain fronts every request the plugin\n   * dispatches — page SSR, the server-function endpoint, dev and\n   * production, `vite preview` — and runs inside the request-event scope,\n   * so `getRequestEvent()` answers with the same event in application code\n   * (decorate `locals`, write the `response` stub). `next()` advances the\n   * chain and takes no arguments: assign `event.request` before calling it\n   * to substitute the request downstream. Nothing reaches the wire until\n   * the outermost middleware returns, so headers on the returned `Response`\n   * stay mutable after `next()` — streamed bodies included — and error\n   * middleware is a plain `try { return await next(); } catch { ... }`.\n   *\n   * The page render happens inside `next()`, so per-request render inputs\n   * go on the event before calling it: `event.nonce` (the CSP nonce — the\n   * runtime's scripts, preloads and styles, the injected client-entry tag,\n   * the redirect fallback and the dev head tags all carry it) and\n   * `event.renderMode` (`'stream'` or `'async'`, overriding\n   * `start.renderMode` for this request).\n   *\n   * All methods and accept types dispatch through the chain — API routes\n   * and no-JS form POSTs included, in dev exactly as in production. A\n   * non-page request (anything but an HTML-accepting GET) that no\n   * middleware handled falls back to Vite's own pipeline in dev instead of\n   * rendering the page at it.\n   *\n   * @default undefined\n   */\n  middleware?: string;\n  /**\n   * Path to a server-only module (resolved relative to the Vite root) that\n   * runs to completion before anything else in the server graph loads: the\n   * app, the middleware, `@solidjs/web`, every dependency. The seam for code\n   * that must run first, typically instrumentation that patches the runtime\n   * before the modules it patches are loaded: an APM's OpenTelemetry setup\n   * (`Sentry.init()`, `NodeSDK.start()`), a profiler, a custom\n   * `module.register` hook. Replaces the per-host\n   * `node --import instrument.mjs` dance with one option the plugin honors on\n   * every surface: `vite dev`, `vite build`, `vite preview`, and a host\n   * consuming the handler entry directly.\n   *\n   * How: the generated handler entry becomes `await import(serverSetup);\n   * await import(handler)`. Top-level await sequencing is the only thing in\n   * ESM that guarantees the order: every module in a static graph is loaded\n   * before any of them runs, so a loader hook registered by a first import\n   * comes too late, and an async module does not hold back the imports\n   * after it. The\n   * module may be async (top-level `await` is honored) and needs no exports.\n   * It runs once per server start; under `vite dev`, again whenever the\n   * server environment reloads. The server build must keep code splitting on\n   * (the default): inlining dynamic imports would hoist the handler graph\n   * back above the server setup module.\n   *\n   * @default undefined\n   */\n  serverSetup?: string;\n  /**\n   * Path to a server-only module (resolved relative to the Vite root) whose\n   * default export runs before every page render in the generated server\n   * entry, after the middleware chain has dispatched to the page render and\n   * immediately before `renderToStream`: a `StartServerRenderSetup`,\n   * `(event, App) => Component | void | Promise<Component | void>`. The\n   * seam for routers that must prepare an app instance per request before\n   * SSR begins (create a router bound to the\n   * request, `await router.load()`, then render): return a component and the\n   * generated entry renders it in the app's place inside the Document;\n   * return nothing and `<App />` renders unchanged. `event` is the shared\n   * request event, the same one the middleware chain decorated (`locals` are\n   * visible), and the function runs inside the request scope, so\n   * `getRequestEvent()` answers in anything it calls.\n   *\n   * Only page renders run it: server-function calls, and requests a\n   * middleware answers without calling `next()`, never reach it. The\n   * module's top level evaluates once, when the handler loads, so per-request\n   * work belongs in the default export.\n   *\n   * Only meaningful with generated entries: an authored `entry-server`\n   * already owns its render function, so configuring both is an error.\n   * Server mode only. Ignored in client mode (there is no per-request app\n   * render to prepare), so the config survives the `ssr` boolean flip.\n   *\n   * @default undefined\n   */\n  serverRenderSetup?: string;\n  /**\n   * Path to a client module (resolved relative to the Vite root) that the\n   * generated client entry runs before it hydrates (SSR mode) or mounts\n   * (client mode) the app. The browser-side seam for setup that must be in\n   * place before the first render: a server-function transport wrapper or\n   * request-header hook, a `vite:preloadError` listener, an error reporter's\n   * `init()`.\n   *\n   * How: the generated entry imports the module for its side effects ahead\n   * of the app, so a synchronous module finishes before the app's own\n   * modules evaluate. The module may be async (top-level `await` is\n   * honored): `hydrate()` / `render()` waits for it to settle, which lets it\n   * wait for the DOM, for example for a global that a classic `<script>` in\n   * `<body>` defines. While it awaits, the app's modules may already\n   * evaluate, but nothing renders. No exports are needed. The module stays\n   * in the entry's static graph, so the build preloads it and the app's\n   * chunks and stylesheets as before. Editing it reloads the page.\n   *\n   * Only meaningful with a generated client entry: an authored\n   * `entry-client` runs its own code before `hydrate()` already, so\n   * configuring both is an error. Applies to both start modes.\n   *\n   * @default undefined\n   */\n  clientSetup?: string;\n  /**\n   * How the generated handler turns a page render into a response body.\n   *\n   * - `'stream'` (default): the document shell flushes as soon as it is\n   *   ready, with `<Loading>` fallbacks in place; boundary content follows\n   *   in later chunks and is swapped in by inline scripts. Best TTFB, but\n   *   a client that never runs JavaScript (crawlers, `curl`, no-JS\n   *   browsers) is left looking at the fallbacks (solidjs/solid#3280).\n   * - `'async'`: the handler awaits the render until every boundary has\n   *   settled and sends one complete document. Nothing has flushed, so\n   *   each resolved boundary is spliced in place of its placeholder — no\n   *   fallback markup, no swap templates or scripts — while hydration data\n   *   still serializes, so JavaScript clients hydrate exactly as before.\n   *   The tradeoffs are inherent: time-to-first-byte waits for the slowest\n   *   boundary, and the whole page buffers in memory before it is sent.\n   *   `deferStream` is moot here (everything defers), and a `Location`\n   *   header written mid-render becomes a real 3xx instead of the\n   *   post-flush script fallback.\n   *\n   * This is the static default. To decide per request (e.g. `'async'` for\n   * crawler user agents or a `?nojs` flag), set `event.renderMode` in\n   * `start.middleware` before calling `next()`. Hosts driving the handler\n   * directly can override both per call with `handleRequest(request, {\n   * renderMode })`; precedence is that option, then `event.renderMode`,\n   * then this value. Applies to generated and authored entries alike (an\n   * authored `render()` returning a `renderToStream` result is awaited the\n   * same way). Server mode only — ignored in client mode, where the served\n   * shell has no boundaries to settle.\n   *\n   * @default 'stream'\n   */\n  renderMode?: 'stream' | 'async';\n  /**\n   * Enable the development toolbar. By default it is enabled when\n   * `@solidjs/start-devtools` is installed. Setting this to `true` requires\n   * the package, while `false` disables it.\n   *\n   * @default undefined\n   */\n  devtools?: boolean;\n  /**\n   * Add the default production error boundary to generated entries.\n   * Disable this when application middleware owns error handling. Authored\n   * entries are unaffected.\n   *\n   * @default true\n   */\n  productionErrorBoundary?: boolean;\n  /**\n   * Let a host integration own the server environment — build wiring and\n   * HTTP serving alike. The plugin skips its start-mode server-build config and\n   * stands its dev middlewares down (SSR serving and the server-function\n   * endpoint); the generated `virtual:solid-ssr-handler` self-serves\n   * instead, inlining dev styles through a virtual module and composing the\n   * server-function endpoint. Its named `handleRequest(request)` and default\n   * Fetchable exports provide the same contract in dev and production.\n   * Generated entries and the client manifest are still provided.\n   *\n   * Often unnecessary: a provider-owned (non-runnable) `ssr` dev environment\n   * is detected automatically and the middlewares stand down on their own;\n   * the normal `ssr` environment also exposes the handler as an `index`\n   * service entry for provider build orchestrators. Set this only when the\n   * host does not adopt that environment — for example, when it uses a\n   * different name or independently configures the server build. To hand\n   * over only the server-function endpoint, use\n   * `serverFunctions.devMiddleware: false` instead.\n   *\n   * Server mode only — ignored in client mode (there is no server side to\n   * hand over; the shell prerender and, with `serverFunctions`, the\n   * endpoint handler are the whole story).\n   *\n   * @default false\n   */\n  externalServer?: boolean;\n  /**\n   * Emit a ready-to-run Node server next to the server bundle:\n   * `dist/server/node.js` (same outDir as `server.js`). It serves the\n   * client build statically — hashed files under `build.assetsDir` as\n   * `Cache-Control: immutable`, everything else `must-revalidate` — and\n   * dispatches every other request through `handleRequest`, passing the raw\n   * Node request as `nativeEvent` (readable via `getRequestEvent()`), with\n   * the plugin's own node<->web bridge (HTTP/2, abort propagation, HEAD,\n   * backpressure — the same code the dev and preview middlewares run).\n   * `node dist/server/node.js` listens on `PORT` (default 3000) and `HOST`;\n   * the file also exports `listener` (the `(req, res)` function, for\n   * `http.createServer` / Express / Fastify), `createListener({ static?,\n   * event? })` (`static: false` leaves files and the client-mode fallback\n   * to the framework; `event` adds request-event fields next to\n   * `nativeEvent`) and `serve({ port?, host?, static?, event? })`.\n   *\n   * The build also precompresses the client build for it: a `.br` and a\n   * `.gz` beside each text file (JS, CSS, HTML, JSON, SVG and the like) of\n   * 1 KiB or more, served by `Accept-Encoding` with `Vary: Accept-Encoding`.\n   * Rendered pages and other handler responses stream uncompressed.\n   * `nodeServer: { precompress: false }` skips the extra files, for when a\n   * proxy or CDN compresses instead.\n   *\n   * Applies to both start modes. In SSR mode the entry renders pages; in\n   * client mode (with `serverFunctions`, which keeps `dist/server`) it\n   * serves `dist/client` with an `index.html` history fallback for HTML\n   * navigations plus the server-function endpoint. Nothing is emitted when\n   * no server bundle exists — client mode without `serverFunctions`, or\n   * `start.externalServer` — and the build warns. `server.js` and its\n   * `handleRequest` / `{ fetch }` contracts are unchanged: the entry is an\n   * extra emitted asset, not a second build input. Node only — every other\n   * mainstream runtime consumes the server bundle's `{ fetch }` directly.\n   *\n   * @default false\n   */\n  nodeServer?: boolean | NodeServerOptions;\n}\n\n/** The object form of {@link StartOptions.nodeServer}. */\nexport interface NodeServerOptions {\n  /**\n   * Write `.br` and `.gz` variants of the client build's text files for the\n   * Node entry to serve.\n   *\n   * @default true\n   */\n  precompress?: boolean;\n}\n\n// Server-only start-mode request handler; also the server bundle's entry so a\n// production server is one import away from `Request -> Response`. Exported\n// for the main plugin to thread into the server-function dev middleware,\n// which dispatches through it when SSR start mode is active (one middleware\n// chain and one request event across both dispatch paths).\nexport const SSR_HANDLER_ID = 'virtual:solid-ssr-handler';\nconst HANDLER_ID = SSR_HANDLER_ID;\n// With `start.serverSetup`, the handler id becomes a thin wrapper that awaits\n// the server setup module and only THEN imports the real handler under this\n// id — the one way ESM can run something to completion before the rest of\n// the graph is even fetched (static imports are hoisted and evaluated in\n// dependency order, so `import './server-setup'` first would still evaluate\n// AFTER `@solidjs/web` and every module it pulls in).\nconst HANDLER_IMPL_ID = 'virtual:solid-ssr-handler-impl';\n// Dev-only response marker: the generated dev handler answers non-page\n// requests that fell through the whole middleware chain to the terminal\n// page dispatch with a marked 404 instead of rendering HTML at them, and\n// the dev middleware hands those back to Vite's pipeline. Production has no\n// such seam — every unhandled request renders — but production also has no\n// Vite pipeline to fall back to.\nconst DEV_FALLTHROUGH_HEADER = 'x-solid-dev-fallthrough';\n// Private protocol between the two generated modules when `start.serverRenderSetup` is\n// async: the entry hands the handler the renderToStream result under this\n// key, because a promise resolving to the stream BARE would adopt the\n// stream's thenable (which waits for the complete render) and buffer it.\nconst STREAM_BOX = '__solidServerRenderSetupStream';\nconst DEV_STYLES_ID = 'virtual:solid-ssr-dev-styles';\nconst RESOLVED_DEV_STYLES_ID = '\\0' + DEV_STYLES_ID;\n// Generated default entries / document shell. The `.tsx` suffix routes them\n// through the plugin's normal JSX transform (per-environment SSR/DOM\n// compile), exactly like user-authored entry files.\nconst ENTRY_SERVER_ID = 'virtual:solid-ssr-entry-server.tsx';\nconst ENTRY_CLIENT_ID = 'virtual:solid-ssr-entry-client.tsx';\nconst DOCUMENT_ID = 'virtual:solid-ssr-document.tsx';\nconst ERROR_BOUNDARY_ID = 'virtual:solid-ssr-error-boundary.tsx';\n\nconst MANIFEST_ID = 'virtual:solid-manifest';\nconst SERVER_FUNCTION_HANDLER_ID = 'virtual:solid-server-function-handler';\nconst STORAGE_SOURCE = '@solidjs/web/storage';\n\nconst ENTRY_EXTENSIONS = ['.tsx', '.jsx', '.ts', '.js', '.mjs', '.tsrx'];\nconst APP_EXTENSIONS = ['.tsx', '.jsx', '.ts', '.js', '.tsrx'];\nconst DOCUMENT_EXTENSIONS = ['.tsx', '.jsx', '.tsrx'];\n\n// The server bundle's entry file name (start's `entryFileNames` below) and\n// the Node entry `start.nodeServer` emits beside it.\nconst SERVER_ENTRY_FILE = 'server.js';\nconst NODE_ENTRY_FILE = 'node.js';\n// With `start.serverSetup`, node.js only sequences and the runtime moves here.\nconst NODE_RUNTIME_FILE = 'node-runtime.js';\n// The Node entry's runtime, built by rolldown.config.ts as a separate artifact\n// of this package (dist/node-entry.mjs) from src/node-entry/index.ts plus\n// the shared bridge in src/http.ts. Located relative to the plugin module\n// itself: the plugin build (dist/esm/index.mjs) sits one directory below it.\nconst NODE_ENTRY_RUNTIME = new URL('../node-entry.mjs', import.meta.url);\n\n/** Emit-time constants the runtime reads off its generated header. */\ninterface NodeEntryConfig {\n  /** Client outDir relative to the server outDir (posix). */\n  clientDir: string;\n  /** The client build's `assetsDir` (immutable caching). */\n  assetsDir: string;\n  /** The resolved Vite `base`. */\n  base: string;\n  /** Client start mode: index.html fallback for HTML navigations. */\n  spa: boolean;\n  /** The file whose run listens (node.js even when the runtime sits beside it). */\n  entry: string;\n  /** The client build has `.br` / `.gz` variants to serve. */\n  precompressed: boolean;\n}\n\n/**\n * dist/server/node.js: a header carrying the emit-time constants, then the\n * runtime artifact verbatim (its `./server.js` import resolves to the\n * sibling server bundle in the user's dist).\n */\nfunction nodeEntryCode(config: NodeEntryConfig, serverOutDir: string): string {\n  let runtime: string;\n  try {\n    runtime = readFileSync(NODE_ENTRY_RUNTIME, 'utf-8');\n  } catch (error) {\n    throw new Error(\n      `[@solidjs/vite-plugin] start.nodeServer: the Node entry runtime is missing from the plugin ` +\n        `package (expected ${fileURLToPath(NODE_ENTRY_RUNTIME)}). Reinstall @solidjs/vite-plugin; ` +\n        `if you run the plugin from a checkout, run its build first. ` +\n        `Cause: ${error instanceof Error ? error.message : String(error)}`,\n    );\n  }\n  return [\n    `// Generated by @solidjs/vite-plugin (start.nodeServer): the Node server for this build.`,\n    `// Run \\`node ${serverOutDir}/${NODE_ENTRY_FILE}\\` (env: PORT, HOST), or import { listener, createListener, serve }.`,\n    `const SOLID_NODE_CONFIG = ${JSON.stringify(config)};`,\n    runtime.trimEnd(),\n    ``,\n  ].join('\\n');\n}\n\n// With `start.serverSetup`, node.js has no static imports so node:http loads after it (#418).\nfunction serverSetupNodeEntryCode(serverOutDir: string): string {\n  return [\n    `// Generated by @solidjs/vite-plugin (start.nodeServer): the Node server for this build.`,\n    `// Run \\`node ${serverOutDir}/${NODE_ENTRY_FILE}\\` (env: PORT, HOST), or import { listener, createListener, serve }.`,\n    `await import('./${SERVER_ENTRY_FILE}');`,\n    `const entry = await import('./${NODE_RUNTIME_FILE}');`,\n    `export const { listener, createListener, serve } = entry;`,\n    ``,\n  ].join('\\n');\n}\n\nfunction probe(root: string, stem: string, extensions: string[]): string | null {\n  for (const ext of extensions) {\n    if (existsSync(path.resolve(root, stem + ext))) return stem + ext;\n  }\n  return null;\n}\n\n/** Normalizes a user-supplied module path to a root-relative one (no leading slash). */\nfunction normalizeUserPath(root: string, spec: string, option: string): string {\n  const absolute = path.isAbsolute(spec) ? spec : path.resolve(root, spec);\n  if (!existsSync(absolute)) {\n    throw new Error(`[@solidjs/vite-plugin] start.${option} does not exist: ${spec}`);\n  }\n  const relative = path.relative(root, absolute).split(path.sep).join('/');\n  if (relative.startsWith('..')) {\n    throw new Error(`[@solidjs/vite-plugin] start.${option} must live inside the Vite root: ${spec}`);\n  }\n  return relative;\n}\n\n/** True when `directory` is nested inside `parent` and is not `parent` itself. */\nfunction isStrictSubdirectory(parent: string, directory: string): boolean {\n  const relative = path.relative(parent, directory);\n  return (\n    relative !== '' &&\n    relative !== '..' &&\n    !relative.startsWith(`..${path.sep}`) &&\n    !path.isAbsolute(relative)\n  );\n}\n\ntype RenderMode = 'stream' | 'async';\n\n/**\n * Validates `start.renderMode` at config time: `'stream'` or `'async'`.\n * The per-request module form shipped in 3.0.0-next prereleases is gone —\n * per-request decisions are `event.renderMode` in middleware — so a path\n * (or anything else) is a config error carrying the migration.\n */\nfunction resolveRenderMode(value: unknown): RenderMode {\n  if (value === undefined) return 'stream';\n  if (value === 'stream' || value === 'async') return value;\n  const got = typeof value === 'string' ? JSON.stringify(value) : typeof value;\n  throw new Error(\n    `[@solidjs/vite-plugin] start.renderMode must be 'stream' (the default) or 'async'; got ${got}. ` +\n      `The per-request module form was removed: decide per request in start.middleware instead, ` +\n      `by setting the mode on the request event before calling next() — ` +\n      `\\`export default (event, next) => { if (isCrawler(event.request)) event.renderMode = 'async'; return next(); }\\`.`,\n  );\n}\n\ninterface ResolvedEntries {\n  /** Root-relative path or virtual id. */\n  entryServer: string;\n  /** Root-relative path or virtual id. */\n  entryClient: string;\n  /** Whether the entries are generated virtual modules. */\n  generated: boolean;\n  /** Absolute path of the app root component (generated entries only). */\n  app: string | null;\n  /** Absolute path of the document shell, or the built-in virtual id. */\n  document: string | null;\n}\n\nfunction resolveEntries(root: string, options: StartOptions, clientMode: boolean): ResolvedEntries {\n  const explicitClient = options.entries?.client\n    ? normalizeUserPath(root, options.entries.client, 'entries.client')\n    : null;\n\n  if (clientMode) {\n    // Client mode: the server entry is always generated (it renders the\n    // document shell only — no App — for dev serving and the build-time\n    // prerender); `start.entries.server` and conventional src/entry-server.*\n    // files are documented no-ops here, so a project flipping the `ssr`\n    // boolean never has to touch them. No entry pairing rule either: an\n    // authored client entry stands alone. The document resolves in every\n    // case because it IS the page in this mode.\n    const document = options.document\n      ? normalizeUserPath(root, options.document, 'document')\n      : probe(root, 'src/Document', DOCUMENT_EXTENSIONS);\n    const entryClient = explicitClient ?? probe(root, 'src/entry-client', ENTRY_EXTENSIONS);\n    if (entryClient) {\n      return {\n        entryServer: ENTRY_SERVER_ID,\n        entryClient,\n        generated: false,\n        app: null,\n        document: document ? path.resolve(root, document) : null,\n      };\n    }\n    const app = options.app\n      ? normalizeUserPath(root, options.app, 'app')\n      : (probe(root, 'src/App', APP_EXTENSIONS) ?? probe(root, 'src/app', APP_EXTENSIONS));\n    if (!app) {\n      throw new Error(\n        `[@solidjs/vite-plugin] the \\`start\\` option needs an app root: add src/App.tsx ` +\n          `(or set start.app), or provide a src/entry-client.* entry.`,\n      );\n    }\n    return {\n      entryServer: ENTRY_SERVER_ID,\n      entryClient: ENTRY_CLIENT_ID,\n      generated: true,\n      app: path.resolve(root, app),\n      document: document ? path.resolve(root, document) : null,\n    };\n  }\n\n  const explicitServer = options.entries?.server\n    ? normalizeUserPath(root, options.entries.server, 'entries.server')\n    : null;\n  const entryServer = explicitServer ?? probe(root, 'src/entry-server', ENTRY_EXTENSIONS);\n  const entryClient = explicitClient ?? probe(root, 'src/entry-client', ENTRY_EXTENSIONS);\n\n  if (entryServer && entryClient) {\n    return { entryServer, entryClient, generated: false, app: null, document: null };\n  }\n  if (entryServer || entryClient) {\n    // One authored entry with a generated counterpart is a hydration\n    // mismatch waiting to happen — the generated side wraps the app in the\n    // document shell, which the authored side knows nothing about.\n    const found = entryServer ? 'entry-server' : 'entry-client';\n    const missing = entryServer ? 'entry-client' : 'entry-server';\n    throw new Error(\n      `[@solidjs/vite-plugin] found ${found} but no ${missing}; entry files come in pairs. ` +\n        `Provide both (src/entry-server.* and src/entry-client.*, or start.entries.server / ` +\n        `start.entries.client) or neither (to generate both from start.app).`,\n    );\n  }\n\n  const app = options.app\n    ? normalizeUserPath(root, options.app, 'app')\n    : (probe(root, 'src/App', APP_EXTENSIONS) ?? probe(root, 'src/app', APP_EXTENSIONS));\n  if (!app) {\n    throw new Error(\n        `[@solidjs/vite-plugin] the \\`start\\` option needs an app root: add src/App.tsx ` +\n          `(or set start.app), or provide src/entry-server.* and src/entry-client.* entries.`,\n    );\n  }\n  const document = options.document\n    ? normalizeUserPath(root, options.document, 'document')\n    : probe(root, 'src/Document', DOCUMENT_EXTENSIONS);\n\n  return {\n    entryServer: ENTRY_SERVER_ID,\n    entryClient: ENTRY_CLIENT_ID,\n    generated: true,\n    app: path.resolve(root, app),\n    document: document ? path.resolve(root, document) : null,\n  };\n}\n\nexport function startServe(\n  options: StartOptions,\n  internal: {\n    serverFunctions?: boolean;\n    /**\n     * The server-function endpoint as the runtime is configured with it\n     * (leading slash, no `base`); present when `serverFunctions` is on.\n     * The preview middleware exempts everything under it from compression.\n     */\n    serverFunctionsEndpoint?: string;\n    serverComponents?: boolean;\n    ssr?: boolean;\n    styleFilter?: DevStyleFilter;\n    /** `'auto'` = enable when the app has `@solidjs/diagnostics` installed. */\n    diagnostics?: boolean | 'auto';\n    /**\n     * Import the Chrome Performance panel tracks module\n     * (`virtual:solid-performance-tracks`, served by the\n     * `solid:performance-tracks` plugin) at the top of the client entry\n     * under dev serve. Skipped, like that plugin, when the app's\n     * `@solidjs/web` lacks the subpath.\n     */\n    performanceTracks?: boolean;\n    /**\n     * Reports the resolved document shell path (absolute, or null when the\n     * built-in virtual document is used) back to the main plugin, which\n     * declines HMR for that module's client compile (solidjs/solid#3151).\n     */\n    onDocumentResolved?: (documentPath: string | null) => void;\n    /**\n     * Reports the client entry this plugin adds to the client build's input\n     * (the virtual generated entry id, or the authored entry's absolute\n     * path) back to the main plugin, which stamps it as `_entry` on\n     * `virtual:solid-manifest` so the built handler and the runtime never\n     * have to guess the entry among other configured inputs (#353).\n     */\n    onClientEntryResolved?: (entryId: string) => void;\n    /**\n     * Reports whether the client build's manifest is on only because this\n     * plugin turned it on (a build without `start.externalServer` and without\n     * a `build.manifest` of the app's), so the main plugin may remove it once\n     * a server build in the same process has read it.\n     */\n    onClientManifestOwned?: (owned: boolean) => void;\n  } = {},\n): Plugin[] {\n  // Renamed before the stable release, without aliases: name the\n  // replacement instead of silently ignoring the old key.\n  for (const [key, replacement] of [\n    ['entryServer', 'entries.server'],\n    ['entryClient', 'entries.client'],\n  ]) {\n    if (key in options) {\n      throw new Error(\n        `[@solidjs/vite-plugin] \\`start.${key}\\` has been renamed to \\`start.${replacement}\\`.`,\n      );\n    }\n  }\n  // Client mode (the `start` option without `ssr: true`) rides this exact\n  // plugin with three deltas: the generated server entry renders the\n  // document shell WITHOUT the app (dev serving doubles as history\n  // fallback, and a post-build hook prerenders it once into\n  // dist/client/index.html), the generated client entry render()s instead\n  // of hydrating, and dist/server is dropped from the output unless\n  // `serverFunctions` needs it for the endpoint. Everything else — entry\n  // probing, the handler, middleware, dev styles, the manifest — is shared,\n  // which is what makes flipping a project between the modes a one-boolean\n  // config change.\n  const clientMode = !internal.ssr;\n  // Server components (`serverFunctions: { components: true }`): generated\n  // entries additionally emit the document-SSR wiring — the render plugin +\n  // direct-call transform server-side, the bootstrap script in <head>, and\n  // the client-side installServerComponents() call. Authored entries carry\n  // those pieces themselves (the endpoint response transform is installed by\n  // the server-function handler module either way). Everything is gated\n  // codegen: with the option off, none of these imports exist anywhere.\n  const serverComponents = !!internal.serverComponents;\n  if ('errorBoundary' in options) {\n    // Renamed before the stable release, without an alias.\n    throw new Error(\n      '[@solidjs/vite-plugin] `start.errorBoundary` has been renamed to ' +\n        '`start.productionErrorBoundary`.',\n    );\n  }\n  const productionErrorBoundary = options.productionErrorBoundary !== false;\n  const styleFilter = internal.styleFilter;\n  // `'auto'` resolves against the project root in configResolved, before\n  // any of the (lazy) uses in entry codegen and the entry transform.\n  let diagnostics = internal.diagnostics === true;\n  // Resolved in configResolved (dev serve, non-test, subpath present) —\n  // the performance-tracks import is the first line of the client entry.\n  let performanceTracks = false;\n  let devtoolsEnabled = false;\n  // Toolbar detection, memoized per consumer: whether @solidjs/start-devtools\n  // resolves at all, and the app importer it was probed from. Only the\n  // verdict is kept — the resolved id is deliberately not (see resolveId).\n  let devtoolsDetections: Partial<Record<'client' | 'server', Promise<boolean>>> = {};\n  let devtoolsImporters: Partial<Record<'client' | 'server', string>> = {};\n  // `externalServer` is server-mode-only (documented no-op in client mode, so a\n  // host-integrated config survives the `ssr` boolean flip untouched).\n  const externalServer = !clientMode && !!options.externalServer;\n  // `start.nodeServer` emits dist/server/node.js beside the server bundle,\n  // only where a server bundle exists to wrap. Client mode without server\n  // functions keeps no dist/server (the prerender hook removes it), and\n  // `start.externalServer` hands the server build to a host; both warn at build\n  // time and emit nothing.\n  const nodeEntry = !!options.nodeServer;\n  const nodeEntryApplies =\n    nodeEntry && !externalServer && (!clientMode || !!internal.serverFunctions);\n  const precompress =\n    nodeEntryApplies &&\n    (typeof options.nodeServer !== 'object' || options.nodeServer.precompress !== false);\n  // Resolved build outDirs (absolute) of the client and ssr environments,\n  // for the entry's client-directory constant. The client's generateBundle\n  // overrides with the directory it actually wrote to (a host orchestrator\n  // may relocate it) when both environments build in one process.\n  let clientOutDir: string | null = null;\n  let serverOutDir: string | null = null;\n  let clientAssetsDir = 'assets';\n  let root = process.cwd();\n  let base = '/';\n  let isBuild = false;\n  // Set from the config hook, before Vite installs the default no-op\n  // `builder.buildApp`. A user or host callback here means the SSR service\n  // must survive client-mode prerender even with server functions off.\n  let configBuildApp = false;\n  let entries: ResolvedEntries | undefined;\n  /** Absolute path of the user's middleware module, when configured. */\n  let middlewarePath: string | null = null;\n  /** Absolute path of the server setup module awaited before the handler graph, when configured. */\n  let serverSetupPath: string | null = null;\n  /** Absolute path of the render setup module, when configured (server mode). */\n  let serverRenderSetupPath: string | null = null;\n  /** Absolute path of the client setup module run before hydrate/render, when configured. */\n  let clientSetupPath: string | null = null;\n  /**\n   * `start.renderMode`, resolved at config time: the static mode baked into\n   * the handler (server mode only — a documented no-op in client mode,\n   * whose shell has no boundaries to settle).\n   */\n  let renderMode: RenderMode = 'stream';\n\n  function requireEntries(): ResolvedEntries {\n    // config() always runs before resolveId/load/configureServer.\n    if (!entries) throw new Error('[@solidjs/vite-plugin] SSR entries not resolved yet');\n    return entries;\n  }\n\n  type DevtoolsResolve = (source: string, importer: string) => Promise<{ id: string } | null>;\n\n  /**\n   * Resolve @solidjs/start-devtools for generated code: from the app graph\n   * first (the documented install location), then from the plugin's own\n   * file — in pnpm-isolated apps a copy that is only a dependency of the\n   * plugin is not reachable from the app's importers. Resolving from the\n   * plugin's own file never yields null when the package is absent: it is\n   * declared an optional peer dependency, so Vite answers with its\n   * `__vite-optional-peer-dep:` stub (an empty module). That stub counts as\n   * \"not installed\".\n   */\n  async function resolveDevtoolsId(\n    resolve: DevtoolsResolve,\n    importer: string,\n  ): Promise<string | null> {\n    const realId = (resolved: { id: string } | null) =>\n      resolved && !resolved.id.startsWith('__vite-optional-peer-dep:') ? resolved.id : null;\n    return (\n      realId(await resolve(DEVTOOLS_PACKAGE, importer)) ??\n      realId(await resolve(DEVTOOLS_PACKAGE, fileURLToPath(import.meta.url)))\n    );\n  }\n\n  async function resolveDevtools(\n    resolve: DevtoolsResolve,\n    importer: string,\n    consumer: 'client' | 'server',\n  ): Promise<boolean> {\n    if (!devtoolsEnabled) return false;\n    // An install cannot change under a running server, so the verdict is\n    // memoized per consumer. The id it was reached with is not reused for\n    // generated imports: resolveId resolves afresh from the same importer.\n    devtoolsImporters[consumer] ??= importer;\n    devtoolsDetections[consumer] ??= resolveDevtoolsId(resolve, importer).then((id) => id !== null);\n    const detected = await devtoolsDetections[consumer];\n    if (!detected && options.devtools === true) {\n      throw new Error(\n        '[@solidjs/vite-plugin] start.devtools requires @solidjs/start-devtools. ' +\n          'Install it as a development dependency or set start.devtools to false.',\n      );\n    }\n    return detected;\n  }\n\n  /**\n   * Cheap walk-up probe mirroring how the optimizer resolves bare\n   * `optimizeDeps.include` entries: is @solidjs/start-devtools reachable from\n   * this directory? Detection proper (resolveDevtools) runs later with a real\n   * importer; this only decides whether the toolbar graph can be pre-bundled\n   * at scan time.\n   */\n  function devtoolsReachableFrom(dir: string): boolean {\n    for (let current = dir; ; ) {\n      if (existsSync(path.join(current, 'node_modules', DEVTOOLS_PACKAGE, 'package.json'))) {\n        return true;\n      }\n      const parent = path.dirname(current);\n      if (parent === current) return false;\n      current = parent;\n    }\n  }\n\n  /**\n   * The `optimizeDeps.include` spec that pre-bundles the toolbar graph, or\n   * null when it cannot be resolved at all. Pre-bundling it is not just a\n   * warm-start nicety: the toolbar hangs off virtual modules the scanner\n   * never crawls, so without an include the optimizer only discovers it on\n   * first request. That re-optimize can pair chunks from different passes\n   * whose shared minified exports disagree, taking down the whole client\n   * entry graph. The spec must therefore cover every install shape\n   * resolveDevtools accepts: bare when the app installs the package, and\n   * Vite's nested-include form (`plugin > dep`) when it is only a dependency\n   * of this plugin (pnpm-isolated installs).\n   */\n  function devtoolsIncludeSpec(rootDir: string): string | null {\n    if (devtoolsReachableFrom(rootDir)) return DEVTOOLS_PACKAGE;\n    if (devtoolsReachableFrom(path.dirname(fileURLToPath(import.meta.url)))) {\n      return `@solidjs/vite-plugin > ${DEVTOOLS_PACKAGE}`;\n    }\n    return null;\n  }\n\n  /** Import specifier for generated code: absolute for files, id for virtuals. */\n  function entryServerSpec(): string {\n    const { entryServer } = requireEntries();\n    return entryServer === ENTRY_SERVER_ID ? entryServer : path.resolve(root, entryServer);\n  }\n\n  /** Browser URL of the client entry on the dev server (base applied). */\n  function devClientEntryUrl(): string {\n    const { entryClient } = requireEntries();\n    return entryClient === ENTRY_CLIENT_ID\n      ? joinBase(base, '/@id/' + ENTRY_CLIENT_ID)\n      : joinBase(base, '/' + entryClient);\n  }\n\n  function documentSpec(): string {\n    const { document } = requireEntries();\n    return document ?? DOCUMENT_ID;\n  }\n\n  function styleRoots(): string[] {\n    const { generated, app, document, entryServer, entryClient } = requireEntries();\n    if (clientMode) {\n      // The app graph's CSS is inlined into the dev shell too (not just the\n      // document's): the client injects it again when the modules load and\n      // the dev style patch dedupes, so this is pure anti-flash.\n      return [\n        generated ? app! : path.resolve(root, entryClient),\n        ...(document ? [document] : []),\n      ];\n    }\n    return generated ? [app!, ...(document ? [document] : [])] : [path.resolve(root, entryServer)];\n  }\n\n  async function devStylesModuleCode(\n    environment: DevEnvironment,\n    watchFile: (file: string) => void,\n  ): Promise<string> {\n    const styles = await collectDevStyleSources(\n      environment,\n      styleRoots(),\n      watchFile,\n      styleFilter,\n    );\n    if (!styles.length) return `export default '';`;\n\n    const imports = styles.map((style, index) => {\n      const specifier = style.url.includes('?') ? `${style.url}&inline` : `${style.url}?inline`;\n      return `import css${index} from ${JSON.stringify(specifier)};`;\n    });\n    return [\n      ...imports,\n      `const ids = ${JSON.stringify(styles.map((style) => style.id))};`,\n      `const css = [${styles.map((_, index) => `css${index}`).join(', ')}];`,\n      `const escapeAttr = value => value.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;');`,\n      `export default css.map((content, index) => {`,\n      `  const id = escapeAttr(ids[index]);`,\n      `  return '<style data-asset=\"' + id + '\" data-vite-dev-id=\"' + id + '\">' +`,\n      `    content.replace(/<\\\\/(style)/gi, '<\\\\\\\\/$1') + '</style>';`,\n      `}).join('');`,\n    ].join('\\n');\n  }\n\n  function errorBoundaryImport(): string[] {\n    return isBuild && productionErrorBoundary\n      ? [`import { DefaultErrorBoundary } from ${JSON.stringify(ERROR_BOUNDARY_ID)};`]\n      : [];\n  }\n\n  function documentTree(root: string, wrapper?: string): string[] {\n    const content = wrapper ? `<${wrapper}><${root} /></${wrapper}>` : `<${root} />`;\n    return isBuild && productionErrorBoundary\n      ? [\n          `  <DefaultErrorBoundary>`,\n          `    <Document>`,\n          `      <DefaultErrorBoundary>`,\n          `        ${content}`,\n          `      </DefaultErrorBoundary>`,\n          `    </Document>`,\n          `  </DefaultErrorBoundary>`,\n        ]\n      : [`  <Document>`, `    ${content}`, `  </Document>`];\n  }\n\n  function generatedEntryServerCode(toolbar: boolean): string {\n    if (clientMode) {\n      // The client-mode shell: the document without the app. Rendered per\n      // request in dev (any HTML GET gets it — history-fallback semantics)\n      // and once at build time into dist/client/index.html. The client\n      // entry script is injected by the handler, exactly like SSR mode.\n      return [\n        `import { renderToStream${isBuild ? '' : ', getRequestEvent'} } from '@solidjs/web';`,\n        `import manifest from ${JSON.stringify(MANIFEST_ID)};`,\n        `import Document from ${JSON.stringify(documentSpec())};`,\n        ...errorBoundaryImport(),\n        ``,\n        `export function render(request, context) {`,\n        `  return renderToStream(() => (`,\n        ...(isBuild && productionErrorBoundary\n          ? [\n              `  <DefaultErrorBoundary>`,\n              `    <Document />`,\n              `  </DefaultErrorBoundary>`,\n            ]\n          : [`  <Document />`]),\n        // A build prerenders this shell once into dist/client/index.html,\n        // so it must not carry a request's nonce; dev renders it per\n        // request, so the request's nonce applies there.\n        `  ), { manifest${isBuild ? '' : ', nonce: getRequestEvent()?.nonce'} });`,\n        `}`,\n      ].join('\\n');\n    }\n    const { app } = requireEntries();\n    // `event.nonce` was validated (and host-overridden) by the handler\n    // before the render; @solidjs/web reads the nonce from the options only,\n    // so the entry hands it over explicitly. The request's `signal` (aborted\n    // by the Node bridge on client disconnect) goes the same way, so a render\n    // still pending when the client leaves is disposed instead of waiting on\n    // its async reads (#467).\n    const streamOptions = `{ manifest, nonce: getRequestEvent()?.nonce, signal: getRequestEvent()?.request.signal${serverComponents ? ', plugins: [ServerComponentPlugin]' : ''} }`;\n    return [\n      `import { renderToStream, getRequestEvent } from '@solidjs/web';`,\n      ...(serverComponents\n        ? [\n            `import { configureServerFunctionsServer } from '@solidjs/web/server-functions';`,\n            `import { frameTransformDirectResult, ServerComponentPlugin } from '@solidjs/web/frames';`,\n          ]\n        : []),\n      `import manifest from ${JSON.stringify(MANIFEST_ID)};`,\n      `import Document from ${JSON.stringify(documentSpec())};`,\n      `import App from ${JSON.stringify(app)};`,\n      ...(toolbar ? [`import { DevToolbar } from ${JSON.stringify(DEVTOOLS_PACKAGE)};`] : []),\n      ...errorBoundaryImport(),\n      ...(serverRenderSetupPath ? [`import serverRenderSetup from ${JSON.stringify(serverRenderSetupPath)};`] : []),\n      ``,\n      ...(serverRenderSetupPath\n        ? [\n            `if (typeof serverRenderSetup !== 'function') {`,\n            `  throw new Error('[@solidjs/vite-plugin] start.serverRenderSetup must default-export a function ' +`,\n            `    '((event, App) => Component | void | Promise<...>): ' + ${JSON.stringify(options.serverRenderSetup)});`,\n            `}`,\n            ``,\n          ]\n        : []),\n      ...(serverComponents\n        ? [\n            // Direct (in-process) server-function calls made during document\n            // SSR must resolve to inline-renderable components; the endpoint\n            // response transform is installed separately by the\n            // server-function handler module (configure calls merge per key).\n            `configureServerFunctionsServer({ transformDirectResult: frameTransformDirectResult });`,\n            ``,\n          ]\n        : []),\n      ...(serverRenderSetupPath\n        ? [\n            // The per-request seam: the hook sees the same event the\n            // middleware chain decorated and finishes before renderToStream\n            // starts. When it is async, the stream must NOT cross the\n            // promise boundary bare — a promise resolving to a\n            // renderToStream result adopts its thenable (which waits for\n            // the *complete* render) and buffers the stream — so it crosses\n            // boxed under a private key the generated handler unboxes\n            // (both modules are ours).\n            `export function render(request, context) {`,\n            `  const prepared = serverRenderSetup(getRequestEvent(), App);`,\n            `  if (prepared && typeof prepared.then === 'function') {`,\n            `    return prepared.then((component) => ({ ${STREAM_BOX}: renderApp(component || App) }));`,\n            `  }`,\n            `  return renderApp(prepared || App);`,\n            `}`,\n            ``,\n            `function renderApp(Root) {`,\n            `  return renderToStream(() => (`,\n            ...documentTree('Root', toolbar ? 'DevToolbar' : undefined),\n            `  ), ${streamOptions});`,\n            `}`,\n          ]\n        : [\n            `export function render(request, context) {`,\n            `  return renderToStream(() => (`,\n            ...documentTree('App', toolbar ? 'DevToolbar' : undefined),\n            `  ), ${streamOptions});`,\n            `}`,\n          ]),\n    ].join('\\n');\n  }\n\n  function generatedEntryClientCode(toolbar: boolean): string {\n    const { app } = requireEntries();\n    // Dev-only: the diagnostics bridge fronts dev-mode channels, so builds\n    // never see this import (mirrors the plugin's own serve-only `apply`).\n    const diagnosticsImport =\n      diagnostics && !isBuild ? [`import ${JSON.stringify(DIAGNOSTICS_CLIENT_ID)};`] : [];\n    // Dev-serve-only likewise, and FIRST: the tracks must be enabled before\n    // anything renders — the module's side effect runs in import order, so\n    // it precedes the toolbar's and the app's module evaluation and the\n    // render/hydration call below, which land on the timeline. (The JSX\n    // compiler hoists its own runtime helper import above it; evaluating\n    // `@solidjs/web` renders nothing.) `performanceTracks` is already false\n    // on builds (configResolved), so the import can never reach a bundle.\n    const performanceTracksImport =\n      performanceTracks && !isBuild\n        ? [`import ${JSON.stringify(PERFORMANCE_TRACKS_CLIENT_ID)};`]\n        : [];\n    // `start.clientSetup`: imported for its side effects ahead of the app,\n    // after the dev-only tooling above so its failures reach the overlay.\n    // A static import, not `await import()` like `start.serverSetup`: a\n    // dynamic import would move the app into a separate chunk the server\n    // neither preloads nor links CSS for. The entry body (hydrate/render)\n    // still waits for an async module's top-level await to settle.\n    const clientSetupImport = clientSetupPath\n      ? [`import ${JSON.stringify(clientSetupPath)};`]\n      : [];\n    if (clientMode) {\n      // render(), not hydrate(): the shell's body is empty, the app mounts\n      // fresh. Client code compiles non-hydratable in client mode, so the\n      // app cannot claim server DOM anyway. The entry script is injected\n      // without `async` (plain module = deferred), so document.body is\n      // complete when this runs.\n      return [\n        ...performanceTracksImport,\n        ...diagnosticsImport,\n        ...clientSetupImport,\n        `import { render } from '@solidjs/web';`,\n        ...errorBoundaryImport(),\n        ...(toolbar ? [`import { DevToolbar } from ${JSON.stringify(DEVTOOLS_PACKAGE)};`] : []),\n        ...(toolbar ? devtoolsConnectCode() : []),\n        `import App from ${JSON.stringify(app)};`,\n        ``,\n        `render(() => ${\n          isBuild && productionErrorBoundary\n            ? '<DefaultErrorBoundary><App /></DefaultErrorBoundary>'\n            : toolbar\n              ? '<DevToolbar><App /></DevToolbar>'\n              : '<App />'\n        }, document.body);`,\n      ].join('\\n');\n    }\n    return [\n      ...performanceTracksImport,\n      ...diagnosticsImport,\n      ...clientSetupImport,\n      `import { hydrate } from '@solidjs/web';`,\n      ...(toolbar ? [`import { DevToolbar } from ${JSON.stringify(DEVTOOLS_PACKAGE)};`] : []),\n      ...(toolbar ? devtoolsConnectCode() : []),\n      ...(serverComponents\n        ? [`import { installServerComponents } from '@solidjs/web/frames';`]\n        : []),\n      ...errorBoundaryImport(),\n      `import Document from ${JSON.stringify(documentSpec())};`,\n      `import App from ${JSON.stringify(app)};`,\n      ``,\n      ...(serverComponents\n        ? [\n            // Installs the t=0 document-adoption registry and the transport\n            // policy (component responses morph their boundary instead of\n            // decoding as data). Must run before hydrate().\n            `installServerComponents();`,\n            ``,\n          ]\n        : []),\n      `hydrate(() => (`,\n      ...documentTree('App', toolbar ? 'DevToolbar' : undefined),\n      `), document);`,\n    ].join('\\n');\n  }\n\n  // Built-in document shell: minimal, hydration-ready. The client entry\n  // script is injected into <head> by the handler (not rendered here) so its\n  // URL never has to survive hydration or a manifest lookup client-side.\n  // The client-mode variant drops <HydrationScript /> — nothing hydrates,\n  // so the shell stays inert HTML. (A user-authored Document carrying\n  // HydrationScript is covered too: the handler strips the event-capture\n  // script from the client-mode shell.)\n  const documentShellCode = [\n    ...(clientMode ? [] : [`import { HydrationScript } from '@solidjs/web';`, ``]),\n    `export default function Document(props) {`,\n    `  return (`,\n    `    <html lang=\"en\">`,\n    `      <head>`,\n    `        <meta charset=\"utf-8\" />`,\n    `        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />`,\n    ...(clientMode ? [] : [`        <HydrationScript />`]),\n    `      </head>`,\n    `      <body>{props.children}</body>`,\n    `    </html>`,\n    `  );`,\n    `}`,\n  ].join('\\n');\n\n  const errorBoundaryCode = [\n    `import { Errored } from 'solid-js';`,\n    `import { httpStatus, isServer } from '@solidjs/web';`,\n    ``,\n    `function ErrorFallback(props) {`,\n    `  console.error(props.error());`,\n    `  httpStatus(500);`,\n    `  return (`,\n    `    <span style=\"font-size:1.5em;text-align:center;position:fixed;left:0;bottom:55%;width:100%\">`,\n    `      {isServer ? '500 | Internal Server Error' : 'Error | Uncaught Client Exception'}`,\n    `    </span>`,\n    `  );`,\n    `}`,\n    ``,\n    `export function DefaultErrorBoundary(props) {`,\n    `  return (`,\n    `    <Errored fallback={(error) => <ErrorFallback error={error} />}>`,\n    `      {props.children}`,\n    `    </Errored>`,\n    `  );`,\n    `}`,\n  ].join('\\n');\n\n  // The handler module: dev and prod share the render/response plumbing;\n  // they differ in how the client entry URL is known (baked dev URL vs a\n  // manifest scan) and what gets injected into <head> (Vite client + style\n  // patch in dev). The response-head lifecycle is the runtime's\n  // (`createRequestEvent`/`createSSRResponse`/`commitEventResponse` from\n  // @solidjs/web): every request runs under a stub-backed event,\n  // `httpStatus`/`httpHeader` writes land on the wire at shell flush, a\n  // pre-flush redirect becomes a real 3xx and a post-flush one the script\n  // fallback, and a Response that skipped the render lifecycle (middleware\n  // early return, raw entry.render Response, server functions) has the\n  // stub folded on at the handler edge after the middleware chain fully\n  // unwinds. When\n  // `serverFunctions` is enabled the endpoint is dispatched here on every\n  // surface (the runnable-dev middleware routes through this module), so\n  // user middleware and the shared request event front it identically.\n  /**\n   * The handler entry with `start.serverSetup`: sequence the server setup\n   * module to completion, then load the real handler. The two awaits are\n   * the contract — see the option's docs. Exports are re-declared by name\n   * (the handler's surface is fixed: `handleRequest` and the `fetch`\n   * default) because a static `export * from` would be hoisted like any\n   * other static import and defeat the ordering.\n   */\n  function serverSetupHandlerCode(): string {\n    return [\n      `await import(${JSON.stringify(serverSetupPath)});`,\n      `const handler = await import(${JSON.stringify(HANDLER_IMPL_ID)});`,\n      `export const handleRequest = handler.handleRequest;`,\n      `export default handler.default;`,\n      ``,\n    ].join('\\n');\n  }\n\n  function handlerModuleCode(externalDev: boolean): string {\n    const { generated, entryClient } = requireEntries();\n    const composeServerFunctions = internal.serverFunctions;\n\n    const lines = [\n      `import { createRequestEvent, createSSRResponse, commitEventResponse, isResponseEnvelope${isBuild ? ', reportRequestFailure' : ''} } from '@solidjs/web';`,\n      `import { provideRequestEvent } from ${JSON.stringify(STORAGE_SOURCE)};`,\n      `import * as entry from ${JSON.stringify(entryServerSpec())};`,\n      ...(middlewarePath\n        ? [`import middlewareModule from ${JSON.stringify(middlewarePath)};`]\n        : []),\n      ...(externalDev ? [`import DEV_STYLES_HEAD from ${JSON.stringify(DEV_STYLES_ID)};`] : []),\n      ...(composeServerFunctions\n        ? [\n            `import { handleServerFunctionRequest, endpoint } from ${JSON.stringify(SERVER_FUNCTION_HANDLER_ID)};`,\n          ]\n        : []),\n    ];\n\n    if (isBuild) {\n      lines.push(`import manifest from ${JSON.stringify(MANIFEST_ID)};`);\n      lines.push(\n        ``,\n        `function joinAssetPath(base, file) {`,\n        `  if (typeof base !== 'string' || !base) base = '/';`,\n        `  if (base[base.length - 1] !== '/') base += '/';`,\n        `  return base + (file[0] === '/' ? file.slice(1) : file);`,\n        `}`,\n        ``,\n        `let clientEntryUrl;`,\n        `function resolveClientEntry() {`,\n        `  if (clientEntryUrl !== undefined) return clientEntryUrl;`,\n        `  clientEntryUrl = null;`,\n        // The plugin's manifest module names the client entry it injected\n        // into the build (`_entry`): every configured input is a genuine\n        // `isEntry` record (a filesystem router's `buildInputs` lists every\n        // route module), so scanning for the first flagged record would pick\n        // whichever sorts first (#353). The scan stays as the fallback for\n        // hand-rolled manifests without the stamp.\n        `  const stamped = manifest._entry && manifest[manifest._entry];`,\n        `  if (stamped && stamped.file) {`,\n        `    return (clientEntryUrl = joinAssetPath(manifest._base, stamped.file));`,\n        `  }`,\n        `  for (const key in manifest) {`,\n        `    const chunk = manifest[key];`,\n        `    if (chunk && chunk.isEntry && chunk.file) {`,\n        `      clientEntryUrl = joinAssetPath(manifest._base, chunk.file);`,\n        `      break;`,\n        `    }`,\n        `  }`,\n        `  return clientEntryUrl;`,\n        `}`,\n      );\n    } else {\n      // Built per request from the nonce attributes: under a nonce-based CSP\n      // the two scripts carry the script nonce (`'strict-dynamic'` then\n      // trusts the modules the Vite client loads) and the collected dev\n      // styles carry the style nonce.\n      lines.push(\n        ``,\n        `function devHead(nonceAttr) {`,\n        `  return '<script' + nonceAttr + '>' + ${JSON.stringify(devStylePatch)} + '</' + 'script>' +`,\n        `    '<script type=\"module\"' + nonceAttr + ' src=' + ${JSON.stringify(JSON.stringify(joinBase(base, '/@vite/client')))} + '></' + 'script>';`,\n        `}`,\n        ``,\n        `function devStyles(html, styleAttr) {`,\n        `  return styleAttr ? html.split('<style data-asset=').join('<style' + styleAttr + ' data-asset=') : html;`,\n        `}`,\n      );\n    }\n\n    // Middleware: the user module default-exports one `(event, next)`\n    // function or an array, composed in order. Without one, the chain\n    // degenerates to the terminal dispatch.\n    lines.push(``);\n    if (middlewarePath) {\n      lines.push(\n        `const middlewares = Array.isArray(middlewareModule) ? middlewareModule : [middlewareModule];`,\n        `for (const mw of middlewares) {`,\n        `  if (typeof mw !== 'function') {`,\n        `    throw new Error('[@solidjs/vite-plugin] start.middleware must default-export a function or an array of functions: ' + ${JSON.stringify(middlewarePath)});`,\n        `  }`,\n        `}`,\n        // The plugin's own composition (event-first, unlike @solidjs/web's\n        // request-first composeMiddleware): each middleware receives the\n        // event, and next() takes no arguments — the request a later\n        // middleware, the server-function endpoint and the render see is\n        // always `event.request`, so substituting it is an assignment.\n        `function runMiddleware(event, last) {`,\n        `  let index = -1;`,\n        `  function dispatch(i) {`,\n        `    if (i <= index) return Promise.reject(new Error('[@solidjs/vite-plugin] next() called multiple times in start.middleware'));`,\n        `    index = i;`,\n        `    if (i === middlewares.length) return Promise.resolve(last());`,\n        `    return Promise.resolve(middlewares[i](event, function next() {`,\n        `      if (arguments.length && arguments[0] !== undefined) {`,\n        `        return Promise.reject(new TypeError('[@solidjs/vite-plugin] start.middleware: next() takes no arguments. ' +`,\n        `          'Middleware receives the request event — (event, next) — so to substitute the request, assign ' +`,\n        `          'event.request = newRequest before calling next().'));`,\n        `      }`,\n        `      return dispatch(i + 1);`,\n        `    }));`,\n        `  }`,\n        `  return dispatch(0);`,\n        `}`,\n      );\n    } else {\n      lines.push(`const runMiddleware = (event, next) => next();`);\n    }\n\n    // Per-request render inputs live on the request event: `event.renderMode`\n    // and `event.nonce`, set by middleware before next() (the render runs\n    // inside it). Precedence per request: the `handleRequest` option (seeded\n    // onto the event before the chain and reasserted at dispatch), then the\n    // event field, then the static config. Render mode: 'stream' flushes the\n    // shell with fallbacks in place and streams boundary content after it;\n    // 'async' adopts the renderToStream result's thenable — which waits for\n    // the complete render — so one settled document goes out (the fix for\n    // no-JS clients, solidjs/solid#3280). Every source is validated against\n    // the two literals with the offender named.\n    lines.push(\n      ``,\n      `function assertRenderMode(mode, source) {`,\n      `  if (mode !== 'stream' && mode !== 'async') {`,\n      `    throw new Error('[@solidjs/vite-plugin] ' + source + \" must be 'stream' or 'async', got \" + JSON.stringify(mode));`,\n      `  }`,\n      `  return mode;`,\n      `}`,\n    );\n\n    // CSP nonce: @solidjs/web's `CSPNonce`, a string or a `{ script, style }`\n    // pair with both keys, each a non-empty string or `false`. An empty\n    // value (undefined, null or '') means none, as in the runtime. Anything\n    // else is rejected: projected as is, a typo'd key or a number would\n    // leave the tags without a nonce without a word.\n    lines.push(\n      ``,\n      `function assertNonce(nonce, source) {`,\n      `  if (nonce == null || typeof nonce === 'string') return nonce || undefined;`,\n      `  const prototype = typeof nonce === 'object' ? Object.getPrototypeOf(nonce) : undefined;`,\n      `  const destination = (value) => value === false || (typeof value === 'string' && value !== '');`,\n      `  if (`,\n      `    (prototype === Object.prototype || prototype === null) &&`,\n      `    Object.keys(nonce).every((key) => key === 'script' || key === 'style') &&`,\n      `    destination(nonce.script) &&`,\n      `    destination(nonce.style)`,\n      `  ) {`,\n      `    return nonce;`,\n      `  }`,\n      `  const got = Array.isArray(nonce) ? 'an array' : prototype ? 'an object with keys ' + JSON.stringify(Object.keys(nonce)) : typeof nonce;`,\n      `  throw new Error('[@solidjs/vite-plugin] ' + source + ' must be a string, a { script, style } object (each a non-empty string or false), or undefined; got ' + got);`,\n      `}`,\n      ``,\n      `function assertHostOptions(options) {`,\n      `  if (options.renderMode !== undefined) assertRenderMode(options.renderMode, 'handleRequest options.renderMode');`,\n      `  assertNonce(options.nonce, 'handleRequest options.nonce');`,\n      `}`,\n    );\n\n    // No `_$SC` bootstrap injection: the runtime's serialized\n    // server-component references self-bootstrap the registry (each\n    // hydration script's first reference carries it as an idempotent\n    // expression), so nothing needs to precede the data scripts. The old\n    // head-open splice actively broke hydration — a script ahead of the\n    // authored <head> elements claims as the first walked child and drifts\n    // every positional claim after it.\n    lines.push(\n      ``,\n      `function escapeAttribute(value) {`,\n      `  return value.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;');`,\n      `}`,\n      ``,\n      `function nonceAttribute(value) {`,\n      `  return value ? ' nonce=\"' + escapeAttribute(value) + '\"' : '';`,\n      `}`,\n      ``,\n      // One destination of a `CSPNonce` (a string, or a `{ script, style }`\n      // pair with `false` for an un-nonced destination). Kept local: the\n      // matching @solidjs/web helpers are internal.\n      `function destinationNonce(nonce, destination) {`,\n      `  const value = typeof nonce === 'string' ? nonce : nonce && nonce[destination];`,\n      `  return typeof value === 'string' && value ? value : undefined;`,\n      `}`,\n      ``,\n      // The client entry and the dev scripts take the script destination of\n      // a `{ script, style }` pair; the dev styles and the csp-nonce meta the\n      // style destination.\n      `function createHtmlChunkTransform(clientEntry, extraHead, nonce) {`,\n      `  const nonceAttr = nonceAttribute(destinationNonce(nonce, 'script'));`,\n      `  const styleAttr = nonceAttribute(destinationNonce(nonce, 'style'));`,\n      `  let first = true;`,\n      `  let injected = false;`,\n      `  return (chunk) => {`,\n    );\n    if (!generated) {\n      // Authored entries reference the client entry by its dev path (the\n      // `<script src=\"/src/entry-client.tsx\">` convention); rewrite it to\n      // the resolved URL like the classic server harnesses do.\n      lines.push(\n        `    if (clientEntry && chunk.includes(${JSON.stringify('/' + entryClient)})) {`,\n        `      chunk = chunk.split(${JSON.stringify('/' + entryClient)}).join(clientEntry);`,\n        `    }`,\n      );\n    }\n    lines.push(`    if (!injected && chunk.includes('</head>')) {`, `      injected = true;`);\n    if (clientMode) {\n      // Nothing hydrates in client mode, so the event-capture bootstrap\n      // `<HydrationScript />` renders (`window._$HY||...`) is dead weight —\n      // but a Document shared with SSR mode carries it by design (the flip\n      // story). Strip it from the shell here instead of making users fork\n      // their Document per mode. (`<!--xs-->` is the script's stream\n      // marker; the shell head always arrives in one chunk.)\n      lines.push(\n        `      chunk = chunk.replace(/<script(?:\\\\s[^>]*)?>window\\\\._\\\\$HY\\\\|\\\\|[\\\\s\\\\S]*?<\\\\/script>(?:<!--xs-->)?/, '');`,\n      );\n    }\n    // The `csp-nonce` meta hands the style nonce to Vite's client code,\n    // which reads `meta[property=csp-nonce]`: in dev for the styles the Vite\n    // client injects on HMR, in a build for the modulepreload and\n    // stylesheet links `__vitePreload` inserts for lazy chunks. (Vite only\n    // writes it itself when it transforms an index.html with\n    // `html.cspNonce`; here the handler writes the head per request.)\n    const headParts: string[] = [\n      `(styleAttr ? '<meta property=\"csp-nonce\"' + styleAttr + '>' : '')`,\n    ];\n    // Dev: the style patch + Vite client, then either middleware-provided\n    // styles or the external environment's HMR-tracked virtual styles module.\n    if (!isBuild) {\n      headParts.push(\n        `devHead(nonceAttr)`,\n        externalDev\n          ? `devStyles(extraHead === undefined ? DEV_STYLES_HEAD : extraHead, styleAttr)`\n          : `devStyles(extraHead || '', styleAttr)`,\n      );\n    }\n    if (generated || clientMode) {\n      // Client-mode note: the shell never references its client entry\n      // itself (even an authored one — the Document knows nothing about\n      // entries), so the handler always injects it. Without `async`: module\n      // scripts default to deferred execution, which is exactly right for a\n      // fresh render-into-body mount (hydration, by contrast, wants to\n      // start as early as possible).\n      headParts.push(\n        `(clientEntry ? '<script type=\"module\"' + nonceAttr + ' src=\"' + clientEntry + '\"${clientMode ? '' : ' async'}></' + 'script>' : '')`,\n      );\n    }\n    lines.push(`      chunk = chunk.replace('</head>', ${headParts.join(' + ')} + '</head>');`);\n    lines.push(`    }`);\n    if (clientMode) {\n      // The shell-end marker (@solidjs/web 2.0.0-rc.15, solidjs/solid#4002)\n      // closes every shell that rendered `<HydrationScript />`. It writes to\n      // `_$HY` without a guard, so it goes with the bootstrap stripped above;\n      // left alone it throws `_$HY is not defined`. It follows the shell's\n      // records rather than its head, so it is matched in any chunk.\n      lines.push(\n        `    if (chunk.includes('_$HY.s[')) {`,\n        `      chunk = chunk.replace(/<script(?:\\\\s[^>]*)?>_\\\\$HY\\\\.s\\\\[[\\\\s\\\\S]*?<\\\\/script>/, '');`,\n        `    }`,\n      );\n    }\n    lines.push(\n      `    if (first) { first = false; chunk = '<!DOCTYPE html>' + chunk; }`,\n      `    return chunk;`,\n      `  };`,\n      `}`,\n    );\n\n    // The handler-edge commit fold — the runtime's `commitEventResponse`\n    // (named import above), the second of the response lifecycle's two\n    // exits: page results leave through `createSSRResponse`, any other\n    // Response (a middleware early return, a raw Response from\n    // entry.render, a server-function response) leaves through\n    // `commitEventResponse`, which folds the event's response stub onto it\n    // (cookies append entry-by-entry, other headers gap-fill, status stays\n    // the response's own) and commits the stub. Committed stubs pass\n    // through untouched, so the edge applies it unconditionally.\n    lines.push(\n      ``,\n      // `consumed` records the render inputs the page render read, for the\n      // dev check in handleRequest (a write after next() came too late).\n      `async function dispatchRequest(event, options, consumed) {`,\n      // The event is the single source of truth for the request: middleware\n      // substitutes it by assigning `event.request` before next().\n      `  const request = event.request;`,\n    );\n    if (composeServerFunctions) {\n      lines.push(\n        // A call's address is `<endpoint>/<id>`, `<endpoint>/data/<id>` or\n        // `<endpoint>/live/<id>` (solidjs/solid#3076, #3094; the live shape\n        // since @solidjs/web 2.0.0-rc.10); the prefix gate covers all three,\n        // and the bare mount still routes so a misaddressed request 404s\n        // through the runtime handler instead of rendering a page at it.\n        `  const requestPath = new URL(request.url).pathname;`,\n        `  if (requestPath === endpoint || requestPath.startsWith(endpoint + '/')) {`,\n        // The call shares the middleware chain's event (locals decoration,\n        // the response stub); an explicit host-provided createEvent wins.\n        // No fold here: the runtime's server-function handler runs the\n        // commit seam itself, and anything it left uncommitted is caught by\n        // the unconditional edge fold in handleRequest.\n        `    return handleServerFunctionRequest(request, {`,\n        `      createEvent: () => event,`,\n        `      ...options.serverFunctions,`,\n        `    });`,\n        `  }`,\n      );\n    }\n    if (!isBuild) {\n      // Dev terminal gate: the dev middleware dispatches every request the\n      // middleware chain might handle (API routes, no-JS form POSTs — all\n      // methods and accept types, matching production), passing\n      // `pageRequest: false` for the non-page ones. When such a request\n      // falls through the whole chain to this terminal dispatch, nothing\n      // owns it — answer with the marked 404 so the dev middleware hands\n      // it back to Vite's pipeline instead of rendering HTML at it. The\n      // gate reflects the wire request: only the dev middleware sets the\n      // flag, so external-host dispatch and preview stay render-always.\n      lines.push(\n        `  if (options.pageRequest === false) {`,\n        `    return new Response(null, { status: 404, headers: { ${JSON.stringify(DEV_FALLTHROUGH_HEADER)}: '1' } });`,\n        `  }`,\n      );\n    }\n    lines.push(\n      isBuild\n        ? `  const clientEntry = options.clientEntry || resolveClientEntry();`\n        : `  const clientEntry = options.clientEntry || ${JSON.stringify(devClientEntryUrl())};`,\n      // Read before the render starts, inside the request scope and after\n      // the middleware chain ran down to here: whatever middleware put on\n      // the event before next() is visible. Host options were seeded onto\n      // the event before the chain; reasserted here, they win over a\n      // middleware write. Generated entries hand `event.nonce` to\n      // renderToStream; authored entries read it the same way.\n      `  if (options.renderMode !== undefined) event.renderMode = options.renderMode;`,\n      `  if (options.nonce !== undefined) event.nonce = options.nonce;`,\n      `  const renderMode = event.renderMode === undefined || event.renderMode === null ? ${JSON.stringify(renderMode)} : assertRenderMode(event.renderMode, 'event.renderMode');`,\n      ...(clientMode && isBuild\n        ? [\n            // The client-mode shell is prerendered once into\n            // dist/client/index.html: a nonce baked into a static file is\n            // no nonce at all, so the shell renders without one (the\n            // generated entry renders without one either way).\n            `  if (assertNonce(event.nonce, 'event.nonce') !== undefined) {`,\n            `    console.warn('[@solidjs/vite-plugin] event.nonce is ignored for the client-mode shell: it is ' +`,\n            `      'prerendered once into dist/client/index.html, so a per-request nonce cannot reach it. Allow ' +`,\n            `      \"the shell's inline scripts by hash ('sha256-...') instead, or set ssr: true.\");`,\n            `    event.nonce = undefined;`,\n            `  }`,\n            `  const nonce = undefined;`,\n          ]\n        : [`  const nonce = assertNonce(event.nonce, 'event.nonce');`]),\n      `  consumed.rendered = true;`,\n      `  consumed.nonce = event.nonce;`,\n      `  consumed.renderMode = event.renderMode;`,\n      // Authored entries own renderToStream, and the runtime reads the nonce\n      // from those options only. The resolved value (host option, else the\n      // event) goes out as context.nonce; with none, a nonce the host\n      // already put on options.context is left alone. Generated entries\n      // read event.nonce themselves.\n      `  const renderContext = { clientEntry, ...options.context };`,\n      `  if (nonce !== undefined) renderContext.nonce = nonce;`,\n      `  let result = entry.render(request, renderContext);`,\n      // renderToStream results are thenables whose then() waits for the\n      // *complete* render — check for pipe first so streaming survives, and\n      // only await plain promises (async render functions).\n      `  if (result && typeof result.pipe !== 'function' && typeof result.then === 'function') {`,\n      `    result = await result;`,\n      `  }`,\n      ...(serverRenderSetupPath\n        ? [\n            // start.serverRenderSetup's async path boxes the stream (see the generated\n            // entry): a bare promise resolution would adopt the stream's\n            // thenable and buffer the whole render.\n            `  if (result && result.${STREAM_BOX}) result = result.${STREAM_BOX};`,\n          ]\n        : []),\n      // Async mode adopts the thenable deliberately — the very thing the\n      // pipe-first check and the setup box exist to avoid in stream mode.\n      // It resolves with the full HTML once every boundary settled, each\n      // spliced in place pre-flush (no fallbacks, no swap scripts; hydration\n      // data still serialized), and the string then takes\n      // createSSRResponse's string path below: stub commit, transformChunk\n      // on the whole document, and a mid-render Location as a real 3xx.\n      `  if (renderMode === 'async' && result && typeof result.then === 'function') {`,\n      `    result = await result;`,\n      `  }`,\n      // Raw Responses fold at the handler edge (handleRequest), after the\n      // middleware chain unwinds — not here, where middleware above this\n      // frame could still legitimately mutate headers.\n      `  if (result instanceof Response) return result;`,\n      // The runtime's response-head lifecycle: commit at shell flush,\n      // pre-flush Location as a real redirect, post-flush Location as the\n      // script fallback; the transform injects the doctype/head pieces.\n      // The redirect fallback is a single script, so a `{ script, style }`\n      // nonce contributes its script value, as with @solidjs/web's other\n      // single-script surfaces.\n      `  return createSSRResponse(result, event, {`,\n      `    responseInit: options.responseInit,`,\n      `    nonce: destinationNonce(nonce, 'script') || null,`,\n      `    transformChunk: createHtmlChunkTransform(clientEntry, options.devHead, nonce),`,\n      `  });`,\n      `}`,\n      ``,\n    );\n\n    // Failure containment for whatever escapes the chain. A thrown Response\n    // is the response, like the server-function endpoint's plain-HTTP answer\n    // (`throw redirect()` included), and so is the Response a thrown\n    // envelope carries (its plain-HTTP form); `Response.error()` (status 0)\n    // is not a response to send. The classification is guarded, so a\n    // hostile thrown value (a revoked Proxy) reads as an ordinary failure\n    // instead of escaping the catch.\n    //\n    // In dev that is all: any other failure rethrows, so the dev server sees\n    // the original error (with the built-in dev middleware, Vite's error\n    // middleware and its overlay).\n    //\n    // In a build any other failure (a middleware throw, a start.serverRenderSetup\n    // failure, an invalid event.renderMode or event.nonce, a render that\n    // throws before renderToStream returns) must not leave handleRequest: each host would\n    // answer it its own way and the configured error policy would never see\n    // it. It is reported through @solidjs/web's `reportRequestFailure`\n    // (`{ kind: 'request', handling: 'failed' }` with the event, and to\n    // console.error when no `configureServerErrors` hook is registered).\n    // The runtime hears a request failure only for an error object it has\n    // not reported yet, so one it already reported (a render failure, or an\n    // uncaught in-process server-function call, heard as\n    // `server-function`/`thrown`) is not\n    // heard twice. The answer is a bodyless 500 like the endpoint's. The\n    // edge fold below adds the stub's headers and cookies while the\n    // response head is still open; once next() returned a rendered page,\n    // the stub was committed with that page and the 500 goes out without\n    // them.\n    lines.push(\n      ...(isBuild\n        ? [\n            `function containFailure(error, event) {`,\n            `  try {`,\n            `    const thrown = isResponseEnvelope(error) ? error.response : error;`,\n            `    if (thrown instanceof Response && thrown.status !== 0) return thrown;`,\n            `  } catch {}`,\n            `  reportRequestFailure(error, event);`,\n            `  return new Response(null, { status: 500 });`,\n            `}`,\n          ]\n        : [\n            `function containFailure(error) {`,\n            `  try {`,\n            `    const thrown = isResponseEnvelope(error) ? error.response : error;`,\n            `    if (thrown instanceof Response && thrown.status !== 0) return thrown;`,\n            `  } catch {}`,\n            `  throw error;`,\n            `}`,\n          ]),\n      ``,\n    );\n\n    lines.push(\n      `export async function handleRequest(request, options = {}) {`,\n      // A bad per-call option is the host's own error, not the app's: it\n      // rejects up front, before the chain runs, instead of being contained\n      // as a request failure.\n      `  assertHostOptions(options);`,\n      // `options.event` is the public wrapper->event extension seam: extra\n      // fields (conventionally `nativeEvent`, the platform's raw request\n      // object) spread over the event's defaults at creation, so hosts and\n      // custom server entries can extend what getRequestEvent() answers\n      // with — no new convention beyond createRequestEvent's own init\n      // parameter (spreading undefined is a no-op).\n      `  const event = createRequestEvent(request, options.event);`,\n      // Host render inputs are seeded before the chain, so middleware sees\n      // them (e.g. `event.nonce ??= ...` builds its CSP header from the\n      // host's nonce); dispatch reasserts them so they also win.\n      `  if (options.nonce !== undefined) event.nonce = options.nonce;`,\n      `  if (options.renderMode !== undefined) event.renderMode = options.renderMode;`,\n      `  const consumed = { rendered: false };`,\n      // Middleware runs inside the request scope, after event creation —\n      // getRequestEvent() answers in middleware with the same event it\n      // receives, and nothing reaches the wire until the outermost\n      // middleware returns.\n      `  const response = await provideRequestEvent(event, async () => {`,\n      `    try {`,\n      `      return await runMiddleware(event, () => dispatchRequest(event, options, consumed));`,\n      `    } catch (error) {`,\n      `      return containFailure(error, event);`,\n      `    }`,\n      `  });`,\n      ...(isBuild\n        ? []\n        : [\n            // Dev-only footgun check: the render runs inside next(), so a\n            // render input written after `await next()` never reached it.\n            `  if (consumed.rendered) {`,\n            `    for (const key of ['nonce', 'renderMode']) {`,\n            `      if (event[key] !== consumed[key]) {`,\n            `        console.warn('[@solidjs/vite-plugin] event.' + key + ' changed after the page render read it, ' +`,\n            `          'so the change had no effect on this response. The render runs inside next(): set event.' + key +`,\n            `          ' in middleware before calling next(), not after awaiting it.');`,\n            `      }`,\n            `    }`,\n            `  }`,\n          ]),\n      // The fold runs strictly AFTER the outermost middleware returned:\n      // headers stay mutable through the whole unwind, and a middleware\n      // early return (an API handler that never called next()) gets its\n      // stub writes — cookies set inside the request scope, status — onto\n      // the wire. Unconditional: page responses come back from\n      // createSSRResponse committed and pass through untouched.\n      `  return commitEventResponse(response, event);`,\n      `}`,\n      ``,\n      `export default {`,\n      `  fetch(request) {`,\n      // Hosts may pass environment/context arguments after the request.\n      // Do not alias fetch directly to handleRequest: its second argument is\n      // the Solid handler options bag, not a provider binding object.\n      `    return handleRequest(request);`,\n      `  },`,\n      `};`,\n    );\n\n    return lines.join('\\n');\n  }\n\n  const plugins: Plugin[] = [\n    {\n      name: 'solid:ssr/setup',\n      enforce: 'pre',\n      config(userConfig, env) {\n        root = path.resolve(userConfig.root || process.cwd());\n        devtoolsEnabled =\n          env.command === 'serve' && !env.isPreview && options.devtools !== false;\n        devtoolsDetections = {};\n        devtoolsImporters = {};\n        entries = resolveEntries(root, options, clientMode);\n        internal.onDocumentResolved?.(entries.document);\n        middlewarePath = options.middleware\n          ? path.resolve(root, normalizeUserPath(root, options.middleware, 'middleware'))\n          : null;\n        serverSetupPath = options.serverSetup\n          ? path.resolve(root, normalizeUserPath(root, options.serverSetup, 'serverSetup'))\n          : null;\n        // Server-mode only, like `entries.server`/`externalServer` (a documented\n        // no-op in client mode so configs survive the `ssr` boolean flip).\n        serverRenderSetupPath =\n          !clientMode && options.serverRenderSetup\n            ? path.resolve(root, normalizeUserPath(root, options.serverRenderSetup, 'serverRenderSetup'))\n            : null;\n        if (serverRenderSetupPath && !entries.generated) {\n          // An authored entry-server owns its render function — the seam the\n          // hook needs does not exist there.\n          throw new Error(\n            '[@solidjs/vite-plugin] start.serverRenderSetup only applies to generated entries: your ' +\n              'entry-server owns render() already, so call your setup step there instead ' +\n              `(remove start.serverRenderSetup or the authored entry): ${options.serverRenderSetup}`,\n          );\n        }\n        // Both modes: the generated client entry hydrates or mounts, and\n        // the setup module runs ahead of either.\n        clientSetupPath = options.clientSetup\n          ? path.resolve(root, normalizeUserPath(root, options.clientSetup, 'clientSetup'))\n          : null;\n        if (clientSetupPath && entries.entryClient !== ENTRY_CLIENT_ID) {\n          // An authored entry-client runs its own code before hydrate().\n          throw new Error(\n            '[@solidjs/vite-plugin] start.clientSetup only applies to a generated client entry: ' +\n              'your entry-client runs before hydrate() already, so import your setup module ' +\n              `there instead (remove start.clientSetup or the authored entry): ${options.clientSetup}`,\n          );\n        }\n        // Server-mode only as well: the client-mode shell renders no app,\n        // so there is nothing to settle. Validated in every mode though —\n        // a typo should not hide behind the `ssr` boolean.\n        renderMode = resolveRenderMode(options.renderMode);\n        if (clientMode) renderMode = 'stream';\n        internal.onClientManifestOwned?.(\n          env.command === 'build' &&\n            !env.isPreview &&\n            !externalServer &&\n            !userConfig.build?.manifest &&\n            !userConfig.environments?.client?.build?.manifest,\n        );\n        if (env.isPreview) {\n          // Defaults only. A host that relocates an environment in\n          // `configEnvironment` still wins — that hook runs after this\n          // merge. `start.externalServer` leaves both directories to the host.\n          const previewBuild = externalServer\n            ? {}\n            : {\n                build: { outDir: 'dist/client' },\n                environments: {\n                  ssr: {\n                    build: {\n                      outDir: 'dist/server',\n                    },\n                  },\n                },\n              };\n          if (clientMode) {\n            // Client-mode builds emit a real index.html (the prerendered\n            // shell), so preview is Vite's stock static + history-fallback\n            // story. When server functions are on, the endpoint dispatches\n            // through the kept server handler (configurePreviewServer).\n            return { appType: 'spa', ...previewBuild };\n          }\n          // `vite preview` serves the client outDir statically; point the\n          // default at the client bundle so hashed assets resolve, while\n          // HTML (and everything else unhandled) falls through to the\n          // configurePreviewServer dispatch below. No index.html exists, so\n          // `custom` keeps preview from attempting an SPA fallback.\n          return {\n            appType: 'custom',\n            ...previewBuild,\n          };\n        }\n        const build = env.command === 'build';\n        const clientInput = entries.generated\n          ? ENTRY_CLIENT_ID\n          : path.resolve(root, entries.entryClient);\n        internal.onClientEntryResolved?.(clientInput);\n        // Real files only — the dep scanner can't crawl virtual modules.\n        // (In client mode the resolved document joins the scan/style roots\n        // even with an authored client entry; in SSR mode authored entries\n        // own the whole graph.)\n        const scanEntries = entries.generated\n          ? [\n              entries.app!,\n              ...(entries.document ? [entries.document] : []),\n              // Its dependencies pre-bundle with the app's, so the first\n              // page load does not trigger a re-optimize and a reload.\n              ...(clientSetupPath ? [clientSetupPath] : []),\n            ]\n          : [\n              path.resolve(root, entries.entryClient),\n              ...(clientMode && entries.document ? [entries.document] : []),\n            ];\n        return {\n          // No index.html: dev must not fall back to SPA-serving one, and\n          // the dep scanner needs explicit entries instead.\n          appType: 'custom',\n          ...(build\n            ? externalServer\n              ? {\n                  environments: {\n                    client: {\n                      build: {\n                        manifest: true,\n                        rollupOptions: { input: clientInput },\n                      },\n                    },\n                  },\n                }\n              : {\n                  environments: {\n                    client: {\n                      build: {\n                        manifest: true,\n                        outDir: 'dist/client',\n                        rollupOptions: { input: clientInput },\n                      },\n                    },\n                    ssr: {\n                      consumer: 'server',\n                      build: {\n                        outDir: 'dist/server',\n                        rollupOptions: {\n                          // `index` is the Vite service convention consumed\n                          // by provider orchestrators such as Nitro. Keep the\n                          // standalone artifact's established filename.\n                          input: { index: HANDLER_ID },\n                          output: { entryFileNames: SERVER_ENTRY_FILE },\n                        },\n                      },\n                    },\n                  },\n                  // Presence of `builder` makes a plain `vite build` build the\n                  // whole app (all environments: client then ssr).\n                  // A classic `vite build --ssr` invocation must stay a\n                  // single-environment build, so it doesn't get the flag.\n                  ...(env.isSsrBuild ? {} : { builder: {} }),\n                }\n            : {\n                ...(!clientMode && !externalServer\n                  ? {\n                      environments: {\n                        ssr: {\n                          consumer: 'server' as const,\n                          build: {\n                            outDir: 'dist/server',\n                            rollupOptions: {\n                              // Expose the same service entry during serve so\n                              // provider runtimes can discover and own it.\n                              input: { index: HANDLER_ID },\n                              output: { entryFileNames: SERVER_ENTRY_FILE },\n                            },\n                          },\n                        },\n                      },\n                    }\n                  : {}),\n                optimizeDeps: {\n                  entries: scanEntries,\n                  // Like the refresh runtime in the main plugin: the toolbar\n                  // graph is injected behind modules the scanner never crawls,\n                  // so pre-bundle it and the server-functions runtime up front.\n                  ...(() => {\n                    const spec = devtoolsEnabled ? devtoolsIncludeSpec(root) : null;\n                    return spec ? { include: [spec, '@solidjs/web/server-functions'] } : {};\n                  })(),\n                },\n              }),\n        };\n      },\n      configEnvironment(name, config) {\n        if (name !== 'ssr') return;\n        config.resolve ??= {};\n        const noExternal = config.resolve.noExternal;\n        if (noExternal !== true) {\n          config.resolve.noExternal = [\n            ...(Array.isArray(noExternal) ? noExternal : noExternal ? [noExternal] : []),\n            DEVTOOLS_PACKAGE,\n          ];\n        }\n      },\n      configResolved(config) {\n        root = config.root;\n        base = config.base;\n        isBuild = config.command === 'build';\n        // Test mode excluded for the same reason as the surface plugin's\n        // `apply`: vitest runs a dev serve, and test pages should not get\n        // the bridge import injected into their client entries.\n        if (internal.diagnostics === 'auto' && !isBuild && config.mode !== 'test') {\n          diagnostics = detectDiagnosticsPackage(root);\n        }\n        // Same gates as the `solid:performance-tracks` plugin's `apply` +\n        // subpath guard (which owns the warning when the guard fails), so\n        // the entry only imports a module that plugin serves. Preview needs\n        // no gate here: it serves the built artifact — neither the entry\n        // codegen nor the entry transform below runs under it.\n        if (internal.performanceTracks && !isBuild && config.mode !== 'test') {\n          performanceTracks = detectPerformanceTracksSubpath(root);\n        }\n        {\n          // Resolved directories for prerender, preview, and the Node entry.\n          // `configEnvironment` has already run, so a host relocation wins\n          // over the dist/client and dist/server defaults. generateBundle\n          // below overrides these with the directories actually written.\n          const environments = (config as any).environments ?? {};\n          const clientBuild = environments.client?.build ?? config.build;\n          const serverBuild = environments.ssr?.build;\n          clientOutDir = path.resolve(root, clientBuild.outDir);\n          serverOutDir = path.resolve(root, serverBuild?.outDir ?? 'dist/server');\n          clientAssetsDir = clientBuild.assetsDir ?? 'assets';\n        }\n        if (isBuild && nodeEntry) {\n          if (externalServer) {\n            config.logger.warn(\n              '[@solidjs/vite-plugin] start.nodeServer is ignored with start.externalServer: the host owns the ' +\n                'server build, so there is no server.js for the Node entry to wrap. Drop one of the ' +\n                'two options.',\n            );\n          } else if (clientMode && !internal.serverFunctions) {\n            config.logger.warn(\n              '[@solidjs/vite-plugin] start.nodeServer has nothing to emit in client start mode without ' +\n                '`serverFunctions`: the build is purely static (dist/client, no server bundle). ' +\n                'Serve dist/client from any static host, or enable `serverFunctions` (or `ssr: true`) ' +\n                'to get dist/server/node.js.',\n            );\n          }\n        }\n      },\n      generateBundle: {\n        // Post order: Vite's asset plugin (`vite:asset`, normal order)\n        // deletes every asset from a server-consumer bundle unless\n        // `build.emitAssets` is on — flipping that would change what the\n        // server build emits, so the Node entry is added after that sweep\n        // instead. It is an emitted asset, never a second input: server.js\n        // is byte-identical with and without the option.\n        order: 'post',\n        handler(outputOptions, bundle) {\n          if (!isBuild) return;\n          const consumer = getEnvironmentConsumer(this.environment);\n          if (consumer === 'client') {\n            // Where the client build actually landed (authoritative over\n            // the resolved outDir when a host relocates it).\n            if (outputOptions.dir) clientOutDir = path.resolve(root, outputOptions.dir);\n            return;\n          }\n          if (this.environment?.name !== 'ssr') return;\n          if (outputOptions.dir) serverOutDir = path.resolve(root, outputOptions.dir);\n          if (!nodeEntryApplies) return;\n          // The entry imports ./server.js; without that chunk (a provider\n          // rewrote the ssr environment's output) it could not run.\n          const serverChunk = bundle[SERVER_ENTRY_FILE];\n          if (!serverChunk || serverChunk.type !== 'chunk') {\n            this.warn(\n              `[@solidjs/vite-plugin] start.nodeServer: the ssr build did not emit ${SERVER_ENTRY_FILE} ` +\n                `(got ${Object.keys(bundle).join(', ') || 'nothing'}), so ${NODE_ENTRY_FILE} was ` +\n                'not emitted — the Node entry wraps that bundle.',\n            );\n            return;\n          }\n          const serverDir = outputOptions.dir\n            ? path.resolve(root, outputOptions.dir)\n            : serverOutDir!;\n          const clientDir = normalizePath(path.relative(serverDir, clientOutDir!)) || '.';\n          const serverDirName = normalizePath(path.relative(root, serverDir));\n          const runtimeSource = nodeEntryCode(\n            {\n              clientDir,\n              assetsDir: clientAssetsDir,\n              base,\n              spa: clientMode,\n              entry: NODE_ENTRY_FILE,\n              precompressed: precompress,\n            },\n            serverDirName,\n          );\n          if (serverSetupPath) {\n            this.emitFile({ type: 'asset', fileName: NODE_RUNTIME_FILE, source: runtimeSource });\n            this.emitFile({\n              type: 'asset',\n              fileName: NODE_ENTRY_FILE,\n              source: serverSetupNodeEntryCode(serverDirName),\n            });\n          } else {\n            this.emitFile({ type: 'asset', fileName: NODE_ENTRY_FILE, source: runtimeSource });\n          }\n        },\n      },\n      async writeBundle(outputOptions) {\n        if (!isBuild || !precompress) return;\n        if (getEnvironmentConsumer(this.environment) !== 'client') return;\n        const dir = outputOptions.dir ? path.resolve(root, outputOptions.dir) : clientOutDir;\n        // The written dir holds the bundle and the copied public dir alike.\n        if (dir) await precompressDir(dir);\n      },\n      async resolveId(source, importer, opts) {\n        if (source === HANDLER_ID) {\n          return { id: HANDLER_ID, moduleSideEffects: true };\n        }\n        if (source === HANDLER_IMPL_ID) {\n          return { id: HANDLER_IMPL_ID, moduleSideEffects: true };\n        }\n        if (source === DEV_STYLES_ID) {\n          return { id: RESOLVED_DEV_STYLES_ID, moduleSideEffects: true };\n        }\n        if (\n          source === ENTRY_SERVER_ID ||\n          source === ENTRY_CLIENT_ID ||\n          source === DOCUMENT_ID ||\n          source === ERROR_BOUNDARY_ID\n        ) {\n          return { id: source, moduleSideEffects: source === ENTRY_CLIENT_ID };\n        }\n        if (devtoolsEnabled && source === DEVTOOLS_MOUNT_ID) {\n          return { id: source, moduleSideEffects: true };\n        }\n        if (\n          source === DEVTOOLS_PACKAGE &&\n          (importer === ENTRY_SERVER_ID ||\n            importer === ENTRY_CLIENT_ID ||\n            importer === DEVTOOLS_MOUNT_ID)\n        ) {\n          // Generated modules have no directory for bare-package resolution:\n          // resolve from the app importer detection probed. Resolve afresh on\n          // every request rather than reusing detection's id — in the client\n          // environment that id is the optimizer's pre-bundled URL, stamped\n          // with the browserHash of the pass that produced it. Any dependency\n          // discovered after the initial scan re-optimizes: the toolbar's\n          // chunks are re-emitted under new names and the hash moves on, and\n          // a frozen id would keep the entry on the previous pass — its lazy\n          // chunks answer 504 (Outdated Optimize Dep) and the stale bundle\n          // brings a second solid-js instance into the page.\n          const from = devtoolsImporters[getEnvironmentConsumer(this.environment, opts)];\n          if (!from) return null;\n          const id = await resolveDevtoolsId(\n            (s, i) => this.resolve(s, i, { skipSelf: true }),\n            from,\n          );\n          return id ? { id } : null;\n        }\n        return null;\n      },\n      async load(id, opts) {\n        const consumer = getEnvironmentConsumer(this.environment, opts);\n        if (id === HANDLER_ID || id === HANDLER_IMPL_ID) {\n          if (consumer !== 'server') {\n            this.error(`${HANDLER_ID} is server-only; import it from server code (SSR build).`);\n          }\n          if (id === HANDLER_ID && serverSetupPath) return serverSetupHandlerCode();\n          const externalDev =\n            !isBuild &&\n            this.environment.mode === 'dev' &&\n            (externalServer || !isRunnableEnvironment(this.environment));\n          return handlerModuleCode(externalDev);\n        }\n        if (id === RESOLVED_DEV_STYLES_ID) {\n          if (consumer !== 'server' || this.environment.mode !== 'dev') {\n            this.error(`${DEV_STYLES_ID} is only available to the development server handler.`);\n          }\n          return devStylesModuleCode(this.environment, (file) => this.addWatchFile(file));\n        }\n        if (id === ENTRY_SERVER_ID) {\n          const toolbar = clientMode\n            ? false\n            : await resolveDevtools(\n                (source, importer) => this.resolve(source, importer, { skipSelf: true }),\n                requireEntries().app!,\n                'server',\n              );\n          return generatedEntryServerCode(toolbar);\n        }\n        if (id === ENTRY_CLIENT_ID) {\n          const toolbar = await resolveDevtools(\n            (source, importer) => this.resolve(source, importer, { skipSelf: true }),\n            requireEntries().app!,\n            'client',\n          );\n          return generatedEntryClientCode(toolbar);\n        }\n        if (id === DOCUMENT_ID) return documentShellCode;\n        if (id === ERROR_BOUNDARY_ID) return errorBoundaryCode;\n        if (id === DEVTOOLS_MOUNT_ID) {\n          let enabled = false;\n          if (devtoolsEnabled && consumer === 'client') {\n            const { app, entryClient } = requireEntries();\n            enabled = await resolveDevtools(\n              (source, importer) => this.resolve(source, importer, { skipSelf: true }),\n              app ?? path.resolve(root, entryClient),\n              'client',\n            );\n          }\n          if (!enabled) {\n            this.error(`${id} is only available to the development client.`);\n          }\n          return devtoolsMountModuleCode();\n        }\n        return null;\n      },\n      configurePreviewServer(server: PreviewServer) {\n        // `vite build && vite preview` runs the production artifact as-is:\n        // Vite's preview statics serve dist/client (see the config hook) and\n        // everything else — pages, the server-function endpoint, middleware\n        // included — dispatches through the built handler, exactly like a\n        // deployed server. Hosts owning the server build (`start.externalServer`)\n        // preview through their own runner instead.\n        // Client mode: pages are the static index.html (preview's own\n        // history fallback serves them before this post middleware runs);\n        // only the server-function endpoint needs the handler, and without\n        // server functions there is no dist/server at all.\n        if (externalServer || (clientMode && !internal.serverFunctions)) return;\n        // The server-function mount as the built handler sees it (base\n        // applied, like every pathname it compares against).\n        const serverFunctionsMount = internal.serverFunctionsEndpoint\n          ? joinBase(base, internal.serverFunctionsEndpoint)\n          : null;\n        const underServerFunctionsMount = (pathname: string) =>\n          serverFunctionsMount !== null &&\n          (pathname === serverFunctionsMount || pathname.startsWith(serverFunctionsMount + '/'));\n        return () => {\n          let handlerPromise: Promise<{\n            handleRequest: (\n              request: Request,\n              options?: { event?: Record<string, unknown> },\n            ) => Promise<Response>;\n          }> | null = null;\n          server.middlewares.use((req, res, next) => {\n            (async () => {\n              handlerPromise ??= import(\n                pathToFileURL(path.join(serverOutDir!, SERVER_ENTRY_FILE)).href\n              );\n              const handler = await handlerPromise;\n              // Preview's base middleware runs before this post hook and\n              // strips the configured `base` from req.url; the built handler\n              // compares pathnames against base-prefixed endpoints (the\n              // server-function endpoint) and hands the URL to application\n              // code, so restore the base — the deployed production handler\n              // receives base-prefixed URLs and preview must match it.\n              const requestUrl = joinBase(base, req.url || '/');\n              const response = await handler.handleRequest(\n                webRequestFromNode(req, requestUrl, res),\n                // Same event extension the dev middleware and a production\n                // Node entry pass: the raw Node request as `nativeEvent`.\n                { event: { nativeEvent: req } },\n              );\n              // Preview's compression middleware (@polka/compression) sizes\n              // a response up on its first write and, past the threshold,\n              // pipes the rest through a zlib stream that holds small writes\n              // until its buffer fills — a streamed response arrives in\n              // bursts, or not at all while a connection stays open. The\n              // deployed handler streams as it renders, and preview exists\n              // to show that artifact, so the streamed shapes opt out\n              // (`content-encoding: identity` is the middleware's own\n              // pass-through signal):\n              // - `text/html`: page renders stream the shell ahead of async\n              //   content;\n              // - `text/event-stream`: server-sent events wherever the app\n              //   emits them (a `live` server function, a middleware route)\n              //   — an SSE connection stays open, so a held event is an\n              //   event never delivered;\n              // - everything under the server-function mount: the runtime\n              //   answers there in its own wire — the streaming codec\n              //   (`text/plain`, too generic to key on), the live event\n              //   stream, JSON — and every shape is either streamed or too\n              //   small for compression to buy anything in preview. Keying\n              //   on the mount also keeps a new answer shape from silently\n              //   regressing to buffered.\n              const contentType = response.headers.get('content-type') || '';\n              if (\n                contentType.includes('text/html') ||\n                contentType.includes('text/event-stream') ||\n                underServerFunctionsMount(parseRequestTarget(requestUrl, 'http://localhost').pathname)\n              ) {\n                res.setHeader('content-encoding', 'identity');\n              }\n              await sendWebResponse(res, response);\n            })().catch(next);\n          });\n        };\n      },\n      configureServer(server: ViteDevServer) {\n        // The files whose static import graphs carry the app's entry CSS:\n        // the app root (+ document) for generated entries, the authored\n        // server entry otherwise. Their transitively imported styles are\n        // inlined into <head> per request (Vite injects entry CSS from\n        // client JS only, so SSR'd markup would flash unstyled without\n        // this); the SSR'd tags carry data-asset + data-vite-dev-id so the\n        // dev style patch drops them once Vite's own injection takes over —\n        // exactly the lazy-asset dedup story, HMR included.\n        // Post middleware: Vite's own middlewares (transforms, static, the\n        // server-function endpoint) run first; whatever asks for HTML after\n        // that gets the streamed SSR render.\n        return () => {\n          const ssrEnvironment = server.environments.ssr;\n          if (externalServer || !isRunnableEnvironment(ssrEnvironment)) {\n            return;\n          }\n          server.middlewares.use((req, res, next) => {\n            const url = parseRequestTarget(req.url || '/', 'http://localhost');\n            if (url.pathname.startsWith('/@')) return next();\n            // Vite's own HTML-fallback test: a GET or HEAD accepting HTML by\n            // name, via `*/*`, or with no Accept (curl, monitors). Production\n            // renders all of these; anything narrower 404s in dev only.\n            const accept = req.headers.accept;\n            const pageRequest =\n              (req.method === 'GET' || req.method === 'HEAD') &&\n              url.pathname !== '/favicon.ico' &&\n              (!accept || accept.includes('text/html') || accept.includes('*/*'));\n            // Production dispatches every request through the handler, so\n            // dev must too or API routes and no-JS form POSTs served by\n            // `start.middleware` are unreachable under `vite dev`. Without\n            // a middleware chain, non-page requests have nothing to reach —\n            // they stay on Vite's pipeline (404s) instead of rendering HTML.\n            if (!pageRequest && !middlewarePath) return next();\n            (async () => {\n              // Loaded through the SSR environment so the app, the request\n              // event storage, and the handler share one module registry.\n              const handler = await ssrEnvironment.runner.import(HANDLER_ID);\n              const styles = pageRequest\n                ? await collectDevStyles(server, styleRoots(), styleFilter)\n                : [];\n              const devHead = styles.map(renderDevStyleTag).join('');\n              // Post middlewares run after Vite's base middleware stripped\n              // the configured `base` from req.url; restore it so the app\n              // sees the same URLs in dev as in production (where the\n              // deployed handler receives base-prefixed requests).\n              const response: Response = await handler.handleRequest(\n                webRequestFromNode(req, joinBase(base, req.url || '/'), res),\n                {\n                  devHead,\n                  pageRequest,\n                  // The raw Node request on the event, matching what a\n                  // production Node server entry passes through the\n                  // `options.event` seam — getRequestEvent().nativeEvent\n                  // answers the same in dev as deployed.\n                  event: { nativeEvent: req },\n                },\n              );\n              // A non-page request the chain never handled: the terminal\n              // dispatch answered with the marked 404 — hand it back to\n              // Vite (its 404, other post middlewares) rather than sending\n              // a rendered page at a fetch()/form client.\n              if (response.headers.has(DEV_FALLTHROUGH_HEADER)) return next();\n              await sendWebResponse(res, response);\n            })().catch((error) => {\n              // Vite's error middleware renders the overlay-enabled 500 page.\n              next(error);\n            });\n          });\n        };\n      },\n    },\n    {\n      // Dev only: injects the dev surfaces into an authored client entry.\n      // Its own serve plugin, so builds never call it for every module.\n      name: 'solid:ssr/entry-client',\n      enforce: 'pre',\n      apply: 'serve',\n      async transform(code, id, opts) {\n        if (isBuild || (!devtoolsEnabled && !diagnostics && !performanceTracks)) return null;\n        const current = requireEntries();\n        if (current.generated || getEnvironmentConsumer(this.environment, opts) !== 'client') {\n          return null;\n        }\n        // Module ids are always forward-slashed; normalize the path.resolve\n        // side too so the comparison holds on Windows.\n        if (normalizePath(id.split('?')[0]) !== normalizePath(path.resolve(root, current.entryClient))) {\n          return null;\n        }\n        const injected: string[] = [];\n        // First, for the same reason as in the generated entry: enabled\n        // before the authored entry's own imports evaluate.\n        if (performanceTracks) {\n          injected.push(`import ${JSON.stringify(PERFORMANCE_TRACKS_CLIENT_ID)};`);\n        }\n        if (diagnostics) injected.push(`import ${JSON.stringify(DIAGNOSTICS_CLIENT_ID)};`);\n        if (devtoolsEnabled) {\n          const toolbar = await resolveDevtools(\n            (source, importer) => this.resolve(source, importer, { skipSelf: true }),\n            id,\n            'client',\n          );\n          if (toolbar) injected.push(`import ${JSON.stringify(DEVTOOLS_MOUNT_ID)};`);\n        }\n        if (injected.length === 0) return null;\n        return {\n          code: `${injected.join('\\n')}\\n${code}`,\n          map: null,\n        };\n      },\n    },\n    ...(clientMode\n      ? [\n          {\n            name: 'solid:start/prerender',\n            apply: 'build',\n            config: {\n              order: 'post',\n              handler(config) {\n                // The resolved builder always has a default no-op buildApp.\n                // Read the user/plugin callback before Vite adds that default.\n                configBuildApp = !!config.builder?.buildApp;\n              },\n            },\n            buildApp: {\n              // Post order: this hook owns the whole client-mode app build (the\n              // client-build-first orchestration pair is SSR-only). It\n              // builds client-then-ssr itself — building anything from a\n              // hook suppresses Vite's build-all fallback, so the ordering\n              // is guaranteed and the manifest is on disk before the shell\n              // bundle bakes it in — then runs the built handler once to\n              // prerender the shell into the client emit directory and drops\n              // the server directory unless server functions or a host still\n              // need its handler. The shell arrives complete from the\n              // handler: the runtime registers every manifest entry's CSS\n              // during the render (registerEntryAssets), so the entry\n              // graph's stylesheet links are already in its head — injecting\n              // them here again double-links every stylesheet.\n              order: 'post' as const,\n              async handler(builder: any) {\n                const client = builder.environments.client;\n                const ssrEnvironment = builder.environments.ssr;\n                if (client && !client.isBuilt) await builder.build(client);\n                if (ssrEnvironment && !ssrEnvironment.isBuilt) {\n                  await builder.build(ssrEnvironment);\n                }\n\n                const serverDir = serverOutDir!;\n                const handler = await import(\n                  pathToFileURL(path.join(serverDir, SERVER_ENTRY_FILE)).href\n                );\n                const response: Response = await handler.handleRequest(\n                  new Request(new URL(base || '/', 'http://localhost')),\n                );\n                // The built handler answers failures with a 500 instead of\n                // rejecting; a shell that did not render must fail the\n                // build, not become index.html. Cleanup runs only after a\n                // shell was actually written.\n                if (!response.ok) {\n                  throw new Error(\n                    `[@solidjs/vite-plugin] prerendering the client-mode shell failed: the handler answered ${response.status}`,\n                  );\n                }\n                const shellFile = path.join(clientOutDir!, 'index.html');\n                writeFileSync(shellFile, await response.text());\n                if (precompress) await precompressFile(shellFile);\n                // A host may still need this service for its final server\n                // build, even when the application has no server functions.\n                // Pre-order buildApp hooks prepare (they clean output) and\n                // do not count; a function hook is normal order and does.\n                const hostBuild =\n                  configBuildApp ||\n                  builder.config.plugins.some(\n                    (plugin: Plugin) =>\n                      plugin.name !== 'solid:start/prerender' &&\n                      !!plugin.buildApp &&\n                      (typeof plugin.buildApp !== 'object' || plugin.buildApp.order !== 'pre'),\n                  );\n                const safeCleanup =\n                  isStrictSubdirectory(root, serverDir) &&\n                  serverDir !== clientOutDir &&\n                  !isStrictSubdirectory(serverDir, clientOutDir!);\n                if (!internal.serverFunctions && !hostBuild) {\n                  if (safeCleanup) {\n                    rmSync(serverDir, { recursive: true, force: true });\n                  } else {\n                    builder.config.logger.warn(\n                      '[@solidjs/vite-plugin] Preserving SSR output at ' +\n                        serverDir +\n                        ': automatic cleanup requires a directory inside the project root that does not contain client output.',\n                    );\n                  }\n                }\n              },\n            },\n          } satisfies Plugin,\n        ]\n      : []),\n  ];\n  // Hook filters (src/hook-filters.ts) for the generated and virtual modules.\n  withFilter(plugins, {\n    pluginNamePattern: ['solid:ssr/setup'],\n    resolveId: {\n      id: exactIds(\n        HANDLER_ID,\n        HANDLER_IMPL_ID,\n        DEV_STYLES_ID,\n        ENTRY_SERVER_ID,\n        ENTRY_CLIENT_ID,\n        DOCUMENT_ID,\n        ERROR_BOUNDARY_ID,\n        DEVTOOLS_MOUNT_ID,\n        DEVTOOLS_PACKAGE,\n      ),\n    },\n    load: {\n      id: exactIds(\n        HANDLER_ID,\n        HANDLER_IMPL_ID,\n        RESOLVED_DEV_STYLES_ID,\n        ENTRY_SERVER_ID,\n        ENTRY_CLIENT_ID,\n        DOCUMENT_ID,\n        ERROR_BOUNDARY_ID,\n        DEVTOOLS_MOUNT_ID,\n      ),\n    },\n  });\n  // The dev server side of the toolbar: server errors, versions, open in editor.\n  if (options.devtools !== false) plugins.push(solidDevtoolsServer());\n  return plugins;\n}\n","// Typed, validated environment variables (`env`):\n// an `env.ts` at the project root default-exports `{ server, client }` maps\n// of Standard Schema validators (zod, valibot, arktype — mixable per key),\n// and the plugin exposes the validated values through two virtual modules:\n//\n// - `virtual:solid-env/server`: every var; importable only from server\n//   module graphs (a client-graph import is a hard error naming the importer).\n// - `virtual:solid-env/client`: the `client` side only, whose keys must\n//   carry the public env prefix (`VITE_` unless `envPrefix` says otherwise).\n//\n// Validation runs at config/build time in node only, against Vite's\n// `loadEnv` merge of the `.env*` files with `process.env` winning (CI\n// secrets take precedence) — and the plugin folds the file-loaded vars into\n// `process.env` itself, so templates don't need the classic\n// `process.env = { ...process.env, ...loadEnv(mode, root, '') }` one-liner.\n//\n// Client values are baked into the bundles as validated plain JSON —\n// that's what the public `VITE_` prefix means — so no validator library\n// ever reaches a browser bundle. Server values are NOT baked anywhere:\n// `virtual:solid-env/server` reads `process.env` at module init (server boot)\n// and validates through the user's own schema, which only the server\n// module graph imports. Platform-injected vars that don't exist at build\n// time work, secrets rotate without a rebuild, and no secret value exists\n// in any dist artifact. Build-time server-value failures downgrade to a\n// warning (boot enforces); dev failures stay hard errors — dev IS runtime.\n// Boot validation is synchronous by design: the generated server module\n// contains no top-level await (a TLA chunk forces esnext on downstream\n// bundlers — Nitro's node-server preset rejects it), which is why async\n// validators are rejected for `server` keys (client keys may stay async;\n// they are awaited at build time where the values are baked).\n//\n// A failed validation fails the build; in dev it renders Vite's error\n// overlay with the per-key report (the virtual modules throw it on load)\n// and `.env*`/schema edits revalidate live. A `solid-env.d.ts` is generated\n// next to the schema file so both virtual modules are fully typed by\n// inference from the user's own schema — no manual declarations.\n//\n// Design credit: the shape of this feature — env.ts schema file, the\n// virtual module pair and their names, build-time validation with baked\n// JSON values, the leak scan — follows @vite-env/core by pyyupsk (MIT,\n// https://github.com/pyyupsk/vite-env), the design-correct prior art. The\n// implementation is fresh against this plugin's machinery: Standard Schema\n// is the only contract (no zod dependency or zod-specific paths), the\n// schema file loads through Vite's own `runnerImport`\n// (no jiti), server-graph protection keys off the environment *consumer*\n// rather than environment-name lists, and the types are inferred from the\n// user's schema instead of introspected per-library.\nimport { existsSync, readFileSync, writeFileSync } from 'fs';\nimport path from 'path';\nimport {\n  loadEnv,\n  runnerImport,\n  type Plugin,\n  type ResolvedConfig,\n  type ViteDevServer,\n  withFilter,\n} from 'vite';\nimport { exactIds } from './hook-filters.js';\n\nexport const CLIENT_ENV_ID = 'virtual:solid-env/client';\nexport const SERVER_ENV_ID = 'virtual:solid-env/server';\n// The IDs before the stable release; imports of them fail naming the new one.\nconst RENAMED_ENV_IDS: Record<string, string> = {\n  'virtual:env/client': CLIENT_ENV_ID,\n  'virtual:env/server': SERVER_ENV_ID,\n};\nconst RESOLVED_CLIENT_ENV_ID = '\\0' + CLIENT_ENV_ID;\nconst RESOLVED_SERVER_ENV_ID = '\\0' + SERVER_ENV_ID;\n\n// Conventional schema locations, project-root relative. TypeScript first —\n// the whole point is inferred types — but a plain-JS project works too.\nconst ENV_FILE_CANDIDATES = ['env.ts', 'env.js'];\n// Generated ambient types, written next to the schema file. Deliberately\n// NOT `env.d.ts`: a declaration file sharing the schema file's stem would\n// shadow it in TS resolution (and self-reference its own `typeof import`).\nconst GENERATED_TYPES_FILE = 'solid-env.d.ts';\n\n/**\n * The minimal structural slice of the Standard Schema v1 interface\n * (https://standardschema.dev) this plugin consumes — the spec is designed\n * to be vendored so validating libraries stay decoupled.\n */\ninterface StandardSchemaLike {\n  '~standard': {\n    version: number;\n    vendor?: string;\n    validate: (value: unknown) => StandardResultLike | Promise<StandardResultLike>;\n  };\n}\ninterface StandardResultLike {\n  value?: unknown;\n  issues?: ReadonlyArray<{\n    message: string;\n    path?: ReadonlyArray<PropertyKey | { key: PropertyKey }>;\n  }>;\n}\n\ninterface EnvSchema {\n  server?: Record<string, StandardSchemaLike>;\n  client?: Record<string, StandardSchemaLike>;\n}\n\ninterface LoadedEnv {\n  schema: EnvSchema;\n  /**\n   * Every validated output value (server + client) as seen by the BUILD\n   * process — used for fast feedback and the client-chunk leak scan. The\n   * server virtual module does not bake these: it re-reads process.env at\n   * boot. Keys whose build-time validation failed (deferred to boot) are\n   * absent.\n   */\n  all: Record<string, unknown>;\n  /** The client-side subset of {@link all}. */\n  client: Record<string, unknown>;\n  /** Files the schema module transitively loaded (for dev watching). */\n  dependencies: string[];\n}\n\nfunction isStandardSchema(value: unknown): value is StandardSchemaLike {\n  return (\n    !!value &&\n    typeof value === 'object' &&\n    typeof (value as StandardSchemaLike)['~standard']?.validate === 'function'\n  );\n}\n\n/**\n * Keys the loadEnv fold added to process.env, tracked process-globally.\n * Real environment always wins over files — but values *we* folded must not\n * count as \"real\" on revalidation, or the first fold would pin every .env\n * value forever and live edits would never be seen. Process-global (not\n * plugin-closure) state because Vite restarts the dev server on .env\n * changes, recreating the plugin instances inside the same node process:\n * the new instance must be able to clear the old instance's fold.\n */\nconst FOLDED_KEYS = Symbol.for('@solidjs/vite-plugin:env-folded-keys');\nfunction foldedKeys(): Set<string> {\n  const holder = globalThis as { [FOLDED_KEYS]?: Set<string> };\n  return (holder[FOLDED_KEYS] ??= new Set());\n}\n\nfunction stringEntries(env: NodeJS.ProcessEnv): Record<string, string> {\n  const out: Record<string, string> = {};\n  for (const key in env) {\n    const value = env[key];\n    if (typeof value === 'string') out[key] = value;\n  }\n  return out;\n}\n\n/** Formats the per-key validation report shared by builds and the dev overlay. */\nfunction formatValidationError(\n  issues: Array<{ key: string; message: string }>,\n  envFile: string,\n  mode: string,\n): string {\n  const lines = issues.map(({ key, message }) => `  ✗ ${key}: ${message}`);\n  return (\n    `[@solidjs/vite-plugin] env validation failed (${issues.length} issue${\n      issues.length === 1 ? '' : 's'\n    }) — schema: ${envFile}, mode: ${mode}\\n\\n` +\n    lines.join('\\n') +\n    `\\n\\nSet the variables in your environment or .env files, or adjust the schema.`\n  );\n}\n\n/** Loads the schema module through Vite with project resolution. */\nasync function importSchemaModule(\n  envFileAbs: string,\n  root: string,\n  mode: string,\n): Promise<{ exported: unknown; dependencies: string[] }> {\n  const { module, dependencies } = await runnerImport<Record<string, unknown>>(envFileAbs, {\n    root,\n    mode,\n  });\n  return {\n    exported: module?.default,\n    dependencies: dependencies\n      .map((dep: string) => path.resolve(root, dep))\n      .filter((dep: string) => existsSync(dep)),\n  };\n}\n\nfunction assertSchemaShape(\n  exported: unknown,\n  envFile: string,\n  envPrefixes: string[],\n): EnvSchema {\n  if (!exported || typeof exported !== 'object') {\n    throw new Error(\n      `[@solidjs/vite-plugin] ${envFile} must default-export an object of the shape ` +\n        `{ server?: { VAR: schema }, client?: { VITE_VAR: schema } } where every schema ` +\n        `is a Standard Schema validator (zod, valibot, arktype, ...). Got: ${\n          exported === null ? 'null' : typeof exported\n        }.`,\n    );\n  }\n  const schema = exported as Record<string, unknown>;\n  for (const key of Object.keys(schema)) {\n    if (key !== 'server' && key !== 'client') {\n      throw new Error(\n        `[@solidjs/vite-plugin] unknown key \"${key}\" in ${envFile}: the env schema takes ` +\n          `only \\`server\\` and \\`client\\` maps of Standard Schema validators.`,\n      );\n    }\n  }\n  for (const side of ['server', 'client'] as const) {\n    const shape = schema[side];\n    if (shape === undefined) continue;\n    if (!shape || typeof shape !== 'object') {\n      throw new Error(\n        `[@solidjs/vite-plugin] \\`${side}\\` in ${envFile} must be an object mapping variable ` +\n          `names to Standard Schema validators.`,\n      );\n    }\n    for (const [key, validator] of Object.entries(shape)) {\n      if (!isStandardSchema(validator)) {\n        throw new Error(\n          `[@solidjs/vite-plugin] ${side}.${key} in ${envFile} is not a Standard Schema ` +\n            `validator (no callable \\`~standard.validate\\`). Any zod/valibot/arktype ` +\n            `schema qualifies; plain values and functions don't.`,\n        );\n      }\n    }\n  }\n  const typed = schema as EnvSchema;\n  for (const key of Object.keys(typed.client ?? {})) {\n    if (!envPrefixes.some((prefix) => key.startsWith(prefix))) {\n      const wanted = envPrefixes[0] ?? 'VITE_';\n      throw new Error(\n        `[@solidjs/vite-plugin] client env var \"${key}\" in ${envFile} must carry the public ` +\n          `env prefix (\"${envPrefixes.join('\" or \"')}\") — client vars are baked into the ` +\n          `browser bundle. Rename it to \"${wanted}${key}\", or move it to \\`server\\` if it ` +\n          `is a secret.`,\n      );\n    }\n    if (typed.server && key in typed.server) {\n      throw new Error(\n        `[@solidjs/vite-plugin] \"${key}\" is defined in both \\`server\\` and \\`client\\` in ` +\n          `${envFile}; a variable belongs to exactly one side (\\`client\\` vars are ` +\n          `visible to the server too).`,\n      );\n    }\n  }\n  // The reverse guard: Vite itself bakes every prefixed variable into\n  // `import.meta.env` for the browser, so declaring one under `server`\n  // cannot keep it secret — it leaks through Vite's channel with no\n  // diagnostics from this plugin's leak scan (which only watches the\n  // virtual server module's values).\n  for (const key of Object.keys(typed.server ?? {})) {\n    const prefix = envPrefixes.find((p) => key.startsWith(p));\n    if (prefix) {\n      const bare = key.slice(prefix.length);\n      throw new Error(\n        `[@solidjs/vite-plugin] server env var \"${key}\" in ${envFile} carries the public ` +\n          `env prefix \"${prefix}\". Vite exposes every \"${prefix}\"-prefixed variable to ` +\n          `the browser through import.meta.env no matter which side declares it, so a ` +\n          `\\`server\\` entry cannot keep it secret. ` +\n          (bare\n            ? `Rename it to \"${bare}\" (in the schema and in your .env/environment), or `\n            : `Rename it without the prefix, or `) +\n          `move it to \\`client\\` if it is public.`,\n      );\n    }\n  }\n  return typed;\n}\n\n/**\n * Generates the ambient `solid-env.d.ts` next to the schema file. The file\n * is self-contained: it infers each variable's type from the user's own\n * schema through the Standard Schema `~standard.types.output` phantom, so\n * any compliant validator library yields full types with no per-library\n * introspection. Only rewritten when the content actually changes.\n */\nfunction generateTypes(schema: EnvSchema, envFileAbs: string): void {\n  const dtsPath = path.join(path.dirname(envFileAbs), GENERATED_TYPES_FILE);\n  const importSpec = './' + path.basename(envFileAbs).replace(/\\.[mc]?[tj]s$/, '');\n\n  const field = (side: 'server' | 'client', key: string) =>\n    `    readonly ${JSON.stringify(key)}: __Out<__Schema[${JSON.stringify(side)}][${JSON.stringify(key)}]>;`;\n\n  const moduleBlock = (id: string, fields: string[]) =>\n    [\n      `declare module '${id}' {`,\n      `  type __Schema = typeof import(${JSON.stringify(importSpec)})['default'];`,\n      `  type __Out<T> = T extends { '~standard': { types?: { output: infer O } | undefined } }`,\n      `    ? O`,\n      `    : string;`,\n      `  const env: {`,\n      ...fields,\n      `  };`,\n      `  export { env };`,\n      `  export default env;`,\n      `}`,\n    ].join('\\n');\n\n  const clientFields = Object.keys(schema.client ?? {}).map((key) => field('client', key));\n  const serverFields = [\n    ...Object.keys(schema.server ?? {}).map((key) => field('server', key)),\n    ...clientFields,\n  ];\n\n  const content =\n    `// Generated by @solidjs/vite-plugin (env) — do not edit.\\n` +\n    `// Regenerated on every dev server and build start from ${path.basename(envFileAbs)}.\\n` +\n    `// Keep this file (and the schema) inside your tsconfig \"include\".\\n\\n` +\n    moduleBlock(CLIENT_ENV_ID, clientFields) +\n    '\\n\\n' +\n    moduleBlock(SERVER_ENV_ID, serverFields) +\n    '\\n';\n\n  try {\n    if (existsSync(dtsPath) && readFileSync(dtsPath, 'utf-8') === content) return;\n    writeFileSync(dtsPath, content);\n  } catch (error) {\n    const reason = error instanceof Error ? `: ${error.message}` : '';\n    console.warn(\n      `[@solidjs/vite-plugin] could not write ${GENERATED_TYPES_FILE} next to the env schema` +\n        `${reason} — the virtual env modules stay untyped until it can be written.`,\n    );\n  }\n}\n\n/**\n * Typed env support for the top-level `env` option. Returns no active hooks\n * when the feature is off (`env: false`, or nothing to probe).\n */\nexport function envPlugin(option: boolean | string | undefined): Plugin[] {\n  if (option === false) return [];\n\n  let root = process.cwd();\n  let config: ResolvedConfig;\n  let isBuild = false;\n  let isPreview = false;\n  let enabled = false;\n  /** Absolute path of the schema file once resolved. */\n  let envFileAbs: string | null = null;\n  /** Root-relative schema path for messages. */\n  let envFile = 'env.ts';\n\n  let envPromise: Promise<LoadedEnv> | null = null;\n  let devErrorLogged = false;\n\n  function resolveEnvFile(): void {\n    if (typeof option === 'string') {\n      const absolute = path.isAbsolute(option) ? option : path.resolve(root, option);\n      if (!existsSync(absolute)) {\n        throw new Error(`[@solidjs/vite-plugin] env does not exist: ${option}`);\n      }\n      const relative = path.relative(root, absolute).split(path.sep).join('/');\n      if (relative.startsWith('..')) {\n        throw new Error(\n          `[@solidjs/vite-plugin] env must live inside the Vite root: ${option}`,\n        );\n      }\n      envFileAbs = absolute;\n      envFile = relative;\n      enabled = true;\n      return;\n    }\n    for (const candidate of ENV_FILE_CANDIDATES) {\n      const absolute = path.resolve(root, candidate);\n      if (existsSync(absolute)) {\n        envFileAbs = absolute;\n        envFile = candidate;\n        enabled = true;\n        return;\n      }\n    }\n    if (option === true) {\n      throw new Error(\n        `[@solidjs/vite-plugin] env is enabled but no schema file was found: add ` +\n          `${ENV_FILE_CANDIDATES.join(' or ')} at the project root (default-exporting ` +\n          `{ server, client } maps of Standard Schema validators), or point env ` +\n          `at a path.`,\n      );\n    }\n  }\n\n  function envPrefixes(): string[] {\n    const prefix = config?.envPrefix ?? 'VITE_';\n    return Array.isArray(prefix) ? prefix : [prefix];\n  }\n\n  async function loadAndValidate(): Promise<LoadedEnv> {\n    const { exported, dependencies } = await (async () => {\n      try {\n        return await importSchemaModule(envFileAbs!, root, config.mode);\n      } catch (error) {\n        const reason = error instanceof Error ? `\\n\\nCause: ${error.message}` : '';\n        throw new Error(\n          `[@solidjs/vite-plugin] could not load the env schema at ${envFile}. It must be a ` +\n            `server-side module default-exporting { server?, client? } maps of Standard ` +\n            `Schema validators.${reason}`,\n        );\n      }\n    })();\n\n    const schema = assertSchemaShape(exported, envFile, envPrefixes());\n    // Types depend only on the schema, not the values: generate before\n    // validating so a missing variable doesn't also break editor types.\n    generateTypes(schema, envFileAbs!);\n\n    // Vite's .env story with `loadEnv` merge priority — process.env wins\n    // (CI/pipeline secrets over files), then .env.[mode].local down to .env.\n    // The fold into process.env is what removes the template's classic\n    // `process.env = { ...process.env, ...loadEnv(mode, root, '') }` line:\n    // server code reading process.env directly (db clients, SDKs) sees the\n    // file-loaded vars too, in dev, build, and the client-mode prerender.\n    const envDir =\n      (config as { envDir?: string | false }).envDir === false\n        ? null\n        : config.envDir || root;\n    const folded = foldedKeys();\n    for (const key of folded) delete process.env[key];\n    folded.clear();\n    const fileEnv = envDir ? loadEnv(config.mode, envDir, '') : {};\n    for (const [key, value] of Object.entries(fileEnv)) {\n      if (!(key in process.env)) {\n        process.env[key] = value;\n        folded.add(key);\n      }\n    }\n    const raw: Record<string, string> = { ...fileEnv, ...stringEntries(process.env) };\n\n    const issues: Array<{ key: string; message: string; side: 'server' | 'client' }> = [];\n    const all: Record<string, unknown> = {};\n    for (const side of ['server', 'client'] as const) {\n      for (const [key, validator] of Object.entries(schema[side] ?? {})) {\n        let result = validator['~standard'].validate(raw[key]);\n        if (result instanceof Promise) {\n          // Async validation is fine for `client` keys — their values are\n          // baked right here at build time, where awaiting costs nothing.\n          // `server` keys validate process.env at boot through generated\n          // code that is deliberately synchronous (a top-level await in the\n          // server env chunk forces esnext on every downstream bundle\n          // target — Nitro's node-server preset rejects it outright), so a\n          // Promise-returning server validator could only ever fail at\n          // deploy boot. Async-ness is a property of the schema, not the\n          // value, so fail fast here with the fix in the message. Boot\n          // still backstops (schemas whose sync prefix short-circuits at\n          // build time can go async on real values).\n          if (side === 'server') {\n            throw new Error(\n              `[@solidjs/vite-plugin] server env var \"${key}\" in ${envFile} uses an async ` +\n                `validator (validate() returned a Promise). Server env is validated ` +\n                `synchronously at boot — the generated module contains no top-level ` +\n                `await, so server bundles work on non-esnext targets — which async ` +\n                `validators cannot do. Make the validator synchronous (drop async ` +\n                `refinements/transforms), or run the async check in application code.`,\n            );\n          }\n          result = await result;\n        }\n        if (result.issues && result.issues.length) {\n          for (const issue of result.issues) {\n            const at = (issue.path ?? [])\n              .map((segment) =>\n                typeof segment === 'object' && segment !== null && 'key' in segment\n                  ? String(segment.key)\n                  : String(segment),\n              )\n              .join('.');\n            issues.push({ key: at ? `${key}.${at}` : key, message: issue.message, side });\n          }\n        } else {\n          all[key] = result.value;\n        }\n      }\n    }\n    if (issues.length) {\n      // Client values are baked at build time, so their failures always\n      // fail hard. Server values are read from process.env at boot: a\n      // build may legitimately run without them (platform-injected vars),\n      // so build-time server failures downgrade to a warning and boot\n      // validation enforces. Dev failures stay hard — dev IS runtime.\n      const clientIssues = issues.filter((issue) => issue.side === 'client');\n      if (!isBuild || clientIssues.length) {\n        throw new Error(\n          formatValidationError(!isBuild ? issues : clientIssues, envFile, config.mode),\n        );\n      }\n      config.logger.warn(\n        `\\n[@solidjs/vite-plugin] server env not valid at build time (deferred to boot ` +\n          `validation — server env is read from process.env at runtime):\\n` +\n          issues.map(({ key, message }) => `  ⚠ ${key}: ${message}`).join('\\n') +\n          '\\n',\n      );\n    }\n\n    const client: Record<string, unknown> = {};\n    for (const key of Object.keys(schema.client ?? {})) client[key] = all[key];\n\n    return { schema, all, client, dependencies };\n  }\n\n  function ensureEnv(): Promise<LoadedEnv> {\n    return (envPromise ??= loadAndValidate());\n  }\n\n  /**\n   * Whether the current hook runs for a server-destined module graph. The\n   * environment's `consumer` is authoritative (covers workerd and friends\n   * without name lists); classic contexts fall back to the ssr flag.\n   */\n  function isServerContext(\n    ctx: { environment?: { config?: { consumer?: string } } },\n    opts?: { ssr?: boolean },\n  ): boolean {\n    const consumer = ctx.environment?.config?.consumer;\n    if (consumer) return consumer === 'server';\n    return !!opts?.ssr;\n  }\n\n  function serverOnlyError(importer?: string): string {\n    return (\n      `[@solidjs/vite-plugin] ${SERVER_ENV_ID} is server-only and was imported from the ` +\n      `client module graph` +\n      (importer ? ` (by ${importer})` : '') +\n      `. Server env values must never reach the browser bundle: import ` +\n      `${CLIENT_ENV_ID} for the public ${envPrefixes().join('/')}-prefixed vars, or move ` +\n      `this import into a server-only module (a \"use server\" module, middleware, or the ` +\n      `server entry).`\n    );\n  }\n\n  // Baked-JSON module emission (pattern from @vite-env/core, MIT): the\n  // validated output values serialize as a frozen object literal, so no\n  // validator code exists in the client bundle and tree-shaking sees plain\n  // data. `moduleType` marks the virtual source as plain JS for rolldown\n  // (Vite 8).\n  function envModuleCode(values: Record<string, unknown>) {\n    return {\n      code:\n        `// Generated by @solidjs/vite-plugin (env)\\n` +\n        `export const env = Object.freeze(${JSON.stringify(values)});\\n` +\n        `export default env;`,\n      moduleType: 'js' as const,\n    };\n  }\n\n  // The server module is NOT baked: server values are read from\n  // process.env at module init (server boot) and validated through the\n  // user's own schema, imported straight into the server graph (the\n  // validator library is server-only, so shipping it there is fine).\n  // Client (public) values stay baked — that's what the VITE_ prefix\n  // means. Platform-injected vars that don't exist at build time work,\n  // secrets rotate without a rebuild, and no secret value exists in any\n  // dist artifact.\n  //\n  // The generated code is deliberately free of top-level await. Module\n  // init is the only point where \"validated and frozen before any\n  // importer's body runs\" can be guaranteed — user server modules read\n  // `env.KEY` at their own top level — and the only async thing here is\n  // Standard Schema's option to return a Promise from validate(). A TLA\n  // chunk breaks every downstream bundler with a non-esnext target\n  // (Nitro's node-server preset in practice), so validation runs\n  // synchronously and a Promise-returning server validator is itself a\n  // boot issue (build/config time rejects it earlier when detectable).\n  function serverEnvModuleCode(loaded: LoadedEnv) {\n    const serverKeys = Object.keys(loaded.schema.server ?? {});\n    const baked = `const __env = ${JSON.stringify(loaded.client)};`;\n    if (!serverKeys.length) {\n      return {\n        code:\n          `// Generated by @solidjs/vite-plugin (env) — server env.\\n` +\n          `${baked}\\n` +\n          `export const env = Object.freeze(__env);\\n` +\n          `export default env;`,\n        moduleType: 'js' as const,\n      };\n    }\n    return {\n      code: [\n        `// Generated by @solidjs/vite-plugin (env) — server env.`,\n        `// Server values are read from process.env and validated at boot;`,\n        `// client (public) values are baked at build time. Boot validation is`,\n        `// synchronous on purpose: a top-level await here would force esnext`,\n        `// on every downstream bundle target (Nitro's node-server preset and`,\n        `// anything else below esnext rejects a TLA chunk outright).`,\n        `import __schema from ${JSON.stringify(envFileAbs)};`,\n        baked,\n        `const __issues = [];`,\n        `for (const __key of ${JSON.stringify(serverKeys)}) {`,\n        `  const __result = __schema.server[__key]['~standard'].validate(process.env[__key]);`,\n        `  if (__result && typeof __result.then === 'function') {`,\n        `    __issues.push('  \\\\u2717 ' + __key + ': validator returned a Promise \\\\u2014 async validators are not supported for server keys (boot validation is synchronous so the server bundle carries no top-level await); make this validator synchronous');`,\n        `  } else if (__result.issues && __result.issues.length) {`,\n        `    for (const __issue of __result.issues) __issues.push('  \\\\u2717 ' + __key + ': ' + __issue.message);`,\n        `  } else {`,\n        `    __env[__key] = __result.value;`,\n        `  }`,\n        `}`,\n        `if (__issues.length) {`,\n        `  throw new Error(`,\n        `    '[@solidjs/vite-plugin] server env validation failed at boot (' + __issues.length +`,\n        `    ' issue' + (__issues.length === 1 ? '' : 's') + ') \\\\u2014 schema: ' + ${JSON.stringify(envFile)} +`,\n        `    '\\\\n\\\\n' + __issues.join('\\\\n') +`,\n        `    '\\\\n\\\\nServer env is read from process.env at boot, not baked at build time: set the ' +`,\n        `    'variables in the server process environment.'`,\n        `  );`,\n        `}`,\n        `export const env = Object.freeze(__env);`,\n        `export default env;`,\n      ].join('\\n'),\n      moduleType: 'js' as const,\n    };\n  }\n\n  const plugins: Plugin[] = [\n    {\n      name: 'solid:env',\n\n      config(userConfig, env) {\n        root = path.resolve(userConfig.root || process.cwd());\n        isPreview = !!env.isPreview;\n        resolveEnvFile();\n        // Preview serves finished artifacts, so no schema loading or\n        // validation happens there — but the built server module reads\n        // process.env at boot, and `vite preview` should smoke-test the\n        // artifact as hands-off as dev runs it: fold the .env files into\n        // process.env (real environment still wins). A production process\n        // brings its own environment instead.\n        if (isPreview && enabled) {\n          const envDirOption = (userConfig as { envDir?: string | false }).envDir;\n          const envDir =\n            envDirOption === false ? null : path.resolve(root, envDirOption || '.');\n          if (envDir) {\n            const folded = foldedKeys();\n            for (const key of folded) delete process.env[key];\n            folded.clear();\n            const fileEnv = loadEnv(userConfig.mode || env.mode, envDir, '');\n            for (const [key, value] of Object.entries(fileEnv)) {\n              if (!(key in process.env)) {\n                process.env[key] = value;\n                folded.add(key);\n              }\n            }\n          }\n        }\n      },\n\n      configResolved(resolved) {\n        config = resolved;\n        root = resolved.root;\n        isBuild = resolved.command === 'build';\n        if (!enabled || isPreview) return;\n        // Kick validation off eagerly (the fold must precede any server\n        // module execution); buildStart awaits it and owns error routing.\n        ensureEnv().catch(() => {});\n      },\n\n      async buildStart() {\n        if (!enabled) return;\n        try {\n          await ensureEnv();\n        } catch (error) {\n          // Builds fail with the report; dev logs it once and lets the\n          // virtual modules rethrow on load, which renders Vite's error\n          // overlay (client imports) or the overlay-enabled 500 (SSR).\n          if (isBuild) throw error;\n          if (!devErrorLogged) {\n            devErrorLogged = true;\n            config.logger.error(\n              '\\n' + (error instanceof Error ? error.message : String(error)) + '\\n',\n            );\n          }\n        }\n      },\n\n      resolveId(source, importer, options) {\n        if (!enabled) return null;\n        if (source in RENAMED_ENV_IDS) {\n          this.error(\n            `[@solidjs/vite-plugin] \\`${source}\\` has been renamed to \\`${RENAMED_ENV_IDS[source]}\\`.`,\n          );\n        }\n        if (source === CLIENT_ENV_ID) return RESOLVED_CLIENT_ENV_ID;\n        if (source === SERVER_ENV_ID) {\n          // The dep scanner probes client entries' import graphs without\n          // executing them; deny real client-graph imports only (the load\n          // hook double-checks — scanners never load `\\0` ids).\n          if (!(options as { scan?: boolean } | undefined)?.scan && !isServerContext(this, options)) {\n            this.error(serverOnlyError(importer));\n          }\n          return RESOLVED_SERVER_ENV_ID;\n        }\n        return null;\n      },\n\n      async load(id, opts) {\n        if (!enabled) return null;\n        if (id !== RESOLVED_CLIENT_ENV_ID && id !== RESOLVED_SERVER_ENV_ID) return null;\n        // Throws the validation report when env is invalid — the dev\n        // overlay / failed build carries the per-key details.\n        const loaded = await ensureEnv();\n        if (id === RESOLVED_SERVER_ENV_ID) {\n          if (!isServerContext(this, opts)) this.error(serverOnlyError());\n          return serverEnvModuleCode(loaded);\n        }\n        return envModuleCode(loaded.client);\n      },\n\n      configureServer(server: ViteDevServer) {\n        if (!enabled) return;\n        const envDir =\n          (config as { envDir?: string | false }).envDir === false\n            ? null\n            : config.envDir || root;\n        // Explicit file list (no globs — chokidar 4 dropped them): the four\n        // .env variants Vite consults for this mode, the schema module, and\n        // whatever it transitively loaded.\n        const envFiles = envDir\n          ? ['.env', '.env.local', `.env.${config.mode}`, `.env.${config.mode}.local`].map(\n              (file) => path.join(envDir, file),\n            )\n          : [];\n        const watched = new Set<string>([...envFiles, envFileAbs!]);\n        server.watcher.add([...watched]);\n        ensureEnv()\n          .then(({ dependencies }) => {\n            for (const dep of dependencies) watched.add(dep);\n            server.watcher.add(dependencies);\n          })\n          .catch(() => {});\n\n        // Live revalidation (flow from @vite-env/core, MIT): reload sources,\n        // rerun the schema, invalidate both virtual modules in every\n        // environment, and full-reload — on failure the reload makes the\n        // client re-import the virtual module, whose load() now throws the\n        // fresh report into the error overlay.\n        let debounce: ReturnType<typeof setTimeout> | undefined;\n        const onFileEvent = (file: string) => {\n          if (!watched.has(file)) return;\n          clearTimeout(debounce);\n          debounce = setTimeout(async () => {\n            envPromise = null;\n            devErrorLogged = false;\n            let failed = false;\n            try {\n              const { dependencies } = await ensureEnv();\n              for (const dep of dependencies) watched.add(dep);\n              server.watcher.add(dependencies);\n            } catch (error) {\n              failed = true;\n              devErrorLogged = true;\n              config.logger.error(\n                '\\n' + (error instanceof Error ? error.message : String(error)) + '\\n',\n              );\n            }\n            let invalidated = false;\n            for (const environment of Object.values(server.environments ?? {})) {\n              const graph = (environment as { moduleGraph?: any }).moduleGraph;\n              if (!graph) continue;\n              for (const id of [RESOLVED_CLIENT_ENV_ID, RESOLVED_SERVER_ENV_ID]) {\n                const mod = graph.getModuleById(id);\n                if (mod) {\n                  graph.invalidateModule(mod);\n                  invalidated = true;\n                }\n              }\n            }\n            if (invalidated) {\n              const hot = server.hot ?? (server as any).ws;\n              hot?.send({ type: 'full-reload' });\n            }\n            if (!failed) {\n              config.logger.info(`[@solidjs/vite-plugin] env revalidated (${envFile})`);\n            }\n          }, 100);\n        };\n        server.watcher.on('change', onFileEvent);\n        server.watcher.on('add', onFileEvent);\n        server.watcher.on('unlink', onFileEvent);\n      },\n\n      // Leak scan (heuristics from @vite-env/core, MIT): a server var's\n      // *value* appearing as a quoted string literal in a client chunk means\n      // something inlined it (an env.ts import from shared code, a define,\n      // a copy-paste). Values under 8 chars skip (too collision-prone), as\n      // do values shared with a client var and pure-vendor chunks.\n      async generateBundle(_options, bundle) {\n        if (!enabled || !isBuild || isServerContext(this, { ssr: !!config.build.ssr })) return;\n        const loaded = await ensureEnv().catch(() => null);\n        if (!loaded) return;\n\n        const clientValues = new Set(Object.values(loaded.client));\n        const secrets = Object.entries(loaded.all).filter(\n          (entry): entry is [string, string] =>\n            !(entry[0] in loaded.client) &&\n            typeof entry[1] === 'string' &&\n            entry[1].length >= 8 &&\n            !clientValues.has(entry[1]),\n        );\n        if (!secrets.length) return;\n\n        const leaks: string[] = [];\n        for (const [fileName, chunk] of Object.entries(bundle)) {\n          if (chunk.type !== 'chunk' || !chunk.code) continue;\n          const moduleIds = (chunk as { moduleIds?: string[] }).moduleIds ?? [];\n          if (moduleIds.length > 0 && moduleIds.every((id) => /[\\\\/]node_modules[\\\\/]/.test(id)))\n            continue;\n          for (const [key, value] of secrets) {\n            const escaped = value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n            if (new RegExp(`([\"'\\`])${escaped}\\\\1`).test(chunk.code)) {\n              leaks.push(`${key} in ${fileName}`);\n            }\n          }\n        }\n        if (leaks.length) {\n          this.error(\n            `[@solidjs/vite-plugin] server env values leaked into client chunks:\\n` +\n              leaks.map((leak) => `  ✗ ${leak}`).join('\\n') +\n              `\\n\\nServer env values belong to the server process only (they are not even ` +\n              `baked into the server bundle). Check for hand-inlined values and imports of ` +\n              `the env schema module from client code, and use ${SERVER_ENV_ID} from ` +\n              `server-only modules instead.`,\n          );\n        }\n      },\n    },\n  ];\n  // Hook filters (src/hook-filters.ts).\n  withFilter(plugins, {\n    resolveId: { id: exactIds(CLIENT_ENV_ID, SERVER_ENV_ID, ...Object.keys(RENAMED_ENV_IDS)) },\n    load: { id: exactIds(RESOLVED_CLIENT_ENV_ID, RESOLVED_SERVER_ENV_ID) },\n  });\n  return plugins;\n}\n","/**\n * `solid.sourceNames`: which names as written in source the compilers carry\n * into output for the dev and observe runtimes, and the source locations\n * that ride along with them. This module resolves the user's value to one\n * flag per kind and builds the option objects each compiler receives; the\n * plugin's transform hooks (src/index.ts) decide when to call it.\n */\n\nimport { SourceMap } from 'module';\n\n/**\n * Which source names are carried into output for the dev and observe\n * runtimes to label the reactive graph with (see\n * `Options.solid.sourceNames`). Each kind defaults to the posture: on for\n * dev and `observe`, off for production builds — except `locations`, which\n * defaults on for dev only. `components` and `bindings` are the JSX\n * compiler's `sourceNames` option; `primitives` is the native compiler's\n * standalone `transformSourceNames` pass, which the plugin runs on every\n * module — babel apps included; `locations` qualifies all three.\n */\nexport interface SourceNamesOptions {\n  /** `createComponent(Home, props, \"Home\")` — owners labelled `<Home>`. */\n  components?: boolean;\n  /** Binding effects named by what they write: `span.textContent`, `div.children`. */\n  bindings?: boolean;\n  /**\n   * Primitives named after the identifier they are declared as —\n   * `createSignal(0, { name: \"count\" })`, `createCounter.value` inside a\n   * composed primitive — by the native compiler's `transformSourceNames`\n   * pass. Runs on `.ts`/`.js` modules as well as components (outside\n   * node_modules), whichever JSX compiler the app uses.\n   */\n  primitives?: boolean;\n  /**\n   * A `file:line:col` source location next to every name the other kinds\n   * emit — `createComponent(Home, props, \"Home\", \"src/App.tsx:12:5\")`,\n   * `{ name: \"count\", loc: \"src/store.ts:3:22\" }` — so a diagnostic\n   * report, a `whyDidRun` chain, or a devtools entry points at the line\n   * that declared the node. Paths are relative to the Vite root, so under\n   * `vite dev` the console link `http://localhost:5173/src/App.tsx:12:5`\n   * opens the file in the browser's sources panel. A location is only\n   * emitted where its name is (a kind that is off emits neither).\n   *\n   * Defaults on under `dev` and off otherwise: an `observe` build is a\n   * production bundle, and shipping source paths in it is an opt-in\n   * (`{ locations: true }`), unlike the names, which `observe` turns on.\n   * `sourceNames: true` turns it on with every other kind. Requires a\n   * compiler release that accepts the option; on an older\n   * `@solidjs/compiler` the names keep coming without locations (a one-time\n   * warning when it was asked for explicitly).\n   */\n  locations?: boolean;\n}\n\n/** Every kind resolved to a flag. */\nexport type ResolvedSourceNames = Required<SourceNamesOptions>;\n\n/**\n * Resolve `solid.sourceNames` to one flag per kind — `components` and\n * `bindings` go to the JSX compiler, `primitives` gates the standalone\n * `transformSourceNames` pass in the transform hook, and `locations`\n * qualifies all of them.\n *\n * The default follows the posture. `dev` here is the same flag the compilers\n * receive as `dev` (`options.dev`, which defaults to on under `vite dev` and\n * off for `vite build`), and `observe` is `options.observe`; those are the\n * two runtimes that read the names, and the production runtime ignores them.\n * `locations` is the one kind that does not follow `observe`: an observe\n * build is a production bundle, and a source path inside it is an opt-in.\n *\n * | `solid.sourceNames`     | dev                     | observe (no dev)          | production                 |\n * | ----------------------- | ----------------------- | ------------------------- | -------------------------- |\n * | (unset)                 | all on                  | names on, locations off   | all off                    |\n * | `true`                  | all on                  | all on                    | all on                     |\n * | `false`                 | all off                 | all off                   | all off                    |\n * | `{ kind: true/false }`  | as given; the rest on   | as given; the rest as unset | as given; the rest off   |\n */\nexport function getSourceNames(\n  user: boolean | SourceNamesOptions | undefined,\n  dev: boolean,\n  observe: boolean,\n): ResolvedSourceNames {\n  const posture = dev || observe;\n  if (typeof user === 'boolean') {\n    return { components: user, bindings: user, primitives: user, locations: user };\n  }\n  return {\n    components: user?.components ?? posture,\n    bindings: user?.bindings ?? posture,\n    primitives: user?.primitives ?? posture,\n    locations: user?.locations ?? dev,\n  };\n}\n\n/**\n * Whether the user asked for locations in so many words (`sourceNames:\n * true` or `{ locations: true }`), as opposed to getting them from the dev\n * default. Decides whether an older compiler's silence is worth a warning.\n */\nexport function requestedLocations(user: boolean | SourceNamesOptions | undefined): boolean {\n  return user === true || (typeof user === 'object' && user.locations === true);\n}\n\n/** The slice of `@solidjs/compiler` the location probe exercises. */\nexport interface LocationProbeCompiler {\n  transform(code: string, options?: object | null): unknown;\n  transformSourceNames?(code: string, options?: object | null): unknown;\n}\n\n/**\n * Whether the installed `@solidjs/compiler` takes the `locations` kind and\n * the `root` option — on `transform` (`sourceNames.locations`) and on\n * `transformSourceNames` (`locations`), which ship together. The compiler\n * validates its options in JavaScript ahead of the native call and throws\n * `received unknown option` for a key it does not know, so one transform of\n * an empty module per function is a cheap, exact probe: it asks the\n * compiler that is actually loaded rather than inferring from a version\n * string what a prerelease carries. Called once per compiler load.\n */\nexport function detectLocationSupport(compiler: LocationProbeCompiler): boolean {\n  if (typeof compiler.transformSourceNames !== 'function') return false;\n  try {\n    compiler.transform('', { filename: '/probe.jsx', root: '/', sourceNames: { locations: true } });\n    compiler.transformSourceNames('', { filename: '/probe.ts', root: '/', locations: true });\n    return true;\n  } catch {\n    return false;\n  }\n}\n\n/** What the compiler about to receive the options can do with locations. */\nexport interface LocationTarget {\n  /**\n   * The compiler accepts `locations` and `root`. The native compiler is\n   * probed (`detectLocationSupport`); `@solidjs/babel-plugin` ignores keys\n   * it does not know, so it always takes them.\n   */\n  supportsLocations: boolean;\n  /** The resolved Vite root locations are made relative to. */\n  root: string;\n}\n\n/** The `sourceNames` value a JSX compiler receives, plus `root` when locations ride along. */\nexport interface JsxSourceNamesOptions {\n  sourceNames: false | { components: boolean; bindings: boolean; locations?: boolean };\n  root?: string;\n}\n\n/**\n * The JSX compiler's share of the resolved names: `sourceNames` as the\n * compilers define it (`false` when neither JSX kind is on — the compilers\n * default their own `sourceNames` on under `dev`, so the resolved value is\n * always passed and the plugin's table, not the compiler default, decides)\n * and, on a compiler that takes it, `locations` resolved the same way, with\n * `root` whenever a location is going to be written. On an older compiler\n * neither key is present: `@solidjs/compiler` throws on an unknown option.\n */\nexport function getJsxSourceNamesOptions(\n  names: ResolvedSourceNames,\n  target: LocationTarget,\n): JsxSourceNamesOptions {\n  const { components, bindings, locations } = names;\n  if (!components && !bindings) return { sourceNames: false };\n  if (!target.supportsLocations) return { sourceNames: { components, bindings } };\n  return {\n    sourceNames: { components, bindings, locations },\n    ...(locations ? { root: target.root } : {}),\n  };\n}\n\n/** Options for `transformSourceNames`, the primitives pass. */\nexport interface PrimitiveNamesOptions {\n  filename: string;\n  sourceMap: true;\n  locations?: boolean;\n  root?: string;\n}\n\n/**\n * The primitives pass's options: `locations` (whose compiler default is on,\n * so the resolved flag is always passed) and `root` when a location is\n * going to be written — both only on a compiler that takes them.\n */\nexport function getPrimitiveNamesOptions(\n  names: ResolvedSourceNames,\n  target: LocationTarget,\n  filename: string,\n): PrimitiveNamesOptions {\n  if (!target.supportsLocations) return { filename, sourceMap: true };\n  return {\n    filename,\n    sourceMap: true,\n    locations: names.locations,\n    ...(names.locations ? { root: target.root } : {}),\n  };\n}\n\n/**\n * Point the JSX transform's locations back at the authored source. The JSX\n * transform runs after the native prelude (primitive names, `lazy()`,\n * refresh), which reprints the module, so the `file:line:col` it writes is a\n * position in that intermediate code. `map` is the prelude's combined\n * sourcemap and `input` the code the JSX transform received: a location\n * already in `input` is the primitives pass's, written against the authored\n * source, and is kept. `file` is the root-relative path the compilers write.\n */\nexport function remapJsxLocations(\n  code: string,\n  input: string,\n  map: object | null,\n  file: string,\n): string {\n  if (!map || !code.includes(`\"${file}:`)) return code;\n  const escaped = file.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n  const pattern = new RegExp(`\"${escaped}:(\\\\d+):(\\\\d+)\"`, 'g');\n  const prelude = new Set(input.match(pattern));\n  const consumer = new SourceMap(map as ConstructorParameters<typeof SourceMap>[0]);\n  return code.replace(pattern, (loc, line: string, column: string) => {\n    if (prelude.has(loc)) return loc;\n    // Nearest mapping at or before the position, on the same line: the\n    // offset past it carries over (one token's mapping covers its text).\n    const entry = consumer.findEntry(+line - 1, +column - 1);\n    if (!('originalLine' in entry) || entry.generatedLine !== +line - 1) return loc;\n    const original = entry.originalColumn + +column - entry.generatedColumn;\n    return `\"${file}:${entry.originalLine + 1}:${original}\"`;\n  });\n}\n","// Asset URLs in JSX. Solid's compiler puts a static attribute such as\n// `<img src=\"./logo.png\">` into the element's template as written, so Vite\n// never sees the asset: a module-relative URL resolves against the page at\n// runtime, and a public-directory URL misses a non-root or relative `base`\n// (Electron's file:// builds, sub-path deployments). Like\n// @vitejs/plugin-vue's `transformAssetUrls`, the attributes below are\n// rewritten before compiling: a relative URL becomes an import of the\n// asset, and a `/` URL naming a public-directory file takes the base.\nimport { existsSync, statSync } from 'fs';\nimport MagicString from 'magic-string';\nimport path from 'path';\nimport { parseSync, Visitor } from 'vite';\n\n/** Elements and their asset URL attributes (plugin-vue's defaults). */\nconst ASSET_ATTRIBUTES: Record<string, readonly string[]> = {\n  img: ['src', 'srcset'],\n  source: ['src', 'srcset'],\n  video: ['src', 'poster'],\n  image: ['href', 'xlink:href'],\n  use: ['href', 'xlink:href'],\n};\nconst MAY_HAVE_ASSET_URLS = /<(?:img|source|video|image|use)[\\s/>]/;\n\nexport interface AssetUrlOptions {\n  /**\n   * What a `/name` URL naming a public-directory file becomes: the URL\n   * under `base` (an absolute path or URL), an import (builds with a\n   * relative base, where the asset plugin emits a chunk-relative URL), or\n   * unchanged (`null`, the root base).\n   */\n  publicUrls: { base: string } | 'import' | null;\n  /** Vite's resolved `publicDir`, '' when disabled. */\n  publicDir: string;\n}\n\nexport function transformAssetUrls(\n  code: string,\n  id: string,\n  typescript: boolean,\n  options: AssetUrlOptions,\n): { code: string; map: string } | null {\n  if (!MAY_HAVE_ASSET_URLS.test(code)) return null;\n  const parsed = parseSync(id, code, { lang: typescript ? 'tsx' : 'jsx', sourceType: 'module' });\n  // The compiler reports syntax errors, with more context.\n  if (parsed.errors.length) return null;\n\n  const s = new MagicString(code);\n  const imports = new Map<string, string>();\n  let nextName = 0;\n  const importName = (specifier: string) => {\n    let name = imports.get(specifier);\n    if (!name) {\n      do name = `__solidAsset${nextName++}`;\n      while (code.includes(name));\n      imports.set(specifier, name);\n    }\n    return name;\n  };\n\n  // One URL as parts (an imported asset's binding or literal text), or\n  // null when it stays as written.\n  const rewriteUrl = (url: string): Part[] | null => {\n    const hashIndex = url.indexOf('#');\n    const target = hashIndex === -1 ? url : url.slice(0, hashIndex);\n    const hash = hashIndex === -1 ? '' : url.slice(hashIndex);\n    const imported = (): Part[] => [{ name: importName(target) }, hash];\n    if (/^\\.{1,2}\\//.test(target)) return imported();\n    if (!options.publicUrls || !isPublicFile(target, options.publicDir)) return null;\n    if (options.publicUrls === 'import') return imported();\n    return [options.publicUrls.base + url.slice(1)];\n  };\n\n  // srcset: comma-separated candidates of a URL and an optional descriptor.\n  // Data URLs carry commas, so a srcset with one stays as written.\n  const rewriteSrcset = (value: string): Part[] | null => {\n    if (value.includes('data:')) return null;\n    let changed = false;\n    const parts: Part[] = [];\n    for (const candidate of value.split(',')) {\n      const [url, ...descriptor] = candidate.trim().split(/\\s+/);\n      if (!url) continue;\n      const rewritten = rewriteUrl(url);\n      if (rewritten) changed = true;\n      if (parts.length) parts.push(', ');\n      parts.push(...(rewritten ?? [url]), ...descriptor.map((text) => ' ' + text));\n    }\n    return changed ? parts : null;\n  };\n\n  new Visitor({\n    JSXOpeningElement(node) {\n      if (node.name.type !== 'JSXIdentifier') return;\n      const attributes = ASSET_ATTRIBUTES[node.name.name];\n      if (!attributes) return;\n      for (const attribute of node.attributes) {\n        if (attribute.type !== 'JSXAttribute' || !attribute.value) continue;\n        const name =\n          attribute.name.type === 'JSXNamespacedName'\n            ? `${attribute.name.namespace.name}:${attribute.name.name.name}`\n            : attribute.name.name;\n        if (!attributes.includes(name)) continue;\n        const value = stringValue(attribute.value);\n        if (value === null) continue;\n        const parts = name === 'srcset' ? rewriteSrcset(value) : rewriteUrl(value);\n        if (parts)\n          s.overwrite(attribute.value.start, attribute.value.end, `{${expression(parts)}}`);\n      }\n    },\n  }).visit(parsed.program);\n  if (!s.hasChanged()) return null;\n\n  if (imports.size) {\n    const statements = [...imports]\n      .map(([specifier, name]) => `import ${name} from ${JSON.stringify(specifier)};`)\n      .join('\\n');\n    // After the directive prologue (\"use server\" must stay first).\n    let end = 0;\n    for (const statement of parsed.program.body) {\n      if (statement.type !== 'ExpressionStatement' || !('directive' in statement)) break;\n      end = statement.end;\n    }\n    if (end) s.appendLeft(end, '\\n' + statements);\n    else s.prepend(statements + '\\n');\n  }\n  return {\n    code: s.toString(),\n    map: s.generateMap({ hires: 'boundary', source: id, includeContent: true }).toString(),\n  };\n}\n\n/** Literal text, or the binding of an imported asset's URL. */\ntype Part = string | { name: string };\n\n// A plain string (a base-prefixed public URL) compiles into the static\n// template; an imported URL alone is its binding, set once; anything else is\n// a template literal.\nfunction expression(parts: Part[]): string {\n  const filled = parts.filter((part) => part !== '');\n  if (filled.every((part) => typeof part === 'string')) return JSON.stringify(filled.join(''));\n  if (filled.length === 1) return (filled[0] as { name: string }).name;\n  const body = filled\n    .map((part) =>\n      typeof part === 'string'\n        ? part.replace(/\\\\|`|\\$\\{/g, (match) => '\\\\' + match)\n        : '${' + part.name + '}',\n    )\n    .join('');\n  return '`' + body + '`';\n}\n\nfunction stringValue(value: any): string | null {\n  if (value.type === 'Literal') return typeof value.value === 'string' ? value.value : null;\n  if (value.type !== 'JSXExpressionContainer') return null;\n  const expression = value.expression;\n  if (expression.type === 'Literal' && typeof expression.value === 'string')\n    return expression.value;\n  if (expression.type === 'TemplateLiteral' && expression.expressions.length === 0) {\n    return expression.quasis[0].value.cooked ?? null;\n  }\n  return null;\n}\n\nfunction isPublicFile(url: string, publicDir: string): boolean {\n  if (!publicDir || !url.startsWith('/') || url.startsWith('//')) return false;\n  let pathname = url.replace(/[?#].*$/, '');\n  try {\n    pathname = decodeURIComponent(pathname);\n  } catch {\n    return false;\n  }\n  const file = path.join(publicDir, pathname);\n  if (!file.startsWith(path.join(publicDir, path.sep))) return false;\n  return existsSync(file) && statSync(file).isFile();\n}\n","// CSS module class names in JSX, in builds. `class={styles.button}` reads a\n// member of an imported object, so Solid's compiler has to treat it as\n// reactive: it emits an effect instead of putting the class in the\n// element's template. A build's class names are fixed, so they are inlined\n// as strings first, read from Vite's own output for the CSS module.\n//\n// An import whose every use was inlined would be dropped (TypeScript elides\n// it, and Vite drops a CSS module's stylesheet once no export is used), so\n// it becomes a bare import, and `plugin` keeps the module whole. A module\n// someone else loaded first can no longer be marked, so it stays as written.\nimport MagicString from 'magic-string';\nimport { parseSync, type Plugin, type Rolldown, Visitor, withFilter } from 'vite';\n\nexport const CSS_MODULE_ID =\n  /\\.module\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\\?)/;\nconst MAY_IMPORT_CSS_MODULE = /\\.module\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)\\b/;\n\ninterface CssModuleImport {\n  /** Where the import declaration starts. */\n  declaration: number;\n  source: string;\n  /** `default` (an object of class names), `*` (the module), or a named class. */\n  imported: string;\n}\n\nexport function createCssModuleClasses() {\n  const requested = new Set<string>();\n  const kept = new Set<string>();\n\n  const plugin: Plugin = {\n    name: 'solid:css-module-classes',\n    apply: 'build',\n    enforce: 'post',\n    transform(code, id) {\n      if (!requested.has(id)) return null;\n      kept.add(id);\n      return { code, map: null, moduleSideEffects: 'no-treeshake' };\n    },\n  };\n  withFilter(plugin, { transform: { id: CSS_MODULE_ID } });\n\n  async function inline(\n    ctx: Rolldown.TransformPluginContext,\n    code: string,\n    id: string,\n    typescript: boolean,\n  ): Promise<{ code: string; map: string } | null> {\n    if (!MAY_IMPORT_CSS_MODULE.test(code)) return null;\n    const parsed = parseSync(id, code, { lang: typescript ? 'tsx' : 'jsx', sourceType: 'module' });\n    if (parsed.errors.length) return null;\n\n    const imports = new Map<string, CssModuleImport>();\n    for (const statement of parsed.program.body) {\n      if (statement.type !== 'ImportDeclaration' || statement.importKind === 'type') continue;\n      const source = statement.source.value;\n      if (!CSS_MODULE_ID.test(source)) continue;\n      for (const specifier of statement.specifiers) {\n        if (specifier.type === 'ImportSpecifier' && specifier.importKind === 'type') continue;\n        imports.set(specifier.local.name, {\n          declaration: statement.start,\n          source,\n          imported:\n            specifier.type === 'ImportDefaultSpecifier'\n              ? 'default'\n              : specifier.type === 'ImportNamespaceSpecifier'\n                ? '*'\n                : specifier.imported.type === 'Identifier'\n                  ? specifier.imported.name\n                  : String(specifier.imported.value),\n        });\n      }\n    }\n    if (!imports.size) return null;\n    // A name declared anywhere else might shadow its import somewhere.\n    for (const name of declaredNames(parsed.program)) imports.delete(name);\n\n    // Class names per source, from Vite's output for the module.\n    const classes = new Map<string, CssModuleExports | null>();\n    for (const { source } of imports.values()) {\n      if (classes.has(source)) continue;\n      classes.set(source, null);\n      const resolved = await ctx.resolve(source, id);\n      if (!resolved || resolved.external) continue;\n      requested.add(resolved.id);\n      const info = await ctx.load({ id: resolved.id });\n      if (kept.has(resolved.id) && info.code) classes.set(source, cssModuleExports(info.code));\n    }\n    for (const [name, entry] of imports) if (!classes.get(entry.source)) imports.delete(name);\n    if (!imports.size) return null;\n\n    const className = (expression: any): { value: string; references: number[] } | null => {\n      if (expression.type === 'Identifier') {\n        const entry = imports.get(expression.name);\n        const value = entry && classes.get(entry.source)!.named.get(entry.imported);\n        return value === undefined ? null : { value, references: [expression.start] };\n      }\n      if (expression.type === 'MemberExpression' && expression.object.type === 'Identifier') {\n        const entry = imports.get(expression.object.name);\n        if (!entry || (entry.imported !== 'default' && entry.imported !== '*')) return null;\n        const key = expression.computed\n          ? expression.property.type === 'Literal' && typeof expression.property.value === 'string'\n            ? expression.property.value\n            : null\n          : expression.property.name;\n        const exports = classes.get(entry.source)!;\n        const value =\n          key === null\n            ? undefined\n            : (entry.imported === '*' ? exports.named : exports.default).get(key);\n        return value === undefined ? null : { value, references: [expression.object.start] };\n      }\n      if (expression.type === 'TemplateLiteral') {\n        let value = expression.quasis[0].value.cooked;\n        const references: number[] = [];\n        for (let index = 0; index < expression.expressions.length; index++) {\n          const part = className(expression.expressions[index]);\n          const text = expression.quasis[index + 1].value.cooked;\n          if (!part || value == null || text == null) return null;\n          value += part.value + text;\n          references.push(...part.references);\n        }\n        return value == null || !references.length ? null : { value, references };\n      }\n      return null;\n    };\n\n    const s = new MagicString(code);\n    const inlined = new Set<number>();\n    const references = new Map<string, number[]>();\n    const notReferences = new Set<number>();\n    new Visitor({\n      ImportDeclaration(node) {\n        for (const specifier of node.specifiers) notReferences.add(specifier.local.start);\n      },\n      MemberExpression(node) {\n        if (!node.computed) notReferences.add(node.property.start);\n      },\n      Property(node) {\n        if (!node.computed && !node.shorthand) notReferences.add(node.key.start);\n      },\n      MethodDefinition(node) {\n        if (!node.computed) notReferences.add(node.key.start);\n      },\n      PropertyDefinition(node) {\n        if (!node.computed) notReferences.add(node.key.start);\n      },\n      JSXAttribute(node) {\n        const value = node.value;\n        if (value?.type !== 'JSXExpressionContainer') return;\n        const result = className(value.expression);\n        if (!result) return;\n        s.overwrite(value.start, value.end, `{${JSON.stringify(result.value)}}`);\n        for (const reference of result.references) inlined.add(reference);\n      },\n      Identifier(node) {\n        if (!imports.has(node.name) || notReferences.has(node.start)) return;\n        references.set(node.name, [...(references.get(node.name) ?? []), node.start]);\n      },\n      // A JSX name (`<styles.Item />`) is a use too, never inlined.\n      JSXIdentifier(node) {\n        if (imports.has(node.name)) {\n          references.set(node.name, [...(references.get(node.name) ?? []), -1]);\n        }\n      },\n    }).visit(parsed.program);\n    if (!inlined.size) return null;\n\n    // A declaration whose every binding is now unused stays as a bare import.\n    const declarations = new Map<number, string[]>();\n    for (const [name, entry] of imports) {\n      declarations.set(entry.declaration, [...(declarations.get(entry.declaration) ?? []), name]);\n    }\n    for (const statement of parsed.program.body) {\n      if (statement.type !== 'ImportDeclaration' || !declarations.has(statement.start)) continue;\n      const names = declarations.get(statement.start)!;\n      const unused = (name: string) =>\n        (references.get(name) ?? []).every((reference) => inlined.has(reference));\n      if (names.length === statement.specifiers.length && names.every(unused)) {\n        s.overwrite(statement.start, statement.end, `import ${statement.source.raw};`);\n      }\n    }\n    return {\n      code: s.toString(),\n      map: s.generateMap({ hires: 'boundary', source: id, includeContent: true }).toString(),\n    };\n  }\n\n  return { plugin, inline };\n}\n\ninterface CssModuleExports {\n  /** The default export's class names, by key. */\n  default: Map<string, string>;\n  /** Named exports (the classes whose names are identifiers). */\n  named: Map<string, string>;\n}\n\n// Vite's CSS module output: `export const a = \"...\"` per identifier class,\n// and `export default { a: a, \"b-c\": \"...\" }`.\nfunction cssModuleExports(code: string): CssModuleExports {\n  const exports: CssModuleExports = { default: new Map(), named: new Map() };\n  const parsed = parseSync('module.js', code, { sourceType: 'module' });\n  for (const statement of parsed.program.body) {\n    if (statement.type === 'ExportNamedDeclaration') {\n      if (statement.declaration?.type !== 'VariableDeclaration') continue;\n      for (const declarator of statement.declaration.declarations) {\n        const init = declarator.init;\n        if (declarator.id.type === 'Identifier' && init?.type === 'Literal') {\n          if (typeof init.value === 'string') exports.named.set(declarator.id.name, init.value);\n        }\n      }\n    } else if (\n      statement.type === 'ExportDefaultDeclaration' &&\n      statement.declaration.type === 'ObjectExpression'\n    ) {\n      for (const property of statement.declaration.properties) {\n        if (property.type !== 'Property' || property.computed) continue;\n        const key =\n          property.key.type === 'Identifier'\n            ? property.key.name\n            : String((property.key as any).value);\n        const value = property.value;\n        if (value.type === 'Literal' && typeof value.value === 'string') {\n          exports.default.set(key, value.value);\n        } else if (value.type === 'Identifier' && exports.named.has(value.name)) {\n          exports.default.set(key, exports.named.get(value.name)!);\n        }\n      }\n    }\n  }\n  return exports;\n}\n\n// Every binding name the module declares, besides its imports.\nfunction declaredNames(program: any): Set<string> {\n  const names = new Set<string>();\n  const addPattern = (pattern: any): void => {\n    if (!pattern) return;\n    if (pattern.type === 'Identifier') names.add(pattern.name);\n    else if (pattern.type === 'ObjectPattern') {\n      for (const property of pattern.properties) {\n        addPattern(property.type === 'RestElement' ? property.argument : property.value);\n      }\n    } else if (pattern.type === 'ArrayPattern') pattern.elements.forEach(addPattern);\n    else if (pattern.type === 'RestElement') addPattern(pattern.argument);\n    else if (pattern.type === 'AssignmentPattern') addPattern(pattern.left);\n    else if (pattern.type === 'TSParameterProperty') addPattern(pattern.parameter);\n  };\n  const addFunction = (node: any) => {\n    if (node.id) names.add(node.id.name);\n    node.params.forEach(addPattern);\n  };\n  new Visitor({\n    VariableDeclarator: (node) => addPattern(node.id),\n    FunctionDeclaration: addFunction,\n    FunctionExpression: addFunction,\n    ArrowFunctionExpression: addFunction,\n    ClassDeclaration: (node) => node.id && names.add(node.id.name),\n    ClassExpression: (node) => node.id && names.add(node.id.name),\n    CatchClause: (node) => addPattern(node.param),\n  }).visit(program);\n  return names;\n}\n","import type * as babel from '@babel/core';\nimport type { TransformOptions as JsxCompilerOptions } from '@solidjs/compiler';\nimport remapping from '@ampproject/remapping';\nimport { existsSync, readFileSync, realpathSync } from 'fs';\nimport { mergeAndConcat } from 'merge-anything';\nimport { createRequire } from 'module';\nimport { pathToFileURL } from 'url';\nimport {\n  createDevAssetResolver,\n  registerDevAssetResolver,\n  installDevManifestBridge,\n  devManifestBridgeUrl,\n  DEV_MANIFEST_REGISTRY_KEY,\n  DEV_MANIFEST_INVALIDATE_EVENT,\n} from './dev-manifest.js';\nimport { boundaryModules } from './boundary-modules.js';\nimport { solidDiagnostics } from './diagnostics/index.js';\nimport {\n  resolvePerformanceTracksOptions,\n  solidPerformanceTracks,\n  type PerformanceTracksOption,\n} from './performance-tracks/index.js';\n\nimport {\n  createServerFunctionsPlugins,\n  normalizeServerFunctionsEndpoint,\n  serverFunctions,\n  type ServerFunctionsOptions,\n} from './server-functions/index.js';\nimport {\n  type NodeServerOptions,\n  SSR_HANDLER_ID,\n  startServe,\n  type StartOptions,\n} from './ssr/index.js';\nimport { envPlugin } from './env.js';\nimport {\n  detectLocationSupport,\n  getJsxSourceNamesOptions,\n  getPrimitiveNamesOptions,\n  getSourceNames,\n  remapJsxLocations,\n  requestedLocations,\n  type LocationTarget,\n  type ResolvedSourceNames,\n  type SourceNamesOptions,\n} from './source-names.js';\nimport {\n  cleanModuleId,\n  isTsrxCssModule,\n  TSRX_CSS_IDS,\n  isTsrxModule,\n  offsetSourceMapLine,\n  prependTsrxCssImport,\n  resolvedTsrxCssModuleId,\n  resolveTsrxCssModule,\n  tsrxCssSourceId,\n  updateTsrxCss,\n} from './tsrx.js';\n\nexport { devStylePatch } from './dev-manifest.js';\nexport { serverFunctions };\nexport type { ServerFunctionsOptions };\nexport type {\n  PersistedServerFunctionManifest,\n  ServerFunctionsFilter,\n} from './server-functions/index.js';\nexport type { NodeServerOptions, StartOptions };\nexport type {\n  StartMiddleware,\n  StartRequestEvent,\n  StartServerRenderContext,\n  StartServerRenderSetup,\n} from './request-event.js';\nexport type { DevAssetResolver } from './dev-manifest.js';\nimport path from 'path';\nimport type { FilterPattern, Logger, Plugin, ViteDevServer } from 'vite';\nimport {\n  createFilter,\n  defaultClientConditions,\n  defaultExternalConditions,\n  defaultServerConditions,\n  searchForWorkspaceRoot,\n  transformWithOxc,\n  withFilter,\n} from 'vite';\nimport { type AssetUrlOptions, transformAssetUrls } from './asset-urls.js';\nimport { removeClientBuildFile } from './build-files.js';\nimport { createCssModuleClasses } from './css-module-classes.js';\nimport { getEnvironmentConsumer, isRunnableEnvironment } from './environment.js';\nimport { exactIds, extensionIds } from './hook-filters.js';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\n/**\n * The `lazy()` module-URL placeholder contract, shared with the native\n * compiler's `transformLazy` pass: `lazy(() => import(\"spec\"))` calls gain a\n * second string-literal argument of the form\n * `\"__SOLID_LAZY_MODULE__:\" + spec`, which `resolveLazyModuleUrls` swaps for\n * the project-relative resolved module path. The prefix and shape are FROZEN\n * — the emitting side lives in @solidjs/compiler and must match.\n */\nconst LAZY_PLACEHOLDER_PREFIX = '__SOLID_LAZY_MODULE__:';\n\n/** Optional peers, loaded on first use: the default native compiler never needs Babel. */\nfunction optionalPeers<T>(load: () => Promise<T>, packages: string[], feature: string) {\n  let loaded: Promise<T> | undefined;\n  return () =>\n    // Not retried: Node remembers a missing package until the process exits.\n    (loaded ??= load().catch((error) => {\n      const missing =\n        error?.code === 'ERR_MODULE_NOT_FOUND' &&\n        packages.some((pkg) => String(error.message).includes(`'${pkg}'`));\n      if (!missing) throw error;\n      const named = packages.map((pkg) => `\\`${pkg}\\``).join(' and ');\n      throw new Error(\n        `[@solidjs/vite-plugin] ${feature} needs ${named}: install ${packages.length > 1 ? 'them' : 'it'} in the project, then restart the Vite process.`,\n        { cause: error },\n      );\n    }));\n}\n\nconst loadBabelCore = optionalPeers(\n  () => import('@babel/core'),\n  ['@babel/core'],\n  'the `babel` option',\n);\nconst loadBabelJsx = optionalPeers(\n  async () => {\n    const [core, plugin] = await Promise.all([\n      import('@babel/core'),\n      import('@solidjs/babel-plugin'),\n    ]);\n    return { transformAsync: core.transformAsync, solid: plugin.default as babel.PluginItem };\n  },\n  ['@babel/core', '@solidjs/babel-plugin'],\n  '`compiler: \"babel\"`',\n);\n\n/**\n * The HMR runtime: the dev-only `solid-js/refresh` core entry. Refresh\n * wrappers are compiled by the native `transformRefresh` pass in every mode\n * and import the runtime through normal module resolution (the legacy\n * solid-refresh package — whose runtime carries a known Solid 2.0 HMR bug,\n * solid-refresh#85 — is no longer used at all).\n */\nconst REFRESH_RUNTIME_SOURCE = 'solid-js/refresh';\n\n// Appended to the document shell's client compile instead of a refresh\n// boundary (see documentModuleId in solidPlugin): self-accept, then\n// invalidate — Vite's spelling for \"this module cannot hot-update, reload\".\nconst DOCUMENT_HMR_DECLINE =\n  '\\nif (import.meta.hot) {\\n  import.meta.hot.accept(() => import.meta.hot.invalidate());\\n}\\n';\n\nconst DEFAULT_STYLE_EXCLUDE = /node_modules/;\n\nconst VIRTUAL_MANIFEST_ID = 'virtual:solid-manifest';\nconst RESOLVED_VIRTUAL_MANIFEST_ID = '\\0' + VIRTUAL_MANIFEST_ID;\nconst VIRTUAL_MANIFEST_BRIDGE_ID = 'virtual:solid-manifest-bridge';\nconst RESOLVED_VIRTUAL_MANIFEST_BRIDGE_ID = '\\0' + VIRTUAL_MANIFEST_BRIDGE_ID;\n\n// In dev the virtual manifest exports a `{ resolve, resolveSync }` resolver:\n// lazy modules resolve to their dev URL plus transitively imported CSS as\n// inline-style descriptors collected from the live module graph. The resolver\n// itself lives plugin-side (it closes over the dev server) and is reached\n// through a global registry; isolated module runners that don't share\n// globals (nitro's dev worker, workerd) fall back to fetching the dev\n// server's bridge endpoint, whose URL is baked in at generation time\n// (`bridgeUrl` — null outside a live dev server, e.g. the manifest-less SSR\n// build fallback, where js-only resolution remains). Bridge failures log\n// loudly and resolve to null so the runtime's own no-assets warning stays\n// the final catch-all. Generated before the server listens (#414), it has no\n// origin yet: `deferBridge` imports it from `virtual:solid-manifest-bridge`\n// on first lookup (waiting in `load` deadlocks environment `listen()`).\n//\n// The generated `moduleUrl` mirrors `devModuleUrl` (src/dev-manifest.ts) —\n// base-prefixed root-relative URLs, `/@fs/` for root-external keys — for the\n// degraded paths that can't reach the plugin-side resolver (no registry and\n// no bridge, or a resolveSync call before the bridge cache warms). Keep the\n// two in sync.\nconst devManifestCode = (\n  root: string,\n  base: string,\n  bridgeUrl: string | null,\n  deferBridge: boolean,\n) => `const registry = globalThis[Symbol.for(${JSON.stringify(DEV_MANIFEST_REGISTRY_KEY)})];\nconst projectRoot = ${JSON.stringify(root.split(path.sep).join('/'))};\nconst base = ${JSON.stringify(base.startsWith('/') ? base.replace(/\\/$/, '') : '')};\nfunction moduleUrl(key) {\n  key = key.replace(/^\\\\/+/, \"\");\n  const queryIndex = key.indexOf(\"?\");\n  const file = queryIndex === -1 ? key : key.slice(0, queryIndex);\n  const query = queryIndex === -1 ? \"\" : key.slice(queryIndex);\n  if (file.slice(0, 2) !== \"..\") return base + \"/\" + key;\n  const segments = (projectRoot + \"/\" + file).split(\"/\");\n  const resolved = [];\n  for (const segment of segments) {\n    if (segment === \"..\") resolved.pop();\n    else if (segment && segment !== \".\") resolved.push(segment);\n  }\n  return base + \"/@fs/\" + resolved.join(\"/\") + query;\n}\nconst jsOnly = key => ({ js: [moduleUrl(key)], css: [] });\nlet bridgeUrl = ${JSON.stringify(bridgeUrl)};\nconst deferBridge = ${deferBridge};\nlet bridgeLookup = null;\nlet bridgeMissing = false;\nfunction lookupBridge() {\n  if (!bridgeLookup) {\n    bridgeLookup = import(${JSON.stringify(VIRTUAL_MANIFEST_BRIDGE_ID)}).then(\n      (mod) => {\n        bridgeLookup = null;\n        bridgeUrl = mod.default;\n        bridgeMissing = !bridgeUrl;\n      },\n      (error) => {\n        bridgeLookup = null;\n        throw error;\n      },\n    );\n  }\n  return bridgeLookup;\n}\nfunction createBridgeResolver() {\n  // Lazy SSR retries need synchronous cache hits to converge. Failed bridge\n  // requests stay retryable; concurrent lookups share one pending promise.\n  const cache = new Map();\n  const inFlight = new Map();\n  let generation = 0;\n  const invalidate = () => {\n    generation++;\n    cache.clear();\n    inFlight.clear();\n  };\n  if (import.meta.hot) {\n    // Hosts such as Nitro consume full-reload before it reaches this runner.\n    import.meta.hot.on(${JSON.stringify(DEV_MANIFEST_INVALIDATE_EVENT)}, invalidate);\n    import.meta.hot.dispose(() => {\n      import.meta.hot.off(${JSON.stringify(DEV_MANIFEST_INVALIDATE_EVENT)}, invalidate);\n      invalidate();\n    });\n  }\n\n  return {\n    resolve(key) {\n      const cached = cache.get(key);\n      if (cached) return cached;\n      if (bridgeMissing) {\n        // No origin yet: stay synchronous and retry the lookup.\n        lookupBridge().catch(() => {});\n        return jsOnly(key);\n      }\n      let request = inFlight.get(key);\n      if (!request) {\n        const startedAt = generation;\n        request = fetchAssets(key).then(\n          (assets) => {\n            if (generation === startedAt) {\n              if (assets && !bridgeMissing) cache.set(key, assets);\n              inFlight.delete(key);\n            }\n            return assets;\n          },\n          (error) => {\n            if (generation === startedAt) inFlight.delete(key);\n            throw error;\n          },\n        );\n        inFlight.set(key, request);\n      }\n      return request;\n    },\n    resolveSync: (key) => cache.get(key) || jsOnly(key),\n  };\n}\nasync function fetchAssets(key) {\n  if (!bridgeUrl) {\n    await lookupBridge();\n    if (!bridgeUrl) return jsOnly(key);\n  }\n  const url = new URL(bridgeUrl);\n  url.searchParams.set(\"key\", key);\n  let response;\n  try {\n    response = await fetch(url);\n  } catch (error) {\n    console.error(\n      '[@solidjs/vite-plugin] Dev manifest bridge request failed for module key \"' + key +\n        '\" (' + url.href + '): ' + ((error && error.message) || error) +\n        \". SSR will render without this module's client assets, so its hydration preload entry will be missing.\",\n    );\n    return null;\n  }\n  if (!response.ok) {\n    // A silent null here strips the module's client assets from the\n    // SSR'd hydration asset map and hydration fails much later with a\n    // cryptic client-side error — report the miss where it happens.\n    console.error(\n      '[@solidjs/vite-plugin] Dev manifest bridge request failed with status ' + response.status +\n        ' for module key \"' + key + '\" (' + url.href +\n        \"). SSR will render without this module's client assets, so its hydration preload entry will be missing.\",\n    );\n    return null;\n  }\n  return response.json();\n}\nexport default (registry && registry[${JSON.stringify(root)}]) ||\n  (bridgeUrl || deferBridge ? createBridgeResolver() : { resolve: jsOnly, resolveSync: jsOnly });`;\n\n/** Possible options for the extensions property */\nexport interface ExtensionOptions {\n  typescript?: boolean;\n}\n\nexport type Compiler = 'babel' | 'native';\nexport type { SourceNamesOptions };\n\n/**\n * Another front end for Solid (see `Options.frontends`): a language whose\n * modules it compiles itself, to what `@solidjs/compiler` emits for a JSX\n * module — Solid's output, no JSX left. The plugin then treats the module\n * the way it treats lowered `.tsrx`: primitive names, `lazy()` module URLs,\n * the HMR refresh pass, server functions, and the stylesheet as a CSS module.\n */\nexport interface Frontend {\n  /**\n   * Compiles one module for one environment. `null` leaves the module to\n   * the rest of the pipeline untouched.\n   */\n  compile(\n    source: string,\n    context: FrontendContext,\n  ): FrontendResult | null | Promise<FrontendResult | null>;\n}\n\nexport interface FrontendContext {\n  /** The module's file path. */\n  id: string;\n  /**\n   * The module's full id, query included: a front end that imports its own\n   * modules under a query (`./x.rx?dep`) tells the forms apart by it.\n   */\n  moduleId: string;\n  /** Whether the module is compiled for a server environment. */\n  ssr: boolean;\n  /** Vite's resolved project root. */\n  root: string;\n  /**\n   * The options this plugin would hand `@solidjs/compiler` for a JSX module\n   * in this environment (`generate`, `hydratable`, `moduleName`, `dev`, …),\n   * so a front end that ends in Solid's compiler compiles alike.\n   */\n  solid: SolidOptions & { root?: string };\n  /**\n   * Marks a file the front end read for this module (an imported module's\n   * declarations, say): a change to it recompiles this module.\n   */\n  addWatchFile(file: string): void;\n}\n\nexport interface FrontendResult {\n  code: string;\n  /** A source map from `code` back to the module's source. */\n  map?: string | object | null;\n  /** The module's stylesheet; the module imports it as a CSS module. */\n  css?: string;\n}\n\n// `root` (the project root `sourceNames.locations` paths are relative to)\n// is not a user option: the plugin passes Vite's resolved `config.root`.\nexport type SolidOptions = Omit<\n  JsxCompilerOptions,\n  'filename' | 'sourceMap' | 'sourceNames' | 'root'\n> & {\n  /**\n   * Source names in output: `true`/`false` for every kind, or per kind.\n   * Defaults to the posture — on for dev and `observe`, off for production\n   * builds (`locations`: on for dev only); `false` opts out of every kind,\n   * in dev too.\n   */\n  sourceNames?: boolean | SourceNamesOptions;\n};\ntype NativeCompiler = typeof import('@solidjs/compiler');\nlet nativeCompilerPromise: Promise<NativeCompiler> | undefined;\n/**\n * Whether the loaded `@solidjs/compiler` takes `sourceNames.locations` and\n * `root` (see `detectLocationSupport`). Probed once, when the compiler\n * loads, so it is only meaningful after `loadNativeCompiler()` resolved —\n * every caller that builds native options awaits the compiler first.\n */\nlet nativeLocations = false;\n\nasync function loadNativeCompiler() {\n  try {\n    return await (nativeCompilerPromise ??= import('@solidjs/compiler').then((compiler) => {\n      nativeLocations = detectLocationSupport(compiler);\n      return compiler;\n    }));\n  } catch (error) {\n    nativeCompilerPromise = undefined;\n    const reason = error instanceof Error ? `\\n\\nCause: ${error.message}` : '';\n    throw new Error(\n      '@solidjs/vite-plugin: failed to load @solidjs/compiler, which is required ' +\n        'in every mode (it drives the lazy, refresh, and server-function transforms; ' +\n        'compiler: \"babel\" only switches the JSX transform). Your platform should get ' +\n        'a prebuilt native binary or the @solidjs/compiler-wasm32-wasi fallback ' +\n        '— check that optional dependencies were installed.' +\n        reason,\n    );\n  }\n}\n\n/** Babel's `TransformOptions`, typed without `@babel/core`, which is an optional peer. */\nexport interface BabelOptions {\n  plugins?: any[] | null;\n  presets?: any[] | null;\n  [option: string]: any;\n}\n\n/** Configuration options for @solidjs/vite-plugin. */\nexport interface Options {\n  /**\n   * A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files\n   * the plugin should operate on. Relative patterns are resolved against the\n   * Vite root, not the invocation directory.\n   */\n  include?: FilterPattern;\n  /**\n   * A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files\n   * to be ignored by the plugin. Relative patterns are resolved against the\n   * Vite root, not the invocation directory.\n   */\n  exclude?: FilterPattern;\n  /**\n   * Use Solid's development builds: the `development` export condition of\n   * `solid-js` and `@solidjs/web`, which carry the extra checks, warnings\n   * and diagnostics, plus the compiler's dev output.\n   *\n   * Left unset, they are used under `vite dev` (and vitest) only. `true`\n   * forces them in `vite build` too, for example to debug a production\n   * bundle with the dev warnings on. `false` serves the production builds\n   * under `vite dev` as well; HMR then falls back to full reloads, since\n   * the production refresh runtime is an inert stub.\n   *\n   * @default undefined (development builds under `vite dev`, production\n   * builds otherwise)\n   */\n  dev?: boolean;\n  /**\n   * Resolve Solid's observe builds: the production-speed runtime that keeps\n   * the diagnostics and attribution channels (`OBSERVE`) alive for\n   * production observability tooling. Adds the `observe` export condition\n   * to every environment (client and server, inlined and externalized) and\n   * turns on the compiler's `sourceNames` (components, bindings, and\n   * primitives) so graph labels survive minification. Applies to `vite\n   * build` and preview; under `vite dev` the\n   * `development` condition still wins (the dev build is a superset).\n   *\n   * @default false\n   */\n  observe?: boolean;\n  /**\n   * Dev-serve only: expose Solid's diagnostic and attribution channels to\n   * out-of-process consumers (agents, tests, curl). Injects a client module\n   * that installs the in-page bridge from the app's own\n   * `@solidjs/diagnostics`, and serves a `/__solid/diagnostics` endpoint on\n   * the dev server that forwards capture control (`begin`/`end`),\n   * `whyDidRun`, and cost queries to the page over the Vite WebSocket. No\n   * effect on builds or preview.\n   *\n   * Omitted (the default), the surface auto-enables when the app declares\n   * `@solidjs/diagnostics` in its package.json — adding the dev dependency\n   * is the whole setup. `true` forces it on (erroring if the package is\n   * missing); `false` opts out entirely. Never active in test mode\n   * (vitest) or on builds/preview.\n   *\n   * @default undefined (auto-detect)\n   */\n  diagnostics?: boolean;\n  /**\n   * Dev-serve only: paint Solid's records — re-runs, interactions, holds,\n   * async flights, navigations, server-function calls — as custom tracks\n   * in the Chrome Performance panel (`@solidjs/web/performance-tracks`),\n   * without the app calling `enablePerformanceTracks()` itself. Injects a\n   * client module that enables the tracks ahead of the app's entry (a\n   * `<head>` script for index.html apps, an import at the top of the\n   * start-mode client entry), so hydration and the first interaction are\n   * on the timeline. The dev server already writes its side of the work\n   * (`Server-Timing`), which the tracks read back.\n   *\n   * Omitted or `true` enables under `vite dev` with the adapter's defaults;\n   * an object enables with those options passed through\n   * (`PerformanceTracksOptions` from `@solidjs/web/performance-tracks`:\n   * `minMs`, `rich`, `attribution` — plain data, serialized into the\n   * injected module); `false` opts out. Never active on `vite build` —\n   * not for `dev: true` or `observe` builds (an observe app enables its\n   * own tracks in production) — in test mode (vitest), or on preview.\n   * With `dev: false` (and no `observe`) the production runtime is served\n   * and the adapter is a no-op.\n   *\n   * @default true\n   */\n  performanceTracks?: PerformanceTracksOption;\n  /**\n   * Whether the app is server-rendered — one meaning everywhere.\n   *\n   * Without {@link start}: the legacy transform-only flag, unchanged.\n   * `true` enables the SSR transforms (hydratable client code, SSR server\n   * code) — you provide the entries and the server yourself. With `false`,\n   * client code is non-hydratable DOM output, and modules loaded on the\n   * server (for example through `ssrLoadModule` to prerender a page) get\n   * non-hydratable SSR output.\n   *\n   * With {@link start}: selects the start mode. `true` is SSR start mode\n   * (per-request streaming render + hydration); `false`/omitted is client\n   * mode (a static document shell + client-side `render()`). Flipping a\n   * start-mode project between SPA and SSR is toggling this one boolean.\n   *\n   * The flag describes the app's initial document, not the internal\n   * pipelines — client mode still compiles the document shell through the\n   * SSR transforms to serve/prerender it.\n   *\n   * @default false\n   */\n  ssr?: boolean;\n\n  /**\n   * Typed, validated environment variables. A schema file, conventionally\n   * `env.ts` or `env.js` at the project root, default-exports `{ server?,\n   * client? }` maps of Standard Schema validators. Validated values are\n   * exposed through `virtual:solid-env/server` (server module graphs only) and\n   * `virtual:solid-env/client` (the `VITE_`-prefixed client side).\n   *\n   * Independent of {@link start}: `true` requires the conventional file and\n   * a string selects an explicit schema path, in any setup. Left unset,\n   * only start mode probes for the conventional file, so a project with an\n   * unrelated `env.ts` is unaffected until it opts in. `false` disables the\n   * probing.\n   *\n   * @default undefined (with `start`: probe env.ts / env.js, off when\n   * absent; without `start`: off)\n   */\n  env?: boolean | string;\n\n  /**\n   * Start mode — Start as a mode of the plugin: it owns entries, dev\n   * serving, and the build — no index.html, no mount file, no server\n   * wiring. `start: true` is the zero-config spelling, sugar for the empty\n   * options bag `start: {}` (both mean the identical start mode with\n   * defaults; `false`/absent is off). Conventions (shared by both modes,\n   * so projects flip between them by toggling {@link ssr}): `src/App.*`\n   * (or `start.app`) is the root component; `src/Document.*` (or\n   * `start.document`) is the optional document shell; authored\n   * `src/entry-server.*` / `src/entry-client.*` (or `start.entries.server` /\n   * `start.entries.client`) replace the generated entries.\n   *\n   * With `ssr: true` — SSR start mode:\n   *\n   * - Dev: a middleware on the Vite dev server streams the rendered app for\n   *   HTML-accepting GET requests — `vite` just works, no server file.\n   * - Build: a plain `vite build` produces both bundles (client to\n   *   `dist/client`, server to `dist/server` via the environments/builder\n   *   API). The server bundle's entry is `virtual:solid-ssr-handler`, whose\n   *   `handleRequest(request)` export maps a web `Request` to a streamed\n   *   `Response`; its default `{ fetch(request) }` export provides the same\n   *   handler in the Fetchable shape used by deployment integrations.\n   *   The normal `ssr` environment exposes it as the `index` service entry\n   *   so provider Vite plugins can supply the runtime and build orchestration.\n   * - `start.nodeServer: true` additionally emits a ready-to-run Node server,\n   *   `dist/server/node.js` (`node dist/server/node.js`; PORT/HOST), that\n   *   serves the client build statically and dispatches the rest through\n   *   `handleRequest` (see {@link StartOptions.nodeServer}). Node is the one\n   *   mainstream runtime without a fetch-shaped server API; every other\n   *   host consumes the `{ fetch }` export directly.\n   * - With `serverFunctions` also enabled, the prod handler serves the\n   *   server-function endpoint too (in dev the server-function middleware\n   *   already runs first).\n   *\n   * Without `ssr: true` — client mode:\n   *\n   * - Dev: every HTML-accepting GET streams the rendered document shell\n   *   (without the app — history-fallback semantics); the generated client\n   *   entry `render()`s the app into it.\n   * - Build: `vite build` emits a static `dist/client` — the shell is\n   *   prerendered once through the built handler into\n   *   `dist/client/index.html` with the hashed entry script and CSS links —\n   *   deployable to any static host. No server bundle remains unless\n   *   `serverFunctions` is enabled, in which case `dist/server` is kept and\n   *   its `handleRequest` serves the endpoint (pages stay static) — and\n   *   `start.nodeServer` then emits `dist/server/node.js` serving the static\n   *   client with an `index.html` history fallback plus the endpoint.\n   * - Client code stays non-hydratable (`generate: 'dom'`), exactly like a\n   *   plain SPA; server-only options (`entries.server`, `externalServer`) are inert.\n   * - `vite preview` serves the static build with history fallback (and\n   *   dispatches the server-function endpoint through the kept handler).\n   *\n   * @default undefined\n   */\n  start?: boolean | StartOptions;\n\n  /** Options for development CSS crawling. */\n  css?: {\n    /**\n     * Which module graphs dev SSR crawls for the CSS it inlines into\n     * `<head>`, in start mode and in `ssr: true` setups reading\n     * `virtual:solid-manifest`. Patterns are\n     * [picomatch](https://github.com/micromatch/picomatch) globs or regexes;\n     * relative globs resolve against the Vite root. The patterns select the\n     * modules whose imports are followed, not stylesheets: CSS files and\n     * virtual modules always pass.\n     *\n     * `exclude` prunes matching graphs and defaults to `/node_modules/`\n     * (providing your own replaces the default). `include` adds matching\n     * files back on top of that baseline rather than narrowing the crawl to\n     * them: typically a package whose CSS should be server-inlined to avoid\n     * a development FOUC, e.g. `{ include: /node_modules\\/some-ui-lib/ }`. A\n     * file matching both stays excluded. Development only: production CSS\n     * always comes from the built assets.\n     */\n    devInline?: {\n      include?: FilterPattern;\n      exclude?: FilterPattern;\n    };\n  };\n\n  /**\n   * JSX compiler backend to use. The default `\"native\"` compiles through\n   * `@solidjs/compiler`; `\"babel\"` is the escape hatch running\n   * `@solidjs/babel-plugin` instead — if native output ever differs from your\n   * expectations, set `compiler: \"babel\"` and file an issue (the behavioral\n   * diff between the modes is the bug report; it needs `@babel/core` and\n   * `@solidjs/babel-plugin` installed in the project). Platforms without a prebuilt\n   * native binary (e.g. StackBlitz WebContainers) automatically use the wasm\n   * fallback; the compiler package itself is required in every mode.\n   *\n   * @default \"native\"\n   */\n  compiler?: Compiler;\n\n  /**\n   * This registers additional extensions that should be processed by\n   * @solidjs/vite-plugin. Experimental `.tsrx` is always registered as\n   * TypeScript TSRX and does not need to be listed here.\n   *\n   * @default undefined\n   */\n  extensions?: (string | [string, ExtensionOptions])[];\n  /**\n   * Other front ends, by file extension (`{ \".x\": x() }`): a module of that\n   * extension is compiled by the front end instead of Solid's JSX compiler,\n   * then takes the route lowered `.tsrx` takes (see `Frontend`). Its\n   * extension joins the default server-functions filter and the dependency\n   * scan. `.rx` (ReactiveScript) is built in, from the\n   * `@reactivescript/compiler` package; an entry for `.rx` here replaces it.\n   *\n   * @default undefined\n   */\n  frontends?: Record<string, Frontend>;\n  /**\n   * Pass any additional babel transform options. They will be merged with\n   * the transformations required by Solid.\n   *\n   * Note: with `compiler: \"native\"` the plugin is normally fully Babel-free\n   * (native lazy/refresh/JSX passes). Supplying custom babel options\n   * reintroduces a Babel support pass ahead of the native JSX transform to\n   * host them. For `.tsrx` only, native TSRX lowering runs first and the\n   * support pass receives the generated ordinary JavaScript. Install\n   * `@babel/core` in the project to use this option.\n   *\n   * @default {}\n   */\n  babel?:\n    | BabelOptions\n    | ((source: string, id: string, ssr: boolean) => BabelOptions)\n    | ((source: string, id: string, ssr: boolean) => Promise<BabelOptions>);\n  /**\n   * Solid JSX compiler options, for whichever compiler runs:\n   * `@solidjs/compiler` by default, `@solidjs/babel-plugin` with\n   * `compiler: \"babel\"`. They are merged with the plugin's Solid defaults.\n   *\n   * @default {}\n   */\n  solid?: SolidOptions;\n\n  /**\n   * Enable `\"use server\"` server function compilation (experimental). Pass\n   * `true` for the defaults (runtime from @solidjs/web/server-functions) or\n   * an options object to customize. The directive transform sub-plugins are\n   * emitted ahead of the JSX transform in the returned plugin array.\n   *\n   * Zero-config setup: in dev, a middleware on the Vite server handles the\n   * endpoint (default `/_server`, joined with `base`) end to end — no\n   * server-function code needed in the server entry. For production SSR\n   * builds, import `virtual:solid-server-function-handler` in the server\n   * entry and mount its `handleServerFunctionRequest(request)` export on the\n   * endpoint; it eagerly imports every module containing server functions so\n   * registrations survive tree-shaking.\n   *\n   * Hosts whose own server environment should own endpoint dispatch in dev\n   * (e.g. @cloudflare/vite-plugin, so functions run in workerd with\n   * bindings) can keep this option and set\n   * `serverFunctions: { devMiddleware: false }` — see\n   * {@link ServerFunctionsOptions.devMiddleware}. A server-only module can\n   * be pinned into the handler graph for pre-dispatch runtime registration\n   * via {@link ServerFunctionsOptions.serverSetup}.\n   *\n   * Meta-frameworks that need to control plugin ordering themselves (e.g.\n   * relative to a file-system router) and dispatch requests through their\n   * own server should use the standalone `serverFunctions()` export instead,\n   * which never installs the dev middleware.\n   *\n   * The object form's `components` flag additionally enables server\n   * components (experimental) — `\"use server\"` functions returning a\n   * component, served over the same endpoint. They come essentially for\n   * free: the endpoint transform is installed automatically, and with\n   * SSR start mode (the `start` option with `ssr: true`) and generated entries\n   * the document wiring is emitted too. See\n   * {@link ServerFunctionsOptions.components}.\n   *\n   * @default undefined\n   */\n  serverFunctions?: boolean | ServerFunctionsOptions;\n\n  /**\n   * Component hot replacement through the native refresh transform (dev\n   * only). `false` turns it off, so edits fall back to a full reload; an\n   * object tunes the transform.\n   *\n   * @default true\n   */\n  refresh?: boolean | RefreshOptions;\n}\n\n/** Options for the native HMR refresh transform (dev only). */\nexport interface RefreshOptions {\n  /**\n   * Emit per-component `signature`/`dependencies` metadata so edits only\n   * remount components whose code actually changed.\n   *\n   * @default true\n   */\n  granular?: boolean;\n}\n\nfunction getExtension(filename: string): string {\n  const index = filename.lastIndexOf('.');\n  return index < 0 ? '' : filename.substring(index);\n}\n\n/**\n * The path the transform compiles for `id`. This is normally `id` without its\n * query. Some plugins put the extension after the query instead, such as\n * unplugin-icons' `~icons/mdi/folder?width=2em.tsx`. Then the full id is used,\n * as it was before queries were stripped. #206\n */\nfunction getTransformPath(id: string, isHandled: (path: string) => boolean): string {\n  const cleanId = id.replace(/\\?.*$/, '');\n  return cleanId !== id && !isHandled(cleanId) && isHandled(id) ? id : cleanId;\n}\n// The packages whose dev/production server builds are selected by the\n// `development` export condition. A dependency on either means the package\n// consumes the runtime and must resolve it through Vite in dev.\nconst SOLID_RUNTIME_PKGS = ['solid-js', '@solidjs/web'];\n\n// Tooling that declares solid-js as a peer but never runs inside the SSR\n// module runner. Kept out of the crawl entirely: classifying them as\n// semi-framework would also crawl THEIR dependencies, which vitefu deep-\n// includes in the client optimizer (`@solidjs/vite-plugin > @babel/core`\n// pre-bundled for the browser — ~2.6 MB of dead weight per cold start).\n// Mirrors vite-plugin-svelte's isCommonDepWithoutSvelteField list.\nconst NON_RUNTIME_SOLID_PKGS = ['@solidjs/vite-plugin', 'vite', 'vitest', 'eslint-plugin-solid'];\nconst NON_RUNTIME_SOLID_PREFIXES = [\n  'vite-plugin-',\n  'eslint-plugin-',\n  'prettier-plugin-',\n  '@types/',\n];\nfunction isNonRuntimeSolidPkg(name: string): boolean {\n  const bare = name.slice(name.lastIndexOf('/') + 1);\n  return (\n    NON_RUNTIME_SOLID_PKGS.includes(name) ||\n    NON_RUNTIME_SOLID_PREFIXES.some((p) => (p.startsWith('@') ? name : bare).startsWith(p))\n  );\n}\n\nfunction containsSolidField(fields: Record<string, any>) {\n  const keys = Object.keys(fields);\n  for (let i = 0; i < keys.length; i++) {\n    const key = keys[i];\n    if (key === 'solid') return true;\n    if (typeof fields[key] === 'object' && fields[key] != null && containsSolidField(fields[key]))\n      return true;\n  }\n  return false;\n}\n\n/**\n * Locate a bare package the way Vite (and Node without `NODE_PATH`) does: walk\n * `<dir>/node_modules/<name>` up from `root`. `require.resolve` can't be used\n * for this — it also consults `NODE_PATH`, which pnpm's bin shims (`pnpm\n * vitest`, `pnpm test`) point at the hoisted virtual store\n * (`node_modules/.pnpm/node_modules`), where every transitive dependency of the\n * whole tree is reachable.\n */\nfunction findPackageDir(name: string, root: string): string | undefined {\n  let dir = root;\n  while (true) {\n    const candidate = path.join(dir, 'node_modules', name);\n    if (existsSync(path.join(candidate, 'package.json'))) return candidate;\n    const parent = path.dirname(dir);\n    if (parent === dir) return undefined;\n    dir = parent;\n  }\n}\n\n/**\n * Whether `id` looks like a package specifier (`name`, `name/sub`,\n * `@scope/name/sub`), by syntax alone. Relative and absolute paths, ids with a\n * protocol or drive (`virtual:`, `node:`, `C:`), subpath imports (`#x`) and\n * aliases like `~/x` or `@/x` don't.\n */\nfunction isPackageSpecifier(id: string): boolean {\n  if (!id || /^[./\\\\#~\\0]/.test(id) || id.includes(':')) return false;\n  if (id.startsWith('@')) return /^@[^/]+\\/[^/]/.test(id);\n  return true;\n}\n\nfunction getJestDomExport(setupFiles: string[], root: string) {\n  if (setupFiles?.some((file) => /jest-dom/.test(file))) return undefined;\n\n  // Resolve from the project root, not from this plugin's own location. With pnpm's\n  // isolated node_modules layout the plugin can reach a jest-dom that only exists as a\n  // transitive dependency (e.g. of Storybook), while Vitest resolves `setupFiles` from the\n  // project root, where it isn't installed, and fails to load it.\n  // https://github.com/solidjs/solid-vite-plugin/issues/231\n  // The bare specifier (not the resolved path) is injected on purpose: `require.resolve` picks\n  // jest-dom's CommonJS entry, which Vitest refuses to load, while Vitest itself resolves the\n  // specifier to the ESM entry.\n  const packageDir = findPackageDir('@testing-library/jest-dom', root);\n  if (!packageDir) return undefined;\n  // Check the subpath against THIS copy: resolving from inside the package\n  // self-references its `exports` map (v6+), or falls back to its own files\n  // for versions without one (v5's `extend-expect`). `NODE_PATH` still\n  // participates in that lookup, so make sure the hit landed in the package\n  // Vite will resolve rather than in some hoisted copy of another version.\n  const realPackageDir = realpathSync(packageDir);\n  const packageRequire = createRequire(path.join(packageDir, 'package.json'));\n  return ['@testing-library/jest-dom/vitest', '@testing-library/jest-dom/extend-expect'].find(\n    (specifier) => {\n      try {\n        const resolved = realpathSync(packageRequire.resolve(specifier));\n        return resolved.startsWith(realPackageDir + path.sep);\n      } catch (e) {\n        return false;\n      }\n    },\n  );\n}\n\n/**\n * The options for one JSX compile. `jsxCompiler` names the backend the\n * result goes to, which decides whether `sourceNames.locations` and `root`\n * can be included (the native compiler rejects options it does not know,\n * so its probe result gates them; the babel plugin ignores unknown keys);\n * for `'native'` the compiler must already be loaded (`loadNativeCompiler`\n * resolved) for the probe to have run. `root` is the resolved Vite root\n * the locations are made relative to.\n */\nfunction getSolidOptions(\n  options: Partial<Options>,\n  isSsr: boolean,\n  dev: boolean,\n  observe: boolean,\n  isTestMode: boolean,\n  jsxCompiler: Compiler,\n  root: string,\n): SolidOptions & { root?: string } {\n  let solidOptions: Pick<SolidOptions, 'generate' | 'hydratable'>;\n\n  if (isTestMode) {\n    // Vitest compiles with the client posture regardless of the app's `ssr`\n    // flag: component tests exercise DOM code and nothing hydrates in a\n    // test, so hydratable output would look for markers that aren't there.\n    // `generate` still follows the transform's own ssr flag, so explicit\n    // node-environment tests (renderToString) keep their server codegen.\n    solidOptions = { generate: isSsr ? 'ssr' : 'dom', hydratable: false };\n  } else if (options.start && !options.ssr) {\n    // Client start mode: client code compiles exactly like a plain SPA\n    // (dom, non-hydratable — nothing hydrates); only the document shell\n    // render goes through the SSR transforms, also non-hydratable since\n    // the shell is inert HTML the client never claims.\n    solidOptions = { generate: isSsr ? 'ssr' : 'dom', hydratable: false };\n  } else if (options.ssr) {\n    if (isSsr) {\n      solidOptions = { generate: 'ssr', hydratable: true };\n    } else {\n      solidOptions = { generate: 'dom', hydratable: true };\n    }\n  } else {\n    // A client-rendered app can still load modules on the server, for\n    // example to prerender static pages with `ssrLoadModule`. DOM output\n    // cannot run there, so server transforms use the SSR generate. Nothing\n    // hydrates the result, so it stays non-hydratable.\n    solidOptions = { generate: isSsr ? 'ssr' : 'dom', hydratable: false };\n  }\n\n  // Server components (serverFunctions.components) turn on the SSR-side\n  // attribute-slot transform: ref/on* positions on intrinsic elements\n  // compile to one guarded `ssrClaim` hole per element instead of dropping\n  // (the runtime marks them `_s:on:<event>` / `_s:ref` for the client\n  // frame's slot reads), a dynamic `class`/`style` compiles to a\n  // whole-attribute `ssrElementAttribute` hole so a client attribute slot\n  // can own it, and a spread element's named ref/on* ride `ssrElement`'s\n  // trailing `claims` thunk. That is the 2.0.0-rc.13 compiler ↔ runtime\n  // contract (the earlier `_bnd` marker is gone; rc.12 was never\n  // published), which is why the compiler and runtime floors move\n  // together. SSR-only by construction (the dom generate ignores the\n  // flag), and apps without the flag compile byte-for-byte as before.\n  const serverComponents =\n    typeof options.serverFunctions === 'object' && !!options.serverFunctions.components;\n\n  // Solid-specific defaults (moduleName \"@solidjs/web\", the control-flow\n  // builtIns, contextToCustomElements, wrapConditionals) are baked into both\n  // backends — @solidjs/compiler and @solidjs/babel-plugin — so only the\n  // posture this plugin actually decides is passed.\n  // Source names: the dev and observe runtimes label each component's owner\n  // (`<Home>`) and each compiled binding effect (`span.textContent`) for\n  // diagnostics and attribution paths. Without the compiler carrying the\n  // source names, a minified build labels owners by whatever the minifier\n  // left of `Comp.name` and bindings as `effect`. Both generates emit the\n  // component name — the ssr generate from the compilers that carry\n  // solidjs/solid#3441 (2.0.0-rc.9), so server findings and boundary\n  // records locate by component too — and the production runtime ignores\n  // the arguments, so they are only emitted for the postures whose runtime\n  // reads them. Primitive names are the separate transformSourceNames pass\n  // (see getSourceNames / the transform hook), not a JSX-compiler option.\n  //\n  // The compilers default their own `sourceNames` on under `dev` (rc.10), so\n  // the resolved value is always passed — `false` when both kinds are off —\n  // and the plugin's table (getSourceNames), not the compiler default,\n  // decides. That is what makes `solid.sourceNames: false` an opt-out in dev\n  // rather than a no-op. `locations` rides inside the same object, with\n  // `root` (the Vite root the paths are relative to) beside it, on a\n  // compiler that takes them: see getJsxSourceNamesOptions.\n  const { sourceNames: _userSourceNames, ...userSolidOptions } = options.solid || {};\n  const names = getSourceNames(options.solid?.sourceNames, dev, observe);\n  return {\n    ...solidOptions,\n    ...(serverComponents && solidOptions.generate === 'ssr' ? { serverComponents: true } : {}),\n    dev,\n    ...getJsxSourceNamesOptions(names, locationTarget(jsxCompiler, root)),\n    ...userSolidOptions,\n  };\n}\n\n/**\n * What a compiler can do with locations: the babel plugin ignores keys it\n * does not know, so it always takes them; the native compiler answers\n * through its load-time probe.\n */\nfunction locationTarget(compiler: Compiler, root: string): LocationTarget {\n  return { supportsLocations: compiler === 'babel' || nativeLocations, root };\n}\n\n/**\n * Script modules the JSX gate returns early for: `.ts`/`.js` and the `m`/`c`\n * variants. Primitive naming applies here (plain JavaScript in and out; a\n * `.d.ts` has nothing to name), and so does the lazy module-URL pipeline —\n * a `routes.ts` is not JSX, but its `lazy()` callsites and an SSR module's\n * `$$moduleUrl` export still have to be written. Refresh and the JSX\n * transform stay on the JSX path.\n */\nconst PRIMITIVES_ONLY_MODULE = /\\.[mc]?[jt]s$/i;\nconst DECLARATION_MODULE = /\\.d\\.[mc]?ts$/i;\n// transformLazy only rewrites `lazy` from `solid-js` and fails on CommonJS it can't parse as ESM.\nconst mayCallLazy = (code: string) => code.includes('lazy') && code.includes('solid-js');\n/**\n * Cheap pre-check ahead of the native call: the pass only names calls that\n * resolve to imports from these modules, so source without either string\n * cannot change.\n */\nconst PRIMITIVE_SOURCES = ['solid-js', '@solidjs/signals'];\n\nlet warnedMissingSourceNamesPass = false;\nlet warnedMissingLocations = false;\n\n/**\n * Warn once when the user asked for `locations` in so many words and the\n * native compiler predates the kind — the dev default stays silent, like\n * every other default-on nicety an older compiler cannot provide. Call\n * after `loadNativeCompiler()` resolved (the probe sets `nativeLocations`).\n */\nfunction warnMissingLocations(ctx: { warn(message: string): void }, options: Partial<Options>) {\n  if (nativeLocations || warnedMissingLocations) return;\n  if (!requestedLocations(options.solid?.sourceNames)) return;\n  warnedMissingLocations = true;\n  ctx.warn(\n    '@solidjs/vite-plugin: the installed @solidjs/compiler does not take the `locations` ' +\n      'source-names kind, so `solid.sourceNames.locations` is ignored and diagnostics ' +\n      'carry no file:line:col. Update @solidjs/compiler.',\n  );\n}\n\n/**\n * Run the compiler's `transformSourceNames` pass, or leave the code alone\n * (warning once) on a compiler predating it — the pass is a default-on\n * nicety for dev/observe, not something to fail a build over. `names` is\n * the resolved `solid.sourceNames` (its `locations` flag goes to the pass)\n * and `root` the Vite root locations are made relative to.\n */\nasync function transformPrimitiveNames(\n  ctx: { warn(message: string): void },\n  compiler: NativeCompiler,\n  code: string,\n  filename: string,\n  names: ResolvedSourceNames,\n  root: string,\n): Promise<{ code: string; map: ChainableMap } | null> {\n  if (!PRIMITIVE_SOURCES.some((source) => code.includes(source))) return null;\n  if (typeof compiler.transformSourceNamesAsync !== 'function') {\n    if (!warnedMissingSourceNamesPass) {\n      warnedMissingSourceNamesPass = true;\n      ctx.warn(\n        '@solidjs/vite-plugin: the installed @solidjs/compiler has no transformSourceNames ' +\n          'pass, so primitives keep their generic labels (`signal`, `computed`) in ' +\n          'diagnostics. Update @solidjs/compiler, or set `solid.sourceNames.primitives: false`.',\n      );\n    }\n    return null;\n  }\n  const result = await compiler.transformSourceNamesAsync(\n    code,\n    getPrimitiveNamesOptions(names, locationTarget('native', root), filename),\n  );\n  // Nothing to name: the pass hands the source back verbatim, with no map.\n  if (result.code === code) return null;\n  return { code: result.code, map: result.map };\n}\n\nasync function getBabelUserOptions(\n  options: Partial<Options>,\n  source: string,\n  id: string,\n  isSsr: boolean,\n) {\n  if (!options.babel) return {};\n  if (typeof options.babel !== 'function') return options.babel;\n\n  const babelOptions = options.babel(source, id, isSsr);\n  return babelOptions instanceof Promise ? await babelOptions : babelOptions;\n}\n\nfunction normalizeSourceMap(\n  map: string | babel.TransformOptions['inputSourceMap'] | null | undefined,\n) {\n  if (typeof map === 'string') return JSON.parse(map);\n  return map || null;\n}\n\ntype ChainableMap = string | babel.TransformOptions['inputSourceMap'] | null | undefined;\n\n/**\n * Merges the sourcemaps of sequential whole-file transforms (given in\n * application order, earliest first) into one map tracing back to the\n * original source.\n */\nfunction combineSourcemaps(maps: ChainableMap[]) {\n  const chain = maps.filter((map): map is NonNullable<ChainableMap> => !!map);\n  if (chain.length === 0) return null;\n  if (chain.length === 1) return normalizeSourceMap(chain[0]);\n  // remapping expects most-recent-first.\n  return JSON.parse(remapping(chain.reverse() as any, () => null).toString());\n}\n\nfunction toPosixPath(p: string): string {\n  return p.split(path.sep).join('/');\n}\n\nfunction tryRealpath(p: string): string | null {\n  try {\n    return realpathSync.native(p);\n  } catch {\n    return null;\n  }\n}\n\n/** The `input` a build environment's config resolves to, in any spelling. */\nfunction configuredBuildInput(build: any): unknown {\n  if (!build) return undefined;\n  return build.rolldownOptions?.input ?? build.rollupOptions?.input ?? build.lib?.entry;\n}\n\n/**\n * The genuine entries of a client build, derived from its configured input\n * (`build.rollupOptions.input` as a string / array / record, or Vite's\n * default `index.html`). Rollup and rolldown only ever flag two kinds of\n * chunk `isEntry`: those facades and chunks plugins emit with\n * `emitFile({ type: 'chunk' })` — so this is exactly the knowledge that\n * tells a real application entry apart from an emitted lazy facade.\n *\n * `moduleIds` — every spelling the entry's facade module id can take: as\n * written (virtual ids resolve to themselves), resolved against the root\n * (Vite resolves relative file inputs there), and the real path of either\n * (Vite's resolver follows symlinks).\n * `manifestKeys` — the manifest.json keys Vite derives from those facades\n * (root-relative, `\\0` stripped), matching Vite's own `getChunkName`.\n */\nfunction resolveConfiguredEntries(input: unknown, root: string) {\n  const raw: string[] =\n    input == null\n      ? ['index.html']\n      : typeof input === 'string'\n        ? [input]\n        : Array.isArray(input)\n          ? input\n          : Object.values(input as Record<string, unknown>);\n  const moduleIds = new Set<string>();\n  for (const id of raw) {\n    if (typeof id !== 'string') continue;\n    const clean = id.replace(/\\0/g, '');\n    const candidates = [clean, path.resolve(root, clean)];\n    for (const candidate of candidates) {\n      moduleIds.add(candidate);\n      moduleIds.add(toPosixPath(candidate));\n      const real = tryRealpath(candidate);\n      if (real) {\n        moduleIds.add(real);\n        moduleIds.add(toPosixPath(real));\n      }\n    }\n  }\n  const manifestKeys = new Set<string>();\n  for (const id of moduleIds) manifestKeys.add(toPosixPath(path.relative(root, id)));\n  return {\n    moduleIds,\n    manifestKeys,\n    isEntryModule(id: string | null | undefined): boolean {\n      if (!id) return false;\n      const clean = id.replace(/\\0/g, '');\n      if (moduleIds.has(clean) || moduleIds.has(toPosixPath(clean))) return true;\n      const real = tryRealpath(clean);\n      return !!real && (moduleIds.has(real) || moduleIds.has(toPosixPath(real)));\n    },\n  };\n}\n\ninterface NormalizeLazyEntriesOptions {\n  /**\n   * Is this record a genuine configured entry? Such records keep `isEntry`\n   * no matter what dynamically imports them.\n   */\n  isConfiguredEntry: (key: string, record: any) => boolean;\n  /**\n   * Records already known to be emitted lazy facades (reclassified\n   * explicitly by their emit references); everything else the sweep strips\n   * is reported through `warn` because it could be an entry the input\n   * matching missed.\n   */\n  knownLazyKeys?: Set<string>;\n  warn?: (message: string) => void;\n  /**\n   * Also flag dynamic-import targets that already lost `isEntry` as\n   * `isDynamicEntry` — repairs the flag rolldown drops (see below) on the\n   * serialized manifest.\n   */\n  repairDynamicEntries?: boolean;\n}\n\n/**\n * Chunks emitted for lazy() targets are marked `isEntry` by Rollup even\n * though they are semantically dynamic entries. Reclassify any entry that is\n * dynamically imported by another chunk so the runtime's entry-asset\n * detection (which keys off `isEntry`) can't pick a lazy facade instead of\n * the real client entry. Works on both the Vite manifest.json shape and the\n * raw Rollup output bundle — both key entries by name and expose\n * `dynamicImports` / `isEntry` with the same meaning.\n *\n * Being a dynamic-import target alone does not make a chunk a lazy facade,\n * though: the real client entry becomes one whenever it absorbs a module\n * that is also dynamically imported somewhere else. Solid 2 produces that\n * shape on its own — `@solidjs/web/frames/client` lazily imports the\n * serialization decoder (`loadCodec()`), so a static import of\n * `@solidjs/web/serialization/decode` anywhere in the client graph merges\n * the decoder into the entry chunk, and the entry then lists itself (or is\n * listed by another lazy chunk) under `dynamicImports`. Stripping `isEntry`\n * there leaves the bundle with no entry at all (\"No entry file found\"\n * downstream, e.g. TanStack Start's manifest capture, #342). Genuine\n * configured entries are therefore never reclassified, and a chunk's\n * dynamic import of itself is not an edge worth acting on.\n *\n * Rolldown caveat: of the flags written here only `isEntry` is synced back\n * to the native bundle after the hook (rolldown's `update_output_chunk`\n * copies `code`, `map`, `imports`, `dynamicImports`, `isEntry` and the file\n * name; `isDynamicEntry` is kept from the original chunk). Later plugins\n * and Vite's manifest plugin therefore see reclassified facades as neither\n * entry nor dynamic entry under rolldown. The manifest `load` path repairs\n * `isDynamicEntry` on the plugin's own manifest module, the one place it\n * controls end to end.\n */\nfunction normalizeEmittedLazyEntries(\n  manifest: Record<string, any>,\n  { isConfiguredEntry, knownLazyKeys, warn, repairDynamicEntries }: NormalizeLazyEntriesOptions,\n) {\n  const dynamicKeys = new Map<string, string>();\n  for (const key in manifest) {\n    const imports: string[] | undefined = manifest[key].dynamicImports;\n    if (!imports) continue;\n    for (const dep of imports) {\n      // A chunk that absorbed one of its own lazy targets imports itself;\n      // that says nothing about whether it is an entry.\n      if (dep !== key && !dynamicKeys.has(dep)) dynamicKeys.set(dep, key);\n    }\n  }\n  for (const [key, importer] of dynamicKeys) {\n    const entry = manifest[key];\n    if (!entry || entry.type === 'asset') continue;\n    if (isConfiguredEntry(key, entry)) continue;\n    if (entry.isEntry) {\n      entry.isEntry = false;\n      entry.isDynamicEntry = true;\n      if (warn && !knownLazyKeys?.has(key)) {\n        warn(\n          `[@solidjs/vite-plugin] Reclassified the entry chunk \"${key}\" as a dynamic entry ` +\n            `because \"${importer}\" dynamically imports it and it does not match a configured ` +\n            `build input. If \"${key}\" is the application entry, its chunk absorbed a module ` +\n            'that is also imported dynamically elsewhere (for example a static import of ' +\n            '\"@solidjs/web/serialization/decode\" alongside Solid\\'s own lazy import of it); ' +\n            'list the entry in `build.rollupOptions.input` so the plugin can recognize it.',\n        );\n      }\n    } else if (repairDynamicEntries && !entry.isDynamicEntry) {\n      entry.isDynamicEntry = true;\n    }\n  }\n}\n\n/**\n * The manifest key of THE client entry — the chunk whose `<script\n * type=\"module\">` boots the page and whose static import graph carries the\n * global CSS. `isEntry` cannot answer this: every configured build input is\n * a genuine entry (#347 keeps them flagged), and plugins routinely add more\n * inputs than the application entry (filesystem-routing's `buildInputs`\n * lists every route module, and route keys sort ahead of the plugin's own\n * `virtual:` entry). So the identity comes from configuration instead: the\n * entry start mode injected itself, or — outside start mode — the single\n * configured input when there is exactly one (including Vite's default\n * `index.html`). Several inputs and no start entry: no answer (null), and\n * consumers keep their first-`isEntry` scan.\n *\n * Matched by key or `src`, the same two spellings `isConfiguredEntry` uses.\n */\nfunction resolveClientEntryKey(\n  manifest: Record<string, any>,\n  startClientEntryId: string | null,\n  clientBuild: any,\n  root: string,\n): string | null {\n  let entryId: string | null = startClientEntryId;\n  if (!entryId) {\n    const input = configuredBuildInput(clientBuild);\n    const raw =\n      input == null\n        ? ['index.html']\n        : typeof input === 'string'\n          ? [input]\n          : Array.isArray(input)\n            ? input\n            : Object.values(input as Record<string, unknown>);\n    if (raw.length !== 1 || typeof raw[0] !== 'string') return null;\n    entryId = raw[0];\n  }\n  const { manifestKeys } = resolveConfiguredEntries(entryId, root);\n  for (const key in manifest) {\n    const record = manifest[key];\n    if (!record || typeof record !== 'object' || !record.file) continue;\n    if (manifestKeys.has(key) || (typeof record.src === 'string' && manifestKeys.has(record.src))) {\n      return key;\n    }\n  }\n  return null;\n}\n\n/**\n * Serializes the plugin's manifest module with the client entry made\n * explicit: `_entry` names its key (the generated handler reads it before\n * falling back to scanning for `isEntry`), and its record is moved to the\n * front. The ordering matters for consumers that still identify the entry\n * by the first `isEntry` record — `@solidjs/web`'s `registerEntryAssets`,\n * which links the entry graph's stylesheets and modulepreloads into\n * `<head>`, and hand-rolled server entries — so they and `_entry` agree on\n * the same chunk. Other configured inputs keep `isEntry`; they are genuine\n * entries, just not the one the document boots.\n */\nfunction stampClientEntry(\n  manifest: Record<string, any>,\n  entryKey: string | null,\n  base: string,\n): Record<string, any> {\n  const ordered: Record<string, any> = {};\n  if (entryKey && manifest[entryKey]) {\n    ordered[entryKey] = manifest[entryKey];\n  }\n  for (const key in manifest) {\n    if (key !== entryKey) ordered[key] = manifest[key];\n  }\n  ordered._base = base;\n  if (entryKey && manifest[entryKey]) ordered._entry = entryKey;\n  return ordered;\n}\n\n// The bundler's default `output.sanitizeFileName`: characters outside the\n// URL-safe set become `_`, except the `:` of a leading Windows drive letter.\n// Rolldown ports Rollup's rule natively and exports no JS copy, so a\n// sanitizer that runs the default first has to restate it. Keep in step with\n// rollup/src/utils/sanitizeFileName.ts and\n// rolldown/crates/rolldown_utils/src/sanitize_filename.rs.\nconst INVALID_FILE_NAME_CHARS = /[\\u0000-\\u001F\"#$%&*+,:;<=>?[\\]^`{|}\\u007F]/g;\nconst WINDOWS_DRIVE_LETTER = /^[a-z]:/i;\n\nfunction defaultSanitizeFileName(name: string): string {\n  const driveLetter = WINDOWS_DRIVE_LETTER.exec(name)?.[0] ?? '';\n  return driveLetter + name.slice(driveLetter.length).replace(INVALID_FILE_NAME_CHARS, '_');\n}\n\n/**\n * The build's `output.sanitizeFileName`: the user's sanitizer, or the default\n * when none is set, then every run of dots collapsed to one. Chunk and asset\n * names come from file names, and the default only swaps the brackets of a\n * catch-all route module: `[...404].tsx` built to `_...404_-<hash>.js`, plus a\n * CSS asset Vite names after that chunk. Hosts, CDNs and middleware whose\n * traversal guard rejects any URL containing `..` refused the lazy route's\n * chunk, and its hydration broke (#391). A run collapses to a single dot\n * instead of being dropped because the bundler splits `[name]` and\n * `[extname]` off the sanitized name: an asset whose own name has dots\n * against its extension (`logo..png`) would otherwise lose it and build to\n * `logopng-<hash>.`. Only the last path segment is touched: with\n * `preserveModules` the name carries the module's directories, and changing a\n * directory such as `my..lib` makes the bundler reject the name.\n */\nfunction collapseDotRuns(\n  sanitizeFileName: true | ((name: string) => string) | undefined,\n): (name: string) => string {\n  const sanitize =\n    typeof sanitizeFileName === 'function' ? sanitizeFileName : defaultSanitizeFileName;\n  return (name) => {\n    const sanitized = sanitize(name);\n    const base = Math.max(sanitized.lastIndexOf('/'), sanitized.lastIndexOf('\\\\')) + 1;\n    return sanitized.slice(0, base) + sanitized.slice(base).replace(/\\.{2,}/g, '.');\n  };\n}\n\n/**\n * Build-time flag libraries use to drop server-component-only client code\n * (#396). Always defined (`\"true\"` or `\"false\"`): an absent identifier cannot\n * be eliminated. `\"true\"` when `serverFunctions.components` is set, including\n * `'external'`. A user-provided `define` value wins.\n */\nconst SERVER_COMPONENTS_DEFINE = '__SOLID_SERVER_COMPONENTS__';\n\n/**\n * `.rx` out of the box: ReactiveScript's front end, the default export of\n * `@reactivescript/compiler/vite`, resolved from the project root the first\n * time an `.rx` module is compiled. A project without `.rx` files never loads\n * it.\n */\nfunction lazyFrontend(pkg: string, extension: string): Frontend {\n  let loaded: Promise<Frontend> | undefined;\n  return {\n    async compile(source, context) {\n      loaded ??= (async () => {\n        let entry: string;\n        try {\n          entry = createRequire(path.join(context.root, 'package.json')).resolve(`${pkg}/vite`);\n        } catch {\n          throw new Error(\n            `[@solidjs/vite-plugin] compiling ${extension} needs the \\`${pkg}\\` package: install it in the project.`,\n          );\n        }\n        const mod = await import(pathToFileURL(entry).href);\n        return (mod.default ?? mod)() as Frontend;\n      })();\n      // a failed load is retried, so installing the package fixes a running server\n      const frontend = await loaded.catch((error) => {\n        loaded = undefined;\n        throw error;\n      });\n      return frontend.compile(source, context);\n    },\n  };\n}\n\nexport default function solidPlugin(options: Partial<Options> = {}): Plugin[] {\n  if (typeof options.ssr === 'object') {\n    throw new Error(\n      '[@solidjs/vite-plugin] `ssr` now only accepts a boolean (\"is the app server-rendered\"); ' +\n        'move start-mode options to `start: {}` and set `ssr: true`. Example: ' +\n        '`solid({ ssr: { document: … } })` becomes `solid({ start: { document: … }, ssr: true })`.',\n    );\n  }\n  // Removed before the stable release, without aliases: name the\n  // replacement instead of silently ignoring the old key.\n  if ('hot' in options) {\n    throw new Error(\n      '[@solidjs/vite-plugin] `hot` has been removed. HMR is on by default; ' +\n        'disable it with `refresh: false`.',\n    );\n  }\n  if (options.refresh && typeof options.refresh === 'object' && 'disabled' in options.refresh) {\n    throw new Error(\n      '[@solidjs/vite-plugin] `refresh.disabled` has been replaced by `refresh: false`.',\n    );\n  }\n  const refreshOptions: RefreshOptions =\n    typeof options.refresh === 'object' ? options.refresh : {};\n  // Recreated in configResolved: relative include/exclude patterns must\n  // resolve against the Vite root, not process.cwd() — running `vite` from\n  // outside the project would otherwise change what the filter matches.\n  let filter = createFilter(options.include, options.exclude);\n  const frontends = Object.entries({\n    '.rx': lazyFrontend('@reactivescript/compiler', '.rx'),\n    ...options.frontends,\n  }).map(([extension, frontend]) => {\n    if (!/^\\.[\\w.-]+$/.test(extension) || /^\\.(?:[mc]?[jt]sx?|tsrx)$/i.test(extension)) {\n      throw new Error(\n        `[@solidjs/vite-plugin] \\`frontends\\` takes file extensions other than Solid's own, such as \".rx\"; got ${JSON.stringify(extension)}.`,\n      );\n    }\n    return [extension.toLowerCase(), frontend] as const;\n  });\n  const frontendFor = (id: string): Frontend | undefined => {\n    if (frontends.length === 0) return undefined;\n    const path = cleanModuleId(id).toLowerCase();\n    return frontends.find(([extension]) => path.endsWith(extension))?.[1];\n  };\n  // A module that reaches Solid's pipeline already lowered: `.tsrx` (lowered\n  // here, first) or another front end's.\n  const isLoweredModule = (id: string) => isTsrxModule(id) || !!frontendFor(id);\n  const scanExtensions = ['.tsrx', ...frontends.map(([extension]) => extension)];\n  // The main transform's hook filter (src/hook-filters.ts): scripts,\n  // `.tsrx`, other front ends' and registered extensions.\n  const registeredExtensions = (options.extensions || []).map((extension) =>\n    typeof extension === 'string' ? extension : extension[0],\n  );\n  const solidModuleIds = [\n    /\\.[mc]?[jt]sx?(?:$|\\?)/i,\n    extensionIds([...scanExtensions, ...registeredExtensions]),\n  ];\n  const serverComponentsOption =\n    typeof options.serverFunctions === 'object' ? options.serverFunctions.components : undefined;\n  const serverComponents = !!serverComponentsOption;\n  // Replaced in `config` when the user already defined the flag. Read by\n  // `configEnvironment`, which runs after `config` resolves.\n  let serverComponentsDefine = JSON.stringify(serverComponents);\n  // The client runtime compiled server-function references import (the\n  // server-functions plugin's own default unless `runtime` is set), kept only\n  // when it names a package. A relative path or an alias is app source: the\n  // optimizer would bundle a copy nothing loads or, for `@/x`, serve that copy\n  // so edits stop showing up. A virtual id or `/src/x` doesn't resolve for\n  // `include` and only warns.\n  const serverFunctionsClientRuntime = options.serverFunctions\n    ? typeof options.serverFunctions === 'object' && options.serverFunctions.runtime\n      ? options.serverFunctions.runtime.client\n      : '@solidjs/web/server-functions'\n    : undefined;\n  const serverFunctionsClientDep =\n    serverFunctionsClientRuntime && isPackageSpecifier(serverFunctionsClientRuntime)\n      ? serverFunctionsClientRuntime\n      : undefined;\n  // `start: true` is sugar for the empty options bag — one start mode,\n  // two spellings — so normalize here and let everything downstream see a\n  // single shape (`false` behaves exactly like omission).\n  // The diagnostics channels exist only in Solid's dev and observe builds.\n  const diagnosticsEnabled =\n    options.diagnostics !== false && (options.dev !== false || options.observe === true);\n  const startOptions: StartOptions | null =\n    options.start === true ? {} : options.start || null;\n  if (startOptions && 'css' in startOptions) {\n    // Moved before the stable release, without an alias.\n    throw new Error(\n      '[@solidjs/vite-plugin] `start.css` has moved to the top-level `css` option. ' +\n        'Example: `solid({ start: { css: { devInline } } })` becomes ' +\n        '`solid({ start: true, css: { devInline } })`.',\n    );\n  }\n  if (startOptions && 'external' in startOptions) {\n    // Renamed before the stable release, without an alias.\n    throw new Error(\n      '[@solidjs/vite-plugin] `start.external` has been renamed to `start.externalServer`.',\n    );\n  }\n  if (startOptions && 'setup' in startOptions) {\n    // Renamed before the stable release, without an alias.\n    throw new Error(\n      '[@solidjs/vite-plugin] `start.setup` has been renamed to `start.serverRenderSetup`.',\n    );\n  }\n  if (startOptions && 'instrument' in startOptions) {\n    // Renamed before the stable release, without an alias.\n    throw new Error(\n      '[@solidjs/vite-plugin] `start.instrument` has been renamed to `start.serverSetup`.',\n    );\n  }\n  if (startOptions && 'node' in startOptions) {\n    // Renamed before the stable release, without an alias.\n    throw new Error(\n      '[@solidjs/vite-plugin] `start.node` has been renamed to `start.nodeServer`.',\n    );\n  }\n  if (options.css && 'filter' in options.css) {\n    // Renamed before the stable release, without an alias.\n    throw new Error('[@solidjs/vite-plugin] `css.filter` has been renamed to `css.devInline`.');\n  }\n  const styleFilterOptions = options.css?.devInline;\n  // The CSS crawl walks the module graph from the app's own entries, so a\n  // plain createFilter allowlist can't express the option's purpose (opting\n  // node_modules graphs in): a bare `include` would reject the app sources\n  // the crawl has to traverse to ever reach the included package. Instead\n  // `include` rescues files on top of the baseline (everything except\n  // `exclude`, which defaults to node_modules), while a file matching both\n  // patterns stays excluded — createFilter's own conflict rule.\n  const createStyleFilter = (resolve?: string) => {\n    const opts = resolve === undefined ? undefined : { resolve };\n    const base = createFilter(\n      undefined,\n      styleFilterOptions?.exclude ?? DEFAULT_STYLE_EXCLUDE,\n      opts,\n    );\n    const include = styleFilterOptions?.include;\n    const hasInclude = include != null && (!Array.isArray(include) || include.length > 0);\n    const included = hasInclude ? createFilter(include, styleFilterOptions?.exclude, opts) : null;\n    return (id: string) => base(id) || (included ? included(id) : false);\n  };\n  let styleFilter = createStyleFilter();\n  const filterDevStyles = (id: string) => styleFilter(id);\n  // `start.externalServer` only means something when a server side exists to hand\n  // over (SSR start mode); in client mode it is a documented no-op.\n  const externalDevServer = !!options.ssr && !!startOptions?.externalServer;\n  // Chrome Performance panel tracks: `null` opts out, otherwise the options\n  // the injected module enables them with (dev serve only; see the\n  // `solid:performance-tracks` plugin and the start-mode entry codegen).\n  const performanceTracksOptions = resolvePerformanceTracksOptions(options.performanceTracks);\n\n  let needHmr = false;\n  let replaceDev = false;\n  let forceProduction = false;\n  let observe = false;\n  // Resolved absolute path of the start-mode document shell (normalized to\n  // forward slashes, matching Vite ids), reported back by the start plugin's\n  // config hook. The document is the one module whose client compile must\n  // decline HMR instead of taking a refresh boundary: it hydrates the whole\n  // `document`, and no component swap can re-claim `document.documentElement`\n  // — an accepted update would be absorbed with nothing visibly changing\n  // (solidjs/solid#3151). Declining makes a save invalidate the module, so\n  // Vite falls back to a full page reload: the honest cost.\n  let documentModuleId: string | null = null;\n  // The live dev server, kept so the dev manifest module can bake the bridge\n  // endpoint URL in when its code is generated (see devManifestBridgeUrl).\n  let devServer: ViteDevServer | null = null;\n  let devAssetResolver: ReturnType<typeof createDevAssetResolver> | undefined;\n  let projectRoot = process.cwd();\n  let isTestMode = false;\n  let serverTestPosture = false;\n  // True when a jsdom or happy-dom test run inlines the Solid runtime. The\n  // `ssr` environment then does not get the `browser` condition (see\n  // `configEnvironment`).\n  let domTestRuntimeInlined = false;\n\n  // Lets the dependency scanner crawl `.tsrx` imports. Registered on every\n  // environment's `optimizeDeps` (top-level for client, configEnvironment\n  // for the rest).\n  const tsrxDepScanPlugin = {\n    name: 'solid:tsrx-dep-scan',\n    async transform(source: string, id: string) {\n      if (!isLoweredModule(id) || isTsrxCssModule(id)) return null;\n      const compiler = await loadNativeCompiler();\n      const frontend = frontendFor(id);\n      if (frontend) {\n        const result = await frontend.compile(source, {\n          id: cleanModuleId(id),\n          moduleId: id,\n          ssr: false,\n          root: projectRoot,\n          solid: getSolidOptions(\n            options,\n            false,\n            replaceDev,\n            observe,\n            isTestMode,\n            'native',\n            projectRoot,\n          ),\n          addWatchFile: () => {},\n        });\n        return result ? { code: result.code, map: null } : null;\n      }\n      const result = await compiler.transformAsync(source, {\n        ...getSolidOptions(options, false, replaceDev, observe, isTestMode, 'native', projectRoot),\n        filename: cleanModuleId(id),\n        sourceMap: false,\n      });\n      const stripped = await transformWithOxc(result.code, cleanModuleId(id) + '.tsx', {\n        lang: 'tsx',\n        sourcemap: false,\n        target: 'esnext',\n      });\n      return { code: stripped.code, map: null };\n    },\n  };\n  withFilter(tsrxDepScanPlugin, {\n    transform: { id: { include: extensionIds(scanExtensions), exclude: TSRX_CSS_IDS } },\n  });\n  let isBuild = false;\n  let isSsrBuild = false;\n  let base = '/';\n  let publicDir = '';\n  // CSS module class names inlined in builds (src/css-module-classes.ts).\n  const cssModuleClasses = createCssModuleClasses();\n  let renderBuiltUrl = false;\n  let logger: Logger | null = null;\n  // Set in configResolved when a worker-targeted server build would carry\n  // the plugin's `@solidjs/web/storage` import; emitted once from buildStart.\n  let workerTargetWarning = false;\n  // The client environment's resolved build options, for the configured\n  // entry input. Read off the resolved config so the SSR half of a\n  // two-invocation build (`vite build --ssr`) still knows the client's\n  // entries when it bakes the client manifest in.\n  let clientBuildConfig: any = null;\n  // Set when the config has a `builder`: one resolve configures every environment.\n  let isAppBuild = false;\n  // The client entry start mode injects into the client build's input\n  // (reported by startServe): the one input that IS the application entry,\n  // as opposed to further inputs other plugins add (e.g. filesystem-routing's\n  // `buildInputs`, which lists every route module). Null outside start mode.\n  let startClientEntryId: string | null = null;\n  let solidPkgsConfig: Awaited<ReturnType<typeof crawlFrameworkPkgs>>;\n  // Names of the packages `isSemiFrameworkPkgByJson` classified, so their\n  // dependencies can be taken back out of `optimizeDeps.include` (see below).\n  const semiFrameworkPkgs = new Set<string>();\n  // Packages that import the Solid runtime without a `solid` export\n  // condition, found by the same crawl in the vitest client posture. They are\n  // inlined there with the runtime (see `test.server.deps` below).\n  const testRuntimeConsumers = new Set<string>();\n  const tsrxCss = new Map<string, string>();\n\n  // The client build's manifest, read back by SSR builds. In builder mode\n  // (one process, e.g. nitro) the client build runs first and its\n  // writeBundle keeps the manifest in memory, along with the file it wrote.\n  // Two-invocation builds (`vite build --outDir dist/client` then\n  // `vite build --ssr`) run in separate processes, so the SSR process reads\n  // the file from the `dist/client` convention. An app build whose builder\n  // gives each environment its own plugin instance (#525) reads it from the\n  // client environment's configured outDir first.\n  let clientManifest: { source: string; file: string } | null = null;\n  // Server environments that read `clientManifest`. Once one has written its\n  // bundle, the file leaves the client output when start mode turned the\n  // manifest on (see onClientManifestOwned): hosts may publish that output.\n  const clientManifestReaders = new Set<string>();\n  let ownsClientManifest = false;\n  function clientManifestPath(): string | null {\n    const setting = clientBuildConfig?.manifest;\n    const fileName = typeof setting === 'string' ? setting : '.vite/manifest.json';\n    for (const dir of [isAppBuild && clientBuildConfig?.outDir, 'dist/client']) {\n      if (!dir) continue;\n      const manifestPath = path.resolve(projectRoot, dir, fileName);\n      if (existsSync(manifestPath)) return manifestPath;\n    }\n    return null;\n  }\n\n  // Asset URLs in JSX (src/asset-urls.ts): a `/name` public-directory URL\n  // takes the base. With a relative base (builds only) or a custom\n  // `renderBuiltUrl`, only Vite's asset plugin can compute the URL, so it is\n  // imported instead.\n  function assetUrlOptions(): AssetUrlOptions {\n    const relativeBase = base === '' || base.startsWith('.');\n    return {\n      publicDir,\n      publicUrls:\n        isBuild && (relativeBase || renderBuiltUrl) ? 'import' : base === '/' ? null : { base },\n    };\n  }\n\n  // Dynamically imported project modules in the client build. Each is\n  // emitted as an explicit chunk so it always gets its own manifest entry\n  // keyed by source path — even when manualChunks or dual static/dynamic\n  // imports would otherwise fold it facade-less into a shared chunk (which\n  // would break resolveAssets lookups and hydration module preloading).\n  // Driven from moduleParsed so it covers every lazy() target, including\n  // import.meta.glob entries that never pass through the moduleUrl transform.\n  const emittedLazyChunks = new Set<string>();\n  // Keep the emitted references because a lazy module's importer may be\n  // removed from the final bundle, leaving no dynamic-import edge to identify\n  // its facade chunk during generateBundle.\n  const emittedLazyChunkRefs: string[] = [];\n\n  // Whether the current hook invocation belongs to a client (browser) build.\n  // Builder-mode builds (e.g. SolidStart's nitro plugin) run the client and\n  // ssr environments through one Vite process with shared plugins, so the\n  // process-wide isSsrBuild flag from configResolved can't tell them apart —\n  // the per-environment consumer can. Classic two-invocation builds\n  // (`vite build` / `vite build --ssr`) fall back to the flag.\n  function isClientBuild(ctx: { environment?: { config?: { consumer?: string } } }): boolean {\n    const consumer = ctx.environment?.config?.consumer;\n    if (consumer) return consumer === 'client';\n    return !isSsrBuild;\n  }\n\n  /**\n   * Replaces lazy() moduleUrl placeholders injected by the babel plugin with\n   * project-relative module paths resolved through Vite's resolver.\n   */\n  async function resolveLazyModuleUrls(ctx: any, code: string, importer: string): Promise<string> {\n    const placeholderRe = new RegExp('\"' + LAZY_PLACEHOLDER_PREFIX + '([^\"]+)\"', 'g');\n    let match;\n    const resolutions: Array<{ placeholder: string; resolved: string }> = [];\n    while ((match = placeholderRe.exec(code)) !== null) {\n      const specifier = match[1];\n      const resolved = await ctx.resolve(specifier, importer);\n      if (resolved) {\n        // The query is part of the module identity: Rollup keys the facade\n        // chunk (and thus the Vite manifest entry) by the queried module id,\n        // and in dev the queried URL can serve different plugin output than\n        // the bare one — stripping it here would break both lookups.\n        const queryIndex = resolved.id.indexOf('?');\n        const file = queryIndex === -1 ? resolved.id : resolved.id.slice(0, queryIndex);\n        const query = queryIndex === -1 ? '' : resolved.id.slice(queryIndex);\n        const relativeId = path.relative(projectRoot, file).split(path.sep).join('/') + query;\n        resolutions.push({\n          placeholder: match[0],\n          resolved: '\"' + relativeId + '\"',\n        });\n      }\n    }\n    for (const { placeholder, resolved } of resolutions) {\n      code = code.replace(placeholder, resolved);\n    }\n    return code;\n  }\n\n  /**\n   * SSR transforms append a `$$moduleUrl` export carrying the module's\n   * client-manifest key (project-relative source path, module query\n   * included — a queried module is its own identity, with its own facade\n   * chunk and manifest entry). Server-side `lazy()` reads it off the\n   * resolved module when the callsite has no static import specifier to\n   * transform — e.g. `lazy` over an `import.meta.glob` entry — so asset\n   * resolution and hydration preloading still work. Client builds are\n   * untouched.\n   */\n  function injectSsrModuleId(code: string, id: string, isSsr: boolean): string {\n    if (!isSsr || /node_modules/.test(id) || code.includes('$$moduleUrl')) return code;\n    const queryIndex = id.indexOf('?');\n    const file = queryIndex === -1 ? id : id.slice(0, queryIndex);\n    const query = queryIndex === -1 ? '' : id.slice(queryIndex);\n    const relativeId = path.relative(projectRoot, file).split(path.sep).join('/') + query;\n    return code + `\\nexport const $$moduleUrl = ${JSON.stringify(relativeId)};\\n`;\n  }\n\n  // Pads removed specifiers with spaces so the chunk's source map stays valid.\n  function stripModuleUrlExport(code: string): string | null {\n    const clause = /export\\s*\\{([^}]*)\\}\\s*;?(?=(?:\\s|\\/\\/[^\\n]*|\\/\\*[\\s\\S]*?\\*\\/)*$)/.exec(code);\n    if (!clause) return null;\n    const specifiers = clause[1].split(',');\n    const kept = specifiers.filter(\n      (spec) => !/^\\s*(?:[\\w$]+\\s+as\\s+)?(?:\\$\\$moduleUrl|([\"'])\\$\\$moduleUrl\\1)\\s*$/.test(spec),\n    );\n    if (kept.length === specifiers.length) return null;\n    const start = clause.index + clause[0].indexOf('{') + 1;\n    return (\n      code.slice(0, start) +\n      kept.join(',').padEnd(clause[1].length) +\n      code.slice(start + clause[1].length)\n    );\n  }\n\n  function nativeTsrxCss(result: unknown): string {\n    const css = (result as { css?: unknown }).css;\n    return typeof css === 'string' ? css : '';\n  }\n\n  function babelTsrxCss(result: babel.BabelFileResult): string {\n    const css = (result.metadata as { css?: unknown } | undefined)?.css;\n    return typeof css === 'string' ? css : '';\n  }\n\n  async function compileLoweredCss(source: string, id: string): Promise<string> {\n    const frontend = frontendFor(id);\n    if (frontend) {\n      const result = await frontend.compile(source, {\n        id: cleanModuleId(id),\n        moduleId: id,\n        ssr: false,\n        root: projectRoot,\n        solid: getSolidOptions(\n          options,\n          false,\n          replaceDev,\n          observe,\n          isTestMode,\n          'native',\n          projectRoot,\n        ),\n        addWatchFile: () => {},\n      });\n      return result?.css ?? '';\n    }\n    return compileTsrxCss(source, id);\n  }\n\n  async function compileTsrxCss(source: string, id: string): Promise<string> {\n    if (options.compiler === 'babel') {\n      const solidOptions = getSolidOptions(\n        options,\n        false,\n        replaceDev,\n        observe,\n        isTestMode,\n        'babel',\n        projectRoot,\n      );\n      const babelUserOptions = await getBabelUserOptions(options, source, id, false);\n      const { transformAsync, solid } = await loadBabelJsx();\n      const babelOptions = mergeAndConcat(babelUserOptions, {\n        root: projectRoot,\n        // Keep .tsrx: the Babel plugin uses it to select its TSRX parser.\n        filename: id,\n        sourceFileName: id,\n        ast: false,\n        code: false,\n        sourceMaps: false,\n        configFile: false,\n        babelrc: false,\n        parserOpts: {\n          plugins: ['jsx', 'decorators', 'typescript'],\n        },\n        plugins: [[solid, solidOptions]],\n      }) as babel.TransformOptions;\n      const result = await transformAsync(source, babelOptions);\n      return result ? babelTsrxCss(result) : '';\n    }\n\n    // The compiler is loaded ahead of the options: its location probe runs\n    // at load, and getSolidOptions reads the result.\n    const compiler = await loadNativeCompiler();\n    const solidOptions = getSolidOptions(\n      options,\n      false,\n      replaceDev,\n      observe,\n      isTestMode,\n      'native',\n      projectRoot,\n    );\n    const result = await compiler.transformAsync(source, {\n      ...solidOptions,\n      filename: id,\n      sourceMap: false,\n    });\n    return nativeTsrxCss(result);\n  }\n\n  const mainPlugin: Plugin = {\n    name: 'solid',\n    enforce: 'pre',\n\n    async config(userConfig, { command }) {\n      // We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode\n      replaceDev = options.dev === true || (options.dev !== false && command === 'serve');\n      observe = options.observe === true;\n      projectRoot = userConfig.root || projectRoot;\n      isTestMode = userConfig.mode === 'test';\n      domTestRuntimeInlined = false;\n      forceProduction = options.dev === false && command === 'serve' && !isTestMode;\n      // Per-vitest-project posture: the client posture (browser conditions,\n      // dom codegen) is right for DOM component tests but\n      // wrong for server-runtime unit tests. A project that explicitly opts\n      // into a server runtime — `test: { environment: 'node' }` (or\n      // 'edge-runtime') — gets the server posture end to end: no browser\n      // condition injection, so the framework resolves its real server\n      // build (isServer true) with no inline/alias workarounds. DOM\n      // environments (jsdom, happy-dom, browser mode) and an unset\n      // environment keep the client posture. Each vitest project resolves its own config, so the\n      // hooks below see the posture of the project they serve.\n      serverTestPosture =\n        isTestMode &&\n        ((userConfig as any).test?.environment === 'node' ||\n          (userConfig as any).test?.environment === 'edge-runtime');\n\n      solidPkgsConfig = await crawlFrameworkPkgs({\n        viteUserConfig: userConfig,\n        root: projectRoot || process.cwd(),\n        isBuild: command === 'build',\n        isFrameworkPkgByJson(pkgJson) {\n          return containsSolidField(pkgJson.exports || {});\n        },\n        // `false` = neither framework nor semi-framework, and don't crawl\n        // its deps; `undefined` = unknown, fall through to the json checks.\n        isFrameworkPkgByName(name) {\n          return isNonRuntimeSolidPkg(name) ? false : undefined;\n        },\n        // Under `vite dev` the runtime must not be split in two. Inlined\n        // modules resolve `solid-js` through Vite with `development` (its dev\n        // server build); an externalized package's own imports are resolved by\n        // Node, which has no `development` condition, so it loads the\n        // production build instead. Both then run, each with its own\n        // `sharedConfig` — the manifest `renderToStream` sets lands on one and\n        // `lazy()` reads the other. `resolve.externalConditions` below only\n        // fixes the external's own entry, not what it imports, so every\n        // package that consumes the runtime has to go through Vite as well.\n        // Semi-framework is the right class: `ssr.noExternal` without\n        // `optimizeDeps.exclude`, since these hold no raw Solid components.\n        isSemiFrameworkPkgByJson(pkgJson) {\n          // Same gate as the core inlining in configEnvironment: dev serve or\n          // an observe build (the `observe` condition selects a server build\n          // the same way `development` does, and an externalized consumer\n          // would split it just the same), never vitest (it manages inlining\n          // via test.server.deps).\n          const semi = SOLID_RUNTIME_PKGS.some(\n            (name) => pkgJson.dependencies?.[name] || pkgJson.peerDependencies?.[name],\n          );\n          if (isTestMode) {\n            // Client test posture: record the runtime consumers so\n            // `test.server.deps.inline` below can inline them, without\n            // handing them to vitefu (its `ssr.external` for their\n            // dependencies would reach vitest's `server.deps.external`).\n            if (semi && !serverTestPosture && typeof pkgJson.name === 'string') {\n              testRuntimeConsumers.add(pkgJson.name);\n            }\n            return false;\n          }\n          if (!(replaceDev || observe)) return false;\n          if (semi && typeof pkgJson.name === 'string') semiFrameworkPkgs.add(pkgJson.name);\n          return semi;\n        },\n      });\n\n      // vitefu only reads the dependencies of the package.json at the Vite\n      // root. In a workspace, the project can also import packages that are\n      // only declared in the workspace root's package.json (npm and yarn\n      // hoist them). A framework package found that way was left external,\n      // so Node loaded its raw `.jsx` source and failed with\n      // `Unknown file extension \".jsx\"` (#157). Crawl the workspace root too\n      // and inline its framework packages. Only `ssr.noExternal` is merged:\n      // inlining a name that is never imported does nothing, while\n      // `optimizeDeps.include` entries must resolve from the project root.\n      const crawlRoot = path.resolve(projectRoot || process.cwd());\n      const workspaceRoot = searchForWorkspaceRoot(crawlRoot);\n      if (workspaceRoot !== crawlRoot) {\n        const workspacePkgs = await crawlFrameworkPkgs({\n          viteUserConfig: userConfig,\n          root: workspaceRoot,\n          isBuild: command === 'build',\n          isFrameworkPkgByJson(pkgJson) {\n            return containsSolidField(pkgJson.exports || {});\n          },\n          isFrameworkPkgByName(name) {\n            return isNonRuntimeSolidPkg(name) ? false : undefined;\n          },\n        });\n        for (const name of workspacePkgs.ssr.noExternal) {\n          if (!solidPkgsConfig.ssr.noExternal.includes(name)) {\n            solidPkgsConfig.ssr.noExternal.push(name);\n          }\n        }\n      }\n\n      // A semi-framework package is inlined for ONE reason: so it resolves the\n      // runtime through Vite and shares the app's copy. vitefu's crawl treats\n      // it like a framework package for its dependencies too — every CJS\n      // dependency is deep-included (`\"pkg > dep\"`) so the browser optimizer\n      // pre-bundles it. For a library that ships its build-time half in the\n      // same package (a Vite plugin, a compiler binding, a CLI) that pushes\n      // node-only modules into the client's pre-bundle: `@yak/solid` lists\n      // `@swc/core`, and rolldown then fails on its native `.node` binding\n      // before `vite dev` serves a page (#375). Nothing about sharing the\n      // runtime needs the package's dependencies pre-bundled, so any chain\n      // that runs through a semi-framework package is dropped; a browser-side\n      // CJS dependency of such a package is discovered and optimized on\n      // first use instead, as it was before the package was classified at\n      // all. Framework packages (a `solid` export condition) keep vitefu's\n      // full treatment — that is the long-standing contract for them.\n      if (semiFrameworkPkgs.size > 0) {\n        solidPkgsConfig.optimizeDeps.include = solidPkgsConfig.optimizeDeps.include.filter(\n          (entry) => !entry.split(' > ').some((name) => semiFrameworkPkgs.has(name)),\n        );\n      }\n\n      // fix for bundling dev in production\n      const nestedDeps = replaceDev ? ['solid-js', '@solidjs/web'] : [];\n      // `@solidjs/signals` is the reactive core `solid-js` depends on.\n      // `@solidjs/diagnostics/browser` and `solid-js/attribution` import it\n      // directly, so a nested/duplicated install (npm nesting a second copy\n      // under a package that lists it as a dependency) yields a second\n      // engine beside the one `solid-js` loads — the same two-engines\n      // symptom the `optimizeDeps.include` entries below guard against on\n      // the pre-bundle path. Dedupe it to the app's copy — but only when the\n      // app root can reach one. `resolve.dedupe` resolves the listed package\n      // from the root, and Vite's Node-side resolver (`fetchModule` for\n      // externalized SSR imports, and the externalize decision itself) has\n      // no importer fallback when that misses. Under pnpm's isolated layout\n      // signals exists only as `solid-js`'s transitive dependency, so with\n      // the entry always on, `import \"@solidjs/signals\"` from the inlined\n      // `solid-js` fails with ERR_MODULE_NOT_FOUND as soon as anything\n      // externalizes it (vitefu does, once a semi-framework package such as\n      // `@solidjs/diagnostics` lists it under `dependencies`). With no root\n      // copy there is nothing to dedupe TO, so the gate loses nothing.\n      //\n      // Dedupe applies to builds as well as dev. A dependency that ships its\n      // own nested copy of `solid-js` would otherwise put a second runtime\n      // in the production bundle, with its own owner tree and contexts. #112\n      // Each package is only listed when the root can resolve it, for the\n      // reason given above for `@solidjs/signals`.\n      const dedupeRoot = path.resolve(projectRoot || process.cwd());\n      const dedupe = ['solid-js', '@solidjs/web', '@solidjs/signals'].filter((name) =>\n        findPackageDir(name, dedupeRoot),\n      );\n      const rootSignals = dedupe.includes('@solidjs/signals');\n\n      const userTest = (userConfig as any).test ?? {};\n      const test = {} as any;\n      if (userConfig.mode === 'test') {\n        // to simplify the processing of the config, we normalize the setupFiles to an array\n        const userSetupFiles: string[] =\n          typeof userTest.setupFiles === 'string'\n            ? [userTest.setupFiles]\n            : userTest.setupFiles || [];\n\n        // No `test.environment` is injected: the project picks its own\n        // (`jsdom` or `happy-dom` for DOM component tests). A default here\n        // also applied to every Node-only test suite that happened to load\n        // the plugin, which then ran under a DOM it never asked for.\n\n        // Vitest 5 defaults `test.sharedViteServer` to true: inline projects\n        // then reuse the root Vite server and take their `test` options from\n        // the raw root block captured BEFORE any `config` hook runs, so nothing\n        // injected here (posture, jest-dom, server.deps) reaches them. Vitest\n        // reads the option off the resolved root config (getOwnServerReason), so\n        // this restores per-project resolution as under Vitest 4 (#369).\n        if (userTest.projects && userTest.sharedViteServer === undefined) {\n          test.sharedViteServer = false;\n        }\n\n        if (serverTestPosture) {\n          // The worker pool is shared across the whole vitest workspace and\n          // imports externalized deps natively with `--conditions` derived\n          // from the ROOT config — which carries the client posture's\n          // 'browser'. Inline the framework so every resolution goes through\n          // THIS project's (server) conditions instead: one server-build\n          // instance end to end (request-event storage included).\n          if (!userTest.server?.deps?.inline) {\n            test.server = { deps: { inline: [/solid-js/, /@solidjs[+/]web/] } };\n          }\n        } else if (\n          // `inline: true` inlines everything already (and Vite's config\n          // merge would turn it into `[true, ...]`, which vitest can't read).\n          // A user list is merged with this one; a user who externalizes\n          // solid-js keeps it external.\n          userTest.server?.deps?.inline !== true &&\n          !userTest.server?.deps?.external?.find((item: string | RegExp) =>\n            /solid-js/.test(item.toString()),\n          )\n        ) {\n          // An externalized package is imported natively, and its own imports\n          // are resolved by the host runtime, not by Vite. Node gets the\n          // `browser` condition from vitest's worker `--conditions`, but Deno\n          // does not apply them in worker threads. It resolves `deno`/`node`\n          // and lands on the server build (`isServer` true inside\n          // `@solidjs/testing-library`'s `render`, #369). Inline the runtime and the packages that consume it, so\n          // every import of `solid-js` and `@solidjs/web` goes through Vite's\n          // `browser` condition and loads one client-build instance. A\n          // consumer left external would load a second, native copy, so the\n          // consumers found by the crawl are inlined with the runtime.\n          // Packages with a `solid` export condition are inlined already\n          // through vitefu's `ssr.noExternal`.\n          test.server = {\n            deps: {\n              inline: [\n                /[\\\\/]node_modules[\\\\/]solid-js[\\\\/]/,\n                /[\\\\/]node_modules[\\\\/]@solidjs[\\\\/]web[\\\\/]/,\n                ...testRuntimeConsumers,\n              ],\n            },\n          };\n        }\n        const environment = userTest.environment ?? test.environment;\n        domTestRuntimeInlined =\n          !serverTestPosture &&\n          !userTest.browser?.enabled &&\n          (environment === 'jsdom' || environment === 'happy-dom') &&\n          !userTest.server?.deps?.external?.find((item: string | RegExp) =>\n            /solid-js/.test(item.toString()),\n          );\n        // jest-dom's DOM matchers have no place in a server-posture project;\n        // vitest browser mode already has bundled jest-dom assertions\n        // https://main.vitest.dev/guide/browser/assertion-api.html#assertion-api\n        if (!userTest.browser?.enabled && !serverTestPosture) {\n          const jestDomImport = getJestDomExport(\n            userSetupFiles,\n            path.resolve(projectRoot || process.cwd()),\n          );\n          if (jestDomImport) {\n            test.setupFiles = [jestDomImport];\n          }\n        }\n      }\n\n      const userDefine = userConfig.define?.[SERVER_COMPONENTS_DEFINE];\n      if (typeof userDefine === 'string') serverComponentsDefine = userDefine;\n\n      return {\n        /**\n         * We only need esbuild on .ts or .js files.\n         * .tsx & .jsx files are handled by us\n         */\n        // esbuild: { include: /\\.ts$/ },\n        // resolve.conditions is handled per-environment in configEnvironment.\n        // Build and dev source (via /@vite/env). The optimizer ignores this\n        // and gets the same flag in configEnvironment.\n        define: {\n          [SERVER_COMPONENTS_DEFINE]: serverComponentsDefine,\n        },\n        resolve: {\n          dedupe,\n        },\n        optimizeDeps: {\n          extensions: scanExtensions,\n          include: [\n            ...nestedDeps,\n            // Dev refresh wrappers import the solid-js/refresh runtime in\n            // every mode; pre-bundle it up front so its discovery doesn't\n            // trigger a re-optimize + full reload on first use.\n            ...(command === 'serve' &&\n            options.dev !== false &&\n            options.refresh !== false\n              ? [REFRESH_RUNTIME_SOURCE]\n              : []),\n            // The server-components client runtime is imported by the\n            // (virtual) client entry, and compiled function references\n            // import the server-function client runtime; pre-bundle both up\n            // front — in one optimizer pass — so a mid-session discovery\n            // can't trigger a re-optimize + full reload, and both entries\n            // share one instance of the transport config module (the\n            // server-components runtime installs its response policy there).\n            // `@solidjs/web/frames` imports that runtime as\n            // `@solidjs/web/server-functions/client`, so list that subpath\n            // too: when the app excludes `@solidjs/web`, the frames bundle\n            // would otherwise load it raw from node_modules, a second\n            // instance the response policy never reaches.\n            ...(command === 'serve' && serverComponents\n              ? [\n                  '@solidjs/web/frames',\n                  '@solidjs/web/server-functions',\n                  '@solidjs/web/server-functions/client',\n                ]\n              : []),\n            // Plain `serverFunctions` needs the runtime too: the scanner never\n            // runs the transform that adds its import, so the first \"use server\"\n            // module forces the same re-optimize + full reload (in Vitest\n            // browser mode, \"Vite unexpectedly reloaded a test\").\n            // `@solidjs/web/server-functions/rich-args`, which the app imports\n            // itself, also reaches the default runtime by the `/client`\n            // subpath, so that is listed as well for the same reason as\n            // frames above.\n            ...(command === 'serve' &&\n            serverFunctionsClientDep &&\n            !(serverComponents && serverFunctionsClientDep === '@solidjs/web/server-functions')\n              ? serverFunctionsClientDep === '@solidjs/web/server-functions'\n                ? [serverFunctionsClientDep, '@solidjs/web/server-functions/client']\n                : [serverFunctionsClientDep]\n              : []),\n            // The attribution engine and the Chrome performance-tracks\n            // recorder are subpaths the scanner only sees when the app's own\n            // graph imports them; a consumer it never crawls (a linked\n            // package, a `solid`-condition package vitefu excluded from the\n            // scan) importing one mid-session would discover it late →\n            // re-optimize → a second `@solidjs/signals` core beside the one\n            // `solid-js` was bundled with. Pre-bundle both in the first pass\n            // so they share that core. Both subpaths exist for every version\n            // in the peer range (^2.0.0-rc.10: `solid-js/attribution` since\n            // rc.8, `@solidjs/web/performance-tracks` since rc.10).\n            ...(command === 'serve'\n              ? ['solid-js/attribution', '@solidjs/web/performance-tracks']\n              : []),\n            // An app that depends on `@solidjs/signals` directly can import\n            // it from a module the scanner never reaches (a test file in\n            // Vitest browser mode, a non-literal dynamic import). The first\n            // pass bundled signals inside `solid-js`, so that import is a\n            // late discovery: re-optimize, full reload. Only when it resolves\n            // from the root: otherwise the app can't import it by name, and\n            // an include entry that doesn't resolve warns on every start.\n            ...(command === 'serve' && rootSignals ? ['@solidjs/signals'] : []),\n            ...solidPkgsConfig.optimizeDeps.include,\n          ],\n          exclude: solidPkgsConfig.optimizeDeps.exclude,\n          // Keep Solid TSX from injecting React's automatic runtime during scanning.\n          rolldownOptions: {\n            transform: { jsx: { runtime: 'classic' as const } },\n            plugins: [tsrxDepScanPlugin],\n          },\n        },\n        ...(Object.keys(test).length ? { test } : {}),\n      };\n    },\n\n    configEnvironment(name, config, opts) {\n      // The optimizer does not apply the top-level `define`, and Vite only\n      // seeds the `client` environment from the top-level `optimizeDeps`.\n      // Every environment's pre-bundle therefore gets the flag here, unless\n      // that environment already set its own value. #396\n      const optimizeDeps = (config.optimizeDeps ??= {});\n      const rolldownOptions = (optimizeDeps.rolldownOptions ??= {});\n      const transform = (rolldownOptions.transform ??= {});\n      const define = (transform.define ??= {});\n      define[SERVER_COMPONENTS_DEFINE] ??= serverComponentsDefine;\n\n      config.resolve ??= {};\n      // Emulate Vite default fallback for `resolve.conditions` if not set\n      if (config.resolve.conditions == null) {\n        if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {\n          config.resolve.conditions = [...defaultClientConditions];\n        } else {\n          config.resolve.conditions = [...defaultServerConditions];\n        }\n      }\n      config.resolve.conditions = [\n        'solid',\n        // A server build with `ssr.target: 'webworker'` starts from Vite's\n        // client conditions, which select the browser builds of `solid-js`\n        // and `@solidjs/web`. Their `worker` export points at the server\n        // build, so add it for that environment. #153\n        ...(opts.isSsrTargetWebworker ? ['worker'] : []),\n        ...(replaceDev ? ['development'] : []),\n        // `development` nests above `observe` in the runtime's exports, so\n        // both may be present: dev serve keeps the dev build, builds get the\n        // observe build.\n        ...(observe ? ['observe'] : []),\n        // Tests resolve the browser builds even when the app is\n        // server-rendered — the client posture applies to the whole test\n        // pipeline, not just the codegen. Projects that explicitly opt into\n        // a server runtime (`test.environment: 'node'` / 'edge-runtime')\n        // keep the default server conditions instead, so the framework's\n        // real server build resolves (isServer true).\n        //\n        // Vitest passes the `ssr` environment's conditions to Node as\n        // `--conditions` for the packages it leaves external. With `browser`\n        // there, Node-only packages fail to load. For example, `msw/node`\n        // imports `@mswjs/interceptors/ClientRequest`, whose `browser`\n        // export is `null` (#125). jsdom and happy-dom tests run in the\n        // `client` environment with the runtime inlined, so `ssr` does not\n        // get `browser` in that case.\n        ...(isTestMode &&\n        !serverTestPosture &&\n        !opts.isSsrTargetWebworker &&\n        !(domTestRuntimeInlined && name === 'ssr')\n          ? ['browser']\n          : []),\n        // Vite's `development|production` resolves to `development` in any\n        // non-production mode, which would undo `dev: false` under `vite dev`.\n        ...(forceProduction\n          ? config.resolve.conditions.map((c) =>\n              c === 'development|production' ? 'production' : c,\n            )\n          : config.resolve.conditions),\n      ];\n\n      // Vite seeds only the `client` environment from the top-level\n      // `optimizeDeps` set in `config`, so every other environment would\n      // scan Solid TSX with Rolldown's default (React's automatic runtime)\n      // and fail on an unresolvable `react/jsx-dev-runtime`. Server\n      // environments default to `noDiscovery: true`, but hosts that run SSR\n      // outside Node turn discovery back on (@cloudflare/vite-plugin), #387.\n      if (name !== 'client') {\n        const optimizeDeps = (config.optimizeDeps ??= {});\n        const missing = scanExtensions.filter(\n          (extension) => !optimizeDeps.extensions?.includes(extension),\n        );\n        if (missing.length) {\n          optimizeDeps.extensions = [...(optimizeDeps.extensions ?? []), ...missing];\n        }\n        const rolldownOptions = (optimizeDeps.rolldownOptions ??= {});\n        const transform = (rolldownOptions.transform ??= {});\n        transform.jsx ??= { runtime: 'classic' };\n        rolldownOptions.plugins = rolldownOptions.plugins\n          ? [rolldownOptions.plugins, tsrxDepScanPlugin]\n          : [tsrxDepScanPlugin];\n      }\n\n      // `resolve.conditions` above only governs modules Vite inlines.\n      // Externalized server deps are resolved by `fetchModule` with\n      // `resolve.externalConditions` (default `['node', 'module-sync']`) and\n      // handed to the module runner as concrete file paths — without\n      // `development` there, packages that select their dev build through\n      // the `development` export condition (@solidjs/web's server-functions\n      // runtime among them) run their PRODUCTION copy under `vite dev`:\n      // server errors reach the client sanitized to \"Internal Server Error\"\n      // instead of carrying the real message, dev-only diagnostics vanish.\n      // So the dev flag has to reach both lists — and `observe` selects its\n      // server build the same way, with the same split if it only reaches\n      // one list.\n      if ((replaceDev || observe) && config.consumer !== 'client' && name !== 'client') {\n        config.resolve.externalConditions = [\n          ...(replaceDev ? ['development'] : []),\n          ...(observe ? ['observe'] : []),\n          ...(config.resolve.externalConditions ?? defaultExternalConditions),\n        ];\n\n        // `externalConditions` only reaches the imports the module runner\n        // resolves itself. An externalized package's OWN imports are resolved\n        // by Node, with Node's conditions — never `development`. Since\n        // solid 2.0.0-rc.7 both `solid-js` and `@solidjs/web` ship a\n        // `dist/server.dev.*` behind that condition, so leaving them external\n        // splits the framework in two under `vite dev`: the app's `solid-js`\n        // is the runner's dev copy while `@solidjs/web`'s `import \"solid-js\"`\n        // lands on Node's prod copy. `renderToStream` then installs the asset\n        // resolver on one `sharedConfig` and `lazy()` reads the other (\"no\n        // asset manifest is set\"), with every other module-level singleton\n        // (owner tracking, request events, hydration keys) split the same\n        // way. Inlining the two core packages makes every resolution — theirs\n        // included — go through the environment's conditions, so one dev\n        // build is loaded end to end. Framework packages that declare the\n        // `solid` export condition are already inlined via vitefu below and\n        // reach the same copy. Vitest projects manage their own inlining\n        // (`test.server.deps` above) and are left alone, as is a host that\n        // set `noExternal: true` (everything is inlined already).\n        //\n        // `seroval` and `seroval-plugins` split the same way: both ship a\n        // `dist/dev` build behind `development`, and `@solidjs/web` imports\n        // both. Left external, `seroval-plugins` loads through Node and its\n        // own `import \"seroval\"` lands on the prod copy, while the inlined\n        // `@solidjs/web` gets the runner's dev copy. Seroval tells a stream\n        // apart with `instanceof Stream`, so the `Stream` that\n        // `ReadableStreamPlugin` builds from one copy is rejected by the\n        // other's serializer (\"cannot be parsed/serialized\"). A server\n        // component that lands after the shell flushes hits this: its\n        // `sc:live` channel is a ReadableStream serialized into the document.\n        if (!isTestMode && config.resolve.noExternal !== true) {\n          const noExternal = config.resolve.noExternal;\n          config.resolve.noExternal = [\n            ...(Array.isArray(noExternal) ? noExternal : noExternal ? [noExternal] : []),\n            'solid-js',\n            '@solidjs/web',\n            'seroval',\n            'seroval-plugins',\n          ];\n        }\n      }\n\n      // Set resolve.noExternal and resolve.external for the SSR environment.\n      // Only set resolve.external if noExternal is not true (to avoid conflicts with plugins like Cloudflare)\n      if (name === 'ssr' && solidPkgsConfig) {\n        if (config.resolve.noExternal !== true) {\n          const hostNoExternal = config.resolve.noExternal;\n          const noExternal = [\n            ...(Array.isArray(hostNoExternal)\n              ? hostNoExternal\n              : hostNoExternal\n                ? [hostNoExternal]\n                : []),\n            ...solidPkgsConfig.ssr.noExternal,\n          ];\n          config.resolve.noExternal = noExternal;\n          // vitefu externalizes the non-framework deps of every framework\n          // package in dev, and Vite gives `external` precedence over\n          // `noExternal`. A framework package that lists solid-js or\n          // @solidjs/web under `dependencies` (not peer — e.g.\n          // @tanstack/solid-router 2.0.0-rc.7 → @solidjs/web) would therefore\n          // re-externalize a core inlined above and split the runtime again.\n          // Nothing inlined may appear in `external`.\n          //\n          // \"Inlined\" means whatever `noExternal` claims, judged the way Vite\n          // judges it (`createFilter(undefined, noExternal, { resolve:\n          // false })` in its `createIsConfiguredAsExternal`): string entries\n          // are picomatch patterns, RegExp entries test the id. A literal\n          // `includes` check only caught exact names, so a host that inlines\n          // its packages by pattern — TanStack Start's `@tanstack/start**`,\n          // whose start-server-core resolves `#tanstack-*` imports only when\n          // Vite processes it — saw them re-externalized once the\n          // semi-framework crawl reached them through its Solid adapter\n          // (their non-Solid dependencies land in vitefu's `ssr.external`),\n          // and `vite dev` failed with ERR_PACKAGE_IMPORT_NOT_DEFINED.\n          const keepsExternal =\n            noExternal.length > 0\n              ? createFilter(undefined, noExternal, { resolve: false })\n              : () => true;\n          config.resolve.external = [\n            ...(Array.isArray(config.resolve.external) ? config.resolve.external : []),\n            ...solidPkgsConfig.ssr.external.filter((dep) => keepsExternal(dep)),\n          ];\n        }\n      }\n    },\n\n    configResolved(config) {\n      isBuild = config.command === 'build';\n      isSsrBuild = !!config.build.ssr;\n      base = config.base;\n      publicDir = config.publicDir;\n      renderBuiltUrl = !!config.experimental?.renderBuiltUrl;\n      projectRoot = config.root;\n      clientBuildConfig = (config as any).environments?.client?.build ?? config.build;\n      isAppBuild = !!config.builder;\n      filter = createFilter(options.include, options.exclude, { resolve: projectRoot });\n      styleFilter = createStyleFilter(projectRoot);\n      // `components: 'external'` is the acknowledgement that a composing\n      // host (e.g. the Astro adapter or TanStack Start's Solid integration)\n      // owns the document wiring itself — behavior is identical to `true`,\n      // only this warning is skipped. Under SSR start mode it's redundant\n      // but harmless (treated exactly as `true`).\n      if (\n        serverComponents &&\n        serverComponentsOption !== 'external' &&\n        !(options.start && options.ssr)\n      ) {\n        config.logger.warn(\n          '[@solidjs/vite-plugin] serverFunctions.components is set without SSR start mode (the `start` ' +\n            'option with `ssr: true`), so the plugin only installs the endpoint response transform ' +\n            '(server functions returning components stream correctly). The document wiring — the ' +\n            'render plugin (with the direct-call transform) and the client-side ' +\n            \"installServerComponents() call — is emitted by SSR start mode's generated entries; \" +\n            'without it, server components only mount from post-boot streams and your client code ' +\n            'must call installServerComponents() itself. If a composing host owns that wiring, set ' +\n            \"`components: 'external'` to acknowledge it and silence this warning.\",\n        );\n      }\n      // The generated server code — the start-mode handler and the\n      // server-function handler module — imports `@solidjs/web/storage`,\n      // the one Solid module that needs `node:async_hooks`\n      // (AsyncLocalStorage keeps the request event live across `await`s;\n      // there is no sync-scope fallback, solidjs/solid#3597). A worker-\n      // targeted server build (`ssr.target: 'webworker'`, e.g. Shopify\n      // Oxygen's Vite plugin) only fails at deploy with a bare\n      // module-not-found, so name the requirement and the fix at build\n      // time instead. Detected here, emitted from the ssr environment's\n      // buildStart so it lands once per server build: the default builder\n      // resolves the config once per environment on top of its own pass,\n      // so a configResolved warning would print three times per build.\n      // Build-only — dev runs the ssr environment in Node.\n      workerTargetWarning =\n        isBuild &&\n        !!(startOptions || options.serverFunctions) &&\n        config.ssr?.target === 'webworker';\n      logger = config.logger;\n      needHmr =\n        config.command === 'serve' &&\n        config.mode !== 'production' &&\n        // The production `solid-js/refresh` runtime is an inert stub.\n        options.dev !== false &&\n        options.refresh !== false;\n    },\n\n    configureServer(server) {\n      devServer = server;\n      // Dev asset resolution for SSR: the virtual manifest module (evaluated\n      // in the SSR environment) picks this resolver up through the global\n      // registry keyed by project root — or, from isolated module runners\n      // that don't share globals with this process, through the HTTP bridge\n      // endpoint the middleware serves.\n      if (options.ssr || options.start) {\n        devAssetResolver = createDevAssetResolver(server, filterDevStyles);\n        registerDevAssetResolver(server.config.root, devAssetResolver);\n        installDevManifestBridge(server);\n      }\n      if (!needHmr) return;\n      // When a module has a syntax error, Vite sends the error overlay via\n      // WebSocket but the failed import triggers invalidation in solid-refresh.\n      // This propagates up to @refresh reload boundaries (e.g. document-level\n      // App components in SSR), causing a full-reload that overrides the overlay.\n      // We suppress update/full-reload messages that immediately follow an error.\n      const hot = server.hot ?? (server as any).ws;\n      if (!hot) return;\n      let lastErrorTime = 0;\n      const origSend = hot.send.bind(hot);\n      hot.send = function (this: any, ...args: any[]) {\n        const payload = args[0];\n        if (typeof payload === 'object' && payload) {\n          if (payload.type === 'error') {\n            lastErrorTime = Date.now();\n          } else if (\n            lastErrorTime &&\n            (payload.type === 'full-reload' || payload.type === 'update')\n          ) {\n            if (Date.now() - lastErrorTime < 200) return;\n            lastErrorTime = 0;\n          }\n        }\n        return origSend(...args);\n      } as typeof hot.send;\n    },\n\n    buildStart() {\n      // A host may rebuild the client with this instance (#525): emit lazy chunks again.\n      if (isBuild && isClientBuild(this)) {\n        emittedLazyChunks.clear();\n        emittedLazyChunkRefs.length = 0;\n      }\n      // `ssr.target` is a property of the `ssr` environment specifically\n      // (Vite reads it as `environment.name === 'ssr'` too), and that is the\n      // one environment whose bundle carries the storage import. buildStart\n      // runs once per environment build, so this runs once for the server\n      // build — and not at all for the client build or a `vite build\n      // --ssr`-less client-only build.\n      if (!workerTargetWarning || this.environment?.name !== 'ssr') return;\n      logger!.warn(\n        '[@solidjs/vite-plugin] The server build targets a worker runtime (ssr.target = \"webworker\"). ' +\n          \"Solid's server runtime requires Node's async context (node:async_hooks / AsyncLocalStorage). \" +\n          'On Cloudflare Workers and compatible runtimes (e.g. Shopify Oxygen) set a compatibility_date ' +\n          'of 2026-08-04 or later (nodejs_compat is on by default from that date), or enable the ' +\n          'nodejs_compat flag. See https://github.com/solidjs/solid/issues/3597',\n      );\n    },\n\n    async hotUpdate({ file, modules, read }) {\n      if (devAssetResolver && this.environment.config.consumer === 'server') {\n        // Vite awaits watchChange and invalidates transforms before hotUpdate.\n        devAssetResolver.invalidate();\n        this.environment.hot.send({ type: 'custom', event: DEV_MANIFEST_INVALIDATE_EVENT });\n      }\n      if (isLoweredModule(file) && this.environment.name === 'client') {\n        updateTsrxCss(tsrxCss, file, await compileLoweredCss(await read(), file));\n        const cssModule = this.environment.moduleGraph.getModuleById(resolvedTsrxCssModuleId(file));\n        if (cssModule) {\n          this.environment.moduleGraph.invalidateModule(cssModule);\n          if (!modules.includes(cssModule)) modules = [...modules, cssModule];\n          return modules;\n        }\n      }\n\n      // solid-refresh only injects HMR boundaries into client modules, so\n      // non-client environments have no accept handlers. Without this, Vite\n      // would see no boundaries and send full-reload messages that race with\n      // client-side HMR updates. Provider-owned (non-runnable) environments\n      // fall through instead: their plugin needs the real module list to\n      // invalidate its remote runner, and its channel never reaches the\n      // browser websocket.\n      if (this.environment.name !== 'client' && isRunnableEnvironment(this.environment)) {\n        // Returning [] also suppresses the signal environment-runner based\n        // servers (e.g. nitro's dev worker) rely on to re-evaluate modules,\n        // leaving SSR stale until a manual restart. Send the reload on this\n        // environment's own channel — for runner-based environments that is\n        // the runner, for the default ssr environment a no-op, and never the\n        // browser websocket, so client HMR stays free of full-reload races.\n        if (modules.length > 0) {\n          this.environment.hot.send({ type: 'full-reload' });\n          // Server-only modules are the exception to the suppression: a file\n          // with no modules in the client graph has no browser HMR path at\n          // all — nothing client-side accepts it, so staying silent leaves\n          // the browser rendering stale server output until a manual refresh\n          // (e.g. the document shell, which only the server ever imports;\n          // solidjs/solid#3151). Reload the page: the honest cost, and there\n          // is no client update to race with by construction.\n          const clientEnv = devServer?.environments.client;\n          if (clientEnv && !clientEnv.moduleGraph.getModulesByFile(file)?.size) {\n            clientEnv.hot.send({ type: 'full-reload' });\n          }\n        }\n        return [];\n      }\n    },\n\n    resolveId(id) {\n      const tsrxCssId = resolveTsrxCssModule(id);\n      if (tsrxCssId) return tsrxCssId;\n      if (id === VIRTUAL_MANIFEST_ID) return RESOLVED_VIRTUAL_MANIFEST_ID;\n      if (id === VIRTUAL_MANIFEST_BRIDGE_ID) return RESOLVED_VIRTUAL_MANIFEST_BRIDGE_ID;\n    },\n\n    moduleParsed(info) {\n      // SSR-mode client builds only: give every dynamically imported project\n      // module its own facade chunk (exports-only preserves `default`\n      // re-exports) so it keeps a manifest entry keyed by its source path\n      // even when chunk grouping would otherwise absorb it. Plain SPA builds\n      // have no manifest lookups to protect.\n      if (!isBuild || !options.ssr || !isClientBuild(this)) return;\n      for (const depId of info.dynamicallyImportedIds || []) {\n        const cleanId = depId.split('?')[0];\n        if (/node_modules/.test(cleanId) || cleanId.startsWith('\\0')) continue;\n        if (!(/\\.[mc]?[tj]sx?$/i.test(cleanId) || isLoweredModule(cleanId))) continue;\n        if (emittedLazyChunks.has(depId)) continue;\n        emittedLazyChunks.add(depId);\n        emittedLazyChunkRefs.push(\n          this.emitFile({ type: 'chunk', id: depId, preserveSignature: 'exports-only' }),\n        );\n      }\n    },\n\n    load(id) {\n      const tsrxSource = tsrxCssSourceId(id);\n      if (tsrxSource) return tsrxCss.get(tsrxSource) ?? '';\n      if (id === RESOLVED_VIRTUAL_MANIFEST_BRIDGE_ID) {\n        const bridgeUrl = devServer ? devManifestBridgeUrl(devServer) : null;\n        const environment = devServer?.environments[this.environment.name];\n        if (!bridgeUrl && environment && devServer?.httpServer) {\n          // Drop the cached null once the server listens.\n          devServer.httpServer.once('listening', () => {\n            const node = environment.moduleGraph.getModuleById(id);\n            if (node) environment.moduleGraph.invalidateModule(node);\n          });\n        }\n        return `export default ${JSON.stringify(bridgeUrl)};`;\n      }\n      if (id === RESOLVED_VIRTUAL_MANIFEST_ID) {\n        if (!isBuild) {\n          const bridgeUrl = devServer ? devManifestBridgeUrl(devServer) : null;\n          // An own HTTP server that is not listening yet (#414).\n          const deferBridge = !bridgeUrl && !!devServer?.httpServer;\n          return devManifestCode(projectRoot, base, bridgeUrl, deferBridge);\n        }\n        if (clientManifest) clientManifestReaders.add(this.environment.name);\n        const manifestPath = clientManifest ? null : clientManifestPath();\n        const manifestSource =\n          clientManifest?.source ?? (manifestPath && readFileSync(manifestPath, 'utf-8'));\n        if (manifestSource) {\n          const manifest = JSON.parse(manifestSource);\n          // Manifest records are keyed the way Vite keys entry chunks (the\n          // root-relative facade path, also carried as `src`), so the\n          // configured client inputs identify the genuine entries here too —\n          // independent of `isEntry`, which the serialized manifest may have\n          // lost already (older plugin builds stripped it; see #342).\n          const entries = resolveConfiguredEntries(\n            configuredBuildInput(clientBuildConfig),\n            projectRoot,\n          );\n          const isConfiguredEntry = (key: string, record: any) =>\n            entries.manifestKeys.has(key) ||\n            (typeof record.src === 'string' && entries.manifestKeys.has(record.src));\n          for (const key in manifest) {\n            if (isConfiguredEntry(key, manifest[key]) && manifest[key].file) {\n              manifest[key].isEntry = true;\n            }\n          }\n          normalizeEmittedLazyEntries(manifest, {\n            isConfiguredEntry,\n            warn: (message) => this.warn(message),\n            repairDynamicEntries: true,\n          });\n          const stamped = stampClientEntry(\n            manifest,\n            resolveClientEntryKey(manifest, startClientEntryId, clientBuildConfig, projectRoot),\n            base,\n          );\n          // The runtime looks records up as `manifest[moduleUrl]`, so a\n          // hand-written slash-prefixed key (`/src/Page.tsx`, #390) needs\n          // its own property. The aliases are non-enumerable: `for…in`,\n          // `Object.keys` and JSON consumers see the manifest unchanged.\n          return `const manifest = ${JSON.stringify(stamped)};\nfor (const key of Object.keys(manifest)) {\n  if (key[0] !== \"/\" && typeof manifest[key] === \"object\") {\n    Object.defineProperty(manifest, \"/\" + key, { value: manifest[key] });\n  }\n}\nexport default manifest;`;\n        }\n        // SSR build before the client build produced a manifest: bake in the\n        // dev-shaped fallback (registry miss degrades to js-only resolution).\n        return devManifestCode(projectRoot, base, null, false);\n      }\n    },\n\n    outputOptions: {\n      // Post order: this runs after every pre and normal `outputOptions`\n      // hook (and after post hooks earlier in the plugin array), so it wraps\n      // the sanitizer from the config or from those hooks instead of being\n      // replaced by a later one. A post hook further down can still override.\n      order: 'post',\n      handler(outputOptions) {\n        // Every build environment, not just the client: client file names\n        // become URLs (see collapseDotRuns), and the server bundle writes the\n        // URLs of the assets it imports, computed with its own sanitizer.\n        // Collapsing on one side only would point server-rendered `src` and\n        // `href` attributes at files the client build never wrote.\n        // `sanitizeFileName: false` is left as is: it is the one spelling\n        // that asks for raw names, and wrapping it too would leave no way\n        // out.\n        if (!isBuild || outputOptions.sanitizeFileName === false) return null;\n        return {\n          ...outputOptions,\n          sanitizeFileName: collapseDotRuns(outputOptions.sanitizeFileName),\n        };\n      },\n    },\n\n    renderChunk(code, chunk, outputOptions) {\n      // Hosts re-export server entries whole, and workerd rejects non-handler exports.\n      if (!isBuild || isClientBuild(this) || outputOptions.format !== 'es') return null;\n      if (!chunk.isEntry || !chunk.exports.includes('$$moduleUrl')) return null;\n      const build = this.environment?.config?.build;\n      const input = build?.lib\n        ? build.lib.entry\n        : typeof build?.ssr === 'string'\n          ? build.ssr\n          : configuredBuildInput(build);\n      if (!resolveConfiguredEntries(input, projectRoot).isEntryModule(chunk.facadeModuleId))\n        return null;\n      const facade = this.getModuleInfo(chunk.facadeModuleId!);\n      if (facade?.importers.length || facade?.dynamicImporters.length) return null;\n      const stripped = stripModuleUrlExport(code);\n      return stripped === null ? null : { code: stripped, map: null };\n    },\n\n    generateBundle(_outputOptions, bundle) {\n      if (!isBuild || !isClientBuild(this)) return;\n      // Reclassify emitted lazy facade chunks in the raw bundle (not just the\n      // serialized manifest read back later) so downstream plugins inspecting\n      // the bundle don't mistake them for application entries. Must precede\n      // the client asset map build, which keys off dynamic entries.\n      if (options.ssr) {\n        // The genuine entries are the configured inputs of this very\n        // environment — the plugin injects the client entry itself in start\n        // mode, and Vite's default is index.html — so their facade chunks\n        // are recognizable regardless of what dynamically imports them.\n        const entries = resolveConfiguredEntries(\n          configuredBuildInput(this.environment?.config?.build ?? clientBuildConfig),\n          projectRoot,\n        );\n        const knownLazyKeys = new Set<string>();\n        for (const ref of emittedLazyChunkRefs) {\n          let fileName: string;\n          try {\n            fileName = this.getFileName(ref);\n          } catch {\n            // Ignore references retained from a previous watch build.\n            continue;\n          }\n          const chunk = bundle[fileName];\n          if (!chunk || chunk.type !== 'chunk') continue;\n          // An entry that is also lazily imported stays an entry.\n          if (entries.isEntryModule(chunk.facadeModuleId)) continue;\n          knownLazyKeys.add(fileName);\n          chunk.isEntry = false;\n          chunk.isDynamicEntry = true;\n        }\n        normalizeEmittedLazyEntries(bundle, {\n          isConfiguredEntry: (_key, chunk) => entries.isEntryModule(chunk.facadeModuleId),\n          knownLazyKeys,\n          warn: (message) => this.warn(message),\n        });\n      }\n    },\n\n    writeBundle(outputOptions, bundle) {\n      if (!isBuild) return;\n      if (isClientBuild(this)) {\n        const setting = this.environment?.config?.build?.manifest;\n        const fileName = typeof setting === 'string' ? setting : '.vite/manifest.json';\n        const asset = setting ? bundle[fileName] : undefined;\n        clientManifest =\n          asset?.type === 'asset'\n            ? {\n                source:\n                  typeof asset.source === 'string'\n                    ? asset.source\n                    : new TextDecoder().decode(asset.source),\n                file: path.resolve(\n                  projectRoot,\n                  outputOptions.dir ?? this.environment.config.build.outDir,\n                  fileName,\n                ),\n              }\n            : null;\n      } else if (\n        ownsClientManifest &&\n        clientManifest &&\n        clientManifestReaders.has(this.environment.name)\n      ) {\n        removeClientBuildFile(clientManifest.file);\n      }\n    },\n\n    async transform(source, id, transformOptions) {\n      if (isTsrxCssModule(id)) return null;\n      const isSsr = getEnvironmentConsumer(this.environment, transformOptions) === 'server';\n\n      const extensionsToWatch = options.extensions || [];\n      const allExtensions = extensionsToWatch.map((extension) =>\n        // An extension can be a string or a tuple [extension, options]\n        typeof extension === 'string' ? extension : extension[0],\n      );\n\n      if (!filter(id)) {\n        return null;\n      }\n\n      // The queried id is the module's real identity (facade chunk /\n      // manifest key / dev URL); keep it for the `$$moduleUrl` injection\n      // while the transform pipeline below works on the clean file path.\n      const moduleId = id;\n      id = getTransformPath(\n        id,\n        (path) =>\n          /\\.[mc]?[tj]sx$/i.test(path) ||\n          allExtensions.includes(getExtension(path)) ||\n          !!frontendFor(path),\n      );\n      // Read the extension from the query-free path, so a dot inside the\n      // query (`a.mdx?x=1.5`) is not taken as the extension.\n      const currentFileExtension = getExtension(id);\n      const isTsrx = isTsrxModule(id);\n      const frontend = frontendFor(id);\n      const inNodeModules = /node_modules/.test(id);\n      // Primitive names stop at node_modules: a dependency's internals\n      // (Solid's own flow controls included) name what they mean to name,\n      // and a composed primitive from a library is identified by its\n      // package, not re-labelled by this app's build.\n      const sourceNames = getSourceNames(options.solid?.sourceNames, replaceDev, observe);\n      const namePrimitives = !inNodeModules && sourceNames.primitives;\n\n      if (!(\n        /\\.[mc]?[tj]sx$/i.test(id) ||\n        isTsrx ||\n        frontend ||\n        allExtensions.includes(currentFileExtension)\n      )) {\n        // Not a JSX module. Primitive naming stays gated as before\n        // (`createSignal` lives in `.ts`/`.js` as much as in components).\n        // The lazy module-URL pipeline also runs, and it is not gated on\n        // naming: a production `routes.ts` of `lazy(() => import(...))`\n        // still needs callsite module URLs, and an SSR script module still\n        // needs `$$moduleUrl`. No JSX transform and no refresh here — those\n        // stay on the JSX path. `.d.ts` is left untouched.\n        if (!PRIMITIVES_ONLY_MODULE.test(id) || DECLARATION_MODULE.test(id)) {\n          return null;\n        }\n\n        let code = source;\n        const maps: ChainableMap[] = [];\n        // Same cheap pre-check as primitive naming: `transformLazy` only\n        // rewrites `lazy` imported from `solid-js`, so other source cannot\n        // change. SSR still appends `$$moduleUrl` below.\n        const needsCompiler = namePrimitives || mayCallLazy(code);\n        if (needsCompiler) {\n          const compiler = await loadNativeCompiler();\n\n          if (namePrimitives) {\n            warnMissingLocations(this, options);\n            const named = await transformPrimitiveNames(\n              this,\n              compiler,\n              code,\n              id,\n              sourceNames,\n              projectRoot,\n            );\n            if (named !== null) {\n              code = named.code;\n              maps.push(named.map);\n            }\n          }\n\n          if (mayCallLazy(code)) {\n            const lazyResult = await compiler.transformLazyAsync(code, {\n              filename: id,\n              sourceMap: true,\n            });\n            code = lazyResult.code;\n            maps.push(lazyResult.map);\n          }\n        }\n\n        const finalCode = injectSsrModuleId(\n          await resolveLazyModuleUrls(this, code, id),\n          moduleId,\n          !!isSsr,\n        );\n        if (finalCode === source) return null;\n        return { code: finalCode, map: combineSourcemaps(maps) };\n      }\n\n      // We need to know if the current file extension has a typescript options tied to it\n      const shouldBeProcessedWithTypescript =\n        /\\.[mc]?tsx$/i.test(id) ||\n        isTsrx ||\n        extensionsToWatch.some((extension) => {\n          if (typeof extension === 'string') {\n            return extension.includes('tsx');\n          }\n\n          const [extensionName, extensionOptions] = extension;\n          if (extensionName !== currentFileExtension) return false;\n\n          return extensionOptions.typescript;\n        });\n      const plugins: NonNullable<NonNullable<babel.TransformOptions['parserOpts']>['plugins']> = [\n        'jsx',\n        'decorators',\n      ];\n\n      if (shouldBeProcessedWithTypescript) {\n        plugins.push('typescript');\n      }\n\n      // See the documentModuleId declaration: the document shell declines HMR\n      // (no refresh boundary, explicit self-invalidation) so edits full-reload.\n      const isDocumentShell = documentModuleId !== null && id === documentModuleId;\n      const needRefresh = needHmr && !isSsr && !inNodeModules && !isDocumentShell;\n      const declineHmr = isDocumentShell && needHmr && !isSsr;\n\n      const babelUserOptions = await getBabelUserOptions(options, source, id, !!isSsr);\n\n      // The native compiler picks its parser dialect from the file\n      // extension; custom extensions registered through `options.extensions`\n      // are unknown to it, so borrow a standard one matching the configured\n      // TypeScript-ness.\n      const nativeFilename =\n        isTsrx || /\\.(?:[mc]?[jt]s|[jt]sx)$/i.test(id)\n          ? id\n          : id + (shouldBeProcessedWithTypescript ? '.tsx' : '.jsx');\n\n      // Shared native prelude for every mode: (dev/observe) the primitive\n      // naming pass, the lazy() module-URL pass, then (dev/client/\n      // non-node_modules) the solid-refresh HMR pass, all operating on\n      // pre-JSX source. Only the JSX transform itself differs between\n      // compiler backends. Sourcemaps are collected in application order and\n      // merged at the end.\n      const compiler = await loadNativeCompiler();\n      // After the compiler load: the options carry `sourceNames.locations`\n      // and `root` only when the load-time probe found the native compiler\n      // takes them (the babel backend always does).\n      const solidOptions = getSolidOptions(\n        options,\n        !!isSsr,\n        replaceDev,\n        observe,\n        isTestMode,\n        options.compiler === 'babel' ? 'babel' : 'native',\n        projectRoot,\n      );\n      warnMissingLocations(this, options);\n      let code = source;\n      const maps: ChainableMap[] = [];\n\n      // Asset URLs in JSX attributes become imports or take the base, ahead\n      // of every other pass (src/asset-urls.ts).\n      if (!isTsrx && !frontend) {\n        const assets = transformAssetUrls(\n          code,\n          id,\n          shouldBeProcessedWithTypescript,\n          assetUrlOptions(),\n        );\n        if (assets) {\n          code = assets.code;\n          maps.push(assets.map);\n        }\n      }\n\n      // In builds, CSS module class names in JSX attributes become strings,\n      // which compile into the templates (src/css-module-classes.ts).\n      if (isBuild && !isTsrx && !frontend) {\n        const classes = await cssModuleClasses.inline(\n          this,\n          code,\n          id,\n          shouldBeProcessedWithTypescript,\n        );\n        if (classes) {\n          code = classes.code;\n          maps.push(classes.map);\n        }\n      }\n\n      // Authored TSRX (or another front end's source) cannot be parsed by a\n      // standalone pass; its primitives are named after Solid lowering, on\n      // the generated module, below.\n      if (namePrimitives && !isTsrx && !frontend) {\n        const named = await transformPrimitiveNames(\n          this,\n          compiler,\n          code,\n          nativeFilename,\n          sourceNames,\n          projectRoot,\n        );\n        if (named !== null) {\n          code = named.code;\n          maps.push(named.map);\n        }\n      }\n\n      if (isTsrx || frontend) {\n        // Solid lowering preserves authored TypeScript annotations; secondary\n        // passes therefore parse the generated module as TSX even though no\n        // template syntax remains.\n        const generatedFilename = id + '.tsx';\n        const babelBaseOptions: babel.TransformOptions = {\n          root: projectRoot,\n          filename: id,\n          sourceFileName: id,\n          ast: false,\n          sourceMaps: true,\n          configFile: false,\n          babelrc: false,\n          parserOpts: {\n            plugins,\n          },\n        };\n        let css = '';\n\n        if (frontend) {\n          // Another front end lowers the module itself, through the options\n          // a JSX module of this environment would get from this plugin.\n          const result = await frontend.compile(code, {\n            id,\n            moduleId,\n            ssr: !!isSsr,\n            root: projectRoot,\n            solid: getSolidOptions(\n              options,\n              !!isSsr,\n              replaceDev,\n              observe,\n              isTestMode,\n              'native',\n              projectRoot,\n            ),\n            addWatchFile: (file) => this.addWatchFile(file),\n          });\n          if (!result) return null;\n          code = result.code;\n          css = result.css ?? '';\n          maps.push(result.map as ChainableMap);\n        } else if (options.compiler !== 'babel') {\n          const result = await compiler.transformAsync(code, {\n            ...solidOptions,\n            filename: id,\n            sourceMap: true,\n          });\n          code = result.code || '';\n          css = nativeTsrxCss(result);\n          maps.push(result.map);\n\n          if (options.babel) {\n            // The support pass cannot parse authored TSRX. On this route it\n            // intentionally sees the lowered ordinary JavaScript instead.\n            const supportOptions = mergeAndConcat(\n              babelUserOptions,\n              babelBaseOptions,\n            ) as babel.TransformOptions;\n            // This pass sees native-lowered ordinary JavaScript, so do not\n            // route it back through Babel's TSRX parser.\n            supportOptions.filename = generatedFilename;\n            const { transformAsync } = await loadBabelCore();\n            const supportResult = await transformAsync(code, supportOptions);\n            if (!supportResult) return undefined;\n            code = supportResult.code || '';\n            maps.push(supportResult.map);\n          }\n        } else {\n          const { transformAsync, solid } = await loadBabelJsx();\n          const babelOptions = mergeAndConcat(babelUserOptions, {\n            ...babelBaseOptions,\n            plugins: [[solid, solidOptions]],\n          }) as babel.TransformOptions;\n          const result = await transformAsync(code, babelOptions);\n          if (!result) return undefined;\n          code = result.code || '';\n          css = babelTsrxCss(result);\n          maps.push(result.map);\n        }\n\n        if (namePrimitives) {\n          const named = await transformPrimitiveNames(\n            this,\n            compiler,\n            code,\n            generatedFilename,\n            sourceNames,\n            projectRoot,\n          );\n          if (named !== null) {\n            code = named.code;\n            maps.push(named.map);\n          }\n        }\n\n        const lazyResult = await compiler.transformLazyAsync(code, {\n          filename: generatedFilename,\n          sourceMap: true,\n        });\n        code = lazyResult.code;\n        maps.push(lazyResult.map);\n\n        if (needRefresh) {\n          const refreshResult = await compiler.transformRefreshAsync(code, {\n            filename: generatedFilename,\n            bundler: 'vite',\n            fixRender: true,\n            ...(typeof refreshOptions.granular === 'boolean'\n              ? { granular: refreshOptions.granular }\n              : {}),\n            jsx: false,\n            importSource: REFRESH_RUNTIME_SOURCE,\n            sourceMap: true,\n          });\n          code = refreshResult.code;\n          maps.push(refreshResult.map);\n        }\n\n        code = injectSsrModuleId(await resolveLazyModuleUrls(this, code, id), moduleId, !!isSsr);\n        let map = options.compiler === 'babel' || frontend ? combineSourcemaps(maps) : null;\n        updateTsrxCss(tsrxCss, id, css);\n        if (css) {\n          code = prependTsrxCssImport(code, id);\n          map = offsetSourceMapLine(map);\n        }\n        // Vite selects its TypeScript stripping by file extension. Since the\n        // real module identity remains `.tsrx`, strip the annotations here\n        // after Solid lowering instead of handing typed JavaScript to Rollup.\n        const stripped = await transformWithOxc(\n          code,\n          generatedFilename,\n          {\n            lang: 'tsx',\n            sourcemap: map != null,\n            target: 'esnext',\n          },\n          map ?? undefined,\n        );\n        return {\n          code: stripped.code,\n          map: map == null ? null : stripped.map,\n        };\n      }\n\n      const lazyResult = await compiler.transformLazyAsync(code, {\n        filename: nativeFilename,\n        sourceMap: true,\n      });\n      code = lazyResult.code;\n      maps.push(lazyResult.map);\n\n      if (needRefresh) {\n        const refreshResult = await compiler.transformRefreshAsync(code, {\n          filename: nativeFilename,\n          bundler: 'vite',\n          fixRender: true,\n          // The napi validator rejects explicit undefined; omit to get the\n          // pass's default (true).\n          ...(typeof refreshOptions.granular === 'boolean'\n            ? { granular: refreshOptions.granular }\n            : {}),\n          jsx: false,\n          importSource: REFRESH_RUNTIME_SOURCE,\n          sourceMap: true,\n        });\n        code = refreshResult.code;\n        maps.push(refreshResult.map);\n      }\n\n      const babelBaseOptions: babel.TransformOptions = {\n        root: projectRoot,\n        filename: id,\n        sourceFileName: id,\n        ast: false,\n        sourceMaps: true,\n        configFile: false,\n        babelrc: false,\n        parserOpts: {\n          plugins,\n        },\n      };\n\n      // The prelude above reprinted the module, so the JSX transform's\n      // locations are positions in `code`: map them back to `source`.\n      const remapLocations = (output: string, filename: string) =>\n        sourceNames.locations && code !== source\n          ? remapJsxLocations(\n              output,\n              code,\n              combineSourcemaps(maps),\n              toPosixPath(path.relative(projectRoot, filename)),\n            )\n          : output;\n\n      if (options.compiler !== 'babel') {\n        if (options.babel) {\n          // Custom babel options reintroduce a Babel support pass hosting\n          // only the user's plugins, ahead of the native JSX transform.\n          const supportOptions = mergeAndConcat(\n            babelUserOptions,\n            babelBaseOptions,\n          ) as babel.TransformOptions;\n          const { transformAsync } = await loadBabelCore();\n          const supportResult = await transformAsync(code, supportOptions);\n          if (!supportResult) {\n            return undefined;\n          }\n          code = supportResult.code || '';\n          maps.push(supportResult.map);\n        }\n\n        const result = await compiler.transformAsync(code, {\n          ...solidOptions,\n          filename: nativeFilename,\n          sourceMap: true,\n        });\n        const jsxCode = remapLocations(result.code || '', nativeFilename);\n        maps.push(result.map);\n\n        const finalCode = injectSsrModuleId(\n          await resolveLazyModuleUrls(this, jsxCode, id),\n          moduleId,\n          !!isSsr,\n        );\n\n        return {\n          code: declineHmr ? finalCode + DOCUMENT_HMR_DECLINE : finalCode,\n          map: combineSourcemaps(maps),\n        };\n      }\n\n      // Babel JSX backend: one babel.transformAsync hosting the user's\n      // options plus @solidjs/babel-plugin. Appended to `plugins` (was the\n      // sole preset pre-rename): user plugins still run before it, user\n      // presets still run after — babel runs plugins before presets and\n      // presets in reverse order, so the pass order is unchanged.\n      const { transformAsync, solid } = await loadBabelJsx();\n      const babelOptions = mergeAndConcat(babelUserOptions, {\n        ...babelBaseOptions,\n        plugins: [[solid, solidOptions]],\n      }) as babel.TransformOptions;\n\n      const result = await transformAsync(code, babelOptions);\n      if (!result) {\n        return undefined;\n      }\n      const jsxCode = remapLocations(result.code || '', id);\n      maps.push(result.map);\n\n      const finalCode = injectSsrModuleId(\n        await resolveLazyModuleUrls(this, jsxCode, id),\n        moduleId,\n        !!isSsr,\n      );\n\n      return {\n        code: declineHmr ? finalCode + DOCUMENT_HMR_DECLINE : finalCode,\n        map: combineSourcemaps(maps),\n      };\n    },\n  };\n\n  // Hook filters (src/hook-filters.ts).\n  withFilter(mainPlugin, {\n    resolveId: { id: [TSRX_CSS_IDS, exactIds(VIRTUAL_MANIFEST_ID, VIRTUAL_MANIFEST_BRIDGE_ID)] },\n    load: {\n      id: [\n        TSRX_CSS_IDS,\n        exactIds(RESOLVED_VIRTUAL_MANIFEST_ID, RESOLVED_VIRTUAL_MANIFEST_BRIDGE_ID),\n      ],\n    },\n    transform: { id: { include: solidModuleIds, exclude: TSRX_CSS_IDS } },\n  });\n\n  // Ordinary modules need the directive transform before JSX. Authored TSRX\n  // cannot be parsed by that standalone pass, so its companion compiler runs\n  // after mainPlugin has lowered the file to ordinary JavaScript while keeping\n  // the original .tsrx id for stable server-function hashes.\n  const serverFunctionPlugins = options.serverFunctions\n    ? createServerFunctionsPlugins(\n        options.serverFunctions === true ? {} : options.serverFunctions,\n        {\n          devMiddleware: true,\n          externalDevServer,\n          tsrxAfterSolid: true,\n          tsrxSourceMap: options.compiler === 'babel',\n          frontendExtensions: frontends.map(([extension]) => extension),\n          // With start mode on (either variant), the dev middleware dispatches\n          // the endpoint through the SSR handler so user middleware and the\n          // stub-backed request event front it exactly like page SSR.\n          ...(startOptions ? { ssrHandler: SSR_HANDLER_ID } : {}),\n        },\n      )\n    : [];\n  // The TSRX compiler runs after Solid's (dev and build variants alike).\n  const tsrxServerFunctionPlugins = serverFunctionPlugins.filter(\n    (plugin) => plugin.name === 'solid:server-functions/tsrx-compiler',\n  );\n  const plugins: Plugin[] = [\n    boundaryModules(),\n    cssModuleClasses.plugin,\n    ...serverFunctionPlugins.filter((plugin) => !tsrxServerFunctionPlugins.includes(plugin)),\n    mainPlugin,\n    ...tsrxServerFunctionPlugins,\n  ];\n\n  // Typed env: config-time validation, the virtual:solid-env/{server,client}\n  // modules, generated types, and the client-bundle leak scan. An explicit\n  // `env` works in any setup; left unset, only start mode probes for the\n  // conventional env.ts / env.js.\n  if (startOptions && 'env' in startOptions) {\n    // Moved before the stable release, without an alias.\n    throw new Error(\n      '[@solidjs/vite-plugin] `start.env` has moved to the top-level `env` option. ' +\n        'Example: `solid({ start: { env: true } })` becomes `solid({ start: true, env: true })`.',\n    );\n  }\n  plugins.push(...envPlugin(options.env ?? (startOptions ? undefined : false)));\n\n  // The `start` option opts into start-mode serving on top of the transforms;\n  // the `ssr` boolean picks the mode (a bare `ssr: true` keeps the\n  // historical transform-only behavior).\n  if (startOptions) {\n    plugins.push(\n      ...startServe(startOptions, {\n        serverFunctions: !!options.serverFunctions,\n        // The mount the runtime is configured with (before `base`; the\n        // start plugin applies it): the preview middleware passes every\n        // response under it through uncompressed.\n        ...(options.serverFunctions\n          ? {\n              serverFunctionsEndpoint: normalizeServerFunctionsEndpoint(\n                options.serverFunctions === true ? undefined : options.serverFunctions.endpoint,\n              ),\n            }\n          : {}),\n        serverComponents,\n        ssr: !!options.ssr,\n        styleFilter: filterDevStyles,\n        diagnostics: diagnosticsEnabled ? (options.diagnostics ?? 'auto') : false,\n        performanceTracks: performanceTracksOptions !== null,\n        onDocumentResolved(documentPath) {\n          // Normalize to forward slashes to match Vite's transform ids.\n          documentModuleId = documentPath ? documentPath.split(path.sep).join('/') : null;\n        },\n        onClientEntryResolved(entryId) {\n          startClientEntryId = entryId;\n        },\n        onClientManifestOwned(owned) {\n          ownsClientManifest = owned;\n        },\n      }),\n    );\n  }\n\n  // Agent diagnostics endpoint + injected bridge (dev serve only — the\n  // plugin no-ops itself for builds and preview via `apply`, and in the\n  // default auto mode additionally disables itself unless the app has\n  // `@solidjs/diagnostics` installed).\n  if (diagnosticsEnabled) {\n    plugins.push(solidDiagnostics(options.diagnostics === true ? true : 'auto'));\n  }\n\n  // Chrome Performance panel tracks, on by default (dev serve only — the\n  // plugin no-ops itself for builds and preview via `apply`). Start mode\n  // imports the module from the client entry (`performanceTracks` above);\n  // plain apps get it from this plugin's `transformIndexHtml`.\n  if (performanceTracksOptions !== null) {\n    plugins.push(solidPerformanceTracks(performanceTracksOptions));\n  }\n\n  // Builder-mode (environments API) client-before-server build ordering.\n  // Server builds read the client manifest — `virtual:solid-manifest` bakes\n  // dist/client/.vite/manifest.json in, and the persisted server-function\n  // manifest merges the client build's discoveries — so the client\n  // environment must build first. Start mode's own orchestration already\n  // orders it that way (environment definition order), but a composed setup\n  // whose orchestrator builds server environments first (e.g.\n  // @cloudflare/vite-plugin's buildApp, which builds workers before client)\n  // would bake a manifest-less fallback into the server bundle. Every user\n  // of such a setup had to hand-write this ordering plugin; absorb it.\n  //\n  // Semantics:\n  // - The first hook builds the client environment first, but only where\n  //   the ordering matters: a client build that emits a manifest and\n  //   actually has an input. It runs at *normal* order, deliberately not\n  //   `pre`: pre-order buildApp hooks are where hosts do destructive\n  //   preparation — nitro v3's `nitro:prepare` rm -rf's the whole output\n  //   directory from a pre-order hook, so a pre-order client build sorted\n  //   before it built into a directory that was then wiped (client assets\n  //   and manifest gone, the manifest-less fallback baked into the server\n  //   bundle, prod 500s). Normal order still runs before every known\n  //   server-first orchestrator: a config-level `builder.buildApp`\n  //   (@cloudflare/vite-plugin's workers-before-client orchestrator) is\n  //   invoked by Vite only after all pre- and normal-order plugin hooks\n  //   (just before the first post-order hook), and hook-based orchestrators\n  //   (nitro's `nitro:main`, cloudflare's own companion hook) declare\n  //   post order. Orchestrators running after skip the client via `isBuilt`\n  //   (or at worst rebuild it, which is wasteful but correct — the manifest\n  //   exists either way when the server environments build).\n  // - Building anything from a hook suppresses Vite's own\n  //   build-all-environments fallback (it only runs when *no* environment\n  //   is built), so a setup with no real orchestrator — e.g. start mode's\n  //   plain `builder: {}` — would end up with only the client built. The\n  //   post-order hook reinstates exactly that fallback: when nothing but\n  //   our own client build has happened and no other plugin stakes a claim\n  //   on the app build, build the remaining environments in definition\n  //   order, precisely what Vite would have done. Another plugin declaring\n  //   a non-pre `buildApp` hook counts as such a claim even when it hasn't\n  //   built anything yet (its post-order hook may sort after ours):\n  //   building on its behalf would break staged orchestration (nitro\n  //   prerenders and copies public assets before its final server bundle)\n  //   and can error outright on environments the orchestrator knows to\n  //   skip (e.g. ones with no rollup input). Pre-order hooks don't count —\n  //   by convention they prepare (clean output dirs) rather than build.\n  if (options.ssr) {\n    let clientBuiltFirst = false;\n    plugins.push(\n      {\n        name: 'solid:client-build-first',\n        apply: 'build',\n        async buildApp(builder) {\n          const client = builder.environments.client;\n          if (!client || client.isBuilt) return;\n          const clientBuild = client.config.build;\n          const hasInput =\n            !!clientBuild.rollupOptions?.input ||\n            existsSync(path.resolve(builder.config.root, 'index.html'));\n          if (!clientBuild.manifest || !hasInput) return;\n          await builder.build(client);\n          clientBuiltFirst = true;\n        },\n      },\n      {\n        name: 'solid:client-build-first/complete',\n        apply: 'build',\n        buildApp: {\n          order: 'post',\n          async handler(builder) {\n            if (!clientBuiltFirst) return;\n            // Another plugin declares its own (non-pre) buildApp hook — the\n            // app build is spoken for, even if that hook sorts after this\n            // one and hasn't run yet.\n            const otherOrchestrator = builder.config.plugins.some((p) => {\n              if (!p.buildApp || p.name.startsWith('solid:client-build-first')) return false;\n              return typeof p.buildApp !== 'object' || p.buildApp.order !== 'pre';\n            });\n            if (otherOrchestrator) return;\n            const environments = Object.values(builder.environments);\n            // A config-level orchestrator built something of its own — the\n            // app build is spoken for, don't build environments it may have\n            // skipped intentionally.\n            if (environments.some((env) => env.isBuilt && env.name !== 'client')) return;\n            for (const environment of environments) {\n              if (!environment.isBuilt) await builder.build(environment);\n            }\n          },\n        },\n      },\n    );\n  }\n\n  // Vite evaluates a config file once per environment build; keep one instance's state.\n  for (const plugin of plugins) plugin.sharedDuringBuild = true;\n  return plugins;\n}\n\n/**\n * The parsed client build manifest that `virtual:solid-manifest` exports in\n * an SSR build, keyed by source path, plus the plugin's metadata keys.\n */\nexport type ViteManifest = Record<\n  string,\n  {\n    file: string;\n    css?: string[];\n    isEntry?: boolean;\n    isDynamicEntry?: boolean;\n    imports?: string[];\n  }\n> & {\n  _base?: string;\n  /**\n   * Manifest key of the client entry the document boots (the plugin's\n   * injected start-mode entry, or the single configured input). Absent when\n   * the plugin cannot tell the application entry apart from other configured\n   * inputs; its record is also serialized first so first-`isEntry` scans\n   * agree with it.\n   */\n  _entry?: string;\n  /**\n   * Never present on a build manifest. Declared so `if (manifest.resolve)`\n   * tells it apart from the dev `DevAssetResolver` that\n   * `virtual:solid-manifest` exports instead.\n   */\n  resolve?: undefined;\n  resolveSync?: undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,mBACd,KACA,SACA,KACS;CAIT,MAAM,WAAY,IAAI,QAAgD,YAClE,UACA;CAGJ,MAAM,OAAO,IAAI,QAAQ,QAAS,IAAI,QAAQ,iBAAwC;CACtF,MAAM,MAAM,mBAAmB,WAAW,IAAI,OAAO,KAAK,GAAG,SAAS,KAAK,MAAM;CACjF,MAAM,UAAU,IAAI,QAAQ;CAC5B,KAAK,MAAM,CAAC,KAAK,UA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