@timber-js/app 0.2.0-alpha.239 → 0.2.0-alpha.240

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 (332) hide show
  1. package/dist/_chunks/{actions-Top9GftB.js → actions-DIgnvDrG.js} +4 -4
  2. package/dist/_chunks/{actions-Top9GftB.js.map → actions-DIgnvDrG.js.map} +1 -1
  3. package/dist/_chunks/{als-registry-DpygwCp0.js → als-registry-PPYstxK0.js} +2 -1
  4. package/dist/_chunks/{als-registry-DpygwCp0.js.map → als-registry-PPYstxK0.js.map} +1 -1
  5. package/dist/_chunks/{cache-api-Bo8c7XVF.js → cache-api-uWQwuxWb.js} +5 -5
  6. package/dist/_chunks/{cache-api-Bo8c7XVF.js.map → cache-api-uWQwuxWb.js.map} +1 -1
  7. package/dist/_chunks/{chains-DMoHX4yH.js → chains-C7CExrUI.js} +2 -2
  8. package/dist/_chunks/{chains-DMoHX4yH.js.map → chains-C7CExrUI.js.map} +1 -1
  9. package/dist/_chunks/chains-CSslTUdI.js +1 -0
  10. package/dist/_chunks/{classify-BwyAd-dZ.js → classify-Cj9EeZoL.js} +2 -2
  11. package/dist/_chunks/{classify-BwyAd-dZ.js.map → classify-Cj9EeZoL.js.map} +1 -1
  12. package/dist/_chunks/{cli-check-DQAD9MLo.js → cli-check-C3QOAru7.js} +3 -3
  13. package/dist/_chunks/{cli-check-DQAD9MLo.js.map → cli-check-C3QOAru7.js.map} +1 -1
  14. package/dist/_chunks/{cli-schema-sync-C_xNLqBj.js → cli-schema-sync-BRxZz66D.js} +1 -1
  15. package/dist/_chunks/{cli-schema-sync-CmGls3dc.js → cli-schema-sync-DQUS_o3V.js} +2 -2
  16. package/dist/_chunks/{cli-schema-sync-CmGls3dc.js.map → cli-schema-sync-DQUS_o3V.js.map} +1 -1
  17. package/dist/_chunks/{client-dep-entries-C5BTQtFS.js → client-dep-entries-ZETBdLgv.js} +2 -2
  18. package/dist/_chunks/{client-dep-entries-C5BTQtFS.js.map → client-dep-entries-ZETBdLgv.js.map} +1 -1
  19. package/dist/_chunks/{convention-lint-GQA6WTRo.js → convention-lint-BoVISNS6.js} +3 -3
  20. package/dist/_chunks/{convention-lint-GQA6WTRo.js.map → convention-lint-BoVISNS6.js.map} +1 -1
  21. package/dist/_chunks/dev-server-B8roKA3Q.js +1 -0
  22. package/dist/_chunks/{dev-server-Cr3_Fu5A.js → dev-server-C5R6jx8Q.js} +2 -2
  23. package/dist/_chunks/{dev-server-Cr3_Fu5A.js.map → dev-server-C5R6jx8Q.js.map} +1 -1
  24. package/dist/_chunks/{dev-span-RsVeYYc_.js → dev-span-0aG7Q_Ph.js} +3 -7
  25. package/dist/_chunks/dev-span-0aG7Q_Ph.js.map +1 -0
  26. package/dist/_chunks/{error-boundary-Bh-egWUI.js → error-boundary-DB51f9ih.js} +98 -419
  27. package/dist/_chunks/error-boundary-DB51f9ih.js.map +1 -0
  28. package/dist/_chunks/{flight-source-node-BsrlUjMO.js → flight-source-node-D9cHBhjP.js} +7 -4
  29. package/dist/_chunks/flight-source-node-D9cHBhjP.js.map +1 -0
  30. package/dist/_chunks/{json-lossy-check-D47R9Fp5.js → json-lossy-check-Y1GxqVX_.js} +2 -2
  31. package/dist/_chunks/{json-lossy-check-D47R9Fp5.js.map → json-lossy-check-Y1GxqVX_.js.map} +1 -1
  32. package/dist/_chunks/{live-graph-HcLScfiV.js → live-graph-BDQWvnMm.js} +4 -4
  33. package/dist/_chunks/{live-graph-HcLScfiV.js.map → live-graph-BDQWvnMm.js.map} +1 -1
  34. package/dist/_chunks/{logger-DDLtp5e-.js → logger-DmRR9tmZ.js} +2 -2
  35. package/dist/_chunks/{logger-DDLtp5e-.js.map → logger-DmRR9tmZ.js.map} +1 -1
  36. package/dist/_chunks/metadata-routes-MXNjWOt5.js.map +1 -1
  37. package/dist/_chunks/{node-response-omewa8e6.js → node-response-yp8zdyRp.js} +2 -2
  38. package/dist/_chunks/{node-response-omewa8e6.js.map → node-response-yp8zdyRp.js.map} +1 -1
  39. package/dist/_chunks/plugin-context-BtaQcMuh.js.map +1 -1
  40. package/dist/_chunks/{poison-scan-DONdiCGX.js → poison-scan-WQgUydF_.js} +2 -2
  41. package/dist/_chunks/{poison-scan-DONdiCGX.js.map → poison-scan-WQgUydF_.js.map} +1 -1
  42. package/dist/_chunks/{scanner-DSAJjH0x.js → scanner-C9Lrf77z.js} +3 -2
  43. package/dist/_chunks/{scanner-DSAJjH0x.js.map → scanner-C9Lrf77z.js.map} +1 -1
  44. package/dist/_chunks/{sizeof-DVhEVN_y.js → sizeof-BISkSaU0.js} +2 -2
  45. package/dist/_chunks/{sizeof-DVhEVN_y.js.map → sizeof-BISkSaU0.js.map} +1 -1
  46. package/dist/_chunks/{walkers-96YopJds.js → walkers-Bxv4v7tX.js} +3 -3
  47. package/dist/_chunks/{walkers-96YopJds.js.map → walkers-Bxv4v7tX.js.map} +1 -1
  48. package/dist/adapters/cloudflare-kv-cache.js +1 -1
  49. package/dist/analyze/crawl-entry.js +3 -3
  50. package/dist/analyze/graph-command.js +2 -2
  51. package/dist/cache/index.js +2 -2
  52. package/dist/cache/stores/memory.js +1 -1
  53. package/dist/cdn/workers-cache-purge.js +1 -1
  54. package/dist/cli.js +3 -3
  55. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
  56. package/dist/client/browser-entry/hydrate.d.ts +1 -1
  57. package/dist/client/browser-entry/router-init.d.ts.map +1 -1
  58. package/dist/client/error-boundary.d.ts +1 -0
  59. package/dist/client/error-boundary.d.ts.map +1 -1
  60. package/dist/client/error-boundary.js +1 -1
  61. package/dist/client/history.d.ts +4 -5
  62. package/dist/client/history.d.ts.map +1 -1
  63. package/dist/client/index.js +6 -7
  64. package/dist/client/index.js.map +1 -1
  65. package/dist/client/internal.d.ts +1 -1
  66. package/dist/client/internal.d.ts.map +1 -1
  67. package/dist/client/internal.js +194 -55
  68. package/dist/client/internal.js.map +1 -1
  69. package/dist/client/navigation-commit.d.ts +6 -25
  70. package/dist/client/navigation-commit.d.ts.map +1 -1
  71. package/dist/client/outlet-content-cache.d.ts +59 -0
  72. package/dist/client/outlet-content-cache.d.ts.map +1 -0
  73. package/dist/client/outlet-scope-context.d.ts +30 -0
  74. package/dist/client/outlet-scope-context.d.ts.map +1 -0
  75. package/dist/client/params-context.d.ts +10 -11
  76. package/dist/client/params-context.d.ts.map +1 -1
  77. package/dist/client/router-pipeline.d.ts +5 -5
  78. package/dist/client/router-pipeline.d.ts.map +1 -1
  79. package/dist/client/router-types.d.ts +10 -24
  80. package/dist/client/router-types.d.ts.map +1 -1
  81. package/dist/client/router.d.ts.map +1 -1
  82. package/dist/client/rsc-fetch.d.ts +4 -17
  83. package/dist/client/rsc-fetch.d.ts.map +1 -1
  84. package/dist/client/segment-cache.d.ts +15 -103
  85. package/dist/client/segment-cache.d.ts.map +1 -1
  86. package/dist/client/segment-outlet.d.ts +28 -52
  87. package/dist/client/segment-outlet.d.ts.map +1 -1
  88. package/dist/client/stale-segment.d.ts +39 -0
  89. package/dist/client/stale-segment.d.ts.map +1 -0
  90. package/dist/client/use-segment-params.d.ts +1 -1
  91. package/dist/config-types.d.ts +7 -6
  92. package/dist/config-types.d.ts.map +1 -1
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +9 -732
  95. package/dist/index.js.map +1 -1
  96. package/dist/native/rsc/manifest.json +6 -4
  97. package/dist/native/rsc/routing/segment-keys.js +3 -11
  98. package/dist/native/rsc/routing/segment-keys.js.map +1 -1
  99. package/dist/native/rsc/server/access-gate.js +3 -7
  100. package/dist/native/rsc/server/access-gate.js.map +1 -1
  101. package/dist/native/rsc/server/als-registry.js +2 -1
  102. package/dist/native/rsc/server/als-registry.js.map +1 -1
  103. package/dist/native/rsc/server/build-manifest.js.map +1 -1
  104. package/dist/native/rsc/server/chain-url-parts.js +1 -6
  105. package/dist/native/rsc/server/chain-url-parts.js.map +1 -1
  106. package/dist/native/rsc/server/client-state-tree.js +33 -0
  107. package/dist/native/rsc/server/client-state-tree.js.map +1 -0
  108. package/dist/native/rsc/server/flight-source-node.js +5 -2
  109. package/dist/native/rsc/server/flight-source-node.js.map +1 -1
  110. package/dist/native/rsc/server/flight-source.js +46 -7
  111. package/dist/native/rsc/server/flight-source.js.map +1 -1
  112. package/dist/native/rsc/server/pipeline-interception.js +1 -1
  113. package/dist/native/rsc/server/publish-params.js.map +1 -1
  114. package/dist/native/rsc/server/route-element-builder.js +43 -61
  115. package/dist/native/rsc/server/route-element-builder.js.map +1 -1
  116. package/dist/native/rsc/server/rsc-entry/helpers.js +5 -28
  117. package/dist/native/rsc/server/rsc-entry/helpers.js.map +1 -1
  118. package/dist/native/rsc/server/rsc-entry/render-route.js +33 -7
  119. package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
  120. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +2 -1
  121. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js.map +1 -1
  122. package/dist/native/rsc/server/rsc-entry/rsc-payload.js +2 -5
  123. package/dist/native/rsc/server/rsc-entry/rsc-payload.js.map +1 -1
  124. package/dist/native/rsc/server/rsc-entry/rsc-stream.js +44 -40
  125. package/dist/native/rsc/server/rsc-entry/rsc-stream.js.map +1 -1
  126. package/dist/native/rsc/server/rsc-entry/ssr-renderer.js +1 -1
  127. package/dist/native/rsc/server/rsc-entry/ssr-renderer.js.map +1 -1
  128. package/dist/native/rsc/server/segment-hash/capture.js +107 -0
  129. package/dist/native/rsc/server/segment-hash/capture.js.map +1 -0
  130. package/dist/native/rsc/server/segment-hash/outlet.js +81 -0
  131. package/dist/native/rsc/server/segment-hash/outlet.js.map +1 -0
  132. package/dist/native/rsc/server/segment-hash/stream-tap.js +139 -0
  133. package/dist/native/rsc/server/segment-hash/stream-tap.js.map +1 -0
  134. package/dist/native/rsc/server/segment-hash/value-hash.js +171 -0
  135. package/dist/native/rsc/server/segment-hash/value-hash.js.map +1 -0
  136. package/dist/native/rsc/server/slot-resolver.js +20 -124
  137. package/dist/native/rsc/server/slot-resolver.js.map +1 -1
  138. package/dist/native/rsc/server/vite-handoff-rsc.js.map +1 -1
  139. package/dist/native/rsc/shared/outlet-decision.js +5 -0
  140. package/dist/native/rsc/shared/outlet-decision.js.map +1 -0
  141. package/dist/native/ssr/client/error-boundary.js +16 -3
  142. package/dist/native/ssr/client/error-boundary.js.map +1 -1
  143. package/dist/native/ssr/client/navigation-commit.js +1 -5
  144. package/dist/native/ssr/client/navigation-commit.js.map +1 -1
  145. package/dist/native/ssr/client/outlet-content-cache.js +53 -0
  146. package/dist/native/ssr/client/outlet-content-cache.js.map +1 -0
  147. package/dist/native/ssr/client/outlet-scope-context.js +12 -0
  148. package/dist/native/ssr/client/outlet-scope-context.js.map +1 -0
  149. package/dist/native/ssr/client/params-context.js.map +1 -1
  150. package/dist/native/ssr/client/rsc-fetch.js +1 -12
  151. package/dist/native/ssr/client/rsc-fetch.js.map +1 -1
  152. package/dist/native/ssr/client/segment-outlet.js +34 -13
  153. package/dist/native/ssr/client/segment-outlet.js.map +1 -1
  154. package/dist/native/ssr/client/stale-segment.js +29 -0
  155. package/dist/native/ssr/client/stale-segment.js.map +1 -0
  156. package/dist/native/ssr/manifest.json +5 -4
  157. package/dist/native/ssr/routing/segment-keys.js +5 -1
  158. package/dist/native/ssr/routing/segment-keys.js.map +1 -1
  159. package/dist/native/ssr/server/access-gate.js +3 -7
  160. package/dist/native/ssr/server/access-gate.js.map +1 -1
  161. package/dist/native/ssr/server/als-registry.js +1 -0
  162. package/dist/native/ssr/server/als-registry.js.map +1 -1
  163. package/dist/native/ssr/server/build-manifest.js.map +1 -1
  164. package/dist/native/ssr/server/client-state-tree.js +33 -0
  165. package/dist/native/ssr/server/client-state-tree.js.map +1 -0
  166. package/dist/native/ssr/server/flight-source-node.js +5 -2
  167. package/dist/native/ssr/server/flight-source-node.js.map +1 -1
  168. package/dist/native/ssr/server/flight-source.js +1 -0
  169. package/dist/native/ssr/server/flight-source.js.map +1 -1
  170. package/dist/native/ssr/server/pipeline-interception.js +1 -1
  171. package/dist/native/ssr/server/segment-hash/value-hash.js +162 -0
  172. package/dist/native/ssr/server/segment-hash/value-hash.js.map +1 -0
  173. package/dist/native/ssr/server/ssr-wrappers.js.map +1 -1
  174. package/dist/native/ssr/server/vite-handoff-rsc.js.map +1 -1
  175. package/dist/native/ssr/shared/payload-root.js.map +1 -1
  176. package/dist/plugin-context.d.ts +0 -16
  177. package/dist/plugin-context.d.ts.map +1 -1
  178. package/dist/plugins/build-manifest.d.ts.map +1 -1
  179. package/dist/routing/index.js +2 -2
  180. package/dist/routing/segment-keys.d.ts +8 -21
  181. package/dist/routing/segment-keys.d.ts.map +1 -1
  182. package/dist/server/access-gate.d.ts +0 -14
  183. package/dist/server/access-gate.d.ts.map +1 -1
  184. package/dist/server/als-registry.d.ts +16 -0
  185. package/dist/server/als-registry.d.ts.map +1 -1
  186. package/dist/server/build-manifest.d.ts +1 -10
  187. package/dist/server/build-manifest.d.ts.map +1 -1
  188. package/dist/server/chain-url-parts.d.ts +3 -13
  189. package/dist/server/chain-url-parts.d.ts.map +1 -1
  190. package/dist/server/client-state-tree.d.ts +31 -0
  191. package/dist/server/client-state-tree.d.ts.map +1 -0
  192. package/dist/server/flight-source-node.d.ts +6 -1
  193. package/dist/server/flight-source-node.d.ts.map +1 -1
  194. package/dist/server/flight-source.d.ts +27 -0
  195. package/dist/server/flight-source.d.ts.map +1 -1
  196. package/dist/server/index.js +2 -2
  197. package/dist/server/internal.js +48 -47
  198. package/dist/server/internal.js.map +1 -1
  199. package/dist/server/publish-params.d.ts +5 -4
  200. package/dist/server/publish-params.d.ts.map +1 -1
  201. package/dist/server/route-element-builder.d.ts +4 -19
  202. package/dist/server/route-element-builder.d.ts.map +1 -1
  203. package/dist/server/rsc-entry/helpers.d.ts +7 -13
  204. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  205. package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
  206. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
  207. package/dist/server/rsc-entry/rsc-payload.d.ts +1 -2
  208. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  209. package/dist/server/rsc-entry/rsc-stream.d.ts +11 -2
  210. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  211. package/dist/server/rsc-entry/ssr-renderer.d.ts +0 -2
  212. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  213. package/dist/server/segment-hash/capture.d.ts +77 -0
  214. package/dist/server/segment-hash/capture.d.ts.map +1 -0
  215. package/dist/server/segment-hash/outlet.d.ts +65 -0
  216. package/dist/server/segment-hash/outlet.d.ts.map +1 -0
  217. package/dist/server/segment-hash/stream-tap.d.ts +49 -0
  218. package/dist/server/segment-hash/stream-tap.d.ts.map +1 -0
  219. package/dist/server/segment-hash/value-hash.d.ts +70 -0
  220. package/dist/server/segment-hash/value-hash.d.ts.map +1 -0
  221. package/dist/server/slot-resolver.d.ts +13 -78
  222. package/dist/server/slot-resolver.d.ts.map +1 -1
  223. package/dist/server/ssr-wrappers.d.ts +7 -9
  224. package/dist/server/ssr-wrappers.d.ts.map +1 -1
  225. package/dist/server/vite-handoff-rsc.d.ts +10 -1
  226. package/dist/server/vite-handoff-rsc.d.ts.map +1 -1
  227. package/dist/shared/outlet-decision.d.ts +48 -0
  228. package/dist/shared/outlet-decision.d.ts.map +1 -0
  229. package/dist/shared/payload-root.d.ts +5 -8
  230. package/dist/shared/payload-root.d.ts.map +1 -1
  231. package/dist/shared/segment-info.d.ts +13 -28
  232. package/dist/shared/segment-info.d.ts.map +1 -1
  233. package/package.json +1 -1
  234. package/src/client/browser-entry/action-dispatch.ts +1 -15
  235. package/src/client/browser-entry/hydrate.ts +3 -3
  236. package/src/client/browser-entry/router-init.ts +28 -47
  237. package/src/client/error-boundary.tsx +49 -9
  238. package/src/client/history.ts +4 -5
  239. package/src/client/internal.ts +1 -1
  240. package/src/client/navigation-commit.ts +25 -83
  241. package/src/client/outlet-content-cache.ts +119 -0
  242. package/src/client/outlet-scope-context.ts +42 -0
  243. package/src/client/params-context.ts +11 -12
  244. package/src/client/router-pipeline.ts +10 -74
  245. package/src/client/router-types.ts +11 -26
  246. package/src/client/router.ts +7 -22
  247. package/src/client/rsc-fetch.ts +5 -30
  248. package/src/client/segment-cache.ts +19 -264
  249. package/src/client/segment-outlet.tsx +80 -72
  250. package/src/client/stale-segment.ts +60 -0
  251. package/src/client/use-segment-params.ts +1 -1
  252. package/src/config-types.ts +7 -6
  253. package/src/index.ts +0 -2
  254. package/src/plugin-context.ts +0 -16
  255. package/src/plugins/build-manifest.ts +1 -22
  256. package/src/routing/scanner.ts +12 -0
  257. package/src/routing/segment-keys.ts +9 -35
  258. package/src/rsc-runtime/vendor-types.d.ts +8 -0
  259. package/src/server/access-gate.tsx +3 -32
  260. package/src/server/als-registry.ts +23 -0
  261. package/src/server/build-manifest.ts +1 -11
  262. package/src/server/chain-url-parts.ts +3 -21
  263. package/src/server/client-state-tree.ts +75 -0
  264. package/src/server/flight-source-node.ts +7 -2
  265. package/src/server/flight-source.ts +102 -9
  266. package/src/server/pipeline-interception.ts +1 -1
  267. package/src/server/publish-params.ts +5 -4
  268. package/src/server/route-element-builder.ts +77 -206
  269. package/src/server/rsc-entry/helpers.ts +11 -65
  270. package/src/server/rsc-entry/render-route.ts +54 -28
  271. package/src/server/rsc-entry/revalidate-renderer.ts +2 -1
  272. package/src/server/rsc-entry/rsc-payload.ts +11 -39
  273. package/src/server/rsc-entry/rsc-stream.ts +123 -101
  274. package/src/server/rsc-entry/ssr-renderer.ts +1 -3
  275. package/src/server/segment-hash/capture.ts +232 -0
  276. package/src/server/segment-hash/outlet.ts +185 -0
  277. package/src/server/segment-hash/stream-tap.ts +244 -0
  278. package/src/server/segment-hash/value-hash.ts +338 -0
  279. package/src/server/slot-resolver.ts +37 -323
  280. package/src/server/ssr-wrappers.tsx +7 -9
  281. package/src/server/vite-handoff-rsc.ts +12 -1
  282. package/src/shared/outlet-decision.ts +54 -0
  283. package/src/shared/payload-root.ts +5 -8
  284. package/src/shared/segment-info.ts +13 -28
  285. package/dist/_chunks/chains-CmzbpG-6.js +0 -1
  286. package/dist/_chunks/dev-server--4_Ogy_6.js +0 -1
  287. package/dist/_chunks/dev-span-RsVeYYc_.js.map +0 -1
  288. package/dist/_chunks/error-boundary-Bh-egWUI.js.map +0 -1
  289. package/dist/_chunks/flight-source-node-BsrlUjMO.js.map +0 -1
  290. package/dist/client/segment-update-context.d.ts +0 -15
  291. package/dist/client/segment-update-context.d.ts.map +0 -1
  292. package/dist/client/slot-content-cache-context.d.ts +0 -35
  293. package/dist/client/slot-content-cache-context.d.ts.map +0 -1
  294. package/dist/native/rsc/server/request-dep.js +0 -12
  295. package/dist/native/rsc/server/request-dep.js.map +0 -1
  296. package/dist/native/rsc/server/route-element-helpers.js +0 -20
  297. package/dist/native/rsc/server/route-element-helpers.js.map +0 -1
  298. package/dist/native/rsc/server/skippable-prefix.js +0 -72
  299. package/dist/native/rsc/server/skippable-prefix.js.map +0 -1
  300. package/dist/native/rsc/server/state-tree-diff.js +0 -35
  301. package/dist/native/rsc/server/state-tree-diff.js.map +0 -1
  302. package/dist/native/ssr/client/segment-cache.js +0 -119
  303. package/dist/native/ssr/client/segment-cache.js.map +0 -1
  304. package/dist/native/ssr/client/segment-update-context.js +0 -9
  305. package/dist/native/ssr/client/segment-update-context.js.map +0 -1
  306. package/dist/native/ssr/client/slot-content-cache-context.js +0 -8
  307. package/dist/native/ssr/client/slot-content-cache-context.js.map +0 -1
  308. package/dist/native/ssr/server/state-tree-diff.js +0 -23
  309. package/dist/native/ssr/server/state-tree-diff.js.map +0 -1
  310. package/dist/plugins/request-dep/analysis.d.ts +0 -106
  311. package/dist/plugins/request-dep/analysis.d.ts.map +0 -1
  312. package/dist/plugins/request-dep/index.d.ts +0 -75
  313. package/dist/plugins/request-dep/index.d.ts.map +0 -1
  314. package/dist/plugins/request-dep/origin.d.ts +0 -61
  315. package/dist/plugins/request-dep/origin.d.ts.map +0 -1
  316. package/dist/server/request-dep.d.ts +0 -15
  317. package/dist/server/request-dep.d.ts.map +0 -1
  318. package/dist/server/route-element-helpers.d.ts +0 -12
  319. package/dist/server/route-element-helpers.d.ts.map +0 -1
  320. package/dist/server/skippable-prefix.d.ts +0 -29
  321. package/dist/server/skippable-prefix.d.ts.map +0 -1
  322. package/dist/server/state-tree-diff.d.ts +0 -78
  323. package/dist/server/state-tree-diff.d.ts.map +0 -1
  324. package/src/client/segment-update-context.ts +0 -23
  325. package/src/client/slot-content-cache-context.ts +0 -43
  326. package/src/plugins/request-dep/analysis.ts +0 -447
  327. package/src/plugins/request-dep/index.ts +0 -376
  328. package/src/plugins/request-dep/origin.ts +0 -310
  329. package/src/server/request-dep.ts +0 -37
  330. package/src/server/route-element-helpers.ts +0 -37
  331. package/src/server/skippable-prefix.ts +0 -172
  332. package/src/server/state-tree-diff.ts +0 -132
@@ -30,11 +30,10 @@ import { setSlotParams, runWithSlotSegmentParams } from './request-context.ts';
30
30
  import { coerceSlotParams } from './param-coercion.ts';
31
31
  import type { CoercedParams } from '../shared/param-value.ts';
32
32
  import { matchUrlParts } from './tree-match.ts';
33
- import { extractUrlParts, consumedPartsThroughSegment } from './chain-url-parts.ts';
33
+ import { extractUrlParts } from './chain-url-parts.ts';
34
34
  import { findInterceptingMatch } from './slot-interception.ts';
35
- import { shouldSkipSlot, type ClientStateTree } from './state-tree-diff.ts';
36
- import { computeSlotKey, computeSlotContentKey } from '../routing/segment-keys.ts';
37
- import { isStaticRequestDependent } from './request-dep.ts';
35
+ import { computeSlotKey } from '../routing/segment-keys.ts';
36
+ import { outletGate, type OutletSpec, type SegmentHashRender } from './segment-hash/outlet.ts';
38
37
  import { clientComponents } from './vite-handoff-rsc.ts';
39
38
 
40
39
  type CreateElementFn = (...args: unknown[]) => React.ReactElement;
@@ -493,10 +492,6 @@ export interface SlotMatchResult {
493
492
  * handing `@sidebar` a shorter URL than it matches against. It would render
494
493
  * its `default.tsx` where a page exists.
495
494
  *
496
- * The index must also agree with `slotUrlParts`, which slices the destination
497
- * pathname at the same point and already used `indexOf(owner)`. Two derivations
498
- * of one index is how they came apart; this is the shared one.
499
- *
500
495
  */
501
496
  export function findSlotOwnerIndex(
502
497
  slotNode: ManifestSegmentNode,
@@ -536,172 +531,7 @@ function findSlotMatch(slotNode: ManifestSegmentNode, match: RouteMatch): SlotMa
536
531
  return { page: leaf.page, chain: result.chain, slotParams: result.params };
537
532
  }
538
533
 
539
- // ─── Slot Caching ──────────────────────────────────────────────────────────
540
-
541
- export interface SlotSkipEntry {
542
- slotKey: string;
543
- parentSegmentId: string;
544
- /**
545
- * Whether the slot's components called request accessors (getHeaders,
546
- * getSearchParams, cookies) during their last render. Replaces the
547
- * unreliable AsyncFunction heuristic — taint-tracked via ALS.
548
- */
549
- isRequestDependent: boolean;
550
- /** Whether the slot's access.ts denied on this render. */
551
- denied: boolean;
552
- /** Whether the slot was skipped (content not rendered, client keeps cached). */
553
- skipped?: boolean;
554
- /**
555
- * Content key encoding owner parts + slot name + entry file + slot params.
556
- * Sent to the client via X-Timber-Segments; the client advertises it back
557
- * so the server can decide skips by key membership (TIM-1370).
558
- */
559
- contentKey: string;
560
- }
561
-
562
- /**
563
- * The destination URL parts a segment's slots match against.
564
- *
565
- * A slot walks its own sub-tree starting where its owning segment stopped
566
- * consuming the URL, so the parts are sliced at the length its ancestors
567
- * consumed. Shared by `resolveSlotProps` and `publishSlotSegmentParams` — both
568
- * have to slice identically or the two would disagree about which page a slot
569
- * matched, and only one of them would be right.
570
- *
571
- * @internal
572
- */
573
- export function slotUrlParts(
574
- segment: ManifestSegmentNode,
575
- match: RouteMatch,
576
- url: string
577
- ): string[] {
578
- const pathname = new URL(url, 'http://localhost').pathname;
579
- // Slice through the owning segment inclusive, to match findSlotMatch, which
580
- // walks the chain from parentIndex + 1. `consumedUrlParts` drops the root
581
- // (it consumes no URL part) and honors the interception anchor, so a slot on
582
- // a retained owner above a climbing marker is not handed parts the target
583
- // does not contain.
584
- const sliceAt = consumedPartsThroughSegment(segment, match).length;
585
- const all = pathname === '/' ? [] : pathname.slice(1).split('/');
586
- return all.slice(sliceAt);
587
- }
588
-
589
- /**
590
- * Seed per-slot segment params for a segment whose layout is being SKIPPED.
591
- *
592
- * `resolveSlotProps` seeds these as part of resolving slot props, but a skipped
593
- * layout never gets there — `route-element-builder` continues past it. Its
594
- * slots are still mounted on the client, though, so leaving them out of the
595
- * published map made `useSegmentParams(slotPath)` fall back to the main route's
596
- * record after any navigation that skipped their parent (TIM-1285).
597
- *
598
- * Only the params are seeded. Nothing renders, no access chain runs — a skipped
599
- * layout's slots are unchanged by definition, which is what made it skippable.
600
- *
601
- * @internal
602
- */
603
- export function publishSlotSegmentParams(
604
- segment: ManifestSegmentNode,
605
- match: RouteMatch,
606
- destinationUrl: string,
607
- parentTreePath: string | undefined
608
- ): void {
609
- const slotEntries = Object.entries(segment.slots ?? {});
610
- if (slotEntries.length === 0) return;
611
- const destinationParts = slotUrlParts(segment, match, destinationUrl);
612
-
613
- for (const [, slotNode] of slotEntries) {
614
- const destMatch = matchUrlParts(slotNode as ManifestSegmentNode, destinationParts);
615
- if (!destMatch) continue;
616
- const coerced = coerceSlotParams(destMatch.chain, destMatch.params);
617
- const fullSlotPath = computeSlotSegmentPath(destMatch.chain, parentTreePath);
618
- if (fullSlotPath && Object.keys(coerced).length > 0) {
619
- setSlotParams(fullSlotPath, coerced);
620
- }
621
- }
622
- }
623
-
624
- /**
625
- * Emit slot metadata for a layout whose rendering was SKIPPED.
626
- *
627
- * Skipped layouts never reach `resolveSlotProps`, but the client rebuilds
628
- * its segment tree from each navigation's X-Timber-Segments response. If
629
- * skipped slots are absent, the client loses their contentKeys and can't
630
- * advertise them on the next navigation — breaking key-based slot skipping.
631
- *
632
- * This computes contentKey and isRequestDependent for each slot without
633
- * rendering anything, using the same derivation as `resolveSlotProps`.
634
- */
635
- export function emitSlotInfoForSkippedLayout(
636
- segment: ManifestSegmentNode,
637
- segmentId: string,
638
- match: RouteMatch,
639
- destinationUrl: string,
640
- slotSkipInfo: SlotSkipEntry[]
641
- ): void {
642
- const slotEntries = Object.entries(segment.slots ?? {});
643
- if (slotEntries.length === 0) return;
644
-
645
- const destinationParts = slotUrlParts(segment, match, destinationUrl);
646
- const ownerParts = consumedPartsThroughSegment(segment, match);
647
-
648
- for (const [slotName, slotNode] of slotEntries) {
649
- const slotManifest = slotNode as ManifestSegmentNode;
650
- const slotKey = computeSlotKey(segmentId, `@${slotName}`);
651
- const destMatch = matchUrlParts(slotManifest, destinationParts);
652
-
653
- const destLeaf = destMatch?.chain[destMatch.chain.length - 1];
654
- const entryFile = destLeaf?.page?.filePath ?? null;
655
- const contentKey = computeSlotContentKey(
656
- slotKey,
657
- ownerParts,
658
- entryFile,
659
- destMatch?.params ?? {}
660
- );
661
-
662
- const hasAccessInChain =
663
- !!slotManifest.access || (destMatch?.chain.some((seg) => seg.access) ?? false);
664
-
665
- let slotRequestDep = hasAccessInChain;
666
- if (!slotRequestDep) {
667
- const hasRenderedPage = destMatch && destLeaf?.page;
668
- if (hasRenderedPage) {
669
- if (
670
- slotManifest.layout?.filePath &&
671
- isStaticRequestDependent(slotManifest.layout.filePath)
672
- ) {
673
- slotRequestDep = true;
674
- }
675
- if (!slotRequestDep) {
676
- for (const seg of destMatch.chain) {
677
- if (seg.layout?.filePath && isStaticRequestDependent(seg.layout.filePath)) {
678
- slotRequestDep = true;
679
- break;
680
- }
681
- }
682
- }
683
- if (!slotRequestDep && destLeaf?.page?.filePath) {
684
- slotRequestDep = isStaticRequestDependent(destLeaf.page.filePath);
685
- }
686
- } else {
687
- const defaultFile = slotManifest.default?.filePath;
688
- if (!defaultFile) {
689
- slotRequestDep = true;
690
- } else {
691
- slotRequestDep = isStaticRequestDependent(defaultFile);
692
- }
693
- }
694
- }
695
-
696
- slotSkipInfo.push({
697
- slotKey,
698
- parentSegmentId: segmentId,
699
- isRequestDependent: slotRequestDep,
700
- denied: false,
701
- contentKey,
702
- });
703
- }
704
- }
534
+ // ─── Slot Outlets ──────────────────────────────────────────────────────────
705
535
 
706
536
  interface ResolveSlotPropsArgs {
707
537
  segment: ManifestSegmentNode;
@@ -710,24 +540,23 @@ interface ResolveSlotPropsArgs {
710
540
  h: CreateElementFn;
711
541
  interception?: InterceptionContext;
712
542
  parentTreePath: string;
713
- /** The request being rendered. Its URL is the slot-matching destination. */
543
+ /** The request being rendered. */
714
544
  req: Request;
715
- clientStateTree: ClientStateTree | null;
716
- slotSkipInfo: SlotSkipEntry[];
545
+ render: SegmentHashRender;
546
+ }
547
+
548
+ /** A layout's slot props, and the outlet of each slot. */
549
+ export interface ResolvedSlots {
550
+ props: Record<string, unknown>;
551
+ outlets: OutletSpec[];
717
552
  }
718
553
 
719
554
  /**
720
- * Resolve all parallel route slots for a layout, wrapping each in a
721
- * SegmentOutlet for client-side caching. Slots whose content key matches
722
- * one the client advertised are rendered with `skip=true` so the client
723
- * keeps its cached content.
555
+ * Resolve all parallel route slots for a layout, each in its own outlet.
724
556
  *
725
- * The skip decision is key-based (TIM-1370): the server computes a content
726
- * key per slot from the owning segment's URL parts, the slot name, the
727
- * matched entry file, and the slot's own params. The client advertises
728
- * the keys it has cached; the server checks membership. This replaces
729
- * the previous approach of reconstructing the client's state from a
730
- * departing URL.
557
+ * Every slot is resolved and every slot's access chain runs, on every render.
558
+ * Whether a slot's bytes are sent is decided by its outlet's hash, the same
559
+ * as any other segment (design/52-segment-hash-dedupe.md).
731
560
  */
732
561
  export async function resolveSlotProps({
733
562
  segment,
@@ -737,143 +566,28 @@ export async function resolveSlotProps({
737
566
  interception,
738
567
  parentTreePath,
739
568
  req,
740
- clientStateTree,
741
- slotSkipInfo,
742
- }: ResolveSlotPropsArgs): Promise<Record<string, unknown>> {
743
- const slotProps: Record<string, unknown> = {};
744
- const slotEntries = Object.entries(segment.slots ?? {});
745
- if (slotEntries.length === 0) return slotProps;
746
-
747
- const destinationParts = slotUrlParts(segment, match, req.url);
748
- const clientSlotKeys = clientStateTree?.slots ?? null;
749
-
750
- // Owner URL parts — the URL values consumed through this segment.
751
- // These are part of the content key because the slot's page may read
752
- // parent params (e.g., via getSegmentParams).
753
- const ownerParts = consumedPartsThroughSegment(segment, match);
754
-
755
- for (const [slotName, slotNode] of slotEntries) {
756
- const slotManifest = slotNode as ManifestSegmentNode;
757
- const slotKey = computeSlotKey(segmentId, `@${slotName}`);
758
-
759
- // Match the slot's sub-tree against the destination URL parts.
760
- const destMatch = matchUrlParts(slotManifest, destinationParts);
761
-
762
- // Compute the content key for this slot at the destination URL.
763
- const destLeaf = destMatch?.chain[destMatch.chain.length - 1];
764
- const entryFile = destLeaf?.page?.filePath ?? null;
765
- const contentKey = computeSlotContentKey(
766
- slotKey,
767
- ownerParts,
768
- entryFile,
769
- destMatch?.params ?? {}
770
- );
771
-
772
- // Auth-bearing slots are inherently request-dependent — their content
773
- // changes based on user state. Skipping them would require eager
774
- // evaluation of access.ts outside React.cache scope, causing double
775
- // execution (TIM-1364). Instead, exclude them from skip candidates
776
- // entirely and let SlotAccessGate handle access during render.
777
- // The client filters these out via isRequestDependent, so their keys
778
- // are never advertised — but checking here is defense-in-depth.
779
- const hasAccessInChain =
780
- !!slotManifest.access || (destMatch?.chain.some((seg) => seg.access) ?? false);
781
- const hasInterceptingChildren = slotManifest.children.some(
782
- (c) => c.segmentType === 'intercepting'
569
+ render,
570
+ }: ResolveSlotPropsArgs): Promise<ResolvedSlots> {
571
+ const props: Record<string, unknown> = {};
572
+ const outlets: OutletSpec[] = [];
573
+
574
+ for (const [slotName, slotNode] of Object.entries(segment.slots ?? {})) {
575
+ const content = await resolveSlotElement(
576
+ slotNode as ManifestSegmentNode,
577
+ match,
578
+ h,
579
+ req,
580
+ interception,
581
+ parentTreePath
783
582
  );
784
- const canSkip =
785
- !interception &&
786
- !hasInterceptingChildren &&
787
- !hasAccessInChain &&
788
- shouldSkipSlot(contentKey, clientSlotKeys);
789
-
790
- if (canSkip) {
791
- // No access.ts in this slot's chain (excluded above), so no gate needed.
792
- slotProps[slotName] = h(clientComponents().SegmentOutlet, {
793
- segmentPath: slotKey,
794
- skip: true,
795
- children: null,
796
- });
797
- slotSkipInfo.push({
798
- slotKey,
799
- parentSegmentId: segmentId,
800
- isRequestDependent: false,
801
- denied: false,
802
- skipped: true,
803
- contentKey,
804
- });
805
- } else {
806
- const resolvedElement = await resolveSlotElement(
807
- slotManifest,
808
- match,
809
- h,
810
- req,
811
- interception,
812
- parentTreePath
813
- );
814
- slotProps[slotName] = h(clientComponents().SegmentOutlet, {
815
- segmentPath: slotKey,
816
- children: resolvedElement,
817
- });
818
- // Static analysis: check if any file in the slot's RENDERED tree
819
- // is request-dependent. Only check layouts when destMatch exists —
820
- // unmatched slots render default.tsx directly without layouts.
821
- // Slots with access.ts are inherently request-dependent — their
822
- // content varies with user state (TIM-1364).
823
- let slotRequestDep = hasAccessInChain;
824
- const hasRenderedPage = destMatch && destLeaf?.page;
825
- if (slotRequestDep) {
826
- // Already marked — skip static analysis
827
- } else if (interception) {
828
- // `destMatch` walks the slot's ordinary children against the
829
- // destination URL; the interception resolver renders an intercepting
830
- // child instead, which that walk never sees. So the files analyzed
831
- // below are not the files that rendered — and `false` here tells the
832
- // client the slot is reusable. Stay conservative: a needlessly
833
- // request-dependent slot is a wasted refetch, a wrongly static one is
834
- // a stale modal.
835
- slotRequestDep = true;
836
- } else if (hasRenderedPage) {
837
- // Check slot root layout (rendered by wrapWithLayout)
838
- if (
839
- slotManifest.layout?.filePath &&
840
- isStaticRequestDependent(slotManifest.layout.filePath)
841
- ) {
842
- slotRequestDep = true;
843
- }
844
- // Check intermediate slot layouts
845
- if (!slotRequestDep) {
846
- for (const seg of destMatch.chain) {
847
- if (seg.layout?.filePath && isStaticRequestDependent(seg.layout.filePath)) {
848
- slotRequestDep = true;
849
- break;
850
- }
851
- }
852
- }
853
- // Check leaf page
854
- if (!slotRequestDep) {
855
- if (destLeaf?.page?.filePath && isStaticRequestDependent(destLeaf.page.filePath)) {
856
- slotRequestDep = true;
857
- }
858
- }
859
- } else {
860
- // No match — only default.tsx is rendered (no layouts)
861
- const defaultFile = slotManifest.default?.filePath;
862
- if (!defaultFile) {
863
- slotRequestDep = true; // No entry file → conservative
864
- } else {
865
- slotRequestDep = isStaticRequestDependent(defaultFile);
866
- }
867
- }
868
- slotSkipInfo.push({
869
- slotKey,
870
- parentSegmentId: segmentId,
871
- isRequestDependent: slotRequestDep,
872
- denied: false,
873
- contentKey,
874
- });
875
- }
583
+ const spec: OutletSpec = {
584
+ segmentPath: computeSlotKey(segmentId, `@${slotName}`),
585
+ content,
586
+ nested: [],
587
+ };
588
+ outlets.push(spec);
589
+ props[slotName] = outletGate(spec, render);
876
590
  }
877
591
 
878
- return slotProps;
592
+ return { props, outlets };
879
593
  }
@@ -11,7 +11,7 @@
11
11
  * hydrate.ts too) wraps the RSC element with:
12
12
  * NavigationRoot → Fragment(TopLoader | null, ...) →
13
13
  * TimberNuqsAdapter → NuqsAdapterProvider →
14
- * SlotContentCacheContext.Provider → SegmentUpdateContext.Provider →
14
+ * OutletContentCacheContext.Provider →
15
15
  * NavigationProvider → PayloadRoot → ParamsProvider → element
16
16
  *
17
17
  * The SSR tree renders the REAL NavigationProvider and PayloadRoot rather
@@ -38,9 +38,8 @@
38
38
  * child — here, `Fragment(TopLoader, element)`. A single-child wrapper, plain
39
39
  * component or context provider, leaves every id below it unchanged; that is
40
40
  * verified by tests/ssr-wrapper-parity.test.ts, not assumed. So the
41
- * client-only `SegmentUpdateContext.Provider` and
42
- * `SlotContentCacheContext.Provider` (single child each) have no mirror
43
- * here and need none. Mirror a new wrapper only if it branches.
41
+ * client-only `OutletContentCacheContext.Provider` (single child) has no
42
+ * mirror here and needs none. Mirror a new wrapper only if it branches.
44
43
  *
45
44
  * Related issues: facebook/react#24669, radix-ui/primitives#3700
46
45
  * See design/02-rendering-pipeline.md §"RSC → SSR → Client Hydration"
@@ -115,11 +114,10 @@ export interface SsrWrapOptions {
115
114
  * → Fragment(TopLoader | null, element)
116
115
  * → TimberNuqsAdapter
117
116
  * → NuqsAdapterProvider (from createAdapterProvider)
118
- * → SlotContentCacheContext.Provider (client-only, single child)
119
- * → SegmentUpdateContext.Provider (client-only, single child)
120
- * → NavigationProvider
121
- * → PayloadRoot → ParamsProvider
122
- * → [RSC element]
117
+ * → OutletContentCacheContext.Provider (client-only, single child)
118
+ * → NavigationProvider
119
+ * → PayloadRoot → ParamsProvider
120
+ * → [RSC element]
123
121
  *
124
122
  * SSR tree (this function):
125
123
  * SsrNavigationRoot
@@ -38,13 +38,24 @@ import type { DenyLastResort } from '../client/deny-last-resort.tsx';
38
38
  * decoder; the runtime only ever passes a stream and inspects the result, and
39
39
  * the narrower type is what a test double can satisfy.
40
40
  */
41
+ /**
42
+ * The decode half of Flight's temporary references: each `$T<id>` in the
43
+ * stream is replaced by `get('$' + id)`. React's client reads only `get`.
44
+ */
45
+ export interface TemporaryReferenceLookup {
46
+ get(key: string): unknown;
47
+ }
48
+
41
49
  export interface RscFlightRuntime {
42
50
  renderFlight: typeof FlightAdapter.renderFlight;
43
51
  loadServerAction: typeof FlightAdapter.loadServerAction;
44
52
  decodeReply: typeof FlightAdapter.decodeReply;
45
53
  decodeAction: typeof FlightAdapter.decodeAction;
46
54
  decodeFormState: typeof FlightAdapter.decodeFormState;
47
- createFromReadableStream: (stream: ReadableStream<Uint8Array>) => Promise<unknown>;
55
+ createFromReadableStream: (
56
+ stream: ReadableStream<Uint8Array>,
57
+ options?: { temporaryReferences?: TemporaryReferenceLookup }
58
+ ) => Promise<unknown>;
48
59
  }
49
60
 
50
61
  /**
@@ -0,0 +1,54 @@
1
+ /**
2
+ * What the server decided for one `SegmentOutlet` — the wire contract
3
+ * between the outlet gate (server/segment-hash/outlet.ts) and the client
4
+ * outlet (client/segment-outlet.tsx).
5
+ *
6
+ * A segment is either sent or skipped:
7
+ *
8
+ * - **Live** — `children` is the segment's content. `hash` is the hash of the
9
+ * rows that carried it, a promise the server resolves once those rows are
10
+ * written (design/52 §"Two hashes, two jobs"); absent when the app has not
11
+ * opted into `clientSegmentCache`, and null when the server could not hash
12
+ * the segment.
13
+ * - **Skip** — the client already holds content with this `hash`, and the
14
+ * server just produced identical output. `outlets` carries the decisions
15
+ * for the segments nested directly inside it, because the client renders
16
+ * its cached copy of this segment and that copy still holds the old ones.
17
+ *
18
+ * The outlet receives the decision as a promise when the server had to
19
+ * render the segment once before deciding, and as a plain value otherwise.
20
+ *
21
+ * See design/52-segment-hash-dedupe.md §"Wire format".
22
+ */
23
+
24
+ import type { ReactNode } from 'react';
25
+
26
+ export type OutletDecision = LiveDecision | SkipDecision;
27
+
28
+ export interface LiveDecision {
29
+ skip?: undefined;
30
+ hash?: PromiseLike<string | null>;
31
+ children: ReactNode;
32
+ }
33
+
34
+ export interface SkipDecision {
35
+ skip: true;
36
+ hash: string;
37
+ /** The decisions of the segments nested directly inside, by segment path. */
38
+ outlets: Record<string, OutletDecisionValue>;
39
+ }
40
+
41
+ /**
42
+ * What a nested outlet carries inside a segment-hash capture, in place of a
43
+ * decision: an opaque marker Flight writes as a temporary reference and the
44
+ * capture's decoder replaces with the real decision. Never reaches a client.
45
+ */
46
+ export interface CaptureHole {
47
+ readonly captureHole: true;
48
+ }
49
+
50
+ /** A decision as an outlet receives it. */
51
+ export type OutletDecisionValue = OutletDecision | PromiseLike<OutletDecision>;
52
+
53
+ /** The `segmentPath` of the metadata outlet — one per payload. */
54
+ export const METADATA_OUTLET_PATH = '#metadata';
@@ -9,15 +9,12 @@
9
9
  * Two reasons it is a sibling field rather than a provider inside the payload
10
10
  * (TIM-1297, which is TIM-1294's mechanism corrected):
11
11
  *
12
- * 1. **A provider inside the payload cannot serve a partial navigation.** The
13
- * client keeps the previous tree and splices the new payload in at the
14
- * first updated `SegmentOutlet`, so the payload's own provider lands
15
- * *below* the retained region — and the retained region's root is the
16
- * *departing* route's provider, which therefore wins for every reader in a
17
- * skipped layout. Wrapping something above it does not help: context
18
- * resolves to the nearest provider, and the departing one is nearer.
12
+ * 1. **A provider inside the payload cannot reach a skipped segment.** A
13
+ * segment the server skipped renders the content the client cached for it
14
+ * (design/52-segment-hash-dedupe.md), and that copy carries whatever was
15
+ * inside it when it was committed — never the incoming route's provider.
19
16
  * Params belong to the *navigation*, so the provider has to be owned by the
20
- * client, above the merge point, and there must be exactly one.
17
+ * client, above the payload root, and there must be exactly one.
21
18
  *
22
19
  * 2. **Element props are not readable at the instant the root resolves.**
23
20
  * Flight outlines a React element's props and fills the record in after the
@@ -13,16 +13,16 @@
13
13
  */
14
14
 
15
15
  /**
16
- * Metadata for one rendered segment or slot, sent via `X-Timber-Segments`.
16
+ * One mounted layout-bearing segment, sent via `X-Timber-Segments`.
17
17
  */
18
18
  export interface SegmentInfo {
19
- /** The segment's URL path (e.g. `/`, `/feed`), or the slot key for slots. */
19
+ /** The segment's URL path (e.g. `/`, `/feed`). */
20
20
  path: string;
21
21
  /** Outlet key — includes route group name when applicable (e.g. `/(marketing)`). */
22
22
  segmentId?: string;
23
23
  /**
24
24
  * The segment's directory path in `app/`, groups included and slots elided
25
- * (e.g. `app/(browse)/feed` → `/(browse)/feed`). Absent on slot entries.
25
+ * (e.g. `app/(browse)/feed` → `/(browse)/feed`).
26
26
  *
27
27
  * This is the identity interception scoping compares against, and it is the
28
28
  * reason it travels: `path`/`segmentId` are URL-addressed and collapse
@@ -30,38 +30,23 @@ export interface SegmentInfo {
30
30
  * tell those two directories apart. See `computeSegmentTreePaths`.
31
31
  */
32
32
  treePath?: string;
33
- isRequestDependent: boolean;
34
- /** True for parallel route slot entries, keyed by slot path (e.g. `/@sidebar`). */
35
- slot?: boolean;
36
- /** Parent segment path for slot entries — attaches the slot to its SegmentNode. */
37
- parentSegment?: string;
38
- /** True when the slot's access.ts denied on this render. Denied slots are excluded from the state tree. */
39
- denied?: boolean;
40
- /** True when the slot was skipped (cached content reused). Payloads with skipped slots are not replayable. */
41
- skipped?: boolean;
42
- /**
43
- * Content key for slot entries — encodes owner parts, slot name, matched
44
- * entry file, and slot params. The client stores and advertises this key;
45
- * the server computes the destination key and checks membership.
46
- * Replaces URL-based departing/destination diffing (TIM-1370).
47
- */
48
- contentKey?: string;
49
33
  }
50
34
 
51
35
  /**
52
36
  * The client's `X-Timber-State-Tree` request header.
53
37
  *
54
- * `segments` and `slots` are a caching optimization — they tell the server what
55
- * the client can reuse. `treePaths` is not: it describes the *shape* of the
56
- * tree currently on screen, so the server can answer "does the rendered route
57
- * pass through the segment that owns this intercepting slot?" without
58
- * re-deriving it from the address bar, which stops being the source route the
59
- * moment a modal is open (TIM-1282).
38
+ * `hashes` is the caching half: the segment hashes the client holds content
39
+ * for, by outlet path, sent only when the app opted into
40
+ * `clientSegmentCache` (design/52-segment-hash-dedupe.md). `treePaths` is
41
+ * not caching: it describes the *shape* of the tree currently on screen, so
42
+ * the server can answer "does the rendered route pass through the segment
43
+ * that owns this intercepting slot?" without re-deriving it from the address
44
+ * bar, which stops being the source route the moment a modal is open
45
+ * (TIM-1282).
60
46
  *
61
- * None of the three is a security input. Every `access.ts` runs regardless.
47
+ * Neither is a security input. Every `access.ts` runs regardless.
62
48
  */
63
49
  export interface StateTree {
64
- segments: string[];
65
- slots?: string[];
50
+ hashes?: Record<string, string>;
66
51
  treePaths?: string[];
67
52
  }
@@ -1 +0,0 @@
1
- export { t as formatChains } from "./chains-DMoHX4yH.js";
@@ -1 +0,0 @@
1
- export { t as RESTART_EXIT_CODE } from "./dev-server-Cr3_Fu5A.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev-span-RsVeYYc_.js","names":[],"sources":["../../src/server/build-manifest.ts","../../src/shared/dev-span.ts"],"sourcesContent":["/**\n * Build manifest types and utilities for CSS and JS asset tracking.\n *\n * The build manifest maps route segment file paths to their output\n * chunks from Vite's client build. This enables:\n * - <link rel=\"stylesheet\"> injection in HTML <head>\n * - <script type=\"module\"> with hashed URLs in production\n * - <link rel=\"modulepreload\"> for client chunk dependencies\n * - Link preload headers for Early Hints (103)\n *\n * In dev mode, Vite's HMR client handles CSS/JS injection, so the build\n * manifest is empty. In production, it's populated from Vite's\n * .vite/manifest.json after the client build.\n *\n * Design docs: 18-build-system.md §\"Build Manifest\", 02-rendering-pipeline.md §\"Early Hints\"\n */\n\n/** A font asset entry in the build manifest. */\nexport interface ManifestFontEntry {\n /** URL path to the font file (e.g. `/_timber/fonts/inter-latin-400-abc123.woff2`). */\n href: string;\n /** Font format (e.g. `woff2`). */\n format: string;\n /** Crossorigin attribute — always `anonymous` for fonts. */\n crossOrigin: string;\n}\n\n/** Build manifest mapping input file paths to output asset URLs. */\nexport interface BuildManifest {\n /** Map from input file path (relative to project root) to output CSS URLs. */\n css: Record<string, string[]>;\n /** Map from input file path to output JS chunk URL (hashed filename). */\n js: Record<string, string>;\n /** Map from input file path to transitive JS dependency URLs for modulepreload. */\n modulepreload: Record<string, string[]>;\n /** Map from input file path to font assets used by that module. */\n fonts: Record<string, ManifestFontEntry[]>;\n /**\n * Cache-busting hashes for metadata route files (opengraph-image, etc.).\n * Map from file path (relative to project root) to short content hash.\n * In dev mode this is empty — a startup nonce is used instead.\n */\n metadataRouteHashes?: Record<string, string>;\n /**\n * Static request-dependency map from the Vite plugin's module-graph analysis.\n * Map from segment entry file path to whether it's request-dependent.\n * Used by buildSegmentInfo() for X-Timber-Segments in production.\n */\n requestDep?: Record<string, boolean>;\n}\n\n/**\n * Empty build manifest used in dev mode, and the single source of truth for\n * what an empty manifest contains.\n *\n * `virtual:timber-build-manifest` serializes this constant into its generated\n * source rather than restating it — one literal for the dev module, one for the\n * production module's `globalThis.__TIMBER_BUILD_MANIFEST__ ?? …` fallback.\n * They were three hand-written objects that had already drifted: this one and\n * the dev literal were missing `requestDep` while the production fallback had\n * it, so a reader who grepped the built bundle for `requestDep` found the one\n * copy that mentioned it and read the fallback as the shipped map (TIM-1300).\n * A field added here now reaches every copy.\n */\nexport const EMPTY_BUILD_MANIFEST: BuildManifest = {\n css: {},\n js: {},\n modulepreload: {},\n fonts: {},\n metadataRouteHashes: {},\n requestDep: {},\n};\n\n/** Segment shape expected by collectRouteCss (matches ManifestSegmentNode). */\ninterface SegmentWithFiles {\n layout?: { filePath: string };\n page?: { filePath: string };\n}\n\n/**\n * Collect all CSS files needed for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting CSS for each layout and page.\n * Deduplicates while preserving order (root layout CSS first).\n */\nexport function collectRouteCss(segments: SegmentWithFiles[], manifest: BuildManifest): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const cssFiles = manifest.css[file.filePath];\n if (!cssFiles) continue;\n for (const url of cssFiles) {\n if (!seen.has(url)) {\n seen.add(url);\n result.push(url);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"stylesheet\"> tags for CSS URLs.\n *\n * Returns an HTML string to prepend to headHtml for injection\n * via injectHead() before </head>.\n */\nexport function buildCssLinkTags(cssUrls: string[]): string {\n // Emit only <link rel=\"stylesheet\"> — no preload tags. CSS preloading\n // is handled by 103 Early Hints (Link header) which fires before the\n // HTML stream. Float also emits `<link rel=\"stylesheet\" data-precedence>`\n // at the top of <head> during Fizz rendering — the browser discovers\n // CSS from that tag. A <link rel=\"preload\"> here would arrive *after*\n // Float's stylesheet tag and trigger \"Preload was ignored\" warnings.\n return cssUrls.map((url) => `<link rel=\"stylesheet\" href=\"${url}\">`).join('');\n}\n\n// ─── Font utilities ──────────────────────────────────────────────────────\n\n/**\n * Collect all font entries needed for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting fonts for each layout and page.\n * Deduplicates by href while preserving order.\n */\nexport function collectRouteFonts(\n segments: SegmentWithFiles[],\n manifest: BuildManifest\n): ManifestFontEntry[] {\n const seen = new Set<string>();\n const result: ManifestFontEntry[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const fonts = manifest.fonts[file.filePath];\n if (!fonts) continue;\n for (const entry of fonts) {\n if (!seen.has(entry.href)) {\n seen.add(entry.href);\n result.push(entry);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"preload\"> tags for font assets.\n *\n * Font preloads use `as=font` and always include `crossorigin` (required\n * for font preloads even for same-origin resources per the spec).\n */\nexport function buildFontPreloadTags(fonts: ManifestFontEntry[]): string {\n return fonts\n .map(\n (f) =>\n `<link rel=\"preload\" href=\"${f.href}\" as=\"font\" type=\"font/${f.format}\" crossorigin=\"${f.crossOrigin}\">`\n )\n .join('');\n}\n\n// ─── JS chunk utilities ──────────────────────────────────────────────────\n\n/**\n * Collect modulepreload URLs for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting transitive JS dependencies\n * for each layout and page. Deduplicates across segments.\n */\nexport function collectRouteModulepreloads(\n segments: SegmentWithFiles[],\n manifest: BuildManifest\n): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const preloads = manifest.modulepreload[file.filePath];\n if (!preloads) continue;\n for (const url of preloads) {\n if (!seen.has(url)) {\n seen.add(url);\n result.push(url);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"modulepreload\"> tags for JS dependency URLs.\n *\n * Modulepreload hints tell the browser to fetch and parse JS modules\n * before they're needed, reducing waterfall latency for dynamic imports.\n */\nexport function buildModulepreloadTags(urls: string[]): string {\n return urls.map((url) => `<link rel=\"modulepreload\" href=\"${url}\">`).join('');\n}\n","/**\n * The wire contract between the dev server's span sink and the dev request\n * pill in the browser. Dev-only; see design/50-dev-request-pill.md.\n *\n * Isomorphic: no server, client, or build-time imports.\n */\n\n/**\n * HMR event that carries finished spans to the browser: a\n * `DevSpanPayload[]` of one trace, in the order the spans ended.\n */\nexport const DEV_SPAN_EVENT = 'timber:span';\n\n/** HMR event a tab sends to ask for a trace's spans that ended before it connected. */\nexport const DEV_SPAN_REPLAY_EVENT = 'timber:span-replay';\n\n/**\n * `globalThis` key holding the span sink. The dev server plugin installs it\n * and `DevSpanProcessor` (RSC module graph, same process, separate module\n * instances) reads it, so the hand-off is a `Symbol.for` global.\n */\nexport const DEV_SPAN_SINK_KEY = Symbol.for('timber.dev.span-sink');\n\n/** The `Server-Timing` metric whose `desc` is the response's trace ID. */\nexport const TRACE_TIMING_NAME = 'timber-trace';\n\n/**\n * `globalThis` key holding the dev await wrapper. The dev await transform\n * (`plugins/dev-await.ts`) rewrites `await x` in app server code to call\n * it, looked up at call time; dev tracing installs it. With nothing\n * installed the call is a plain await. See design/50-dev-request-pill.md\n * §\"Phase 2\".\n */\nexport const DEV_AWAIT_KEY = Symbol.for('timber.dev.await');\n\n/** Span name for one awaited call in app server code. */\nexport const AWAIT_SPAN_NAME = 'timber.await';\n\n/**\n * Set on an await span that waited on work started elsewhere: a promise\n * another await already took (React's `cache()`), or one made before the\n * await began (`const p = load(); … await p`). The work's own spans nest\n * where it started, so the wait adds no new information when they exist.\n */\nexport const AWAIT_WAIT_ATTRIBUTE = 'timber.await_wait';\n\n/**\n * Await spans shorter than this are dropped before they reach the terminal\n * tree or the pill: `await params` and other awaits of settled values would\n * otherwise drown the I/O the spans exist to show.\n */\nexport const AWAIT_SPAN_MIN_MS = 1;\n\n/** Span name for one dev-instrumented `fetch()`, ended when headers arrive. */\nexport const FETCH_SPAN_NAME = 'timber.fetch';\n\n/**\n * Span name for reading a fetched response's body (`.text()`, `.json()`,\n * …), a child of the fetch span. The fetch span ends at headers, so without\n * it a slow body read showed only as the `await res.text()` that waited on it.\n */\nexport const FETCH_BODY_SPAN_NAME = 'timber.fetch.body';\n\n/** Root span of every pipeline request. */\nexport const ROOT_SPAN_NAME = 'http.server.request';\n\n/**\n * The span attributes that may reach the browser — the ones the pill reads,\n * and nothing else. An allowlist of keys, not of prefixes: a prefix let\n * through `timber.fetch_error` (an error message that can quote a full URL)\n * and user attributes such as `url.full` or\n * `http.request.header.authorization`. Typing the payload with this list\n * means the pill cannot read an attribute that isn't on it.\n */\nexport const DEV_SPAN_ATTRIBUTES = [\n 'http.request.method',\n 'http.response.status_code',\n /** Query and fragment stripped. */\n 'http.url',\n /** Query and fragment stripped. */\n 'url.path',\n 'timber.route',\n 'timber.segment',\n 'timber.slot',\n 'timber.action_name',\n 'timber.cache_status',\n /** The awaited expression's source text, whitespace collapsed, truncated. */\n 'timber.await_label',\n /** `path/relative/to/root.ts:line` of the await. */\n 'timber.await_location',\n /** See `AWAIT_WAIT_ATTRIBUTE`. */\n 'timber.await_wait',\n] as const;\n\nexport type DevSpanAttribute = (typeof DEV_SPAN_ATTRIBUTES)[number];\n\n/** Attributes that hold a URL; sent without query or fragment. */\nexport const DEV_SPAN_URL_ATTRIBUTES: ReadonlySet<DevSpanAttribute> = new Set([\n 'http.url',\n 'url.path',\n]);\n\nexport type DevSpanSink = (span: DevSpanPayload) => void;\n\n/** One finished span, projected for the browser. */\nexport interface DevSpanPayload {\n traceId: string;\n spanId: string;\n /** Absent for the root span. */\n parentSpanId?: string;\n name: string;\n /** Epoch milliseconds. */\n startMs: number;\n /** Epoch milliseconds. */\n endMs: number;\n error: boolean;\n /** Only `DEV_SPAN_ATTRIBUTES`; URLs without query or fragment. */\n attributes: Partial<Record<DevSpanAttribute, string | number | boolean>>;\n /** Names of `timber.*` span events, e.g. `timber.cache.hit`. */\n events: string[];\n}\n\n/**\n * Read the trace ID from `Server-Timing` metrics, either a raw header value\n * or the `serverTiming` entries of a `PerformanceResourceTiming`.\n */\nexport function traceIdFromServerTiming(\n timing: string | null | readonly { name: string; description: string }[]\n): string | null {\n if (timing == null) return null;\n if (typeof timing !== 'string') {\n return timing.find((t) => t.name === TRACE_TIMING_NAME)?.description || null;\n }\n // `timber-trace;desc=\"<32 hex>\"` — the ID is hex, so no escaping to undo.\n const match = new RegExp(`(?:^|,)\\\\s*${TRACE_TIMING_NAME}\\\\s*;\\\\s*desc=\"?([0-9a-f]+)\"?`).exec(\n timing\n );\n return match?.[1] ?? null;\n}\n\n/** The `Server-Timing` entry that carries a trace ID. */\nexport function traceTimingEntry(traceId: string): string {\n return `${TRACE_TIMING_NAME};desc=\"${traceId}\"`;\n}\n\n// ─── Labels ─────────────────────────────────────────────────────────────────\n\n/** Span attributes as either side holds them (OTEL also allows arrays). */\ntype SpanAttributes = Readonly<Record<string, unknown>>;\n\n/** `@slot ` for a span from a parallel slot, so it reads apart from the main route. */\nfunction slotPrefix(attrs: SpanAttributes): string {\n const slot = attrs['timber.slot'];\n return slot ? `${String(slot)} ` : '';\n}\n\n/**\n * A fetch URL as the terminal tree and the pill show it: without its scheme,\n * which is `https://` for nearly every fetch and only makes the line longer\n * (TIM-1631).\n */\nexport function fetchDisplayUrl(url: string): string {\n return url.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, '');\n}\n\n/**\n * Map a span to its display label and environment tag. One mapping for the\n * terminal tree and the dev request pill, so the two never name a span\n * differently.\n */\nexport function devSpanLabel(name: string, attrs: SpanAttributes): { label: string; env: string } {\n switch (name) {\n case ROOT_SPAN_NAME: {\n const method = attrs['http.request.method'] ?? 'GET';\n const path = attrs['url.path'] ?? '/';\n return { label: `${String(method)} ${String(path)}`, env: 'rsc' };\n }\n case 'timber.proxy':\n return { label: 'proxy.ts', env: 'proxy' };\n case 'timber.middleware':\n return { label: 'middleware.ts', env: 'rsc' };\n case 'timber.render':\n return { label: 'render', env: 'rsc' };\n case 'timber.access': {\n const seg = attrs['timber.segment'] ?? 'segment';\n return { label: `AccessGate (${String(seg)})`, env: 'rsc' };\n }\n case 'timber.ssr':\n return { label: 'hydration render', env: 'ssr' };\n case 'timber.action': {\n const actionName = attrs['timber.action_name'] ?? 'action';\n return { label: String(actionName), env: 'rsc' };\n }\n case 'timber.metadata':\n return { label: 'metadata()', env: 'rsc' };\n case 'timber.layout': {\n const seg = attrs['timber.segment'] ?? '/';\n return { label: `layout ${slotPrefix(attrs)}${String(seg)}`, env: 'rsc' };\n }\n case 'timber.page': {\n const route = attrs['timber.route'] ?? '/';\n return { label: `page ${slotPrefix(attrs)}${String(route)}`, env: 'rsc' };\n }\n case AWAIT_SPAN_NAME:\n // A wait on work started elsewhere — no new work under it.\n return {\n label: `await ${String(attrs['timber.await_label'] ?? '')}${attrs[AWAIT_WAIT_ATTRIBUTE] === true ? ' (wait)' : ''}`,\n env: 'await',\n };\n case FETCH_BODY_SPAN_NAME:\n return { label: 'response body', env: 'fetch' };\n case FETCH_SPAN_NAME: {\n const fetchMethod = attrs['http.request.method'] ?? 'GET';\n const fetchUrl = attrs['http.url'] ?? '';\n return {\n label: `fetch ${String(fetchMethod)} ${fetchDisplayUrl(String(fetchUrl))}`,\n env: 'fetch',\n };\n }\n default:\n return { label: name, env: 'rsc' };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAgEA,IAAa,uBAAsC;CACjD,KAAK,CAAC;CACN,IAAI,CAAC;CACL,eAAe,CAAC;CAChB,OAAO,CAAC;CACR,qBAAqB,CAAC;CACtB,YAAY,CAAC;AACf;;;;;;;AAcA,SAAgB,gBAAgB,UAA8B,UAAmC;CAC/F,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,WAAW,SAAS,IAAI,KAAK;EACnC,IAAI,CAAC,UAAU;EACf,KAAK,MAAM,OAAO,UAChB,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG;GAClB,KAAK,IAAI,GAAG;GACZ,OAAO,KAAK,GAAG;EACjB;CAEJ;CAGF,OAAO;AACT;;;;;;;AA0BA,SAAgB,kBACd,UACA,UACqB;CACrB,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAA8B,CAAC;CAErC,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,QAAQ,SAAS,MAAM,KAAK;EAClC,IAAI,CAAC,OAAO;EACZ,KAAK,MAAM,SAAS,OAClB,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,GAAG;GACzB,KAAK,IAAI,MAAM,IAAI;GACnB,OAAO,KAAK,KAAK;EACnB;CAEJ;CAGF,OAAO;AACT;;;;;;;AAyBA,SAAgB,2BACd,UACA,UACU;CACV,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,WAAW,SAAS,cAAc,KAAK;EAC7C,IAAI,CAAC,UAAU;EACf,KAAK,MAAM,OAAO,UAChB,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG;GAClB,KAAK,IAAI,GAAG;GACZ,OAAO,KAAK,GAAG;EACjB;CAEJ;CAGF,OAAO;AACT;;;;;;;;;;;;AC5LA,IAAa,iBAAiB;;AAG9B,IAAa,wBAAwB;;;;;;AAOrC,IAAa,oBAAoB,OAAO,IAAI,sBAAsB;;AAGlE,IAAa,oBAAoB;;AAqHjC,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,GAAG,kBAAkB,SAAS,QAAQ;AAC/C"}