@timber-js/app 0.2.0-alpha.2 → 0.2.0-alpha.200

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 (1329) hide show
  1. package/LICENSE +8 -0
  2. package/agent-skill.md +346 -0
  3. package/dist/_chunks/actions-d1hCqnU3.js +345 -0
  4. package/dist/_chunks/actions-d1hCqnU3.js.map +1 -0
  5. package/dist/_chunks/als-registry-C6kcfprT.js +41 -0
  6. package/dist/_chunks/als-registry-C6kcfprT.js.map +1 -0
  7. package/dist/_chunks/als-slots-BEEIPKYm.js +26 -0
  8. package/dist/_chunks/als-slots-BEEIPKYm.js.map +1 -0
  9. package/dist/_chunks/base-path-DaQrzbez.js +80 -0
  10. package/dist/_chunks/base-path-DaQrzbez.js.map +1 -0
  11. package/dist/_chunks/build-manifest-DTmSGLRz.js +135 -0
  12. package/dist/_chunks/build-manifest-DTmSGLRz.js.map +1 -0
  13. package/dist/_chunks/build-output-helper-9dqCv1pZ.js +370 -0
  14. package/dist/_chunks/build-output-helper-9dqCv1pZ.js.map +1 -0
  15. package/dist/_chunks/cache-api-ByagcC-J.js +1149 -0
  16. package/dist/_chunks/cache-api-ByagcC-J.js.map +1 -0
  17. package/dist/_chunks/canonicalize-CgHoscYO.js +66 -0
  18. package/dist/_chunks/canonicalize-CgHoscYO.js.map +1 -0
  19. package/dist/_chunks/chains-Bpb0W4ax.js +412 -0
  20. package/dist/_chunks/chains-Bpb0W4ax.js.map +1 -0
  21. package/dist/_chunks/cli-check-D6VolrDV.js +293 -0
  22. package/dist/_chunks/cli-check-D6VolrDV.js.map +1 -0
  23. package/dist/_chunks/cli-schema-sync-D6rO-VcS.js +299 -0
  24. package/dist/_chunks/cli-schema-sync-D6rO-VcS.js.map +1 -0
  25. package/dist/_chunks/cloudflare-BFb__LYG.js +1290 -0
  26. package/dist/_chunks/cloudflare-BFb__LYG.js.map +1 -0
  27. package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
  28. package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
  29. package/dist/_chunks/convention-lint-fRkwVwEH.js +893 -0
  30. package/dist/_chunks/convention-lint-fRkwVwEH.js.map +1 -0
  31. package/dist/_chunks/dist-DtrJyBbw.js +386 -0
  32. package/dist/_chunks/dist-DtrJyBbw.js.map +1 -0
  33. package/dist/_chunks/error-boundary-BfPHZjm0.js +1050 -0
  34. package/dist/_chunks/error-boundary-BfPHZjm0.js.map +1 -0
  35. package/dist/_chunks/fast-hash-C-tVYrLb.js +41 -0
  36. package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
  37. package/dist/_chunks/file-cache-Dw6BJPG7.js +458 -0
  38. package/dist/_chunks/file-cache-Dw6BJPG7.js.map +1 -0
  39. package/dist/_chunks/format-BKclgVbk.js +14 -0
  40. package/dist/_chunks/format-BKclgVbk.js.map +1 -0
  41. package/dist/_chunks/fs-identity-D7vb6GdI.js +208 -0
  42. package/dist/_chunks/fs-identity-D7vb6GdI.js.map +1 -0
  43. package/dist/_chunks/graph-cache-CP4GEmf9.js +304 -0
  44. package/dist/_chunks/graph-cache-CP4GEmf9.js.map +1 -0
  45. package/dist/_chunks/href-validation-BIrxavIy.js +213 -0
  46. package/dist/_chunks/href-validation-BIrxavIy.js.map +1 -0
  47. package/dist/_chunks/json-lossy-check-ClNvBM_3.js +63 -0
  48. package/dist/_chunks/json-lossy-check-ClNvBM_3.js.map +1 -0
  49. package/dist/_chunks/live-graph-D_2D32Ad.js +150 -0
  50. package/dist/_chunks/live-graph-D_2D32Ad.js.map +1 -0
  51. package/dist/_chunks/logger-uLBuGKDI.js +1484 -0
  52. package/dist/_chunks/logger-uLBuGKDI.js.map +1 -0
  53. package/dist/_chunks/navigation-context-D0TU0Jog.js +135 -0
  54. package/dist/_chunks/navigation-context-D0TU0Jog.js.map +1 -0
  55. package/dist/_chunks/navigation-root-mHSK9psY.js +126 -0
  56. package/dist/_chunks/navigation-root-mHSK9psY.js.map +1 -0
  57. package/dist/_chunks/param-value-C8TNYchQ.js +66 -0
  58. package/dist/_chunks/param-value-C8TNYchQ.js.map +1 -0
  59. package/dist/_chunks/plugin-context-8idfR3UZ.js +321 -0
  60. package/dist/_chunks/plugin-context-8idfR3UZ.js.map +1 -0
  61. package/dist/_chunks/poison-rules-DoEhbqaY.js +110 -0
  62. package/dist/_chunks/poison-rules-DoEhbqaY.js.map +1 -0
  63. package/dist/_chunks/poison-scan-Bm9Yyqk9.js +101 -0
  64. package/dist/_chunks/poison-scan-Bm9Yyqk9.js.map +1 -0
  65. package/dist/_chunks/purge-store-Byr8XOjU.js +14 -0
  66. package/dist/_chunks/purge-store-Byr8XOjU.js.map +1 -0
  67. package/dist/_chunks/resolve-schema-CBR6Lm4i.js +50 -0
  68. package/dist/_chunks/resolve-schema-CBR6Lm4i.js.map +1 -0
  69. package/dist/_chunks/rolldown-runtime-D7D4PA-g.js +13 -0
  70. package/dist/_chunks/rsc-cache-key-ClUiXQnK.js +243 -0
  71. package/dist/_chunks/rsc-cache-key-ClUiXQnK.js.map +1 -0
  72. package/dist/_chunks/rsc-media-type-DDc7duTD.js +61 -0
  73. package/dist/_chunks/rsc-media-type-DDc7duTD.js.map +1 -0
  74. package/dist/_chunks/rsc-payload-path-B_LBodc2.js +48 -0
  75. package/dist/_chunks/rsc-payload-path-B_LBodc2.js.map +1 -0
  76. package/dist/_chunks/scan-BoP17W3w.js +140 -0
  77. package/dist/_chunks/scan-BoP17W3w.js.map +1 -0
  78. package/dist/_chunks/scanner-AiazgH_f.js +1771 -0
  79. package/dist/_chunks/scanner-AiazgH_f.js.map +1 -0
  80. package/dist/_chunks/schema-bridge-C83xa9lT.js +199 -0
  81. package/dist/_chunks/schema-bridge-C83xa9lT.js.map +1 -0
  82. package/dist/_chunks/segment-classify-C539Pa2O.js +197 -0
  83. package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
  84. package/dist/_chunks/segment-context-D9_89u34.js +34 -0
  85. package/dist/_chunks/segment-context-D9_89u34.js.map +1 -0
  86. package/dist/_chunks/segment-keys-lqtdookO.js +256 -0
  87. package/dist/_chunks/segment-keys-lqtdookO.js.map +1 -0
  88. package/dist/_chunks/singleflight-2lUWfcAk.js +54 -0
  89. package/dist/_chunks/singleflight-2lUWfcAk.js.map +1 -0
  90. package/dist/_chunks/sizeof-lXffQ1Vr.js +35 -0
  91. package/dist/_chunks/sizeof-lXffQ1Vr.js.map +1 -0
  92. package/dist/_chunks/{ssr-data-DLnbYpj1.js → ssr-data-D6T6Y3ef.js} +3 -31
  93. package/dist/_chunks/ssr-data-D6T6Y3ef.js.map +1 -0
  94. package/dist/_chunks/state-FippDgxN.js +52 -0
  95. package/dist/_chunks/state-FippDgxN.js.map +1 -0
  96. package/dist/_chunks/status-page-marker-DwQBrLBz.js +496 -0
  97. package/dist/_chunks/status-page-marker-DwQBrLBz.js.map +1 -0
  98. package/dist/_chunks/use-query-states-I3JMng6J.js +226 -0
  99. package/dist/_chunks/use-query-states-I3JMng6J.js.map +1 -0
  100. package/dist/_chunks/walkers-B6XUtmqK.js +144 -0
  101. package/dist/_chunks/walkers-B6XUtmqK.js.map +1 -0
  102. package/dist/adapters/build-output-helper.d.ts +72 -0
  103. package/dist/adapters/build-output-helper.d.ts.map +1 -0
  104. package/dist/adapters/cloudflare-dev.d.ts +109 -0
  105. package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
  106. package/dist/adapters/cloudflare-dev.js +74 -0
  107. package/dist/adapters/cloudflare-dev.js.map +1 -0
  108. package/dist/adapters/cloudflare-kv-cache.d.ts +65 -0
  109. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  110. package/dist/adapters/cloudflare-kv-cache.js +123 -0
  111. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  112. package/dist/adapters/cloudflare.d.ts +200 -22
  113. package/dist/adapters/cloudflare.d.ts.map +1 -1
  114. package/dist/adapters/cloudflare.js +2 -188
  115. package/dist/adapters/compress-module.d.ts +17 -4
  116. package/dist/adapters/compress-module.d.ts.map +1 -1
  117. package/dist/adapters/fs-identity.d.ts +64 -0
  118. package/dist/adapters/fs-identity.d.ts.map +1 -0
  119. package/dist/adapters/nitro-presets.d.ts +37 -0
  120. package/dist/adapters/nitro-presets.d.ts.map +1 -0
  121. package/dist/adapters/nitro-preview.d.ts +32 -0
  122. package/dist/adapters/nitro-preview.d.ts.map +1 -0
  123. package/dist/adapters/nitro.d.ts +82 -37
  124. package/dist/adapters/nitro.d.ts.map +1 -1
  125. package/dist/adapters/nitro.js +457 -288
  126. package/dist/adapters/nitro.js.map +1 -1
  127. package/dist/adapters/shared.d.ts +62 -0
  128. package/dist/adapters/shared.d.ts.map +1 -0
  129. package/dist/adapters/types.d.ts +28 -6
  130. package/dist/adapters/types.d.ts.map +1 -1
  131. package/dist/analyze/chains.d.ts +124 -0
  132. package/dist/analyze/chains.d.ts.map +1 -0
  133. package/dist/analyze/classify.d.ts +150 -0
  134. package/dist/analyze/classify.d.ts.map +1 -0
  135. package/dist/analyze/crawl-entry.d.ts +17 -0
  136. package/dist/analyze/crawl-entry.d.ts.map +1 -0
  137. package/dist/analyze/crawl-entry.js +313 -0
  138. package/dist/analyze/crawl-entry.js.map +1 -0
  139. package/dist/analyze/crawl.d.ts +134 -0
  140. package/dist/analyze/crawl.d.ts.map +1 -0
  141. package/dist/analyze/graph-cache.d.ts +104 -0
  142. package/dist/analyze/graph-cache.d.ts.map +1 -0
  143. package/dist/analyze/graph-command.d.ts +43 -0
  144. package/dist/analyze/graph-command.d.ts.map +1 -0
  145. package/dist/analyze/graph-command.js +472 -0
  146. package/dist/analyze/graph-command.js.map +1 -0
  147. package/dist/analyze/live-graph.d.ts +81 -0
  148. package/dist/analyze/live-graph.d.ts.map +1 -0
  149. package/dist/analyze/poison-rules.d.ts +72 -0
  150. package/dist/analyze/poison-rules.d.ts.map +1 -0
  151. package/dist/analyze/poison-scan.d.ts +48 -0
  152. package/dist/analyze/poison-scan.d.ts.map +1 -0
  153. package/dist/analyze/scan.d.ts +73 -0
  154. package/dist/analyze/scan.d.ts.map +1 -0
  155. package/dist/cache/cache-api.d.ts +48 -0
  156. package/dist/cache/cache-api.d.ts.map +1 -0
  157. package/dist/cache/fast-hash.d.ts +27 -0
  158. package/dist/cache/fast-hash.d.ts.map +1 -0
  159. package/dist/cache/handler-store.d.ts +33 -0
  160. package/dist/cache/handler-store.d.ts.map +1 -0
  161. package/dist/cache/index.d.ts +32 -9
  162. package/dist/cache/index.d.ts.map +1 -1
  163. package/dist/cache/index.js +3 -284
  164. package/dist/cache/invalidation-epoch.d.ts +43 -0
  165. package/dist/cache/invalidation-epoch.d.ts.map +1 -0
  166. package/dist/cache/json-lossy-check.d.ts +11 -0
  167. package/dist/cache/json-lossy-check.d.ts.map +1 -0
  168. package/dist/cache/redis-handler.d.ts +141 -9
  169. package/dist/cache/redis-handler.d.ts.map +1 -1
  170. package/dist/cache/singleflight.d.ts +21 -2
  171. package/dist/cache/singleflight.d.ts.map +1 -1
  172. package/dist/cache/sizeof.d.ts +22 -0
  173. package/dist/cache/sizeof.d.ts.map +1 -0
  174. package/dist/cache/stable-stringify.d.ts +9 -0
  175. package/dist/cache/stable-stringify.d.ts.map +1 -1
  176. package/dist/cache/store.d.ts +53 -0
  177. package/dist/cache/store.d.ts.map +1 -0
  178. package/dist/cache/stores/cloudflare-kv.d.ts +38 -0
  179. package/dist/cache/stores/cloudflare-kv.d.ts.map +1 -0
  180. package/dist/cache/stores/cloudflare-kv.js +29 -0
  181. package/dist/cache/stores/cloudflare-kv.js.map +1 -0
  182. package/dist/cache/stores/memory.d.ts +42 -0
  183. package/dist/cache/stores/memory.d.ts.map +1 -0
  184. package/dist/cache/stores/memory.js +90 -0
  185. package/dist/cache/stores/memory.js.map +1 -0
  186. package/dist/cache/stores/redis.d.ts +69 -0
  187. package/dist/cache/stores/redis.d.ts.map +1 -0
  188. package/dist/cache/stores/redis.js +35 -0
  189. package/dist/cache/stores/redis.js.map +1 -0
  190. package/dist/cache/stores/vercel.d.ts +36 -0
  191. package/dist/cache/stores/vercel.d.ts.map +1 -0
  192. package/dist/cache/stores/vercel.js +33 -0
  193. package/dist/cache/stores/vercel.js.map +1 -0
  194. package/dist/cache/tag-aware-handler.d.ts +52 -0
  195. package/dist/cache/tag-aware-handler.d.ts.map +1 -0
  196. package/dist/cache/timber-cache.d.ts +21 -11
  197. package/dist/cache/timber-cache.d.ts.map +1 -1
  198. package/dist/cdn/cloudflare-purge.d.ts +23 -0
  199. package/dist/cdn/cloudflare-purge.d.ts.map +1 -0
  200. package/dist/cdn/cloudflare-purge.js +30 -0
  201. package/dist/cdn/cloudflare-purge.js.map +1 -0
  202. package/dist/cdn/fastly-purge.d.ts +25 -0
  203. package/dist/cdn/fastly-purge.d.ts.map +1 -0
  204. package/dist/cdn/fastly-purge.js +33 -0
  205. package/dist/cdn/fastly-purge.js.map +1 -0
  206. package/dist/cdn/headers.d.ts +97 -0
  207. package/dist/cdn/headers.d.ts.map +1 -0
  208. package/dist/cdn/index.d.ts +5 -0
  209. package/dist/cdn/index.d.ts.map +1 -0
  210. package/dist/cdn/index.js +94 -0
  211. package/dist/cdn/index.js.map +1 -0
  212. package/dist/cdn/purge-store.d.ts +23 -0
  213. package/dist/cdn/purge-store.d.ts.map +1 -0
  214. package/dist/cdn/workers-cache-purge.d.ts +20 -0
  215. package/dist/cdn/workers-cache-purge.d.ts.map +1 -0
  216. package/dist/cdn/workers-cache-purge.js +35 -0
  217. package/dist/cdn/workers-cache-purge.js.map +1 -0
  218. package/dist/cli-check.d.ts +163 -0
  219. package/dist/cli-check.d.ts.map +1 -0
  220. package/dist/cli-schema-sync.d.ts +59 -0
  221. package/dist/cli-schema-sync.d.ts.map +1 -0
  222. package/dist/cli.d.ts +75 -8
  223. package/dist/cli.d.ts.map +1 -1
  224. package/dist/cli.js +175 -47
  225. package/dist/cli.js.map +1 -1
  226. package/dist/client/browser-dev.d.ts +37 -1
  227. package/dist/client/browser-dev.d.ts.map +1 -1
  228. package/dist/client/browser-entry/action-dispatch.d.ts +19 -0
  229. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  230. package/dist/client/browser-entry/action-queue.d.ts +44 -0
  231. package/dist/client/browser-entry/action-queue.d.ts.map +1 -0
  232. package/dist/client/browser-entry/hmr.d.ts +21 -0
  233. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  234. package/dist/client/browser-entry/hydrate.d.ts +63 -0
  235. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  236. package/dist/client/browser-entry/index.d.ts +30 -0
  237. package/dist/client/browser-entry/index.d.ts.map +1 -0
  238. package/dist/client/browser-entry/post-hydration.d.ts +29 -0
  239. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  240. package/dist/client/browser-entry/router-init.d.ts +46 -0
  241. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  242. package/dist/client/browser-entry/rsc-stream.d.ts +32 -0
  243. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  244. package/dist/client/browser-entry/scroll.d.ts +28 -0
  245. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  246. package/dist/client/deny-last-resort.d.ts +29 -0
  247. package/dist/client/deny-last-resort.d.ts.map +1 -0
  248. package/dist/client/error-boundary.d.ts +66 -6
  249. package/dist/client/error-boundary.d.ts.map +1 -1
  250. package/dist/client/error-boundary.js +2 -126
  251. package/dist/client/error-reconstituter.d.ts +61 -0
  252. package/dist/client/error-reconstituter.d.ts.map +1 -0
  253. package/dist/client/form.d.ts +16 -27
  254. package/dist/client/form.d.ts.map +1 -1
  255. package/dist/client/global-context.d.ts +15 -0
  256. package/dist/client/global-context.d.ts.map +1 -0
  257. package/dist/client/history.d.ts +50 -9
  258. package/dist/client/history.d.ts.map +1 -1
  259. package/dist/client/index.d.ts +20 -33
  260. package/dist/client/index.d.ts.map +1 -1
  261. package/dist/client/index.js +323 -1148
  262. package/dist/client/index.js.map +1 -1
  263. package/dist/client/internal.d.ts +20 -0
  264. package/dist/client/internal.d.ts.map +1 -0
  265. package/dist/client/internal.js +818 -0
  266. package/dist/client/internal.js.map +1 -0
  267. package/dist/client/link.d.ts +63 -60
  268. package/dist/client/link.d.ts.map +1 -1
  269. package/dist/client/location-search.d.ts +12 -0
  270. package/dist/client/location-search.d.ts.map +1 -0
  271. package/dist/client/navigation-api.d.ts +121 -0
  272. package/dist/client/navigation-api.d.ts.map +1 -0
  273. package/dist/client/navigation-commit.d.ts +98 -0
  274. package/dist/client/navigation-commit.d.ts.map +1 -0
  275. package/dist/client/navigation-context.d.ts +51 -31
  276. package/dist/client/navigation-context.d.ts.map +1 -1
  277. package/dist/client/navigation-root.d.ts +98 -0
  278. package/dist/client/navigation-root.d.ts.map +1 -0
  279. package/dist/client/navigation-transition.d.ts +187 -0
  280. package/dist/client/navigation-transition.d.ts.map +1 -0
  281. package/dist/client/nuqs-adapter.d.ts +1 -1
  282. package/dist/client/nuqs-adapter.d.ts.map +1 -1
  283. package/dist/client/params-context.d.ts +81 -0
  284. package/dist/client/params-context.d.ts.map +1 -0
  285. package/dist/client/react-root.d.ts +44 -0
  286. package/dist/client/react-root.d.ts.map +1 -0
  287. package/dist/client/router-effects.d.ts +130 -0
  288. package/dist/client/router-effects.d.ts.map +1 -0
  289. package/dist/client/router-lifecycle.d.ts +98 -0
  290. package/dist/client/router-lifecycle.d.ts.map +1 -0
  291. package/dist/client/router-pipeline.d.ts +87 -0
  292. package/dist/client/router-pipeline.d.ts.map +1 -0
  293. package/dist/client/router-ref.d.ts +2 -2
  294. package/dist/client/router-ref.d.ts.map +1 -1
  295. package/dist/client/router-skew.d.ts +21 -0
  296. package/dist/client/router-skew.d.ts.map +1 -0
  297. package/dist/client/router-types.d.ts +272 -0
  298. package/dist/client/router-types.d.ts.map +1 -0
  299. package/dist/client/router.d.ts +1 -97
  300. package/dist/client/router.d.ts.map +1 -1
  301. package/dist/client/rsc-fetch.d.ts +104 -26
  302. package/dist/client/rsc-fetch.d.ts.map +1 -1
  303. package/dist/client/segment-cache.d.ts +161 -25
  304. package/dist/client/segment-cache.d.ts.map +1 -1
  305. package/dist/client/segment-context.d.ts +1 -1
  306. package/dist/client/segment-context.d.ts.map +1 -1
  307. package/dist/client/segment-outlet.d.ts +68 -0
  308. package/dist/client/segment-outlet.d.ts.map +1 -0
  309. package/dist/client/segment-update-context.d.ts +15 -0
  310. package/dist/client/segment-update-context.d.ts.map +1 -0
  311. package/dist/client/shallow-url.d.ts +10 -0
  312. package/dist/client/shallow-url.d.ts.map +1 -0
  313. package/dist/client/slot-content-cache-context.d.ts +35 -0
  314. package/dist/client/slot-content-cache-context.d.ts.map +1 -0
  315. package/dist/client/slot-context.d.ts +31 -0
  316. package/dist/client/slot-context.d.ts.map +1 -0
  317. package/dist/client/slot-outlet.d.ts +16 -0
  318. package/dist/client/slot-outlet.d.ts.map +1 -0
  319. package/dist/client/slot-provider.d.ts +25 -0
  320. package/dist/client/slot-provider.d.ts.map +1 -0
  321. package/dist/client/ssr-data.d.ts +29 -7
  322. package/dist/client/ssr-data.d.ts.map +1 -1
  323. package/dist/client/stale-client.d.ts +69 -0
  324. package/dist/client/stale-client.d.ts.map +1 -0
  325. package/dist/client/state.d.ts +19 -8
  326. package/dist/client/state.d.ts.map +1 -1
  327. package/dist/client/status-page-marker.d.ts +25 -0
  328. package/dist/client/status-page-marker.d.ts.map +1 -0
  329. package/dist/client/top-loader.d.ts +7 -6
  330. package/dist/client/top-loader.d.ts.map +1 -1
  331. package/dist/client/unload-guard.d.ts +5 -0
  332. package/dist/client/unload-guard.d.ts.map +1 -1
  333. package/dist/client/use-cookie.d.ts +12 -0
  334. package/dist/client/use-cookie.d.ts.map +1 -1
  335. package/dist/client/use-link-status.d.ts +5 -5
  336. package/dist/client/use-link-status.d.ts.map +1 -1
  337. package/dist/client/use-pathname.d.ts +13 -11
  338. package/dist/client/use-pathname.d.ts.map +1 -1
  339. package/dist/client/use-pending-navigation.d.ts +23 -0
  340. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  341. package/dist/client/use-query-states.d.ts +10 -4
  342. package/dist/client/use-query-states.d.ts.map +1 -1
  343. package/dist/client/use-router.d.ts +2 -2
  344. package/dist/client/use-router.d.ts.map +1 -1
  345. package/dist/client/use-search-params.d.ts +15 -8
  346. package/dist/client/use-search-params.d.ts.map +1 -1
  347. package/dist/client/use-segment-params.d.ts +55 -0
  348. package/dist/client/use-segment-params.d.ts.map +1 -0
  349. package/dist/codec.d.ts +69 -0
  350. package/dist/codec.d.ts.map +1 -0
  351. package/dist/codec.js +76 -0
  352. package/dist/codec.js.map +1 -0
  353. package/dist/config-types.d.ts +322 -0
  354. package/dist/config-types.d.ts.map +1 -0
  355. package/dist/config-validation.d.ts +51 -0
  356. package/dist/config-validation.d.ts.map +1 -0
  357. package/dist/cookies/define-cookie.d.ts +58 -25
  358. package/dist/cookies/define-cookie.d.ts.map +1 -1
  359. package/dist/cookies/index.d.ts +3 -2
  360. package/dist/cookies/index.d.ts.map +1 -1
  361. package/dist/cookies/index.js +256 -36
  362. package/dist/cookies/index.js.map +1 -1
  363. package/dist/cookies/json-cookie.d.ts +64 -0
  364. package/dist/cookies/json-cookie.d.ts.map +1 -0
  365. package/dist/cookies/validation.d.ts +34 -0
  366. package/dist/cookies/validation.d.ts.map +1 -0
  367. package/dist/dev-tools/404-page.d.ts +50 -0
  368. package/dist/dev-tools/404-page.d.ts.map +1 -0
  369. package/dist/dev-tools/browser-logs.d.ts +40 -0
  370. package/dist/dev-tools/browser-logs.d.ts.map +1 -0
  371. package/dist/dev-tools/dev-page-shell.d.ts +78 -0
  372. package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
  373. package/dist/dev-tools/error-page.d.ts +32 -0
  374. package/dist/dev-tools/error-page.d.ts.map +1 -0
  375. package/dist/dev-tools/holding-server.d.ts +46 -0
  376. package/dist/dev-tools/holding-server.d.ts.map +1 -0
  377. package/dist/dev-tools/hydration-overlay.d.ts +11 -0
  378. package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
  379. package/dist/dev-tools/index.d.ts +31 -0
  380. package/dist/dev-tools/index.d.ts.map +1 -0
  381. package/dist/dev-tools/instrumentation.d.ts +59 -0
  382. package/dist/dev-tools/instrumentation.d.ts.map +1 -0
  383. package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
  384. package/dist/dev-tools/logger.d.ts.map +1 -0
  385. package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +17 -3
  386. package/dist/dev-tools/logs.d.ts.map +1 -0
  387. package/dist/dev-tools/overlay.d.ts +91 -0
  388. package/dist/dev-tools/overlay.d.ts.map +1 -0
  389. package/dist/dev-tools/stack-classifier.d.ts +34 -0
  390. package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
  391. package/dist/dev-tools/terminal.d.ts +28 -0
  392. package/dist/dev-tools/terminal.d.ts.map +1 -0
  393. package/dist/fonts/ast-walk.d.ts +68 -0
  394. package/dist/fonts/ast-walk.d.ts.map +1 -0
  395. package/dist/fonts/ast.d.ts +112 -8
  396. package/dist/fonts/ast.d.ts.map +1 -1
  397. package/dist/fonts/bundle.d.ts +50 -0
  398. package/dist/fonts/bundle.d.ts.map +1 -0
  399. package/dist/fonts/css.d.ts +2 -1
  400. package/dist/fonts/css.d.ts.map +1 -1
  401. package/dist/fonts/dev-middleware.d.ts +22 -0
  402. package/dist/fonts/dev-middleware.d.ts.map +1 -0
  403. package/dist/fonts/fallbacks.d.ts +0 -7
  404. package/dist/fonts/fallbacks.d.ts.map +1 -1
  405. package/dist/fonts/google.d.ts +5 -3
  406. package/dist/fonts/google.d.ts.map +1 -1
  407. package/dist/fonts/local.d.ts +6 -4
  408. package/dist/fonts/local.d.ts.map +1 -1
  409. package/dist/fonts/paths.d.ts +43 -0
  410. package/dist/fonts/paths.d.ts.map +1 -0
  411. package/dist/fonts/pipeline.d.ts +177 -0
  412. package/dist/fonts/pipeline.d.ts.map +1 -0
  413. package/dist/fonts/transform.d.ts +82 -0
  414. package/dist/fonts/transform.d.ts.map +1 -0
  415. package/dist/fonts/types.d.ts +47 -1
  416. package/dist/fonts/types.d.ts.map +1 -1
  417. package/dist/fonts/virtual-modules.d.ts +77 -0
  418. package/dist/fonts/virtual-modules.d.ts.map +1 -0
  419. package/dist/index.d.ts +35 -153
  420. package/dist/index.d.ts.map +1 -1
  421. package/dist/index.js +10488 -13975
  422. package/dist/index.js.map +1 -1
  423. package/dist/params/codec-registry.d.ts +26 -0
  424. package/dist/params/codec-registry.d.ts.map +1 -0
  425. package/dist/params/define-schema.d.ts +81 -0
  426. package/dist/params/define-schema.d.ts.map +1 -0
  427. package/dist/params/index.d.ts +5 -0
  428. package/dist/params/index.d.ts.map +1 -0
  429. package/dist/params/index.js +34 -0
  430. package/dist/params/index.js.map +1 -0
  431. package/dist/params/resolve-schema.d.ts +34 -0
  432. package/dist/params/resolve-schema.d.ts.map +1 -0
  433. package/dist/plugin-context.d.ts +276 -0
  434. package/dist/plugin-context.d.ts.map +1 -0
  435. package/dist/plugins/adapter-build.d.ts +21 -1
  436. package/dist/plugins/adapter-build.d.ts.map +1 -1
  437. package/dist/plugins/build-manifest.d.ts +7 -3
  438. package/dist/plugins/build-manifest.d.ts.map +1 -1
  439. package/dist/plugins/build-report.d.ts +54 -7
  440. package/dist/plugins/build-report.d.ts.map +1 -1
  441. package/dist/plugins/cache.d.ts +64 -0
  442. package/dist/plugins/cache.d.ts.map +1 -0
  443. package/dist/plugins/callsite-ast.d.ts +117 -0
  444. package/dist/plugins/callsite-ast.d.ts.map +1 -0
  445. package/dist/plugins/callsite-jsx.d.ts +35 -0
  446. package/dist/plugins/callsite-jsx.d.ts.map +1 -0
  447. package/dist/plugins/chunks.d.ts +11 -4
  448. package/dist/plugins/chunks.d.ts.map +1 -1
  449. package/dist/plugins/client-chunks.d.ts +40 -0
  450. package/dist/plugins/client-chunks.d.ts.map +1 -0
  451. package/dist/plugins/cloudflare-wasm.d.ts +21 -0
  452. package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
  453. package/dist/plugins/content.d.ts +1 -1
  454. package/dist/plugins/content.d.ts.map +1 -1
  455. package/dist/plugins/dev-discovery.d.ts +123 -0
  456. package/dist/plugins/dev-discovery.d.ts.map +1 -0
  457. package/dist/plugins/dev-server.d.ts +17 -1
  458. package/dist/plugins/dev-server.d.ts.map +1 -1
  459. package/dist/plugins/entries.d.ts +32 -1
  460. package/dist/plugins/entries.d.ts.map +1 -1
  461. package/dist/plugins/fonts.d.ts +16 -65
  462. package/dist/plugins/fonts.d.ts.map +1 -1
  463. package/dist/plugins/graph-endpoint.d.ts +112 -0
  464. package/dist/plugins/graph-endpoint.d.ts.map +1 -0
  465. package/dist/plugins/mdx.d.ts +24 -5
  466. package/dist/plugins/mdx.d.ts.map +1 -1
  467. package/dist/plugins/prebuilt-capture.d.ts +60 -0
  468. package/dist/plugins/prebuilt-capture.d.ts.map +1 -0
  469. package/dist/plugins/prebuilt-options-analysis.d.ts +40 -0
  470. package/dist/plugins/prebuilt-options-analysis.d.ts.map +1 -0
  471. package/dist/plugins/prebuilt.d.ts +82 -0
  472. package/dist/plugins/prebuilt.d.ts.map +1 -0
  473. package/dist/plugins/prerender-sugar.d.ts +39 -0
  474. package/dist/plugins/prerender-sugar.d.ts.map +1 -0
  475. package/dist/plugins/request-dep/analysis.d.ts +106 -0
  476. package/dist/plugins/request-dep/analysis.d.ts.map +1 -0
  477. package/dist/plugins/request-dep/index.d.ts +75 -0
  478. package/dist/plugins/request-dep/index.d.ts.map +1 -0
  479. package/dist/plugins/request-dep/origin.d.ts +61 -0
  480. package/dist/plugins/request-dep/origin.d.ts.map +1 -0
  481. package/dist/plugins/routing.d.ts +1 -1
  482. package/dist/plugins/routing.d.ts.map +1 -1
  483. package/dist/plugins/server-bundle.d.ts.map +1 -1
  484. package/dist/plugins/shims.d.ts +29 -5
  485. package/dist/plugins/shims.d.ts.map +1 -1
  486. package/dist/plugins/static-build.d.ts +218 -21
  487. package/dist/plugins/static-build.d.ts.map +1 -1
  488. package/dist/routing/codegen-shared.d.ts +26 -0
  489. package/dist/routing/codegen-shared.d.ts.map +1 -0
  490. package/dist/routing/codegen-types.d.ts +61 -0
  491. package/dist/routing/codegen-types.d.ts.map +1 -0
  492. package/dist/routing/codegen-write.d.ts +51 -0
  493. package/dist/routing/codegen-write.d.ts.map +1 -0
  494. package/dist/routing/codegen.d.ts +8 -3
  495. package/dist/routing/codegen.d.ts.map +1 -1
  496. package/dist/routing/collision-probe.d.ts +104 -0
  497. package/dist/routing/collision-probe.d.ts.map +1 -0
  498. package/dist/routing/collision-spaces.d.ts +26 -0
  499. package/dist/routing/collision-spaces.d.ts.map +1 -0
  500. package/dist/routing/convention-lint.d.ts +55 -0
  501. package/dist/routing/convention-lint.d.ts.map +1 -0
  502. package/dist/routing/export-detect.d.ts +72 -0
  503. package/dist/routing/export-detect.d.ts.map +1 -0
  504. package/dist/routing/file-cache.d.ts +8 -0
  505. package/dist/routing/file-cache.d.ts.map +1 -0
  506. package/dist/routing/index.d.ts +13 -7
  507. package/dist/routing/index.d.ts.map +1 -1
  508. package/dist/routing/index.js +5 -2
  509. package/dist/routing/interception-overlap.d.ts +35 -0
  510. package/dist/routing/interception-overlap.d.ts.map +1 -0
  511. package/dist/routing/interception.d.ts +234 -10
  512. package/dist/routing/interception.d.ts.map +1 -1
  513. package/dist/routing/link-codegen.d.ts +105 -0
  514. package/dist/routing/link-codegen.d.ts.map +1 -0
  515. package/dist/routing/manifest-codegen.d.ts +26 -0
  516. package/dist/routing/manifest-codegen.d.ts.map +1 -0
  517. package/dist/routing/scanner.d.ts +14 -10
  518. package/dist/routing/scanner.d.ts.map +1 -1
  519. package/dist/routing/schema-validation.d.ts +35 -0
  520. package/dist/routing/schema-validation.d.ts.map +1 -0
  521. package/dist/routing/segment-classify.d.ts +114 -0
  522. package/dist/routing/segment-classify.d.ts.map +1 -0
  523. package/dist/routing/segment-codegen.d.ts +38 -0
  524. package/dist/routing/segment-codegen.d.ts.map +1 -0
  525. package/dist/routing/segment-keys.d.ts +118 -0
  526. package/dist/routing/segment-keys.d.ts.map +1 -0
  527. package/dist/routing/slot-placement.d.ts +48 -0
  528. package/dist/routing/slot-placement.d.ts.map +1 -0
  529. package/dist/routing/types.d.ts +74 -26
  530. package/dist/routing/types.d.ts.map +1 -1
  531. package/dist/routing/walkers.d.ts +57 -0
  532. package/dist/routing/walkers.d.ts.map +1 -0
  533. package/dist/rsc-runtime/rsc.d.ts +1 -1
  534. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  535. package/dist/rsc-runtime/ssr.d.ts +14 -0
  536. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  537. package/dist/rsc-runtime/transforms.d.ts +13 -0
  538. package/dist/rsc-runtime/transforms.d.ts.map +1 -0
  539. package/dist/schema-bridge.d.ts +145 -0
  540. package/dist/schema-bridge.d.ts.map +1 -0
  541. package/dist/search-params/define.d.ts +262 -0
  542. package/dist/search-params/define.d.ts.map +1 -0
  543. package/dist/search-params/index.d.ts +3 -7
  544. package/dist/search-params/index.d.ts.map +1 -1
  545. package/dist/search-params/index.js +179 -360
  546. package/dist/search-params/index.js.map +1 -1
  547. package/dist/search-params/parse-total.d.ts +81 -0
  548. package/dist/search-params/parse-total.d.ts.map +1 -0
  549. package/dist/search-params/serialize-equal.d.ts +9 -0
  550. package/dist/search-params/serialize-equal.d.ts.map +1 -0
  551. package/dist/search-params/wrappers.d.ts +76 -0
  552. package/dist/search-params/wrappers.d.ts.map +1 -0
  553. package/dist/server/access-gate.d.ts +98 -10
  554. package/dist/server/access-gate.d.ts.map +1 -1
  555. package/dist/server/action-client.d.ts +42 -7
  556. package/dist/server/action-client.d.ts.map +1 -1
  557. package/dist/server/action-encryption.d.ts +76 -0
  558. package/dist/server/action-encryption.d.ts.map +1 -0
  559. package/dist/server/action-handler.d.ts +39 -5
  560. package/dist/server/action-handler.d.ts.map +1 -1
  561. package/dist/server/actions.d.ts +29 -35
  562. package/dist/server/actions.d.ts.map +1 -1
  563. package/dist/server/als-registry.d.ts +117 -13
  564. package/dist/server/als-registry.d.ts.map +1 -1
  565. package/dist/server/asset-headers.d.ts +8 -18
  566. package/dist/server/asset-headers.d.ts.map +1 -1
  567. package/dist/server/body-limits.d.ts.map +1 -1
  568. package/dist/server/build-manifest.d.ts +25 -30
  569. package/dist/server/build-manifest.d.ts.map +1 -1
  570. package/dist/server/canonicalize.d.ts +10 -0
  571. package/dist/server/canonicalize.d.ts.map +1 -1
  572. package/dist/server/chain-url-parts.d.ts +82 -0
  573. package/dist/server/chain-url-parts.d.ts.map +1 -0
  574. package/dist/server/children-interception.d.ts +49 -0
  575. package/dist/server/children-interception.d.ts.map +1 -0
  576. package/dist/server/coalesce-tick.d.ts +40 -0
  577. package/dist/server/coalesce-tick.d.ts.map +1 -0
  578. package/dist/server/compress.d.ts.map +1 -1
  579. package/dist/server/cookie-context.d.ts +170 -0
  580. package/dist/server/cookie-context.d.ts.map +1 -0
  581. package/dist/server/cookie-parsing.d.ts +65 -0
  582. package/dist/server/cookie-parsing.d.ts.map +1 -0
  583. package/dist/server/csp-nonce.d.ts +45 -0
  584. package/dist/server/csp-nonce.d.ts.map +1 -0
  585. package/dist/server/csrf.d.ts +3 -2
  586. package/dist/server/csrf.d.ts.map +1 -1
  587. package/dist/server/debug.d.ts +82 -0
  588. package/dist/server/debug.d.ts.map +1 -0
  589. package/dist/server/default-logger.d.ts +22 -0
  590. package/dist/server/default-logger.d.ts.map +1 -0
  591. package/dist/server/default-status-page.d.ts +45 -0
  592. package/dist/server/default-status-page.d.ts.map +1 -0
  593. package/dist/server/deny-boundary.d.ts +253 -0
  594. package/dist/server/deny-boundary.d.ts.map +1 -0
  595. package/dist/server/deny-renderer.d.ts +20 -9
  596. package/dist/server/deny-renderer.d.ts.map +1 -1
  597. package/dist/server/dev-source-map.d.ts +22 -0
  598. package/dist/server/dev-source-map.d.ts.map +1 -0
  599. package/dist/server/early-hints-sender.d.ts.map +1 -1
  600. package/dist/server/early-hints.d.ts +14 -12
  601. package/dist/server/early-hints.d.ts.map +1 -1
  602. package/dist/server/error-boundary-wrapper.d.ts +101 -10
  603. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  604. package/dist/server/error-response-headers.d.ts +3 -0
  605. package/dist/server/error-response-headers.d.ts.map +1 -0
  606. package/dist/server/fallback-error.d.ts +12 -7
  607. package/dist/server/fallback-error.d.ts.map +1 -1
  608. package/dist/server/flight-injection-state.d.ts +66 -0
  609. package/dist/server/flight-injection-state.d.ts.map +1 -0
  610. package/dist/server/flight-scripts.d.ts +45 -0
  611. package/dist/server/flight-scripts.d.ts.map +1 -0
  612. package/dist/server/form-data.d.ts +41 -0
  613. package/dist/server/form-data.d.ts.map +1 -1
  614. package/dist/server/form-flash.d.ts +1 -1
  615. package/dist/server/head-response.d.ts +35 -0
  616. package/dist/server/head-response.d.ts.map +1 -0
  617. package/dist/server/html-injector-core.d.ts +257 -0
  618. package/dist/server/html-injector-core.d.ts.map +1 -0
  619. package/dist/server/html-injectors.d.ts +84 -42
  620. package/dist/server/html-injectors.d.ts.map +1 -1
  621. package/dist/server/index.d.ts +18 -54
  622. package/dist/server/index.d.ts.map +1 -1
  623. package/dist/server/index.js +212 -2930
  624. package/dist/server/index.js.map +1 -1
  625. package/dist/server/instrumentation.d.ts +1 -1
  626. package/dist/server/internal.d.ts +50 -0
  627. package/dist/server/internal.d.ts.map +1 -0
  628. package/dist/server/internal.js +4034 -0
  629. package/dist/server/internal.js.map +1 -0
  630. package/dist/server/logger.d.ts +39 -7
  631. package/dist/server/logger.d.ts.map +1 -1
  632. package/dist/server/metadata-collector.d.ts +71 -0
  633. package/dist/server/metadata-collector.d.ts.map +1 -0
  634. package/dist/server/metadata-platform.d.ts +2 -2
  635. package/dist/server/metadata-render.d.ts +2 -2
  636. package/dist/server/metadata-render.d.ts.map +1 -1
  637. package/dist/server/metadata-routes.d.ts +60 -11
  638. package/dist/server/metadata-routes.d.ts.map +1 -1
  639. package/dist/server/metadata-social.d.ts +2 -2
  640. package/dist/server/metadata.d.ts +10 -2
  641. package/dist/server/metadata.d.ts.map +1 -1
  642. package/dist/server/middleware-runner.d.ts +20 -5
  643. package/dist/server/middleware-runner.d.ts.map +1 -1
  644. package/dist/server/node-stream-transforms.d.ts +105 -0
  645. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  646. package/dist/server/nuqs-ssr-provider.d.ts +7 -3
  647. package/dist/server/nuqs-ssr-provider.d.ts.map +1 -1
  648. package/dist/server/param-coercion.d.ts +78 -0
  649. package/dist/server/param-coercion.d.ts.map +1 -0
  650. package/dist/server/pipeline-helpers.d.ts +77 -0
  651. package/dist/server/pipeline-helpers.d.ts.map +1 -0
  652. package/dist/server/pipeline-interception.d.ts +59 -9
  653. package/dist/server/pipeline-interception.d.ts.map +1 -1
  654. package/dist/server/pipeline-metadata.d.ts +7 -1
  655. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  656. package/dist/server/pipeline-outcome.d.ts +49 -0
  657. package/dist/server/pipeline-outcome.d.ts.map +1 -0
  658. package/dist/server/pipeline-phases.d.ts +70 -0
  659. package/dist/server/pipeline-phases.d.ts.map +1 -0
  660. package/dist/server/pipeline.d.ts +160 -24
  661. package/dist/server/pipeline.d.ts.map +1 -1
  662. package/dist/server/port-resolution.d.ts +31 -0
  663. package/dist/server/port-resolution.d.ts.map +1 -0
  664. package/dist/server/prebuilt/cache-key.d.ts +63 -0
  665. package/dist/server/prebuilt/cache-key.d.ts.map +1 -0
  666. package/dist/server/prebuilt/capture-state.d.ts +57 -0
  667. package/dist/server/prebuilt/capture-state.d.ts.map +1 -0
  668. package/dist/server/prebuilt/key-discipline.d.ts +52 -0
  669. package/dist/server/prebuilt/key-discipline.d.ts.map +1 -0
  670. package/dist/server/prebuilt/manifest-tag-index.d.ts +27 -0
  671. package/dist/server/prebuilt/manifest-tag-index.d.ts.map +1 -0
  672. package/dist/server/prebuilt/overlay.d.ts +100 -0
  673. package/dist/server/prebuilt/overlay.d.ts.map +1 -0
  674. package/dist/server/prebuilt/payload-source.d.ts +79 -0
  675. package/dist/server/prebuilt/payload-source.d.ts.map +1 -0
  676. package/dist/server/prebuilt/slots.d.ts +99 -0
  677. package/dist/server/prebuilt/slots.d.ts.map +1 -0
  678. package/dist/server/prebuilt/synthetic-store.d.ts +67 -0
  679. package/dist/server/prebuilt/synthetic-store.d.ts.map +1 -0
  680. package/dist/server/prebuilt-builder.d.ts +121 -0
  681. package/dist/server/prebuilt-builder.d.ts.map +1 -0
  682. package/dist/server/prebuilt-runtime.d.ts +111 -0
  683. package/dist/server/prebuilt-runtime.d.ts.map +1 -0
  684. package/dist/server/primitives.d.ts +129 -45
  685. package/dist/server/primitives.d.ts.map +1 -1
  686. package/dist/server/publish-params.d.ts +33 -0
  687. package/dist/server/publish-params.d.ts.map +1 -0
  688. package/dist/server/render-timeout.d.ts +51 -0
  689. package/dist/server/render-timeout.d.ts.map +1 -0
  690. package/dist/server/render-utils.d.ts +26 -0
  691. package/dist/server/render-utils.d.ts.map +1 -0
  692. package/dist/server/request-context.d.ts +111 -107
  693. package/dist/server/request-context.d.ts.map +1 -1
  694. package/dist/server/request-dep.d.ts +15 -0
  695. package/dist/server/request-dep.d.ts.map +1 -0
  696. package/dist/server/response-cache-policy.d.ts +3 -0
  697. package/dist/server/response-cache-policy.d.ts.map +1 -0
  698. package/dist/server/route-element-builder.d.ts +57 -30
  699. package/dist/server/route-element-builder.d.ts.map +1 -1
  700. package/dist/server/route-element-helpers.d.ts +12 -0
  701. package/dist/server/route-element-helpers.d.ts.map +1 -0
  702. package/dist/server/route-handler.d.ts +1 -1
  703. package/dist/server/route-handler.d.ts.map +1 -1
  704. package/dist/server/route-matcher.d.ts +40 -38
  705. package/dist/server/route-matcher.d.ts.map +1 -1
  706. package/dist/server/route-module-loader.d.ts +37 -0
  707. package/dist/server/route-module-loader.d.ts.map +1 -0
  708. package/dist/server/rsc-cache-key-guard.d.ts +78 -0
  709. package/dist/server/rsc-cache-key-guard.d.ts.map +1 -0
  710. package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
  711. package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
  712. package/dist/server/rsc-entry/api-handler.d.ts +12 -3
  713. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  714. package/dist/server/rsc-entry/deny-fallback.d.ts +29 -0
  715. package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -0
  716. package/dist/server/rsc-entry/error-renderer.d.ts +38 -13
  717. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  718. package/dist/server/rsc-entry/helpers.d.ts +59 -42
  719. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  720. package/dist/server/rsc-entry/index.d.ts +40 -6
  721. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  722. package/dist/server/rsc-entry/render-route.d.ts +51 -0
  723. package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
  724. package/dist/server/rsc-entry/revalidate-renderer.d.ts +108 -0
  725. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
  726. package/dist/server/rsc-entry/rsc-payload.d.ts +26 -6
  727. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  728. package/dist/server/rsc-entry/rsc-stream.d.ts +39 -3
  729. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  730. package/dist/server/rsc-entry/ssr-bridge.d.ts +5 -1
  731. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  732. package/dist/server/rsc-entry/ssr-renderer.d.ts +37 -5
  733. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  734. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +89 -0
  735. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
  736. package/dist/server/rsc-error-envelope.d.ts +11 -0
  737. package/dist/server/rsc-error-envelope.d.ts.map +1 -0
  738. package/dist/server/rsc-prop-warnings.d.ts.map +1 -1
  739. package/dist/server/safe-load.d.ts +46 -0
  740. package/dist/server/safe-load.d.ts.map +1 -0
  741. package/dist/server/sensitive-fields.d.ts +74 -0
  742. package/dist/server/sensitive-fields.d.ts.map +1 -0
  743. package/dist/server/sitemap-generator.d.ts +130 -0
  744. package/dist/server/sitemap-generator.d.ts.map +1 -0
  745. package/dist/server/sitemap-handler.d.ts +22 -0
  746. package/dist/server/sitemap-handler.d.ts.map +1 -0
  747. package/dist/server/skippable-prefix.d.ts +29 -0
  748. package/dist/server/skippable-prefix.d.ts.map +1 -0
  749. package/dist/server/slot-interception.d.ts +80 -0
  750. package/dist/server/slot-interception.d.ts.map +1 -0
  751. package/dist/server/slot-resolver.d.ts +137 -7
  752. package/dist/server/slot-resolver.d.ts.map +1 -1
  753. package/dist/server/slot-subtree-contain.d.ts +54 -0
  754. package/dist/server/slot-subtree-contain.d.ts.map +1 -0
  755. package/dist/server/ssr-bridge-types.d.ts +160 -0
  756. package/dist/server/ssr-bridge-types.d.ts.map +1 -0
  757. package/dist/server/ssr-entry.d.ts +1 -43
  758. package/dist/server/ssr-entry.d.ts.map +1 -1
  759. package/dist/server/ssr-render.d.ts +69 -22
  760. package/dist/server/ssr-render.d.ts.map +1 -1
  761. package/dist/server/ssr-wrappers.d.ts +93 -0
  762. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  763. package/dist/server/state-tree-diff.d.ts +44 -9
  764. package/dist/server/state-tree-diff.d.ts.map +1 -1
  765. package/dist/server/static-generator.d.ts +112 -0
  766. package/dist/server/static-generator.d.ts.map +1 -0
  767. package/dist/server/static-not-found.d.ts +52 -0
  768. package/dist/server/static-not-found.d.ts.map +1 -0
  769. package/dist/server/status-code-resolver.d.ts +26 -15
  770. package/dist/server/status-code-resolver.d.ts.map +1 -1
  771. package/dist/server/stream-utils.d.ts +47 -0
  772. package/dist/server/stream-utils.d.ts.map +1 -0
  773. package/dist/server/tracing.d.ts +56 -11
  774. package/dist/server/tracing.d.ts.map +1 -1
  775. package/dist/server/tree-match.d.ts +49 -0
  776. package/dist/server/tree-match.d.ts.map +1 -0
  777. package/dist/server/types.d.ts +88 -7
  778. package/dist/server/types.d.ts.map +1 -1
  779. package/dist/server/utils/element-type.d.ts +50 -0
  780. package/dist/server/utils/element-type.d.ts.map +1 -0
  781. package/dist/server/utils/escape-html.d.ts +14 -0
  782. package/dist/server/utils/escape-html.d.ts.map +1 -0
  783. package/dist/server/utils/mdx-file.d.ts +17 -0
  784. package/dist/server/utils/mdx-file.d.ts.map +1 -0
  785. package/dist/server/version-skew.d.ts +61 -0
  786. package/dist/server/version-skew.d.ts.map +1 -0
  787. package/dist/server/waituntil-bridge.d.ts.map +1 -1
  788. package/dist/server/workers-cache-bridge.d.ts +26 -0
  789. package/dist/server/workers-cache-bridge.d.ts.map +1 -0
  790. package/dist/shared/als-slots.d.ts +42 -0
  791. package/dist/shared/als-slots.d.ts.map +1 -0
  792. package/dist/shared/base-path.d.ts +56 -0
  793. package/dist/shared/base-path.d.ts.map +1 -0
  794. package/dist/shared/href-validation.d.ts +49 -0
  795. package/dist/shared/href-validation.d.ts.map +1 -0
  796. package/dist/shared/merge-search-params.d.ts +22 -0
  797. package/dist/shared/merge-search-params.d.ts.map +1 -0
  798. package/dist/shared/param-value.d.ts +104 -0
  799. package/dist/shared/param-value.d.ts.map +1 -0
  800. package/dist/shared/payload-root.d.ts +109 -0
  801. package/dist/shared/payload-root.d.ts.map +1 -0
  802. package/dist/shared/redirect-type.d.ts +17 -0
  803. package/dist/shared/redirect-type.d.ts.map +1 -0
  804. package/dist/shared/rsc-cache-key.d.ts +163 -0
  805. package/dist/shared/rsc-cache-key.d.ts.map +1 -0
  806. package/dist/shared/rsc-error-envelope.d.ts +16 -0
  807. package/dist/shared/rsc-error-envelope.d.ts.map +1 -0
  808. package/dist/shared/rsc-manifest.d.ts +28 -0
  809. package/dist/shared/rsc-manifest.d.ts.map +1 -0
  810. package/dist/shared/rsc-media-type.d.ts +52 -0
  811. package/dist/shared/rsc-media-type.d.ts.map +1 -0
  812. package/dist/shared/rsc-payload-path.d.ts +42 -0
  813. package/dist/shared/rsc-payload-path.d.ts.map +1 -0
  814. package/dist/shared/segment-info.d.ts +66 -0
  815. package/dist/shared/segment-info.d.ts.map +1 -0
  816. package/dist/shared/slot-params.d.ts +52 -0
  817. package/dist/shared/slot-params.d.ts.map +1 -0
  818. package/dist/shared/static-platform-files.d.ts +71 -0
  819. package/dist/shared/static-platform-files.d.ts.map +1 -0
  820. package/dist/shared/status-reason-phrase.d.ts +26 -0
  821. package/dist/shared/status-reason-phrase.d.ts.map +1 -0
  822. package/dist/shims/font-google.d.ts +1 -1
  823. package/dist/shims/font-google.d.ts.map +1 -1
  824. package/dist/shims/font-google.js +42 -0
  825. package/dist/shims/font-google.js.map +1 -0
  826. package/dist/shims/font-local.d.ts +26 -0
  827. package/dist/shims/font-local.d.ts.map +1 -0
  828. package/dist/shims/font-local.js +20 -0
  829. package/dist/shims/font-local.js.map +1 -0
  830. package/dist/shims/headers.d.ts +53 -1
  831. package/dist/shims/headers.d.ts.map +1 -1
  832. package/dist/shims/image.d.ts +120 -120
  833. package/dist/shims/image.d.ts.map +1 -1
  834. package/dist/shims/navigation-client.d.ts +25 -12
  835. package/dist/shims/navigation-client.d.ts.map +1 -1
  836. package/dist/shims/navigation-rsc.d.ts +21 -0
  837. package/dist/shims/navigation-rsc.d.ts.map +1 -0
  838. package/dist/shims/navigation.d.ts +10 -5
  839. package/dist/shims/navigation.d.ts.map +1 -1
  840. package/dist/utils/state-machine.d.ts +80 -0
  841. package/dist/utils/state-machine.d.ts.map +1 -0
  842. package/docs/api/30-api-server.mdx +236 -0
  843. package/docs/api/31-api-client.mdx +167 -0
  844. package/docs/api/32-api-cache.mdx +311 -0
  845. package/docs/api/33-api-search-params.mdx +176 -0
  846. package/docs/api/34-api-config.mdx +329 -0
  847. package/docs/api/35-api-typescript.mdx +91 -0
  848. package/docs/api/36-cli.mdx +192 -0
  849. package/docs/learn/00-introduction.mdx +109 -0
  850. package/docs/learn/01-quick-start.mdx +94 -0
  851. package/docs/learn/02-pages-and-layouts.mdx +147 -0
  852. package/docs/learn/03-fetching-data.mdx +211 -0
  853. package/docs/learn/04-access-control.mdx +115 -0
  854. package/docs/learn/05-the-flush-point.mdx +175 -0
  855. package/docs/learn/06-typed-params.mdx +275 -0
  856. package/docs/learn/07-typed-routes.mdx +108 -0
  857. package/docs/learn/08-forms-and-actions.mdx +146 -0
  858. package/docs/learn/09-streaming.mdx +140 -0
  859. package/docs/learn/10-caching.mdx +252 -0
  860. package/docs/learn/11-middleware.mdx +158 -0
  861. package/docs/learn/12-error-handling.mdx +188 -0
  862. package/docs/learn/13-deploying.mdx +287 -0
  863. package/llms.txt +55 -0
  864. package/package.json +117 -29
  865. package/src/adapters/build-output-helper.ts +351 -0
  866. package/src/adapters/cloudflare-dev.ts +183 -0
  867. package/src/adapters/cloudflare-kv-cache.ts +207 -0
  868. package/src/adapters/cloudflare.ts +747 -130
  869. package/src/adapters/compress-module.ts +101 -88
  870. package/src/adapters/fs-identity.ts +156 -0
  871. package/src/adapters/nitro-presets.ts +139 -0
  872. package/src/adapters/nitro-preview.ts +340 -0
  873. package/src/adapters/nitro.ts +279 -418
  874. package/src/adapters/raw-imports.d.ts +5 -0
  875. package/src/adapters/shared.ts +274 -0
  876. package/src/adapters/types.ts +28 -7
  877. package/src/adapters/wrangler.d.ts +7 -0
  878. package/src/analyze/chains.ts +411 -0
  879. package/src/analyze/classify.ts +258 -0
  880. package/src/analyze/crawl-entry.ts +68 -0
  881. package/src/analyze/crawl.ts +500 -0
  882. package/src/analyze/graph-cache.ts +332 -0
  883. package/src/analyze/graph-command.ts +762 -0
  884. package/src/analyze/live-graph.ts +232 -0
  885. package/src/analyze/poison-rules.ts +165 -0
  886. package/src/analyze/poison-scan.ts +162 -0
  887. package/src/analyze/scan.ts +149 -0
  888. package/src/cache/cache-api.ts +107 -0
  889. package/src/cache/fast-hash.ts +39 -0
  890. package/src/cache/handler-store.ts +76 -0
  891. package/src/cache/index.ts +115 -22
  892. package/src/cache/invalidation-epoch.ts +93 -0
  893. package/src/cache/json-lossy-check.ts +75 -0
  894. package/src/cache/redis-handler.ts +198 -20
  895. package/src/cache/singleflight.ts +69 -6
  896. package/src/cache/sizeof.ts +33 -0
  897. package/src/cache/stable-stringify.ts +65 -2
  898. package/src/cache/store.ts +71 -0
  899. package/src/cache/stores/cloudflare-kv.ts +52 -0
  900. package/src/cache/stores/memory.ts +125 -0
  901. package/src/cache/stores/redis.ts +97 -0
  902. package/src/cache/stores/vercel.ts +59 -0
  903. package/src/cache/tag-aware-handler.ts +237 -0
  904. package/src/cache/timber-cache.ts +180 -48
  905. package/src/cdn/cloudflare-purge.ts +50 -0
  906. package/src/cdn/fastly-purge.ts +63 -0
  907. package/src/cdn/headers.ts +153 -0
  908. package/src/cdn/index.ts +23 -0
  909. package/src/cdn/purge-store.ts +34 -0
  910. package/src/cdn/workers-cache-purge.ts +34 -0
  911. package/src/cli-check.ts +507 -0
  912. package/src/cli-schema-sync.ts +401 -0
  913. package/src/cli.ts +262 -55
  914. package/src/client/browser-dev.ts +157 -2
  915. package/src/client/browser-entry/action-dispatch.ts +197 -0
  916. package/src/client/browser-entry/action-queue.ts +90 -0
  917. package/src/client/browser-entry/hmr.ts +70 -0
  918. package/src/client/browser-entry/hydrate.ts +148 -0
  919. package/src/client/browser-entry/index.ts +131 -0
  920. package/src/client/browser-entry/post-hydration.ts +123 -0
  921. package/src/client/browser-entry/router-init.ts +418 -0
  922. package/src/client/browser-entry/rsc-stream.ts +166 -0
  923. package/src/client/browser-entry/scroll.ts +50 -0
  924. package/src/client/deny-last-resort.tsx +54 -0
  925. package/src/client/error-boundary.tsx +316 -40
  926. package/src/client/error-reconstituter.tsx +79 -0
  927. package/src/client/form.tsx +36 -32
  928. package/src/client/global-context.ts +31 -0
  929. package/src/client/history.ts +81 -10
  930. package/src/client/index.ts +89 -53
  931. package/src/client/internal.ts +59 -0
  932. package/src/client/link.tsx +452 -159
  933. package/src/client/location-search.ts +15 -0
  934. package/src/client/navigation-api.ts +347 -0
  935. package/src/client/navigation-commit.ts +295 -0
  936. package/src/client/navigation-context.ts +67 -98
  937. package/src/client/navigation-root.tsx +224 -0
  938. package/src/client/navigation-transition.ts +327 -0
  939. package/src/client/nuqs-adapter.tsx +21 -9
  940. package/src/client/params-context.ts +187 -0
  941. package/src/client/react-root.ts +72 -0
  942. package/src/client/router-effects.ts +228 -0
  943. package/src/client/router-lifecycle.ts +354 -0
  944. package/src/client/router-pipeline.ts +490 -0
  945. package/src/client/router-ref.ts +3 -3
  946. package/src/client/router-skew.ts +30 -0
  947. package/src/client/router-types.ts +294 -0
  948. package/src/client/router.ts +436 -424
  949. package/src/client/rsc-fetch.ts +512 -73
  950. package/src/client/segment-cache.ts +327 -40
  951. package/src/client/segment-context.ts +13 -5
  952. package/src/client/segment-outlet.tsx +96 -0
  953. package/src/client/segment-update-context.ts +23 -0
  954. package/src/client/shallow-url.ts +22 -0
  955. package/src/client/slot-content-cache-context.ts +43 -0
  956. package/src/client/slot-context.ts +50 -0
  957. package/src/client/slot-outlet.tsx +22 -0
  958. package/src/client/slot-provider.tsx +32 -0
  959. package/src/client/ssr-data.ts +30 -9
  960. package/src/client/stale-client.ts +191 -0
  961. package/src/client/state.ts +29 -15
  962. package/src/client/status-page-marker.tsx +32 -0
  963. package/src/client/top-loader.tsx +36 -29
  964. package/src/client/unload-guard.ts +35 -3
  965. package/src/client/use-cookie.ts +70 -18
  966. package/src/client/use-link-status.ts +7 -7
  967. package/src/client/use-pathname.ts +22 -31
  968. package/src/client/use-pending-navigation.ts +40 -0
  969. package/src/client/use-query-states.ts +206 -36
  970. package/src/client/use-router.ts +6 -3
  971. package/src/client/use-search-params.ts +38 -49
  972. package/src/client/use-segment-params.ts +69 -0
  973. package/src/client/use-selected-layout-segment.ts +2 -2
  974. package/src/codec.ts +149 -0
  975. package/src/config-types.ts +322 -0
  976. package/src/config-validation.ts +347 -0
  977. package/src/cookies/define-cookie.ts +222 -53
  978. package/src/cookies/index.ts +13 -2
  979. package/src/cookies/json-cookie.ts +105 -0
  980. package/src/cookies/validation.ts +192 -0
  981. package/src/dev-tools/404-page.ts +286 -0
  982. package/src/dev-tools/browser-logs.ts +55 -0
  983. package/src/dev-tools/dev-page-shell.ts +260 -0
  984. package/src/dev-tools/error-page.ts +331 -0
  985. package/src/dev-tools/holding-server.ts +185 -0
  986. package/src/dev-tools/hydration-overlay.ts +158 -0
  987. package/src/dev-tools/index.ts +83 -0
  988. package/src/dev-tools/instrumentation.ts +213 -0
  989. package/src/{server/dev-logger.ts → dev-tools/logger.ts} +33 -51
  990. package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +122 -26
  991. package/src/dev-tools/overlay.ts +469 -0
  992. package/src/dev-tools/stack-classifier.ts +75 -0
  993. package/src/dev-tools/terminal.ts +182 -0
  994. package/src/fonts/ast-walk.ts +235 -0
  995. package/src/fonts/ast.ts +479 -128
  996. package/src/fonts/bundle.ts +138 -0
  997. package/src/fonts/css.ts +3 -2
  998. package/src/fonts/dev-middleware.ts +85 -0
  999. package/src/fonts/fallbacks.ts +0 -23
  1000. package/src/fonts/google.ts +101 -19
  1001. package/src/fonts/local.ts +13 -8
  1002. package/src/fonts/paths.ts +58 -0
  1003. package/src/fonts/pipeline.ts +348 -0
  1004. package/src/fonts/transform.ts +311 -0
  1005. package/src/fonts/types.ts +52 -1
  1006. package/src/fonts/virtual-modules.ts +179 -0
  1007. package/src/index.ts +486 -344
  1008. package/src/params/codec-registry.ts +34 -0
  1009. package/src/params/define-schema.ts +115 -0
  1010. package/src/params/index.ts +17 -0
  1011. package/src/params/resolve-schema.ts +84 -0
  1012. package/src/plugin-context.ts +503 -0
  1013. package/src/plugins/adapter-build.ts +229 -7
  1014. package/src/plugins/build-manifest.ts +201 -26
  1015. package/src/plugins/build-report.ts +275 -43
  1016. package/src/plugins/cache.ts +243 -0
  1017. package/src/plugins/callsite-ast.ts +472 -0
  1018. package/src/plugins/callsite-jsx.ts +243 -0
  1019. package/src/plugins/chunks.ts +74 -5
  1020. package/src/plugins/client-chunks.ts +185 -0
  1021. package/src/plugins/cloudflare-wasm.ts +141 -0
  1022. package/src/plugins/content.ts +5 -1
  1023. package/src/plugins/dev-discovery.ts +218 -0
  1024. package/src/plugins/dev-server.ts +369 -96
  1025. package/src/plugins/entries.ts +148 -18
  1026. package/src/plugins/fonts.ts +251 -524
  1027. package/src/plugins/graph-endpoint.ts +532 -0
  1028. package/src/plugins/mdx.ts +116 -40
  1029. package/src/plugins/prebuilt-capture.ts +217 -0
  1030. package/src/plugins/prebuilt-options-analysis.ts +175 -0
  1031. package/src/plugins/prebuilt.ts +655 -0
  1032. package/src/plugins/prerender-sugar.ts +320 -0
  1033. package/src/plugins/request-dep/analysis.ts +447 -0
  1034. package/src/plugins/request-dep/index.ts +376 -0
  1035. package/src/plugins/request-dep/origin.ts +310 -0
  1036. package/src/plugins/routing.ts +273 -277
  1037. package/src/plugins/server-bundle.ts +103 -14
  1038. package/src/plugins/shims.ts +259 -97
  1039. package/src/plugins/static-build.ts +708 -66
  1040. package/src/react-canary.d.ts +2 -0
  1041. package/src/routing/codegen-shared.ts +39 -0
  1042. package/src/routing/codegen-types.ts +62 -0
  1043. package/src/routing/codegen-write.ts +141 -0
  1044. package/src/routing/codegen.ts +349 -232
  1045. package/src/routing/collision-probe.ts +438 -0
  1046. package/src/routing/collision-spaces.ts +281 -0
  1047. package/src/routing/convention-lint.ts +623 -0
  1048. package/src/routing/export-detect.ts +448 -0
  1049. package/src/routing/file-cache.ts +23 -0
  1050. package/src/routing/index.ts +16 -7
  1051. package/src/routing/interception-overlap.ts +141 -0
  1052. package/src/routing/interception.ts +1044 -67
  1053. package/src/routing/link-codegen.ts +280 -0
  1054. package/src/routing/manifest-codegen.ts +226 -0
  1055. package/src/routing/scanner.ts +393 -219
  1056. package/src/routing/schema-validation.ts +155 -0
  1057. package/src/routing/segment-classify.ts +280 -0
  1058. package/src/routing/segment-codegen.ts +98 -0
  1059. package/src/routing/segment-keys.ts +186 -0
  1060. package/src/routing/slot-placement.ts +97 -0
  1061. package/src/routing/types.ts +75 -26
  1062. package/src/routing/walkers.ts +98 -0
  1063. package/src/rsc-runtime/rsc.ts +9 -0
  1064. package/src/rsc-runtime/ssr.ts +51 -0
  1065. package/src/rsc-runtime/transforms.ts +13 -0
  1066. package/src/rsc-runtime/vendor-types.d.ts +19 -0
  1067. package/src/schema-bridge.ts +380 -0
  1068. package/src/search-params/define.ts +677 -0
  1069. package/src/search-params/index.ts +14 -20
  1070. package/src/search-params/parse-total.ts +91 -0
  1071. package/src/search-params/serialize-equal.ts +14 -0
  1072. package/src/search-params/wrappers.ts +150 -0
  1073. package/src/server/access-gate.tsx +196 -57
  1074. package/src/server/action-client.ts +136 -35
  1075. package/src/server/action-encryption.ts +144 -0
  1076. package/src/server/action-handler.ts +256 -56
  1077. package/src/server/actions.ts +112 -68
  1078. package/src/server/als-registry.ts +160 -21
  1079. package/src/server/asset-headers.ts +15 -37
  1080. package/src/server/body-limits.ts +10 -2
  1081. package/src/server/build-manifest.ts +33 -57
  1082. package/src/server/canonicalize.ts +6 -3
  1083. package/src/server/chain-url-parts.ts +163 -0
  1084. package/src/server/children-interception.ts +115 -0
  1085. package/src/server/coalesce-tick.ts +75 -0
  1086. package/src/server/compress.ts +43 -8
  1087. package/src/server/cookie-context.ts +484 -0
  1088. package/src/server/cookie-parsing.ts +163 -0
  1089. package/src/server/csp-nonce.ts +70 -0
  1090. package/src/server/csrf.ts +39 -6
  1091. package/src/server/debug.ts +137 -0
  1092. package/src/server/default-logger.ts +99 -0
  1093. package/src/server/default-status-page.ts +88 -0
  1094. package/src/server/deny-boundary.ts +533 -0
  1095. package/src/server/deny-renderer.ts +214 -112
  1096. package/src/server/dev-source-map.ts +31 -0
  1097. package/src/server/early-hints-sender.ts +4 -3
  1098. package/src/server/early-hints.ts +39 -29
  1099. package/src/server/error-boundary-wrapper.ts +181 -44
  1100. package/src/server/error-response-headers.ts +18 -0
  1101. package/src/server/fallback-error.ts +79 -102
  1102. package/src/server/flight-injection-state.ts +113 -0
  1103. package/src/server/flight-scripts.ts +67 -0
  1104. package/src/server/form-data.ts +124 -12
  1105. package/src/server/form-flash.ts +2 -2
  1106. package/src/server/head-response.ts +54 -0
  1107. package/src/server/html-injector-core.ts +512 -0
  1108. package/src/server/html-injectors.ts +272 -235
  1109. package/src/server/index.ts +40 -192
  1110. package/src/server/instrumentation.ts +1 -1
  1111. package/src/server/internal.ts +173 -0
  1112. package/src/server/logger.ts +73 -36
  1113. package/src/server/metadata-collector.ts +174 -0
  1114. package/src/server/metadata-platform.ts +2 -2
  1115. package/src/server/metadata-render.ts +30 -8
  1116. package/src/server/metadata-routes.ts +205 -24
  1117. package/src/server/metadata-social.ts +2 -2
  1118. package/src/server/metadata.ts +23 -2
  1119. package/src/server/middleware-runner.ts +32 -5
  1120. package/src/server/node-stream-transforms.ts +323 -0
  1121. package/src/server/nuqs-ssr-provider.tsx +8 -7
  1122. package/src/server/param-coercion.ts +198 -0
  1123. package/src/server/pipeline-helpers.ts +159 -0
  1124. package/src/server/pipeline-interception.ts +109 -33
  1125. package/src/server/pipeline-metadata.ts +15 -1
  1126. package/src/server/pipeline-outcome.ts +218 -0
  1127. package/src/server/pipeline-phases.ts +606 -0
  1128. package/src/server/pipeline.ts +343 -389
  1129. package/src/server/port-resolution.ts +53 -0
  1130. package/src/server/prebuilt/cache-key.ts +299 -0
  1131. package/src/server/prebuilt/capture-state.ts +89 -0
  1132. package/src/server/prebuilt/key-discipline.ts +122 -0
  1133. package/src/server/prebuilt/manifest-tag-index.ts +46 -0
  1134. package/src/server/prebuilt/overlay.ts +256 -0
  1135. package/src/server/prebuilt/payload-source.ts +202 -0
  1136. package/src/server/prebuilt/slots.ts +190 -0
  1137. package/src/server/prebuilt/synthetic-store.ts +122 -0
  1138. package/src/server/prebuilt-builder.ts +804 -0
  1139. package/src/server/prebuilt-runtime.ts +817 -0
  1140. package/src/server/primitives.ts +246 -97
  1141. package/src/server/publish-params.ts +42 -0
  1142. package/src/server/render-timeout.ts +108 -0
  1143. package/src/server/render-utils.ts +35 -0
  1144. package/src/server/request-context.ts +244 -333
  1145. package/src/server/request-dep.ts +37 -0
  1146. package/src/server/response-cache-policy.ts +45 -0
  1147. package/src/server/route-element-builder.ts +508 -360
  1148. package/src/server/route-element-helpers.ts +37 -0
  1149. package/src/server/route-handler.ts +40 -13
  1150. package/src/server/route-matcher.ts +165 -272
  1151. package/src/server/route-module-loader.ts +161 -0
  1152. package/src/server/rsc-cache-key-guard.ts +122 -0
  1153. package/src/server/rsc-entry/action-middleware-runner.ts +174 -0
  1154. package/src/server/rsc-entry/api-handler.ts +78 -34
  1155. package/src/server/rsc-entry/deny-fallback.ts +93 -0
  1156. package/src/server/rsc-entry/error-renderer.ts +373 -95
  1157. package/src/server/rsc-entry/helpers.ts +226 -95
  1158. package/src/server/rsc-entry/index.ts +405 -323
  1159. package/src/server/rsc-entry/render-route.ts +304 -0
  1160. package/src/server/rsc-entry/revalidate-renderer.ts +350 -0
  1161. package/src/server/rsc-entry/rsc-payload.ts +239 -50
  1162. package/src/server/rsc-entry/rsc-stream.ts +160 -30
  1163. package/src/server/rsc-entry/ssr-bridge.ts +18 -5
  1164. package/src/server/rsc-entry/ssr-renderer.ts +315 -57
  1165. package/src/server/rsc-entry/wrap-action-dispatch.ts +186 -0
  1166. package/src/server/rsc-error-envelope.ts +18 -0
  1167. package/src/server/rsc-prop-warnings.ts +3 -1
  1168. package/src/server/safe-load.ts +60 -0
  1169. package/src/server/sensitive-fields.ts +230 -0
  1170. package/src/server/server-only-guard-noop.js +3 -0
  1171. package/src/server/server-timing.ts +1 -1
  1172. package/src/server/sitemap-generator.ts +337 -0
  1173. package/src/server/sitemap-handler.ts +157 -0
  1174. package/src/server/skippable-prefix.ts +172 -0
  1175. package/src/server/slot-interception.ts +168 -0
  1176. package/src/server/slot-resolver.ts +707 -300
  1177. package/src/server/slot-subtree-contain.ts +255 -0
  1178. package/src/server/ssr-bridge-types.ts +165 -0
  1179. package/src/server/ssr-entry.ts +230 -85
  1180. package/src/server/ssr-render.ts +357 -85
  1181. package/src/server/ssr-wrappers.tsx +162 -0
  1182. package/src/server/state-tree-diff.ts +85 -30
  1183. package/src/server/static-generator.ts +715 -0
  1184. package/src/server/static-not-found.ts +134 -0
  1185. package/src/server/status-code-resolver.ts +107 -148
  1186. package/src/server/stream-utils.ts +292 -0
  1187. package/src/server/tracing.ts +151 -16
  1188. package/src/server/tree-match.ts +262 -0
  1189. package/src/server/types.ts +95 -10
  1190. package/src/server/utils/element-type.ts +88 -0
  1191. package/src/server/utils/escape-html.ts +20 -0
  1192. package/src/server/utils/mdx-file.ts +22 -0
  1193. package/src/server/version-skew.ts +104 -0
  1194. package/src/server/waituntil-bridge.ts +5 -2
  1195. package/src/server/workers-cache-bridge.ts +33 -0
  1196. package/src/shared/als-slots.ts +74 -0
  1197. package/src/shared/base-path.ts +80 -0
  1198. package/src/shared/href-validation.ts +159 -0
  1199. package/src/shared/merge-search-params.ts +55 -0
  1200. package/src/shared/param-value.ts +281 -0
  1201. package/src/shared/payload-root.ts +152 -0
  1202. package/src/shared/redirect-type.ts +17 -0
  1203. package/src/shared/rsc-cache-key.ts +269 -0
  1204. package/src/shared/rsc-error-envelope.ts +16 -0
  1205. package/src/shared/rsc-manifest.ts +29 -0
  1206. package/src/shared/rsc-media-type.ts +59 -0
  1207. package/src/shared/rsc-payload-path.ts +45 -0
  1208. package/src/shared/segment-info.ts +67 -0
  1209. package/src/shared/slot-params.ts +109 -0
  1210. package/src/shared/static-platform-files.ts +75 -0
  1211. package/src/shared/status-reason-phrase.ts +61 -0
  1212. package/src/shims/font-google.ts +1 -1
  1213. package/src/shims/font-local.ts +34 -0
  1214. package/src/shims/headers.ts +122 -1
  1215. package/src/shims/navigation-client.ts +36 -32
  1216. package/src/shims/navigation-rsc.ts +47 -0
  1217. package/src/shims/navigation.ts +10 -7
  1218. package/src/utils/state-machine.ts +111 -0
  1219. package/dist/_chunks/als-registry-k-AtAQ9R.js +0 -41
  1220. package/dist/_chunks/als-registry-k-AtAQ9R.js.map +0 -1
  1221. package/dist/_chunks/format-DNt20Kt8.js +0 -163
  1222. package/dist/_chunks/format-DNt20Kt8.js.map +0 -1
  1223. package/dist/_chunks/interception-DGDIjDbR.js +0 -676
  1224. package/dist/_chunks/interception-DGDIjDbR.js.map +0 -1
  1225. package/dist/_chunks/metadata-routes-CQCnF4VK.js +0 -153
  1226. package/dist/_chunks/metadata-routes-CQCnF4VK.js.map +0 -1
  1227. package/dist/_chunks/request-context-CRj2Zh1E.js +0 -329
  1228. package/dist/_chunks/request-context-CRj2Zh1E.js.map +0 -1
  1229. package/dist/_chunks/ssr-data-DLnbYpj1.js.map +0 -1
  1230. package/dist/_chunks/tracing-DF0G3FB7.js +0 -173
  1231. package/dist/_chunks/tracing-DF0G3FB7.js.map +0 -1
  1232. package/dist/_chunks/use-cookie-dDbpCTx-.js +0 -91
  1233. package/dist/_chunks/use-cookie-dDbpCTx-.js.map +0 -1
  1234. package/dist/_chunks/use-query-states-DAhgj8Gx.js +0 -109
  1235. package/dist/_chunks/use-query-states-DAhgj8Gx.js.map +0 -1
  1236. package/dist/adapters/cloudflare.js.map +0 -1
  1237. package/dist/cache/index.js.map +0 -1
  1238. package/dist/cache/register-cached-function.d.ts +0 -17
  1239. package/dist/cache/register-cached-function.d.ts.map +0 -1
  1240. package/dist/client/browser-entry.d.ts +0 -21
  1241. package/dist/client/browser-entry.d.ts.map +0 -1
  1242. package/dist/client/error-boundary.js.map +0 -1
  1243. package/dist/client/head.d.ts +0 -16
  1244. package/dist/client/head.d.ts.map +0 -1
  1245. package/dist/client/link-status-provider.d.ts +0 -11
  1246. package/dist/client/link-status-provider.d.ts.map +0 -1
  1247. package/dist/client/segment-merger.d.ts +0 -119
  1248. package/dist/client/segment-merger.d.ts.map +0 -1
  1249. package/dist/client/stale-reload.d.ts +0 -44
  1250. package/dist/client/stale-reload.d.ts.map +0 -1
  1251. package/dist/client/transition-root.d.ts +0 -74
  1252. package/dist/client/transition-root.d.ts.map +0 -1
  1253. package/dist/client/use-navigation-pending.d.ts +0 -26
  1254. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  1255. package/dist/client/use-params.d.ts +0 -92
  1256. package/dist/client/use-params.d.ts.map +0 -1
  1257. package/dist/content/index.d.ts +0 -11
  1258. package/dist/content/index.d.ts.map +0 -1
  1259. package/dist/content/index.js +0 -2
  1260. package/dist/plugins/cache-transform.d.ts +0 -36
  1261. package/dist/plugins/cache-transform.d.ts.map +0 -1
  1262. package/dist/plugins/dev-error-overlay.d.ts +0 -60
  1263. package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
  1264. package/dist/plugins/dev-logs.d.ts.map +0 -1
  1265. package/dist/plugins/dynamic-transform.d.ts +0 -72
  1266. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  1267. package/dist/plugins/server-action-exports.d.ts +0 -26
  1268. package/dist/plugins/server-action-exports.d.ts.map +0 -1
  1269. package/dist/routing/status-file-lint.d.ts +0 -33
  1270. package/dist/routing/status-file-lint.d.ts.map +0 -1
  1271. package/dist/search-params/analyze.d.ts +0 -54
  1272. package/dist/search-params/analyze.d.ts.map +0 -1
  1273. package/dist/search-params/builtin-codecs.d.ts +0 -105
  1274. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  1275. package/dist/search-params/codecs.d.ts +0 -53
  1276. package/dist/search-params/codecs.d.ts.map +0 -1
  1277. package/dist/search-params/create.d.ts +0 -106
  1278. package/dist/search-params/create.d.ts.map +0 -1
  1279. package/dist/search-params/registry.d.ts +0 -20
  1280. package/dist/search-params/registry.d.ts.map +0 -1
  1281. package/dist/server/client-module-map.d.ts +0 -47
  1282. package/dist/server/client-module-map.d.ts.map +0 -1
  1283. package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
  1284. package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
  1285. package/dist/server/dev-logger.d.ts.map +0 -1
  1286. package/dist/server/dev-span-processor.d.ts +0 -29
  1287. package/dist/server/dev-span-processor.d.ts.map +0 -1
  1288. package/dist/server/dev-warnings.d.ts +0 -129
  1289. package/dist/server/dev-warnings.d.ts.map +0 -1
  1290. package/dist/server/flush.d.ts +0 -74
  1291. package/dist/server/flush.d.ts.map +0 -1
  1292. package/dist/server/manifest-status-resolver.d.ts +0 -58
  1293. package/dist/server/manifest-status-resolver.d.ts.map +0 -1
  1294. package/dist/server/prerender.d.ts +0 -77
  1295. package/dist/server/prerender.d.ts.map +0 -1
  1296. package/dist/server/tree-builder.d.ts +0 -126
  1297. package/dist/server/tree-builder.d.ts.map +0 -1
  1298. package/dist/utils/directive-parser.d.ts +0 -70
  1299. package/dist/utils/directive-parser.d.ts.map +0 -1
  1300. package/src/cache/register-cached-function.ts +0 -99
  1301. package/src/client/browser-entry.ts +0 -674
  1302. package/src/client/head.ts +0 -61
  1303. package/src/client/link-status-provider.tsx +0 -30
  1304. package/src/client/segment-merger.ts +0 -345
  1305. package/src/client/stale-reload.ts +0 -89
  1306. package/src/client/transition-root.tsx +0 -160
  1307. package/src/client/use-navigation-pending.ts +0 -38
  1308. package/src/client/use-params.ts +0 -141
  1309. package/src/content/index.ts +0 -13
  1310. package/src/plugins/cache-transform.ts +0 -199
  1311. package/src/plugins/dev-error-overlay.ts +0 -230
  1312. package/src/plugins/dynamic-transform.ts +0 -161
  1313. package/src/plugins/server-action-exports.ts +0 -220
  1314. package/src/routing/status-file-lint.ts +0 -112
  1315. package/src/search-params/analyze.ts +0 -192
  1316. package/src/search-params/builtin-codecs.ts +0 -228
  1317. package/src/search-params/codecs.ts +0 -153
  1318. package/src/search-params/create.ts +0 -321
  1319. package/src/search-params/registry.ts +0 -31
  1320. package/src/server/client-module-map.ts +0 -58
  1321. package/src/server/dev-fetch-instrumentation.ts +0 -96
  1322. package/src/server/dev-span-processor.ts +0 -78
  1323. package/src/server/dev-warnings.ts +0 -282
  1324. package/src/server/flush.ts +0 -182
  1325. package/src/server/manifest-status-resolver.ts +0 -215
  1326. package/src/server/prerender.ts +0 -139
  1327. package/src/server/tree-builder.ts +0 -382
  1328. package/src/shims/server-only-noop.js +0 -6
  1329. package/src/utils/directive-parser.ts +0 -529
@@ -0,0 +1,458 @@
1
+ import { n as classifyUrlSegment, r as effectiveUrlSegment } from "./segment-classify-C539Pa2O.js";
2
+ import { join, relative } from "node:path";
3
+ import { existsSync, readFileSync, statSync } from "node:fs";
4
+ //#region src/routing/codegen-shared.ts
5
+ /**
6
+ * Build a TypeScript type expression for a single param using the global
7
+ * schema's InferCodecType. Falls back to the param's base type when
8
+ * schema doesn't declare this param (schemas are opt-in per key).
9
+ *
10
+ * Uses `infer` to extract the codec value rather than direct indexing
11
+ * because TypeScript doesn't narrow index validity inside a conditional
12
+ * type's true branch — `typeof schema.segmentParams[K]` produces TS2538
13
+ * even when the condition proves K is a valid key. In .d.ts files that
14
+ * error is suppressed and the type silently becomes `any`.
15
+ */
16
+ function buildSchemaParamType(p, fallback) {
17
+ return `typeof schema['segmentParams'] extends Record<${JSON.stringify(p.bracketName)}, infer V> ? InferCodecType<V> : ${fallback ?? p.type}`;
18
+ }
19
+ //#endregion
20
+ //#region src/routing/link-codegen.ts
21
+ /**
22
+ * The `searchParams` prop type, emitted identically on every Link variant
23
+ * — per-route pattern, resolved template, and catch-all.
24
+ *
25
+ * TIM-1343: there is no per-route narrowing any more. `params.ts` is gone,
26
+ * so codegen has no definition to read a `SearchParamsDefinition<T>` from.
27
+ * Type safety moved to the value's construction site instead: callers write
28
+ * `definition.buildSearchParams({ ... })`, which checks `Partial<T>` there
29
+ * and returns a query STRING — the only shape that survives the RSC Flight
30
+ * boundary. A plain record is the uncodec'd escape hatch. See `client/link.tsx` §"searchParams prop shapes".
31
+ *
32
+ * Declared once so the three emission sites cannot drift apart.
33
+ */
34
+ var SEARCH_PARAMS_PROP_TYPE = "string | Record<string, unknown>";
35
+ /** Shared Link base-props type literal used in every emitted call signature. */
36
+ var LINK_BASE_PROPS_TYPE = "Omit<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & { prefetch?: boolean; scroll?: boolean; preserveSearchParams?: true | string[]; onNavigate?: import('./client/link.js').OnNavigateHandler; children?: import('react').ReactNode }";
37
+ /**
38
+ * Build a TypeScript template literal pattern for a dynamic route.
39
+ * e.g. '/products/[id]' → '/products/${string}'
40
+ * '/blog/[...slug]' → '/blog/${string}'
41
+ * '/docs/[[...path]]' → '/docs/${string}' (also matches /docs)
42
+ * '/[org]/[repo]' → '/${string}/${string}'
43
+ */
44
+ function buildResolvedPattern(route) {
45
+ return route.urlPath.split("/").map((part) => {
46
+ const seg = classifyUrlSegment(part);
47
+ switch (seg.kind) {
48
+ case "catch-all":
49
+ case "optional-catch-all": return "${string}";
50
+ case "dynamic": return `${seg.prefix ?? ""}\${string}${seg.suffix ?? ""}`;
51
+ default: return part;
52
+ }
53
+ }).join("/");
54
+ }
55
+ /**
56
+ * Format the segmentParams type for Link overloads.
57
+ *
58
+ * Link params accept `string | number` for single dynamic segments
59
+ * (convenience — values are stringified at runtime). Catch-all and
60
+ * optional catch-all remain `string[]` / `string[] | undefined`.
61
+ *
62
+ * With a global schema, the schema codec's inferred type wins. Without
63
+ * one, a URL segment is a raw string (widened to string | number for
64
+ * Link convenience) — per-segment codec chains were deleted in TIM-1342.
65
+ */
66
+ function formatLinkParamsType(params, hasSchema) {
67
+ if (params.length === 0) return "{}";
68
+ return `{ ${params.map((p) => {
69
+ const fallback = p.type === "string" ? "string | number" : p.type;
70
+ const codecType = hasSchema ? buildSchemaParamType(p, fallback) : fallback;
71
+ return `${p.name}: ${codecType}`;
72
+ }).join("; ")} }`;
73
+ }
74
+ /**
75
+ * Catch-all call signatures for `<Link>` — external hrefs and computed
76
+ * `string` variables. Emitted from codegen in a SEPARATE
77
+ * `declare module` block (declared AFTER the per-route block) so the TS
78
+ * "later overload set ordered first" rule places these catch-all
79
+ * signatures ahead of per-route in resolution order, leaving per-route
80
+ * as the final overload whose error message is reported on failure.
81
+ *
82
+ * The conditional `string extends H ? ... : never` protection preserves
83
+ * TIM-624's guarantee that unknown internal path literals don't match
84
+ * the catch-all — typos like `<Link href="/typo" />` still error.
85
+ */
86
+ function formatLinkCatchAllOverloads() {
87
+ const lines = [];
88
+ const baseProps = LINK_BASE_PROPS_TYPE;
89
+ const catchAllSearchParams = SEARCH_PARAMS_PROP_TYPE;
90
+ const externalHref = "`http://${string}` | `https://${string}` | `mailto:${string}` | `tel:${string}` | `ftp://${string}` | `//${string}` | `#${string}` | `?${string}`";
91
+ lines.push(" // Typed Link overloads — catch-all (block 2 / emitted second)");
92
+ lines.push(" interface LinkFunction {");
93
+ lines.push(` (props: ${baseProps} & {`);
94
+ lines.push(` href: ${externalHref}`);
95
+ lines.push(` segmentParams?: Record<string, unknown>`);
96
+ lines.push(` searchParams?: ${catchAllSearchParams}`);
97
+ lines.push(` }): import('react').JSX.Element`);
98
+ lines.push(` <H extends string>(`);
99
+ lines.push(` props: ${baseProps} & {`);
100
+ lines.push(` href: string extends H ? H : never`);
101
+ lines.push(` segmentParams?: Record<string, string | number | string[]>`);
102
+ lines.push(` searchParams?: ${catchAllSearchParams}`);
103
+ lines.push(` }`);
104
+ lines.push(` ): import('react').JSX.Element`);
105
+ lines.push(" }");
106
+ return lines;
107
+ }
108
+ /**
109
+ * Generate typed per-route Link call signatures via LinkFunction
110
+ * interface merging.
111
+ *
112
+ * TIM-835: This emits a SINGLE call signature whose props is a
113
+ * discriminated union keyed on `href`. TypeScript narrows the union by
114
+ * the literal `href` at the call site, then checks the rest of the
115
+ * props against the matched variant. When `segmentParams` or
116
+ * `searchParams` is wrong, TS reports the error against the matched
117
+ * variant — naming the user's actual `href` and the offending field.
118
+ *
119
+ * Before TIM-835, this function emitted N separate per-route overloads
120
+ * (one per route, sometimes two for dynamic routes). When ALL overloads
121
+ * failed, TS would pick an arbitrary failed overload (heuristically the
122
+ * "last tried") to render the diagnostic, often pointing at a route
123
+ * completely unrelated to the one the user wrote. The discriminated
124
+ * union sidesteps overload-resolution heuristics entirely.
125
+ *
126
+ * Open property shapes (`Record<string, unknown>` instead of `never`)
127
+ * for `segmentParams` on routes that don't declare them keep generic
128
+ * `LinkProps`-spreading wrappers compiling. (Aligned with TIM-833.)
129
+ *
130
+ * TIM-832: this function still emits the per-route block FIRST and the
131
+ * catch-all block follows, so per-route remains the LAST overload set in
132
+ * resolution order — the one TS reports against on failure. With a
133
+ * discriminated union there is only one call signature in this block,
134
+ * so the resolved-template-vs-pattern ordering reduces to placing the
135
+ * pattern variant before the resolved-template variant inside the union.
136
+ */
137
+ function formatTypedLinkOverloads(routes, hasSchema) {
138
+ const lines = [];
139
+ const baseProps = LINK_BASE_PROPS_TYPE;
140
+ const variants = [];
141
+ for (const route of routes) {
142
+ const hasDynamicParams = route.params.length > 0;
143
+ const paramsProp = hasDynamicParams ? `segmentParams: ${formatLinkParamsType(route.params, hasSchema)}` : "segmentParams?: Record<string, unknown>";
144
+ const searchParamsProp = `searchParams?: ${SEARCH_PARAMS_PROP_TYPE}`;
145
+ variants.push(`${baseProps} & { href: '${route.urlPath}'; ${paramsProp}; ${searchParamsProp} }`);
146
+ if (hasDynamicParams) {
147
+ const templatePattern = buildResolvedPattern(route);
148
+ if (templatePattern) variants.push(`${baseProps} & { href: \`${templatePattern}\`; segmentParams?: Record<string, never>; ${searchParamsProp} }`);
149
+ }
150
+ }
151
+ lines.push(" interface LinkFunction {");
152
+ if (variants.length === 0) {
153
+ lines.push(" }");
154
+ return lines;
155
+ }
156
+ lines.push(" (");
157
+ lines.push(" props:");
158
+ for (const variant of variants) lines.push(` | (${variant})`);
159
+ lines.push(` ): import('react').JSX.Element`);
160
+ lines.push(" }");
161
+ return lines;
162
+ }
163
+ //#endregion
164
+ //#region src/routing/codegen.ts
165
+ /**
166
+ * Route map codegen.
167
+ *
168
+ * Walks the scanned RouteTree and generates a TypeScript declaration file
169
+ * mapping every route to its params and searchParams shapes.
170
+ *
171
+ * This runs at build time and in dev (regenerated on file changes).
172
+ * No runtime overhead — purely static type generation.
173
+ */
174
+ /**
175
+ * Generate a TypeScript declaration file string from a scanned route tree.
176
+ *
177
+ * The output is a `declare module '@timber-js/app'` block containing the Routes
178
+ * interface that maps every route path to its params and searchParams shape.
179
+ */
180
+ function generateRouteMap(tree, options = {}) {
181
+ const hasSchema = options.hasSchema ?? detectSchema(options.appDir);
182
+ const routes = [];
183
+ collectRoutes(tree.root, [], "", routes, hasSchema, false);
184
+ routes.sort((a, b) => a.urlPath.localeCompare(b.urlPath));
185
+ return formatDeclarationFile(routes, options.outputDir ?? options.appDir, hasSchema, options.appDir);
186
+ }
187
+ /** Schema file extensions to check, in priority order. */
188
+ var SCHEMA_EXTENSIONS = [
189
+ ".ts",
190
+ ".tsx",
191
+ ".js",
192
+ ".jsx"
193
+ ];
194
+ /**
195
+ * Detect whether app/schema.{ts,tsx,js,jsx} exists.
196
+ */
197
+ function detectSchema(appDir) {
198
+ if (!appDir) return false;
199
+ return SCHEMA_EXTENSIONS.some((ext) => existsSync(join(appDir, `schema${ext}`)));
200
+ }
201
+ /**
202
+ * Recursively walk the segment tree and collect route entries.
203
+ *
204
+ * A route entry is created for any segment that has a `page` or `route` file.
205
+ * Params accumulate from ancestor dynamic segments.
206
+ */
207
+ function collectRoutes(node, ancestorParams, parentTreePath, routes, hasSchema, insideSlot, insideIntercepting = false) {
208
+ const treePath = node.segmentName ? `${parentTreePath}/${node.segmentName}` : parentTreePath;
209
+ const urlSegment = effectiveUrlSegment(node);
210
+ const params = [...ancestorParams];
211
+ if (urlSegment.paramName) params.push({
212
+ name: urlSegment.paramName,
213
+ bracketName: bracketNameForSegment(urlSegment),
214
+ type: paramTypeForSegment(urlSegment.segmentType)
215
+ });
216
+ const isPage = !!node.page;
217
+ const isApiRoute = !!node.route;
218
+ const hostsCode = !!node.layout || !!node.middleware || !!node.access;
219
+ if (isPage || isApiRoute || hostsCode) {
220
+ const entry = {
221
+ urlPath: node.urlPath,
222
+ segmentPath: treePath || "/",
223
+ params,
224
+ isApiRoute,
225
+ isRoutable: isPage || isApiRoute,
226
+ isSlotRoute: insideSlot,
227
+ isInterceptingRoute: insideIntercepting,
228
+ hasSchema
229
+ };
230
+ routes.push(entry);
231
+ }
232
+ for (const child of node.children) collectRoutes(child, params, treePath, routes, hasSchema, insideSlot, insideIntercepting || child.segmentType === "intercepting");
233
+ for (const slot of Object.values(node.slots)) collectRoutes(slot, params, treePath, routes, hasSchema, true, insideIntercepting);
234
+ }
235
+ /**
236
+ * Dedupe route entries by urlPath for urlPath-keyed emissions (the Routes
237
+ * interface and typed Link variants).
238
+ *
239
+ * Parallel-slot pages share their parent's urlPath; emitting one entry per
240
+ * slot page produced duplicate interface keys (TS2300/TS2717 under
241
+ * skipLibCheck:false) and duplicate overloads. The non-slot entry is the
242
+ * canonical one; when only slot entries exist (parent has no page), the
243
+ * lexicographically smallest segmentPath wins so output is independent of
244
+ * slot scan order.
245
+ *
246
+ * The loser is discarded outright. It used to donate its `searchParams`
247
+ * definition to the winner, because a slot could carry one the parent page
248
+ * lacked; since TIM-1343 no route entry carries a searchParams definition at
249
+ * all, there is nothing left to merge.
250
+ *
251
+ * segmentPath-keyed emissions (getSegmentParams, useSegmentParams,
252
+ * TimberSegmentParams) must NOT use this — segmentPaths are already unique
253
+ * and slot entries feed those APIs directly.
254
+ */
255
+ function dedupeRoutesByUrlPath(routes) {
256
+ const byPath = /* @__PURE__ */ new Map();
257
+ for (const route of routes) {
258
+ const existing = byPath.get(route.urlPath);
259
+ if (!existing) {
260
+ byPath.set(route.urlPath, route);
261
+ continue;
262
+ }
263
+ const routeWins = existing.isSlotRoute && !route.isSlotRoute || !!existing.isSlotRoute === !!route.isSlotRoute && route.segmentPath.localeCompare(existing.segmentPath) < 0;
264
+ byPath.set(route.urlPath, routeWins ? route : existing);
265
+ }
266
+ return [...byPath.values()];
267
+ }
268
+ /**
269
+ * Determine the TypeScript type for a segment's param.
270
+ */
271
+ /**
272
+ * Derive the bracket key for schema/codegen lookup.
273
+ * For bare segments like `[id]` this is the segmentName itself.
274
+ * For affixed segments like `img-[id].png` this is `[id]` — the bare bracket form.
275
+ */
276
+ function bracketNameForSegment(node) {
277
+ if (node.paramPrefix || node.paramSuffix) return `[${node.paramName}]`;
278
+ return node.segmentName;
279
+ }
280
+ function paramTypeForSegment(segmentType) {
281
+ switch (segmentType) {
282
+ case "catch-all": return "string[]";
283
+ case "optional-catch-all": return "string[] | undefined";
284
+ default: return "string";
285
+ }
286
+ }
287
+ /**
288
+ * Emit the schema-based type exports: TimberSegmentParams, TimberRoute,
289
+ * AllSegmentParams, RoutesWithParams.
290
+ *
291
+ * These types use InferCodecType references so they stay in sync with
292
+ * the schema without hardcoding resolved types.
293
+ *
294
+ * Design doc: design/41-global-params.md §Codegen Output
295
+ */
296
+ function formatSchemaTypes(routes) {
297
+ const lines = [];
298
+ lines.push("/** Union of all valid route patterns. */");
299
+ lines.push("export type TimberRoute = keyof TimberSegmentParams;");
300
+ lines.push("");
301
+ lines.push("/** Maps each segment path to its accumulated segment params. */");
302
+ lines.push("export interface TimberSegmentParams {");
303
+ for (const route of routes) if (route.params.length === 0) lines.push(` '${route.segmentPath}': {};`);
304
+ else {
305
+ lines.push(` '${route.segmentPath}': {`);
306
+ for (const p of route.params) lines.push(` ${p.name}: ${buildSchemaParamType(p)};`);
307
+ lines.push(" };");
308
+ }
309
+ lines.push("}");
310
+ lines.push("");
311
+ lines.push("/** All segment params (union of all route params). */");
312
+ lines.push("export type AllSegmentParams = {");
313
+ lines.push(" [K in keyof TimberSegmentParams as TimberSegmentParams[K] extends Record<string, never>");
314
+ lines.push(" ? never");
315
+ lines.push(" : K]: TimberSegmentParams[K];");
316
+ lines.push("} extends infer U");
317
+ lines.push(" ? { [K in keyof U[keyof U]]: U[keyof U][K] }");
318
+ lines.push(" : never;");
319
+ lines.push("");
320
+ lines.push("/** Filters TimberRoute to routes whose accumulated params include all listed keys. */");
321
+ lines.push("export type RoutesWithParams<K extends keyof AllSegmentParams> = {");
322
+ lines.push(" [R in TimberRoute]: K extends keyof TimberSegmentParams[R] ? R : never;");
323
+ lines.push("}[TimberRoute];");
324
+ return lines;
325
+ }
326
+ /**
327
+ * Format the collected routes into a TypeScript declaration file.
328
+ */
329
+ function formatDeclarationFile(routes, importBase, hasSchema, appDir) {
330
+ const lines = [];
331
+ lines.push("// This file is auto-generated by timber.js route map codegen.");
332
+ lines.push("// Do not edit manually. Regenerated on build and in dev mode.");
333
+ lines.push("");
334
+ lines.push("export {};");
335
+ lines.push("");
336
+ if (hasSchema) {
337
+ const schemaImport = appDir && importBase ? "./" + relative(importBase, join(appDir, "schema")).replace(/\\/g, "/") : "../app/schema";
338
+ lines.push(`import type schema from '${schemaImport}';`);
339
+ lines.push("import type { InferCodecType, SegmentParamCodec } from '@timber-js/app/params';");
340
+ lines.push("");
341
+ const allBracketKeys = /* @__PURE__ */ new Set();
342
+ for (const route of routes) for (const p of route.params) allBracketKeys.add(p.bracketName);
343
+ if (allBracketKeys.size > 0) {
344
+ lines.push("declare module '@timber-js/app/params' {");
345
+ lines.push(" interface ValidDynamicSegmentKeysRegistry {");
346
+ for (const key of [...allBracketKeys].sort()) lines.push(` ${JSON.stringify(key)}: true;`);
347
+ lines.push(" }");
348
+ lines.push("}");
349
+ lines.push("");
350
+ }
351
+ lines.push("type _IsAny<T> = 0 extends 1 & T ? true : false;");
352
+ lines.push("type _AssertSchemaNotAny<_T extends false = _IsAny<typeof schema>> = true;");
353
+ lines.push("type _AssertCodecTypeNotAny<_T extends false = _IsAny<SegmentParamCodec>> = true;");
354
+ lines.push("");
355
+ lines.push("type _AssertSchemaValues = {");
356
+ lines.push(" [K in keyof typeof schema['segmentParams']]: typeof schema['segmentParams'][K] extends SegmentParamCodec ? true : ['Error: value for', K, 'is not a valid Codec or Standard Schema'];");
357
+ lines.push("};");
358
+ lines.push("type _EnforceSchemaValues<_T extends Record<string, true> = _AssertSchemaValues> = true;");
359
+ lines.push("");
360
+ }
361
+ const uniqueByUrlPath = dedupeRoutesByUrlPath(routes.filter((r) => r.isRoutable && !r.isInterceptingRoute));
362
+ lines.push("declare module '@timber-js/app' {");
363
+ lines.push(" interface Routes {");
364
+ for (const route of uniqueByUrlPath) {
365
+ const paramsType = formatParamsType(route.params, hasSchema);
366
+ lines.push(` '${route.urlPath}': {`);
367
+ lines.push(` segmentParams: ${paramsType}`);
368
+ lines.push(` }`);
369
+ }
370
+ lines.push(" }");
371
+ if (hasSchema) {
372
+ lines.push("");
373
+ lines.push(...formatSchemaTypes(routes).map((l) => ` ${l}`));
374
+ }
375
+ lines.push("}");
376
+ lines.push("");
377
+ const pageRoutes = uniqueByUrlPath.filter((r) => !r.isApiRoute);
378
+ const dynamicRoutes = routes.filter((r) => r.params.length > 0);
379
+ if (dynamicRoutes.length > 0) {
380
+ lines.push("declare module '@timber-js/app/server' {");
381
+ if (hasSchema) lines.push(" import type { AllSegmentParams } from '@timber-js/app'");
382
+ for (const route of dynamicRoutes) {
383
+ const paramsType = formatParamsType(route.params, hasSchema);
384
+ lines.push(` export function getSegmentParams(segmentPath: '${route.segmentPath}'): ${paramsType}`);
385
+ }
386
+ lines.push(hasSchema ? " export function getSegmentParams(): Partial<AllSegmentParams>" : " export function getSegmentParams(): Record<string, string | string[]>");
387
+ lines.push("}");
388
+ lines.push("");
389
+ }
390
+ if (dynamicRoutes.length > 0 || pageRoutes.length > 0) {
391
+ lines.push("declare module '@timber-js/app/client' {");
392
+ lines.push(" import type { SearchParamsDefinition } from '@timber-js/app/search-params'");
393
+ if (hasSchema) lines.push(" import type { AllSegmentParams } from '@timber-js/app'");
394
+ lines.push("");
395
+ if (dynamicRoutes.length > 0) {
396
+ for (const route of dynamicRoutes) {
397
+ const paramsType = formatParamsType(route.params, hasSchema);
398
+ lines.push(` export function useSegmentParams(segmentPath: '${route.segmentPath}'): ${paramsType}`);
399
+ }
400
+ lines.push(hasSchema ? " export function useSegmentParams(): Partial<AllSegmentParams>" : " export function useSegmentParams(): Record<string, string | string[]>");
401
+ lines.push("");
402
+ }
403
+ if (pageRoutes.length > 0) {
404
+ lines.push(" // Typed Link overloads — per-route (block 1 / emitted first)");
405
+ lines.push(...formatTypedLinkOverloads(pageRoutes, hasSchema));
406
+ lines.push("");
407
+ }
408
+ lines.push("}");
409
+ lines.push("");
410
+ }
411
+ lines.push("declare module '@timber-js/app/client' {");
412
+ lines.push(" import type { SearchParamsDefinition } from '@timber-js/app/search-params'");
413
+ lines.push("");
414
+ lines.push(...formatLinkCatchAllOverloads());
415
+ lines.push("}");
416
+ lines.push("");
417
+ return lines.join("\n");
418
+ }
419
+ /**
420
+ * Format the params type for a route entry.
421
+ */
422
+ function formatParamsType(params, hasSchema) {
423
+ if (params.length === 0) return "{}";
424
+ return `{ ${params.map((p) => {
425
+ const codecType = hasSchema ? buildSchemaParamType(p) : p.type;
426
+ return `${p.name}: ${codecType}`;
427
+ }).join("; ")} }`;
428
+ }
429
+ //#endregion
430
+ //#region src/routing/file-cache.ts
431
+ var cache = /* @__PURE__ */ new Map();
432
+ /**
433
+ * Read a file's text content, returning a cached copy when the file
434
+ * hasn't been modified since the last read (checked via mtime + size).
435
+ *
436
+ * Falls back to a fresh read on any stat/read error.
437
+ */
438
+ function readFileCached(filePath) {
439
+ try {
440
+ const stat = statSync(filePath);
441
+ const entry = cache.get(filePath);
442
+ if (entry && entry.mtimeMs === stat.mtimeMs && entry.size === stat.size) return entry.content;
443
+ const content = readFileSync(filePath, "utf-8");
444
+ cache.set(filePath, {
445
+ mtimeMs: stat.mtimeMs,
446
+ size: stat.size,
447
+ content
448
+ });
449
+ return content;
450
+ } catch {
451
+ cache.delete(filePath);
452
+ return readFileSync(filePath, "utf-8");
453
+ }
454
+ }
455
+ //#endregion
456
+ export { generateRouteMap as n, readFileCached as t };
457
+
458
+ //# sourceMappingURL=file-cache-Dw6BJPG7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-cache-Dw6BJPG7.js","names":[],"sources":["../../src/routing/codegen-shared.ts","../../src/routing/link-codegen.ts","../../src/routing/codegen.ts","../../src/routing/file-cache.ts"],"sourcesContent":["/**\n * Shared codegen helpers — import-path computation and codec chain type\n * builders.\n *\n * Extracted from `codegen.ts` so `link-codegen.ts` can use the same\n * helpers without a cyclic import.\n */\n\nimport { relative, posix } from 'node:path';\nimport type { ParamEntry } from './codegen-types.ts';\n\n/**\n * Compute a relative import specifier for a codec/page file, stripping\n * the .ts/.tsx extension and resolving against the codegen output dir.\n */\nexport function codecImportPath(codecFilePath: string, importBase: string | undefined): string {\n const absPath = codecFilePath.replace(/\\.(ts|tsx)$/, '');\n if (importBase) {\n return './' + relative(importBase, absPath).replace(/\\\\/g, '/');\n }\n return './' + posix.basename(absPath);\n}\n\n/**\n * Build a TypeScript type expression for a single param using the global\n * schema's InferCodecType. Falls back to the param's base type when\n * schema doesn't declare this param (schemas are opt-in per key).\n *\n * Uses `infer` to extract the codec value rather than direct indexing\n * because TypeScript doesn't narrow index validity inside a conditional\n * type's true branch — `typeof schema.segmentParams[K]` produces TS2538\n * even when the condition proves K is a valid key. In .d.ts files that\n * error is suppressed and the type silently becomes `any`.\n */\nexport function buildSchemaParamType(p: ParamEntry, fallback?: string): string {\n const key = JSON.stringify(p.bracketName);\n const fb = fallback ?? p.type;\n return `typeof schema['segmentParams'] extends Record<${key}, infer V> ? InferCodecType<V> : ${fb}`;\n}\n","/**\n * Typed `<Link>` codegen — interface augmentation generation.\n *\n * Extracted from `codegen.ts` to keep that file under the project's\n * 500-line cap. This module owns everything that emits the\n * `interface LinkFunction { ... }` augmentation blocks in the generated\n * `.timber/timber-routes.d.ts`.\n *\n * Two augmentation blocks are emitted:\n *\n * 1. **Per-route discriminated union** (`formatTypedLinkOverloads`) —\n * one call signature whose props is a union keyed on `href`. TS\n * narrows by literal href and reports prop errors against the\n * matched variant. See TIM-835 and `design/09-typescript.md`.\n *\n * 2. **Catch-all overloads** (`formatLinkCatchAllOverloads`) — external\n * href literals (`http://`, `mailto:`, etc.) and a computed-string\n * `<H extends string>` signature for runtime-computed paths.\n *\n * Block ordering is critical for error UX: per-route is emitted FIRST\n * so that, after TS's \"later overload set ordered first\" merge rule,\n * the discriminated union ends up LAST in resolution order — the\n * overload TS reports against on failure.\n */\n\nimport type { ParamEntry, RouteEntry } from './codegen-types.ts';\nimport { buildSchemaParamType } from './codegen-shared.ts';\nimport { classifyUrlSegment } from './segment-classify.ts';\n\n/**\n * The `searchParams` prop type, emitted identically on every Link variant\n * — per-route pattern, resolved template, and catch-all.\n *\n * TIM-1343: there is no per-route narrowing any more. `params.ts` is gone,\n * so codegen has no definition to read a `SearchParamsDefinition<T>` from.\n * Type safety moved to the value's construction site instead: callers write\n * `definition.buildSearchParams({ ... })`, which checks `Partial<T>` there\n * and returns a query STRING — the only shape that survives the RSC Flight\n * boundary. A plain record is the uncodec'd escape hatch. See `client/link.tsx` §\"searchParams prop shapes\".\n *\n * Declared once so the three emission sites cannot drift apart.\n */\nexport const SEARCH_PARAMS_PROP_TYPE = 'string | Record<string, unknown>';\n\n/** Shared Link base-props type literal used in every emitted call signature. */\nexport const LINK_BASE_PROPS_TYPE =\n \"Omit<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & { prefetch?: boolean; scroll?: boolean; preserveSearchParams?: true | string[]; onNavigate?: import('./client/link.js').OnNavigateHandler; children?: import('react').ReactNode }\";\n\n/**\n * Build a TypeScript template literal pattern for a dynamic route.\n * e.g. '/products/[id]' → '/products/${string}'\n * '/blog/[...slug]' → '/blog/${string}'\n * '/docs/[[...path]]' → '/docs/${string}' (also matches /docs)\n * '/[org]/[repo]' → '/${string}/${string}'\n */\nexport function buildResolvedPattern(route: RouteEntry): string | null {\n const parts = route.urlPath.split('/');\n const templateParts = parts.map((part) => {\n const seg = classifyUrlSegment(part);\n switch (seg.kind) {\n case 'catch-all':\n case 'optional-catch-all':\n // eslint-disable-next-line no-template-curly-in-string -- codegen output\n return '${string}';\n case 'dynamic': {\n const prefix = seg.prefix ?? '';\n const suffix = seg.suffix ?? '';\n // eslint-disable-next-line no-template-curly-in-string -- codegen output\n return `${prefix}\\${string}${suffix}`;\n }\n default:\n return part;\n }\n });\n return templateParts.join('/');\n}\n\n/**\n * Format the segmentParams type for Link overloads.\n *\n * Link params accept `string | number` for single dynamic segments\n * (convenience — values are stringified at runtime). Catch-all and\n * optional catch-all remain `string[]` / `string[] | undefined`.\n *\n * With a global schema, the schema codec's inferred type wins. Without\n * one, a URL segment is a raw string (widened to string | number for\n * Link convenience) — per-segment codec chains were deleted in TIM-1342.\n */\nexport function formatLinkParamsType(params: ParamEntry[], hasSchema?: boolean): string {\n if (params.length === 0) {\n return '{}';\n }\n\n const fields = params.map((p) => {\n const fallback = p.type === 'string' ? 'string | number' : p.type;\n const codecType = hasSchema ? buildSchemaParamType(p, fallback) : fallback;\n return `${p.name}: ${codecType}`;\n });\n return `{ ${fields.join('; ')} }`;\n}\n\n/**\n * Catch-all call signatures for `<Link>` — external hrefs and computed\n * `string` variables. Emitted from codegen in a SEPARATE\n * `declare module` block (declared AFTER the per-route block) so the TS\n * \"later overload set ordered first\" rule places these catch-all\n * signatures ahead of per-route in resolution order, leaving per-route\n * as the final overload whose error message is reported on failure.\n *\n * The conditional `string extends H ? ... : never` protection preserves\n * TIM-624's guarantee that unknown internal path literals don't match\n * the catch-all — typos like `<Link href=\"/typo\" />` still error.\n */\nexport function formatLinkCatchAllOverloads(): string[] {\n const lines: string[] = [];\n const baseProps = LINK_BASE_PROPS_TYPE;\n\n const catchAllSearchParams = SEARCH_PARAMS_PROP_TYPE;\n\n // ExternalHref inlined here rather than referenced as an exported\n // alias so the generated .d.ts stands alone without source imports.\n /* eslint-disable no-template-curly-in-string -- codegen output */\n const externalHref =\n '`http://${string}` | `https://${string}` | `mailto:${string}` | `tel:${string}` | `ftp://${string}` | `//${string}` | `#${string}` | `?${string}`';\n /* eslint-enable no-template-curly-in-string */\n\n lines.push(' // Typed Link overloads — catch-all (block 2 / emitted second)');\n lines.push(' interface LinkFunction {');\n\n // (1) External/literal-protocol hrefs.\n //\n // TIM-833: `segmentParams` is permissively typed as\n // `Record<string, unknown>` (not `never`) so generic wrappers that\n // forward a `LinkProps`-shaped object can compile when the wrapper\n // happens to bottom out at an external href. There are no dynamic\n // segments to interpolate for an external href, so this prop is\n // ignored at runtime — accepting an open-shape object instead of\n // forbidding it removes a footgun without changing behavior.\n lines.push(` (props: ${baseProps} & {`);\n lines.push(` href: ${externalHref}`);\n lines.push(` segmentParams?: Record<string, unknown>`);\n lines.push(` searchParams?: ${catchAllSearchParams}`);\n lines.push(` }): import('react').JSX.Element`);\n\n // (2) Computed/variable href — non-literal `string` only.\n //\n // `string extends H` is true only when H is the wide `string` type,\n // not a specific literal. For literal hrefs, this overload must NOT\n // be selectable so the per-route discriminated union (block 1) is\n // the resolution target.\n //\n // TIM-833 follow-up: the previous shape used `string extends H ? {...} : never`\n // on the WHOLE props type. For literal H, that collapsed `props` to\n // `never`, and JSX type inference then read `(never).children` as\n // `never` — producing the misleading\n // `'children' prop expects type 'never' which requires multiple\n // children, but only a single child was provided` (TS2745) error,\n // which buried the actual prop-mismatch message under a noise diagnostic.\n //\n // Fix: move the `: never` from the whole props onto just the `href`\n // field. The overload remains uncallable for literal H (since `\"/x\"`\n // is not assignable to `never`), but `children` retains its real\n // `ReactNode` type so JSX inference no longer collapses to never.\n // The diagnostic surface becomes: TS reports the per-route block's\n // error chain (the helpful \"Type 'number' is not assignable to type\n // 'string'\" message) WITHOUT a leading TS2745 noise line.\n lines.push(` <H extends string>(`);\n lines.push(` props: ${baseProps} & {`);\n lines.push(` href: string extends H ? H : never`);\n lines.push(` segmentParams?: Record<string, string | number | string[]>`);\n lines.push(` searchParams?: ${catchAllSearchParams}`);\n lines.push(` }`);\n lines.push(` ): import('react').JSX.Element`);\n\n lines.push(' }');\n return lines;\n}\n\n/**\n * Generate typed per-route Link call signatures via LinkFunction\n * interface merging.\n *\n * TIM-835: This emits a SINGLE call signature whose props is a\n * discriminated union keyed on `href`. TypeScript narrows the union by\n * the literal `href` at the call site, then checks the rest of the\n * props against the matched variant. When `segmentParams` or\n * `searchParams` is wrong, TS reports the error against the matched\n * variant — naming the user's actual `href` and the offending field.\n *\n * Before TIM-835, this function emitted N separate per-route overloads\n * (one per route, sometimes two for dynamic routes). When ALL overloads\n * failed, TS would pick an arbitrary failed overload (heuristically the\n * \"last tried\") to render the diagnostic, often pointing at a route\n * completely unrelated to the one the user wrote. The discriminated\n * union sidesteps overload-resolution heuristics entirely.\n *\n * Open property shapes (`Record<string, unknown>` instead of `never`)\n * for `segmentParams` on routes that don't declare them keep generic\n * `LinkProps`-spreading wrappers compiling. (Aligned with TIM-833.)\n *\n * TIM-832: this function still emits the per-route block FIRST and the\n * catch-all block follows, so per-route remains the LAST overload set in\n * resolution order — the one TS reports against on failure. With a\n * discriminated union there is only one call signature in this block,\n * so the resolved-template-vs-pattern ordering reduces to placing the\n * pattern variant before the resolved-template variant inside the union.\n */\nexport function formatTypedLinkOverloads(routes: RouteEntry[], hasSchema?: boolean): string[] {\n const lines: string[] = [];\n const baseProps = LINK_BASE_PROPS_TYPE;\n\n // Build the union variants. Each route contributes one variant for the\n // pattern href (e.g. '/products/[id]') and, for dynamic routes, an\n // additional variant for the resolved-template href (e.g.\n // `/products/${string}`).\n //\n // The PATTERN variant must be listed BEFORE the resolved-template\n // variant for the same route so that when the user writes the literal\n // pattern href (`<Link href=\"/products/[id]\" />`), TS narrows to the\n // pattern variant (which carries the typed `segmentParams` shape)\n // rather than the looser resolved-template variant. Without this\n // ordering, TS would silently match the resolved-template variant\n // first — swallowing typed-segmentParams type errors.\n const variants: string[] = [];\n for (const route of routes) {\n const hasDynamicParams = route.params.length > 0;\n // For routes with no dynamic params, accept an absent OR open-shape\n // segmentParams. `Record<string, unknown>` keeps generic spreads\n // compiling and gives a readable error if a non-object is passed.\n const paramsProp = hasDynamicParams\n ? `segmentParams: ${formatLinkParamsType(route.params, hasSchema)}`\n : 'segmentParams?: Record<string, unknown>';\n\n // TIM-1343: searchParams is no longer typed per-route. There is no\n // convention file to read a definition from, so codegen has nothing to\n // narrow with — the value is either a URLSearchParams built by\n // `definition.buildSearchParams()` (which type-checks its own\n // `Partial<T>` at that call) or a plain String()-coerced record.\n const searchParamsProp = `searchParams?: ${SEARCH_PARAMS_PROP_TYPE}`;\n\n // Pattern variant FIRST (more specific).\n variants.push(\n `${baseProps} & { href: '${route.urlPath}'; ${paramsProp}; ${searchParamsProp} }`\n );\n\n // Resolved-template variant SECOND (looser, matches interpolated hrefs).\n if (hasDynamicParams) {\n const templatePattern = buildResolvedPattern(route);\n if (templatePattern) {\n // TIM-835: `Record<string, never>` for segmentParams forbids ANY\n // provided keys on the resolved-template variant. Without this,\n // the resolved-template would shadow the pattern variant for\n // literal pattern hrefs (`<Link href=\"/products/[id]\" segmentParams={...} />`)\n // because both variants accept the literal `'/products/[id]'`\n // and the looser variant would silently swallow segmentParams\n // type errors.\n variants.push(\n `${baseProps} & { href: \\`${templatePattern}\\`; segmentParams?: Record<string, never>; ${searchParamsProp} }`\n );\n }\n }\n }\n\n lines.push(' interface LinkFunction {');\n if (variants.length === 0) {\n // No page routes — emit nothing. The catch-all block in the second\n // augmentation still provides external/computed-string signatures.\n lines.push(' }');\n return lines;\n }\n lines.push(' (');\n lines.push(' props:');\n for (const variant of variants) {\n lines.push(` | (${variant})`);\n }\n lines.push(` ): import('react').JSX.Element`);\n lines.push(' }');\n\n return lines;\n}\n","/**\n * Route map codegen.\n *\n * Walks the scanned RouteTree and generates a TypeScript declaration file\n * mapping every route to its params and searchParams shapes.\n *\n * This runs at build time and in dev (regenerated on file changes).\n * No runtime overhead — purely static type generation.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join, relative } from 'node:path';\nimport type { RouteTree, SegmentNode } from './types.ts';\nimport type { ParamEntry, RouteEntry } from './codegen-types.ts';\nimport { buildSchemaParamType } from './codegen-shared.ts';\nimport { effectiveUrlSegment, type UrlSegmentIdentity } from './segment-classify.ts';\nimport { formatLinkCatchAllOverloads, formatTypedLinkOverloads } from './link-codegen.ts';\n\n/** Options for route map generation. */\nexport interface CodegenOptions {\n /** Absolute path to the app/ directory. Required for page searchParams detection. */\n appDir?: string;\n /**\n * Absolute path to the directory where the .d.ts file will be written.\n * Used to compute correct relative import paths for page files.\n * Defaults to appDir when not provided (preserves backward compat for tests).\n */\n outputDir?: string;\n /**\n * Whether a global schema (app/schema.ts) exists.\n * Auto-detected from appDir when not explicitly set.\n */\n hasSchema?: boolean;\n}\n\n/**\n * Generate a TypeScript declaration file string from a scanned route tree.\n *\n * The output is a `declare module '@timber-js/app'` block containing the Routes\n * interface that maps every route path to its params and searchParams shape.\n */\nexport function generateRouteMap(tree: RouteTree, options: CodegenOptions = {}): string {\n // Auto-detect schema from appDir when not explicitly set\n const hasSchema = options.hasSchema ?? detectSchema(options.appDir);\n\n const routes: RouteEntry[] = [];\n collectRoutes(tree.root, [], '', routes, hasSchema, false);\n\n // Sort routes alphabetically for deterministic output\n routes.sort((a, b) => a.urlPath.localeCompare(b.urlPath));\n\n // When outputDir differs from appDir, import paths must be relative to outputDir\n const importBase = options.outputDir ?? options.appDir;\n\n return formatDeclarationFile(routes, importBase, hasSchema, options.appDir);\n}\n\n/** Schema file extensions to check, in priority order. */\nconst SCHEMA_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx'];\n\n/**\n * Detect whether app/schema.{ts,tsx,js,jsx} exists.\n */\nfunction detectSchema(appDir: string | undefined): boolean {\n if (!appDir) return false;\n return SCHEMA_EXTENSIONS.some((ext) => existsSync(join(appDir, `schema${ext}`)));\n}\n\n/**\n * Recursively walk the segment tree and collect route entries.\n *\n * A route entry is created for any segment that has a `page` or `route` file.\n * Params accumulate from ancestor dynamic segments.\n */\nfunction collectRoutes(\n node: SegmentNode,\n ancestorParams: ParamEntry[],\n parentTreePath: string,\n routes: RouteEntry[],\n hasSchema: boolean,\n insideSlot: boolean,\n insideIntercepting = false\n): void {\n // Build the tree path (includes groups, slots — uniquely identifies this segment).\n // Root node has empty segmentName, producing treePath = ''.\n const treePath = node.segmentName ? `${parentTreePath}/${node.segmentName}` : parentTreePath;\n // Accumulate params from this segment.\n //\n // The segment is read through `effectiveUrlSegment` for the same reason the\n // runtime coercer is: an intercepting node's own `segmentType` is\n // 'intercepting' and its `paramName` is unset — the param it binds lives in\n // the intercepted name (`(.)[albumSlug]` → `[albumSlug]`). Reading the node\n // directly emitted `{}` for a segment the router does bind and coerce, so\n // the types disagreed with the values for every intercepting page with a\n // dynamic intercepted segment, and for its descendants, which lost the\n // ancestor param too.\n const urlSegment = effectiveUrlSegment(node);\n const params = [...ancestorParams];\n if (urlSegment.paramName) {\n params.push({\n name: urlSegment.paramName,\n bracketName: bracketNameForSegment(urlSegment),\n type: paramTypeForSegment(urlSegment.segmentType),\n });\n }\n\n // Check if this segment is a leaf route (has page or route file)\n const isPage = !!node.page;\n const isApiRoute = !!node.route;\n\n // A segment that hosts code but is not itself addressable — a layout,\n // middleware, or access check above the leaf — still gets a `$segment`\n // module, so `getSegmentParams(SEGMENT_PATH)` is callable from it and needs\n // a matching typed overload. Emitting only leaves left those call sites on\n // the broad `Record<string, string | string[]>` signature, which since\n // TIM-1342 (which deleted `defineSegmentParams`) is their ONLY typed path.\n // design/41-global-params.md's Type Summary promises layouts and middleware\n // exact accumulated params.\n //\n // `isRoutable: false` keeps them out of the urlPath-keyed emissions — the\n // `Routes` interface and `<Link>` variants — where they would publish a URL\n // that no request can reach. They belong only to the segmentPath-keyed\n // APIs: `getSegmentParams`, `useSegmentParams`, `TimberSegmentParams`.\n const hostsCode = !!node.layout || !!node.middleware || !!node.access;\n\n if (isPage || isApiRoute || hostsCode) {\n const entry: RouteEntry = {\n urlPath: node.urlPath,\n segmentPath: treePath || '/',\n params,\n isApiRoute,\n isRoutable: isPage || isApiRoute,\n isSlotRoute: insideSlot,\n isInterceptingRoute: insideIntercepting,\n hasSchema,\n };\n\n routes.push(entry);\n }\n\n // Recurse into children. An intercepting subtree is flagged, and the flag is\n // sticky — the descendants are where the false URLs are. See\n // `RouteEntry.isInterceptingRoute` for what the flag drops and why dedupe\n // alone was not enough.\n for (const child of node.children) {\n const childIntercepting = insideIntercepting || child.segmentType === 'intercepting';\n collectRoutes(child, params, treePath, routes, hasSchema, insideSlot, childIntercepting);\n }\n\n // Recurse into slots (they share the parent's URL path, but may have their own pages)\n for (const slot of Object.values(node.slots)) {\n collectRoutes(slot, params, treePath, routes, hasSchema, true, insideIntercepting);\n }\n}\n\n/**\n * Dedupe route entries by urlPath for urlPath-keyed emissions (the Routes\n * interface and typed Link variants).\n *\n * Parallel-slot pages share their parent's urlPath; emitting one entry per\n * slot page produced duplicate interface keys (TS2300/TS2717 under\n * skipLibCheck:false) and duplicate overloads. The non-slot entry is the\n * canonical one; when only slot entries exist (parent has no page), the\n * lexicographically smallest segmentPath wins so output is independent of\n * slot scan order.\n *\n * The loser is discarded outright. It used to donate its `searchParams`\n * definition to the winner, because a slot could carry one the parent page\n * lacked; since TIM-1343 no route entry carries a searchParams definition at\n * all, there is nothing left to merge.\n *\n * segmentPath-keyed emissions (getSegmentParams, useSegmentParams,\n * TimberSegmentParams) must NOT use this — segmentPaths are already unique\n * and slot entries feed those APIs directly.\n */\nfunction dedupeRoutesByUrlPath(routes: RouteEntry[]): RouteEntry[] {\n const byPath = new Map<string, RouteEntry>();\n for (const route of routes) {\n const existing = byPath.get(route.urlPath);\n if (!existing) {\n byPath.set(route.urlPath, route);\n continue;\n }\n\n const routeWins =\n (existing.isSlotRoute && !route.isSlotRoute) ||\n (!!existing.isSlotRoute === !!route.isSlotRoute &&\n route.segmentPath.localeCompare(existing.segmentPath) < 0);\n byPath.set(route.urlPath, routeWins ? route : existing);\n }\n return [...byPath.values()];\n}\n\n/**\n * Determine the TypeScript type for a segment's param.\n */\n/**\n * Derive the bracket key for schema/codegen lookup.\n * For bare segments like `[id]` this is the segmentName itself.\n * For affixed segments like `img-[id].png` this is `[id]` — the bare bracket form.\n */\nfunction bracketNameForSegment(node: UrlSegmentIdentity): string {\n if (node.paramPrefix || node.paramSuffix) {\n return `[${node.paramName}]`;\n }\n return node.segmentName;\n}\n\nfunction paramTypeForSegment(segmentType: string): ParamEntry['type'] {\n switch (segmentType) {\n case 'catch-all':\n return 'string[]';\n case 'optional-catch-all':\n return 'string[] | undefined';\n default:\n return 'string';\n }\n}\n\n/**\n * Emit the schema-based type exports: TimberSegmentParams, TimberRoute,\n * AllSegmentParams, RoutesWithParams.\n *\n * These types use InferCodecType references so they stay in sync with\n * the schema without hardcoding resolved types.\n *\n * Design doc: design/41-global-params.md §Codegen Output\n */\nfunction formatSchemaTypes(routes: RouteEntry[]): string[] {\n const lines: string[] = [];\n\n lines.push('/** Union of all valid route patterns. */');\n lines.push('export type TimberRoute = keyof TimberSegmentParams;');\n lines.push('');\n lines.push('/** Maps each segment path to its accumulated segment params. */');\n lines.push('export interface TimberSegmentParams {');\n\n for (const route of routes) {\n if (route.params.length === 0) {\n lines.push(` '${route.segmentPath}': {};`);\n } else {\n lines.push(` '${route.segmentPath}': {`);\n for (const p of route.params) {\n lines.push(` ${p.name}: ${buildSchemaParamType(p)};`);\n }\n lines.push(' };');\n }\n }\n\n lines.push('}');\n lines.push('');\n\n // AllSegmentParams — flat union of all param types across all routes\n lines.push('/** All segment params (union of all route params). */');\n lines.push('export type AllSegmentParams = {');\n lines.push(\n ' [K in keyof TimberSegmentParams as TimberSegmentParams[K] extends Record<string, never>'\n );\n lines.push(' ? never');\n lines.push(' : K]: TimberSegmentParams[K];');\n lines.push('} extends infer U');\n lines.push(' ? { [K in keyof U[keyof U]]: U[keyof U][K] }');\n lines.push(' : never;');\n lines.push('');\n\n // RoutesWithParams — filter routes by required param keys\n lines.push(\n '/** Filters TimberRoute to routes whose accumulated params include all listed keys. */'\n );\n lines.push('export type RoutesWithParams<K extends keyof AllSegmentParams> = {');\n lines.push(' [R in TimberRoute]: K extends keyof TimberSegmentParams[R] ? R : never;');\n lines.push('}[TimberRoute];');\n\n return lines;\n}\n\n/**\n * Format the collected routes into a TypeScript declaration file.\n */\nfunction formatDeclarationFile(\n routes: RouteEntry[],\n importBase?: string,\n hasSchema?: boolean,\n appDir?: string\n): string {\n const lines: string[] = [];\n\n lines.push('// This file is auto-generated by timber.js route map codegen.');\n lines.push('// Do not edit manually. Regenerated on build and in dev mode.');\n lines.push('');\n // export {} makes this file a module, so all declare module blocks are\n // augmentations rather than ambient replacements. Without this, the\n // declare module blocks would replace the original module types entirely\n // (removing exports like bindUseQueryStates that aren't listed here).\n lines.push('export {};');\n lines.push('');\n\n if (hasSchema) {\n // Schema-based codegen: import schema and InferCodecType\n // Compute the schema import path relative to the output directory\n const schemaImport =\n appDir && importBase\n ? './' + relative(importBase, join(appDir, 'schema')).replace(/\\\\/g, '/')\n : '../app/schema';\n lines.push(`import type schema from '${schemaImport}';`);\n lines.push(\"import type { InferCodecType, SegmentParamCodec } from '@timber-js/app/params';\");\n lines.push('');\n // Collect all unique bracket keys from routes for key validation\n const allBracketKeys = new Set<string>();\n for (const route of routes) {\n for (const p of route.params) {\n allBracketKeys.add(p.bracketName);\n }\n }\n\n // Augment the ValidDynamicSegmentKeysRegistry so defineSchema constrains keys\n // to known filesystem segments. Unknown keys produce inline TS errors.\n if (allBracketKeys.size > 0) {\n lines.push(\"declare module '@timber-js/app/params' {\");\n lines.push(' interface ValidDynamicSegmentKeysRegistry {');\n for (const key of [...allBracketKeys].sort()) {\n lines.push(` ${JSON.stringify(key)}: true;`);\n }\n lines.push(' }');\n lines.push('}');\n lines.push('');\n }\n // Guard: detect when the schema or params imports silently degraded to\n // `any` because TypeScript could not resolve the import specifier.\n // In a .d.ts an unresolved import does NOT error — every downstream\n // type silently becomes `any`, which satisfies every assertion. Only\n // an explicit IsAny check catches it.\n lines.push('type _IsAny<T> = 0 extends 1 & T ? true : false;');\n lines.push('type _AssertSchemaNotAny<_T extends false = _IsAny<typeof schema>> = true;');\n lines.push('type _AssertCodecTypeNotAny<_T extends false = _IsAny<SegmentParamCodec>> = true;');\n lines.push('');\n // Type-level validation: each schema value must be a Codec or Standard Schema.\n // Running `pnpm run typecheck` will surface errors for invalid values.\n lines.push('type _AssertSchemaValues = {');\n lines.push(\n \" [K in keyof typeof schema['segmentParams']]: typeof schema['segmentParams'][K] extends SegmentParamCodec ? true : ['Error: value for', K, 'is not a valid Codec or Standard Schema'];\"\n );\n lines.push('};');\n // Generic constraint enforces that all values are `true` — if any value is\n // an error tuple, TS reports a real diagnostic instead of silently computing it.\n lines.push(\n 'type _EnforceSchemaValues<_T extends Record<string, true> = _AssertSchemaValues> = true;'\n );\n lines.push('');\n }\n\n // urlPath-keyed emissions use the deduped list (slot pages share their\n // parent's urlPath); segmentPath-keyed emissions below keep all entries.\n //\n // Intercepting subtrees are dropped outright rather than deduped: their\n // computed urlPath is not a route any request can reach, so a path that\n // happens NOT to collide with a real one would otherwise be published as a\n // real route. See `RouteEntry.isInterceptingRoute`.\n const uniqueByUrlPath = dedupeRoutesByUrlPath(\n routes.filter((r) => r.isRoutable && !r.isInterceptingRoute)\n );\n\n lines.push(\"declare module '@timber-js/app' {\");\n lines.push(' interface Routes {');\n\n // TIM-1343: no `searchParams` member. With `params.ts` gone there is no\n // convention file to read a definition from, so the framework has nothing\n // to type it with — and an always-`{}` member is a claim that every route\n // has no search params, which is false. Search-param types now come from\n // the definition object itself, wherever the app chooses to keep it.\n for (const route of uniqueByUrlPath) {\n const paramsType = formatParamsType(route.params, hasSchema);\n\n lines.push(` '${route.urlPath}': {`);\n lines.push(` segmentParams: ${paramsType}`);\n lines.push(` }`);\n }\n\n lines.push(' }');\n\n // When a global schema exists, emit segment param types inside the\n // @timber-js/app module augmentation so that declare module blocks\n // for @timber-js/app/server and @timber-js/app/client can reference\n // AllSegmentParams via `import type { AllSegmentParams } from '@timber-js/app'`.\n if (hasSchema) {\n lines.push('');\n lines.push(...formatSchemaTypes(routes).map((l) => ` ${l}`));\n }\n\n lines.push('}');\n lines.push('');\n\n // useQueryStates + typed Link are urlPath-keyed → deduped list.\n const pageRoutes = uniqueByUrlPath.filter((r) => !r.isApiRoute);\n // getSegmentParams / useSegmentParams are segmentPath-keyed → full list,\n // so slot segments keep their own typed overloads.\n const dynamicRoutes = routes.filter((r) => r.params.length > 0);\n\n // Generate @timber-js/app/server augmentation — typed getSegmentParams\n if (dynamicRoutes.length > 0) {\n lines.push(\"declare module '@timber-js/app/server' {\");\n if (hasSchema) {\n lines.push(\" import type { AllSegmentParams } from '@timber-js/app'\");\n }\n for (const route of dynamicRoutes) {\n const paramsType = formatParamsType(route.params, hasSchema);\n lines.push(\n ` export function getSegmentParams(segmentPath: '${route.segmentPath}'): ${paramsType}`\n );\n }\n lines.push(\n hasSchema\n ? ' export function getSegmentParams(): Partial<AllSegmentParams>'\n : ' export function getSegmentParams(): Record<string, string | string[]>'\n );\n lines.push('}');\n lines.push('');\n }\n\n // Generate overloads for @timber-js/app/client\n\n if (dynamicRoutes.length > 0 || pageRoutes.length > 0) {\n lines.push(\"declare module '@timber-js/app/client' {\");\n lines.push(\" import type { SearchParamsDefinition } from '@timber-js/app/search-params'\");\n if (hasSchema) {\n lines.push(\" import type { AllSegmentParams } from '@timber-js/app'\");\n }\n lines.push('');\n\n // useSegmentParams overloads\n if (dynamicRoutes.length > 0) {\n for (const route of dynamicRoutes) {\n const paramsType = formatParamsType(route.params, hasSchema);\n lines.push(\n ` export function useSegmentParams(segmentPath: '${route.segmentPath}'): ${paramsType}`\n );\n }\n lines.push(\n hasSchema\n ? ' export function useSegmentParams(): Partial<AllSegmentParams>'\n : ' export function useSegmentParams(): Record<string, string | string[]>'\n );\n lines.push('');\n }\n\n // Typed Link overloads — per-route with DIRECT types (no conditionals).\n // Direct types preserve TypeScript's excess property checking.\n //\n // TIM-832: per-route and catch-all are emitted as TWO separate\n // augmentation blocks. Per TS's merging rule \"later overload sets\n // ordered first\", the catch-all block (declared SECOND in this file)\n // ends up FIRST in the merged call-signature list at resolution time,\n // which puts the per-route block LAST — so its error message is the\n // one TypeScript reports when no overload matches. This gives users a\n // clear prop-mismatch error (e.g. \"'string | undefined' is not\n // assignable to 'string | number' on id\") instead of the old\n // confusing \"Type 'string' is not assignable to type 'never'\" cascade.\n if (pageRoutes.length > 0) {\n lines.push(' // Typed Link overloads — per-route (block 1 / emitted first)');\n lines.push(...formatTypedLinkOverloads(pageRoutes, hasSchema));\n lines.push('');\n }\n\n lines.push('}');\n lines.push('');\n }\n\n // TIM-832: catch-all block — emitted as a SEPARATE `declare module`\n // augmentation so TS's \"later overload set first\" rule orders it ahead\n // of the per-route block above at resolution time, leaving per-route as\n // the \"last overload\" whose error TypeScript reports.\n lines.push(\"declare module '@timber-js/app/client' {\");\n lines.push(\" import type { SearchParamsDefinition } from '@timber-js/app/search-params'\");\n lines.push('');\n lines.push(...formatLinkCatchAllOverloads());\n lines.push('}');\n lines.push('');\n\n return lines.join('\\n');\n}\n\n/**\n * Format the params type for a route entry.\n */\nfunction formatParamsType(params: ParamEntry[], hasSchema?: boolean): string {\n if (params.length === 0) {\n return '{}';\n }\n\n // Without a schema a URL segment is an uninterpreted string — that IS\n // its type. Per-segment codec chains used to narrow it here; TIM-1342\n // deleted them along with params.ts.\n const fields = params.map((p) => {\n const codecType = hasSchema ? buildSchemaParamType(p) : p.type;\n return `${p.name}: ${codecType}`;\n });\n return `{ ${fields.join('; ')} }`;\n}\n\n// TIM-1341: `useQueryStates` no longer has a route-string form, so the\n// generated `.d.ts` emits no overloads for it. Its source signature —\n// `useQueryStates(codecs, options?)` — is fully generic over the codec map\n// and needs no per-route augmentation. Reaching another route's codecs is\n// done by importing that route's `searchParams` definition from its\n// `params.ts` and calling `definition.useQueryStates()`, which is typed by\n// inference and cannot fail at runtime on an unpopulated registry.\n// See design/23-search-params.md §\"Client Access\".\n\n// Link overload formatters and helpers (`formatTypedLinkOverloads`,\n// `formatLinkCatchAllOverloads`, `formatLinkParamsType`,\n// `buildResolvedPattern`, `LINK_BASE_PROPS_TYPE`) were extracted to\n// `./link-codegen.ts` (TIM-835) to keep this file under the 500-line\n// cap. They are imported at the top of this file.\n","import { readFileSync, statSync } from 'node:fs';\n\nconst cache = new Map<string, { mtimeMs: number; size: number; content: string }>();\n\n/**\n * Read a file's text content, returning a cached copy when the file\n * hasn't been modified since the last read (checked via mtime + size).\n *\n * Falls back to a fresh read on any stat/read error.\n */\nexport function readFileCached(filePath: string): string {\n try {\n const stat = statSync(filePath);\n const entry = cache.get(filePath);\n if (entry && entry.mtimeMs === stat.mtimeMs && entry.size === stat.size) return entry.content;\n const content = readFileSync(filePath, 'utf-8');\n cache.set(filePath, { mtimeMs: stat.mtimeMs, size: stat.size, content });\n return content;\n } catch {\n cache.delete(filePath);\n return readFileSync(filePath, 'utf-8');\n }\n}\n"],"mappings":"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"}
@@ -0,0 +1,14 @@
1
+ //#region src/utils/format.ts
2
+ /**
3
+ * Shared formatting utilities.
4
+ */
5
+ /** Format a byte count as a human-readable string (e.g. "1.50 kB"). */
6
+ function formatSize(bytes) {
7
+ if (bytes < 1024) return `${bytes} B`;
8
+ if (bytes < 1048576) return `${(bytes / 1024).toFixed(2)} kB`;
9
+ return `${(bytes / 1048576).toFixed(2)} MB`;
10
+ }
11
+ //#endregion
12
+ export { formatSize as t };
13
+
14
+ //# sourceMappingURL=format-BKclgVbk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-BKclgVbk.js","names":[],"sources":["../../src/utils/format.ts"],"sourcesContent":["/**\n * Shared formatting utilities.\n */\n\n/** Format a byte count as a human-readable string (e.g. \"1.50 kB\"). */\nexport function formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} kB`;\n return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;\n}\n"],"mappings":";;;;;AAKA,SAAgB,WAAW,OAAuB;CAChD,IAAI,QAAQ,MAAM,OAAO,GAAG,MAAM;CAClC,IAAI,QAAQ,SAAa,OAAO,IAAI,QAAQ,KAAA,CAAM,QAAQ,CAAC,EAAE;CAC7D,OAAO,IAAI,QAAS,QAAA,CAAc,QAAQ,CAAC,EAAE;AAC/C"}