@nifrajs/cli 5.1.0 → 5.3.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 (230) hide show
  1. package/CHANGELOG.md +3313 -0
  2. package/README.md +3 -0
  3. package/dist/agent-files.d.ts +19 -11
  4. package/dist/agent-files.d.ts.map +1 -1
  5. package/dist/agent-files.js +26 -18
  6. package/dist/agent-files.js.map +1 -1
  7. package/dist/assure-hydration.d.ts.map +1 -1
  8. package/dist/assure-hydration.js +7 -2
  9. package/dist/assure-hydration.js.map +1 -1
  10. package/dist/assure.d.ts.map +1 -1
  11. package/dist/assure.js +14 -1
  12. package/dist/assure.js.map +1 -1
  13. package/dist/capabilities-tool.d.ts.map +1 -1
  14. package/dist/capabilities-tool.js +131 -45
  15. package/dist/capabilities-tool.js.map +1 -1
  16. package/dist/check-diagnostics.d.ts +5 -0
  17. package/dist/check-diagnostics.d.ts.map +1 -1
  18. package/dist/check-diagnostics.js +5 -0
  19. package/dist/check-diagnostics.js.map +1 -1
  20. package/dist/check-scan.d.ts +9 -3
  21. package/dist/check-scan.d.ts.map +1 -1
  22. package/dist/check-scan.js +61 -21
  23. package/dist/check-scan.js.map +1 -1
  24. package/dist/check.d.ts.map +1 -1
  25. package/dist/check.js +55 -15
  26. package/dist/check.js.map +1 -1
  27. package/dist/cli.d.ts.map +1 -1
  28. package/dist/cli.js +37 -18
  29. package/dist/cli.js.map +1 -1
  30. package/dist/command-catalog.d.ts.map +1 -1
  31. package/dist/command-catalog.js +9 -5
  32. package/dist/command-catalog.js.map +1 -1
  33. package/dist/db-tool.d.ts.map +1 -1
  34. package/dist/db-tool.js +2 -1
  35. package/dist/db-tool.js.map +1 -1
  36. package/dist/dev-bun-config.d.ts +6 -3
  37. package/dist/dev-bun-config.d.ts.map +1 -1
  38. package/dist/dev-bun-config.js +13 -10
  39. package/dist/dev-bun-config.js.map +1 -1
  40. package/dist/dev-feed-tool.d.ts +3 -2
  41. package/dist/dev-feed-tool.d.ts.map +1 -1
  42. package/dist/dev-feed-tool.js +26 -5
  43. package/dist/dev-feed-tool.js.map +1 -1
  44. package/dist/doctor.d.ts +15 -1
  45. package/dist/doctor.d.ts.map +1 -1
  46. package/dist/doctor.js +79 -61
  47. package/dist/doctor.js.map +1 -1
  48. package/dist/env-file.d.ts.map +1 -1
  49. package/dist/env-file.js +41 -8
  50. package/dist/env-file.js.map +1 -1
  51. package/dist/i18n-check.d.ts +11 -1
  52. package/dist/i18n-check.d.ts.map +1 -1
  53. package/dist/i18n-check.js +170 -17
  54. package/dist/i18n-check.js.map +1 -1
  55. package/dist/init-agents.d.ts +46 -6
  56. package/dist/init-agents.d.ts.map +1 -1
  57. package/dist/init-agents.js +193 -31
  58. package/dist/init-agents.js.map +1 -1
  59. package/dist/internal/project-specifiers.d.ts.map +1 -1
  60. package/dist/internal/project-specifiers.js +9 -1
  61. package/dist/internal/project-specifiers.js.map +1 -1
  62. package/dist/internal/source-facts.d.ts +22 -0
  63. package/dist/internal/source-facts.d.ts.map +1 -1
  64. package/dist/internal/source-facts.js +322 -0
  65. package/dist/internal/source-facts.js.map +1 -1
  66. package/dist/internal/workspace-packages.d.ts +22 -0
  67. package/dist/internal/workspace-packages.d.ts.map +1 -0
  68. package/dist/internal/workspace-packages.js +215 -0
  69. package/dist/internal/workspace-packages.js.map +1 -0
  70. package/dist/load.d.ts +7 -2
  71. package/dist/load.d.ts.map +1 -1
  72. package/dist/load.js +11 -2
  73. package/dist/load.js.map +1 -1
  74. package/dist/lock-links.d.ts +42 -0
  75. package/dist/lock-links.d.ts.map +1 -0
  76. package/dist/lock-links.js +144 -0
  77. package/dist/lock-links.js.map +1 -0
  78. package/dist/mcp-exec.d.ts +1 -0
  79. package/dist/mcp-exec.d.ts.map +1 -1
  80. package/dist/mcp-exec.js +16 -5
  81. package/dist/mcp-exec.js.map +1 -1
  82. package/dist/mcp-http.js +1 -1
  83. package/dist/mcp-io.d.ts +23 -3
  84. package/dist/mcp-io.d.ts.map +1 -1
  85. package/dist/mcp-io.js +59 -12
  86. package/dist/mcp-io.js.map +1 -1
  87. package/dist/mcp-isolate.d.ts.map +1 -1
  88. package/dist/mcp-isolate.js +2 -1
  89. package/dist/mcp-isolate.js.map +1 -1
  90. package/dist/mcp-root.d.ts +6 -4
  91. package/dist/mcp-root.d.ts.map +1 -1
  92. package/dist/mcp-root.js +12 -8
  93. package/dist/mcp-root.js.map +1 -1
  94. package/dist/migrate-layout.d.ts +2 -1
  95. package/dist/migrate-layout.d.ts.map +1 -1
  96. package/dist/migrate-layout.js +435 -29
  97. package/dist/migrate-layout.js.map +1 -1
  98. package/dist/project-site.d.ts +7 -0
  99. package/dist/project-site.d.ts.map +1 -0
  100. package/dist/project-site.js +19 -0
  101. package/dist/project-site.js.map +1 -0
  102. package/dist/recipes/4.0.0.d.ts.map +1 -1
  103. package/dist/recipes/4.0.0.js +2 -0
  104. package/dist/recipes/4.0.0.js.map +1 -1
  105. package/dist/recipes/5.1.0.d.ts +9 -0
  106. package/dist/recipes/5.1.0.d.ts.map +1 -0
  107. package/dist/recipes/5.1.0.js +22 -0
  108. package/dist/recipes/5.1.0.js.map +1 -0
  109. package/dist/recipes/5.2.0.d.ts +10 -0
  110. package/dist/recipes/5.2.0.d.ts.map +1 -0
  111. package/dist/recipes/5.2.0.js +32 -0
  112. package/dist/recipes/5.2.0.js.map +1 -0
  113. package/dist/recipes/5.3.0.d.ts +11 -0
  114. package/dist/recipes/5.3.0.d.ts.map +1 -0
  115. package/dist/recipes/5.3.0.js +35 -0
  116. package/dist/recipes/5.3.0.js.map +1 -0
  117. package/dist/recipes/index.d.ts +3 -0
  118. package/dist/recipes/index.d.ts.map +1 -1
  119. package/dist/recipes/index.js +9 -0
  120. package/dist/recipes/index.js.map +1 -1
  121. package/dist/review.d.ts.map +1 -1
  122. package/dist/review.js +4 -0
  123. package/dist/review.js.map +1 -1
  124. package/dist/rule-explain.d.ts +26 -0
  125. package/dist/rule-explain.d.ts.map +1 -0
  126. package/dist/rule-explain.js +49 -0
  127. package/dist/rule-explain.js.map +1 -0
  128. package/dist/rules/codes.d.ts +4 -0
  129. package/dist/rules/codes.d.ts.map +1 -1
  130. package/dist/rules/codes.js +4 -0
  131. package/dist/rules/codes.js.map +1 -1
  132. package/dist/rules/contract-visibility.d.ts.map +1 -1
  133. package/dist/rules/contract-visibility.js +93 -21
  134. package/dist/rules/contract-visibility.js.map +1 -1
  135. package/dist/rules/explanations.d.ts +14 -0
  136. package/dist/rules/explanations.d.ts.map +1 -0
  137. package/dist/rules/explanations.js +326 -0
  138. package/dist/rules/explanations.js.map +1 -0
  139. package/dist/rules/legacy.d.ts.map +1 -1
  140. package/dist/rules/legacy.js +24 -1
  141. package/dist/rules/legacy.js.map +1 -1
  142. package/dist/rules/merge-auth.d.ts +12 -0
  143. package/dist/rules/merge-auth.d.ts.map +1 -0
  144. package/dist/rules/merge-auth.js +52 -0
  145. package/dist/rules/merge-auth.js.map +1 -0
  146. package/dist/rules/pages.d.ts +51 -0
  147. package/dist/rules/pages.d.ts.map +1 -1
  148. package/dist/rules/pages.js +293 -2
  149. package/dist/rules/pages.js.map +1 -1
  150. package/dist/rules/route-statement.d.ts +10 -0
  151. package/dist/rules/route-statement.d.ts.map +1 -0
  152. package/dist/rules/route-statement.js +150 -0
  153. package/dist/rules/route-statement.js.map +1 -0
  154. package/dist/rules/routes.d.ts +3 -2
  155. package/dist/rules/routes.d.ts.map +1 -1
  156. package/dist/rules/routes.js +4 -3
  157. package/dist/rules/routes.js.map +1 -1
  158. package/dist/rules/zones.d.ts.map +1 -1
  159. package/dist/rules/zones.js +3 -2
  160. package/dist/rules/zones.js.map +1 -1
  161. package/dist/typecheck-coverage.d.ts +11 -0
  162. package/dist/typecheck-coverage.d.ts.map +1 -1
  163. package/dist/typecheck-coverage.js +50 -7
  164. package/dist/typecheck-coverage.js.map +1 -1
  165. package/dist/upgrade.d.ts +80 -11
  166. package/dist/upgrade.d.ts.map +1 -1
  167. package/dist/upgrade.js +332 -65
  168. package/dist/upgrade.js.map +1 -1
  169. package/dist/verification-plan.d.ts.map +1 -1
  170. package/dist/verification-plan.js +2 -0
  171. package/dist/verification-plan.js.map +1 -1
  172. package/dist/version-drift.d.ts.map +1 -1
  173. package/dist/version-drift.js +12 -1
  174. package/dist/version-drift.js.map +1 -1
  175. package/dist/web-app-options.d.ts +1 -1
  176. package/dist/web-app-options.d.ts.map +1 -1
  177. package/dist/web-app-options.js.map +1 -1
  178. package/docs/examples.json +19 -1
  179. package/docs/llms-full.txt +716 -138
  180. package/docs/types.json +516 -74
  181. package/package.json +13 -12
  182. package/src/agent-files.ts +27 -17
  183. package/src/assure-hydration.ts +8 -1
  184. package/src/assure.ts +11 -1
  185. package/src/capabilities-tool.ts +159 -50
  186. package/src/check-diagnostics.ts +10 -0
  187. package/src/check-scan.ts +64 -19
  188. package/src/check.ts +75 -15
  189. package/src/cli.ts +38 -17
  190. package/src/command-catalog.ts +16 -8
  191. package/src/db-tool.ts +2 -0
  192. package/src/dev-bun-config.ts +13 -9
  193. package/src/dev-feed-tool.ts +40 -6
  194. package/src/doctor.ts +102 -66
  195. package/src/env-file.ts +42 -7
  196. package/src/i18n-check.ts +254 -18
  197. package/src/init-agents.ts +221 -41
  198. package/src/internal/project-specifiers.ts +9 -1
  199. package/src/internal/source-facts.ts +397 -0
  200. package/src/internal/workspace-packages.ts +218 -0
  201. package/src/load.ts +19 -3
  202. package/src/lock-links.ts +173 -0
  203. package/src/mcp-exec.ts +18 -4
  204. package/src/mcp-http.ts +1 -1
  205. package/src/mcp-io.ts +72 -12
  206. package/src/mcp-isolate.ts +2 -0
  207. package/src/mcp-root.ts +14 -8
  208. package/src/migrate-layout.ts +496 -31
  209. package/src/project-site.ts +18 -0
  210. package/src/recipes/4.0.0.ts +2 -0
  211. package/src/recipes/5.1.0.ts +23 -0
  212. package/src/recipes/5.2.0.ts +33 -0
  213. package/src/recipes/5.3.0.ts +36 -0
  214. package/src/recipes/index.ts +9 -0
  215. package/src/review.ts +4 -0
  216. package/src/rule-explain.ts +75 -0
  217. package/src/rules/codes.ts +4 -0
  218. package/src/rules/contract-visibility.ts +118 -20
  219. package/src/rules/explanations.ts +339 -0
  220. package/src/rules/legacy.ts +24 -1
  221. package/src/rules/merge-auth.ts +55 -0
  222. package/src/rules/pages.ts +381 -2
  223. package/src/rules/route-statement.ts +170 -0
  224. package/src/rules/routes.ts +4 -3
  225. package/src/rules/zones.ts +3 -2
  226. package/src/typecheck-coverage.ts +51 -6
  227. package/src/upgrade.ts +430 -70
  228. package/src/verification-plan.ts +6 -0
  229. package/src/version-drift.ts +15 -0
  230. package/src/web-app-options.ts +9 -1
@@ -575,7 +575,7 @@ hydrates that, then renders the component with the data it already has. A client
575
575
  to the page renders the component directly. For a component that reads `window`,
576
576
  a canvas, or a browser-only library while it renders.
577
577
 
578
- ```ts
578
+ ```tsx
579
579
  // routes/map.tsx - a page whose component needs a browser to render.
580
580
  import type { Route } from "./+types/map"
581
581
 
@@ -611,12 +611,12 @@ combined with `hydrate = false`: nothing would ever render the page.
611
611
  Export a `searchSchema` - any Standard Schema (valibot, zod, arktype) - and the URL
612
612
  query becomes typed and validated on both sides: the loader receives it as
613
613
  `ctx.search` and the component reads the same value with
614
- `useSearch()`. Invalid or hostile input fails closed to the
614
+ `useSearch<typeof searchSchema>()`. Invalid or hostile input fails closed to the
615
615
  schema's defaults (never a 500), and the value is derived identically on the server and on each
616
616
  client navigation - so a query-reading page hydrates with no mismatch and never touches
617
617
  `window.location.search` by hand.
618
618
 
619
- ```ts
619
+ ```tsx
620
620
  // routes/reports.tsx - a typed, validated ?page=&sort= query.
621
621
  import { useSearch } from "@nifrajs/web-react/router"
622
622
  import * as v from "valibot" // any Standard Schema works (valibot, zod, arktype)
@@ -645,7 +645,7 @@ export async function loader({ search, api }: Route.LoaderArgs) {
645
645
  ```
646
646
 
647
647
  Without a `searchSchema`, `ctx.search` and `useSearch()` are
648
- the raw parsed query (`Record`). `useSearch` ships on
648
+ the raw parsed query (`Record<string, unknown>`). `useSearch` ships on
649
649
  every adapter (React, Preact, Vue, Solid, Svelte), each in that framework's shape - a value on
650
650
  React/Preact, a `Ref` on Vue, an accessor on Solid/Svelte. For imperative reads and
651
651
  writes of the raw query, `useSearchParams()` mirrors react-router's
@@ -679,7 +679,7 @@ around it (the nearest one wins), says when:
679
679
  -
680
680
  `none`: never; the route loads when the link is followed.
681
681
 
682
- ```ts
682
+ ```tsx
683
683
  // A docs sidebar: each link loads as it scrolls into view.
684
684
  <nav data-nifra-prefetch="viewport">
685
685
  <a href="/docs/routing">Routing</a>
@@ -712,7 +712,7 @@ query), `params` the ones it declares, and `data` its loader data (`null` withou
712
712
  can therefore build breadcrumbs, a title, or a section nav from what the routes below it
713
713
  export.
714
714
 
715
- ```ts
715
+ ```tsx
716
716
  // routes/orgs/[org]/_layout.tsx
717
717
  import type { ReactNode } from "react"
718
718
  import { useMatches } from "@nifrajs/web-react/router"
@@ -757,7 +757,7 @@ call `proceed()` to continue or `reset()` to stay. It mirrors
757
757
  react-router's shape - a plain boolean can't express an async "are you sure?", these two
758
758
  callbacks can.
759
759
 
760
- ```ts
760
+ ```tsx
761
761
  // routes/posts/[id]/edit.tsx - don't lose a half-finished edit to a stray click.
762
762
  import { useState } from "react"
763
763
  import { useBlocker } from "@nifrajs/web-react/router"
@@ -873,9 +873,9 @@ answers `422`.
873
873
  `GET /users/:id?` throws at registration, because both serve
874
874
  `GET /users`. Nothing of a rejected route is left registered.
875
875
 
876
- Other param modifiers (`:id+`, `:id*`, `:id(\\d+)`) are not
876
+ Other param modifiers (`:id+`, `:id*`, `:id(\d+)`) are not
877
877
  part of the path grammar and match as literal text. Where that text is intended, put
878
- `// nifra-expect NF-C026: ` above the registration.
878
+ `// nifra-expect NF-C026: <reason>` above the registration.
879
879
 
880
880
  ### Param constraints
881
881
 
@@ -902,10 +902,10 @@ A constraint is one of two things:
902
902
 
903
903
  -
904
904
  **One character class, with an optional count.** `[0-9]`,
905
- `[a-z0-9_-]`, `\\d` or `\\w`, followed by nothing
905
+ `[a-z0-9_-]`, `\d` or `\w`, followed by nothing
906
906
  (exactly one character), `+`, `{n}`, `{n,}` or
907
- `{n,m}`. A class holds letters, digits, ranges of them, `\\d`,
908
- `\\w` and the characters `. _ ~ ! $ & ' ( ) + , ; = @ -`. There
907
+ `{n,m}`. A class holds letters, digits, ranges of them, `\d`,
908
+ `\w` and the characters `. _ ~ ! $ & ' ( ) + , ; = @ -`. There
909
909
  is no negated class, and a count starts at one.
910
910
 
911
911
  -
@@ -916,7 +916,7 @@ is no negated class, and a count starts at one.
916
916
  Anything else in braces (`:id{int}`, `:id{[0-9]+|[a-z]+}`,
917
917
  `:id{.+}`) is not a constraint. It is literal text, as before, and
918
918
  `nifra check` reports it as `NF-C026`. In a JavaScript string
919
- `\\d` is written `{'"\\\\d"'}`.
919
+ `\d` is written `"\\d"`.
920
920
 
921
921
  -
922
922
  **The value is checked as it was sent,** before percent-decoding. `/users/4%32`
@@ -938,7 +938,7 @@ the same rule a literal route follows beside a param route.
938
938
 
939
939
  -
940
940
  **Two spellings of one constraint are one route.** `:id{[0-9]+}`,
941
- `:id{\\d+}` and `:id{[0-9]{1,}}` accept the same values, so
941
+ `:id{\d+}` and `:id{[0-9]{1,}}` accept the same values, so
942
942
  registering two of them for one method throws `DUPLICATE_ROUTE`, and different
943
943
  methods on them share one `Allow` list.
944
944
 
@@ -953,14 +953,14 @@ not look for another split.
953
953
  `/users/:id{[0-9]+}` serve no request in common, so `nifra check`
954
954
  (`NF-C024`) has nothing to report. A constrained route beside a bare
955
955
  `:param` route still overlaps and is still reported; mark the pair with
956
- `// nifra-expect NF-C024: ` where it is intended.
956
+ `// nifra-expect NF-C024: <reason>` where it is intended.
957
957
 
958
958
  -
959
959
  **OpenAPI and the typed client use the bare name.** The path is
960
960
  `/users/{id}`; the parameter's schema is
961
- `{'{ type: "string", pattern: "^[0-9]+$" }'}` for a class and an `enum`
961
+ `{ type: "string", pattern: "^[0-9]+$" }` for a class and an `enum`
962
962
  for a list, unless the route declares a `params` schema. The client call is
963
- `{'api.users({ id: "42" }).get()'}`. The client does not check the value: a value
963
+ `api.users({ id: "42" }).get()`. The client does not check the value: a value
964
964
  that does not fit is sent, and answered by whichever route it does match. Where two param
965
965
  routes share a position, give their params different names so that the call picks the route
966
966
  by name.
@@ -1052,8 +1052,14 @@ export const app = server()
1052
1052
 
1053
1053
  Prefer `c.set` over returning a raw `Response`. A `Response`
1054
1054
  return makes the typed client infer `data: never`, so you silently lose drift
1055
- detection for that route (`nifra check` flags it). `c.set` keeps your
1056
- plain-object return fully typed.
1055
+ detection for that route (`nifra check` flags it, NF-C007). `c.set`
1056
+ keeps your plain-object return fully typed. The check reads the functions a route
1057
+ registration (on `server()` or `createWebApp()`) or an
1058
+ `implement()` map passes, and a local function one returns a call to. It counts a
1059
+ `Response` held in a local before it is returned, a handler's
1060
+ `c.json()`/`c.text()`, and a call to a function imported from a
1061
+ relative module that returns one, reported at each route that returns it. A helper that
1062
+ answers an auth stage, or a handler registered from a list of route objects, is not read.
1057
1063
 
1058
1064
  A `Response` a handler or hook returns or throws still gets the
1059
1065
  `c.set.headers` it lacks and the queued cookies, so a guard's
@@ -1086,6 +1092,10 @@ and queued cookies still apply. On the typed client, checking `res.status === 40
1086
1092
  narrows `res.data` to the declared 409 body; a status the route does not declare
1087
1093
  falls into one arm whose `data` is `unknown`.
1088
1094
 
1095
+ The code may be a runtime value. Typed as a literal union (`200 | 409`), it splits
1096
+ into one arm per code. Typed as plain `number`, it cannot be sorted into success
1097
+ or error, so its body types `res.data`: a 2xx from that return can only carry it.
1098
+
1089
1099
  ```ts
1090
1100
  import { client } from "@nifrajs/client"
1091
1101
  import { server, status } from "@nifrajs/core/server"
@@ -1145,6 +1155,37 @@ A strict `t.object` here would reject real traffic. A signed cookie arrives as i
1145
1155
  `hasDuplicateCookie`. The OpenAPI document lists each declared field as an
1146
1156
  `in: cookie` parameter.
1147
1157
 
1158
+ ### Typed request headers (schema.headers)
1159
+
1160
+ A `headers` schema is validated before the handler like the other slots: a missing
1161
+ or malformed header is a `422` (`onValidationError` receives the kind
1162
+ `"headers"`), and `c.headers` becomes the schema&rsquo;s typed output.
1163
+ Every client sends headers no route declares - `host`, `user-agent`,
1164
+ `accept` - so a closed `t.object` validates only the names it declares,
1165
+ each read case-insensitively, which is also how the OpenAPI document lists them: one
1166
+ `in: header` parameter per declared name.
1167
+
1168
+ ```ts
1169
+ import { server } from "@nifrajs/core/server"
1170
+ import { t } from "@nifrajs/schema"
1171
+
1172
+ export const app = server()
1173
+ // Closed: validates only the names it declares, whatever else the client sends.
1174
+ .get("/reports", { headers: t.object({ "x-tenant": t.string() }) }, (c) => ({
1175
+ tenant: c.headers["x-tenant"], // string - a request without it is a 422
1176
+ }))
1177
+ // Open: every header arrives, names lower-cased, declared values coerced from text.
1178
+ .get("/jobs", { headers: t.headers({ "x-retry": t.optional(t.integer()) }) }, (c) => ({
1179
+ retry: c.headers["x-retry"] ?? 0, // number
1180
+ }))
1181
+ ```
1182
+
1183
+ `t.headers` is the open form: it receives every header with its name lower-cased,
1184
+ so it takes lower-case names only, and like `t.query` it coerces declared
1185
+ `t.integer()` / `t.number()` / `t.boolean()` fields from text.
1186
+ A schema nifra cannot read the names of - a Zod `.strict()` object or a Valibot
1187
+ `strictObject` - receives every header, so declare it open.
1188
+
1148
1189
  ### Requests no route matched (notFound)
1149
1190
 
1150
1191
  A path no route matches is answered `404` with
@@ -1269,14 +1310,24 @@ await api.users({ id: "1" }).posts({ postId: "2" }).get() // nested params
1269
1310
  await api.files("report.json").get() // /files/:name.json → the segment as sent
1270
1311
  ```
1271
1312
 
1313
+ **Chain the routes the client calls.** Each registration returns a new type that records
1314
+ its route, so `typeof app` holds only the routes chained onto the expression
1315
+ `app` is assigned from. `app.get("/x", handler)` written as a
1316
+ statement of its own still serves `/x`, but the client has no call for it. Chain
1317
+ the registration, or declare the routes on their own `server()` and
1318
+ `merge()` it. `nifra check` reports such a statement on a server whose
1319
+ type is exported or read by `typeof` (NF-C045, advisory). The same holds for
1320
+ `createWebApp`: its type holds the routes chained onto it, and the routes of the
1321
+ `api` it mounts keep their type on that backend server.
1322
+
1272
1323
  A segment that is part literal, part param - `/files/:name.json`,
1273
1324
  `/post-:id`, `/v:major.:minor` - has no single param to name, so it is
1274
- called with the segment as the request carries it: `{'api.files("report.json")'}`,
1275
- `{'api("post-42")'}`, `{'api("v1.2")'}`. The argument is typed as the
1276
- segment's literal text around any string, so `{'api.files("report.txt")'}` does
1325
+ called with the segment as the request carries it: `api.files("report.json")`,
1326
+ `api("post-42")`, `api("v1.2")`. The argument is typed as the
1327
+ segment's literal text around any string, so `api.files("report.txt")` does
1277
1328
  not compile, and it is sent as one encoded segment: a `/` in it never adds a path
1278
1329
  level. `RequestPath` from `@nifrajs/core` is the same reading for a
1279
- whole path: `{'RequestPath'}` is
1330
+ whole path: `RequestPath<"/files/:name.json">` is
1280
1331
  ``/files/${string}.json``.
1281
1332
 
1282
1333
  **Reserved proxy keys.** The client proxy resolves a fixed set of property names
@@ -1293,7 +1344,7 @@ same call params use, accepting exactly the colliding segment names. The client
1293
1344
  the dot access at compile time with that guidance, and `nifra check` reports the
1294
1345
  collision (`NF-C018`, advisory). Prefer a verb-free segment
1295
1346
  (e.g. `/api/remove`) when you control the path; mark a route served only to
1296
- non-typed-client consumers with `// nifra-expect NF-C018: ` above its
1347
+ non-typed-client consumers with `// nifra-expect NF-C018: <reason>` above its
1297
1348
  registration.
1298
1349
 
1299
1350
  ### Results never throw
@@ -1642,7 +1693,7 @@ site.
1642
1693
  What a component usually wants around the call is state, and state is the part every framework
1643
1694
  spells differently. `useServerFn` adds exactly that.
1644
1695
 
1645
- ```ts
1696
+ ```tsx
1646
1697
  // doc-check: skip - JSX fragment, shown for the shape rather than compiled here.
1647
1698
  import { useServerFn } from "@nifrajs/web-react/fn"
1648
1699
  import { addTodo } from "./todos.fn.ts"
@@ -1707,7 +1758,7 @@ and `nifra assure` for free. The starter policy's
1707
1758
  `authenticated-write` rule matches any route declaring a domain write, so a function
1708
1759
  that writes and skips auth fails the check rather than shipping:
1709
1760
 
1710
- ```ts
1761
+ ```bash
1711
1762
  # A server function is a public POST endpoint, so the starter policy already covers it.
1712
1763
  nifra assure
1713
1764
 
@@ -1908,6 +1959,15 @@ const paths = prerendered.map((p) => p.path)
1908
1959
  Bun.write("./dist/_routes.json", JSON.stringify(cloudflarePagesRoutes({ prerendered: paths })))
1909
1960
  ```
1910
1961
 
1962
+ On a server you run yourself, `nifra build --target bun` or `node`
1963
+ prerenders the same routes into `_prerendered/` beside `server.js`, and
1964
+ the server answers each from its file instead of rendering it. The file is served from the
1965
+ page route, so `use` middleware still runs first and a gate in front of the page
1966
+ still applies. A request with a query string, a navigation data request, or a draft-mode
1967
+ visitor renders on demand. So does a page whose build-time render set a cookie, was private or
1968
+ `no-store`, or varied on a request header, and every page of an app with a
1969
+ `nonce`. The Vite pipeline and the edge targets render every page on demand.
1970
+
1911
1971
  ### ISR - cache with stale-while-revalidate
1912
1972
 
1913
1973
  When data changes but not on every request, ISR gives static-like speed with background
@@ -2197,7 +2257,7 @@ that gap safe for you - you rarely have to think about it.
2197
2257
 
2198
2258
  ### Forms and links - nothing to do
2199
2259
 
2200
- A `` to a route, and any ``, use
2260
+ A `<form method="post">` to a route, and any `<a href>`, use
2201
2261
  progressive enhancement: native submit/navigation before hydration, a no-reload client
2202
2262
  takeover after.
2203
2263
 
@@ -2835,6 +2895,8 @@ UI idiom
2835
2895
  Build plugin
2836
2896
  Hydration bundle
2837
2897
 
2898
+ `{f.pkg}`
2899
+
2838
2900
  **Bundle** = the same minimal counter app, minified (not gzipped), for each framework -
2839
2901
  see `examples/web-*`. Indicative payload, not a benchmark.
2840
2902
 
@@ -3071,6 +3133,14 @@ yes
3071
3133
  the merged server&rsquo;s own - a route declaring `idempotency` without one is
3072
3134
  refused at registration
3073
3135
 
3136
+ Two checks catch the silent cases. In development and tests, `unusedScopedHooks`
3137
+ reports a hook followed only by `merge()` calls, and a `responseContract()`
3138
+ or `effectLedger()` installed after routes it would have covered.
3139
+ `nifra check` reports a `merge()` whose server authenticates none of its
3140
+ routes while this server&rsquo;s `authenticate()` or auth plugin covers its own
3141
+ (NF-C043); a module that is public on purpose takes
3142
+ `// nifra-expect NF-C043: <reason>` on the merge line.
3143
+
3074
3144
  ### Route/hook plugins: keep types with defineRouterPlugin
3075
3145
 
3076
3146
  A plugin that registers routes or hooks but adds **no context type** - e.g. mounting an auth
@@ -3084,7 +3154,7 @@ else typed).
3084
3154
 
3085
3155
  **Footgun:** reach for `definePlugin` here instead and a plain
3086
3156
  `definePlugin((app) => app.get(...))` infers `app` as
3087
- `Server`, collapsing `use()`'s result - and your whole typed
3157
+ `Server<any, any>`, collapsing `use()`'s result - and your whole typed
3088
3158
  client - to `any`, with **no type error and no runtime error**.
3089
3159
  `@nifrajs/better-auth` is built with the identity form, so
3090
3160
  `server().use(betterAuth(auth)).get(...)` keeps every route typed.
@@ -3161,7 +3231,7 @@ app&rsquo;s `responseHeaders()`.
3161
3231
 
3162
3232
  `nifra routes --hooks --json` writes the report; `--since <file>`
3163
3233
  prints what runs differently from a saved one. `nifra upgrade --write` saves the
3164
- report before it edits anything and prints the scope diff, and `nifra check --json`
3234
+ report before it edits anything and prints the scope diff once the target is installed, and `nifra check --json`
3165
3235
  includes it as `hooks` when `nifra.assurance.ts` names a
3166
3236
  `source`. Origins are recorded only outside production builds.
3167
3237
 
@@ -3588,9 +3658,44 @@ exposes `validate` and no way to enumerate declared keys. A _stripping_ schema
3588
3658
  response becomes a 500 and the detail goes to the logger, never to the caller.
3589
3659
  `{ extra: "strip" }` changes that for `t` schemas: they carry their
3590
3660
  JSON Schema, which does list the declared keys, so the payload is projected onto them - nested
3591
- objects, arrays and records included - before it is validated. In `"warn"`
3661
+ objects, arrays and records included - before it is validated. A union is projected when a
3662
+ value can meet only one of its branches: a single object branch, or object branches that all
3663
+ require one key holding literals no two of them share, such as `ok: true` and
3664
+ `ok: false`. Other unions are left to the validator. In `"warn"`
3592
3665
  mode the same option makes the log name the fields `"enforce"` would drop.
3593
3666
 
3667
+ Stripping is silent by design. To see a field the contract does not declare - a new column -
3668
+ before someone asks where it went, pass `logStripped: true` with
3669
+ `"enforce"`: the log names each stripped field, nested ones as
3670
+ `user.email` and array items as `items[].cost`, once per route for each
3671
+ distinct set of names. Values are never logged.
3672
+
3673
+ For a metric or an alert, pass `onReport`. It receives every response the
3674
+ contract has something to say about: `violation` (enforce mode, a 500 went out
3675
+ instead), `warn` (warn mode, sent anyway, with the undeclared keys in
3676
+ `fields` when they are the reason) and `stripped` (enforce mode, sent
3677
+ without `fields`). Each report carries the route&rsquo;s method and pattern and
3678
+ the log line&rsquo;s message, never a value. A hook that throws or rejects is logged once and
3679
+ changes no response.
3680
+
3681
+ ```ts
3682
+ import { server } from "@nifrajs/core/server"
3683
+ import { responseContract } from "@nifrajs/core/response-contract"
3684
+
3685
+ const counts = new Map<string, number>()
3686
+
3687
+ export const app = server().use(
3688
+ responseContract("enforce", {
3689
+ extra: "strip",
3690
+ // Every report, where the log speaks once per route. `route` is the pattern, so the keys stay bounded.
3691
+ onReport: ({ kind, method, route }) => {
3692
+ const key = `${kind} ${method} ${route}`
3693
+ counts.set(key, (counts.get(key) ?? 0) + 1)
3694
+ },
3695
+ }),
3696
+ )
3697
+ ```
3698
+
3594
3699
  A `merge()`d server&rsquo;s routes are covered by a contract the parent installed
3595
3700
  before the merge, as long as the route declares a response and its own server installed none.
3596
3701
  See [what a parent&rsquo;s use() covers](/docs/plugins#parent-use).
@@ -4340,6 +4445,10 @@ who asked" and have that be true.
4340
4445
  A route says what it does with `capabilities`, the same on a hand-written route or a
4341
4446
  server function:
4342
4447
 
4448
+ ```ts
4449
+ .post("/notes", { body: NoteInput, capabilities: ["db.write"] }, handler)
4450
+ ```
4451
+
4343
4452
  On its own that is an assertion. What makes it load-bearing is the other half:
4344
4453
  `provenance.imports` maps a module specifier to the capabilities that reaching it
4345
4454
  implies, so Nifra can compare what a route _says_ against what it _can do_.
@@ -4388,7 +4497,7 @@ the guarantee.
4388
4497
 
4389
4498
  Write to the database and declare nothing, and the check says so:
4390
4499
 
4391
- ```ts
4500
+ ```bash
4392
4501
  $ nifra check
4393
4502
 
4394
4503
  ✗ effect/capability assurance: 1
@@ -4397,7 +4506,7 @@ $ nifra check
4397
4506
 
4398
4507
  Declare it, and the policy takes over:
4399
4508
 
4400
- ```ts
4509
+ ```bash
4401
4510
  $ nifra check
4402
4511
  ✓ effect/capability assurance: none
4403
4512
 
@@ -4425,7 +4534,7 @@ is true: the handler really does have the connection in lexical scope.
4425
4534
 
4426
4535
  Which produces a specific dead end, and a specific finding for it:
4427
4536
 
4428
- ```ts
4537
+ ```bash
4429
4538
  $ nifra check
4430
4539
 
4431
4540
  ✗ effect/capability assurance: 1
@@ -4464,7 +4573,7 @@ A raw driver cannot tell a read from a write at the import, so it grants both -
4464
4573
  GET route in any module that can reach the driver is stuck. Putting your queries behind a seam
4465
4574
  split by access is what unsticks it, and it is what `create-nifra --db` scaffolds:
4466
4575
 
4467
- ```ts
4576
+ ```text
4468
4577
  db/
4469
4578
  index.ts the connection - no route module imports this
4470
4579
  read.ts reads, mapped to db.read
@@ -4483,9 +4592,13 @@ source without running it. It reads a path written as a string literal, or as a
4483
4592
  a module-level `const` string, with or without `as const`. The
4484
4593
  `const` can live in the same file or be exported from a project file it imports.
4485
4594
  The same holds for a WebSocket route's `app.ws(path, ...)`. A path built at runtime, such as a template with `${...}` in it, cannot be read
4486
- this way. `nifra check` names that expression in an NF-C036 finding, because the
4487
- route then has no module to start from. List the module in
4488
- `provenance.routeModules` to give it one.
4595
+ this way. So when `nifra.assurance.ts` loads the app, Nifra also records, in
4596
+ development, the module whose call registered each route, and the walk starts there too: a
4597
+ computed path, or a route on a server a helper builds, is still covered.
4598
+ `nifra check` still names such an expression in an NF-C036 finding, since the
4599
+ route lints read the source alone. When the registering module is not where the route&apos;s
4600
+ code lives, such as a shared helper that registers other modules&apos; handlers, list the
4601
+ right module in `provenance.routeModules`.
4489
4602
 
4490
4603
  ### Runtime beacons
4491
4604
 
@@ -4593,7 +4706,7 @@ record routes, not mounts, so review a new gap where it is listed: in the check
4593
4706
  same
4594
4707
  `opaque` field works on a `createWebApp` `mounts` entry.
4595
4708
 
4596
- ```ts
4709
+ ```bash
4597
4710
  $ nifra check
4598
4711
  • known gap, not capability-analyzed: /api/auth/* - better-auth's own handler; its effects are its own
4599
4712
  ```
@@ -4631,7 +4744,7 @@ Once assurance passes, snapshot the result. The lockfile is a review artifact: a
4631
4744
  starts touching something new shows up as a diff in the pull request rather than as nothing at
4632
4745
  all.
4633
4746
 
4634
- ```ts
4747
+ ```bash
4635
4748
  $ nifra capabilities snapshot # writes capabilities.lock.json
4636
4749
  $ nifra levels
4637
4750
  ✓ L0 typed contract
@@ -4891,6 +5004,15 @@ unauthenticated caller gets the 401 (or the refusal `run` returns), never a 413
4891
5004
  `apiKey` and `jwt` from `@nifrajs/middleware` run there. With
4892
5005
  `optional: true` they never refuse, so validation answers as usual.
4893
5006
 
5007
+ A stage that throws, or returns anything but `authenticated(principal)` or
5008
+ `rejected(...)`, fails closed with 503
5009
+ `{ ok: false, error: "auth_unavailable" }`, keeping 401 and 403 for the two
5010
+ real decisions and the cause out of the response. The cause goes where a handler's error
5011
+ goes: to `onError`, whose response replaces the 503, and when no hook answers, to
5012
+ the logger as `unhandled request error`. A database outage inside
5013
+ `authed()` is reported the same way. A thrown `Response` or
5014
+ `status(...)` is sent as thrown, as it is from a handler.
5015
+
4894
5016
  `run` receives the method, pathname, headers, path params, the raw
4895
5017
  `search` and the parsed `query` (frozen, read by the parser
4896
5018
  `c.query` uses; a repeated key is an array), the `request` (never read
@@ -4973,16 +5095,22 @@ own address (which would put all users in one bucket). Never key on a raw
4973
5095
  `X-Forwarded-For` value: a client writes whatever it likes there and gets a fresh bucket
4974
5096
  per request.
4975
5097
 
4976
- " }.
5098
+ ```ts
5099
+ import { server } from "@nifrajs/core/server"
5100
+ import { MemoryStore, rateLimit } from "@nifrajs/middleware"
5101
+
5102
+ // One reverse proxy you operate appends the caller to X-Forwarded-For. Behind a CDN that overwrites
5103
+ // a single header instead, declare { header: "<that header>" }.
4977
5104
  const app = server({ clientIp: { trustedHops: 1 } })
4978
- .use(
4979
- rateLimit({
4980
- store: new MemoryStore(), // use a shared store (Redis, etc.) in production
4981
- max: 5, // 5 attempts
4982
- windowMs: 15 * 60 * 1000, // per 15 minutes
4983
- .post("/login", …)
4984
- lang="ts"
4985
- />
5105
+ .use(
5106
+ rateLimit({
5107
+ store: new MemoryStore(), // use a shared store (Redis, etc.) in production
5108
+ max: 5, // 5 attempts
5109
+ windowMs: 15 * 60 * 1000, // per 15 minutes
5110
+ }),
5111
+ )
5112
+ .post("/login", …)
5113
+ ```
4986
5114
 
4987
5115
  Declare only hops you actually run: a directly reachable app with `trustedHops` set lets
4988
5116
  a client forge the forwarded address. Check your proxy's documentation for the header it sets
@@ -5259,9 +5387,14 @@ export const locales = defineLocales({
5259
5387
  gu: { draft: true }, // catalogs in progress: never routed, never an alternate
5260
5388
  },
5261
5389
  })
5262
- export const urls = defineI18nRouting(locales)
5390
+ export const urls = defineI18nRouting(locales, {
5391
+ // The pages that exist in some locales only, declared once; undefined = every served locale.
5392
+ pageLocales: (pathname) => (pathname.startsWith("/guides/") ? ["en", "hi"] : undefined),
5393
+ })
5263
5394
 
5264
5395
  urls.localizePathname("/kundli", "hi") // "/hi/kundli"
5396
+ urls.localizePathname("/guides/setup", "ur", { fallback: "default" }) // "/guides/setup"
5397
+ urls.localesOf("/hi/guides/setup") // ["en", "hi"]
5265
5398
  locales.chain("hi") // ["hi", "en"] - the catalog fallback order
5266
5399
  ```
5267
5400
 
@@ -5326,6 +5459,45 @@ export function meta({ params, origin }: MetaArgs): Meta {
5326
5459
  }
5327
5460
  ```
5328
5461
 
5462
+ A page that exists in some languages only is declared once, with `pageLocales`
5463
+ (given the path without its locale prefix; it must be pure). Then
5464
+ `matchSegment` answers not-found for the other locales, `alternates`
5465
+ lists only the page's own (none for a page in one locale), `localesOf(path)` names
5466
+ them for a prerender's static paths, and `localizePathname(path, locale, { fallback: "default" })`
5467
+ links a menu entry to the default locale's page where the page is missing. A
5468
+ `pageLocales` that throws, or names a locale the registry does not declare, throws
5469
+ rather than serving every locale.
5470
+
5471
+ ### Register the routing once
5472
+
5473
+ Export the router as `i18n` from `backend/framework.ts` (re-export it from
5474
+ `nifra.config.ts` when both exist), or pass it to a hand-written
5475
+ `createWebApp({ i18n })`. Every document then takes its locale from the URL:
5476
+
5477
+ - `<html lang dir>` come from `documentMeta(localeOf(path))`,
5478
+ unless the route's meta sets `lang`, on a hard load and after each client
5479
+ navigation alike.
5480
+
5481
+ - The response carries `Content-Language`.
5482
+
5483
+ - Each adapter's `useLocale()` names the page's locale key, and
5484
+ `<I18nProvider>` formats in its tag when no `locale` is passed;
5485
+ no loader has to hand either over.
5486
+
5487
+ - A route under a `[lang]` or `[[lang]]` directory runs
5488
+ `matchSegment` before any middleware: an unserved locale, or a page missing from
5489
+ it, is a 404 through your `_404`, and a non-canonical prefix (`/en/x`
5490
+ when the default is unprefixed) is a 308 to the canonical URL. The guard middleware above is
5491
+ then only needed for checks of your own.
5492
+
5493
+ ```ts
5494
+ // doc-check: skip - imports the app's own routing module.
5495
+ // backend/framework.ts - nifra dev, nifra build and the generated server entry read it from here.
5496
+ import { urls } from "../shared/i18n"
5497
+
5498
+ export const i18n = urls
5499
+ ```
5500
+
5329
5501
  ### Negotiate the locale
5330
5502
 
5331
5503
  `negotiateLocale` picks the best supported locale from a `?lang=` query
@@ -5470,6 +5642,9 @@ function Body() {
5470
5642
  }
5471
5643
  ```
5472
5644
 
5645
+ In an app that registers its routing, `locale` may be left out: the provider formats
5646
+ in the page's locale, and `useLocale()` reads the page's locale key anywhere below
5647
+ the route.
5473
5648
  `locale`, `messages` and `fallback` are serializable, so SSR
5474
5649
  renders the negotiated catalogs and the client rebuilds the same formatter on hydrate - no
5475
5650
  mismatch. Switching language re-navigates (a cookie or `?lang=`); the loader returns
@@ -5477,6 +5652,73 @@ the new catalog and the page re-renders. `localeCookie(name, locale)` builds the
5477
5652
  detector's own cookie for a switcher, so a choice made in the page and one made through
5478
5653
  `?lang=` are the same cookie.
5479
5654
 
5655
+ ### Copy tables
5656
+
5657
+ A catalog keys every message; a **copy table** keeps a page's text and its translations
5658
+ beside the code that shows it, with no key to name. `defineCopy(locales)` from
5659
+ `@nifrajs/i18n/copy` binds tables to the registry: the default locale's value is
5660
+ required, a locale the registry does not declare is a type error, and every other value has the
5661
+ default's shape - a list its length, a block its keys. Values are data (messages, lists, blocks);
5662
+ a message that takes values is ICU, read with `copy.format()`.
5663
+
5664
+ ```ts
5665
+ // shared/copy.ts - copy tables: the text and its translations beside the code that shows it.
5666
+ import { defineLocales } from "@nifrajs/i18n"
5667
+ import { defineCopy } from "@nifrajs/i18n/copy"
5668
+
5669
+ export const locales = defineLocales({ default: "en", locales: { en: {}, hi: {}, ta: {} } })
5670
+ export const copy = defineCopy(locales, {
5671
+ onMissing: ({ id, locale, fallback }) => console.warn(`${id ?? "a table"}: no ${locale}, showing ${fallback}`),
5672
+ })
5673
+
5674
+ // The default locale's value is required; every other locale is optional and shaped like it.
5675
+ export const TITLE = copy({ en: "Bicycle", hi: "साइकिल", ta: "மிதிவண்டி" })
5676
+ export const FAQ = copy.id("shop.faq", { en: ["Brakes?", "Gears?"], hi: ["ब्रेक?", "गियर?"] })
5677
+ export const PEDALS = copy({ en: "{n, plural, one {# pedal} other {# pedals}}", hi: "{n} पैडल" })
5678
+
5679
+ copy.pick(TITLE, "ta") // "மிதிவண்டி"
5680
+ copy.pick(FAQ, "ta") // ["Brakes?", "Gears?"] - the en value; onMissing fires once for ta
5681
+ copy.format(PEDALS, "en", { n: 3 }) // "3 pedals"
5682
+ ```
5683
+
5684
+ `copy.pick(table, locale)` walks `locales.chain(locale)`, and
5685
+ `onMissing` fires once per table and locale that falls back. A table's id is its
5686
+ `file:line`, or the one `copy.id()` names.
5687
+
5688
+ In a **production client build**, each table's values move out of the bundle into one chunk
5689
+ per locale, so a page's JavaScript carries the copy of the locale it renders in and none of the
5690
+ others; a chunk holds the fallback's value wherever its locale has none. The server bundle keeps
5691
+ every table whole. A page loads the chunk of its URL's locale (the first path segment when it is a
5692
+ served locale, or what `defineCopy(locales, { localeOf })` returns) and of the
5693
+ locale its `<html lang>` names, both preloaded; a client navigation loads the next
5694
+ URL's chunk with the route's code.
5695
+
5696
+ ```ts
5697
+ // doc-check: skip - continues a hand-written server.ts (adapter, manifest).
5698
+ // nifra build wires this itself; a server entry you write passes the client build's copyChunks.
5699
+ const assets = JSON.parse(await Bun.file("dist/manifest.json").text())
5700
+ export const app = createWebApp({
5701
+ adapter, manifest, clientEntry: assets.entry,
5702
+ copyChunks: assets.copyChunks, // locale -> chunk URL; each page preloads its own
5703
+ })
5704
+ ```
5705
+
5706
+ - The build reads tables statically: string literals, lists and blocks of them, and constants
5707
+ the same module declares. A table built any other way, or written in a `.svelte` or
5708
+ `.vue` file, keeps every locale in the bundle and still works;
5709
+ `nifra i18n check` says which tables those are.
5710
+
5711
+ - The build reads the source with the app's TypeScript (5.9 or 6). Without its compiler API
5712
+ (TypeScript 7 ships none) the build warns and keeps tables whole. It adds about 1 ms per
5713
+ module to a production build.
5714
+
5715
+ - A server entry that calls `createWebApp` with a `clientEntry` and
5716
+ no `copyChunks` passes `nifra dev`, which never splits, and fails on the
5717
+ first production page that renders copy. `nifra check` reports that call as
5718
+ `NF-C044`; the generated server manifest exports `copyChunks` for it
5719
+ to import, and `// nifra-expect NF-C044: <reason>` on the call accepts a
5720
+ server that never serves those pages.
5721
+
5480
5722
  ### Rich text
5481
5723
 
5482
5724
  `rich(t, key, tags, vars)` renders a message's tags with your components, never
@@ -5505,7 +5747,7 @@ React, Preact, Solid and Vue export `rich()` from their `/i18n` entry,
5505
5747
  returning one node (each handler gets its tag's content as one node too). Svelte has
5506
5748
  `<Rich>`, which takes one snippet per tag:
5507
5749
 
5508
- ```ts
5750
+ ```svelte
5509
5751
  <!-- Svelte: each tag is a snippet that renders its content -->
5510
5752
  <script>
5511
5753
  import { Rich } from "@nifrajs/web-svelte/i18n"
@@ -5546,6 +5788,17 @@ the locale's script. Latin words (brands, units) stay allowed.
5546
5788
 
5547
5789
  - **Untranslated** messages identical to the default in another language, as a warning.
5548
5790
 
5791
+ - **Partly translated** text in a locale that does not write in Latin: a message of 6 words
5792
+ or more that is over 60% Latin-script words (`latin-share`; words split by
5793
+ `Intl.Segmenter`, so Japanese counts), with each locale's share in the coverage
5794
+ table and a warning above 10%; and a message of 80 graphemes or more translated to under 32%
5795
+ of its length (`volume`), a summary rather than a translation. Han scripts, which
5796
+ write a sentence in far fewer graphemes, are left out of `volume`. Every threshold
5797
+ is an option.
5798
+
5799
+ - **Your rules**: each of `rules` runs on every message of every locale, and
5800
+ its findings read `custom:<code>`, which `ignore` takes.
5801
+
5549
5802
  ```ts
5550
5803
  // doc-check: skip - imports the app's own catalog files.
5551
5804
  // shared/i18n.ts - the module `nifra i18n check` imports.
@@ -5563,8 +5816,22 @@ export const catalogs = {
5563
5816
  }
5564
5817
  // Keys a check skips: exact, a prefix ending in ".*", or "*".
5565
5818
  export const ignore = { script: ["languages.*"], untranslated: ["brand"] }
5819
+ // The rest of checkCatalogs()'s options: Latin words a translation keeps, and your own rules.
5820
+ export const check = {
5821
+ latinWords: ["PDF", "OK"],
5822
+ rules: [
5823
+ ({ message }: { readonly message: string }) =>
5824
+ message === message.trim() ? undefined : { code: "spacing", message: "starts or ends with a space" },
5825
+ ],
5826
+ }
5566
5827
  ```
5567
5828
 
5829
+ When the module also exports a `copy` from `defineCopy()` (or only
5830
+ that), the check finds its tables across the project's source, turns them into a catalog per
5831
+ locale and runs the same checks on them, reporting each at its `file:line`. Two tables
5832
+ with one id are an error (a production build refuses them too); a table it cannot read is a
5833
+ warning that says why.
5834
+
5568
5835
  It exits 1 on an error, and with `--strict` on a warning too; `--json`
5569
5836
  prints the result. Draft locales report missing keys as info. The checks themselves are
5570
5837
  `checkCatalogs()` from `@nifrajs/i18n/check`:
@@ -6173,7 +6440,7 @@ sessions, pub/sub) needs a shared store, as in any multi-instance deploy.
6173
6440
  Self-hosting (no CDN in front)? Hand `@nifrajs/node`'s `serve` a
6174
6441
  `static` mount and it serves the client bundle from disk - traversal-guarded,
6175
6442
  content-typed, with an immutable cache - before the app runs, leaving the SSR fast path
6176
- untouched: `serve(app, {'{ port, static: { dir: new URL("./assets/", import.meta.url) } }'})`.
6443
+ untouched: `serve(app, { port, static: { dir: new URL("./assets/", import.meta.url) } })`.
6177
6444
  On Cloudflare/Vercel the platform serves assets, so you don't need it there.
6178
6445
 
6179
6446
  Every file under the mount is cached as immutable by default. If the directory also holds
@@ -6341,6 +6608,12 @@ export const vitePlugins = [react()] // dev HMR (Fast Refresh)
6341
6608
  Nifra includes a conservative codemod for moving static Tailwind classes to StyleX. It is a dry
6342
6609
  run by default, so inspect the proposed edits first:
6343
6610
 
6611
+ ```sh
6612
+ nifra migrate --from tailwind --to stylex # report safe edits and manual issues
6613
+ nifra migrate --from tailwind --to stylex --write # apply only safe edits
6614
+ nifra migrate --from tailwind --to stylex --dir src
6615
+ ```
6616
+
6344
6617
  Supported static `className` attributes become `stylex.props(...)` calls
6345
6618
  backed by a local `stylex.create(...)` table. Responsive breakpoints and
6346
6619
  element-local pseudo-classes such as `hover:` are supported. Dynamic class
@@ -6351,7 +6624,7 @@ remain.
6351
6624
  StyleX compilation is native to Nifra&apos;s Bun pipeline. Install the runtime and compiler peers,
6352
6625
  then register both the browser and SSR transforms:
6353
6626
 
6354
- ```ts
6627
+ ```sh
6355
6628
  # Install the runtime and the optional compiler peers.
6356
6629
  bun add @stylexjs/stylex
6357
6630
  bun add -d @babel/core @stylexjs/babel-plugin @babel/plugin-syntax-flow \
@@ -6388,12 +6661,18 @@ oldest first. A recipe moves a removed package to its replacement, rewrites impo
6388
6661
  moved, lists comments a release stopped honoring, and pins each group dependency to the
6389
6662
  target, keeping its `^` or `~` unless you pass `--exact`.
6390
6663
  The pins in `overrides`, `resolutions` and
6391
- `pnpm.overrides` move with them, since an override decides what installs.
6664
+ `pnpm.overrides` move with them, since an override decides what installs. A
6665
+ `peerDependencies` range is what a library accepts, not a pin: it is raised only
6666
+ when it excludes the target (keeping its operator, even with `--exact`), and a
6667
+ library&apos;s `">=3.1.0"` floor never sets the version the upgrade
6668
+ starts from unless nothing else, installed or declared, names one.
6392
6669
 
6393
- ```ts
6670
+ ```bash
6394
6671
  nifra upgrade --list # the release targets this CLI knows
6395
6672
  nifra upgrade 5.0.0 # dry-run: every planned edit, nothing written
6396
- nifra upgrade 5.0.0 --write # apply, then nifra check verifies (--no-verify skips it)
6673
+ nifra upgrade 5.0.0 --write # apply; it verifies with nifra check once the target is installed
6674
+ bun install # install the new pins
6675
+ nifra check # verify against them
6397
6676
  nifra doctor # afterwards: no "mixed nifra versions" advisory left
6398
6677
  ```
6399
6678
 
@@ -6404,16 +6683,35 @@ that release&apos;s CLI. It edits files under the workspace root only: a symlink
6404
6683
  directory or `package.json` is never followed, and a group package installed by a
6405
6684
  link from outside the root is listed under "Left alone" for you to upgrade in its
6406
6685
  own repository. The MCP launch pin in `.mcp.json`, `.cursor/mcp.json`,
6407
- `CLAUDE.md` and `AGENTS.md` moves to the target, the edit
6408
- `nifra init-agents --sync-mcp` makes. Another version pinned outside
6686
+ `CLAUDE.md` and `AGENTS.md` moves to the target, or is dropped when
6687
+ the project declares `@nifrajs/cli` so the launch runs that install from then on:
6688
+ the edit `nifra init-agents --sync-mcp` makes. Another version pinned outside
6409
6689
  `package.json` is listed with its line: the rest of an agent file, an MCP config
6410
6690
  elsewhere, a Dockerfile or compose file, a CI workflow, and a lockfile other than the
6411
6691
  workspace&apos;s own (an image build&apos;s frozen lockfile, say), which you regenerate after
6412
- installing. With `--write` it also
6413
- prints how hook scope changed across the
6414
- upgrade (`--no-hooks` skips that). `nifra doctor` and
6692
+ installing. `nifra check` reads the installed packages, so `--write`
6693
+ runs it (`--no-verify` skips that) only once they match the target: until the new
6694
+ pins are installed it would judge the release you are leaving, and the command prints the
6695
+ install to run first instead. With `--write` it also saves the hook report from
6696
+ before the edits and, once the target is installed, prints how hook scope changed across the
6697
+ upgrade (`--no-hooks` skips that); before then,
6698
+ `nifra routes --hooks --since` compares after the install.
6699
+ `nifra doctor` and
6415
6700
  `nifra check` (NF-D002) point here when a workspace carries more than one version;
6416
- see [mixed nifra versions](/docs/troubleshooting#mixed-versions).
6701
+ see [mixed nifra versions](/docs/troubleshooting#mixed-versions). A
6702
+ `file:` package whose dependencies this upgrade moves keeps its old ones in
6703
+ `bun.lock`, where Bun never refreshes them; the plan lists each, and
6704
+ `--write` drops those entries so the next `bun install` records them
6705
+ again (see [stale file: links](/docs/troubleshooting#stale-file-links)).
6706
+
6707
+ A `link:` or `file:` dependency outside the root that installs its own
6708
+ `@nifrajs/*` at another version stops the upgrade before anything is written: its
6709
+ imports resolve from its own `node_modules`, so after the upgrade a
6710
+ `server()` it builds cannot be merged into yours. The refusal names each one with
6711
+ the commands that move it to the target; upgrade those first, or pass
6712
+ `--allow-linked-skew` to go ahead. `nifra upgrade --list` shows the
6713
+ targets with the notes of every release after the one you declare: what an app can observe
6714
+ changing on the way up.
6417
6715
 
6418
6716
  ### Scope
6419
6717
 
@@ -6478,7 +6776,7 @@ need both). Anywhere else, add the URL.
6478
6776
 
6479
6777
  ### Setup
6480
6778
 
6481
- ```ts
6779
+ ```bash
6482
6780
  # Registers the MCP server and writes the agent files. Never clobbers what is already there.
6483
6781
  nifra init-agents
6484
6782
 
@@ -6491,9 +6789,14 @@ nifra init-agents
6491
6789
 
6492
6790
  # Then restart the agent so it picks the server up.
6493
6791
 
6494
- # The server is pinned to an exact @nifrajs/cli. After upgrading nifra, re-pin it to the version the
6495
- # project installs. Only that version string changes; every other byte of every file is kept.
6792
+ # A project that declares @nifrajs/cli launches `bunx @nifrajs/cli mcp`, unpinned: bunx runs the
6793
+ # installed CLI, so the server moves with every upgrade. Elsewhere the launch is pinned to an exact
6794
+ # version, since an unpinned bunx would fetch the latest release.
6795
+ # This moves an old pinned launch to that form: unpinned when the project declares the CLI, else the
6796
+ # version it installs. Only the version string changes; every other byte of every file is kept.
6496
6797
  # At a workspace root whose one nifra app is a member, the launch also names it: `mcp app`.
6798
+ # Run in that member, it also re-pins the root's files whose every nifra launch serves it (they stay
6799
+ # pinned: the root's own node_modules need not hold the CLI).
6497
6800
  nifra init-agents --sync-mcp
6498
6801
  ```
6499
6802
 
@@ -6502,7 +6805,7 @@ safe to re-run after a Nifra upgrade.
6502
6805
 
6503
6806
  ### The loop
6504
6807
 
6505
- ```ts
6808
+ ```bash
6506
6809
  # 1. What is here?
6507
6810
  nifra_context # routes, page routes, conventions - one call, unfiltered, as an index
6508
6811
  nifra_routes # API routes as JSON: { method, path, call, body?, query?, response? }
@@ -6539,7 +6842,7 @@ without being told a port. The server writes `.nifra/dev-server.json`, readable
6539
6842
  its owner, with its port and a token minted for that run; a tool checks that the server answers
6540
6843
  as itself before it reads anything.
6541
6844
 
6542
- ```ts
6845
+ ```bash
6543
6846
  nifra_errors # every open error, newest last
6544
6847
  nifra_errors {since: 41} # only what happened after a previous call's cursor
6545
6848
  nifra_errors {category: ["hydration"], includeStale: false}
@@ -6553,7 +6856,7 @@ nifra logs --level warn,error --grep cart
6553
6856
 
6554
6857
  Each error is a structured diagnostic, the same one the dev overlay renders:
6555
6858
 
6556
- ```ts
6859
+ ```json
6557
6860
  {
6558
6861
  "id": "e_5b6cbe9d",
6559
6862
  "category": "browser",
@@ -6632,7 +6935,7 @@ export const devDatabase = {
6632
6935
  }
6633
6936
  ```
6634
6937
 
6635
- ```ts
6938
+ ```bash
6636
6939
  nifra_db_schema # tables, row estimates, columns, keys, indexes
6637
6940
  nifra_db_schema {table: "orders"} # one table
6638
6941
  nifra_db_query {sql: "SELECT status, count(*) FROM orders GROUP BY 1"}
@@ -6748,7 +7051,7 @@ is.
6748
7051
  only by its owner: the SQL with secrets redacted, its fingerprint, the row count, the duration
6749
7052
  and the refusal code - never the rows. It rotates at 1 MB; `nifra db audit` reads it.
6750
7053
 
6751
- ```ts
7054
+ ```json
6752
7055
  {
6753
7056
  "ok": true,
6754
7057
  "tool": "query",
@@ -6857,7 +7160,7 @@ The teaching tools - `nifra_docs`, `nifra_example`,
6857
7160
  verified corpora, with no local checkout. It is read-only and needs no key. The project tools
6858
7161
  above still come from `nifra mcp` in your own repo, where they can see your routes.
6859
7162
 
6860
- ```ts
7163
+ ```bash
6861
7164
  # Claude Code
6862
7165
  claude mcp add --transport http nifra-docs https://mcp.nifra.dev
6863
7166
 
@@ -6882,7 +7185,7 @@ add Nifra docs to Cursor
6882
7185
  `nifra_check` is the one an agent should loop on. It returns structured
6883
7186
  diagnostics, each carrying its own fix, so a failure is a work item rather than a wall.
6884
7187
 
6885
- ```ts
7188
+ ```json
6886
7189
  {
6887
7190
  "ok": true,
6888
7191
  "typecheck": "pass",
@@ -6903,7 +7206,7 @@ contract (L0) to contract-derived invariant tests (L4). A scaffolded app starts
6903
7206
  rung it has not reached reports the specific thing missing - so the ladder doubles as the list
6904
7207
  of what to do next. See [the verification ladder](/docs/verification).
6905
7208
 
6906
- ```ts
7209
+ ```bash
6907
7210
  # The two an agent should gate on. Both exit non-zero on failure, so they work in CI unchanged.
6908
7211
  nifra check
6909
7212
  nifra levels --min 1
@@ -6964,7 +7267,7 @@ any Agent Client Protocol agent (Claude Code, Codex, Gemini CLI) over stdio; oth
6964
7267
  implement the same protocol port and can prove it with `checkAgentBackend` from
6965
7268
  `@nifrajs/agent-protocol/conformance`.
6966
7269
 
6967
- ```ts
7270
+ ```bash
6968
7271
  bun add @nifrajs/coding-agent @nifrajs/pi
6969
7272
 
6970
7273
  # Interactive, one-shot, JSON, and local RPC modes are available.
@@ -6979,7 +7282,7 @@ environments, and treats extensions as an explicit opt-in. Post-turn `check`,
6979
7282
  the gate until it passes or the attempt cap is reached. The local process adapter and extension
6980
7283
  worker are crash-containment helpers, not hostile-code sandboxes.
6981
7284
 
6982
- ```ts
7285
+ ```bash
6983
7286
  # Post-turn gates are opt-in. A failed gate becomes bounded repair work.
6984
7287
  bunx nifra-agent --backend pi --message "implement the change" \
6985
7288
  --verify-after-turn check,assure --max-repair-attempts 2
@@ -7509,6 +7812,13 @@ emits the _same_ error as the Bun build (one implementation, adapted to Rollup's
7509
7812
  so a refused import - a `node:` builtin, `backend/`, a route's
7510
7813
  `.backend.ts` half - fails the build either way.
7511
7814
 
7815
+ `import.meta.glob` is not one of them. The Bun build expands a literal pattern the
7816
+ way Vite does: a string or an array of strings starting with `./`,
7817
+ `../` or `/` (the app root), `!` excluding, with the
7818
+ `eager` and `import` options, keyed as Vite keys it. Any other form
7819
+ (a computed pattern, an alias, `query`) fails the build with the file and line, and
7820
+ so does a bundle that still calls the glob because another plugin loaded that module first.
7821
+
7512
7822
  ```ts
7513
7823
  // vite.config.ts - a Vite/Rollup PRODUCTION client build (the escape hatch, not the default).
7514
7824
  // Only reach for this when an app needs a Vite-only transform with no Bun equivalent; Nifra's default
@@ -7867,7 +8177,7 @@ Declare the packages in your app's `package.json`. It is a **static**
7867
8177
  declaration on purpose - `nifra check` reads it without importing your config, so
7868
8178
  the preflight never executes app code:
7869
8179
 
7870
- ```ts
8180
+ ```json
7871
8181
  {
7872
8182
  "name": "my-app",
7873
8183
  "dependencies": {
@@ -7902,7 +8212,7 @@ not: Bun's _runtime_ resolver never offers a
7902
8212
  bare specifier to a plugin, so `bun test`, `bun run`, and preloaded
7903
8213
  scripts still load both copies unless you preload the registrar:
7904
8214
 
7905
- ```ts
8215
+ ```toml
7906
8216
  # bunfig.toml
7907
8217
  preload = ["@nifrajs/core/single-copy/register"]
7908
8218
 
@@ -7949,7 +8259,7 @@ Vue, Solid, Svelte). Nifra dedupes the active adapter's runtime in build and dev
7949
8259
  `AGENTS.md`.
7950
8260
 
7951
8261
  ###
7952
- `client` resolves to `never` (or `data: never`)
8262
+ `client<typeof app>` resolves to `never` (or `data: never`)
7953
8263
 
7954
8264
  The typed client is derived from your backend's type. Two things collapse it:
7955
8265
 
@@ -7966,7 +8276,7 @@ plain object and shape the response with `c.set` - reach for `c.json` /
7966
8276
  -
7967
8277
  **A plugin widened the app's type.** A plugin that registers routes/hooks but whose return
7968
8278
  type isn't the concrete server (e.g. an untyped `app => app.onResponse(…)`)
7969
- makes `.use()` return `Server` and the client loses your
8279
+ makes `.use()` return `Server<any, any>` and the client loses your
7970
8280
  registry. Build it with `defineRouterPlugin(name, …)` (the clearer-named
7971
8281
  `defineIdentityPlugin`) so `.use()` returns your server unchanged and
7972
8282
  routes added after it stay typed. See
@@ -8062,10 +8372,10 @@ export const app = implement(contract, {
8062
8372
  Because the budget is per-expression and global to a compilation, a type-heavy construct
8063
8373
  _elsewhere_ in the program can push an otherwise-fine `.merge()` chain over the
8064
8374
  edge. It surfaces not as `TS2589` but as a `TS2345` assignability error
8065
- naming an **uninstantiated** `Server` - the shape
8375
+ naming an **uninstantiated** `Server<Registry, unknown>` - the shape
8066
8376
  the server type collapses to when the compiler gives up mid-inference. The usual trigger is a
8067
8377
  **generic higher-order function that wraps the builder** (a
8068
- `withX(app)` that threads the `Server` type through its own type
8378
+ `withX<T>(app)` that threads the `Server` type through its own type
8069
8379
  parameters); merely having that file in the program can be enough. Treat these as real
8070
8380
  constraints of an inference-first framework:
8071
8381
 
@@ -8076,10 +8386,10 @@ inference-heavy generics thread the `Server` / registry type through your own co
8076
8386
  -
8077
8387
  **Avoid generic HOF wrappers around the builder.** Wrap with a
8078
8388
  `defineRouterPlugin` (identity plugin) or compose with `.merge()` instead
8079
- of a `withX(app)` that re-infers the whole server type.
8389
+ of a `withX<T>(app)` that re-infers the whole server type.
8080
8390
 
8081
8391
  -
8082
- Put an explicit `Promise` return annotation on async callbacks that thread
8392
+ Put an explicit `Promise<T>` return annotation on async callbacks that thread
8083
8393
  framework types, so the compiler stops re-deriving the awaited type at each use.
8084
8394
 
8085
8395
  [!TIP]
@@ -8118,6 +8428,21 @@ workspace root only. A symlinked package directory or `package.json` is never
8118
8428
  followed, and a group package installed by a link from outside the root is listed under
8119
8429
  "Left alone" - upgrade that repository on its own.
8120
8430
 
8431
+ ### "records dependencies its file: packages no longer declare"
8432
+
8433
+ A `file:` dependency's own dependencies are recorded in `bun.lock` when
8434
+ Bun first installs it, and Bun does not read that package's `package.json` again:
8435
+ after the linked package moves to a new version of a dependency, `bun install`
8436
+ (even with `--force`) keeps installing the recorded one beside it, so the app can
8437
+ load two copies of the same package. `nifra doctor` (and `nifra check`,
8438
+ as the `NF-D003` warning) compares each recorded entry with the linked
8439
+ `package.json` and names every dependency that moved.
8440
+
8441
+ Run `bun update <package>` for each named package. `nifra upgrade`
8442
+ reads the lock against the manifests it is about to write, and with `--write` drops
8443
+ those entries so the next `bun install` records them again; run that install
8444
+ before committing `bun.lock`, or `bun install --frozen-lockfile` fails.
8445
+
8121
8446
  ### Still stuck?
8122
8447
 
8123
8448
  Run `nifra check --json` as the done-gate - it surfaces the import-chain leaks,
@@ -8224,10 +8549,17 @@ written down: `nifra fix --code NF-C035` adds
8224
8549
 
8225
8550
  With both files, `nifra dev` and `nifra build` take
8226
8551
  `apiPrefix`, `apiStrip`, `mounts`, `csp`,
8227
- `nonce`, `serverComponents` and `use` from
8228
- `backend/framework.ts` when `nifra.config.ts` does not set them, so the
8552
+ `nonce`, `serverComponents`, `i18n`, `use` and
8553
+ `publicEnvPrefix` from `backend/framework.ts` when
8554
+ `nifra.config.ts` does not set them, so the
8229
8555
  server entry and the dev server read one value without a re-export. A hand-written
8230
- `createWebApp` call passes `apiPrefix` itself.
8556
+ `createWebApp` call passes `apiPrefix` itself; import it from
8557
+ `backend/framework.ts` so production serves the backend where
8558
+ `nifra dev` does. `nifra check` reports `NF-C035` at a call
8559
+ that mounts a backend with no `apiPrefix`, or with a different one. When another
8560
+ server already serves the backend there, behind middleware of its own, an
8561
+ `apiPrefix` on the call would add a second path to it that skips that middleware: mark the call
8562
+ `// nifra-expect NF-C035: <reason>` instead.
8231
8563
 
8232
8564
  Because the backend answers first and its 404 is final, a page file under the prefix (
8233
8565
  `routes/api/report.tsx`) could never render. Nifra refuses it instead of serving a
@@ -8237,7 +8569,7 @@ mount in front of the page router.
8237
8569
 
8238
8570
  An app run by `nifra dev` and `nifra build` sets these options from
8239
8571
  `backend/framework.ts`: `apiPrefix`, `apiStrip`, `mounts`,
8240
- `csp` and `nonce`. The generated server entry imports them from there, so
8572
+ `csp`, `nonce` and `i18n`. The generated server entry imports them from there, so
8241
8573
  export them from `framework.ts` (and re-export from `nifra.config.ts` when
8242
8574
  both exist). A `mounts` entry hands a path to another app; a single extra URL
8243
8575
  outside the prefix, such as a sitemap, is a plain route registered in `use`:
@@ -8320,7 +8652,7 @@ each other. Each domain therefore owns its full absolute paths (`/api/listings`,
8320
8652
  `.group(prefix, build)`
8321
8653
  **
8322
8654
  - declare routes under a static prefix. `app.group("/admin", (a) => a.get("/users",
8323
- list))` serves `/admin/users`, and the prefix is part of the typed client,
8655
+ list))` serves `/admin/users`, and the prefix is part of the typed client,
8324
8656
  `routes()`, OpenAPI, capability events and the effect ledger. The builder
8325
8657
  inherits this server's middleware chain as it stands at the call; what it adds stays in the
8326
8658
  group, and its `onRequest`/`onResponse` hooks run only for requests at
@@ -8401,7 +8733,7 @@ Two valid ways to mutate; pick by where the call originates.
8401
8733
 
8402
8734
  -
8403
8735
  **Route `action`** - the form/SSR path. A
8404
- `` (or the client submit) runs the route's
8736
+ `<form method="post">` (or the client submit) runs the route's
8405
8737
  `action(ctx)`, which typically calls `ctx.api` in-process and returns
8406
8738
  `actionData` (or a `redirect`). Progressive-enhancement: works with JS
8407
8739
  off, and the loader revalidates after. Reach for this for page-driven mutations tied to a
@@ -8612,7 +8944,7 @@ than something we vouch for.
8612
8944
 
8613
8945
  ### The report is the evidence
8614
8946
 
8615
- ```ts
8947
+ ```json
8616
8948
  {
8617
8949
  "schemaVersion": 1,
8618
8950
  "ok": true,
@@ -8823,7 +9155,8 @@ header keeps the page out of the store.
8823
9155
  -
8824
9156
  **Prerender.** A prerendered page is a static file: it is served without the
8825
9157
  loader's headers or cookies. Set those on the host that serves the file, or keep the route
8826
- on-demand.
9158
+ on-demand. A `bun` or `node` build serves the file itself, after
9159
+ `use` middleware, with the page's `content-language` and CSP.
8827
9160
 
8828
9161
  ### Two ways to handle a request
8829
9162
 
@@ -9124,7 +9457,7 @@ router and await auth-scope invalidation on identity, tenant or permission chang
9124
9457
  The programmatic `buildClient()` API emits a content-hashed directory plus a
9125
9458
  `manifest.json` you can hand to `createWebApp` (`entry`,
9126
9459
  `routes` for per-route preload, `css` + `routeStyles` for
9127
- `<link>` injection).
9460
+ `<link>` injection, `copyChunks` when the app has copy tables).
9128
9461
 
9129
9462
  ```ts
9130
9463
  // buildClient() writes a browser bundle + manifest.json for custom build pipelines:
@@ -9133,7 +9466,8 @@ The programmatic `buildClient()` API emits a content-hashed directory plus a
9133
9466
  "assets": ["/assets/…"], // every emitted chunk URL
9134
9467
  "routes": { "users/[id]": ["/assets/_layout-H.js", "/assets/_slug_-H.js"] },
9135
9468
  "css": ["/assets/app-H.css"], // aggregate stylesheets (fallback)
9136
- "routeStyles": { "users/[id]": ["/assets/_layout-H.css"] } // per-route CSS (chain only)
9469
+ "routeStyles": { "users/[id]": ["/assets/_layout-H.css"] }, // per-route CSS (chain only)
9470
+ "copyChunks": { "hi": "/assets/copy-hi-H.js" } // copy tables by locale (@nifrajs/i18n/copy)
9137
9471
  }
9138
9472
 
9139
9473
  // Invariants worth knowing:
@@ -9645,8 +9979,8 @@ says that the app kept it open.
9645
9979
  **Routes nifra cannot see.** A mounted handler such as better-auth answers paths that are
9646
9980
  not in your backend, and no typed client covers them. Declare the mount opaque,
9647
9981
  `
9648
- mounts: [{ path: "/api/auth", app: auth, opaque: "better-auth" }]
9649
- `
9982
+ mounts: [{ path: "/api/auth", app: auth, opaque: "better-auth" }]
9983
+ `
9650
9984
  , and when `nifra.assurance.ts` names this app as its `source`, the
9651
9985
  check skips a `fetch` into that prefix by itself. Without that, list the prefixes
9652
9986
  in `nifra.check.json` next to `package.json`:
@@ -9659,7 +9993,7 @@ in `nifra.check.json` next to `package.json`:
9659
9993
 
9660
9994
  -
9661
9995
  **One call nifra cannot type.** For a single call rather than a whole prefix, such as a
9662
- static file, put `// nifra-expect NF-C002: ` on the line or in the
9996
+ static file, put `// nifra-expect NF-C002: <reason>` on the line or in the
9663
9997
  comment block above it. The finding stays in the report as info, with your reason. A comment
9664
9998
  with no reason silences nothing.
9665
9999
 
@@ -9963,7 +10297,7 @@ do. The dev overlay shows it, `nifra_explain` returns it, and every entry
9963
10297
  recognise is `NIFRA_UNHANDLED`, still with its frames and a codeframe around the line
9964
10298
  in your source.
9965
10299
 
9966
- ```ts
10300
+ ```json
9967
10301
  {
9968
10302
  "code": "NIFRA_OUTPUT_SENSITIVE_FIELD",
9969
10303
  "name": "OutputGuardError",
@@ -10124,9 +10458,16 @@ its own.
10124
10458
 
10125
10459
  ### Silencing a nifra check finding
10126
10460
 
10127
- `nifra check` names each finding with an `NF-` code. Where a finding is
10128
- reviewed and intended, a comment on the flagged line, or anywhere in the comment block directly
10129
- above it, says so and why:
10461
+ `nifra check` names each finding with an `NF-` code;
10462
+ `nifra explain NF-C007` (or `nifra_explain` with the code as its
10463
+ `error`) says what the rule reports, why it matters, how to fix it and where it is
10464
+ documented. Where a finding is reviewed and intended, a comment on the flagged line, or anywhere
10465
+ in the comment block directly above it, says so and why:
10466
+
10467
+ ```ts
10468
+ // nifra-expect NF-S002: compares the challenge the sender echoes back, not a secret
10469
+ if (echoToken === challenge) return accept()
10470
+ ```
10130
10471
 
10131
10472
  The comment answers only the code it names. A finding that fails the check, and every security
10132
10473
  finding, is silenced only with a reason after the colon; an advisory also accepts the comment
@@ -10442,8 +10783,12 @@ and import edits; this guide covers the structural changes it deliberately canno
10442
10783
 
10443
10784
  ### 1. Run the executable upgrade
10444
10785
 
10445
- ```ts
10446
-
10786
+ ```sh
10787
+ nifra upgrade 2.0.0 # dry-run: inspect every planned edit
10788
+ nifra upgrade 2.0.0 --write # apply edits, then run nifra check
10789
+ bun install
10790
+ bun run test
10791
+ bun run build
10447
10792
  ```
10448
10793
 
10449
10794
  The command updates existing `@nifrajs/*`, `Nifra`, and
@@ -10461,7 +10806,26 @@ only the systems an app uses with `.use()`; registration fails loudly if a requi
10461
10806
  plugin is missing.
10462
10807
 
10463
10808
  ```ts
10809
+ // doc-check: skip - migration fragment uses the application's existing stores and handlers
10810
+ // 1.x
10811
+ import "@nifrajs/core/ws"
10812
+ const app = server({ idempotencyStore, effectLedger: { sink } })
10813
+ .ws("/chat", socketHandler)
10464
10814
 
10815
+ // 2.0
10816
+ import { effectLedger } from "@nifrajs/core/effect-ledger"
10817
+ import { idempotency } from "@nifrajs/core/idempotency-plugin"
10818
+ import { mcp } from "@nifrajs/core/mcp"
10819
+ import { streaming } from "@nifrajs/core/sse"
10820
+ import { websocket } from "@nifrajs/core/ws"
10821
+
10822
+ const app = server()
10823
+ .use(idempotency({ store: idempotencyStore }))
10824
+ .use(effectLedger({ sink }))
10825
+ .use(mcp()) // only when the app declares tools/resources/prompts
10826
+ .use(streaming()) // only when the app declares SSE routes
10827
+ .use(websocket())
10828
+ .ws("/chat", socketHandler)
10465
10829
  ```
10466
10830
 
10467
10831
  The `@nifrajs/node` adapter installs `nodeDirect()` automatically.
@@ -10475,7 +10839,12 @@ contracts, assurance, capabilities, budgets, manifests, reflection, SSE, WebSock
10475
10839
  other optional systems from their documented subpaths.
10476
10840
 
10477
10841
  ```ts
10842
+ // doc-check: skip - before/after migration block includes the removed 1.x package
10843
+ // 1.x
10844
+ import { createRequestBudget } from "@nifrajs/budget"
10478
10845
 
10846
+ // 2.0
10847
+ import { createRequestBudget } from "@nifrajs/core/budget"
10479
10848
  ```
10480
10849
 
10481
10850
  Contract-generated adversarial testing lives in `@nifrajs/testing`; the deprecated
@@ -10490,7 +10859,17 @@ result of `inProcessClient(backend)` or `testClient(backend)`; both
10490
10859
  already implement the interface and forward `env` and `waitUntil`.
10491
10860
 
10492
10861
  ```ts
10862
+ // doc-check: skip - fragment uses the application adapter, manifest, and client entry
10863
+ import { inProcessClient } from "@nifrajs/client"
10864
+ import { createWebApp } from "@nifrajs/web"
10865
+ import { backend } from "./backend"
10493
10866
 
10867
+ const app = createWebApp({
10868
+ adapter,
10869
+ manifest,
10870
+ clientEntry,
10871
+ api: inProcessClient(backend),
10872
+ })
10494
10873
  ```
10495
10874
 
10496
10875
  ### 5. Declare external library mounts
@@ -10500,8 +10879,10 @@ Nifra typed contract. A relative fetch to that library is intentional, but other
10500
10879
  a hand-rolled own-API call. Declare only the exact mounted prefix in
10501
10880
  `nifra.check.json` so `nifra check` does not keep CI red:
10502
10881
 
10503
- ```ts
10504
-
10882
+ ```json
10883
+ {
10884
+ "externalMounts": ["/auth"]
10885
+ }
10505
10886
  ```
10506
10887
 
10507
10888
  Prefixes are segment-anchored: `/auth` covers `/auth` and its children,
@@ -10516,7 +10897,14 @@ After checking `!result.ok`, also narrow `result.status` before reading
10516
10897
  typed failure data. Undeclared statuses and transport status `0` remain unknown.
10517
10898
 
10518
10899
  ```ts
10519
-
10900
+ const result = await api.users({ id }).get()
10901
+ if (!result.ok) {
10902
+ if (result.status === 404) {
10903
+ result.data.message // typed from errors[404]
10904
+ } else {
10905
+ // Undeclared status or transport status 0: result.data is unknown.
10906
+ }
10907
+ }
10520
10908
  ```
10521
10909
 
10522
10910
  ### 7. Apply the remaining web and protocol changes
@@ -10525,7 +10913,11 @@ typed failure data. Undeclared statuses and transport status `0` remain unknown.
10525
10913
  Redirects accept an options object as their second argument.
10526
10914
 
10527
10915
  ```ts
10916
+ // 1.x
10917
+ redirect("/done", 307)
10528
10918
 
10919
+ // 2.0
10920
+ redirect("/done", { status: 307 })
10529
10921
  ```
10530
10922
 
10531
10923
  -
@@ -10577,8 +10969,12 @@ cannot guess, plus the Node proxy transport default.
10577
10969
 
10578
10970
  ### 1. Run the executable upgrade
10579
10971
 
10580
- ```ts
10581
-
10972
+ ```sh
10973
+ nifra upgrade 3.0.0 # dry-run: inspect every planned edit
10974
+ nifra upgrade 3.0.0 --write # apply edits, then run nifra check
10975
+ bun install
10976
+ bun run test
10977
+ bun run build
10582
10978
  ```
10583
10979
 
10584
10980
  The command pins every matching `@nifrajs/*`, `Nifra`, and
@@ -10611,7 +11007,19 @@ through the second argument, and assert on `.plain` in tests. A hand-rolled
10611
11007
  itself returns changed.
10612
11008
 
10613
11009
  ```ts
11010
+ // 2.x - a redirect was a Web Response
11011
+ const r = redirect("/done")
11012
+ r.status // 302
11013
+ r.headers.get("location")
11014
+ r instanceof Response // true
10614
11015
 
11016
+ // 3.0 - a redirect is plain render data
11017
+ const r = redirect("/done")
11018
+ r.plain // { status, headers, body }
11019
+ r.toResponse() // build a Response only when something genuinely needs one
11020
+
11021
+ // Add headers through the second argument; cookies still ride c.set as before.
11022
+ redirect("/done", { status: 307, headers: { "cache-control": "no-store" } })
10615
11023
  ```
10616
11024
 
10617
11025
  ### 3. Fix reserved typed-client segments
@@ -10623,7 +11031,13 @@ because the proxy resolves the reserved key before a path segment. The types now
10623
11031
  access at compile time instead of silently reaching the wrong node.
10624
11032
 
10625
11033
  ```ts
11034
+ // A route whose path segment spells a reserved client key
11035
+ // (get/post/put/patch/delete/head/options, subscribe/ws/index/then)
11036
+ // is no longer reachable by property access:
11037
+ api.posts.delete.get() // 3.0: type error - `delete` is a reserved verb key
10626
11038
 
11039
+ // The typed spelling is a call on the parent node with the segment:
11040
+ api.posts("delete").get() // reaches /posts/delete
10627
11041
  ```
10628
11042
 
10629
11043
  Run `nifra fix --code NF-C018` to rewrite the affected call sites. It reads them
@@ -10634,7 +11048,11 @@ from the compiler rather than a text search, so it finds every one and never mis
10634
11048
  both the table and `--json`. The set is exported as the one place it is written down.
10635
11049
 
10636
11050
  ```ts
11051
+ // doc-check: skip - fragment reads the exported reserved-key contract
11052
+ import { RESERVED_VERB_KEYS, RESERVED_EXACT_KEYS, reservedKeyFor } from '@nifrajs/client'
10637
11053
 
11054
+ reservedKeyFor('delete') // 'delete'
11055
+ reservedKeyFor('posts') // undefined
10638
11056
  ```
10639
11057
 
10640
11058
  ### 4. Review the Node proxy transport (only if you use it)
@@ -10644,7 +11062,15 @@ On Node, `@nifrajs/proxy` now defaults to the undici transport, shipped from the
10644
11062
  `createProxy` to override it.
10645
11063
 
10646
11064
  ```ts
11065
+ // doc-check: skip - fragment shows the Node transport default and its override
11066
+ import { createProxy } from '@nifrajs/proxy'
11067
+ import { undiciTransport } from '@nifrajs/proxy/undici'
11068
+
11069
+ // 3.0 on Node: undici is the default transport.
11070
+ const proxy = createProxy({ target })
10647
11071
 
11072
+ // Override it explicitly when a different transport is wanted:
11073
+ const custom = createProxy({ target, transport: undiciTransport() })
10648
11074
  ```
10649
11075
 
10650
11076
  ### 5. Run the release gates
@@ -10672,8 +11098,10 @@ finished migration from one that needs a decision.
10672
11098
 
10673
11099
  ### 1. Run the executable upgrade
10674
11100
 
10675
- ```ts
10676
-
11101
+ ```sh
11102
+ bunx @nifrajs/cli@5.0.0 upgrade 5.0.0 # dry run: every release step from the installed version
11103
+ bunx @nifrajs/cli@5.0.0 upgrade 5.0.0 --write # apply the pins and import moves
11104
+ bun install
10677
11105
  ```
10678
11106
 
10679
11107
  Run the command from the release you are moving to. It chains every release recipe between
@@ -10681,13 +11109,16 @@ the installed version and 5.0, so a 3.x app takes the 4.0 steps (the retired
10681
11109
  `@nifrajs/web/server-only` import moves to `@nifrajs/web/backend-only`)
10682
11110
  and the 5.0 ones in one pass, and prints each release's notes. It lists every
10683
11111
  `@nifra-gate-reviewed` comment, which silences nothing in 5.0: after review, write
10684
- `// nifra-expect : ` with the code `nifra check`
11112
+ `// nifra-expect <code>: <reason>` with the code `nifra check`
10685
11113
  reports there. The upgrade never writes a reason for you.
10686
11114
 
10687
11115
  ### 2. Move onto the frontend/backend layout (from 3.x)
10688
11116
 
10689
- ```ts
10690
-
11117
+ ```sh
11118
+ nifra migrate layout # dry run: splits, moves, rewritten imports, issues
11119
+ nifra migrate layout --write # apply it
11120
+ nifra schemas --write # draft the output schemas it lists as follow-ups
11121
+ nifra check
10691
11122
  ```
10692
11123
 
10693
11124
  Each route file splits into `x.tsx`, the page, and `x.backend.ts`, which
@@ -10698,16 +11129,37 @@ to `frontend/`, `backend/` or `shared/` by who imports it at
10698
11129
  runtime. A folder whose imported files all land in one zone moves whole, so a component nothing
10699
11130
  imports yet travels with its folder; a folder split between zones is reported instead.
10700
11131
 
10701
- ```ts
11132
+ ```tsx
11133
+ // doc-check: skip - a route split into its two halves
11134
+ // routes/notes.tsx - the page, shipped to the browser whole
11135
+ import type { loader } from "./notes.backend.ts"
11136
+ export default function Notes({ data }: { data: Awaited<ReturnType<typeof loader>> }) {
11137
+ return <ul>{data.notes.map((note) => <li key={note.id}>{note.title}</li>)}</ul>
11138
+ }
10702
11139
 
11140
+ // routes/notes.backend.ts - loader, action, middleware and the other server exports
11141
+ import { t } from "@nifrajs/schema"
11142
+ export const loaderOutput = t.object({
11143
+ notes: t.array(t.object({ id: t.string(), title: t.string() })),
11144
+ })
11145
+ export async function loader() {
11146
+ return { notes: await listNotes() }
11147
+ }
10703
11148
  ```
10704
11149
 
10705
11150
  To keep a folder where it is, declare it a zone before migrating. The migration leaves zoned
10706
11151
  folders in place, and builds, `nifra dev` and `nifra check` enforce them
10707
11152
  like the default folders.
10708
11153
 
10709
- ```ts
10710
-
11154
+ ```json
11155
+ {
11156
+ "nifra": {
11157
+ "zones": {
11158
+ "frontend": ["src/ui"],
11159
+ "backend": ["server"]
11160
+ }
11161
+ }
11162
+ }
10711
11163
  ```
10712
11164
 
10713
11165
  `nifra migrate layout --zones` writes those entries for you: every module the
@@ -10718,9 +11170,10 @@ overrides it, so a backend file can sit in a frontend folder without moving.
10718
11170
 
10719
11171
  The command exits `0` when nothing needs a decision. A step with a known command,
10720
11172
  such as drafting an output schema for a backend half it did not write, is listed under
10721
- `next` and in `followUps` with `--json`, and does not fail it.
10722
- An issue (an import it could not place, a frontend that still uses a moved name at runtime)
10723
- exits `1`.
11173
+ `next` and in `followUps` with `--json`, and does not fail it;
11174
+ so is a moved path a module names only in comments, which is worth updating but changes
11175
+ nothing that runs. An issue (an import it could not place, a frontend that still uses a moved
11176
+ name at runtime, a moved path written in code or a string) exits `1`.
10724
11177
 
10725
11178
  5.0 refuses a route file that still exports a server name: `nifra build` and the
10726
11179
  server stop on it, and `nifra check` reports it as NF-C041.
@@ -10748,17 +11201,30 @@ browser call to `/api` reaches page routing. `nifra migrate layout` adds
10748
11201
  `nifra check` reports a framework config that sets none (NF-C035).
10749
11202
 
10750
11203
  ```ts
11204
+ // doc-check: skip - backend/framework.ts
11205
+ export { reactAdapter as adapter } from "@nifrajs/web-react"
10751
11206
 
11207
+ // Serve backend/app.ts at /api, as 3.x and 4.x did by default. "" keeps it loader-only.
11208
+ export const apiPrefix = "/api"
10752
11209
  ```
10753
11210
 
10754
11211
  With both `nifra.config.ts` and `backend/framework.ts`, every command
10755
11212
  takes `apiPrefix`, `apiStrip`, `mounts`, `csp`,
10756
- `nonce`, `serverComponents` and `use` from
10757
- `backend/framework.ts` when `nifra.config.ts` leaves them unset. The
11213
+ `nonce`, `serverComponents`, `use` and
11214
+ `publicEnvPrefix` from `backend/framework.ts` when
11215
+ `nifra.config.ts` leaves them unset. The
10758
11216
  backend sees each request's full path unless `apiStrip` is on, so its routes are
10759
11217
  registered under the prefix; `nifra routes` marks one outside it as in-process
10760
11218
  only, and `nifra dev` and `nifra build` warn about it.
10761
11219
 
11220
+ An app that strips the prefix itself, with a `Proxy` or a wrapper around the
11221
+ backend's `fetch` that cuts `/api` before routing, gets that warning
11222
+ for every route: the check reads the registered paths, and a rewrite at run time is invisible
11223
+ to it. Delete the wrapper and export `apiStrip = true` beside
11224
+ `apiPrefix`, which does the same cut where the framework can see it. A second
11225
+ prefix the wrapper served (a `/v1` alias, a webhook path) becomes an entry in
11226
+ `mounts`.
11227
+
10762
11228
  ### 5. Review the 5.0 defaults that changed
10763
11229
 
10764
11230
  -
@@ -10783,9 +11249,31 @@ request.
10783
11249
  `nifra check` fails a secret comparison (NF-S002) outside browser code of a web
10784
11250
  app.
10785
11251
 
11252
+ From 3.x, two 4.0 changes also show up in tests and tooling rather than in pages:
11253
+
11254
+ -
11255
+ Page data is handed over in one
11256
+ `<script type="application/json" id="__nifra-handover">`, not a script that
11257
+ assigns `window.__NIFRA_DATA__`. A test that read the data out of the HTML
11258
+ parses that element (`HANDOVER_ID` from `@nifrajs/web`).
11259
+
11260
+ -
11261
+ `x-nifra-isr-revalidate` and `x-nifra-isr-tags` are set only under a
11262
+ cache wrapper such as `withISR`, which removes them before responding. A test
11263
+ that read a page's TTL from them on an unwrapped app reads nothing.
11264
+
10786
11265
  `nifra upgrade` prints the full list with the finding or the one-line change that
10787
11266
  keeps the 4.x behavior for each.
10788
11267
 
11268
+ Past 5.0, 5.1 adds one change a frontend on another origin sees. A route with a
11269
+ `body` schema answers a urlencoded, multipart or `text/plain` body whose
11270
+ `Origin` names another site with `403 forbidden_origin`, before reading
11271
+ it. List that frontend&rsquo;s origin, or an identity provider&rsquo;s for a
11272
+ `form_post` callback, in the `formOrigins` server option (an array of
11273
+ exact origins or a function; `@nifrajs/edge` takes it too). JSON bodies are
11274
+ unchanged. [Security](/docs/security) covers what the check leaves to
11275
+ `csrf()`.
11276
+
10789
11277
  ### 6. Run the release gates
10790
11278
 
10791
11279
  -
@@ -10949,7 +11437,7 @@ Nifra's client router - `Link` + hover/focus prefetch, scroll restoration
10949
11437
  The biggest change: data fetching becomes a typed `loader` that calls your backend
10950
11438
  in-process during SSR - no `fetch` to your own API, no untyped JSON.
10951
11439
 
10952
- ```ts
11440
+ ```tsx
10953
11441
  // Next.js - app/users/[id]/page.tsx
10954
11442
  export default async function Page({ params }) {
10955
11443
  const res = await fetch(`https://api/users/${params.id}`)
@@ -11023,6 +11511,11 @@ mount small and temporary, and use typed routes for every migrated endpoint.
11023
11511
  `stripPrefix: true` when the legacy app declares paths relative to its mount point.
11024
11512
  The platform object is forwarded as the second argument when the runtime supplies one.
11025
11513
 
11514
+ A mounted fetch handler carries HTTP only. A WebSocket upgrade under the mount reaches it as
11515
+ an ordinary request and never becomes a socket, so keep the legacy app&apos;s sockets on its own
11516
+ server until they move to `app.ws()` routes (see
11517
+ [WebSockets in a composed app](/docs/websockets#composed)).
11518
+
11026
11519
  ```ts
11027
11520
  import { Hono } from "hono"
11028
11521
  import { server } from "@nifrajs/core/server"
@@ -11212,7 +11705,7 @@ only on Node, where `fetch` is undici.
11212
11705
  `GET /orders` reads through the cache, enqueues a job into a Postgres-backed store,
11213
11706
  and a separate worker process runs it. In Jaeger it is one trace:
11214
11707
 
11215
- ```ts
11708
+ ```text
11216
11709
  GET /orders orders-api server
11217
11710
  pg.query SELECT orders orders-api client (the cache loader)
11218
11711
  cache wrap orders-api internal outcome=miss
@@ -11718,12 +12211,12 @@ yes
11718
12211
  A file outside those folders joins a side with a suffix: `x.frontend.ts`,
11719
12212
  `x.backend.ts` or `x.shared.ts`. A workspace package declares its side
11720
12213
  in its `package.json`:
11721
- `{'"nifra": { "environment": "frontend" | "backend" | "shared" | "library" }'}`.
12214
+ `"nifra": { "environment": "frontend" | "backend" | "shared" | "library" }`.
11722
12215
  A file in no zone is a build error, so nothing is ever classified by accident.
11723
12216
 
11724
12217
  A package whose entries run on different sides gives each export subpath its own:
11725
12218
 
11726
- ```ts
12219
+ ```json
11727
12220
  {
11728
12221
  "name": "@shop/payments",
11729
12222
  "exports": {
@@ -11752,7 +12245,7 @@ an error.
11752
12245
  The app's own `package.json` can set sides too, so a folder that has to stay
11753
12246
  where it is, or a family of workspace packages, needs no edit of its own:
11754
12247
 
11755
- ```ts
12248
+ ```json
11756
12249
  {
11757
12250
  "name": "my-app",
11758
12251
  "nifra": {
@@ -11774,7 +12267,7 @@ frontend folder. One path listed under two sides is refused. Builds, dev servers
11774
12267
  `nifra check` and the editor plugin all read this setting.
11775
12268
 
11776
12269
  A project that serves no pages has no browser, so the zones do not apply to it. Declare that
11777
- in its `package.json` with `{'"nifra": { "kind": "api" }'}`:
12270
+ in its `package.json` with `"nifra": { "kind": "api" }`:
11778
12271
  `nifra check` then skips the zone checks and the server-only import check there,
11779
12272
  and treats every file as server code. It is read from the nearest `package.json`
11780
12273
  and only takes values `"api"` and `"web"`. A directory with web config
@@ -11842,7 +12335,7 @@ and `Route.ComponentProps` types `data` as exactly what
11842
12335
  `loaderOutput` lets through. `nifra dev`, `nifra build`,
11843
12336
  `nifra check` and `nifra types` write these files under
11844
12337
  `.nifra/types`; the app's `tsconfig.json` resolves them with
11845
- `{'"rootDirs": [".", "./.nifra/types"]'}`.
12338
+ `"rootDirs": [".", "./.nifra/types"]`.
11846
12339
 
11847
12340
  ### What may import what
11848
12341
 
@@ -11893,7 +12386,7 @@ page, `frontend/` or `shared/` fails the build, optional access (
11893
12386
  -
11894
12387
  **The build scans what it emits.** A client bundle, a public file or a prerendered page
11895
12388
  that contains what looks like a credential fails the build. A label in a message catalog (
11896
- `{'{ password: "Password" }'}`) and a documented placeholder (
12389
+ `{ password: "Password" }`) and a documented placeholder (
11897
12390
  `your-api-key`) are text, not credentials.
11898
12391
 
11899
12392
  The same rules run in `nifra dev` (a refused module is answered with a 403 before
@@ -11919,7 +12412,7 @@ needs a hand, such as an alias with no target that covers a moved file, a specif
11919
12412
  names nothing installed, or a sibling workspace package that names a moved file. It never
11920
12413
  edits files outside the app.
11921
12414
 
11922
- An API-only app, one that declares `{'"nifra": { "kind": "api" }'}` or has no web
12415
+ An API-only app, one that declares `"nifra": { "kind": "api" }` or has no web
11923
12416
  config, no `routes/` and a `backend.ts` that exports
11924
12417
  `backend`, migrates as one: only
11925
12418
  `backend.ts` moves, to `backend/app.ts`, with the imports from it and
@@ -12270,8 +12763,10 @@ The tooling reads the backend `backend/app.ts` exports. An app that
12270
12763
  `implement`s a contract somewhere else, such as a `createApp(deps)`
12271
12764
  factory, is invisible to the contract lock and the route lints until that file serves it.
12272
12765
  `nifra check` names each implemented operation the backend does not serve
12273
- (NF-C039), and counts them when there is no `backend/app.ts` at all. Export the
12274
- same app built with stand-in dependencies:
12766
+ (NF-C039), and counts them when there is no `backend/app.ts` at all. It reads a
12767
+ contract imported from a workspace package through that package&apos;s
12768
+ `exports`; a package installed from a registry is never read, and the check says
12769
+ so rather than passing it. Export the same app built with stand-in dependencies:
12275
12770
 
12276
12771
  ```ts
12277
12772
  // backend/app.ts - the backend nifra's tooling reads
@@ -12309,7 +12804,7 @@ The same routes and schemas feed coding agents. `nifra context` prints the live
12309
12804
  API surface as compact text, and `nifra mcp` serves it over the Model Context
12310
12805
  Protocol so Claude Code or Cursor read the real contract instead of guessing.
12311
12806
 
12312
- ```ts
12807
+ ```sh
12313
12808
  $ nifra context # the same contract as compact text - pipe into any agent prompt
12314
12809
  GET /users/:id → params { id: string } response { id, name, role }
12315
12810
 
@@ -12368,7 +12863,7 @@ executor with nothing skipped.
12368
12863
 
12369
12864
  ### Run it
12370
12865
 
12371
- ```ts
12866
+ ```sh
12372
12867
  # What does this project prove right now?
12373
12868
  nifra levels
12374
12869
 
@@ -12379,7 +12874,7 @@ nifra levels --min 2
12379
12874
  nifra levels --json
12380
12875
  ```
12381
12876
 
12382
- ```ts
12877
+ ```text
12383
12878
  L0 typed contract ok
12384
12879
  L1 route assurance ok
12385
12880
  L2 capability lockfile ok
@@ -12475,8 +12970,11 @@ and says which.
12475
12970
  The count does not fail a level on its own. To make L1 require enforcement, add a
12476
12971
  `baseline` rule selecting `hasResponse: true`: unlike
12477
12972
  `rules`, where the first match owns a route, a baseline rule is checked on every
12478
- route it matches, so one entry covers every class. `nifra assure --strict` also fails
12479
- while any declared route is typed-only or warn-only.
12973
+ route it matches, so one entry covers every class. A new app from `create-nifra`
12974
+ ships this baseline in its `nifra.assurance.ts`, beside the
12975
+ `responseContract("enforce")` its backend installs.
12976
+ `nifra assure --strict` also fails while any declared route is typed-only or
12977
+ warn-only.
12480
12978
 
12481
12979
  ```ts
12482
12980
  // nifra.assurance.ts
@@ -13657,6 +14155,9 @@ remember them. It does three things and exits non-zero if any fails:
13657
14155
  a screen that expects the wrong shape is a type error. Running the typecheck is what turns that latent
13658
14156
  guarantee into an enforced one. TypeScript sources with no `tsconfig.json` beside them fail this step,
13659
14157
  as a missing `typescript` install does: nothing typechecked them. A JavaScript-only project skips it.
14158
+ Every project `tsconfig.json` references is typechecked too, each as its own program; a project that
14159
+ splits its code across sibling configs lists them in `nifra.check.json`:
14160
+ `{ "tsconfigs": ["tsconfig.json", "tsconfig.server.json"] }`. A zoned file no program reads fails it.
13660
14161
  2. **Typed-client lint** - flags any hand-rolled `fetch()` to your own API (a relative URL like
13661
14162
  `fetch("/users")`), which bypasses the typed client so the compiler can't see the drift. External
13662
14163
  absolute-URL fetches are not flagged.
@@ -14708,6 +15209,17 @@ locales.documentMeta("ur") // { lang: "ur-PK", dir: "rtl" }
14708
15209
  Guard a `[lang]` route segment with `matchSegment()` in `routes/[lang]/_middleware.ts`: an unknown or
14709
15210
  draft value answers 404, and the default's prefix (`/en/...`) or a wrong case redirects.
14710
15211
 
15212
+ A page that exists in some locales only is declared once, with
15213
+ `defineI18nRouting(locales, { pageLocales: (pathname) => K[] | undefined })`: `matchSegment` answers
15214
+ 404 for the other locales, `alternates` lists only the page's own, `localesOf(path)` names them, and
15215
+ `localizePathname(path, locale, { fallback: "default" })` links to the default locale's page where the
15216
+ page is missing.
15217
+
15218
+ Register the router once, as `export const i18n = urls` in `backend/framework.ts`, and `@nifrajs/web`
15219
+ sets every document's `<html lang dir>` and `Content-Language` from it, guards `[lang]` and `[[lang]]`
15220
+ routes with `matchSegment`, and each adapter's `useLocale()` and `<I18nProvider>` read the page's
15221
+ locale.
15222
+
14711
15223
  ## Messages
14712
15224
 
14713
15225
  `createFormatter(locale, messages, options)` formats ICU messages: interpolation, `plural`,
@@ -14738,13 +15250,44 @@ entry exports a `rich()` that returns framework nodes (Svelte: `<Rich>` with one
14738
15250
  `localeCookie(name, locale)` is the browser half of the detector's `persist` cookie: assign it to
14739
15251
  `document.cookie` in a language switcher and it is byte-identical to the detector's `Set-Cookie`.
14740
15252
 
15253
+ ## Copy tables
15254
+
15255
+ `defineCopy(locales)` from `@nifrajs/i18n/copy` keeps a page's text and its translations beside the
15256
+ code that shows it, with no key to name. The default locale's value is required, an undeclared locale
15257
+ is a type error, and every other value has the default's shape. `copy.pick(table, locale)` falls back
15258
+ along `locales.chain()` and fires `onMissing` once per table and locale; `copy.format()` reads an ICU
15259
+ message.
15260
+
15261
+ ```ts
15262
+ import { defineCopy } from "@nifrajs/i18n/copy"
15263
+
15264
+ export const copy = defineCopy(locales, { onMissing: reportMissingCopy })
15265
+ export const TITLE = copy({ en: "Bicycle", hi: "साइकिल", ta: "மிதிவண்டி" })
15266
+ export const FAQ = copy.id("shop.faq", { en: ["Brakes?", "Gears?"], hi: ["ब्रेक?", "गियर?"] })
15267
+
15268
+ copy.pick(FAQ, "ta") // ["Brakes?", "Gears?"], from en
15269
+ ```
15270
+
15271
+ A production `@nifrajs/web` client build moves each table's values into one chunk per locale, so a
15272
+ page's JavaScript carries only the copy of the locale it renders in; the server keeps every table. It
15273
+ reads tables statically (literals, lists and blocks of them, same-module constants) with the app's
15274
+ TypeScript; a table written any other way keeps every locale in the bundle. `nifra i18n check` checks
15275
+ the tables of a `copy` export like catalogs, at each table's `file:line`; `tablesToCatalogs()` from
15276
+ `@nifrajs/i18n/check` is the pure transpose.
15277
+
14741
15278
  ## Checking catalogs
14742
15279
 
14743
15280
  `checkCatalogs({ locales, catalogs, ignore })` from `@nifrajs/i18n/check` reports coverage, missing
14744
15281
  and unused keys, ICU syntax errors, placeholder and rich-tag parity with the default message, plural
14745
15282
  cases the locale's grammar needs, script purity (`Intl.Locale(tag).maximize().script` against Unicode
14746
15283
  script properties - a Telugu sign in Gujarati, a Cyrillic `е` in English), and untranslated messages.
14747
- It is pure; `nifra i18n check [entry]` runs it over the module exporting `locales` and `catalogs`.
15284
+ It also catches partly translated text in a locale that does not write in Latin: `latin-share` reports
15285
+ a message of 6 words or more that is mostly Latin-script words (`latinWords` lists the brands a
15286
+ translation keeps), and each locale's coverage carries its `latinShare`; `volume` reports a long
15287
+ message translated to under a third of its length. `rules` adds the app's own checks, reported as
15288
+ `custom:<code>`.
15289
+ It is pure; `nifra i18n check [entry]` runs it over the module exporting `locales` and `catalogs`,
15290
+ and passes the rest of the options from its `check` export.
14748
15291
 
14749
15292
  ## Locale detection
14750
15293
 
@@ -15896,6 +16439,41 @@ const openapi = toOpenAPI(app) // OpenAPI 3.1
15896
16439
  `operationId`s); also works on a live app. Routes using a BYO Standard Schema are
15897
16440
  emitted without a detailed schema (Standard Schema exposes no JSON Schema).
15898
16441
 
16442
+ ### Static validators for edge runtimes
16443
+
16444
+ `@nifrajs/schema/compile` generates a TypeScript module at build time. Import that generated module
16445
+ in the server: its validator runs without `new Function`, retains the source schema's inferred types,
16446
+ and keeps the schema builder and dynamic compiler out of the runtime bundle. Invalid data still
16447
+ produces the same structured issues, capped at 100.
16448
+
16449
+ Define the source schema in `src/schemas/users.ts`:
16450
+
16451
+ ```ts
16452
+ import { t } from "@nifrajs/schema"
16453
+ export const body = t.object({ name: t.string({ minLength: 1 }), age: t.integer() })
16454
+ ```
16455
+
16456
+ Generate `src/generated/users.ts` before building the app:
16457
+
16458
+ ```ts
16459
+ import { compileSchema } from "@nifrajs/schema/compile"
16460
+ import { body } from "../src/schemas/users.ts"
16461
+
16462
+ await Bun.write(
16463
+ "src/generated/users.ts",
16464
+ compileSchema(body, { source: "../schemas/users.ts", exportName: "body" }),
16465
+ )
16466
+ ```
16467
+
16468
+ The server imports `body` from `./generated/users.ts` and uses it as its route schema. The generated
16469
+ source-schema import is type-only and disappears from the deployed bundle. Regenerate when the source
16470
+ schema changes. Custom string formats must be registered in the serving process, as with ordinary schemas.
16471
+
16472
+ Compilation refuses coercing schemas (`t.query`, `t.form` and the other request-slot schemas), a
16473
+ schema whose `validate` does more than check its `jsonSchema`, custom registry kinds such as dates/deferred values,
16474
+ runtime-only metadata, and known TypeBox compiler escape hazards. Use the ordinary `t` adapter for
16475
+ these shapes. This opt-in build step leaves the existing validation API and runtime behavior intact.
16476
+
15899
16477
  ### Forms and files - `@nifrajs/schema/form`
15900
16478
 
15901
16479
  The `t` exported from `@nifrajs/schema/form` is the same builder plus `t.file` and `t.form`. A
@@ -17045,7 +17623,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
17045
17623
 
17046
17624
  ## @nifrajs/otel
17047
17625
 
17048
- `ActiveObservation`, `AttributeValue`, `EffectTracingOptions`, `EffectTracingPlugin`, `EndObservation`, `NifraSpan`, `ObservationAdapter`, `ObservationClock`, `ObservationContext`, `ObservationLifecycle`, `ObservationLifecycleOptions`, `ObservationLink`, `ObservationParent`, `ObservationScope`, `OtlpExporter`, `OtlpExporterOptions`, `ParsedTraceparent`, `SpanKind`, `SpanStatus`, `StartObservation`, `TraceContext`, `TracingOptions`, `causalitySpanLink`, `combineObservationAdapters`, `consoleSpanExporter`, `createObservationLifecycle`, `effectTracing`, `formatTraceparent`, `generateSpanId`, `generateTraceId`, `otlpExporter`, `parseTraceparent`, `traceHeaders`, `tracing`
17626
+ `ActiveObservation`, `AttributeValue`, `EffectTracingOptions`, `EffectTracingPlugin`, `EndObservation`, `NifraSpan`, `ObservationAdapter`, `ObservationClock`, `ObservationContext`, `ObservationLifecycle`, `ObservationLifecycleOptions`, `ObservationLink`, `ObservationParent`, `ObservationScope`, `OtlpExporter`, `OtlpExporterOptions`, `ParsedTraceparent`, `RecordingObservationLifecycle`, `SpanKind`, `SpanStatus`, `StartObservation`, `TraceContext`, `TracingOptions`, `causalitySpanLink`, `combineObservationAdapters`, `consoleSpanExporter`, `createObservationLifecycle`, `effectTracing`, `formatTraceparent`, `generateSpanId`, `generateTraceId`, `otlpExporter`, `parseTraceparent`, `traceHeaders`, `tracing`
17049
17627
 
17050
17628
  ## @nifrajs/pi
17051
17629
 
@@ -17085,7 +17663,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
17085
17663
 
17086
17664
  ## @nifrajs/web
17087
17665
 
17088
- `ACTION_GLOBAL`, `Action`, `BOUNDARY_GLOBAL`, `BackendOnly`, `Blocker`, `BlockerController`, `BlockerFunction`, `BlockerLocation`, `BlockerState`, `Boundary`, `BoundaryDescriptor`, `BoundaryError`, `BoundaryMode`, `BoundaryRegistration`, `BoundaryRequestCtx`, `BoundaryState`, `BoundaryStates`, `BoundaryStatus`, `BrowserNavigate`, `CacheStore`, `CachedResponse`, `CdnPurgeOutcome`, `CdnPurgeTarget`, `ClientAction`, `ClientActionArgs`, `ClientActionResult`, `ClientLoader`, `ClientLoaderArgs`, `ClientRequestBody`, `ClientRouteHooks`, `ClientRouter`, `ClientRouterOptions`, `CreateCspPolicyOptions`, `CreateNonceResolverOptions`, `CreateWebAppOptions`, `CspHeaderContext`, `CspPolicy`, `CssLoadingMode`, `DATA_GLOBAL`, `DATA_HEADER`, `DEFAULT_CSS_LOADING`, `DEFAULT_DEV_PORT`, `DRAFT_COOKIE`, `Deferred`, `DehydratedState`, `DocumentParts`, `DraftCookieControls`, `DynamicBoundary`, `DynamicBoundaryBatch`, `EnableDraftOptions`, `FetchRouteData`, `Fetcher`, `FetcherState`, `FontDisplay`, `FontFace`, `FontPreloadInput`, `FontSource`, `GenerateClientEntryOptions`, `GenerateRouteSearchTypesOptions`, `GenerateServerManifestOptions`, `GetStaticPaths`, `HANDOVER_ID`, `HtmlSanitizer`, `IDLE_BLOCKER`, `ISRApp`, `ISROptions`, `ISRPlatform`, `ISRQuery`, `ISRStoreOp`, `ISR_REVALIDATE_HEADER`, `ISR_REVALIDATE_TAGS_HEADER`, `ISR_STATUS_HEADER`, `InertScriptType`, `InfiniteData`, `InfiniteQueryHandle`, `InfiniteQueryOptions`, `InterceptBoundary`, `KVCacheStore`, `KVCacheStoreOptions`, `KVNamespaceLike`, `LAYOUT_DATA_GLOBAL`, `LayoutEntry`, `LinkDescriptor`, `Loader`, `LoaderContext`, `LoaderResponseControls`, `LoadingEntry`, `Manifest`, `MatchChain`, `MemoryCacheStore`, `MemoryCacheStoreOptions`, `MemoryStaticBoundaryCache`, `Meta`, `MetaArgs`, `MetaDescriptor`, `MetaInput`, `MiddlewareOutcome`, `MountRouterOptions`, `MutationCallbacks`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NavigateSearchOf`, `NavigateTargetInput`, `NonceContext`, `NonceGenerator`, `NonceHeader`, `NonceHeaderContext`, `NonceResolver`, `NotFoundEntry`, `NotFoundScope`, `OpenGraphInput`, `PRE_HYDRATION_GUARD`, `PendingBoundary`, `PrefetchMode`, `PreviewEndpointOptions`, `PublicDirCache`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `QueryOptions`, `QueryState`, `QueryStatus`, `REDIRECT_HEADER`, `RETAIN_HEADER`, `REVALIDATE_HEADER`, `ROOT_ATTRIBUTE`, `ROUTE_GLOBAL`, `RedirectOptions`, `RenderAdapter`, `RenderAdapterConformanceError`, `RenderAdapterConformanceFixture`, `RenderAssemblyCache`, `RenderPageInput`, `RenderPageOptions`, `RenderProps`, `RenderStreamOptions`, `RenderedPage`, `RevalidateEndpointOptions`, `RevalidateResult`, `RevalidateTags`, `RevalidateTagsInput`, `RouteEntry`, `RouteMatch`, `RouteMiddleware`, `RouteModule`, `RoutePattern`, `RouteSearch`, `RouterState`, `SERVER_FN_MODULE`, `STATUS_HEADER`, `SanitizedHtml`, `ScriptDescriptor`, `SearchOf`, `ServePublicDirOptions`, `ShouldRevalidate`, `ShouldRevalidateArgs`, `SsrModuleLoader`, `StaticBoundary`, `StaticBoundaryCache`, `StaticBoundaryImportEdge`, `StaticBoundaryRoot`, `StaticCtx`, `StaticPath`, `StaticPaths`, `StaticRoutes`, `StatusPageOptions`, `Submission`, `SubmitOptions`, `TrustedHtml`, `UIMatch`, `UnsafeScriptDescriptor`, `assertCssLoadingCompatible`, `assertRenderAdapterConformance`, `assertStaticBoundaryImports`, `boundaryDescriptors`, `boundaryModeKey`, `buildManifest`, `canonical`, `createClientRouter`, `createCspPolicy`, `createMatcher`, `createMutation`, `createNonceResolver`, `createQueryClient`, `createWebApp`, `defer`, `disableDraft`, `enableDraft`, `enumerateStaticRoutes`, `filePathToPattern`, `filePathToPatterns`, `fontFace`, `fontPreload`, `generateClientEntry`, `generateRouteSearchTypes`, `generateServerManifest`, `getBrowserNavigate`, `gone`, `hashQueryKey`, `isCacheablePage`, `isDraftEnabled`, `jsonLd`, `mergeHeads`, `nifraScriptHashes`, `normalizeCssLoading`, `notFound`, `openGraph`, `previewEndpoint`, `redirect`, `registerBlocker`, `renderPage`, `renderPageResult`, `resolveChainMeta`, `resolveDynamicBoundaries`, `resolveMeta`, `resolveNavigate`, `resolvePublicPath`, `resolveStaticBoundaries`, `revalidate`, `revalidateEndpoint`, `sanitizeHtml`, `sanitizedHtml`, `searchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `servePublicDir`, `setBlockerController`, `setBrowserNavigate`, `setSsrModuleLoader`, `ssrModuleLoader`, `startDynamicBoundaries`, `statusPage`, `trustHtml`, `unsafeInlineScript`, `webProjectEvidence`, `withISR`
17666
+ `ACTION_GLOBAL`, `Action`, `BOUNDARY_GLOBAL`, `BackendOnly`, `Blocker`, `BlockerController`, `BlockerFunction`, `BlockerLocation`, `BlockerState`, `Boundary`, `BoundaryDescriptor`, `BoundaryError`, `BoundaryMode`, `BoundaryRegistration`, `BoundaryRequestCtx`, `BoundaryState`, `BoundaryStates`, `BoundaryStatus`, `BrowserNavigate`, `CacheStore`, `CachedResponse`, `CdnPurgeOutcome`, `CdnPurgeTarget`, `ClientAction`, `ClientActionArgs`, `ClientActionResult`, `ClientLoader`, `ClientLoaderArgs`, `ClientRequestBody`, `ClientRouteHooks`, `ClientRouter`, `ClientRouterOptions`, `CreateCspPolicyOptions`, `CreateNonceResolverOptions`, `CreateWebAppOptions`, `CspHeaderContext`, `CspPolicy`, `CssLoadingMode`, `DATA_GLOBAL`, `DATA_HEADER`, `DEFAULT_CSS_LOADING`, `DEFAULT_DEV_PORT`, `DRAFT_COOKIE`, `Deferred`, `DehydratedState`, `DocumentParts`, `DraftCookieControls`, `DynamicBoundary`, `DynamicBoundaryBatch`, `EnableDraftOptions`, `FetchRouteData`, `Fetcher`, `FetcherState`, `FontDisplay`, `FontFace`, `FontPreloadInput`, `FontSource`, `GenerateClientEntryOptions`, `GenerateRouteSearchTypesOptions`, `GenerateServerManifestOptions`, `GetStaticPaths`, `HANDOVER_ID`, `HtmlSanitizer`, `IDLE_BLOCKER`, `ISRApp`, `ISROptions`, `ISRPlatform`, `ISRQuery`, `ISRStoreOp`, `ISR_REVALIDATE_HEADER`, `ISR_REVALIDATE_TAGS_HEADER`, `ISR_STATUS_HEADER`, `InertScriptType`, `InfiniteData`, `InfiniteQueryHandle`, `InfiniteQueryOptions`, `InterceptBoundary`, `KVCacheStore`, `KVCacheStoreOptions`, `KVNamespaceLike`, `LAYOUT_DATA_GLOBAL`, `LOCALES_GLOBAL`, `LayoutEntry`, `LinkDescriptor`, `Loader`, `LoaderContext`, `LoaderResponseControls`, `LoadingEntry`, `Manifest`, `MatchChain`, `MemoryCacheStore`, `MemoryCacheStoreOptions`, `MemoryStaticBoundaryCache`, `Meta`, `MetaArgs`, `MetaDescriptor`, `MetaInput`, `MiddlewareOutcome`, `MountRouterOptions`, `MutationCallbacks`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NavigateSearchOf`, `NavigateTargetInput`, `NonceContext`, `NonceGenerator`, `NonceHeader`, `NonceHeaderContext`, `NonceResolver`, `NotFoundEntry`, `NotFoundScope`, `OpenGraphInput`, `PRE_HYDRATION_GUARD`, `PageLocale`, `PageLocales`, `PendingBoundary`, `PrefetchMode`, `PrerenderedPageReaderOptions`, `PrerenderedPages`, `PreviewEndpointOptions`, `PublicDirCache`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `QueryOptions`, `QueryState`, `QueryStatus`, `REDIRECT_HEADER`, `RETAIN_HEADER`, `REVALIDATE_HEADER`, `ROOT_ATTRIBUTE`, `ROUTE_GLOBAL`, `RedirectOptions`, `RenderAdapter`, `RenderAdapterConformanceError`, `RenderAdapterConformanceFixture`, `RenderAssemblyCache`, `RenderPageInput`, `RenderPageOptions`, `RenderProps`, `RenderStreamOptions`, `RenderedPage`, `RevalidateEndpointOptions`, `RevalidateResult`, `RevalidateTags`, `RevalidateTagsInput`, `RouteEntry`, `RouteMatch`, `RouteMiddleware`, `RouteModule`, `RoutePattern`, `RouteSearch`, `RouterState`, `SERVER_FN_MODULE`, `STATUS_HEADER`, `SanitizedHtml`, `ScriptDescriptor`, `SearchOf`, `ServePublicDirOptions`, `ShouldRevalidate`, `ShouldRevalidateArgs`, `SsrModuleLoader`, `StaticBoundary`, `StaticBoundaryCache`, `StaticBoundaryImportEdge`, `StaticBoundaryRoot`, `StaticCtx`, `StaticPath`, `StaticPaths`, `StaticRoutes`, `StatusPageOptions`, `Submission`, `SubmitOptions`, `TrustedHtml`, `UIMatch`, `UnsafeScriptDescriptor`, `WebAppI18n`, `assertCssLoadingCompatible`, `assertRenderAdapterConformance`, `assertStaticBoundaryImports`, `boundaryDescriptors`, `boundaryModeKey`, `buildManifest`, `canonical`, `createClientRouter`, `createCspPolicy`, `createMatcher`, `createMutation`, `createNonceResolver`, `createQueryClient`, `createWebApp`, `defer`, `disableDraft`, `enableDraft`, `enumerateStaticRoutes`, `filePathToPattern`, `filePathToPatterns`, `fontFace`, `fontPreload`, `generateClientEntry`, `generateRouteSearchTypes`, `generateServerManifest`, `getBrowserNavigate`, `gone`, `hashQueryKey`, `isCacheablePage`, `isDraftEnabled`, `jsonLd`, `localeOfProps`, `mergeHeads`, `nifraScriptHashes`, `normalizeCssLoading`, `notFound`, `openGraph`, `pageLocaleIn`, `prerenderedPageReader`, `previewEndpoint`, `redirect`, `registerBlocker`, `renderPage`, `renderPageResult`, `resolveChainMeta`, `resolveDynamicBoundaries`, `resolveMeta`, `resolveNavigate`, `resolvePublicPath`, `resolveStaticBoundaries`, `revalidate`, `revalidateEndpoint`, `sanitizeHtml`, `sanitizedHtml`, `searchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `servePublicDir`, `setBlockerController`, `setBrowserNavigate`, `setSsrModuleLoader`, `ssrModuleLoader`, `startDynamicBoundaries`, `statusPage`, `trustHtml`, `unsafeInlineScript`, `webProjectEvidence`, `withISR`
17089
17667
 
17090
17668
  ## @nifrajs/web-preact
17091
17669