@timber-js/app 0.2.0-alpha.21 → 0.2.0-alpha.210

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 (1386) hide show
  1. package/LICENSE +8 -0
  2. package/agent-skill.md +346 -0
  3. package/bin/timber.mjs +15 -1
  4. package/dist/_chunks/actions-Rjk4htmA.js +1199 -0
  5. package/dist/_chunks/actions-Rjk4htmA.js.map +1 -0
  6. package/dist/_chunks/als-registry-DaxkVjt5.js +45 -0
  7. package/dist/_chunks/als-registry-DaxkVjt5.js.map +1 -0
  8. package/dist/_chunks/als-slots-BEEIPKYm.js +26 -0
  9. package/dist/_chunks/als-slots-BEEIPKYm.js.map +1 -0
  10. package/dist/_chunks/base-path-DaQrzbez.js +80 -0
  11. package/dist/_chunks/base-path-DaQrzbez.js.map +1 -0
  12. package/dist/_chunks/build-manifest-DWppEdLB.js +86 -0
  13. package/dist/_chunks/build-manifest-DWppEdLB.js.map +1 -0
  14. package/dist/_chunks/build-output-helper-RV_BRcF1.js +367 -0
  15. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +1 -0
  16. package/dist/_chunks/cache-api-DGdYfNJn.js +1182 -0
  17. package/dist/_chunks/cache-api-DGdYfNJn.js.map +1 -0
  18. package/dist/_chunks/canonicalize-CgHoscYO.js +66 -0
  19. package/dist/_chunks/canonicalize-CgHoscYO.js.map +1 -0
  20. package/dist/_chunks/chains-BoO51joc.js +413 -0
  21. package/dist/_chunks/chains-BoO51joc.js.map +1 -0
  22. package/dist/_chunks/cli-check-ajNY3B2e.js +252 -0
  23. package/dist/_chunks/cli-check-ajNY3B2e.js.map +1 -0
  24. package/dist/_chunks/cli-context-By7k2xVo.js +70 -0
  25. package/dist/_chunks/cli-context-By7k2xVo.js.map +1 -0
  26. package/dist/_chunks/cli-schema-sync-D2eI8jEg.js +299 -0
  27. package/dist/_chunks/cli-schema-sync-D2eI8jEg.js.map +1 -0
  28. package/dist/_chunks/cloudflare-Byxl8FWP.js +1333 -0
  29. package/dist/_chunks/cloudflare-Byxl8FWP.js.map +1 -0
  30. package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
  31. package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
  32. package/dist/_chunks/codegen-Bps1sLKJ.js +432 -0
  33. package/dist/_chunks/codegen-Bps1sLKJ.js.map +1 -0
  34. package/dist/_chunks/convention-lint-DLmhGsRS.js +590 -0
  35. package/dist/_chunks/convention-lint-DLmhGsRS.js.map +1 -0
  36. package/dist/_chunks/dev-server-v97rQH4b.js +2039 -0
  37. package/dist/_chunks/dev-server-v97rQH4b.js.map +1 -0
  38. package/dist/_chunks/dist-DtrJyBbw.js +386 -0
  39. package/dist/_chunks/dist-DtrJyBbw.js.map +1 -0
  40. package/dist/_chunks/error-boundary-DsNScGRM.js +1024 -0
  41. package/dist/_chunks/error-boundary-DsNScGRM.js.map +1 -0
  42. package/dist/_chunks/fast-hash-C-tVYrLb.js +41 -0
  43. package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
  44. package/dist/_chunks/format-BKclgVbk.js +14 -0
  45. package/dist/_chunks/format-BKclgVbk.js.map +1 -0
  46. package/dist/_chunks/fs-identity-BRKuL215.js +207 -0
  47. package/dist/_chunks/fs-identity-BRKuL215.js.map +1 -0
  48. package/dist/_chunks/graph-cache-CYiUS2aS.js +303 -0
  49. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +1 -0
  50. package/dist/_chunks/href-validation-BIrxavIy.js +213 -0
  51. package/dist/_chunks/href-validation-BIrxavIy.js.map +1 -0
  52. package/dist/_chunks/json-lossy-check-CVuRs2hG.js +66 -0
  53. package/dist/_chunks/json-lossy-check-CVuRs2hG.js.map +1 -0
  54. package/dist/_chunks/live-graph-9cSnn_h9.js +150 -0
  55. package/dist/_chunks/live-graph-9cSnn_h9.js.map +1 -0
  56. package/dist/_chunks/logger-BP0LN6vP.js +662 -0
  57. package/dist/_chunks/logger-BP0LN6vP.js.map +1 -0
  58. package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → metadata-routes-DSDjM_hJ.js} +71 -27
  59. package/dist/_chunks/metadata-routes-DSDjM_hJ.js.map +1 -0
  60. package/dist/_chunks/navigation-root-BQfo1-kG.js +126 -0
  61. package/dist/_chunks/navigation-root-BQfo1-kG.js.map +1 -0
  62. package/dist/_chunks/param-value-C8TNYchQ.js +66 -0
  63. package/dist/_chunks/param-value-C8TNYchQ.js.map +1 -0
  64. package/dist/_chunks/plugin-context-BPBPc3lL.js +345 -0
  65. package/dist/_chunks/plugin-context-BPBPc3lL.js.map +1 -0
  66. package/dist/_chunks/poison-rules-DoEhbqaY.js +110 -0
  67. package/dist/_chunks/poison-rules-DoEhbqaY.js.map +1 -0
  68. package/dist/_chunks/poison-scan-vGV7Re0B.js +101 -0
  69. package/dist/_chunks/poison-scan-vGV7Re0B.js.map +1 -0
  70. package/dist/_chunks/purge-store-Byr8XOjU.js +14 -0
  71. package/dist/_chunks/purge-store-Byr8XOjU.js.map +1 -0
  72. package/dist/_chunks/render-timeout-DOf_BBcO.js +46 -0
  73. package/dist/_chunks/render-timeout-DOf_BBcO.js.map +1 -0
  74. package/dist/_chunks/resolve-schema-CBR6Lm4i.js +50 -0
  75. package/dist/_chunks/resolve-schema-CBR6Lm4i.js.map +1 -0
  76. package/dist/_chunks/rolldown-runtime-D7D4PA-g.js +13 -0
  77. package/dist/_chunks/rsc-cache-key-ClUiXQnK.js +243 -0
  78. package/dist/_chunks/rsc-cache-key-ClUiXQnK.js.map +1 -0
  79. package/dist/_chunks/rsc-media-type-DDc7duTD.js +61 -0
  80. package/dist/_chunks/rsc-media-type-DDc7duTD.js.map +1 -0
  81. package/dist/_chunks/rsc-payload-path-dffcs4jp.js +54 -0
  82. package/dist/_chunks/rsc-payload-path-dffcs4jp.js.map +1 -0
  83. package/dist/_chunks/scan-BoP17W3w.js +140 -0
  84. package/dist/_chunks/scan-BoP17W3w.js.map +1 -0
  85. package/dist/_chunks/scanner-DmqdxzbW.js +2056 -0
  86. package/dist/_chunks/scanner-DmqdxzbW.js.map +1 -0
  87. package/dist/_chunks/schema-bridge-C83xa9lT.js +199 -0
  88. package/dist/_chunks/schema-bridge-C83xa9lT.js.map +1 -0
  89. package/dist/_chunks/segment-classify-C539Pa2O.js +197 -0
  90. package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
  91. package/dist/_chunks/segment-context-xtPUGfdq.js +137 -0
  92. package/dist/_chunks/segment-context-xtPUGfdq.js.map +1 -0
  93. package/dist/_chunks/segment-keys-D5hu1hz4.js +62 -0
  94. package/dist/_chunks/segment-keys-D5hu1hz4.js.map +1 -0
  95. package/dist/_chunks/singleflight-BeVMMKi0.js +55 -0
  96. package/dist/_chunks/singleflight-BeVMMKi0.js.map +1 -0
  97. package/dist/_chunks/sizeof-BM1409x2.js +36 -0
  98. package/dist/_chunks/sizeof-BM1409x2.js.map +1 -0
  99. package/dist/_chunks/ssr-data-nA3I70_n.js +49 -0
  100. package/dist/_chunks/ssr-data-nA3I70_n.js.map +1 -0
  101. package/dist/_chunks/state-BhNGPsdi.js +50 -0
  102. package/dist/_chunks/state-BhNGPsdi.js.map +1 -0
  103. package/dist/_chunks/status-page-marker-BRX9Ib-d.js +564 -0
  104. package/dist/_chunks/status-page-marker-BRX9Ib-d.js.map +1 -0
  105. package/dist/_chunks/tree-match-6yihorhk.js +169 -0
  106. package/dist/_chunks/tree-match-6yihorhk.js.map +1 -0
  107. package/dist/_chunks/use-query-states-I3JMng6J.js +226 -0
  108. package/dist/_chunks/use-query-states-I3JMng6J.js.map +1 -0
  109. package/dist/_chunks/walkers-Czu2jXFq.js +144 -0
  110. package/dist/_chunks/walkers-Czu2jXFq.js.map +1 -0
  111. package/dist/_chunks/write-file-atomic-D1qWqHb4.js +32 -0
  112. package/dist/_chunks/write-file-atomic-D1qWqHb4.js.map +1 -0
  113. package/dist/adapters/build-output-helper.d.ts +72 -0
  114. package/dist/adapters/build-output-helper.d.ts.map +1 -0
  115. package/dist/adapters/canonicalize-module.d.ts +8 -0
  116. package/dist/adapters/canonicalize-module.d.ts.map +1 -0
  117. package/dist/adapters/cloudflare-dev.d.ts +109 -0
  118. package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
  119. package/dist/adapters/cloudflare-dev.js +74 -0
  120. package/dist/adapters/cloudflare-dev.js.map +1 -0
  121. package/dist/adapters/cloudflare-kv-cache.d.ts +65 -0
  122. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  123. package/dist/adapters/cloudflare-kv-cache.js +123 -0
  124. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  125. package/dist/adapters/cloudflare.d.ts +224 -24
  126. package/dist/adapters/cloudflare.d.ts.map +1 -1
  127. package/dist/adapters/cloudflare.js +2 -188
  128. package/dist/adapters/compress-module.d.ts +25 -4
  129. package/dist/adapters/compress-module.d.ts.map +1 -1
  130. package/dist/adapters/fs-identity.d.ts +63 -0
  131. package/dist/adapters/fs-identity.d.ts.map +1 -0
  132. package/dist/adapters/nitro-presets.d.ts +31 -0
  133. package/dist/adapters/nitro-presets.d.ts.map +1 -0
  134. package/dist/adapters/nitro-preview.d.ts +64 -0
  135. package/dist/adapters/nitro-preview.d.ts.map +1 -0
  136. package/dist/adapters/nitro.d.ts +54 -37
  137. package/dist/adapters/nitro.d.ts.map +1 -1
  138. package/dist/adapters/nitro.js +631 -359
  139. package/dist/adapters/nitro.js.map +1 -1
  140. package/dist/adapters/shared.d.ts +67 -0
  141. package/dist/adapters/shared.d.ts.map +1 -0
  142. package/dist/adapters/types.d.ts +122 -16
  143. package/dist/adapters/types.d.ts.map +1 -1
  144. package/dist/adapters/types.js +0 -0
  145. package/dist/analyze/chains.d.ts +124 -0
  146. package/dist/analyze/chains.d.ts.map +1 -0
  147. package/dist/analyze/classify.d.ts +151 -0
  148. package/dist/analyze/classify.d.ts.map +1 -0
  149. package/dist/analyze/crawl-entry.d.ts +17 -0
  150. package/dist/analyze/crawl-entry.d.ts.map +1 -0
  151. package/dist/analyze/crawl-entry.js +313 -0
  152. package/dist/analyze/crawl-entry.js.map +1 -0
  153. package/dist/analyze/crawl.d.ts +134 -0
  154. package/dist/analyze/crawl.d.ts.map +1 -0
  155. package/dist/analyze/graph-cache.d.ts +104 -0
  156. package/dist/analyze/graph-cache.d.ts.map +1 -0
  157. package/dist/analyze/graph-command.d.ts +43 -0
  158. package/dist/analyze/graph-command.d.ts.map +1 -0
  159. package/dist/analyze/graph-command.js +472 -0
  160. package/dist/analyze/graph-command.js.map +1 -0
  161. package/dist/analyze/live-graph.d.ts +81 -0
  162. package/dist/analyze/live-graph.d.ts.map +1 -0
  163. package/dist/analyze/poison-rules.d.ts +72 -0
  164. package/dist/analyze/poison-rules.d.ts.map +1 -0
  165. package/dist/analyze/poison-scan.d.ts +48 -0
  166. package/dist/analyze/poison-scan.d.ts.map +1 -0
  167. package/dist/analyze/scan.d.ts +73 -0
  168. package/dist/analyze/scan.d.ts.map +1 -0
  169. package/dist/cache/cache-api.d.ts +48 -0
  170. package/dist/cache/cache-api.d.ts.map +1 -0
  171. package/dist/cache/fast-hash.d.ts +5 -0
  172. package/dist/cache/fast-hash.d.ts.map +1 -1
  173. package/dist/cache/handler-store.d.ts +33 -0
  174. package/dist/cache/handler-store.d.ts.map +1 -0
  175. package/dist/cache/index.d.ts +32 -9
  176. package/dist/cache/index.d.ts.map +1 -1
  177. package/dist/cache/index.js +3 -326
  178. package/dist/cache/invalidation-epoch.d.ts +43 -0
  179. package/dist/cache/invalidation-epoch.d.ts.map +1 -0
  180. package/dist/cache/json-lossy-check.d.ts +11 -0
  181. package/dist/cache/json-lossy-check.d.ts.map +1 -0
  182. package/dist/cache/redis-handler.d.ts +141 -9
  183. package/dist/cache/redis-handler.d.ts.map +1 -1
  184. package/dist/cache/singleflight.d.ts +21 -2
  185. package/dist/cache/singleflight.d.ts.map +1 -1
  186. package/dist/cache/sizeof.d.ts +22 -0
  187. package/dist/cache/sizeof.d.ts.map +1 -0
  188. package/dist/cache/stable-stringify.d.ts +9 -0
  189. package/dist/cache/stable-stringify.d.ts.map +1 -1
  190. package/dist/cache/store.d.ts +53 -0
  191. package/dist/cache/store.d.ts.map +1 -0
  192. package/dist/cache/stores/cloudflare-kv.d.ts +38 -0
  193. package/dist/cache/stores/cloudflare-kv.d.ts.map +1 -0
  194. package/dist/cache/stores/cloudflare-kv.js +29 -0
  195. package/dist/cache/stores/cloudflare-kv.js.map +1 -0
  196. package/dist/cache/stores/memory.d.ts +42 -0
  197. package/dist/cache/stores/memory.d.ts.map +1 -0
  198. package/dist/cache/stores/memory.js +90 -0
  199. package/dist/cache/stores/memory.js.map +1 -0
  200. package/dist/cache/stores/redis.d.ts +69 -0
  201. package/dist/cache/stores/redis.d.ts.map +1 -0
  202. package/dist/cache/stores/redis.js +35 -0
  203. package/dist/cache/stores/redis.js.map +1 -0
  204. package/dist/cache/stores/vercel.d.ts +36 -0
  205. package/dist/cache/stores/vercel.d.ts.map +1 -0
  206. package/dist/cache/stores/vercel.js +33 -0
  207. package/dist/cache/stores/vercel.js.map +1 -0
  208. package/dist/cache/tag-aware-handler.d.ts +52 -0
  209. package/dist/cache/tag-aware-handler.d.ts.map +1 -0
  210. package/dist/cache/timber-cache.d.ts +21 -11
  211. package/dist/cache/timber-cache.d.ts.map +1 -1
  212. package/dist/cdn/cloudflare-purge.d.ts +23 -0
  213. package/dist/cdn/cloudflare-purge.d.ts.map +1 -0
  214. package/dist/cdn/cloudflare-purge.js +30 -0
  215. package/dist/cdn/cloudflare-purge.js.map +1 -0
  216. package/dist/cdn/fastly-purge.d.ts +25 -0
  217. package/dist/cdn/fastly-purge.d.ts.map +1 -0
  218. package/dist/cdn/fastly-purge.js +33 -0
  219. package/dist/cdn/fastly-purge.js.map +1 -0
  220. package/dist/cdn/headers.d.ts +97 -0
  221. package/dist/cdn/headers.d.ts.map +1 -0
  222. package/dist/cdn/index.d.ts +5 -0
  223. package/dist/cdn/index.d.ts.map +1 -0
  224. package/dist/cdn/index.js +94 -0
  225. package/dist/cdn/index.js.map +1 -0
  226. package/dist/cdn/purge-store.d.ts +23 -0
  227. package/dist/cdn/purge-store.d.ts.map +1 -0
  228. package/dist/cdn/workers-cache-purge.d.ts +20 -0
  229. package/dist/cdn/workers-cache-purge.d.ts.map +1 -0
  230. package/dist/cdn/workers-cache-purge.js +35 -0
  231. package/dist/cdn/workers-cache-purge.js.map +1 -0
  232. package/dist/cli-check.d.ts +133 -0
  233. package/dist/cli-check.d.ts.map +1 -0
  234. package/dist/cli-context.d.ts +54 -0
  235. package/dist/cli-context.d.ts.map +1 -0
  236. package/dist/cli-schema-sync.d.ts +59 -0
  237. package/dist/cli-schema-sync.d.ts.map +1 -0
  238. package/dist/cli.d.ts +85 -13
  239. package/dist/cli.d.ts.map +1 -1
  240. package/dist/cli.js +224 -63
  241. package/dist/cli.js.map +1 -1
  242. package/dist/client/browser-dev.d.ts +42 -2
  243. package/dist/client/browser-dev.d.ts.map +1 -1
  244. package/dist/client/browser-entry/action-dispatch.d.ts +19 -0
  245. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  246. package/dist/client/browser-entry/action-queue.d.ts +63 -0
  247. package/dist/client/browser-entry/action-queue.d.ts.map +1 -0
  248. package/dist/client/browser-entry/hmr.d.ts +21 -0
  249. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  250. package/dist/client/browser-entry/hydrate.d.ts +53 -0
  251. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  252. package/dist/client/browser-entry/index.d.ts +30 -0
  253. package/dist/client/browser-entry/index.d.ts.map +1 -0
  254. package/dist/client/browser-entry/post-hydration.d.ts +26 -0
  255. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  256. package/dist/client/browser-entry/router-init.d.ts +41 -0
  257. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  258. package/dist/client/browser-entry/rsc-stream.d.ts +32 -0
  259. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  260. package/dist/client/browser-entry/scroll.d.ts +28 -0
  261. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  262. package/dist/client/deny-last-resort.d.ts +29 -0
  263. package/dist/client/deny-last-resort.d.ts.map +1 -0
  264. package/dist/client/error-boundary.d.ts +58 -9
  265. package/dist/client/error-boundary.d.ts.map +1 -1
  266. package/dist/client/error-boundary.js +2 -126
  267. package/dist/client/error-reconstituter.d.ts +55 -0
  268. package/dist/client/error-reconstituter.d.ts.map +1 -0
  269. package/dist/client/form.d.ts +16 -27
  270. package/dist/client/form.d.ts.map +1 -1
  271. package/dist/client/global-context.d.ts +15 -0
  272. package/dist/client/global-context.d.ts.map +1 -0
  273. package/dist/client/history.d.ts +50 -9
  274. package/dist/client/history.d.ts.map +1 -1
  275. package/dist/client/index.d.ts +20 -33
  276. package/dist/client/index.d.ts.map +1 -1
  277. package/dist/client/index.js +330 -1150
  278. package/dist/client/index.js.map +1 -1
  279. package/dist/client/internal.d.ts +20 -0
  280. package/dist/client/internal.d.ts.map +1 -0
  281. package/dist/client/internal.js +792 -0
  282. package/dist/client/internal.js.map +1 -0
  283. package/dist/client/link.d.ts +85 -60
  284. package/dist/client/link.d.ts.map +1 -1
  285. package/dist/client/location-search.d.ts +12 -0
  286. package/dist/client/location-search.d.ts.map +1 -0
  287. package/dist/client/navigation-api.d.ts +133 -0
  288. package/dist/client/navigation-api.d.ts.map +1 -0
  289. package/dist/client/navigation-commit.d.ts +111 -0
  290. package/dist/client/navigation-commit.d.ts.map +1 -0
  291. package/dist/client/navigation-context.d.ts +54 -36
  292. package/dist/client/navigation-context.d.ts.map +1 -1
  293. package/dist/client/navigation-root.d.ts +106 -0
  294. package/dist/client/navigation-root.d.ts.map +1 -0
  295. package/dist/client/navigation-transition.d.ts +192 -0
  296. package/dist/client/navigation-transition.d.ts.map +1 -0
  297. package/dist/client/nuqs-adapter.d.ts +1 -1
  298. package/dist/client/nuqs-adapter.d.ts.map +1 -1
  299. package/dist/client/params-context.d.ts +81 -0
  300. package/dist/client/params-context.d.ts.map +1 -0
  301. package/dist/client/react-root.d.ts +45 -0
  302. package/dist/client/react-root.d.ts.map +1 -0
  303. package/dist/client/router-effects.d.ts +137 -0
  304. package/dist/client/router-effects.d.ts.map +1 -0
  305. package/dist/client/router-lifecycle.d.ts +98 -0
  306. package/dist/client/router-lifecycle.d.ts.map +1 -0
  307. package/dist/client/router-pipeline.d.ts +84 -0
  308. package/dist/client/router-pipeline.d.ts.map +1 -0
  309. package/dist/client/router-ref.d.ts +2 -2
  310. package/dist/client/router-ref.d.ts.map +1 -1
  311. package/dist/client/router-skew.d.ts +21 -0
  312. package/dist/client/router-skew.d.ts.map +1 -0
  313. package/dist/client/router-types.d.ts +334 -0
  314. package/dist/client/router-types.d.ts.map +1 -0
  315. package/dist/client/router-url.d.ts +24 -0
  316. package/dist/client/router-url.d.ts.map +1 -0
  317. package/dist/client/router.d.ts +1 -97
  318. package/dist/client/router.d.ts.map +1 -1
  319. package/dist/client/rsc-fetch.d.ts +110 -28
  320. package/dist/client/rsc-fetch.d.ts.map +1 -1
  321. package/dist/client/segment-cache.d.ts +186 -25
  322. package/dist/client/segment-cache.d.ts.map +1 -1
  323. package/dist/client/segment-context.d.ts.map +1 -1
  324. package/dist/client/segment-outlet.d.ts +68 -0
  325. package/dist/client/segment-outlet.d.ts.map +1 -0
  326. package/dist/client/segment-update-context.d.ts +15 -0
  327. package/dist/client/segment-update-context.d.ts.map +1 -0
  328. package/dist/client/shallow-url.d.ts +10 -0
  329. package/dist/client/shallow-url.d.ts.map +1 -0
  330. package/dist/client/slot-content-cache-context.d.ts +35 -0
  331. package/dist/client/slot-content-cache-context.d.ts.map +1 -0
  332. package/dist/client/slot-context.d.ts +31 -0
  333. package/dist/client/slot-context.d.ts.map +1 -0
  334. package/dist/client/slot-outlet.d.ts +16 -0
  335. package/dist/client/slot-outlet.d.ts.map +1 -0
  336. package/dist/client/slot-provider.d.ts +25 -0
  337. package/dist/client/slot-provider.d.ts.map +1 -0
  338. package/dist/client/ssr-data.d.ts +26 -50
  339. package/dist/client/ssr-data.d.ts.map +1 -1
  340. package/dist/client/stale-client.d.ts +69 -0
  341. package/dist/client/stale-client.d.ts.map +1 -0
  342. package/dist/client/state.d.ts +21 -13
  343. package/dist/client/state.d.ts.map +1 -1
  344. package/dist/client/status-page-marker.d.ts +25 -0
  345. package/dist/client/status-page-marker.d.ts.map +1 -0
  346. package/dist/client/top-loader.d.ts +7 -6
  347. package/dist/client/top-loader.d.ts.map +1 -1
  348. package/dist/client/unload-guard.d.ts +5 -0
  349. package/dist/client/unload-guard.d.ts.map +1 -1
  350. package/dist/client/use-cookie.d.ts +12 -0
  351. package/dist/client/use-cookie.d.ts.map +1 -1
  352. package/dist/client/use-link-status.d.ts +5 -5
  353. package/dist/client/use-link-status.d.ts.map +1 -1
  354. package/dist/client/use-pathname.d.ts +13 -11
  355. package/dist/client/use-pathname.d.ts.map +1 -1
  356. package/dist/client/use-pending-navigation.d.ts +23 -0
  357. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  358. package/dist/client/use-query-states.d.ts +10 -4
  359. package/dist/client/use-query-states.d.ts.map +1 -1
  360. package/dist/client/use-router.d.ts +15 -8
  361. package/dist/client/use-router.d.ts.map +1 -1
  362. package/dist/client/use-search-params.d.ts +15 -8
  363. package/dist/client/use-search-params.d.ts.map +1 -1
  364. package/dist/client/use-segment-params.d.ts +55 -0
  365. package/dist/client/use-segment-params.d.ts.map +1 -0
  366. package/dist/codec.d.ts +69 -0
  367. package/dist/codec.d.ts.map +1 -0
  368. package/dist/codec.js +76 -0
  369. package/dist/codec.js.map +1 -0
  370. package/dist/config-types.d.ts +323 -0
  371. package/dist/config-types.d.ts.map +1 -0
  372. package/dist/config-validation.d.ts +68 -0
  373. package/dist/config-validation.d.ts.map +1 -0
  374. package/dist/cookies/define-cookie.d.ts +58 -25
  375. package/dist/cookies/define-cookie.d.ts.map +1 -1
  376. package/dist/cookies/index.d.ts +3 -2
  377. package/dist/cookies/index.d.ts.map +1 -1
  378. package/dist/cookies/index.js +256 -36
  379. package/dist/cookies/index.js.map +1 -1
  380. package/dist/cookies/json-cookie.d.ts +64 -0
  381. package/dist/cookies/json-cookie.d.ts.map +1 -0
  382. package/dist/cookies/validation.d.ts +34 -0
  383. package/dist/cookies/validation.d.ts.map +1 -0
  384. package/dist/dev-tools/404-page.d.ts +50 -0
  385. package/dist/dev-tools/404-page.d.ts.map +1 -0
  386. package/dist/dev-tools/browser-logs.d.ts +40 -0
  387. package/dist/dev-tools/browser-logs.d.ts.map +1 -0
  388. package/dist/dev-tools/dev-page-shell.d.ts +95 -0
  389. package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
  390. package/dist/dev-tools/error-page.d.ts +32 -0
  391. package/dist/dev-tools/error-page.d.ts.map +1 -0
  392. package/dist/dev-tools/holding-server.d.ts +46 -0
  393. package/dist/dev-tools/holding-server.d.ts.map +1 -0
  394. package/dist/dev-tools/hydration-overlay.d.ts +11 -0
  395. package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
  396. package/dist/dev-tools/index.d.ts +31 -0
  397. package/dist/dev-tools/index.d.ts.map +1 -0
  398. package/dist/dev-tools/instrumentation.d.ts +74 -0
  399. package/dist/dev-tools/instrumentation.d.ts.map +1 -0
  400. package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
  401. package/dist/dev-tools/logger.d.ts.map +1 -0
  402. package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +17 -3
  403. package/dist/dev-tools/logs.d.ts.map +1 -0
  404. package/dist/{plugins/dev-error-overlay.d.ts → dev-tools/overlay.d.ts} +15 -25
  405. package/dist/dev-tools/overlay.d.ts.map +1 -0
  406. package/dist/dev-tools/stack-classifier.d.ts +34 -0
  407. package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
  408. package/dist/dev-tools/terminal.d.ts +28 -0
  409. package/dist/dev-tools/terminal.d.ts.map +1 -0
  410. package/dist/fonts/ast-walk.d.ts +68 -0
  411. package/dist/fonts/ast-walk.d.ts.map +1 -0
  412. package/dist/fonts/ast.d.ts +112 -8
  413. package/dist/fonts/ast.d.ts.map +1 -1
  414. package/dist/fonts/bundle.d.ts +50 -0
  415. package/dist/fonts/bundle.d.ts.map +1 -0
  416. package/dist/fonts/css.d.ts +1 -1
  417. package/dist/fonts/dev-middleware.d.ts +22 -0
  418. package/dist/fonts/dev-middleware.d.ts.map +1 -0
  419. package/dist/fonts/fallbacks.d.ts +0 -7
  420. package/dist/fonts/fallbacks.d.ts.map +1 -1
  421. package/dist/fonts/google.d.ts +5 -3
  422. package/dist/fonts/google.d.ts.map +1 -1
  423. package/dist/fonts/local.d.ts +5 -5
  424. package/dist/fonts/local.d.ts.map +1 -1
  425. package/dist/fonts/paths.d.ts +43 -0
  426. package/dist/fonts/paths.d.ts.map +1 -0
  427. package/dist/fonts/pipeline.d.ts +177 -0
  428. package/dist/fonts/pipeline.d.ts.map +1 -0
  429. package/dist/fonts/transform.d.ts +82 -0
  430. package/dist/fonts/transform.d.ts.map +1 -0
  431. package/dist/fonts/types.d.ts +47 -1
  432. package/dist/fonts/types.d.ts.map +1 -1
  433. package/dist/fonts/virtual-modules.d.ts +77 -0
  434. package/dist/fonts/virtual-modules.d.ts.map +1 -0
  435. package/dist/index.d.ts +35 -181
  436. package/dist/index.d.ts.map +1 -1
  437. package/dist/index.js +8844 -14244
  438. package/dist/index.js.map +1 -1
  439. package/dist/params/codec-registry.d.ts +26 -0
  440. package/dist/params/codec-registry.d.ts.map +1 -0
  441. package/dist/params/define-schema.d.ts +81 -0
  442. package/dist/params/define-schema.d.ts.map +1 -0
  443. package/dist/params/index.d.ts +5 -0
  444. package/dist/params/index.d.ts.map +1 -0
  445. package/dist/params/index.js +34 -0
  446. package/dist/params/index.js.map +1 -0
  447. package/dist/params/resolve-schema.d.ts +34 -0
  448. package/dist/params/resolve-schema.d.ts.map +1 -0
  449. package/dist/plugin-context.d.ts +262 -0
  450. package/dist/plugin-context.d.ts.map +1 -0
  451. package/dist/plugins/build-manifest.d.ts +7 -3
  452. package/dist/plugins/build-manifest.d.ts.map +1 -1
  453. package/dist/plugins/build-report.d.ts +61 -11
  454. package/dist/plugins/build-report.d.ts.map +1 -1
  455. package/dist/plugins/cache.d.ts +64 -0
  456. package/dist/plugins/cache.d.ts.map +1 -0
  457. package/dist/plugins/callsite-ast.d.ts +117 -0
  458. package/dist/plugins/callsite-ast.d.ts.map +1 -0
  459. package/dist/plugins/callsite-jsx.d.ts +35 -0
  460. package/dist/plugins/callsite-jsx.d.ts.map +1 -0
  461. package/dist/plugins/chunks.d.ts +11 -4
  462. package/dist/plugins/chunks.d.ts.map +1 -1
  463. package/dist/plugins/client-chunks.d.ts +40 -0
  464. package/dist/plugins/client-chunks.d.ts.map +1 -0
  465. package/dist/plugins/cloudflare-wasm.d.ts +21 -0
  466. package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
  467. package/dist/plugins/content.d.ts +1 -1
  468. package/dist/plugins/content.d.ts.map +1 -1
  469. package/dist/plugins/dev-discovery.d.ts +123 -0
  470. package/dist/plugins/dev-discovery.d.ts.map +1 -0
  471. package/dist/plugins/dev-server.d.ts +24 -1
  472. package/dist/plugins/dev-server.d.ts.map +1 -1
  473. package/dist/plugins/entries.d.ts +28 -4
  474. package/dist/plugins/entries.d.ts.map +1 -1
  475. package/dist/plugins/fonts.d.ts +35 -74
  476. package/dist/plugins/fonts.d.ts.map +1 -1
  477. package/dist/plugins/graph-endpoint.d.ts +112 -0
  478. package/dist/plugins/graph-endpoint.d.ts.map +1 -0
  479. package/dist/plugins/mdx.d.ts +18 -5
  480. package/dist/plugins/mdx.d.ts.map +1 -1
  481. package/dist/plugins/post-build.d.ts +110 -0
  482. package/dist/plugins/post-build.d.ts.map +1 -0
  483. package/dist/plugins/prebuilt-capture.d.ts +67 -0
  484. package/dist/plugins/prebuilt-capture.d.ts.map +1 -0
  485. package/dist/plugins/prebuilt-options-analysis.d.ts +40 -0
  486. package/dist/plugins/prebuilt-options-analysis.d.ts.map +1 -0
  487. package/dist/plugins/prebuilt.d.ts +98 -0
  488. package/dist/plugins/prebuilt.d.ts.map +1 -0
  489. package/dist/plugins/prerender-sugar.d.ts +39 -0
  490. package/dist/plugins/prerender-sugar.d.ts.map +1 -0
  491. package/dist/plugins/react-resolve.d.ts +49 -0
  492. package/dist/plugins/react-resolve.d.ts.map +1 -0
  493. package/dist/plugins/request-dep/analysis.d.ts +106 -0
  494. package/dist/plugins/request-dep/analysis.d.ts.map +1 -0
  495. package/dist/plugins/request-dep/index.d.ts +75 -0
  496. package/dist/plugins/request-dep/index.d.ts.map +1 -0
  497. package/dist/plugins/request-dep/origin.d.ts +61 -0
  498. package/dist/plugins/request-dep/origin.d.ts.map +1 -0
  499. package/dist/plugins/routing.d.ts +1 -1
  500. package/dist/plugins/routing.d.ts.map +1 -1
  501. package/dist/plugins/rsc-assets-manifest.d.ts +33 -0
  502. package/dist/plugins/rsc-assets-manifest.d.ts.map +1 -0
  503. package/dist/plugins/server-bundle.d.ts.map +1 -1
  504. package/dist/plugins/shims.d.ts +29 -5
  505. package/dist/plugins/shims.d.ts.map +1 -1
  506. package/dist/plugins/static-build.d.ts +246 -26
  507. package/dist/plugins/static-build.d.ts.map +1 -1
  508. package/dist/routing/codegen-shared.d.ts +26 -0
  509. package/dist/routing/codegen-shared.d.ts.map +1 -0
  510. package/dist/routing/codegen-types.d.ts +61 -0
  511. package/dist/routing/codegen-types.d.ts.map +1 -0
  512. package/dist/routing/codegen-write.d.ts +42 -0
  513. package/dist/routing/codegen-write.d.ts.map +1 -0
  514. package/dist/routing/codegen.d.ts +8 -3
  515. package/dist/routing/codegen.d.ts.map +1 -1
  516. package/dist/routing/collision-probe.d.ts +104 -0
  517. package/dist/routing/collision-probe.d.ts.map +1 -0
  518. package/dist/routing/collision-spaces.d.ts +26 -0
  519. package/dist/routing/collision-spaces.d.ts.map +1 -0
  520. package/dist/routing/convention-lint.d.ts +55 -0
  521. package/dist/routing/convention-lint.d.ts.map +1 -0
  522. package/dist/routing/export-detect.d.ts +91 -0
  523. package/dist/routing/export-detect.d.ts.map +1 -0
  524. package/dist/routing/file-cache.d.ts +8 -0
  525. package/dist/routing/file-cache.d.ts.map +1 -0
  526. package/dist/routing/index.d.ts +13 -7
  527. package/dist/routing/index.d.ts.map +1 -1
  528. package/dist/routing/index.js +5 -2
  529. package/dist/routing/interception-overlap.d.ts +35 -0
  530. package/dist/routing/interception-overlap.d.ts.map +1 -0
  531. package/dist/routing/interception.d.ts +234 -10
  532. package/dist/routing/interception.d.ts.map +1 -1
  533. package/dist/routing/link-codegen.d.ts +105 -0
  534. package/dist/routing/link-codegen.d.ts.map +1 -0
  535. package/dist/routing/manifest-codegen.d.ts +26 -0
  536. package/dist/routing/manifest-codegen.d.ts.map +1 -0
  537. package/dist/routing/scanner.d.ts +14 -10
  538. package/dist/routing/scanner.d.ts.map +1 -1
  539. package/dist/routing/schema-validation.d.ts +35 -0
  540. package/dist/routing/schema-validation.d.ts.map +1 -0
  541. package/dist/routing/segment-classify.d.ts +114 -0
  542. package/dist/routing/segment-classify.d.ts.map +1 -0
  543. package/dist/routing/segment-codegen.d.ts +38 -0
  544. package/dist/routing/segment-codegen.d.ts.map +1 -0
  545. package/dist/routing/segment-keys.d.ts +118 -0
  546. package/dist/routing/segment-keys.d.ts.map +1 -0
  547. package/dist/routing/slot-placement.d.ts +48 -0
  548. package/dist/routing/slot-placement.d.ts.map +1 -0
  549. package/dist/routing/types.d.ts +81 -26
  550. package/dist/routing/types.d.ts.map +1 -1
  551. package/dist/routing/walkers.d.ts +57 -0
  552. package/dist/routing/walkers.d.ts.map +1 -0
  553. package/dist/rsc-runtime/rsc.d.ts +1 -1
  554. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  555. package/dist/rsc-runtime/ssr.d.ts +14 -0
  556. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  557. package/dist/rsc-runtime/transforms.d.ts +13 -0
  558. package/dist/rsc-runtime/transforms.d.ts.map +1 -0
  559. package/dist/schema-bridge.d.ts +145 -0
  560. package/dist/schema-bridge.d.ts.map +1 -0
  561. package/dist/search-params/define.d.ts +262 -0
  562. package/dist/search-params/define.d.ts.map +1 -0
  563. package/dist/search-params/index.d.ts +3 -7
  564. package/dist/search-params/index.d.ts.map +1 -1
  565. package/dist/search-params/index.js +179 -360
  566. package/dist/search-params/index.js.map +1 -1
  567. package/dist/search-params/parse-total.d.ts +81 -0
  568. package/dist/search-params/parse-total.d.ts.map +1 -0
  569. package/dist/search-params/serialize-equal.d.ts +9 -0
  570. package/dist/search-params/serialize-equal.d.ts.map +1 -0
  571. package/dist/search-params/wrappers.d.ts +76 -0
  572. package/dist/search-params/wrappers.d.ts.map +1 -0
  573. package/dist/server/access-gate.d.ts +98 -10
  574. package/dist/server/access-gate.d.ts.map +1 -1
  575. package/dist/server/action-client.d.ts +44 -9
  576. package/dist/server/action-client.d.ts.map +1 -1
  577. package/dist/server/action-encryption.d.ts +76 -0
  578. package/dist/server/action-encryption.d.ts.map +1 -0
  579. package/dist/server/action-handler.d.ts +40 -5
  580. package/dist/server/action-handler.d.ts.map +1 -1
  581. package/dist/server/actions.d.ts +78 -40
  582. package/dist/server/actions.d.ts.map +1 -1
  583. package/dist/server/als-registry.d.ts +166 -16
  584. package/dist/server/als-registry.d.ts.map +1 -1
  585. package/dist/server/body-limits.d.ts.map +1 -1
  586. package/dist/server/build-manifest.d.ts +25 -30
  587. package/dist/server/build-manifest.d.ts.map +1 -1
  588. package/dist/server/canonicalize.d.ts +10 -0
  589. package/dist/server/canonicalize.d.ts.map +1 -1
  590. package/dist/server/chain-url-parts.d.ts +82 -0
  591. package/dist/server/chain-url-parts.d.ts.map +1 -0
  592. package/dist/server/children-interception.d.ts +49 -0
  593. package/dist/server/children-interception.d.ts.map +1 -0
  594. package/dist/server/coalesce-tick.d.ts +40 -0
  595. package/dist/server/coalesce-tick.d.ts.map +1 -0
  596. package/dist/server/compress.d.ts.map +1 -1
  597. package/dist/server/cookie-context.d.ts +149 -0
  598. package/dist/server/cookie-context.d.ts.map +1 -0
  599. package/dist/server/cookie-parsing.d.ts +65 -0
  600. package/dist/server/cookie-parsing.d.ts.map +1 -0
  601. package/dist/server/csp-nonce.d.ts +36 -0
  602. package/dist/server/csp-nonce.d.ts.map +1 -0
  603. package/dist/server/csrf.d.ts +58 -15
  604. package/dist/server/csrf.d.ts.map +1 -1
  605. package/dist/server/debug.d.ts +0 -1
  606. package/dist/server/debug.d.ts.map +1 -1
  607. package/dist/server/default-logger.d.ts +23 -0
  608. package/dist/server/default-logger.d.ts.map +1 -0
  609. package/dist/server/default-status-page.d.ts +45 -0
  610. package/dist/server/default-status-page.d.ts.map +1 -0
  611. package/dist/server/deny-boundary.d.ts +257 -0
  612. package/dist/server/deny-boundary.d.ts.map +1 -0
  613. package/dist/server/deny-renderer.d.ts +21 -15
  614. package/dist/server/deny-renderer.d.ts.map +1 -1
  615. package/dist/server/early-hints-sender.d.ts.map +1 -1
  616. package/dist/server/early-hints.d.ts +14 -12
  617. package/dist/server/early-hints.d.ts.map +1 -1
  618. package/dist/server/error-boundary-wrapper.d.ts +102 -10
  619. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  620. package/dist/server/error-response-headers.d.ts +3 -0
  621. package/dist/server/error-response-headers.d.ts.map +1 -0
  622. package/dist/server/fallback-error.d.ts +19 -7
  623. package/dist/server/fallback-error.d.ts.map +1 -1
  624. package/dist/server/flight-injection-state.d.ts +66 -0
  625. package/dist/server/flight-injection-state.d.ts.map +1 -0
  626. package/dist/server/flight-scripts.d.ts +45 -0
  627. package/dist/server/flight-scripts.d.ts.map +1 -0
  628. package/dist/server/form-data.d.ts +41 -0
  629. package/dist/server/form-data.d.ts.map +1 -1
  630. package/dist/server/form-flash.d.ts +2 -2
  631. package/dist/server/head-response.d.ts +35 -0
  632. package/dist/server/head-response.d.ts.map +1 -0
  633. package/dist/server/html-injector-core.d.ts +257 -0
  634. package/dist/server/html-injector-core.d.ts.map +1 -0
  635. package/dist/server/html-injectors.d.ts +84 -42
  636. package/dist/server/html-injectors.d.ts.map +1 -1
  637. package/dist/server/index.d.ts +17 -54
  638. package/dist/server/index.d.ts.map +1 -1
  639. package/dist/server/index.js +195 -2922
  640. package/dist/server/index.js.map +1 -1
  641. package/dist/server/instrumentation.d.ts +11 -4
  642. package/dist/server/instrumentation.d.ts.map +1 -1
  643. package/dist/server/internal.d.ts +47 -0
  644. package/dist/server/internal.d.ts.map +1 -0
  645. package/dist/server/internal.js +4645 -0
  646. package/dist/server/internal.js.map +1 -0
  647. package/dist/server/json-status-response.d.ts +34 -0
  648. package/dist/server/json-status-response.d.ts.map +1 -0
  649. package/dist/server/logger.d.ts +78 -7
  650. package/dist/server/logger.d.ts.map +1 -1
  651. package/dist/server/metadata-collector.d.ts +73 -0
  652. package/dist/server/metadata-collector.d.ts.map +1 -0
  653. package/dist/server/metadata-platform.d.ts +2 -2
  654. package/dist/server/metadata-render.d.ts +2 -2
  655. package/dist/server/metadata-render.d.ts.map +1 -1
  656. package/dist/server/metadata-routes.d.ts +71 -11
  657. package/dist/server/metadata-routes.d.ts.map +1 -1
  658. package/dist/server/metadata-social.d.ts +2 -2
  659. package/dist/server/metadata.d.ts +10 -2
  660. package/dist/server/metadata.d.ts.map +1 -1
  661. package/dist/server/middleware-runner.d.ts +20 -5
  662. package/dist/server/middleware-runner.d.ts.map +1 -1
  663. package/dist/server/node-stream-transforms.d.ts +105 -0
  664. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  665. package/dist/server/nuqs-ssr-provider.d.ts +7 -3
  666. package/dist/server/nuqs-ssr-provider.d.ts.map +1 -1
  667. package/dist/server/param-coercion.d.ts +83 -0
  668. package/dist/server/param-coercion.d.ts.map +1 -0
  669. package/dist/server/pipeline-helpers.d.ts +193 -0
  670. package/dist/server/pipeline-helpers.d.ts.map +1 -0
  671. package/dist/server/pipeline-interception.d.ts +70 -9
  672. package/dist/server/pipeline-interception.d.ts.map +1 -1
  673. package/dist/server/pipeline-metadata.d.ts +7 -1
  674. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  675. package/dist/server/pipeline-outcome.d.ts +59 -0
  676. package/dist/server/pipeline-outcome.d.ts.map +1 -0
  677. package/dist/server/pipeline-phases.d.ts +70 -0
  678. package/dist/server/pipeline-phases.d.ts.map +1 -0
  679. package/dist/server/pipeline.d.ts +147 -23
  680. package/dist/server/pipeline.d.ts.map +1 -1
  681. package/dist/server/port-resolution.d.ts +31 -0
  682. package/dist/server/port-resolution.d.ts.map +1 -0
  683. package/dist/server/prebuilt/cache-key.d.ts +63 -0
  684. package/dist/server/prebuilt/cache-key.d.ts.map +1 -0
  685. package/dist/server/prebuilt/capture-render.d.ts +25 -0
  686. package/dist/server/prebuilt/capture-render.d.ts.map +1 -0
  687. package/dist/server/prebuilt/capture-routes.d.ts +37 -0
  688. package/dist/server/prebuilt/capture-routes.d.ts.map +1 -0
  689. package/dist/server/prebuilt/capture-state.d.ts +101 -0
  690. package/dist/server/prebuilt/capture-state.d.ts.map +1 -0
  691. package/dist/server/prebuilt/key-discipline.d.ts +52 -0
  692. package/dist/server/prebuilt/key-discipline.d.ts.map +1 -0
  693. package/dist/server/prebuilt/lifetime.d.ts +38 -0
  694. package/dist/server/prebuilt/lifetime.d.ts.map +1 -0
  695. package/dist/server/prebuilt/manifest-tag-index.d.ts +27 -0
  696. package/dist/server/prebuilt/manifest-tag-index.d.ts.map +1 -0
  697. package/dist/server/prebuilt/overlay.d.ts +100 -0
  698. package/dist/server/prebuilt/overlay.d.ts.map +1 -0
  699. package/dist/server/prebuilt/payload-source.d.ts +79 -0
  700. package/dist/server/prebuilt/payload-source.d.ts.map +1 -0
  701. package/dist/server/prebuilt/slots.d.ts +106 -0
  702. package/dist/server/prebuilt/slots.d.ts.map +1 -0
  703. package/dist/server/prebuilt/synthetic-store.d.ts +67 -0
  704. package/dist/server/prebuilt/synthetic-store.d.ts.map +1 -0
  705. package/dist/server/prebuilt-builder.d.ts +121 -0
  706. package/dist/server/prebuilt-builder.d.ts.map +1 -0
  707. package/dist/server/prebuilt-runtime.d.ts +111 -0
  708. package/dist/server/prebuilt-runtime.d.ts.map +1 -0
  709. package/dist/server/primitives.d.ts +101 -90
  710. package/dist/server/primitives.d.ts.map +1 -1
  711. package/dist/server/publish-params.d.ts +33 -0
  712. package/dist/server/publish-params.d.ts.map +1 -0
  713. package/dist/server/react-cache-bridge.d.ts +59 -0
  714. package/dist/server/react-cache-bridge.d.ts.map +1 -0
  715. package/dist/server/react-cache-scope.d.ts +49 -0
  716. package/dist/server/react-cache-scope.d.ts.map +1 -0
  717. package/dist/server/render-timeout.d.ts +66 -0
  718. package/dist/server/render-timeout.d.ts.map +1 -0
  719. package/dist/server/render-utils.d.ts +35 -0
  720. package/dist/server/render-utils.d.ts.map +1 -0
  721. package/dist/server/request-context.d.ts +128 -103
  722. package/dist/server/request-context.d.ts.map +1 -1
  723. package/dist/server/request-dep.d.ts +15 -0
  724. package/dist/server/request-dep.d.ts.map +1 -0
  725. package/dist/server/response-cache-policy.d.ts +3 -0
  726. package/dist/server/response-cache-policy.d.ts.map +1 -0
  727. package/dist/server/route-element-builder.d.ts +57 -30
  728. package/dist/server/route-element-builder.d.ts.map +1 -1
  729. package/dist/server/route-element-helpers.d.ts +12 -0
  730. package/dist/server/route-element-helpers.d.ts.map +1 -0
  731. package/dist/server/route-handler.d.ts +1 -1
  732. package/dist/server/route-handler.d.ts.map +1 -1
  733. package/dist/server/route-matcher.d.ts +55 -38
  734. package/dist/server/route-matcher.d.ts.map +1 -1
  735. package/dist/server/route-module-loader.d.ts +37 -0
  736. package/dist/server/route-module-loader.d.ts.map +1 -0
  737. package/dist/server/rsc-cache-key-guard.d.ts +78 -0
  738. package/dist/server/rsc-cache-key-guard.d.ts.map +1 -0
  739. package/dist/server/rsc-entry/action-dispatcher.d.ts +67 -0
  740. package/dist/server/rsc-entry/action-dispatcher.d.ts.map +1 -0
  741. package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
  742. package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
  743. package/dist/server/rsc-entry/api-handler.d.ts +19 -3
  744. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  745. package/dist/server/rsc-entry/deny-fallback.d.ts +55 -0
  746. package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -0
  747. package/dist/server/rsc-entry/error-renderer.d.ts +35 -21
  748. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  749. package/dist/server/rsc-entry/helpers.d.ts +14 -59
  750. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  751. package/dist/server/rsc-entry/index.d.ts +30 -6
  752. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  753. package/dist/server/rsc-entry/render-route.d.ts +50 -0
  754. package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
  755. package/dist/server/rsc-entry/render-signals.d.ts +65 -0
  756. package/dist/server/rsc-entry/render-signals.d.ts.map +1 -0
  757. package/dist/server/rsc-entry/revalidate-renderer.d.ts +98 -0
  758. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
  759. package/dist/server/rsc-entry/rsc-payload.d.ts +30 -6
  760. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  761. package/dist/server/rsc-entry/rsc-stream.d.ts +12 -30
  762. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  763. package/dist/server/rsc-entry/ssr-bridge.d.ts +6 -2
  764. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  765. package/dist/server/rsc-entry/ssr-renderer.d.ts +44 -7
  766. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  767. package/dist/server/rsc-error-envelope.d.ts +11 -0
  768. package/dist/server/rsc-error-envelope.d.ts.map +1 -0
  769. package/dist/server/safe-load.d.ts +39 -0
  770. package/dist/server/safe-load.d.ts.map +1 -0
  771. package/dist/server/sensitive-fields.d.ts +74 -0
  772. package/dist/server/sensitive-fields.d.ts.map +1 -0
  773. package/dist/server/signal-identity.d.ts +43 -0
  774. package/dist/server/signal-identity.d.ts.map +1 -0
  775. package/dist/server/sitemap-generator.d.ts +130 -0
  776. package/dist/server/sitemap-generator.d.ts.map +1 -0
  777. package/dist/server/sitemap-handler.d.ts +22 -0
  778. package/dist/server/sitemap-handler.d.ts.map +1 -0
  779. package/dist/server/skippable-prefix.d.ts +29 -0
  780. package/dist/server/skippable-prefix.d.ts.map +1 -0
  781. package/dist/server/slot-interception.d.ts +80 -0
  782. package/dist/server/slot-interception.d.ts.map +1 -0
  783. package/dist/server/slot-resolver.d.ts +138 -7
  784. package/dist/server/slot-resolver.d.ts.map +1 -1
  785. package/dist/server/slot-subtree-contain.d.ts +54 -0
  786. package/dist/server/slot-subtree-contain.d.ts.map +1 -0
  787. package/dist/server/ssr-bridge-types.d.ts +198 -0
  788. package/dist/server/ssr-bridge-types.d.ts.map +1 -0
  789. package/dist/server/ssr-entry.d.ts +8 -47
  790. package/dist/server/ssr-entry.d.ts.map +1 -1
  791. package/dist/server/ssr-render.d.ts +60 -27
  792. package/dist/server/ssr-render.d.ts.map +1 -1
  793. package/dist/server/ssr-wrappers.d.ts +93 -0
  794. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  795. package/dist/server/state-tree-diff.d.ts +44 -9
  796. package/dist/server/state-tree-diff.d.ts.map +1 -1
  797. package/dist/server/static-generator.d.ts +112 -0
  798. package/dist/server/static-generator.d.ts.map +1 -0
  799. package/dist/server/static-not-found.d.ts +52 -0
  800. package/dist/server/static-not-found.d.ts.map +1 -0
  801. package/dist/server/status-code-resolver.d.ts +26 -15
  802. package/dist/server/status-code-resolver.d.ts.map +1 -1
  803. package/dist/server/stream-utils.d.ts +59 -0
  804. package/dist/server/stream-utils.d.ts.map +1 -0
  805. package/dist/server/tracing.d.ts +57 -26
  806. package/dist/server/tracing.d.ts.map +1 -1
  807. package/dist/server/tree-match.d.ts +59 -0
  808. package/dist/server/tree-match.d.ts.map +1 -0
  809. package/dist/server/types.d.ts +89 -8
  810. package/dist/server/types.d.ts.map +1 -1
  811. package/dist/server/utils/element-type.d.ts +50 -0
  812. package/dist/server/utils/element-type.d.ts.map +1 -0
  813. package/dist/server/utils/escape-html.d.ts +14 -0
  814. package/dist/server/utils/escape-html.d.ts.map +1 -0
  815. package/dist/server/version-skew.d.ts +61 -0
  816. package/dist/server/version-skew.d.ts.map +1 -0
  817. package/dist/server/workers-cache-bridge.d.ts +26 -0
  818. package/dist/server/workers-cache-bridge.d.ts.map +1 -0
  819. package/dist/shared/als-slots.d.ts +42 -0
  820. package/dist/shared/als-slots.d.ts.map +1 -0
  821. package/dist/shared/base-path.d.ts +56 -0
  822. package/dist/shared/base-path.d.ts.map +1 -0
  823. package/dist/shared/csrf-reject.d.ts +16 -0
  824. package/dist/shared/csrf-reject.d.ts.map +1 -0
  825. package/dist/shared/error-digest.d.ts +28 -0
  826. package/dist/shared/error-digest.d.ts.map +1 -0
  827. package/dist/shared/href-validation.d.ts +49 -0
  828. package/dist/shared/href-validation.d.ts.map +1 -0
  829. package/dist/shared/merge-search-params.d.ts +22 -0
  830. package/dist/shared/merge-search-params.d.ts.map +1 -0
  831. package/dist/shared/param-value.d.ts +104 -0
  832. package/dist/shared/param-value.d.ts.map +1 -0
  833. package/dist/shared/payload-root.d.ts +110 -0
  834. package/dist/shared/payload-root.d.ts.map +1 -0
  835. package/dist/shared/redirect-type.d.ts +17 -0
  836. package/dist/shared/redirect-type.d.ts.map +1 -0
  837. package/dist/shared/rsc-cache-key.d.ts +163 -0
  838. package/dist/shared/rsc-cache-key.d.ts.map +1 -0
  839. package/dist/shared/rsc-error-envelope.d.ts +16 -0
  840. package/dist/shared/rsc-error-envelope.d.ts.map +1 -0
  841. package/dist/shared/rsc-manifest.d.ts +28 -0
  842. package/dist/shared/rsc-manifest.d.ts.map +1 -0
  843. package/dist/shared/rsc-media-type.d.ts +52 -0
  844. package/dist/shared/rsc-media-type.d.ts.map +1 -0
  845. package/dist/shared/rsc-payload-path.d.ts +48 -0
  846. package/dist/shared/rsc-payload-path.d.ts.map +1 -0
  847. package/dist/shared/segment-info.d.ts +66 -0
  848. package/dist/shared/segment-info.d.ts.map +1 -0
  849. package/dist/shared/slot-params.d.ts +52 -0
  850. package/dist/shared/slot-params.d.ts.map +1 -0
  851. package/dist/shared/static-platform-files.d.ts +71 -0
  852. package/dist/shared/static-platform-files.d.ts.map +1 -0
  853. package/dist/shared/status-reason-phrase.d.ts +26 -0
  854. package/dist/shared/status-reason-phrase.d.ts.map +1 -0
  855. package/dist/shims/font-google.d.ts +1 -1
  856. package/dist/shims/font-google.d.ts.map +1 -1
  857. package/dist/shims/font-google.js +42 -0
  858. package/dist/shims/font-google.js.map +1 -0
  859. package/dist/shims/font-local.d.ts +26 -0
  860. package/dist/shims/font-local.d.ts.map +1 -0
  861. package/dist/shims/font-local.js +20 -0
  862. package/dist/shims/font-local.js.map +1 -0
  863. package/dist/shims/headers.d.ts +53 -1
  864. package/dist/shims/headers.d.ts.map +1 -1
  865. package/dist/shims/image.d.ts +120 -120
  866. package/dist/shims/image.d.ts.map +1 -1
  867. package/dist/shims/navigation-client.d.ts +25 -12
  868. package/dist/shims/navigation-client.d.ts.map +1 -1
  869. package/dist/shims/navigation-rsc.d.ts +21 -0
  870. package/dist/shims/navigation-rsc.d.ts.map +1 -0
  871. package/dist/shims/navigation.d.ts +10 -5
  872. package/dist/shims/navigation.d.ts.map +1 -1
  873. package/dist/utils/state-machine.d.ts +80 -0
  874. package/dist/utils/state-machine.d.ts.map +1 -0
  875. package/dist/utils/write-file-atomic.d.ts +17 -0
  876. package/dist/utils/write-file-atomic.d.ts.map +1 -0
  877. package/docs/api/30-api-server.mdx +239 -0
  878. package/docs/api/31-api-client.mdx +170 -0
  879. package/docs/api/32-api-cache.mdx +339 -0
  880. package/docs/api/33-api-search-params.mdx +176 -0
  881. package/docs/api/34-api-config.mdx +359 -0
  882. package/docs/api/35-api-typescript.mdx +91 -0
  883. package/docs/api/36-cli.mdx +202 -0
  884. package/docs/learn/00-introduction.mdx +109 -0
  885. package/docs/learn/01-quick-start.mdx +94 -0
  886. package/docs/learn/02-pages-and-layouts.mdx +147 -0
  887. package/docs/learn/03-fetching-data.mdx +227 -0
  888. package/docs/learn/04-access-control.mdx +115 -0
  889. package/docs/learn/05-the-flush-point.mdx +175 -0
  890. package/docs/learn/06-typed-params.mdx +275 -0
  891. package/docs/learn/07-typed-routes.mdx +108 -0
  892. package/docs/learn/08-forms-and-actions.mdx +146 -0
  893. package/docs/learn/09-streaming.mdx +140 -0
  894. package/docs/learn/10-caching.mdx +270 -0
  895. package/docs/learn/11-middleware.mdx +164 -0
  896. package/docs/learn/12-error-handling.mdx +192 -0
  897. package/docs/learn/13-deploying.mdx +287 -0
  898. package/llms.txt +55 -0
  899. package/package.json +120 -29
  900. package/src/adapters/build-output-helper.ts +353 -0
  901. package/src/adapters/canonicalize-module.ts +29 -0
  902. package/src/adapters/cloudflare-dev.ts +183 -0
  903. package/src/adapters/cloudflare-kv-cache.ts +207 -0
  904. package/src/adapters/cloudflare.ts +809 -150
  905. package/src/adapters/compress-module.ts +110 -86
  906. package/src/adapters/fs-identity.ts +155 -0
  907. package/src/adapters/nitro-presets.ts +124 -0
  908. package/src/adapters/nitro-preview.ts +476 -0
  909. package/src/adapters/nitro.ts +317 -457
  910. package/src/adapters/raw-imports.d.ts +5 -0
  911. package/src/adapters/shared.ts +283 -0
  912. package/src/adapters/types.ts +127 -17
  913. package/src/adapters/wrangler.d.ts +7 -0
  914. package/src/analyze/chains.ts +411 -0
  915. package/src/analyze/classify.ts +259 -0
  916. package/src/analyze/crawl-entry.ts +68 -0
  917. package/src/analyze/crawl.ts +500 -0
  918. package/src/analyze/graph-cache.ts +331 -0
  919. package/src/analyze/graph-command.ts +762 -0
  920. package/src/analyze/live-graph.ts +232 -0
  921. package/src/analyze/poison-rules.ts +165 -0
  922. package/src/analyze/poison-scan.ts +162 -0
  923. package/src/analyze/scan.ts +149 -0
  924. package/src/cache/cache-api.ts +107 -0
  925. package/src/cache/fast-hash.ts +5 -0
  926. package/src/cache/handler-store.ts +76 -0
  927. package/src/cache/index.ts +115 -22
  928. package/src/cache/invalidation-epoch.ts +93 -0
  929. package/src/cache/json-lossy-check.ts +69 -0
  930. package/src/cache/redis-handler.ts +198 -20
  931. package/src/cache/singleflight.ts +72 -6
  932. package/src/cache/sizeof.ts +35 -0
  933. package/src/cache/stable-stringify.ts +65 -2
  934. package/src/cache/store.ts +71 -0
  935. package/src/cache/stores/cloudflare-kv.ts +52 -0
  936. package/src/cache/stores/memory.ts +125 -0
  937. package/src/cache/stores/redis.ts +97 -0
  938. package/src/cache/stores/vercel.ts +59 -0
  939. package/src/cache/tag-aware-handler.ts +254 -0
  940. package/src/cache/timber-cache.ts +165 -40
  941. package/src/cdn/cloudflare-purge.ts +50 -0
  942. package/src/cdn/fastly-purge.ts +63 -0
  943. package/src/cdn/headers.ts +153 -0
  944. package/src/cdn/index.ts +23 -0
  945. package/src/cdn/purge-store.ts +34 -0
  946. package/src/cdn/workers-cache-purge.ts +34 -0
  947. package/src/cli-check.ts +417 -0
  948. package/src/cli-context.ts +119 -0
  949. package/src/cli-schema-sync.ts +401 -0
  950. package/src/cli.ts +330 -78
  951. package/src/client/browser-dev.ts +192 -5
  952. package/src/client/browser-entry/action-dispatch.ts +237 -0
  953. package/src/client/browser-entry/action-queue.ts +152 -0
  954. package/src/client/browser-entry/hmr.ts +70 -0
  955. package/src/client/browser-entry/hydrate.ts +143 -0
  956. package/src/client/browser-entry/index.ts +120 -0
  957. package/src/client/browser-entry/post-hydration.ts +99 -0
  958. package/src/client/browser-entry/router-init.ts +406 -0
  959. package/src/client/browser-entry/rsc-stream.ts +145 -0
  960. package/src/client/browser-entry/scroll.ts +50 -0
  961. package/src/client/deny-last-resort.tsx +54 -0
  962. package/src/client/error-boundary.tsx +279 -61
  963. package/src/client/error-reconstituter.tsx +84 -0
  964. package/src/client/form.tsx +36 -32
  965. package/src/client/global-context.ts +31 -0
  966. package/src/client/history.ts +74 -11
  967. package/src/client/index.ts +89 -53
  968. package/src/client/internal.ts +54 -0
  969. package/src/client/link.tsx +468 -151
  970. package/src/client/location-search.ts +15 -0
  971. package/src/client/navigation-api.ts +380 -0
  972. package/src/client/navigation-commit.ts +318 -0
  973. package/src/client/navigation-context.ts +67 -134
  974. package/src/client/navigation-root.tsx +236 -0
  975. package/src/client/navigation-transition.ts +337 -0
  976. package/src/client/nuqs-adapter.tsx +21 -9
  977. package/src/client/params-context.ts +187 -0
  978. package/src/client/react-root.ts +82 -0
  979. package/src/client/router-effects.ts +235 -0
  980. package/src/client/router-lifecycle.ts +354 -0
  981. package/src/client/router-pipeline.ts +458 -0
  982. package/src/client/router-ref.ts +3 -3
  983. package/src/client/router-skew.ts +30 -0
  984. package/src/client/router-types.ts +370 -0
  985. package/src/client/router-url.ts +32 -0
  986. package/src/client/router.ts +491 -424
  987. package/src/client/rsc-fetch.ts +510 -109
  988. package/src/client/segment-cache.ts +362 -41
  989. package/src/client/segment-context.ts +7 -4
  990. package/src/client/segment-outlet.tsx +96 -0
  991. package/src/client/segment-update-context.ts +23 -0
  992. package/src/client/shallow-url.ts +22 -0
  993. package/src/client/slot-content-cache-context.ts +43 -0
  994. package/src/client/slot-context.ts +50 -0
  995. package/src/client/slot-outlet.tsx +22 -0
  996. package/src/client/slot-provider.tsx +32 -0
  997. package/src/client/ssr-data.ts +27 -67
  998. package/src/client/stale-client.ts +191 -0
  999. package/src/client/state.ts +31 -24
  1000. package/src/client/status-page-marker.tsx +32 -0
  1001. package/src/client/top-loader.tsx +13 -10
  1002. package/src/client/unload-guard.ts +35 -3
  1003. package/src/client/use-cookie.ts +70 -18
  1004. package/src/client/use-link-status.ts +7 -7
  1005. package/src/client/use-pathname.ts +22 -31
  1006. package/src/client/use-pending-navigation.ts +40 -0
  1007. package/src/client/use-query-states.ts +206 -36
  1008. package/src/client/use-router.ts +31 -9
  1009. package/src/client/use-search-params.ts +38 -49
  1010. package/src/client/use-segment-params.ts +69 -0
  1011. package/src/client/use-selected-layout-segment.ts +2 -2
  1012. package/src/codec.ts +149 -0
  1013. package/src/config-types.ts +323 -0
  1014. package/src/config-validation.ts +464 -0
  1015. package/src/cookies/define-cookie.ts +222 -53
  1016. package/src/cookies/index.ts +13 -2
  1017. package/src/cookies/json-cookie.ts +105 -0
  1018. package/src/cookies/validation.ts +192 -0
  1019. package/src/dev-tools/404-page.ts +286 -0
  1020. package/src/dev-tools/browser-logs.ts +55 -0
  1021. package/src/dev-tools/dev-page-shell.ts +278 -0
  1022. package/src/dev-tools/error-page.ts +331 -0
  1023. package/src/dev-tools/holding-server.ts +185 -0
  1024. package/src/dev-tools/hydration-overlay.ts +158 -0
  1025. package/src/dev-tools/index.ts +79 -0
  1026. package/src/dev-tools/instrumentation.ts +261 -0
  1027. package/src/{server/dev-logger.ts → dev-tools/logger.ts} +33 -51
  1028. package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +122 -26
  1029. package/src/{plugins/dev-error-overlay.ts → dev-tools/overlay.ts} +25 -80
  1030. package/src/dev-tools/stack-classifier.ts +75 -0
  1031. package/src/dev-tools/terminal.ts +182 -0
  1032. package/src/fonts/ast-walk.ts +235 -0
  1033. package/src/fonts/ast.ts +479 -128
  1034. package/src/fonts/bundle.ts +138 -0
  1035. package/src/fonts/css.ts +1 -1
  1036. package/src/fonts/dev-middleware.ts +85 -0
  1037. package/src/fonts/fallbacks.ts +0 -23
  1038. package/src/fonts/google.ts +101 -19
  1039. package/src/fonts/local.ts +12 -11
  1040. package/src/fonts/paths.ts +58 -0
  1041. package/src/fonts/pipeline.ts +348 -0
  1042. package/src/fonts/transform.ts +311 -0
  1043. package/src/fonts/types.ts +52 -1
  1044. package/src/fonts/virtual-modules.ts +179 -0
  1045. package/src/index.ts +494 -380
  1046. package/src/params/codec-registry.ts +34 -0
  1047. package/src/params/define-schema.ts +115 -0
  1048. package/src/params/index.ts +17 -0
  1049. package/src/params/resolve-schema.ts +84 -0
  1050. package/src/plugin-context.ts +502 -0
  1051. package/src/plugins/build-manifest.ts +204 -36
  1052. package/src/plugins/build-report.ts +299 -87
  1053. package/src/plugins/cache.ts +243 -0
  1054. package/src/plugins/callsite-ast.ts +472 -0
  1055. package/src/plugins/callsite-jsx.ts +243 -0
  1056. package/src/plugins/chunks.ts +74 -5
  1057. package/src/plugins/client-chunks.ts +185 -0
  1058. package/src/plugins/cloudflare-wasm.ts +141 -0
  1059. package/src/plugins/content.ts +5 -1
  1060. package/src/plugins/dev-discovery.ts +218 -0
  1061. package/src/plugins/dev-server.ts +360 -97
  1062. package/src/plugins/entries.ts +142 -16
  1063. package/src/plugins/fonts.ts +260 -657
  1064. package/src/plugins/graph-endpoint.ts +532 -0
  1065. package/src/plugins/mdx.ts +108 -35
  1066. package/src/plugins/post-build.ts +327 -0
  1067. package/src/plugins/prebuilt-capture.ts +213 -0
  1068. package/src/plugins/prebuilt-options-analysis.ts +175 -0
  1069. package/src/plugins/prebuilt.ts +670 -0
  1070. package/src/plugins/prerender-sugar.ts +316 -0
  1071. package/src/plugins/react-resolve.ts +149 -0
  1072. package/src/plugins/request-dep/analysis.ts +447 -0
  1073. package/src/plugins/request-dep/index.ts +376 -0
  1074. package/src/plugins/request-dep/origin.ts +310 -0
  1075. package/src/plugins/routing.ts +273 -277
  1076. package/src/plugins/rsc-assets-manifest.ts +251 -0
  1077. package/src/plugins/server-bundle.ts +99 -14
  1078. package/src/plugins/shims.ts +260 -97
  1079. package/src/plugins/static-build.ts +681 -71
  1080. package/src/react-canary.d.ts +2 -0
  1081. package/src/routing/codegen-shared.ts +39 -0
  1082. package/src/routing/codegen-types.ts +62 -0
  1083. package/src/routing/codegen-write.ts +163 -0
  1084. package/src/routing/codegen.ts +349 -232
  1085. package/src/routing/collision-probe.ts +438 -0
  1086. package/src/routing/collision-spaces.ts +281 -0
  1087. package/src/routing/convention-lint.ts +651 -0
  1088. package/src/routing/export-detect.ts +536 -0
  1089. package/src/routing/file-cache.ts +23 -0
  1090. package/src/routing/index.ts +16 -7
  1091. package/src/routing/interception-overlap.ts +141 -0
  1092. package/src/routing/interception.ts +1044 -67
  1093. package/src/routing/link-codegen.ts +280 -0
  1094. package/src/routing/manifest-codegen.ts +232 -0
  1095. package/src/routing/scanner.ts +417 -223
  1096. package/src/routing/schema-validation.ts +155 -0
  1097. package/src/routing/segment-classify.ts +280 -0
  1098. package/src/routing/segment-codegen.ts +99 -0
  1099. package/src/routing/segment-keys.ts +186 -0
  1100. package/src/routing/slot-placement.ts +97 -0
  1101. package/src/routing/types.ts +82 -26
  1102. package/src/routing/walkers.ts +98 -0
  1103. package/src/rsc-runtime/rsc.ts +9 -0
  1104. package/src/rsc-runtime/ssr.ts +51 -0
  1105. package/src/rsc-runtime/transforms.ts +13 -0
  1106. package/src/rsc-runtime/vendor-types.d.ts +27 -0
  1107. package/src/schema-bridge.ts +382 -0
  1108. package/src/search-params/define.ts +677 -0
  1109. package/src/search-params/index.ts +14 -20
  1110. package/src/search-params/parse-total.ts +91 -0
  1111. package/src/search-params/serialize-equal.ts +14 -0
  1112. package/src/search-params/wrappers.ts +150 -0
  1113. package/src/server/access-gate.tsx +195 -56
  1114. package/src/server/action-client.ts +126 -33
  1115. package/src/server/action-encryption.ts +144 -0
  1116. package/src/server/action-handler.ts +457 -111
  1117. package/src/server/actions.ts +172 -85
  1118. package/src/server/als-registry.ts +224 -25
  1119. package/src/server/body-limits.ts +10 -2
  1120. package/src/server/build-manifest.ts +33 -57
  1121. package/src/server/canonicalize.ts +6 -3
  1122. package/src/server/chain-url-parts.ts +163 -0
  1123. package/src/server/children-interception.ts +116 -0
  1124. package/src/server/coalesce-tick.ts +75 -0
  1125. package/src/server/compress.ts +43 -8
  1126. package/src/server/cookie-context.ts +454 -0
  1127. package/src/server/cookie-parsing.ts +163 -0
  1128. package/src/server/csp-nonce.ts +58 -0
  1129. package/src/server/csrf.ts +228 -35
  1130. package/src/server/debug.ts +0 -1
  1131. package/src/server/default-logger.ts +100 -0
  1132. package/src/server/default-status-page.ts +88 -0
  1133. package/src/server/deny-boundary.ts +527 -0
  1134. package/src/server/deny-renderer.ts +201 -179
  1135. package/src/server/early-hints-sender.ts +4 -3
  1136. package/src/server/early-hints.ts +39 -29
  1137. package/src/server/error-boundary-wrapper.ts +160 -44
  1138. package/src/server/error-response-headers.ts +18 -0
  1139. package/src/server/fallback-error.ts +88 -104
  1140. package/src/server/flight-injection-state.ts +113 -0
  1141. package/src/server/flight-scripts.ts +67 -0
  1142. package/src/server/form-data.ts +124 -12
  1143. package/src/server/form-flash.ts +3 -3
  1144. package/src/server/head-response.ts +54 -0
  1145. package/src/server/html-injector-core.ts +512 -0
  1146. package/src/server/html-injectors.ts +270 -255
  1147. package/src/server/index.ts +36 -192
  1148. package/src/server/instrumentation.ts +11 -4
  1149. package/src/server/internal.ts +168 -0
  1150. package/src/server/json-status-response.ts +105 -0
  1151. package/src/server/logger.ts +126 -38
  1152. package/src/server/metadata-collector.ts +177 -0
  1153. package/src/server/metadata-platform.ts +2 -2
  1154. package/src/server/metadata-render.ts +30 -8
  1155. package/src/server/metadata-routes.ts +220 -24
  1156. package/src/server/metadata-social.ts +2 -2
  1157. package/src/server/metadata.ts +23 -2
  1158. package/src/server/middleware-runner.ts +32 -5
  1159. package/src/server/node-stream-transforms.ts +323 -0
  1160. package/src/server/nuqs-ssr-provider.tsx +8 -7
  1161. package/src/server/param-coercion.ts +201 -0
  1162. package/src/server/pipeline-helpers.ts +485 -0
  1163. package/src/server/pipeline-interception.ts +241 -32
  1164. package/src/server/pipeline-metadata.ts +15 -1
  1165. package/src/server/pipeline-outcome.ts +290 -0
  1166. package/src/server/pipeline-phases.ts +496 -0
  1167. package/src/server/pipeline.ts +385 -427
  1168. package/src/server/port-resolution.ts +53 -0
  1169. package/src/server/prebuilt/cache-key.ts +299 -0
  1170. package/src/server/prebuilt/capture-render.ts +118 -0
  1171. package/src/server/prebuilt/capture-routes.ts +104 -0
  1172. package/src/server/prebuilt/capture-state.ts +196 -0
  1173. package/src/server/prebuilt/key-discipline.ts +122 -0
  1174. package/src/server/prebuilt/lifetime.ts +151 -0
  1175. package/src/server/prebuilt/manifest-tag-index.ts +46 -0
  1176. package/src/server/prebuilt/overlay.ts +256 -0
  1177. package/src/server/prebuilt/payload-source.ts +202 -0
  1178. package/src/server/prebuilt/slots.ts +202 -0
  1179. package/src/server/prebuilt/synthetic-store.ts +125 -0
  1180. package/src/server/prebuilt-builder.ts +514 -0
  1181. package/src/server/prebuilt-runtime.ts +813 -0
  1182. package/src/server/primitives.ts +153 -171
  1183. package/src/server/publish-params.ts +42 -0
  1184. package/src/server/react-cache-bridge.ts +124 -0
  1185. package/src/server/react-cache-scope.ts +104 -0
  1186. package/src/server/render-timeout.ts +128 -0
  1187. package/src/server/render-utils.ts +45 -0
  1188. package/src/server/request-context.ts +269 -332
  1189. package/src/server/request-dep.ts +37 -0
  1190. package/src/server/response-cache-policy.ts +45 -0
  1191. package/src/server/route-element-builder.ts +514 -355
  1192. package/src/server/route-element-helpers.ts +37 -0
  1193. package/src/server/route-handler.ts +67 -27
  1194. package/src/server/route-matcher.ts +238 -267
  1195. package/src/server/route-module-loader.ts +161 -0
  1196. package/src/server/rsc-cache-key-guard.ts +122 -0
  1197. package/src/server/rsc-entry/action-dispatcher.ts +142 -0
  1198. package/src/server/rsc-entry/action-middleware-runner.ts +130 -0
  1199. package/src/server/rsc-entry/api-handler.ts +49 -81
  1200. package/src/server/rsc-entry/deny-fallback.ts +151 -0
  1201. package/src/server/rsc-entry/error-renderer.ts +301 -113
  1202. package/src/server/rsc-entry/helpers.ts +90 -115
  1203. package/src/server/rsc-entry/index.ts +370 -350
  1204. package/src/server/rsc-entry/render-route.ts +229 -0
  1205. package/src/server/rsc-entry/render-signals.ts +108 -0
  1206. package/src/server/rsc-entry/revalidate-renderer.ts +349 -0
  1207. package/src/server/rsc-entry/rsc-payload.ts +192 -72
  1208. package/src/server/rsc-entry/rsc-stream.ts +128 -131
  1209. package/src/server/rsc-entry/ssr-bridge.ts +19 -6
  1210. package/src/server/rsc-entry/ssr-renderer.ts +300 -137
  1211. package/src/server/rsc-error-envelope.ts +18 -0
  1212. package/src/server/rsc-prop-warnings.ts +1 -1
  1213. package/src/server/safe-load.ts +53 -0
  1214. package/src/server/sensitive-fields.ts +230 -0
  1215. package/src/server/server-only-guard-noop.js +3 -0
  1216. package/src/server/server-timing.ts +1 -1
  1217. package/src/server/signal-identity.ts +112 -0
  1218. package/src/server/sitemap-generator.ts +337 -0
  1219. package/src/server/sitemap-handler.ts +157 -0
  1220. package/src/server/skippable-prefix.ts +172 -0
  1221. package/src/server/slot-interception.ts +168 -0
  1222. package/src/server/slot-resolver.ts +707 -300
  1223. package/src/server/slot-subtree-contain.ts +273 -0
  1224. package/src/server/ssr-bridge-types.ts +201 -0
  1225. package/src/server/ssr-entry.ts +225 -104
  1226. package/src/server/ssr-render.ts +354 -91
  1227. package/src/server/ssr-wrappers.tsx +162 -0
  1228. package/src/server/state-tree-diff.ts +85 -30
  1229. package/src/server/static-generator.ts +680 -0
  1230. package/src/server/static-not-found.ts +134 -0
  1231. package/src/server/status-code-resolver.ts +107 -148
  1232. package/src/server/stream-utils.ts +343 -0
  1233. package/src/server/tracing.ts +163 -68
  1234. package/src/server/tree-match.ts +494 -0
  1235. package/src/server/types.ts +96 -11
  1236. package/src/server/utils/element-type.ts +88 -0
  1237. package/src/server/utils/escape-html.ts +20 -0
  1238. package/src/server/version-skew.ts +104 -0
  1239. package/src/server/waituntil-bridge.ts +1 -1
  1240. package/src/server/workers-cache-bridge.ts +33 -0
  1241. package/src/shared/als-slots.ts +74 -0
  1242. package/src/shared/base-path.ts +80 -0
  1243. package/src/shared/csrf-reject.ts +15 -0
  1244. package/src/shared/error-digest.ts +46 -0
  1245. package/src/shared/href-validation.ts +159 -0
  1246. package/src/shared/merge-search-params.ts +55 -0
  1247. package/src/shared/param-value.ts +281 -0
  1248. package/src/shared/payload-root.ts +153 -0
  1249. package/src/shared/redirect-type.ts +17 -0
  1250. package/src/shared/rsc-cache-key.ts +269 -0
  1251. package/src/shared/rsc-error-envelope.ts +16 -0
  1252. package/src/shared/rsc-manifest.ts +29 -0
  1253. package/src/shared/rsc-media-type.ts +59 -0
  1254. package/src/shared/rsc-payload-path.ts +52 -0
  1255. package/src/shared/segment-info.ts +67 -0
  1256. package/src/shared/slot-params.ts +109 -0
  1257. package/src/shared/static-platform-files.ts +75 -0
  1258. package/src/shared/status-reason-phrase.ts +61 -0
  1259. package/src/shims/font-google.ts +1 -1
  1260. package/src/shims/font-local.ts +34 -0
  1261. package/src/shims/headers.ts +122 -1
  1262. package/src/shims/navigation-client.ts +36 -32
  1263. package/src/shims/navigation-rsc.ts +47 -0
  1264. package/src/shims/navigation.ts +10 -7
  1265. package/src/utils/state-machine.ts +111 -0
  1266. package/src/utils/write-file-atomic.ts +32 -0
  1267. package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
  1268. package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
  1269. package/dist/_chunks/debug-B3Gypr3D.js +0 -108
  1270. package/dist/_chunks/debug-B3Gypr3D.js.map +0 -1
  1271. package/dist/_chunks/format-RyoGQL74.js +0 -164
  1272. package/dist/_chunks/format-RyoGQL74.js.map +0 -1
  1273. package/dist/_chunks/interception-BOoWmLUA.js +0 -676
  1274. package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
  1275. package/dist/_chunks/metadata-routes-Cjmvi3rQ.js.map +0 -1
  1276. package/dist/_chunks/request-context-BQUC8PHn.js +0 -330
  1277. package/dist/_chunks/request-context-BQUC8PHn.js.map +0 -1
  1278. package/dist/_chunks/ssr-data-MjmprTmO.js +0 -88
  1279. package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
  1280. package/dist/_chunks/tracing-CemImE6h.js +0 -187
  1281. package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
  1282. package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
  1283. package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
  1284. package/dist/_chunks/use-query-states-D5KaffOK.js +0 -109
  1285. package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
  1286. package/dist/adapters/cloudflare.js.map +0 -1
  1287. package/dist/cache/index.js.map +0 -1
  1288. package/dist/cache/register-cached-function.d.ts +0 -17
  1289. package/dist/cache/register-cached-function.d.ts.map +0 -1
  1290. package/dist/client/browser-entry.d.ts +0 -21
  1291. package/dist/client/browser-entry.d.ts.map +0 -1
  1292. package/dist/client/error-boundary.js.map +0 -1
  1293. package/dist/client/head.d.ts +0 -16
  1294. package/dist/client/head.d.ts.map +0 -1
  1295. package/dist/client/link-status-provider.d.ts +0 -11
  1296. package/dist/client/link-status-provider.d.ts.map +0 -1
  1297. package/dist/client/segment-merger.d.ts +0 -119
  1298. package/dist/client/segment-merger.d.ts.map +0 -1
  1299. package/dist/client/stale-reload.d.ts +0 -44
  1300. package/dist/client/stale-reload.d.ts.map +0 -1
  1301. package/dist/client/transition-root.d.ts +0 -74
  1302. package/dist/client/transition-root.d.ts.map +0 -1
  1303. package/dist/client/types.d.ts +0 -14
  1304. package/dist/client/types.d.ts.map +0 -1
  1305. package/dist/client/use-navigation-pending.d.ts +0 -26
  1306. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  1307. package/dist/client/use-params.d.ts +0 -92
  1308. package/dist/client/use-params.d.ts.map +0 -1
  1309. package/dist/content/index.d.ts +0 -11
  1310. package/dist/content/index.d.ts.map +0 -1
  1311. package/dist/content/index.js +0 -2
  1312. package/dist/plugins/adapter-build.d.ts +0 -18
  1313. package/dist/plugins/adapter-build.d.ts.map +0 -1
  1314. package/dist/plugins/cache-transform.d.ts +0 -36
  1315. package/dist/plugins/cache-transform.d.ts.map +0 -1
  1316. package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
  1317. package/dist/plugins/dev-logs.d.ts.map +0 -1
  1318. package/dist/plugins/dynamic-transform.d.ts +0 -72
  1319. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  1320. package/dist/plugins/server-action-exports.d.ts +0 -26
  1321. package/dist/plugins/server-action-exports.d.ts.map +0 -1
  1322. package/dist/routing/status-file-lint.d.ts +0 -33
  1323. package/dist/routing/status-file-lint.d.ts.map +0 -1
  1324. package/dist/search-params/analyze.d.ts +0 -54
  1325. package/dist/search-params/analyze.d.ts.map +0 -1
  1326. package/dist/search-params/builtin-codecs.d.ts +0 -105
  1327. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  1328. package/dist/search-params/codecs.d.ts +0 -53
  1329. package/dist/search-params/codecs.d.ts.map +0 -1
  1330. package/dist/search-params/create.d.ts +0 -106
  1331. package/dist/search-params/create.d.ts.map +0 -1
  1332. package/dist/search-params/registry.d.ts +0 -20
  1333. package/dist/search-params/registry.d.ts.map +0 -1
  1334. package/dist/server/asset-headers.d.ts +0 -42
  1335. package/dist/server/asset-headers.d.ts.map +0 -1
  1336. package/dist/server/client-module-map.d.ts +0 -47
  1337. package/dist/server/client-module-map.d.ts.map +0 -1
  1338. package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
  1339. package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
  1340. package/dist/server/dev-logger.d.ts.map +0 -1
  1341. package/dist/server/dev-span-processor.d.ts +0 -29
  1342. package/dist/server/dev-span-processor.d.ts.map +0 -1
  1343. package/dist/server/dev-warnings.d.ts +0 -129
  1344. package/dist/server/dev-warnings.d.ts.map +0 -1
  1345. package/dist/server/flush.d.ts +0 -74
  1346. package/dist/server/flush.d.ts.map +0 -1
  1347. package/dist/server/manifest-status-resolver.d.ts +0 -58
  1348. package/dist/server/manifest-status-resolver.d.ts.map +0 -1
  1349. package/dist/server/prerender.d.ts +0 -77
  1350. package/dist/server/prerender.d.ts.map +0 -1
  1351. package/dist/server/tree-builder.d.ts +0 -126
  1352. package/dist/server/tree-builder.d.ts.map +0 -1
  1353. package/dist/utils/directive-parser.d.ts +0 -70
  1354. package/dist/utils/directive-parser.d.ts.map +0 -1
  1355. package/src/cache/register-cached-function.ts +0 -103
  1356. package/src/client/browser-entry.ts +0 -678
  1357. package/src/client/head.ts +0 -61
  1358. package/src/client/link-status-provider.tsx +0 -30
  1359. package/src/client/segment-merger.ts +0 -339
  1360. package/src/client/stale-reload.ts +0 -87
  1361. package/src/client/transition-root.tsx +0 -166
  1362. package/src/client/types.ts +0 -21
  1363. package/src/client/use-navigation-pending.ts +0 -38
  1364. package/src/client/use-params.ts +0 -141
  1365. package/src/content/index.ts +0 -13
  1366. package/src/plugins/adapter-build.ts +0 -118
  1367. package/src/plugins/cache-transform.ts +0 -199
  1368. package/src/plugins/dynamic-transform.ts +0 -161
  1369. package/src/plugins/server-action-exports.ts +0 -220
  1370. package/src/routing/status-file-lint.ts +0 -112
  1371. package/src/search-params/analyze.ts +0 -192
  1372. package/src/search-params/builtin-codecs.ts +0 -228
  1373. package/src/search-params/codecs.ts +0 -153
  1374. package/src/search-params/create.ts +0 -321
  1375. package/src/search-params/registry.ts +0 -31
  1376. package/src/server/asset-headers.ts +0 -81
  1377. package/src/server/client-module-map.ts +0 -58
  1378. package/src/server/dev-fetch-instrumentation.ts +0 -96
  1379. package/src/server/dev-span-processor.ts +0 -78
  1380. package/src/server/dev-warnings.ts +0 -283
  1381. package/src/server/flush.ts +0 -182
  1382. package/src/server/manifest-status-resolver.ts +0 -215
  1383. package/src/server/prerender.ts +0 -139
  1384. package/src/server/tree-builder.ts +0 -382
  1385. package/src/shims/server-only-noop.js +0 -6
  1386. package/src/utils/directive-parser.ts +0 -529
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-boundary-DsNScGRM.js","names":[],"sources":["../../src/shared/payload-root.ts","../../src/client/rsc-fetch.ts","../../src/client/unload-guard.ts","../../src/client/stale-client.ts","../../src/client/router-skew.ts","../../src/client/router-effects.ts","../../src/shared/error-digest.ts","../../src/client/error-boundary.tsx"],"sourcesContent":["/**\n * The shape of an RSC payload's root row.\n *\n * Every tree the server sends the browser is serialized as\n * `{ tree, params, slotParams }` — the route's element tree, plus the coerced\n * params it rendered with, as *siblings* rather than as a wrapper around the\n * tree. See design/41-global-params.md §\"Transport\".\n *\n * Two reasons it is a sibling field rather than a provider inside the payload\n * (TIM-1297, which is TIM-1294's mechanism corrected):\n *\n * 1. **A provider inside the payload cannot serve a partial navigation.** The\n * client keeps the previous tree and splices the new payload in at the\n * first updated `SegmentOutlet`, so the payload's own provider lands\n * *below* the retained region — and the retained region's root is the\n * *departing* route's provider, which therefore wins for every reader in a\n * skipped layout. Wrapping something above it does not help: context\n * resolves to the nearest provider, and the departing one is nearer.\n * Params belong to the *navigation*, so the provider has to be owned by the\n * client, above the merge point, and there must be exactly one.\n *\n * 2. **Element props are not readable at the instant the root resolves.**\n * Flight outlines a React element's props and fills the record in after the\n * root row resolves, so a reader that unblocks on the root sees `{}` — and\n * since the object is filled *in place*, its identity never changes and any\n * memo keyed on it caches the empty snapshot permanently. A plain model\n * field has no such window: the root chunk stays blocked until everything\n * it references has resolved.\n *\n * This module is the single declaration of that shape. The server builds roots\n * through `server/publish-params.ts` and the client reads them through the\n * helpers here — producer and consumer do not each describe the payload.\n */\n\nimport type { CoercedParams } from './param-value.ts';\nimport type { SlotParamsRecord } from './slot-params.ts';\n\n/** The params published beside a tree. */\nexport interface PublishedParams {\n /** The main route's coerced params. */\n params: CoercedParams;\n /** Per-slot params, or null when the route rendered no slots with params. */\n slotParams: SlotParamsRecord | null;\n}\n\n/**\n * Params ready to publish: settled, or a promise the root provider suspends on.\n *\n * Both forms exist on purpose. The hydration path cannot await — `hydrateRoot`\n * has to be called before the inline Flight stream has necessarily produced\n * the root row — so it hands over the promise and suspends exactly where React\n * was already going to suspend on the tree. Every other path settles it inside\n * the navigation transition first, which is what keeps a decode failure inside\n * the app's own error boundaries instead of above them (TIM-1297).\n */\nexport type ParamsSource = PublishedParams | Promise<PublishedParams>;\n\n/** The root row of an RSC payload. */\nexport interface RscPayloadRoot extends PublishedParams {\n /** The route's element tree. */\n tree: unknown;\n}\n\n/**\n * What a reader gets when the value it was handed is not a payload root.\n *\n * In the browser this is unreachable for a real response: all four producers\n * of a route payload go through `withPublishedParams`, and a client talking to\n * a different build is answered with 204 at Stage 1c\n * (`server/pipeline-phases.ts`) before any payload exists. It is what a page\n * with no payload at all publishes — a document hydrated without an inlined\n * payload, or a prefetch entry that carries no params.\n */\nexport const NO_PUBLISHED_PARAMS: PublishedParams = { params: {}, slotParams: null };\n\n/** True when `value` carries published params — a root, or a read of one. */\nfunction hasPublishedParams(value: unknown): value is PublishedParams {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'params' in value &&\n typeof (value as PublishedParams).params === 'object' &&\n (value as PublishedParams).params !== null\n );\n}\n\n/**\n * Read the params published beside a tree.\n *\n * Accepts a payload root *or* a `PublishedParams` already split off one, so\n * the client can pre-resolve on the navigation path and still hand the same\n * value to the same provider. Never throws.\n */\nexport function readPublishedParams(source: unknown): PublishedParams {\n if (!hasPublishedParams(source)) return NO_PUBLISHED_PARAMS;\n return { params: source.params, slotParams: source.slotParams ?? null };\n}\n\n/**\n * Read the renderable tree out of a payload root.\n *\n * Returns the value unchanged when it is not a root, so a malformed value\n * reaches React (and its error boundaries) rather than vanishing here.\n */\nexport function readPayloadTree(root: unknown): unknown {\n if (typeof root === 'object' && root !== null && 'tree' in root && hasPublishedParams(root)) {\n return (root as RscPayloadRoot).tree;\n }\n return root;\n}\n\n/** A decoded payload, split into the two things the client does with it. */\nexport interface SplitPayload {\n /** The renderable tree — an element, or a thenable React suspends on. */\n tree: unknown;\n /**\n * The params published beside it. Settled when the root already is, so the\n * hydration path can render without an extra await.\n *\n * **Never rejects.** A decode failure has to surface through `tree`: where\n * React renders it on hydration, so the error boundary *around the tree*\n * catches it, and where the router awaits it before handing a navigation\n * over, so the navigation fails and recovers. Rejecting here too would take\n * down the provider above every boundary in the app, turning a contained\n * failure into a blank page (TIM-1297).\n */\n params: ParamsSource;\n}\n\n/**\n * Split a decoded payload root into its tree and its params.\n *\n * Accepts a settled root or a thenable of one, and preserves which it was: a\n * settled root splits synchronously, so no code path gains a suspend point it\n * did not already have.\n */\nexport function splitPayloadRoot(root: unknown): SplitPayload {\n if (\n typeof root !== 'object' ||\n root === null ||\n typeof (root as PromiseLike<unknown>).then !== 'function'\n ) {\n return { tree: readPayloadTree(root), params: readPublishedParams(root) };\n }\n const settled = root as PromiseLike<unknown>;\n const tree = Promise.resolve(settled).then(readPayloadTree);\n // The rejection still reaches React through its own read of `tree`; this\n // only marks it handled for the case where nothing renders it (a partial\n // navigation whose segment update finds no matching outlet).\n tree.catch(() => {});\n const params = Promise.resolve(settled).then(readPublishedParams, () => NO_PUBLISHED_PARAMS);\n return { tree, params };\n}\n","/**\n * RSC Fetch — handles fetching and parsing RSC Flight payloads.\n *\n * Extracted from router.ts to keep both files under the 500-line limit.\n * This module handles:\n * - Cache-busting URL generation for RSC requests\n * - Building RSC request headers (Accept, X-Timber-State-Tree)\n * - Extracting metadata from RSC response headers\n * - Fetching and decoding RSC payloads\n *\n * See design/19-client-navigation.md §\"RSC Payload Handling\"\n */\n\nimport {\n rscCacheKey,\n recordLookup,\n randomRscCacheKey,\n RSC_KEY_PARAM,\n} from '../shared/rsc-cache-key.ts';\nimport type { RscManifest, RscManifestEntry } from '../shared/rsc-manifest.ts';\nimport { splitPayloadRoot, type PublishedParams } from '../shared/payload-root.ts';\nimport { normalizeBasePath, stripBasePath, withBasePath } from '../shared/base-path.ts';\nimport { rscPayloadPath } from '../shared/rsc-payload-path.ts';\nimport type { SegmentInfo, StateTree } from '../shared/segment-info.ts';\nimport { TIMBER_ERROR_HEADER } from '../shared/rsc-error-envelope.ts';\nimport { RSC_CONTENT_TYPE, isRscContentType } from '../shared/rsc-media-type.ts';\nimport type { RouterDeps } from './router-types.ts';\n\n// ─── Types ───────────────────────────────────────────────────────\n\n/** Result of fetching an RSC payload — includes segment metadata. */\nexport interface FetchResult {\n /** The renderable tree, split off the payload root. */\n payload: unknown;\n /**\n * The params the same payload published beside that tree.\n *\n * Not a separate channel: both fields come out of one `splitPayloadRoot`\n * call on one decoded root, so a response cannot deliver a tree and another\n * route's params. They used to arrive on their own header, which is how a\n * navigation could render one route and publish another's (TIM-1285,\n * TIM-1294).\n */\n params: PublishedParams | Promise<PublishedParams>;\n /**\n * Promise that settles when the RSC decode completes or fails.\n * The payload thenable is NOT awaited before returning (for streaming),\n * so callers must monitor this to catch async decode errors\n * (truncated streams, Flight parse failures) that would otherwise\n * become unhandled rejections.\n */\n decodePromise: Promise<void> | null;\n /** Segment metadata from X-Timber-Segments header for populating the segment cache. */\n segmentInfo: SegmentInfo[] | null;\n /** Segment paths that were skipped by the server (for client-side merging). */\n skippedSegments: string[] | null;\n}\n\n// ─── URL Helpers ─────────────────────────────────────────────────\n\n/**\n * Append a `_rsc=<key>` query parameter to the URL (TIM-1268).\n *\n * The key is a deterministic hash of the RSC request headers, so identical\n * requests share a URL and the payload becomes cacheable. It also keeps the\n * document and the payload on different URLs, so a shared cache cannot\n * return HTML for an RSC request (or vice versa) even where `Vary` is\n * opt-in configuration rather than default behaviour — Cloudflare and\n * CloudFront both. See GHSA-wfc6-r584-vfw7, design/13-security.md.\n *\n * The origin recomputes this key from the received headers and refuses to\n * let a mismatched response be shared-cached, so a caller cannot claim\n * another client's key while sending its own headers.\n *\n * Falls back to a random value when no key can be derived — `crypto.subtle`\n * is absent in non-secure browsing contexts (plain `http://` on a LAN\n * address). Dropping the parameter instead would put the payload back on\n * the document URL, where a query-keyed cache that ignores `Vary` could\n * store a Flight response under `/about` and serve it to an HTML\n * navigation. The random parameter this feature replaced did separate those\n * representations, and the fallback must not be worse than what it\n * replaced. The origin cannot verify a random key, so it refuses to\n * share-cache the response — which is exactly the old behaviour, where a\n * unique URL was never a cache hit anyway.\n *\n * Strips any #fragment before appending — fragments are client-only and\n * fetch() discards them, so _rsc would land inside the hash and be lost.\n */\nasync function appendRscParam(url: string, headers: Record<string, string>): Promise<string> {\n const hashIndex = url.indexOf('#');\n const urlWithoutHash = hashIndex === -1 ? url : url.slice(0, hashIndex);\n const key = (await rscCacheKey(recordLookup(headers))) ?? randomRscCacheKey();\n const separator = urlWithoutHash.includes('?') ? '&' : '?';\n return `${urlWithoutHash}${separator}${RSC_KEY_PARAM}=${key}`;\n}\n\n// ─── Deployment ID ───────────────────────────────────────────────\n\n/**\n * The client's deployment ID, set at bootstrap from the runtime config.\n * Sent with every RSC/action request for version skew detection.\n * Null in dev mode. See TIM-446.\n */\nlet clientDeploymentId: string | null = null;\n\n/** Set the client deployment ID. Called once at bootstrap. */\nexport function setClientDeploymentId(id: string | null): void {\n clientDeploymentId = id;\n}\n\n/** Get the client deployment ID. */\nexport function getClientDeploymentId(): string | null {\n return clientDeploymentId;\n}\n\n// ─── Base Path ───────────────────────────────────────────────────\n\n/**\n * The deployment base path (Vite's resolved `base`), normalized.\n * Set at bootstrap from `virtual:timber-config`; `'/'` unless the app is\n * deployed under a sub-path. See design/11-platform.md, TIM-1261.\n *\n * **The base is applied in exactly one place: at fetch time**\n * (`toStaticRscUrl`). The static build writes the RSC manifest with\n * root-relative keys *and* root-relative URLs, so the generated site stays\n * relocatable and there is no second copy of the base to drift from this one.\n */\nlet basePath = '/';\n\n/** Set the deployment base path. Called once at bootstrap. */\nexport function setBasePath(base: string | undefined): void {\n basePath = normalizeBasePath(base);\n}\n\n/** Get the normalized deployment base path. @internal Exported for testing. */\nexport function getBasePath(): string {\n return basePath;\n}\n\n// ─── Static Mode ────────────────────────────────────────────────\n\n/**\n * When true, RSC fetches use _rsc/*.rsc file URLs instead of\n * the route URL with Accept headers. Static hosts ignore Accept\n * headers, so the client must fetch the pre-generated .rsc files\n * directly. Set at bootstrap from virtual:timber-config output mode.\n */\nlet staticMode = false;\n\nexport function setStaticMode(enabled: boolean): void {\n staticMode = enabled;\n}\n\nexport function isStaticMode(): boolean {\n return staticMode;\n}\n\n/**\n * RSC manifest mapping unhashed → content-hashed `.rsc` URLs. Populated from\n * `window.__TIMBER_RSC_MANIFEST__` (injected into HTML during static\n * generation). Shape shared with the static build that writes it — see\n * `shared/rsc-manifest.ts`. See TIM-1254.\n */\nlet rscManifest: RscManifest | null = null;\n\nfunction getRscManifest(): RscManifest | null {\n if (rscManifest) return rscManifest;\n if (typeof window !== 'undefined' && (window as any).__TIMBER_RSC_MANIFEST__) {\n rscManifest = (window as any).__TIMBER_RSC_MANIFEST__;\n }\n return rscManifest;\n}\n\n/** @internal Exported for testing. */\nexport function setRscManifest(manifest: RscManifest | null): void {\n rscManifest = manifest;\n}\n\n/** A resolved static payload target: the URL to fetch, and how it was resolved. */\ninterface StaticRscTarget {\n /** Fetchable URL — base-prefixed. */\n url: string;\n /**\n * True when the RSC manifest supplied a content-hashed filename. The hash\n * guarantees freshness, so no `_rsc` cache key is appended (TIM-1254).\n */\n hashed: boolean;\n}\n\n/**\n * Resolve a route URL to the `_rsc/*.rsc` file to fetch. The naming rule is\n * `shared/rsc-payload-path.ts`, shared with the build that writes the files.\n *\n * When an RSC manifest is available (hashed filenames from TIM-1254),\n * the manifest is consulted to resolve to the hashed path.\n *\n * / → /_rsc/index.rsc (or /_rsc/index-B7YxEKdN.rsc with manifest)\n * /about → /_rsc/about/index.rsc (or /_rsc/about/index-C8ZzFLfO.rsc)\n * /blog/hello → /_rsc/blog/hello/index.rsc\n *\n * The manifest is written and read in route space (no base prefix), so the\n * base is applied here — once, on the way out. See client/base-path.ts.\n */\nfunction toStaticRscUrl(url: string): StaticRscTarget {\n const unhashed = toUnhashedRscUrl(url);\n const hashedUrl = manifestLookup(unhashed);\n return { url: withBasePath(basePath, hashedUrl ?? unhashed), hashed: hashedUrl !== null };\n}\n\n/**\n * Compute the unhashed `_rsc/*.rsc` path for a route URL.\n *\n * Returns a **route-space** path: the deployment base is stripped from the\n * incoming URL and is NOT re-applied, because this value doubles as the RSC\n * manifest key, and the manifest is base-less. `toStaticRscUrl` applies the\n * base to whatever is actually fetched.\n *\n * @internal Exported for testing.\n */\nexport function toUnhashedRscUrl(url: string): string {\n const hashIndex = url.indexOf('#');\n const queryIndex = url.indexOf('?');\n const hashEnd = hashIndex === -1 ? url.length : hashIndex;\n const queryEnd = queryIndex === -1 ? url.length : queryIndex;\n const end = Math.min(hashEnd, queryEnd);\n let pathname = stripBasePath(basePath, url.slice(0, end));\n // Strip trailing slash (unless root) to match static build output naming\n if (pathname.length > 1 && pathname.endsWith('/')) {\n pathname = pathname.slice(0, -1);\n }\n return rscPayloadPath(pathname);\n}\n\n/**\n * Look up a key in the RSC manifest, falling back to percent-decoded\n * lookup for encoded browser URLs. Returns the entry or null.\n */\nfunction manifestEntry(key: string): RscManifestEntry | null {\n const manifest = getRscManifest();\n if (!manifest) return null;\n if (manifest[key]) return manifest[key];\n try {\n const decoded = decodeURIComponent(key);\n if (decoded !== key && manifest[decoded]) return manifest[decoded];\n } catch {\n // Malformed percent sequence (e.g. /100%.rsc) — skip decoded lookup\n }\n return null;\n}\n\n/**\n * Look up the hashed URL for an unhashed RSC path.\n */\nfunction manifestLookup(key: string): string | null {\n return manifestEntry(key)?.url ?? null;\n}\n\n// The manifest used to inline each route's params, because a generated\n// `.rsc` file carries no response headers and the header channel therefore\n// did not exist on the static path (TIM-1255, TIM-1285). The `.rsc` file now\n// carries them itself — they are props inside the payload — so the static\n// path needs no special case at all.\n\n// ─── Reload Signal ───────────────────────────────────────────────\n\n/** Header name used by the server to signal a version skew reload. */\nexport const RELOAD_HEADER = 'X-Timber-Reload';\n\n/** Header name for the client's deployment ID. */\nexport const DEPLOYMENT_ID_HEADER = 'X-Timber-Deployment-Id';\n\n/**\n * Check if a response signals a version skew reload.\n * Triggers a full page reload if the server indicates the client is stale.\n */\nexport function checkReloadSignal(response: Response): boolean {\n return response.headers.get(RELOAD_HEADER) === '1';\n}\n\n// ─── Header Builder ──────────────────────────────────────────────\n\n/**\n * Build the headers for an RSC payload request.\n *\n * **Every header added here is hashed into the payload URL** as the `_rsc`\n * cache key (see `rscCacheKey`), and URLs are logged by proxies, CDNs, and\n * origin access logs. So: no credentials, no session identifiers, no\n * user-supplied content. `fnv1aHash` is a cache-key hash, not a KDF — a\n * low-entropy secret would be recoverable from the URL by brute force.\n * Authentication already travels on cookies, which are not part of this\n * object and never enter the key.\n */\nexport function buildRscHeaders(\n stateTree: StateTree | undefined,\n currentUrl?: string\n): Record<string, string> {\n const headers: Record<string, string> = {\n Accept: RSC_CONTENT_TYPE,\n };\n if (stateTree) {\n headers['X-Timber-State-Tree'] = JSON.stringify(stateTree);\n }\n // Send current URL for intercepting route resolution.\n // The server uses this to determine if an intercepting route should\n // render instead of the actual target route (modal pattern).\n // See design/07-routing.md §\"Intercepting Routes\"\n if (currentUrl) {\n headers['X-Timber-URL'] = currentUrl;\n }\n // Send deployment ID for version skew detection (TIM-446).\n // The server compares this against the current build's ID.\n // On mismatch, the server signals a reload instead of returning\n // an RSC payload with mismatched module references.\n if (clientDeploymentId) {\n headers[DEPLOYMENT_ID_HEADER] = clientDeploymentId;\n }\n return headers;\n}\n\n// ─── Response Header Extraction ──────────────────────────────────\n\n/** Dev-only warning for malformed framework headers. Tree-shaken in production. */\nfunction warnMalformedHeader(headerName: string, raw: string): void {\n if (process.env.NODE_ENV !== 'production') {\n const preview = raw.length > 200 ? raw.slice(0, 200) + '…' : raw;\n console.warn(\n `[timber] Malformed ${headerName} header \\u2014 JSON.parse failed. ` +\n `This indicates a framework bug or header corruption. Raw (first 200 chars): ${preview}`\n );\n }\n}\n\n/**\n * Extract segment metadata from the X-Timber-Segments response header.\n * Returns null if the header is missing or malformed.\n *\n * Format: JSON array of {path, isRequestDependent} objects describing the rendered\n * segment chain from root to leaf. Used to populate the client-side\n * segment cache for state tree diffing on subsequent navigations.\n */\nexport function extractSegmentInfo(response: Response): SegmentInfo[] | null {\n const header = response.headers.get('X-Timber-Segments');\n if (!header) return null;\n try {\n return JSON.parse(header);\n } catch {\n warnMalformedHeader('X-Timber-Segments', header);\n return null;\n }\n}\n\n/**\n * Extract skipped segment paths from the X-Timber-Skipped-Segments header.\n * Returns null if the header is missing or malformed.\n *\n * When the server skips sync layouts the client already has cached,\n * it sends this header listing the skipped segment paths (outermost first).\n * The client uses this to merge the partial payload with cached segments.\n */\nexport function extractSkippedSegments(response: Response): string[] | null {\n const header = response.headers.get('X-Timber-Skipped-Segments');\n if (!header) return null;\n try {\n const parsed = JSON.parse(header);\n return Array.isArray(parsed) ? parsed : null;\n } catch {\n warnMalformedHeader('X-Timber-Skipped-Segments', header);\n return null;\n }\n}\n\n// ─── Redirect Error ──────────────────────────────────────────────\n\n/**\n * Thrown when an RSC payload response contains X-Timber-Redirect header.\n * Caught in navigate() to trigger a soft router navigation to the redirect target.\n */\nexport class RedirectError extends Error {\n readonly redirectUrl: string;\n constructor(url: string) {\n super(`Server redirect to ${url}`);\n this.redirectUrl = url;\n }\n}\n\n/**\n * Thrown when the server signals a version skew (X-Timber-Reload header).\n * Caught in navigate() to trigger a full page reload.\n * See TIM-446.\n */\nexport class VersionSkewError extends Error {\n constructor() {\n super('Version skew detected — server has been redeployed');\n }\n}\n\n/**\n * Thrown when the server returns an error for an RSC payload request.\n * The server sends X-Timber-Error header and a JSON body instead of a\n * RSC stream it cannot answer in-SPA (a deny that needs a fallback page, a\n * broken first read). Caught in\n * navigate() to trigger a hard navigation so the server can render\n * the error page as HTML.\n *\n * See design/10-error-handling.md §\"Error Page Rendering for Client Navigation\"\n */\nexport class ServerErrorResponse extends Error {\n readonly status: number;\n readonly url: string;\n constructor(status: number, url: string) {\n super(`Server error ${status} during navigation to ${url}`);\n this.status = status;\n this.url = url;\n }\n}\n\n/**\n * Thrown when the RSC fetch response has a Content-Type that is not\n * text/x-component — e.g., a static asset (image, CSS, JS) served\n * for a same-origin URL that isn't a route. The response body is\n * cancelled immediately (headers-only cost). Caught in navigate()\n * to trigger a hard navigation; caught in prefetch() to store a\n * negative cache entry so click hard-navigates without a second fetch.\n *\n * See TIM-1231.\n */\nexport class NonRscResponse extends Error {\n readonly url: string;\n constructor(url: string) {\n super(`Non-RSC response for ${url}`);\n this.url = url;\n }\n}\n\n// ─── Stream Completion Tracking ───────────────────────────────────\n\n/**\n * Wrap a response body stream to track when it's fully consumed.\n * Returns a new body that passes all chunks through unchanged, plus\n * a `done` promise that resolves when the last chunk is read (or\n * rejects if the stream errors).\n *\n * createFromFetch's thenable resolves on shell arrival, but callers need to\n * know when the stream is fully decoded: that is what `navigateTransition`'s\n * returned promise means, and what the router's pending store, the Navigation\n * API deferred and `<Link>`'s `isPending` are all timed against.\n */\nfunction trackStreamCompletion(body: ReadableStream<Uint8Array>): {\n body: ReadableStream<Uint8Array>;\n done: Promise<void>;\n} {\n let resolveDone!: () => void;\n let rejectDone!: (e: unknown) => void;\n const done = new Promise<void>((res, rej) => {\n resolveDone = res;\n rejectDone = rej;\n });\n\n const reader = body.getReader();\n const tracked = new ReadableStream<Uint8Array>({\n async pull(controller) {\n try {\n const result = await reader.read();\n if (result.done) {\n controller.close();\n resolveDone();\n } else {\n controller.enqueue(result.value);\n }\n } catch (error) {\n controller.error(error);\n rejectDone(error);\n }\n },\n cancel(reason) {\n reader.cancel(reason);\n resolveDone();\n },\n });\n\n return { body: tracked, done };\n}\n\n// ─── Fetch ───────────────────────────────────────────────────────\n\n/**\n * Fetch an RSC payload from the server and start decoding it.\n *\n * Every response is classified here, once: a version-skew reload, a 204 or\n * 3xx redirect, a server error envelope and a non-RSC body are each turned\n * into their error before `decodeRsc` sees the body. There is no second\n * path — tests decode real Flight bytes through the same code (TIM-1541).\n */\nexport async function fetchRscPayload(\n url: string,\n deps: RouterDeps,\n stateTree?: { segments: string[] },\n currentUrl?: string,\n signal?: AbortSignal\n): Promise<FetchResult> {\n // In static mode, fetch the pre-generated _rsc/*.rsc file directly\n // instead of the route URL with Accept headers. Static hosts ignore\n // Accept headers, so the route URL would return HTML.\n const staticTarget = staticMode ? toStaticRscUrl(url) : null;\n const fetchTarget = staticTarget ? staticTarget.url : url;\n // Static hosts resolve neither partial payloads nor intercepting routes,\n // so neither the state tree nor the source URL is sent — and neither may\n // fragment the cache key of a file that does not vary on them.\n const headers = staticMode\n ? buildRscHeaders(undefined, undefined)\n : buildRscHeaders(stateTree, currentUrl);\n // Skip the cache key when the manifest supplies a content-hashed\n // URL — the hash itself guarantees freshness, and the param would defeat\n // the immutable cache headers on /_rsc/* (TIM-1254).\n const rscUrl = staticTarget?.hashed ? fetchTarget : await appendRscParam(fetchTarget, headers);\n // Deriving the cache key is async (SubtleCrypto), so the fetch is no\n // longer issued in the same tick as the call. A navigation superseded\n // during that window would otherwise still hit the network with an\n // already-aborted signal.\n signal?.throwIfAborted();\n // createFromFetch takes a Promise<Response> and progressively parses\n // the RSC Flight stream as chunks arrive.\n //\n // Intercept the response to read segment metadata before createFromFetch\n // consumes the body. Reading headers does NOT consume the body stream.\n const fetchPromise = deps.fetch(rscUrl, { headers, redirect: 'manual', signal });\n let segmentInfo: SegmentInfo[] | null = null;\n let skippedSegments: string[] | null = null;\n // Track when the full RSC body stream is consumed (not just shell).\n // Initialized to resolved for bodyless responses; overwritten when\n // the response has a body.\n let streamDone: Promise<void> = Promise.resolve();\n\n const wrappedPromise = fetchPromise.then((response) => {\n // Version skew detection (TIM-446): if the server signals a reload,\n // throw VersionSkewError so the caller (router navigate) can trigger\n // a full page reload.\n if (checkReloadSignal(response)) {\n throw new VersionSkewError();\n }\n // Detect server-side redirects. The server returns 204 + X-Timber-Redirect\n // for RSC payload requests instead of a raw 302, because fetch with\n // redirect: \"manual\" turns 302s into opaque redirects (status 0, null body)\n // which crashes createFromFetch when it tries to read the body stream.\n const redirectLocation =\n response.headers.get('X-Timber-Redirect') ||\n (response.status >= 300 && response.status < 400 ? response.headers.get('Location') : null);\n if (redirectLocation) {\n throw new RedirectError(redirectLocation);\n }\n // Detect server error responses. The server returns X-Timber-Error header\n // with a JSON body instead of an RSC stream it cannot answer in-SPA.\n // Hard-navigate so the server renders the error page as HTML.\n // See design/10-error-handling.md §\"Error Page Rendering for Client Navigation\"\n if (response.headers.get(TIMBER_ERROR_HEADER) === '1') {\n throw new ServerErrorResponse(response.status, url);\n }\n // Content-Type guard: reject non-RSC responses before createFromFetch\n // tries to parse the body as Flight data.\n // In static mode, accept octet-stream/text/plain/absent content-type\n // (static hosts serve .rsc files with these), but still reject 404s\n // and text/html (missing .rsc file → host returns 404 page or SPA\n // HTML fallback). See TIM-1231, TIM-1243, TIM-1247.\n if (staticMode) {\n const contentType = response.headers.get('content-type');\n if (\n !response.ok ||\n (contentType && contentType.split(';')[0].trim().toLowerCase() === 'text/html')\n ) {\n response.body?.cancel();\n throw new NonRscResponse(url);\n }\n } else {\n if (!isRscContentType(response.headers.get('content-type'))) {\n response.body?.cancel();\n throw new NonRscResponse(url);\n }\n }\n // Metadata (<title>/<meta>/<link>) now rides the RSC Flight payload\n // as React elements — React 19 Float handles them. See TIM-1151.\n segmentInfo = extractSegmentInfo(response);\n skippedSegments = extractSkippedSegments(response);\n\n // Wrap the body to track full stream consumption. createFromFetch's\n // thenable resolves when the root model (shell) arrives, but we need\n // to know when ALL chunks are read — that is what the navigation\n // promise resolving means, and what keeps the pending store set.\n if (response.body) {\n const tracked = trackStreamCompletion(response.body);\n streamDone = tracked.done;\n streamDone.catch(() => {}); // prevent unhandled rejection\n return new Response(tracked.body, {\n headers: response.headers,\n status: response.status,\n });\n }\n return response;\n });\n // Await headers so segmentInfo is populated.\n await wrappedPromise;\n // Start decoding but do NOT await — return the in-progress thenable.\n // React can render a Flight thenable directly: it suspends on unresolved\n // parts and progressively renders as chunks arrive, spreading work across\n // frames instead of blocking the main thread in one burst.\n const root = deps.decodeRsc(wrappedPromise);\n // One split, one root: the tree and the params it was rendered with come\n // apart here and nowhere else, so nothing downstream has to keep them\n // paired by hand.\n const { tree: payload, params } = splitPayloadRoot(root);\n // Settles once the stream has ended AND the root has decoded, and rejects\n // as soon as either fails. streamDone marks the end of the RSC stream,\n // which is what the navigation promise resolves on; the root's rejection\n // carries decode failures (stale client references, Flight parse errors)\n // so the router's catch block can trigger recovery (stale reload).\n //\n // Not a race between the two: a payload that arrives whole — a small\n // static `.rsc` file — ends its stream before Flight rejects the root it\n // could not decode, and a race resolved on the stream, so the failure\n // never reached recovery and the skew was never recorded (TIM-1541).\n const rootDecoded = Promise.resolve(root).then(() => {});\n rootDecoded.catch(() => {});\n const decodePromise = Promise.all([streamDone, rootDecoded]).then(() => {});\n // Mark handled, like rootDecoded above. The same rejection reaches the\n // router through `payload`, and a navigation that recovers by hard\n // navigating (version skew, non-RSC response) hangs deliberately and never\n // awaits this one — leaving it to surface as an unhandled rejection.\n decodePromise.catch(() => {});\n return {\n payload,\n params,\n decodePromise,\n segmentInfo,\n skippedSegments,\n };\n}\n","/**\n * Page unload detection — suppresses spurious errors during page refresh/navigation.\n *\n * When the user refreshes the page or navigates away while React is still\n * streaming Suspense content, the aborted connection causes streaming errors.\n * These are not application errors — they're a side effect of the browser\n * tearing down the connection. This module tracks whether the page is being\n * unloaded so error boundaries and error handlers can suppress abort-related\n * errors during the unload window.\n *\n * This is the single owner of \"is this document going away\". Anything that\n * needs the answer imports `isPageUnloading()` — an unload flag maintained a\n * second time somewhere else is a flag that will drift out of agreement with\n * this one (TIM-1260).\n *\n * Mutable state is delegated to client/state.ts for singleton guarantees.\n * See design/18-build-system.md §\"Singleton State Registry\"\n *\n * See design/10-error-handling.md §\"Known limitation: deny() inside Suspense and hydration\"\n */\n\nimport { unloading, _setUnloading } from './state.ts';\n\n/**\n * Departure is *committed*: `pagehide` has fired, or this document has called\n * reload() on itself. `beforeunload` alone doesn't qualify — it is\n * speculative, and the user can still cancel out of it.\n */\nlet committed = false;\n\nif (typeof window !== 'undefined') {\n window.addEventListener('beforeunload', () => {\n _setUnloading(true);\n\n // An app with an unsaved-changes prompt can have this cancelled. Nothing\n // fires to say so, so the only signal is that the page is still running\n // afterwards — and timers are blocked while the modal is up, so this task\n // cannot run until the user has chosen. If they left, `pagehide` has\n // already committed and this is a no-op.\n setTimeout(() => {\n if (!committed) _setUnloading(false);\n }, 0);\n });\n\n // pagehide is the committed-departure event, and fires for both navigations\n // and bfcache entry. Safari in particular may skip beforeunload entirely.\n window.addEventListener('pagehide', () => {\n committed = true;\n _setUnloading(true);\n });\n\n window.addEventListener('pageshow', (event) => {\n // A bfcache restore un-does the teardown `pagehide` announced: the same\n // document is alive again, with this module's state intact. Without the\n // reset, every consumer would go on suppressing errors on a live page.\n if (event.persisted) {\n committed = false;\n _setUnloading(false);\n }\n });\n}\n\n/**\n * Returns true if the page is currently being unloaded (user refreshed\n * or navigated away). Error boundaries should suppress errors in this state.\n */\nexport function isPageUnloading(): boolean {\n return unloading;\n}\n","/**\n * Stale Client — knowing when this bundle has been superseded.\n *\n * Layer 1 of version skew handling (see design/33-version-skew.md) is\n * proactive: the server compares `X-Timber-Deployment-Id` against the current\n * build and answers a stale client with `X-Timber-Reload: 1`. That covers\n * every RSC navigation and every server action — as long as there is a server\n * in the request path.\n *\n * This module is the reactive half, plus the state both halves feed. It\n * recognizes the two error shapes a stale client produces on its own:\n *\n * 1. **Stale client references** — React's Flight client throws\n * \"Could not find the module …\" when an RSC payload names a client module\n * ID that isn't in this bundle's manifest.\n * 2. **Chunk load failures** — a content-hashed chunk that no longer exists on\n * the CDN fails to `import()`. Every engine words this differently.\n *\n * It matters most for `output: 'static'`, where there is no server to send the\n * reload header and this is the *only* skew detection that can run.\n *\n * **Nothing here reloads the page.** A stale client is recorded, not acted on;\n * the router turns the next user-initiated navigation into a full document\n * load. See design/33-version-skew.md §\"Recovery on the next navigation\" for\n * why — a self-issued `location.reload()` cannot tell a recovery from a bounce\n * between two live deployments, and mid-rollout it produces exactly that loop.\n *\n * See TIM-1260, TIM-1275.\n */\n\n// The only import: the shared unload state. Kept minimal because this module\n// is reached from the error boundary, a `'use client'` component evaluated in\n// the SSR graph too — a dependency on the client fetch layer would drag that\n// graph along with it.\nimport { isPageUnloading } from './unload-guard.ts';\n\n// ─── Error Shapes ────────────────────────────────────────────────\n\n/**\n * Substrings that identify a failed dynamic import, lowercased for\n * case-insensitive matching. Engines and bundlers each word this\n * differently and none of them expose a stable error code.\n */\nconst CHUNK_LOAD_PATTERNS = [\n // Chromium\n 'failed to fetch dynamically imported module',\n // Firefox\n 'error loading dynamically imported module',\n // Safari\n 'importing a module script failed',\n // Vite's preload helper, for the stylesheet of a lazily-imported chunk\n 'unable to preload css for',\n];\n\n/** Substring React's Flight client uses when a client module ID is unknown. */\nconst STALE_REFERENCE_PATTERN = 'could not find the module';\n\n/**\n * Pull a comparable message out of an unknown thrown value. Rejections cross\n * enough boundaries (event handlers, `unhandledrejection`, Vite's preload\n * event) that the value is not reliably an `Error`.\n */\nfunction messageOf(error: unknown): string {\n if (typeof error === 'string') return error.toLowerCase();\n if (error instanceof Error) return error.message.toLowerCase();\n if (error && typeof error === 'object' && 'message' in error) {\n const message = (error as { message: unknown }).message;\n if (typeof message === 'string') return message.toLowerCase();\n }\n return '';\n}\n\n/**\n * True when the error is React's \"client reference not in this manifest\"\n * failure — the payload was produced by a build this bundle doesn't match.\n */\nexport function isStaleClientReference(error: unknown): boolean {\n return messageOf(error).includes(STALE_REFERENCE_PATTERN);\n}\n\n/**\n * True when the error is a failed dynamic import or CSS preload — the\n * content-hashed chunk this bundle asks for is gone from the CDN.\n */\nexport function isChunkLoadError(error: unknown): boolean {\n if (error instanceof Error && error.name === 'ChunkLoadError') return true;\n const message = messageOf(error);\n return CHUNK_LOAD_PATTERNS.some((pattern) => message.includes(pattern));\n}\n\n// ─── Staleness ───────────────────────────────────────────────────\n\n/**\n * True once this client is known to be running against a superseded\n * deployment. One-way: a document that has gone stale cannot come back, since\n * the only way to get fresh code is to load a new document.\n *\n * In-memory on purpose. Persisting it would be wrong — the next document gets\n * whatever build the server hands it, and if that one is stale too it will\n * find out the same way.\n */\nlet stale = false;\n\n/**\n * True once {@link initStaleClient} has seen a deployment ID — i.e. this is a\n * production build. False in dev, where nothing is ever stale: HMR owns code\n * updates, and a failed dynamic import is a real error the developer needs to\n * see rather than something a page load fixes.\n */\nlet deployed = false;\n\n/** Whether this client has been superseded by a newer deployment. */\nexport function isClientStale(): boolean {\n return stale;\n}\n\n/**\n * Record that the origin has told us this client is stale — the `X-Timber-Reload`\n * header on an RSC or action response. Authoritative, so it is not gated on\n * anything: a dev server never sends the header in the first place.\n */\nexport function markClientStale(): void {\n stale = true;\n}\n\n/**\n * Record staleness if `error` is one of the shapes a superseded bundle\n * produces. Returns whether it did, so a caller mid-navigation can decide to\n * hard-navigate instead of surfacing the error.\n *\n * Inference, unlike {@link markClientStale}, so it is gated on being a\n * production build. This is the single place that gate lives — call sites\n * cannot see each other, and \"remember to gate the next one too\" is not a\n * guarantee.\n */\nexport function markStaleFromError(error: unknown): boolean {\n if (!deployed) return false;\n\n // A document being torn down aborts its in-flight dynamic imports, and an\n // aborted import reads exactly like a chunk the CDN has dropped. That is not\n // evidence of staleness, and the bit outlives the teardown that produced it:\n // a document entering the back-forward cache is frozen, not destroyed, so a\n // false positive recorded on the way out would cost the *restored* page its\n // client-side navigation for good. `unload-guard.ts` clears its own flag on\n // a persisted `pageshow`; this one is one-way by design, so it has to not be\n // set in the first place.\n if (isPageUnloading()) return false;\n\n if (!isStaleClientReference(error) && !isChunkLoadError(error)) return false;\n stale = true;\n return true;\n}\n\n// ─── Initialization ──────────────────────────────────────────────\n\n/**\n * The underlying error Vite attaches to a `vite:preloadError` event.\n *\n * Narrowed at runtime rather than cast: the property is Vite's, not ours, and\n * a shape change should fall back to matching the event itself rather than\n * silently reading `undefined` forever.\n */\nfunction preloadErrorPayload(event: Event): unknown {\n return 'payload' in event ? (event as Event & { payload: unknown }).payload : event;\n}\n\n/**\n * Arm the module, and register the listeners that catch stale-client errors\n * never passing through the router: a lazily imported client component, a\n * preloaded stylesheet, anything that rejects outside a navigation.\n *\n * No-op when `deploymentId` is null — that is dev. Called from the browser\n * entry before hydration, so it precedes any render or navigation that could\n * throw.\n */\nexport function initStaleClient(deploymentId: string | null): void {\n if (!deploymentId) return;\n deployed = true;\n\n // Vite dispatches this for failed chunk/CSS preloads. Note what is *not*\n // here: `preventDefault()`. Recording staleness is not recovering from this\n // error — the page is still broken until the user navigates — so Vite must\n // go on rethrowing it rather than have it silently swallowed.\n window.addEventListener('vite:preloadError', (event) => {\n markStaleFromError(preloadErrorPayload(event));\n });\n\n window.addEventListener('unhandledrejection', (event: PromiseRejectionEvent) => {\n markStaleFromError(event.reason);\n });\n}\n","/**\n * Router Skew Recording — turning a rejection into \"this bundle is superseded\".\n *\n * Detection lives in `stale-client.ts`; this is the one place the router (and\n * anything else holding an RSC rejection) turns an error into that verdict.\n * Recovery is not here: every path that gives up on client-side navigation —\n * skew or not — leaves through `createSpaExits()` in `router-effects.ts`.\n *\n * See design/33-version-skew.md §\"Recovery on the next navigation\"\n */\n\nimport { VersionSkewError } from './rsc-fetch.ts';\nimport { markClientStale, markStaleFromError } from './stale-client.ts';\n\n/**\n * Record a version skew if `error` is one, and report whether it was.\n *\n * `VersionSkewError` is the origin saying so outright; the reactive shapes are\n * inferred from the error text and are a no-op in dev.\n *\n * Closes over nothing — anywhere an RSC payload can fail needs it, including\n * places that have no router instance to hand.\n */\nexport function recordSkew(error: unknown): boolean {\n if (error instanceof VersionSkewError) {\n markClientStale();\n return true;\n }\n return markStaleFromError(error);\n}\n","/**\n * Router Effects — full-page navigation and post-paint scroll.\n *\n * The two things the router does *to the document* rather than to its own\n * state: leaving the SPA entirely, and moving the scroll position once React\n * has committed. Extracted from `router.ts` to keep that file focused on\n * navigation state (see design/18-build-system.md §\"No file >500 lines\").\n *\n * See design/19-client-navigation.md §\"Scroll Restoration\"\n */\n\nimport { setHardNavigating } from './navigation-root.tsx';\nimport type { RenderOwner } from './navigation-transition.ts';\nimport { RedirectError, ServerErrorResponse, NonRscResponse } from './rsc-fetch.ts';\nimport { recordSkew } from './router-skew.ts';\n\n/** The subset of `RouterDeps` the post-paint scroll effects need. */\nexport interface ScrollEffectDeps {\n scrollTo: (x: number, y: number) => void;\n afterPaint?: (callback: () => void) => void;\n scrollToHash?: (hash: string) => boolean;\n}\n\nexport interface ScrollEffects {\n /**\n * Schedule scroll restoration after the next paint and fire the\n * scroll-restored event. Used by navigate, popstate, and refresh.\n */\n restoreScrollAfterPaint: (scrollY: number) => void;\n /**\n * Scroll to the element matching the URL #fragment after paint, falling\n * back to scroll-to-top when no element matches (matching full-page-load\n * behavior for an unknown fragment). Used by forward navigation to a\n * hash-bearing URL (TIM-1035).\n */\n scrollToHashAfterPaint: (hash: string) => void;\n}\n\nexport function createScrollEffects(deps: ScrollEffectDeps): ScrollEffects {\n /** Run a callback after the next paint (after React commit). */\n function afterPaint(callback: () => void): void {\n if (deps.afterPaint) {\n deps.afterPaint(callback);\n } else {\n callback();\n }\n }\n\n function restoreScrollAfterPaint(scrollY: number): void {\n afterPaint(() => {\n deps.scrollTo(0, scrollY);\n window.dispatchEvent(new Event('timber:scroll-restored'));\n });\n }\n\n function scrollToHashAfterPaint(hash: string): void {\n afterPaint(() => {\n if (deps.scrollToHash?.(hash) !== true) {\n deps.scrollTo(0, 0);\n }\n window.dispatchEvent(new Event('timber:scroll-restored'));\n });\n }\n\n return { restoreScrollAfterPaint, scrollToHashAfterPaint };\n}\n\n/**\n * Leave the SPA and never come back.\n *\n * Every router path that gives up on client-side navigation does the same\n * three things: flag the hard navigation so the Navigation API and React stop\n * acting on a dying document, perform the document load, then block forever so\n * the caller cannot carry on rendering into it. The returned promise is\n * deliberately unresolvable — `location` assignment does not stop this turn of\n * the event loop.\n *\n * Callers: server error, non-RSC response, and every version skew path\n * ([33-version-skew.md](../../../../design/33-version-skew.md)).\n */\nexport function leaveSpa(url: string, fromUrl: string): Promise<never> {\n setHardNavigating(true);\n hardNavigate(url, fromUrl);\n return new Promise<never>(() => {});\n}\n\nexport interface SpaExitDeps {\n /** The owner that holds the router right now, or null when idle. */\n currentOwner: () => RenderOwner | null;\n /** Supersede whatever is in flight and take ownership. */\n supersede: () => void;\n}\n\nexport interface SpaExits {\n /**\n * Leave the SPA — but only if `owner` still owns the router. Every\n * failure a navigation can end on (a server error, a non-RSC response, a\n * version skew) can surface long after the user has clicked something else:\n * a fetch that was never cancellable, a Flight thenable that rejects late.\n * Hard navigating to the abandoned URL would undo that click, so a\n * navigation that no longer owns the router does nothing and lets the one\n * that does drive. Never resolves when it does navigate.\n *\n * Must be called from inside the `runNavigation()` callback. That function's\n * `finally` clears the current controller, so an ownership check downstream\n * of it compares against `null` and never leaves at all.\n */\n leaveSpaIfOwned: (owner: RenderOwner, url: string, fromUrl: string) => Promise<void>;\n\n /**\n * Leave the SPA from a path that never entered `runNavigation()` — the\n * stale-client short circuits, which decide before any fetch is attempted.\n *\n * Supersedes first. Nothing else on those paths takes ownership, so without\n * it an in-flight navigation keeps the router: when its fetch or decode\n * fails a moment later it still passes its own ownership check and hard\n * navigates to *its* URL, overwriting the document load started here.\n */\n leaveSpaSuperseding: (url: string, fromUrl: string) => Promise<never>;\n}\n\n/**\n * The two ownership-aware ways out of the SPA.\n *\n * Both wrap {@link leaveSpa} with the question \"is this navigation still the\n * one the user is waiting for?\" — asked before leaving on a failure, answered\n * by force on a path that decided before any navigation began. They live\n * together because every caller of `leaveSpa()` needs one or the other, and\n * an unguarded call is the bug (TIM-1275, TIM-1276).\n */\nexport function createSpaExits({ currentOwner, supersede }: SpaExitDeps): SpaExits {\n async function leaveSpaIfOwned(owner: RenderOwner, url: string, fromUrl: string): Promise<void> {\n if (currentOwner() !== owner) return;\n await leaveSpa(url, fromUrl);\n }\n\n function leaveSpaSuperseding(url: string, fromUrl: string): Promise<never> {\n supersede();\n return leaveSpa(url, fromUrl);\n }\n\n return { leaveSpaIfOwned, leaveSpaSuperseding };\n}\n\nexport interface NavigationRecoveryDeps {\n /** The owner that holds the router right now, or null when idle. */\n currentOwner: () => RenderOwner | null;\n leaveSpaIfOwned: SpaExits['leaveSpaIfOwned'];\n /**\n * Replace the current entry with `url` — the router's own `navigate()`,\n * rendering with `types`: the view transition types of the render the\n * redirect interrupted, so a redirected Back still animates as Back and a\n * link's own `transitionTypes` survive the hop (TIM-1471).\n */\n navigate: (url: string, types: readonly string[]) => Promise<void>;\n}\n\n/**\n * Answer the failures an RSC fetch can end on, or report that this one is not\n * ours to answer.\n *\n * Returns `true` when the error was handled; the caller rethrows on `false`.\n * Handling a failure by leaving the SPA never resolves at all — the document\n * is going away and the caller must not carry on rendering into it.\n *\n * There is exactly one family of these and one response to it, so it lives in\n * one function rather than once per fetch path. `navigate()`, `refresh()` and\n * an uncached traversal all reach it: the latter two used to rethrow instead,\n * and since nobody awaits a traversal that meant pressing Back on a 500 left\n * the user on the old document with an unhandled rejection (TIM-1277).\n *\n * Order matters in exactly one way: `recordSkew()` ends in error-*text*\n * matching, so it goes last and can never pre-empt a framework control-flow\n * signal whose message happens to read like a stale bundle. The class checks\n * above it are mutually exclusive, so their order is free.\n *\n * Must be called from inside the `runNavigation()` callback — see\n * {@link SpaExits.leaveSpaIfOwned}.\n */\nexport function createNavigationRecovery({\n currentOwner,\n leaveSpaIfOwned,\n navigate,\n}: NavigationRecoveryDeps) {\n return async function recoverFromNavigationError(\n error: unknown,\n owner: RenderOwner,\n url: string,\n fromUrl: string,\n /** The view transition types of the render that failed. */\n types: readonly string[]\n ): Promise<boolean> {\n if (error instanceof RedirectError) {\n // Same ownership rule as leaving the SPA: a superseded navigation must\n // not steer the document to the destination it was abandoned for.\n if (currentOwner() !== owner) return true;\n await navigate(error.redirectUrl, types);\n return true;\n }\n // A server error, a non-RSC response and a version skew all end the same\n // way: hand `url` back to the server as a document load, so it can render\n // the outcome as HTML (design/10-error-handling.md §\"Error Page Rendering\n // for Client Navigation\").\n if (\n error instanceof ServerErrorResponse ||\n error instanceof NonRscResponse ||\n recordSkew(error)\n ) {\n await leaveSpaIfOwned(owner, url, fromUrl);\n return true;\n }\n return false;\n };\n}\n\n/**\n * Perform the full document load.\n *\n * `fromUrl` is the URL the navigation departed from, passed explicitly\n * because the address bar may have already been updated.\n *\n * When the target differs from the departure point only by #fragment,\n * assigning `href` is a hash change, not a load — so assign first (to update\n * the address bar) and then reload (TIM-1235).\n */\nexport function hardNavigate(url: string, fromUrl: string): void {\n const current = new URL(fromUrl, window.location.origin);\n const target = new URL(url, window.location.origin);\n if (target.pathname === current.pathname && target.search === current.search) {\n window.location.href = url;\n window.location.reload();\n } else {\n window.location.href = url;\n }\n}\n","/**\n * The digest an unhandled render error carries across Flight, and the\n * correlation ID error pages read back out of it.\n *\n * Flight's `onError` (server/rsc-entry/rsc-stream.ts) returns this string for\n * any error that is not a deny or redirect, and React sets it as `digest` on\n * the Error it revives for that row, in SSR and on the client alike. The\n * `errorId` is the one the server logged the error with, so an error page\n * that shows it gives the reader something to quote that an operator can\n * find. It is the `digest` prop every TSX error page receives.\n *\n * `message` is the real message only in dev; production sends a fixed string\n * (design/13-security.md §\"Errors don't leak\").\n */\n\ninterface ErrorRowDigest {\n type: 'error';\n message: string;\n errorId: string;\n}\n\nexport function encodeErrorDigest(digest: Omit<ErrorRowDigest, 'type'>): string {\n const row: ErrorRowDigest = { type: 'error', ...digest };\n return JSON.stringify(row);\n}\n\n/**\n * The correlation ID in an error's Flight digest, or `null` when the error\n * carries none — a deny or redirect row, an error that never crossed Flight,\n * or anything that is not an object.\n */\nexport function errorDigestId(error: unknown): string | null {\n if (typeof error !== 'object' || error === null) return null;\n const digest: unknown = Reflect.get(error, 'digest');\n if (typeof digest !== 'string') return null;\n let parsed: unknown;\n try {\n parsed = JSON.parse(digest);\n } catch {\n // A digest someone else set (a library's own error): not ours to read.\n return null;\n }\n if (typeof parsed !== 'object' || parsed === null) return null;\n const errorId: unknown = Reflect.get(parsed, 'errorId');\n return Reflect.get(parsed, 'type') === 'error' && typeof errorId === 'string' ? errorId : null;\n}\n","'use client';\n\n/**\n * Framework-injected React error boundary.\n *\n * Catches errors thrown by children and renders a fallback component\n * with the appropriate props based on error type:\n * - DenySignal (4xx) → { status, data }\n * - Unhandled error (500) → { error, digest, reset }, where `digest` is the\n * ID the server logged the error with (shared/error-digest.ts)\n *\n * The `status` prop controls which errors this boundary catches:\n * - Specific code (e.g. 403) → only that status\n * - Category (400) → any 4xx\n * - Category (500) → any 5xx\n * - Omitted → catches everything (error.tsx behavior)\n *\n * See design/10-error-handling.md §\"Status-Code Files\"\n */\n\nimport { Component, createContext, createElement, useContext, type ReactNode } from 'react';\nimport { getRouterOrNull } from './router-ref.ts';\nimport { markStaleFromError } from './stale-client.ts';\nimport { StatusPageMarker } from './status-page-marker.tsx';\nimport { errorDigestId } from '../shared/error-digest.ts';\nimport { leaveSpa } from './router-effects.ts';\n// Page unload detection: when the page is being torn down, error boundaries\n// suppress activation — the error is from the aborted connection, not the\n// application. unload-guard.ts is the single owner of that state; this module\n// used to keep its own copy, which drifted (TIM-1260).\nimport { isPageUnloading } from './unload-guard.ts';\n\n// ─── Ancestry Context ────────────────────────────────────────────────────────\n\n/**\n * Tracks the chain of segment keys from root to the current boundary.\n * Each keyed `TimberErrorBoundary` appends its `segmentKey`; unkeyed\n * slot boundaries pass the parent value through. The claim rule uses\n * this to find the first *reachable* owner from the `owners` list,\n * eliminating the owner-below-throw-site escape. See TIM-1450.\n */\nconst DenyAncestryContext = createContext<readonly string[]>([]);\n\nexport { DenyAncestryContext };\n\n// ─── Digest Types ────────────────────────────────────────────────────────────\n\n/** Structured digest returned by RSC onError for DenySignal. */\ninterface DenyDigest {\n type: 'deny';\n status: number;\n data: unknown;\n /**\n * Ordered candidate owners — segment keys of segments with matching deny\n * pages, best match first. Present = addressed (a boundary should render\n * it). In-tree hoists produce a single-element list; late addressing\n * (TIM-1450) produces the full candidate list so the boundary can find the\n * first *reachable* owner via its ancestry context.\n */\n owners?: string[];\n}\n\n/** Structured digest returned by RSC onError for RedirectSignal. */\ninterface RedirectDigest {\n type: 'redirect';\n location: string;\n status: number;\n}\n\ntype ParsedDigest = DenyDigest | RedirectDigest;\n\n// ─── Props & State ───────────────────────────────────────────────────────────\n\nexport interface TimberErrorBoundaryProps {\n /** The component to render when an error is caught. */\n fallbackComponent?: (...args: unknown[]) => ReactNode;\n /**\n * Status code filter. If set, only catches errors matching this status.\n * 400 = any 4xx, 500 = any 5xx, specific number = exact match.\n */\n status?: number;\n /**\n * When true, this boundary wraps a parallel slot. Slot denials are\n * graceful degradation: the boundary claims any addressed deny that\n * reaches it and leaves the page's segment chain unmarked.\n */\n isSlotBoundary?: boolean;\n /**\n * Segment key of the segment that declared this boundary. Only meaningful\n * against a deny digest carrying `owners`. See the decline rule in\n * `render()` and TIM-1356.\n */\n segmentKey?: string;\n /**\n * Catch denies only; re-throw everything else. Set on the copy of a\n * segment's boundaries placed outside its layout, which gives a deny thrown\n * from that layout's own chrome a catcher keyed to the segment — without\n * changing where a 5xx from the same chrome goes. See TIM-1450.\n */\n denyOnly?: boolean;\n /**\n * The deny chain's terminal: the outermost framework boundary, which claims\n * any deny that streamed past every segment boundary and renders the\n * framework default page. Implies `denyOnly`. Only a deny thrown from a\n * layout's chrome with no status file at or above that layout gets here —\n * the segment copies (`denyOnly`) claim every other shape. See TIM-1450.\n */\n lastResort?: boolean;\n children: ReactNode;\n}\n\ninterface TimberErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n\n// Module-level guard: the first boundary to catch a given redirect digest\n// schedules the navigation and marks it handled here. Subsequent renders\n// (React retries the error-boundary render path multiple times in dev, and\n// outer boundaries that also see the error) become no-ops, preventing\n// duplicate router.navigate() calls.\nconst _handledRedirects = new WeakSet<object>();\n\n// The same guard for the terminal's exit: React may render the fallback\n// path more than once for one error, and the document load must start once.\nconst _handledExits = new WeakSet<object>();\n\n// Companion guard keyed by location: client-render redirect() (the\n// next/navigation shim) throws a FRESH error instance on every render\n// attempt, and React replays the errored render — so the WeakSet alone\n// would schedule the navigation twice. While a navigation to a location\n// is pending, further redirect errors for the same location are no-ops.\nlet _pendingRedirectLocation: string | null = null;\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\nexport class TimberErrorBoundary extends Component<\n TimberErrorBoundaryProps,\n TimberErrorBoundaryState\n> {\n constructor(props: TimberErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error): TimberErrorBoundaryState {\n // Suppress error boundaries during page unload (refresh/navigate away).\n // The aborted connection causes React's streaming hydration to error,\n // but the page is about to be replaced — showing an error boundary\n // would be a jarring flash for the user.\n if (isPageUnloading()) {\n return { hasError: false, error: null };\n }\n\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error): void {\n // A stale bundle most often surfaces here rather than as a rejected\n // navigation: a client reference missing from this build's manifest, or\n // a lazily-imported chunk the CDN no longer has, thrown during render.\n //\n // Recording it is all that happens — this boundary still renders its\n // fallback, and the recovery is the user's next navigation, which the\n // router turns into a full document load. Reloading from here would be a\n // page load the user did not ask for, on a page that may be mid-rollout\n // and would come back just as stale (TIM-1275).\n markStaleFromError(error);\n }\n\n componentDidUpdate(prevProps: TimberErrorBoundaryProps): void {\n // Reset error state when children change (e.g. client-side navigation).\n // Without this, navigating from one error page to another keeps the\n // stale error — getDerivedStateFromError doesn't re-fire for new children.\n if (this.state.hasError && prevProps.children !== this.props.children) {\n this.setState({ hasError: false, error: null });\n }\n }\n\n /** Reset the error state so children re-render. */\n private reset = () => {\n this.setState({ hasError: false, error: null });\n };\n\n static override contextType = DenyAncestryContext;\n declare context: readonly string[];\n\n private get childAncestry(): readonly string[] {\n const parent = this.context ?? [];\n const key = this.props.segmentKey;\n // A segment has two keyed boundary sets (outside and inside its layout);\n // the inner one sees its own key already present and adds nothing.\n return key && !parent.includes(key) ? [...parent, key] : parent;\n }\n\n render(): ReactNode {\n if (!this.state.hasError || !this.state.error) {\n return createElement(\n DenyAncestryContext.Provider,\n { value: this.childAncestry },\n this.props.children\n );\n }\n\n const error = this.state.error;\n const parsed = parseDigest(error);\n\n // RedirectSignal handling splits by environment:\n //\n // - SSR (no window): re-throw so the Fizz shell fails and the server\n // pipeline catch block can produce a proper HTTP 3xx response. See\n // design/04-authorization.md.\n //\n // - Client (window exists): a RedirectSignal that leaked into the RSC\n // Flight payload during client navigation would otherwise bubble past\n // every error boundary to `window.onerror`, which in dev triggers the\n // Vite error overlay (false positive — navigation itself works).\n // Instead, ask the router to perform an SPA navigation to the target\n // and render nothing while it takes over. The router's own catch path\n // handles cross-origin / hard navigations. See TIM-838.\n if (parsed?.type === 'redirect') {\n if (typeof window === 'undefined') {\n throw error;\n }\n // Dedupe: React may render the error-boundary fallback path more\n // than once for a single caught error (dev-mode double render, and\n // additional boundaries above us in the tree). Only schedule the\n // navigation on the first render that sees this error instance.\n const alreadyHandled =\n _handledRedirects.has(error) || _pendingRedirectLocation === parsed.location;\n if (!alreadyHandled) {\n _handledRedirects.add(error);\n const router = getRouterOrNull();\n if (router) {\n _pendingRedirectLocation = parsed.location;\n // Schedule the navigation outside the render phase to avoid\n // setState-during-render warnings from router state updates.\n queueMicrotask(() => {\n router\n .navigate(parsed.location, { replace: true })\n .catch(() => {\n // Fall back to a hard navigation if the soft navigation fails.\n window.location.href = parsed.location;\n })\n .finally(() => {\n _pendingRedirectLocation = null;\n });\n });\n } else {\n // No router available (shouldn't happen post-bootstrap) — fall\n // back to a hard navigation so the user still ends up at the\n // target.\n window.location.href = parsed.location;\n }\n }\n // Nothing to show, but still a subtree replaced: a layout that\n // redirected after I/O never mounted its children, and the commit that\n // renders this empty spot must not teach the cache otherwise — or the\n // redirect's own navigation would advertise those layouts as mounted\n // and the server would skip into an outlet the client does not have.\n return this.markStatusPage(null);\n }\n\n // Owner-addressed denies: the digest carries an ordered `owners` list\n // of segment keys with matching deny pages. This boundary claims the\n // deny only when it is the first *reachable* owner — i.e. its\n // segmentKey appears in `owners` AND in its ancestry (the chain from\n // root to here). Unreachable owners (below the throw site) are skipped,\n // and the first ancestor that IS reachable claims. This eliminates the\n // owner-below-throw-site escape (TIM-1450).\n //\n // Unkeyed boundaries (slots, or boundaries without deny chains) never\n // claim an addressed deny. See TIM-1356.\n if (parsed?.type === 'deny' && Array.isArray(parsed.owners) && parsed.owners.length > 0) {\n // Slot boundaries always claim addressed denies — graceful degradation\n // within the slot is correct regardless of which segment the owner\n // chain resolved to. Without this, the deny escapes the slot and\n // becomes a page-level 4xx. See TIM-1450.\n if (!this.props.lastResort && !this.props.isSlotBoundary) {\n const reachable = parsed.owners.find((k: string) => this.childAncestry.includes(k));\n if (!this.props.segmentKey || reachable !== this.props.segmentKey) {\n throw error;\n }\n }\n }\n // Deny-only boundaries (the outer segment copies) re-throw everything\n // else so a crash in a layout's chrome still reaches the documented 5xx\n // flow instead of a status page for an unrelated error.\n if (this.props.denyOnly && !this.props.lastResort && parsed?.type !== 'deny') {\n throw error;\n }\n // The terminal is where that flow ends on the client. A non-deny row\n // nothing claimed — a crash on a route with no\n // matching `error.tsx` — has no page to render in-SPA; React would\n // unmount the root. So the terminal does what the router does for an\n // error envelope (design/10 §\"Error Page Rendering for Client\n // Navigation\"): leave the SPA, and let the document request render the\n // real error page with the real status. On the server it re-throws so\n // the Fizz shell fails and the pipeline serves that page directly. The\n // envelope still covers errors that land inside Flight's opening window;\n // this covers the ones that land after it, which used to be held for\n // (TIM-1495, TIM-1497).\n if (this.props.lastResort && parsed?.type !== 'deny') {\n if (typeof window === 'undefined') {\n throw error;\n }\n if (!_handledExits.has(error)) {\n _handledExits.add(error);\n const router = getRouterOrNull();\n const current = window.location.pathname + window.location.search;\n // The row arrived for the navigation in flight, whose URL is not on\n // the address bar yet; fall back to the current document.\n const target = router?.getPendingUrl() ?? current;\n queueMicrotask(() => {\n void leaveSpa(target, current);\n });\n }\n return null;\n }\n\n // If this boundary has a status filter, check whether the error matches.\n // Non-matching errors re-throw so an outer boundary can catch them.\n if (this.props.status != null) {\n const errorStatus = getErrorStatus(parsed, error);\n if (errorStatus == null || !statusMatches(this.props.status, errorStatus)) {\n // Re-throw: this boundary doesn't handle this error.\n throw error;\n }\n }\n\n return this.markStatusPage(this.renderFallback(parsed, error));\n }\n\n /**\n * The status page this boundary shows for a row it claimed. Its shape is\n * the file's documented contract: TSX status files get `{ status,\n * data }`, `error.tsx` gets `{ error, digest, reset }` (plus\n * the deny extras for dual-shape implementations — without the error prop,\n * an error.tsx reading error.message crashes on deny fall-through, TIM-1081).\n */\n private renderFallback(parsed: ParsedDigest | null, error: Error): ReactNode {\n if (parsed?.type === 'deny') {\n if (this.props.status != null) {\n return createElement(this.props.fallbackComponent as never, {\n status: parsed.status,\n data: parsed.data,\n });\n }\n return createElement(this.props.fallbackComponent as never, {\n error: denyError(parsed.status, error),\n digest: null,\n reset: this.reset,\n status: parsed.status,\n data: parsed.data,\n });\n }\n\n // Unhandled error (500)\n return createElement(this.props.fallbackComponent as never, {\n error,\n digest: errorDigestId(error),\n reset: this.reset,\n });\n }\n\n /**\n * A status page (or, for a redirect row, nothing at all) replaced part of\n * the main route, and the segment cache must not learn a chain that never\n * mounted; the marker tells the navigation that commits this tree. A boundary that declined in `render()` re-threw\n * before getting here, so only the boundary that put a page on screen\n * speaks. A slot degrading leaves the page and its chain intact, so slot\n * boundaries stay silent. See `status-page-marker.tsx` (TIM-1495).\n */\n private markStatusPage(page: ReactNode): ReactNode {\n if (this.props.isSlotBoundary) return page;\n return createElement(StatusPageMarker, null, page);\n }\n}\n\n// ─── Helpers ─────────────────────────────────────────────────────────────────\n\n/**\n * Parse the structured digest from the error.\n * React sets `error.digest` from the string returned by RSC's onError.\n */\nfunction parseDigest(error: Error): ParsedDigest | null {\n const raw = (error as { digest?: string }).digest;\n if (typeof raw !== 'string') return null;\n try {\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === 'object' && typeof parsed.type === 'string') {\n return parsed as ParsedDigest;\n }\n } catch (e) {\n console.debug('[timber] error digest is not valid JSON:', e instanceof Error ? e.message : e);\n }\n return null;\n}\n\n/**\n * The Error an `error.tsx` serving a deny should receive.\n *\n * The error that actually arrives here is React's, not the framework's: a\n * server-thrown error crossing Flight has its message and name replaced with\n * a generic redacted string in production, by design. An `error.tsx` written\n * per the docs branches on `error.message` — so handing it the redacted error\n * gives it nothing to branch on, while the in-tree path hands the same file a\n * `DenySignal` named error reading `Access denied with status <N>` (see\n * `renderDenyEntry`). This reconstructs that shape from the digest, which is\n * where the status already is.\n *\n * Derived from the status alone — no stack, no server data — so it is safe on\n * the client for the same reason the digest is. See design/13-security.md\n * §\"Errors don't leak\", TIM-1081.\n */\nfunction denyError(status: number, original: Error): Error {\n // A dev build may have preserved something more useful than the redaction.\n if (original.name === 'DenySignal') return original;\n const error = new Error(`Access denied with status ${status}`);\n error.name = 'DenySignal';\n return error;\n}\n\n/**\n * Extract the HTTP status code from a parsed digest or error message.\n * Falls back to message pattern matching for errors without a digest.\n */\nfunction getErrorStatus(parsed: ParsedDigest | null, error: Error): number | null {\n if (parsed?.type === 'deny') return parsed.status;\n if (parsed?.type === 'redirect') return parsed.status;\n\n // Fallback: parse DenySignal message pattern for errors that lost their digest\n const match = error.message.match(/^Access denied with status (\\d+)$/);\n if (match) return parseInt(match[1], 10);\n\n // Unhandled errors are implicitly 500\n return 500;\n}\n\n/**\n * Check whether an error's status matches the boundary's status filter.\n * Category markers (400, 500) match any status in that range.\n */\nfunction statusMatches(boundaryStatus: number, errorStatus: number): boolean {\n // Category catch-all: 400 matches any 4xx, 500 matches any 5xx\n if (boundaryStatus === 400) return errorStatus >= 400 && errorStatus <= 499;\n if (boundaryStatus === 500) return errorStatus >= 500 && errorStatus <= 599;\n // Exact match\n return boundaryStatus === errorStatus;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyEA,IAAa,sBAAuC;CAAE,QAAQ,CAAC;CAAG,YAAY;AAAK;;AAGnF,SAAS,mBAAmB,OAA0C;CACpE,OACE,OAAO,UAAU,YACjB,UAAU,QACV,YAAY,SACZ,OAAQ,MAA0B,WAAW,YAC5C,MAA0B,WAAW;AAE1C;;;;;;;;AASA,SAAgB,oBAAoB,QAAkC;CACpE,IAAI,CAAC,mBAAmB,MAAM,GAAG,OAAO;CACxC,OAAO;EAAE,QAAQ,OAAO;EAAQ,YAAY,OAAO,cAAc;CAAK;AACxE;;;;;;;AAQA,SAAgB,gBAAgB,MAAwB;CACtD,IAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,UAAU,QAAQ,mBAAmB,IAAI,GACxF,OAAQ,KAAwB;CAElC,OAAO;AACT;;;;;;;;AA2BA,SAAgB,iBAAiB,MAA6B;CAC5D,IACE,O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AgB,OAAO;EACtC,OAAO,cAAc,kBAAkB,MAAM,IAAI;CACnD;AACF;;;;;AAQA,SAAS,YAAY,OAAmC;CACtD,MAAM,MAAO,MAA8B;CAC3C,IAAI,OAAO,QAAQ,UAAU,OAAO;CACpC,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,GAAG;EAC7B,IAAI,UAAU,OAAO,WAAW,YAAY,OAAO,OAAO,SAAS,UACjE,OAAO;CAEX,SAAS,GAAG;EACV,QAAQ,MAAM,4CAA4C,aAAa,QAAQ,EAAE,UAAU,CAAC;CAC9F;CACA,OAAO;AACT;;;;;;;;;;;;;;;;;AAkBA,SAAS,UAAU,QAAgB,UAAwB;CAEzD,IAAI,SAAS,SAAS,cAAc,OAAO;CAC3C,MAAM,wBAAQ,IAAI,MAAM,6BAA6B,QAAQ;CAC7D,MAAM,OAAO;CACb,OAAO;AACT;;;;;AAMA,SAAS,eAAe,QAA6B,OAA6B;CAChF,IAAI,QAAQ,SAAS,QAAQ,OAAO,OAAO;CAC3C,IAAI,QAAQ,SAAS,YAAY,OAAO,OAAO;CAG/C,MAAM,QAAQ,MAAM,QAAQ,MAAM,mCAAmC;CACrE,IAAI,OAAO,OAAO,SAAS,MAAM,IAAI,EAAE;CAGvC,OAAO;AACT;;;;;AAMA,SAAS,cAAc,gBAAwB,aAA8B;CAE3E,IAAI,mBAAmB,KAAK,OAAO,eAAe,OAAO,eAAe;CACxE,IAAI,mBAAmB,KAAK,OAAO,eAAe,OAAO,eAAe;CAExE,OAAO,mBAAmB;AAC5B"}
@@ -0,0 +1,41 @@
1
+ //#region src/cache/fast-hash.ts
2
+ /**
3
+ * Fast non-cryptographic hash for cache keys.
4
+ *
5
+ * FNV-1a 64-bit produces a well-distributed hash with a collision
6
+ * probability of ~1 in 5 billion at 77k keys (birthday paradox).
7
+ * Not suitable for security, but ideal for cache key generation
8
+ * where we need speed over crypto strength.
9
+ *
10
+ * Uses BigInt for 64-bit arithmetic — supported in all modern runtimes
11
+ * including Cloudflare Workers. No node:crypto dependency.
12
+ *
13
+ * Server-side only. The `_rsc` payload cache key deliberately does NOT use
14
+ * this — the origin compares that value, which makes it a check rather than
15
+ * a cache key, and FNV is solvable for a chosen digest. See
16
+ * `shared/rsc-cache-key.ts`.
17
+ *
18
+ * See TIM-370.
19
+ */
20
+ var FNV_OFFSET_BASIS = 14695981039346656037n;
21
+ var FNV_PRIME = 1099511628211n;
22
+ var MASK_64 = 18446744073709551615n;
23
+ /**
24
+ * Compute a 64-bit FNV-1a hash of a string, returned as a 16-char hex string.
25
+ *
26
+ * 64 bits gives ~5 billion keys before a 50% collision probability
27
+ * (birthday paradox), making accidental collisions effectively impossible
28
+ * for cache key use cases.
29
+ */
30
+ function fnv1aHash(input) {
31
+ let hash = FNV_OFFSET_BASIS;
32
+ for (let i = 0; i < input.length; i++) {
33
+ hash ^= BigInt(input.charCodeAt(i));
34
+ hash = hash * FNV_PRIME & MASK_64;
35
+ }
36
+ return hash.toString(16).padStart(16, "0");
37
+ }
38
+ //#endregion
39
+ export { fnv1aHash as t };
40
+
41
+ //# sourceMappingURL=fast-hash-C-tVYrLb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fast-hash-C-tVYrLb.js","names":[],"sources":["../../src/cache/fast-hash.ts"],"sourcesContent":["/**\n * Fast non-cryptographic hash for cache keys.\n *\n * FNV-1a 64-bit produces a well-distributed hash with a collision\n * probability of ~1 in 5 billion at 77k keys (birthday paradox).\n * Not suitable for security, but ideal for cache key generation\n * where we need speed over crypto strength.\n *\n * Uses BigInt for 64-bit arithmetic — supported in all modern runtimes\n * including Cloudflare Workers. No node:crypto dependency.\n *\n * Server-side only. The `_rsc` payload cache key deliberately does NOT use\n * this — the origin compares that value, which makes it a check rather than\n * a cache key, and FNV is solvable for a chosen digest. See\n * `shared/rsc-cache-key.ts`.\n *\n * See TIM-370.\n */\n\n// FNV-1a constants for 64-bit hash\nconst FNV_OFFSET_BASIS = 0xcbf29ce484222325n;\nconst FNV_PRIME = 0x100000001b3n;\nconst MASK_64 = 0xffffffffffffffffn;\n\n/**\n * Compute a 64-bit FNV-1a hash of a string, returned as a 16-char hex string.\n *\n * 64 bits gives ~5 billion keys before a 50% collision probability\n * (birthday paradox), making accidental collisions effectively impossible\n * for cache key use cases.\n */\nexport function fnv1aHash(input: string): string {\n let hash = FNV_OFFSET_BASIS;\n for (let i = 0; i < input.length; i++) {\n hash ^= BigInt(input.charCodeAt(i));\n hash = (hash * FNV_PRIME) & MASK_64;\n }\n return hash.toString(16).padStart(16, '0');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAM,mBAAmB;AACzB,IAAM,YAAY;AAClB,IAAM,UAAU;;;;;;;;AAShB,SAAgB,UAAU,OAAuB;CAC/C,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,QAAQ,OAAO,MAAM,WAAW,CAAC,CAAC;EAClC,OAAQ,OAAO,YAAa;CAC9B;CACA,OAAO,KAAK,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG;AAC3C"}
@@ -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"}
@@ -0,0 +1,207 @@
1
+ import { join } from "node:path";
2
+ import { randomUUID } from "node:crypto";
3
+ import { rm, stat, writeFile } from "node:fs/promises";
4
+ //#region src/shared/static-platform-files.ts
5
+ /**
6
+ * Platform files the static build is allowed to overwrite in the output.
7
+ *
8
+ * The build merges two trees into the deployed directory — the client bundle
9
+ * (which carries everything the user put in `public/`) and the pre-rendered
10
+ * site. That merge otherwise refuses overlaps, because a silent overwrite
11
+ * leaves one of two artifacts deployed with nothing recording which
12
+ * (TIM-1266).
13
+ *
14
+ * These names are the exception, and only because the pre-rendered copy is
15
+ * *derived from* the one it replaces rather than competing with it:
16
+ * `plugins/static-build.ts` reads `public/_redirects` and writes the
17
+ * generated rules plus the user's, so the winner is a superset of the loser.
18
+ *
19
+ * That holds only for a file the current pass produced, which is why
20
+ * `cleanConditionalArtifacts` deletes a previous build's `_redirects` before
21
+ * generation: written only when a pass finds redirects, it would otherwise
22
+ * survive into a pass that produced nothing and claim an exemption it no
23
+ * longer earns.
24
+ *
25
+ * `_headers` is NOT here. It is not written into the pre-rendered tree at
26
+ * all — adapters generate it directly into the output, folding in the
27
+ * user's copy as they go (TIM-1326).
28
+ *
29
+ * Declared once so the code that performs the merge and the code that
30
+ * produces the merged file cannot disagree about which names are exempt.
31
+ *
32
+ * Isomorphic: no server, client, or build-time imports.
33
+ */
34
+ /** Platform redirect rules (Cloudflare Pages, Netlify). See TIM-1245/TIM-1249. */
35
+ var REDIRECTS_FILE = "_redirects";
36
+ /** Platform header rules (Cloudflare Pages, Netlify). See TIM-1241/TIM-1326. */
37
+ var HEADERS_FILE = "_headers";
38
+ /**
39
+ * Where a user authors platform files. Stated once because two modules read
40
+ * from here — `plugins/static-build.ts` for `_redirects`, adapters for
41
+ * `_headers` — and they must look in the same place.
42
+ *
43
+ * Both read the **project source**, never the build output. The generated
44
+ * file lands under the same name in the output directory, so a reader aimed
45
+ * there would fold the previous build's generated rules back in and compound
46
+ * them on every rebuild.
47
+ */
48
+ var USER_PLATFORM_DIR = "public";
49
+ /** Output-relative paths whose pre-rendered copy subsumes the `public/` one. */
50
+ var USER_MERGED_PLATFORM_FILES = [REDIRECTS_FILE];
51
+ /**
52
+ * Output paths the framework writes itself, which no route may claim.
53
+ *
54
+ * These are written outside the per-entry writer — `_redirects` after
55
+ * generation, `_headers` by the adapter after the copy — so the collision
56
+ * tracker never sees them and a route rendering to one of these paths is
57
+ * overwritten with nothing recording it.
58
+ *
59
+ * Reserved rather than tracked, because there is no version of "serve a route
60
+ * at `/_headers`" that works: Cloudflare Pages and Netlify read these two
61
+ * files themselves and never serve them, so the route is unservable however
62
+ * the conflict is resolved.
63
+ *
64
+ * That justification is per-file, not per-mechanism. `.nojekyll` is written
65
+ * the same way and is deliberately NOT here: only the `github-pages` target
66
+ * writes it, and everywhere else `/.nojekyll` is an ordinary servable path,
67
+ * so reserving it globally would refuse a valid Cloudflare site. Its write
68
+ * site skips the write when a file is already there instead — GitHub Pages
69
+ * only cares that the file exists.
70
+ *
71
+ * Same reasoning as the synthetic 404 entry using an internal urlPath so a
72
+ * real `/404` route cannot collide with `404.html`.
73
+ */
74
+ var RESERVED_OUTPUT_PATHS = [REDIRECTS_FILE, HEADERS_FILE];
75
+ //#endregion
76
+ //#region src/adapters/fs-identity.ts
77
+ /**
78
+ * What the output filesystem considers "the same file".
79
+ *
80
+ * Two build steps compare paths to decide whether two artifacts would land on
81
+ * one file — the render pass (`plugins/static-build.ts`) and the adapter's
82
+ * tree merge (`build-output-helper.ts`). Both are predicting a filesystem
83
+ * decision, so both ask the filesystem rather than comparing raw strings
84
+ * (TIM-1266).
85
+ *
86
+ * Two properties matter, and they are independent:
87
+ *
88
+ * - **Case folding.** macOS APFS and Windows NTFS fold by default, ext4 does
89
+ * not. Dynamic params `Foo` and `foo` are one file on a Mac and two on
90
+ * Linux CI.
91
+ * - **Unicode normalization.** APFS compares normalization-insensitively, so
92
+ * `café` spelled NFC (`é`) and NFD (`e` + combining acute) address one
93
+ * file. This holds even on a *case-sensitive* APFS volume, which is why it
94
+ * is probed separately rather than inferred from case folding.
95
+ *
96
+ * Probed rather than read off `process.platform`: a case-sensitive volume on
97
+ * macOS and a case-insensitive mount on Linux are both ordinary, and the
98
+ * answer that matters is the one for the directory being written.
99
+ *
100
+ * Leaf module — Node built-ins only. Kept apart from `adapters/shared.ts`,
101
+ * whose rule builders are pure string functions: this one touches the disk.
102
+ */
103
+ /** Every path comparison is exact — the conservative answer when unprobed. */
104
+ var EXACT_FS_IDENTITY = {
105
+ caseInsensitive: false,
106
+ normalizationInsensitive: false,
107
+ stripsTrailingDotsAndSpaces: false
108
+ };
109
+ /**
110
+ * Probe `dir` by writing one file and asking for it under other spellings.
111
+ *
112
+ * Returns {@link EXACT_FS_IDENTITY} when the probe cannot run. That
113
+ * under-detects, but a directory this cannot write to is one the caller is
114
+ * about to fail on anyway, with a clearer error than a missed collision.
115
+ */
116
+ async function detectFsIdentity(dir) {
117
+ const name = `.timber-probe-${randomUUID()}-café`;
118
+ const path = join(dir, name);
119
+ try {
120
+ await writeFile(path, "");
121
+ const [caseInsensitive, normalizationInsensitive, stripsTrailingDotsAndSpaces] = await Promise.all([
122
+ exists(join(dir, name.toUpperCase())),
123
+ exists(join(dir, name.normalize("NFD"))),
124
+ exists(join(dir, `${name}.`))
125
+ ]);
126
+ return {
127
+ caseInsensitive,
128
+ normalizationInsensitive,
129
+ stripsTrailingDotsAndSpaces
130
+ };
131
+ } catch {
132
+ return EXACT_FS_IDENTITY;
133
+ } finally {
134
+ await rm(path, { force: true }).catch(() => {});
135
+ }
136
+ }
137
+ /**
138
+ * Fold a path to the identity the filesystem compares it under.
139
+ *
140
+ * Normalization first, then case: `toLowerCase()` operates per code point, so
141
+ * folding a decomposed string first would leave the combining marks in a
142
+ * different order than folding a precomposed one.
143
+ *
144
+ * An approximation of the filesystem's own algorithm — APFS and NTFS fold per
145
+ * their own Unicode tables, which `toLowerCase()` matches for everything short
146
+ * of the exotic. It errs toward *finding* a collision, and the cost of a false
147
+ * positive is a build error naming two routes rather than a silent overwrite.
148
+ */
149
+ function fsKey(path, identity) {
150
+ let key = identity.caseInsensitive ? caseFold(path) : path;
151
+ if (identity.normalizationInsensitive) key = key.normalize("NFC");
152
+ if (identity.stripsTrailingDotsAndSpaces) key = key.split("/").map(stripTrailing).join("/");
153
+ return key;
154
+ }
155
+ /**
156
+ * Approximate Unicode case folding, which is what case-insensitive
157
+ * filesystems actually compare under.
158
+ *
159
+ * `toLowerCase()` is not it. Greek `σ` and final `ς` are both already
160
+ * lowercase and stay distinct under it, yet NTFS upcases both to `Σ` and APFS
161
+ * folds `ς` to `σ` — so two routes differing only in that letter are one file
162
+ * on both, and a lowercase key admitted them as two claims (TIM-1266).
163
+ * Uppercasing first collapses them.
164
+ *
165
+ * The residual is over-folding, in these cases and a few like them:
166
+ *
167
+ * | pair | folded together here | NTFS / APFS |
168
+ * | --------- | -------------------- | ----------------- |
169
+ * | `σ` / `ς` | yes | yes — the fix |
170
+ * | `ß` / `ss`| yes | no |
171
+ * | `ı` / `i` | yes | no |
172
+ * | `fi` / `fi`| yes | no |
173
+ *
174
+ * That direction is deliberate. Over-folding costs a build error naming two
175
+ * routes, which a developer fixes by renaming one; under-folding costs a
176
+ * payload silently overwritten by another route's, which nothing downstream
177
+ * can detect. An exact fold would need `Intl.Collator`, which compares but
178
+ * emits no sort key, so using it would turn a hash lookup into a pairwise
179
+ * scan over every claimed path.
180
+ */
181
+ function caseFold(value) {
182
+ return value.toUpperCase().toLowerCase();
183
+ }
184
+ /**
185
+ * Drop trailing dots and spaces from one path segment, as Win32 does.
186
+ *
187
+ * A segment that is nothing but dots and spaces is left alone: `.` and `..`
188
+ * are traversal, which the caller rejects before reaching here, and emptying
189
+ * a segment would merge two unrelated paths rather than the aliases this
190
+ * models.
191
+ */
192
+ function stripTrailing(segment) {
193
+ const stripped = segment.replace(/[. ]+$/, "");
194
+ return stripped === "" ? segment : stripped;
195
+ }
196
+ async function exists(path) {
197
+ try {
198
+ await stat(path);
199
+ return true;
200
+ } catch {
201
+ return false;
202
+ }
203
+ }
204
+ //#endregion
205
+ export { REDIRECTS_FILE as a, USER_PLATFORM_DIR as c, HEADERS_FILE as i, detectFsIdentity as n, RESERVED_OUTPUT_PATHS as o, fsKey as r, USER_MERGED_PLATFORM_FILES as s, EXACT_FS_IDENTITY as t };
206
+
207
+ //# sourceMappingURL=fs-identity-BRKuL215.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-identity-BRKuL215.js","names":[],"sources":["../../src/shared/static-platform-files.ts","../../src/adapters/fs-identity.ts"],"sourcesContent":["/**\n * Platform files the static build is allowed to overwrite in the output.\n *\n * The build merges two trees into the deployed directory — the client bundle\n * (which carries everything the user put in `public/`) and the pre-rendered\n * site. That merge otherwise refuses overlaps, because a silent overwrite\n * leaves one of two artifacts deployed with nothing recording which\n * (TIM-1266).\n *\n * These names are the exception, and only because the pre-rendered copy is\n * *derived from* the one it replaces rather than competing with it:\n * `plugins/static-build.ts` reads `public/_redirects` and writes the\n * generated rules plus the user's, so the winner is a superset of the loser.\n *\n * That holds only for a file the current pass produced, which is why\n * `cleanConditionalArtifacts` deletes a previous build's `_redirects` before\n * generation: written only when a pass finds redirects, it would otherwise\n * survive into a pass that produced nothing and claim an exemption it no\n * longer earns.\n *\n * `_headers` is NOT here. It is not written into the pre-rendered tree at\n * all — adapters generate it directly into the output, folding in the\n * user's copy as they go (TIM-1326).\n *\n * Declared once so the code that performs the merge and the code that\n * produces the merged file cannot disagree about which names are exempt.\n *\n * Isomorphic: no server, client, or build-time imports.\n */\n\n/** Platform redirect rules (Cloudflare Pages, Netlify). See TIM-1245/TIM-1249. */\nexport const REDIRECTS_FILE = '_redirects';\n\n/** Platform header rules (Cloudflare Pages, Netlify). See TIM-1241/TIM-1326. */\nexport const HEADERS_FILE = '_headers';\n\n/**\n * Where a user authors platform files. Stated once because two modules read\n * from here — `plugins/static-build.ts` for `_redirects`, adapters for\n * `_headers` — and they must look in the same place.\n *\n * Both read the **project source**, never the build output. The generated\n * file lands under the same name in the output directory, so a reader aimed\n * there would fold the previous build's generated rules back in and compound\n * them on every rebuild.\n */\nexport const USER_PLATFORM_DIR = 'public';\n\n/** Output-relative paths whose pre-rendered copy subsumes the `public/` one. */\nexport const USER_MERGED_PLATFORM_FILES: readonly string[] = [REDIRECTS_FILE];\n\n/**\n * Output paths the framework writes itself, which no route may claim.\n *\n * These are written outside the per-entry writer — `_redirects` after\n * generation, `_headers` by the adapter after the copy — so the collision\n * tracker never sees them and a route rendering to one of these paths is\n * overwritten with nothing recording it.\n *\n * Reserved rather than tracked, because there is no version of \"serve a route\n * at `/_headers`\" that works: Cloudflare Pages and Netlify read these two\n * files themselves and never serve them, so the route is unservable however\n * the conflict is resolved.\n *\n * That justification is per-file, not per-mechanism. `.nojekyll` is written\n * the same way and is deliberately NOT here: only the `github-pages` target\n * writes it, and everywhere else `/.nojekyll` is an ordinary servable path,\n * so reserving it globally would refuse a valid Cloudflare site. Its write\n * site skips the write when a file is already there instead — GitHub Pages\n * only cares that the file exists.\n *\n * Same reasoning as the synthetic 404 entry using an internal urlPath so a\n * real `/404` route cannot collide with `404.html`.\n */\nexport const RESERVED_OUTPUT_PATHS: readonly string[] = [REDIRECTS_FILE, HEADERS_FILE];\n","/**\n * What the output filesystem considers \"the same file\".\n *\n * Two build steps compare paths to decide whether two artifacts would land on\n * one file — the render pass (`plugins/static-build.ts`) and the adapter's\n * tree merge (`build-output-helper.ts`). Both are predicting a filesystem\n * decision, so both ask the filesystem rather than comparing raw strings\n * (TIM-1266).\n *\n * Two properties matter, and they are independent:\n *\n * - **Case folding.** macOS APFS and Windows NTFS fold by default, ext4 does\n * not. Dynamic params `Foo` and `foo` are one file on a Mac and two on\n * Linux CI.\n * - **Unicode normalization.** APFS compares normalization-insensitively, so\n * `café` spelled NFC (`é`) and NFD (`e` + combining acute) address one\n * file. This holds even on a *case-sensitive* APFS volume, which is why it\n * is probed separately rather than inferred from case folding.\n *\n * Probed rather than read off `process.platform`: a case-sensitive volume on\n * macOS and a case-insensitive mount on Linux are both ordinary, and the\n * answer that matters is the one for the directory being written.\n *\n * Leaf module — Node built-ins only. Kept apart from `adapters/shared.ts`,\n * whose rule builders are pure string functions: this one touches the disk.\n */\n\nimport { writeFile, stat, rm } from 'node:fs/promises';\nimport { randomUUID } from 'node:crypto';\nimport { join } from 'node:path';\n\n/** How the output filesystem decides that two paths name one file. */\nexport interface FsIdentity {\n /** `Foo` and `foo` are the same file. */\n caseInsensitive: boolean;\n /** Canonically equivalent Unicode spellings are the same file. */\n normalizationInsensitive: boolean;\n /**\n * Trailing dots and spaces are stripped from each segment, so `foo.` and\n * `foo` are the same file. Win32 does this in path resolution rather than\n * in the filesystem, which is why it is probed like the others.\n */\n stripsTrailingDotsAndSpaces: boolean;\n}\n\n/** Every path comparison is exact — the conservative answer when unprobed. */\nexport const EXACT_FS_IDENTITY: FsIdentity = {\n caseInsensitive: false,\n normalizationInsensitive: false,\n stripsTrailingDotsAndSpaces: false,\n};\n\n/**\n * Probe `dir` by writing one file and asking for it under other spellings.\n *\n * Returns {@link EXACT_FS_IDENTITY} when the probe cannot run. That\n * under-detects, but a directory this cannot write to is one the caller is\n * about to fail on anyway, with a clearer error than a missed collision.\n */\nexport async function detectFsIdentity(dir: string): Promise<FsIdentity> {\n // `café` — NFC, with a precomposed é. The UUID contributes the\n // hex letters the case probe needs.\n const name = `.timber-probe-${randomUUID()}-café`;\n const path = join(dir, name);\n\n try {\n await writeFile(path, '');\n const [caseInsensitive, normalizationInsensitive, stripsTrailingDotsAndSpaces] =\n await Promise.all([\n exists(join(dir, name.toUpperCase())),\n // NFD spells the same string as `e` + U+0301; a filesystem that\n // resolves it to the NFC file compares normalization-insensitively.\n exists(join(dir, name.normalize('NFD'))),\n // Win32 strips trailing dots and spaces during path resolution, so\n // asking for `name.` reaches `name`.\n exists(join(dir, `${name}.`)),\n ]);\n return { caseInsensitive, normalizationInsensitive, stripsTrailingDotsAndSpaces };\n } catch {\n return EXACT_FS_IDENTITY;\n } finally {\n await rm(path, { force: true }).catch(() => {});\n }\n}\n\n/**\n * Fold a path to the identity the filesystem compares it under.\n *\n * Normalization first, then case: `toLowerCase()` operates per code point, so\n * folding a decomposed string first would leave the combining marks in a\n * different order than folding a precomposed one.\n *\n * An approximation of the filesystem's own algorithm — APFS and NTFS fold per\n * their own Unicode tables, which `toLowerCase()` matches for everything short\n * of the exotic. It errs toward *finding* a collision, and the cost of a false\n * positive is a build error naming two routes rather than a silent overwrite.\n */\nexport function fsKey(path: string, identity: FsIdentity): string {\n let key = identity.caseInsensitive ? caseFold(path) : path;\n if (identity.normalizationInsensitive) key = key.normalize('NFC');\n if (identity.stripsTrailingDotsAndSpaces) key = key.split('/').map(stripTrailing).join('/');\n return key;\n}\n\n/**\n * Approximate Unicode case folding, which is what case-insensitive\n * filesystems actually compare under.\n *\n * `toLowerCase()` is not it. Greek `σ` and final `ς` are both already\n * lowercase and stay distinct under it, yet NTFS upcases both to `Σ` and APFS\n * folds `ς` to `σ` — so two routes differing only in that letter are one file\n * on both, and a lowercase key admitted them as two claims (TIM-1266).\n * Uppercasing first collapses them.\n *\n * The residual is over-folding, in these cases and a few like them:\n *\n * | pair | folded together here | NTFS / APFS |\n * | --------- | -------------------- | ----------------- |\n * | `σ` / `ς` | yes | yes — the fix |\n * | `ß` / `ss`| yes | no |\n * | `ı` / `i` | yes | no |\n * | `fi` / `fi`| yes | no |\n *\n * That direction is deliberate. Over-folding costs a build error naming two\n * routes, which a developer fixes by renaming one; under-folding costs a\n * payload silently overwritten by another route's, which nothing downstream\n * can detect. An exact fold would need `Intl.Collator`, which compares but\n * emits no sort key, so using it would turn a hash lookup into a pairwise\n * scan over every claimed path.\n */\nfunction caseFold(value: string): string {\n return value.toUpperCase().toLowerCase();\n}\n\n/**\n * Drop trailing dots and spaces from one path segment, as Win32 does.\n *\n * A segment that is nothing but dots and spaces is left alone: `.` and `..`\n * are traversal, which the caller rejects before reaching here, and emptying\n * a segment would merge two unrelated paths rather than the aliases this\n * models.\n */\nfunction stripTrailing(segment: string): string {\n const stripped = segment.replace(/[. ]+$/, '');\n return stripped === '' ? segment : stripped;\n}\n\nasync function exists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,iBAAiB;;AAG9B,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,oBAAoB;;AAGjC,IAAa,6BAAgD,CAAC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;AAyB5E,IAAa,wBAA2C,CAAC,gBAAgB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5BrF,IAAa,oBAAgC;CAC3C,iBAAiB;CACjB,0BAA0B;CAC1B,6BAA6B;AAC/B;;;;;;;;AASA,eAAsB,iBAAiB,KAAkC;CAGvE,MAAM,OAAO,iBAAiB,WAAW,EAAE;CAC3C,MAAM,OAAO,KAAK,KAAK,IAAI;CAE3B,IAAI;EACF,MAAM,UAAU,MAAM,EAAE;EACxB,MAAM,CAAC,iBAAiB,0BAA0B,+BAChD,MAAM,QAAQ,IAAI;GAChB,OAAO,KAAK,KAAK,KAAK,YAAY,CAAC,CAAC;GAGpC,OAAO,KAAK,KAAK,KAAK,UAAU,KAAK,CAAC,CAAC;GAGvC,OAAO,KAAK,KAAK,GAAG,KAAK,EAAE,CAAC;EAC9B,CAAC;EACH,OAAO;GAAE;GAAiB;GAA0B;EAA4B;CAClF,QAAQ;EACN,OAAO;CACT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