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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/agent-skill.md +21 -5
  2. package/dist/_chunks/{actions-vBHr2vqd.js → actions-7dTXYJfu.js} +53 -24
  3. package/dist/_chunks/actions-7dTXYJfu.js.map +1 -0
  4. package/dist/_chunks/{als-registry-BZqHCtq-.js → als-registry-DpygwCp0.js} +2 -3
  5. package/dist/_chunks/{als-registry-BZqHCtq-.js.map → als-registry-DpygwCp0.js.map} +1 -1
  6. package/dist/_chunks/{als-slots-BEEIPKYm.js → als-slots-kbQrHTzm.js} +2 -3
  7. package/dist/_chunks/{als-slots-BEEIPKYm.js.map → als-slots-kbQrHTzm.js.map} +1 -1
  8. package/dist/_chunks/{base-path-DaQrzbez.js → base-path-DDIx0FXe.js} +2 -3
  9. package/dist/_chunks/{base-path-DaQrzbez.js.map → base-path-DDIx0FXe.js.map} +1 -1
  10. package/dist/_chunks/{build-manifest-DWppEdLB.js → build-manifest-Y4jl7nwU.js} +2 -3
  11. package/dist/_chunks/{build-manifest-DWppEdLB.js.map → build-manifest-Y4jl7nwU.js.map} +1 -1
  12. package/dist/_chunks/{build-output-helper-RV_BRcF1.js → build-output-helper-B7wWGTfR.js} +14 -10
  13. package/dist/_chunks/build-output-helper-B7wWGTfR.js.map +1 -0
  14. package/dist/_chunks/{cache-api-DdcDLpBj.js → cache-api-TDZ4hlDc.js} +190 -38
  15. package/dist/_chunks/cache-api-TDZ4hlDc.js.map +1 -0
  16. package/dist/_chunks/{canonicalize-BAWkWiKK.js → canonicalize-CqK135BN.js} +29 -4
  17. package/dist/_chunks/{canonicalize-BAWkWiKK.js.map → canonicalize-CqK135BN.js.map} +1 -1
  18. package/dist/_chunks/chains-CwOr3Myj.js +1 -0
  19. package/dist/_chunks/{chains-BchW_AtW.js → chains-Dgm3PrMe.js} +3 -4
  20. package/dist/_chunks/{chains-BchW_AtW.js.map → chains-Dgm3PrMe.js.map} +1 -1
  21. package/dist/_chunks/{classify-IqzMpxMs.js → classify--_kINHQV.js} +4 -5
  22. package/dist/_chunks/{classify-IqzMpxMs.js.map → classify--_kINHQV.js.map} +1 -1
  23. package/dist/_chunks/{cli-check-DQne_YhU.js → cli-check-Dv3f8d2j.js} +5 -6
  24. package/dist/_chunks/{cli-check-DQne_YhU.js.map → cli-check-Dv3f8d2j.js.map} +1 -1
  25. package/dist/_chunks/{cli-context-_mPttGGY.js → cli-context-CbZp32SK.js} +3 -4
  26. package/dist/_chunks/{cli-context-_mPttGGY.js.map → cli-context-CbZp32SK.js.map} +1 -1
  27. package/dist/_chunks/cli-context-n5hmkdla.js +1 -0
  28. package/dist/_chunks/cli-dev-status-prPMLU8G.js +138 -0
  29. package/dist/_chunks/cli-dev-status-prPMLU8G.js.map +1 -0
  30. package/dist/_chunks/cli-init-BoXOYYil.js +196 -0
  31. package/dist/_chunks/cli-init-BoXOYYil.js.map +1 -0
  32. package/dist/_chunks/{cli-schema-sync-BS-RFGE2.js → cli-schema-sync-DIPurq7X.js} +4 -5
  33. package/dist/_chunks/{cli-schema-sync-BS-RFGE2.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
  34. package/dist/_chunks/{cli-schema-sync-v872sHms.js → cli-schema-sync-uq72EZmD.js} +1 -1
  35. package/dist/_chunks/{client-dep-entries-BJyP9SIu.js → client-dep-entries-CP7AkMCM.js} +4 -5
  36. package/dist/_chunks/{client-dep-entries-BJyP9SIu.js.map → client-dep-entries-CP7AkMCM.js.map} +1 -1
  37. package/dist/_chunks/{cloudflare-Byxl8FWP.js → cloudflare-B75X6u4O.js} +10 -13
  38. package/dist/_chunks/{cloudflare-Byxl8FWP.js.map → cloudflare-B75X6u4O.js.map} +1 -1
  39. package/dist/_chunks/{codec-registry-oOUxugz3.js → codec-registry-CPc6bjVl.js} +2 -3
  40. package/dist/_chunks/{codec-registry-oOUxugz3.js.map → codec-registry-CPc6bjVl.js.map} +1 -1
  41. package/dist/_chunks/{codegen-Bps1sLKJ.js → codegen-B9oWkWGf.js} +5 -8
  42. package/dist/_chunks/{codegen-Bps1sLKJ.js.map → codegen-B9oWkWGf.js.map} +1 -1
  43. package/dist/_chunks/{convention-lint-VwzrtjIt.js → convention-lint-hZwz5wd4.js} +8 -11
  44. package/dist/_chunks/{convention-lint-VwzrtjIt.js.map → convention-lint-hZwz5wd4.js.map} +1 -1
  45. package/dist/_chunks/dev-discovery-YnabkCKD.js +238 -0
  46. package/dist/_chunks/dev-discovery-YnabkCKD.js.map +1 -0
  47. package/dist/_chunks/{dev-server-BNr5drEO.js → dev-server-C61GWpGg.js} +369 -55
  48. package/dist/_chunks/dev-server-C61GWpGg.js.map +1 -0
  49. package/dist/_chunks/dev-server-CBvvM7Lr.js +1 -0
  50. package/dist/_chunks/{dev-store-BOa304m_.js → dev-store-BvdqtHvK.js} +82 -38
  51. package/dist/_chunks/dev-store-BvdqtHvK.js.map +1 -0
  52. package/dist/_chunks/{dist-DtrJyBbw.js → dist-C1Rjlo6s.js} +3 -5
  53. package/dist/_chunks/{dist-DtrJyBbw.js.map → dist-C1Rjlo6s.js.map} +1 -1
  54. package/dist/_chunks/{error-boundary-Bc8QPZuq.js → error-boundary-DRQXGWCp.js} +20 -27
  55. package/dist/_chunks/{error-boundary-Bc8QPZuq.js.map → error-boundary-DRQXGWCp.js.map} +1 -1
  56. package/dist/_chunks/{fast-hash-C-tVYrLb.js → fast-hash-DddxkU5Y.js} +2 -3
  57. package/dist/_chunks/{fast-hash-C-tVYrLb.js.map → fast-hash-DddxkU5Y.js.map} +1 -1
  58. package/dist/_chunks/{flight-source-node-BdHUOUqg.js → flight-source-node-0Tp6evlz.js} +6 -8
  59. package/dist/_chunks/flight-source-node-0Tp6evlz.js.map +1 -0
  60. package/dist/_chunks/{format-BKclgVbk.js → format-DuPOoXUP.js} +2 -3
  61. package/dist/_chunks/{format-BKclgVbk.js.map → format-DuPOoXUP.js.map} +1 -1
  62. package/dist/_chunks/{fs-identity-BRKuL215.js → fs-identity-BmQ_Agg-.js} +3 -5
  63. package/dist/_chunks/{fs-identity-BRKuL215.js.map → fs-identity-BmQ_Agg-.js.map} +1 -1
  64. package/dist/_chunks/{global-context-B9PFncvb.js → global-context-DbxNWeBP.js} +2 -3
  65. package/dist/_chunks/{global-context-B9PFncvb.js.map → global-context-DbxNWeBP.js.map} +1 -1
  66. package/dist/_chunks/{graph-cache-CYiUS2aS.js → graph-cache-B1LAg4t7.js} +5 -89
  67. package/dist/_chunks/graph-cache-B1LAg4t7.js.map +1 -0
  68. package/dist/_chunks/{href-validation-BIrxavIy.js → href-validation-CEZy1V-k.js} +4 -7
  69. package/dist/_chunks/{href-validation-BIrxavIy.js.map → href-validation-CEZy1V-k.js.map} +1 -1
  70. package/dist/_chunks/{json-lossy-check-C3Sht92C.js → json-lossy-check-DVkLUlfC.js} +3 -4
  71. package/dist/_chunks/{json-lossy-check-C3Sht92C.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
  72. package/dist/_chunks/{live-graph-DEu_GWbc.js → live-graph-BcVjQ1Te.js} +6 -7
  73. package/dist/_chunks/{live-graph-DEu_GWbc.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
  74. package/dist/_chunks/{logger-CI_hThfy.js → logger-CWk44DLp.js} +89 -47
  75. package/dist/_chunks/logger-CWk44DLp.js.map +1 -0
  76. package/dist/_chunks/{metadata-routes-B3XJNyIH.js → metadata-routes-BL26HCDd.js} +2 -3
  77. package/dist/_chunks/{metadata-routes-B3XJNyIH.js.map → metadata-routes-BL26HCDd.js.map} +1 -1
  78. package/dist/_chunks/{navigation-root-BQfo1-kG.js → navigation-root-M3B2ZrdO.js} +6 -10
  79. package/dist/_chunks/{navigation-root-BQfo1-kG.js.map → navigation-root-M3B2ZrdO.js.map} +1 -1
  80. package/dist/_chunks/{node-response-bF0bKoig.js → node-response-B9aviPDa.js} +43 -9
  81. package/dist/_chunks/node-response-B9aviPDa.js.map +1 -0
  82. package/dist/_chunks/{param-value-C8TNYchQ.js → param-value-DqlGfF57.js} +2 -3
  83. package/dist/_chunks/{param-value-C8TNYchQ.js.map → param-value-DqlGfF57.js.map} +1 -1
  84. package/dist/_chunks/{plugin-context-uDHFqHHJ.js → plugin-context-BfSRKJfz.js} +1 -1
  85. package/dist/_chunks/{plugin-context-DxMMvjUt.js → plugin-context-FCkaNLUB.js} +4 -6
  86. package/dist/_chunks/plugin-context-FCkaNLUB.js.map +1 -0
  87. package/dist/_chunks/{poison-rules-DoEhbqaY.js → poison-rules-Bmz-lCPi.js} +2 -3
  88. package/dist/_chunks/{poison-rules-DoEhbqaY.js.map → poison-rules-Bmz-lCPi.js.map} +1 -1
  89. package/dist/_chunks/{poison-scan-DTWIfNgD.js → poison-scan-DJYxZc_7.js} +4 -5
  90. package/dist/_chunks/{poison-scan-DTWIfNgD.js.map → poison-scan-DJYxZc_7.js.map} +1 -1
  91. package/dist/_chunks/{purge-store-WZaxu-3m.js → purge-store-8BqLAYZ1.js} +2 -3
  92. package/dist/_chunks/{purge-store-WZaxu-3m.js.map → purge-store-8BqLAYZ1.js.map} +1 -1
  93. package/dist/_chunks/{render-timeout-Ln_u7fX-.js → render-timeout-MrrqD1wd.js} +2 -3
  94. package/dist/_chunks/{render-timeout-Ln_u7fX-.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
  95. package/dist/_chunks/{resolve-schema-CkAInout.js → resolve-schema-B-aCuTu3.js} +3 -4
  96. package/dist/_chunks/{resolve-schema-CkAInout.js.map → resolve-schema-B-aCuTu3.js.map} +1 -1
  97. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js → rsc-cache-key-D0cb0Gmc.js} +2 -3
  98. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js.map → rsc-cache-key-D0cb0Gmc.js.map} +1 -1
  99. package/dist/_chunks/{rsc-media-type-DDc7duTD.js → rsc-media-type-m8jz9u6_.js} +2 -3
  100. package/dist/_chunks/{rsc-media-type-DDc7duTD.js.map → rsc-media-type-m8jz9u6_.js.map} +1 -1
  101. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js → rsc-payload-path-EphpDB-J.js} +2 -3
  102. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js.map → rsc-payload-path-EphpDB-J.js.map} +1 -1
  103. package/dist/_chunks/{scan-BoP17W3w.js → scan-CyizcBiX.js} +2 -3
  104. package/dist/_chunks/{scan-BoP17W3w.js.map → scan-CyizcBiX.js.map} +1 -1
  105. package/dist/_chunks/{scanner-C8fdKvKG.js → scanner-CJC-ScJU.js} +15 -23
  106. package/dist/_chunks/{scanner-C8fdKvKG.js.map → scanner-CJC-ScJU.js.map} +1 -1
  107. package/dist/_chunks/{schema-bridge-DpOmvZlI.js → schema-bridge-DyRs3cqy.js} +2 -3
  108. package/dist/_chunks/{schema-bridge-DpOmvZlI.js.map → schema-bridge-DyRs3cqy.js.map} +1 -1
  109. package/dist/_chunks/{segment-classify-C539Pa2O.js → segment-classify-Ho8jXWeC.js} +3 -5
  110. package/dist/_chunks/{segment-classify-C539Pa2O.js.map → segment-classify-Ho8jXWeC.js.map} +1 -1
  111. package/dist/_chunks/{segment-context-D3DNxKFq.js → segment-context-CYiGTi3K.js} +4 -6
  112. package/dist/_chunks/{segment-context-D3DNxKFq.js.map → segment-context-CYiGTi3K.js.map} +1 -1
  113. package/dist/_chunks/{segment-keys-D5hu1hz4.js → segment-keys-Y60KNc8C.js} +2 -3
  114. package/dist/_chunks/{segment-keys-D5hu1hz4.js.map → segment-keys-Y60KNc8C.js.map} +1 -1
  115. package/dist/_chunks/{singleflight-BeVMMKi0.js → singleflight-BChPMjwH.js} +2 -3
  116. package/dist/_chunks/{singleflight-BeVMMKi0.js.map → singleflight-BChPMjwH.js.map} +1 -1
  117. package/dist/_chunks/{sizeof-CO3dk0V1.js → sizeof-DG4W40lv.js} +3 -4
  118. package/dist/_chunks/{sizeof-CO3dk0V1.js.map → sizeof-DG4W40lv.js.map} +1 -1
  119. package/dist/_chunks/{ssr-data-nA3I70_n.js → ssr-data-9hPtcNOr.js} +3 -4
  120. package/dist/_chunks/{ssr-data-nA3I70_n.js.map → ssr-data-9hPtcNOr.js.map} +1 -1
  121. package/dist/_chunks/{state-BhNGPsdi.js → state-B-EBjeER.js} +2 -3
  122. package/dist/_chunks/{state-BhNGPsdi.js.map → state-B-EBjeER.js.map} +1 -1
  123. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js → status-page-marker-XIQXlTOb.js} +8 -13
  124. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js.map → status-page-marker-XIQXlTOb.js.map} +1 -1
  125. package/dist/_chunks/{tree-match-6yihorhk.js → tree-match-Bqdr9szG.js} +2 -3
  126. package/dist/_chunks/{tree-match-6yihorhk.js.map → tree-match-Bqdr9szG.js.map} +1 -1
  127. package/dist/_chunks/{use-query-states-I3JMng6J.js → use-query-states-pkDV-jSg.js} +4 -7
  128. package/dist/_chunks/{use-query-states-I3JMng6J.js.map → use-query-states-pkDV-jSg.js.map} +1 -1
  129. package/dist/_chunks/{walkers-BqzxnwGC.js → walkers-DIE203ir.js} +6 -8
  130. package/dist/_chunks/{walkers-BqzxnwGC.js.map → walkers-DIE203ir.js.map} +1 -1
  131. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js → write-file-atomic-DW8m_Atv.js} +2 -3
  132. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js.map → write-file-atomic-DW8m_Atv.js.map} +1 -1
  133. package/dist/adapters/build-output-helper.d.ts +10 -1
  134. package/dist/adapters/build-output-helper.d.ts.map +1 -1
  135. package/dist/adapters/cloudflare-dev.js +2 -3
  136. package/dist/adapters/cloudflare-kv-cache.js +3 -4
  137. package/dist/adapters/cloudflare.d.ts.map +1 -1
  138. package/dist/adapters/cloudflare.js +1 -1
  139. package/dist/adapters/nitro-presets.d.ts +6 -0
  140. package/dist/adapters/nitro-presets.d.ts.map +1 -1
  141. package/dist/adapters/nitro-preview.d.ts.map +1 -1
  142. package/dist/adapters/nitro.d.ts.map +1 -1
  143. package/dist/adapters/nitro.js +94 -57
  144. package/dist/adapters/nitro.js.map +1 -1
  145. package/dist/analyze/crawl-entry.js +7 -9
  146. package/dist/analyze/crawl-entry.js.map +1 -1
  147. package/dist/analyze/graph-command.d.ts.map +1 -1
  148. package/dist/analyze/graph-command.js +19 -105
  149. package/dist/analyze/graph-command.js.map +1 -1
  150. package/dist/cache/index.js +3 -3
  151. package/dist/cache/key-discipline.d.ts +61 -0
  152. package/dist/cache/key-discipline.d.ts.map +1 -0
  153. package/dist/cache/stores/cloudflare-kv.js +1 -2
  154. package/dist/cache/stores/memory.js +2 -3
  155. package/dist/cache/stores/redis.js +1 -2
  156. package/dist/cache/stores/vercel.js +1 -2
  157. package/dist/cache/timber-cache.d.ts +5 -1
  158. package/dist/cache/timber-cache.d.ts.map +1 -1
  159. package/dist/cdn/cloudflare-purge.js +1 -2
  160. package/dist/cdn/fastly-purge.js +1 -2
  161. package/dist/cdn/index.js +2 -3
  162. package/dist/cdn/workers-cache-purge.js +3 -5
  163. package/dist/cdn/workers-cache-purge.js.map +1 -1
  164. package/dist/cli-dev-status.d.ts +75 -0
  165. package/dist/cli-dev-status.d.ts.map +1 -0
  166. package/dist/cli-init.d.ts +72 -0
  167. package/dist/cli-init.d.ts.map +1 -0
  168. package/dist/cli.d.ts +4 -12
  169. package/dist/cli.d.ts.map +1 -1
  170. package/dist/cli.js +27 -54
  171. package/dist/cli.js.map +1 -1
  172. package/dist/client/error-boundary.d.ts.map +1 -1
  173. package/dist/client/error-boundary.js +1 -1
  174. package/dist/client/index.js +22 -34
  175. package/dist/client/index.js.map +1 -1
  176. package/dist/client/internal.js +13 -18
  177. package/dist/client/internal.js.map +1 -1
  178. package/dist/client/use-cookie.d.ts +18 -5
  179. package/dist/client/use-cookie.d.ts.map +1 -1
  180. package/dist/codec.js +2 -3
  181. package/dist/config-types.d.ts +22 -5
  182. package/dist/config-types.d.ts.map +1 -1
  183. package/dist/config-validation.d.ts.map +1 -1
  184. package/dist/cookies/define-cookie.d.ts.map +1 -1
  185. package/dist/cookies/index.js +40 -67
  186. package/dist/cookies/index.js.map +1 -1
  187. package/dist/cookies/json-cookie.d.ts +4 -4
  188. package/dist/index.js +266 -229
  189. package/dist/index.js.map +1 -1
  190. package/dist/params/index.js +3 -4
  191. package/dist/plugin-context.d.ts +7 -0
  192. package/dist/plugin-context.d.ts.map +1 -1
  193. package/dist/plugins/dev-discovery.d.ts +69 -5
  194. package/dist/plugins/dev-discovery.d.ts.map +1 -1
  195. package/dist/plugins/dev-hostname.d.ts +152 -0
  196. package/dist/plugins/dev-hostname.d.ts.map +1 -0
  197. package/dist/plugins/dev-server.d.ts +5 -1
  198. package/dist/plugins/dev-server.d.ts.map +1 -1
  199. package/dist/plugins/dev-store-clear.d.ts +59 -4
  200. package/dist/plugins/dev-store-clear.d.ts.map +1 -1
  201. package/dist/plugins/graph-endpoint.d.ts +4 -2
  202. package/dist/plugins/graph-endpoint.d.ts.map +1 -1
  203. package/dist/plugins/prebuilt.d.ts.map +1 -1
  204. package/dist/routing/index.js +4 -4
  205. package/dist/rsc-runtime/rsc.d.ts +2 -1
  206. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  207. package/dist/rsc-runtime/server-references.d.ts +8 -0
  208. package/dist/rsc-runtime/server-references.d.ts.map +1 -0
  209. package/dist/search-params/index.js +5 -7
  210. package/dist/search-params/index.js.map +1 -1
  211. package/dist/server/access-gate.d.ts +12 -0
  212. package/dist/server/access-gate.d.ts.map +1 -1
  213. package/dist/server/canonicalize.d.ts +21 -0
  214. package/dist/server/canonicalize.d.ts.map +1 -1
  215. package/dist/server/cookie-context.d.ts +8 -1
  216. package/dist/server/cookie-context.d.ts.map +1 -1
  217. package/dist/server/flight-source-node.d.ts.map +1 -1
  218. package/dist/server/flight-source.d.ts.map +1 -1
  219. package/dist/server/index.d.ts +1 -1
  220. package/dist/server/index.d.ts.map +1 -1
  221. package/dist/server/index.js +8 -13
  222. package/dist/server/index.js.map +1 -1
  223. package/dist/server/interception-gates.d.ts +49 -0
  224. package/dist/server/interception-gates.d.ts.map +1 -0
  225. package/dist/server/internal.js +1061 -943
  226. package/dist/server/internal.js.map +1 -1
  227. package/dist/server/logger.d.ts +17 -0
  228. package/dist/server/logger.d.ts.map +1 -1
  229. package/dist/server/param-coercion.d.ts +8 -0
  230. package/dist/server/param-coercion.d.ts.map +1 -1
  231. package/dist/server/pipeline-interception.d.ts +34 -4
  232. package/dist/server/pipeline-interception.d.ts.map +1 -1
  233. package/dist/server/pipeline-metadata-route.d.ts +24 -0
  234. package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
  235. package/dist/server/pipeline-metadata.d.ts +3 -2
  236. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  237. package/dist/server/pipeline-phases.d.ts +9 -3
  238. package/dist/server/pipeline-phases.d.ts.map +1 -1
  239. package/dist/server/pipeline.d.ts +18 -0
  240. package/dist/server/pipeline.d.ts.map +1 -1
  241. package/dist/server/prebuilt/dev-store.d.ts +68 -22
  242. package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
  243. package/dist/server/prebuilt/overlay.d.ts +8 -0
  244. package/dist/server/prebuilt/overlay.d.ts.map +1 -1
  245. package/dist/server/prebuilt-runtime.d.ts.map +1 -1
  246. package/dist/server/primitives.d.ts +13 -0
  247. package/dist/server/primitives.d.ts.map +1 -1
  248. package/dist/server/render-utils.d.ts +21 -0
  249. package/dist/server/render-utils.d.ts.map +1 -1
  250. package/dist/server/request-context.d.ts +14 -0
  251. package/dist/server/request-context.d.ts.map +1 -1
  252. package/dist/server/route-element-builder.d.ts.map +1 -1
  253. package/dist/server/route-handler.d.ts +7 -0
  254. package/dist/server/route-handler.d.ts.map +1 -1
  255. package/dist/server/route-matcher.d.ts +14 -3
  256. package/dist/server/route-matcher.d.ts.map +1 -1
  257. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  258. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  259. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  260. package/dist/server/signal-identity.d.ts +6 -0
  261. package/dist/server/signal-identity.d.ts.map +1 -1
  262. package/dist/server/traced-access.d.ts +18 -0
  263. package/dist/server/traced-access.d.ts.map +1 -0
  264. package/dist/server/tracing.d.ts.map +1 -1
  265. package/dist/server/types.d.ts +5 -4
  266. package/dist/server/types.d.ts.map +1 -1
  267. package/dist/shims/font-google.js +1 -2
  268. package/dist/shims/font-local.js +1 -2
  269. package/dist/shims/headers.d.ts +11 -4
  270. package/dist/shims/headers.d.ts.map +1 -1
  271. package/docs/api/30-api-server.mdx +3 -1
  272. package/docs/api/32-api-cache.mdx +1 -1
  273. package/docs/api/34-api-config.mdx +22 -0
  274. package/docs/api/36-cli.mdx +72 -6
  275. package/docs/learn/01-quick-start.mdx +1 -1
  276. package/docs/learn/06-typed-params.mdx +2 -2
  277. package/docs/learn/10-caching.mdx +26 -5
  278. package/llms.txt +1 -1
  279. package/package.json +12 -12
  280. package/src/adapters/build-output-helper.ts +26 -4
  281. package/src/adapters/cloudflare.ts +1 -0
  282. package/src/adapters/nitro-presets.ts +15 -0
  283. package/src/adapters/nitro-preview.ts +66 -34
  284. package/src/adapters/nitro.ts +14 -6
  285. package/src/analyze/graph-command.ts +25 -133
  286. package/src/cache/key-discipline.ts +218 -0
  287. package/src/cache/timber-cache.ts +42 -5
  288. package/src/cli-dev-status.ts +196 -0
  289. package/src/cli-init.ts +278 -0
  290. package/src/cli.ts +33 -79
  291. package/src/client/error-boundary.tsx +19 -2
  292. package/src/client/use-cookie.ts +33 -21
  293. package/src/config-types.ts +22 -5
  294. package/src/config-validation.ts +17 -0
  295. package/src/cookies/define-cookie.ts +10 -46
  296. package/src/cookies/json-cookie.ts +4 -4
  297. package/src/plugin-context.ts +7 -0
  298. package/src/plugins/dev-discovery.ts +216 -6
  299. package/src/plugins/dev-hostname.ts +322 -0
  300. package/src/plugins/dev-server.ts +96 -37
  301. package/src/plugins/dev-store-clear.ts +105 -7
  302. package/src/plugins/graph-endpoint.ts +15 -3
  303. package/src/plugins/prebuilt.ts +9 -0
  304. package/src/rsc-runtime/rsc.ts +7 -3
  305. package/src/rsc-runtime/server-references.ts +73 -0
  306. package/src/rsc-runtime/vendor-types.d.ts +9 -0
  307. package/src/server/access-gate.tsx +32 -20
  308. package/src/server/action-handler.ts +40 -34
  309. package/src/server/canonicalize.ts +27 -0
  310. package/src/server/cookie-context.ts +11 -3
  311. package/src/server/flight-source-node.ts +5 -2
  312. package/src/server/flight-source.ts +4 -3
  313. package/src/server/index.ts +6 -1
  314. package/src/server/interception-gates.ts +94 -0
  315. package/src/server/logger.ts +23 -0
  316. package/src/server/param-coercion.ts +22 -0
  317. package/src/server/pipeline-interception.ts +64 -4
  318. package/src/server/pipeline-metadata-route.ts +242 -0
  319. package/src/server/pipeline-metadata.ts +7 -5
  320. package/src/server/pipeline-phases.ts +71 -131
  321. package/src/server/pipeline.ts +20 -2
  322. package/src/server/prebuilt/dev-store.ts +113 -34
  323. package/src/server/prebuilt/overlay.ts +18 -0
  324. package/src/server/prebuilt-runtime.ts +43 -44
  325. package/src/server/primitives.ts +14 -0
  326. package/src/server/render-utils.ts +25 -0
  327. package/src/server/request-context.ts +27 -3
  328. package/src/server/route-element-builder.ts +15 -2
  329. package/src/server/route-handler.ts +3 -2
  330. package/src/server/route-matcher.ts +48 -33
  331. package/src/server/rsc-entry/api-handler.ts +2 -33
  332. package/src/server/rsc-entry/index.ts +8 -3
  333. package/src/server/rsc-entry/rsc-stream.ts +7 -1
  334. package/src/server/signal-identity.ts +30 -12
  335. package/src/server/traced-access.ts +50 -0
  336. package/src/server/tracing.ts +18 -1
  337. package/src/server/types.ts +5 -4
  338. package/src/shims/headers.ts +12 -4
  339. package/dist/_chunks/actions-vBHr2vqd.js.map +0 -1
  340. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
  341. package/dist/_chunks/cache-api-DdcDLpBj.js.map +0 -1
  342. package/dist/_chunks/chains-B8TCLved.js +0 -1
  343. package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
  344. package/dist/_chunks/dev-server-BNr5drEO.js.map +0 -1
  345. package/dist/_chunks/dev-server-CUg7Mqh_.js +0 -1
  346. package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
  347. package/dist/_chunks/flight-source-node-BdHUOUqg.js.map +0 -1
  348. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
  349. package/dist/_chunks/logger-CI_hThfy.js.map +0 -1
  350. package/dist/_chunks/node-response-bF0bKoig.js.map +0 -1
  351. package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
  352. package/dist/server/prebuilt/key-discipline.d.ts +0 -52
  353. package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
  354. package/src/server/prebuilt/key-discipline.ts +0 -122
@@ -81,7 +81,7 @@ export interface CookieDefinition<T> extends ServerOnlyCookieDefinition<T> {
81
81
  // by trying getCookieJar() — if it throws the stub error, we fall through
82
82
  // to the client path.
83
83
  //
84
- // Client: useCookie, getCookieValue, notifyCookieChange
84
+ // Client: useCookie, getCookieValue, writeClientCookie, deleteClientCookie
85
85
  // are imported from use-cookie.ts. These are safe in all environments (no
86
86
  // node:async_hooks dependency).
87
87
  //
@@ -90,8 +90,9 @@ export interface CookieDefinition<T> extends ServerOnlyCookieDefinition<T> {
90
90
  import { getCookieJar } from '@timber-js/app/server';
91
91
  import {
92
92
  useCookie as useRawCookie,
93
- notifyCookieChange,
94
93
  getCookieValue,
94
+ writeClientCookie,
95
+ deleteClientCookie,
95
96
  } from '../client/use-cookie.ts';
96
97
 
97
98
  // ─── Environment Detection ────────────────────────────────────────────────
@@ -117,33 +118,6 @@ function tryGetServerCookieJar(): ReturnType<typeof getCookieJar> | null {
117
118
  }
118
119
  }
119
120
 
120
- // ─── Client Cookie Helpers ────────────────────────────────────────────────
121
-
122
- /** Write a cookie via document.cookie and notify useCookie subscribers. */
123
- function setClientCookie(name: string, value: string, options?: ClientCookieOptions): void {
124
- const parts: string[] = [`${name}=${encodeURIComponent(value)}`];
125
- const path = options?.path ?? '/';
126
- parts.push(`Path=${path}`);
127
- if (options?.domain) parts.push(`Domain=${options.domain}`);
128
- if (options?.maxAge !== undefined) parts.push(`Max-Age=${options.maxAge}`);
129
- if (options?.expires) parts.push(`Expires=${options.expires.toUTCString()}`);
130
- const sameSite = options?.sameSite ?? 'lax';
131
- parts.push(`SameSite=${sameSite.charAt(0).toUpperCase()}${sameSite.slice(1)}`);
132
- if (options?.secure) parts.push('Secure');
133
- document.cookie = parts.join('; ');
134
- notifyCookieChange(name);
135
- }
136
-
137
- /** Delete a cookie via document.cookie and notify useCookie subscribers. */
138
- function deleteClientCookie(name: string, options?: ClientCookieOptions): void {
139
- const path = options?.path ?? '/';
140
- const domain = options?.domain;
141
- let cookieStr = `${name}=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=${path}`;
142
- if (domain) cookieStr += `; Domain=${domain}`;
143
- document.cookie = cookieStr;
144
- notifyCookieChange(name);
145
- }
146
-
147
121
  // ─── Standard Schema Auto-Detection ───────────────────────────────────────
148
122
 
149
123
  function resolveCodec<T>(codecOrSchema: CookieCodec<T> | StandardSchemaV1<T>): CookieCodec<T> {
@@ -196,14 +170,10 @@ export function defineCookie<T, HttpOnly extends boolean = true>(
196
170
  const isHttpOnly = options.httpOnly !== false; // default true
197
171
 
198
172
  function getClientOpts(): ClientCookieOptions {
199
- return {
200
- path: resolvedOptions.path,
201
- domain: resolvedOptions.domain,
202
- maxAge: resolvedOptions.maxAge,
203
- expires: resolvedOptions.expires,
204
- sameSite: resolvedOptions.sameSite,
205
- secure: resolvedOptions.secure,
206
- };
173
+ // httpOnly is the one attribute document.cookie cannot write.
174
+ const { httpOnly: _httpOnly, ...clientOpts } = resolvedOptions;
175
+ void _httpOnly;
176
+ return clientOpts;
207
177
  }
208
178
 
209
179
  const base: ServerOnlyCookieDefinition<T> = {
@@ -232,10 +202,7 @@ export function defineCookie<T, HttpOnly extends boolean = true>(
232
202
  if (serverJar) {
233
203
  const serialized = codec.serialize(value);
234
204
  if (serialized === null) {
235
- serverJar.delete(name, {
236
- path: resolvedOptions.path,
237
- domain: resolvedOptions.domain,
238
- });
205
+ serverJar.delete(name, resolvedOptions);
239
206
  } else {
240
207
  serverJar.set(name, serialized, resolvedOptions);
241
208
  }
@@ -252,17 +219,14 @@ export function defineCookie<T, HttpOnly extends boolean = true>(
252
219
  if (serialized === null) {
253
220
  deleteClientCookie(name, getClientOpts());
254
221
  } else {
255
- setClientCookie(name, serialized, getClientOpts());
222
+ writeClientCookie(name, serialized, getClientOpts());
256
223
  }
257
224
  },
258
225
 
259
226
  delete(): void {
260
227
  const serverJar = tryGetServerCookieJar();
261
228
  if (serverJar) {
262
- serverJar.delete(name, {
263
- path: resolvedOptions.path,
264
- domain: resolvedOptions.domain,
265
- });
229
+ serverJar.delete(name, resolvedOptions);
266
230
  return;
267
231
  }
268
232
  // Client path
@@ -6,12 +6,12 @@
6
6
  * `JSON.parse` on parse. The framework handles the URL encoding /
7
7
  * decoding around it (see design/29-cookies.md §"Encoding Contract"):
8
8
  *
9
- * defineCookie.setCookie(value)
9
+ * defineCookie().set(value)
10
10
  * → codec.serialize: JSON.stringify → '{"a":1}'
11
- * → cookies().set: encodeURIComponent → '%7B%22a%22%3A1%7D'
11
+ * → getCookieJar().set: encodeURIComponent → '%7B%22a%22%3A1%7D'
12
12
  * → wire: Set-Cookie: prefs=%7B%22a%22%3A1%7D
13
13
  *
14
- * defineCookie.getCookie()
14
+ * defineCookie().get()
15
15
  * → wire: Cookie: prefs=%7B%22a%22%3A1%7D
16
16
  * → parseCookieHeader: decodeURIComponent → '{"a":1}'
17
17
  * → codec.parse: JSON.parse → { a: 1 }
@@ -36,7 +36,7 @@
36
36
  * maxAge: 60 * 60 * 24 * 365,
37
37
  * });
38
38
  *
39
- * await prefsCookie.setCookie({ lang: 'fr', fontSize: 18 });
39
+ * prefsCookie.set({ lang: 'fr', fontSize: 18 });
40
40
  * ```
41
41
  */
42
42
 
@@ -167,6 +167,13 @@ export interface PluginContext {
167
167
  * RSC generateBundle alongside routePrebuiltComponents.
168
168
  */
169
169
  prebuiltLazyChunks?: Map<string, string>;
170
+ /**
171
+ * Dev only: RSC module ID → the cache.component IDs its last transform
172
+ * declared. Written by timber-prebuilt's transform, read by
173
+ * timber-dev-server to scope a dev store clear to the components a saved
174
+ * module could have changed (plugins/dev-store-clear.ts, TIM-1599).
175
+ */
176
+ devPrebuiltComponentIds?: Map<string, string[]>;
170
177
  /**
171
178
  * Content-keyed AST parse memo shared across cache/prebuilt/prerender-sugar
172
179
  * transforms. Collapses both cross-plugin and cross-environment duplicate
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * Dev-server discovery records — `.timber/dev/<pid>-<port>-<token>.json`.
3
3
  *
4
- * On startup each dev server writes `{ port, pid, host, protocol }` to its own record
5
- * file under the app's `.timber/dev/` so the `timber graph` CLI and the
6
- * VS Code extension can discover a running dev server for the
7
- * live-graph fast path.
4
+ * On startup each dev server writes `{ url, port, pid, host, protocol }` to its own record
5
+ * file under the app's `.timber/dev/` so `timber dev status`, the
6
+ * `timber graph` CLI, and the VS Code extension can discover a running
7
+ * dev server. `timber dev status` is the public, agent-facing consumer;
8
+ * the records themselves are not.
8
9
  *
9
10
  * One record file per server, one writer per file. This is what makes
10
11
  * multi-server roots (Vite auto-increments the port across processes;
@@ -29,12 +30,29 @@ import type { Server } from 'node:net';
29
30
  import { Server as TlsServer } from 'node:tls';
30
31
  import { randomUUID } from 'node:crypto';
31
32
  import { mkdirSync, writeFileSync, rmSync, readFileSync, readdirSync } from 'node:fs';
32
- import { join } from 'node:path';
33
+ import { dirname, join } from 'node:path';
34
+ import { request as httpRequest, type ClientRequest } from 'node:http';
35
+ import { request as httpsRequest } from 'node:https';
36
+ import type { AdvertisedUrls } from './dev-hostname.ts';
33
37
 
34
38
  /** Relative path of the discovery directory within the project root. */
35
39
  export const DEV_DISCOVERY_DIR = join('.timber', 'dev');
36
40
 
37
41
  export interface DevRecord {
42
+ /**
43
+ * The URL the server printed and opened — Vite's `resolvedUrls` pick,
44
+ * with the app's dev hostname applied (`http://blog.localhost:3000/`,
45
+ * see plugins/dev-hostname.ts). What `timber dev status` reports. Taken
46
+ * from Vite rather than rebuilt from `host`, so the two cannot disagree.
47
+ */
48
+ url: string;
49
+ /**
50
+ * The same server for non-browser HTTP clients: `url` at plain
51
+ * `localhost` when that resolves and verifies (see `loopbackUrl` in
52
+ * plugins/dev-hostname.ts). Computed by the server, which alone knows its
53
+ * TLS certificate.
54
+ */
55
+ loopbackUrl: string;
38
56
  port: number;
39
57
  pid: number;
40
58
  /**
@@ -133,12 +151,28 @@ function sweepDeadRecords(dir: string): void {
133
151
  }
134
152
  }
135
153
 
154
+ /**
155
+ * The directory whose `.timber/dev/` holds a server's record: the Vite
156
+ * config file's directory, falling back to the resolved root for an inline
157
+ * (`configFile: false`) server. Every consumer — `timber dev status`,
158
+ * `timber graph`, the VS Code extension — locates an app by its config or
159
+ * package directory without evaluating Vite, so the record goes where they
160
+ * look rather than under a `root` the config may move elsewhere.
161
+ */
162
+ export function devRecordRoot(root: string, configFile: string | false | undefined): string {
163
+ return typeof configFile === 'string' ? dirname(configFile) : root;
164
+ }
165
+
136
166
  /**
137
167
  * Register discovery-record lifecycle handlers on the dev server's HTTP
138
168
  * server. Writes `.timber/dev/<pid>-<port>-<token>.json` once the server is
139
169
  * listening (the bound port is only known then) and removes exactly
140
170
  * that record on clean shutdown.
141
171
  *
172
+ * `urls` is read when the server starts listening: the URLs to advertise
173
+ * (`advertisedUrls`). With none, nothing is written — a record no one can
174
+ * open is not worth advertising.
175
+ *
142
176
  * All filesystem work is best-effort: a failure to write or remove a
143
177
  * record must never break the dev server. `httpServer` is null in
144
178
  * middleware mode — no port exists, so there is nothing to advertise.
@@ -148,6 +182,7 @@ function sweepDeadRecords(dir: string): void {
148
182
  export function registerDevDiscovery(
149
183
  httpServer: Server | null,
150
184
  root: string,
185
+ urls: () => AdvertisedUrls | undefined,
151
186
  config?: {
152
187
  configFile?: string | false;
153
188
  base?: string;
@@ -164,16 +199,20 @@ export function registerDevDiscovery(
164
199
  ): void {
165
200
  if (!httpServer) return;
166
201
 
167
- const dir = join(root, DEV_DISCOVERY_DIR);
202
+ const dir = join(devRecordRoot(root, config?.configFile), DEV_DISCOVERY_DIR);
168
203
  let recordPath: string | null = null;
169
204
 
170
205
  httpServer.on('listening', () => {
171
206
  const address = httpServer.address();
172
207
  // Unix-socket listeners have a string address — no port to advertise.
173
208
  if (address === null || typeof address === 'string') return;
209
+ const advertised = urls();
210
+ if (advertised === undefined) return;
174
211
  const hmrOpts = typeof config?.server?.hmr === 'object' ? config.server.hmr : undefined;
175
212
  const wsOpts = typeof config?.server?.ws === 'object' ? config.server.ws : undefined;
176
213
  const record: DevRecord = {
214
+ url: advertised.url,
215
+ loopbackUrl: advertised.loopbackUrl,
177
216
  port: address.port,
178
217
  pid: process.pid,
179
218
  host: address.address,
@@ -216,3 +255,174 @@ export function registerDevDiscovery(
216
255
  }
217
256
  });
218
257
  }
258
+
259
+ // ─── Reading records ─────────────────────────────────────────────────────────
260
+ //
261
+ // The consumer side of the same contract, for the CLI: `timber graph` and
262
+ // `timber dev status` only see validated `DevRecord`s. The VS Code extension
263
+ // (packages/timber-vscode/src/graph-client.ts) is a separate package with its
264
+ // own reader of the same format; a format change must update both.
265
+
266
+ /**
267
+ * `GET /__timber/status` — the dev server's identity probe. Answers
268
+ * `{ pid }` with the serving process's pid, so a consumer can confirm the
269
+ * server on a record's port is the one that wrote the record (a crashed
270
+ * server's port may since have been taken by another process).
271
+ */
272
+ export const STATUS_ENDPOINT_PATH = '/__timber/status';
273
+
274
+ /** Probe deadline: discovery must never hold a CLI hostage. */
275
+ export const DEV_PROBE_TIMEOUT_MS = 2_000;
276
+
277
+ /** Max probe response body (16 MB — matches the crawl child). */
278
+ const PROBE_MAX_BODY_BYTES = 16 * 1024 * 1024;
279
+
280
+ function isValidRecord(record: Partial<DevRecord>): record is DevRecord {
281
+ return (
282
+ typeof record.url === 'string' &&
283
+ typeof record.loopbackUrl === 'string' &&
284
+ typeof record.port === 'number' &&
285
+ Number.isInteger(record.port) &&
286
+ record.port >= 1 &&
287
+ record.port <= 65535 &&
288
+ typeof record.pid === 'number' &&
289
+ Number.isInteger(record.pid) &&
290
+ record.pid >= 1 &&
291
+ typeof record.host === 'string' &&
292
+ (record.protocol === 'http' || record.protocol === 'https')
293
+ );
294
+ }
295
+
296
+ /**
297
+ * Records under `<root>/.timber/dev/` that are well-formed and name a live
298
+ * pid. These are candidates, not proof: the caller still has to probe the
299
+ * endpoint (`readLiveDevRecords`, or `timber graph`'s own graph request,
300
+ * which doubles as its probe). A missing directory or unreadable record is
301
+ * absence, never an error.
302
+ */
303
+ export function readDevRecords(root: string): DevRecord[] {
304
+ const dir = join(root, DEV_DISCOVERY_DIR);
305
+ let entries: string[];
306
+ try {
307
+ entries = readdirSync(dir);
308
+ } catch {
309
+ return [];
310
+ }
311
+ const records: DevRecord[] = [];
312
+ for (const entry of entries) {
313
+ if (!entry.endsWith('.json')) continue;
314
+ let record: Partial<DevRecord>;
315
+ try {
316
+ record = JSON.parse(readFileSync(join(dir, entry), 'utf8')) as Partial<DevRecord>;
317
+ } catch {
318
+ continue;
319
+ }
320
+ if (isValidRecord(record) && isPidAlive(record.pid)) records.push(record);
321
+ }
322
+ return records;
323
+ }
324
+
325
+ /**
326
+ * Records whose server answers the status probe with the record's own pid —
327
+ * the full "pid alive AND probe succeeds" validation. Probes run in
328
+ * parallel, each under `DEV_PROBE_TIMEOUT_MS`.
329
+ */
330
+ export async function readLiveDevRecords(root: string): Promise<DevRecord[]> {
331
+ const candidates = readDevRecords(root);
332
+ const answers = await Promise.all(
333
+ candidates.map((record) => probeDevServer(record, STATUS_ENDPOINT_PATH, DEV_PROBE_TIMEOUT_MS))
334
+ );
335
+ return candidates.filter((record, i) => {
336
+ const answer = answers[i];
337
+ return typeof answer === 'object' && answer !== null && 'pid' in answer
338
+ ? answer.pid === record.pid
339
+ : false;
340
+ });
341
+ }
342
+
343
+ /**
344
+ * Wildcard binds (`0.0.0.0`, `::`) are reached through loopback; a server
345
+ * bound to one specific interface is reached only through that address.
346
+ */
347
+ function connectHost(host: string): string {
348
+ return host === '0.0.0.0' || host === '::' || host === '' ? '127.0.0.1' : host;
349
+ }
350
+
351
+ /**
352
+ * HTTP(S) GET against a record's server with a wall-clock deadline and a
353
+ * response-size limit, returning the parsed JSON body or null on any failure
354
+ * (non-200, bad JSON, timeout, connection error). Uses node:http/https
355
+ * directly — `fetch` silently strips the Host header, which the endpoint's
356
+ * DNS-rebinding defense needs to see as a localhost form.
357
+ *
358
+ * The wall-clock timer covers both connection and body streaming — node's
359
+ * `timeout` option is an INACTIVITY timeout that resets on every chunk, so a
360
+ * slow-drip response would never fire it.
361
+ */
362
+ export function probeDevServer(
363
+ record: DevRecord,
364
+ path: string,
365
+ timeoutMs: number
366
+ ): Promise<unknown> {
367
+ return new Promise((resolve) => {
368
+ let settled = false;
369
+ let req: ClientRequest | undefined;
370
+ const done = (value: unknown) => {
371
+ if (settled) return;
372
+ settled = true;
373
+ clearTimeout(wallClock);
374
+ resolve(value);
375
+ };
376
+ const wallClock = setTimeout(() => {
377
+ req?.destroy();
378
+ done(null);
379
+ }, timeoutMs);
380
+
381
+ const doRequest = record.protocol === 'https' ? httpsRequest : httpRequest;
382
+ try {
383
+ req = doRequest(
384
+ {
385
+ hostname: connectHost(record.host),
386
+ port: record.port,
387
+ path,
388
+ method: 'GET',
389
+ // Self-signed certs are normal for dev servers.
390
+ rejectUnauthorized: false,
391
+ },
392
+ (res) => {
393
+ if (res.statusCode !== 200) {
394
+ req?.destroy();
395
+ done(null);
396
+ return;
397
+ }
398
+ const chunks: Buffer[] = [];
399
+ let totalBytes = 0;
400
+ res.on('data', (chunk: Buffer) => {
401
+ totalBytes += chunk.length;
402
+ if (totalBytes > PROBE_MAX_BODY_BYTES) {
403
+ req?.destroy();
404
+ done(null);
405
+ return;
406
+ }
407
+ chunks.push(chunk);
408
+ });
409
+ res.on('end', () => {
410
+ try {
411
+ done(JSON.parse(Buffer.concat(chunks).toString('utf8')));
412
+ } catch {
413
+ done(null);
414
+ }
415
+ });
416
+ res.on('error', () => done(null));
417
+ }
418
+ );
419
+ } catch {
420
+ // http.request throws synchronously on malformed hostnames
421
+ // (ERR_INVALID_CHAR) or other invalid options — treat as absent.
422
+ done(null);
423
+ return;
424
+ }
425
+ req.on('error', () => done(null));
426
+ req.end();
427
+ });
428
+ }