@nifrajs/cli 2.10.0 → 2.11.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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/check.d.ts +9 -1
  3. package/dist/check.d.ts.map +1 -1
  4. package/dist/check.js +38 -6
  5. package/dist/check.js.map +1 -1
  6. package/dist/cli.d.ts +2 -18
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +95 -64
  9. package/dist/cli.js.map +1 -1
  10. package/dist/dev-bun-config.d.ts +17 -6
  11. package/dist/dev-bun-config.d.ts.map +1 -1
  12. package/dist/dev-bun-config.js +51 -14
  13. package/dist/dev-bun-config.js.map +1 -1
  14. package/dist/doctor.d.ts +10 -0
  15. package/dist/doctor.d.ts.map +1 -1
  16. package/dist/doctor.js +17 -1
  17. package/dist/doctor.js.map +1 -1
  18. package/dist/introspect.d.ts.map +1 -1
  19. package/dist/introspect.js +7 -1
  20. package/dist/introspect.js.map +1 -1
  21. package/dist/load.d.ts +4 -0
  22. package/dist/load.d.ts.map +1 -1
  23. package/dist/load.js +1 -0
  24. package/dist/load.js.map +1 -1
  25. package/dist/mcp-http.js +1 -1
  26. package/dist/mcp.js +2 -2
  27. package/dist/mcp.js.map +1 -1
  28. package/dist/pipeline-guard.d.ts +25 -10
  29. package/dist/pipeline-guard.d.ts.map +1 -1
  30. package/dist/pipeline-guard.js +35 -15
  31. package/dist/pipeline-guard.js.map +1 -1
  32. package/dist/pipeline-report.d.ts +34 -0
  33. package/dist/pipeline-report.d.ts.map +1 -0
  34. package/dist/pipeline-report.js +282 -0
  35. package/dist/pipeline-report.js.map +1 -0
  36. package/docs/llms-full.txt +200 -13
  37. package/docs/types.json +88 -5
  38. package/package.json +9 -9
  39. package/src/check.ts +54 -5
  40. package/src/cli.ts +99 -65
  41. package/src/dev-bun-config.ts +57 -14
  42. package/src/doctor.ts +28 -1
  43. package/src/introspect.ts +6 -0
  44. package/src/load.ts +5 -0
  45. package/src/mcp-http.ts +1 -1
  46. package/src/mcp.ts +2 -2
  47. package/src/pipeline-guard.ts +44 -14
  48. package/src/pipeline-report.ts +341 -0
@@ -3545,23 +3545,35 @@ Deploy: `wrangler pages deploy dist` (Pages) or `wrangler deploy`
3545
3545
  `server.ts` to hand-write. (`create-nifra` scaffolds the conventions.)
3546
3546
 
3547
3547
  ```ts
3548
- nifra dev # true-HMR dev server (Vite middleware + Nifra SSR) - http://localhost:4321
3548
+ nifra dev # true-HMR dev server (Bun native HMR + Nifra SSR) - http://localhost:4321
3549
+ nifra dev --vite # the Vite middleware pipeline instead (automatic when vitePlugins are your ONLY transforms)
3549
3550
  nifra build # full Bun deploy → dist/server.js + content-hashed dist/assets/ (default target: bun)
3550
3551
  nifra start # run dist/server.js on Bun
3551
3552
  nifra build --target cf-pages # also: node | deno | vercel | static; add --report for chunk sizes
3552
3553
 
3553
3554
  # dev + start share the default port 4321. Override per run: --port <n> (alias -p) or the PORT env var.
3554
3555
  # flags: --port <n> (dev/start) · --out <dir> (build/start) · --target <t> (build) · --poll (dev)
3556
+ # --vite | --bun (dev/build) force the pipeline
3555
3557
  ```
3556
3558
 
3557
3559
  ### The conventions
3558
3560
 
3559
- Four conventions at the project root. `nifra dev` runs the Vite-backed
3561
+ Four conventions at the project root. `nifra dev` runs the Bun-native
3560
3562
  [HMR dev server](/docs/dev); `nifra build` runs the Bun-native production
3561
3563
  build (content-hashed client assets plus a target-specific server); `nifra start`
3562
3564
  runs the default Bun output. The generated server serves assets and SSR with matched-route
3563
3565
  chunks preloaded and route CSS linked in each `<head>`.
3564
3566
 
3567
+ **One rule picks the bundler, and it is the same rule in both phases** - so a
3568
+ project can never be bundled by one toolchain in dev and the other in production. Bun runs
3569
+ everything, except an app whose _only_ transforms are `vitePlugins`: the Bun
3570
+ pipeline cannot run those, so that app gets Vite for dev and build alike, and says so.
3571
+ `--vite` / `--bun` force the choice; `--bun` is refused on a
3572
+ Vite-only app rather than dropping its transforms silently. Every `dev` and
3573
+ `build` run prints which bundler it picked and why, and `nifra check`
3574
+ answers the same question without starting a server - see
3575
+ [which pipeline runs, when](/docs/dev) for the full table.
3576
+
3565
3577
  ```ts
3566
3578
  my-app/
3567
3579
  routes/ # file-based routes (index.tsx, _layout.tsx, [id].tsx, …)
@@ -3844,9 +3856,9 @@ distinct.
3844
3856
 
3845
3857
  Nifra gives you two local development loops, and the rule between them is that one
3846
3858
  toolchain owns a whole phase. **Both** give you React Fast Refresh with state
3847
- preserved. Use `nifra dev` (Vite) for the plugin ecosystem, or
3848
- `nifra dev --bun` for one bundler across dev and prod with no Vite dependency.
3849
- Both serve your real SSR app locally, and neither mixes the two bundlers in one process.
3859
+ preserved. Bun is the default; Vite takes over automatically when your config's only
3860
+ transforms are `vitePlugins`. Both serve your real SSR app locally, and neither
3861
+ mixes the two bundlers in one process.
3850
3862
 
3851
3863
  ### Two loops, same app
3852
3864
 
@@ -3859,7 +3871,7 @@ use when
3859
3871
 
3860
3872
  Bun HMR + Fast Refresh (native)
3861
3873
  none (Bun only)
3862
- one bundler dev+prod; no Vite dep (no CSS Modules)
3874
+ one bundler dev+prod, no Vite dep; CSS Modules included
3863
3875
 
3864
3876
  `@nifrajs/web/vite`
3865
3877
 
@@ -3869,6 +3881,79 @@ true HMR (Fast Refresh / framework HMR)
3869
3881
 
3870
3882
  state-preserving UI iteration
3871
3883
 
3884
+ ### Which pipeline runs, when
3885
+
3886
+ One rule decides the bundler, and it decides it the same way for `nifra dev` and
3887
+ `nifra build` - your dev loop and your production build are never on different
3888
+ toolchains.
3889
+
3890
+ your config
3891
+ command
3892
+ pipeline
3893
+ why
3894
+
3895
+ no plugins at all
3896
+
3897
+ `nifra dev` / `nifra build`
3898
+
3899
+ Bun
3900
+ the default: no Vite dependency, one bundler across dev and prod
3901
+
3902
+ `clientPlugins` and/or `serverPlugins`
3903
+
3904
+ `nifra dev` / `nifra build`
3905
+
3906
+ Bun
3907
+ those slots are Bun.build plugins; Vite would never call them
3908
+
3909
+ `vitePlugins` only
3910
+
3911
+ `nifra dev` / `nifra build`
3912
+
3913
+ Vite (automatic)
3914
+ the Bun build cannot run them, so staying on Bun would silently drop your transforms
3915
+
3916
+ `vitePlugins` only
3917
+
3918
+ `--bun`
3919
+
3920
+ error
3921
+ nifra refuses rather than build an app with its compiler switched off
3922
+
3923
+ any
3924
+
3925
+ `--vite`
3926
+
3927
+ Vite (forced)
3928
+
3929
+ exact dev/prod client resolution for `conditions`, or a Vite-only plugin
3930
+
3931
+ any
3932
+
3933
+ `--bun`
3934
+
3935
+ Bun (forced)
3936
+ allowed whenever no transform would be lost
3937
+
3938
+ You never have to work this out from the table. Every `nifra dev` and
3939
+ `nifra build` run prints the answer under its banner, and
3940
+ `nifra check` and `nifra doctor` report it - with the config hazards
3941
+ below - without starting a server:
3942
+
3943
+ ```ts
3944
+ # doc-check: skip - fragment: terminal output, not source.
3945
+ $ nifra dev
3946
+ nifra dev (bun) → http://localhost:3000
3947
+ bundler: bun (default; --vite to switch)
3948
+
3949
+ $ nifra build
3950
+ nifra build (node, vite) → dist/server/server.js
3951
+ bundler: vite (auto: this app's only transforms are `vitePlugins` (svelte), which the Bun build cannot run)
3952
+
3953
+ $ nifra check
3954
+ • bundler: vite (auto: this app's only transforms are `vitePlugins` (svelte), which the Bun build cannot run)
3955
+ ```
3956
+
3872
3957
  ### State-preserving HMR
3873
3958
 
3874
3959
  Use `createViteDevServer` when you want component edits to update the browser
@@ -4012,10 +4097,12 @@ a component-only module swaps its markup with `useState` state intact, no reload
4012
4097
  boundary rule is the same as Vite's (see below). The real prize is that dev and production use
4013
4098
  the _same bundler_, so the dev/prod seam disappears.
4014
4099
 
4015
- One gap: **CSS Modules**. Bun's dev-server bundler has no
4016
- `*.module.css` transform (its production `Bun.build` does), so the CLI
4017
- refuses `--bun` for a CSS-Modules app rather than serving a broken client. Plain CSS
4018
- and Tailwind work normally.
4100
+ **CSS Modules included.** Bun's dev-server bundler has no
4101
+ `*.module.css` transform of its own, so the CLI hands it the same one the
4102
+ production `Bun.build` uses - and a class hashes to the same scoped name on every
4103
+ pipeline. Calling `createDevServer` as a library instead of through the CLI, you
4104
+ supply that plugin yourself through your own `bunfig.toml`; plain CSS and Tailwind
4105
+ need nothing either way.
4019
4106
 
4020
4107
  **
4021
4108
  Server functions and `*.server` modules work under `--bun`
@@ -4044,7 +4131,8 @@ source. A divergence between the loops is treated as a bug, not a caveat.
4044
4131
  import { createDevServer } from "@nifrajs/web/dev"
4045
4132
  // Bun.serve bundles + hot-reloads the client; Bun's runtime resolves SSR. An edit reloads the
4046
4133
  // changed module graph - with React Fast Refresh (state preserved) applied natively by Bun, no plugin.
4047
- // CSS + the entry URL come from Bun. Plain CSS/Tailwind work; *.module.css does not (Bun's dev bundler).
4134
+ // CSS + the entry URL come from Bun. Plain CSS/Tailwind work as-is; for *.module.css as a library
4135
+ // caller, pass the production CSS Modules plugin through your own bunfig (nifra dev --bun does it for you).
4048
4136
  const server = await createDevServer({ routesDir, outDir, clientModule, createApp })
4049
4137
  ```
4050
4138
 
@@ -4161,6 +4249,105 @@ own stylesheet. Pass `manifest.routeStyles` to `createWebApp` alongside
4161
4249
  `styles`, and Nifra links the matched route's CSS during SSR. In
4162
4250
  **dev**, Vite injects per-module CSS.
4163
4251
 
4252
+ ### Gotchas
4253
+
4254
+ The rule "one toolchain owns a whole phase" is what keeps the two loops honest, and most of
4255
+ what follows is a consequence of it. None of these are things you have to memorise before you
4256
+ start - they are the edges you can hit later, collected in one place.
4257
+
4258
+ #### Keep the adapter out of your config file
4259
+
4260
+ Split `framework.ts` (the adapter, imported by your server and edge entries) from
4261
+ `nifra.config.ts` (the CLI's config, where the Vite plugins and SFC compilers live).
4262
+ If your server entry reaches the adapter _through_ the config, everything the config
4263
+ imports is bundled into your production server - the Vite plugin, the framework compiler, and
4264
+ their native bindings. It builds without complaint and then fails at startup with a missing
4265
+ native binding, which reads like a broken install rather than a config-shape problem.
4266
+
4267
+ ```ts
4268
+ // doc-check: skip - fragment: two files from one app, shown together.
4269
+ // framework.ts - imported by your SERVER and edge entries. Adapter only, nothing else.
4270
+ import { svelteAdapter } from "@nifrajs/web-svelte"
4271
+ export const adapter = svelteAdapter
4272
+
4273
+ // nifra.config.ts - imported ONLY by the CLI, which runs on Bun. Compilers and Vite plugins
4274
+ // belong here. Re-export the adapter; never define it here, or the dev toolchain it pulls in
4275
+ // (Vite, the SFC compiler, their native bindings) is bundled into your production server.
4276
+ import { svelte } from "@sveltejs/vite-plugin-svelte"
4277
+ export { adapter } from "./framework"
4278
+ export const clientModule = "@nifrajs/web-svelte/client"
4279
+ export const vitePlugins = [svelte()]
4280
+ ```
4281
+
4282
+ #### Plugins go in the slot that matches the pipeline
4283
+
4284
+ `vitePlugins` run on the Vite pipeline; `clientPlugins` and
4285
+ `serverPlugins` run on the Bun one. A plugin in the wrong slot is not an error, it
4286
+ is a _no-op_ - your transform silently does not run. Nifra classifies each plugin by its
4287
+ hook shape and refuses a mismatch rather than letting the build succeed without it. The same
4288
+ check is why `--bun` throws for an app whose only transforms are
4289
+ `vitePlugins`, instead of building without them.
4290
+
4291
+ #### `conditions` does not reach the Bun dev client bundle
4292
+
4293
+ On the Bun pipeline, `conditions` governs SSR - `nifra dev` passes them
4294
+ to the runtime when it re-execs - and it governs the production client bundle. It cannot govern
4295
+ the client bundle the dev server serves: Bun's dev-server bundler accepts no resolve
4296
+ conditions, and there is no `bunfig.toml` key for them either (a top-level
4297
+ `conditions`, or one under `[run]`, `[serve.static]` or
4298
+ `[bundle]`, parses and is ignored). So a package with an `exports` map
4299
+ can resolve to one file in dev and another in `nifra build`. Nifra says so once at
4300
+ startup rather than letting you find out in production. If your app depends on exact dev/prod
4301
+ client resolution, run `nifra dev --vite`.
4302
+
4303
+ Related, if you ever pass the flag to `bun` yourself: it takes
4304
+ **one condition per flag**. The comma form is accepted and matches nothing,
4305
+ because Bun reads the whole string as a single condition name.
4306
+
4307
+ ```ts
4308
+ # Resolve conditions on the Bun dev pipeline.
4309
+ # SSR honours `conditions` - nifra passes them to the runtime when it re-execs.
4310
+ # The CLIENT bundle does not: Bun's dev-server bundler takes no resolve conditions,
4311
+ # from bunfig.toml or anywhere else. nifra warns once at startup when it matters.
4312
+ nifra dev --vite # exact dev/prod client resolution, if your app needs it
4313
+
4314
+ # If you invoke bun yourself: ONE FLAG PER CONDITION.
4315
+ bun --conditions=browser --conditions=development ./app.ts # correct
4316
+ bun --conditions=browser,development ./app.ts # ONE condition named "browser,development"
4317
+ ```
4318
+
4319
+ #### Editing a non-route file updates SSR too
4320
+
4321
+ On the Bun pipeline the dev server tracks the module graph your routes import, so editing a
4322
+ component, a helper, or a server module several levels down is reflected in the next SSR
4323
+ render - not just in the browser bundle. Modules you did _not_ touch keep their
4324
+ identity, so a module-level singleton stays single across the reload. Two limits are
4325
+ deliberate: files under `node_modules` are not tracked (they are dependencies, not
4326
+ your source), and a specifier only participates if it is relative and written literally - a
4327
+ computed or aliased specifier is invisible to a static graph. A third-party Bun plugin that
4328
+ rewrites imports needs to call `rewriteSsrImports` for its output to stay tracked.
4329
+
4330
+ #### An adapter with a compiled asset needs the dev server's loader
4331
+
4332
+ This one matters only if you are writing a render adapter. On the Vite pipeline Vite owns SSR
4333
+ resolution, which is what lets `resolve.dedupe` reach the server and keeps your app
4334
+ on one copy of the framework. Adapter packages themselves stay external to that graph, because
4335
+ the adapter's context object has to be the one instance your app imported. If such an adapter
4336
+ must load a _compiled_ asset on the server - Svelte's chain component is one - a plain
4337
+ `import` reaches a runtime with no compiler for it, and registering a second
4338
+ compiler in the runtime is worse: the tree then holds two copies of the framework runtime, and
4339
+ context written by one half is invisible to the other. Load it through
4340
+ `ssrModuleLoader()` instead, and take the framework's _server renderer_ from
4341
+ there as well - a component compiled by one toolchain has to render through the renderer that
4342
+ toolchain resolved.
4343
+
4344
+ #### Scoped class names are identical across pipelines
4345
+
4346
+ A CSS Modules class hashes to the same scoped name whichever pipeline produced it, and across
4347
+ machines - the hash is keyed on the class name plus the module's _package-relative_
4348
+ path, never an absolute one. A selector written against a generated name behaves the same under
4349
+ `nifra dev`, `nifra dev --bun`, and `nifra build`.
4350
+
4164
4351
  ## Nifra - Troubleshooting
4165
4352
 
4166
4353
  > Fixes keyed on the literal error strings Nifra prints: `reached the client bundle` (a node:/native import in the browser bundle), `server-only module reached the client bundle` (the server-only marker), and `resolveDispatcher` / `Invalid hook call` (duplicate React).
@@ -6877,7 +7064,7 @@ The `nifra` CLI - zero-config dev/build/start for a nifra app, plus the agent su
6877
7064
  `routes/`).
6878
7065
 
6879
7066
  ```
6880
- nifra dev [--port <n>] [--poll] True-HMR dev server (Vite + nifra SSR).
7067
+ nifra dev [--port <n>] [--poll] True-HMR dev server (Bun + nifra SSR; Vite for a Vite-only app).
6881
7068
  nifra build [--out <dir>] [--target <t>] Complete deploy directory; target defaults to Bun.
6882
7069
  nifra start [--port <n>] [--out <dir>] Run the generated Bun server at <out>/server.js.
6883
7070
  nifra context Print this project's API + page routes + conventions.
@@ -8955,7 +9142,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
8955
9142
 
8956
9143
  ## @nifrajs/web
8957
9144
 
8958
- `Action`, `ACTION_GLOBAL`, `apiKey`, `assertRenderAdapterConformance`, `Blocker`, `BlockerController`, `BlockerFunction`, `BlockerLocation`, `BlockerState`, `BrowserNavigate`, `buildManifest`, `CachedResponse`, `CacheStore`, `canonical`, `clientEntry`, `ClientRouter`, `ClientRouterOptions`, `createClientRouter`, `createMatcher`, `createMutation`, `createQueryClient`, `createWebApp`, `CreateWebAppOptions`, `DATA_GLOBAL`, `DATA_HEADER`, `DEFAULT_DEV_PORT`, `defer`, `Deferred`, `DehydratedState`, `disableDraft`, `DRAFT_COOKIE`, `DraftCookieControls`, `enableDraft`, `EnableDraftOptions`, `enumerateStaticRoutes`, `Fetcher`, `FetcherState`, `FetchRouteData`, `filePathToPattern`, `filePathToPatterns`, `FontDisplay`, `fontFace`, `FontFace`, `fontPreload`, `FontPreloadInput`, `FontSource`, `gate`, `generateClientEntry`, `GenerateClientEntryOptions`, `generateRouteSearchTypes`, `GenerateRouteSearchTypesOptions`, `generateServerManifest`, `GenerateServerManifestOptions`, `getBrowserNavigate`, `GetStaticPaths`, `gone`, `hashQueryKey`, `IDLE_BLOCKER`, `InertScriptType`, `InfiniteData`, `InfiniteQueryHandle`, `InfiniteQueryOptions`, `isDraftEnabled`, `ISR_REVALIDATE_HEADER`, `ISR_REVALIDATE_TAGS_HEADER`, `ISR_STATUS_HEADER`, `ISRApp`, `ISROptions`, `ISRPlatform`, `jsonLd`, `KVCacheStore`, `KVCacheStoreOptions`, `KVNamespaceLike`, `LAYOUT_DATA_GLOBAL`, `LayoutEntry`, `LinkDescriptor`, `Loader`, `LoaderContext`, `manifest`, `Manifest`, `MemoryCacheStore`, `MemoryCacheStoreOptions`, `mergeHeads`, `meta`, `Meta`, `MetaArgs`, `MetaInput`, `MountRouterOptions`, `MutationCallbacks`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NavigateSearchOf`, `NavigateTargetInput`, `notFound`, `openGraph`, `OpenGraphInput`, `PRE_HYDRATION_GUARD`, `previewEndpoint`, `PreviewEndpointOptions`, `PublicDirCache`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `QueryOptions`, `QueryState`, `QueryStatus`, `redirect`, `REDIRECT_HEADER`, `RedirectOptions`, `registerBlocker`, `RenderAdapter`, `RenderAdapterConformanceError`, `RenderAdapterConformanceFixture`, `RenderAssemblyCache`, `RenderedPage`, `renderPage`, `RenderPageInput`, `RenderPageOptions`, `renderPageResult`, `RenderProps`, `resolveMeta`, `resolveNavigate`, `resolvePublicPath`, `RETAIN_HEADER`, `revalidate`, `REVALIDATE_HEADER`, `revalidateEndpoint`, `RevalidateEndpointOptions`, `RevalidateResult`, `ROOT_ATTRIBUTE`, `ROUTE_GLOBAL`, `RouteEntry`, `RouteMatch`, `RouteModule`, `RoutePattern`, `RouterState`, `RouteSearch`, `routeStyles`, `ScriptDescriptor`, `searchOf`, `SearchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `servePublicDir`, `ServePublicDirOptions`, `SERVER_FN_MODULE`, `SERVER_ONLY_MODULE`, `ServerOnly`, `setBlockerController`, `setBrowserNavigate`, `StaticPath`, `StaticPaths`, `StaticRoutes`, `STATUS_HEADER`, `statusPage`, `StatusPageOptions`, `styles`, `Submission`, `SubmitOptions`, `unsafeInlineScript`, `UnsafeScriptDescriptor`, `withISR`
9145
+ `Action`, `ACTION_GLOBAL`, `apiKey`, `assertRenderAdapterConformance`, `Blocker`, `BlockerController`, `BlockerFunction`, `BlockerLocation`, `BlockerState`, `BrowserNavigate`, `buildManifest`, `CachedResponse`, `CacheStore`, `canonical`, `clientEntry`, `ClientRouter`, `ClientRouterOptions`, `createClientRouter`, `createMatcher`, `createMutation`, `createQueryClient`, `createWebApp`, `CreateWebAppOptions`, `DATA_GLOBAL`, `DATA_HEADER`, `DEFAULT_DEV_PORT`, `defer`, `Deferred`, `DehydratedState`, `disableDraft`, `DRAFT_COOKIE`, `DraftCookieControls`, `enableDraft`, `EnableDraftOptions`, `enumerateStaticRoutes`, `Fetcher`, `FetcherState`, `FetchRouteData`, `filePathToPattern`, `filePathToPatterns`, `FontDisplay`, `fontFace`, `FontFace`, `fontPreload`, `FontPreloadInput`, `FontSource`, `gate`, `generateClientEntry`, `GenerateClientEntryOptions`, `generateRouteSearchTypes`, `GenerateRouteSearchTypesOptions`, `generateServerManifest`, `GenerateServerManifestOptions`, `getBrowserNavigate`, `GetStaticPaths`, `gone`, `hashQueryKey`, `IDLE_BLOCKER`, `InertScriptType`, `InfiniteData`, `InfiniteQueryHandle`, `InfiniteQueryOptions`, `isDraftEnabled`, `ISR_REVALIDATE_HEADER`, `ISR_REVALIDATE_TAGS_HEADER`, `ISR_STATUS_HEADER`, `ISRApp`, `ISROptions`, `ISRPlatform`, `jsonLd`, `KVCacheStore`, `KVCacheStoreOptions`, `KVNamespaceLike`, `LAYOUT_DATA_GLOBAL`, `LayoutEntry`, `LinkDescriptor`, `Loader`, `LoaderContext`, `manifest`, `Manifest`, `MemoryCacheStore`, `MemoryCacheStoreOptions`, `mergeHeads`, `meta`, `Meta`, `MetaArgs`, `MetaInput`, `MountRouterOptions`, `MutationCallbacks`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NavigateSearchOf`, `NavigateTargetInput`, `notFound`, `openGraph`, `OpenGraphInput`, `PRE_HYDRATION_GUARD`, `previewEndpoint`, `PreviewEndpointOptions`, `PublicDirCache`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `QueryOptions`, `QueryState`, `QueryStatus`, `redirect`, `REDIRECT_HEADER`, `RedirectOptions`, `registerBlocker`, `RenderAdapter`, `RenderAdapterConformanceError`, `RenderAdapterConformanceFixture`, `RenderAssemblyCache`, `RenderedPage`, `renderPage`, `RenderPageInput`, `RenderPageOptions`, `renderPageResult`, `RenderProps`, `resolveMeta`, `resolveNavigate`, `resolvePublicPath`, `RETAIN_HEADER`, `revalidate`, `REVALIDATE_HEADER`, `revalidateEndpoint`, `RevalidateEndpointOptions`, `RevalidateResult`, `ROOT_ATTRIBUTE`, `ROUTE_GLOBAL`, `RouteEntry`, `RouteMatch`, `RouteModule`, `RoutePattern`, `RouterState`, `RouteSearch`, `routeStyles`, `ScriptDescriptor`, `searchOf`, `SearchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `servePublicDir`, `ServePublicDirOptions`, `SERVER_FN_MODULE`, `SERVER_ONLY_MODULE`, `ServerOnly`, `setBlockerController`, `setBrowserNavigate`, `setSsrModuleLoader`, `ssrModuleLoader`, `SsrModuleLoader`, `StaticPath`, `StaticPaths`, `StaticRoutes`, `STATUS_HEADER`, `statusPage`, `StatusPageOptions`, `styles`, `Submission`, `SubmitOptions`, `unsafeInlineScript`, `UnsafeScriptDescriptor`, `withISR`
8959
9146
 
8960
9147
  ## @nifrajs/web-preact
8961
9148
 
package/docs/types.json CHANGED
@@ -3229,6 +3229,33 @@
3229
3229
  "signature": "export declare function detectServerOnlyInClient(graph: ClientModuleGraph): ReadonlyArray<ServerOnlyFinding>;",
3230
3230
  "doc": "/**\n * Scan a build's metafile for any module that opts into the `server-only` marker (a side-effect\n * `import \"@nifrajs/web/server-only\"`) yet landed in a CLIENT output chunk, returning a sorted, deduped\n * list of {@link ServerOnlyFinding}s. Mirrors {@link detectNodeBuiltinsInClient}: it reads the SAME\n * graph facts - which inputs import the marker (the \"marked\" modules), which chunk each landed in (the\n * per-output `inputs`), and the shortest import chain from a user entry to it. The marker module ITSELF\n * (which imports nothing) is excluded - only the modules that *opt in* are flagged. Pure + exported for\n * unit testing. Empty ⇒ clean.\n */"
3231
3231
  },
3232
+ {
3233
+ "name": "DEV_HMR_ENV",
3234
+ "kind": "const",
3235
+ "package": "@nifrajs/web",
3236
+ "signature": "export declare const DEV_HMR_ENV = \"NIFRA_DEV_HMR\";",
3237
+ "doc": "/**\n * Env flag a nifra dev server sets for its own lifetime, so a framework compiler plugin can tell a dev\n * compile from a `nifra build` one. Exported for the dev server that sets it; plugins ask\n * {@link devServerCompile} instead of reading it.\n */"
3238
+ },
3239
+ {
3240
+ "name": "DEV_ROOT_ENV",
3241
+ "kind": "const",
3242
+ "package": "@nifrajs/web",
3243
+ "signature": "export declare const DEV_ROOT_ENV = \"NIFRA_DEV_ROOT\";",
3244
+ "doc": "/**\n * The app root and the routes directory of the running dev server, for plugins that need to tell one of\n * the app's own components from a dependency or a route module. Set alongside {@link DEV_HMR_ENV}; read\n * through {@link devHotComponent}.\n */"
3245
+ },
3246
+ {
3247
+ "name": "DEV_ROUTES_ENV",
3248
+ "kind": "const",
3249
+ "package": "@nifrajs/web",
3250
+ "signature": "export declare const DEV_ROUTES_ENV = \"NIFRA_DEV_ROUTES\";"
3251
+ },
3252
+ {
3253
+ "name": "devHotComponent",
3254
+ "kind": "function",
3255
+ "package": "@nifrajs/web",
3256
+ "signature": "export declare function devHotComponent(path: string): boolean;",
3257
+ "doc": "/**\n * Whether a dev compile of `path` may wrap the module in component-level hot-patching - i.e. whether it\n * is one of the app's OWN components rather than a dependency or a route module.\n *\n * The exclusions are not caution, they are two things such a wrapper cannot survive:\n *\n * - a **dependency**, whose components are the framework's own composition machinery. An adapter folds\n * a layout chain through them, so they are entered from a snippet or as a dynamic component - and a\n * wrapper there sits between the SSR markup and the component that is supposed to claim it.\n * - a **route module**, for the same reason one level down: a route or layout IS a chain member, so it\n * is always the dynamic child. It is also the wrong boundary to patch - a route module carries the\n * loader and meta the server ran, and re-running those is a navigation, not a patch. Editing one\n * finds no accepting module and reloads the page, which is the correct outcome.\n *\n * Both cost nothing in practice: the components an edit loop actually touches are the views, and a view\n * that wants to hot-patch lives outside the routes directory. Where the split is unknown (no dev server,\n * or a root that was never announced), the answer is `false` - a full reload is always correct, a\n * mispatched tree is not.\n */"
3258
+ },
3232
3259
  {
3233
3260
  "name": "devHtml",
3234
3261
  "kind": "function",
@@ -3242,6 +3269,13 @@
3242
3269
  "package": "@nifrajs/web",
3243
3270
  "signature": "export interface DevServer {\n readonly port: number;\n /**\n * The URL pages point their client entry at - always {@link CLIENT_ENTRY_PATH}, never Bun's hashed\n * chunk. Deliberately not the underlying chunk URL: that one moves on every rebuild, and anything\n * holding onto it is holding onto a URL that will stop working.\n */\n readonly clientEntry: string;\n stop(): void;\n}"
3244
3271
  },
3272
+ {
3273
+ "name": "devServerCompile",
3274
+ "kind": "function",
3275
+ "package": "@nifrajs/web",
3276
+ "signature": "export declare function devServerCompile(): boolean;",
3277
+ "doc": "/**\n * True while a nifra dev server is running, i.e. the compile may emit HMR wiring (and, where the\n * framework couples the two, dev-mode runtime output).\n *\n * The phase cannot be a plugin constructor argument: an app builds its `clientPlugins` once in\n * `nifra.config.ts` and the same plugin objects serve both `nifra dev` and `nifra build`. Guarding the\n * emitted code with `if (import.meta.hot)` is not sufficient either - `Bun.build` keeps the branch, so\n * the HMR calls were measured shipping in production client chunks. The dev server announces itself in\n * the environment instead, and `nifra build` never sets it. Read per compile (not captured at\n * registration) so the flag is honoured however late the server sets it.\n */"
3278
+ },
3245
3279
  {
3246
3280
  "name": "DevServerOptions",
3247
3281
  "kind": "interface",
@@ -4520,6 +4554,13 @@
4520
4554
  "signature": "export declare class Histogram {\n readonly name: string;\n readonly help: string;\n private readonly series;\n private readonly buckets;\n constructor(name: string, help: string, buckets: readonly number[]);\n observe(value: number, labels?: Labels): void;\n render(): string;\n}",
4521
4555
  "doc": "/** Latency-style distribution over fixed buckets (seconds). Renders Prometheus cumulative buckets. */"
4522
4556
  },
4557
+ {
4558
+ "name": "hotUpdateNeedsReload",
4559
+ "kind": "const",
4560
+ "package": "@nifrajs/web-preact",
4561
+ "signature": "export declare const hotUpdateNeedsReload = true;",
4562
+ "doc": "/**\n * Preact cannot apply Bun's hot updates, so the generated client entry reloads instead.\n *\n * Bun's dev server runs React Fast Refresh over JSX modules. A Preact component compiles to JSX that\n * looks the same, so the update is ACCEPTED - and then dropped, because Preact's refresh runtime\n * (prefresh) is not the one Bun installs. Measured: `bun:beforeUpdate` and `bun:afterUpdate` both fire,\n * the server logs the rebuild, the browser keeps rendering the old component and never reloads. The\n * edit simply appears not to happen.\n *\n * Reloading loses component state, which React keeps here. That is the honest trade until Bun's dev\n * server can install prefresh: a visible reload beats an edit that silently does nothing.\n */"
4563
+ },
4523
4564
  {
4524
4565
  "name": "html",
4525
4566
  "kind": "function",
@@ -6186,7 +6227,7 @@
6186
6227
  "kind": "function",
6187
6228
  "package": "@nifrajs/web",
6188
6229
  "signature": "export declare function mergeHeads(heads: readonly Meta[]): Meta;",
6189
- "doc": "/**\n * Merge a route's `<head>` contributions from its layout chain + the page into one {@link Meta}.\n *\n * The head contract (see {@link CreateWebAppOptions} and `LayoutEntry`): a `_layout.tsx` may export\n * `meta` to put sitewide tags (`hreflang`, `preconnect`, a default `<title>`, …) on every page below\n * it. `heads` is passed **outermost layout → … → innermost layout → page** (the same order as the\n * render chain), and merges:\n * - **`title`** - *nearest-wins*: the last defined value across the list, so the page overrides an\n * inner layout, which overrides an outer one. A layout `title` is the section default; an undefined\n * page `title` keeps it.\n * - **`meta` / `link`** - *concatenated* in list order (outermost first, page last). Duplicate-tag\n * de-duplication is the caller's concern; the framework emits exactly what's declared so a layout\n * can ship N `<link rel=\"alternate\" hreflang>` tags and a page can add its own canonical.\n *\n * Returns a fresh object whose identity is stable per `heads` *content* only when every entry is a\n * static (by-reference) `Meta` and there is exactly one - otherwise a new object each call. That is\n * fine: {@link headTags}'s memo is keyed on identity, so a per-request merge simply recomputes (its\n * content can vary with loader data anyway).\n */"
6230
+ "doc": "/**\n * Merge a layout chain's heads, outermost first: `title`/`lang`/`dir` are nearest-wins, and\n * `meta`/`link`/`script` concatenate in chain order.\n *\n * Returns a fresh object whose identity is stable per `heads` *content* only when every entry is a\n * static (by-reference) `Meta` and there is exactly one - otherwise a new object each call. That is\n * fine: `headTags`'s memo is keyed on identity, so a per-request merge simply recomputes (its\n * content can vary with loader data anyway).\n */"
6190
6231
  },
6191
6232
  {
6192
6233
  "name": "Messages",
@@ -8352,7 +8393,7 @@
8352
8393
  "kind": "function",
8353
8394
  "package": "@nifrajs/web",
8354
8395
  "signature": "export declare function resolveMeta(meta: MetaInput | undefined, args: MetaArgs): Meta;",
8355
- "doc": "/** Resolve a route's `meta` (static or a function of the loader data + params) to a {@link Meta}. */"
8396
+ "doc": "/** Resolve a route's `meta` export - a static object, or a function of the route's data/params. */"
8356
8397
  },
8357
8398
  {
8358
8399
  "name": "resolveNavigate",
@@ -8614,6 +8655,13 @@
8614
8655
  "signature": "export interface RevalidateResult<T> {\n readonly __nifraRevalidate: readonly string[];\n readonly data: T;\n}",
8615
8656
  "doc": "/** The wrapper `revalidate()` returns: the action's `data` plus the paths it changed. A plain tagged\n * shape (not a class) so `@nifrajs/client`'s `ActionData` can unwrap it structurally without importing\n * from `@nifrajs/web`. `createWebApp` strips the wrapper - the client receives `data` as the body and\n * the paths via the `X-Nifra-Revalidate` header. */"
8616
8657
  },
8658
+ {
8659
+ "name": "rewriteSsrImports",
8660
+ "kind": "function",
8661
+ "package": "@nifrajs/web",
8662
+ "signature": "export declare function rewriteSsrImports(contents: string, path: string, generate: \"dom\" | \"ssr\"): string;",
8663
+ "doc": "/**\n * Re-key the app-owned imports of a module a **server-side** plugin just compiled. A plugin that claims a\n * file extension is the only code that sees that file's source, so it is the only place its imports can\n * be versioned; without this call every component in that language stays on the code it had at startup.\n *\n * A no-op outside a Bun dev server, and on the client half of a plugin - the client is bundled, and a\n * bundle has no import cache to bust.\n */"
8664
+ },
8617
8665
  {
8618
8666
  "name": "richWireCodec",
8619
8667
  "kind": "function",
@@ -9206,6 +9254,13 @@
9206
9254
  "signature": "export interface SchemaSnapshot {\n readonly jsonSchema?: JsonSchema;\n readonly fields?: readonly ReflectedSchemaField[];\n}",
9207
9255
  "doc": "/** One schema position in a snapshot: JSON Schema metadata only, no validator. */"
9208
9256
  },
9257
+ {
9258
+ "name": "scopedName",
9259
+ "kind": "function",
9260
+ "package": "@nifrajs/web",
9261
+ "signature": "export declare function scopedName(filePath: string, className: string): string;",
9262
+ "doc": "/**\n * The scoped name for a class. Keyed by `filePath` + `className` (NUL-separated so `\"a\"+\"bc\"` can't\n * collide with `\"ab\"+\"c\"`), so the same class name in two different files gets two different scoped\n * names - cross-file collision resistance - while staying stable across builds.\n *\n * Exported because it is the definition of the name, and the OTHER pipeline has to be able to produce\n * it: Vite ships its own CSS-Modules naming, so without handing Vite this function a class is called\n * one thing under `nifra dev --vite` and another after `nifra build`. `filePath` must be the\n * package-relative form from `reproduciblePath`, never an absolute path, or the name stops being\n * reproducible across machines.\n */"
9263
+ },
9209
9264
  {
9210
9265
  "name": "ScriptDescriptor",
9211
9266
  "kind": "interface",
@@ -9798,6 +9853,13 @@
9798
9853
  "signature": "export type SetSearchParams = (next: SearchParamsInit | ((prev: URLSearchParams) => SearchParamsInit), options?: NavigateOptions) => void;",
9799
9854
  "doc": "/** Set the query string. Accepts a `URLSearchParams`, a record, a raw string, or an updater of the\n * current params; navigates to the same pathname with the new query (push, or replace via options). */"
9800
9855
  },
9856
+ {
9857
+ "name": "setSsrModuleLoader",
9858
+ "kind": "function",
9859
+ "package": "@nifrajs/web",
9860
+ "signature": "export declare function setSsrModuleLoader(load: SsrModuleLoader | undefined): void;",
9861
+ "doc": "/**\n * Publishes the dev server's SSR module loader. Called by a dev server that owns SSR resolution\n * itself; pass `undefined` to clear it on shutdown.\n */"
9862
+ },
9801
9863
  {
9802
9864
  "name": "shapeOf",
9803
9865
  "kind": "function",
@@ -9981,7 +10043,7 @@
9981
10043
  "kind": "function",
9982
10044
  "package": "@nifrajs/web-solid",
9983
10045
  "signature": "export declare function solidBunPlugin(generate: \"dom\" | \"ssr\"): BunPlugin;",
9984
- "doc": "/**\n * Bun build/runtime plugin that compiles Solid components with Babel - `generate: \"ssr\"`\n * for the server, `\"dom\"` for the client, `hydratable` so SSR and hydrate align. Solid's\n * reactive-JSX compiler ships only as a Babel plugin (no swc/native port); this runs at\n * build time, on `.tsx` files only.\n */"
10046
+ "doc": "/**\n * Bun build/runtime plugin that compiles Solid components with Babel - `generate: \"ssr\"`\n * for the server, `\"dom\"` for the client, `hydratable` so SSR and hydrate align. Solid's\n * reactive-JSX compiler ships only as a Babel plugin (no swc/native port); this runs at\n * build time, on `.tsx` files only.\n *\n * Under a dev server the client half additionally runs `solid-refresh`, which is what makes an edit\n * patch the running component tree instead of reloading the page - see {@link setupSolidRefresh}.\n */"
9985
10047
  },
9986
10048
  {
9987
10049
  "name": "solidMdxBunPlugin",
@@ -10115,6 +10177,20 @@
10115
10177
  "signature": "export interface SSEStream {\n /** Enqueue an event frame. No-op once the stream is closed. */\n send(message: SSEMessage): void;\n /** End the stream now. */\n close(): void;\n /** Aborts when the client disconnects - use it to tear down subscriptions/loops. */\n readonly signal: AbortSignal;\n}",
10116
10178
  "doc": "/** The stream handed to the `run` callback. */"
10117
10179
  },
10180
+ {
10181
+ "name": "ssrModuleLoader",
10182
+ "kind": "function",
10183
+ "package": "@nifrajs/web",
10184
+ "signature": "export declare function ssrModuleLoader(): SsrModuleLoader | undefined;",
10185
+ "doc": "/**\n * The dev server's SSR module loader, or `undefined` when nothing owns SSR resolution but the runtime\n * - the Bun dev pipeline, and every production build, where the adapter's assets are compiled ahead\n * of time and a plain `import` is already the right thing.\n *\n * An adapter that must load a COMPILED asset at runtime (a `.svelte` component, say) has to prefer\n * this over a bare `import`, and has to take the framework's SERVER RENDERER from it as well, not\n * just the component. A component compiled by the dev server renders through the renderer the dev\n * server resolved; mixing the two puts two copies of the framework runtime in one component tree,\n * where context written by one half is invisible to the other.\n */"
10186
+ },
10187
+ {
10188
+ "name": "SsrModuleLoader",
10189
+ "kind": "type",
10190
+ "package": "@nifrajs/web",
10191
+ "signature": "export type SsrModuleLoader = (id: string) => Promise<unknown>;",
10192
+ "doc": "/**\n * Loads a module through the DEV SERVER'S module graph rather than the runtime's. Takes an absolute\n * file path or a bare specifier; resolution, compilation and caching are the dev server's.\n */"
10193
+ },
10118
10194
  {
10119
10195
  "name": "StandardFailure",
10120
10196
  "kind": "interface",
@@ -10541,6 +10617,13 @@
10541
10617
  "signature": "export declare const svelteDedupePlugin: (from: string) => BunPlugin;",
10542
10618
  "doc": "/**\n * Dedupe Svelte to a single copy - the Svelte analogue of `reactDedupePlugin`/`preactDedupePlugin`, closing\n * the same class of bug for Svelte (which had NO build-time dedup before). A workspace- or file-linked\n * `@nifrajs/web-svelte` can resolve its OWN `svelte` (e.g. a sibling repo's install store) while the app's\n * components resolve another - SAME version, two physical copies. Svelte 5's client runtime\n * (`svelte/internal/client`) holds module-level component-context state, so two copies means the compiled\n * components register on one runtime while `hydrate` runs on the other → hydration throws\n * `Cannot read properties of undefined (reading 'call')` and the server-rendered markup is wiped.\n *\n * Pin every `svelte` + `svelte/internal/*` import to the ONE copy resolvable from `from` (the app root) so\n * the renderer (`hydrate`/`mount`) and the compiled components share one runtime. Unlike react/preact (a\n * fixed subpath list), Svelte has many internal subpaths, so each matched import is resolved dynamically.\n * `svelte/compiler` (build-time only, not in the bundle) doesn't match the filter and is left alone. No-op\n * when Svelte isn't used / isn't resolvable from `from`.\n */"
10543
10619
  },
10620
+ {
10621
+ "name": "svelteHmrBoundary",
10622
+ "kind": "function",
10623
+ "package": "@nifrajs/web-svelte",
10624
+ "signature": "export declare function svelteHmrBoundary({ filename }: {\n filename: string;\n}): {\n hmr: boolean;\n};",
10625
+ "doc": "/**\n * The same hot-patch boundary as the Bun pipeline's, in the shape `@sveltejs/vite-plugin-svelte` takes:\n *\n * ```ts\n * svelte({ dynamicCompileOptions: svelteHmrBoundary })\n * ```\n *\n * Svelte's HMR wrapper resolves the component through a signal, which survives hydration only where\n * the component is a plain child in a template. A layout or a page is not: the adapter's `Chain` enters\n * chain members as dynamic components and through snippets, so a wrapper on one leaves the hydration\n * cursor pointing at markup the wrapped component never claims. Svelte then throws the server's tree\n * away and re-renders on the client - `hydration_mismatch` in the console, on first load, before any\n * edit. Left on, the dev server quietly stops exercising hydration at all.\n *\n * Views keep hot-patching; route modules fall back to a full reload, which is what they want anyway\n * (a route module carries the loader and meta the server ran, and re-running those is a navigation).\n * Outside a nifra dev server nothing is announced and the answer is \"no boundary\" - a full reload is\n * always correct, a mispatched tree is not.\n */"
10626
+ },
10544
10627
  {
10545
10628
  "name": "svelteMdxBunPlugin",
10546
10629
  "kind": "function",
@@ -11609,14 +11692,14 @@
11609
11692
  "name": "VERSION",
11610
11693
  "kind": "const",
11611
11694
  "package": "@nifrajs/core",
11612
- "signature": "export declare const VERSION: \"2.10.0\";",
11695
+ "signature": "export declare const VERSION: \"2.11.0\";",
11613
11696
  "doc": "/**\n * Current package version. A hardcoded literal on purpose - core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version.\n */"
11614
11697
  },
11615
11698
  {
11616
11699
  "name": "VERSION",
11617
11700
  "kind": "const",
11618
11701
  "package": "nifra",
11619
- "signature": "export declare const VERSION: \"2.10.0\";",
11702
+ "signature": "export declare const VERSION: \"2.11.0\";",
11620
11703
  "doc": "/**\n * Current package version. A hardcoded literal on purpose - core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version.\n */"
11621
11704
  },
11622
11705
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nifrajs/cli",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "The nifra CLI - zero-config dev/build/start for a nifra app (`nifra dev`, `nifra build`, `nifra start`).",
5
5
  "keywords": [
6
6
  "bun",
@@ -41,14 +41,14 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@nifrajs/client": "2.10.0",
45
- "@nifrajs/core": "2.10.0",
46
- "@nifrajs/mcp": "2.10.0",
47
- "@nifrajs/runner": "2.10.0",
48
- "@nifrajs/schema": "2.10.0",
49
- "@nifrajs/testing": "2.10.0",
50
- "@nifrajs/web": "2.10.0",
51
- "create-nifra": "2.10.0"
44
+ "@nifrajs/client": "2.11.0",
45
+ "@nifrajs/core": "2.11.0",
46
+ "@nifrajs/mcp": "2.11.0",
47
+ "@nifrajs/runner": "2.11.0",
48
+ "@nifrajs/schema": "2.11.0",
49
+ "@nifrajs/testing": "2.11.0",
50
+ "@nifrajs/web": "2.11.0",
51
+ "create-nifra": "2.11.0"
52
52
  },
53
53
  "repository": {
54
54
  "type": "git",