@timber-js/app 0.2.0-alpha.221 → 0.2.0-alpha.223

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 (380) hide show
  1. package/agent-skill.md +21 -5
  2. package/dist/_chunks/{actions-BDqn4Oxj.js → actions-7dTXYJfu.js} +53 -24
  3. package/dist/_chunks/actions-7dTXYJfu.js.map +1 -0
  4. package/dist/_chunks/{als-registry-BZqHCtq-.js → als-registry-DpygwCp0.js} +2 -3
  5. package/dist/_chunks/{als-registry-BZqHCtq-.js.map → als-registry-DpygwCp0.js.map} +1 -1
  6. package/dist/_chunks/{als-slots-BEEIPKYm.js → als-slots-kbQrHTzm.js} +2 -3
  7. package/dist/_chunks/{als-slots-BEEIPKYm.js.map → als-slots-kbQrHTzm.js.map} +1 -1
  8. package/dist/_chunks/{base-path-DaQrzbez.js → base-path-DDIx0FXe.js} +2 -3
  9. package/dist/_chunks/{base-path-DaQrzbez.js.map → base-path-DDIx0FXe.js.map} +1 -1
  10. package/dist/_chunks/{build-manifest-DWppEdLB.js → build-manifest-Y4jl7nwU.js} +2 -3
  11. package/dist/_chunks/{build-manifest-DWppEdLB.js.map → build-manifest-Y4jl7nwU.js.map} +1 -1
  12. package/dist/_chunks/{build-output-helper-RV_BRcF1.js → build-output-helper-B7wWGTfR.js} +14 -10
  13. package/dist/_chunks/build-output-helper-B7wWGTfR.js.map +1 -0
  14. package/dist/_chunks/{cache-api-GE4AOe2H.js → cache-api-TDZ4hlDc.js} +237 -37
  15. package/dist/_chunks/cache-api-TDZ4hlDc.js.map +1 -0
  16. package/dist/_chunks/{canonicalize-BAWkWiKK.js → canonicalize-CqK135BN.js} +29 -4
  17. package/dist/_chunks/{canonicalize-BAWkWiKK.js.map → canonicalize-CqK135BN.js.map} +1 -1
  18. package/dist/_chunks/chains-CwOr3Myj.js +1 -0
  19. package/dist/_chunks/{chains-e_Buf9vg.js → chains-Dgm3PrMe.js} +3 -4
  20. package/dist/_chunks/{chains-e_Buf9vg.js.map → chains-Dgm3PrMe.js.map} +1 -1
  21. package/dist/_chunks/{classify-2Yp3xJY1.js → classify--_kINHQV.js} +4 -5
  22. package/dist/_chunks/{classify-2Yp3xJY1.js.map → classify--_kINHQV.js.map} +1 -1
  23. package/dist/_chunks/{cli-check-DDwCkeDY.js → cli-check-Dv3f8d2j.js} +5 -6
  24. package/dist/_chunks/{cli-check-DDwCkeDY.js.map → cli-check-Dv3f8d2j.js.map} +1 -1
  25. package/dist/_chunks/{cli-context-_mPttGGY.js → cli-context-CbZp32SK.js} +3 -4
  26. package/dist/_chunks/{cli-context-_mPttGGY.js.map → cli-context-CbZp32SK.js.map} +1 -1
  27. package/dist/_chunks/cli-context-n5hmkdla.js +1 -0
  28. package/dist/_chunks/cli-dev-status-prPMLU8G.js +138 -0
  29. package/dist/_chunks/cli-dev-status-prPMLU8G.js.map +1 -0
  30. package/dist/_chunks/cli-init-BoXOYYil.js +196 -0
  31. package/dist/_chunks/cli-init-BoXOYYil.js.map +1 -0
  32. package/dist/_chunks/{cli-schema-sync-BdIebmk3.js → cli-schema-sync-DIPurq7X.js} +4 -5
  33. package/dist/_chunks/{cli-schema-sync-BdIebmk3.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
  34. package/dist/_chunks/{cli-schema-sync-CLNfXQDK.js → cli-schema-sync-uq72EZmD.js} +1 -1
  35. package/dist/_chunks/{client-dep-entries-BOkpKjj1.js → client-dep-entries-CP7AkMCM.js} +4 -5
  36. package/dist/_chunks/{client-dep-entries-BOkpKjj1.js.map → client-dep-entries-CP7AkMCM.js.map} +1 -1
  37. package/dist/_chunks/{cloudflare-Byxl8FWP.js → cloudflare-B75X6u4O.js} +10 -13
  38. package/dist/_chunks/{cloudflare-Byxl8FWP.js.map → cloudflare-B75X6u4O.js.map} +1 -1
  39. package/dist/_chunks/{codec-registry-oOUxugz3.js → codec-registry-CPc6bjVl.js} +2 -3
  40. package/dist/_chunks/{codec-registry-oOUxugz3.js.map → codec-registry-CPc6bjVl.js.map} +1 -1
  41. package/dist/_chunks/{codegen-Bps1sLKJ.js → codegen-B9oWkWGf.js} +5 -8
  42. package/dist/_chunks/{codegen-Bps1sLKJ.js.map → codegen-B9oWkWGf.js.map} +1 -1
  43. package/dist/_chunks/{convention-lint-ByKJ6aqD.js → convention-lint-hZwz5wd4.js} +8 -11
  44. package/dist/_chunks/{convention-lint-ByKJ6aqD.js.map → convention-lint-hZwz5wd4.js.map} +1 -1
  45. package/dist/_chunks/dev-discovery-YnabkCKD.js +238 -0
  46. package/dist/_chunks/dev-discovery-YnabkCKD.js.map +1 -0
  47. package/dist/_chunks/{dev-server-DIy-SY-J.js → dev-server-C61GWpGg.js} +409 -51
  48. package/dist/_chunks/dev-server-C61GWpGg.js.map +1 -0
  49. package/dist/_chunks/dev-server-CBvvM7Lr.js +1 -0
  50. package/dist/_chunks/{dev-store-BOa304m_.js → dev-store-BvdqtHvK.js} +82 -38
  51. package/dist/_chunks/dev-store-BvdqtHvK.js.map +1 -0
  52. package/dist/_chunks/{dist-DtrJyBbw.js → dist-C1Rjlo6s.js} +3 -5
  53. package/dist/_chunks/{dist-DtrJyBbw.js.map → dist-C1Rjlo6s.js.map} +1 -1
  54. package/dist/_chunks/{error-boundary-Bc8QPZuq.js → error-boundary-DRQXGWCp.js} +20 -27
  55. package/dist/_chunks/{error-boundary-Bc8QPZuq.js.map → error-boundary-DRQXGWCp.js.map} +1 -1
  56. package/dist/_chunks/{fast-hash-C-tVYrLb.js → fast-hash-DddxkU5Y.js} +2 -3
  57. package/dist/_chunks/{fast-hash-C-tVYrLb.js.map → fast-hash-DddxkU5Y.js.map} +1 -1
  58. package/dist/_chunks/{flight-source-node-HptmGMT8.js → flight-source-node-0Tp6evlz.js} +6 -8
  59. package/dist/_chunks/flight-source-node-0Tp6evlz.js.map +1 -0
  60. package/dist/_chunks/{format-BKclgVbk.js → format-DuPOoXUP.js} +2 -3
  61. package/dist/_chunks/{format-BKclgVbk.js.map → format-DuPOoXUP.js.map} +1 -1
  62. package/dist/_chunks/{fs-identity-BRKuL215.js → fs-identity-BmQ_Agg-.js} +3 -5
  63. package/dist/_chunks/{fs-identity-BRKuL215.js.map → fs-identity-BmQ_Agg-.js.map} +1 -1
  64. package/dist/_chunks/global-context-DbxNWeBP.js +47 -0
  65. package/dist/_chunks/global-context-DbxNWeBP.js.map +1 -0
  66. package/dist/_chunks/{graph-cache-CYiUS2aS.js → graph-cache-B1LAg4t7.js} +5 -89
  67. package/dist/_chunks/graph-cache-B1LAg4t7.js.map +1 -0
  68. package/dist/_chunks/{href-validation-BIrxavIy.js → href-validation-CEZy1V-k.js} +4 -7
  69. package/dist/_chunks/{href-validation-BIrxavIy.js.map → href-validation-CEZy1V-k.js.map} +1 -1
  70. package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js → json-lossy-check-DVkLUlfC.js} +3 -4
  71. package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
  72. package/dist/_chunks/{live-graph-tSWrv8eH.js → live-graph-BcVjQ1Te.js} +6 -7
  73. package/dist/_chunks/{live-graph-tSWrv8eH.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
  74. package/dist/_chunks/{logger-CbLdcy-W.js → logger-CWk44DLp.js} +97 -47
  75. package/dist/_chunks/logger-CWk44DLp.js.map +1 -0
  76. package/dist/_chunks/{metadata-routes-B3XJNyIH.js → metadata-routes-BL26HCDd.js} +2 -3
  77. package/dist/_chunks/{metadata-routes-B3XJNyIH.js.map → metadata-routes-BL26HCDd.js.map} +1 -1
  78. package/dist/_chunks/{navigation-root-BQfo1-kG.js → navigation-root-M3B2ZrdO.js} +6 -10
  79. package/dist/_chunks/{navigation-root-BQfo1-kG.js.map → navigation-root-M3B2ZrdO.js.map} +1 -1
  80. package/dist/_chunks/{node-response-rkQqcFGq.js → node-response-B9aviPDa.js} +43 -9
  81. package/dist/_chunks/node-response-B9aviPDa.js.map +1 -0
  82. package/dist/_chunks/{param-value-C8TNYchQ.js → param-value-DqlGfF57.js} +2 -3
  83. package/dist/_chunks/{param-value-C8TNYchQ.js.map → param-value-DqlGfF57.js.map} +1 -1
  84. package/dist/_chunks/{plugin-context-uDHFqHHJ.js → plugin-context-BfSRKJfz.js} +1 -1
  85. package/dist/_chunks/{plugin-context-DxMMvjUt.js → plugin-context-FCkaNLUB.js} +4 -6
  86. package/dist/_chunks/plugin-context-FCkaNLUB.js.map +1 -0
  87. package/dist/_chunks/{poison-rules-DoEhbqaY.js → poison-rules-Bmz-lCPi.js} +2 -3
  88. package/dist/_chunks/{poison-rules-DoEhbqaY.js.map → poison-rules-Bmz-lCPi.js.map} +1 -1
  89. package/dist/_chunks/{poison-scan-C4FgMxFl.js → poison-scan-DJYxZc_7.js} +4 -5
  90. package/dist/_chunks/{poison-scan-C4FgMxFl.js.map → poison-scan-DJYxZc_7.js.map} +1 -1
  91. package/dist/_chunks/{purge-store-WZaxu-3m.js → purge-store-8BqLAYZ1.js} +2 -3
  92. package/dist/_chunks/{purge-store-WZaxu-3m.js.map → purge-store-8BqLAYZ1.js.map} +1 -1
  93. package/dist/_chunks/{render-timeout-joFhz4KH.js → render-timeout-MrrqD1wd.js} +20 -4
  94. package/dist/_chunks/{render-timeout-joFhz4KH.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
  95. package/dist/_chunks/{resolve-schema-CBR6Lm4i.js → resolve-schema-B-aCuTu3.js} +3 -4
  96. package/dist/_chunks/{resolve-schema-CBR6Lm4i.js.map → resolve-schema-B-aCuTu3.js.map} +1 -1
  97. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js → rsc-cache-key-D0cb0Gmc.js} +2 -3
  98. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js.map → rsc-cache-key-D0cb0Gmc.js.map} +1 -1
  99. package/dist/_chunks/{rsc-media-type-DDc7duTD.js → rsc-media-type-m8jz9u6_.js} +2 -3
  100. package/dist/_chunks/{rsc-media-type-DDc7duTD.js.map → rsc-media-type-m8jz9u6_.js.map} +1 -1
  101. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js → rsc-payload-path-EphpDB-J.js} +2 -3
  102. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js.map → rsc-payload-path-EphpDB-J.js.map} +1 -1
  103. package/dist/_chunks/{scan-BoP17W3w.js → scan-CyizcBiX.js} +2 -3
  104. package/dist/_chunks/{scan-BoP17W3w.js.map → scan-CyizcBiX.js.map} +1 -1
  105. package/dist/_chunks/{scanner-Cb3fSjAC.js → scanner-CJC-ScJU.js} +15 -23
  106. package/dist/_chunks/{scanner-Cb3fSjAC.js.map → scanner-CJC-ScJU.js.map} +1 -1
  107. package/dist/_chunks/{schema-bridge-C83xa9lT.js → schema-bridge-DyRs3cqy.js} +61 -25
  108. package/dist/_chunks/schema-bridge-DyRs3cqy.js.map +1 -0
  109. package/dist/_chunks/{segment-classify-C539Pa2O.js → segment-classify-Ho8jXWeC.js} +3 -5
  110. package/dist/_chunks/{segment-classify-C539Pa2O.js.map → segment-classify-Ho8jXWeC.js.map} +1 -1
  111. package/dist/_chunks/{segment-context-xtPUGfdq.js → segment-context-CYiGTi3K.js} +6 -12
  112. package/dist/_chunks/segment-context-CYiGTi3K.js.map +1 -0
  113. package/dist/_chunks/{segment-keys-D5hu1hz4.js → segment-keys-Y60KNc8C.js} +2 -3
  114. package/dist/_chunks/{segment-keys-D5hu1hz4.js.map → segment-keys-Y60KNc8C.js.map} +1 -1
  115. package/dist/_chunks/{singleflight-BeVMMKi0.js → singleflight-BChPMjwH.js} +2 -3
  116. package/dist/_chunks/{singleflight-BeVMMKi0.js.map → singleflight-BChPMjwH.js.map} +1 -1
  117. package/dist/_chunks/{sizeof-QPE5nd3u.js → sizeof-DG4W40lv.js} +3 -4
  118. package/dist/_chunks/{sizeof-QPE5nd3u.js.map → sizeof-DG4W40lv.js.map} +1 -1
  119. package/dist/_chunks/{ssr-data-nA3I70_n.js → ssr-data-9hPtcNOr.js} +3 -4
  120. package/dist/_chunks/{ssr-data-nA3I70_n.js.map → ssr-data-9hPtcNOr.js.map} +1 -1
  121. package/dist/_chunks/{state-BhNGPsdi.js → state-B-EBjeER.js} +2 -3
  122. package/dist/_chunks/{state-BhNGPsdi.js.map → state-B-EBjeER.js.map} +1 -1
  123. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js → status-page-marker-XIQXlTOb.js} +8 -13
  124. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js.map → status-page-marker-XIQXlTOb.js.map} +1 -1
  125. package/dist/_chunks/{tree-match-6yihorhk.js → tree-match-Bqdr9szG.js} +2 -3
  126. package/dist/_chunks/{tree-match-6yihorhk.js.map → tree-match-Bqdr9szG.js.map} +1 -1
  127. package/dist/_chunks/{use-query-states-I3JMng6J.js → use-query-states-pkDV-jSg.js} +4 -7
  128. package/dist/_chunks/{use-query-states-I3JMng6J.js.map → use-query-states-pkDV-jSg.js.map} +1 -1
  129. package/dist/_chunks/{walkers-qu8TpiLh.js → walkers-DIE203ir.js} +6 -8
  130. package/dist/_chunks/{walkers-qu8TpiLh.js.map → walkers-DIE203ir.js.map} +1 -1
  131. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js → write-file-atomic-DW8m_Atv.js} +2 -3
  132. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js.map → write-file-atomic-DW8m_Atv.js.map} +1 -1
  133. package/dist/adapters/build-output-helper.d.ts +10 -1
  134. package/dist/adapters/build-output-helper.d.ts.map +1 -1
  135. package/dist/adapters/cloudflare-dev.js +2 -3
  136. package/dist/adapters/cloudflare-kv-cache.js +3 -4
  137. package/dist/adapters/cloudflare.d.ts.map +1 -1
  138. package/dist/adapters/cloudflare.js +1 -1
  139. package/dist/adapters/nitro-presets.d.ts +6 -0
  140. package/dist/adapters/nitro-presets.d.ts.map +1 -1
  141. package/dist/adapters/nitro-preview.d.ts.map +1 -1
  142. package/dist/adapters/nitro.d.ts.map +1 -1
  143. package/dist/adapters/nitro.js +94 -57
  144. package/dist/adapters/nitro.js.map +1 -1
  145. package/dist/analyze/crawl-entry.js +7 -9
  146. package/dist/analyze/crawl-entry.js.map +1 -1
  147. package/dist/analyze/graph-command.d.ts.map +1 -1
  148. package/dist/analyze/graph-command.js +19 -105
  149. package/dist/analyze/graph-command.js.map +1 -1
  150. package/dist/cache/guarded-read.d.ts +29 -0
  151. package/dist/cache/guarded-read.d.ts.map +1 -0
  152. package/dist/cache/index.js +3 -3
  153. package/dist/cache/key-discipline.d.ts +61 -0
  154. package/dist/cache/key-discipline.d.ts.map +1 -0
  155. package/dist/cache/stores/cloudflare-kv.js +1 -2
  156. package/dist/cache/stores/memory.js +2 -3
  157. package/dist/cache/stores/redis.js +1 -2
  158. package/dist/cache/stores/vercel.js +1 -2
  159. package/dist/cache/timber-cache.d.ts +5 -1
  160. package/dist/cache/timber-cache.d.ts.map +1 -1
  161. package/dist/cdn/cloudflare-purge.js +1 -2
  162. package/dist/cdn/fastly-purge.js +1 -2
  163. package/dist/cdn/index.js +2 -3
  164. package/dist/cdn/workers-cache-purge.js +3 -5
  165. package/dist/cdn/workers-cache-purge.js.map +1 -1
  166. package/dist/cli-dev-status.d.ts +75 -0
  167. package/dist/cli-dev-status.d.ts.map +1 -0
  168. package/dist/cli-init.d.ts +72 -0
  169. package/dist/cli-init.d.ts.map +1 -0
  170. package/dist/cli.d.ts +4 -12
  171. package/dist/cli.d.ts.map +1 -1
  172. package/dist/cli.js +27 -54
  173. package/dist/cli.js.map +1 -1
  174. package/dist/client/error-boundary.d.ts.map +1 -1
  175. package/dist/client/error-boundary.js +1 -1
  176. package/dist/client/global-context.d.ts +21 -1
  177. package/dist/client/global-context.d.ts.map +1 -1
  178. package/dist/client/index.js +23 -44
  179. package/dist/client/index.js.map +1 -1
  180. package/dist/client/internal.js +13 -18
  181. package/dist/client/internal.js.map +1 -1
  182. package/dist/client/navigation-context.d.ts.map +1 -1
  183. package/dist/client/params-context.d.ts.map +1 -1
  184. package/dist/client/slot-context.d.ts +2 -2
  185. package/dist/client/slot-context.d.ts.map +1 -1
  186. package/dist/client/use-cookie.d.ts +18 -5
  187. package/dist/client/use-cookie.d.ts.map +1 -1
  188. package/dist/codec.js +2 -3
  189. package/dist/config-types.d.ts +22 -5
  190. package/dist/config-types.d.ts.map +1 -1
  191. package/dist/config-validation.d.ts.map +1 -1
  192. package/dist/cookies/define-cookie.d.ts.map +1 -1
  193. package/dist/cookies/index.js +40 -67
  194. package/dist/cookies/index.js.map +1 -1
  195. package/dist/cookies/json-cookie.d.ts +4 -4
  196. package/dist/index.js +266 -229
  197. package/dist/index.js.map +1 -1
  198. package/dist/params/index.js +3 -4
  199. package/dist/plugin-context.d.ts +7 -0
  200. package/dist/plugin-context.d.ts.map +1 -1
  201. package/dist/plugins/dev-discovery.d.ts +69 -5
  202. package/dist/plugins/dev-discovery.d.ts.map +1 -1
  203. package/dist/plugins/dev-hostname.d.ts +152 -0
  204. package/dist/plugins/dev-hostname.d.ts.map +1 -0
  205. package/dist/plugins/dev-server.d.ts +6 -2
  206. package/dist/plugins/dev-server.d.ts.map +1 -1
  207. package/dist/plugins/dev-store-clear.d.ts +83 -0
  208. package/dist/plugins/dev-store-clear.d.ts.map +1 -0
  209. package/dist/plugins/graph-endpoint.d.ts +4 -2
  210. package/dist/plugins/graph-endpoint.d.ts.map +1 -1
  211. package/dist/plugins/prebuilt.d.ts.map +1 -1
  212. package/dist/routing/index.js +4 -4
  213. package/dist/rsc-runtime/rsc.d.ts +2 -1
  214. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  215. package/dist/rsc-runtime/server-references.d.ts +8 -0
  216. package/dist/rsc-runtime/server-references.d.ts.map +1 -0
  217. package/dist/schema-bridge.d.ts +28 -19
  218. package/dist/schema-bridge.d.ts.map +1 -1
  219. package/dist/search-params/define.d.ts +1 -1
  220. package/dist/search-params/define.d.ts.map +1 -1
  221. package/dist/search-params/index.js +11 -14
  222. package/dist/search-params/index.js.map +1 -1
  223. package/dist/search-params/wrappers.d.ts +3 -3
  224. package/dist/server/access-gate.d.ts +12 -0
  225. package/dist/server/access-gate.d.ts.map +1 -1
  226. package/dist/server/canonicalize.d.ts +21 -0
  227. package/dist/server/canonicalize.d.ts.map +1 -1
  228. package/dist/server/cookie-context.d.ts +8 -1
  229. package/dist/server/cookie-context.d.ts.map +1 -1
  230. package/dist/server/flight-source-node.d.ts.map +1 -1
  231. package/dist/server/flight-source.d.ts.map +1 -1
  232. package/dist/server/index.d.ts +1 -1
  233. package/dist/server/index.d.ts.map +1 -1
  234. package/dist/server/index.js +8 -13
  235. package/dist/server/index.js.map +1 -1
  236. package/dist/server/interception-gates.d.ts +49 -0
  237. package/dist/server/interception-gates.d.ts.map +1 -0
  238. package/dist/server/internal.js +1080 -959
  239. package/dist/server/internal.js.map +1 -1
  240. package/dist/server/logger.d.ts +26 -0
  241. package/dist/server/logger.d.ts.map +1 -1
  242. package/dist/server/param-coercion.d.ts +8 -0
  243. package/dist/server/param-coercion.d.ts.map +1 -1
  244. package/dist/server/pipeline-interception.d.ts +34 -4
  245. package/dist/server/pipeline-interception.d.ts.map +1 -1
  246. package/dist/server/pipeline-metadata-route.d.ts +24 -0
  247. package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
  248. package/dist/server/pipeline-metadata.d.ts +3 -2
  249. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  250. package/dist/server/pipeline-phases.d.ts +9 -3
  251. package/dist/server/pipeline-phases.d.ts.map +1 -1
  252. package/dist/server/pipeline.d.ts +18 -0
  253. package/dist/server/pipeline.d.ts.map +1 -1
  254. package/dist/server/prebuilt/dev-store.d.ts +68 -22
  255. package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
  256. package/dist/server/prebuilt/overlay.d.ts +17 -3
  257. package/dist/server/prebuilt/overlay.d.ts.map +1 -1
  258. package/dist/server/prebuilt-runtime.d.ts.map +1 -1
  259. package/dist/server/primitives.d.ts +13 -0
  260. package/dist/server/primitives.d.ts.map +1 -1
  261. package/dist/server/render-utils.d.ts +21 -0
  262. package/dist/server/render-utils.d.ts.map +1 -1
  263. package/dist/server/request-context.d.ts +14 -0
  264. package/dist/server/request-context.d.ts.map +1 -1
  265. package/dist/server/route-element-builder.d.ts.map +1 -1
  266. package/dist/server/route-handler.d.ts +7 -0
  267. package/dist/server/route-handler.d.ts.map +1 -1
  268. package/dist/server/route-matcher.d.ts +14 -3
  269. package/dist/server/route-matcher.d.ts.map +1 -1
  270. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  271. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  272. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  273. package/dist/server/signal-identity.d.ts +6 -0
  274. package/dist/server/signal-identity.d.ts.map +1 -1
  275. package/dist/server/traced-access.d.ts +18 -0
  276. package/dist/server/traced-access.d.ts.map +1 -0
  277. package/dist/server/tracing.d.ts.map +1 -1
  278. package/dist/server/types.d.ts +5 -4
  279. package/dist/server/types.d.ts.map +1 -1
  280. package/dist/shims/font-google.js +1 -2
  281. package/dist/shims/font-local.js +1 -2
  282. package/dist/shims/headers.d.ts +11 -4
  283. package/dist/shims/headers.d.ts.map +1 -1
  284. package/docs/api/30-api-server.mdx +3 -1
  285. package/docs/api/32-api-cache.mdx +1 -1
  286. package/docs/api/33-api-search-params.mdx +3 -1
  287. package/docs/api/34-api-config.mdx +22 -0
  288. package/docs/api/36-cli.mdx +72 -6
  289. package/docs/learn/01-quick-start.mdx +1 -1
  290. package/docs/learn/06-typed-params.mdx +4 -4
  291. package/docs/learn/10-caching.mdx +26 -5
  292. package/llms.txt +1 -1
  293. package/package.json +12 -12
  294. package/src/adapters/build-output-helper.ts +26 -4
  295. package/src/adapters/cloudflare.ts +1 -0
  296. package/src/adapters/nitro-presets.ts +15 -0
  297. package/src/adapters/nitro-preview.ts +66 -34
  298. package/src/adapters/nitro.ts +14 -6
  299. package/src/analyze/graph-command.ts +25 -133
  300. package/src/cache/guarded-read.ts +44 -0
  301. package/src/cache/key-discipline.ts +218 -0
  302. package/src/cache/timber-cache.ts +46 -7
  303. package/src/cli-dev-status.ts +196 -0
  304. package/src/cli-init.ts +278 -0
  305. package/src/cli.ts +33 -79
  306. package/src/client/error-boundary.tsx +19 -2
  307. package/src/client/global-context.ts +42 -14
  308. package/src/client/navigation-context.ts +4 -11
  309. package/src/client/params-context.ts +5 -17
  310. package/src/client/segment-update-context.ts +1 -1
  311. package/src/client/slot-content-cache-context.ts +1 -1
  312. package/src/client/slot-context.ts +6 -17
  313. package/src/client/use-cookie.ts +33 -21
  314. package/src/config-types.ts +22 -5
  315. package/src/config-validation.ts +17 -0
  316. package/src/cookies/define-cookie.ts +10 -46
  317. package/src/cookies/json-cookie.ts +4 -4
  318. package/src/plugin-context.ts +7 -0
  319. package/src/plugins/dev-discovery.ts +216 -6
  320. package/src/plugins/dev-hostname.ts +322 -0
  321. package/src/plugins/dev-server.ts +130 -37
  322. package/src/plugins/dev-store-clear.ts +145 -0
  323. package/src/plugins/graph-endpoint.ts +15 -3
  324. package/src/plugins/prebuilt.ts +9 -0
  325. package/src/rsc-runtime/rsc.ts +7 -3
  326. package/src/rsc-runtime/server-references.ts +73 -0
  327. package/src/rsc-runtime/vendor-types.d.ts +17 -0
  328. package/src/schema-bridge.ts +93 -38
  329. package/src/search-params/define.ts +5 -6
  330. package/src/search-params/wrappers.ts +3 -3
  331. package/src/server/access-gate.tsx +32 -20
  332. package/src/server/action-handler.ts +58 -36
  333. package/src/server/canonicalize.ts +27 -0
  334. package/src/server/cookie-context.ts +11 -3
  335. package/src/server/flight-source-node.ts +5 -2
  336. package/src/server/flight-source.ts +4 -3
  337. package/src/server/index.ts +6 -1
  338. package/src/server/interception-gates.ts +94 -0
  339. package/src/server/logger.ts +32 -0
  340. package/src/server/param-coercion.ts +22 -0
  341. package/src/server/pipeline-interception.ts +64 -4
  342. package/src/server/pipeline-metadata-route.ts +242 -0
  343. package/src/server/pipeline-metadata.ts +7 -5
  344. package/src/server/pipeline-phases.ts +71 -131
  345. package/src/server/pipeline.ts +20 -2
  346. package/src/server/prebuilt/dev-store.ts +113 -34
  347. package/src/server/prebuilt/overlay.ts +32 -4
  348. package/src/server/prebuilt-runtime.ts +63 -45
  349. package/src/server/primitives.ts +14 -0
  350. package/src/server/render-utils.ts +25 -0
  351. package/src/server/request-context.ts +27 -3
  352. package/src/server/route-element-builder.ts +15 -2
  353. package/src/server/route-handler.ts +3 -2
  354. package/src/server/route-matcher.ts +48 -33
  355. package/src/server/rsc-entry/api-handler.ts +2 -33
  356. package/src/server/rsc-entry/index.ts +8 -3
  357. package/src/server/rsc-entry/rsc-stream.ts +7 -1
  358. package/src/server/signal-identity.ts +30 -12
  359. package/src/server/traced-access.ts +50 -0
  360. package/src/server/tracing.ts +18 -1
  361. package/src/server/types.ts +5 -4
  362. package/src/shims/headers.ts +12 -4
  363. package/dist/_chunks/actions-BDqn4Oxj.js.map +0 -1
  364. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
  365. package/dist/_chunks/cache-api-GE4AOe2H.js.map +0 -1
  366. package/dist/_chunks/chains-CDK1AWZQ.js +0 -1
  367. package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
  368. package/dist/_chunks/dev-server-BiWNMBVU.js +0 -1
  369. package/dist/_chunks/dev-server-DIy-SY-J.js.map +0 -1
  370. package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
  371. package/dist/_chunks/flight-source-node-HptmGMT8.js.map +0 -1
  372. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
  373. package/dist/_chunks/logger-CbLdcy-W.js.map +0 -1
  374. package/dist/_chunks/node-response-rkQqcFGq.js.map +0 -1
  375. package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
  376. package/dist/_chunks/schema-bridge-C83xa9lT.js.map +0 -1
  377. package/dist/_chunks/segment-context-xtPUGfdq.js.map +0 -1
  378. package/dist/server/prebuilt/key-discipline.d.ts +0 -52
  379. package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
  380. package/src/server/prebuilt/key-discipline.ts +0 -122
@@ -74,6 +74,18 @@ export interface RouteMatch {
74
74
  rawSegmentParams: Record<string, string | string[]>;
75
75
  /** Middleware chain from the segment tree, ordered root-to-leaf. */
76
76
  middlewareChain: MiddlewareFn[];
77
+ /**
78
+ * The URL's own route, with coerced params, when this match renders an
79
+ * interception of it (either shape). Set by the pipeline only.
80
+ *
81
+ * The rendered chain is a different route, and nothing on it was written
82
+ * to protect this URL. So the URL's `middleware.ts` chain runs before
83
+ * render, and its `access.ts` files render as gates in this tree — those
84
+ * of segments the two chains do not share, placed around the deepest
85
+ * shared segment's layout (TIM-1607, design/07-routing.md §"Intercepting
86
+ * Routes"). A match with `canonical` set never nests another.
87
+ */
88
+ canonical?: RouteMatch;
77
89
  }
78
90
 
79
91
  /** Function that matches a canonical pathname to a route. */
@@ -153,6 +165,12 @@ export interface PipelineConfig {
153
165
  stripTrailingSlash?: boolean;
154
166
  /** Slow request threshold in ms. Requests exceeding this emit a warning. 0 to disable. Default: 3000. */
155
167
  slowRequestMs?: number;
168
+ /**
169
+ * The resolved `renderTimeoutMs`: the deadline for reading a dynamic
170
+ * metadata route's Response body before it is answered. Defaults to
171
+ * `DEFAULT_RENDER_TIMEOUT_MS` for direct callers.
172
+ */
173
+ renderTimeoutMs?: number;
156
174
  /**
157
175
  * Interception rewrites — conditional routes for the modal pattern.
158
176
  * Generated at build time from intercepting route directories.
@@ -529,8 +547,8 @@ export function createPipeline(config: PipelineConfig): (req: Request) => Promis
529
547
 
530
548
  // Append Server-Timing header based on configured mode.
531
549
  // Header mutability is guaranteed by the producer-side clone
532
- // in `outcomeToResponse` and the metadata-route / auto-sitemap
533
- // user-handler clones in `handleRequest`, so we can write
550
+ // in `outcomeToResponse`, `serveMetadataRoute`, and the
551
+ // auto-sitemap user-handler clone in `handleRequest`, so we can write
534
552
  // directly without a runtime probe. See TIM-866.
535
553
  if (serverTiming === 'detailed') {
536
554
  // Detailed: per-phase breakdown (proxy, middleware, render).
@@ -9,21 +9,30 @@
9
9
  * that. Runtime-tier entries (`ttl`/`tags`) keep using the cache-handler
10
10
  * overlay; in dev their keys carry this store's namespace (`overlayKey`).
11
11
  *
12
- * Invalidation is deliberately coarse: ANY dev-server watcher event clears
13
- * everything. The dev-server plugin sends `PREBUILT_DEV_CLEAR_EVENT` to the
14
- * RSC environment and the RSC entry calls `clearDevPrebuiltStore()`. There
15
- * is no per-component dependency tracking — the module graph misses files
16
- * read with `fs`, and one re-render per save is what dev used to pay on
17
- * every request. A clear does three things:
12
+ * Every dev-server watcher event clears the store. The dev-server plugin
13
+ * sends `PREBUILT_DEV_CLEAR_EVENT` to the RSC environment and the RSC entry
14
+ * calls `clearDevPrebuiltStore()` (plugins/dev-store-clear.ts, TIM-1599).
15
+ * A save of a file the RSC module graph knows is scoped: the event names
16
+ * the components declared in the saved module and its transitive
17
+ * importers, which are the only call sites whose code could have changed.
18
+ * Any other event (a file read with `fs`, an add or a delete) names none,
19
+ * and clears everything — the module graph never says who reads a file
20
+ * with `fs`. A clear
21
+ * does three things:
18
22
  *
19
- * 1. drops every seed;
20
- * 2. bumps the generation, which namespaces dev overlay keys, so
21
- * runtime-tier entries stored before the save become unreachable;
22
- * 3. records an invalidation of everything (`recordInvalidationOfAll`),
23
- * so a capture already in flight — which may have loaded the
24
- * pre-save code — is not stored, and a request arriving after the
25
- * save does not join that flight (the TIM-1028 guard every capture
26
- * path already runs).
23
+ * 1. drops the seeds of the named components and every ISR seed (every
24
+ * seed, unscoped);
25
+ * 2. bumps the generation, which namespaces dev overlay keys and
26
+ * `cache.data` keys, so EVERY runtime-tier and data entry stored
27
+ * before the save becomes unreachable, scoped or not. Those tiers are
28
+ * cheap to refill, and a data function's ID comes from its call site,
29
+ * so a scoped answer for them would need a dependency walk of its own;
30
+ * 3. records an invalidation of the named components (of everything,
31
+ * unscoped), so a capture of one already in flight — which may have
32
+ * loaded the pre-save code — is not stored, and a request arriving
33
+ * after the save does not join that flight (the TIM-1028 guard every
34
+ * capture path already runs). Captures of the other components are
35
+ * untouched.
27
36
  *
28
37
  * Inactive outside dev: production never enables it. Dev enables it only
29
38
  * when HMR is on — with `server.hmr: false` Vite delivers no watcher events
@@ -37,6 +46,14 @@ import { recordInvalidation, recordInvalidationOfAll } from '../../cache/invalid
37
46
  /** Custom HMR event the dev-server plugin sends to the RSC environment. */
38
47
  export const PREBUILT_DEV_CLEAR_EVENT = 'timber:prebuilt-dev-clear';
39
48
 
49
+ /**
50
+ * The `PREBUILT_DEV_CLEAR_EVENT` payload: the components whose seeds to
51
+ * drop. Absent means every component.
52
+ */
53
+ export interface DevStoreClear {
54
+ componentIds?: string[];
55
+ }
56
+
40
57
  /** One captured prerender-tier entry — the dev counterpart of a `.flight` seed. */
41
58
  export interface DevSeed {
42
59
  bytes: Uint8Array;
@@ -44,6 +61,11 @@ export interface DevSeed {
44
61
  tags: string[];
45
62
  /** Capture time; stands in for the manifest's buildTimestamp. */
46
63
  capturedAt: number;
64
+ /**
65
+ * The component also has a runtime lifetime (`ttl`/`tags`, ISR): its
66
+ * newer renders live in the overlay, which every clear moves on from.
67
+ */
68
+ isr: boolean;
47
69
  }
48
70
 
49
71
  /**
@@ -59,7 +81,10 @@ export type DevPrebuiltStoreMode = 'off' | 'active' | 'bypass';
59
81
 
60
82
  let mode: DevPrebuiltStoreMode = 'off';
61
83
  let generation = 0;
62
- const seeds = new Map<string, DevSeed>();
84
+ /** Components already announced by the one-time dev log. */
85
+ const loggedIds = new Set<string>();
86
+ /** Component ID → cache key → seed. */
87
+ const seeds = new Map<string, Map<string, DevSeed>>();
63
88
 
64
89
  /**
65
90
  * Distinguishes this process's overlay keys from a previous dev session's,
@@ -71,12 +96,15 @@ const seeds = new Map<string, DevSeed>();
71
96
  */
72
97
  let processToken: string | null = null;
73
98
 
74
- function seedKey(componentId: string, cacheKey: string): string {
75
- return `${componentId}:${cacheKey}`;
76
- }
77
-
78
- /** Set by the RSC entry in dev (and by tests). The store starts empty either way. */
99
+ /**
100
+ * Set by the RSC entry in dev (and by tests). A change of mode starts the
101
+ * store empty. Setting the same mode again keeps it: the RSC entry
102
+ * self-accepts, so it re-runs whenever anything it imports changes (with
103
+ * Tailwind, every source save reaches it through the CSS), and the save
104
+ * has already cleared what it could have changed.
105
+ */
79
106
  export function setDevPrebuiltStoreMode(next: DevPrebuiltStoreMode): void {
107
+ if (next === mode) return;
80
108
  mode = next;
81
109
  seeds.clear();
82
110
  }
@@ -116,37 +144,86 @@ export function devDataCacheKey(key: string): string {
116
144
  }
117
145
 
118
146
  export function getDevSeed(componentId: string, cacheKey: string): DevSeed | undefined {
119
- return seeds.get(seedKey(componentId, cacheKey));
147
+ return seeds.get(componentId)?.get(cacheKey);
120
148
  }
121
149
 
122
150
  /**
123
- * Store a captured seed. The caller has already checked that no clear (or
124
- * tag invalidation) happened while it was capturing.
151
+ * Store a captured seed, announcing the component's first one. The caller
152
+ * has already checked that no clear (or tag invalidation) happened while it
153
+ * was capturing.
125
154
  */
126
155
  export function setDevSeed(componentId: string, cacheKey: string, seed: DevSeed): void {
127
- seeds.set(seedKey(componentId, cacheKey), seed);
156
+ let entries = seeds.get(componentId);
157
+ if (!entries) seeds.set(componentId, (entries = new Map()));
158
+ entries.set(cacheKey, seed);
159
+ if (!loggedIds.has(componentId)) {
160
+ loggedIds.add(componentId);
161
+ console.log(
162
+ `[timber] cache.component "${componentId}": prerendered in dev — served from memory until ` +
163
+ `a file it depends on changes. A hard reload (Cache-Control: no-cache) renders it again.`
164
+ );
165
+ }
128
166
  }
129
167
 
130
- /** Drop everything — called on every dev-server watcher event. */
131
- export function clearDevPrebuiltStore(): void {
132
- seeds.clear();
168
+ /**
169
+ * An invalidation-epoch tag for one component (it never reaches a cache
170
+ * handler; the NUL keeps it apart from user tags), recorded when a scoped
171
+ * clear drops the component. Dev captures add it
172
+ * to their invalidation checks, so a scoped clear reaches a capture of the
173
+ * component that is in flight, including its first, which has no seed yet.
174
+ */
175
+ export function devComponentTag(componentId: string): string {
176
+ return `\u0000timber-dev-component:${componentId}`;
177
+ }
178
+
179
+ /**
180
+ * A source change: drop the seeds of `componentIds`, or of every component
181
+ * when absent. Every clear bumps the generation (see the header).
182
+ */
183
+ export function clearDevPrebuiltStore(componentIds?: Iterable<string>): void {
133
184
  generation++;
134
- recordInvalidationOfAll();
185
+ if (componentIds === undefined) {
186
+ seeds.clear();
187
+ recordInvalidationOfAll();
188
+ return;
189
+ }
190
+ for (const id of componentIds) {
191
+ recordInvalidation({ tag: devComponentTag(id) });
192
+ seeds.delete(id);
193
+ }
194
+ // An ISR seed is the base its overlay entries refresh. Kept while they
195
+ // become unreachable, it would serve a render older than the last one.
196
+ for (const entries of seeds.values()) {
197
+ for (const [cacheKey, seed] of entries) {
198
+ if (seed.isr) entries.delete(cacheKey);
199
+ }
200
+ }
201
+ }
202
+
203
+ /**
204
+ * The invalidation-epoch key dev captures of one entry check. Unlike the
205
+ * overlay key it carries no generation, like the seed it guards: a capture
206
+ * that a scoped clear kept in flight started under an older generation,
207
+ * and must still see a hard reload that comes after the clear.
208
+ */
209
+ export function devEntryKey(componentId: string, cacheKey: string): string {
210
+ return `\u0000timber-dev-entry:${componentId}:${cacheKey}`;
135
211
  }
136
212
 
137
213
  /**
138
214
  * A hard reload: discard one entry — its seed and its overlay record — so
139
- * the request renders it again. Recorded as an invalidation of its key
140
- * first, so a capture of it already in flight (which may have read the old
141
- * external data) neither stores nor is joined by this request.
215
+ * the request renders it again. Recorded as an invalidation of both its
216
+ * keys first, so a capture of it already in flight (which may have read the
217
+ * old external data) neither stores nor is joined by this request.
142
218
  */
143
219
  export async function discardDevEntry(
144
220
  componentId: string,
145
221
  cacheKey: string,
146
222
  overlayKey: string
147
223
  ): Promise<void> {
224
+ recordInvalidation({ key: devEntryKey(componentId, cacheKey) });
148
225
  recordInvalidation({ key: overlayKey });
149
- seeds.delete(seedKey(componentId, cacheKey));
226
+ seeds.get(componentId)?.delete(cacheKey);
150
227
  await getCacheHandler().invalidate({ key: overlayKey });
151
228
  }
152
229
 
@@ -156,8 +233,10 @@ export async function discardDevEntry(
156
233
  * mechanics) — the next request misses and captures again.
157
234
  */
158
235
  export function invalidateDevSeedsByTag(tag: string): void {
159
- for (const [key, seed] of seeds) {
160
- if (seed.tags.includes(tag)) seeds.delete(key);
236
+ for (const entries of seeds.values()) {
237
+ for (const [cacheKey, seed] of entries) {
238
+ if (seed.tags.includes(tag)) entries.delete(cacheKey);
239
+ }
161
240
  }
162
241
  }
163
242
 
@@ -15,6 +15,8 @@
15
15
 
16
16
  import { getCacheHandler, isCacheHandlerConfigured } from '../../cache/handler-store.ts';
17
17
  import { MemoryCacheHandler } from '../../cache/index.ts';
18
+ import { guardedRead } from '../../cache/guarded-read.ts';
19
+ import { wasInvalidatedSince } from '../../cache/invalidation-epoch.ts';
18
20
  import { getDeploymentId } from '../version-skew.ts';
19
21
  import { devOverlayNamespace } from './dev-store.ts';
20
22
  import { buildTagIndex, type SeedKeyInfo } from './manifest-tag-index.ts';
@@ -73,16 +75,41 @@ export function overlayKey(componentId: string, cacheKey: string): string {
73
75
  return `timber:c:${deploymentId}:${componentId}:${cacheKey}`;
74
76
  }
75
77
 
78
+ /**
79
+ * Whether a re-render that started at `startEpoch` may store its capture
80
+ * under `oKey`: nothing invalidated the key or its tags meanwhile
81
+ * (TIM-1028), and the overlay key has not moved on. In dev a save moves it
82
+ * to a new namespace, and the bytes may come from the pre-save code: stored,
83
+ * they would answer every request after the save.
84
+ */
85
+ export function mayStoreRerender(
86
+ startEpoch: number,
87
+ componentId: string,
88
+ cacheKey: string,
89
+ oKey: string,
90
+ tags: string[]
91
+ ): boolean {
92
+ return !wasInvalidatedSince(startEpoch, oKey, tags) && overlayKey(componentId, cacheKey) === oKey;
93
+ }
94
+
76
95
  // ─── Overlay read ────────────────────────────────────────────────────────
77
96
 
78
97
  export interface OverlayLookupResult {
79
- kind: 'fresh' | 'stale' | 'tombstone';
80
- /** The overlay value (null for tombstones). */
98
+ /**
99
+ * `unreadable`: the handler read threw or timed out (cache/guarded-read.ts).
100
+ * Not a miss — a miss falls through to the build seed, and the overlay the
101
+ * read could not reach may hold that seed's tombstone. The caller renders
102
+ * instead of trusting the seed.
103
+ */
104
+ kind: 'fresh' | 'stale' | 'tombstone' | 'unreadable';
105
+ /** The overlay value (null for tombstones and unreadable reads). */
81
106
  record: ComponentOverlayRecord | null;
82
- /** Raw flight payload bytes (decoded from base64). Null for tombstones. */
107
+ /** Raw flight payload bytes (decoded from base64). Null for tombstones and unreadable reads. */
83
108
  payload: Uint8Array | null;
84
109
  }
85
110
 
111
+ const READ_FAILED: unique symbol = Symbol('overlay read failed');
112
+
86
113
  /**
87
114
  * Look up an overlay entry in the cache handler.
88
115
  * Returns null on a clean miss (no overlay entry at all).
@@ -93,7 +120,8 @@ export async function lookupOverlay(
93
120
  ): Promise<OverlayLookupResult | null> {
94
121
  const handler = getCacheHandler();
95
122
  const key = overlayKey(componentId, cacheKey);
96
- const result = await handler.get(key);
123
+ const result = await guardedRead(key, () => handler.get(key), READ_FAILED);
124
+ if (result === READ_FAILED) return { kind: 'unreadable', record: null, payload: null };
97
125
  if (!result) return null;
98
126
 
99
127
  const value = result.value as OverlayValue;
@@ -46,11 +46,7 @@ import {
46
46
  withoutChildrenOutlet,
47
47
  wrapInSlotsProvider,
48
48
  } from './prebuilt/slots.ts';
49
- import {
50
- createKeyDisciplineProxy,
51
- emitKeyDisciplineWarning,
52
- shouldCheckKeyDiscipline,
53
- } from './prebuilt/key-discipline.ts';
49
+ import { observeKeyDiscipline } from '../cache/key-discipline.ts';
54
50
  import {
55
51
  createCaptureScope,
56
52
  isCaptureActive,
@@ -64,9 +60,16 @@ import {
64
60
  lookupArtifactSeed,
65
61
  type Seed,
66
62
  } from './prebuilt/payload-source.ts';
67
- import { lookupOverlay, storeOverlayEntry, overlayKey } from './prebuilt/overlay.ts';
63
+ import {
64
+ lookupOverlay,
65
+ mayStoreRerender,
66
+ storeOverlayEntry,
67
+ overlayKey,
68
+ } from './prebuilt/overlay.ts';
68
69
  import {
69
70
  clearDevPrebuiltStore,
71
+ devComponentTag,
72
+ devEntryKey,
70
73
  discardDevEntry,
71
74
  getDevSeed,
72
75
  isDevPrebuiltCacheBypassed,
@@ -77,6 +80,7 @@ import {
77
80
  import { renderEntry } from './prebuilt/capture-render.ts';
78
81
  import { BuildTimeContextError } from './prebuilt/synthetic-store.ts';
79
82
  import { getWaitUntil } from './waituntil-bridge.ts';
83
+ import { swallow } from './logger.ts';
80
84
  import { runBackgroundFlight } from './pipeline-helpers.ts';
81
85
  import { runOutsideReactCacheScope } from './react-cache-scope.ts';
82
86
  import { collectFlightBytes, type RenderFlight } from './flight-source.ts';
@@ -297,12 +301,6 @@ async function captureComponentPayload(
297
301
  // reports the component's own error rather than a stand-in.
298
302
  let renderError: { error: unknown } | undefined;
299
303
 
300
- // Key-discipline diagnostic (design/45 §Enforcement): proxy the ALS
301
- // store to detect request-context reads during the capture render.
302
- // The proxy is transparent — it never blocks or throws; it only observes.
303
- const store = requestContextAls.getStore();
304
- const discipline = store && shouldCheckKeyDiscipline(id) ? createKeyDisciplineProxy(store) : null;
305
-
306
304
  const doCapture = (): Promise<Uint8Array> =>
307
305
  capture.run(async () => {
308
306
  // Outside the request's React.cache scope: this payload is stored
@@ -329,13 +327,10 @@ async function captureComponentPayload(
329
327
  return bytes;
330
328
  });
331
329
 
332
- const bytes = discipline
333
- ? await requestContextAls.run(discipline.proxy, doCapture)
334
- : await doCapture();
335
-
336
- if (discipline && discipline.accessedApis.size > 0) {
337
- emitKeyDisciplineWarning(id, discipline.accessedApis);
338
- }
330
+ // Key-discipline diagnostic (design/45 §Enforcement): request-context
331
+ // reads during the capture render are reported, or rejected in strict mode
332
+ // so the tainted payload is never stored.
333
+ const bytes = await observeKeyDiscipline({ tier: 'cache.component', id }, doCapture);
339
334
 
340
335
  return { bytes, nested: capture.nestedRenders() };
341
336
  }
@@ -346,6 +341,10 @@ async function captureComponentPayload(
346
341
  * warning follows the store: a capture that is discarded (aborted,
347
342
  * invalidated mid-render, failed store) holds no clamped copy, and must
348
343
  * not spend the pair's one warning.
344
+ *
345
+ * A failed store is swallowed, like a failed `cache.data` write (TIM-1046):
346
+ * the captured payload is valid and still answers the request. Thrown, it
347
+ * would discard the capture and render the component a second time.
349
348
  */
350
349
  async function storeCapturedEntry(
351
350
  id: string,
@@ -355,7 +354,12 @@ async function storeCapturedEntry(
355
354
  tags: string[],
356
355
  hasSeed: boolean
357
356
  ): Promise<void> {
358
- await storeOverlayEntry(id, cacheKey, captured.bytes, { ttl: options.ttl, tags, hasSeed });
357
+ try {
358
+ await storeOverlayEntry(id, cacheKey, captured.bytes, { ttl: options.ttl, tags, hasSeed });
359
+ } catch (err) {
360
+ swallow(err, `cache.component overlay store failed for "${id}"`);
361
+ return;
362
+ }
359
363
  warnNestingClamps({ id, options, tags }, captured.nested, warnedNestingPairs, (m) =>
360
364
  console.warn(m)
361
365
  );
@@ -376,18 +380,20 @@ async function inlineRerender(
376
380
  ): Promise<{ element: unknown } | null> {
377
381
  const tags = resolveTags(options, props);
378
382
  const oKey = overlayKey(id, cacheKey);
379
- const sfKey = `prebuilt:${id}:${cacheKey}\0${lastInvalidationEpochFor(oKey, tags)}`;
383
+ // Keyed by the overlay key, which carries the dev namespace: a request
384
+ // after a save never joins a re-render of the pre-save code.
385
+ const sfKey = `prebuilt:${oKey}\0${lastInvalidationEpochFor(oKey, tags)}`;
380
386
 
381
387
  try {
382
388
  const payload = await componentSingleflight.do(sfKey, async (signal) => {
383
389
  const startEpoch = currentInvalidationEpoch();
384
390
  const captured = await captureComponentPayload(id, component, props, options);
385
391
  // Skip the store if aborted (singleflight timeout) or if the
386
- // key/tags were invalidated while rendering (TIM-1028 guard).
392
+ // key/tags were invalidated, or a dev save landed, while rendering.
387
393
  if (
388
394
  !signal.aborted &&
389
395
  hasRuntimeLifetime(options) &&
390
- !wasInvalidatedSince(startEpoch, oKey, tags)
396
+ mayStoreRerender(startEpoch, id, cacheKey, oKey, tags)
391
397
  ) {
392
398
  await storeCapturedEntry(id, cacheKey, captured, options, tags, hasSeed);
393
399
  }
@@ -439,7 +445,7 @@ function backgroundRerender(
439
445
  const tags = resolveTags(options, props);
440
446
  const oKey = overlayKey(id, cacheKey);
441
447
  const startEpoch = currentInvalidationEpoch();
442
- const sfKey = `prebuilt-bg:${id}:${cacheKey}\0${lastInvalidationEpochFor(oKey, tags)}`;
448
+ const sfKey = `prebuilt-bg:${oKey}\0${lastInvalidationEpochFor(oKey, tags)}`;
443
449
 
444
450
  const work = requestContextAls.run(snapshot, () =>
445
451
  componentSingleflight
@@ -451,7 +457,7 @@ function backgroundRerender(
451
457
  signal,
452
458
  async () => {
453
459
  const captured = await captureComponentPayload(id, component, props, options);
454
- if (!signal.aborted && !wasInvalidatedSince(startEpoch, oKey, tags)) {
460
+ if (!signal.aborted && mayStoreRerender(startEpoch, id, cacheKey, oKey, tags)) {
455
461
  await storeCapturedEntry(id, cacheKey, captured, options, tags, hasSeed);
456
462
  }
457
463
  },
@@ -479,9 +485,6 @@ function backgroundRerender(
479
485
  }
480
486
  }
481
487
 
482
- /** Components already announced by the one-time dev log. */
483
- const devLoggedIds = new Set<string>();
484
-
485
488
  /**
486
489
  * Dev: the seed for a prerender entry — the stored capture, or a new one
487
490
  * rendered exactly as the build would render it (synthetic store, isolated
@@ -504,10 +507,16 @@ async function resolveDevSeed(
504
507
  if (stored) return { payload: stored.bytes, capturedAt: stored.capturedAt };
505
508
 
506
509
  const tags = resolveTags(options, props);
507
- const oKey = overlayKey(id, cacheKey);
508
- // The epoch scopes the flight: a request after a source change (which
509
- // invalidates everything) never joins a capture of the old code.
510
- const sfKey = `prebuilt-dev:${id}:${cacheKey}\0${lastInvalidationEpochFor(oKey, tags)}`;
510
+ // A source change that drops this component invalidates its tag (or
511
+ // everything), and a hard reload its entry key, so the epoch scopes the
512
+ // flight: a request after either never joins a capture from before it. A
513
+ // save that keeps the component does not. Every save drops an ISR seed
514
+ // (prebuilt/dev-store.ts), so its capture is guarded like a re-render:
515
+ // on the overlay key, which every save moves.
516
+ const isr = hasRuntimeLifetime(options);
517
+ const guardKey = isr ? overlayKey(id, cacheKey) : devEntryKey(id, cacheKey);
518
+ const guardTags = [...tags, devComponentTag(id)];
519
+ const sfKey = `prebuilt-dev:${guardKey}\0${lastInvalidationEpochFor(guardKey, guardTags)}`;
511
520
  try {
512
521
  return await componentSingleflight.do(sfKey, async (signal) => {
513
522
  const startEpoch = currentInvalidationEpoch();
@@ -527,18 +536,17 @@ async function resolveDevSeed(
527
536
  }
528
537
  // A save (or revalidateTag) while this rendered: the bytes may come
529
538
  // from the old code, so this request gets them but the store does not.
530
- if (!signal.aborted && !wasInvalidatedSince(startEpoch, oKey, tags)) {
531
- setDevSeed(id, cacheKey, { bytes: outcome.bytes, tags, capturedAt });
539
+ const moved = isr && overlayKey(id, cacheKey) !== guardKey;
540
+ if (!signal.aborted && !moved && !wasInvalidatedSince(startEpoch, guardKey, guardTags)) {
541
+ setDevSeed(id, cacheKey, {
542
+ bytes: outcome.bytes,
543
+ tags,
544
+ capturedAt,
545
+ isr,
546
+ });
532
547
  warnNestingClamps({ id, options, tags }, outcome.nested, warnedNestingPairs, (m) =>
533
548
  console.warn(m)
534
549
  );
535
- if (!devLoggedIds.has(id)) {
536
- devLoggedIds.add(id);
537
- console.log(
538
- `[timber] cache.component "${id}": prerendered in dev — served from memory until ` +
539
- `a file changes. A hard reload (Cache-Control: no-cache) renders it again.`
540
- );
541
- }
542
550
  }
543
551
  return { payload: outcome.bytes, capturedAt };
544
552
  });
@@ -610,6 +618,7 @@ async function tryRevivePayload(
610
618
  }
611
619
 
612
620
  // ─── Step 1: Check overlay (CacheHandler) ─────────────────────────
621
+ let overlayUnreadable = false;
613
622
  if (hasRuntime) {
614
623
  const overlayResult = await lookupOverlay(id, cacheKey);
615
624
  if (overlayResult) {
@@ -617,6 +626,10 @@ async function tryRevivePayload(
617
626
  if (overlayResult.kind === 'tombstone') {
618
627
  return await inlineRerender(id, component, props, cacheKey, options, true, outcome);
619
628
  }
629
+ // Unreadable is decided after the seed lookup: the seed says whether
630
+ // this key was ever enumerated (a strict miss must still throw), but
631
+ // its bytes can't be served — the overlay may hold its tombstone.
632
+ overlayUnreadable = overlayResult.kind === 'unreadable';
620
633
  if (overlayResult.kind === 'fresh' && overlayResult.payload) {
621
634
  return await revivePayload(id, overlayResult.payload, outcome);
622
635
  }
@@ -654,6 +667,10 @@ async function tryRevivePayload(
654
667
  : hasSource
655
668
  ? await lookupArtifactSeed(id, cacheKey, options.ttl !== undefined)
656
669
  : null;
670
+ if (seed !== null && overlayUnreadable) {
671
+ // Render, as for a tombstone (design/06 §Store failures).
672
+ return await inlineRerender(id, component, props, cacheKey, options, true, outcome);
673
+ }
657
674
  if (seed !== null) {
658
675
  // Check seed freshness when the component has a TTL.
659
676
  if (options.ttl !== undefined) {
@@ -737,12 +754,13 @@ export function __prebuilt<C extends ServerComponent>(
737
754
  const registration: PrebuiltRegistration = { id, component, options };
738
755
  if (isDevPrebuiltStoreActive()) {
739
756
  // Dev: a second registration of an ID means its module re-evaluated,
740
- // so some code in this subtree changed. Clear rather than trust that
741
- // the watcher event already did (it may land after this request
742
- // rendered). Dev keeps only the ID: nothing walks the registry there,
757
+ // so some code in this subtree changed. Drop its entries rather than
758
+ // trust that the watcher event already did (it may land after this
759
+ // request rendered). Only its own: every module whose code could have
760
+ // changed with it re-evaluates too, and drops its own. Dev keeps only the ID: nothing walks the registry there,
743
761
  // and an edited call site gets a new ID, so holding registrations
744
762
  // would pin every superseded component and its module for the session.
745
- if (devRegisteredIds.has(id)) clearDevPrebuiltStore();
763
+ if (devRegisteredIds.has(id)) clearDevPrebuiltStore([id]);
746
764
  devRegisteredIds.add(id);
747
765
  } else {
748
766
  registry.set(id, registration);
@@ -141,6 +141,20 @@ export class DenySignal extends Error {
141
141
  */
142
142
  _hardNavigate?: boolean;
143
143
 
144
+ /**
145
+ * When true, no boundary in the tree that threw this may place it: the
146
+ * denying gate guards a segment of the URL's own route that the rendered
147
+ * tree does not contain, so none of its deny pages, nor their layouts, are
148
+ * here. Set by the gate an intercepted navigation renders for each such
149
+ * segment (TIM-1607), together with `_hardNavigate`.
150
+ *
151
+ * Flight's `onError` does not late-address it, and its row carries
152
+ * `leaveSpa`, which every client boundary declines but the terminal, which
153
+ * leaves the SPA — so the document request for the URL renders the URL's
154
+ * own deny page with its real status, wherever the deny lands in time.
155
+ */
156
+ _leaveSpa?: boolean;
157
+
144
158
  constructor(status: number, data?: JsonSerializable) {
145
159
  super(`Access denied with status ${status}`);
146
160
  this.name = 'DenySignal';
@@ -18,14 +18,39 @@ export function nonceAttr(nonce: string | undefined): string {
18
18
  return nonce ? ` nonce="${nonce}"` : '';
19
19
  }
20
20
 
21
+ /**
22
+ * The reason to abort a render with when its consumer releases it.
23
+ *
24
+ * The framework releases a Flight render it no longer needs — the renderer
25
+ * once a deny or redirect is captured, a tee once either branch is done —
26
+ * usually without a reason. React then reports the abort to the render's
27
+ * `onError` as a plain `Error("The render was aborted by the server without a
28
+ * reason.")`, which reads as an application failure: a `metadata()` that
29
+ * denies while the page is still fetching logged an unhandled render error
30
+ * (TIM-1597). An `AbortError` is what {@link isAbortError} already treats as
31
+ * not-an-error. A reason the caller did pass (a timeout, the tee's divergence
32
+ * guard) is kept, so those still reach the log.
33
+ */
34
+ export function releaseReason(reason: unknown): unknown {
35
+ return reason ?? new DOMException('The render was released by its consumer.', 'AbortError');
36
+ }
37
+
21
38
  /**
22
39
  * Check if an error is an abort error (connection closed by client).
23
40
  *
24
41
  * When the browser aborts a request (page refresh, navigation away),
25
42
  * the AbortSignal fires and React/streams throw an AbortError. This
26
43
  * is not an application error — suppress it from error boundaries and logs.
44
+ *
45
+ * A native `ReadableStream.tee()` cancels its source with an array of both
46
+ * branches' reasons (Streams spec, ReadableStreamDefaultTee), so a Web
47
+ * render released through a tee is aborted with `[reason1, reason2]`. That is
48
+ * an abort when every entry is — a tee whose branches were both released
49
+ * ({@link releaseReason}) — and an error when any entry is, such as the
50
+ * divergence guard's.
27
51
  */
28
52
  export function isAbortError(error: unknown): boolean {
53
+ if (Array.isArray(error)) return error.length > 0 && error.every(isAbortError);
29
54
  if (error instanceof DOMException && error.name === 'AbortError') return true;
30
55
  if (error instanceof Error && error.name === 'AbortError') return true;
31
56
  return false;
@@ -211,12 +211,36 @@ export function runWithSlotSegmentParams<T>(
211
211
  ): T {
212
212
  const store = requestContextAls.getStore();
213
213
  if (!store?.segmentParams) return fn();
214
+ return runWithSegmentParams(
215
+ slotSegmentPath ?? store.matchedSegmentPath,
216
+ mergeSlotParams(store.segmentParams, slotParams),
217
+ fn
218
+ );
219
+ }
214
220
 
215
- const merged = mergeSlotParams(store.segmentParams, slotParams);
216
- const matchedSegmentPath = slotSegmentPath ?? store.matchedSegmentPath;
221
+ /**
222
+ * Run `fn` with exactly these segment params, and this matched segment
223
+ * path, standing in for the main route's — what a no-arg
224
+ * `getSegmentParams()` returns inside it.
225
+ *
226
+ * The parallel-slot scope above is one use. The other is an intercepted
227
+ * navigation (TIM-1607): the URL's own middleware and access.ts run while the
228
+ * request publishes the *rendered* route's params, and each must see the
229
+ * params of the route it was written for. Same Proxy, for the same reason:
230
+ * every write still reaches the live store.
231
+ *
232
+ * @internal — framework use only
233
+ */
234
+ export function runWithSegmentParams<T>(
235
+ matchedSegmentPath: string | undefined,
236
+ segmentParams: CoercedParams,
237
+ fn: () => T
238
+ ): T {
239
+ const store = requestContextAls.getStore();
240
+ if (!store) return fn();
217
241
  const scoped = new Proxy(store, {
218
242
  get(target, prop, receiver) {
219
- if (prop === 'segmentParams') return merged;
243
+ if (prop === 'segmentParams') return segmentParams;
220
244
  if (prop === 'matchedSegmentPath') return matchedSegmentPath;
221
245
  return Reflect.get(target, prop, receiver);
222
246
  },