@timber-js/app 0.2.0-alpha.222 → 0.2.0-alpha.224

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 (362) 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-B7o4As0l.js} +383 -55
  48. package/dist/_chunks/dev-server-B7o4As0l.js.map +1 -0
  49. package/dist/_chunks/dev-server-hZzmbMvK.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 +40 -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.d.ts.map +1 -1
  189. package/dist/index.js +698 -237
  190. package/dist/index.js.map +1 -1
  191. package/dist/params/index.js +3 -4
  192. package/dist/plugin-context.d.ts +7 -0
  193. package/dist/plugin-context.d.ts.map +1 -1
  194. package/dist/plugins/dev-discovery.d.ts +69 -5
  195. package/dist/plugins/dev-discovery.d.ts.map +1 -1
  196. package/dist/plugins/dev-hostname.d.ts +152 -0
  197. package/dist/plugins/dev-hostname.d.ts.map +1 -0
  198. package/dist/plugins/dev-server.d.ts +5 -1
  199. package/dist/plugins/dev-server.d.ts.map +1 -1
  200. package/dist/plugins/dev-store-clear.d.ts +59 -4
  201. package/dist/plugins/dev-store-clear.d.ts.map +1 -1
  202. package/dist/plugins/graph-endpoint.d.ts +4 -2
  203. package/dist/plugins/graph-endpoint.d.ts.map +1 -1
  204. package/dist/plugins/optimize-package-imports-defaults.d.ts +13 -0
  205. package/dist/plugins/optimize-package-imports-defaults.d.ts.map +1 -0
  206. package/dist/plugins/optimize-package-imports.d.ts +113 -0
  207. package/dist/plugins/optimize-package-imports.d.ts.map +1 -0
  208. package/dist/plugins/prebuilt.d.ts.map +1 -1
  209. package/dist/routing/index.js +4 -4
  210. package/dist/rsc-runtime/rsc.d.ts +2 -1
  211. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  212. package/dist/rsc-runtime/server-references.d.ts +8 -0
  213. package/dist/rsc-runtime/server-references.d.ts.map +1 -0
  214. package/dist/search-params/index.js +5 -7
  215. package/dist/search-params/index.js.map +1 -1
  216. package/dist/server/access-gate.d.ts +12 -0
  217. package/dist/server/access-gate.d.ts.map +1 -1
  218. package/dist/server/canonicalize.d.ts +21 -0
  219. package/dist/server/canonicalize.d.ts.map +1 -1
  220. package/dist/server/cookie-context.d.ts +8 -1
  221. package/dist/server/cookie-context.d.ts.map +1 -1
  222. package/dist/server/flight-source-node.d.ts.map +1 -1
  223. package/dist/server/flight-source.d.ts.map +1 -1
  224. package/dist/server/index.d.ts +1 -1
  225. package/dist/server/index.d.ts.map +1 -1
  226. package/dist/server/index.js +8 -13
  227. package/dist/server/index.js.map +1 -1
  228. package/dist/server/interception-gates.d.ts +49 -0
  229. package/dist/server/interception-gates.d.ts.map +1 -0
  230. package/dist/server/internal.js +1061 -943
  231. package/dist/server/internal.js.map +1 -1
  232. package/dist/server/logger.d.ts +17 -0
  233. package/dist/server/logger.d.ts.map +1 -1
  234. package/dist/server/param-coercion.d.ts +8 -0
  235. package/dist/server/param-coercion.d.ts.map +1 -1
  236. package/dist/server/pipeline-interception.d.ts +34 -4
  237. package/dist/server/pipeline-interception.d.ts.map +1 -1
  238. package/dist/server/pipeline-metadata-route.d.ts +24 -0
  239. package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
  240. package/dist/server/pipeline-metadata.d.ts +3 -2
  241. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  242. package/dist/server/pipeline-phases.d.ts +9 -3
  243. package/dist/server/pipeline-phases.d.ts.map +1 -1
  244. package/dist/server/pipeline.d.ts +18 -0
  245. package/dist/server/pipeline.d.ts.map +1 -1
  246. package/dist/server/prebuilt/dev-store.d.ts +68 -22
  247. package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
  248. package/dist/server/prebuilt/overlay.d.ts +8 -0
  249. package/dist/server/prebuilt/overlay.d.ts.map +1 -1
  250. package/dist/server/prebuilt-runtime.d.ts.map +1 -1
  251. package/dist/server/primitives.d.ts +13 -0
  252. package/dist/server/primitives.d.ts.map +1 -1
  253. package/dist/server/render-utils.d.ts +21 -0
  254. package/dist/server/render-utils.d.ts.map +1 -1
  255. package/dist/server/request-context.d.ts +14 -0
  256. package/dist/server/request-context.d.ts.map +1 -1
  257. package/dist/server/route-element-builder.d.ts.map +1 -1
  258. package/dist/server/route-handler.d.ts +7 -0
  259. package/dist/server/route-handler.d.ts.map +1 -1
  260. package/dist/server/route-matcher.d.ts +14 -3
  261. package/dist/server/route-matcher.d.ts.map +1 -1
  262. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  263. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  264. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  265. package/dist/server/signal-identity.d.ts +6 -0
  266. package/dist/server/signal-identity.d.ts.map +1 -1
  267. package/dist/server/traced-access.d.ts +18 -0
  268. package/dist/server/traced-access.d.ts.map +1 -0
  269. package/dist/server/tracing.d.ts.map +1 -1
  270. package/dist/server/types.d.ts +5 -4
  271. package/dist/server/types.d.ts.map +1 -1
  272. package/dist/shims/font-google.js +1 -2
  273. package/dist/shims/font-local.js +1 -2
  274. package/dist/shims/headers.d.ts +11 -4
  275. package/dist/shims/headers.d.ts.map +1 -1
  276. package/docs/api/30-api-server.mdx +3 -1
  277. package/docs/api/32-api-cache.mdx +1 -1
  278. package/docs/api/34-api-config.mdx +42 -0
  279. package/docs/api/36-cli.mdx +72 -6
  280. package/docs/learn/01-quick-start.mdx +1 -1
  281. package/docs/learn/06-typed-params.mdx +2 -2
  282. package/docs/learn/10-caching.mdx +26 -5
  283. package/llms.txt +1 -1
  284. package/package.json +12 -12
  285. package/src/adapters/build-output-helper.ts +26 -4
  286. package/src/adapters/cloudflare.ts +1 -0
  287. package/src/adapters/nitro-presets.ts +15 -0
  288. package/src/adapters/nitro-preview.ts +66 -34
  289. package/src/adapters/nitro.ts +14 -6
  290. package/src/analyze/graph-command.ts +25 -133
  291. package/src/cache/key-discipline.ts +218 -0
  292. package/src/cache/timber-cache.ts +42 -5
  293. package/src/cli-dev-status.ts +196 -0
  294. package/src/cli-init.ts +278 -0
  295. package/src/cli.ts +33 -79
  296. package/src/client/error-boundary.tsx +19 -2
  297. package/src/client/use-cookie.ts +33 -21
  298. package/src/config-types.ts +40 -5
  299. package/src/config-validation.ts +37 -0
  300. package/src/cookies/define-cookie.ts +10 -46
  301. package/src/cookies/json-cookie.ts +4 -4
  302. package/src/index.ts +2 -0
  303. package/src/plugin-context.ts +7 -0
  304. package/src/plugins/dev-discovery.ts +216 -6
  305. package/src/plugins/dev-hostname.ts +322 -0
  306. package/src/plugins/dev-server.ts +96 -37
  307. package/src/plugins/dev-store-clear.ts +105 -7
  308. package/src/plugins/graph-endpoint.ts +15 -3
  309. package/src/plugins/optimize-package-imports-defaults.ts +88 -0
  310. package/src/plugins/optimize-package-imports.ts +439 -0
  311. package/src/plugins/prebuilt.ts +9 -0
  312. package/src/rsc-runtime/rsc.ts +7 -3
  313. package/src/rsc-runtime/server-references.ts +73 -0
  314. package/src/rsc-runtime/vendor-types.d.ts +9 -0
  315. package/src/server/access-gate.tsx +32 -20
  316. package/src/server/action-handler.ts +40 -34
  317. package/src/server/canonicalize.ts +27 -0
  318. package/src/server/cookie-context.ts +11 -3
  319. package/src/server/flight-source-node.ts +5 -2
  320. package/src/server/flight-source.ts +4 -3
  321. package/src/server/index.ts +6 -1
  322. package/src/server/interception-gates.ts +94 -0
  323. package/src/server/logger.ts +23 -0
  324. package/src/server/param-coercion.ts +22 -0
  325. package/src/server/pipeline-interception.ts +64 -4
  326. package/src/server/pipeline-metadata-route.ts +242 -0
  327. package/src/server/pipeline-metadata.ts +7 -5
  328. package/src/server/pipeline-phases.ts +71 -131
  329. package/src/server/pipeline.ts +20 -2
  330. package/src/server/prebuilt/dev-store.ts +113 -34
  331. package/src/server/prebuilt/overlay.ts +18 -0
  332. package/src/server/prebuilt-runtime.ts +43 -44
  333. package/src/server/primitives.ts +14 -0
  334. package/src/server/render-utils.ts +25 -0
  335. package/src/server/request-context.ts +27 -3
  336. package/src/server/route-element-builder.ts +15 -2
  337. package/src/server/route-handler.ts +3 -2
  338. package/src/server/route-matcher.ts +48 -33
  339. package/src/server/rsc-entry/api-handler.ts +2 -33
  340. package/src/server/rsc-entry/index.ts +8 -3
  341. package/src/server/rsc-entry/rsc-stream.ts +7 -1
  342. package/src/server/signal-identity.ts +30 -12
  343. package/src/server/traced-access.ts +50 -0
  344. package/src/server/tracing.ts +18 -1
  345. package/src/server/types.ts +5 -4
  346. package/src/shims/headers.ts +12 -4
  347. package/dist/_chunks/actions-vBHr2vqd.js.map +0 -1
  348. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
  349. package/dist/_chunks/cache-api-DdcDLpBj.js.map +0 -1
  350. package/dist/_chunks/chains-B8TCLved.js +0 -1
  351. package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
  352. package/dist/_chunks/dev-server-BNr5drEO.js.map +0 -1
  353. package/dist/_chunks/dev-server-CUg7Mqh_.js +0 -1
  354. package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
  355. package/dist/_chunks/flight-source-node-BdHUOUqg.js.map +0 -1
  356. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
  357. package/dist/_chunks/logger-CI_hThfy.js.map +0 -1
  358. package/dist/_chunks/node-response-bF0bKoig.js.map +0 -1
  359. package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
  360. package/dist/server/prebuilt/key-discipline.d.ts +0 -52
  361. package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
  362. package/src/server/prebuilt/key-discipline.ts +0 -122
@@ -93,6 +93,20 @@ function matchPathname(root: ManifestSegmentNode, pathname: string): RouteMatch
93
93
  };
94
94
  }
95
95
 
96
+ /**
97
+ * The matched segment path of a chain — its segment names, groups and slots
98
+ * included — as `getSegmentParams()`'s dev-mode validation compares against.
99
+ * See design/41-global-params.md §Runtime Validation.
100
+ */
101
+ export function matchedSegmentPath(chain: ManifestSegmentNode[]): string {
102
+ const path =
103
+ chain
104
+ .map((s) => s.segmentName)
105
+ .filter(Boolean)
106
+ .join('/') || '/';
107
+ return path.startsWith('/') ? path : `/${path}`;
108
+ }
109
+
96
110
  /**
97
111
  * Collect middleware from a matched segment chain, root to leaf.
98
112
  *
@@ -152,14 +166,19 @@ export interface MetadataRouteMatch {
152
166
  contentType: string;
153
167
  /** The manifest file reference for the handler module. */
154
168
  file: ManifestFile;
155
- /** The matched segment (for context/params if needed). */
156
- segment: ManifestSegmentNode;
169
+ /**
170
+ * The segment chain from the root to the segment that owns the file, as
171
+ * a page's match would carry it: route groups and a zero-segment
172
+ * `[[...slug]]` the file sits in included. The pipeline coerces params
173
+ * and runs `middleware.ts` / `access.ts` over it (TIM-1609, TIM-1612).
174
+ */
175
+ segments: ManifestSegmentNode[];
157
176
  /**
158
177
  * Whether this is a static file (e.g. sitemap.xml, favicon.ico, icon.png)
159
178
  * that should be served from disk rather than executed as a handler.
160
179
  */
161
180
  isStatic: boolean;
162
- /** Extracted segment params from dynamic segments in the URL prefix. */
181
+ /** Raw segment params from dynamic segments in the URL prefix. */
163
182
  segmentParams: Record<string, string | string[]>;
164
183
  }
165
184
 
@@ -213,8 +232,8 @@ export function matchMetadataRoute(
213
232
  // For root-level routes (e.g. /sitemap.xml), prefix is empty → root segment.
214
233
  const prefixParts = parts.slice(0, -1);
215
234
 
216
- let segment: ManifestSegmentNode;
217
- let params: Record<string, string | string[]>;
235
+ let segments: ManifestSegmentNode[] = [];
236
+ let params: Record<string, string | string[]> = {};
218
237
  let file: ManifestFile | null = null;
219
238
 
220
239
  // Find the metadata file owner. For prefix matches, iterate all matching
@@ -223,8 +242,6 @@ export function matchMetadataRoute(
223
242
  // search all group children since findMetadataRouteInSegment may return
224
243
  // a file with the wrong extension when multiple groups own the same
225
244
  // convention with different static types.
226
- segment = root;
227
- params = {};
228
245
  const candidates = [...metadataOwnerCandidates(root, prefixParts)];
229
246
 
230
247
  // Two passes: direct owners first (node itself + groups), then
@@ -232,20 +249,21 @@ export function matchMetadataRoute(
232
249
  // candidate must beat a zero-segment catch-all on an earlier candidate.
233
250
  for (const allowCatchAll of [false, true]) {
234
251
  for (const candidate of candidates) {
235
- if (!convention.nestable && candidate.segment !== root) continue;
252
+ const owner = candidate.chain[candidate.chain.length - 1];
253
+ if (!convention.nestable && owner !== root) continue;
236
254
  const found = findMetadataRouteInSegment(
237
- candidate.segment,
255
+ owner,
238
256
  baseName,
239
257
  allowCatchAll && convention.nestable
240
258
  );
241
259
  if (!found) continue;
242
260
  if (convention.serveExtension) {
243
- const resolvedServePath = resolveServePathForFile(baseName, found.filePath);
261
+ const resolvedServePath = resolveServePathForFile(baseName, found.file.filePath);
244
262
  if (lastPart !== resolvedServePath) continue;
245
263
  }
246
- segment = candidate.segment;
264
+ segments = [...candidate.chain, ...found.descent];
247
265
  params = candidate.params;
248
- file = found;
266
+ file = found.file;
249
267
  break;
250
268
  }
251
269
  if (file) break;
@@ -263,7 +281,7 @@ export function matchMetadataRoute(
263
281
  type: convention.type,
264
282
  contentType,
265
283
  file,
266
- segment,
284
+ segments,
267
285
  isStatic,
268
286
  segmentParams: params,
269
287
  };
@@ -287,19 +305,21 @@ export function matchMetadataRoute(
287
305
  * child of the root IS at the root.
288
306
  *
289
307
  * The segment's own metadata file wins over a zero-segment child's.
308
+ *
309
+ * `descent` is the path below `node` to the segment that owns the file —
310
+ * empty when `node` owns it — so the match's chain reaches the owner.
290
311
  */
291
312
  function findMetadataRouteInSegment(
292
313
  node: ManifestSegmentNode,
293
314
  baseName: string,
294
315
  nestable: boolean
295
- ): ManifestFile | null {
296
- if (node.metadataRoutes?.[baseName]) {
297
- return node.metadataRoutes[baseName];
298
- }
316
+ ): { file: ManifestFile; descent: ManifestSegmentNode[] } | null {
317
+ const own = node.metadataRoutes?.[baseName];
318
+ if (own) return { file: own, descent: [] };
299
319
  for (const child of node.children) {
300
320
  if (child.segmentType === 'group' || (nestable && child.segmentType === 'optional-catch-all')) {
301
321
  const found = findMetadataRouteInSegment(child, baseName, nestable);
302
- if (found) return found;
322
+ if (found) return { file: found.file, descent: [child, ...found.descent] };
303
323
  }
304
324
  }
305
325
  return null;
@@ -316,30 +336,25 @@ function findMetadataRouteInSegment(
316
336
  function* metadataOwnerCandidates(
317
337
  root: ManifestSegmentNode,
318
338
  prefixParts: string[]
319
- ): Generator<{ segment: ManifestSegmentNode; params: Record<string, string | string[]> }> {
339
+ ): Generator<{ chain: ManifestSegmentNode[]; params: Record<string, string | string[]> }> {
320
340
  if (prefixParts.length === 0) {
321
- yield { segment: root, params: {} };
322
- // Also yield each group child individually so the caller can validate
323
- // extensions per-group rather than taking the first file found.
324
- for (const child of root.children) {
325
- if (child.segmentType === 'group') {
326
- yield* groupDescendants(child);
327
- }
328
- }
341
+ // The root, then each group below it individually, so the caller can
342
+ // validate extensions per-group rather than taking the first file found.
343
+ yield* groupDescendants([root]);
329
344
  } else {
330
345
  for (const result of matchUrlPartsAll(root, prefixParts, { requireTerminal: false })) {
331
- yield { segment: result.chain[result.chain.length - 1], params: result.params };
346
+ yield { chain: result.chain, params: result.params };
332
347
  }
333
348
  }
334
349
  }
335
350
 
336
351
  function* groupDescendants(
337
- node: ManifestSegmentNode
338
- ): Generator<{ segment: ManifestSegmentNode; params: Record<string, string | string[]> }> {
339
- yield { segment: node, params: {} };
340
- for (const child of node.children) {
352
+ chain: ManifestSegmentNode[]
353
+ ): Generator<{ chain: ManifestSegmentNode[]; params: Record<string, string | string[]> }> {
354
+ yield { chain, params: {} };
355
+ for (const child of chain[chain.length - 1].children) {
341
356
  if (child.segmentType === 'group') {
342
- yield* groupDescendants(child);
357
+ yield* groupDescendants([...chain, child]);
343
358
  }
344
359
  }
345
360
  }
@@ -13,10 +13,9 @@
13
13
  * per route type (TIM-1537, TIM-1533).
14
14
  */
15
15
 
16
- import { withSpan, setSpanAttribute } from '../tracing.ts';
17
16
  import type { ManifestSegmentNode } from '../route-matcher.ts';
18
17
  import { loadModule } from '../safe-load.ts';
19
- import { isDenySignal, isRedirectSignal } from '../signal-identity.ts';
18
+ import { runAccessChain } from '../traced-access.ts';
20
19
  import { handleRouteRequest } from '../route-handler.ts';
21
20
  import type { RouteModule } from '../route-handler.ts';
22
21
  import type { RouteContext } from '../types.ts';
@@ -38,37 +37,7 @@ export async function handleApiRoute(
38
37
  ): Promise<Response> {
39
38
  const leaf = segments[segments.length - 1];
40
39
 
41
- // Run access.ts for every segment in the chain, top-down.
42
- // Each access.ts is independent — deny()/redirect() throws a signal.
43
- for (const segment of segments) {
44
- if (segment.access) {
45
- const accessMod = await loadModule(segment.access);
46
- const accessFn = accessMod.default as (() => unknown) | undefined;
47
- if (accessFn) {
48
- await withSpan(
49
- 'timber.access',
50
- { 'timber.segment': segment.segmentName ?? 'unknown' },
51
- async () => {
52
- try {
53
- await accessFn();
54
- await setSpanAttribute('timber.result', 'pass');
55
- } catch (error) {
56
- if (isDenySignal(error)) {
57
- await setSpanAttribute('timber.result', 'deny');
58
- await setSpanAttribute('timber.deny_status', error.status);
59
- if (error.sourceFile) {
60
- await setSpanAttribute('timber.deny_file', error.sourceFile);
61
- }
62
- } else if (isRedirectSignal(error)) {
63
- await setSpanAttribute('timber.result', 'redirect');
64
- }
65
- throw error;
66
- }
67
- }
68
- );
69
- }
70
- }
71
- }
40
+ await runAccessChain(segments);
72
41
 
73
42
  // Load route.ts module and dispatch.
74
43
  // Segment params / query params are NOT on `ctx` — handlers read them
@@ -62,6 +62,7 @@ import {
62
62
  PREBUILT_DEV_CLEAR_EVENT,
63
63
  clearDevPrebuiltStore,
64
64
  setDevPrebuiltStoreMode,
65
+ type DevStoreClear,
65
66
  } from '../prebuilt/dev-store.ts';
66
67
  import { renderRoute } from './render-route.ts';
67
68
  import { isDebug, isDevMode, setDebugFromConfig } from '../debug.ts';
@@ -70,7 +71,7 @@ import { setPrebuiltPayloadSource } from '../prebuilt/payload-source.ts';
70
71
  import { setRscFunctions, setComponentRefreshTimeout } from '../prebuilt-runtime.ts';
71
72
  import { cancelFlightSource, setFlightRenderTimeout } from '../flight-source.ts';
72
73
  import { installReactCacheBridge } from '../react-cache-bridge.ts';
73
- import { setKeyDisciplineStrict } from '../prebuilt/key-discipline.ts';
74
+ import { setKeyDisciplineStrict } from '../../cache/key-discipline.ts';
74
75
  import { createAutoSitemapHandler } from '../sitemap-handler.ts';
75
76
  import { generateStaticSite } from '../static-generator.ts';
76
77
 
@@ -144,13 +145,16 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
144
145
  // In dev mode there are no prebuilt artifacts — source stays null and the
145
146
  // in-memory dev store stands in for them: prerender entries are captured
146
147
  // on first request and cleared on every dev-server watcher event, which
147
- // the timber-dev-server plugin forwards here (TIM-1588). Without HMR
148
+ // the timber-dev-server plugin forwards here (TIM-1588), scoped to the
149
+ // components the saved module could have changed (TIM-1599). Without HMR
148
150
  // (`server.hmr: false`) no event would ever clear it, so dev bypasses
149
151
  // cache.component caching entirely and every wrapper renders live.
150
152
  if (isDevMode()) {
151
153
  if (import.meta.hot) {
152
154
  setDevPrebuiltStoreMode('active');
153
- import.meta.hot.on(PREBUILT_DEV_CLEAR_EVENT, clearDevPrebuiltStore);
155
+ import.meta.hot.on(PREBUILT_DEV_CLEAR_EVENT, (data: DevStoreClear) =>
156
+ clearDevPrebuiltStore(data.componentIds)
157
+ );
154
158
  } else {
155
159
  setDevPrebuiltStoreMode('bypass');
156
160
  }
@@ -313,6 +317,7 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
313
317
  matchRoute,
314
318
  csrf: csrfConfig,
315
319
  matchMetadataRoute,
320
+ renderTimeoutMs: (config as Record<string, unknown>).renderTimeoutMs as number,
316
321
  // 103 Early Hints — fires after route match, before middleware.
317
322
  // Collects CSS, font, and JS chunk Link headers from the build manifest
318
323
  // so the browser starts fetching critical resources while the server renders.
@@ -69,7 +69,12 @@ export function renderRscStream(
69
69
  // Resolve it against the leaf deny chain and stamp the full
70
70
  // candidate list so the client can find the first reachable
71
71
  // owner via its ancestry context.
72
- if (!error.owners && leafDenyChain) {
72
+ //
73
+ // Not a deny the tree cannot hold (`_leaveSpa`, TIM-1607): the
74
+ // leaf chain here is the rendered route's, and its files are not
75
+ // the URL's answer. Left unaddressed, it is the deny fallback's
76
+ // inside the opening window, and the client terminal's after it.
77
+ if (!error.owners && leafDenyChain && !error._leaveSpa) {
73
78
  const entries = matchDenyEntries(leafDenyChain, error.status);
74
79
  if (entries.length > 0) {
75
80
  error.owners = entries.map((e) => e.ownerKey);
@@ -81,6 +86,7 @@ export function renderRscStream(
81
86
  status: error.status,
82
87
  data: error.data,
83
88
  owners: error.owners,
89
+ leaveSpa: error._leaveSpa,
84
90
  });
85
91
  }
86
92
  if (isRedirectSignal(error)) {
@@ -68,20 +68,38 @@ export function isControlFlowSignal(error: unknown): boolean {
68
68
  if (isDenySignal(error) || isRedirectSignal(error)) {
69
69
  return true;
70
70
  }
71
- if (error && typeof error === 'object') {
72
- const digest = (error as { digest?: unknown }).digest;
73
- if (typeof digest === 'string') {
74
- try {
75
- const parsed = JSON.parse(digest) as { type?: unknown } | null;
76
- if (parsed && typeof parsed === 'object') {
77
- return parsed.type === 'redirect' || parsed.type === 'deny';
78
- }
79
- } catch {
80
- // Not valid digest JSON
81
- }
71
+ return signalDigest(error) !== null;
72
+ }
73
+
74
+ /**
75
+ * The HTTP status a control-flow signal answers with: a signal's own, or the
76
+ * one its digest carries once revived on the SSR side. `undefined` for
77
+ * anything that is not a signal.
78
+ */
79
+ export function controlFlowStatus(error: unknown): number | undefined {
80
+ if (isDenySignal(error) || isRedirectSignal(error)) return error.status;
81
+ const status = signalDigest(error)?.status;
82
+ return typeof status === 'number' ? status : undefined;
83
+ }
84
+
85
+ /** A revived signal's parsed digest (`rsc-stream.ts` writes it), or null. */
86
+ function signalDigest(error: unknown): { type: 'deny' | 'redirect'; status?: unknown } | null {
87
+ if (!error || typeof error !== 'object') return null;
88
+ const digest = (error as { digest?: unknown }).digest;
89
+ if (typeof digest !== 'string') return null;
90
+ try {
91
+ const parsed = JSON.parse(digest) as { type?: unknown; status?: unknown } | null;
92
+ if (
93
+ parsed &&
94
+ typeof parsed === 'object' &&
95
+ (parsed.type === 'redirect' || parsed.type === 'deny')
96
+ ) {
97
+ return { type: parsed.type, status: parsed.status };
82
98
  }
99
+ } catch {
100
+ // Not valid digest JSON
83
101
  }
84
- return false;
102
+ return null;
85
103
  }
86
104
 
87
105
  // ─── SsrStreamError ─────────────────────────────────────────────────────────
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The one traced call every `access.ts` executor shares: `AccessGate`, in a
3
+ * page render, and `runAccessChain` below, for the `route.ts` handler and
4
+ * metadata routes, which have no render to put a gate in
5
+ * (design/04-authorization.md §"Auth in API Routes", §"Auth in Metadata Routes").
6
+ */
7
+
8
+ import type { ManifestSegmentNode } from './route-matcher.ts';
9
+ import { loadModule } from './safe-load.ts';
10
+ import { isDenySignal, isRedirectSignal } from './signal-identity.ts';
11
+ import { withSpan, setSpanAttribute } from './tracing.ts';
12
+
13
+ /**
14
+ * Run each segment's `access.ts`, root to leaf, outside a render. Each one
15
+ * is independent; a deny() or redirect() propagates as a signal.
16
+ */
17
+ export async function runAccessChain(segments: readonly ManifestSegmentNode[]): Promise<void> {
18
+ for (const segment of segments) {
19
+ if (!segment.access) continue;
20
+ const { default: accessFn } = await loadModule<{ default?: () => unknown }>(segment.access);
21
+ if (accessFn) await runTracedAccess(accessFn, segment.segmentName);
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Call one access function inside a `timber.access` span that records its
27
+ * result. Signals and errors propagate unchanged.
28
+ */
29
+ export async function runTracedAccess(
30
+ accessFn: () => unknown,
31
+ segmentName: string | undefined
32
+ ): Promise<void> {
33
+ await withSpan('timber.access', { 'timber.segment': segmentName ?? 'unknown' }, async () => {
34
+ try {
35
+ await accessFn();
36
+ await setSpanAttribute('timber.result', 'pass');
37
+ } catch (error: unknown) {
38
+ if (isDenySignal(error)) {
39
+ await setSpanAttribute('timber.result', 'deny');
40
+ await setSpanAttribute('timber.deny_status', error.status);
41
+ if (error.sourceFile) {
42
+ await setSpanAttribute('timber.deny_file', error.sourceFile);
43
+ }
44
+ } else if (isRedirectSignal(error)) {
45
+ await setSpanAttribute('timber.result', 'redirect');
46
+ }
47
+ throw error;
48
+ }
49
+ });
50
+ }
@@ -10,6 +10,7 @@
10
10
 
11
11
  import { randomUUID } from 'node:crypto';
12
12
  import { traceAls, type TraceStore } from './als-registry.ts';
13
+ import { controlFlowStatus, isSsrStreamError } from './signal-identity.ts';
13
14
 
14
15
  // Re-export the TraceStore type for public API consumers.
15
16
  export type { TraceStore } from './als-registry.ts';
@@ -285,7 +286,22 @@ async function runOtelSpan<T>(
285
286
  );
286
287
  }
287
288
 
288
- /** Run `fn` and end `span` with its outcome. */
289
+ /**
290
+ * True when `error` is a `redirect()`, or a `deny()` below 500: an outcome the
291
+ * span observed, not a failure. Such a span ends with its status unset and no
292
+ * exception event, so an OTEL backend does not count every 404 from an access
293
+ * check, a page, a layout or a metadata() as an error (TIM-1597). A
294
+ * `deny(5xx)` is a server failure by HTTP's own account and stays an error.
295
+ *
296
+ * SSR wraps the revived signal its shell failed on in an `SsrStreamError`;
297
+ * the cause is the outcome, so `timber.ssr` follows the same rule.
298
+ */
299
+ function isOutcomeSignal(error: unknown): boolean {
300
+ const status = controlFlowStatus(isSsrStreamError(error) ? error.cause : error);
301
+ return status !== undefined && status < 500;
302
+ }
303
+
304
+ /** Run `fn` and end `span` with its outcome (see {@link isOutcomeSignal}). */
289
305
  async function settleOtelSpan<T>(
290
306
  api: typeof import('@opentelemetry/api'),
291
307
  span: import('@opentelemetry/api').Span,
@@ -296,6 +312,7 @@ async function settleOtelSpan<T>(
296
312
  span.setStatus({ code: api.SpanStatusCode.OK });
297
313
  return result;
298
314
  } catch (error) {
315
+ if (isOutcomeSignal(error)) throw error;
299
316
  span.setStatus({ code: api.SpanStatusCode.ERROR });
300
317
  if (error instanceof Error) {
301
318
  span.recordException(error);
@@ -210,10 +210,11 @@ export namespace MetadataRoute {
210
210
  * The value a dynamic metadata route handler may return.
211
211
  *
212
212
  * This is a structural union — the pipeline dispatches on the shape at
213
- * request time (see `pipeline-phases.ts`):
214
- * - `Response` → returned as-is (e.g. `ImageResponse`, `Response.redirect()`).
215
- * Used by `icon.tsx`, `opengraph-image.tsx`,
216
- * `apple-icon.tsx`.
213
+ * request time (see `pipeline-metadata-route.ts`):
214
+ * - `Response` → its status and headers as-is (e.g. `ImageResponse`,
215
+ * `Response.redirect()`). Used by `icon.tsx`, `opengraph-image.tsx`,
216
+ * `apple-icon.tsx`. An image route's body is read to the end before it
217
+ * is answered, so a render that fails is a 500; other routes stream it.
217
218
  * - `string` → written as the response body verbatim. Used by `robots.ts`
218
219
  * and by any handler that wants to emit a pre-serialized payload.
219
220
  * - `MetadataRoute.Sitemap` → serialized via the sitemap XML writer. Used
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  import { getCookieJar } from '@timber-js/app/server';
21
- import type { CookieOptions, SetCookieOptions } from '@timber-js/app/server';
21
+ import type { CookieDeleteOptions, SetCookieOptions } from '@timber-js/app/server';
22
22
 
23
23
  // Re-export timber's primary API
24
24
  export { getHeaders, getCookieJar } from '@timber-js/app/server';
@@ -43,6 +43,12 @@ export interface NextCookieListItem extends NextCookieOptions {
43
43
  value: string;
44
44
  }
45
45
 
46
+ /**
47
+ * Next.js's object overload for `cookies().delete({ name, ...options })` —
48
+ * every cookie option but `expires`, as in Next.'s `Omit<ResponseCookie, 'value' | 'expires'>`.
49
+ */
50
+ export type NextCookieDeleteItem = { name: string } & CookieDeleteOptions & { maxAge?: number };
51
+
46
52
  /** Next.js's RequestCookies surface, backed by timber's cookie jar. */
47
53
  export interface NextRequestCookies {
48
54
  get(name: string): RequestCookie | undefined;
@@ -54,7 +60,7 @@ export interface NextRequestCookies {
54
60
  set(name: string, value: string, options?: NextCookieOptions): void;
55
61
  set(cookie: NextCookieListItem): void;
56
62
  delete(name: string): void;
57
- delete(cookie: { name: string } & Pick<CookieOptions, 'path' | 'domain'>): void;
63
+ delete(cookie: NextCookieDeleteItem): void;
58
64
  [Symbol.iterator](): IterableIterator<[string, RequestCookie]>;
59
65
  toString(): string;
60
66
  }
@@ -110,11 +116,13 @@ export function cookies(): NextRequestCookies {
110
116
  jar.set(name, cookieValue, normalizeOptions(objectOptions));
111
117
  }
112
118
  },
113
- delete(nameOrCookie: string | ({ name: string } & Pick<CookieOptions, 'path' | 'domain'>)) {
119
+ delete(nameOrCookie: string | NextCookieDeleteItem) {
114
120
  if (typeof nameOrCookie === 'string') {
115
121
  jar.delete(nameOrCookie);
116
122
  } else {
117
- const { name, ...options } = nameOrCookie;
123
+ // maxAge is accepted for Next.js type compat; the deletion forces it to 0.
124
+ const { name, maxAge: _maxAge, ...options } = nameOrCookie;
125
+ void _maxAge;
118
126
  jar.delete(name, options);
119
127
  }
120
128
  },