@nifrajs/cli 5.13.0 → 5.14.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 (346) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +3 -1
  3. package/dist/agent-files.js +0 -74
  4. package/dist/agent-files.js.map +1 -1
  5. package/dist/app-files.js +0 -19
  6. package/dist/app-files.js.map +1 -1
  7. package/dist/assure-hydration.js +0 -23
  8. package/dist/assure-hydration.js.map +1 -1
  9. package/dist/assure.js +0 -14
  10. package/dist/assure.js.map +1 -1
  11. package/dist/capabilities-tool.js +0 -51
  12. package/dist/capabilities-tool.js.map +1 -1
  13. package/dist/cdn-check.js +0 -2
  14. package/dist/cdn-check.js.map +1 -1
  15. package/dist/check-diagnostics.js +0 -29
  16. package/dist/check-diagnostics.js.map +1 -1
  17. package/dist/check-scan.js +10 -621
  18. package/dist/check-scan.js.map +1 -1
  19. package/dist/check.js +0 -86
  20. package/dist/check.js.map +1 -1
  21. package/dist/cli.js +3 -336
  22. package/dist/cli.js.map +1 -1
  23. package/dist/client-module.js +0 -13
  24. package/dist/client-module.js.map +1 -1
  25. package/dist/command-catalog.js +0 -21
  26. package/dist/command-catalog.js.map +1 -1
  27. package/dist/component-check.js +1 -7
  28. package/dist/component-check.js.map +1 -1
  29. package/dist/config-target.js +0 -13
  30. package/dist/config-target.js.map +1 -1
  31. package/dist/contract-proof.js +0 -1
  32. package/dist/contract-proof.js.map +1 -1
  33. package/dist/contracts.js +0 -36
  34. package/dist/contracts.js.map +1 -1
  35. package/dist/db-audit.js +0 -15
  36. package/dist/db-audit.js.map +1 -1
  37. package/dist/db-child.js +0 -20
  38. package/dist/db-child.js.map +1 -1
  39. package/dist/db-config.js +0 -23
  40. package/dist/db-config.js.map +1 -1
  41. package/dist/db-tool.js +0 -24
  42. package/dist/db-tool.js.map +1 -1
  43. package/dist/deployment-adapters.js +1 -7
  44. package/dist/deployment-adapters.js.map +1 -1
  45. package/dist/dev-bun-config.js +0 -102
  46. package/dist/dev-bun-config.js.map +1 -1
  47. package/dist/dev-feed-tool.js +0 -32
  48. package/dist/dev-feed-tool.js.map +1 -1
  49. package/dist/dev-server-client.js +0 -16
  50. package/dist/dev-server-client.js.map +1 -1
  51. package/dist/diagnostics.js +0 -10
  52. package/dist/diagnostics.js.map +1 -1
  53. package/dist/diff-tool.js +0 -23
  54. package/dist/diff-tool.js.map +1 -1
  55. package/dist/docs-search.js +0 -35
  56. package/dist/docs-search.js.map +1 -1
  57. package/dist/doctor.js +3 -161
  58. package/dist/doctor.js.map +1 -1
  59. package/dist/env-file.js +0 -66
  60. package/dist/env-file.js.map +1 -1
  61. package/dist/examples.js +0 -16
  62. package/dist/examples.js.map +1 -1
  63. package/dist/fix-recipes.js +0 -20
  64. package/dist/fix-recipes.js.map +1 -1
  65. package/dist/frontend-guidance.js +0 -36
  66. package/dist/frontend-guidance.js.map +1 -1
  67. package/dist/hand-built-manifest.js +0 -17
  68. package/dist/hand-built-manifest.js.map +1 -1
  69. package/dist/hooks-report.js +0 -4
  70. package/dist/hooks-report.js.map +1 -1
  71. package/dist/i18n-check.js +0 -30
  72. package/dist/i18n-check.js.map +1 -1
  73. package/dist/init-agents.js +1 -133
  74. package/dist/init-agents.js.map +1 -1
  75. package/dist/internal/code-unit-order.js +0 -2
  76. package/dist/internal/code-unit-order.js.map +1 -1
  77. package/dist/internal/config-paths.js +0 -12
  78. package/dist/internal/config-paths.js.map +1 -1
  79. package/dist/internal/control-character.js +0 -1
  80. package/dist/internal/control-character.js.map +1 -1
  81. package/dist/internal/escape-regexp.d.ts +1 -2
  82. package/dist/internal/escape-regexp.d.ts.map +1 -1
  83. package/dist/internal/escape-regexp.js +1 -4
  84. package/dist/internal/escape-regexp.js.map +1 -1
  85. package/dist/internal/git-ignored.js +0 -11
  86. package/dist/internal/git-ignored.js.map +1 -1
  87. package/dist/internal/installed-package.js +0 -2
  88. package/dist/internal/installed-package.js.map +1 -1
  89. package/dist/internal/line-at.js +0 -1
  90. package/dist/internal/line-at.js.map +1 -1
  91. package/dist/internal/nifra-project.js +0 -31
  92. package/dist/internal/nifra-project.js.map +1 -1
  93. package/dist/internal/posix-path.js +0 -1
  94. package/dist/internal/posix-path.js.map +1 -1
  95. package/dist/internal/project-specifiers.js +0 -34
  96. package/dist/internal/project-specifiers.js.map +1 -1
  97. package/dist/internal/realpath-or-self.js +0 -1
  98. package/dist/internal/realpath-or-self.js.map +1 -1
  99. package/dist/internal/record.d.ts +1 -1
  100. package/dist/internal/record.d.ts.map +1 -1
  101. package/dist/internal/record.js +1 -4
  102. package/dist/internal/record.js.map +1 -1
  103. package/dist/internal/reserved-segment-codemod.js +0 -44
  104. package/dist/internal/reserved-segment-codemod.js.map +1 -1
  105. package/dist/internal/script-kind.js +0 -5
  106. package/dist/internal/script-kind.js.map +1 -1
  107. package/dist/internal/source-facts.js +3 -37
  108. package/dist/internal/source-facts.js.map +1 -1
  109. package/dist/internal/typescript-import.js +0 -49
  110. package/dist/internal/typescript-import.js.map +1 -1
  111. package/dist/internal/workspace-packages.js +0 -24
  112. package/dist/internal/workspace-packages.js.map +1 -1
  113. package/dist/introspect.js +1 -89
  114. package/dist/introspect.js.map +1 -1
  115. package/dist/learn.js +0 -16
  116. package/dist/learn.js.map +1 -1
  117. package/dist/levels-tool.js +0 -34
  118. package/dist/levels-tool.js.map +1 -1
  119. package/dist/load.js +0 -75
  120. package/dist/load.js.map +1 -1
  121. package/dist/local-cli.js +0 -23
  122. package/dist/local-cli.js.map +1 -1
  123. package/dist/lock-links.js +0 -20
  124. package/dist/lock-links.js.map +1 -1
  125. package/dist/manifest-tool.js +0 -5
  126. package/dist/manifest-tool.js.map +1 -1
  127. package/dist/mcp-app-tool.js +0 -9
  128. package/dist/mcp-app-tool.js.map +1 -1
  129. package/dist/mcp-context.js +0 -30
  130. package/dist/mcp-context.js.map +1 -1
  131. package/dist/mcp-delegate.js +0 -45
  132. package/dist/mcp-delegate.js.map +1 -1
  133. package/dist/mcp-docs-tools.js +0 -13
  134. package/dist/mcp-docs-tools.js.map +1 -1
  135. package/dist/mcp-exec.js +0 -71
  136. package/dist/mcp-exec.js.map +1 -1
  137. package/dist/mcp-http.js +1 -38
  138. package/dist/mcp-http.js.map +1 -1
  139. package/dist/mcp-io.d.ts +5 -1
  140. package/dist/mcp-io.d.ts.map +1 -1
  141. package/dist/mcp-io.js +3 -68
  142. package/dist/mcp-io.js.map +1 -1
  143. package/dist/mcp-isolate.js +0 -28
  144. package/dist/mcp-isolate.js.map +1 -1
  145. package/dist/mcp-path.js +0 -8
  146. package/dist/mcp-path.js.map +1 -1
  147. package/dist/mcp-project-child.js +0 -19
  148. package/dist/mcp-project-child.js.map +1 -1
  149. package/dist/mcp-protocol.js +0 -5
  150. package/dist/mcp-protocol.js.map +1 -1
  151. package/dist/mcp-reflect.js +0 -11
  152. package/dist/mcp-reflect.js.map +1 -1
  153. package/dist/mcp-relay.d.ts +4 -0
  154. package/dist/mcp-relay.d.ts.map +1 -1
  155. package/dist/mcp-relay.js +9 -20
  156. package/dist/mcp-relay.js.map +1 -1
  157. package/dist/mcp-render.js +1 -42
  158. package/dist/mcp-render.js.map +1 -1
  159. package/dist/mcp-root.js +0 -90
  160. package/dist/mcp-root.js.map +1 -1
  161. package/dist/mcp-run.js +1 -38
  162. package/dist/mcp-run.js.map +1 -1
  163. package/dist/mcp-tool-meta.js +3 -8
  164. package/dist/mcp-tool-meta.js.map +1 -1
  165. package/dist/mcp-ws.js +0 -16
  166. package/dist/mcp-ws.js.map +1 -1
  167. package/dist/mcp.js +0 -86
  168. package/dist/mcp.js.map +1 -1
  169. package/dist/migrate-layout.js +0 -313
  170. package/dist/migrate-layout.js.map +1 -1
  171. package/dist/openapi-tool.js +0 -18
  172. package/dist/openapi-tool.js.map +1 -1
  173. package/dist/openapi-types.js +0 -22
  174. package/dist/openapi-types.js.map +1 -1
  175. package/dist/output-schemas.js +0 -67
  176. package/dist/output-schemas.js.map +1 -1
  177. package/dist/pipeline-guard.js +0 -58
  178. package/dist/pipeline-guard.js.map +1 -1
  179. package/dist/pipeline-report.js +0 -71
  180. package/dist/pipeline-report.js.map +1 -1
  181. package/dist/port.js +1 -89
  182. package/dist/port.js.map +1 -1
  183. package/dist/ppr-read-fix.js +0 -29
  184. package/dist/ppr-read-fix.js.map +1 -1
  185. package/dist/project-facts.js +0 -5
  186. package/dist/project-facts.js.map +1 -1
  187. package/dist/project-path.js +0 -7
  188. package/dist/project-path.js.map +1 -1
  189. package/dist/project-site.js +0 -2
  190. package/dist/project-site.js.map +1 -1
  191. package/dist/recipes/1.8.0.js +0 -9
  192. package/dist/recipes/1.8.0.js.map +1 -1
  193. package/dist/recipes/2.0.0.js +0 -6
  194. package/dist/recipes/2.0.0.js.map +1 -1
  195. package/dist/recipes/3.0.0.js +0 -7
  196. package/dist/recipes/3.0.0.js.map +1 -1
  197. package/dist/recipes/4.0.0.js +0 -6
  198. package/dist/recipes/4.0.0.js.map +1 -1
  199. package/dist/recipes/5.0.0.js +0 -8
  200. package/dist/recipes/5.0.0.js.map +1 -1
  201. package/dist/recipes/5.1.0.js +0 -6
  202. package/dist/recipes/5.1.0.js.map +1 -1
  203. package/dist/recipes/5.10.0.js +0 -10
  204. package/dist/recipes/5.10.0.js.map +1 -1
  205. package/dist/recipes/5.11.0.js +0 -7
  206. package/dist/recipes/5.11.0.js.map +1 -1
  207. package/dist/recipes/5.12.0.js +0 -6
  208. package/dist/recipes/5.12.0.js.map +1 -1
  209. package/dist/recipes/5.13.0.js +0 -6
  210. package/dist/recipes/5.13.0.js.map +1 -1
  211. package/dist/recipes/5.14.0.d.ts +10 -0
  212. package/dist/recipes/5.14.0.d.ts.map +1 -0
  213. package/dist/recipes/5.14.0.js +26 -0
  214. package/dist/recipes/5.14.0.js.map +1 -0
  215. package/dist/recipes/5.2.0.js +0 -7
  216. package/dist/recipes/5.2.0.js.map +1 -1
  217. package/dist/recipes/5.3.0.js +0 -8
  218. package/dist/recipes/5.3.0.js.map +1 -1
  219. package/dist/recipes/5.4.0.js +0 -8
  220. package/dist/recipes/5.4.0.js.map +1 -1
  221. package/dist/recipes/5.5.0.js +0 -6
  222. package/dist/recipes/5.5.0.js.map +1 -1
  223. package/dist/recipes/5.6.0.js +0 -7
  224. package/dist/recipes/5.6.0.js.map +1 -1
  225. package/dist/recipes/5.7.0.js +0 -9
  226. package/dist/recipes/5.7.0.js.map +1 -1
  227. package/dist/recipes/5.8.0.js +0 -6
  228. package/dist/recipes/5.8.0.js.map +1 -1
  229. package/dist/recipes/5.9.0.js +0 -9
  230. package/dist/recipes/5.9.0.js.map +1 -1
  231. package/dist/recipes/index.d.ts.map +1 -1
  232. package/dist/recipes/index.js +2 -9
  233. package/dist/recipes/index.js.map +1 -1
  234. package/dist/release-verification.js +0 -14
  235. package/dist/release-verification.js.map +1 -1
  236. package/dist/replay.js +0 -3
  237. package/dist/replay.js.map +1 -1
  238. package/dist/review.js +0 -21
  239. package/dist/review.js.map +1 -1
  240. package/dist/route-types.js +0 -17
  241. package/dist/route-types.js.map +1 -1
  242. package/dist/rule-explain.js +0 -5
  243. package/dist/rule-explain.js.map +1 -1
  244. package/dist/rules/codes.js +0 -2
  245. package/dist/rules/codes.js.map +1 -1
  246. package/dist/rules/comment-markers.js +0 -25
  247. package/dist/rules/comment-markers.js.map +1 -1
  248. package/dist/rules/contract-visibility.js +0 -27
  249. package/dist/rules/contract-visibility.js.map +1 -1
  250. package/dist/rules/data-guard.js +1 -52
  251. package/dist/rules/data-guard.js.map +1 -1
  252. package/dist/rules/internal-links.js +0 -36
  253. package/dist/rules/internal-links.js.map +1 -1
  254. package/dist/rules/islands.js +2 -65
  255. package/dist/rules/islands.js.map +1 -1
  256. package/dist/rules/layout.js +0 -1
  257. package/dist/rules/layout.js.map +1 -1
  258. package/dist/rules/legacy.js +0 -31
  259. package/dist/rules/legacy.js.map +1 -1
  260. package/dist/rules/merge-auth.js +0 -9
  261. package/dist/rules/merge-auth.js.map +1 -1
  262. package/dist/rules/pages.js +0 -95
  263. package/dist/rules/pages.js.map +1 -1
  264. package/dist/rules/ppr.js +0 -8
  265. package/dist/rules/ppr.js.map +1 -1
  266. package/dist/rules/route-statement.js +0 -13
  267. package/dist/rules/route-statement.js.map +1 -1
  268. package/dist/rules/routes.js +1 -67
  269. package/dist/rules/routes.js.map +1 -1
  270. package/dist/rules/secrets.js +0 -15
  271. package/dist/rules/secrets.js.map +1 -1
  272. package/dist/rules/security.js +0 -113
  273. package/dist/rules/security.js.map +1 -1
  274. package/dist/rules/server-fn-namespace.js +0 -5
  275. package/dist/rules/server-fn-namespace.js.map +1 -1
  276. package/dist/rules/source-scan.js +0 -5
  277. package/dist/rules/source-scan.js.map +1 -1
  278. package/dist/rules/swap.js +0 -21
  279. package/dist/rules/swap.js.map +1 -1
  280. package/dist/rules/text-slot-boolean.js +0 -5
  281. package/dist/rules/text-slot-boolean.js.map +1 -1
  282. package/dist/rules/typescript.js +0 -5
  283. package/dist/rules/typescript.js.map +1 -1
  284. package/dist/rules/undeclared-response.js +0 -8
  285. package/dist/rules/undeclared-response.js.map +1 -1
  286. package/dist/rules/zones.js +0 -45
  287. package/dist/rules/zones.js.map +1 -1
  288. package/dist/runtime-differences.js +0 -20
  289. package/dist/runtime-differences.js.map +1 -1
  290. package/dist/scaffold-hole.js +1 -45
  291. package/dist/scaffold-hole.js.map +1 -1
  292. package/dist/scaffold.js +3 -60
  293. package/dist/scaffold.js.map +1 -1
  294. package/dist/sdk.js +1 -13
  295. package/dist/sdk.js.map +1 -1
  296. package/dist/search-terms.js +0 -12
  297. package/dist/search-terms.js.map +1 -1
  298. package/dist/shell-files.js +0 -15
  299. package/dist/shell-files.js.map +1 -1
  300. package/dist/shell-init.js +0 -15
  301. package/dist/shell-init.js.map +1 -1
  302. package/dist/smoke.js +0 -4
  303. package/dist/smoke.js.map +1 -1
  304. package/dist/source-rewrites.js +0 -43
  305. package/dist/source-rewrites.js.map +1 -1
  306. package/dist/stylex-migrate.js +0 -29
  307. package/dist/stylex-migrate.js.map +1 -1
  308. package/dist/symptom-search.js +0 -3
  309. package/dist/symptom-search.js.map +1 -1
  310. package/dist/sync-manifest.js +3 -33
  311. package/dist/sync-manifest.js.map +1 -1
  312. package/dist/test-tool.js +0 -10
  313. package/dist/test-tool.js.map +1 -1
  314. package/dist/typecheck-coverage.js +0 -36
  315. package/dist/typecheck-coverage.js.map +1 -1
  316. package/dist/types-search.js +0 -35
  317. package/dist/types-search.js.map +1 -1
  318. package/dist/upgrade.js +0 -214
  319. package/dist/upgrade.js.map +1 -1
  320. package/dist/verification-plan.js +0 -19
  321. package/dist/verification-plan.js.map +1 -1
  322. package/dist/verification.js +0 -23
  323. package/dist/verification.js.map +1 -1
  324. package/dist/version-drift.js +0 -8
  325. package/dist/version-drift.js.map +1 -1
  326. package/dist/web-app-options.js +0 -16
  327. package/dist/web-app-options.js.map +1 -1
  328. package/dist/work-graph.js +0 -21
  329. package/dist/work-graph.js.map +1 -1
  330. package/dist/workspace-link.js +0 -31
  331. package/dist/workspace-link.js.map +1 -1
  332. package/docs/llms-full.txt +370 -31
  333. package/docs/types.json +152 -3
  334. package/package.json +12 -11
  335. package/src/assure-hydration.ts +3 -3
  336. package/src/cli.ts +5 -5
  337. package/src/internal/escape-regexp.ts +1 -4
  338. package/src/internal/record.ts +1 -3
  339. package/src/internal/typescript-import.ts +1 -1
  340. package/src/mcp-http.ts +1 -1
  341. package/src/mcp-io.ts +8 -5
  342. package/src/mcp-relay.ts +19 -7
  343. package/src/mcp-render.ts +1 -1
  344. package/src/mcp-tool-meta.ts +3 -3
  345. package/src/recipes/5.14.0.ts +34 -0
  346. package/src/recipes/index.ts +2 -0
package/docs/types.json CHANGED
@@ -4431,7 +4431,7 @@
4431
4431
  "name": "CreateWebAppOptions",
4432
4432
  "kind": "interface",
4433
4433
  "package": "@nifrajs/web",
4434
- "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly serverComponents?: import(\"../server-components/types.js\").ServerComponentRuntime;\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** Cache production module imports and layout preparation, never request data. Defaults to NODE_ENV === \"production\"; disable for a mutable manifest. */\n readonly cacheRouteModules?: boolean;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. Pass {@link cspHeader} to have nifra write the\n * Content-Security-Policy header from the same value.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * Build the Content-Security-Policy value for each document a {@link nonce} app renders, or return\n * `undefined` to send none. nifra sets it on every document it renders - pages, status pages,\n * `_error`, streamed and deferred documents - from the nonce it put on that document's scripts, so\n * the header never depends on which `Request` object a wrapper holds. `sources` is the\n * `script-src` list the document needs: `'nonce-…'` plus a `'sha256-…'` hash for each constant\n * inline script nifra writes, which covers a document the resolver left nonce-free.\n *\n * ```ts\n * cspHeader: ({ sources }) => `default-src 'self'; script-src 'self' ${sources}; object-src 'none'`\n * ```\n *\n * Needs `nonce`; `csp` writes its own header, so the two are refused together.\n */\n readonly cspHeader?: (context: CspHeaderContext) => string | undefined;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`, instead of `nonce`. A document then\n * carries a nonce only when it needs one (it `defer()`s a value, or `meta` names the nonce in\n * `unsafeInlineScript`); every other page is nonce-free, gets the same CSP header on every request,\n * and stays cacheable by `withISR` or a CDN. `meta` still receives a nonce to name.\n */\n readonly csp?: CspPolicy;\n /**\n * Partial prerendering, from `partialPrerendering()` in `@nifrajs/web/ppr`. A route whose backend\n * half exports `shellLoader` streams a shell shared by every visitor, then each `dynamic` boundary\n * as it settles. `csp` (hashes) is optional; `nonce` is refused, since a per-request nonce would\n * make every shell unique.\n */\n readonly ppr?: PprSetup;\n /**\n * Options for the underlying `server()` - `requestTimeoutMs`, `admission`, `gracefulSignals`, and\n * the rest of {@link ServerOptions}.\n *\n * Needed because the `Server` is constructed in here, so a caller has no other way to reach its\n * constructor: a page app could set no request timeout and no capacity gate, which are exactly the\n * two knobs a production readiness check looks for. An SSR app wants them MORE than a backend does -\n * a render is slow and allocation-heavy, so a burst that a JSON API would absorb is the one that\n * exhausts the pod.\n *\n * Applies to the whole app, {@link mounts} and the {@link api} auto-mount included: the capacity gate\n * sits at the fetch entry, ahead of the request hooks those are dispatched from.\n */\n readonly server?: ServerOptions;\n /**\n * Runs against the app BEFORE any page route is registered - the seam for `securityHeaders()`,\n * `requestId()`, `logger()`, a rate limit, or anything else applied with `use`.\n *\n * ```ts\n * createWebApp({\n * …,\n * use: (app) => {\n * app.use(securityHeaders())\n * app.use(requestId())\n * },\n * })\n * ```\n *\n * A callback rather than an array because `use` is overloaded - `Middleware`, `IdentityPlugin`,\n * `ContextPlugin` - and only the real call site instantiates the right overload. The return value\n * is ignored: this is for cross-cutting concerns, not for declaring routes (declare those on the\n * returned app, where they get their types).\n *\n * **Why the timing matters.** `beforeHandle`, `afterHandle`, `around`, `derive`/`decorate`, and\n * `onError` are snapshotted into each route AS IT IS DECLARED, and `createWebApp` declares every\n * page (plus the `/*` catch-all) before it returns - so a caller's `app.use(…)` afterwards would\n * bind them to no page, and outside production it throws (`HOOK_AFTER_PAGES`). `requestId()` is\n * exactly that case: it is a `derive`, so applied late it would leave every page without\n * `c.requestId`. A `group()` is its own scope and stays allowed. Route assurance evidence is order-scoped the same\n * way, so a late `securityHeaders()` leaves the pages unable to PROVE the header to `nifra assure`\n * even though it does still set it.\n *\n * `onRequest`/`onResponse` (and the response header/body hooks) are app-global arrays read at\n * request time, so those alone DO work when added late. Using this seam for everything avoids\n * having to remember which is which.\n *\n * Runs ahead of the {@link mounts} / {@link api} request hooks, so an `onRequest` middleware guards\n * a mounted auth handler too.\n *\n * A `ContextPlugin` applied here takes runtime effect but cannot widen the declared return type of\n * this function, so `c.requestId` is not typed on routes you declare afterwards. Named plugins are\n * idempotent, so `app.use(requestId())` on the returned app recovers the TYPE without applying the\n * plugin a second time.\n */\n readonly use?: (app: ReturnType<typeof server<Env>>) => void;\n /** Injected into each loader's `ctx.api` - typically an `inProcessClient(app)` (typed\n * per-route via `@nifrajs/client`'s `createRoutes`). Opaque to the core.\n *\n * **Auto-mount.** Every `inProcessClient(backend)` exposes the symbol-keyed platform-aware backend\n * mount interface from `@nifrajs/core/mount`; given an {@link apiPrefix}, `createWebApp` also serves\n * that backend over HTTP there: a request whose pathname starts with the prefix is dispatched before\n * page routing with the same `env`/`waitUntil` platform context, and the backend's `Response` is\n * returned untouched. The mount runs in `nifra dev` too. Without `apiPrefix` the backend is\n * loader-only.\n *\n * **Request-scoped loader calls.** While a page renders, its loaders, actions and boundaries get a\n * `ctx.api` bound to that request's platform identity: a backend handler reached through it sees the\n * visitor's `c.clientIp` (derived under this app's `server.clientIp` trust declaration), `c.env` and\n * `c.waitUntil`, so a per-caller rate limit or audit field keys on the real visitor. `c.clientIp` is\n * the supported way to read the caller - identity travels in the platform, so rebuilding a `Request`\n * does not lose it. Headers do NOT travel: the page request's `cookie` and `authorization` are never\n * copied, so a loader call is anonymous unless the loader passes headers on the call itself. */\n readonly api?: unknown;\n /** HTTP path prefix the {@link api} backend is mounted at, such as `\"/api\"`. A request whose\n * pathname is exactly the prefix or starts with `prefix + \"/\"` is dispatched to the backend before\n * page routing; the backend therefore defines its routes at the **full** path (`server().post(\"/api/\n * sync\", …)`), matching the in-process `inProcessClient` call sites. Unset or `\"\"`, nothing is\n * mounted: the app serves pages only and `api` stays a loader-only `ctx.api`. Mounting is also a\n * no-op when `api` does not expose the symbol mount.\n *\n * A page file under the prefix (`routes/api/report.tsx`) could never render - the backend answers\n * first and its 404 is final - so `createWebApp` throws, naming the file. The same holds for every\n * other pre-route mount. */\n readonly apiPrefix?: string;\n /**\n * Strip {@link apiPrefix} from the pathname before dispatching to `api` (default `false`).\n *\n * The default suits a backend that declares FULL paths (`server().post(\"/api/sync\", …)`), which is\n * right when it is only ever mounted here. Set this when the backend declares its routes WITHOUT the\n * prefix because it also runs standalone behind its own shell, so its paths cannot carry a prefix that\n * only exists when it is mounted. Without it every request 404s inside the backend, and the workaround\n * is a `Proxy` that rewrites each URL.\n */\n readonly apiStrip?: boolean;\n /**\n * Sub-apps mounted ahead of page routing - an auth handler, a webhook receiver, a stack's routes.\n *\n * Structural on purpose: anything with `{ path, app: { fetch } }` fits, so a library that exposes its\n * routes as such a list mounts as `mounts: theirRoutes` without `@nifrajs/web` taking a dependency on\n * it. `better-auth` is the motivating case - it is not a `backend` route, so `/api/auth/*` used to 404\n * silently.\n *\n * Tried longest-path-first and BEFORE the `api` mount, so a mount at `/api/auth` wins over a backend\n * at `/api` no matter which was declared first. `stripPrefix` is the per-mount form of {@link apiStrip}:\n * leave it off to pass the full path through. `opaque` states why a mount whose routes nifra cannot\n * read (better-auth's handler) is outside assurance; it is then listed as a known gap, with any\n * routes it declares reported as declared.\n */\n readonly mounts?: ReadonlyArray<{\n readonly path: string;\n readonly app: MountableApp<Env>;\n readonly stripPrefix?: boolean;\n readonly priority?: number;\n readonly fallbackOn?: 404;\n readonly opaque?: MountOptions<Env>[\"opaque\"];\n }>;\n /** Secret for **draft / preview mode** (see `enableDraft`). When set, a request carrying a valid\n * signed `__nifra_draft` cookie gets `ctx.draft === true` in loaders/actions (else always `false`).\n * Pair with `withISR({ draftSecret })` so editors bypass the cache. Omit to disable draft mode. */\n readonly draftSecret?: string;\n /**\n * Live data refresh, from `live()` in `@nifrajs/web/live`. Loaders declare keys with `ctx.live()`;\n * the app answers live loads at the runtime's load endpoint. Omit and nothing live is loaded.\n */\n readonly live?: LiveRuntimeHandle;\n /** Per-route chunk URLs (`buildClient`'s `BuildManifest.routes`) - `routeId → [layout chunks…, own\n * chunk]`. When present, each page `modulepreload`s its matched route's chunks alongside the entry,\n * so the route code downloads in parallel (no entry→route-chunk waterfall). Omit ⇒ entry-only. */\n readonly routePreload?: Readonly<Record<string, readonly string[]>>;\n /** The app's bundled stylesheet URLs (`buildClient`'s `BuildManifest.css`) - the aggregate, injected\n * as `<link rel=\"stylesheet\">` in a page's `<head>`. Used as the fallback for any route absent from\n * {@link routeStyles}. Omit ⇒ no links (dev, where Vite injects CSS, or a CSS-free app). */\n readonly styles?: readonly string[];\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - `routeId → [chain CSS]`.\n * When a matched route has an entry here, only those (its layout chain + own CSS) are linked instead\n * of the aggregate `styles`, so a page ships only the CSS it uses. An empty array ⇒ no `<link>` (the\n * page imports no CSS). Routes absent here fall back to `styles`. Omit ⇒ always use `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`, the server manifest's\n * `copyChunks`). A production client build moves copy tables (`@nifrajs/i18n/copy`) into one chunk per\n * locale; each page lists them for the browser and preloads its own. Omit ⇒ tables keep their values. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /**\n * The app's locale routing, `defineI18nRouting()` from `@nifrajs/i18n/routing`, registered once:\n * export it as `i18n` from `backend/framework.ts`. Every document then takes its locale from the\n * URL: `<html lang dir>` from the registry unless the route's meta sets `lang`, a `Content-Language`\n * header, and the locale each adapter's `useLocale()` and `<I18nProvider>` read. A route under a\n * `[lang]` or `[[lang]]` directory is checked with its `matchSegment()` before any middleware: an\n * unserved locale, or a page missing from it, is a 404, and a non-canonical prefix (`/en/x` when the\n * default is unprefixed) redirects with a 308.\n */\n readonly i18n?: WebAppI18n;\n /**\n * Activation policy for framework-owned stylesheet links (default `\"blocking\"`). `\"deferred\"`\n * emits `media=\"print\"` links; the generated client waits for them and switches them to `all` before\n * mounting. Pair with an aggregate Vite stylesheet (`cssCodeSplit: false`) to prevent lazy-prefetch\n * CSS insertion. Non-hydrated pages always keep their stylesheet links blocking.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). Handed over as `window.__NIFRA_PRERENDERED__` on every page so a client soft-nav\n * into a prerendered route fetches its static `_data.json` instead of hitting the worker, unless the\n * target carries a query string, which renders on demand as a hard request does. A set over\n * 4 KB of JSON is served once from `/__nifra/prerendered.json?v=<version>`, cacheable for good, and\n * pages hand over only that URL; `prerenderRoutes` writes the file into a static output. */\n readonly prerenderedPaths?: readonly string[];\n /**\n * Pages a self-hosted build prerendered, answered from their file instead of rendered. `nifra build\n * --target bun|node` wires this from its prerender pass. The page is served from the page route,\n * so `use` middleware and every request hook run first; a request with a query string, a navigation\n * data or component request, or a draft-mode visitor renders on demand as before. Ignored with\n * {@link nonce}, whose documents need a nonce minted for their request.\n */\n readonly prerenderedPages?: PrerenderedPages;\n /**\n * Which pages and files each host serves, from `createHostPolicy()`. Evaluated before everything\n * else the app answers (prerendered pages, mounts, the API, every page) and, in a `nifra build`\n * server entry, before its static files too. A refused path answers the policy's refusal.\n */\n readonly hostPolicy?: HostPolicy;\n /**\n * Which cookies say who is signed in, for an app with a `keepAlive` route. A response that changes\n * or deletes one rotates the readable identity epoch cookie, and every tab drops the pages it kept\n * for the previous visitor. The session cookies of `@nifrajs/auth` and Auth.js count under their\n * default names, Better Auth's under any `cookiePrefix`; name any other in `identityCookies`. An app\n * run by `nifra dev` and `nifra build` exports this from `backend/framework.ts`. Development reports, once per\n * name, an `HttpOnly` cookie that changes and is in neither list (`NIFRA_KEEPALIVE_IDENTITY_COOKIE`).\n */\n readonly keepAlive?: KeepAliveServerOptions;\n /**\n * The files the build emitted, by request path: `buildAssets` from the generated server manifest.\n * A {@link hostPolicy} rule's `buildAssets` token matches exactly these. `nifra dev` serves the\n * client bundle and `public/` ahead of the app, so the app's own check never sees them there.\n */\n readonly buildAssets?: BuildAssetSet;\n /** Publish the project's `AGENTS.md` inside `/llms.txt` and `/llms-full.txt`. **Off by default**:\n * those endpoints are public and unauthenticated, while `AGENTS.md` is a repo file written for the\n * team - unreleased feature names, internal hostnames, and \"don't touch X yet\" notes live there\n * routinely. Turn it on only for a repo whose guidelines you would publish as a page. */\n readonly publishLocalGuidelines?: boolean;\n /** Serve `/llms.txt` and `/llms-full.txt`: the page routes, and the backend routes when the backend\n * is mounted over HTTP at {@link apiPrefix}, with their request and response schemas in the full\n * text. **Off by default**: both are public and unauthenticated, and they list every route, admin\n * and internal ones included. Turn it on for an app whose whole surface you would publish. */\n readonly llmsTxt?: boolean;\n /** SSG: per dynamic route pattern, its `getStaticPaths` `fallback` (from `enumerateStaticRoutes` or\n * the build's `prerendered.json`). A route mapped to `\"404\"` rejects any path NOT in\n * `prerenderedPaths` with the 404 page - the unlisted path simply doesn't exist. `\"ssr\"` (the\n * default for unmapped routes) renders unlisted paths on-demand. */\n readonly staticFallbacks?: Readonly<Record<string, \"ssr\" | \"404\">>;\n /** In-memory reference cache for explicitly `static` boundary values. It never persists payloads\n * across processes; operated/durable cache implementations stay outside the public framework. */\n readonly staticBoundaryCache?: import(\"../boundary.js\").StaticBoundaryCache;\n /** Observe every loader/action failure - for error-reporting plugins (Sentry-style). Called for\n * real throws (not control-flow `Response`s like `redirect`), **before** the nearest `_error`\n * boundary renders / a soft-nav 500 / a rethrow. A failure a boundary answers is also written to the\n * server's `logger` (under its `errorLogDetail`) whether or not this is set, exactly as an unhandled\n * error is. Observation only; its own throws are swallowed so a faulty reporter can't break\n * rendering. (`beforeLoader` is intentionally omitted - the core HTTP hooks already cover\n * pre-request work.) */\n readonly onLoaderError?: (error: unknown, ctx: {\n readonly request: Request;\n readonly params: Readonly<Record<string, string>>;\n readonly route: string;\n }) => void;\n}"
4434
+ "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly serverComponents?: import(\"../server-components/types.js\").ServerComponentRuntime;\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** Cache production module imports and layout preparation, never request data. Defaults to NODE_ENV === \"production\"; disable for a mutable manifest. */\n readonly cacheRouteModules?: boolean;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. Pass {@link cspHeader} to have nifra write the\n * Content-Security-Policy header from the same value.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * Build the Content-Security-Policy value for each document a {@link nonce} app renders, or return\n * `undefined` to send none. nifra sets it on every document it renders - pages, status pages,\n * `_error`, streamed and deferred documents - from the nonce it put on that document's scripts, so\n * the header never depends on which `Request` object a wrapper holds. `sources` is the\n * `script-src` list the document needs: `'nonce-…'` plus a `'sha256-…'` hash for each constant\n * inline script nifra writes, which covers a document the resolver left nonce-free.\n *\n * ```ts\n * cspHeader: ({ sources }) => `default-src 'self'; script-src 'self' ${sources}; object-src 'none'`\n * ```\n *\n * Needs `nonce`; `csp` writes its own header, so the two are refused together.\n */\n readonly cspHeader?: (context: CspHeaderContext) => string | undefined;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`, instead of `nonce`. A document then\n * carries a nonce only when it needs one (it `defer()`s a value, or `meta` names the nonce in\n * `unsafeInlineScript`); every other page is nonce-free, gets the same CSP header on every request,\n * and stays cacheable by `withISR` or a CDN. `meta` still receives a nonce to name.\n */\n readonly csp?: CspPolicy;\n /**\n * Partial prerendering, from `partialPrerendering()` in `@nifrajs/web/ppr`. A route whose backend\n * half exports `shellLoader` streams a shell shared by every visitor, then each `dynamic` boundary\n * as it settles. `csp` (hashes) is optional; `nonce` is refused, since a per-request nonce would\n * make every shell unique.\n */\n readonly ppr?: PprSetup;\n /**\n * Options for the underlying `server()` - `requestTimeoutMs`, `admission`, `gracefulSignals`, and\n * the rest of {@link ServerOptions}.\n *\n * Needed because the `Server` is constructed in here, so a caller has no other way to reach its\n * constructor: a page app could set no request timeout and no capacity gate, which are exactly the\n * two knobs a production readiness check looks for. An SSR app wants them MORE than a backend does -\n * a render is slow and allocation-heavy, so a burst that a JSON API would absorb is the one that\n * exhausts the pod.\n *\n * Applies to the whole app, {@link mounts} and the {@link api} auto-mount included: the capacity gate\n * sits at the fetch entry, ahead of the request hooks those are dispatched from.\n */\n readonly server?: ServerOptions;\n /**\n * Runs against the app BEFORE any page route is registered - the seam for `securityHeaders()`,\n * `requestId()`, `logger()`, a rate limit, or anything else applied with `use`.\n *\n * ```ts\n * createWebApp({\n * …,\n * use: (app) => {\n * app.use(securityHeaders())\n * app.use(requestId())\n * },\n * })\n * ```\n *\n * A callback rather than an array because `use` is overloaded - `Middleware`, `IdentityPlugin`,\n * `ContextPlugin` - and only the real call site instantiates the right overload. The return value\n * is ignored: this is for cross-cutting concerns, not for declaring routes (declare those on the\n * returned app, where they get their types).\n *\n * **Why the timing matters.** `beforeHandle`, `afterHandle`, `around`, `derive`/`decorate`, and\n * `onError` are snapshotted into each route AS IT IS DECLARED, and `createWebApp` declares every\n * page (plus the `/*` catch-all) before it returns - so a caller's `app.use(…)` afterwards would\n * bind them to no page, and outside production it throws (`HOOK_AFTER_PAGES`). `requestId()` is\n * exactly that case: it is a `derive`, so applied late it would leave every page without\n * `c.requestId`. A `group()` is its own scope and stays allowed. Route assurance evidence is order-scoped the same\n * way, so a late `securityHeaders()` leaves the pages unable to PROVE the header to `nifra assure`\n * even though it does still set it.\n *\n * `onRequest`/`onResponse` (and the response header/body hooks) are app-global arrays read at\n * request time, so those alone DO work when added late. Using this seam for everything avoids\n * having to remember which is which.\n *\n * Runs ahead of the {@link mounts} / {@link api} request hooks, so an `onRequest` middleware guards\n * a mounted auth handler too.\n *\n * A `ContextPlugin` applied here takes runtime effect but cannot widen the declared return type of\n * this function, so `c.requestId` is not typed on routes you declare afterwards. Named plugins are\n * idempotent, so `app.use(requestId())` on the returned app recovers the TYPE without applying the\n * plugin a second time.\n */\n readonly use?: (app: ReturnType<typeof server<Env>>) => void;\n /** Injected into each loader's `ctx.api` - typically an `inProcessClient(app)` (typed\n * per-route via `@nifrajs/client`'s `createRoutes`). Opaque to the core.\n *\n * **Auto-mount.** Every `inProcessClient(backend)` exposes the symbol-keyed platform-aware backend\n * mount interface from `@nifrajs/core/mount`; given an {@link apiPrefix}, `createWebApp` also serves\n * that backend over HTTP there: a request whose pathname starts with the prefix is dispatched before\n * page routing with the same `env`/`waitUntil` platform context, and the backend's `Response` is\n * returned untouched. The mount runs in `nifra dev` too. Without `apiPrefix` the backend is\n * loader-only.\n *\n * **Request-scoped loader calls.** While a page renders, its loaders, actions and boundaries get a\n * `ctx.api` bound to that request's platform identity: a backend handler reached through it sees the\n * visitor's `c.clientIp` (derived under this app's `server.clientIp` trust declaration), `c.env` and\n * `c.waitUntil`, so a per-caller rate limit or audit field keys on the real visitor. `c.clientIp` is\n * the supported way to read the caller - identity travels in the platform, so rebuilding a `Request`\n * does not lose it. Headers do NOT travel: the page request's `cookie` and `authorization` are never\n * copied, so a loader call is anonymous unless the loader passes headers on the call itself. */\n readonly api?: unknown;\n /** HTTP path prefix the {@link api} backend is mounted at, such as `\"/api\"`. A request whose\n * pathname is exactly the prefix or starts with `prefix + \"/\"` is dispatched to the backend before\n * page routing; the backend therefore defines its routes at the **full** path (`server().post(\"/api/\n * sync\", …)`), matching the in-process `inProcessClient` call sites. Unset or `\"\"`, nothing is\n * mounted: the app serves pages only and `api` stays a loader-only `ctx.api`. Mounting is also a\n * no-op when `api` does not expose the symbol mount.\n *\n * A page file under the prefix (`routes/api/report.tsx`) could never render - the backend answers\n * first and its 404 is final - so `createWebApp` throws, naming the file. The same holds for every\n * other pre-route mount. */\n readonly apiPrefix?: string;\n /**\n * Strip {@link apiPrefix} from the pathname before dispatching to `api` (default `false`).\n *\n * The default suits a backend that declares FULL paths (`server().post(\"/api/sync\", …)`), which is\n * right when it is only ever mounted here. Set this when the backend declares its routes WITHOUT the\n * prefix because it also runs standalone behind its own shell, so its paths cannot carry a prefix that\n * only exists when it is mounted. Without it every request 404s inside the backend; the routing layer\n * must strip the mount prefix before dispatching.\n */\n readonly apiStrip?: boolean;\n /**\n * Sub-apps mounted ahead of page routing - an auth handler, a webhook receiver, a stack's routes.\n *\n * Structural on purpose: anything with `{ path, app: { fetch } }` fits, so a library that exposes its\n * routes as such a list mounts as `mounts: theirRoutes` without `@nifrajs/web` taking a dependency on\n * it. `better-auth` is the motivating case - it is not a `backend` route, so `/api/auth/*` used to 404\n * silently.\n *\n * Tried longest-path-first and BEFORE the `api` mount, so a mount at `/api/auth` wins over a backend\n * at `/api` no matter which was declared first. `stripPrefix` is the per-mount form of {@link apiStrip}:\n * leave it off to pass the full path through. `opaque` states why a mount whose routes nifra cannot\n * read (better-auth's handler) is outside assurance; it is then listed as a known gap, with any\n * routes it declares reported as declared.\n */\n readonly mounts?: ReadonlyArray<{\n readonly path: string;\n readonly app: MountableApp<Env>;\n readonly stripPrefix?: boolean;\n readonly priority?: number;\n readonly fallbackOn?: 404;\n readonly opaque?: MountOptions<Env>[\"opaque\"];\n }>;\n /** Secret for **draft / preview mode** (see `enableDraft`). When set, a request carrying a valid\n * signed `__nifra_draft` cookie gets `ctx.draft === true` in loaders/actions (else always `false`).\n * Pair with `withISR({ draftSecret })` so editors bypass the cache. Omit to disable draft mode. */\n readonly draftSecret?: string;\n /**\n * Live data refresh, from `live()` in `@nifrajs/web/live`. Loaders declare keys with `ctx.live()`;\n * the app answers live loads at the runtime's load endpoint. Omit and nothing live is loaded.\n */\n readonly live?: LiveRuntimeHandle;\n /** Per-route chunk URLs (`buildClient`'s `BuildManifest.routes`) - `routeId → [layout chunks…, own\n * chunk]`. When present, each page `modulepreload`s its matched route's chunks alongside the entry,\n * so the route code downloads in parallel (no entry→route-chunk waterfall). Omit ⇒ entry-only. */\n readonly routePreload?: Readonly<Record<string, readonly string[]>>;\n /** The app's bundled stylesheet URLs (`buildClient`'s `BuildManifest.css`) - the aggregate, injected\n * as `<link rel=\"stylesheet\">` in a page's `<head>`. Used as the fallback for any route absent from\n * {@link routeStyles}. Omit ⇒ no links (dev, where Vite injects CSS, or a CSS-free app). */\n readonly styles?: readonly string[];\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - `routeId → [chain CSS]`.\n * When a matched route has an entry here, only those (its layout chain + own CSS) are linked instead\n * of the aggregate `styles`, so a page ships only the CSS it uses. An empty array ⇒ no `<link>` (the\n * page imports no CSS). Routes absent here fall back to `styles`. Omit ⇒ always use `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`, the server manifest's\n * `copyChunks`). A production client build moves copy tables (`@nifrajs/i18n/copy`) into one chunk per\n * locale; each page lists them for the browser and preloads its own. Omit ⇒ tables keep their values. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /**\n * The app's locale routing, `defineI18nRouting()` from `@nifrajs/i18n/routing`, registered once:\n * export it as `i18n` from `backend/framework.ts`. Every document then takes its locale from the\n * URL: `<html lang dir>` from the registry unless the route's meta sets `lang`, a `Content-Language`\n * header, and the locale each adapter's `useLocale()` and `<I18nProvider>` read. A route under a\n * `[lang]` or `[[lang]]` directory is checked with its `matchSegment()` before any middleware: an\n * unserved locale, or a page missing from it, is a 404, and a non-canonical prefix (`/en/x` when the\n * default is unprefixed) redirects with a 308.\n */\n readonly i18n?: WebAppI18n;\n /**\n * Activation policy for framework-owned stylesheet links (default `\"blocking\"`). `\"deferred\"`\n * emits `media=\"print\"` links; the generated client waits for them and switches them to `all` before\n * mounting. Pair with an aggregate Vite stylesheet (`cssCodeSplit: false`) to prevent lazy-prefetch\n * CSS insertion. Non-hydrated pages always keep their stylesheet links blocking.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). Handed over as `window.__NIFRA_PRERENDERED__` on every page so a client soft-nav\n * into a prerendered route fetches its static `_data.json` instead of hitting the worker, unless the\n * target carries a query string, which renders on demand as a hard request does. A set over\n * 4 KB of JSON is served once from `/__nifra/prerendered.json?v=<version>`, cacheable for good, and\n * pages hand over only that URL; `prerenderRoutes` writes the file into a static output. */\n readonly prerenderedPaths?: readonly string[];\n /**\n * Pages a self-hosted build prerendered, answered from their file instead of rendered. `nifra build\n * --target bun|node` wires this from its prerender pass. The page is served from the page route,\n * so `use` middleware and every request hook run first; a request with a query string, a navigation\n * data or component request, or a draft-mode visitor renders on demand as before. Ignored with\n * {@link nonce}, whose documents need a nonce minted for their request.\n */\n readonly prerenderedPages?: PrerenderedPages;\n /**\n * Which pages and files each host serves, from `createHostPolicy()`. Evaluated before everything\n * else the app answers (prerendered pages, mounts, the API, every page) and, in a `nifra build`\n * server entry, before its static files too. A refused path answers the policy's refusal.\n */\n readonly hostPolicy?: HostPolicy;\n /**\n * Which cookies say who is signed in, for an app with a `keepAlive` route. A response that changes\n * or deletes one rotates the readable identity epoch cookie, and every tab drops the pages it kept\n * for the previous visitor. The session cookies of `@nifrajs/auth` and Auth.js count under their\n * default names, Better Auth's under any `cookiePrefix`; name any other in `identityCookies`. An app\n * run by `nifra dev` and `nifra build` exports this from `backend/framework.ts`. Development reports, once per\n * name, an `HttpOnly` cookie that changes and is in neither list (`NIFRA_KEEPALIVE_IDENTITY_COOKIE`).\n */\n readonly keepAlive?: KeepAliveServerOptions;\n /**\n * The files the build emitted, by request path: `buildAssets` from the generated server manifest.\n * A {@link hostPolicy} rule's `buildAssets` token matches exactly these. `nifra dev` serves the\n * client bundle and `public/` ahead of the app, so the app's own check never sees them there.\n */\n readonly buildAssets?: BuildAssetSet;\n /** Publish the project's `AGENTS.md` inside `/llms.txt` and `/llms-full.txt`. **Off by default**:\n * those endpoints are public and unauthenticated, while `AGENTS.md` is a repo file written for the\n * team - unreleased feature names, internal hostnames, and \"don't touch X yet\" notes live there\n * routinely. Turn it on only for a repo whose guidelines you would publish as a page. */\n readonly publishLocalGuidelines?: boolean;\n /** Serve `/llms.txt` and `/llms-full.txt`: the page routes, and the backend routes when the backend\n * is mounted over HTTP at {@link apiPrefix}, with their request and response schemas in the full\n * text. **Off by default**: both are public and unauthenticated, and they list every route, admin\n * and internal ones included. Turn it on for an app whose whole surface you would publish. */\n readonly llmsTxt?: boolean;\n /** SSG: per dynamic route pattern, its `getStaticPaths` `fallback` (from `enumerateStaticRoutes` or\n * the build's `prerendered.json`). A route mapped to `\"404\"` rejects any path NOT in\n * `prerenderedPaths` with the 404 page - the unlisted path simply doesn't exist. `\"ssr\"` (the\n * default for unmapped routes) renders unlisted paths on-demand. */\n readonly staticFallbacks?: Readonly<Record<string, \"ssr\" | \"404\">>;\n /** In-memory reference cache for explicitly `static` boundary values. It never persists payloads\n * across processes; operated/durable cache implementations stay outside the public framework. */\n readonly staticBoundaryCache?: import(\"../boundary.js\").StaticBoundaryCache;\n /** Observe every loader/action failure - for error-reporting plugins (Sentry-style). Called for\n * real throws (not control-flow `Response`s like `redirect`), **before** the nearest `_error`\n * boundary renders / a soft-nav 500 / a rethrow. A failure a boundary answers is also written to the\n * server's `logger` (under its `errorLogDetail`) whether or not this is set, exactly as an unhandled\n * error is. Observation only; its own throws are swallowed so a faulty reporter can't break\n * rendering. (`beforeLoader` is intentionally omitted - the core HTTP hooks already cover\n * pre-request work.) */\n readonly onLoaderError?: (error: unknown, ctx: {\n readonly request: Request;\n readonly params: Readonly<Record<string, string>>;\n readonly route: string;\n }) => void;\n}"
4435
4435
  },
4436
4436
  {
4437
4437
  "name": "CronError",
@@ -6598,6 +6598,13 @@
6598
6598
  "signature": "export interface FetchHandler {\n fetch(request: Request, platform?: NodePlatform): Response | Promise<Response>;\n /** Nifra apps also expose this WS-upgrade seam; present → this adapter serves `app.ws()` routes via\n * the optional `ws` package (lazy-imported on the first upgrade). Absent (a plain `{ fetch }`\n * handler) → HTTP only, and an upgrade request gets a 404. */\n resolveWebSocketUpgrade?(request: Request, platform?: NodePlatform): WsUpgradeOutcome | Promise<WsUpgradeOutcome>;\n}",
6599
6599
  "doc": "/** Anything exposing a Web `fetch` handler - a nifra `app`, for instance. */"
6600
6600
  },
6601
+ {
6602
+ "name": "FetchHandler",
6603
+ "kind": "interface",
6604
+ "package": "@nifrajs/node-uws",
6605
+ "signature": "export interface FetchHandler {\n fetch(request: Request, platform?: {\n readonly clientIp?: string | undefined;\n }): Response | Promise<Response>;\n /** Present on every nifra app: the node-direct lane, which skips building a Web `Request`. */\n resolveNodeSource?(source: unknown, platform?: unknown, runtime?: object | undefined): NodeServeOutcome | Promise<NodeServeOutcome>;\n}",
6606
+ "doc": "/** Anything exposing a Web `fetch` handler - a nifra `app`, for instance. */"
6607
+ },
6601
6608
  {
6602
6609
  "name": "FetchRouteData",
6603
6610
  "kind": "type",
@@ -7259,12 +7266,25 @@
7259
7266
  "signature": "export interface HostPolicy {\n /** Capability kinds the host will admit. A descriptor of any other kind is refused. */\n readonly allowedKinds: readonly CapabilityKind[];\n /** Required-capability allowlist. Every `requiredCapabilities` entry must be present. */\n readonly allowedCapabilities: readonly string[];\n /** Isolation floor. A descriptor offering weaker isolation than this is refused. */\n readonly minIsolation: IsolationClass;\n /** When true, a descriptor whose approval class is `none` is refused as a downgrade. */\n readonly requireApproval: boolean;\n}",
7260
7267
  "doc": "/** The authoritative admission policy. Empty allowlists deny everything of that kind. */"
7261
7268
  },
7269
+ {
7270
+ "name": "HostPolicy",
7271
+ "kind": "interface",
7272
+ "package": "@nifrajs/node",
7273
+ "signature": "export interface HostPolicy {\n readonly allowedHosts: ReadonlySet<string> | ((host: string) => boolean) | undefined;\n readonly canonicalHost: string | undefined;\n readonly normalizeTarget: boolean;\n}",
7274
+ "doc": "/** The Host and target options `serve()` accepts, resolved once at startup. */"
7275
+ },
7262
7276
  {
7263
7277
  "name": "HostPolicy",
7264
7278
  "kind": "interface",
7265
7279
  "package": "@nifrajs/web",
7266
7280
  "signature": "export interface HostPolicy {\n readonly rules: readonly HostPolicyRule[];\n /**\n * Whether `pathname` (as requested, percent-encoded, without the query) may be served on `host` (a\n * Host header value; its port and case are ignored). `buildAssets` is the build's file set; without\n * it a rule's `buildAssets` matches nothing.\n */\n allows(host: string, pathname: string, buildAssets?: BuildAssetSet): boolean;\n /** The refusal for `pathname` on `host`, or `undefined` to serve it. */\n refusal(host: string, pathname: string, buildAssets?: BuildAssetSet): Response | undefined;\n /** {@link HostPolicy.refusal} for a request: its Host header (else its URL's host) and path. */\n check(request: Request, buildAssets?: BuildAssetSet): Response | undefined;\n}"
7267
7281
  },
7282
+ {
7283
+ "name": "HostPolicyOptions",
7284
+ "kind": "interface",
7285
+ "package": "@nifrajs/node",
7286
+ "signature": "export interface HostPolicyOptions {\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n readonly canonicalHost?: string;\n readonly normalizeTarget?: boolean;\n}"
7287
+ },
7268
7288
  {
7269
7289
  "name": "HostPolicyOptions",
7270
7290
  "kind": "interface",
@@ -10973,6 +10993,12 @@
10973
10993
  "signature": "export type NodeServeOutcome = {\n readonly kind: \"response\";\n readonly response: Response;\n} | {\n readonly kind: \"json\";\n readonly status: number;\n /** Header record after native hooks; repeated values are retained as arrays. */\n readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;\n /** Queued `Set-Cookie` lines, or `undefined`; the adapter emits one header line each. */\n readonly cookies: readonly string[] | undefined;\n /** The JSON body already stringified, or `null` for an empty (204) response. */\n readonly body: string | null;\n} | {\n readonly kind: \"body\";\n readonly status: number;\n readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;\n readonly body: string | Uint8Array;\n};",
10974
10994
  "doc": "/**\n * What {@link Server.resolveNode} returns: either a plain-data render the `@nifrajs/node` adapter writes\n * to the socket directly (`kind: \"json\"` - status + headers + cookies + a pre-stringified body, **no**\n * undici `Response` built or drained), a marked buffered response body (`kind: \"body\"` - e.g.\n * @nifrajs/web's non-deferred SSR HTML), or a `Response` (`kind: \"response\"`) for everything else\n * (redirects, 404/405/errors, unmarked or streaming bodies). Internal to the nifra<->node bridge.\n */"
10975
10995
  },
10996
+ {
10997
+ "name": "NodeServeOutcome",
10998
+ "kind": "type",
10999
+ "package": "@nifrajs/node",
11000
+ "signature": "export type NodeServeOutcome = {\n readonly kind: \"response\";\n readonly response: Response;\n} | {\n readonly kind: \"json\";\n readonly status: number;\n /** Header record after native hooks; repeated values are retained as arrays. */\n readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;\n /** Queued `Set-Cookie` lines, or `undefined`; the adapter emits one header line each. */\n readonly cookies: readonly string[] | undefined;\n /** The JSON body already stringified, or `null` for an empty (204) response. */\n readonly body: string | null;\n} | {\n readonly kind: \"body\";\n readonly status: number;\n readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;\n readonly body: string | Uint8Array;\n};"
11001
+ },
10976
11002
  {
10977
11003
  "name": "NodeServeOutcome",
10978
11004
  "kind": "type",
@@ -10993,6 +11019,13 @@
10993
11019
  "signature": "export interface NodeStopOptions {\n /** How long in-flight requests get to finish before the stop forces them closed. Default 10_000. */\n readonly drainMs?: number;\n /**\n * How long the server keeps serving after `stop()` began, before it stops accepting connections:\n * the time a load balancer takes to see readiness fail. Default 0.\n */\n readonly delayMs?: number;\n}",
10994
11020
  "doc": "/** How `stop()` winds the server down; the same shape as nifra's Bun `stop()` takes. */"
10995
11021
  },
11022
+ {
11023
+ "name": "NodeStopOptions",
11024
+ "kind": "interface",
11025
+ "package": "@nifrajs/node-uws",
11026
+ "signature": "export interface NodeStopOptions {\n readonly drainMs?: number;\n readonly delayMs?: number;\n}",
11027
+ "doc": "/** How `stop()` winds the server down; the same shape `serve()` takes in `@nifrajs/node`. */"
11028
+ },
10996
11029
  {
10997
11030
  "name": "NonceContext",
10998
11031
  "kind": "interface",
@@ -15539,6 +15572,12 @@
15539
15572
  "package": "@nifrajs/node",
15540
15573
  "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Protocol used when the adapter constructs `Request.url`.\n *\n * The default is `\"https\"` when {@link ServeOptions.tls} is set and `\"http\"` otherwise. Deployments\n * behind TLS termination can set `\"https\"` (or a trusted infra-aware function) so app code that reads\n * `request.url` sees the public scheme. Forwarded headers are not trusted implicitly.\n */\n readonly protocol?: RequestProtocolOption;\n /**\n * Serve HTTPS directly, with no proxy in front: `{ cert, key }` as PEM text or the files' bytes\n * (`readFileSync(\"cert.pem\")`), plus any other `node:tls` server option (`passphrase`, `ca`,\n * `requestCert` for client certificates, `minVersion`, `SNICallback`, ...). Unset, the server speaks\n * plain HTTP, which is what a proxy or platform that terminates TLS expects.\n */\n readonly tls?: TlsOptions;\n /** Reject requests whose normalized Host authority is not in this allowlist or callback result. */\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n /** Use this validated authority when constructing Request.url, ignoring the inbound Host value. */\n readonly canonicalHost?: string;\n /**\n * Route a request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed URL,\n * so `/public/../admin` reaches the app as `/admin`; Node's `IncomingMessage.url` is the target as\n * sent. Off, Node routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path. Off by default; enable it when path guards, or a path-normalizing proxy, sit in front\n * of or inside the app. The same option as `server({ normalizeTarget })` on Deno.\n *\n * Off applies to requests the adapter serves from Node's own request object. A request the adapter\n * must hand over as a Web `Request` - one a `static` callback sees, and every WebSocket upgrade -\n * is built by the platform's URL parser, which resolves dot segments whatever this option says.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in, as\n * `server({ gracefulSignals })` is for Bun's `listen()`. The object form is passed to `stop()`.\n *\n * The app-level request timeout (`server({ requestTimeoutMs })` → 503) and body cap\n * are *not* set here - they live inside `app.fetch`, so they already apply through\n * this adapter. Slow-client protection is Node's built-in `requestTimeout` (300s) /\n * `headersTimeout` (60s) defaults.\n */\n readonly gracefulSignals?: boolean | NodeStopOptions;\n /**\n * Sees every request before the app does, so a file it answers wins over any route at the same\n * path. It returns the file's response, or `undefined` to let the app route the request. No hook\n * of the app runs for a request it answers. The same option as Bun's `app.listen()` and\n * `@nifrajs/deno`'s `serve()`.\n *\n * {@link serveStatic} is the one to pass for files on disk: this adapter runs its mounts on Node's\n * own request, so a request they pass on keeps the app's direct lane. Any other function needs a\n * Web `Request` for every request, which roughly doubles the cost of a small route.\n */\n readonly static?: (request: Request) => Response | Promise<Response | undefined> | undefined;\n /**\n * Make a hand-rolled `return new Response(body)` ride the direct-write lane, by swapping\n * `globalThis.Response` for a stand-in that defers a *simple* construction (a string body, no\n * `statusText`, no headers or a plain header record) the way `c.text` / `c.json` already do.\n *\n * Off by default: prefer `c.text` / `c.json`, which get this without a global swap. Reach for the\n * flag only when handlers construct `Response` by hand on the hot path. It patches a process-global\n * builtin, so every `new Response(...)` anywhere in the process goes through the stand-in -\n * transparent (non-simple bodies build a real `Response`, and simple ones stay `instanceof\n * Response`), but a broad enough change to be opt-in.\n */\n readonly fastResponse?: boolean;\n}"
15541
15574
  },
15575
+ {
15576
+ "name": "ServeOptions",
15577
+ "kind": "interface",
15578
+ "package": "@nifrajs/node-uws",
15579
+ "signature": "export interface ServeOptions extends HostPolicyOptions {\n readonly port: number;\n readonly hostname?: string;\n /** The scheme `Request.url` carries. `\"https\"` by default when {@link tls} is set, else `\"http\"`. */\n readonly protocol?: \"http\" | \"https\";\n readonly tls?: UwsTlsOptions;\n /** SIGTERM/SIGINT call `stop()`; off by default, as in `@nifrajs/node`. */\n readonly gracefulSignals?: boolean | NodeStopOptions;\n}"
15580
+ },
15542
15581
  {
15543
15582
  "name": "ServeStaticOptions",
15544
15583
  "kind": "interface",
@@ -17861,18 +17900,31 @@
17861
17900
  "signature": "export interface UseQueryResult<T> {\n readonly state: Readonly<ShallowRef<QueryState<T>>>;\n /** Force a refetch (ignores `staleTime`). */\n readonly refetch: () => Promise<T>;\n}",
17862
17901
  "doc": "/** A query's reactive {@link QueryState} (read `.value`) plus `refetch`. */"
17863
17902
  },
17903
+ {
17904
+ "name": "UwsServer",
17905
+ "kind": "interface",
17906
+ "package": "@nifrajs/node-uws",
17907
+ "signature": "export interface UwsServer {\n /** The bound port (resolved when `port: 0` is requested). */\n readonly port: number;\n /**\n * Run the app's `onStopping` hooks, keep serving for `delayMs`, stop accepting connections, let\n * in-flight requests finish for up to `drainMs`, then close what is left and run `onStop`.\n */\n stop(options?: NodeStopOptions): Promise<void>;\n [Symbol.asyncDispose](): Promise<void>;\n}"
17908
+ },
17909
+ {
17910
+ "name": "UwsTlsOptions",
17911
+ "kind": "interface",
17912
+ "package": "@nifrajs/node-uws",
17913
+ "signature": "export interface UwsTlsOptions {\n readonly keyFileName: string;\n readonly certFileName: string;\n readonly passphrase?: string;\n readonly caFileName?: string;\n readonly dhParamsFileName?: string;\n readonly sslCiphers?: string;\n readonly sslPreferLowMemoryUsage?: boolean;\n}",
17914
+ "doc": "/**\n * HTTPS from files, in uWS's own terms: it reads the key and certificate itself, so these are paths\n * rather than the PEM text `@nifrajs/node` takes.\n */"
17915
+ },
17864
17916
  {
17865
17917
  "name": "VERSION",
17866
17918
  "kind": "const",
17867
17919
  "package": "@nifrajs/core",
17868
- "signature": "export declare const VERSION: \"5.13.0\";",
17920
+ "signature": "export declare const VERSION: \"5.14.0\";",
17869
17921
  "doc": "/**\n * Current package version. A hardcoded literal on purpose - core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version.\n */"
17870
17922
  },
17871
17923
  {
17872
17924
  "name": "VERSION",
17873
17925
  "kind": "const",
17874
17926
  "package": "nifra",
17875
- "signature": "export declare const VERSION: \"5.13.0\";",
17927
+ "signature": "export declare const VERSION: \"5.14.0\";",
17876
17928
  "doc": "/**\n * Current package version. A hardcoded literal on purpose - core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version.\n */"
17877
17929
  },
17878
17930
  {
@@ -18366,6 +18418,13 @@
18366
18418
  "signature": "export declare class ZoneConfigError extends Error {\n readonly name = \"ZoneConfigError\";\n /** The file holding the setting, as the caller named it. */\n readonly source: string;\n constructor(source: string, problem: string);\n}",
18367
18419
  "doc": "/** A `\"nifra\": { \"zones\": ... }` setting that cannot be applied. Thrown when a classifier is created. */"
18368
18420
  },
18421
+ {
18422
+ "name": "activateAsyncContextFrame",
18423
+ "kind": "const",
18424
+ "package": "@nifrajs/node",
18425
+ "signature": "export declare const activateAsyncContextFrame: () => void;",
18426
+ "doc": "/** Node's async-context bookkeeping flips on lazily; flipping it before listening keeps the tick loop monomorphic. */"
18427
+ },
18369
18428
  {
18370
18429
  "name": "addSourceTransform",
18371
18430
  "kind": "function",
@@ -19082,6 +19141,13 @@
19082
19141
  "package": "@nifrajs/web",
19083
19142
  "signature": "export declare function bytesStream(bytes: Uint8Array): ReadableStream<Uint8Array>;"
19084
19143
  },
19144
+ {
19145
+ "name": "bytesToHex",
19146
+ "kind": "function",
19147
+ "package": "@nifrajs/utils",
19148
+ "signature": "export declare function bytesToHex(bytes: Uint8Array): string;",
19149
+ "doc": "/** Lowercase hex, two digits per byte. */"
19150
+ },
19085
19151
  {
19086
19152
  "name": "cache",
19087
19153
  "kind": "function",
@@ -19632,6 +19698,13 @@
19632
19698
  "signature": "export declare function computed<T>(fn: () => T): Computed<T>;",
19633
19699
  "doc": "/**\n * Derived value, cached into a signal and computed on first read. While an effect (or another\n * computed) reads it, it recomputes when its tracked inputs change. Once nothing reads it, the next\n * input change stops it instead of recomputing, so a dropped computed costs nothing; reading it\n * again starts it afresh. `dispose()` stops it at once.\n */"
19634
19700
  },
19701
+ {
19702
+ "name": "concatBytes",
19703
+ "kind": "function",
19704
+ "package": "@nifrajs/utils",
19705
+ "signature": "export declare function concatBytes(chunks: readonly Uint8Array[], total: number): Uint8Array;",
19706
+ "doc": "/** Concatenate chunks into an output array with the supplied total byte length. */"
19707
+ },
19635
19708
  {
19636
19709
  "name": "concatSourceMaps",
19637
19710
  "kind": "function",
@@ -21112,6 +21185,13 @@
21112
21185
  "signature": "export declare function enableDraft(c: {\n readonly set: DraftCookieControls;\n}, secret: string, options?: EnableDraftOptions): Promise<void>;",
21113
21186
  "doc": "/**\n * Turn draft mode **on** for this client by setting a signed, HttpOnly `__nifra_draft` cookie. Call it\n * from a route you've already authorized. `secret` signs the cookie - pass the SAME secret to\n * `createWebApp({ draftSecret })` and `withISR({ draftSecret })` so the framework can verify it.\n */"
21114
21187
  },
21188
+ {
21189
+ "name": "enableNodeDirect",
21190
+ "kind": "const",
21191
+ "package": "@nifrajs/node",
21192
+ "signature": "export declare const enableNodeDirect: (app: object) => void;",
21193
+ "doc": "/** Install the app's node-direct hooks (a no-op for a plain `{ fetch }` handler or an already-served app). */"
21194
+ },
21115
21195
  {
21116
21196
  "name": "enableSwap",
21117
21197
  "kind": "function",
@@ -21221,6 +21301,20 @@
21221
21301
  "signature": "export declare function errorFromCoreLog(entry: CoreLogEntry): Error | undefined;",
21222
21302
  "doc": "/** The thrown error core's `unhandled request error` log line describes, rebuilt for a Diagnostic. */"
21223
21303
  },
21304
+ {
21305
+ "name": "errorReporterOf",
21306
+ "kind": "const",
21307
+ "package": "@nifrajs/node",
21308
+ "signature": "export declare const errorReporterOf: (app: object) => ((error: unknown) => void) | undefined;",
21309
+ "doc": "/** The app's own error log, when it has one. */"
21310
+ },
21311
+ {
21312
+ "name": "escapeRegExp",
21313
+ "kind": "function",
21314
+ "package": "@nifrajs/utils",
21315
+ "signature": "export declare function escapeRegExp(value: string): string;",
21316
+ "doc": "/** Escape every RegExp metacharacter so `value` matches literally inside a pattern. */"
21317
+ },
21224
21318
  {
21225
21319
  "name": "etag",
21226
21320
  "kind": "function",
@@ -21858,6 +21952,13 @@
21858
21952
  "signature": "export declare function holeComponents(client: ComponentClientAdapter | undefined): void;",
21859
21953
  "doc": "/**\n * How the client islands inside partially prerendered holes that show server\n * components mount, as the adapter's component client, such as `vueComponentClient({ islands })`;\n * `undefined` forgets it. Call it in the client entry before the router mounts. Without one such a\n * hole shows its error slot.\n */"
21860
21954
  },
21955
+ {
21956
+ "name": "hostPolicyOf",
21957
+ "kind": "const",
21958
+ "package": "@nifrajs/node",
21959
+ "signature": "export declare const hostPolicyOf: (options: HostPolicyOptions) => HostPolicy;",
21960
+ "doc": "/** Validate and normalize `allowedHosts` / `canonicalHost` / `normalizeTarget`; throws a `TypeError` on a malformed entry. */"
21961
+ },
21861
21962
  {
21862
21963
  "name": "hotUpdateNeedsReload",
21863
21964
  "kind": "const",
@@ -22343,6 +22444,13 @@
22343
22444
  "signature": "export declare function isProcessAlive(pid: number): boolean;",
22344
22445
  "doc": "/** Whether a process with `pid` exists (EPERM means it exists but is not ours). */"
22345
22446
  },
22447
+ {
22448
+ "name": "isRecord",
22449
+ "kind": "function",
22450
+ "package": "@nifrajs/utils",
22451
+ "signature": "export declare function isRecord(value: unknown): value is Record<string, unknown>;",
22452
+ "doc": "/** A non-null, non-array object; its prototype is not restricted. */"
22453
+ },
22346
22454
  {
22347
22455
  "name": "isRegistrableMethod",
22348
22456
  "kind": "function",
@@ -22565,6 +22673,13 @@
22565
22673
  "signature": "export declare function lastModifiedOf(version: FileVersion): number | undefined;",
22566
22674
  "doc": "/**\n * The time a file can be dated by in Last-Modified, or `undefined`: its mtime, only while that is\n * the time of its own last change. A copy or build that keeps or normalizes timestamps - `cp -p`,\n * `rsync -a`, tar, a container image layer, SOURCE_DATE_EPOCH, the Nix store's 1 s - gives a\n * same-size replacement the old file's date, so its files are left undated and their content tag\n * validates them alone.\n */"
22567
22675
  },
22676
+ {
22677
+ "name": "lifecycleOf",
22678
+ "kind": "const",
22679
+ "package": "@nifrajs/node",
22680
+ "signature": "export declare const lifecycleOf: (app: object) => (phase: \"stopping\" | \"stopped\") => Promise<void>;",
22681
+ "doc": "/** The app's `onStopping` / `onStop` hooks as one function; a no-op for a plain handler. */"
22682
+ },
22568
22683
  {
22569
22684
  "name": "lintPostgresStatement",
22570
22685
  "kind": "function",
@@ -23081,6 +23196,13 @@
23081
23196
  "signature": "export declare function nodeDirect(): IdentityPlugin;",
23082
23197
  "doc": "/** Enable `app.resolveNode()` for direct callers. Applying it twice is a no-op (named plugin dedupe). */"
23083
23198
  },
23199
+ {
23200
+ "name": "nodeOutcomeRuntime",
23201
+ "kind": "const",
23202
+ "package": "@nifrajs/node",
23203
+ "signature": "export declare const nodeOutcomeRuntime: object;",
23204
+ "doc": "/** Handed to `app.resolveNodeSource(source, platform, runtime)`; opaque to the transport. */"
23205
+ },
23084
23206
  {
23085
23207
  "name": "noopArtifactPort",
23086
23208
  "kind": "function",
@@ -24789,6 +24911,20 @@
24789
24911
  "signature": "export declare function resolvePublicPath(root: string, pathname: string): string | undefined;",
24790
24912
  "doc": "/**\n * Resolve a URL pathname to an absolute path **confined** to `root`, or `undefined` if it escapes.\n *\n * This is a user-path-to-filesystem sink, which makes it the one part of this feature with a security\n * consequence. Decode first (`%2e%2e%2f` is `../`), then normalize, then verify the result is still\n * under `root` by prefix - checking the *resolved* path rather than scanning the input for `..`,\n * because a blocklist over encodings is exactly the kind of check that gets bypassed.\n */"
24791
24913
  },
24914
+ {
24915
+ "name": "resolveRequestHost",
24916
+ "kind": "const",
24917
+ "package": "@nifrajs/node",
24918
+ "signature": "export declare const resolveRequestHost: (host: string | null | undefined, policy: HostPolicy) => string | undefined;",
24919
+ "doc": "/** The authority a request is answered as, or `undefined` to refuse it with 400. `null` means Host repeated. */"
24920
+ },
24921
+ {
24922
+ "name": "resolveRequestTarget",
24923
+ "kind": "const",
24924
+ "package": "@nifrajs/node",
24925
+ "signature": "export declare const resolveRequestTarget: (target: string, normalizeTarget: boolean) => string;",
24926
+ "doc": "/** The origin-form target the app routes on: absolute-form unwrapped, dot segments resolved when asked. */"
24927
+ },
24792
24928
  {
24793
24929
  "name": "resolveRouteFile",
24794
24930
  "kind": "function",
@@ -25449,6 +25585,12 @@
25449
25585
  "package": "@nifrajs/node",
25450
25586
  "signature": "export declare function serve(app: FetchHandler, options: ServeOptions): Promise<NodeServer>;"
25451
25587
  },
25588
+ {
25589
+ "name": "serve",
25590
+ "kind": "function",
25591
+ "package": "@nifrajs/node-uws",
25592
+ "signature": "export declare function serve(app: FetchHandler, options: ServeOptions): Promise<UwsServer>;"
25593
+ },
25452
25594
  {
25453
25595
  "name": "serveDatabaseAsMcp",
25454
25596
  "kind": "function",
@@ -25668,6 +25810,13 @@
25668
25810
  "signature": "export declare function sha256Hex(bytes: Uint8Array): Promise<string>;",
25669
25811
  "doc": "/** SHA-256 of `bytes` as lowercase hex. Collision-resistant so a digest cannot be forged from content. */"
25670
25812
  },
25813
+ {
25814
+ "name": "sha256Hex",
25815
+ "kind": "function",
25816
+ "package": "@nifrajs/utils",
25817
+ "signature": "export declare function sha256Hex(input: string | Uint8Array): Promise<string>;",
25818
+ "doc": "/** SHA-256 of UTF-8 text or a stable copy of bytes, as lowercase hex. Collision-resistant so a digest cannot be forged from content. */"
25819
+ },
25671
25820
  {
25672
25821
  "name": "sha256HexOf",
25673
25822
  "kind": "function",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nifrajs/cli",
3
- "version": "5.13.0",
3
+ "version": "5.14.0",
4
4
  "description": "The nifra CLI - zero-config dev/build/start for a nifra app (`nifra dev`, `nifra build`, `nifra start`).",
5
5
  "keywords": [
6
6
  "bun",
@@ -70,16 +70,17 @@
70
70
  "access": "public"
71
71
  },
72
72
  "dependencies": {
73
- "@nifrajs/client": "5.13.0",
74
- "@nifrajs/core": "5.13.0",
75
- "@nifrajs/agent-review": "5.13.0",
76
- "@nifrajs/i18n": "5.13.0",
77
- "@nifrajs/mcp": "5.13.0",
78
- "@nifrajs/mcp-db": "5.13.0",
79
- "@nifrajs/runner": "5.13.0",
80
- "@nifrajs/schema": "5.13.0",
81
- "@nifrajs/testing": "5.13.0",
82
- "@nifrajs/web": "5.13.0"
73
+ "@nifrajs/agent-review": "5.14.0",
74
+ "@nifrajs/client": "5.14.0",
75
+ "@nifrajs/core": "5.14.0",
76
+ "@nifrajs/i18n": "5.14.0",
77
+ "@nifrajs/mcp": "5.14.0",
78
+ "@nifrajs/mcp-db": "5.14.0",
79
+ "@nifrajs/runner": "5.14.0",
80
+ "@nifrajs/schema": "5.14.0",
81
+ "@nifrajs/testing": "5.14.0",
82
+ "@nifrajs/utils": "5.14.0",
83
+ "@nifrajs/web": "5.14.0"
83
84
  },
84
85
  "repository": {
85
86
  "type": "git",
@@ -220,7 +220,7 @@ async function buildHydrationApp(cwd: string): Promise<BuiltHydrationApp | { ski
220
220
  clientEntry: client.entry,
221
221
  ...frameworkWebAppOptions(loaded.framework, loaded.backend),
222
222
  ...(client.copyChunks === undefined ? {} : { copyChunks: client.copyChunks }),
223
- }) as unknown as AppLike
223
+ }) as AppLike
224
224
  return {
225
225
  app: webApp,
226
226
  client,
@@ -273,8 +273,8 @@ async function runDomHydration(
273
273
  unknown
274
274
  >
275
275
  const documentValue = windowValue.document as Record<string, unknown>
276
- const globals = globalThis as unknown as Record<string, unknown>
277
- const globalRecord = globalThis as unknown as Record<PropertyKey, unknown>
276
+ const globals = globalThis as Record<string, unknown>
277
+ const globalRecord = globalThis as Record<PropertyKey, unknown>
278
278
  const runtimeKey = Symbol.for("nifra.hydration.runtime")
279
279
  const previous = new Map<string, unknown>()
280
280
  const names = [
package/src/cli.ts CHANGED
@@ -368,7 +368,7 @@ set in the process environment is never overwritten by a file.
368
368
  ${renderCommandCatalogHelp()}`
369
369
 
370
370
  // Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
371
- const CLI_VERSION = "5.13.0"
371
+ const CLI_VERSION = "5.14.0"
372
372
 
373
373
  // A render adapter + nifra server are opaque to the CLI (it just forwards them); cast at the seam.
374
374
  const asAdapter = (v: unknown): RenderAdapter => v as RenderAdapter
@@ -1025,8 +1025,8 @@ async function buildForTarget(
1025
1025
  // whatever it's given straight to the chosen bundler, which casts to its own plugin type.
1026
1026
  const plugins = useVite
1027
1027
  ? {
1028
- clientPlugins: app.resolvedPlugins.vitePlugins as unknown as BunPlugin[],
1029
- serverPlugins: app.resolvedPlugins.vitePlugins as unknown as BunPlugin[],
1028
+ clientPlugins: app.resolvedPlugins.vitePlugins as BunPlugin[],
1029
+ serverPlugins: app.resolvedPlugins.vitePlugins as BunPlugin[],
1030
1030
  }
1031
1031
  : {
1032
1032
  clientPlugins: asBunPlugins(app.resolvedPlugins.clientPlugins),
@@ -1516,7 +1516,7 @@ async function main(): Promise<void> {
1516
1516
  markReflecting(command)
1517
1517
  const output = await catalogSpec.run(input, { cwd: process.cwd(), cliVersion: CLI_VERSION })
1518
1518
  markReflecting(undefined)
1519
- const asRecord = output as unknown as Record<string, unknown>
1519
+ const asRecord = output as Record<string, unknown>
1520
1520
  const wantsJson = asRecord.json === true || argv.includes("--json")
1521
1521
  if (wantsJson) {
1522
1522
  const value = catalogSpec.json?.(output, input) ?? output
@@ -1674,7 +1674,7 @@ function isMainModule(): boolean {
1674
1674
  * Only non-flag entries are considered and every match must resolve to this exact file, so an
1675
1675
  * unresolved or arbitrary flag can never turn an imported CLI module into a running CLI.
1676
1676
  */
1677
- const bunMain = (Bun as unknown as { main?: unknown }).main
1677
+ const bunMain = (Bun as { main?: unknown }).main
1678
1678
  const argvEntries = (argv: readonly string[]): string[] => {
1679
1679
  const entries: string[] = []
1680
1680
  for (const value of argv.slice(1)) {
@@ -1,4 +1 @@
1
- /** `value` with every RegExp metacharacter escaped, to match it literally inside a pattern. */
2
- export function escapeRegExp(value: string): string {
3
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
4
- }
1
+ export { escapeRegExp } from "@nifrajs/utils/escape-regexp"
@@ -1,4 +1,2 @@
1
1
  /** A non-null, non-array object. The prototype is not checked: a `Date` or a `Map` passes. */
2
- export function isRecord(value: unknown): value is Record<string, unknown> {
3
- return typeof value === "object" && value !== null && !Array.isArray(value)
4
- }
2
+ export { isRecord } from "@nifrajs/utils/record"
@@ -562,7 +562,7 @@ async function createTypeScript7Session(
562
562
  isParameter,
563
563
  isStringLiteralLike,
564
564
  }
565
- const compiler = Object.freeze(facade) as unknown as TypeScriptApi
565
+ const compiler = Object.freeze(facade) as TypeScriptApi
566
566
 
567
567
  const firstProject = projects.values().next().value as TypeScript7Project | undefined
568
568
  const semantic =
package/src/mcp-http.ts CHANGED
@@ -30,7 +30,7 @@ export { docsTools } from "./mcp-docs-tools.ts"
30
30
  export type { TypeEntry } from "./types-search.ts"
31
31
 
32
32
  // Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
33
- const VERSION = "5.13.0"
33
+ const VERSION = "5.14.0"
34
34
  const SERVER_INFO = { name: "nifra-docs", version: VERSION }
35
35
  // Derive the GET/health tool list from the tools actually served, so the line can never drift from them.
36
36
  const docsHealth = (tools: McpTool[]): string =>
package/src/mcp-io.ts CHANGED
@@ -233,7 +233,11 @@ function decodeLine(chunks: readonly Uint8Array[], totalBytes: number): string {
233
233
  return new TextDecoder().decode(bytes)
234
234
  }
235
235
 
236
- /** Read newline-delimited input without retaining a line larger than the configured byte budget. */
236
+ /**
237
+ * Read newline-delimited input without retaining a line larger than the configured byte budget. A
238
+ * line over the budget is reported as `too-large` the moment it crosses it, not when it ends, so a
239
+ * peer that never sends a newline is noticed; the rest of that line is skipped.
240
+ */
237
241
  export async function* readBoundedLines(
238
242
  stream: ReadableStream<Uint8Array>,
239
243
  maxBytes = CHILD_INPUT_MAX_BYTES,
@@ -255,22 +259,21 @@ export async function* readBoundedLines(
255
259
  tooLarge = true
256
260
  chunks.length = 0
257
261
  totalBytes = 0
262
+ yield { kind: "too-large" }
258
263
  } else if (segment.byteLength > 0) {
259
264
  chunks.push(segment)
260
265
  totalBytes += segment.byteLength
261
266
  }
262
267
  }
263
268
  if (newline === -1) break
264
- if (tooLarge) yield { kind: "too-large" }
265
- else yield { kind: "line", text: decodeLine(chunks, totalBytes) }
269
+ if (!tooLarge) yield { kind: "line", text: decodeLine(chunks, totalBytes) }
266
270
  chunks.length = 0
267
271
  totalBytes = 0
268
272
  tooLarge = false
269
273
  start = newline + 1
270
274
  }
271
275
  }
272
- if (tooLarge) yield { kind: "too-large" }
273
- else if (totalBytes > 0) yield { kind: "line", text: decodeLine(chunks, totalBytes) }
276
+ if (!tooLarge && totalBytes > 0) yield { kind: "line", text: decodeLine(chunks, totalBytes) }
274
277
  }
275
278
 
276
279
  /** Serialize a JSON value only when its UTF-8 representation fits within the byte budget. */
package/src/mcp-relay.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import type { StdioMessage } from "@nifrajs/mcp/stdio"
10
+ import { readBoundedLines } from "./mcp-io.ts"
10
11
  import {
11
12
  isJsonRpcRequest,
12
13
  isJsonRpcResponse,
@@ -20,6 +21,8 @@ type JsonRpcId = JsonRpcResponse["id"]
20
21
  const HANDSHAKE_ID = "nifra-relay-handshake"
21
22
  const HANDSHAKE_MS = 30_000
22
23
  const CLOSE_MS = 5_000
24
+ /** The largest line the child may send. A tool result is one line, so this bounds a result, not a session. */
25
+ export const RELAY_FRAME_MAX_BYTES = 16 * 1024 * 1024
23
26
 
24
27
  const spawnChild = (
25
28
  command: readonly string[],
@@ -54,6 +57,8 @@ export async function startRelay(options: {
54
57
  readonly send: (message: StdioMessage) => void
55
58
  /** Written to stderr once the child answers. */
56
59
  readonly announce: string
60
+ /** Largest line read from the child before it is ended. Default {@link RELAY_FRAME_MAX_BYTES}. */
61
+ readonly maxFrameBytes?: number
57
62
  }): Promise<McpRelay | undefined> {
58
63
  let child: ReturnType<typeof spawnChild>
59
64
  try {
@@ -90,15 +95,22 @@ export async function startRelay(options: {
90
95
  } else if (isJsonRpcRequest(parsed)) options.send(parsed)
91
96
  }
92
97
  const pumped = (async () => {
93
- const decoder = new TextDecoder()
94
- let buffered = ""
95
- for await (const chunk of child.stdout) {
96
- buffered += decoder.decode(chunk, { stream: true })
97
- for (let at = buffered.indexOf("\n"); at !== -1; at = buffered.indexOf("\n")) {
98
- const line = buffered.slice(0, at).trim()
99
- buffered = buffered.slice(at + 1)
98
+ for await (const item of readBoundedLines(
99
+ child.stdout,
100
+ options.maxFrameBytes ?? RELAY_FRAME_MAX_BYTES,
101
+ )) {
102
+ if (item.kind === "line") {
103
+ const line = item.text.trim()
100
104
  if (line !== "") route(line)
105
+ continue
101
106
  }
107
+ // The frame was dropped, so a response may be missing and the stream can no longer be trusted:
108
+ // end the child, and the requests waiting on it settle with an error.
109
+ process.stderr.write(
110
+ "nifra mcp: the project's nifra CLI sent an oversized message; ending it\n",
111
+ )
112
+ child.kill("SIGKILL")
113
+ return
102
114
  }
103
115
  })().catch(() => {})
104
116
  void child.exited.then(async () => {