@nifrajs/cli 5.12.1 → 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 (379) hide show
  1. package/CHANGELOG.md +72 -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.d.ts +9 -2
  22. package/dist/cli.d.ts.map +1 -1
  23. package/dist/cli.js +139 -351
  24. package/dist/cli.js.map +1 -1
  25. package/dist/client-module.js +0 -13
  26. package/dist/client-module.js.map +1 -1
  27. package/dist/command-catalog.d.ts +29 -1
  28. package/dist/command-catalog.d.ts.map +1 -1
  29. package/dist/command-catalog.js +100 -23
  30. package/dist/command-catalog.js.map +1 -1
  31. package/dist/component-check.js +1 -7
  32. package/dist/component-check.js.map +1 -1
  33. package/dist/config-target.js +0 -13
  34. package/dist/config-target.js.map +1 -1
  35. package/dist/contract-proof.js +0 -1
  36. package/dist/contract-proof.js.map +1 -1
  37. package/dist/contracts.js +0 -36
  38. package/dist/contracts.js.map +1 -1
  39. package/dist/db-audit.js +0 -15
  40. package/dist/db-audit.js.map +1 -1
  41. package/dist/db-child.js +0 -20
  42. package/dist/db-child.js.map +1 -1
  43. package/dist/db-config.js +0 -23
  44. package/dist/db-config.js.map +1 -1
  45. package/dist/db-tool.js +0 -24
  46. package/dist/db-tool.js.map +1 -1
  47. package/dist/deployment-adapters.d.ts +12 -0
  48. package/dist/deployment-adapters.d.ts.map +1 -0
  49. package/dist/deployment-adapters.js +86 -0
  50. package/dist/deployment-adapters.js.map +1 -0
  51. package/dist/dev-bun-config.d.ts +4 -3
  52. package/dist/dev-bun-config.d.ts.map +1 -1
  53. package/dist/dev-bun-config.js +9 -101
  54. package/dist/dev-bun-config.js.map +1 -1
  55. package/dist/dev-feed-tool.js +0 -32
  56. package/dist/dev-feed-tool.js.map +1 -1
  57. package/dist/dev-server-client.js +0 -16
  58. package/dist/dev-server-client.js.map +1 -1
  59. package/dist/diagnostics.js +0 -10
  60. package/dist/diagnostics.js.map +1 -1
  61. package/dist/diff-tool.js +0 -23
  62. package/dist/diff-tool.js.map +1 -1
  63. package/dist/docs-search.js +0 -35
  64. package/dist/docs-search.js.map +1 -1
  65. package/dist/doctor.js +3 -161
  66. package/dist/doctor.js.map +1 -1
  67. package/dist/env-file.js +0 -66
  68. package/dist/env-file.js.map +1 -1
  69. package/dist/examples.js +0 -16
  70. package/dist/examples.js.map +1 -1
  71. package/dist/fix-recipes.js +0 -20
  72. package/dist/fix-recipes.js.map +1 -1
  73. package/dist/frontend-guidance.js +0 -36
  74. package/dist/frontend-guidance.js.map +1 -1
  75. package/dist/hand-built-manifest.js +0 -17
  76. package/dist/hand-built-manifest.js.map +1 -1
  77. package/dist/hooks-report.js +0 -4
  78. package/dist/hooks-report.js.map +1 -1
  79. package/dist/i18n-check.js +0 -30
  80. package/dist/i18n-check.js.map +1 -1
  81. package/dist/init-agents.d.ts +5 -0
  82. package/dist/init-agents.d.ts.map +1 -1
  83. package/dist/init-agents.js +2 -134
  84. package/dist/init-agents.js.map +1 -1
  85. package/dist/internal/code-unit-order.js +0 -2
  86. package/dist/internal/code-unit-order.js.map +1 -1
  87. package/dist/internal/config-paths.js +0 -12
  88. package/dist/internal/config-paths.js.map +1 -1
  89. package/dist/internal/control-character.js +0 -1
  90. package/dist/internal/control-character.js.map +1 -1
  91. package/dist/internal/escape-regexp.d.ts +1 -2
  92. package/dist/internal/escape-regexp.d.ts.map +1 -1
  93. package/dist/internal/escape-regexp.js +1 -4
  94. package/dist/internal/escape-regexp.js.map +1 -1
  95. package/dist/internal/git-ignored.js +0 -11
  96. package/dist/internal/git-ignored.js.map +1 -1
  97. package/dist/internal/installed-package.js +0 -2
  98. package/dist/internal/installed-package.js.map +1 -1
  99. package/dist/internal/line-at.js +0 -1
  100. package/dist/internal/line-at.js.map +1 -1
  101. package/dist/internal/nifra-project.js +0 -31
  102. package/dist/internal/nifra-project.js.map +1 -1
  103. package/dist/internal/posix-path.js +0 -1
  104. package/dist/internal/posix-path.js.map +1 -1
  105. package/dist/internal/project-specifiers.js +0 -34
  106. package/dist/internal/project-specifiers.js.map +1 -1
  107. package/dist/internal/realpath-or-self.js +0 -1
  108. package/dist/internal/realpath-or-self.js.map +1 -1
  109. package/dist/internal/record.d.ts +1 -1
  110. package/dist/internal/record.d.ts.map +1 -1
  111. package/dist/internal/record.js +1 -4
  112. package/dist/internal/record.js.map +1 -1
  113. package/dist/internal/reserved-segment-codemod.js +0 -44
  114. package/dist/internal/reserved-segment-codemod.js.map +1 -1
  115. package/dist/internal/script-kind.js +0 -5
  116. package/dist/internal/script-kind.js.map +1 -1
  117. package/dist/internal/source-facts.js +3 -37
  118. package/dist/internal/source-facts.js.map +1 -1
  119. package/dist/internal/typescript-import.js +0 -49
  120. package/dist/internal/typescript-import.js.map +1 -1
  121. package/dist/internal/workspace-packages.js +0 -24
  122. package/dist/internal/workspace-packages.js.map +1 -1
  123. package/dist/introspect.js +1 -89
  124. package/dist/introspect.js.map +1 -1
  125. package/dist/learn.js +0 -16
  126. package/dist/learn.js.map +1 -1
  127. package/dist/levels-tool.js +0 -34
  128. package/dist/levels-tool.js.map +1 -1
  129. package/dist/load.d.ts +12 -3
  130. package/dist/load.d.ts.map +1 -1
  131. package/dist/load.js +19 -75
  132. package/dist/load.js.map +1 -1
  133. package/dist/local-cli.js +0 -23
  134. package/dist/local-cli.js.map +1 -1
  135. package/dist/lock-links.js +0 -20
  136. package/dist/lock-links.js.map +1 -1
  137. package/dist/manifest-tool.js +0 -5
  138. package/dist/manifest-tool.js.map +1 -1
  139. package/dist/mcp-app-tool.js +0 -9
  140. package/dist/mcp-app-tool.js.map +1 -1
  141. package/dist/mcp-context.js +0 -30
  142. package/dist/mcp-context.js.map +1 -1
  143. package/dist/mcp-delegate.js +0 -45
  144. package/dist/mcp-delegate.js.map +1 -1
  145. package/dist/mcp-docs-tools.js +0 -13
  146. package/dist/mcp-docs-tools.js.map +1 -1
  147. package/dist/mcp-exec.js +0 -71
  148. package/dist/mcp-exec.js.map +1 -1
  149. package/dist/mcp-http.js +1 -38
  150. package/dist/mcp-http.js.map +1 -1
  151. package/dist/mcp-io.d.ts +5 -1
  152. package/dist/mcp-io.d.ts.map +1 -1
  153. package/dist/mcp-io.js +3 -68
  154. package/dist/mcp-io.js.map +1 -1
  155. package/dist/mcp-isolate.js +0 -28
  156. package/dist/mcp-isolate.js.map +1 -1
  157. package/dist/mcp-path.js +0 -8
  158. package/dist/mcp-path.js.map +1 -1
  159. package/dist/mcp-project-child.js +0 -19
  160. package/dist/mcp-project-child.js.map +1 -1
  161. package/dist/mcp-protocol.js +0 -5
  162. package/dist/mcp-protocol.js.map +1 -1
  163. package/dist/mcp-reflect.js +0 -11
  164. package/dist/mcp-reflect.js.map +1 -1
  165. package/dist/mcp-relay.d.ts +4 -0
  166. package/dist/mcp-relay.d.ts.map +1 -1
  167. package/dist/mcp-relay.js +9 -20
  168. package/dist/mcp-relay.js.map +1 -1
  169. package/dist/mcp-render.js +1 -42
  170. package/dist/mcp-render.js.map +1 -1
  171. package/dist/mcp-root.d.ts.map +1 -1
  172. package/dist/mcp-root.js +18 -90
  173. package/dist/mcp-root.js.map +1 -1
  174. package/dist/mcp-run.js +1 -38
  175. package/dist/mcp-run.js.map +1 -1
  176. package/dist/mcp-tool-meta.js +3 -8
  177. package/dist/mcp-tool-meta.js.map +1 -1
  178. package/dist/mcp-ws.js +0 -16
  179. package/dist/mcp-ws.js.map +1 -1
  180. package/dist/mcp.js +0 -86
  181. package/dist/mcp.js.map +1 -1
  182. package/dist/migrate-layout.js +0 -313
  183. package/dist/migrate-layout.js.map +1 -1
  184. package/dist/openapi-tool.js +0 -18
  185. package/dist/openapi-tool.js.map +1 -1
  186. package/dist/openapi-types.js +0 -22
  187. package/dist/openapi-types.js.map +1 -1
  188. package/dist/output-schemas.js +0 -67
  189. package/dist/output-schemas.js.map +1 -1
  190. package/dist/pipeline-guard.js +0 -58
  191. package/dist/pipeline-guard.js.map +1 -1
  192. package/dist/pipeline-report.js +0 -71
  193. package/dist/pipeline-report.js.map +1 -1
  194. package/dist/port.d.ts +6 -3
  195. package/dist/port.d.ts.map +1 -1
  196. package/dist/port.js +16 -92
  197. package/dist/port.js.map +1 -1
  198. package/dist/ppr-read-fix.js +0 -29
  199. package/dist/ppr-read-fix.js.map +1 -1
  200. package/dist/project-facts.js +0 -5
  201. package/dist/project-facts.js.map +1 -1
  202. package/dist/project-path.js +0 -7
  203. package/dist/project-path.js.map +1 -1
  204. package/dist/project-site.js +0 -2
  205. package/dist/project-site.js.map +1 -1
  206. package/dist/recipes/1.8.0.js +0 -9
  207. package/dist/recipes/1.8.0.js.map +1 -1
  208. package/dist/recipes/2.0.0.js +0 -6
  209. package/dist/recipes/2.0.0.js.map +1 -1
  210. package/dist/recipes/3.0.0.js +0 -7
  211. package/dist/recipes/3.0.0.js.map +1 -1
  212. package/dist/recipes/4.0.0.js +0 -6
  213. package/dist/recipes/4.0.0.js.map +1 -1
  214. package/dist/recipes/5.0.0.js +0 -8
  215. package/dist/recipes/5.0.0.js.map +1 -1
  216. package/dist/recipes/5.1.0.js +0 -6
  217. package/dist/recipes/5.1.0.js.map +1 -1
  218. package/dist/recipes/5.10.0.js +0 -10
  219. package/dist/recipes/5.10.0.js.map +1 -1
  220. package/dist/recipes/5.11.0.js +0 -7
  221. package/dist/recipes/5.11.0.js.map +1 -1
  222. package/dist/recipes/5.12.0.js +0 -6
  223. package/dist/recipes/5.12.0.js.map +1 -1
  224. package/dist/recipes/5.13.0.d.ts +9 -0
  225. package/dist/recipes/5.13.0.d.ts.map +1 -0
  226. package/dist/recipes/5.13.0.js +34 -0
  227. package/dist/recipes/5.13.0.js.map +1 -0
  228. package/dist/recipes/5.14.0.d.ts +10 -0
  229. package/dist/recipes/5.14.0.d.ts.map +1 -0
  230. package/dist/recipes/5.14.0.js +26 -0
  231. package/dist/recipes/5.14.0.js.map +1 -0
  232. package/dist/recipes/5.2.0.js +0 -7
  233. package/dist/recipes/5.2.0.js.map +1 -1
  234. package/dist/recipes/5.3.0.js +0 -8
  235. package/dist/recipes/5.3.0.js.map +1 -1
  236. package/dist/recipes/5.4.0.js +0 -8
  237. package/dist/recipes/5.4.0.js.map +1 -1
  238. package/dist/recipes/5.5.0.js +0 -6
  239. package/dist/recipes/5.5.0.js.map +1 -1
  240. package/dist/recipes/5.6.0.js +0 -7
  241. package/dist/recipes/5.6.0.js.map +1 -1
  242. package/dist/recipes/5.7.0.js +0 -9
  243. package/dist/recipes/5.7.0.js.map +1 -1
  244. package/dist/recipes/5.8.0.js +0 -6
  245. package/dist/recipes/5.8.0.js.map +1 -1
  246. package/dist/recipes/5.9.0.js +0 -9
  247. package/dist/recipes/5.9.0.js.map +1 -1
  248. package/dist/recipes/index.d.ts.map +1 -1
  249. package/dist/recipes/index.js +4 -9
  250. package/dist/recipes/index.js.map +1 -1
  251. package/dist/release-verification.js +0 -14
  252. package/dist/release-verification.js.map +1 -1
  253. package/dist/replay.js +0 -3
  254. package/dist/replay.js.map +1 -1
  255. package/dist/review.js +0 -21
  256. package/dist/review.js.map +1 -1
  257. package/dist/route-types.js +0 -17
  258. package/dist/route-types.js.map +1 -1
  259. package/dist/rule-explain.js +0 -5
  260. package/dist/rule-explain.js.map +1 -1
  261. package/dist/rules/codes.js +0 -2
  262. package/dist/rules/codes.js.map +1 -1
  263. package/dist/rules/comment-markers.js +0 -25
  264. package/dist/rules/comment-markers.js.map +1 -1
  265. package/dist/rules/contract-visibility.js +0 -27
  266. package/dist/rules/contract-visibility.js.map +1 -1
  267. package/dist/rules/data-guard.js +1 -52
  268. package/dist/rules/data-guard.js.map +1 -1
  269. package/dist/rules/internal-links.js +0 -36
  270. package/dist/rules/internal-links.js.map +1 -1
  271. package/dist/rules/islands.js +2 -65
  272. package/dist/rules/islands.js.map +1 -1
  273. package/dist/rules/layout.js +0 -1
  274. package/dist/rules/layout.js.map +1 -1
  275. package/dist/rules/legacy.js +0 -31
  276. package/dist/rules/legacy.js.map +1 -1
  277. package/dist/rules/merge-auth.js +0 -9
  278. package/dist/rules/merge-auth.js.map +1 -1
  279. package/dist/rules/pages.js +0 -95
  280. package/dist/rules/pages.js.map +1 -1
  281. package/dist/rules/ppr.js +0 -8
  282. package/dist/rules/ppr.js.map +1 -1
  283. package/dist/rules/route-statement.js +0 -13
  284. package/dist/rules/route-statement.js.map +1 -1
  285. package/dist/rules/routes.js +1 -67
  286. package/dist/rules/routes.js.map +1 -1
  287. package/dist/rules/secrets.js +0 -15
  288. package/dist/rules/secrets.js.map +1 -1
  289. package/dist/rules/security.js +0 -113
  290. package/dist/rules/security.js.map +1 -1
  291. package/dist/rules/server-fn-namespace.js +0 -5
  292. package/dist/rules/server-fn-namespace.js.map +1 -1
  293. package/dist/rules/source-scan.js +0 -5
  294. package/dist/rules/source-scan.js.map +1 -1
  295. package/dist/rules/swap.js +0 -21
  296. package/dist/rules/swap.js.map +1 -1
  297. package/dist/rules/text-slot-boolean.js +0 -5
  298. package/dist/rules/text-slot-boolean.js.map +1 -1
  299. package/dist/rules/typescript.js +0 -5
  300. package/dist/rules/typescript.js.map +1 -1
  301. package/dist/rules/undeclared-response.js +0 -8
  302. package/dist/rules/undeclared-response.js.map +1 -1
  303. package/dist/rules/zones.js +0 -45
  304. package/dist/rules/zones.js.map +1 -1
  305. package/dist/runtime-differences.js +0 -20
  306. package/dist/runtime-differences.js.map +1 -1
  307. package/dist/scaffold-hole.js +1 -45
  308. package/dist/scaffold-hole.js.map +1 -1
  309. package/dist/scaffold.js +3 -60
  310. package/dist/scaffold.js.map +1 -1
  311. package/dist/sdk.js +1 -13
  312. package/dist/sdk.js.map +1 -1
  313. package/dist/search-terms.js +0 -12
  314. package/dist/search-terms.js.map +1 -1
  315. package/dist/shell-files.d.ts +44 -0
  316. package/dist/shell-files.d.ts.map +1 -0
  317. package/dist/shell-files.js +186 -0
  318. package/dist/shell-files.js.map +1 -0
  319. package/dist/shell-init.d.ts +33 -0
  320. package/dist/shell-init.d.ts.map +1 -0
  321. package/dist/shell-init.js +84 -0
  322. package/dist/shell-init.js.map +1 -0
  323. package/dist/smoke.js +0 -4
  324. package/dist/smoke.js.map +1 -1
  325. package/dist/source-rewrites.js +0 -43
  326. package/dist/source-rewrites.js.map +1 -1
  327. package/dist/stylex-migrate.js +0 -29
  328. package/dist/stylex-migrate.js.map +1 -1
  329. package/dist/symptom-search.js +0 -3
  330. package/dist/symptom-search.js.map +1 -1
  331. package/dist/sync-manifest.js +3 -33
  332. package/dist/sync-manifest.js.map +1 -1
  333. package/dist/test-tool.js +0 -10
  334. package/dist/test-tool.js.map +1 -1
  335. package/dist/typecheck-coverage.js +0 -36
  336. package/dist/typecheck-coverage.js.map +1 -1
  337. package/dist/types-search.js +0 -35
  338. package/dist/types-search.js.map +1 -1
  339. package/dist/upgrade.js +0 -214
  340. package/dist/upgrade.js.map +1 -1
  341. package/dist/verification-plan.js +0 -19
  342. package/dist/verification-plan.js.map +1 -1
  343. package/dist/verification.js +0 -23
  344. package/dist/verification.js.map +1 -1
  345. package/dist/version-drift.js +0 -8
  346. package/dist/version-drift.js.map +1 -1
  347. package/dist/web-app-options.js +0 -16
  348. package/dist/web-app-options.js.map +1 -1
  349. package/dist/work-graph.js +0 -21
  350. package/dist/work-graph.js.map +1 -1
  351. package/dist/workspace-link.js +0 -31
  352. package/dist/workspace-link.js.map +1 -1
  353. package/docs/examples.json +97 -1
  354. package/docs/llms-full.txt +1347 -59
  355. package/docs/types.json +756 -37
  356. package/package.json +12 -11
  357. package/src/assure-hydration.ts +3 -3
  358. package/src/cli.ts +189 -39
  359. package/src/command-catalog.ts +144 -7
  360. package/src/deployment-adapters.ts +107 -0
  361. package/src/dev-bun-config.ts +21 -2
  362. package/src/init-agents.ts +1 -1
  363. package/src/internal/escape-regexp.ts +1 -4
  364. package/src/internal/record.ts +1 -3
  365. package/src/internal/typescript-import.ts +1 -1
  366. package/src/load.ts +36 -3
  367. package/src/mcp-http.ts +1 -1
  368. package/src/mcp-io.ts +8 -5
  369. package/src/mcp-relay.ts +19 -7
  370. package/src/mcp-render.ts +1 -1
  371. package/src/mcp-root.ts +21 -3
  372. package/src/mcp-tool-meta.ts +3 -3
  373. package/src/port.ts +25 -8
  374. package/src/recipes/5.13.0.ts +41 -0
  375. package/src/recipes/5.14.0.ts +34 -0
  376. package/src/recipes/index.ts +4 -0
  377. package/src/rules/routes.ts +2 -2
  378. package/src/shell-files.ts +225 -0
  379. package/src/shell-init.ts +139 -0
@@ -0,0 +1,107 @@
1
+ import { existsSync, readFileSync } from "node:fs"
2
+ import { dirname, resolve } from "node:path"
3
+
4
+ const BASE_TARGETS = new Set(["bun", "node", "deno", "cloudflare", "vercel", "static"])
5
+ const PACKAGE_NAME = /^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/i
6
+
7
+ const DEPENDENCY_FIELDS = [
8
+ "dependencies",
9
+ "devDependencies",
10
+ "optionalDependencies",
11
+ "peerDependencies",
12
+ ]
13
+
14
+ const isBaseTarget = (value: unknown): value is DeploymentAdapterMetadata["baseTarget"] =>
15
+ typeof value === "string" && BASE_TARGETS.has(value)
16
+
17
+ export interface DeploymentAdapterMetadata {
18
+ readonly apiVersion: 1
19
+ readonly id: string
20
+ readonly baseTarget: "bun" | "node" | "deno" | "cloudflare" | "vercel" | "static"
21
+ readonly packageName: string
22
+ }
23
+
24
+ /** Parse package JSON as a record and treat unreadable or malformed manifests as absent. */
25
+ function readRecord(path: string): Record<string, unknown> | undefined {
26
+ try {
27
+ const value: unknown = JSON.parse(readFileSync(path, "utf8"))
28
+ return typeof value === "object" && value !== null && !Array.isArray(value)
29
+ ? // biome-ignore lint/plugin/requireSafetyCommentForTypeAssertion: JSON.parse is assigned to unknown and the object/null/array checks above establish the record shape.
30
+ (value as Record<string, unknown>)
31
+ : undefined
32
+ } catch {
33
+ return undefined
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Read only package metadata, never importing app config or adapter code. `nifra port` uses this to
39
+ * map a custom target id to the built-in runtime its adapter wraps.
40
+ */
41
+ export function readDeploymentAdapterMetadata(
42
+ appRoot: string,
43
+ id: string,
44
+ ): DeploymentAdapterMetadata | undefined {
45
+ const packageRoots: string[] = []
46
+ let directory = resolve(appRoot)
47
+ for (;;) {
48
+ packageRoots.push(directory)
49
+ const parent = dirname(directory)
50
+ if (parent === directory) break
51
+ directory = parent
52
+ }
53
+ // A workspace root can declare the adapter for an app package that does not repeat it.
54
+ const dependencyNames = new Set<string>()
55
+ for (const packageRoot of packageRoots) {
56
+ const manifest = readRecord(resolve(packageRoot, "package.json"))
57
+ if (manifest === undefined) continue
58
+ for (const field of DEPENDENCY_FIELDS) {
59
+ const dependencies = manifest[field]
60
+ if (typeof dependencies !== "object" || dependencies === null || Array.isArray(dependencies))
61
+ continue
62
+ for (const name of Object.keys(dependencies))
63
+ if (PACKAGE_NAME.test(name)) dependencyNames.add(name)
64
+ }
65
+ }
66
+ const matches: DeploymentAdapterMetadata[] = []
67
+ for (const packageName of dependencyNames) {
68
+ for (const packageRoot of packageRoots) {
69
+ const manifestPath = resolve(packageRoot, "node_modules", packageName, "package.json")
70
+ if (!existsSync(manifestPath)) continue
71
+ const manifest = readRecord(manifestPath)
72
+ const nifra = manifest?.nifra
73
+ const declaration =
74
+ typeof nifra === "object" && nifra !== null && !Array.isArray(nifra)
75
+ ? Reflect.get(nifra, "deploymentAdapter")
76
+ : undefined
77
+ if (typeof declaration !== "object" || declaration === null || Array.isArray(declaration))
78
+ break
79
+ const apiVersion: unknown = Reflect.get(declaration, "apiVersion")
80
+ const adapterId: unknown = Reflect.get(declaration, "id")
81
+ const baseTarget: unknown = Reflect.get(declaration, "baseTarget")
82
+ if (
83
+ apiVersion === 1 &&
84
+ adapterId === id &&
85
+ typeof adapterId === "string" &&
86
+ /^[a-z][a-z0-9-]{1,62}$/.test(adapterId) &&
87
+ isBaseTarget(baseTarget)
88
+ ) {
89
+ matches.push({
90
+ apiVersion,
91
+ id: adapterId,
92
+ baseTarget,
93
+ packageName,
94
+ })
95
+ }
96
+ break
97
+ }
98
+ }
99
+ if (matches.length > 1) {
100
+ const targets = new Set(matches.map((match) => match.baseTarget))
101
+ if (targets.size > 1)
102
+ throw new Error(
103
+ `[nifra] multiple installed adapters declare target "${id}" with different base targets`,
104
+ )
105
+ }
106
+ return matches[0]
107
+ }
@@ -154,6 +154,7 @@ export function renderDevBunfig(
154
154
  user: BunfigData,
155
155
  appRoot: string,
156
156
  define: Readonly<Record<string, string>> = {},
157
+ clientDefine: Readonly<Record<string, string>> = {},
157
158
  ): string {
158
159
  const data: BunfigData = structuredClone(user)
159
160
  if (data.preload !== undefined) {
@@ -165,6 +166,22 @@ export function renderDevBunfig(
165
166
  const serveStatic = isTable(serve.static) ? serve.static : {}
166
167
  serve.static = serveStatic
167
168
  serveStatic.plugins = [boundaryPluginPath]
169
+ if (Object.keys(clientDefine).length > 0) {
170
+ // Client only, as `nifra build` bakes the public environment into the client bundle alone. The
171
+ // app's own bunfig defines beat it, the top-level one too (SSR reads it, so the client must agree),
172
+ // and the config's `define` below beats both.
173
+ const own = isTable(data.define) ? data.define : {}
174
+ const fromEnv = Object.fromEntries(
175
+ Object.entries(clientDefine).filter(([key]) => !(key in own)),
176
+ )
177
+ const shared = Object.fromEntries(Object.entries(own).filter(([key]) => key in clientDefine))
178
+ serveStatic.define = Object.assign(
179
+ {},
180
+ fromEnv,
181
+ shared,
182
+ isTable(serveStatic.define) ? serveStatic.define : {},
183
+ )
184
+ }
168
185
  if (Object.keys(define).length > 0) {
169
186
  for (const [key, value] of Object.entries(define)) {
170
187
  if (typeof value !== "string") {
@@ -310,12 +327,14 @@ const TOKEN_FILE = "launch-token"
310
327
  /** Write the generated config for an app; returns the bunfig path to re-exec with and the fresh
311
328
  * launch token to pass in the child's environment. `configPath` (the app's `nifra.config.ts` /
312
329
  * `backend/framework.ts`) is what lets the app's own `clientPlugins` reach Bun's dev-server
313
- * bundler; `define` and `publicEnvPrefix` are the loaded config's own. */
330
+ * bundler; `define` and `publicEnvPrefix` are the loaded config's own. `clientDefine` is what only the
331
+ * client bundle gets: the public environment, which `nifra build` inlines and Bun's dev bundler does not. */
314
332
  export async function writeBunDevConfig(
315
333
  appRoot: string,
316
334
  configPath?: string,
317
335
  define?: Readonly<Record<string, string>>,
318
336
  publicEnvPrefix?: string,
337
+ clientDefine?: Readonly<Record<string, string>>,
319
338
  ): Promise<BunDevConfig> {
320
339
  const dir = resolve(appRoot, ".nifra", "dev-bun")
321
340
  mkdirSync(dir, { recursive: true })
@@ -335,7 +354,7 @@ export async function writeBunDevConfig(
335
354
  ),
336
355
  )
337
356
  const bunfigPath = resolve(dir, "bunfig.toml")
338
- writeFileSync(bunfigPath, renderDevBunfig(pluginPath, user, appRoot, define))
357
+ writeFileSync(bunfigPath, renderDevBunfig(pluginPath, user, appRoot, define, clientDefine))
339
358
  const launchToken = crypto.randomUUID()
340
359
  writeFileSync(resolve(dir, TOKEN_FILE), launchToken)
341
360
  return { bunfigPath, launchToken }
@@ -141,7 +141,7 @@ async function nonRegularTarget(
141
141
  * Write a whole-file generator's output to `path` unless it already exists and `force` is false.
142
142
  * Returns the per-file result for the report.
143
143
  */
144
- async function writeOwned(
144
+ export async function writeOwned(
145
145
  cwd: string,
146
146
  rel: string,
147
147
  content: string,
@@ -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/load.ts CHANGED
@@ -16,7 +16,11 @@
16
16
  import { existsSync } from "node:fs"
17
17
  import { isAbsolute, resolve } from "node:path"
18
18
  import type { CreateWebAppOptions, CssLoadingMode } from "@nifrajs/web"
19
- import type { SecretExemption, ServerEntrySelfHost } from "@nifrajs/web/build"
19
+ import type {
20
+ DeploymentTargetAdapter,
21
+ SecretExemption,
22
+ ServerEntrySelfHost,
23
+ } from "@nifrajs/web/build"
20
24
  import { assertCurrentLayout, BACKEND_APP_FILE, CONFIG_FILE, FRAMEWORK_FILE } from "./app-files.ts"
21
25
  import { checkPipelineSeparation } from "./pipeline-guard.ts"
22
26
 
@@ -68,9 +72,14 @@ export interface NifraFramework {
68
72
  readonly conditions?: readonly string[]
69
73
  /** Compile-time `define` replacements, e.g. Vue's `__VUE_*` flags. */
70
74
  readonly define?: Readonly<Record<string, string>>
71
- /** The deploy target `nifra build` emits without `--target` (default `"bun"`); `nifra target <t>`
72
- * rewrites it. */
75
+ /** The built-in target or configured adapter id `nifra build` emits without `--target` (default `"bun"`);
76
+ * `nifra target <t>` rewrites it. */
73
77
  readonly target?: string
78
+ /** Optional public build-time host adapter. Its code runs in this CLI process during builds. */
79
+ readonly deploymentAdapter?: {
80
+ readonly adapter: DeploymentTargetAdapter
81
+ readonly options?: unknown
82
+ }
74
83
  /** Ordinary Vercel SSR: Edge by default, or opt into a Node.js 22 serverless handler. */
75
84
  readonly vercelRuntime?: "edge" | "node"
76
85
  /** `"platform"` makes a `cloudflare` / `vercel` build read `c.clientIp` from the header that
@@ -98,6 +107,10 @@ export interface NifraFramework {
98
107
  /** Reviewed false positives of `nifra build`'s secret scan. A `file` scope applies throughout that
99
108
  * file; for `private-env-value`, an `env` scope applies to every finding from that variable. */
100
109
  readonly secretExemptions?: readonly SecretExemption[]
110
+ /** A module, relative to the app, whose default export is the `fetch` the client reaches its server
111
+ * through, such as `serverFetch({ origin })` from `@nifrajs/web/client`. For a build that ships
112
+ * inside a native shell while the server lives elsewhere. */
113
+ readonly transport?: string
101
114
  /** Vite production CSS output policy. `false` emits one aggregate stylesheet for the whole client. */
102
115
  readonly cssCodeSplit?: boolean
103
116
  /** Framework-owned SSR stylesheet activation. Deferred mode is intended for aggregate CSS. */
@@ -232,9 +245,29 @@ function assertFrameworkWebOptions(fw: Partial<NifraFramework>, configFile: stri
232
245
  'an array of { rule, file, reason } entries (or { rule: "private-env-value", env, reason })',
233
246
  )
234
247
  }
248
+ if (fw.transport !== undefined && (typeof fw.transport !== "string" || fw.transport === "")) {
249
+ wrong("transport", 'a module path such as "./shell/transport.ts"')
250
+ }
235
251
  if (fw.target !== undefined && typeof fw.target !== "string") {
236
252
  wrong("target", 'a deploy target name such as "bun"')
237
253
  }
254
+ if (fw.deploymentAdapter !== undefined) {
255
+ const configured: unknown = fw.deploymentAdapter
256
+ if (typeof configured !== "object" || configured === null) {
257
+ wrong("deploymentAdapter", "an object with { adapter, options? }")
258
+ } else {
259
+ const adapter: unknown = Reflect.get(configured, "adapter")
260
+ if (
261
+ typeof adapter !== "object" ||
262
+ adapter === null ||
263
+ typeof Reflect.get(adapter, "id") !== "string" ||
264
+ typeof Reflect.get(adapter, "baseTarget") !== "string" ||
265
+ typeof Reflect.get(adapter, "validateOptions") !== "function" ||
266
+ typeof Reflect.get(adapter, "emit") !== "function"
267
+ )
268
+ wrong("deploymentAdapter.adapter", "a public deployment adapter from @nifrajs/web/build")
269
+ }
270
+ }
238
271
  if (
239
272
  fw.vercelRuntime !== undefined &&
240
273
  fw.vercelRuntime !== "edge" &&
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.12.1"
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 () => {
package/src/mcp-render.ts CHANGED
@@ -57,7 +57,7 @@ async function buildWebApp(cwd: string): Promise<{ app: AppLike } | { error: str
57
57
  manifest: discoverRoutes(app.routesDir),
58
58
  clientEntry: "/_nifra-render-only.js", // placeholder; SSR HTML does not need the built client
59
59
  ...frameworkWebAppOptions(app.framework, app.backend),
60
- }) as unknown as AppLike
60
+ }) as AppLike
61
61
  return { app: webApp }
62
62
  } catch (err) {
63
63
  return { error: errString(err) }
package/src/mcp-root.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * Everything here is pure state + fs probes; the I/O wiring lives in `./mcp.ts`.
18
18
  */
19
19
 
20
- import { readdir, readFile, stat } from "node:fs/promises"
20
+ import { readdir, readFile, realpath, stat } from "node:fs/promises"
21
21
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path"
22
22
  import { fileURLToPath } from "node:url"
23
23
 
@@ -100,10 +100,27 @@ async function workspacePatterns(dir: string): Promise<readonly string[] | null>
100
100
  if (!Array.isArray(list)) return null
101
101
  return list.filter(
102
102
  (pattern): pattern is string =>
103
- typeof pattern === "string" && pattern !== "" && !pattern.startsWith("!"),
103
+ typeof pattern === "string" &&
104
+ pattern !== "" &&
105
+ !pattern.startsWith("!") &&
106
+ !patternLeavesRoot(pattern),
104
107
  )
105
108
  }
106
109
 
110
+ /** An absolute pattern or one with a `..` segment names a directory outside the workspace root, so
111
+ * a manifest could otherwise make the server adopt a neighbouring project. */
112
+ function patternLeavesRoot(pattern: string): boolean {
113
+ return isAbsolute(pattern) || pattern.split(/[\\/]/).includes("..")
114
+ }
115
+
116
+ /** Whether `member` resolves, symlinks followed, to somewhere inside `rootReal`. */
117
+ async function insideRoot(rootReal: string, member: string): Promise<boolean> {
118
+ const real = await realpath(member).catch(() => null)
119
+ if (real === null) return false
120
+ const rel = relative(rootReal, real)
121
+ return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel)
122
+ }
123
+
107
124
  /**
108
125
  * The directories under `dir` that `pattern` matches and that hold a `package.json`, in name order. A
109
126
  * walk rather than a glob scan: a `**` pattern would otherwise descend every `node_modules` below it,
@@ -165,10 +182,11 @@ export async function workspaceMemberDirs(dir: string): Promise<string[] | null>
165
182
  if (patterns === null) return null
166
183
  const members = new Set<string>()
167
184
  const budget = { directories: MAX_WORKSPACE_DIRECTORIES }
185
+ const rootReal = await realpath(dir).catch(() => dir)
168
186
  for (const pattern of patterns) {
169
187
  for (const member of await workspaceMatches(dir, pattern, budget)) {
170
188
  if (members.size === MAX_WORKSPACE_MEMBERS) break
171
- members.add(join(dir, member))
189
+ if (await insideRoot(rootReal, join(dir, member))) members.add(join(dir, member))
172
190
  }
173
191
  }
174
192
  return [...members]
@@ -251,11 +251,11 @@ export function withToolMeta(tool: McpTool): McpTool {
251
251
  const annotated = { ...tool, annotations: tool.annotations ?? meta.annotations }
252
252
  const fields = meta.fields
253
253
  const properties = tool.inputSchema.properties
254
- if (fields === undefined || !isRecord(properties)) return annotated
254
+ if (fields === undefined || !isNonNullObject(properties)) return annotated
255
255
  const described = Object.fromEntries(
256
256
  Object.entries(properties).map(([name, property]) => {
257
257
  const description = fields[name]
258
- return description === undefined || !isRecord(property) || "description" in property
258
+ return description === undefined || !isNonNullObject(property) || "description" in property
259
259
  ? [name, property]
260
260
  : [name, { ...property, description }]
261
261
  }),
@@ -263,5 +263,5 @@ export function withToolMeta(tool: McpTool): McpTool {
263
263
  return { ...annotated, inputSchema: { ...tool.inputSchema, properties: described } }
264
264
  }
265
265
 
266
- const isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>
266
+ const isNonNullObject = (value: unknown): value is Readonly<Record<string, unknown>> =>
267
267
  typeof value === "object" && value !== null
package/src/port.ts CHANGED
@@ -18,6 +18,7 @@ import { join } from "node:path"
18
18
  import { Glob } from "bun"
19
19
  import { stripComments } from "./check.ts"
20
20
  import { readConfigTarget } from "./config-target.ts"
21
+ import { readDeploymentAdapterMetadata } from "./deployment-adapters.ts"
21
22
  import { codeUnitOrder } from "./internal/code-unit-order.ts"
22
23
  import { lineAt } from "./internal/line-at.ts"
23
24
 
@@ -357,10 +358,13 @@ export async function detectFeatures(cwd: string): Promise<DetectedFeature[]> {
357
358
 
358
359
  export interface ResolvedTarget {
359
360
  readonly target: Target
361
+ /** The custom deployment key when its package declares the wrapped runtime statically. */
362
+ readonly adapterId?: string
360
363
  /** How the target was determined - surfaced so the report explains itself. */
361
364
  readonly source:
362
365
  | "flag"
363
366
  | "config"
367
+ | "adapter"
364
368
  | "package-json-build"
365
369
  | "package-json-deploy"
366
370
  | "wrangler"
@@ -390,25 +394,32 @@ interface PackageJsonScripts {
390
394
  * Resolve the app's deploy target. `--target` (validated) always wins, then the `target` that
391
395
  * `nifra.config.ts` exports. Otherwise infer it, in priority order, from: the canonical `build` script
392
396
  * (an older create-nifra's `build-<target>.ts`), the `deploy` script
393
- * (the vendor CLI it shells out to), a `wrangler.toml` (Cloudflare Pages), or a `vercel.json`. Returns
394
- * `undefined` when nothing signals a target (the matrix still prints; CI gating needs an explicit one).
397
+ * (the vendor CLI it shells out to), a `wrangler.toml` (Cloudflare Pages), a `vercel.json`, or installed
398
+ * adapter metadata. Returns `undefined` when nothing signals a target (the matrix still prints; CI
399
+ * gating needs an explicit one).
395
400
  */
396
401
  export async function resolveTarget(
397
402
  cwd: string,
398
403
  override?: string,
399
404
  ): Promise<ResolvedTarget | undefined> {
400
- const checked = (value: string, label: string): Target => {
401
- if (isTarget(value)) return value
405
+ /** Map a built-in target directly or a custom adapter ID to its declared runtime. */
406
+ const checked = (value: string, label: string): ResolvedTarget => {
407
+ if (isTarget(value)) return { target: value, source: label === "--target" ? "flag" : "config" }
408
+ const metadata = readDeploymentAdapterMetadata(cwd, value)
409
+ if (metadata !== undefined && metadata.baseTarget !== "static")
410
+ return { target: metadata.baseTarget, source: "adapter", adapterId: metadata.id }
402
411
  throw new Error(
403
412
  value === "cf-pages"
404
413
  ? `[nifra] the ${label} "cf-pages" is now "cloudflare"`
405
- : `[nifra] invalid ${label} "${value}". options: ${TARGETS.join(", ")}`,
414
+ : metadata?.baseTarget === "static"
415
+ ? `[nifra] ${label} "${value}" is a static adapter; nifra port checks runtime targets (${TARGETS.join(", ")})`
416
+ : `[nifra] invalid ${label} "${value}". options: ${TARGETS.join(", ")} or an installed deployment adapter with Nifra metadata`,
406
417
  )
407
418
  }
408
- if (override !== undefined) return { target: checked(override, "--target"), source: "flag" }
419
+ if (override !== undefined) return checked(override, "--target")
409
420
  const configured = readConfigTarget(cwd)
410
421
  if (configured !== undefined && configured !== "static") {
411
- return { target: checked(configured, "target in nifra.config.ts"), source: "config" }
422
+ return checked(configured, "target in nifra.config.ts")
412
423
  }
413
424
 
414
425
  const pkg = await readJson<PackageJsonScripts>(join(cwd, "package.json"))
@@ -546,7 +557,11 @@ export function renderReport(result: PortResult, opts: { readonly strict?: boole
546
557
  const out: string[] = ["nifra port - portability matrix", ""]
547
558
 
548
559
  if (resolved !== undefined) {
549
- out.push(`target: ${resolved.target} (detected from ${describeSource(resolved.source)})`)
560
+ out.push(
561
+ resolved.adapterId === undefined
562
+ ? `target: ${resolved.target} (detected from ${describeSource(resolved.source)})`
563
+ : `target: ${resolved.adapterId} (base runtime ${resolved.target}; detected from ${describeSource(resolved.source)})`,
564
+ )
550
565
  } else {
551
566
  out.push(
552
567
  "target: not detected - pass --target <bun|node|deno|cloudflare|vercel> to gate against one",
@@ -631,6 +646,8 @@ function describeSource(source: ResolvedTarget["source"]): string {
631
646
  return "--target"
632
647
  case "config":
633
648
  return "nifra.config.ts"
649
+ case "adapter":
650
+ return "installed adapter package metadata"
634
651
  case "package-json-build":
635
652
  return "the package.json build script"
636
653
  case "package-json-deploy":
@@ -0,0 +1,41 @@
1
+ import type { UpgradeRecipe } from "./index.ts"
2
+
3
+ /**
4
+ * Upgrade recipe for Nifra 5.13.
5
+ *
6
+ * This release has no import or dependency moves. Its notes cover the stricter cross-site form
7
+ * policy, the native-shell transport, and the handle and idempotency changes.
8
+ */
9
+ export const recipe: UpgradeRecipe = {
10
+ version: "5.13.0",
11
+ pins: [
12
+ { match: "@nifrajs/", to: "5.13.0" },
13
+ { match: "create-nifra", to: "5.13.0" },
14
+ { match: "nifra", to: "5.13.0" },
15
+ ],
16
+ importMoves: [],
17
+ affects: [
18
+ "@nifrajs/cli",
19
+ "@nifrajs/client",
20
+ "@nifrajs/core",
21
+ "@nifrajs/cron",
22
+ "@nifrajs/deno",
23
+ "@nifrajs/edge",
24
+ "@nifrajs/image",
25
+ "@nifrajs/jobs",
26
+ "@nifrajs/middleware",
27
+ "@nifrajs/node",
28
+ "@nifrajs/web",
29
+ "create-nifra",
30
+ ],
31
+ notes: [
32
+ "A route without a body schema now refuses a cross-site HTML form post, and an unsafe request with no content type from an untrusted site, with `403 forbidden_origin` before the handler runs, on every lane including Bun's native route table and `@nifrajs/edge`. An app that handles CORS outside Nifra, such as a reverse proxy adding the headers, and takes bodyless cross-origin `POST`, `PUT`, `PATCH` or `DELETE` calls without an `Authorization` header needs that frontend's origin in `formOrigins`.",
33
+ "The origins a `cors()` list or predicate and a `csrf({ origins })` list name are now trusted for form posts, so those frontends need no second copy in `formOrigins`. Audit those origins: a named origin may now also post a form to the routes of the server that installs the middleware.",
34
+ "A route's `allowedOrigins` function receives, as its second argument, whether the default same-origin check would admit the request.",
35
+ "`createClientRouter` takes a `fetch` option and a build takes a `transport` module, so a page inside a native shell can reach its server on another origin. `nifra shell tauri` and `create-nifra --shell tauri` scaffold a Tauri 2 shell; `nifra build --target static --prerender <paths>` prerenders the pages a shell build opens on.",
36
+ "Standalone idempotency response serialization and replay, and in-process client response decoding, are bounded to 1 MB by default. Set `maxBytes` or a route's `maxResponseBytes` to change the limit.",
37
+ "Bun `listen()` handles, Node and Deno `serve()` handles, jobs workers, cron schedulers, client subscriptions and client WebSockets can be held with `await using` or `using`.",
38
+ "Native query URL parsing and remote image body handling are stricter, and the web query cache does less repeated hashing, invalidation and eviction work.",
39
+ "The generated client entry sets `data-nifra-hydrated` on a timer while the view is hidden, so a window created hidden no longer waits for an animation frame.",
40
+ ],
41
+ }
@@ -0,0 +1,34 @@
1
+ import type { UpgradeRecipe } from "./index.ts"
2
+
3
+ /**
4
+ * Upgrade recipe for Nifra 5.14.
5
+ *
6
+ * This release has no import or dependency moves. Its notes cover the new uWebSockets.js adapter,
7
+ * the server-component tuple that moves to Vite 8.3.8, the markdown renderer behind `entry.html`,
8
+ * and TRACE routing on Deno through a mounted app. A fifth covers `data:` URLs on a `<script>` in `@nifrajs/web-vanilla`.
9
+ */
10
+ export const recipe: UpgradeRecipe = {
11
+ version: "5.14.0",
12
+ pins: [
13
+ { match: "@nifrajs/", to: "5.14.0" },
14
+ { match: "create-nifra", to: "5.14.0" },
15
+ { match: "nifra", to: "5.14.0" },
16
+ ],
17
+ importMoves: [],
18
+ affects: [
19
+ "@nifrajs/content",
20
+ "@nifrajs/core",
21
+ "@nifrajs/node",
22
+ "@nifrajs/node-uws",
23
+ "@nifrajs/web",
24
+ "@nifrajs/web-react",
25
+ "@nifrajs/web-vanilla",
26
+ ],
27
+ notes: [
28
+ "`@nifrajs/node-uws` serves an app on uWebSockets.js from Node, through the same node-direct lane as `@nifrajs/node`: `serve(app, { port })` from the new package. It has no WebSocket or static-file support, and uWebSockets.js is installed from GitHub with its own prebuilt binaries, so keep `@nifrajs/node` where those matter. Nothing changes for an app that stays on `@nifrajs/node`.",
29
+ "The certified server-component tuple moves to Vite 8.3.8 and `@vitejs/plugin-rsc` 0.5.39. The pipeline's guard accepts only the certified Vite and the plugin peer is exact, so an app using server components must pin `vite@8.3.8` and `@vitejs/plugin-rsc@0.5.39` together. Apps that do not opt in to server components are unaffected.",
30
+ "`entry.html` in `@nifrajs/content` is rendered by marked 18 (was 15): a code span that wraps across lines inside a list item stays one span, a single `~` before a number is text instead of strikethrough, and HTML blocks and tables no longer carry the blank lines that followed them in the source. Re-bake collections and review any snapshot of `entry.html`.",
31
+ "On Deno with `normalizeTarget`, an app reached through `mount()` or `mountFetch()` routes a TRACE or TRACK request on the target its parent resolved, so `TRACE /x/../pages/form` answers the page's 405 with its `Allow` as on every other runtime.",
32
+ "`@nifrajs/web-vanilla` writes an interpolated `data:` URL that begins a `<script>`'s `src` or `href` as `about:invalid`, as it already did for `javascript:`. A page that loads a script from an interpolated `data:` URL must serve it from a real URL; `data:` URLs on images, links, frames, objects and stylesheets are unchanged.",
33
+ ],
34
+ }
@@ -24,6 +24,8 @@ import { recipe as v5_9_0 } from "./5.9.0.ts"
24
24
  import { recipe as v5_10_0 } from "./5.10.0.ts"
25
25
  import { recipe as v5_11_0 } from "./5.11.0.ts"
26
26
  import { recipe as v5_12_0 } from "./5.12.0.ts"
27
+ import { recipe as v5_13_0 } from "./5.13.0.ts"
28
+ import { recipe as v5_14_0 } from "./5.14.0.ts"
27
29
 
28
30
  /** A pin rule: every dependency whose name starts with `match` is set to version `to`. */
29
31
  export interface PinRule {
@@ -107,6 +109,8 @@ const RECIPES: Record<string, UpgradeRecipe> = {
107
109
  [v5_10_0.version]: v5_10_0,
108
110
  [v5_11_0.version]: v5_11_0,
109
111
  [v5_12_0.version]: v5_12_0,
112
+ [v5_13_0.version]: v5_13_0,
113
+ [v5_14_0.version]: v5_14_0,
110
114
  }
111
115
 
112
116
  export function getRecipe(version: string): UpgradeRecipe | undefined {
@@ -12,8 +12,8 @@ import type { CheckRule, RuleContext } from "./index.ts"
12
12
  * NF-C018 exists because the typed client's proxy intercepts a fixed set of property names before
13
13
  * path resolution (`resolveSegment` + the thenable guard in @nifrajs/client). A route whose path
14
14
  * contains a static segment spelling one of these cannot be reached by DOT ACCESS -
15
- * `api.delete.post` resolves the DELETE verb, not the path. The typed spelling is a call on the
16
- * parent node (`api.api("delete").post()`, treaty.ts `SegmentCall`), and the client type rejects
15
+ * `api.delete()` invokes the DELETE verb and `api.delete.post` is undefined. The typed spelling is a
16
+ * call on the parent node (`api.api("delete").post()`, treaty.ts `SegmentCall`), and the client type rejects
17
17
  * the dot access with the same guidance - so the collision is a warning that teaches the call
18
18
  * spelling, not a blocking error: the route IS reachable, just not by the spelling its name
19
19
  * suggests.