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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/agent-skill.md +21 -5
  2. package/dist/_chunks/{actions-BDqn4Oxj.js → actions-7dTXYJfu.js} +53 -24
  3. package/dist/_chunks/actions-7dTXYJfu.js.map +1 -0
  4. package/dist/_chunks/{als-registry-BZqHCtq-.js → als-registry-DpygwCp0.js} +2 -3
  5. package/dist/_chunks/{als-registry-BZqHCtq-.js.map → als-registry-DpygwCp0.js.map} +1 -1
  6. package/dist/_chunks/{als-slots-BEEIPKYm.js → als-slots-kbQrHTzm.js} +2 -3
  7. package/dist/_chunks/{als-slots-BEEIPKYm.js.map → als-slots-kbQrHTzm.js.map} +1 -1
  8. package/dist/_chunks/{base-path-DaQrzbez.js → base-path-DDIx0FXe.js} +2 -3
  9. package/dist/_chunks/{base-path-DaQrzbez.js.map → base-path-DDIx0FXe.js.map} +1 -1
  10. package/dist/_chunks/{build-manifest-DWppEdLB.js → build-manifest-Y4jl7nwU.js} +2 -3
  11. package/dist/_chunks/{build-manifest-DWppEdLB.js.map → build-manifest-Y4jl7nwU.js.map} +1 -1
  12. package/dist/_chunks/{build-output-helper-RV_BRcF1.js → build-output-helper-B7wWGTfR.js} +14 -10
  13. package/dist/_chunks/build-output-helper-B7wWGTfR.js.map +1 -0
  14. package/dist/_chunks/{cache-api-GE4AOe2H.js → cache-api-TDZ4hlDc.js} +237 -37
  15. package/dist/_chunks/cache-api-TDZ4hlDc.js.map +1 -0
  16. package/dist/_chunks/{canonicalize-BAWkWiKK.js → canonicalize-CqK135BN.js} +29 -4
  17. package/dist/_chunks/{canonicalize-BAWkWiKK.js.map → canonicalize-CqK135BN.js.map} +1 -1
  18. package/dist/_chunks/chains-CwOr3Myj.js +1 -0
  19. package/dist/_chunks/{chains-e_Buf9vg.js → chains-Dgm3PrMe.js} +3 -4
  20. package/dist/_chunks/{chains-e_Buf9vg.js.map → chains-Dgm3PrMe.js.map} +1 -1
  21. package/dist/_chunks/{classify-2Yp3xJY1.js → classify--_kINHQV.js} +4 -5
  22. package/dist/_chunks/{classify-2Yp3xJY1.js.map → classify--_kINHQV.js.map} +1 -1
  23. package/dist/_chunks/{cli-check-DDwCkeDY.js → cli-check-Dv3f8d2j.js} +5 -6
  24. package/dist/_chunks/{cli-check-DDwCkeDY.js.map → cli-check-Dv3f8d2j.js.map} +1 -1
  25. package/dist/_chunks/{cli-context-_mPttGGY.js → cli-context-CbZp32SK.js} +3 -4
  26. package/dist/_chunks/{cli-context-_mPttGGY.js.map → cli-context-CbZp32SK.js.map} +1 -1
  27. package/dist/_chunks/cli-context-n5hmkdla.js +1 -0
  28. package/dist/_chunks/cli-dev-status-prPMLU8G.js +138 -0
  29. package/dist/_chunks/cli-dev-status-prPMLU8G.js.map +1 -0
  30. package/dist/_chunks/cli-init-BoXOYYil.js +196 -0
  31. package/dist/_chunks/cli-init-BoXOYYil.js.map +1 -0
  32. package/dist/_chunks/{cli-schema-sync-BdIebmk3.js → cli-schema-sync-DIPurq7X.js} +4 -5
  33. package/dist/_chunks/{cli-schema-sync-BdIebmk3.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
  34. package/dist/_chunks/{cli-schema-sync-CLNfXQDK.js → cli-schema-sync-uq72EZmD.js} +1 -1
  35. package/dist/_chunks/{client-dep-entries-BOkpKjj1.js → client-dep-entries-CP7AkMCM.js} +4 -5
  36. package/dist/_chunks/{client-dep-entries-BOkpKjj1.js.map → client-dep-entries-CP7AkMCM.js.map} +1 -1
  37. package/dist/_chunks/{cloudflare-Byxl8FWP.js → cloudflare-B75X6u4O.js} +10 -13
  38. package/dist/_chunks/{cloudflare-Byxl8FWP.js.map → cloudflare-B75X6u4O.js.map} +1 -1
  39. package/dist/_chunks/{codec-registry-oOUxugz3.js → codec-registry-CPc6bjVl.js} +2 -3
  40. package/dist/_chunks/{codec-registry-oOUxugz3.js.map → codec-registry-CPc6bjVl.js.map} +1 -1
  41. package/dist/_chunks/{codegen-Bps1sLKJ.js → codegen-B9oWkWGf.js} +5 -8
  42. package/dist/_chunks/{codegen-Bps1sLKJ.js.map → codegen-B9oWkWGf.js.map} +1 -1
  43. package/dist/_chunks/{convention-lint-ByKJ6aqD.js → convention-lint-hZwz5wd4.js} +8 -11
  44. package/dist/_chunks/{convention-lint-ByKJ6aqD.js.map → convention-lint-hZwz5wd4.js.map} +1 -1
  45. package/dist/_chunks/dev-discovery-YnabkCKD.js +238 -0
  46. package/dist/_chunks/dev-discovery-YnabkCKD.js.map +1 -0
  47. package/dist/_chunks/{dev-server-DIy-SY-J.js → dev-server-C61GWpGg.js} +409 -51
  48. package/dist/_chunks/dev-server-C61GWpGg.js.map +1 -0
  49. package/dist/_chunks/dev-server-CBvvM7Lr.js +1 -0
  50. package/dist/_chunks/{dev-store-BOa304m_.js → dev-store-BvdqtHvK.js} +82 -38
  51. package/dist/_chunks/dev-store-BvdqtHvK.js.map +1 -0
  52. package/dist/_chunks/{dist-DtrJyBbw.js → dist-C1Rjlo6s.js} +3 -5
  53. package/dist/_chunks/{dist-DtrJyBbw.js.map → dist-C1Rjlo6s.js.map} +1 -1
  54. package/dist/_chunks/{error-boundary-Bc8QPZuq.js → error-boundary-DRQXGWCp.js} +20 -27
  55. package/dist/_chunks/{error-boundary-Bc8QPZuq.js.map → error-boundary-DRQXGWCp.js.map} +1 -1
  56. package/dist/_chunks/{fast-hash-C-tVYrLb.js → fast-hash-DddxkU5Y.js} +2 -3
  57. package/dist/_chunks/{fast-hash-C-tVYrLb.js.map → fast-hash-DddxkU5Y.js.map} +1 -1
  58. package/dist/_chunks/{flight-source-node-HptmGMT8.js → flight-source-node-0Tp6evlz.js} +6 -8
  59. package/dist/_chunks/flight-source-node-0Tp6evlz.js.map +1 -0
  60. package/dist/_chunks/{format-BKclgVbk.js → format-DuPOoXUP.js} +2 -3
  61. package/dist/_chunks/{format-BKclgVbk.js.map → format-DuPOoXUP.js.map} +1 -1
  62. package/dist/_chunks/{fs-identity-BRKuL215.js → fs-identity-BmQ_Agg-.js} +3 -5
  63. package/dist/_chunks/{fs-identity-BRKuL215.js.map → fs-identity-BmQ_Agg-.js.map} +1 -1
  64. package/dist/_chunks/global-context-DbxNWeBP.js +47 -0
  65. package/dist/_chunks/global-context-DbxNWeBP.js.map +1 -0
  66. package/dist/_chunks/{graph-cache-CYiUS2aS.js → graph-cache-B1LAg4t7.js} +5 -89
  67. package/dist/_chunks/graph-cache-B1LAg4t7.js.map +1 -0
  68. package/dist/_chunks/{href-validation-BIrxavIy.js → href-validation-CEZy1V-k.js} +4 -7
  69. package/dist/_chunks/{href-validation-BIrxavIy.js.map → href-validation-CEZy1V-k.js.map} +1 -1
  70. package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js → json-lossy-check-DVkLUlfC.js} +3 -4
  71. package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
  72. package/dist/_chunks/{live-graph-tSWrv8eH.js → live-graph-BcVjQ1Te.js} +6 -7
  73. package/dist/_chunks/{live-graph-tSWrv8eH.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
  74. package/dist/_chunks/{logger-CbLdcy-W.js → logger-CWk44DLp.js} +97 -47
  75. package/dist/_chunks/logger-CWk44DLp.js.map +1 -0
  76. package/dist/_chunks/{metadata-routes-B3XJNyIH.js → metadata-routes-BL26HCDd.js} +2 -3
  77. package/dist/_chunks/{metadata-routes-B3XJNyIH.js.map → metadata-routes-BL26HCDd.js.map} +1 -1
  78. package/dist/_chunks/{navigation-root-BQfo1-kG.js → navigation-root-M3B2ZrdO.js} +6 -10
  79. package/dist/_chunks/{navigation-root-BQfo1-kG.js.map → navigation-root-M3B2ZrdO.js.map} +1 -1
  80. package/dist/_chunks/{node-response-rkQqcFGq.js → node-response-B9aviPDa.js} +43 -9
  81. package/dist/_chunks/node-response-B9aviPDa.js.map +1 -0
  82. package/dist/_chunks/{param-value-C8TNYchQ.js → param-value-DqlGfF57.js} +2 -3
  83. package/dist/_chunks/{param-value-C8TNYchQ.js.map → param-value-DqlGfF57.js.map} +1 -1
  84. package/dist/_chunks/{plugin-context-uDHFqHHJ.js → plugin-context-BfSRKJfz.js} +1 -1
  85. package/dist/_chunks/{plugin-context-DxMMvjUt.js → plugin-context-FCkaNLUB.js} +4 -6
  86. package/dist/_chunks/plugin-context-FCkaNLUB.js.map +1 -0
  87. package/dist/_chunks/{poison-rules-DoEhbqaY.js → poison-rules-Bmz-lCPi.js} +2 -3
  88. package/dist/_chunks/{poison-rules-DoEhbqaY.js.map → poison-rules-Bmz-lCPi.js.map} +1 -1
  89. package/dist/_chunks/{poison-scan-C4FgMxFl.js → poison-scan-DJYxZc_7.js} +4 -5
  90. package/dist/_chunks/{poison-scan-C4FgMxFl.js.map → poison-scan-DJYxZc_7.js.map} +1 -1
  91. package/dist/_chunks/{purge-store-WZaxu-3m.js → purge-store-8BqLAYZ1.js} +2 -3
  92. package/dist/_chunks/{purge-store-WZaxu-3m.js.map → purge-store-8BqLAYZ1.js.map} +1 -1
  93. package/dist/_chunks/{render-timeout-joFhz4KH.js → render-timeout-MrrqD1wd.js} +20 -4
  94. package/dist/_chunks/{render-timeout-joFhz4KH.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
  95. package/dist/_chunks/{resolve-schema-CBR6Lm4i.js → resolve-schema-B-aCuTu3.js} +3 -4
  96. package/dist/_chunks/{resolve-schema-CBR6Lm4i.js.map → resolve-schema-B-aCuTu3.js.map} +1 -1
  97. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js → rsc-cache-key-D0cb0Gmc.js} +2 -3
  98. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js.map → rsc-cache-key-D0cb0Gmc.js.map} +1 -1
  99. package/dist/_chunks/{rsc-media-type-DDc7duTD.js → rsc-media-type-m8jz9u6_.js} +2 -3
  100. package/dist/_chunks/{rsc-media-type-DDc7duTD.js.map → rsc-media-type-m8jz9u6_.js.map} +1 -1
  101. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js → rsc-payload-path-EphpDB-J.js} +2 -3
  102. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js.map → rsc-payload-path-EphpDB-J.js.map} +1 -1
  103. package/dist/_chunks/{scan-BoP17W3w.js → scan-CyizcBiX.js} +2 -3
  104. package/dist/_chunks/{scan-BoP17W3w.js.map → scan-CyizcBiX.js.map} +1 -1
  105. package/dist/_chunks/{scanner-Cb3fSjAC.js → scanner-CJC-ScJU.js} +15 -23
  106. package/dist/_chunks/{scanner-Cb3fSjAC.js.map → scanner-CJC-ScJU.js.map} +1 -1
  107. package/dist/_chunks/{schema-bridge-C83xa9lT.js → schema-bridge-DyRs3cqy.js} +61 -25
  108. package/dist/_chunks/schema-bridge-DyRs3cqy.js.map +1 -0
  109. package/dist/_chunks/{segment-classify-C539Pa2O.js → segment-classify-Ho8jXWeC.js} +3 -5
  110. package/dist/_chunks/{segment-classify-C539Pa2O.js.map → segment-classify-Ho8jXWeC.js.map} +1 -1
  111. package/dist/_chunks/{segment-context-xtPUGfdq.js → segment-context-CYiGTi3K.js} +6 -12
  112. package/dist/_chunks/segment-context-CYiGTi3K.js.map +1 -0
  113. package/dist/_chunks/{segment-keys-D5hu1hz4.js → segment-keys-Y60KNc8C.js} +2 -3
  114. package/dist/_chunks/{segment-keys-D5hu1hz4.js.map → segment-keys-Y60KNc8C.js.map} +1 -1
  115. package/dist/_chunks/{singleflight-BeVMMKi0.js → singleflight-BChPMjwH.js} +2 -3
  116. package/dist/_chunks/{singleflight-BeVMMKi0.js.map → singleflight-BChPMjwH.js.map} +1 -1
  117. package/dist/_chunks/{sizeof-QPE5nd3u.js → sizeof-DG4W40lv.js} +3 -4
  118. package/dist/_chunks/{sizeof-QPE5nd3u.js.map → sizeof-DG4W40lv.js.map} +1 -1
  119. package/dist/_chunks/{ssr-data-nA3I70_n.js → ssr-data-9hPtcNOr.js} +3 -4
  120. package/dist/_chunks/{ssr-data-nA3I70_n.js.map → ssr-data-9hPtcNOr.js.map} +1 -1
  121. package/dist/_chunks/{state-BhNGPsdi.js → state-B-EBjeER.js} +2 -3
  122. package/dist/_chunks/{state-BhNGPsdi.js.map → state-B-EBjeER.js.map} +1 -1
  123. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js → status-page-marker-XIQXlTOb.js} +8 -13
  124. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js.map → status-page-marker-XIQXlTOb.js.map} +1 -1
  125. package/dist/_chunks/{tree-match-6yihorhk.js → tree-match-Bqdr9szG.js} +2 -3
  126. package/dist/_chunks/{tree-match-6yihorhk.js.map → tree-match-Bqdr9szG.js.map} +1 -1
  127. package/dist/_chunks/{use-query-states-I3JMng6J.js → use-query-states-pkDV-jSg.js} +4 -7
  128. package/dist/_chunks/{use-query-states-I3JMng6J.js.map → use-query-states-pkDV-jSg.js.map} +1 -1
  129. package/dist/_chunks/{walkers-qu8TpiLh.js → walkers-DIE203ir.js} +6 -8
  130. package/dist/_chunks/{walkers-qu8TpiLh.js.map → walkers-DIE203ir.js.map} +1 -1
  131. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js → write-file-atomic-DW8m_Atv.js} +2 -3
  132. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js.map → write-file-atomic-DW8m_Atv.js.map} +1 -1
  133. package/dist/adapters/build-output-helper.d.ts +10 -1
  134. package/dist/adapters/build-output-helper.d.ts.map +1 -1
  135. package/dist/adapters/cloudflare-dev.js +2 -3
  136. package/dist/adapters/cloudflare-kv-cache.js +3 -4
  137. package/dist/adapters/cloudflare.d.ts.map +1 -1
  138. package/dist/adapters/cloudflare.js +1 -1
  139. package/dist/adapters/nitro-presets.d.ts +6 -0
  140. package/dist/adapters/nitro-presets.d.ts.map +1 -1
  141. package/dist/adapters/nitro-preview.d.ts.map +1 -1
  142. package/dist/adapters/nitro.d.ts.map +1 -1
  143. package/dist/adapters/nitro.js +94 -57
  144. package/dist/adapters/nitro.js.map +1 -1
  145. package/dist/analyze/crawl-entry.js +7 -9
  146. package/dist/analyze/crawl-entry.js.map +1 -1
  147. package/dist/analyze/graph-command.d.ts.map +1 -1
  148. package/dist/analyze/graph-command.js +19 -105
  149. package/dist/analyze/graph-command.js.map +1 -1
  150. package/dist/cache/guarded-read.d.ts +29 -0
  151. package/dist/cache/guarded-read.d.ts.map +1 -0
  152. package/dist/cache/index.js +3 -3
  153. package/dist/cache/key-discipline.d.ts +61 -0
  154. package/dist/cache/key-discipline.d.ts.map +1 -0
  155. package/dist/cache/stores/cloudflare-kv.js +1 -2
  156. package/dist/cache/stores/memory.js +2 -3
  157. package/dist/cache/stores/redis.js +1 -2
  158. package/dist/cache/stores/vercel.js +1 -2
  159. package/dist/cache/timber-cache.d.ts +5 -1
  160. package/dist/cache/timber-cache.d.ts.map +1 -1
  161. package/dist/cdn/cloudflare-purge.js +1 -2
  162. package/dist/cdn/fastly-purge.js +1 -2
  163. package/dist/cdn/index.js +2 -3
  164. package/dist/cdn/workers-cache-purge.js +3 -5
  165. package/dist/cdn/workers-cache-purge.js.map +1 -1
  166. package/dist/cli-dev-status.d.ts +75 -0
  167. package/dist/cli-dev-status.d.ts.map +1 -0
  168. package/dist/cli-init.d.ts +72 -0
  169. package/dist/cli-init.d.ts.map +1 -0
  170. package/dist/cli.d.ts +4 -12
  171. package/dist/cli.d.ts.map +1 -1
  172. package/dist/cli.js +27 -54
  173. package/dist/cli.js.map +1 -1
  174. package/dist/client/error-boundary.d.ts.map +1 -1
  175. package/dist/client/error-boundary.js +1 -1
  176. package/dist/client/global-context.d.ts +21 -1
  177. package/dist/client/global-context.d.ts.map +1 -1
  178. package/dist/client/index.js +23 -44
  179. package/dist/client/index.js.map +1 -1
  180. package/dist/client/internal.js +13 -18
  181. package/dist/client/internal.js.map +1 -1
  182. package/dist/client/navigation-context.d.ts.map +1 -1
  183. package/dist/client/params-context.d.ts.map +1 -1
  184. package/dist/client/slot-context.d.ts +2 -2
  185. package/dist/client/slot-context.d.ts.map +1 -1
  186. package/dist/client/use-cookie.d.ts +18 -5
  187. package/dist/client/use-cookie.d.ts.map +1 -1
  188. package/dist/codec.js +2 -3
  189. package/dist/config-types.d.ts +22 -5
  190. package/dist/config-types.d.ts.map +1 -1
  191. package/dist/config-validation.d.ts.map +1 -1
  192. package/dist/cookies/define-cookie.d.ts.map +1 -1
  193. package/dist/cookies/index.js +40 -67
  194. package/dist/cookies/index.js.map +1 -1
  195. package/dist/cookies/json-cookie.d.ts +4 -4
  196. package/dist/index.js +266 -229
  197. package/dist/index.js.map +1 -1
  198. package/dist/params/index.js +3 -4
  199. package/dist/plugin-context.d.ts +7 -0
  200. package/dist/plugin-context.d.ts.map +1 -1
  201. package/dist/plugins/dev-discovery.d.ts +69 -5
  202. package/dist/plugins/dev-discovery.d.ts.map +1 -1
  203. package/dist/plugins/dev-hostname.d.ts +152 -0
  204. package/dist/plugins/dev-hostname.d.ts.map +1 -0
  205. package/dist/plugins/dev-server.d.ts +6 -2
  206. package/dist/plugins/dev-server.d.ts.map +1 -1
  207. package/dist/plugins/dev-store-clear.d.ts +83 -0
  208. package/dist/plugins/dev-store-clear.d.ts.map +1 -0
  209. package/dist/plugins/graph-endpoint.d.ts +4 -2
  210. package/dist/plugins/graph-endpoint.d.ts.map +1 -1
  211. package/dist/plugins/prebuilt.d.ts.map +1 -1
  212. package/dist/routing/index.js +4 -4
  213. package/dist/rsc-runtime/rsc.d.ts +2 -1
  214. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  215. package/dist/rsc-runtime/server-references.d.ts +8 -0
  216. package/dist/rsc-runtime/server-references.d.ts.map +1 -0
  217. package/dist/schema-bridge.d.ts +28 -19
  218. package/dist/schema-bridge.d.ts.map +1 -1
  219. package/dist/search-params/define.d.ts +1 -1
  220. package/dist/search-params/define.d.ts.map +1 -1
  221. package/dist/search-params/index.js +11 -14
  222. package/dist/search-params/index.js.map +1 -1
  223. package/dist/search-params/wrappers.d.ts +3 -3
  224. package/dist/server/access-gate.d.ts +12 -0
  225. package/dist/server/access-gate.d.ts.map +1 -1
  226. package/dist/server/canonicalize.d.ts +21 -0
  227. package/dist/server/canonicalize.d.ts.map +1 -1
  228. package/dist/server/cookie-context.d.ts +8 -1
  229. package/dist/server/cookie-context.d.ts.map +1 -1
  230. package/dist/server/flight-source-node.d.ts.map +1 -1
  231. package/dist/server/flight-source.d.ts.map +1 -1
  232. package/dist/server/index.d.ts +1 -1
  233. package/dist/server/index.d.ts.map +1 -1
  234. package/dist/server/index.js +8 -13
  235. package/dist/server/index.js.map +1 -1
  236. package/dist/server/interception-gates.d.ts +49 -0
  237. package/dist/server/interception-gates.d.ts.map +1 -0
  238. package/dist/server/internal.js +1080 -959
  239. package/dist/server/internal.js.map +1 -1
  240. package/dist/server/logger.d.ts +26 -0
  241. package/dist/server/logger.d.ts.map +1 -1
  242. package/dist/server/param-coercion.d.ts +8 -0
  243. package/dist/server/param-coercion.d.ts.map +1 -1
  244. package/dist/server/pipeline-interception.d.ts +34 -4
  245. package/dist/server/pipeline-interception.d.ts.map +1 -1
  246. package/dist/server/pipeline-metadata-route.d.ts +24 -0
  247. package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
  248. package/dist/server/pipeline-metadata.d.ts +3 -2
  249. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  250. package/dist/server/pipeline-phases.d.ts +9 -3
  251. package/dist/server/pipeline-phases.d.ts.map +1 -1
  252. package/dist/server/pipeline.d.ts +18 -0
  253. package/dist/server/pipeline.d.ts.map +1 -1
  254. package/dist/server/prebuilt/dev-store.d.ts +68 -22
  255. package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
  256. package/dist/server/prebuilt/overlay.d.ts +17 -3
  257. package/dist/server/prebuilt/overlay.d.ts.map +1 -1
  258. package/dist/server/prebuilt-runtime.d.ts.map +1 -1
  259. package/dist/server/primitives.d.ts +13 -0
  260. package/dist/server/primitives.d.ts.map +1 -1
  261. package/dist/server/render-utils.d.ts +21 -0
  262. package/dist/server/render-utils.d.ts.map +1 -1
  263. package/dist/server/request-context.d.ts +14 -0
  264. package/dist/server/request-context.d.ts.map +1 -1
  265. package/dist/server/route-element-builder.d.ts.map +1 -1
  266. package/dist/server/route-handler.d.ts +7 -0
  267. package/dist/server/route-handler.d.ts.map +1 -1
  268. package/dist/server/route-matcher.d.ts +14 -3
  269. package/dist/server/route-matcher.d.ts.map +1 -1
  270. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  271. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  272. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  273. package/dist/server/signal-identity.d.ts +6 -0
  274. package/dist/server/signal-identity.d.ts.map +1 -1
  275. package/dist/server/traced-access.d.ts +18 -0
  276. package/dist/server/traced-access.d.ts.map +1 -0
  277. package/dist/server/tracing.d.ts.map +1 -1
  278. package/dist/server/types.d.ts +5 -4
  279. package/dist/server/types.d.ts.map +1 -1
  280. package/dist/shims/font-google.js +1 -2
  281. package/dist/shims/font-local.js +1 -2
  282. package/dist/shims/headers.d.ts +11 -4
  283. package/dist/shims/headers.d.ts.map +1 -1
  284. package/docs/api/30-api-server.mdx +3 -1
  285. package/docs/api/32-api-cache.mdx +1 -1
  286. package/docs/api/33-api-search-params.mdx +3 -1
  287. package/docs/api/34-api-config.mdx +22 -0
  288. package/docs/api/36-cli.mdx +72 -6
  289. package/docs/learn/01-quick-start.mdx +1 -1
  290. package/docs/learn/06-typed-params.mdx +4 -4
  291. package/docs/learn/10-caching.mdx +26 -5
  292. package/llms.txt +1 -1
  293. package/package.json +12 -12
  294. package/src/adapters/build-output-helper.ts +26 -4
  295. package/src/adapters/cloudflare.ts +1 -0
  296. package/src/adapters/nitro-presets.ts +15 -0
  297. package/src/adapters/nitro-preview.ts +66 -34
  298. package/src/adapters/nitro.ts +14 -6
  299. package/src/analyze/graph-command.ts +25 -133
  300. package/src/cache/guarded-read.ts +44 -0
  301. package/src/cache/key-discipline.ts +218 -0
  302. package/src/cache/timber-cache.ts +46 -7
  303. package/src/cli-dev-status.ts +196 -0
  304. package/src/cli-init.ts +278 -0
  305. package/src/cli.ts +33 -79
  306. package/src/client/error-boundary.tsx +19 -2
  307. package/src/client/global-context.ts +42 -14
  308. package/src/client/navigation-context.ts +4 -11
  309. package/src/client/params-context.ts +5 -17
  310. package/src/client/segment-update-context.ts +1 -1
  311. package/src/client/slot-content-cache-context.ts +1 -1
  312. package/src/client/slot-context.ts +6 -17
  313. package/src/client/use-cookie.ts +33 -21
  314. package/src/config-types.ts +22 -5
  315. package/src/config-validation.ts +17 -0
  316. package/src/cookies/define-cookie.ts +10 -46
  317. package/src/cookies/json-cookie.ts +4 -4
  318. package/src/plugin-context.ts +7 -0
  319. package/src/plugins/dev-discovery.ts +216 -6
  320. package/src/plugins/dev-hostname.ts +322 -0
  321. package/src/plugins/dev-server.ts +130 -37
  322. package/src/plugins/dev-store-clear.ts +145 -0
  323. package/src/plugins/graph-endpoint.ts +15 -3
  324. package/src/plugins/prebuilt.ts +9 -0
  325. package/src/rsc-runtime/rsc.ts +7 -3
  326. package/src/rsc-runtime/server-references.ts +73 -0
  327. package/src/rsc-runtime/vendor-types.d.ts +17 -0
  328. package/src/schema-bridge.ts +93 -38
  329. package/src/search-params/define.ts +5 -6
  330. package/src/search-params/wrappers.ts +3 -3
  331. package/src/server/access-gate.tsx +32 -20
  332. package/src/server/action-handler.ts +58 -36
  333. package/src/server/canonicalize.ts +27 -0
  334. package/src/server/cookie-context.ts +11 -3
  335. package/src/server/flight-source-node.ts +5 -2
  336. package/src/server/flight-source.ts +4 -3
  337. package/src/server/index.ts +6 -1
  338. package/src/server/interception-gates.ts +94 -0
  339. package/src/server/logger.ts +32 -0
  340. package/src/server/param-coercion.ts +22 -0
  341. package/src/server/pipeline-interception.ts +64 -4
  342. package/src/server/pipeline-metadata-route.ts +242 -0
  343. package/src/server/pipeline-metadata.ts +7 -5
  344. package/src/server/pipeline-phases.ts +71 -131
  345. package/src/server/pipeline.ts +20 -2
  346. package/src/server/prebuilt/dev-store.ts +113 -34
  347. package/src/server/prebuilt/overlay.ts +32 -4
  348. package/src/server/prebuilt-runtime.ts +63 -45
  349. package/src/server/primitives.ts +14 -0
  350. package/src/server/render-utils.ts +25 -0
  351. package/src/server/request-context.ts +27 -3
  352. package/src/server/route-element-builder.ts +15 -2
  353. package/src/server/route-handler.ts +3 -2
  354. package/src/server/route-matcher.ts +48 -33
  355. package/src/server/rsc-entry/api-handler.ts +2 -33
  356. package/src/server/rsc-entry/index.ts +8 -3
  357. package/src/server/rsc-entry/rsc-stream.ts +7 -1
  358. package/src/server/signal-identity.ts +30 -12
  359. package/src/server/traced-access.ts +50 -0
  360. package/src/server/tracing.ts +18 -1
  361. package/src/server/types.ts +5 -4
  362. package/src/shims/headers.ts +12 -4
  363. package/dist/_chunks/actions-BDqn4Oxj.js.map +0 -1
  364. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
  365. package/dist/_chunks/cache-api-GE4AOe2H.js.map +0 -1
  366. package/dist/_chunks/chains-CDK1AWZQ.js +0 -1
  367. package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
  368. package/dist/_chunks/dev-server-BiWNMBVU.js +0 -1
  369. package/dist/_chunks/dev-server-DIy-SY-J.js.map +0 -1
  370. package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
  371. package/dist/_chunks/flight-source-node-HptmGMT8.js.map +0 -1
  372. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
  373. package/dist/_chunks/logger-CbLdcy-W.js.map +0 -1
  374. package/dist/_chunks/node-response-rkQqcFGq.js.map +0 -1
  375. package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
  376. package/dist/_chunks/schema-bridge-C83xa9lT.js.map +0 -1
  377. package/dist/_chunks/segment-context-xtPUGfdq.js.map +0 -1
  378. package/dist/server/prebuilt/key-discipline.d.ts +0 -52
  379. package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
  380. package/src/server/prebuilt/key-discipline.ts +0 -122
@@ -1,15 +1,14 @@
1
- import { a as readGraphCache, c as isPidAlive, i as hashFingerprintEntries, n as computeProjectFingerprint, o as writeGraphCache, r as fingerprintEntriesForFiles, s as DEV_DISCOVERY_DIR, t as collectBaseFingerprintEntries } from "../_chunks/graph-cache-CYiUS2aS.js";
2
- import { r as normalizeSlashes } from "../_chunks/scan-BoP17W3w.js";
1
+ import { a as readDevRecords, i as probeDevServer, t as DEV_PROBE_TIMEOUT_MS } from "../_chunks/dev-discovery-YnabkCKD.js";
2
+ import { r as normalizeSlashes } from "../_chunks/scan-CyizcBiX.js";
3
+ import { a as readGraphCache, i as hashFingerprintEntries, n as computeProjectFingerprint, o as writeGraphCache, r as fingerprintEntriesForFiles, t as collectBaseFingerprintEntries } from "../_chunks/graph-cache-B1LAg4t7.js";
3
4
  import { dirname, join, relative, resolve, sep } from "node:path";
4
5
  import { createRequire } from "node:module";
5
- import { existsSync, readFileSync, readdirSync } from "node:fs";
6
- import { request } from "node:http";
7
- import { request as request$1 } from "node:https";
6
+ import { existsSync } from "node:fs";
8
7
  import { fileURLToPath } from "node:url";
9
8
  import { promisify } from "node:util";
10
9
  import { mkdir, readFile, realpath, rm } from "node:fs/promises";
11
10
  import { execFile } from "node:child_process";
12
- //#region src/analyze/graph-command.ts
11
+ // src/analyze/graph-command.ts
13
12
  /**
14
13
  * graph-command — `timber graph <file> [--json] [--all --json]`.
15
14
  *
@@ -36,11 +35,6 @@ var execFileAsync = promisify(execFile);
36
35
  /** Crawl deadline passed to the child, plus slack for its boot/exit. */
37
36
  var CRAWL_TIMEOUT_MS = 12e4;
38
37
  /**
39
- * Short timeout for the dev-server probe: the fast path must not hold
40
- * the fallback hostage if the server is wedged or the connection hangs.
41
- */
42
- var DEV_PROBE_TIMEOUT_MS = 2e3;
43
- /**
44
38
  * Vite's own default config file names, in Vite's precedence order.
45
39
  * Matching the list (rather than globbing) keeps the walk-up aligned
46
40
  * with what `createServer` would discover in each directory.
@@ -70,104 +64,25 @@ function findViteConfigUpward(startDir) {
70
64
  dir = parent;
71
65
  }
72
66
  }
73
- /** Max response body size (16 MB — matches the crawl child). */
74
- var PROBE_MAX_BODY_BYTES = 16777216;
75
- /**
76
- * HTTP(S) GET with a wall-clock deadline and response-size limit,
77
- * returning the parsed JSON body or null on any failure. Uses
78
- * node:http/https directly — `fetch` silently strips the Host header,
79
- * which the endpoint's DNS-rebinding defense needs to see as `localhost`.
80
- *
81
- * The wall-clock timer covers both connection and body streaming —
82
- * node's `timeout` option is an INACTIVITY timeout that resets on every
83
- * chunk, so a slow-drip response would never fire it.
84
- */
85
- function probeEndpoint(record, path, timeoutMs) {
86
- return new Promise((resolve) => {
87
- let settled = false;
88
- const done = (value) => {
89
- if (settled) return;
90
- settled = true;
91
- clearTimeout(wallClock);
92
- resolve(value);
93
- };
94
- const probeHost = record.host === "0.0.0.0" || record.host === "::" || record.host === "" ? "127.0.0.1" : record.host;
95
- const req = (record.protocol === "https" ? request$1 : request)({
96
- hostname: probeHost,
97
- port: record.port,
98
- path,
99
- method: "GET",
100
- rejectUnauthorized: false
101
- }, (res) => {
102
- if (res.statusCode !== 200) {
103
- req.destroy();
104
- done(null);
105
- return;
106
- }
107
- const chunks = [];
108
- let totalBytes = 0;
109
- res.on("data", (chunk) => {
110
- totalBytes += chunk.length;
111
- if (totalBytes > PROBE_MAX_BODY_BYTES) {
112
- req.destroy();
113
- done(null);
114
- return;
115
- }
116
- chunks.push(chunk);
117
- });
118
- res.on("end", () => {
119
- try {
120
- const parsed = JSON.parse(Buffer.concat(chunks).toString("utf8"));
121
- done(parsed?.version === 1 && parsed?.source === "dev-server" ? parsed : null);
122
- } catch {
123
- done(null);
124
- }
125
- });
126
- res.on("error", () => done(null));
127
- });
128
- req.on("error", () => done(null));
129
- const wallClock = setTimeout(() => {
130
- req.destroy();
131
- done(null);
132
- }, timeoutMs);
133
- req.end();
134
- });
135
- }
136
67
  /**
137
68
  * Try to delegate a graph query to a running dev server discovered via
138
- * `.timber/dev/` records. Returns the parsed JSON response on success,
139
- * null on any failure (missing dir, no live records, probe failure).
140
- * Every failure mode is silent — the caller falls back to the cold crawl.
69
+ * its discovery record. Returns the parsed JSON response on success, null
70
+ * on any failure (no live records, wrong config, probe failure). Every
71
+ * failure mode is silent — the caller falls back to the cold crawl. The
72
+ * graph request itself is the liveness probe, so no separate status probe
73
+ * is made.
141
74
  */
142
75
  async function tryDevServer(configDir, configFile, queryString) {
143
- const dir = join(configDir, DEV_DISCOVERY_DIR);
144
- let entries;
145
- try {
146
- entries = readdirSync(dir);
147
- } catch {
148
- return null;
149
- }
150
- for (const entry of entries) {
151
- if (!entry.endsWith(".json")) continue;
152
- let record;
153
- try {
154
- record = JSON.parse(readFileSync(join(dir, entry), "utf8"));
155
- } catch {
156
- continue;
157
- }
158
- if (typeof record.port !== "number" || !Number.isInteger(record.port) || record.port < 1 || record.port > 65535 || typeof record.pid !== "number" || !Number.isInteger(record.pid) || record.pid < 1 || typeof record.host !== "string" || record.protocol !== "http" && record.protocol !== "https") continue;
76
+ for (const record of readDevRecords(configDir)) {
159
77
  if (record.configFile && normalizeSlashes(record.configFile) !== normalizeSlashes(configFile)) continue;
160
- if (!isPidAlive(record.pid)) continue;
161
- let result;
162
- try {
163
- result = await probeEndpoint(record, `/__timber/graph${queryString}`, DEV_PROBE_TIMEOUT_MS);
164
- } catch {
165
- continue;
166
- }
167
- if (result) return result;
78
+ const result = await probeDevServer(record, `/__timber/graph${queryString}`, DEV_PROBE_TIMEOUT_MS);
79
+ if (isDevServerGraphResponse(result)) return result;
168
80
  }
169
81
  return null;
170
82
  }
83
+ function isDevServerGraphResponse(value) {
84
+ return typeof value === "object" && value !== null && "version" in value && value.version === 1 && "source" in value && value.source === "dev-server";
85
+ }
171
86
  /**
172
87
  * Resolve the app root from the config file's own directory, reading
173
88
  * it off the timber root-sync plugin api (the single supported way —
@@ -182,7 +97,7 @@ async function tryDevServer(configDir, configFile, queryString) {
182
97
  */
183
98
  async function resolveAppRoot(configFile) {
184
99
  const { resolveConfig } = await import("vite");
185
- const { isTimberPluginApi } = await import("../_chunks/plugin-context-uDHFqHHJ.js");
100
+ const { isTimberPluginApi } = await import("../_chunks/plugin-context-BfSRKJfz.js");
186
101
  const previousCwd = process.cwd();
187
102
  process.chdir(dirname(configFile));
188
103
  const stdoutWrite = process.stdout.write;
@@ -378,7 +293,7 @@ async function printSingleFile(input, target, module, answer, json) {
378
293
  console.log(` environments: ${envs.length > 0 ? envs.join(", ") : "none"}`);
379
294
  if (module.subtreeUnknown) console.log(" note: reachable, but its subtree is unknown (never transformed)");
380
295
  if (module.chains.length > 0) {
381
- const { formatChains } = await import("../_chunks/chains-CDK1AWZQ.js");
296
+ const { formatChains } = await import("../_chunks/chains-CwOr3Myj.js");
382
297
  console.log(" import chains:");
383
298
  console.log(formatChains(module.chains, root));
384
299
  }
@@ -397,7 +312,7 @@ async function printDevServerText(data, configDir) {
397
312
  console.log(` environments: ${envList.length > 0 ? envList.join(", ") : "none"}`);
398
313
  if (data.subtreeUnknown) console.log(" note: reachable, but its subtree is unknown (never transformed)");
399
314
  if (data.chains.length > 0) {
400
- const { formatChains } = await import("../_chunks/chains-CDK1AWZQ.js");
315
+ const { formatChains } = await import("../_chunks/chains-CwOr3Myj.js");
401
316
  console.log(" import chains:");
402
317
  console.log(formatChains(data.chains, configDir));
403
318
  }
@@ -466,7 +381,6 @@ async function runGraph(options) {
466
381
  if (!module) throw new Error(`[timber] ${candidates[0]} is not part of the app at ${answer.report.root}\n (resolved from ${configFile}). Only project source files inside the app\n root are classified — node_modules and non-source files are not.`);
467
382
  await printSingleFile(target.input, module.file, module, answer, options.json);
468
383
  }
469
- //#endregion
470
384
  export { findViteConfigUpward, runGraph };
471
385
 
472
386
  //# sourceMappingURL=graph-command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-command.js","names":["httpsRequest","httpRequest"],"sources":["../../src/analyze/graph-command.ts"],"sourcesContent":["/**\n * graph-command — `timber graph <file> [--json] [--all --json]`.\n *\n * Answers \"what environment(s) does this file run in?\" by delegating\n * to a running dev server when one is discovered (milliseconds), and\n * falling back to the cold crawl + mtime-keyed cache otherwise\n * (design/47 §5b). Dev-server responses are NOT cached in the mtime\n * cache: live answers may include real browser-graph data.\n *\n * Config anchoring deliberately diverges from `check`/`build`: those\n * discover the Vite config from the cwd (\"the app here\"), which is\n * wrong for a file-addressed command invoked from a monorepo root —\n * cwd anchoring would select the wrong app. `graph` walks UP from the\n * target file's directory to the nearest Vite config and resolves from\n * there, so the file's own app answers. `--config` overrides, same as\n * everywhere else.\n *\n * Cold-path policy: a cold single-file query runs the full-project\n * crawl (`--all` internally) and caches the entire report — one crawl\n * per project state, every subsequent question a cache hit. The\n * cache-hit path never imports Vite.\n */\n\nimport { execFile } from 'node:child_process';\nimport { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { mkdir, readFile, realpath, rm } from 'node:fs/promises';\nimport { request as httpRequest } from 'node:http';\nimport { request as httpsRequest } from 'node:https';\nimport { createRequire } from 'node:module';\nimport { dirname, join, relative, resolve, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { promisify } from 'node:util';\nimport { DEV_DISCOVERY_DIR, isPidAlive, type DevRecord } from '../plugins/dev-discovery.ts';\nimport {\n collectBaseFingerprintEntries,\n computeProjectFingerprint,\n fingerprintEntriesForFiles,\n hashFingerprintEntries,\n readGraphCache,\n writeGraphCache,\n GRAPH_CACHE_VERSION,\n GRAPH_JSON_VERSION,\n} from './graph-cache.ts';\nimport type { CrawlReport, GraphModuleReport } from './crawl.ts';\nimport type { ImportChain } from './chains.ts';\nimport { normalizeSlashes } from './scan.ts';\n\nconst execFileAsync = promisify(execFile);\n\nexport type GraphSource = 'dev-server' | 'static-scan';\n\n/** Crawl deadline passed to the child, plus slack for its boot/exit. */\nconst CRAWL_TIMEOUT_MS = 120_000;\nconst SPAWN_SLACK_MS = 30_000;\n\n/**\n * Short timeout for the dev-server probe: the fast path must not hold\n * the fallback hostage if the server is wedged or the connection hangs.\n */\nconst DEV_PROBE_TIMEOUT_MS = 2_000;\n\n/**\n * Vite's own default config file names, in Vite's precedence order.\n * Matching the list (rather than globbing) keeps the walk-up aligned\n * with what `createServer` would discover in each directory.\n */\nconst VITE_CONFIG_FILES = [\n 'vite.config.js',\n 'vite.config.mjs',\n 'vite.config.ts',\n 'vite.config.cjs',\n 'vite.config.mts',\n 'vite.config.cts',\n];\n\nexport interface GraphOptions {\n /** Target file; required unless `all`. */\n file?: string;\n /** Explicit Vite config path (overrides the walk-up discovery). */\n config?: string;\n json: boolean;\n all: boolean;\n}\n\n/**\n * Walk up from `startDir` to the nearest directory containing a Vite\n * config file. Returns the config's absolute path, or null at the\n * filesystem root.\n */\nexport function findViteConfigUpward(startDir: string): string | null {\n let dir = startDir;\n for (;;) {\n for (const name of VITE_CONFIG_FILES) {\n const candidate = join(dir, name);\n if (existsSync(candidate)) return candidate;\n }\n const parent = dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n\n/** Max response body size (16 MB — matches the crawl child). */\nconst PROBE_MAX_BODY_BYTES = 16 * 1024 * 1024;\n\n/**\n * HTTP(S) GET with a wall-clock deadline and response-size limit,\n * returning the parsed JSON body or null on any failure. Uses\n * node:http/https directly — `fetch` silently strips the Host header,\n * which the endpoint's DNS-rebinding defense needs to see as `localhost`.\n *\n * The wall-clock timer covers both connection and body streaming —\n * node's `timeout` option is an INACTIVITY timeout that resets on every\n * chunk, so a slow-drip response would never fire it.\n */\nfunction probeEndpoint(record: DevRecord, path: string, timeoutMs: number): Promise<unknown> {\n return new Promise((resolve) => {\n let settled = false;\n const done = (value: unknown) => {\n if (settled) return;\n settled = true;\n clearTimeout(wallClock);\n resolve(value);\n };\n\n const probeHost =\n record.host === '0.0.0.0' || record.host === '::' || record.host === ''\n ? '127.0.0.1'\n : record.host;\n const doRequest = record.protocol === 'https' ? httpsRequest : httpRequest;\n const req = doRequest(\n {\n hostname: probeHost,\n port: record.port,\n path,\n method: 'GET',\n // Self-signed certs are normal for dev servers.\n rejectUnauthorized: false,\n },\n (res) => {\n if (res.statusCode !== 200) {\n req.destroy();\n done(null);\n return;\n }\n const chunks: Buffer[] = [];\n let totalBytes = 0;\n res.on('data', (chunk: Buffer) => {\n totalBytes += chunk.length;\n if (totalBytes > PROBE_MAX_BODY_BYTES) {\n req.destroy();\n done(null);\n return;\n }\n chunks.push(chunk);\n });\n res.on('end', () => {\n try {\n const parsed = JSON.parse(Buffer.concat(chunks).toString('utf8')) as Record<\n string,\n unknown\n >;\n done(\n parsed?.version === GRAPH_JSON_VERSION && parsed?.source === 'dev-server'\n ? parsed\n : null\n );\n } catch {\n done(null);\n }\n });\n res.on('error', () => done(null));\n }\n );\n req.on('error', () => done(null));\n\n const wallClock = setTimeout(() => {\n req.destroy();\n done(null);\n }, timeoutMs);\n req.end();\n });\n}\n\n/**\n * Try to delegate a graph query to a running dev server discovered via\n * `.timber/dev/` records. Returns the parsed JSON response on success,\n * null on any failure (missing dir, no live records, probe failure).\n * Every failure mode is silent — the caller falls back to the cold crawl.\n */\nasync function tryDevServer(\n configDir: string,\n configFile: string,\n queryString: string\n): Promise<unknown> {\n const dir = join(configDir, DEV_DISCOVERY_DIR);\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return null;\n }\n for (const entry of entries) {\n if (!entry.endsWith('.json')) continue;\n let record: DevRecord;\n try {\n record = JSON.parse(readFileSync(join(dir, entry), 'utf8')) as DevRecord;\n } catch {\n continue;\n }\n if (\n typeof record.port !== 'number' ||\n !Number.isInteger(record.port) ||\n record.port < 1 ||\n record.port > 65535 ||\n typeof record.pid !== 'number' ||\n !Number.isInteger(record.pid) ||\n record.pid < 1 ||\n typeof record.host !== 'string' ||\n (record.protocol !== 'http' && record.protocol !== 'https')\n ) {\n continue;\n }\n // Skip records from a different Vite config (TIM-1393). Records\n // without configFile (old servers) are accepted — rejecting them\n // would break the fast path until every server restarts.\n if (record.configFile && normalizeSlashes(record.configFile) !== normalizeSlashes(configFile))\n continue;\n if (!isPidAlive(record.pid)) continue;\n let result: unknown;\n try {\n result = await probeEndpoint(record, `/__timber/graph${queryString}`, DEV_PROBE_TIMEOUT_MS);\n } catch {\n // http.request can throw synchronously on malformed hostnames\n // (ERR_INVALID_CHAR) or other invalid options — treat as absent.\n continue;\n }\n if (result) return result;\n }\n return null;\n}\n\n/**\n * Resolve the app root from the config file's own directory, reading\n * it off the timber root-sync plugin api (the single supported way —\n * cf. cli-check.ts). Only runs on the cold path.\n *\n * Resolution uses SERVE/development semantics, not build's: the crawl\n * child evaluates this same config through `createServer` (dev), and\n * the dev-server fast path answers from dev graphs — the dev graphs\n * are the tool's ground truth (design/47 §Motivation). Resolving the\n * root under build mode while crawling under serve would let a\n * command/mode-branching config select one app and crawl another.\n */\nasync function resolveAppRoot(\n configFile: string\n): Promise<{ root: string; configFileDependencies: string[]; pageExtensions?: string[] }> {\n const { resolveConfig } = await import('vite');\n // Lazy for the same reason as Vite itself: plugin-context.ts has a\n // module-level `parseAst` import from vite, so a static import here\n // would make even warm cache hits pay Vite's startup cost — the\n // cache-hit path must stay vite-free (design/47 §Cold-path policy).\n const { isTimberPluginApi } = await import('../plugin-context.ts');\n // Anchor Vite's cwd-relative defaults at the config's directory, not\n // the caller's cwd — the whole point of the walk-up. The config's own\n // explicit `root` option still wins over this cwd, as it should.\n const previousCwd = process.cwd();\n process.chdir(dirname(configFile));\n // Route config-evaluation stdout to stderr for the duration: the\n // app's config and plugin hooks run in THIS process, and any\n // console.log from them would land in front of the --json contract,\n // breaking JSON.parse(stdout) consumers. (The crawl child has the\n // same problem solved by --out; this parent-side evaluation needs\n // the equivalent.) Bind write() so its overloads keep their exact\n // callback semantics.\n const stdoutWrite = process.stdout.write;\n process.stdout.write = process.stderr.write.bind(process.stderr) as typeof process.stdout.write;\n try {\n // TIMBER_ANALYZE and middlewareMode mirror the crawl child's boot:\n // serve-mode config hooks otherwise start dev-only side effects in\n // THIS process — the startup holding server binds the app's port\n // and keeps the CLI alive forever (index.ts gates it on\n // !middlewareMode), and platform dev plugins may open remote\n // connections classification never needs.\n process.env.TIMBER_ANALYZE = '1';\n const {\n plugins,\n configFileDependencies,\n resolve: resolveOptions,\n } = await resolveConfig(\n { configFile, logLevel: 'error', server: { middlewareMode: true } },\n 'serve',\n 'development',\n 'development'\n );\n const rootSync = plugins.find((plugin) => plugin.name === 'timber-root-sync');\n if (!rootSync || !isTimberPluginApi(rootSync.api)) {\n throw new Error(\n `[timber] ${configFile} does not produce the timber plugin.\\n` +\n ` \\`timber graph\\` resolves the app through Vite so it classifies the same\\n` +\n ` modules the build builds. Check that the config lists timber():\\n\\n` +\n ` import { timber } from '@timber-js/app';\\n` +\n ` export default { plugins: [timber()] };\\n`\n );\n }\n // Same path space as the crawl's report.root — the hit path\n // fingerprints cache.report.root, so a divergent space here\n // (backslashes, or symlink-vs-physical) would make miss- and\n // hit-path entry strings differ and the cache never match. Vite\n // does NOT realpath its resolved root; the crawl realpaths unless\n // resolve.preserveSymlinks keeps graphs on symlink paths — mirror\n // that decision from the same resolved config.\n const { normalizePath } = await import('vite');\n const pluginCtx = rootSync.api.getContext();\n const rawRoot = pluginCtx.root;\n return {\n root: normalizePath(resolveOptions.preserveSymlinks ? rawRoot : await realpath(rawRoot)),\n // A config helper imported from OUTSIDE the app root (a shared\n // vite.shared.ts beside a monorepo config) can reshape aliases,\n // plugins, or timber options without touching anything the disk\n // scan sees — the fingerprint must track these too. Vite's list\n // covers the vite.config bundle; timber.config.ts is require()d\n // by root-sync during resolveConfig, so its transitive imports\n // live in require.cache and are collected from there.\n configFileDependencies: [...configFileDependencies, ...collectTimberConfigDeps()],\n pageExtensions: pluginCtx.config.pageExtensions,\n };\n } finally {\n process.stdout.write = stdoutWrite;\n process.chdir(previousCwd);\n }\n}\n\n/**\n * Transitive dependencies of the loaded timber.config, from\n * require.cache: `loadTimberConfigFile` loads the config with native\n * require() (design/11 §Config Loading Semantics), so after\n * resolveConfig has run the config module and everything it imported —\n * including helpers OUTSIDE the app root that Vite's\n * configFileDependencies cannot see — sit in the cache with their\n * children recorded. node_modules entries are skipped (the lockfile\n * fingerprint covers them).\n */\nfunction collectTimberConfigDeps(): string[] {\n const require = createRequire(import.meta.url);\n const cache = require.cache ?? {};\n const roots = Object.values(cache).filter(\n (mod): mod is NonNullable<typeof mod> =>\n mod != null && /timber\\.config\\.(?:ts|js|mjs)$/.test(mod.filename)\n );\n const deps: string[] = [];\n const seen = new Set<string>();\n const queue = [...roots];\n while (queue.length > 0) {\n const mod = queue.shift()!;\n if (seen.has(mod.filename)) continue;\n seen.add(mod.filename);\n if (mod.filename.includes(`${sep}node_modules${sep}`)) continue;\n deps.push(mod.filename);\n queue.push(...mod.children);\n }\n return deps;\n}\n\n/**\n * Locate the crawl child entry beside this module: the built `.js` in\n * a published install, the `.ts` source under tsx (tests, this repo).\n */\nfunction resolveCrawlEntry(): { entry: string; nodeArgs: string[] } {\n const jsEntry = fileURLToPath(new URL('./crawl-entry.js', import.meta.url));\n if (existsSync(jsEntry)) return { entry: jsEntry, nodeArgs: [] };\n const tsEntry = fileURLToPath(new URL('./crawl-entry.ts', import.meta.url));\n return { entry: tsEntry, nodeArgs: ['--import', 'tsx/esm'] };\n}\n\n/** Spawn the crawl child and read its report from the --out file. */\nasync function runColdCrawl(root: string, configFile: string): Promise<CrawlReport> {\n const { entry, nodeArgs } = resolveCrawlEntry();\n const outFile = join(root, '.timber', `graph-crawl-${process.pid}.json`);\n await mkdir(dirname(outFile), { recursive: true });\n try {\n await execFileAsync(\n process.execPath,\n [\n ...nodeArgs,\n entry,\n '--root',\n root,\n '--config',\n configFile,\n '--out',\n outFile,\n '--timeout',\n String(CRAWL_TIMEOUT_MS),\n ],\n {\n // Same cwd anchor as resolveAppRoot: a config that derives\n // options from process.cwd() must evaluate identically in the\n // resolution that selected the app and in the crawl that\n // classifies it, or the two describe different apps. The app\n // root still reaches the child explicitly via --root.\n cwd: dirname(configFile),\n // The child's BFS deadline handles hung transforms; this spawn\n // timeout is the outer guard for a hang in createServer itself,\n // which the deadline cannot cover (see crawl-entry.ts).\n timeout: CRAWL_TIMEOUT_MS + SPAWN_SLACK_MS,\n maxBuffer: 16 * 1024 * 1024,\n }\n );\n return JSON.parse(await readFile(outFile, 'utf8')) as CrawlReport;\n } finally {\n await rm(outFile, { force: true }).catch(() => {});\n }\n}\n\ninterface GraphAnswer {\n report: CrawlReport;\n configFile: string;\n cached: boolean;\n}\n\n/**\n * Produce the full-project report: cache hit when the fingerprint\n * matches, cold crawl otherwise.\n *\n * The scan-derived base entries are computed BEFORE the crawl — files\n * changing mid-crawl make the next query miss, never the reverse. The\n * `trackedExtras` (config dependencies + every file the report\n * classifies) are only knowable after resolution and crawl, so their\n * entries are stat'd afterwards; for those alone, a mid-crawl edit is\n * stale-until-the-next-edit rather than an immediate miss.\n */\nasync function loadReport(configFile: string): Promise<GraphAnswer> {\n // The cache is anchored at the config file's directory, NOT the\n // resolved Vite root: knowing the root requires resolveConfig (which\n // imports Vite), and the entire point of the hit path is answering\n // without it. Reading and writing must use the same anchor — a split\n // (read here, write under the resolved root) would never hit for a\n // config whose `root` points elsewhere, silently re-crawling forever.\n const cacheDir = dirname(configFile);\n const cache = await readGraphCache(cacheDir);\n if (cache && cache.configFile === configFile) {\n const fingerprint = await computeProjectFingerprint(\n cache.report.root,\n configFile,\n cache.trackedExtras,\n cache.pageExtensions\n );\n if (fingerprint === cache.fingerprint) {\n return { report: cache.report, configFile, cached: true };\n }\n }\n\n const { root, configFileDependencies, pageExtensions } = await resolveAppRoot(configFile);\n const baseEntries = await collectBaseFingerprintEntries(root, configFile, pageExtensions);\n process.stderr.write('[timber] graph cache miss — cold project crawl (~2.5–10 s)\\n');\n // Config-dependency entries are snapshotted BEFORE the crawl, like\n // the base entries: a config helper edited during the multi-second\n // crawl must make the next query miss, not be stamped post-crawl\n // with its new mtime beside a report built from its old contents.\n const configDepEntries = await fingerprintEntriesForFiles(configFileDependencies);\n const report = await runColdCrawl(root, configFile);\n if (report.incomplete) {\n // Deadline-truncated report: transient (slow machine, cold dep\n // optimizer). Serve it — a truncated answer now beats none — but\n // never cache it: with unchanged files it would be served forever,\n // with no retry after the transient cause cleared.\n process.stderr.write('[timber] crawl hit its deadline — serving truncated, uncached report\\n');\n return { report, configFile, cached: false };\n }\n const trackedExtras = [\n ...new Set([...configFileDependencies, ...report.modules.map((m) => m.file)]),\n ].sort();\n // Report-file entries can only be stat'd post-crawl (the set is\n // unknowable before); for those alone a mid-crawl edit is stale-\n // until-next-edit. Files already covered pre-crawl (scan overlap,\n // config deps) keep their pre-crawl entries — hashFingerprintEntries\n // dedupes identical strings, and a mid-crawl edit produces a\n // DIFFERENT post-crawl entry for the same path, which changes the\n // hash and correctly misses on the next query.\n const reportFileEntries = await fingerprintEntriesForFiles(report.modules.map((m) => m.file));\n const fingerprint = hashFingerprintEntries([\n ...baseEntries,\n ...configDepEntries,\n ...reportFileEntries,\n ]);\n await writeGraphCache(cacheDir, {\n version: GRAPH_CACHE_VERSION,\n fingerprint,\n configFile,\n pageExtensions,\n trackedExtras,\n report,\n });\n return { report, configFile, cached: false };\n}\n\n/** Project-relative display path (JSON always stays absolute). */\nfunction displayPath(file: string, root: string): string {\n const rel = relative(root, file);\n return rel.startsWith('..') ? file : rel;\n}\n\n/**\n * Crawl errors that bear on one file's answer: failures on the file\n * itself (recorded by path or by root-relative URL) plus scan-level\n * failures, which undermine completeness for every file. Without this,\n * a target whose own transform failed would print a confident `server`\n * classification while only `--all` exposed the error (codex review,\n * PR #1056).\n */\nfunction errorsForTarget(report: CrawlReport, target: string): CrawlReport['errors'] {\n const asUrl = '/' + relative(report.root, target).split('\\\\').join('/');\n return report.errors.filter(\n (error) => error.environment === 'scan' || error.id === target || error.id === asUrl\n );\n}\n\nasync function printSingleFile(\n input: string,\n target: string,\n module: GraphModuleReport,\n answer: GraphAnswer,\n json: boolean\n): Promise<void> {\n const errors = errorsForTarget(answer.report, target);\n if (json) {\n console.log(\n JSON.stringify({\n version: GRAPH_JSON_VERSION,\n source: 'static-scan' satisfies GraphSource,\n cached: answer.cached,\n target: { input, resolved: target },\n kind: module.kind,\n pending: module.pending,\n subtreeUnknown: module.subtreeUnknown,\n envs: module.envs,\n boundary: module.boundary,\n chains: module.chains,\n poisonings: module.poisonings,\n errors,\n })\n );\n return;\n }\n\n const root = answer.report.root;\n const envs = Object.entries(module.envs)\n .filter(([, present]) => present)\n .map(([env]) => env);\n console.log(\n `${displayPath(target, root)} — ${module.kind}` +\n `${module.pending ? ' (pending: no graph has confirmed this file yet)' : ''}`\n );\n console.log(` source: static-scan${answer.cached ? ' (cached)' : ''}`);\n console.log(` environments: ${envs.length > 0 ? envs.join(', ') : 'none'}`);\n if (module.subtreeUnknown) {\n console.log(' note: reachable, but its subtree is unknown (never transformed)');\n }\n if (module.chains.length > 0) {\n // Lazy import: the text formatter pulls Vite (normalizePath); the\n // JSON path above must stay import-free for fast cache hits.\n const { formatChains } = await import('./chains.ts');\n console.log(' import chains:');\n console.log(formatChains(module.chains, root));\n }\n for (const poisoning of module.poisonings) {\n console.log(\n ` poisoning: ${poisoning.description} (${poisoning.specifier}) — ` +\n `implies ${poisoning.implies}`\n );\n }\n for (const error of errors) {\n console.log(` error [${error.environment}]: ${error.message} (${error.id})`);\n }\n}\n\n/**\n * The single-file JSON contract shape for dev-server responses. Shared\n * between the HTTP endpoint (graph-endpoint.ts) and this consumer so\n * the boundary crossing is typed, not cast. The endpoint produces this\n * shape; `probeEndpoint` parses it; `printDevServerText` formats it.\n */\ninterface DevServerFileResponse {\n version: number;\n source: string;\n cached: boolean;\n target: { input: string; resolved: string };\n kind: string;\n pending: boolean;\n subtreeUnknown: boolean;\n envs: Record<string, boolean>;\n boundary: boolean;\n chains: ImportChain[];\n poisonings: Array<{ description: string; specifier: string; implies: string }>;\n errors: Array<{ environment: string; message: string; id: string }>;\n}\n\n/**\n * Text-mode output for a dev-server response. The response carries the\n * same fields as the static-scan JSON, so the formatting mirrors\n * `printSingleFile` with `source: \"dev-server\"`.\n */\nasync function printDevServerText(data: DevServerFileResponse, configDir: string): Promise<void> {\n console.log(\n `${displayPath(data.target.resolved, configDir)} — ${data.kind}` +\n `${data.pending ? ' (pending: no graph has confirmed this file yet)' : ''}`\n );\n console.log(' source: dev-server');\n const envList = Object.entries(data.envs)\n .filter(([, present]) => present)\n .map(([env]) => env);\n console.log(` environments: ${envList.length > 0 ? envList.join(', ') : 'none'}`);\n if (data.subtreeUnknown) {\n console.log(' note: reachable, but its subtree is unknown (never transformed)');\n }\n if (data.chains.length > 0) {\n const { formatChains } = await import('./chains.ts');\n console.log(' import chains:');\n console.log(formatChains(data.chains, configDir));\n }\n for (const poisoning of data.poisonings) {\n console.log(\n ` poisoning: ${poisoning.description} (${poisoning.specifier}) — ` +\n `implies ${poisoning.implies}`\n );\n }\n for (const error of data.errors) {\n console.log(` error [${error.environment}]: ${error.message} (${error.id})`);\n }\n}\n\n/**\n * Run `timber graph`. Throws with actionable messages; the CLI's main()\n * prints and exits nonzero.\n */\nexport async function runGraph(options: GraphOptions): Promise<void> {\n if (options.all && !options.json) {\n throw new Error(\n 'timber graph --all requires --json (no text format is defined for the full project).'\n );\n }\n let target: { input: string; candidates: string[] } | null = null;\n if (options.file) {\n const resolved = resolve(process.cwd(), options.file);\n if (!existsSync(resolved)) {\n throw new Error(`[timber] file not found: ${resolved}`);\n }\n // Report paths are slash-normalized (normalizeSlashes) and usually\n // realpaths — but under resolve.preserveSymlinks the graphs keep\n // symlink paths. Look up BOTH forms rather than guessing the\n // config's setting (the hit path is vite-free and cannot ask):\n // as-typed first, realpath second.\n const asTyped = normalizeSlashes(resolved);\n const physical = normalizeSlashes(await realpath(resolved));\n target = {\n input: options.file,\n candidates: asTyped === physical ? [asTyped] : [asTyped, physical],\n };\n }\n if (!options.all && !target) {\n throw new Error('Usage: timber graph <file> [--json], or timber graph --all --json');\n }\n\n // Anchor config discovery at the AS-TYPED path (candidates[0]): under\n // preserveSymlinks a symlinked target's realpath may live in a\n // sibling workspace package, and walking up from there would select\n // that package's config — or none — instead of the app the user\n // addressed. The realpath candidate exists only for module lookup.\n const anchor = target ? dirname(target.candidates[0]) : process.cwd();\n const configFile = options.config\n ? resolve(process.cwd(), options.config)\n : findViteConfigUpward(anchor);\n if (!configFile || !existsSync(configFile)) {\n throw new Error(\n `[timber] no Vite config found walking up from ${anchor}.\\n` +\n ` \\`timber graph\\` anchors config discovery at the target file (not the cwd)\\n` +\n ` so the file's own app answers in a monorepo. Pass --config <path> to override.`\n );\n }\n\n // Fast path: delegate to a running dev server if one is discovered.\n // The query string mirrors the endpoint's contract — `?file=` for\n // single-file, `?all=1` for the full project. The endpoint returns\n // the same JSON contract the CLI prints, so on success the response\n // is printed verbatim (JSON mode) or decoded and formatted (text).\n // TIMBER_ANALYZE=1 suppresses delegation: the crawl child sets it\n // to skip dev-server side effects, and it also prevents the child\n // from discovering and probing the parent dev server's own endpoint.\n const configDir = dirname(configFile);\n const delegate = process.env.TIMBER_ANALYZE !== '1';\n if (delegate && options.all) {\n const live = await tryDevServer(configDir, configFile, '?all=1');\n if (live) {\n // --json is already guaranteed by the guard at the top.\n console.log(JSON.stringify(live));\n return;\n }\n } else if (delegate && target) {\n // The endpoint accepts absolute paths — pass the as-typed candidate\n // (matching the CLI's own config anchoring, not the realpath).\n const live = await tryDevServer(\n configDir,\n configFile,\n `?file=${encodeURIComponent(target.candidates[0])}`\n );\n if (live) {\n if (options.json) {\n // Preserve the user's original input (e.g. \"app/page.tsx\") —\n // the endpoint echoes the absolute path we sent as target.input,\n // which would differ from the cold path's relative input.\n const liveObj = live as Record<string, unknown>;\n if (typeof liveObj.target === 'object' && liveObj.target !== null) {\n (liveObj.target as Record<string, unknown>).input = target.input;\n }\n console.log(JSON.stringify(liveObj));\n return;\n }\n // The endpoint produces DevServerFileResponse by construction —\n // both frontends use the same classification pipeline. This is\n // the HTTP JSON boundary: probeEndpoint returns `unknown` from\n // JSON.parse; we narrow here because the endpoint's shape is our\n // own contract, not third-party data.\n await printDevServerText(live as DevServerFileResponse, configDir);\n return;\n }\n }\n\n // Cold path: mtime-keyed cache, then crawl.\n const answer = await loadReport(configFile);\n\n if (options.all) {\n console.log(\n JSON.stringify({\n version: GRAPH_JSON_VERSION,\n source: 'static-scan' satisfies GraphSource,\n cached: answer.cached,\n root: answer.report.root,\n configFile: answer.configFile,\n modules: answer.report.modules,\n errors: answer.report.errors,\n stats: answer.report.stats,\n })\n );\n return;\n }\n\n if (!target) {\n // Unreachable — validated at the top; kept for type narrowing.\n throw new Error('Usage: timber graph <file> [--json]');\n }\n const candidates = target.candidates;\n const module = answer.report.modules.find((m) => candidates.includes(m.file));\n if (!module) {\n throw new Error(\n `[timber] ${candidates[0]} is not part of the app at ${answer.report.root}\\n` +\n ` (resolved from ${configFile}). Only project source files inside the app\\n` +\n ` root are classified — node_modules and non-source files are not.`\n );\n }\n await printSingleFile(target.input, module.file, module, answer, options.json);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAM,gBAAgB,UAAU,QAAQ;;AAKxC,IAAM,mBAAmB;;;;;AAOzB,IAAM,uBAAuB;;;;;;AAO7B,IAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AAgBA,SAAgB,qBAAqB,UAAiC;CACpE,IAAI,MAAM;CACV,SAAS;EACP,KAAK,MAAM,QAAQ,mBAAmB;GACpC,MAAM,YAAY,KAAK,KAAK,IAAI;GAChC,IAAI,WAAW,SAAS,GAAG,OAAO;EACpC;EACA,MAAM,SAAS,QAAQ,GAAG;EAC1B,IAAI,WAAW,KAAK,OAAO;EAC3B,MAAM;CACR;AACF;;AAGA,IAAM,uBAAuB;;;;;;;;;;;AAY7B,SAAS,cAAc,QAAmB,MAAc,WAAqC;CAC3F,OAAO,IAAI,SAAS,YAAY;EAC9B,IAAI,UAAU;EACd,MAAM,QAAQ,UAAmB;GAC/B,IAAI,SAAS;GACb,UAAU;GACV,aAAa,SAAS;GACtB,QAAQ,KAAK;EACf;EAEA,MAAM,YACJ,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AIhB,MAAM,UAAU;IAChB,IAAI,OAAO,QAAQ,WAAW,YAAY,QAAQ,WAAW,MAC3D,QAAS,OAAmC,QAAQ,OAAO;IAE7D,QAAQ,IAAI,KAAK,UAAU,OAAO,CAAC;IACnC;GACF;GAMA,MAAM,mBAAmB,MAA+B,SAAS;GACjE;EACF;CACF;CAGA,MAAM,SAAS,MAAM,WAAW,UAAU;CAE1C,IAAI,QAAQ,KAAK;EACf,QAAQ,IACN,KAAK,UAAU;GACb,SAAA;GACA,QAAQ;GACR,QAAQ,OAAO;GACf,MAAM,OAAO,OAAO;GACpB,YAAY,OAAO;GACnB,SAAS,OAAO,OAAO;GACvB,QAAQ,OAAO,OAAO;GACtB,OAAO,OAAO,OAAO;EACvB,CAAC,CACH;EACA;CACF;CAEA,IAAI,CAAC,QAEH,MAAM,IAAI,MAAM,qCAAqC;CAEvD,MAAM,aAAa,OAAO;CAC1B,MAAM,SAAS,OAAO,OAAO,QAAQ,MAAM,MAAM,WAAW,SAAS,EAAE,IAAI,CAAC;CAC5E,IAAI,CAAC,QACH,MAAM,IAAI,MACR,YAAY,WAAW,GAAG,6BAA6B,OAAO,OAAO,KAAK,qBACpD,WAAW,gHAEnC;CAEF,MAAM,gBAAgB,OAAO,OAAO,OAAO,MAAM,QAAQ,QAAQ,QAAQ,IAAI;AAC/E"}
1
+ {"version":3,"file":"graph-command.js","names":[],"sources":["../../src/analyze/graph-command.ts"],"sourcesContent":["/**\n * graph-command — `timber graph <file> [--json] [--all --json]`.\n *\n * Answers \"what environment(s) does this file run in?\" by delegating\n * to a running dev server when one is discovered (milliseconds), and\n * falling back to the cold crawl + mtime-keyed cache otherwise\n * (design/47 §5b). Dev-server responses are NOT cached in the mtime\n * cache: live answers may include real browser-graph data.\n *\n * Config anchoring deliberately diverges from `check`/`build`: those\n * discover the Vite config from the cwd (\"the app here\"), which is\n * wrong for a file-addressed command invoked from a monorepo root —\n * cwd anchoring would select the wrong app. `graph` walks UP from the\n * target file's directory to the nearest Vite config and resolves from\n * there, so the file's own app answers. `--config` overrides, same as\n * everywhere else.\n *\n * Cold-path policy: a cold single-file query runs the full-project\n * crawl (`--all` internally) and caches the entire report — one crawl\n * per project state, every subsequent question a cache hit. The\n * cache-hit path never imports Vite.\n */\n\nimport { execFile } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, realpath, rm } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport { dirname, join, relative, resolve, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { promisify } from 'node:util';\nimport { DEV_PROBE_TIMEOUT_MS, probeDevServer, readDevRecords } from '../plugins/dev-discovery.ts';\nimport {\n collectBaseFingerprintEntries,\n computeProjectFingerprint,\n fingerprintEntriesForFiles,\n hashFingerprintEntries,\n readGraphCache,\n writeGraphCache,\n GRAPH_CACHE_VERSION,\n GRAPH_JSON_VERSION,\n} from './graph-cache.ts';\nimport type { CrawlReport, GraphModuleReport } from './crawl.ts';\nimport type { ImportChain } from './chains.ts';\nimport { normalizeSlashes } from './scan.ts';\n\nconst execFileAsync = promisify(execFile);\n\nexport type GraphSource = 'dev-server' | 'static-scan';\n\n/** Crawl deadline passed to the child, plus slack for its boot/exit. */\nconst CRAWL_TIMEOUT_MS = 120_000;\nconst SPAWN_SLACK_MS = 30_000;\n\n/**\n * Vite's own default config file names, in Vite's precedence order.\n * Matching the list (rather than globbing) keeps the walk-up aligned\n * with what `createServer` would discover in each directory.\n */\nconst VITE_CONFIG_FILES = [\n 'vite.config.js',\n 'vite.config.mjs',\n 'vite.config.ts',\n 'vite.config.cjs',\n 'vite.config.mts',\n 'vite.config.cts',\n];\n\nexport interface GraphOptions {\n /** Target file; required unless `all`. */\n file?: string;\n /** Explicit Vite config path (overrides the walk-up discovery). */\n config?: string;\n json: boolean;\n all: boolean;\n}\n\n/**\n * Walk up from `startDir` to the nearest directory containing a Vite\n * config file. Returns the config's absolute path, or null at the\n * filesystem root.\n */\nexport function findViteConfigUpward(startDir: string): string | null {\n let dir = startDir;\n for (;;) {\n for (const name of VITE_CONFIG_FILES) {\n const candidate = join(dir, name);\n if (existsSync(candidate)) return candidate;\n }\n const parent = dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n\n/**\n * Try to delegate a graph query to a running dev server discovered via\n * its discovery record. Returns the parsed JSON response on success, null\n * on any failure (no live records, wrong config, probe failure). Every\n * failure mode is silent — the caller falls back to the cold crawl. The\n * graph request itself is the liveness probe, so no separate status probe\n * is made.\n */\nasync function tryDevServer(\n configDir: string,\n configFile: string,\n queryString: string\n): Promise<unknown> {\n for (const record of readDevRecords(configDir)) {\n // Skip records from a different Vite config (TIM-1393). Records\n // without configFile (old servers) are accepted — rejecting them\n // would break the fast path until every server restarts.\n if (record.configFile && normalizeSlashes(record.configFile) !== normalizeSlashes(configFile))\n continue;\n const result = await probeDevServer(\n record,\n `/__timber/graph${queryString}`,\n DEV_PROBE_TIMEOUT_MS\n );\n if (isDevServerGraphResponse(result)) return result;\n }\n return null;\n}\n\nfunction isDevServerGraphResponse(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'version' in value &&\n value.version === GRAPH_JSON_VERSION &&\n 'source' in value &&\n value.source === 'dev-server'\n );\n}\n\n/**\n * Resolve the app root from the config file's own directory, reading\n * it off the timber root-sync plugin api (the single supported way —\n * cf. cli-check.ts). Only runs on the cold path.\n *\n * Resolution uses SERVE/development semantics, not build's: the crawl\n * child evaluates this same config through `createServer` (dev), and\n * the dev-server fast path answers from dev graphs — the dev graphs\n * are the tool's ground truth (design/47 §Motivation). Resolving the\n * root under build mode while crawling under serve would let a\n * command/mode-branching config select one app and crawl another.\n */\nasync function resolveAppRoot(\n configFile: string\n): Promise<{ root: string; configFileDependencies: string[]; pageExtensions?: string[] }> {\n const { resolveConfig } = await import('vite');\n // Lazy for the same reason as Vite itself: plugin-context.ts has a\n // module-level `parseAst` import from vite, so a static import here\n // would make even warm cache hits pay Vite's startup cost — the\n // cache-hit path must stay vite-free (design/47 §Cold-path policy).\n const { isTimberPluginApi } = await import('../plugin-context.ts');\n // Anchor Vite's cwd-relative defaults at the config's directory, not\n // the caller's cwd — the whole point of the walk-up. The config's own\n // explicit `root` option still wins over this cwd, as it should.\n const previousCwd = process.cwd();\n process.chdir(dirname(configFile));\n // Route config-evaluation stdout to stderr for the duration: the\n // app's config and plugin hooks run in THIS process, and any\n // console.log from them would land in front of the --json contract,\n // breaking JSON.parse(stdout) consumers. (The crawl child has the\n // same problem solved by --out; this parent-side evaluation needs\n // the equivalent.) Bind write() so its overloads keep their exact\n // callback semantics.\n const stdoutWrite = process.stdout.write;\n process.stdout.write = process.stderr.write.bind(process.stderr) as typeof process.stdout.write;\n try {\n // TIMBER_ANALYZE and middlewareMode mirror the crawl child's boot:\n // serve-mode config hooks otherwise start dev-only side effects in\n // THIS process — the startup holding server binds the app's port\n // and keeps the CLI alive forever (index.ts gates it on\n // !middlewareMode), and platform dev plugins may open remote\n // connections classification never needs.\n process.env.TIMBER_ANALYZE = '1';\n const {\n plugins,\n configFileDependencies,\n resolve: resolveOptions,\n } = await resolveConfig(\n { configFile, logLevel: 'error', server: { middlewareMode: true } },\n 'serve',\n 'development',\n 'development'\n );\n const rootSync = plugins.find((plugin) => plugin.name === 'timber-root-sync');\n if (!rootSync || !isTimberPluginApi(rootSync.api)) {\n throw new Error(\n `[timber] ${configFile} does not produce the timber plugin.\\n` +\n ` \\`timber graph\\` resolves the app through Vite so it classifies the same\\n` +\n ` modules the build builds. Check that the config lists timber():\\n\\n` +\n ` import { timber } from '@timber-js/app';\\n` +\n ` export default { plugins: [timber()] };\\n`\n );\n }\n // Same path space as the crawl's report.root — the hit path\n // fingerprints cache.report.root, so a divergent space here\n // (backslashes, or symlink-vs-physical) would make miss- and\n // hit-path entry strings differ and the cache never match. Vite\n // does NOT realpath its resolved root; the crawl realpaths unless\n // resolve.preserveSymlinks keeps graphs on symlink paths — mirror\n // that decision from the same resolved config.\n const { normalizePath } = await import('vite');\n const pluginCtx = rootSync.api.getContext();\n const rawRoot = pluginCtx.root;\n return {\n root: normalizePath(resolveOptions.preserveSymlinks ? rawRoot : await realpath(rawRoot)),\n // A config helper imported from OUTSIDE the app root (a shared\n // vite.shared.ts beside a monorepo config) can reshape aliases,\n // plugins, or timber options without touching anything the disk\n // scan sees — the fingerprint must track these too. Vite's list\n // covers the vite.config bundle; timber.config.ts is require()d\n // by root-sync during resolveConfig, so its transitive imports\n // live in require.cache and are collected from there.\n configFileDependencies: [...configFileDependencies, ...collectTimberConfigDeps()],\n pageExtensions: pluginCtx.config.pageExtensions,\n };\n } finally {\n process.stdout.write = stdoutWrite;\n process.chdir(previousCwd);\n }\n}\n\n/**\n * Transitive dependencies of the loaded timber.config, from\n * require.cache: `loadTimberConfigFile` loads the config with native\n * require() (design/11 §Config Loading Semantics), so after\n * resolveConfig has run the config module and everything it imported —\n * including helpers OUTSIDE the app root that Vite's\n * configFileDependencies cannot see — sit in the cache with their\n * children recorded. node_modules entries are skipped (the lockfile\n * fingerprint covers them).\n */\nfunction collectTimberConfigDeps(): string[] {\n const require = createRequire(import.meta.url);\n const cache = require.cache ?? {};\n const roots = Object.values(cache).filter(\n (mod): mod is NonNullable<typeof mod> =>\n mod != null && /timber\\.config\\.(?:ts|js|mjs)$/.test(mod.filename)\n );\n const deps: string[] = [];\n const seen = new Set<string>();\n const queue = [...roots];\n while (queue.length > 0) {\n const mod = queue.shift()!;\n if (seen.has(mod.filename)) continue;\n seen.add(mod.filename);\n if (mod.filename.includes(`${sep}node_modules${sep}`)) continue;\n deps.push(mod.filename);\n queue.push(...mod.children);\n }\n return deps;\n}\n\n/**\n * Locate the crawl child entry beside this module: the built `.js` in\n * a published install, the `.ts` source under tsx (tests, this repo).\n */\nfunction resolveCrawlEntry(): { entry: string; nodeArgs: string[] } {\n const jsEntry = fileURLToPath(new URL('./crawl-entry.js', import.meta.url));\n if (existsSync(jsEntry)) return { entry: jsEntry, nodeArgs: [] };\n const tsEntry = fileURLToPath(new URL('./crawl-entry.ts', import.meta.url));\n return { entry: tsEntry, nodeArgs: ['--import', 'tsx/esm'] };\n}\n\n/** Spawn the crawl child and read its report from the --out file. */\nasync function runColdCrawl(root: string, configFile: string): Promise<CrawlReport> {\n const { entry, nodeArgs } = resolveCrawlEntry();\n const outFile = join(root, '.timber', `graph-crawl-${process.pid}.json`);\n await mkdir(dirname(outFile), { recursive: true });\n try {\n await execFileAsync(\n process.execPath,\n [\n ...nodeArgs,\n entry,\n '--root',\n root,\n '--config',\n configFile,\n '--out',\n outFile,\n '--timeout',\n String(CRAWL_TIMEOUT_MS),\n ],\n {\n // Same cwd anchor as resolveAppRoot: a config that derives\n // options from process.cwd() must evaluate identically in the\n // resolution that selected the app and in the crawl that\n // classifies it, or the two describe different apps. The app\n // root still reaches the child explicitly via --root.\n cwd: dirname(configFile),\n // The child's BFS deadline handles hung transforms; this spawn\n // timeout is the outer guard for a hang in createServer itself,\n // which the deadline cannot cover (see crawl-entry.ts).\n timeout: CRAWL_TIMEOUT_MS + SPAWN_SLACK_MS,\n maxBuffer: 16 * 1024 * 1024,\n }\n );\n return JSON.parse(await readFile(outFile, 'utf8')) as CrawlReport;\n } finally {\n await rm(outFile, { force: true }).catch(() => {});\n }\n}\n\ninterface GraphAnswer {\n report: CrawlReport;\n configFile: string;\n cached: boolean;\n}\n\n/**\n * Produce the full-project report: cache hit when the fingerprint\n * matches, cold crawl otherwise.\n *\n * The scan-derived base entries are computed BEFORE the crawl — files\n * changing mid-crawl make the next query miss, never the reverse. The\n * `trackedExtras` (config dependencies + every file the report\n * classifies) are only knowable after resolution and crawl, so their\n * entries are stat'd afterwards; for those alone, a mid-crawl edit is\n * stale-until-the-next-edit rather than an immediate miss.\n */\nasync function loadReport(configFile: string): Promise<GraphAnswer> {\n // The cache is anchored at the config file's directory, NOT the\n // resolved Vite root: knowing the root requires resolveConfig (which\n // imports Vite), and the entire point of the hit path is answering\n // without it. Reading and writing must use the same anchor — a split\n // (read here, write under the resolved root) would never hit for a\n // config whose `root` points elsewhere, silently re-crawling forever.\n const cacheDir = dirname(configFile);\n const cache = await readGraphCache(cacheDir);\n if (cache && cache.configFile === configFile) {\n const fingerprint = await computeProjectFingerprint(\n cache.report.root,\n configFile,\n cache.trackedExtras,\n cache.pageExtensions\n );\n if (fingerprint === cache.fingerprint) {\n return { report: cache.report, configFile, cached: true };\n }\n }\n\n const { root, configFileDependencies, pageExtensions } = await resolveAppRoot(configFile);\n const baseEntries = await collectBaseFingerprintEntries(root, configFile, pageExtensions);\n process.stderr.write('[timber] graph cache miss — cold project crawl (~2.5–10 s)\\n');\n // Config-dependency entries are snapshotted BEFORE the crawl, like\n // the base entries: a config helper edited during the multi-second\n // crawl must make the next query miss, not be stamped post-crawl\n // with its new mtime beside a report built from its old contents.\n const configDepEntries = await fingerprintEntriesForFiles(configFileDependencies);\n const report = await runColdCrawl(root, configFile);\n if (report.incomplete) {\n // Deadline-truncated report: transient (slow machine, cold dep\n // optimizer). Serve it — a truncated answer now beats none — but\n // never cache it: with unchanged files it would be served forever,\n // with no retry after the transient cause cleared.\n process.stderr.write('[timber] crawl hit its deadline — serving truncated, uncached report\\n');\n return { report, configFile, cached: false };\n }\n const trackedExtras = [\n ...new Set([...configFileDependencies, ...report.modules.map((m) => m.file)]),\n ].sort();\n // Report-file entries can only be stat'd post-crawl (the set is\n // unknowable before); for those alone a mid-crawl edit is stale-\n // until-next-edit. Files already covered pre-crawl (scan overlap,\n // config deps) keep their pre-crawl entries — hashFingerprintEntries\n // dedupes identical strings, and a mid-crawl edit produces a\n // DIFFERENT post-crawl entry for the same path, which changes the\n // hash and correctly misses on the next query.\n const reportFileEntries = await fingerprintEntriesForFiles(report.modules.map((m) => m.file));\n const fingerprint = hashFingerprintEntries([\n ...baseEntries,\n ...configDepEntries,\n ...reportFileEntries,\n ]);\n await writeGraphCache(cacheDir, {\n version: GRAPH_CACHE_VERSION,\n fingerprint,\n configFile,\n pageExtensions,\n trackedExtras,\n report,\n });\n return { report, configFile, cached: false };\n}\n\n/** Project-relative display path (JSON always stays absolute). */\nfunction displayPath(file: string, root: string): string {\n const rel = relative(root, file);\n return rel.startsWith('..') ? file : rel;\n}\n\n/**\n * Crawl errors that bear on one file's answer: failures on the file\n * itself (recorded by path or by root-relative URL) plus scan-level\n * failures, which undermine completeness for every file. Without this,\n * a target whose own transform failed would print a confident `server`\n * classification while only `--all` exposed the error (codex review,\n * PR #1056).\n */\nfunction errorsForTarget(report: CrawlReport, target: string): CrawlReport['errors'] {\n const asUrl = '/' + relative(report.root, target).split('\\\\').join('/');\n return report.errors.filter(\n (error) => error.environment === 'scan' || error.id === target || error.id === asUrl\n );\n}\n\nasync function printSingleFile(\n input: string,\n target: string,\n module: GraphModuleReport,\n answer: GraphAnswer,\n json: boolean\n): Promise<void> {\n const errors = errorsForTarget(answer.report, target);\n if (json) {\n console.log(\n JSON.stringify({\n version: GRAPH_JSON_VERSION,\n source: 'static-scan' satisfies GraphSource,\n cached: answer.cached,\n target: { input, resolved: target },\n kind: module.kind,\n pending: module.pending,\n subtreeUnknown: module.subtreeUnknown,\n envs: module.envs,\n boundary: module.boundary,\n chains: module.chains,\n poisonings: module.poisonings,\n errors,\n })\n );\n return;\n }\n\n const root = answer.report.root;\n const envs = Object.entries(module.envs)\n .filter(([, present]) => present)\n .map(([env]) => env);\n console.log(\n `${displayPath(target, root)} — ${module.kind}` +\n `${module.pending ? ' (pending: no graph has confirmed this file yet)' : ''}`\n );\n console.log(` source: static-scan${answer.cached ? ' (cached)' : ''}`);\n console.log(` environments: ${envs.length > 0 ? envs.join(', ') : 'none'}`);\n if (module.subtreeUnknown) {\n console.log(' note: reachable, but its subtree is unknown (never transformed)');\n }\n if (module.chains.length > 0) {\n // Lazy import: the text formatter pulls Vite (normalizePath); the\n // JSON path above must stay import-free for fast cache hits.\n const { formatChains } = await import('./chains.ts');\n console.log(' import chains:');\n console.log(formatChains(module.chains, root));\n }\n for (const poisoning of module.poisonings) {\n console.log(\n ` poisoning: ${poisoning.description} (${poisoning.specifier}) — ` +\n `implies ${poisoning.implies}`\n );\n }\n for (const error of errors) {\n console.log(` error [${error.environment}]: ${error.message} (${error.id})`);\n }\n}\n\n/**\n * The single-file JSON contract shape for dev-server responses. Shared\n * between the HTTP endpoint (graph-endpoint.ts) and this consumer so\n * the boundary crossing is typed, not cast. The endpoint produces this\n * shape; `probeEndpoint` parses it; `printDevServerText` formats it.\n */\ninterface DevServerFileResponse {\n version: number;\n source: string;\n cached: boolean;\n target: { input: string; resolved: string };\n kind: string;\n pending: boolean;\n subtreeUnknown: boolean;\n envs: Record<string, boolean>;\n boundary: boolean;\n chains: ImportChain[];\n poisonings: Array<{ description: string; specifier: string; implies: string }>;\n errors: Array<{ environment: string; message: string; id: string }>;\n}\n\n/**\n * Text-mode output for a dev-server response. The response carries the\n * same fields as the static-scan JSON, so the formatting mirrors\n * `printSingleFile` with `source: \"dev-server\"`.\n */\nasync function printDevServerText(data: DevServerFileResponse, configDir: string): Promise<void> {\n console.log(\n `${displayPath(data.target.resolved, configDir)} — ${data.kind}` +\n `${data.pending ? ' (pending: no graph has confirmed this file yet)' : ''}`\n );\n console.log(' source: dev-server');\n const envList = Object.entries(data.envs)\n .filter(([, present]) => present)\n .map(([env]) => env);\n console.log(` environments: ${envList.length > 0 ? envList.join(', ') : 'none'}`);\n if (data.subtreeUnknown) {\n console.log(' note: reachable, but its subtree is unknown (never transformed)');\n }\n if (data.chains.length > 0) {\n const { formatChains } = await import('./chains.ts');\n console.log(' import chains:');\n console.log(formatChains(data.chains, configDir));\n }\n for (const poisoning of data.poisonings) {\n console.log(\n ` poisoning: ${poisoning.description} (${poisoning.specifier}) — ` +\n `implies ${poisoning.implies}`\n );\n }\n for (const error of data.errors) {\n console.log(` error [${error.environment}]: ${error.message} (${error.id})`);\n }\n}\n\n/**\n * Run `timber graph`. Throws with actionable messages; the CLI's main()\n * prints and exits nonzero.\n */\nexport async function runGraph(options: GraphOptions): Promise<void> {\n if (options.all && !options.json) {\n throw new Error(\n 'timber graph --all requires --json (no text format is defined for the full project).'\n );\n }\n let target: { input: string; candidates: string[] } | null = null;\n if (options.file) {\n const resolved = resolve(process.cwd(), options.file);\n if (!existsSync(resolved)) {\n throw new Error(`[timber] file not found: ${resolved}`);\n }\n // Report paths are slash-normalized (normalizeSlashes) and usually\n // realpaths — but under resolve.preserveSymlinks the graphs keep\n // symlink paths. Look up BOTH forms rather than guessing the\n // config's setting (the hit path is vite-free and cannot ask):\n // as-typed first, realpath second.\n const asTyped = normalizeSlashes(resolved);\n const physical = normalizeSlashes(await realpath(resolved));\n target = {\n input: options.file,\n candidates: asTyped === physical ? [asTyped] : [asTyped, physical],\n };\n }\n if (!options.all && !target) {\n throw new Error('Usage: timber graph <file> [--json], or timber graph --all --json');\n }\n\n // Anchor config discovery at the AS-TYPED path (candidates[0]): under\n // preserveSymlinks a symlinked target's realpath may live in a\n // sibling workspace package, and walking up from there would select\n // that package's config — or none — instead of the app the user\n // addressed. The realpath candidate exists only for module lookup.\n const anchor = target ? dirname(target.candidates[0]) : process.cwd();\n const configFile = options.config\n ? resolve(process.cwd(), options.config)\n : findViteConfigUpward(anchor);\n if (!configFile || !existsSync(configFile)) {\n throw new Error(\n `[timber] no Vite config found walking up from ${anchor}.\\n` +\n ` \\`timber graph\\` anchors config discovery at the target file (not the cwd)\\n` +\n ` so the file's own app answers in a monorepo. Pass --config <path> to override.`\n );\n }\n\n // Fast path: delegate to a running dev server if one is discovered.\n // The query string mirrors the endpoint's contract — `?file=` for\n // single-file, `?all=1` for the full project. The endpoint returns\n // the same JSON contract the CLI prints, so on success the response\n // is printed verbatim (JSON mode) or decoded and formatted (text).\n // TIMBER_ANALYZE=1 suppresses delegation: the crawl child sets it\n // to skip dev-server side effects, and it also prevents the child\n // from discovering and probing the parent dev server's own endpoint.\n const configDir = dirname(configFile);\n const delegate = process.env.TIMBER_ANALYZE !== '1';\n if (delegate && options.all) {\n const live = await tryDevServer(configDir, configFile, '?all=1');\n if (live) {\n // --json is already guaranteed by the guard at the top.\n console.log(JSON.stringify(live));\n return;\n }\n } else if (delegate && target) {\n // The endpoint accepts absolute paths — pass the as-typed candidate\n // (matching the CLI's own config anchoring, not the realpath).\n const live = await tryDevServer(\n configDir,\n configFile,\n `?file=${encodeURIComponent(target.candidates[0])}`\n );\n if (live) {\n if (options.json) {\n // Preserve the user's original input (e.g. \"app/page.tsx\") —\n // the endpoint echoes the absolute path we sent as target.input,\n // which would differ from the cold path's relative input.\n const liveObj = live as Record<string, unknown>;\n if (typeof liveObj.target === 'object' && liveObj.target !== null) {\n (liveObj.target as Record<string, unknown>).input = target.input;\n }\n console.log(JSON.stringify(liveObj));\n return;\n }\n // The endpoint produces DevServerFileResponse by construction —\n // both frontends use the same classification pipeline. This is\n // the HTTP JSON boundary: probeEndpoint returns `unknown` from\n // JSON.parse; we narrow here because the endpoint's shape is our\n // own contract, not third-party data.\n await printDevServerText(live as DevServerFileResponse, configDir);\n return;\n }\n }\n\n // Cold path: mtime-keyed cache, then crawl.\n const answer = await loadReport(configFile);\n\n if (options.all) {\n console.log(\n JSON.stringify({\n version: GRAPH_JSON_VERSION,\n source: 'static-scan' satisfies GraphSource,\n cached: answer.cached,\n root: answer.report.root,\n configFile: answer.configFile,\n modules: answer.report.modules,\n errors: answer.report.errors,\n stats: answer.report.stats,\n })\n );\n return;\n }\n\n if (!target) {\n // Unreachable — validated at the top; kept for type narrowing.\n throw new Error('Usage: timber graph <file> [--json]');\n }\n const candidates = target.candidates;\n const module = answer.report.modules.find((m) => candidates.includes(m.file));\n if (!module) {\n throw new Error(\n `[timber] ${candidates[0]} is not part of the app at ${answer.report.root}\\n` +\n ` (resolved from ${configFile}). Only project source files inside the app\\n` +\n ` root are classified — node_modules and non-source files are not.`\n );\n }\n await printSingleFile(target.input, module.file, module, answer, options.json);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAM,gBAAgB,UAAU,QAAQ;;AAKxC,IAAM,mBAAmB;;;;;;AAQzB,IAAM,oBAAo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AI,CAAC;GAChC;EACF;CACF,OAAO,IAAI,YAAY,QAAQ;EAG7B,MAAM,OAAO,MAAM,aACjB,WACA,YACA,SAAS,mBAAmB,OAAO,WAAW,EAAE,GAClD;EACA,IAAI,MAAM;GACR,IAAI,QAAQ,MAAM;IAIhB,MAAM,UAAU;IAChB,IAAI,OAAO,QAAQ,WAAW,YAAY,QAAQ,WAAW,MAC3D,QAAS,OAAmC,QAAQ,OAAO;IAE7D,QAAQ,IAAI,KAAK,UAAU,OAAO,CAAC;IACnC;GACF;GAMA,MAAM,mBAAmB,MAA+B,SAAS;GACjE;EACF;CACF;CAGA,MAAM,SAAS,MAAM,WAAW,UAAU;CAE1C,IAAI,QAAQ,KAAK;EACf,QAAQ,IACN,KAAK,UAAU;GACb,SAAA;GACA,QAAQ;GACR,QAAQ,OAAO;GACf,MAAM,OAAO,OAAO;GACpB,YAAY,OAAO;GACnB,SAAS,OAAO,OAAO;GACvB,QAAQ,OAAO,OAAO;GACtB,OAAO,OAAO,OAAO;EACvB,CAAC,CACH;EACA;CACF;CAEA,IAAI,CAAC,QAEH,MAAM,IAAI,MAAM,qCAAqC;CAEvD,MAAM,aAAa,OAAO;CAC1B,MAAM,SAAS,OAAO,OAAO,QAAQ,MAAM,MAAM,WAAW,SAAS,EAAE,IAAI,CAAC;CAC5E,IAAI,CAAC,QACH,MAAM,IAAI,MACR,YAAY,WAAW,GAAG,6BAA6B,OAAO,OAAO,KAAK,qBACpD,WAAW,gHAEnC;CAEF,MAAM,gBAAgB,OAAO,OAAO,OAAO,MAAM,QAAQ,QAAQ,QAAQ,IAAI;AAC/E"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Cache reads never fail a request.
3
+ *
4
+ * A cache is an optimization: when the store is down, slow, or returns
5
+ * garbage, the request must still succeed by doing the work the cache would
6
+ * have skipped. Writes already follow this rule (timber-cache.ts swallows a
7
+ * failed handler.set, TIM-1046); reads go through here so a throwing or hung
8
+ * handler.get costs a live fetch or render, never a failed or stalled request.
9
+ *
10
+ * The timeout matters as much as the catch. Shared-store clients often queue
11
+ * commands while disconnected (ioredis retries each one up to 20 times by
12
+ * default), so an outage shows up as a read that never settles, not an error.
13
+ *
14
+ * Invalidation is deliberately NOT guarded: a failed invalidate that looked
15
+ * like success would leave stale data in place silently.
16
+ *
17
+ * See design/06-caching.md §"Store failures".
18
+ */
19
+ /** Ceiling for a single cache read. A healthy store answers in milliseconds. */
20
+ export declare const CACHE_READ_TIMEOUT_MS = 1000;
21
+ /**
22
+ * Run a cache read. A throw, a rejection, or no answer within
23
+ * CACHE_READ_TIMEOUT_MS logs a warning and resolves to `onFailure`, which the
24
+ * caller picks: `null` where a failed read means "miss", a distinct value
25
+ * where a miss would fall back to something the failed read might have
26
+ * overridden (an invalidated build seed — server/prebuilt/overlay.ts).
27
+ */
28
+ export declare function guardedRead<T, F>(cacheKey: string, read: () => Promise<T>, onFailure: F): Promise<T | F>;
29
+ //# sourceMappingURL=guarded-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guarded-read.d.ts","sourceRoot":"","sources":["../../src/cache/guarded-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,CAAC,EACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,SAAS,EAAE,CAAC,GACX,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAOhB"}
@@ -1,4 +1,4 @@
1
- import { g as getCacheHandler, v as setCacheHandler } from "../_chunks/dev-store-BOa304m_.js";
2
- import { d as MemoryCacheHandler, f as TagAwareCacheHandler, m as setDefaultSingleflightTimeout, p as RedisCacheHandler, t as cache } from "../_chunks/cache-api-GE4AOe2H.js";
3
- import { t as estimateByteSize } from "../_chunks/sizeof-QPE5nd3u.js";
1
+ import { b as setCacheHandler, v as getCacheHandler } from "../_chunks/dev-store-BvdqtHvK.js";
2
+ import { f as MemoryCacheHandler, h as setDefaultSingleflightTimeout, m as RedisCacheHandler, p as TagAwareCacheHandler, t as cache } from "../_chunks/cache-api-TDZ4hlDc.js";
3
+ import { t as estimateByteSize } from "../_chunks/sizeof-DG4W40lv.js";
4
4
  export { MemoryCacheHandler, RedisCacheHandler, TagAwareCacheHandler, cache, estimateByteSize, getCacheHandler, setCacheHandler, setDefaultSingleflightTimeout };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Key-discipline diagnostic for both cache tiers (design/45 §Enforcement).
3
+ *
4
+ * A cached value is stored under a key computed from declared inputs only —
5
+ * props and segment params for `cache.component`, the function's arguments
6
+ * for `cache.data`. A request-context read while the value is being computed
7
+ * is the data-leak danger zone (design/06 security note): the result varies
8
+ * by user but the key does not. While the cached work runs, the ALS store is
9
+ * wrapped in a transparent observing proxy; any request-context read
10
+ * produces a structured, rate-limited production diagnostic.
11
+ *
12
+ * The diagnostic fires per offending callsite, rate-limited to once per
13
+ * interval (default 60 s) — not once per process. This ensures the
14
+ * signal stays visible in log aggregators across restarts and deploys.
15
+ *
16
+ * When `strictKeyDiscipline` is enabled (via timber.config.ts
17
+ * `cache.strictKeyDiscipline: true`), the diagnostic is promoted to a
18
+ * thrown error that prevents the tainted value from being cached.
19
+ */
20
+ /** Which cache tier a callsite belongs to — selects the diagnostic wording. */
21
+ export type KeyDisciplineTier = 'cache.component' | 'cache.data';
22
+ /** A cached callsite whose work is observed for request-context reads. */
23
+ export interface KeyDisciplineSite {
24
+ tier: KeyDisciplineTier;
25
+ /** Stable id of the callsite — the rate-limit key within its tier. */
26
+ id: string;
27
+ /** Human-readable name for the message; defaults to the id. */
28
+ label?: string;
29
+ /** The cache key this call computed — logged so the entry can be found. */
30
+ cacheKey?: string;
31
+ }
32
+ /**
33
+ * Thrown in strict mode. A distinct class so a caller holding an earlier
34
+ * result computed by the same fn (a stale SWR entry) can drop it.
35
+ */
36
+ export declare class KeyDisciplineViolation extends Error {
37
+ name: string;
38
+ }
39
+ /**
40
+ * Configure strict key-discipline mode. When true, a violation throws
41
+ * instead of logging — the tainted value is never cached.
42
+ * Called at boot from the RSC entry with the resolved config value.
43
+ */
44
+ export declare function setKeyDisciplineStrict(enabled: boolean): void;
45
+ /**
46
+ * Run a cached callsite's work under the observing proxy, then report any
47
+ * request-context read it made. The proxy is transparent — it forwards all
48
+ * reads and writes; it only observes.
49
+ *
50
+ * Outside a request context `run` executes as-is: there is nothing to read,
51
+ * and cache.data must keep working there. In default mode a callsite that
52
+ * reported within the rate-limit window is not observed at all. In strict
53
+ * mode a violation rejects after `run` resolves, so the caller never stores
54
+ * the value.
55
+ */
56
+ export declare function observeKeyDiscipline<T>(site: KeyDisciplineSite, run: () => Promise<T>): Promise<T>;
57
+ /**
58
+ * Reset all diagnostic state. Exported for tests only.
59
+ */
60
+ export declare function resetKeyDisciplineState(): void;
61
+ //# sourceMappingURL=key-discipline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-discipline.d.ts","sourceRoot":"","sources":["../../src/cache/key-discipline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAsBH,+EAA+E;AAC/E,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,YAAY,CAAC;AAEjE,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,iBAAiB,CAAC;IACxB,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAoCD;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IACtC,IAAI,SAA4B;CAC1C;AAID;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE7D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,CAAC,CAQZ;AAkFD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C"}
@@ -1,4 +1,4 @@
1
- //#region src/cache/stores/cloudflare-kv.ts
1
+ // src/cache/stores/cloudflare-kv.ts
2
2
  var CloudflareKVStore = class {
3
3
  kv;
4
4
  consistency = "eventual";
@@ -23,7 +23,6 @@ var CloudflareKVStore = class {
23
23
  await this.getKV().delete(key);
24
24
  }
25
25
  };
26
- //#endregion
27
26
  export { CloudflareKVStore };
28
27
 
29
28
  //# sourceMappingURL=cloudflare-kv.js.map
@@ -1,5 +1,5 @@
1
- import { t as estimateByteSize } from "../../_chunks/sizeof-QPE5nd3u.js";
2
- //#region src/cache/stores/memory.ts
1
+ import { t as estimateByteSize } from "../../_chunks/sizeof-DG4W40lv.js";
2
+ // src/cache/stores/memory.ts
3
3
  var MemoryCacheStore = class {
4
4
  store = /* @__PURE__ */ new Map();
5
5
  sets = /* @__PURE__ */ new Map();
@@ -84,7 +84,6 @@ var MemoryCacheStore = class {
84
84
  if (oldest !== void 0) this.removeEntry(oldest);
85
85
  }
86
86
  };
87
- //#endregion
88
87
  export { MemoryCacheStore };
89
88
 
90
89
  //# sourceMappingURL=memory.js.map
@@ -1,4 +1,4 @@
1
- //#region src/cache/stores/redis.ts
1
+ // src/cache/stores/redis.ts
2
2
  var RedisCacheStore = class {
3
3
  client;
4
4
  consistency = "strong";
@@ -29,7 +29,6 @@ var RedisCacheStore = class {
29
29
  await this.client.del(key);
30
30
  }
31
31
  };
32
- //#endregion
33
32
  export { RedisCacheStore };
34
33
 
35
34
  //# sourceMappingURL=redis.js.map
@@ -1,4 +1,4 @@
1
- //#region src/cache/stores/vercel.ts
1
+ // src/cache/stores/vercel.ts
2
2
  var VercelCacheStore = class {
3
3
  cache;
4
4
  consistency = "strong";
@@ -27,7 +27,6 @@ var VercelCacheStore = class {
27
27
  await this.getCache().expireTag(tag);
28
28
  }
29
29
  };
30
- //#endregion
31
30
  export { VercelCacheStore };
32
31
 
33
32
  //# sourceMappingURL=vercel.js.map
@@ -22,7 +22,11 @@ export declare function setDefaultSingleflightTimeout(timeoutMs: number): void;
22
22
  * configured handler once it arrives (TIM-1029)
23
23
  * - No ALS dependency for correctness — cache() works outside a request
24
24
  * context. The waitUntil ALS bridge is read optionally so the SWR
25
- * background refetch survives handler return on Workers/Lambda.
25
+ * background refetch survives handler return on Workers/Lambda, and
26
+ * inside one, fn runs under the key-discipline observer (design/45
27
+ * §Enforcement): the key comes from the arguments only, so a
28
+ * request-context read in fn is reported, or rejected in strict mode
29
+ * before the result is stored.
26
30
  *
27
31
  * Cache hits/misses are recorded as OTEL span events on the enclosing
28
32
  * span (not child spans). The DevSpanProcessor reads these for dev log output.
@@ -1 +1 @@
1
- {"version":3,"file":"timber-cache.d.ts","sourceRoot":"","sources":["../../src/cache/timber-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAgC7D;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAErE;AAoED;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAAgB,WAAW,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EACrE,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC,EACtB,UAAU,EAAE,MAAM,YAAY,EAC9B,QAAQ,CAAC,EAAE,MAAM,GAChB,EAAE,CAoHJ"}
1
+ {"version":3,"file":"timber-cache.d.ts","sourceRoot":"","sources":["../../src/cache/timber-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkC7D;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAErE;AAoED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,wBAAgB,WAAW,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EACrE,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC,EACtB,UAAU,EAAE,MAAM,YAAY,EAC9B,QAAQ,CAAC,EAAE,MAAM,GAChB,EAAE,CAqJJ"}
@@ -1,4 +1,4 @@
1
- //#region src/cdn/cloudflare-purge.ts
1
+ // src/cdn/cloudflare-purge.ts
2
2
  var CloudflarePurge = class {
3
3
  zoneId;
4
4
  apiToken;
@@ -24,7 +24,6 @@ var CloudflarePurge = class {
24
24
  }
25
25
  }
26
26
  };
27
- //#endregion
28
27
  export { CloudflarePurge };
29
28
 
30
29
  //# sourceMappingURL=cloudflare-purge.js.map
@@ -1,4 +1,4 @@
1
- //#region src/cdn/fastly-purge.ts
1
+ // src/cdn/fastly-purge.ts
2
2
  var FastlyPurge = class {
3
3
  serviceId;
4
4
  apiToken;
@@ -27,7 +27,6 @@ var FastlyPurge = class {
27
27
  if (failures.length > 0) throw new Error(`Fastly purge failed for ${failures.length}/${tags.length} tags: ${failures.map((f) => f.reason?.message).join("; ")}`);
28
28
  }
29
29
  };
30
- //#endregion
31
30
  export { FastlyPurge };
32
31
 
33
32
  //# sourceMappingURL=fastly-purge.js.map
package/dist/cdn/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { n as setCdnPurgeHandler, t as getCdnPurgeHandler } from "../_chunks/purge-store-WZaxu-3m.js";
2
- //#region src/cdn/headers.ts
1
+ import { n as setCdnPurgeHandler, t as getCdnPurgeHandler } from "../_chunks/purge-store-8BqLAYZ1.js";
2
+ // src/cdn/headers.ts
3
3
  /**
4
4
  * Build a `Cache-Control` header value.
5
5
  *
@@ -88,7 +88,6 @@ function cacheTag(tags) {
88
88
  }
89
89
  return [...new Set(tags)].join(",");
90
90
  }
91
- //#endregion
92
91
  export { cacheControl, cacheTag, cdnCacheControl, getCdnPurgeHandler, setCdnPurgeHandler, surrogateControl, surrogateKey };
93
92
 
94
93
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import { l as workersCachePurgeAls } from "../_chunks/als-registry-BZqHCtq-.js";
2
- //#region src/server/workers-cache-bridge.ts
1
+ import { l as workersCachePurgeAls } from "../_chunks/als-registry-DpygwCp0.js";
2
+ // src/server/workers-cache-bridge.ts
3
3
  /**
4
4
  * Per-request Workers Cache purge bridge — ALS bridge for Cloudflare adapter.
5
5
  *
@@ -19,8 +19,7 @@ import { l as workersCachePurgeAls } from "../_chunks/als-registry-BZqHCtq-.js";
19
19
  function getWorkersCachePurgeCtx() {
20
20
  return workersCachePurgeAls.getStore();
21
21
  }
22
- //#endregion
23
- //#region src/cdn/workers-cache-purge.ts
22
+ // src/cdn/workers-cache-purge.ts
24
23
  var WorkersCachePurge = class {
25
24
  async purgeTags(tags) {
26
25
  if (tags.length === 0) return;
@@ -29,7 +28,6 @@ var WorkersCachePurge = class {
29
28
  await ctx.purge({ tags });
30
29
  }
31
30
  };
32
- //#endregion
33
31
  export { WorkersCachePurge };
34
32
 
35
33
  //# sourceMappingURL=workers-cache-purge.js.map