@stratal/inertia 0.0.27 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +359 -0
- package/README.md +158 -14
- package/dist/build-seo-tags-DBsHKxX9.mjs.map +1 -1
- package/dist/{decorate-B7nr7eBl.mjs → decorate-RQD1h28J.mjs} +1 -1
- package/dist/generator/type-generator.worker.d.mts +1 -1
- package/dist/generator/type-generator.worker.mjs +1 -1
- package/dist/index.d.mts +214 -92
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +390 -130
- package/dist/index.mjs.map +1 -1
- package/dist/quarry.d.mts +6 -8
- package/dist/quarry.d.mts.map +1 -1
- package/dist/quarry.mjs +127 -12
- package/dist/quarry.mjs.map +1 -1
- package/dist/react/access.d.mts +95 -0
- package/dist/react/access.d.mts.map +1 -0
- package/dist/react/access.mjs +133 -0
- package/dist/react/access.mjs.map +1 -0
- package/dist/react-dom-server-legacy-stub.d.mts +20 -0
- package/dist/react-dom-server-legacy-stub.d.mts.map +1 -0
- package/dist/react-dom-server-legacy-stub.mjs +25 -0
- package/dist/react-dom-server-legacy-stub.mjs.map +1 -0
- package/dist/react.d.mts +4 -6
- package/dist/react.d.mts.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/seo-runtime.d.mts +1 -1
- package/dist/seo-runtime.mjs +8 -6
- package/dist/seo-runtime.mjs.map +1 -1
- package/dist/services/ssr-exclusion.d.mts +38 -0
- package/dist/services/ssr-exclusion.d.mts.map +1 -0
- package/dist/services/ssr-exclusion.mjs +0 -0
- package/dist/services/ssr-exclusion.mjs.map +1 -0
- package/dist/ssr.d.mts +37 -8
- package/dist/ssr.d.mts.map +1 -1
- package/dist/ssr.mjs +7 -4
- package/dist/ssr.mjs.map +1 -1
- package/dist/testing.d.mts +3 -2
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +20 -6
- package/dist/testing.mjs.map +1 -1
- package/dist/{type-generator-DFpha_Fp.mjs → type-generator-BVw8mj1y.mjs} +373 -64
- package/dist/type-generator-BVw8mj1y.mjs.map +1 -0
- package/dist/types-BltKoOR7.d.mts +193 -0
- package/dist/types-BltKoOR7.d.mts.map +1 -0
- package/dist/types-D-j_Ee_h.d.mts +52 -0
- package/dist/types-D-j_Ee_h.d.mts.map +1 -0
- package/dist/types-DzE1pdZs.d.mts.map +1 -1
- package/dist/vite.d.mts +19 -6
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +67 -5
- package/dist/vite.mjs.map +1 -1
- package/package.json +38 -27
- package/dist/type-generator-DFpha_Fp.mjs.map +0 -1
- package/dist/types-BhgXhWx6.d.mts +0 -82
- package/dist/types-BhgXhWx6.d.mts.map +0 -1
package/dist/vite.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.mjs","names":["URL"],"sources":["../src/vite/inertia-dev-css-plugin.ts","../src/vite/type-gen-dispatcher.ts","../src/vite/inertia-types-plugin.ts","../src/vite.ts"],"sourcesContent":["import type { ModuleNode, Plugin, ViteDevServer } from 'vite'\n\nconst CSS_LANGS_RE = /\\.(css|scss|sass|less|styl|stylus|pcss|postcss)(?:$|\\?)/\nconst VIRTUAL_MODULE_ID = 'virtual:inertia-ssr.css'\nconst RESOLVED_VIRTUAL_MODULE_ID = '\\0' + VIRTUAL_MODULE_ID\n\nexport interface InertiaDevCssOptions {\n entries: string[]\n}\n\nfunction collectStyleUrls(server: ViteDevServer, entries: string[]): string[] {\n const urls: string[] = []\n const visited = new Set<string>()\n\n function traverse(mod: ModuleNode) {\n if (visited.has(mod.url)) return\n visited.add(mod.url)\n\n if (CSS_LANGS_RE.test(mod.url)) {\n urls.push(mod.url)\n }\n\n for (const imported of mod.importedModules) {\n traverse(imported)\n }\n }\n\n for (const entry of entries) {\n const mod = server.moduleGraph.getModulesByFile(\n entry.startsWith('/') ? entry.slice(1) : entry,\n )\n\n if (mod) {\n for (const m of mod) {\n traverse(m)\n }\n }\n\n const urlMod = server.moduleGraph.urlToModuleMap.get(entry)\n if (urlMod) {\n traverse(urlMod)\n }\n }\n\n return urls\n}\n\nasync function collectStyle(server: ViteDevServer, entries: string[]): Promise<string> {\n for (const entry of entries) {\n try {\n await server.transformRequest(entry)\n }\n catch {\n //\n }\n }\n\n const urls = collectStyleUrls(server, entries)\n const styles: string[] = []\n\n for (const url of urls) {\n try {\n const separator = url.includes('?') ? '&' : '?'\n const result = await server.transformRequest(url + separator + 'direct')\n if (result?.code) {\n styles.push(result.code)\n }\n }\n catch {\n //\n }\n }\n\n return styles.join('\\n')\n}\n\nexport function stratalInertiaDevCss(options: InertiaDevCssOptions): Plugin {\n let server: ViteDevServer\n let cachedCss: string | null = null\n let inflight: Promise<string> | null = null\n let cacheEpoch = 0\n\n function invalidate(): void {\n cachedCss = null\n cacheEpoch++\n }\n\n async function getCss(): Promise<string> {\n if (cachedCss !== null) return cachedCss\n if (inflight) return inflight\n const epoch = cacheEpoch\n inflight = collectStyle(server, options.entries)\n .then((css) => {\n // Drop stale result if invalidated mid-flight, so the next caller re-collects.\n if (epoch === cacheEpoch) cachedCss = css\n return css\n })\n .finally(() => {\n inflight = null\n })\n return inflight\n }\n\n return {\n name: 'stratal:inertia-dev-css',\n apply: 'serve',\n\n resolveId(id) {\n if (id === VIRTUAL_MODULE_ID) {\n return RESOLVED_VIRTUAL_MODULE_ID\n }\n },\n\n async load(id) {\n if (id === RESOLVED_VIRTUAL_MODULE_ID) {\n return await getCss()\n }\n },\n\n handleHotUpdate() {\n // JS/TS edits can add or remove CSS imports, which changes the SSR CSS graph\n // without the changed file itself matching CSS_LANGS_RE. Invalidate on every\n // HMR tick — collectStyle() is fast and dev-only.\n invalidate()\n },\n\n configureServer(devServer) {\n server = devServer\n\n server.middlewares.use((req, res, next) => {\n const pathname = new URL(req.url ?? '', 'http://localhost').pathname\n if (pathname !== '/__inertia/ssr-css') { next(); return; }\n\n getCss().then((css) => {\n res.setHeader('Content-Type', 'text/css')\n res.setHeader('Cache-Control', 'no-store')\n res.end(css)\n }).catch(() => {\n res.statusCode = 500\n res.end('')\n })\n })\n },\n }\n}\n","import { URL } from 'node:url'\nimport { Worker } from 'node:worker_threads'\n\nexport interface TypeGenWorkerResult {\n ok: boolean\n outputPath?: string\n pageCount?: number\n error?: string\n}\n\nexport interface TypeGenWorkerHandle {\n on(event: 'message', cb: (m: TypeGenWorkerResult) => void): this\n on(event: 'error', cb: (e: Error) => void): this\n on(event: 'exit', cb: (code: number) => void): this\n terminate(): Promise<number> | number\n}\n\nexport type TypeGenWorkerSpawner = (cwd: string) => TypeGenWorkerHandle\n\nexport interface TypeGenDispatcher {\n schedule(): void\n dispose(): Promise<void>\n}\n\nexport interface TypeGenDispatcherOptions {\n cwd: string\n spawn?: TypeGenWorkerSpawner\n debounceMs?: number\n onResult?: (result: TypeGenWorkerResult) => void\n onError?: (error: Error) => void\n}\n\nconst defaultSpawn: TypeGenWorkerSpawner = (cwd) =>\n new Worker(new URL('./generator/type-generator.worker.mjs', import.meta.url), {\n workerData: { cwd },\n })\n\nexport function createTypeGenDispatcher(options: TypeGenDispatcherOptions): TypeGenDispatcher {\n const spawn = options.spawn ?? defaultSpawn\n const debounceMs = options.debounceMs ?? 250\n\n let pendingTimer: ReturnType<typeof setTimeout> | null = null\n let inflight: TypeGenWorkerHandle | null = null\n let queued = false\n let disposed = false\n\n function fire() {\n pendingTimer = null\n if (disposed) return\n if (inflight) {\n queued = true\n return\n }\n\n const worker = spawn(options.cwd)\n inflight = worker\n\n const finish = () => {\n if (inflight === worker) inflight = null\n if (disposed) return\n if (queued) {\n queued = false\n fire()\n }\n }\n\n worker.on('message', (msg) => {\n // `exit` will follow; finish() runs there so terminate() has settled before the next spawn.\n options.onResult?.(msg)\n })\n\n worker.on('error', (err) => {\n options.onError?.(err)\n })\n\n worker.on('exit', () => {\n finish()\n })\n }\n\n return {\n schedule() {\n if (disposed) return\n if (inflight) {\n queued = true\n return\n }\n if (pendingTimer) clearTimeout(pendingTimer)\n pendingTimer = setTimeout(fire, debounceMs)\n },\n\n async dispose() {\n disposed = true\n queued = false\n if (pendingTimer) {\n clearTimeout(pendingTimer)\n pendingTimer = null\n }\n const worker = inflight\n inflight = null\n if (worker) {\n try {\n await worker.terminate()\n } catch {\n // ignore\n }\n }\n },\n }\n}\n","import { existsSync, readFileSync } from 'node:fs'\nimport { join, relative } from 'node:path'\nimport type { Plugin } from 'vite'\nimport { findPagesDir, runTypeGeneration } from '../generator/type-generator'\nimport { createTypeGenDispatcher, type TypeGenDispatcher } from './type-gen-dispatcher'\n\nconst INERTIA_CALL_PATTERN = /ctx\\.inertia\\(|\\.share\\(|ctx\\.flash\\(|ctx\\.defer\\(|ctx\\.optional\\(|ctx\\.merge\\(|ctx\\.once\\(|ctx\\.always\\(/\n\nexport function stratalInertiaTypes(): Plugin {\n let cwd: string\n let pagesDir: string\n let srcDir: string\n let dispatcher: TypeGenDispatcher | null = null\n\n return {\n name: 'stratal:inertia-types',\n\n configResolved(config) {\n cwd = config.root\n pagesDir = findPagesDir(cwd) + '/'\n srcDir = join(cwd, 'src') + '/'\n dispatcher = createTypeGenDispatcher({\n cwd,\n onError(err) {\n console.warn('[stratal:inertia-types] Type generation worker errored:', err.message)\n },\n onResult(result) {\n if (!result.ok && result.error) {\n console.warn('[stratal:inertia-types] Type generation failed:', result.error)\n }\n },\n })\n },\n\n async buildStart() {\n if (!existsSync(pagesDir)) return\n try {\n await runTypeGeneration(cwd)\n } catch (error) {\n console.warn('[stratal:inertia-types] Type generation failed during build:', error)\n }\n },\n\n handleHotUpdate({ file }) {\n if (!dispatcher) return\n if (!/\\.(tsx|ts)$/.test(file)) return\n\n const relToSrc = relative(srcDir, file)\n const isInSrc = !relToSrc.startsWith('..')\n\n if (!isInSrc) return\n\n // Page files always trigger regeneration\n const relToPages = relative(pagesDir, file)\n const isPageFile = !relToPages.startsWith('..')\n\n if (!isPageFile) {\n // For non-page files, only regenerate if they contain inertia-related calls\n try {\n const content = readFileSync(file, 'utf-8')\n if (!INERTIA_CALL_PATTERN.test(content)) return\n } catch {\n return\n }\n }\n\n dispatcher.schedule()\n },\n\n async closeBundle() {\n if (dispatcher) {\n await dispatcher.dispose()\n dispatcher = null\n }\n },\n }\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { isAbsolute, join } from 'node:path';\nimport type { EnvironmentOptions, Plugin } from 'vite';\nimport { stratalInertiaDevCss } from './vite/inertia-dev-css-plugin';\nimport { stratalInertiaTypes } from './vite/inertia-types-plugin';\n\nexport { stratalInertiaDevCss, stratalInertiaTypes };\n\nexport interface StratalInertiaPluginOptions {\n /** Client entry path(s) for CSS collection (default: ['/src/inertia/app.tsx']) */\n entries?: string[]\n /**\n * Whether to emit sourcemaps in `vite build`. Default: `'dev-and-staging'`\n * — sourcemaps in development and staging deploys for debugging, but never\n * in production (which would inflate the worker upload).\n *\n * - `true` / `false` — force on / off\n * - `'dev-and-staging'` — on unless `CLOUDFLARE_ENV === 'prod'`\n */\n sourcemap?: boolean | 'dev-and-staging'\n /**\n * Path (relative to project root) to the Vite client manifest emitted by\n * the standalone browser-bundle build phase. The injector plugin reads it\n * during the worker build and inlines it onto the worker entry chunk so\n * `ManifestService` can resolve hashed asset URLs at runtime.\n *\n * Default: `'dist/client/.vite/manifest.json'` — matches the layout\n * `quarry inertia:build` produces.\n */\n clientManifestPath?: string\n}\n\nexport function stratalInertia(options?: StratalInertiaPluginOptions): Plugin[] {\n const entries = options?.entries ?? ['/src/inertia/app.tsx']\n const sourcemapOption = options?.sourcemap ?? 'dev-and-staging'\n const sourcemap = sourcemapOption === 'dev-and-staging'\n ? process.env.CLOUDFLARE_ENV !== 'prod' && process.env.CLOUDFLARE_ENV! !== 'production'\n : sourcemapOption\n\n // Hono and stratal must NOT be pre-bundled by Vite's optimizeDeps. When they are,\n // a duplicate copy ends up in `.vite/deps_<env>/` while the worker bundle imports\n // another copy from node_modules — Response objects from one instance flow into\n // a Context class from the other, and Hono's `set res` setter crashes inside\n // `this.#res.headers.entries()` because the prototype chain doesn't match.\n //\n // React 19 ships its main entry as CJS and relies on the optimizer's CJS→ESM\n // conversion, so it cannot be excluded outright. To prevent the related\n // identity-mismatch bug (two `?v=<hash>` copies after the optimizer re-runs\n // when a new dep is auto-discovered), the React-ecosystem packages are listed\n // in `resolve.noExternal` so Vite treats them as part of the user module graph\n // and `resolve.dedupe` so all imports collapse to a single physical copy.\n const optimizeDepsExclude = [\n '@cloudflare/vite-plugin',\n 'wrangler',\n 'blake3-wasm',\n '@stratal/inertia',\n 'stratal',\n 'hono',\n '@hono/zod-openapi',\n '@hono/swagger-ui',\n ]\n const dedupe = [\n 'react',\n 'react-dom',\n 'react-is',\n 'scheduler',\n '@inertiajs/core',\n '@inertiajs/react',\n ]\n const noExternal = [\n 'react',\n 'react-dom',\n 'react-is',\n 'scheduler',\n 'use-sync-external-store',\n '@inertiajs/core',\n '@inertiajs/react',\n ]\n const optimizeDepsInclude = ['buffer', 'buffer/', 'base64-js', 'ieee754']\n // Dev/build-time-only packages that must never reach the worker or browser\n // bundle. `ts-morph` is used by the type generator. The langium / zenstack\n // CLI/SDK group is dragged in transitively by ZenStack's runtime barrel\n // (e.g. `@zenstackhq/better-auth` imports a `schema-generator` that\n // references `@zenstackhq/language` which depends on `langium`); no actual\n // runtime code path executes any of it. If a future refactor genuinely\n // needs one of these at runtime, this list should be revisited explicitly.\n const devOnlyExternals: (string | RegExp)[] = [\n 'ts-morph',\n /^langium($|\\/)/,\n /^@zenstackhq\\/cli($|\\/)/,\n /^@zenstackhq\\/language($|\\/)/,\n /^@zenstackhq\\/sdk($|\\/)/,\n ]\n\n const clientManifestPath = options?.clientManifestPath ?? 'dist/client/.vite/manifest.json'\n\n return [\n stratalInertiaDevCss({ entries }),\n stratalInertiaTypes(),\n {\n name: 'stratal:optimize-deps-fix',\n config(config) {\n config.publicDir ??= 'src/inertia/public';\n },\n configEnvironment(name: string, env: EnvironmentOptions) {\n const existing = env.optimizeDeps?.exclude ?? []\n const existingInclude = env.optimizeDeps?.include ?? []\n env.optimizeDeps = {\n ...env.optimizeDeps,\n exclude: [...existing, ...optimizeDepsExclude],\n include: [...existingInclude, ...optimizeDepsInclude],\n }\n\n const existingDedupe = env.resolve?.dedupe ?? []\n const existingNoExternal = env.resolve?.noExternal\n const mergedNoExternal: (string | RegExp)[] = [\n ...(Array.isArray(existingNoExternal)\n ? existingNoExternal\n : typeof existingNoExternal === 'string' || existingNoExternal instanceof RegExp\n ? [existingNoExternal]\n : []),\n ...noExternal,\n ]\n env.resolve = {\n ...env.resolve,\n dedupe: [...existingDedupe, ...dedupe],\n noExternal: existingNoExternal === true ? true : mergedNoExternal,\n }\n\n const existingExternal = env.build?.rolldownOptions?.external\n const existingExternalArray: (string | RegExp)[] = Array.isArray(existingExternal)\n ? (existingExternal as (string | RegExp)[])\n : existingExternal != null\n ? [existingExternal as string | RegExp]\n : []\n env.build = {\n ...env.build,\n // Only override sourcemap when the user hasn't set it explicitly,\n // so a per-app `build.sourcemap` in vite.config.ts still wins.\n sourcemap: env.build?.sourcemap ?? sourcemap,\n rolldownOptions: {\n ...env.build?.rolldownOptions,\n external: [...existingExternalArray, ...devOnlyExternals],\n },\n }\n\n // `quarry inertia:build` runs a standalone client build (phase 1) that\n // emits the browser bundle + manifest to dist/client/ before invoking\n // this worker build (phase 2). `@cloudflare/vite-plugin`'s `buildApp`\n // then runs a \"fallback\" build for its own `client` env (because no\n // input is set on it here) which, with Vite's default\n // `build.emptyOutDir = true` for in-root outDirs, would wipe phase 1's\n // chunks. Pinning `emptyOutDir = false` for the client env preserves\n // the browser bundle so CF's asset binding can serve `/assets/app-<hash>.js`.\n if (name === 'client') {\n env.build.emptyOutDir = false\n }\n },\n },\n injectSeoRuntime({ entries }),\n injectClientManifestIntoWorker({ clientManifestPath }),\n ]\n}\n\n// Injects the client-side SEO head-sync runtime into the browser entry so\n// backend `ctx.seo()` metadata stays in sync across Inertia navigations with\n// zero app wiring. The runtime is a side-effect import (`@stratal/inertia/seo-runtime`)\n// prepended to each configured client entry; it only reaches the browser bundle\n// because the worker/SSR builds never transform these entry files.\nfunction injectSeoRuntime(args: { entries: string[] }): Plugin {\n const runtime = '@stratal/inertia/seo-runtime'\n const targets = args.entries.map((entry) => entry.replace(/^\\//, ''))\n\n return {\n name: 'stratal:inertia-inject-seo-runtime',\n transform(code, id) {\n const file = id.split('?')[0]\n if (!targets.some((target) => file.endsWith(target))) return null\n if (code.includes(runtime)) return null\n return { code: `import '${runtime}';\\n${code}`, map: null }\n },\n }\n}\n\n// Reads the manifest produced by the standalone browser-bundle build (run\n// before this build by `quarry inertia:build`) and inlines it onto the worker\n// entry chunk as `globalThis.__STRATAL_INERTIA_MANIFEST__`. The manifest must\n// be inlined in the bundle itself — Cloudflare Workers have no filesystem at\n// runtime — so `ManifestService` can resolve hashed asset URLs without any\n// consumer-side wiring.\nfunction injectClientManifestIntoWorker(args: { clientManifestPath: string }): Plugin {\n let projectRoot = process.cwd()\n\n return {\n name: 'stratal:inertia-inject-manifest',\n apply: 'build',\n configResolved(config) {\n projectRoot = config.root\n },\n generateBundle(_options, bundle) {\n // Only inject into worker / SSR bundles. The browser-bundle build runs\n // in a separate `vite build` invocation and never reaches this plugin.\n if (this.environment.name === 'client') return\n\n const manifestPath = isAbsolute(args.clientManifestPath)\n ? args.clientManifestPath\n : join(projectRoot, args.clientManifestPath)\n\n if (!existsSync(manifestPath)) {\n this.error(\n '@stratal/inertia: client manifest not found at ' + manifestPath\n + '. Run `quarry inertia:build` to build the browser bundle before deploying.',\n )\n }\n\n const manifestJson = readFileSync(manifestPath, 'utf-8')\n // Parse + re-stringify so a malformed manifest fails loudly here rather\n // than at worker boot, and so the inlined value is normalized.\n const manifest = JSON.parse(manifestJson) as unknown\n const inlined = JSON.stringify(manifest)\n const sentinel = 'globalThis.__STRATAL_INERTIA_MANIFEST__'\n\n for (const fileName of Object.keys(bundle)) {\n const chunk = bundle[fileName]\n if (chunk.type !== 'chunk') continue\n if (!ch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GAAG,EAAE;GAC3B,IAAI,CAAC,QAAQ,MAAM,WAAW,KAAK,SAAS,MAAM,CAAC,GAAG,OAAO;GAC7D,IAAI,KAAK,SAAS,OAAO,GAAG,OAAO;GACnC,OAAO;IAAE,MAAM,WAAW,QAAQ,MAAM;IAAQ,KAAK;GAAK;EAC5D;CACF;AACF;AAQA,SAAS,+BAA+B,MAA8C;CACpF,IAAI,cAAc,QAAQ,IAAI;CAE9B,OAAO;EACL,MAAM;EACN,OAAO;EACP,eAAe,QAAQ;GACrB,cAAc,OAAO;EACvB;EACA,eAAe,UAAU,QAAQ;GAG/B,IAAI,KAAK,YAAY,SAAS,UAAU;GAExC,MAAM,eAAe,WAAW,KAAK,kBAAkB,IACnD,KAAK,qBACL,KAAK,aAAa,KAAK,kBAAkB;GAE7C,IAAI,CAAC,WAAW,YAAY,GAC1B,KAAK,MACH,oDAAoD,eAClD,4EACJ;GAGF,MAAM,eAAe,aAAa,cAAc,OAAO;GAGvD,MAAM,WAAW,KAAK,MAAM,YAAY;GACxC,MAAM,UAAU,KAAK,UAAU,QAAQ;GACvC,MAAM,WAAW;GAEjB,KAAK,MAAM,YAAY,OAAO,KAAK,MAAM,GAAG;IAC1C,MAAM,QAAQ,OAAO;IACrB,IAAI,MAAM,SAAS,SAAS;IAC5B,IAAI,CAAC,MAAM,SAAS;IACpB,IAAI,MAAM,KAAK,WAAW,QAAQ,GAAG;IACrC,MAAM,OAAO,GAAG,SAAS,KAAK,QAAQ,KAAK,MAAM;GACnD;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"vite.mjs","names":["URL"],"sources":["../src/vite/inertia-dev-css-plugin.ts","../src/vite/type-gen-dispatcher.ts","../src/vite/inertia-types-plugin.ts","../src/vite.ts"],"sourcesContent":["import type { ModuleNode, Plugin, ViteDevServer } from 'vite'\n\nconst CSS_LANGS_RE = /\\.(css|scss|sass|less|styl|stylus|pcss|postcss)(?:$|\\?)/\nconst VIRTUAL_MODULE_ID = 'virtual:inertia-ssr.css'\nconst RESOLVED_VIRTUAL_MODULE_ID = '\\0' + VIRTUAL_MODULE_ID\n\nexport interface InertiaDevCssOptions {\n entries: string[]\n}\n\nfunction collectStyleUrls(server: ViteDevServer, entries: string[]): string[] {\n const urls: string[] = []\n const visited = new Set<string>()\n\n function traverse(mod: ModuleNode) {\n if (visited.has(mod.url)) return\n visited.add(mod.url)\n\n if (CSS_LANGS_RE.test(mod.url)) {\n urls.push(mod.url)\n }\n\n for (const imported of mod.importedModules) {\n traverse(imported)\n }\n }\n\n for (const entry of entries) {\n const mod = server.moduleGraph.getModulesByFile(\n entry.startsWith('/') ? entry.slice(1) : entry,\n )\n\n if (mod) {\n for (const m of mod) {\n traverse(m)\n }\n }\n\n const urlMod = server.moduleGraph.urlToModuleMap.get(entry)\n if (urlMod) {\n traverse(urlMod)\n }\n }\n\n return urls\n}\n\nasync function collectStyle(server: ViteDevServer, entries: string[]): Promise<string> {\n for (const entry of entries) {\n try {\n await server.transformRequest(entry)\n }\n catch {\n //\n }\n }\n\n const urls = collectStyleUrls(server, entries)\n const styles: string[] = []\n\n for (const url of urls) {\n try {\n const separator = url.includes('?') ? '&' : '?'\n const result = await server.transformRequest(url + separator + 'direct')\n if (result?.code) {\n styles.push(result.code)\n }\n }\n catch {\n //\n }\n }\n\n return styles.join('\\n')\n}\n\nexport function stratalInertiaDevCss(options: InertiaDevCssOptions): Plugin {\n let server: ViteDevServer\n let cachedCss: string | null = null\n let inflight: Promise<string> | null = null\n let cacheEpoch = 0\n\n function invalidate(): void {\n cachedCss = null\n cacheEpoch++\n }\n\n async function getCss(): Promise<string> {\n if (cachedCss !== null) return cachedCss\n if (inflight) return inflight\n const epoch = cacheEpoch\n inflight = collectStyle(server, options.entries)\n .then((css) => {\n // Drop stale result if invalidated mid-flight, so the next caller re-collects.\n if (epoch === cacheEpoch) cachedCss = css\n return css\n })\n .finally(() => {\n inflight = null\n })\n return inflight\n }\n\n return {\n name: 'stratal:inertia-dev-css',\n apply: 'serve',\n\n resolveId(id) {\n if (id === VIRTUAL_MODULE_ID) {\n return RESOLVED_VIRTUAL_MODULE_ID\n }\n },\n\n async load(id) {\n if (id === RESOLVED_VIRTUAL_MODULE_ID) {\n return await getCss()\n }\n },\n\n handleHotUpdate() {\n // JS/TS edits can add or remove CSS imports, which changes the SSR CSS graph\n // without the changed file itself matching CSS_LANGS_RE. Invalidate on every\n // HMR tick — collectStyle() is fast and dev-only.\n invalidate()\n },\n\n configureServer(devServer) {\n server = devServer\n\n server.middlewares.use((req, res, next) => {\n const pathname = new URL(req.url ?? '', 'http://localhost').pathname\n if (pathname !== '/__inertia/ssr-css') { next(); return; }\n\n getCss().then((css) => {\n res.setHeader('Content-Type', 'text/css')\n res.setHeader('Cache-Control', 'no-store')\n res.end(css)\n }).catch(() => {\n res.statusCode = 500\n res.end('')\n })\n })\n },\n }\n}\n","import { URL } from 'node:url'\nimport { Worker } from 'node:worker_threads'\n\nexport interface TypeGenWorkerResult {\n ok: boolean\n outputPath?: string\n pageCount?: number\n error?: string\n}\n\nexport interface TypeGenWorkerHandle {\n on(event: 'message', cb: (m: TypeGenWorkerResult) => void): this\n on(event: 'error', cb: (e: Error) => void): this\n on(event: 'exit', cb: (code: number) => void): this\n terminate(): Promise<number> | number\n}\n\nexport type TypeGenWorkerSpawner = (cwd: string) => TypeGenWorkerHandle\n\nexport interface TypeGenDispatcher {\n schedule(): void\n dispose(): Promise<void>\n}\n\nexport interface TypeGenDispatcherOptions {\n cwd: string\n spawn?: TypeGenWorkerSpawner\n debounceMs?: number\n onResult?: (result: TypeGenWorkerResult) => void\n onError?: (error: Error) => void\n}\n\nconst defaultSpawn: TypeGenWorkerSpawner = (cwd) =>\n new Worker(new URL('./generator/type-generator.worker.mjs', import.meta.url), {\n workerData: { cwd },\n })\n\nexport function createTypeGenDispatcher(options: TypeGenDispatcherOptions): TypeGenDispatcher {\n const spawn = options.spawn ?? defaultSpawn\n const debounceMs = options.debounceMs ?? 250\n\n let pendingTimer: ReturnType<typeof setTimeout> | null = null\n let inflight: TypeGenWorkerHandle | null = null\n let queued = false\n let disposed = false\n\n function fire() {\n pendingTimer = null\n if (disposed) return\n if (inflight) {\n queued = true\n return\n }\n\n const worker = spawn(options.cwd)\n inflight = worker\n\n const finish = () => {\n if (inflight === worker) inflight = null\n if (disposed) return\n if (queued) {\n queued = false\n fire()\n }\n }\n\n worker.on('message', (msg) => {\n // `exit` will follow; finish() runs there so terminate() has settled before the next spawn.\n options.onResult?.(msg)\n })\n\n worker.on('error', (err) => {\n options.onError?.(err)\n })\n\n worker.on('exit', () => {\n finish()\n })\n }\n\n return {\n schedule() {\n if (disposed) return\n if (inflight) {\n queued = true\n return\n }\n if (pendingTimer) clearTimeout(pendingTimer)\n pendingTimer = setTimeout(fire, debounceMs)\n },\n\n async dispose() {\n disposed = true\n queued = false\n if (pendingTimer) {\n clearTimeout(pendingTimer)\n pendingTimer = null\n }\n const worker = inflight\n inflight = null\n if (worker) {\n try {\n await worker.terminate()\n } catch {\n // ignore\n }\n }\n },\n }\n}\n","import { existsSync, readFileSync } from 'node:fs'\nimport { join, relative } from 'node:path'\nimport type { Plugin } from 'vite'\nimport { findPagesDir, runTypeGeneration } from '../generator/type-generator'\nimport { createTypeGenDispatcher, type TypeGenDispatcher } from './type-gen-dispatcher'\n\nconst INERTIA_CALL_PATTERN = /ctx\\.inertia\\(|\\.share\\(|ctx\\.flash\\(|ctx\\.defer\\(|ctx\\.optional\\(|ctx\\.merge\\(|ctx\\.once\\(|ctx\\.always\\(/\n\nexport function stratalInertiaTypes(): Plugin {\n let cwd: string\n let pagesDir: string\n let srcDir: string\n let dispatcher: TypeGenDispatcher | null = null\n\n return {\n name: 'stratal:inertia-types',\n\n configResolved(config) {\n cwd = config.root\n pagesDir = findPagesDir(cwd) + '/'\n srcDir = join(cwd, 'src') + '/'\n dispatcher = createTypeGenDispatcher({\n cwd,\n onError(err) {\n console.warn('[stratal:inertia-types] Type generation worker errored:', err.message)\n },\n onResult(result) {\n if (!result.ok && result.error) {\n console.warn('[stratal:inertia-types] Type generation failed:', result.error)\n }\n },\n })\n },\n\n async buildStart() {\n if (!existsSync(pagesDir)) return\n try {\n await runTypeGeneration(cwd)\n } catch (error) {\n console.warn('[stratal:inertia-types] Type generation failed during build:', error)\n }\n },\n\n handleHotUpdate({ file }) {\n if (!dispatcher) return\n if (!/\\.(tsx|ts)$/.test(file)) return\n\n const relToSrc = relative(srcDir, file)\n const isInSrc = !relToSrc.startsWith('..')\n\n if (!isInSrc) return\n\n // Page files always trigger regeneration\n const relToPages = relative(pagesDir, file)\n const isPageFile = !relToPages.startsWith('..')\n\n if (!isPageFile) {\n // For non-page files, only regenerate if they contain inertia-related calls\n try {\n const content = readFileSync(file, 'utf-8')\n if (!INERTIA_CALL_PATTERN.test(content)) return\n } catch {\n return\n }\n }\n\n dispatcher.schedule()\n },\n\n async closeBundle() {\n if (dispatcher) {\n await dispatcher.dispose()\n dispatcher = null\n }\n },\n }\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { isAbsolute, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Alias, EnvironmentOptions, Plugin } from 'vite';\nimport { stratalInertiaDevCss } from './vite/inertia-dev-css-plugin';\nimport { stratalInertiaTypes } from './vite/inertia-types-plugin';\n\n// Absolute path to the build-time stub that replaces react-dom's legacy\n// synchronous server renderer in the worker SSR bundle (see the stub module\n// and `reactDomServerLegacyAlias` for why). Resolves to the sibling\n// `dist/react-dom-server-legacy-stub.mjs` of the built `dist/vite.mjs`.\nconst reactDomServerLegacyStub = fileURLToPath(\n new URL('./react-dom-server-legacy-stub.mjs', import.meta.url),\n)\n\n// react-dom/server (workerd → server.edge.js) CJS-`require()`s the synchronous\n// legacy renderer alongside the streaming one; the require defeats tree-shaking,\n// so the unused ~200 KB legacy build ships in every worker. Redirect it to the\n// stub. The find matches the whole specifier (relative require or absolute id)\n// so the replacement fully replaces it.\nconst reactDomServerLegacyAlias: Alias = {\n find: /^.*react-dom-server-legacy\\.browser\\.(?:production|development)\\.js$/,\n replacement: reactDomServerLegacyStub,\n}\n\n// Packages reachable only through the optimize-excluded packages below — the\n// data-layer ORM and the email renderer — ship CJS that the dep scanner never\n// auto-discovers and that the workerd runner cannot evaluate. Force-optimize\n// each, but only when it resolves from the project (both are optional).\nconst optionalCjsOptimizeTargets = ['@zenstackhq/orm', '@react-email/render']\n\n// Subset of `specifiers` that resolves from `root`'s module graph.\nfunction resolvableFrom(root: string, specifiers: string[]): string[] {\n const requireFrom = createRequire(join(root, 'package.json'))\n return specifiers.filter((specifier) => {\n try {\n requireFrom.resolve(specifier)\n return true\n } catch {\n return false\n }\n })\n}\n\nexport { stratalInertiaDevCss, stratalInertiaTypes };\n\nexport interface StratalInertiaPluginOptions {\n /** Client entry path(s) for CSS collection (default: ['/src/inertia/app.tsx']) */\n entries?: string[]\n /**\n * Whether to emit sourcemaps in `vite build`. Default: `'dev-and-staging'`\n * — sourcemaps in development and staging deploys for debugging, but never\n * in production (which would inflate the worker upload).\n *\n * - `true` / `false` — force on / off\n * - `'dev-and-staging'` — on unless `CLOUDFLARE_ENV === 'prod'`\n */\n sourcemap?: boolean | 'dev-and-staging'\n /**\n * Path (relative to project root) to the Vite client manifest emitted by\n * the standalone browser-bundle build phase. The injector plugin reads it\n * during the worker build and inlines it onto the worker entry chunk so\n * `ManifestService` can resolve hashed asset URLs at runtime.\n *\n * Default: `'dist/client/.vite/manifest.json'` — matches the layout\n * `quarry inertia:build` produces.\n */\n clientManifestPath?: string\n /**\n * Page-component globs to exclude from server-side rendering, e.g.\n * `['Admin/**', 'Reports/Heavy']`. Patterns match Inertia component names —\n * the `./pages/<name>.tsx` glob key with the `./pages/` prefix and `.tsx`\n * suffix stripped:\n *\n * - `*` matches a single path segment (no `/`)\n * - `**` matches any number of segments (including `/`)\n *\n * Excluded pages are dropped from the worker/SSR bundle entirely (smaller cold\n * start) and rendered client-only at runtime; the browser bundle still includes\n * them so they hydrate normally. Requires the conventional\n * `import.meta.glob('./pages/**\\/*.tsx')` page resolver in the SSR entry.\n */\n ssrExclude?: string[]\n}\n\nexport function stratalInertia(options?: StratalInertiaPluginOptions): Plugin[] {\n const entries = options?.entries ?? ['/src/inertia/app.tsx']\n const sourcemapOption = options?.sourcemap ?? 'dev-and-staging'\n const sourcemap = sourcemapOption === 'dev-and-staging'\n ? process.env.CLOUDFLARE_ENV !== 'prod' && process.env.CLOUDFLARE_ENV! !== 'production'\n : sourcemapOption\n\n // Hono and stratal must NOT be pre-bundled by Vite's optimizeDeps. When they are,\n // a duplicate copy ends up in `.vite/deps_<env>/` while the worker bundle imports\n // another copy from node_modules — Response objects from one instance flow into\n // a Context class from the other, and Hono's `set res` setter crashes inside\n // `this.#res.headers.entries()` because the prototype chain doesn't match.\n //\n // React 19 ships its main entry as CJS and relies on the optimizer's CJS→ESM\n // conversion, so it cannot be excluded outright. To prevent the related\n // identity-mismatch bug (two `?v=<hash>` copies after the optimizer re-runs\n // when a new dep is auto-discovered), the React-ecosystem packages are listed\n // in `resolve.noExternal` so Vite treats them as part of the user module graph\n // and `resolve.dedupe` so all imports collapse to a single physical copy.\n const optimizeDepsExclude = [\n '@cloudflare/vite-plugin',\n 'wrangler',\n 'blake3-wasm',\n '@stratal/inertia',\n 'stratal',\n // `@stratal/framework` re-exports `stratal`'s DI tokens and Hono surface, so it must share their\n // module space. If the optimizer pre-bundles it while `stratal` is excluded, the bundled copy's\n // token identities diverge from the excluded `stratal`'s — and under a portal/symlinked checkout the\n // optimized `@stratal/framework/database` subpath even drops named exports (a guest SSR render then\n // throws \"createPoolFactory is not a function\"). Excluding it keeps it in one copy with `stratal`.\n '@stratal/framework',\n 'hono',\n '@hono/swagger-ui',\n ]\n const dedupe = [\n 'react',\n 'react-dom',\n 'react-is',\n 'scheduler',\n '@inertiajs/core',\n '@inertiajs/react',\n ]\n const noExternal = [\n 'react',\n 'react-dom',\n 'react-is',\n 'scheduler',\n 'use-sync-external-store',\n '@inertiajs/core',\n '@inertiajs/react',\n ]\n const optimizeDepsInclude = [\n 'buffer',\n 'buffer/',\n 'base64-js',\n 'ieee754',\n // `@stratal/inertia`'s SSR renderer imports the `react-dom/server` subpath. Because\n // `@stratal/inertia` is optimize-EXCLUDED above, the optimizer never crawls into it and so\n // never auto-discovers `react-dom/server`. React 19's `react-dom/server` is a CJS shim whose\n // conditional `require('./cjs/react-dom-server.<env>.<mode>.js')` only gets resolved by the\n // optimizer's CJS→ESM conversion — left undiscovered, that `require` reaches the workerd SSR\n // runner (which has no `require`) and every SSR page 500s with \"require is not defined\".\n // Force-optimizing the exact subpath makes esbuild convert it; the framework's import then\n // redirects to the converted copy. (Optimizing `react-dom` alone is not enough — the optimizer\n // keys on the specifier, and the import is `react-dom/server`, condition-resolved per env.)\n 'react-dom/server',\n // `@inertiajs/react`'s `App` component — imported by the SSR renderer above through\n // `@stratal/inertia`, itself optimize-EXCLUDED — imports the `react-dom/client` subpath\n // unconditionally at module scope, so the same discovery gap applies: the optimizer never\n // crawls into it and so never auto-discovers `react-dom/client` either. `react-dom/client`\n // is the same kind of CJS shim as `react-dom/server`, conditionally `require()`-ing its\n // production/development build; left undiscovered, that `require` reaches the workerd SSR\n // runner and every SSR page 500s with \"module is not defined\". Force-optimizing the exact\n // subpath makes esbuild convert it and inline its own CJS dependencies (`react`, `scheduler`,\n // …) in the process, the same way it already does for `react-dom/server` — no separate entry\n // is needed for those siblings. The import reaching the optimizer at all is what matters\n // here, not whether `App` ever calls `createRoot`/`hydrateRoot` during a server render.\n 'react-dom/client',\n // Same mechanism as `react-dom/server`: CJS packages reachable only through the optimize-excluded\n // packages above, force-optimized when installed (see `optionalCjsOptimizeTargets`).\n ...resolvableFrom(process.cwd(), optionalCjsOptimizeTargets),\n ]\n // Dev/build-time-only packages that must never reach the worker or browser\n // bundle. `ts-morph` is used by the type generator. The langium / zenstack\n // CLI/SDK group is dragged in transitively by ZenStack's runtime barrel\n // (e.g. `@zenstackhq/better-auth` imports a `schema-generator` that\n // references `@zenstackhq/language` which depends on `langium`); no actual\n // runtime code path executes any of it. If a future refactor genuinely\n // needs one of these at runtime, this list should be revisited explicitly.\n const devOnlyExternals: (string | RegExp)[] = [\n 'ts-morph',\n /^langium($|\\/)/,\n /^@zenstackhq\\/cli($|\\/)/,\n /^@zenstackhq\\/language($|\\/)/,\n /^@zenstackhq\\/sdk($|\\/)/,\n ]\n\n const clientManifestPath = options?.clientManifestPath ?? 'dist/client/.vite/manifest.json'\n const ssrExclude = options?.ssrExclude ?? []\n\n return [\n stratalInertiaDevCss({ entries }),\n stratalInertiaTypes(),\n ...(ssrExclude.length ? [excludeSsrPages({ patterns: ssrExclude })] : []),\n {\n name: 'stratal:optimize-deps-fix',\n config(config) {\n config.publicDir ??= 'src/inertia/public';\n\n // Strip react-dom's unused legacy synchronous renderer from every\n // build. `alias` must carry RegExp entries in array form; normalize an\n // existing object/array form before prepending ours.\n config.resolve ??= {}\n const existingAlias = config.resolve.alias\n const existingAliasArray: Alias[] = Array.isArray(existingAlias)\n ? (existingAlias as Alias[])\n : existingAlias != null\n ? Object.entries(existingAlias).map(([find, replacement]) => ({ find, replacement: replacement as string }))\n : []\n config.resolve.alias = [reactDomServerLegacyAlias, ...existingAliasArray]\n },\n configEnvironment(name: string, env: EnvironmentOptions) {\n const existing = env.optimizeDeps?.exclude ?? []\n const existingInclude = env.optimizeDeps?.include ?? []\n env.optimizeDeps = {\n ...env.optimizeDeps,\n exclude: [...existing, ...optimizeDepsExclude],\n include: [...existingInclude, ...optimizeDepsInclude],\n }\n\n const existingDedupe = env.resolve?.dedupe ?? []\n const existingNoExternal = env.resolve?.noExternal\n const mergedNoExternal: (string | RegExp)[] = [\n ...(Array.isArray(existingNoExternal)\n ? existingNoExternal\n : typeof existingNoExternal === 'string' || existingNoExternal instanceof RegExp\n ? [existingNoExternal]\n : []),\n ...noExternal,\n ]\n env.resolve = {\n ...env.resolve,\n dedupe: [...existingDedupe, ...dedupe],\n noExternal: existingNoExternal === true ? true : mergedNoExternal,\n }\n\n const existingExternal = env.build?.rolldownOptions?.external\n const existingExternalArray: (string | RegExp)[] = Array.isArray(existingExternal)\n ? (existingExternal)\n : existingExternal != null\n ? [existingExternal as string | RegExp]\n : []\n env.build = {\n ...env.build,\n // Only override sourcemap when the user hasn't set it explicitly,\n // so a per-app `build.sourcemap` in vite.config.ts still wins.\n sourcemap: env.build?.sourcemap ?? sourcemap,\n rolldownOptions: {\n ...env.build?.rolldownOptions,\n external: [...existingExternalArray, ...devOnlyExternals],\n },\n }\n\n // `quarry inertia:build` runs a standalone client build (phase 1) that\n // emits the browser bundle + manifest to dist/client/ before invoking\n // this worker build (phase 2). `@cloudflare/vite-plugin`'s `buildApp`\n // then runs a \"fallback\" build for its own `client` env (because no\n // input is set on it here) which, with Vite's default\n // `build.emptyOutDir = true` for in-root outDirs, would wipe phase 1's\n // chunks. Pinning `emptyOutDir = false` for the client env preserves\n // the browser bundle so CF's asset binding can serve `/assets/app-<hash>.js`.\n if (name === 'client') {\n env.build.emptyOutDir = false\n }\n },\n },\n injectSeoRuntime({ entries }),\n injectClientManifestIntoWorker({ clientManifestPath }),\n ]\n}\n\n// Injects the client-side SEO head-sync runtime into the browser entry so\n// backend `ctx.seo()` metadata stays in sync across Inertia navigations with\n// zero app wiring. The runtime is a side-effect import (`@stratal/inertia/seo-runtime`)\n// prepended to each configured client entry; it only reaches the browser bundle\n// because the worker/SSR builds never transform these entry files.\nfunction injectSeoRuntime(args: { entries: string[] }): Plugin {\n const runtime = '@stratal/inertia/seo-runtime'\n const targets = args.entries.map((entry) => entry.replace(/^\\//, ''))\n\n return {\n name: 'stratal:inertia-inject-seo-runtime',\n transform(code, id) {\n const file = id.split('?')[0]\n if (!targets.some((target) => file.endsWith(target))) return null\n if (code.includes(runtime)) return null\n return { code: `import '${runtime}';\\n${code}`, map: null }\n },\n }\n}\n\n// Reads the manifest produced by the standalone browser-bundle build (run\n// before this build by `quarry inertia:build`) and inlines it onto the worker\n// entry chunk as `globalThis.__STRATAL_INERTIA_MANIFEST__`. The manifest must\n// be inlined in the bundle itself — Cloudflare Workers have no filesystem at\n// runtime — so `ManifestService` can resolve hashed asset URLs without any\n// consumer-side wiring.\nfunction injectClientManifestIntoWorker(args: { clientManifestPath: string }): Plugin {\n let projectRoot = process.cwd()\n\n return {\n name: 'stratal:inertia-inject-manifest',\n apply: 'build',\n configResolved(config) {\n projectRoot = config.root\n },\n generateBundle(_options, bundle) {\n // Only inject into worker / SSR bundles. The browser-bundle build runs\n // in a separate `vite build` invocation and never reaches this plugin.\n if (this.environment.name === 'client') return\n\n const manifestPath = isAbsolute(args.clientManifestPath)\n ? args.clientManifestPath\n : join(projectRoot, args.clientManifestPath)\n\n if (!existsSync(manifestPath)) {\n this.error(\n '@stratal/inertia: client manifest not found at ' + manifestPath\n + '. Run `quarry inertia:build` to build the browser bundle before deploying.',\n )\n }\n\n const manifestJson = readFileSync(manifestPath, 'utf-8')\n // Parse + re-stringify so a malformed manifest fails loudly here rather\n // than at worker boot, and so the inlined value is normalized.\n const manifest = JSON.parse(manifestJson) as unknown\n const inlined = JSON.stringify(manifest)\n const sentinel = 'globalThis.__STRATAL_INERTIA_MANIFEST__'\n\n for (const fileName of Object.keys(bundle)) {\n const chunk = bundle[fileName]\n if (chunk.type !== 'chunk') continue\n if (!chunk.isEntry) continue\n if (chunk.code.startsWith(sentinel)) continue\n chunk.code = `${sentinel} = ${inlined};\\n${chunk.code}`\n }\n },\n }\n}\n\n// Build-time half of the SSR page-exclusion feature (runtime half lives in\n// `services/ssr-exclusion.ts`). Two coordinated effects, both keyed off the same\n// `ssrExclude` glob list so there is a single source of truth:\n//\n// 1. `transform` rewrites the worker/SSR `import.meta.glob('./pages/**\\/*.tsx')`\n// to add an `ignore`, so excluded page modules (and their heavy deps) never\n// enter the worker bundle — the cold-start win. The browser environment is\n// left untouched so excluded pages still hydrate client-side.\n// 2. `config` defines the runtime global with the same glob list, so\n// `InertiaService` renders matching components client-only. `define` (rather\n// than a `generateBundle` injection) makes it present in dev as well as build.\nfunction excludeSsrPages(args: { patterns: string[] }): Plugin {\n // Vite excludes glob matches via negative patterns in the array-form first\n // argument (there is no `ignore` option), so each exclusion becomes a `!`\n // entry appended to the page glob.\n const negativeGlobs = args.patterns.map(toSsrNegativeGlob).map((g) => JSON.stringify(g)).join(', ')\n // Mirrors `SSR_EXCLUDE_GLOBAL` in `services/ssr-exclusion.ts`. Kept as a literal\n // here to honour the Vite-entry boundary (no imports from worker-runtime code).\n const runtimeGlobal = 'globalThis.__STRATAL_INERTIA_SSR_EXCLUDE__'\n\n return {\n name: 'stratal:inertia-ssr-exclude',\n enforce: 'pre',\n config(config) {\n config.define = {\n ...config.define,\n [runtimeGlobal]: JSON.stringify(args.patterns),\n }\n },\n transform(code, id) {\n if (this.environment.name === 'client') return null\n if (!code.includes('import.meta.glob')) return null\n\n // Array form first, then single-string. The order is load-bearing: the single-string\n // rewrite EMITS an array, so running it first would leave output the array rewrite then\n // matches, appending every negative a second time. Neither regex matches the other's\n // output — one requires a quote after the paren, the other a bracket — so this order\n // applies exactly one of them.\n const next = code\n .replace(\n // Vite's documented way to write negative patterns, so a resolver that already\n // excludes something of its own arrives here. Exclusions are appended to what is\n // there rather than replacing it.\n //\n // Matched as a list of quoted strings, excluding only quote characters — the same\n // basis as the single-string form below. Excluding `]` or `)` instead would break on\n // patterns that legitimately contain them: `[A-Z]` character classes and `!(*.spec)`\n // extglobs respectively, both valid Vite globs.\n /import\\.meta\\.glob\\(\\s*\\[((?:\\s*(['\"])[^'\"]*\\2\\s*,?)+)\\]\\s*(,[^)]*)?\\)/g,\n (match: string, list: string, _quote: string, rest = '') => {\n if (!list.includes('pages')) return match\n return `import.meta.glob([${list.trim().replace(/,$/, '')}, ${negativeGlobs}]${rest})`\n },\n )\n .replace(\n // The optional trailing group preserves a second `import.meta.glob` argument\n // (e.g. `{ eager: true }`) so option-bearing resolvers are rewritten rather than\n // silently skipped.\n /import\\.meta\\.glob\\(\\s*(['\"])([^'\"]*pages[^'\"]*)\\1\\s*(,[^)]*)?\\)/g,\n (_match, quote: string, arg: string, rest = '') =>\n `import.meta.glob([${quote}${arg}${quote}, ${negativeGlobs}]${rest})`,\n )\n\n if (next === code) {\n // Loud rather than silent. The rewrite is the only thing that keeps excluded pages\n // out of the worker bundle, so a resolver this cannot match means `ssrExclude` did\n // nothing at all — every page still server-renders, with no error to explain why.\n // Only the SSR entry is expected to carry the page glob; other modules matching\n // `import.meta.glob` without a `pages` argument are none of this plugin's business.\n if (/import\\.meta\\.glob\\([^)]*pages/.test(code)) {\n this.warn(\n `stratalInertia: ssrExclude could not rewrite the page glob in ${id}. ` +\n `Expected import.meta.glob('./pages/**/*.tsx') or the array form. ` +\n `No pages were excluded from the worker bundle.`\n )\n }\n return null\n }\n\n return { code: next, map: null }\n },\n }\n}\n\n// Convert a component-name glob (`Admin/**`, `Reports/Heavy`) into a negative\n// `import.meta.glob` pattern relative to the `./pages` resolver root. A trailing\n// `**` already spans the file segment; everything else targets a single `.tsx`\n// file (or a single-segment `*` wildcard over `.tsx` files).\nfunction toSsrNegativeGlob(pattern: string): string {\n return pattern.endsWith('**') ? `!./pages/${pattern}` : `!./pages/${pattern}.tsx`\n}\n\n"],"mappings":";;;;;;;AAEA,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,6BAA6B,OAAO;AAM1C,SAAS,iBAAiB,QAAuB,SAA6B;CAC5E,MAAM,OAAiB,CAAC;CACxB,MAAM,0BAAU,IAAI,IAAY;CAEhC,SAAS,SAAS,KAAiB;EACjC,IAAI,QAAQ,IAAI,IAAI,GAAG,GAAG;EAC1B,QAAQ,IAAI,IAAI,GAAG;EAEnB,IAAI,aAAa,KAAK,IAAI,GAAG,GAC3B,KAAK,KAAK,IAAI,GAAG;EAGnB,KAAK,MAAM,YAAY,IAAI,iBACzB,SAAS,QAAQ;CAErB;CAEA,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,MAAM,OAAO,YAAY,iBAC7B,MAAM,WAAW,GAAG,IAAI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MAAM,gBAAgB,KAAK,SAAS,IAAI,iBAAiB,CAAC,CAAC,KAAK,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;CAGlG,MAAM,gBAAgB;CAEtB,OAAO;EACL,MAAM;EACN,SAAS;EACT,OAAO,QAAQ;GACb,OAAO,SAAS;IACd,GAAG,OAAO;KACT,gBAAgB,KAAK,UAAU,KAAK,QAAQ;GAC/C;EACF;EACA,UAAU,MAAM,IAAI;GAClB,IAAI,KAAK,YAAY,SAAS,UAAU,OAAO;GAC/C,IAAI,CAAC,KAAK,SAAS,kBAAkB,GAAG,OAAO;GAO/C,MAAM,OAAO,KACV,QASC,4EACC,OAAe,MAAc,QAAgB,OAAO,OAAO;IAC1D,IAAI,CAAC,KAAK,SAAS,OAAO,GAAG,OAAO;IACpC,OAAO,qBAAqB,KAAK,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE,EAAE,IAAI,cAAc,GAAG,KAAK;GACtF,CACF,CAAC,CACA,QAIC,sEACC,QAAQ,OAAe,KAAa,OAAO,OAC1C,qBAAqB,QAAQ,MAAM,MAAM,IAAI,cAAc,GAAG,KAAK,EACvE;GAEF,IAAI,SAAS,MAAM;IAMjB,IAAI,iCAAiC,KAAK,IAAI,GAC5C,KAAK,KACH,iEAAiE,GAAG,kHAGtE;IAEF,OAAO;GACT;GAEA,OAAO;IAAE,MAAM;IAAM,KAAK;GAAK;EACjC;CACF;AACF;AAMA,SAAS,kBAAkB,SAAyB;CAClD,OAAO,QAAQ,SAAS,IAAI,IAAI,YAAY,YAAY,YAAY,QAAQ;AAC9E"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratal/inertia",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Inertia.js v3 server adapter for Stratal framework — server-driven React SPAs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"author":
|
|
8
|
-
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Temitayo Fadojutimi",
|
|
9
|
+
"url": "https://x.com/adesege_"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://stratal.dev",
|
|
9
12
|
"repository": {
|
|
10
13
|
"type": "git",
|
|
11
14
|
"url": "git+https://github.com/strataljs/stratal.git",
|
|
@@ -48,10 +51,18 @@
|
|
|
48
51
|
"types": "./dist/react.d.mts",
|
|
49
52
|
"import": "./dist/react.mjs"
|
|
50
53
|
},
|
|
54
|
+
"./react/access": {
|
|
55
|
+
"types": "./dist/react/access.d.mts",
|
|
56
|
+
"import": "./dist/react/access.mjs"
|
|
57
|
+
},
|
|
51
58
|
"./seo-runtime": {
|
|
52
59
|
"types": "./dist/seo-runtime.d.mts",
|
|
53
60
|
"import": "./dist/seo-runtime.mjs"
|
|
54
61
|
},
|
|
62
|
+
"./services/ssr-exclusion": {
|
|
63
|
+
"types": "./dist/services/ssr-exclusion.d.mts",
|
|
64
|
+
"import": "./dist/services/ssr-exclusion.mjs"
|
|
65
|
+
},
|
|
55
66
|
"./ssr": {
|
|
56
67
|
"types": "./dist/ssr.d.mts",
|
|
57
68
|
"import": "./dist/ssr.mjs"
|
|
@@ -75,7 +86,7 @@
|
|
|
75
86
|
"lint:fix": "npx oxlint --fix ."
|
|
76
87
|
},
|
|
77
88
|
"dependencies": {
|
|
78
|
-
"intl-messageformat": "^
|
|
89
|
+
"intl-messageformat": "^12.1.1",
|
|
79
90
|
"ts-morph": "^28.0.0"
|
|
80
91
|
},
|
|
81
92
|
"peerDependencies": {
|
|
@@ -83,11 +94,11 @@
|
|
|
83
94
|
"@inertiajs/core": ">=3",
|
|
84
95
|
"@inertiajs/react": ">=3",
|
|
85
96
|
"@inertiajs/vite": ">=3",
|
|
86
|
-
"@stratal/testing": ">=0.0
|
|
97
|
+
"@stratal/testing": ">=0.1.0",
|
|
87
98
|
"hono": ">=4",
|
|
88
99
|
"react": ">=19",
|
|
89
100
|
"react-dom": ">=19",
|
|
90
|
-
"stratal": ">=0.0
|
|
101
|
+
"stratal": ">=0.1.0",
|
|
91
102
|
"vite": ">=8",
|
|
92
103
|
"vitest": ">=4"
|
|
93
104
|
},
|
|
@@ -118,25 +129,25 @@
|
|
|
118
129
|
}
|
|
119
130
|
},
|
|
120
131
|
"devDependencies": {
|
|
121
|
-
"@cloudflare/vite-plugin": "^1.
|
|
122
|
-
"@cloudflare/workers-types": "
|
|
123
|
-
"@inertiajs/core": "^3.
|
|
124
|
-
"@inertiajs/react": "^3.
|
|
125
|
-
"@inertiajs/vite": "^3.
|
|
126
|
-
"@stratal/testing": "
|
|
127
|
-
"@types/node": "^
|
|
128
|
-
"@types/react": "^19.
|
|
129
|
-
"@types/react-dom": "^19.
|
|
130
|
-
"@vitest/runner": "~4.1.
|
|
131
|
-
"@vitest/snapshot": "~4.1.
|
|
132
|
-
"hono": "^4.
|
|
133
|
-
"jsdom": "^
|
|
134
|
-
"react": "^19.
|
|
135
|
-
"react-dom": "^19.
|
|
136
|
-
"stratal": "
|
|
137
|
-
"tsdown": "^0.
|
|
138
|
-
"typescript": "^
|
|
139
|
-
"vite": "^8.0
|
|
140
|
-
"vitest": "~4.1.
|
|
132
|
+
"@cloudflare/vite-plugin": "^1.56.0",
|
|
133
|
+
"@cloudflare/workers-types": "5.20260919.1",
|
|
134
|
+
"@inertiajs/core": "^3.7.1",
|
|
135
|
+
"@inertiajs/react": "^3.7.1",
|
|
136
|
+
"@inertiajs/vite": "^3.7.1",
|
|
137
|
+
"@stratal/testing": "0.1.0",
|
|
138
|
+
"@types/node": "^26.6.2",
|
|
139
|
+
"@types/react": "^19.3.0",
|
|
140
|
+
"@types/react-dom": "^19.3.0",
|
|
141
|
+
"@vitest/runner": "~4.1.11",
|
|
142
|
+
"@vitest/snapshot": "~4.1.11",
|
|
143
|
+
"hono": "^4.13.8",
|
|
144
|
+
"jsdom": "^30.1.0",
|
|
145
|
+
"react": "^19.3.0",
|
|
146
|
+
"react-dom": "^19.3.0",
|
|
147
|
+
"stratal": "0.1.0",
|
|
148
|
+
"tsdown": "^0.23.0",
|
|
149
|
+
"typescript": "^7.0.2",
|
|
150
|
+
"vite": "^8.3.0",
|
|
151
|
+
"vitest": "~4.1.11"
|
|
141
152
|
}
|
|
142
|
-
}
|
|
153
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-generator-DFpha_Fp.mjs","names":[],"sources":["../src/generator/type-generator.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\nexport interface PageTypeInfo {\n componentName: string\n propsType: string\n}\n\nexport interface SharedDataTypeInfo {\n members: SharedDataMember[]\n}\n\nexport interface SharedDataMember {\n name: string\n type: string\n optional: boolean\n}\n\nexport interface FlashTypeInfo {\n members: { name: string; type: string }[]\n}\n\nasync function loadTsMorph() {\n return import('ts-morph')\n}\n\ntype TsMorphModule = Awaited<ReturnType<typeof loadTsMorph>>\ntype TsObj = TsMorphModule['ts']\ntype Project = InstanceType<TsMorphModule['Project']>\ntype SourceFile = InstanceType<TsMorphModule['Project']> extends { getSourceFiles(): (infer S)[] } ? S : never\ntype Node = ReturnType<SourceFile['getDescendants']>[number]\ntype Type = ReturnType<Node['getType']>\n\n// --- Shared ts-morph project creation ---\n\nasync function createProject(tsConfigPath?: string): Promise<{ project: Project; SyntaxKind: TsMorphModule['SyntaxKind']; ts: TsObj }> {\n const { Project, SyntaxKind, ts } = await loadTsMorph()\n\n const project = new Project({\n tsConfigFilePath: tsConfigPath,\n skipAddingFilesFromTsConfig: true,\n compilerOptions: tsConfigPath ? undefined : {\n jsx: ts.JsxEmit.ReactJSX,\n esModuleInterop: true,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n module: ts.ModuleKind.ESNext,\n target: ts.ScriptTarget.ESNext,\n },\n })\n\n return { project, SyntaxKind, ts }\n}\n\n// --- Controller ctx.inertia() extraction ---\n\nconst WRAPPER_TYPE_NAMES = [\n 'InertiaDeferredProp',\n 'InertiaMergeProp',\n 'InertiaOptionalProp',\n 'InertiaOnceProp',\n 'InertiaAlwaysProp',\n]\n\nexport function extractControllerPageTypes(\n project: Project,\n SK: TsMorphModule['SyntaxKind'],\n tsObj: TsObj,\n srcDir: string,\n pagesDir: string,\n): PageTypeInfo[] {\n project.addSourceFilesAtPaths(join(srcDir, '**/*.ts'))\n\n // Map from component name to all collected prop type strings (one per call site)\n const pages = new Map<string, string[]>()\n\n for (const sourceFile of project.getSourceFiles()) {\n const filePath = sourceFile.getFilePath()\n if (filePath.includes(pagesDir.replace(/\\\\/g, '/'))) continue\n // Skip test files\n if (filePath.includes('__tests__') || filePath.includes('.spec.') || filePath.includes('.test.')) continue\n\n const callExpressions = sourceFile.getDescendantsOfKind(SK.CallExpression)\n\n for (const call of callExpressions) {\n const expr = call.getExpression()\n if (!expr.isKind(SK.PropertyAccessExpression)) continue\n if (expr.getName() !== 'inertia') continue\n\n const args = call.getArguments()\n if (args.length === 0) continue\n\n // First arg must be a string literal (component name)\n const firstArg = args[0]\n if (!firstArg.isKind(SK.StringLiteral)) continue\n const componentName = firstArg.getLiteralValue()\n\n if (!pages.has(componentName)) {\n pages.set(componentName, [])\n }\n\n // Second arg is the props object\n if (args.length < 2) {\n pages.get(componentName)!.push('Record<string, never>')\n continue\n }\n\n const propsArg = args[1]\n const propsType = propsArg.getType()\n\n // Unwrap prop wrappers from each property\n if (propsType.isObject() && !propsType.isArray()) {\n const properties = propsType.getProperties()\n if (properties.length === 0) {\n pages.get(componentName)!.push('Record<string, never>')\n continue\n }\n\n const members = properties.map((prop) => {\n const decl = prop.getDeclarations()[0] ?? prop.getValueDeclaration()\n const location = decl ?? propsArg\n const isOptional = prop.isOptional()\n const propType = prop.getTypeAtLocation(location)\n const unwrapped = unwrapWrapperType(propType, tsObj, propsArg)\n return `${prop.getName()}${isOptional ? '?' : ''}: ${unwrapped}`\n })\n\n pages.get(componentName)!.push(`{ ${members.join('; ')} }`)\n } else {\n pages.get(componentName)!.push(typeToString(propsType, tsObj, propsArg))\n }\n }\n }\n\n return Array.from(pages.entries())\n .map(([componentName, typeVariants]) => {\n // Deduplicate identical variants then join with union\n const unique = [...new Set(typeVariants)]\n const propsType = unique.length === 1 ? unique[0] : unique.join(' | ')\n return { componentName, propsType }\n })\n .sort((a, b) => a.componentName.localeCompare(b.componentName))\n}\n\nfunction unwrapWrapperType(type: Type, tsObj: TsObj, fallbackLocation?: Node): string {\n if (type.isUnion()) {\n const unionTypes = type.getUnionTypes()\n const unwrapped = unionTypes\n .filter((t) => {\n const text = t.getText(undefined, tsObj.TypeFormatFlags.NoTruncation)\n return !WRAPPER_TYPE_NAMES.some((name) => text.includes(name))\n })\n .map((t) => typeToString(t, tsObj, fallbackLocation))\n\n if (unwrapped.length > 0) {\n return unwrapped.join(' | ')\n }\n }\n\n // Check if the type itself is a wrapper type — extract callback return type\n const text = type.getText(undefined, tsObj.TypeFormatFlags.NoTruncation)\n for (const wrapperName of WRAPPER_TYPE_NAMES) {\n if (text.includes(wrapperName)) {\n const callbackProp = type.getProperty('callback')\n if (callbackProp) {\n const decl = callbackProp.getDeclarations()[0] ?? callbackProp.getValueDeclaration()\n const location = decl ?? fallbackLocation\n if (!location) return 'unknown'\n const callbackType = callbackProp.getTypeAtLocation(location)\n const callSignatures = callbackType.getCallSignatures()\n if (callSignatures.length > 0) {\n return unwrapPromise(callSignatures[0].getReturnType(), tsObj, fallbackLocation)\n }\n }\n return 'unknown'\n }\n }\n\n return widenLiteralType(type, tsObj, fallbackLocation)\n}\n\nfunction unwrapPromise(type: Type, tsObj: TsObj, fallbackLocation?: Node): string {\n // `getAwaitedType()` resolves the `Awaited<T>` of any thenable — covers\n // `Promise<T>`, `PromiseLike<T>`, and branded thenables (e.g. ZenStack's\n // `ZenStackPromise<T>`) whose text doesn't start with `Promise<`.\n const awaited = type.getAwaitedType?.()\n if (awaited && awaited !== type) {\n return stripReadonly(awaited, tsObj, fallbackLocation)\n }\n return stripReadonly(type, tsObj, fallbackLocation)\n}\n\nfunction stripReadonly(type: Type, tsObj: TsObj, fallbackLocation?: Node): string {\n if (type.isTuple()) {\n const elements = type.getTupleElements()\n const parts = elements.map((e) => typeToString(e, tsObj, fallbackLocation))\n return `[${parts.join(', ')}]`\n }\n\n const text = type.getText(undefined, tsObj.TypeFormatFlags.NoTruncation)\n if (text.startsWith('readonly ') && type.isArray()) {\n const elementType = type.getArrayElementType()\n if (elementType) {\n return `Array<${typeToString(elementType, tsObj, fallbackLocation)}>`\n }\n }\n\n return typeToString(type, tsObj, fallbackLocation)\n}\n\n// --- Extract this.inertia.share() call types ---\n\nexport function extractShareCallTypes(\n project: Project,\n SK: TsMorphModule['SyntaxKind'],\n tsObj: TsObj,\n srcDir: string,\n): Map<string, string> {\n const shareTypes = new Map<string, string>()\n\n for (const sourceFile of project.getSourceFiles()) {\n const filePath = sourceFile.getFilePath()\n if (!filePath.startsWith(srcDir.replace(/\\\\/g, '/'))) continue\n if (filePath.includes('__tests__') || filePath.includes('.spec.') || filePath.includes('.test.')) continue\n\n const callExpressions = sourceFile.getDescendantsOfKind(SK.CallExpression)\n\n for (const call of callExpressions) {\n const expr = call.getExpression()\n if (!expr.isKind(SK.PropertyAccessExpression)) continue\n if (expr.getName() !== 'share') continue\n\n // Check that the object is inertia-related (this.inertia.share, inertia.share)\n const objExpr = expr.getExpression()\n const objText = objExpr.getText()\n if (!objText.includes('inertia')) continue\n\n const args = call.getArguments()\n if (args.length < 2) continue\n\n const keyArg = args[0]\n if (!keyArg.isKind(SK.StringLiteral)) continue\n const key = keyArg.getLiteralValue()\n\n if (shareTypes.has(key)) continue\n\n const valueType = widenLiteralType(args[1].getType(), tsObj)\n shareTypes.set(key, valueType)\n }\n }\n\n return shareTypes\n}\n\n// --- Detect i18n config in InertiaModule.forRoot() ---\n\n/**\n * Given the first argument of `Module.forRoot(...)` or `Module.forRootAsync(...)`,\n * return the object literal where downstream options actually live.\n *\n * - For `forRoot({...})` the literal IS the first arg.\n * - For `forRootAsync({ inject, useFactory: (...) => ({...}) })` we drill into\n * the `useFactory`'s return value:\n * `() => ({ … })` — ParenthesizedExpression → ObjectLiteral\n * `() => ({ ... } as Foo)` — AsExpression → ObjectLiteral\n * `() => { return { … } }` — Block → ReturnStatement → ObjectLiteral\n *\n * Returns `null` when nothing usable is found.\n */\nfunction resolveModuleOptionsLiteral(\n optionsArg: Node,\n SK: TsMorphModule['SyntaxKind'],\n): Node | null {\n if (!optionsArg.isKind(SK.ObjectLiteralExpression)) return null\n\n // forRootAsync wrapper: { inject, useFactory: (env) => ({ ... }) }\n const useFactoryProp = optionsArg.getProperty('useFactory')\n if (useFactoryProp?.isKind(SK.PropertyAssignment)) {\n const initializer = useFactoryProp.getInitializer()\n if (initializer?.isKind(SK.ArrowFunction) || initializer?.isKind(SK.FunctionExpression)) {\n const body = initializer.getBody()\n\n // Concise arrow body: () => ({...}) — Parenthesized\n if (body.isKind(SK.ParenthesizedExpression)) {\n const inner = unwrapAs(body.getExpression(), SK)\n if (inner?.isKind(SK.ObjectLiteralExpression)) return inner\n }\n\n // Concise arrow body returning a plain literal (rare without parens but legal)\n const unwrapped = unwrapAs(body, SK)\n if (unwrapped?.isKind(SK.ObjectLiteralExpression)) return unwrapped\n\n // Block body: { ... return {...}; }\n if (body.isKind(SK.Block)) {\n const returnStatements = body.getDescendantsOfKind(SK.ReturnStatement)\n // Walk in reverse so a later `return` wins (last-write-wins semantics)\n for (let i = returnStatements.length - 1; i >= 0; i--) {\n const ret = returnStatements[i]\n const expr = ret.getExpression()\n if (!expr) continue\n if (expr.isKind(SK.ParenthesizedExpression)) {\n const inner = unwrapAs(expr.getExpression(), SK)\n if (inner?.isKind(SK.ObjectLiteralExpression)) return inner\n continue\n }\n const direct = unwrapAs(expr, SK)\n if (direct?.isKind(SK.ObjectLiteralExpression)) return direct\n }\n }\n }\n }\n\n // Plain forRoot({...}) — the first arg IS the options literal.\n return optionsArg\n}\n\n/**\n * Strip a single `as Foo` cast if present, otherwise return the node as-is.\n * `useFactory: (env) => ({ ... } as Options)` is common in TypeScript.\n */\nfunction unwrapAs(node: Node | undefined, SK: TsMorphModule['SyntaxKind']): Node | undefined {\n if (!node) return undefined\n if (node.isKind(SK.AsExpression) || node.isKind(SK.TypeAssertionExpression)) {\n return node.getExpression()\n }\n if (node.isKind(SK.SatisfiesExpression)) {\n return node.getExpression()\n }\n return node\n}\n\nexport interface I18nDetectionResult {\n enabled: boolean\n only: string[]\n}\n\nexport function detectI18nConfig(\n project: Project,\n SK: TsMorphModule['SyntaxKind'],\n srcDir: string,\n): I18nDetectionResult {\n const none: I18nDetectionResult = { enabled: false, only: [] }\n const normalizedSrcDir = srcDir.replace(/\\\\/g, '/')\n\n for (const sourceFile of project.getSourceFiles()) {\n const filePath = sourceFile.getFilePath()\n if (!filePath.startsWith(normalizedSrcDir)) continue\n if (filePath.includes('__tests__') || filePath.includes('.spec.') || filePath.includes('.test.')) continue\n\n const callExpressions = sourceFile.getDescendantsOfKind(SK.CallExpression)\n\n for (const call of callExpressions) {\n const expr = call.getExpression()\n if (!expr.isKind(SK.PropertyAccessExpression)) continue\n\n const propName = expr.getName()\n if (propName !== 'forRoot' && propName !== 'forRootAsync') continue\n\n const objExpr = expr.getExpression()\n if (!objExpr.isKind(SK.Identifier) || objExpr.getText() !== 'InertiaModule') continue\n\n const args = call.getArguments()\n if (args.length === 0) continue\n\n // 1. AST-based: direct object literals (same-file forRoot / forRootAsync with inline useFactory)\n const optionsLiteral = resolveModuleOptionsLiteral(args[0], SK)\n if (optionsLiteral?.isKind(SK.ObjectLiteralExpression)) {\n const i18nProp = optionsLiteral.getProperty('i18n')\n if (!i18nProp) continue\n return { enabled: true, only: extractOnlyFromLiteral(i18nProp, SK) }\n }\n\n // 2. AST-based cross-file: follow identifier.asProvider() → registerAs factory\n const configLiteral = resolveConfigLiteralFromAsProvider(args[0], SK)\n if (configLiteral?.isKind(SK.ObjectLiteralExpression)) {\n const i18nProp = configLiteral.getProperty('i18n')\n if (i18nProp) return { enabled: true, only: extractOnlyFromLiteral(i18nProp, SK) }\n }\n\n // 3. Type-based fallback: check if the resolved type has an i18n property\n const optionsType = resolveOptionsType(args[0], propName)\n if (optionsType?.getProperty('i18n')) {\n return { enabled: true, only: extractOnlyFromType(optionsType, args[0]) }\n }\n }\n }\n\n return none\n}\n\nfunction resolveConfigLiteralFromAsProvider(\n arg: Node,\n SK: TsMorphModule['SyntaxKind'],\n): Node | null {\n if (!arg.isKind(SK.CallExpression)) return null\n\n const callExpr = arg.getExpression()\n if (!callExpr.isKind(SK.PropertyAccessExpression)) return null\n if (callExpr.getName() !== 'asProvider') return null\n\n const configIdentifier = callExpr.getExpression()\n if (!configIdentifier.isKind(SK.Identifier)) return null\n\n const varDecl = resolveToVariableDeclaration(configIdentifier, SK)\n if (!varDecl) return null\n\n return extractLiteralFromRegisterAs(varDecl, SK)\n}\n\nfunction resolveToVariableDeclaration(\n identifier: Node,\n SK: TsMorphModule['SyntaxKind'],\n): Node | null {\n const symbol = identifier.getSymbol()\n if (!symbol) return null\n\n for (const decl of symbol.getDeclarations()) {\n if (decl.isKind(SK.VariableDeclaration)) return decl\n\n if (decl.isKind(SK.ImportSpecifier)) {\n const sourceFile = decl.getImportDeclaration().getModuleSpecifierSourceFile()\n if (!sourceFile) continue\n\n const exportName = decl.getName()\n const exported = sourceFile.getExportedDeclarations().get(exportName)\n if (!exported) continue\n\n for (const exportDecl of exported) {\n if (exportDecl.isKind(SK.VariableDeclaration)) return exportDecl\n }\n }\n }\n\n return null\n}\n\nfunction extractLiteralFromRegisterAs(\n varDecl: Node,\n SK: TsMorphModule['SyntaxKind'],\n): Node | null {\n if (!varDecl.isKind(SK.VariableDeclaration)) return null\n\n const init = varDecl.getInitializer()\n if (!init?.isKind(SK.CallExpression)) return null\n\n const factoryArgs = init.getArguments()\n if (factoryArgs.length < 2) return null\n\n const factory = factoryArgs[1]\n if (!factory.isKind(SK.ArrowFunction) && !factory.isKind(SK.FunctionExpression)) return null\n\n const body = factory.getBody()\n\n if (body.isKind(SK.ParenthesizedExpression)) {\n const inner = unwrapAs(body.getExpression(), SK)\n if (inner?.isKind(SK.ObjectLiteralExpression)) return inner\n }\n\n const unwrapped = unwrapAs(body, SK)\n if (unwrapped?.isKind(SK.ObjectLiteralExpression)) return unwrapped\n\n if (body.isKind(SK.Block)) {\n const returnStatements = body.getDescendantsOfKind(SK.ReturnStatement)\n for (let i = returnStatements.length - 1; i >= 0; i--) {\n const ret = returnStatements[i]\n const retExpr = ret.getExpression()\n if (!retExpr) continue\n if (retExpr.isKind(SK.ParenthesizedExpression)) {\n const inner = unwrapAs(retExpr.getExpression(), SK)\n if (inner?.isKind(SK.ObjectLiteralExpression)) return inner\n continue\n }\n const direct = unwrapAs(retExpr, SK)\n if (direct?.isKind(SK.ObjectLiteralExpression)) return direct\n }\n }\n\n return null\n}\n\nfunction extractOnlyFromLiteral(i18nProp: Node, SK: TsMorphModule['SyntaxKind']): string[] {\n const only: string[] = []\n if (!i18nProp.isKind(SK.PropertyAssignment)) return only\n const init = i18nProp.getInitializer()\n if (!init?.isKind(SK.ObjectLiteralExpression)) return only\n const onlyProp = init.getProperty('only')\n if (!onlyProp?.isKind(SK.PropertyAssignment)) return only\n const onlyInit = onlyProp.getInitializer()\n if (!onlyInit?.isKind(SK.ArrayLiteralExpression)) return only\n for (const el of onlyInit.getElements()) {\n if (el.isKind(SK.StringLiteral)) {\n only.push(el.getLiteralValue())\n }\n }\n return only\n}\n\nfunction resolveOptionsType(arg: Node, methodName: string): Type | null {\n const argType = arg.getType()\n\n if (methodName === 'forRoot') {\n return argType\n }\n\n // forRootAsync: arg is FactoryProvider-shaped — drill through useFactory return type\n const useFactorySymbol = argType.getProperty('useFactory')\n if (!useFactorySymbol) return null\n\n const useFactoryType = useFactorySymbol.getTypeAtLocation(arg)\n const signatures = useFactoryType.getCallSignatures()\n if (signatures.length === 0) return null\n\n const returnType = signatures[0].getReturnType()\n\n // Return type is T | Promise<T> — find the branch with i18n\n if (returnType.isUnion()) {\n for (const member of returnType.getUnionTypes()) {\n if (member.getProperty('i18n')) return member\n }\n return null\n }\n\n return returnType\n}\n\nfunction extractOnlyFromType(optionsType: Type, locationNode: Node): string[] {\n const i18nSymbol = optionsType.getProperty('i18n')\n if (!i18nSymbol) return []\n\n const i18nType = i18nSymbol.getTypeAtLocation(locationNode)\n const onlySymbol = i18nType.getProperty('only')\n if (!onlySymbol) return []\n\n const onlyType = onlySymbol.getTypeAtLocation(locationNode)\n const elementType = onlyType.getNumberIndexType()\n if (!elementType) return []\n\n const result: string[] = []\n if (elementType.isUnion()) {\n for (const member of elementType.getUnionTypes()) {\n if (member.isStringLiteral()) {\n result.push(member.getLiteralValue() as string)\n }\n }\n } else if (elementType.isStringLiteral()) {\n result.push(elementType.getLiteralValue() as string)\n }\n return result\n}\n\n// --- Extract ctx.flash() call types ---\n\n/**\n * Collect every string-literal value a flash-key argument can resolve to.\n *\n * A direct string literal yields a single key. A conditional expression\n * (`cond ? 'a' : 'b'`, including nested ternaries) contributes the literals\n * from each branch. Non-literal keys (variables, template strings) yield\n * nothing — they can't be statically known.\n */\nfunction collectFlashKeyLiterals(node: Node, SK: TsMorphModule['SyntaxKind']): string[] {\n const stringLiteral = node.asKind(SK.StringLiteral)\n if (stringLiteral) return [stringLiteral.getLiteralValue()]\n\n const conditional = node.asKind(SK.ConditionalExpression)\n if (conditional) {\n return [\n ...collectFlashKeyLiterals(conditional.getWhenTrue(), SK),\n ...collectFlashKeyLiterals(conditional.getWhenFalse(), SK),\n ]\n }\n\n return []\n}\n\nexport function extractFlashTypes(\n project: Project,\n SK: TsMorphModule['SyntaxKind'],\n tsObj: TsObj,\n srcDir: string,\n): FlashTypeInfo | null {\n const flashMembers = new Map<string, string>()\n\n for (const sourceFile of project.getSourceFiles()) {\n const filePath = sourceFile.getFilePath()\n if (!filePath.startsWith(srcDir.replace(/\\\\/g, '/'))) continue\n if (filePath.includes('__tests__') || filePath.includes('.spec.') || filePath.includes('.test.')) continue\n\n const callExpressions = sourceFile.getDescendantsOfKind(SK.CallExpression)\n\n for (const call of callExpressions) {\n const expr = call.getExpression()\n if (!expr.isKind(SK.PropertyAccessExpression)) continue\n if (expr.getName() !== 'flash') continue\n\n const args = call.getArguments()\n if (args.length < 2) continue\n\n // The key may be a plain string literal or a conditional expression\n // selecting between several literals (e.g. `cond ? 'success' : 'error'`).\n // Every literal a branch can produce is a real flash key.\n const keys = collectFlashKeyLiterals(args[0], SK)\n if (keys.length === 0) continue\n\n const valueType = widenLiteralType(args[1].getType(), tsObj)\n for (const key of keys) {\n if (flashMembers.has(key)) continue\n flashMembers.set(key, valueType)\n }\n }\n }\n\n if (flashMembers.size === 0) return null\n\n return {\n members: Array.from(flashMembers.entries()).map(([name, type]) => ({ name, type })),\n }\n}\n\n// --- Extract shared data from module config (existing, refactored) ---\n\nexport function extractSharedDataType(\n project: Project,\n SK: TsMorphModule['SyntaxKind'],\n tsObj: TsObj,\n moduleFilePath: string,\n): SharedDataTypeInfo | null {\n const sourceFile = project.getSourceFile(moduleFilePath)\n ?? project.addSourceFileAtPath(moduleFilePath)\n\n const callExpressions = sourceFile.getDescendantsOfKind(SK.CallExpression)\n\n for (const call of callExpressions) {\n const expr = call.getExpression()\n if (!expr.isKind(SK.PropertyAccessExpression)) continue\n\n const propName = expr.getName()\n if (propName !== 'forRoot' && propName !== 'forRootAsync') continue\n\n const objExpr = expr.getExpression()\n if (!objExpr.isKind(SK.Identifier) || objExpr.getText() !== 'InertiaModule') continue\n\n const args = call.getArguments()\n if (args.length === 0) continue\n\n const optionsLiteral = resolveModuleOptionsLiteral(args[0], SK)\n if (!optionsLiteral || !optionsLiteral.isKind(SK.ObjectLiteralExpression)) continue\n\n const sharedDataProp = optionsLiteral.getProperty('sharedData')\n if (!sharedDataProp) continue\n\n if (!sharedDataProp.isKind(SK.PropertyAssignment)) continue\n\n const initializer = sharedDataProp.getInitializer()\n if (!initializer?.isKind(SK.ObjectLiteralExpression)) continue\n\n const members: SharedDataMember[] = []\n for (const prop of initializer.getProperties()) {\n if (!prop.isKind(SK.PropertyAssignment)) continue\n\n const name = prop.getName()\n const value = prop.getInitializer()\n if (!value) continue\n\n let valueType: string\n\n if (value.isKind(SK.ArrowFunction) || value.isKind(SK.FunctionExpression)) {\n const returnType = value.getReturnType()\n valueType = typeToString(returnType, tsObj)\n } else {\n valueType = typeToString(value.getType(), tsObj)\n }\n\n members.push({ name, type: valueType, optional: false })\n }\n\n if (members.length > 0) {\n return { members }\n }\n }\n\n return null\n}\n\n// --- Generate output ---\n\nexport interface GenerateTypesInput {\n pages: PageTypeInfo[]\n sharedData: SharedDataTypeInfo | null\n shareCallTypes: Map<string, string>\n i18n: I18nDetectionResult\n flashTypes: FlashTypeInfo | null\n}\n\nfunction componentNameToPropsTypeName(componentName: string, segmentCount = 2): string {\n const segments = componentName.split('/')\n const used = segments.slice(-segmentCount)\n return used.map(toPascalCase).join('') + 'PageProps'\n}\n\nfunction toPascalCase(segment: string): string {\n return segment\n .split(/[-_\\s]+/)\n .filter((part) => part.length > 0)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('')\n}\n\nfunction resolvePagePropsTypeNames(pages: PageTypeInfo[]): Map<string, string> {\n const result = new Map<string, string>()\n\n // First pass: use last 2 segments\n const nameToComponents = new Map<string, string[]>()\n for (const page of pages) {\n const typeName = componentNameToPropsTypeName(page.componentName)\n const existing = nameToComponents.get(typeName) ?? []\n existing.push(page.componentName)\n nameToComponents.set(typeName, existing)\n }\n\n // Second pass: resolve collisions by using all segments\n for (const [typeName, components] of nameToComponents) {\n if (components.length === 1) {\n result.set(components[0], typeName)\n } else {\n for (const componentName of components) {\n const fullSegments = componentName.split('/').length\n result.set(componentName, componentNameToPropsTypeName(componentName, fullSegments))\n }\n }\n }\n\n return result\n}\n\nexport function generateInertiaTypes(input: GenerateTypesInput): string {\n const { pages, sharedData, shareCallTypes, i18n, flashTypes } = input\n\n // Compute type names with collision resolution\n const typeNames = resolvePagePropsTypeNames(pages)\n\n const lines: string[] = [\n '// Auto-generated by @stratal/inertia. Do not edit.',\n ]\n\n // Global page props types\n if (pages.length > 0) {\n lines.push('declare global {')\n for (const page of pages) {\n const typeName = typeNames.get(page.componentName)!\n lines.push(` type ${typeName} = ${page.propsType}`)\n }\n lines.push('}')\n lines.push('')\n }\n\n // InertiaPageRegistry augmentation referencing global types\n lines.push(\"declare module '@stratal/inertia' {\")\n lines.push(' interface InertiaPageRegistry {')\n for (const page of pages) {\n const typeName = typeNames.get(page.componentName)!\n lines.push(` '${page.componentName}': ${typeName}`)\n }\n lines.push(' }')\n if (i18n.enabled && i18n.only.length > 0) {\n const prefixUnion = i18n.only.map((p) => `'${p}'`).join(' | ')\n lines.push(' interface InertiaI18nConfig {')\n lines.push(` translationKeys: import('stratal/i18n').FilterByPrefix<import('stratal/i18n').MessageKeys, ${prefixUnion}>`)\n lines.push(' }')\n }\n lines.push('}')\n\n // Build InertiaConfig augmentation\n const configMembers: string[] = []\n\n // Flash data type\n if (flashTypes && flashTypes.members.length > 0) {\n const flashProps = flashTypes.members\n .map((m) => `${m.name}?: ${m.type}`)\n .join('; ')\n configMembers.push(` flashDataType: { ${flashProps} }`)\n }\n\n // Shared page props\n const sharedMembers: string[] = []\n\n // From module config (non-optional)\n if (sharedData) {\n for (const member of sharedData.members) {\n sharedMembers.push(` ${member.name}${member.optional ? '?' : ''}: ${member.type}`)\n }\n }\n\n // From i18n detection (non-optional)\n if (i18n.enabled) {\n sharedMembers.push(' locale: string')\n sharedMembers.push(' translations: Record<string, string>')\n }\n\n // From .share() calls (optional — per-request)\n for (const [key, type] of shareCallTypes) {\n // Skip if already declared by module config\n if (sharedData?.members.some((m) => m.name === key)) continue\n sharedMembers.push(` ${key}?: ${type}`)\n }\n\n if (sharedMembers.length > 0) {\n configMembers.push(` sharedPageProps: {\\n${sharedMembers.join('\\n')}\\n }`)\n }\n\n if (configMembers.length > 0) {\n lines.push('')\n lines.push(\"declare module '@inertiajs/core' {\")\n lines.push(' export interface InertiaConfig {')\n for (const member of configMembers) {\n lines.push(member)\n }\n lines.push(' }')\n lines.push('}')\n }\n\n lines.push('', 'export {}', '')\n\n return lines.join('\\n')\n}\n\n// --- Type string helpers ---\n\nfunction widenLiteralType(type: Type, tsObj: TsObj, fallbackLocation?: Node): string {\n if (type.isStringLiteral()) return 'string'\n if (type.isNumberLiteral()) return 'number'\n if (type.isBooleanLiteral()) return 'boolean'\n return typeToString(type, tsObj, fallbackLocation)\n}\n\nfunction typeToString(type: Type, tsObj: TsObj, fallbackLocation?: Node): string {\n // Preserve MessageKeys as InertiaTranslationKeys — narrows automatically via i18n.only augmentation\n if (type.isUnion() && type.getAliasSymbol?.()?.getName() === 'MessageKeys') {\n return \"import('@stratal/inertia').InertiaTranslationKeys\"\n }\n\n // Always expand objects/unions/intersections so getText() can't leak inline\n // index signatures (e.g. StratalRouteMap params' `[key: string]: ...`).\n if (type.isObject() || type.isUnion() || type.isIntersection()) {\n return expandTypeToInline(type, tsObj, fallbackLocation)\n }\n\n const text = type.getText(undefined, tsObj.TypeFormatFlags.NoTruncation | tsObj.TypeFormatFlags.UseFullyQualifiedType)\n\n if (text.includes('import(')) {\n return expandTypeToInline(type, tsObj, fallbackLocation)\n }\n\n return text\n}\n\nfunction expandPropertyType(\n type: Type,\n tsObj: TsObj,\n fallbackLocation: Node | undefined,\n visiting: Set<Type>,\n isOptional: boolean,\n): string {\n // The `?` marker already implies `undefined`, so strip it from the union\n // to avoid `id?: undefined | string`.\n if (isOptional && type.isUnion()) {\n const parts = type.getUnionTypes().filter((t) => !t.isUndefined())\n if (parts.length === 0) return 'undefined'\n if (parts.length === 1) return expandTypeToInline(parts[0], tsObj, fallbackLocation, visiting)\n return parts.map((t) => expandTypeToInline(t, tsObj, fallbackLocation, visiting)).join(' | ')\n }\n return expandTypeToInline(type, tsObj, fallbackLocation, visiting)\n}\n\nfunction expandTypeToInline(\n type: Type,\n tsObj: TsObj,\n fallbackLocation?: Node,\n visiting = new Set<Type>(),\n): string {\n if (visiting.has(type)) return 'unknown'\n // `boolean` is internally `true | false` — short-circuit before the union branch.\n if (type.isBoolean()) return 'boolean'\n visiting.add(type)\n try {\n if (type.isObject() && !type.isArray() && !type.isReadonlyArray()) {\n // Named global types (Date, RegExp, Map, Set, ...) — emit text as-is.\n // Expanding them iterates every method and produces garbage like\n // `{ toString: ...; getTime: ...; }` for Date.\n const symbolName = type.getSymbol()?.getName()\n const text = type.getText(undefined, tsObj.TypeFormatFlags.NoTruncation | tsObj.TypeFormatFlags.UseFullyQualifiedType)\n if (\n symbolName\n && !symbolName.startsWith('__')\n && symbolName !== 'Object'\n && !text.includes('import(')\n ) {\n return text\n }\n\n const properties = type.getProperties()\n if (properties.length === 0) {\n const stringIndexType = type.getStringIndexType()\n if (stringIndexType) {\n return `Record<string, ${expandTypeToInline(stringIndexType, tsObj, fallbackLocation, visiting)}>`\n }\n // Use `{}` not `Record<string, never>` — `never` collapses intersections.\n return '{}'\n }\n\n const members = properties.map((prop) => {\n const decl = prop.getDeclarations()[0] ?? prop.getValueDeclaration()\n const location = decl ?? fallbackLocation\n const isOptional = prop.isOptional()\n if (!location) return `${prop.getName()}${isOptional ? '?' : ''}: unknown`\n const propType = prop.getTypeAtLocation(location)\n const propTypeStr = expandPropertyType(propType, tsObj, fallbackLocation, visiting, isOptional)\n return `${prop.getName()}${isOptional ? '?' : ''}: ${propTypeStr}`\n })\n\n return `{ ${members.join('; ')} }`\n }\n\n if (type.isArray() || type.isReadonlyArray()) {\n const elementType = type.getArrayElementType()\n if (elementType) {\n const inner = expandTypeToInline(elementType, tsObj, fallbackLocation, visiting)\n return type.isReadonlyArray() ? `ReadonlyArray<${inner}>` : `Array<${inner}>`\n }\n }\n\n if (type.isUnion()) {\n if (type.getAliasSymbol?.()?.getName() === 'MessageKeys') {\n return \"import('@stratal/inertia').InertiaTranslationKeys\"\n }\n return type.getUnionTypes().map((t) => expandTypeToInline(t, tsObj, fallbackLocation, visiting)).join(' | ')\n }\n\n if (type.isIntersection()) {\n return type.getIntersectionTypes().map((t) => expandTypeToInline(t, tsObj, fallbackLocation, visiting)).join(' & ')\n }\n\n const text = type.getText(undefined, tsObj.TypeFormatFlags.NoTruncation)\n if (text.includes('import(')) {\n return 'unknown'\n }\n return text\n } finally {\n visiting.delete(type)\n }\n}\n\n// --- File path helpers ---\n\nexport function writeInertiaTypes(outputPath: string, content: string): boolean {\n if (existsSync(outputPath)) {\n try {\n if (readFileSync(outputPath, 'utf-8') === content) return false\n } catch {\n // fall through and write\n }\n }\n mkdirSync(dirname(outputPath), { recursive: true })\n const tmpPath = `${outputPath}.tmp-${process.pid}-${Date.now()}`\n writeFileSync(tmpPath, content, 'utf-8')\n renameSync(tmpPath, outputPath)\n return true\n}\n\nexport function findAppModulePath(cwd: string): string | undefined {\n const candidates = [\n join(cwd, 'src', 'app.module.ts'),\n join(cwd, 'src', 'app.module.tsx'),\n ]\n\n return candidates.find(existsSync)\n}\n\nexport function findPagesDir(cwd: string): string {\n return join(cwd, 'src', 'inertia', 'pages')\n}\n\nexport function findOutputPath(cwd: string): string {\n return join(cwd, 'src', 'inertia', 'inertia.d.ts')\n}\n\nexport function findTsConfigPath(cwd: string): string | undefined {\n const candidate = join(cwd, 'tsconfig.json')\n return existsSync(candidate) ? candidate : undefined\n}\n\n// --- Main pipeline ---\n\nexport async function runTypeGeneration(cwd: string): Promise<{ outputPath: string; pageCount: number }> {\n const pagesDir = findPagesDir(cwd)\n const srcDir = join(cwd, 'src')\n const outputPath = findOutputPath(cwd)\n const moduleFilePath = findAppModulePath(cwd)\n const tsConfigPath = findTsConfigPath(cwd)\n\n // Single shared project for all extractors\n const { project, SyntaxKind, ts } = await createProject(tsConfigPath)\n\n // 1. Controller ctx.inertia() calls — sole source of truth for InertiaPageRegistry\n const pages = extractControllerPageTypes(project, SyntaxKind, ts, srcDir, pagesDir)\n\n // 2. Module shared data config\n const sharedData = moduleFilePath\n ? extractSharedDataType(project, SyntaxKind, ts, moduleFilePath)\n : null\n\n // 3. i18n detection (scans all source files for InertiaModule.forRoot*)\n const i18n = detectI18nConfig(project, SyntaxKind, srcDir)\n\n // 4. Per-request .share() calls\n const shareCallTypes = extractShareCallTypes(project, SyntaxKind, ts, srcDir)\n\n // 5. Flash ctx.flash() calls\n const flashTypes = extractFlashTypes(project, SyntaxKind, ts, srcDir)\n\n // 6. Generate\n const content = generateInertiaTypes({\n pages,\n sharedData,\n shareCallTypes,\n i18n,\n flashTypes,\n })\n writeInertiaTypes(outputPath, content)\n\n return { outputPath, pageCount: pages.length }\n}\n"],"mappings":";;;AAsBA,eAAe,cAAc;CAC3B,OAAO,OAAO;AAChB;AAWA,eAAe,cAAc,cAA0G;CACrI,MAAM,EAAE,SAAS,YAAY,OAAO,MAAM,YAAY;CActD,OAAO;EAAE,SAAA,IAZW,QAAQ;GAC1B,kBAAkB;GAClB,6BAA6B;GAC7B,iBAAiB,eAAe,KAAA,IAAY;IAC1C,KAAK,GAAG,QAAQ;IAChB,iBAAiB;IACjB,kBAAkB,GAAG,qBAAqB;IAC1C,QAAQ,GAAG,WAAW;IACtB,QAAQ,GAAG,aAAa;GAC1B;EACF,CAEe;EAAG;EAAY;CAAG;AACnC;AAIA,MAAM,qBAAqB;CACzB;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,2BACd,SACA,IACA,OACA,QACA,UACgB;CAChB,QAAQ,sBAAsB,KAAK,QAAQ,SAAS,CAAC;CAGrD,MAAM,wBAAQ,IAAI,IAAsB;CAExC,KAAK,MAAM,cAAc,QAAQ,eAAe,GAAG;EACjD,MAAM,WAAW,WAAW,YAAY;EACxC,IAAI,SAAS,SAAS,SAAS,QAAQ,OAAO,GAAG,CAAC,GAAG;EAErD,IAAI,SAAS,SAAS,WAAW,KAAK,SAAS,SAAS,QAAQ,KAAK,SAAS,SAAS,QAAQ,GAAG;EAElG,MAAM,kBAAkB,WAAW,qBAAqB,GAAG,cAAc;EAEzE,KAAK,MAAM,QAAQ,iBAAiB;GAClC,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AO,gBAAgB,CAGnB,EAAE,KAAK,UAAU;AACnC;AAEA,SAAgB,aAAa,KAAqB;CAChD,OAAO,KAAK,KAAK,OAAO,WAAW,OAAO;AAC5C;AAEA,SAAgB,eAAe,KAAqB;CAClD,OAAO,KAAK,KAAK,OAAO,WAAW,cAAc;AACnD;AAEA,SAAgB,iBAAiB,KAAiC;CAChE,MAAM,YAAY,KAAK,KAAK,eAAe;CAC3C,OAAO,WAAW,SAAS,IAAI,YAAY,KAAA;AAC7C;AAIA,eAAsB,kBAAkB,KAAiE;CACvG,MAAM,WAAW,aAAa,GAAG;CACjC,MAAM,SAAS,KAAK,KAAK,KAAK;CAC9B,MAAM,aAAa,eAAe,GAAG;CACrC,MAAM,iBAAiB,kBAAkB,GAAG;CAI5C,MAAM,EAAE,SAAS,YAAY,OAAO,MAAM,cAHrB,iBAAiB,GAG6B,CAAC;CAGpE,MAAM,QAAQ,2BAA2B,SAAS,YAAY,IAAI,QAAQ,QAAQ;CAGlF,MAAM,aAAa,iBACf,sBAAsB,SAAS,YAAY,IAAI,cAAc,IAC7D;CAGJ,MAAM,OAAO,iBAAiB,SAAS,YAAY,MAAM;CAgBzD,kBAAkB,YAPF,qBAAqB;EACnC;EACA;EACA,gBATqB,sBAAsB,SAAS,YAAY,IAAI,MASvD;EACb;EACA,YARiB,kBAAkB,SAAS,YAAY,IAAI,MAQnD;CACX,CACoC,CAAC;CAErC,OAAO;EAAE;EAAY,WAAW,MAAM;CAAO;AAC/C"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { RouterContext } from "stratal/router";
|
|
2
|
-
import { MessageKeys } from "stratal/i18n";
|
|
3
|
-
import { Page, Page as InertiaPage, SharedPageProps } from "@inertiajs/core";
|
|
4
|
-
import { ContentfulStatusCode } from "hono/utils/http-status";
|
|
5
|
-
|
|
6
|
-
//#region src/types.d.ts
|
|
7
|
-
interface InertiaPageRegistry {}
|
|
8
|
-
interface InertiaI18nConfig {}
|
|
9
|
-
type InertiaTranslationKeys = InertiaI18nConfig extends {
|
|
10
|
-
translationKeys: infer T extends string;
|
|
11
|
-
} ? T : MessageKeys;
|
|
12
|
-
type InertiaSharedProps = SharedPageProps;
|
|
13
|
-
type InertiaPageComponent = keyof InertiaPageRegistry extends never ? string : Extract<keyof InertiaPageRegistry, string>;
|
|
14
|
-
type AllowInertiaWrappers<T> = { [K in keyof T]: T[K] | InertiaDeferredProp | InertiaMergeProp | InertiaOptionalProp | InertiaOnceProp | InertiaAlwaysProp };
|
|
15
|
-
type ResolvedInertiaPageProps<C extends InertiaPageComponent> = C extends keyof InertiaPageRegistry ? AllowInertiaWrappers<InertiaPageRegistry[C]> : Record<string, unknown>;
|
|
16
|
-
type InertiaFullPageProps<C extends InertiaPageComponent> = (C extends keyof InertiaPageRegistry ? InertiaPageRegistry[C] : Record<string, unknown>) & InertiaSharedProps;
|
|
17
|
-
interface InertiaRenderOptions {
|
|
18
|
-
encryptHistory?: boolean;
|
|
19
|
-
clearHistory?: boolean;
|
|
20
|
-
preserveFragment?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* HTTP status code to use for the rendered response. Defaults to `200`.
|
|
23
|
-
* Useful for rendering Inertia error pages (e.g. `Errors/404` with status 404).
|
|
24
|
-
*/
|
|
25
|
-
status?: ContentfulStatusCode;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Streaming SSR render result. `head` carries the document `<head>` tags Inertia
|
|
29
|
-
* collected during the synchronous shell render (known once the shell is ready);
|
|
30
|
-
* `stream` is React's `renderToReadableStream` output, piped into the `#app` body.
|
|
31
|
-
*/
|
|
32
|
-
interface InertiaSsrResult {
|
|
33
|
-
head: string[];
|
|
34
|
-
stream: ReadableStream<Uint8Array>;
|
|
35
|
-
}
|
|
36
|
-
interface InertiaSsrBundle {
|
|
37
|
-
render(page: Page): Promise<InertiaSsrResult>;
|
|
38
|
-
}
|
|
39
|
-
type SharedDataResolver = (ctx: RouterContext) => any;
|
|
40
|
-
interface ViteManifestEntry {
|
|
41
|
-
file: string;
|
|
42
|
-
css?: string[];
|
|
43
|
-
isEntry?: boolean;
|
|
44
|
-
imports?: string[];
|
|
45
|
-
dynamicImports?: string[];
|
|
46
|
-
src?: string;
|
|
47
|
-
}
|
|
48
|
-
type ViteManifest = Record<string, ViteManifestEntry>;
|
|
49
|
-
declare const INERTIA_PROP_OPTIONAL: unique symbol;
|
|
50
|
-
declare const INERTIA_PROP_DEFERRED: unique symbol;
|
|
51
|
-
declare const INERTIA_PROP_MERGE: unique symbol;
|
|
52
|
-
declare const INERTIA_PROP_ONCE: unique symbol;
|
|
53
|
-
declare const INERTIA_PROP_ALWAYS: unique symbol;
|
|
54
|
-
interface InertiaOptionalProp<T = unknown> {
|
|
55
|
-
[INERTIA_PROP_OPTIONAL]: true;
|
|
56
|
-
callback: () => T;
|
|
57
|
-
}
|
|
58
|
-
interface InertiaDeferredProp<T = unknown> {
|
|
59
|
-
[INERTIA_PROP_DEFERRED]: true;
|
|
60
|
-
callback: () => T;
|
|
61
|
-
group: string;
|
|
62
|
-
}
|
|
63
|
-
type InertiaMergeStrategy = 'append' | 'prepend' | 'deep';
|
|
64
|
-
interface InertiaMergeProp<T = unknown> {
|
|
65
|
-
[INERTIA_PROP_MERGE]: true;
|
|
66
|
-
callback: () => T;
|
|
67
|
-
strategy: InertiaMergeStrategy;
|
|
68
|
-
matchOn?: string;
|
|
69
|
-
}
|
|
70
|
-
interface InertiaOnceProp<T = unknown> {
|
|
71
|
-
[INERTIA_PROP_ONCE]: true;
|
|
72
|
-
callback: () => T;
|
|
73
|
-
expiresAt?: number | null;
|
|
74
|
-
key?: string;
|
|
75
|
-
}
|
|
76
|
-
interface InertiaAlwaysProp<T = unknown> {
|
|
77
|
-
[INERTIA_PROP_ALWAYS]: true;
|
|
78
|
-
callback: () => T;
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
export { ResolvedInertiaPageProps as _, InertiaMergeProp as a, ViteManifestEntry as b, InertiaOptionalProp as c, InertiaPageRegistry as d, InertiaRenderOptions as f, InertiaTranslationKeys as g, InertiaSsrResult as h, InertiaI18nConfig as i, InertiaPage as l, InertiaSsrBundle as m, InertiaDeferredProp as n, InertiaMergeStrategy as o, InertiaSharedProps as p, InertiaFullPageProps as r, InertiaOnceProp as s, InertiaAlwaysProp as t, InertiaPageComponent as u, SharedDataResolver as v, ViteManifest as y };
|
|
82
|
-
//# sourceMappingURL=types-BhgXhWx6.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-BhgXhWx6.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;UAMiB,mBAAA;AAAA,UAEA,iBAAA;AAAA,KAEL,sBAAA,GACV,iBAAA;EAA4B,eAAA;AAAA,IAA4C,CAAA,GAAI,WAAW;AAAA,KAI7E,kBAAA,GAAqB,eAAe;AAAA,KAEpC,oBAAA,SAA6B,mBAAA,0BAErC,OAAA,OAAc,mBAAA;AAAA,KAGb,oBAAA,oBACS,CAAA,GAAI,CAAA,CAAE,CAAA,IAAK,mBAAA,GAAsB,gBAAA,GAAmB,mBAAA,GAAsB,eAAA,GAAkB,iBAAA;AAAA,KAK9F,wBAAA,WAAmC,oBAAA,IAC7C,CAAA,eAAgB,mBAAA,GAAsB,oBAAA,CAAqB,mBAAA,CAAoB,CAAA,KAAM,MAAA;AAAA,KAG3E,oBAAA,WAA+B,oBAAA,KACxC,CAAA,eAAgB,mBAAA,GAAsB,mBAAA,CAAoB,CAAA,IAAK,MAAA,qBAA2B,kBAAA;AAAA,UAK5E,oBAAA;EACf,cAAA;EACA,YAAA;EACA,gBAAA;EA9BwE;;;AAAe;EAmCvF,MAAA,GAAS,oBAAoB;AAAA;;;AA/BiB;AAEhD;;UAqCiB,gBAAA;EACf,IAAA;EACA,MAAA,EAAQ,cAAc,CAAC,UAAA;AAAA;AAAA,UAGR,gBAAA;EACf,MAAA,CAAO,IAAA,EAAM,IAAA,GAAO,OAAA,CAAQ,gBAAA;AAAA;AAAA,KA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