@timber-js/app 0.2.0-alpha.241 → 0.2.0-alpha.243

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 (331) hide show
  1. package/dist/_chunks/{actions-BCYVyoFl.js → actions-DoTj0Jd3.js} +78 -32
  2. package/dist/_chunks/actions-DoTj0Jd3.js.map +1 -0
  3. package/dist/_chunks/{als-registry-fabsRnPY.js → als-registry-C-iwbtvI.js} +1 -2
  4. package/dist/_chunks/{als-registry-fabsRnPY.js.map → als-registry-C-iwbtvI.js.map} +1 -1
  5. package/dist/_chunks/{cache-api-n5FL4wFs.js → cache-api-D3HmgsFh.js} +5 -5
  6. package/dist/_chunks/{cache-api-n5FL4wFs.js.map → cache-api-D3HmgsFh.js.map} +1 -1
  7. package/dist/_chunks/{chains-IswOWMnq.js → chains-BpvDwp08.js} +2 -2
  8. package/dist/_chunks/{chains-IswOWMnq.js.map → chains-BpvDwp08.js.map} +1 -1
  9. package/dist/_chunks/chains-CjlZZ5ad.js +1 -0
  10. package/dist/_chunks/{classify-B08RCF6s.js → classify-Bbb_lKjH.js} +2 -2
  11. package/dist/_chunks/{classify-B08RCF6s.js.map → classify-Bbb_lKjH.js.map} +1 -1
  12. package/dist/_chunks/{cli-check-tpFb6pBU.js → cli-check-DlQBSKIN.js} +3 -3
  13. package/dist/_chunks/{cli-check-tpFb6pBU.js.map → cli-check-DlQBSKIN.js.map} +1 -1
  14. package/dist/_chunks/{cli-schema-sync-DRNJutey.js → cli-schema-sync-CWkGFlYu.js} +2 -2
  15. package/dist/_chunks/{cli-schema-sync-DRNJutey.js.map → cli-schema-sync-CWkGFlYu.js.map} +1 -1
  16. package/dist/_chunks/{cli-schema-sync-C0pXBtzG.js → cli-schema-sync-Dyvdkv_I.js} +1 -1
  17. package/dist/_chunks/{client-dep-entries-Dw5Dvatr.js → client-dep-entries-Dka67elj.js} +2 -2
  18. package/dist/_chunks/{client-dep-entries-Dw5Dvatr.js.map → client-dep-entries-Dka67elj.js.map} +1 -1
  19. package/dist/_chunks/{convention-lint-BfC_dAhZ.js → convention-lint-CGGcseNn.js} +19 -5
  20. package/dist/_chunks/convention-lint-CGGcseNn.js.map +1 -0
  21. package/dist/_chunks/dev-server-DrjLscqT.js +1 -0
  22. package/dist/_chunks/{dev-server-3R6Bl9_R.js → dev-server-LO4McfQi.js} +3 -4
  23. package/dist/_chunks/dev-server-LO4McfQi.js.map +1 -0
  24. package/dist/_chunks/{error-boundary-Dfhxigko.js → error-boundary-wuNvAJ4n.js} +8 -15
  25. package/dist/_chunks/error-boundary-wuNvAJ4n.js.map +1 -0
  26. package/dist/_chunks/{flight-source-node-QOpWZATb.js → flight-source-node-BeF00Wo_.js} +4 -7
  27. package/dist/_chunks/flight-source-node-BeF00Wo_.js.map +1 -0
  28. package/dist/_chunks/{interception-CtNt9jPt.js → interception-D1dCGNmQ.js} +6 -6
  29. package/dist/_chunks/{interception-CtNt9jPt.js.map → interception-D1dCGNmQ.js.map} +1 -1
  30. package/dist/_chunks/{json-lossy-check-5KFcC1yt.js → json-lossy-check-DpXneTBm.js} +2 -2
  31. package/dist/_chunks/{json-lossy-check-5KFcC1yt.js.map → json-lossy-check-DpXneTBm.js.map} +1 -1
  32. package/dist/_chunks/key-headers-uIig1_mU.js +40 -0
  33. package/dist/_chunks/key-headers-uIig1_mU.js.map +1 -0
  34. package/dist/_chunks/{live-graph-D1dfVqoT.js → live-graph-DXhz6A_X.js} +4 -4
  35. package/dist/_chunks/{live-graph-D1dfVqoT.js.map → live-graph-DXhz6A_X.js.map} +1 -1
  36. package/dist/_chunks/{logger-BvGxPd1e.js → logger-D1sWX2I0.js} +18 -3
  37. package/dist/_chunks/logger-D1sWX2I0.js.map +1 -0
  38. package/dist/_chunks/metadata-routes-MXNjWOt5.js.map +1 -1
  39. package/dist/_chunks/{node-response-D5cfiyWP.js → node-response-Cp62CtH1.js} +2 -2
  40. package/dist/_chunks/{node-response-D5cfiyWP.js.map → node-response-Cp62CtH1.js.map} +1 -1
  41. package/dist/_chunks/{poison-scan-CX02ilxN.js → poison-scan-DdkJoHvP.js} +2 -2
  42. package/dist/_chunks/{poison-scan-CX02ilxN.js.map → poison-scan-DdkJoHvP.js.map} +1 -1
  43. package/dist/_chunks/{scanner-DneYxQoY.js → scanner-B6V2RqqF.js} +20 -3
  44. package/dist/_chunks/scanner-B6V2RqqF.js.map +1 -0
  45. package/dist/_chunks/{sizeof-BtQ3ErLf.js → sizeof-BKA6qOZq.js} +2 -2
  46. package/dist/_chunks/{sizeof-BtQ3ErLf.js.map → sizeof-BKA6qOZq.js.map} +1 -1
  47. package/dist/_chunks/{walkers-C9R2A4jN.js → walkers-BAZoAlfI.js} +3 -3
  48. package/dist/_chunks/{walkers-C9R2A4jN.js.map → walkers-BAZoAlfI.js.map} +1 -1
  49. package/dist/adapters/cloudflare-kv-cache.js +1 -1
  50. package/dist/analyze/crawl-entry.js +3 -3
  51. package/dist/analyze/graph-command.js +2 -2
  52. package/dist/cache/index.js +2 -2
  53. package/dist/cache/stores/memory.js +1 -1
  54. package/dist/cdn/workers-cache-purge.js +1 -1
  55. package/dist/cli.js +3 -3
  56. package/dist/client/browser-entry/router-init.d.ts +0 -1
  57. package/dist/client/browser-entry/router-init.d.ts.map +1 -1
  58. package/dist/client/document-withdrawal.d.ts +2 -0
  59. package/dist/client/document-withdrawal.d.ts.map +1 -0
  60. package/dist/client/error-boundary.js +1 -1
  61. package/dist/client/index.js +1 -1
  62. package/dist/client/index.js.map +1 -1
  63. package/dist/client/internal.js +3 -5
  64. package/dist/client/internal.js.map +1 -1
  65. package/dist/client/navigation-commit.d.ts +0 -7
  66. package/dist/client/navigation-commit.d.ts.map +1 -1
  67. package/dist/client/outlet-content-cache.d.ts +28 -42
  68. package/dist/client/outlet-content-cache.d.ts.map +1 -1
  69. package/dist/client/outlet-scope-context.d.ts +9 -4
  70. package/dist/client/outlet-scope-context.d.ts.map +1 -1
  71. package/dist/client/params-context.d.ts +1 -1
  72. package/dist/client/router-types.d.ts +3 -13
  73. package/dist/client/router-types.d.ts.map +1 -1
  74. package/dist/client/router.d.ts.map +1 -1
  75. package/dist/client/segment-cache.d.ts +2 -2
  76. package/dist/client/segment-outlet.d.ts +12 -15
  77. package/dist/client/segment-outlet.d.ts.map +1 -1
  78. package/dist/client/stale-segment.d.ts +2 -2
  79. package/dist/config-types.d.ts +2 -18
  80. package/dist/config-types.d.ts.map +1 -1
  81. package/dist/config-validation.d.ts.map +1 -1
  82. package/dist/index.js +7 -8
  83. package/dist/index.js.map +1 -1
  84. package/dist/native/rsc/manifest.json +3 -4
  85. package/dist/native/rsc/routing/segment-keys.js.map +1 -1
  86. package/dist/native/rsc/server/als-registry.js +1 -2
  87. package/dist/native/rsc/server/als-registry.js.map +1 -1
  88. package/dist/native/rsc/server/client-state-tree.js +1 -5
  89. package/dist/native/rsc/server/client-state-tree.js.map +1 -1
  90. package/dist/native/rsc/server/cookie-context.js +7 -7
  91. package/dist/native/rsc/server/cookie-context.js.map +1 -1
  92. package/dist/native/rsc/server/deny-boundary.js +2 -1
  93. package/dist/native/rsc/server/deny-boundary.js.map +1 -1
  94. package/dist/native/rsc/server/dev-overlay-report.js +13 -0
  95. package/dist/native/rsc/server/dev-overlay-report.js.map +1 -0
  96. package/dist/native/rsc/server/flight-source-node.js +2 -5
  97. package/dist/native/rsc/server/flight-source-node.js.map +1 -1
  98. package/dist/native/rsc/server/flight-source.js +6 -41
  99. package/dist/native/rsc/server/flight-source.js.map +1 -1
  100. package/dist/native/rsc/server/framework-stack-frames.js.map +1 -1
  101. package/dist/native/rsc/server/logger.js +6 -1
  102. package/dist/native/rsc/server/logger.js.map +1 -1
  103. package/dist/native/rsc/server/pipeline-interception.js +4 -1
  104. package/dist/native/rsc/server/pipeline-interception.js.map +1 -1
  105. package/dist/native/rsc/server/pipeline.js.map +1 -1
  106. package/dist/native/rsc/server/request-context.js +6 -6
  107. package/dist/native/rsc/server/request-context.js.map +1 -1
  108. package/dist/native/rsc/server/route-element-builder.js +5 -5
  109. package/dist/native/rsc/server/route-element-builder.js.map +1 -1
  110. package/dist/native/rsc/server/rsc-entry/render-route.js +4 -30
  111. package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
  112. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +0 -2
  113. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js.map +1 -1
  114. package/dist/native/rsc/server/rsc-entry/rsc-stream.js +2 -5
  115. package/dist/native/rsc/server/rsc-entry/rsc-stream.js.map +1 -1
  116. package/dist/native/rsc/server/segment-lifetime/outlet-gate.js +44 -0
  117. package/dist/native/rsc/server/segment-lifetime/outlet-gate.js.map +1 -0
  118. package/dist/native/rsc/server/segment-lifetime/read-rule.js +45 -12
  119. package/dist/native/rsc/server/segment-lifetime/read-rule.js.map +1 -1
  120. package/dist/native/rsc/server/segment-lifetime/read-scope.js +50 -8
  121. package/dist/native/rsc/server/segment-lifetime/read-scope.js.map +1 -1
  122. package/dist/native/rsc/server/segment-lifetime/segment-key.js +17 -3
  123. package/dist/native/rsc/server/segment-lifetime/segment-key.js.map +1 -1
  124. package/dist/native/rsc/server/segment-lifetime/slot-outlets.js +4 -4
  125. package/dist/native/rsc/server/segment-lifetime/slot-outlets.js.map +1 -1
  126. package/dist/native/rsc/server/slot-resolver.js +8 -7
  127. package/dist/native/rsc/server/slot-resolver.js.map +1 -1
  128. package/dist/native/rsc/server/slot-subtree-contain.js +2 -1
  129. package/dist/native/rsc/server/slot-subtree-contain.js.map +1 -1
  130. package/dist/native/rsc/server/subtree-walk.js +14 -5
  131. package/dist/native/rsc/server/subtree-walk.js.map +1 -1
  132. package/dist/native/rsc/server/vite-handoff-rsc.js.map +1 -1
  133. package/dist/native/rsc/shared/key-headers.js +20 -0
  134. package/dist/native/rsc/shared/key-headers.js.map +1 -0
  135. package/dist/native/rsc/shared/outlet-decision.js.map +1 -1
  136. package/dist/native/ssr/client/document-withdrawal.js +17 -0
  137. package/dist/native/ssr/client/document-withdrawal.js.map +1 -0
  138. package/dist/native/ssr/client/outlet-content-cache.js +10 -25
  139. package/dist/native/ssr/client/outlet-content-cache.js.map +1 -1
  140. package/dist/native/ssr/client/outlet-scope-context.js.map +1 -1
  141. package/dist/native/ssr/client/segment-outlet.js +17 -21
  142. package/dist/native/ssr/client/segment-outlet.js.map +1 -1
  143. package/dist/native/ssr/manifest.json +6 -1
  144. package/dist/native/ssr/server/als-registry.js +0 -1
  145. package/dist/native/ssr/server/als-registry.js.map +1 -1
  146. package/dist/native/ssr/server/client-state-tree.js +1 -5
  147. package/dist/native/ssr/server/client-state-tree.js.map +1 -1
  148. package/dist/native/ssr/server/cookie-context.js +7 -7
  149. package/dist/native/ssr/server/cookie-context.js.map +1 -1
  150. package/dist/native/ssr/server/deny-boundary.js +2 -1
  151. package/dist/native/ssr/server/deny-boundary.js.map +1 -1
  152. package/dist/native/ssr/server/dev-overlay-report.js +6 -0
  153. package/dist/native/ssr/server/dev-overlay-report.js.map +1 -0
  154. package/dist/native/ssr/server/flight-source-node.js +2 -5
  155. package/dist/native/ssr/server/flight-source-node.js.map +1 -1
  156. package/dist/native/ssr/server/flight-source.js +0 -1
  157. package/dist/native/ssr/server/flight-source.js.map +1 -1
  158. package/dist/native/ssr/server/framework-stack-frames.js.map +1 -1
  159. package/dist/native/ssr/server/logger.js +6 -1
  160. package/dist/native/ssr/server/logger.js.map +1 -1
  161. package/dist/native/ssr/server/pipeline-interception.js +4 -1
  162. package/dist/native/ssr/server/pipeline-interception.js.map +1 -1
  163. package/dist/native/ssr/server/pipeline.js.map +1 -1
  164. package/dist/native/ssr/server/request-context.js +6 -6
  165. package/dist/native/ssr/server/request-context.js.map +1 -1
  166. package/dist/native/ssr/server/segment-lifetime/outlet-gate.js +11 -0
  167. package/dist/native/ssr/server/segment-lifetime/outlet-gate.js.map +1 -0
  168. package/dist/native/ssr/server/segment-lifetime/read-rule.js +45 -12
  169. package/dist/native/ssr/server/segment-lifetime/read-rule.js.map +1 -1
  170. package/dist/native/ssr/server/segment-lifetime/read-scope.js +16 -0
  171. package/dist/native/ssr/server/segment-lifetime/read-scope.js.map +1 -0
  172. package/dist/native/ssr/server/subtree-walk.js +149 -0
  173. package/dist/native/ssr/server/subtree-walk.js.map +1 -0
  174. package/dist/native/ssr/server/utils/element-type.js +21 -9
  175. package/dist/native/ssr/server/utils/element-type.js.map +1 -1
  176. package/dist/native/ssr/server/vite-handoff-rsc.js.map +1 -1
  177. package/dist/native/ssr/shared/key-headers.js +13 -0
  178. package/dist/native/ssr/shared/key-headers.js.map +1 -0
  179. package/dist/plugins/entries.d.ts.map +1 -1
  180. package/dist/routing/index.js +3 -3
  181. package/dist/routing/route-options.d.ts.map +1 -1
  182. package/dist/routing/segment-keys.d.ts +3 -4
  183. package/dist/routing/segment-keys.d.ts.map +1 -1
  184. package/dist/routing/slot-placement.d.ts +23 -4
  185. package/dist/routing/slot-placement.d.ts.map +1 -1
  186. package/dist/server/als-registry.d.ts +20 -16
  187. package/dist/server/als-registry.d.ts.map +1 -1
  188. package/dist/server/client-state-tree.d.ts +5 -11
  189. package/dist/server/client-state-tree.d.ts.map +1 -1
  190. package/dist/server/deny-boundary.d.ts.map +1 -1
  191. package/dist/server/dev-overlay-report.d.ts +13 -0
  192. package/dist/server/dev-overlay-report.d.ts.map +1 -0
  193. package/dist/server/flight-source-node.d.ts +1 -6
  194. package/dist/server/flight-source-node.d.ts.map +1 -1
  195. package/dist/server/flight-source.d.ts +0 -27
  196. package/dist/server/flight-source.d.ts.map +1 -1
  197. package/dist/server/framework-stack-frames.d.ts +1 -4
  198. package/dist/server/framework-stack-frames.d.ts.map +1 -1
  199. package/dist/server/index.js +2 -2
  200. package/dist/server/internal.js +105 -26
  201. package/dist/server/internal.js.map +1 -1
  202. package/dist/server/logger.d.ts +10 -0
  203. package/dist/server/logger.d.ts.map +1 -1
  204. package/dist/server/pipeline-interception.d.ts.map +1 -1
  205. package/dist/server/pipeline.d.ts +13 -1
  206. package/dist/server/pipeline.d.ts.map +1 -1
  207. package/dist/server/request-context.d.ts.map +1 -1
  208. package/dist/server/route-element-builder.d.ts +2 -2
  209. package/dist/server/route-element-builder.d.ts.map +1 -1
  210. package/dist/server/rsc-entry/helpers.d.ts +1 -1
  211. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  212. package/dist/server/rsc-entry/render-route.d.ts +0 -1
  213. package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
  214. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
  215. package/dist/server/rsc-entry/rsc-stream.d.ts +2 -11
  216. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  217. package/dist/server/segment-lifetime/outlet-gate.d.ts +58 -0
  218. package/dist/server/segment-lifetime/outlet-gate.d.ts.map +1 -0
  219. package/dist/server/segment-lifetime/read-rule.d.ts +19 -13
  220. package/dist/server/segment-lifetime/read-rule.d.ts.map +1 -1
  221. package/dist/server/segment-lifetime/read-scope.d.ts +48 -6
  222. package/dist/server/segment-lifetime/read-scope.d.ts.map +1 -1
  223. package/dist/server/segment-lifetime/segment-key.d.ts +3 -0
  224. package/dist/server/segment-lifetime/segment-key.d.ts.map +1 -1
  225. package/dist/server/segment-lifetime/slot-outlets.d.ts +3 -3
  226. package/dist/server/segment-lifetime/slot-outlets.d.ts.map +1 -1
  227. package/dist/server/slot-resolver.d.ts +5 -5
  228. package/dist/server/slot-resolver.d.ts.map +1 -1
  229. package/dist/server/slot-subtree-contain.d.ts.map +1 -1
  230. package/dist/server/subtree-walk.d.ts +17 -3
  231. package/dist/server/subtree-walk.d.ts.map +1 -1
  232. package/dist/server/types.d.ts +8 -2
  233. package/dist/server/types.d.ts.map +1 -1
  234. package/dist/server/vite-handoff-rsc.d.ts +3 -10
  235. package/dist/server/vite-handoff-rsc.d.ts.map +1 -1
  236. package/dist/shared/key-headers.d.ts +13 -0
  237. package/dist/shared/key-headers.d.ts.map +1 -0
  238. package/dist/shared/outlet-decision.d.ts +13 -44
  239. package/dist/shared/outlet-decision.d.ts.map +1 -1
  240. package/dist/shared/payload-root.d.ts +1 -1
  241. package/dist/shared/segment-info.d.ts +3 -7
  242. package/dist/shared/segment-info.d.ts.map +1 -1
  243. package/docs/api/30-api-server.mdx +1 -1
  244. package/docs/api/34-api-config.mdx +1 -1
  245. package/package.json +1 -1
  246. package/src/client/browser-entry/index.ts +0 -2
  247. package/src/client/browser-entry/router-init.ts +2 -4
  248. package/src/client/document-withdrawal.tsx +41 -0
  249. package/src/client/error-boundary.tsx +1 -1
  250. package/src/client/navigation-commit.ts +4 -18
  251. package/src/client/outlet-content-cache.ts +38 -60
  252. package/src/client/outlet-scope-context.ts +10 -5
  253. package/src/client/params-context.ts +1 -1
  254. package/src/client/router-types.ts +3 -14
  255. package/src/client/router.ts +0 -2
  256. package/src/client/rsc-fetch.ts +1 -1
  257. package/src/client/segment-cache.ts +2 -2
  258. package/src/client/segment-outlet.tsx +28 -54
  259. package/src/client/stale-segment.ts +2 -2
  260. package/src/config-types.ts +2 -18
  261. package/src/config-validation.ts +0 -1
  262. package/src/plugins/entries.ts +0 -1
  263. package/src/routing/interception.ts +5 -5
  264. package/src/routing/route-options.ts +20 -4
  265. package/src/routing/scanner.ts +1 -1
  266. package/src/routing/segment-keys.ts +3 -4
  267. package/src/routing/slot-placement.ts +41 -4
  268. package/src/rsc-runtime/vendor-types.d.ts +1 -1
  269. package/src/server/als-registry.ts +16 -23
  270. package/src/server/client-state-tree.ts +7 -18
  271. package/src/server/cookie-context.ts +7 -7
  272. package/src/server/deny-boundary.ts +4 -1
  273. package/src/server/dev-overlay-report.ts +22 -0
  274. package/src/server/flight-source-node.ts +1 -5
  275. package/src/server/flight-source.ts +1 -81
  276. package/src/server/framework-stack-frames.ts +1 -4
  277. package/src/server/logger.ts +13 -0
  278. package/src/server/pipeline-interception.ts +11 -2
  279. package/src/server/pipeline.ts +13 -1
  280. package/src/server/request-context.ts +12 -11
  281. package/src/server/route-element-builder.ts +15 -16
  282. package/src/server/rsc-entry/helpers.ts +1 -1
  283. package/src/server/rsc-entry/index.ts +7 -3
  284. package/src/server/rsc-entry/render-route.ts +7 -54
  285. package/src/server/rsc-entry/revalidate-renderer.ts +0 -2
  286. package/src/server/rsc-entry/rsc-stream.ts +3 -23
  287. package/src/server/segment-lifetime/outlet-gate.ts +102 -0
  288. package/src/server/segment-lifetime/read-rule.ts +110 -22
  289. package/src/server/segment-lifetime/read-scope.ts +131 -15
  290. package/src/server/segment-lifetime/segment-key.ts +31 -3
  291. package/src/server/segment-lifetime/slot-outlets.ts +6 -6
  292. package/src/server/slot-resolver.ts +30 -18
  293. package/src/server/slot-subtree-contain.ts +2 -1
  294. package/src/server/subtree-walk.ts +34 -9
  295. package/src/server/types.ts +8 -2
  296. package/src/server/vite-handoff-rsc.ts +3 -12
  297. package/src/shared/key-headers.ts +42 -0
  298. package/src/shared/outlet-decision.ts +13 -48
  299. package/src/shared/payload-root.ts +1 -1
  300. package/src/shared/segment-info.ts +3 -7
  301. package/dist/_chunks/actions-BCYVyoFl.js.map +0 -1
  302. package/dist/_chunks/chains-DPZAMMav.js +0 -1
  303. package/dist/_chunks/convention-lint-BfC_dAhZ.js.map +0 -1
  304. package/dist/_chunks/dev-server-3DNTXQV-.js +0 -1
  305. package/dist/_chunks/dev-server-3R6Bl9_R.js.map +0 -1
  306. package/dist/_chunks/error-boundary-Dfhxigko.js.map +0 -1
  307. package/dist/_chunks/flight-source-node-QOpWZATb.js.map +0 -1
  308. package/dist/_chunks/logger-BvGxPd1e.js.map +0 -1
  309. package/dist/_chunks/scanner-DneYxQoY.js.map +0 -1
  310. package/dist/native/rsc/server/segment-hash/capture.js +0 -107
  311. package/dist/native/rsc/server/segment-hash/capture.js.map +0 -1
  312. package/dist/native/rsc/server/segment-hash/outlet.js +0 -101
  313. package/dist/native/rsc/server/segment-hash/outlet.js.map +0 -1
  314. package/dist/native/rsc/server/segment-hash/stream-tap.js +0 -139
  315. package/dist/native/rsc/server/segment-hash/stream-tap.js.map +0 -1
  316. package/dist/native/rsc/server/segment-hash/value-hash.js +0 -171
  317. package/dist/native/rsc/server/segment-hash/value-hash.js.map +0 -1
  318. package/dist/native/ssr/server/segment-hash/value-hash.js +0 -162
  319. package/dist/native/ssr/server/segment-hash/value-hash.js.map +0 -1
  320. package/dist/server/segment-hash/capture.d.ts +0 -77
  321. package/dist/server/segment-hash/capture.d.ts.map +0 -1
  322. package/dist/server/segment-hash/outlet.d.ts +0 -93
  323. package/dist/server/segment-hash/outlet.d.ts.map +0 -1
  324. package/dist/server/segment-hash/stream-tap.d.ts +0 -49
  325. package/dist/server/segment-hash/stream-tap.d.ts.map +0 -1
  326. package/dist/server/segment-hash/value-hash.d.ts +0 -70
  327. package/dist/server/segment-hash/value-hash.d.ts.map +0 -1
  328. package/src/server/segment-hash/capture.ts +0 -232
  329. package/src/server/segment-hash/outlet.ts +0 -229
  330. package/src/server/segment-hash/stream-tap.ts +0 -244
  331. package/src/server/segment-hash/value-hash.ts +0 -338
@@ -1,70 +0,0 @@
1
- /**
2
- * The hash of a segment: a canonical walk over the values React's own Flight
3
- * client decoded — never over the wire format.
4
- *
5
- * Both sides of the comparison are decoded by React (`createFromReadableStream`
6
- * in the RSC environment): the capture of a segment, and the segment's rows in
7
- * the response the client received. So everything about how Flight encodes a
8
- * value — which markers mean references, how objects are outlined or deduped,
9
- * which rows carry debug info — is interpreted by the code that defines it,
10
- * and a React upgrade that changes the encoding changes nothing here.
11
- *
12
- * What is hashed is what a client can observe:
13
- *
14
- * - **Identity.** Every object is a node, numbered on first visit; a later
15
- * visit writes `alias(n)`. Objects are the decoded objects themselves, so
16
- * sharing, cycles and promise identity are exactly what the client gets —
17
- * and a shared subgraph is written once.
18
- * - **An allowlist of value kinds**: primitives, plain objects (own keys, in
19
- * order), arrays, React elements, client and server references, promises,
20
- * lazy elements, Dates, Maps, Sets, binary data and errors. Anything else —
21
- * a stream, an async iterator, a class instance — makes the segment
22
- * unhashable, which means it is always sent: a value kind this code does
23
- * not know costs bytes, never correctness.
24
- * - **Holes.** A nested `SegmentOutlet` element is `hole(segmentPath, key)`;
25
- * its decision — and the nested segment's content — is not visited.
26
- *
27
- * The hash is SHA-256, truncated to 132 bits (22 base64url characters).
28
- *
29
- * See design/52-segment-hash-dedupe.md §"The hash is over a canonical form".
30
- */
31
- export declare const SEGMENT_HASH_LENGTH = 22;
32
- export type ValueHashOutcome =
33
- /** Every value the subgraph reaches is settled. */
34
- {
35
- status: 'complete';
36
- hash: string;
37
- streaming: boolean;
38
- }
39
- /** Some promises or lazy elements are still pending; wait for them. */
40
- | {
41
- status: 'pending';
42
- streaming: boolean;
43
- waitFor: PromiseLike<unknown>[];
44
- }
45
- /** A value of a kind not on the allowlist, or over budget: always sent. */
46
- | {
47
- status: 'unhashable';
48
- };
49
- export interface ValueHashOptions {
50
- /** Whether an element type is timber's `SegmentOutlet` client reference. */
51
- isOutlet(type: unknown): boolean;
52
- }
53
- export declare function hashCanonical(canonical: string): string;
54
- /**
55
- * In dev, @vitejs/plugin-rsc appends `$$cache=<random>` to every reference
56
- * id, freshly per render, so the browser re-imports a module after HMR. Two
57
- * renders of the same tree name the same module with different ids; the tag
58
- * is not part of what the module is.
59
- */
60
- export declare function stripReferenceCacheTag(id: string): string;
61
- /** Hash the value graph rooted at `root`. */
62
- export declare function hashValue(root: unknown, options: ValueHashOptions): ValueHashOutcome;
63
- /**
64
- * Hash `root` once everything it reaches has settled, waiting as needed.
65
- * Settles to null if it is unhashable or `signal` aborts first.
66
- */
67
- export declare function hashSettledValue(root: unknown, options: ValueHashOptions, signal: {
68
- aborted: boolean;
69
- }): Promise<string | null>;
70
- //# sourceMappingURL=value-hash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"value-hash.d.ts","sourceRoot":"","sources":["../../../src/server/segment-hash/value-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,MAAM,MAAM,gBAAgB;AAC1B,mDAAmD;AACjD;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE;AAC1D,uEAAuE;GACrE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAA;CAAE;AAC5E,2EAA2E;GACzE;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;CAClC;AA0BD,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEzD;AAcD,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAqNpF;AAQD;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASxB"}
@@ -1,232 +0,0 @@
1
- /**
2
- * The capture: a segment rendered on its own Flight stream, inside the current
3
- * request — the segment's one and only render.
4
- *
5
- * The outlet gate captures a segment when the client advertised a hash for it.
6
- * The capture is decoded as it streams by React's own Flight client in the
7
- * RSC environment, and the decoded value graph is hashed (value-hash.ts):
8
- *
9
- * - its hash equals the client's → a skip, and the decoded tree is dropped;
10
- * - it differs → the decoded tree is emitted as the segment's live content.
11
- * Nothing is rendered a second time: server components already ran, and the
12
- * main render only serializes what they produced.
13
- *
14
- * A capture that reaches a Suspense boundary or a promise prop still pending
15
- * is not waited on (the shell rule is not built): its decoded tree is emitted
16
- * live at once and the pending content streams when it would have anyway.
17
- *
18
- * Nested outlets are holes. Each renders as a `SegmentOutlet` whose decision is
19
- * an opaque marker, written as a Flight temporary reference. Decoding
20
- * replaces it with a lazy decision for the nested segment, made only if the
21
- * decoded tree is sent — a skip decides the nested segments itself.
22
- *
23
- * Because the capture is the render, it writes request state (metadata
24
- * entries, deny status) directly, and reports errors through the main
25
- * render's error handler. An error decoded into the live content keeps its
26
- * digest: the main render passes it through rather than reporting it again.
27
- *
28
- * See design/52-segment-hash-dedupe.md §"Capture".
29
- */
30
-
31
- import { createHash } from 'node:crypto';
32
- import { createElement, type ReactNode } from 'react';
33
- import { segmentCaptureAls } from '../als-registry.ts';
34
- import { flightChunkBytes, openFlightReader } from '../flight-source.ts';
35
- import { withTimeout } from '../render-timeout.ts';
36
- import { createFromReadableStream, renderFlight } from '../vite-handoff-rsc.ts';
37
- import type {
38
- CaptureHole,
39
- OutletDecision,
40
- OutletDecisionValue,
41
- } from '../../shared/outlet-decision.ts';
42
- import { hashValue } from './value-hash.ts';
43
-
44
- /**
45
- * Inside a capture render, the marker a nested outlet renders with in place of
46
- * its decision; undefined outside one.
47
- */
48
- export function captureHoleMarker(segmentPath: string): CaptureHole | undefined {
49
- return segmentCaptureAls.getStore()?.hole(segmentPath);
50
- }
51
-
52
- /** A short, stable `useId()` prefix for the capture of `segmentPath`. */
53
- function captureIdPrefix(segmentPath: string): string {
54
- return 's' + createHash('sha256').update(segmentPath).digest('base64url').slice(0, 8) + '-';
55
- }
56
-
57
- export interface CaptureOptions {
58
- /** The segment captured — its `useId()` prefix derives from it. */
59
- segmentPath: string;
60
- /** Upper bound on the whole capture stream. */
61
- timeoutMs: number;
62
- /** The request's signal — a disconnect abandons the capture. */
63
- signal?: AbortSignal;
64
- /** Subscribes to the main render's end — a capture never outlives it. */
65
- onRenderEnd?: (cancel: () => void) => () => void;
66
- /** The main render's error handler: its digests, signals and reports. */
67
- onError?: (error: unknown) => string | void;
68
- /** Whether a decoded element type is timber's `SegmentOutlet`. */
69
- isOutlet: (type: unknown) => boolean;
70
- /** The decision for a nested outlet, made only if the capture is sent live. */
71
- decideHole: (segmentPath: string) => OutletDecisionValue | undefined;
72
- }
73
-
74
- /** What a capture found, as soon as it can say. */
75
- export type SegmentCapture =
76
- /** Everything the segment reaches settled: its hash is known. */
77
- | {
78
- kind: 'complete';
79
- hash: string;
80
- /**
81
- * The nested outlets that rendered as holes. One missing here was not
82
- * rendered — an access gate above it denied — and a skip must not decide
83
- * it: deciding renders its content.
84
- */
85
- holes: ReadonlySet<string>;
86
- /** The decoded content, to send if the segment is not skipped. */
87
- content: ReactNode;
88
- /** The segment is skipped: stop reading the capture. */
89
- discard(): void;
90
- }
91
- /** Not waited for — still streaming, or not hashable. Send it live. */
92
- | { kind: 'live'; content: ReactNode };
93
-
94
- /**
95
- * A decision made the first time something asks for it. The main render asks
96
- * when it serializes the decoded tree (Flight awaits any thenable prop); a
97
- * skip never does.
98
- */
99
- function lazyDecision(decide: () => OutletDecisionValue | undefined): PromiseLike<OutletDecision> {
100
- let decided: Promise<OutletDecision> | undefined;
101
- return {
102
- then(onFulfilled, onRejected) {
103
- decided ??= Promise.resolve(decide()).then((d) => {
104
- // The client refuses an outlet without a decision rather than show
105
- // stale content (client/segment-outlet.tsx).
106
- if (d === undefined) throw new Error('[timber] a capture hole has no segment to decide');
107
- return d;
108
- });
109
- return decided.then(onFulfilled, onRejected);
110
- },
111
- };
112
- }
113
-
114
- /** Render `content` as a capture. Settles once its hash is known or not waited for. */
115
- export async function captureSegment(
116
- content: ReactNode,
117
- options: CaptureOptions
118
- ): Promise<SegmentCapture> {
119
- // Hole markers, by temporary-reference id, and the paths they stand for.
120
- const temporaryReferences = new WeakMap<object, string>();
121
- const holePaths = new Map<string, string>();
122
- const source = segmentCaptureAls.run(
123
- {
124
- hole(segmentPath) {
125
- const id = String(holePaths.size);
126
- const marker: CaptureHole = { captureHole: true };
127
- holePaths.set(id, segmentPath);
128
- temporaryReferences.set(marker, id);
129
- return marker;
130
- },
131
- },
132
- () =>
133
- renderFlight(content, {
134
- signal: options.signal,
135
- timeoutMs: options.timeoutMs,
136
- onError: options.onError,
137
- temporaryReferences,
138
- // The capture counts `useId()` from zero like the main render does;
139
- // a prefix of its own, stable per segment, keeps their ids apart in
140
- // one document and keeps the hash the same from render to render.
141
- identifierPrefix: captureIdPrefix(options.segmentPath),
142
- })
143
- );
144
-
145
- const reader = openFlightReader(source);
146
- // Cancelling the reader aborts the capture's render. Unsubscribed when the
147
- // capture's stream ends.
148
- let ended = false;
149
- const unsubscribe = options.onRenderEnd?.(() => {
150
- ended = true;
151
- reader.cancel();
152
- });
153
-
154
- // Pump the capture into the decoder, every read under the deadline.
155
- const deadline = Date.now() + options.timeoutMs;
156
- const bytes = new ReadableStream<Uint8Array>({
157
- async pull(controller) {
158
- try {
159
- const result = await withTimeout(
160
- reader.read(),
161
- Math.max(0, deadline - Date.now()),
162
- 'segment capture'
163
- );
164
- if (result.done) {
165
- unsubscribe?.();
166
- controller.close();
167
- } else {
168
- controller.enqueue(flightChunkBytes(result.value));
169
- }
170
- } catch (error) {
171
- // Failed, cancelled, or out of time: release the render. Sent live,
172
- // the decoded content fails at the same point — the main render
173
- // answers it.
174
- unsubscribe?.();
175
- reader.cancel();
176
- controller.error(error);
177
- }
178
- },
179
- cancel() {
180
- unsubscribe?.();
181
- reader.cancel();
182
- },
183
- });
184
-
185
- const decisions = new Map<string, PromiseLike<OutletDecision>>();
186
- const root = createFromReadableStream(bytes, {
187
- temporaryReferences: {
188
- get(key: string) {
189
- // Flight's client asks for `$<id>`; each hole is decided once, lazily.
190
- const id = key.slice(1);
191
- const path = holePaths.get(id);
192
- if (path === undefined) return undefined;
193
- let decision = decisions.get(id);
194
- if (!decision) {
195
- decision = lazyDecision(() => options.decideHole(path));
196
- decisions.set(id, decision);
197
- }
198
- return decision;
199
- },
200
- },
201
- });
202
- let decoded: ReactNode;
203
- try {
204
- decoded = (await root) as ReactNode;
205
- } catch {
206
- // The capture's root errored (or never arrived). Sent live as the
207
- // rejected root, the main render writes that error where the segment
208
- // would be — once, with the digest the capture already reported.
209
- // A server component that only awaits the decoded root: no app code runs.
210
- const DecodedCaptureRoot = async (): Promise<ReactNode> => (await root) as ReactNode;
211
- return { kind: 'live', content: createElement(DecodedCaptureRoot) };
212
- }
213
-
214
- for (;;) {
215
- const outcome = hashValue(decoded, { isOutlet: options.isOutlet });
216
- if (outcome.status === 'complete') {
217
- return {
218
- kind: 'complete',
219
- hash: outcome.hash,
220
- holes: new Set(holePaths.values()),
221
- content: decoded,
222
- discard: () => reader.cancel(),
223
- };
224
- }
225
- if (outcome.status === 'unhashable' || outcome.streaming || ended) {
226
- return { kind: 'live', content: decoded };
227
- }
228
- // Pending async work outside any Suspense boundary: the client cannot
229
- // commit before it arrives either, so waiting for it is invisible.
230
- await Promise.allSettled(outcome.waitFor.map((t) => Promise.resolve(t)));
231
- }
232
- }
@@ -1,229 +0,0 @@
1
- /**
2
- * The outlet gate: renders one segment as a `SegmentOutlet` whose decision is
3
- * either its live content or a skip.
4
- *
5
- * Every segment renders on every navigation; access runs for every one. What
6
- * hash dedupe saves is bytes: when the client advertised a hash for a segment,
7
- * the gate captures the segment (capture.ts), and if the capture's hash
8
- * equals the client's, the segment is sent as a skip — the client keeps the
9
- * content it holds. Otherwise the live content is sent with a hash the client
10
- * stores beside it (stream-tap.ts). Nothing is predicted: a skip happens only
11
- * when a render the server just ran produced exactly what the client holds.
12
- *
13
- * A skip carries the decisions of the segments nested directly inside it —
14
- * only those the capture rendered as holes. Their access gates ran in the
15
- * capture; a nested gate that denied rendered its deny page instead of the
16
- * hole, so its segment is never decided, never rendered, never sent.
17
- *
18
- * A `'document'` segment (design/53-segment-lifetime.md) is decided before
19
- * any of that, and never captured: when the client holds content rendered
20
- * under the current key digest, the segment is skipped **without rendering**,
21
- * and its nested outlets are decided as if it had rendered — lifetime does
22
- * not cascade. Otherwise it is sent live with the digest it rendered under.
23
- *
24
- * See design/52-segment-hash-dedupe.md §"Mechanism".
25
- */
26
-
27
- import { createElement, type ReactElement, type ReactNode } from 'react';
28
- import type { OutletDecision, OutletDecisionValue } from '../../shared/outlet-decision.ts';
29
- import { clientComponents } from '../vite-handoff-rsc.ts';
30
- import { stripReferenceCacheTag } from './value-hash.ts';
31
- import { captureHoleMarker, captureSegment, type SegmentCapture } from './capture.ts';
32
- import type { SegmentHashTap } from './stream-tap.ts';
33
- import type { DocumentKeys, DocumentOutlet } from '../segment-lifetime/document-outlet.ts';
34
- import type { SegmentLifetime } from '../types.ts';
35
-
36
- /** One outlet in the element tree, and the outlets directly inside it. */
37
- export interface OutletSpec {
38
- segmentPath: string;
39
- content: ReactNode;
40
- nested: OutletSpec[];
41
- /** Set on a `'document'` segment's outlet when the render can issue digests. */
42
- document?: DocumentOutlet;
43
- }
44
-
45
- /** Per-request inputs to every gate in one render. */
46
- export interface SegmentHashRender {
47
- /** The hashes the client advertised (`X-Timber-State-Tree`), by path. */
48
- clientHashes: ReadonlyMap<string, string> | null;
49
- /** Hashes the outgoing stream; null when `clientSegmentCache` is off. */
50
- tap: SegmentHashTap | null;
51
- /**
52
- * Bounds each capture's stream. A capture also ends with the main render
53
- * (`tap.onEnd`), which usually comes first.
54
- */
55
- captureTimeoutMs: number;
56
- /**
57
- * The main render's error handler. A capture is a segment's render, so its
58
- * errors are the render's: reported, digested and signalled once, there.
59
- */
60
- onCaptureError?: (error: unknown) => string | void;
61
- signal?: AbortSignal;
62
- /**
63
- * Key digests for `'document'` segments: the client's, and the signer that
64
- * issues and checks them. Null when no client router can hold a segment.
65
- */
66
- documents: DocumentKeys | null;
67
- /**
68
- * The lifetime of a layout that declares none: the app's
69
- * `defaultLayoutLifetime` (design/53 §"App-wide default"). Pages always
70
- * default to `'request'`.
71
- */
72
- defaultLayoutLifetime: SegmentLifetime;
73
- }
74
-
75
- /** A render with dedupe off: every segment live, no hashes. */
76
- export const NO_SEGMENT_HASHING: SegmentHashRender = {
77
- clientHashes: null,
78
- tap: null,
79
- captureTimeoutMs: 0,
80
- documents: null,
81
- defaultLayoutLifetime: 'request',
82
- };
83
-
84
- /**
85
- * Whether a decoded element type is timber's `SegmentOutlet` client
86
- * reference. Matched by reference id — module and export — so an app
87
- * component that happened to be exported as `SegmentOutlet` is not read as a
88
- * hole, which would keep changes inside it out of its segment's hash.
89
- */
90
- export function isOutletType(type: unknown): boolean {
91
- if (typeof type !== 'function' && (typeof type !== 'object' || type === null)) return false;
92
- const id = (type as { $$id?: unknown }).$$id;
93
- const outlet = (clientComponents().SegmentOutlet as { $$id?: unknown }).$$id;
94
- return (
95
- typeof id === 'string' &&
96
- typeof outlet === 'string' &&
97
- stripReferenceCacheTag(id) === stripReferenceCacheTag(outlet)
98
- );
99
- }
100
-
101
- /**
102
- * The element for an outlet: a server component that decides when it renders
103
- * — after every access gate above it — and inside a capture renders a bare
104
- * hole, since the nested segment's content belongs to its own hash.
105
- *
106
- * A closure with no props rather than a component taking `{ spec, render }`:
107
- * dev Flight serializes a server component's props as debug info, and these
108
- * would repeat the whole subtree in every dev payload.
109
- */
110
- export function outletGate(spec: OutletSpec, render: SegmentHashRender): ReactElement {
111
- function OutletGate(): ReactElement {
112
- const { SegmentOutlet } = clientComponents();
113
- const marker = captureHoleMarker(spec.segmentPath);
114
- if (marker)
115
- return createElement(SegmentOutlet, { segmentPath: spec.segmentPath, decision: marker });
116
- return createElement(SegmentOutlet, {
117
- segmentPath: spec.segmentPath,
118
- decision: decide(spec, render),
119
- });
120
- }
121
- OUTLET_GATES.add(OutletGate);
122
- return createElement(OutletGate);
123
- }
124
-
125
- /** Every gate component `outletGate` made, so a subtree walk can stop at one. */
126
- const OUTLET_GATES = new WeakSet<object>();
127
-
128
- /**
129
- * Whether `node` is an outlet gate element — the boundary of the segment
130
- * whose content contains it. A walk over one segment's output (a
131
- * 'document' segment's read scope) stops here: what renders inside belongs
132
- * to the nested segment and its own rules.
133
- */
134
- export function isOutletGateElement(node: unknown): boolean {
135
- if (typeof node !== 'object' || node === null || !('type' in node)) return false;
136
- const type = (node as { type: unknown }).type;
137
- return typeof type === 'function' && OUTLET_GATES.has(type);
138
- }
139
-
140
- function decide(spec: OutletSpec, render: SegmentHashRender): OutletDecisionValue {
141
- if (spec.document) {
142
- if ('held' in spec.document) return documentSkip(spec, render, spec.document.held);
143
- return { children: spec.content, digest: spec.document.issued };
144
- }
145
- const clientHash = render.clientHashes?.get(spec.segmentPath);
146
- if (clientHash === undefined) return live(spec, render, spec.content);
147
- // Development Flight follows this decision's async chain into the capture's
148
- // reads, whose awaited values include the decoded segment. It writes those
149
- // as debug rows only for awaits in app code; every render filters timber's
150
- // own frames out (framework-stack-frames.ts), so a skip sends nothing.
151
- return compare(spec, render, clientHash);
152
- }
153
-
154
- function compare(
155
- spec: OutletSpec,
156
- render: SegmentHashRender,
157
- clientHash: string
158
- ): Promise<OutletDecision> {
159
- return captureSegment(spec.content, {
160
- segmentPath: spec.segmentPath,
161
- timeoutMs: render.captureTimeoutMs,
162
- signal: render.signal,
163
- onRenderEnd: render.tap?.onEnd,
164
- onError: render.onCaptureError,
165
- isOutlet: isOutletType,
166
- decideHole: (path) => decideNested(spec, path, render),
167
- }).then(
168
- (capture) => {
169
- if (capture.kind === 'complete' && capture.hash === clientHash) {
170
- capture.discard();
171
- return skip(spec, render, capture);
172
- }
173
- // Sent live: the capture's own elements, decoded — not a second render.
174
- return live(spec, render, capture.content);
175
- },
176
- // The capture could not be started at all (renderFlight threw before
177
- // rendering anything): render the segment inline, as without a hash.
178
- () => live(spec, render, spec.content)
179
- );
180
- }
181
-
182
- /** The decision for the nested outlet at `path`, which rendered as a hole. */
183
- function decideNested(
184
- spec: OutletSpec,
185
- path: string,
186
- render: SegmentHashRender
187
- ): OutletDecisionValue | undefined {
188
- const nested = spec.nested.find((n) => n.segmentPath === path);
189
- // A hole the builder did not record under this segment cannot be decided;
190
- // the client refuses an outlet without a decision rather than show it stale.
191
- return nested ? decide(nested, render) : undefined;
192
- }
193
-
194
- function live(spec: OutletSpec, render: SegmentHashRender, children: ReactNode): OutletDecision {
195
- if (!render.tap) return { children };
196
- return { hash: render.tap.advertise(spec.segmentPath), children };
197
- }
198
-
199
- /**
200
- * A skip decides exactly the nested outlets its capture rendered as holes —
201
- * the ones whose access gates passed. Those are also exactly the outlets in
202
- * the client's cached copy, since the hashes matched. A nested outlet whose
203
- * gate denied is not decided at all: deciding it would render its content.
204
- */
205
- function skip(
206
- spec: OutletSpec,
207
- render: SegmentHashRender,
208
- capture: Extract<SegmentCapture, { kind: 'complete' }>
209
- ): OutletDecision {
210
- const outlets: Record<string, OutletDecisionValue> = {};
211
- for (const nested of spec.nested) {
212
- if (capture.holes.has(nested.segmentPath)) outlets[nested.segmentPath] = decide(nested, render);
213
- }
214
- return { skip: true, hash: capture.hash, outlets };
215
- }
216
-
217
- /**
218
- * A `'document'` skip: the segment is not rendered, so nothing says which
219
- * nested outlets its content would hold — every one is decided. The client
220
- * renders only those in its cached copy; a nested segment a layout body hid
221
- * at load is still rendered and serialized here (its own `access.ts` still
222
- * gates it), which is why a `'document'` layout body is not a data-hiding
223
- * boundary (design/53 §"What stays frozen").
224
- */
225
- function documentSkip(spec: OutletSpec, render: SegmentHashRender, digest: string): OutletDecision {
226
- const outlets: Record<string, OutletDecisionValue> = {};
227
- for (const nested of spec.nested) outlets[nested.segmentPath] = decide(nested, render);
228
- return { skip: true, digest, outlets };
229
- }