@timber-js/app 0.2.0-alpha.222 → 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 (354) hide show
  1. package/agent-skill.md +21 -5
  2. package/dist/_chunks/{actions-vBHr2vqd.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-DdcDLpBj.js → cache-api-TDZ4hlDc.js} +190 -38
  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-BchW_AtW.js → chains-Dgm3PrMe.js} +3 -4
  20. package/dist/_chunks/{chains-BchW_AtW.js.map → chains-Dgm3PrMe.js.map} +1 -1
  21. package/dist/_chunks/{classify-IqzMpxMs.js → classify--_kINHQV.js} +4 -5
  22. package/dist/_chunks/{classify-IqzMpxMs.js.map → classify--_kINHQV.js.map} +1 -1
  23. package/dist/_chunks/{cli-check-DQne_YhU.js → cli-check-Dv3f8d2j.js} +5 -6
  24. package/dist/_chunks/{cli-check-DQne_YhU.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-BS-RFGE2.js → cli-schema-sync-DIPurq7X.js} +4 -5
  33. package/dist/_chunks/{cli-schema-sync-BS-RFGE2.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
  34. package/dist/_chunks/{cli-schema-sync-v872sHms.js → cli-schema-sync-uq72EZmD.js} +1 -1
  35. package/dist/_chunks/{client-dep-entries-BJyP9SIu.js → client-dep-entries-CP7AkMCM.js} +4 -5
  36. package/dist/_chunks/{client-dep-entries-BJyP9SIu.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-VwzrtjIt.js → convention-lint-hZwz5wd4.js} +8 -11
  44. package/dist/_chunks/{convention-lint-VwzrtjIt.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-BNr5drEO.js → dev-server-C61GWpGg.js} +369 -55
  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-BdHUOUqg.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-B9PFncvb.js → global-context-DbxNWeBP.js} +2 -3
  65. package/dist/_chunks/{global-context-B9PFncvb.js.map → global-context-DbxNWeBP.js.map} +1 -1
  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-C3Sht92C.js → json-lossy-check-DVkLUlfC.js} +3 -4
  71. package/dist/_chunks/{json-lossy-check-C3Sht92C.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
  72. package/dist/_chunks/{live-graph-DEu_GWbc.js → live-graph-BcVjQ1Te.js} +6 -7
  73. package/dist/_chunks/{live-graph-DEu_GWbc.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
  74. package/dist/_chunks/{logger-CI_hThfy.js → logger-CWk44DLp.js} +89 -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-bF0bKoig.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-DTWIfNgD.js → poison-scan-DJYxZc_7.js} +4 -5
  90. package/dist/_chunks/{poison-scan-DTWIfNgD.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-Ln_u7fX-.js → render-timeout-MrrqD1wd.js} +2 -3
  94. package/dist/_chunks/{render-timeout-Ln_u7fX-.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
  95. package/dist/_chunks/{resolve-schema-CkAInout.js → resolve-schema-B-aCuTu3.js} +3 -4
  96. package/dist/_chunks/{resolve-schema-CkAInout.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-C8fdKvKG.js → scanner-CJC-ScJU.js} +15 -23
  106. package/dist/_chunks/{scanner-C8fdKvKG.js.map → scanner-CJC-ScJU.js.map} +1 -1
  107. package/dist/_chunks/{schema-bridge-DpOmvZlI.js → schema-bridge-DyRs3cqy.js} +2 -3
  108. package/dist/_chunks/{schema-bridge-DpOmvZlI.js.map → schema-bridge-DyRs3cqy.js.map} +1 -1
  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-D3DNxKFq.js → segment-context-CYiGTi3K.js} +4 -6
  112. package/dist/_chunks/{segment-context-D3DNxKFq.js.map → segment-context-CYiGTi3K.js.map} +1 -1
  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-CO3dk0V1.js → sizeof-DG4W40lv.js} +3 -4
  118. package/dist/_chunks/{sizeof-CO3dk0V1.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-BqzxnwGC.js → walkers-DIE203ir.js} +6 -8
  130. package/dist/_chunks/{walkers-BqzxnwGC.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/index.js +3 -3
  151. package/dist/cache/key-discipline.d.ts +61 -0
  152. package/dist/cache/key-discipline.d.ts.map +1 -0
  153. package/dist/cache/stores/cloudflare-kv.js +1 -2
  154. package/dist/cache/stores/memory.js +2 -3
  155. package/dist/cache/stores/redis.js +1 -2
  156. package/dist/cache/stores/vercel.js +1 -2
  157. package/dist/cache/timber-cache.d.ts +5 -1
  158. package/dist/cache/timber-cache.d.ts.map +1 -1
  159. package/dist/cdn/cloudflare-purge.js +1 -2
  160. package/dist/cdn/fastly-purge.js +1 -2
  161. package/dist/cdn/index.js +2 -3
  162. package/dist/cdn/workers-cache-purge.js +3 -5
  163. package/dist/cdn/workers-cache-purge.js.map +1 -1
  164. package/dist/cli-dev-status.d.ts +75 -0
  165. package/dist/cli-dev-status.d.ts.map +1 -0
  166. package/dist/cli-init.d.ts +72 -0
  167. package/dist/cli-init.d.ts.map +1 -0
  168. package/dist/cli.d.ts +4 -12
  169. package/dist/cli.d.ts.map +1 -1
  170. package/dist/cli.js +27 -54
  171. package/dist/cli.js.map +1 -1
  172. package/dist/client/error-boundary.d.ts.map +1 -1
  173. package/dist/client/error-boundary.js +1 -1
  174. package/dist/client/index.js +22 -34
  175. package/dist/client/index.js.map +1 -1
  176. package/dist/client/internal.js +13 -18
  177. package/dist/client/internal.js.map +1 -1
  178. package/dist/client/use-cookie.d.ts +18 -5
  179. package/dist/client/use-cookie.d.ts.map +1 -1
  180. package/dist/codec.js +2 -3
  181. package/dist/config-types.d.ts +22 -5
  182. package/dist/config-types.d.ts.map +1 -1
  183. package/dist/config-validation.d.ts.map +1 -1
  184. package/dist/cookies/define-cookie.d.ts.map +1 -1
  185. package/dist/cookies/index.js +40 -67
  186. package/dist/cookies/index.js.map +1 -1
  187. package/dist/cookies/json-cookie.d.ts +4 -4
  188. package/dist/index.js +266 -229
  189. package/dist/index.js.map +1 -1
  190. package/dist/params/index.js +3 -4
  191. package/dist/plugin-context.d.ts +7 -0
  192. package/dist/plugin-context.d.ts.map +1 -1
  193. package/dist/plugins/dev-discovery.d.ts +69 -5
  194. package/dist/plugins/dev-discovery.d.ts.map +1 -1
  195. package/dist/plugins/dev-hostname.d.ts +152 -0
  196. package/dist/plugins/dev-hostname.d.ts.map +1 -0
  197. package/dist/plugins/dev-server.d.ts +5 -1
  198. package/dist/plugins/dev-server.d.ts.map +1 -1
  199. package/dist/plugins/dev-store-clear.d.ts +59 -4
  200. package/dist/plugins/dev-store-clear.d.ts.map +1 -1
  201. package/dist/plugins/graph-endpoint.d.ts +4 -2
  202. package/dist/plugins/graph-endpoint.d.ts.map +1 -1
  203. package/dist/plugins/prebuilt.d.ts.map +1 -1
  204. package/dist/routing/index.js +4 -4
  205. package/dist/rsc-runtime/rsc.d.ts +2 -1
  206. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  207. package/dist/rsc-runtime/server-references.d.ts +8 -0
  208. package/dist/rsc-runtime/server-references.d.ts.map +1 -0
  209. package/dist/search-params/index.js +5 -7
  210. package/dist/search-params/index.js.map +1 -1
  211. package/dist/server/access-gate.d.ts +12 -0
  212. package/dist/server/access-gate.d.ts.map +1 -1
  213. package/dist/server/canonicalize.d.ts +21 -0
  214. package/dist/server/canonicalize.d.ts.map +1 -1
  215. package/dist/server/cookie-context.d.ts +8 -1
  216. package/dist/server/cookie-context.d.ts.map +1 -1
  217. package/dist/server/flight-source-node.d.ts.map +1 -1
  218. package/dist/server/flight-source.d.ts.map +1 -1
  219. package/dist/server/index.d.ts +1 -1
  220. package/dist/server/index.d.ts.map +1 -1
  221. package/dist/server/index.js +8 -13
  222. package/dist/server/index.js.map +1 -1
  223. package/dist/server/interception-gates.d.ts +49 -0
  224. package/dist/server/interception-gates.d.ts.map +1 -0
  225. package/dist/server/internal.js +1061 -943
  226. package/dist/server/internal.js.map +1 -1
  227. package/dist/server/logger.d.ts +17 -0
  228. package/dist/server/logger.d.ts.map +1 -1
  229. package/dist/server/param-coercion.d.ts +8 -0
  230. package/dist/server/param-coercion.d.ts.map +1 -1
  231. package/dist/server/pipeline-interception.d.ts +34 -4
  232. package/dist/server/pipeline-interception.d.ts.map +1 -1
  233. package/dist/server/pipeline-metadata-route.d.ts +24 -0
  234. package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
  235. package/dist/server/pipeline-metadata.d.ts +3 -2
  236. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  237. package/dist/server/pipeline-phases.d.ts +9 -3
  238. package/dist/server/pipeline-phases.d.ts.map +1 -1
  239. package/dist/server/pipeline.d.ts +18 -0
  240. package/dist/server/pipeline.d.ts.map +1 -1
  241. package/dist/server/prebuilt/dev-store.d.ts +68 -22
  242. package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
  243. package/dist/server/prebuilt/overlay.d.ts +8 -0
  244. package/dist/server/prebuilt/overlay.d.ts.map +1 -1
  245. package/dist/server/prebuilt-runtime.d.ts.map +1 -1
  246. package/dist/server/primitives.d.ts +13 -0
  247. package/dist/server/primitives.d.ts.map +1 -1
  248. package/dist/server/render-utils.d.ts +21 -0
  249. package/dist/server/render-utils.d.ts.map +1 -1
  250. package/dist/server/request-context.d.ts +14 -0
  251. package/dist/server/request-context.d.ts.map +1 -1
  252. package/dist/server/route-element-builder.d.ts.map +1 -1
  253. package/dist/server/route-handler.d.ts +7 -0
  254. package/dist/server/route-handler.d.ts.map +1 -1
  255. package/dist/server/route-matcher.d.ts +14 -3
  256. package/dist/server/route-matcher.d.ts.map +1 -1
  257. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  258. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  259. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  260. package/dist/server/signal-identity.d.ts +6 -0
  261. package/dist/server/signal-identity.d.ts.map +1 -1
  262. package/dist/server/traced-access.d.ts +18 -0
  263. package/dist/server/traced-access.d.ts.map +1 -0
  264. package/dist/server/tracing.d.ts.map +1 -1
  265. package/dist/server/types.d.ts +5 -4
  266. package/dist/server/types.d.ts.map +1 -1
  267. package/dist/shims/font-google.js +1 -2
  268. package/dist/shims/font-local.js +1 -2
  269. package/dist/shims/headers.d.ts +11 -4
  270. package/dist/shims/headers.d.ts.map +1 -1
  271. package/docs/api/30-api-server.mdx +3 -1
  272. package/docs/api/32-api-cache.mdx +1 -1
  273. package/docs/api/34-api-config.mdx +22 -0
  274. package/docs/api/36-cli.mdx +72 -6
  275. package/docs/learn/01-quick-start.mdx +1 -1
  276. package/docs/learn/06-typed-params.mdx +2 -2
  277. package/docs/learn/10-caching.mdx +26 -5
  278. package/llms.txt +1 -1
  279. package/package.json +12 -12
  280. package/src/adapters/build-output-helper.ts +26 -4
  281. package/src/adapters/cloudflare.ts +1 -0
  282. package/src/adapters/nitro-presets.ts +15 -0
  283. package/src/adapters/nitro-preview.ts +66 -34
  284. package/src/adapters/nitro.ts +14 -6
  285. package/src/analyze/graph-command.ts +25 -133
  286. package/src/cache/key-discipline.ts +218 -0
  287. package/src/cache/timber-cache.ts +42 -5
  288. package/src/cli-dev-status.ts +196 -0
  289. package/src/cli-init.ts +278 -0
  290. package/src/cli.ts +33 -79
  291. package/src/client/error-boundary.tsx +19 -2
  292. package/src/client/use-cookie.ts +33 -21
  293. package/src/config-types.ts +22 -5
  294. package/src/config-validation.ts +17 -0
  295. package/src/cookies/define-cookie.ts +10 -46
  296. package/src/cookies/json-cookie.ts +4 -4
  297. package/src/plugin-context.ts +7 -0
  298. package/src/plugins/dev-discovery.ts +216 -6
  299. package/src/plugins/dev-hostname.ts +322 -0
  300. package/src/plugins/dev-server.ts +96 -37
  301. package/src/plugins/dev-store-clear.ts +105 -7
  302. package/src/plugins/graph-endpoint.ts +15 -3
  303. package/src/plugins/prebuilt.ts +9 -0
  304. package/src/rsc-runtime/rsc.ts +7 -3
  305. package/src/rsc-runtime/server-references.ts +73 -0
  306. package/src/rsc-runtime/vendor-types.d.ts +9 -0
  307. package/src/server/access-gate.tsx +32 -20
  308. package/src/server/action-handler.ts +40 -34
  309. package/src/server/canonicalize.ts +27 -0
  310. package/src/server/cookie-context.ts +11 -3
  311. package/src/server/flight-source-node.ts +5 -2
  312. package/src/server/flight-source.ts +4 -3
  313. package/src/server/index.ts +6 -1
  314. package/src/server/interception-gates.ts +94 -0
  315. package/src/server/logger.ts +23 -0
  316. package/src/server/param-coercion.ts +22 -0
  317. package/src/server/pipeline-interception.ts +64 -4
  318. package/src/server/pipeline-metadata-route.ts +242 -0
  319. package/src/server/pipeline-metadata.ts +7 -5
  320. package/src/server/pipeline-phases.ts +71 -131
  321. package/src/server/pipeline.ts +20 -2
  322. package/src/server/prebuilt/dev-store.ts +113 -34
  323. package/src/server/prebuilt/overlay.ts +18 -0
  324. package/src/server/prebuilt-runtime.ts +43 -44
  325. package/src/server/primitives.ts +14 -0
  326. package/src/server/render-utils.ts +25 -0
  327. package/src/server/request-context.ts +27 -3
  328. package/src/server/route-element-builder.ts +15 -2
  329. package/src/server/route-handler.ts +3 -2
  330. package/src/server/route-matcher.ts +48 -33
  331. package/src/server/rsc-entry/api-handler.ts +2 -33
  332. package/src/server/rsc-entry/index.ts +8 -3
  333. package/src/server/rsc-entry/rsc-stream.ts +7 -1
  334. package/src/server/signal-identity.ts +30 -12
  335. package/src/server/traced-access.ts +50 -0
  336. package/src/server/tracing.ts +18 -1
  337. package/src/server/types.ts +5 -4
  338. package/src/shims/headers.ts +12 -4
  339. package/dist/_chunks/actions-vBHr2vqd.js.map +0 -1
  340. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
  341. package/dist/_chunks/cache-api-DdcDLpBj.js.map +0 -1
  342. package/dist/_chunks/chains-B8TCLved.js +0 -1
  343. package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
  344. package/dist/_chunks/dev-server-BNr5drEO.js.map +0 -1
  345. package/dist/_chunks/dev-server-CUg7Mqh_.js +0 -1
  346. package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
  347. package/dist/_chunks/flight-source-node-BdHUOUqg.js.map +0 -1
  348. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
  349. package/dist/_chunks/logger-CI_hThfy.js.map +0 -1
  350. package/dist/_chunks/node-response-bF0bKoig.js.map +0 -1
  351. package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
  352. package/dist/server/prebuilt/key-discipline.d.ts +0 -52
  353. package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
  354. package/src/server/prebuilt/key-discipline.ts +0 -122
@@ -1,5 +1,6 @@
1
1
  /**
2
- * graph-endpoint — `GET /__timber/graph` on the dev server.
2
+ * graph-endpoint — `GET /__timber/graph` (and the `GET /__timber/status`
3
+ * identity probe) on the dev server.
3
4
  *
4
5
  * The fast path of design/47: when a dev server runs, the env module
5
6
  * graphs are already resident and classification is a lookup. Serves
@@ -38,6 +39,7 @@ import { isAbsolute, join, relative, resolve } from 'node:path';
38
39
  import type { PluginContext } from '../plugin-context.ts';
39
40
  import { buildSourceExtensions, isScannableSourceFile } from '../analyze/scan.ts';
40
41
  import { GRAPH_JSON_VERSION } from '../analyze/graph-cache.ts';
42
+ import { STATUS_ENDPOINT_PATH } from './dev-discovery.ts';
41
43
 
42
44
  export const GRAPH_ENDPOINT_PATH = '/__timber/graph';
43
45
 
@@ -159,7 +161,8 @@ function reflectCors(res: ServerResponse, origin: string | undefined): void {
159
161
  }
160
162
 
161
163
  /**
162
- * Create the Connect middleware handling GET /__timber/graph.
164
+ * Create the Connect middleware handling GET /__timber/graph and the
165
+ * GET /__timber/status identity probe.
163
166
  *
164
167
  * Query surface: `?file=<path>` (absolute or project-root-relative) or
165
168
  * `?all=1`. Anything else is a 400 — fail loudly, like the CLI.
@@ -175,7 +178,8 @@ export function createGraphEndpointMiddleware(server: ViteDevServer, ctx: Plugin
175
178
  return;
176
179
  }
177
180
  const url = new URL(rawUrl, 'http://placeholder.invalid');
178
- if (url.pathname !== GRAPH_ENDPOINT_PATH) {
181
+ const isStatus = url.pathname === STATUS_ENDPOINT_PATH;
182
+ if (!isStatus && url.pathname !== GRAPH_ENDPOINT_PATH) {
179
183
  sendJson(res, 404, { error: `unknown /__timber/ endpoint: ${url.pathname}` });
180
184
  return;
181
185
  }
@@ -205,6 +209,14 @@ export function createGraphEndpointMiddleware(server: ViteDevServer, ctx: Plugin
205
209
  // consumers can actually READ the response.
206
210
  reflectCors(res, origin);
207
211
 
212
+ // Identity probe for `timber dev status` (dev-discovery.ts): the pid
213
+ // lets the CLI confirm this is the server that wrote the record, not
214
+ // a different process that took a crashed server's port.
215
+ if (isStatus) {
216
+ sendJson(res, 200, { pid: process.pid });
217
+ return;
218
+ }
219
+
208
220
  try {
209
221
  // Lazy import: the analyze pipeline (oxc parse, chains) loads on
210
222
  // first query, not on every dev-server boot.
@@ -420,6 +420,14 @@ export function timberPrebuilt(ctx: PluginContext): Plugin & { api: PrebuiltBuil
420
420
  moduleComponents.delete(id);
421
421
  bindingNames.delete(id);
422
422
  }
423
+ // Dev: the same, for the dev store's scoped clears. A save reaches the
424
+ // watcher before the module is transformed again, so the clear for a
425
+ // save drops the IDs the module declared before it.
426
+ const devIds =
427
+ ctx.dev && this?.environment?.name === 'rsc'
428
+ ? (ctx.devPrebuiltComponentIds ??= new Map())
429
+ : null;
430
+ devIds?.delete(id);
423
431
  if (!code.includes('@timber-js/app/cache') && !code.includes('timber/cache')) return;
424
432
  // Skip node_modules (don't transform third-party code)
425
433
  if (id.includes('node_modules')) return;
@@ -468,6 +476,7 @@ export function timberPrebuilt(ctx: PluginContext): Plugin & { api: PrebuiltBuil
468
476
  // Only prerender-capable call sites feed the capture attribution —
469
477
  // runtime-tier components (ttl/tags only) must do no build work.
470
478
  if (!ctx.dev && mayPrerender(call)) componentIds.push(componentId);
479
+ if (devIds) devIds.set(id, [...(devIds.get(id) ?? []), componentId]);
471
480
 
472
481
  s.overwrite(call.callee.start, call.callee.end, '__prebuilt');
473
482
  s.appendLeft(call.arguments[0].start, `${JSON.stringify(componentId)}, `);
@@ -10,8 +10,9 @@
10
10
  * touches the RSC runtime.
11
11
  *
12
12
  * Keep this as thin pass-through re-exports — the value is the single choke
13
- * point, not abstraction. The exception is `renderFlight`, the only way to
14
- * render Flight (render-flight.ts). Bound-args encryption is plugin-rsc's
13
+ * point, not abstraction. The exceptions are `renderFlight`, the only way to
14
+ * render Flight (render-flight.ts), and `loadServerAction`, which tells an
15
+ * unknown reference from a broken module (server-references.ts). Bound-args encryption is plugin-rsc's
15
16
  * injected runtime, resolved to encryption-runtime.ts so it renders through
16
17
  * `renderFlight` too.
17
18
  */
@@ -21,8 +22,11 @@ import { scopeReferenceCacheToGeneration } from './dev-reference-cache.ts';
21
22
  // The only way to render Flight; see render-flight.ts.
22
23
  export { renderFlight } from './render-flight.ts';
23
24
 
25
+ // Resolves an unknown reference to undefined instead of rejecting, so a
26
+ // rejection means a real module failed to load; see server-references.ts.
27
+ export { loadServerAction } from './server-references.ts';
28
+
24
29
  export {
25
- loadServerAction,
26
30
  decodeReply,
27
31
  decodeAction,
28
32
  // No-JS action result → the `useActionState` hook that submitted it
@@ -0,0 +1,73 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="@vitejs/plugin-rsc/types" />
3
+ // Declares the server-reference virtual for projects that typecheck this
4
+ // file without the package tsconfig (the website).
5
+ /// <reference path="./vendor-types.d.ts" />
6
+
7
+ /**
8
+ * Load a server action by reference ID, telling a reference that does not
9
+ * exist apart from a module that fails to load (TIM-1601).
10
+ *
11
+ * plugin-rsc's `loadServerAction` rejects the same way for both: an unknown
12
+ * module ID throws from its reference lookup, and a real `'use server'`
13
+ * module that fails to import throws from the import. The first is a client
14
+ * error, the second a server fault, and the error message is the only thing
15
+ * that differs. So the lookup is asked first, through the same table
16
+ * plugin-rsc's loader reads, and an unknown module resolves to `undefined`:
17
+ * what plugin-rsc already resolves for an unknown export of a known module.
18
+ * A rejection from the load itself is then a real failure.
19
+ */
20
+
21
+ import { loadServerAction as loadServerReference } from '@vitejs/plugin-rsc/rsc';
22
+ import serverReferences from 'virtual:vite-rsc/server-references';
23
+
24
+ /**
25
+ * Whether plugin-rsc knows `moduleId` as a `'use server'` module.
26
+ *
27
+ * - Build: the keys of `virtual:vite-rsc/server-references`, the table
28
+ * plugin-rsc's build loader indexes. Own keys only: the table is a plain
29
+ * object, so `constructor` would otherwise be found on its prototype.
30
+ * - Dev: plugin-rsc's reference-validation virtual, which its dev loader
31
+ * imports before the module itself, and which fails for a module ID it has
32
+ * no server-reference metadata for (after transforming the file once, so a
33
+ * module no render has reached yet is still found). plugin-rsc swallows
34
+ * the transform's own error, so a module that fails to transform in the
35
+ * RSC environment (a syntax error, a non-async export) counts as unknown
36
+ * here too, and is answered with a 400 and a warning. When an RSC render
37
+ * imports the module, that render reports the error. When only a client
38
+ * component imports it, nothing does until the production build fails on
39
+ * it. Any other rejection of this import (the environment closing during a
40
+ * restart) is likewise read as unknown. These cases are dev-only: a build
41
+ * never contains a module that failed to transform.
42
+ */
43
+ async function isServerReferenceModule(moduleId: string): Promise<boolean> {
44
+ if (import.meta.env.__vite_rsc_build__) {
45
+ return Object.hasOwn(serverReferences, moduleId);
46
+ }
47
+ try {
48
+ // The ID plugin-rsc's dev loader imports (`toReferenceValidationVirtual`
49
+ // in its plugins/shared.ts), which it does not export.
50
+ await import(
51
+ /* @vite-ignore */
52
+ '/@id/__x00__virtual:vite-rsc/reference-validation?type=server&id=' +
53
+ encodeURIComponent(moduleId) +
54
+ '&lang.js'
55
+ );
56
+ return true;
57
+ } catch {
58
+ return false;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * The export `id` (`<module>#<export>`) names, or `undefined` when the module
64
+ * or the export does not exist. Rejects only when a known module fails to
65
+ * load. The value is not checked: the caller decides whether it is a server
66
+ * function.
67
+ */
68
+ export async function loadServerAction(id: string): Promise<unknown> {
69
+ // Split at `#` as plugin-rsc's `loadServerAction` does.
70
+ const [moduleId] = id.split('#');
71
+ if (!(await isServerReferenceModule(moduleId))) return undefined;
72
+ return loadServerReference(id);
73
+ }
@@ -5,6 +5,15 @@ declare module 'virtual:vite-rsc/encryption-key' {
5
5
  export default encryptionKey;
6
6
  }
7
7
 
8
+ // plugin-rsc's server-reference table (its `vite-rsc/server-references`
9
+ // virtual): reference key → module loader in a build, read by
10
+ // server-references.ts. In dev the virtual exports nothing, so this is
11
+ // undefined there and is read only behind `__vite_rsc_build__`.
12
+ declare module 'virtual:vite-rsc/server-references' {
13
+ const serverReferences: Record<string, () => Promise<Record<string, unknown>>>;
14
+ export default serverReferences;
15
+ }
16
+
8
17
  // src renders through plugin-rsc's wrappers (rsc-runtime/rsc.ts); tests stand
9
18
  // in the vendored servers for them, with an empty client manifest.
10
19
  declare module '@vitejs/plugin-rsc/vendor/react-server-dom/server.node' {
@@ -15,7 +15,7 @@
15
15
 
16
16
  import { DenySignal, RedirectSignal } from './primitives.ts';
17
17
  import { isDenySignal, isRedirectSignal } from './signal-identity.ts';
18
- import { withSpan, setSpanAttribute } from './tracing.ts';
18
+ import { runTracedAccess } from './traced-access.ts';
19
19
  import { isDebug } from './debug.ts';
20
20
  import type { DenyPageEntry } from './deny-boundary.ts';
21
21
  import { handleCaughtDeny, setFirstDeniedSegmentIndex } from './deny-boundary.ts';
@@ -79,6 +79,15 @@ export interface AccessGateProps {
79
79
  * return rscErrorEnvelope for a client hard-navigate.
80
80
  */
81
81
  skippedSegment?: boolean;
82
+ /**
83
+ * When true, this gate guards a segment of the URL's own route that is not
84
+ * in the rendered tree — an intercepted navigation renders one for each
85
+ * (TIM-1607). On deny it marks the signal `_leaveSpa` and rethrows: no
86
+ * deny page of that segment can render here, so the client leaves the SPA
87
+ * and the document request answers. Never set with `denyPages` or
88
+ * `segmentIndex`, which describe positions in the rendered chain.
89
+ */
90
+ outsideTree?: boolean;
82
91
  children: ReactNode;
83
92
  }
84
93
 
@@ -128,10 +137,21 @@ export interface SlotAccessGateProps {
128
137
  * in-tree — the client's cached layout chrome would wrap them incorrectly.
129
138
  * Instead, the deny is recorded in ALS and rethrown so the response path
130
139
  * can return rscErrorEnvelope for a client hard-navigate.
140
+ *
141
+ * For a segment outside the rendered tree (outsideTree=true), see
142
+ * `DenySignal._leaveSpa`.
131
143
  */
132
144
  export function AccessGate(props: AccessGateProps): Promise<ReactNode> {
133
- const { accessFn, segmentName, segmentKey, segmentIndex, denyPages, skippedSegment, children } =
134
- props;
145
+ const {
146
+ accessFn,
147
+ segmentName,
148
+ segmentKey,
149
+ segmentIndex,
150
+ denyPages,
151
+ skippedSegment,
152
+ outsideTree,
153
+ children,
154
+ } = props;
135
155
 
136
156
  return accessGateFallback(
137
157
  accessFn,
@@ -140,6 +160,7 @@ export function AccessGate(props: AccessGateProps): Promise<ReactNode> {
140
160
  segmentIndex,
141
161
  skippedSegment ? undefined : denyPages,
142
162
  skippedSegment,
163
+ outsideTree,
143
164
  children
144
165
  );
145
166
  }
@@ -155,32 +176,23 @@ async function accessGateFallback(
155
176
  segmentIndex: AccessGateProps['segmentIndex'],
156
177
  denyPages: DenyPageEntry[] | undefined,
157
178
  skippedSegment: boolean | undefined,
179
+ outsideTree: boolean | undefined,
158
180
  children: ReactNode
159
181
  ): Promise<ReactNode> {
160
182
  try {
161
- await withSpan('timber.access', { 'timber.segment': segmentName ?? 'unknown' }, async () => {
162
- try {
163
- await accessFn();
164
- await setSpanAttribute('timber.result', 'pass');
165
- } catch (error: unknown) {
166
- if (isDenySignal(error)) {
167
- await setSpanAttribute('timber.result', 'deny');
168
- await setSpanAttribute('timber.deny_status', error.status);
169
- if (error.sourceFile) {
170
- await setSpanAttribute('timber.deny_file', error.sourceFile);
171
- }
172
- } else if (isRedirectSignal(error)) {
173
- await setSpanAttribute('timber.result', 'redirect');
174
- }
175
- throw error;
176
- }
177
- });
183
+ await runTracedAccess(accessFn, segmentName);
178
184
  } catch (error: unknown) {
179
185
  if (isDenySignal(error)) {
180
186
  if (segmentIndex !== undefined) {
181
187
  setFirstDeniedSegmentIndex(segmentIndex);
182
188
  }
183
189
 
190
+ if (outsideTree) {
191
+ error._hardNavigate = true;
192
+ error._leaveSpa = true;
193
+ throw error;
194
+ }
195
+
184
196
  if (skippedSegment) {
185
197
  error._hardNavigate = true;
186
198
  throw error;
@@ -37,7 +37,7 @@ import type { ReactFormState } from 'react-dom/client';
37
37
  import { encodeErrorDigest } from '../shared/error-digest.ts';
38
38
  import { clientErrorMessage } from './client-error-message.ts';
39
39
  import { checkVersionSkew, applyReloadHeaders } from './version-skew.ts';
40
- import { logActionError, swallow } from './logger.ts';
40
+ import { logActionError, logActionRejected, swallow } from './logger.ts';
41
41
  import { fireOnRequestError } from './pipeline-helpers.ts';
42
42
  import { withTimeout, RenderTimeoutError, DEFAULT_RENDER_TIMEOUT_MS } from './render-timeout.ts';
43
43
  import { canonicalize } from './canonicalize.ts';
@@ -268,29 +268,29 @@ async function reportRevalidationErrors(req: Request, errors: readonly unknown[]
268
268
  }
269
269
 
270
270
  /**
271
- * Answer an action request that failed before the action ran with a bare
272
- * status, never a 200 action-error payload: a fabricated action id must not
273
- * look like an action that ran (tests/e2e/security.test.ts). Either way it
274
- * is logged and reported to `onRequestError` as phase `'action'` (TIM-1537).
271
+ * Answer an action request the client got wrong with a bare 400, never a 200
272
+ * action-error payload: a fabricated action id must not look like an action
273
+ * that ran (tests/e2e/security.test.ts). The request is wrong in a way the
274
+ * handler can see for itself: the reference names no server function, or the
275
+ * body will not parse, decode, or decode to an argument list.
275
276
  *
276
- * The status is chosen by what failed, not by matching error messages:
277
- * - **400**: the request is wrong in a way the handler can see for itself.
278
- * The body will not parse or decode, or the reference resolves to
279
- * something that is not a function.
280
- * - **500**: loading the action module failed. plugin-rsc rejects the same
281
- * way for an unknown reference and for a real module that fails to import
282
- * or evaluate, and the second is a server fault, so the load failure keeps
283
- * the 5xx it had before this change. The no-JS path cannot make this
284
- * split (`decodeAction` decodes and loads in one call) and answers 400;
285
- * see `handleFormAction`.
277
+ * Any client can send these, so they are logged at warn with the reason and
278
+ * no stack, and are not reported to `onRequestError`: an error tracker would
279
+ * otherwise record whatever a client makes up (TIM-1601). A known action
280
+ * module that fails to load is the server's fault, and `decodeRscActionCall`
281
+ * answers it with a 500 and reports it. Two loads cannot be split that way
282
+ * and land here: a server function passed as an argument, which
283
+ * `decodeReply` loads, and the no-JS action, which `decodeAction` loads.
284
+ * Their module's error is still the logged reason.
286
285
  */
287
- async function rejectActionRequest(
288
- req: Request,
289
- error: unknown,
290
- status: 400 | 500
291
- ): Promise<Response> {
292
- await reportActionError(req, error);
293
- return new Response(null, { status });
286
+ function rejectActionRequest(req: Request, reason: unknown): Response {
287
+ logActionRejected({
288
+ method: req.method,
289
+ path: new URL(req.url).pathname,
290
+ status: 400,
291
+ reason: reason instanceof Error ? reason.message : String(reason),
292
+ });
293
+ return new Response(null, { status: 400 });
294
294
  }
295
295
 
296
296
  /**
@@ -340,8 +340,9 @@ function isServerReference(value: unknown): value is (...args: unknown[]) => Pro
340
340
  /**
341
341
  * Load the action by reference ID and decode its args from the request body
342
342
  * (RSC wire format). Returns a Response for a request that fails before the
343
- * action can run: see `rejectActionRequest` for the status, and the field
344
- * limit for its own.
343
+ * action can run: a 400 for the client's mistakes (`rejectActionRequest`),
344
+ * a 500 for a known action module that fails to load, and the field limit's
345
+ * own status.
345
346
  */
346
347
  async function decodeRscActionCall(
347
348
  req: Request,
@@ -352,11 +353,15 @@ async function decodeRscActionCall(
352
353
  try {
353
354
  loaded = await loadServerAction(actionId);
354
355
  } catch (error) {
355
- return rejectActionRequest(req, error, 500);
356
+ // The module exists but failed to import or evaluate: a server fault.
357
+ // An unknown module does not get here; it loads as undefined (below).
358
+ await reportActionError(req, error);
359
+ return new Response(null, { status: 500 });
356
360
  }
357
361
  if (!isServerReference(loaded)) {
358
- // The module loaded but has no such export: a reference the client made up.
359
- return rejectActionRequest(req, new Error(`Unknown server action "${actionId}"`), 400);
362
+ // No such module or export, or not a server function: a reference the
363
+ // client made up.
364
+ return rejectActionRequest(req, `Unknown server action "${actionId}"`);
360
365
  }
361
366
  const actionFn = loaded;
362
367
 
@@ -377,13 +382,13 @@ async function decodeRscActionCall(
377
382
  decoded = await decodeReply(await req.text());
378
383
  }
379
384
  } catch (error) {
380
- return rejectActionRequest(req, error, 400);
385
+ return rejectActionRequest(req, error);
381
386
  }
382
387
  // The client always encodes an argument list. Anything else would fail
383
388
  // when `executeAction` spreads it, inside the action's own catch, and
384
389
  // come back as a 200 INTERNAL_ERROR for what is the caller's mistake.
385
390
  if (!Array.isArray(decoded)) {
386
- return rejectActionRequest(req, new Error('Server action body is not an argument list'), 400);
391
+ return rejectActionRequest(req, 'Server action body is not an argument list');
387
392
  }
388
393
  return { actionFn, args: decoded };
389
394
  }
@@ -620,7 +625,7 @@ async function handleFormAction(
620
625
  try {
621
626
  formData = await req.clone().formData();
622
627
  } catch (error) {
623
- return rejectActionRequest(req, error, 400);
628
+ return rejectActionRequest(req, error);
624
629
  }
625
630
 
626
631
  // Enforce field count limit after parsing FormData.
@@ -641,10 +646,11 @@ async function handleFormAction(
641
646
  // decodeAction both decodes the form's `$ACTION_REF_` metadata and loads
642
647
  // the module, and React does not say which failed. On a no-JS POST that
643
648
  // metadata is written by React into the form, so a failure is almost
644
- // always a forged or truncated request: 400. A module that genuinely
645
- // fails to import also breaks the RSC render of the page holding the
646
- // form, which surfaces it as a 500 there.
647
- return rejectActionRequest(req, error, 400);
649
+ // always a forged or truncated request: 400, logged at warn with the
650
+ // error as the reason. A module that genuinely fails to import also
651
+ // breaks the RSC render of a page that imports it, which reports it; an
652
+ // action module only a client component imports gets the warning alone.
653
+ return rejectActionRequest(req, error);
648
654
  }
649
655
  if (!actionFn) {
650
656
  return null;
@@ -120,3 +120,30 @@ export function canonicalRequestPath(rawPathname: string, stripTrailingSlash = t
120
120
  }
121
121
  return pathname;
122
122
  }
123
+
124
+ /**
125
+ * Build a request's URL from its origin and its raw request target, or
126
+ * return null when the result is not a URL (the caller answers 400).
127
+ *
128
+ * An origin-form target (`/path`) is concatenated, not resolved against the
129
+ * origin: resolved as a relative reference, `//evil.com/` names another host,
130
+ * and the pipeline would see `/` instead of the path it must redirect to
131
+ * `/evil.com` (TIM-1571). Any other form is resolved against the origin:
132
+ * the asterisk-form `OPTIONS *` becomes `/*`, and an absolute-form target
133
+ * (`GET http://host/a`) keeps only its path and query. Its scheme and
134
+ * authority are the client's word, not the connection's: they would stand in
135
+ * for the Host that the dev server's allowedHosts check and CSRF read, and a
136
+ * non-http scheme (`foo://x/`) makes an opaque origin the pipeline cannot
137
+ * build URLs from, so that is null too.
138
+ *
139
+ * Shared by the dev server and the Nitro preview server (which ships this
140
+ * file as `_canonicalize.mjs`), so the two cannot disagree about which path a
141
+ * request target names. Production adapters build the URL in their own
142
+ * runtime (srvx for Nitro).
143
+ */
144
+ export function requestTargetUrl(origin: string, target: string): URL | null {
145
+ if (target.startsWith('/')) return URL.parse(origin + target);
146
+ const resolved = URL.parse(target, origin);
147
+ if (resolved?.protocol !== 'http:' && resolved?.protocol !== 'https:') return null;
148
+ return URL.parse(origin + resolved.pathname + resolved.search);
149
+ }
@@ -185,7 +185,7 @@ export function getCookieJar(): RequestCookies {
185
185
  }
186
186
  },
187
187
 
188
- delete(name: string, options?: Pick<CookieOptions, 'path' | 'domain'>): void {
188
+ delete(name: string, options?: CookieDeleteOptions): void {
189
189
  assertMutable(store, 'delete');
190
190
  // Validate the name even though delete writes an empty value — a
191
191
  // smuggled name (`;` or CR/LF) would corrupt the Set-Cookie header
@@ -208,7 +208,7 @@ export function getCookieJar(): RequestCookies {
208
208
  expires: new Date(0),
209
209
  };
210
210
  // delete() is a jar entry point like set() — caller-supplied
211
- // path/domain are serialized verbatim into the Set-Cookie header,
211
+ // attributes are serialized verbatim into the Set-Cookie header,
212
212
  // so they must pass the same attribute-injection guard. See
213
213
  // design/29-cookies.md §"Cookie Attribute Validation" (TIM-1026).
214
214
  assertValidCookieOptions(opts);
@@ -300,6 +300,14 @@ export interface CookieOptions {
300
300
  partitioned?: boolean;
301
301
  }
302
302
 
303
+ /**
304
+ * Options for deleting a cookie: every attribute but the lifetime, which
305
+ * delete() forces to the past. Pass the attributes the cookie was set with —
306
+ * a partitioned cookie is only removed by a deletion that is also
307
+ * `Partitioned`, since browsers keep it in a separate jar (TIM-1606).
308
+ */
309
+ export type CookieDeleteOptions = Omit<CookieOptions, 'maxAge' | 'expires'>;
310
+
303
311
  /**
304
312
  * Cookie accessor returned by `getCookies()`.
305
313
  *
@@ -340,7 +348,7 @@ export interface RequestCookies {
340
348
  */
341
349
  setFromHeaders(headers: Headers): void;
342
350
  /** Delete a cookie. Only available in mutable contexts. */
343
- delete(name: string, options?: Pick<CookieOptions, 'path' | 'domain'>): void;
351
+ delete(name: string, options?: CookieDeleteOptions): void;
344
352
  /** Delete all cookies. Only available in mutable contexts. */
345
353
  clear(): void;
346
354
  /** Serialize cookies as a Cookie header string. */
@@ -21,6 +21,7 @@ import { NodeBodyResponse } from './node-body-response.ts';
21
21
  import { DEFAULT_MAX_BUFFER_BYTES, teeBufferExceeded } from './stream-utils.ts';
22
22
  import { onAbortUntil } from './abort-scope.ts';
23
23
  import { RenderTimeoutError } from './render-timeout.ts';
24
+ import { releaseReason } from './render-utils.ts';
24
25
 
25
26
  // `String.prototype.toWellFormed` ships in every Node timber supports
26
27
  // (engines: >=22.18) but is ES2024, past the project's ES2022 lib; this file
@@ -110,8 +111,10 @@ export function pipeFlightToNode(
110
111
  destroy(error, callback) {
111
112
  scope.abort();
112
113
  clearTimeout(timer);
113
- // A no-op once Flight has finished (it ignores abort after close).
114
- flight.abort(error ?? undefined);
114
+ // A no-op once Flight has finished (it ignores abort after close). A
115
+ // release without a reason aborts with an AbortError, so the render's
116
+ // onError does not log the abort (releaseReason, TIM-1597).
117
+ flight.abort(releaseReason(error));
115
118
  callback(error);
116
119
  },
117
120
  });
@@ -23,6 +23,7 @@
23
23
 
24
24
  import type { Readable } from 'node:stream';
25
25
  import { nodeStreamsPlatform } from './node-streams-platform.ts';
26
+ import { releaseReason } from './render-utils.ts';
26
27
  import {
27
28
  concatBytes,
28
29
  drainWithDeadline,
@@ -157,7 +158,7 @@ export function openFlightReader(source: FlightSource): FlightReader {
157
158
  return {
158
159
  read: () => reader.read(),
159
160
  takeBuffered: () => [],
160
- cancel: (reason) => void reader.cancel(reason).catch(() => {}),
161
+ cancel: (reason) => void reader.cancel(releaseReason(reason)).catch(() => {}),
161
162
  };
162
163
  }
163
164
  const { destroyNodeFlight } = requireNodeFlight();
@@ -186,7 +187,7 @@ export function openFlightReader(source: FlightSource): FlightReader {
186
187
  /** Release a source nothing will read, aborting the render behind it. */
187
188
  export function cancelFlightSource(source: FlightSource, reason?: unknown): void {
188
189
  if (source.kind === 'web') {
189
- source.stream.cancel(reason).catch(() => {});
190
+ source.stream.cancel(releaseReason(reason)).catch(() => {});
190
191
  return;
191
192
  }
192
193
  requireNodeFlight().destroyNodeFlight(source.stream, reason);
@@ -281,7 +282,7 @@ export function peekFlight(source: FlightSource): FlightPeek {
281
282
  else controller.enqueue(result.value);
282
283
  },
283
284
  cancel(reason) {
284
- return reader.cancel(reason);
285
+ return reader.cancel(releaseReason(reason));
285
286
  },
286
287
  });
287
288
  return { ready, source: { kind: 'web', stream } };
@@ -18,7 +18,12 @@ export type { ReadonlyHeaders } from './request-context.ts';
18
18
  // Cookie Context — ALS-backed getCookieJar() escape hatch
19
19
  // Design doc: design/29-cookies.md
20
20
  export { getCookieJar } from './cookie-context.ts';
21
- export type { RequestCookies, CookieOptions, SetCookieOptions } from './cookie-context.ts';
21
+ export type {
22
+ RequestCookies,
23
+ CookieOptions,
24
+ CookieDeleteOptions,
25
+ SetCookieOptions,
26
+ } from './cookie-context.ts';
22
27
 
23
28
  // Runtime primitives
24
29
  export {
@@ -0,0 +1,94 @@
1
+ /**
2
+ * The URL's own access gates in an intercepted tree (TIM-1607).
3
+ *
4
+ * An intercepted navigation renders a different route than its URL names —
5
+ * the source route with the target in a slot, or the owner's chain through
6
+ * its intercepting child. The response is still for the URL, so the URL's
7
+ * whole `access.ts` chain gates it, in the one render, as one group of gates
8
+ * at the top of the tree:
9
+ *
10
+ * ```
11
+ * [Gate(/) → Gate(secret) → Gate(secret/[id])] → root layout → … → Gate(feed) → …
12
+ * ```
13
+ *
14
+ * The whole chain, shared segments included, for two reasons:
15
+ *
16
+ * - **Params.** Each gate must read the URL's params. A shared segment's
17
+ * in-tree gate reads the rendered route's, and in the modal shape those come
18
+ * from re-matching `interceptingPrefix`, a pattern — a shared `[org]` reads
19
+ * the literal `'[org]'`, not `'acme'`.
20
+ * - **Coverage.** Nothing renders outside the top of the tree. Placed any
21
+ * lower, the gates miss whatever an ancestor layout renders beside them —
22
+ * a modal slot is a prop of its owner's layout, and the rendered chain can
23
+ * continue past the owner through a route group the target shares
24
+ * (`app/@modal/(.)secret/[id]` over `app/(main)/page.tsx`).
25
+ *
26
+ * The shared segments' in-tree gates are dropped (`sharedCount`), so each
27
+ * access.ts still runs once, outer → inner: the URL's chain, then the gates
28
+ * only the rendered chain has.
29
+ *
30
+ * Each gate is marked `outsideTree`: the URL's deny pages, and the layouts
31
+ * they render in, are not this tree's, so a deny leaves the SPA for the URL's
32
+ * document instead of being placed here. See `DenySignal._leaveSpa`,
33
+ * design/07-routing.md §"Intercepting Routes".
34
+ */
35
+
36
+ import type React from 'react';
37
+ import { AccessGate } from './access-gate.tsx';
38
+ import type { RouteMatch } from './pipeline.ts';
39
+ import { runWithRouteParams } from './pipeline-interception.ts';
40
+ import { loadModule } from './safe-load.ts';
41
+
42
+ export interface InterceptionGates {
43
+ /**
44
+ * How many segments, from the root, the rendered chain shares with the
45
+ * URL's route. Their access.ts runs in the group; the builder gives them no
46
+ * gate of their own.
47
+ */
48
+ sharedCount: number;
49
+ /** Wrap the whole tree in the URL's gates, outermost first. */
50
+ wrap(
51
+ element: React.ReactElement,
52
+ h: (...args: unknown[]) => React.ReactElement
53
+ ): React.ReactElement;
54
+ }
55
+
56
+ /** The gates an intercepted match needs, or null when it is not intercepted. */
57
+ export async function loadInterceptionGates(match: RouteMatch): Promise<InterceptionGates | null> {
58
+ const canonical = match.canonical;
59
+ if (!canonical) return null;
60
+
61
+ // Both chains are paths from the manifest root through one tree, so the
62
+ // segments they share are exactly a common prefix.
63
+ const rendered = match.segments;
64
+ let sharedCount = 0;
65
+ while (
66
+ sharedCount < rendered.length &&
67
+ sharedCount < canonical.segments.length &&
68
+ rendered[sharedCount] === canonical.segments[sharedCount]
69
+ ) {
70
+ sharedCount++;
71
+ }
72
+
73
+ const gates: Array<{ segmentName: string; accessFn: () => unknown }> = [];
74
+ for (const segment of canonical.segments) {
75
+ if (!segment.access) continue;
76
+ const mod = await loadModule(segment.access);
77
+ const accessFn = mod.default as (() => unknown) | undefined;
78
+ if (!accessFn) continue;
79
+ gates.push({
80
+ segmentName: segment.segmentName,
81
+ accessFn: () => runWithRouteParams(canonical, accessFn),
82
+ });
83
+ }
84
+
85
+ return {
86
+ sharedCount,
87
+ wrap(element, h) {
88
+ for (let i = gates.length - 1; i >= 0; i--) {
89
+ element = h(AccessGate, { ...gates[i], outsideTree: true, children: element });
90
+ }
91
+ return element;
92
+ },
93
+ };
94
+ }