@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,12 +1,13 @@
1
- import { n as RENDER_TIMEOUT_CEILING_MS, t as DEFAULT_RENDER_TIMEOUT_MS } from "./render-timeout-joFhz4KH.js";
2
- import { l as registerDevDiscovery } from "./graph-cache-CYiUS2aS.js";
3
- import { n as isScannableSourceFile, t as buildSourceExtensions } from "./scan-BoP17W3w.js";
4
- import { t as RSC_CONTENT_TYPE } from "./rsc-media-type-DDc7duTD.js";
5
- import { o as isMetadataRouteServePath } from "./metadata-routes-B3XJNyIH.js";
6
- import { i as canonicalize } from "./canonicalize-BAWkWiKK.js";
7
- import { t as PREBUILT_DEV_CLEAR_EVENT } from "./dev-store-BOa304m_.js";
8
- import { t as matchUrlParts } from "./tree-match-6yihorhk.js";
9
- import { normalizePath } from "vite";
1
+ import { n as RENDER_TIMEOUT_CEILING_MS, t as DEFAULT_RENDER_TIMEOUT_MS } from "./render-timeout-MrrqD1wd.js";
2
+ import { n as STATUS_ENDPOINT_PATH, r as devRecordRoot, s as registerDevDiscovery } from "./dev-discovery-YnabkCKD.js";
3
+ import { n as isScannableSourceFile, t as buildSourceExtensions } from "./scan-CyizcBiX.js";
4
+ import "./graph-cache-B1LAg4t7.js";
5
+ import { t as RSC_CONTENT_TYPE } from "./rsc-media-type-m8jz9u6_.js";
6
+ import { o as isMetadataRouteServePath } from "./metadata-routes-BL26HCDd.js";
7
+ import { a as requestTargetUrl, i as canonicalize } from "./canonicalize-CqK135BN.js";
8
+ import { t as PREBUILT_DEV_CLEAR_EVENT } from "./dev-store-BvdqtHvK.js";
9
+ import { t as matchUrlParts } from "./tree-match-Bqdr9szG.js";
10
+ import { loadConfigFromFile, normalizePath } from "vite";
10
11
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
11
12
  import { createRequire } from "node:module";
12
13
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
@@ -17,10 +18,11 @@ import "node:https";
17
18
  import "node:http2";
18
19
  import { pathToFileURL } from "node:url";
19
20
  import { styleText } from "node:util";
21
+ import { X509Certificate } from "node:crypto";
20
22
  import { realpath, stat } from "node:fs/promises";
21
23
  import { isIP } from "node:net";
22
24
  import { constants, createGzip } from "node:zlib";
23
- //#region ../../node_modules/.pnpm/srvx@1.0.5/node_modules/srvx/dist/adapters/node.mjs
25
+ // ../../node_modules/.pnpm/srvx@1.0.8/node_modules/srvx/dist/adapters/node.mjs
24
26
  function sendNodeResponse(nodeRes, webRes) {
25
27
  try {
26
28
  return _sendNodeResponse(nodeRes, webRes, false) || Promise.resolve();
@@ -83,6 +85,10 @@ function pipeBody(stream, nodeRes, status, statusText, headers) {
83
85
  stream.pipe(nodeRes);
84
86
  return new Promise((resolve) => nodeRes.on("close", resolve));
85
87
  }
88
+ if (stream.readableEnded && !stream.errored) {
89
+ writeHead(nodeRes, status, statusText, headers);
90
+ return endNodeResponse(nodeRes);
91
+ }
86
92
  if (stream.destroyed) {
87
93
  writeHead(nodeRes, 500, "Internal Server Error", []);
88
94
  return endNodeResponse(nodeRes);
@@ -91,6 +97,7 @@ function pipeBody(stream, nodeRes, status, statusText, headers) {
91
97
  function cleanup() {
92
98
  stream.off("error", onEarlyError);
93
99
  stream.off("readable", onReadable);
100
+ stream.off("end", onEnd);
94
101
  nodeRes.off("close", onResClose);
95
102
  }
96
103
  function onEarlyError() {
@@ -108,6 +115,12 @@ function pipeBody(stream, nodeRes, status, statusText, headers) {
108
115
  writeHead(nodeRes, status, statusText, headers);
109
116
  pipeline$1(stream, nodeRes).catch(() => {}).then(() => resolve());
110
117
  }
118
+ function onEnd() {
119
+ cleanup();
120
+ if (nodeRes.destroyed) return resolve();
121
+ writeHead(nodeRes, status, statusText, headers);
122
+ endNodeResponse(nodeRes).then(resolve);
123
+ }
111
124
  function onResClose() {
112
125
  cleanup();
113
126
  stream.destroy();
@@ -115,6 +128,7 @@ function pipeBody(stream, nodeRes, status, statusText, headers) {
115
128
  }
116
129
  stream.once("error", onEarlyError);
117
130
  stream.once("readable", onReadable);
131
+ stream.once("end", onEnd);
118
132
  nodeRes.once("close", onResClose);
119
133
  });
120
134
  }
@@ -149,8 +163,7 @@ function streamBody(stream, nodeRes) {
149
163
  nodeRes.off("error", streamCancel);
150
164
  });
151
165
  }
152
- //#endregion
153
- //#region src/dev-tools/stack-classifier.ts
166
+ // src/dev-tools/stack-classifier.ts
154
167
  /** Parse file/line/col from a stack frame line. */
155
168
  function parseFrame(frameLine) {
156
169
  const parenMatch = /\(([^)]+):(\d+):(\d+)\)/.exec(frameLine);
@@ -202,8 +215,7 @@ function classifyStack(stack, projectRoot) {
202
215
  };
203
216
  });
204
217
  }
205
- //#endregion
206
- //#region src/dev-tools/terminal.ts
218
+ // src/dev-tools/terminal.ts
207
219
  /**
208
220
  * Terminal error formatting — boxed, color-coded error output for dev mode.
209
221
  *
@@ -318,8 +330,7 @@ function extractFnName(frameLine) {
318
330
  const match = /at\s+(\S+)\s+\(/.exec(frameLine.trim());
319
331
  return match ? match[1] : "";
320
332
  }
321
- //#endregion
322
- //#region src/dev-tools/overlay.ts
333
+ // src/dev-tools/overlay.ts
323
334
  /** Labels for terminal output. */
324
335
  var PHASE_LABELS$1 = {
325
336
  "module-transform": "Module Transform",
@@ -408,8 +419,7 @@ function sendErrorToOverlay(server, error, phase, projectRoot) {
408
419
  console.debug("[timber] overlay error send failed:", e instanceof Error ? e.message : e);
409
420
  }
410
421
  }
411
- //#endregion
412
- //#region src/server/utils/escape-html.ts
422
+ // src/server/utils/escape-html.ts
413
423
  /**
414
424
  * Shared HTML escaping utility.
415
425
  *
@@ -425,8 +435,7 @@ function sendErrorToOverlay(server, error, phase, projectRoot) {
425
435
  function escapeHtml(str) {
426
436
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
427
437
  }
428
- //#endregion
429
- //#region src/dev-tools/dev-page-shell.ts
438
+ // src/dev-tools/dev-page-shell.ts
430
439
  /**
431
440
  * Shared scaffold for dev-mode HTML pages (dev error page, dev 404 page).
432
441
  *
@@ -630,8 +639,7 @@ var SHARED_CSS = `
630
639
 
631
640
  .timber-logo { font-weight: 600; white-space: nowrap; }
632
641
  `;
633
- //#endregion
634
- //#region src/dev-tools/error-page.ts
642
+ // src/dev-tools/error-page.ts
635
643
  /**
636
644
  * Dev error page — self-contained HTML error page for dev server 500s.
637
645
  *
@@ -883,8 +891,243 @@ var ERROR_CSS = `
883
891
 
884
892
  .btn:hover { opacity: 0.85; }
885
893
  `;
886
- //#endregion
887
- //#region src/config-validation.ts
894
+ // src/plugins/dev-hostname.ts
895
+ /**
896
+ * Per-app dev hostnames — print and open `<name>.localhost:<port>`.
897
+ *
898
+ * Cookies are not scoped by port, so every app served on `localhost` shares
899
+ * one cookie jar: two apps on :3000 and :3001 overwrite each other's
900
+ * sessions, and service workers stuck to `localhost:3000` carry over to
901
+ * whichever project next gets that port. Browsers resolve
902
+ * `*.localhost` (at any depth) to loopback with no DNS or `/etc/hosts` setup,
903
+ * so giving each app its own name gives it its own cookie jar.
904
+ *
905
+ * This only changes the URL Vite prints, opens, and records for discovery.
906
+ * Nothing is proxied, no `Host` is rewritten, and plain `localhost:<port>`
907
+ * keeps working. Vite's host check already accepts `*.localhost`.
908
+ *
909
+ * See design/21-dev-server.md §"Dev Hostnames" (TIM-1613).
910
+ */
911
+ var LOCALHOST = "localhost";
912
+ var LOCALHOST_SUFFIX = `.${LOCALHOST}`;
913
+ /** RFC 1035 label limit. */
914
+ var MAX_LABEL_LENGTH = 63;
915
+ /** RFC 1035 name limit, `.localhost` included. */
916
+ var MAX_HOSTNAME_LENGTH = 253;
917
+ /**
918
+ * Package names that say nothing about the app: the create-timber-app
919
+ * default (`packages/create-timber-app/src/index.ts`) and the generic names
920
+ * people leave in templates. They would put every unrenamed app on the same
921
+ * hostname, and so the same cookie jar, which is exactly what this
922
+ * feature is for avoiding. The directory name is used instead.
923
+ */
924
+ var PLACEHOLDER_PACKAGE_NAMES = /* @__PURE__ */ new Set([
925
+ "app",
926
+ "my-app",
927
+ "my-timber-app"
928
+ ]);
929
+ var LABEL_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
930
+ /**
931
+ * Reduce arbitrary text to one DNS label: lowercase, anything outside
932
+ * `[a-z0-9-]` becomes `-`, runs of `-` collapse, no leading or trailing
933
+ * `-`, at most 63 characters. May return '' when nothing usable is left.
934
+ */
935
+ function sanitizeLabel(raw) {
936
+ return raw.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+/, "").slice(0, MAX_LABEL_LENGTH).replace(/-+$/, "");
937
+ }
938
+ /**
939
+ * Labels for a package name, most specific first: `@acme/web` →
940
+ * `['web', 'acme']` (so `web.acme.localhost`), `example-blog` →
941
+ * `['example-blog']`. Placeholders and non-strings give `[]`.
942
+ */
943
+ function packageNameLabels(name) {
944
+ if (typeof name !== "string") return [];
945
+ if (PLACEHOLDER_PACKAGE_NAMES.has(name.trim().toLowerCase())) return [];
946
+ const scoped = /^@([^/]+)\/(.+)$/.exec(name);
947
+ return (scoped ? [scoped[2], scoped[1]] : [name]).map(sanitizeLabel).filter(Boolean);
948
+ }
949
+ /**
950
+ * Why a `dev.hostname` value is unusable, or null when it is fine. Accepts
951
+ * `false` (opt out: keep plain `localhost`) or a dot-separated sequence of
952
+ * DNS labels, case-insensitively, with or without a trailing `.localhost`.
953
+ */
954
+ function devHostnameError(value) {
955
+ if (value === false) return null;
956
+ if (typeof value !== "string") return `must be a string like "blog" or false, got ${JSON.stringify(value)}.`;
957
+ const labels = stripLocalhost(value.toLowerCase());
958
+ if (labels === "") return `${JSON.stringify(value)} names no app. Use a name like "blog", or false to keep plain localhost.`;
959
+ const bad = labels.split(".").find((label) => !LABEL_RE.test(label));
960
+ if (bad !== void 0) return `${JSON.stringify(value)} is not a valid hostname: label ${JSON.stringify(bad)} must be 1-63 characters of a-z, 0-9 and "-", not starting or ending with "-".`;
961
+ if (labels.length + LOCALHOST_SUFFIX.length > MAX_HOSTNAME_LENGTH) return `${JSON.stringify(value)} is longer than a hostname can be (253 characters with .localhost).`;
962
+ return null;
963
+ }
964
+ function stripLocalhost(name) {
965
+ if (name === LOCALHOST) return "";
966
+ return name.endsWith(LOCALHOST_SUFFIX) ? name.slice(0, -LOCALHOST_SUFFIX.length) : name;
967
+ }
968
+ /**
969
+ * The dev hostname for an app. In order:
970
+ *
971
+ * 1. `dev.hostname`, when set (`false` → plain `localhost`). An invalid value
972
+ * throws; config validation reports it as fatal before this runs.
973
+ * 2. package.json `name`, unless it is a placeholder. Preferred over the
974
+ * directory because it is stable across clones and worktrees, so OAuth
975
+ * callback URLs registered against it keep working, and because monorepo
976
+ * directories are generic (`apps/web` everywhere).
977
+ * 3. The directory name.
978
+ * 4. Plain `localhost`, when nothing usable is left after sanitizing.
979
+ */
980
+ function deriveDevHostname(source) {
981
+ const { override } = source;
982
+ if (override === false) return LOCALHOST;
983
+ if (override !== void 0) {
984
+ const error = devHostnameError(override);
985
+ if (error) throw new Error(`[timber] dev.hostname ${error}`);
986
+ return `${stripLocalhost(override.toLowerCase())}${LOCALHOST_SUFFIX}`;
987
+ }
988
+ let labels = packageNameLabels(source.packageName);
989
+ if (labels.length === 0) labels = [sanitizeLabel(source.dirName)].filter(Boolean);
990
+ return labels.length === 0 ? LOCALHOST : `${labels.join(".")}${LOCALHOST_SUFFIX}`;
991
+ }
992
+ /**
993
+ * `deriveDevHostname` for the app in `appDir` — the directory its
994
+ * `.timber/` lives in (`devRecordRoot`), where its package.json is. A
995
+ * missing or unreadable package.json falls through to the directory name.
996
+ */
997
+ function resolveDevHostname(appDir, override) {
998
+ let packageName;
999
+ try {
1000
+ packageName = JSON.parse(readFileSync(join(appDir, "package.json"), "utf8")).name;
1001
+ } catch {
1002
+ packageName = void 0;
1003
+ }
1004
+ return deriveDevHostname({
1005
+ override,
1006
+ packageName,
1007
+ dirName: basename(appDir)
1008
+ });
1009
+ }
1010
+ /**
1011
+ * A `cert` entry as Vite reads it (`readFileIfExists` in its
1012
+ * `resolveHttpsConfig`): a string is first tried as a file path, resolved
1013
+ * against the cwd, and is PEM text only when no such file can be read.
1014
+ * `config.server.https` keeps the raw option, so the path is read here too.
1015
+ */
1016
+ function certBytes(entry) {
1017
+ if (entry instanceof Uint8Array) return entry;
1018
+ if (typeof entry !== "string") return null;
1019
+ try {
1020
+ return readFileSync(resolve(entry));
1021
+ } catch {
1022
+ return entry;
1023
+ }
1024
+ }
1025
+ /**
1026
+ * Whether a TLS `cert` option (PEM string or Buffer, a path to one, or an
1027
+ * array of them — Node's `tls` shape plus Vite's paths) names `hostname`.
1028
+ * A `pfx`-only config has no `cert` and so keeps `localhost`. An https dev server prints the
1029
+ * named URL only when it does: a trusted certificate issued for `localhost`
1030
+ * alone (mkcert's default) would turn a working URL into a certificate error.
1031
+ */
1032
+ function certCoversHostname(cert, hostname) {
1033
+ return (Array.isArray(cert) ? cert : [cert]).some((entry) => {
1034
+ const pem = certBytes(entry);
1035
+ if (pem === null) return false;
1036
+ try {
1037
+ return new X509Certificate(pem).checkHost(hostname) !== void 0;
1038
+ } catch {
1039
+ return false;
1040
+ }
1041
+ });
1042
+ }
1043
+ /**
1044
+ * The hostname to print for this server, after the https check. `https` is
1045
+ * Vite's resolved `server.https` (undefined for plain http).
1046
+ */
1047
+ function effectiveDevHostname(hostname, https) {
1048
+ if (hostname === LOCALHOST || !https) return hostname;
1049
+ return certCoversHostname(https.cert, hostname) ? hostname : LOCALHOST;
1050
+ }
1051
+ /**
1052
+ * Rename the `localhost` entries of `urls.local` to `hostname`. Only those:
1053
+ * an explicit loopback IP (`host: '127.0.0.1'`) is what the developer asked
1054
+ * to see, certificate-derived names already name a host, and network URLs
1055
+ * are other machines' way in. Idempotent: a renamed URL is no longer a
1056
+ * `localhost` URL.
1057
+ */
1058
+ function withDevHostname(urls, hostname) {
1059
+ if (hostname === LOCALHOST) return urls;
1060
+ const local = urls.local.map((href) => {
1061
+ const url = new URL(href);
1062
+ if (url.hostname !== LOCALHOST) return href;
1063
+ url.hostname = hostname;
1064
+ return url.href;
1065
+ });
1066
+ return {
1067
+ ...urls,
1068
+ local: [...new Set(local)]
1069
+ };
1070
+ }
1071
+ /**
1072
+ * The same URL through plain `localhost`: what a non-browser HTTP client can
1073
+ * reach. Browsers and curl resolve `*.localhost` themselves, but Node, Python
1074
+ * and other clients ask the OS, and not every resolver (glibc without
1075
+ * systemd-resolved) maps `*.localhost` to loopback. The server answers both
1076
+ * names, so only the hostname changes. Other URLs are returned unchanged.
1077
+ *
1078
+ * Under https the swap also has to survive TLS hostname verification: a
1079
+ * certificate issued for `blog.localhost` alone fails for `localhost`
1080
+ * (`ERR_TLS_CERT_ALTNAME_INVALID`), so the named URL is kept unless the
1081
+ * certificate covers `localhost` too. `https` is Vite's `server.https`.
1082
+ */
1083
+ function loopbackUrl(href, https) {
1084
+ const url = new URL(href);
1085
+ if (!url.hostname.endsWith(LOCALHOST_SUFFIX)) return href;
1086
+ if (url.protocol === "https:" && !certCoversHostname(https?.cert, LOCALHOST)) return href;
1087
+ url.hostname = LOCALHOST;
1088
+ return url.href;
1089
+ }
1090
+ /**
1091
+ * The URL a server is opened at, after the rename: Vite's own choice, as its
1092
+ * `getServerUrlByHost` makes it for `server.open` — the first URL containing
1093
+ * a string `server.host`, else `local[0]`, else `network[0]`. The discovery
1094
+ * record stores this, so `timber dev status` reports the URL Vite opens.
1095
+ */
1096
+ function primaryServerUrl(urls, hostname, serverHost) {
1097
+ if (!urls) return void 0;
1098
+ const named = withDevHostname(urls, hostname);
1099
+ const all = [...named.local, ...named.network];
1100
+ return (typeof serverHost === "string" ? all.find((url) => url.includes(serverHost)) : void 0) ?? named.local[0] ?? named.network[0];
1101
+ }
1102
+ /**
1103
+ * The record's URLs, computed by the server, which alone knows its
1104
+ * certificate. `server` is Vite's resolved `server` config.
1105
+ */
1106
+ function advertisedUrls(urls, hostname, server) {
1107
+ const url = primaryServerUrl(urls, hostname, server?.host);
1108
+ return url === void 0 ? void 0 : {
1109
+ url,
1110
+ loopbackUrl: loopbackUrl(url, server?.https)
1111
+ };
1112
+ }
1113
+ /**
1114
+ * Resolve the app's dev hostname and rename the printed/opened URL once the
1115
+ * server is listening. Returns the hostname so the discovery record can
1116
+ * describe the same URL (`primaryServerUrl`).
1117
+ *
1118
+ * Vite assigns `resolvedUrls` in a `listening` listener it *prepends* in
1119
+ * `listen()`, after every `configureServer` hook has run, so this listener
1120
+ * always sees them; `printUrls()` and `openBrowser()` run after `listen()`
1121
+ * resolves. Middleware mode has no `httpServer` and prints nothing.
1122
+ */
1123
+ function applyDevHostname(server, appDir, override) {
1124
+ const hostname = effectiveDevHostname(resolveDevHostname(appDir, override), server.config.server?.https);
1125
+ if (server.httpServer && hostname !== LOCALHOST) server.httpServer.on("listening", () => {
1126
+ if (server.resolvedUrls) server.resolvedUrls = withDevHostname(server.resolvedUrls, hostname);
1127
+ });
1128
+ return hostname;
1129
+ }
1130
+ // src/config-validation.ts
888
1131
  /**
889
1132
  * Config validation — validates timber.config.ts at startup.
890
1133
  *
@@ -1012,6 +1255,15 @@ function validateConfig(config) {
1012
1255
  suggestion: `Use one of: ${valid.map((v) => `"${v}"`).join(", ")}.`
1013
1256
  });
1014
1257
  }
1258
+ if (config.dev?.hostname !== void 0) {
1259
+ const problem = devHostnameError(config.dev.hostname);
1260
+ if (problem) errors.push({
1261
+ field: "dev.hostname",
1262
+ message: `dev.hostname ${problem}`,
1263
+ value: config.dev.hostname,
1264
+ suggestion: "Use DNS labels separated by dots, e.g. dev: { hostname: \"blog\" } for blog.localhost, or false to keep plain localhost."
1265
+ });
1266
+ }
1015
1267
  if (config.sitemap != null && typeof config.sitemap === "object") {
1016
1268
  if (config.sitemap.enabled && !config.sitemap.baseUrl) errors.push({
1017
1269
  field: "sitemap.baseUrl",
@@ -1301,7 +1553,8 @@ function reflectCors(res, origin) {
1301
1553
  res.setHeader("Vary", "Origin");
1302
1554
  }
1303
1555
  /**
1304
- * Create the Connect middleware handling GET /__timber/graph.
1556
+ * Create the Connect middleware handling GET /__timber/graph and the
1557
+ * GET /__timber/status identity probe.
1305
1558
  *
1306
1559
  * Query surface: `?file=<path>` (absolute or project-root-relative) or
1307
1560
  * `?all=1`. Anything else is a 400 — fail loudly, like the CLI.
@@ -1315,7 +1568,8 @@ function createGraphEndpointMiddleware(server, ctx) {
1315
1568
  return;
1316
1569
  }
1317
1570
  const url = new URL(rawUrl, "http://placeholder.invalid");
1318
- if (url.pathname !== "/__timber/graph") {
1571
+ const isStatus = url.pathname === STATUS_ENDPOINT_PATH;
1572
+ if (!isStatus && url.pathname !== "/__timber/graph") {
1319
1573
  sendJson(res, 404, { error: `unknown /__timber/ endpoint: ${url.pathname}` });
1320
1574
  return;
1321
1575
  }
@@ -1335,8 +1589,12 @@ function createGraphEndpointMiddleware(server, ctx) {
1335
1589
  return;
1336
1590
  }
1337
1591
  reflectCors(res, origin);
1592
+ if (isStatus) {
1593
+ sendJson(res, 200, { pid: process.pid });
1594
+ return;
1595
+ }
1338
1596
  try {
1339
- const { classifyLiveFile, classifyLiveProject } = await import("./live-graph-tSWrv8eH.js");
1597
+ const { classifyLiveFile, classifyLiveProject } = await import("./live-graph-BcVjQ1Te.js");
1340
1598
  const preserveSymlinks = server.config.resolve.preserveSymlinks;
1341
1599
  const root = normalizePath(preserveSymlinks ? ctx.root : await realpath(ctx.root));
1342
1600
  const appDir = normalizePath(preserveSymlinks ? ctx.appDir : await realpath(ctx.appDir).catch(() => join(root, relative(ctx.root, ctx.appDir))));
@@ -1528,8 +1786,7 @@ function makeGraphUpdateChannel(ctx, send, isTransformed, canonicalize = (file)
1528
1786
  }
1529
1787
  };
1530
1788
  }
1531
- //#endregion
1532
- //#region src/server/compress.ts
1789
+ // src/server/compress.ts
1533
1790
  /**
1534
1791
  * MIME types that benefit from compression.
1535
1792
  * text/* is handled via prefix matching; these are the specific
@@ -1662,8 +1919,72 @@ function compressWithGzip(body) {
1662
1919
  pipeline(nodeInput, gzip, () => {});
1663
1920
  return Readable.toWeb(gzip);
1664
1921
  }
1665
- //#endregion
1666
- //#region src/plugins/dev-server.ts
1922
+ // src/plugins/dev-store-clear.ts
1923
+ /**
1924
+ * Comfortably past the throttle window. Both are timers started in the same
1925
+ * synchronous emit, so this one always fires after the throttle has expired,
1926
+ * however late the event loop runs them.
1927
+ */
1928
+ var TRAILING_CLEAR_DELAY_MS = 100;
1929
+ function clearDevStoreOnWatcherEvents(watcher, clear) {
1930
+ let trailing;
1931
+ let burst = /* @__PURE__ */ new Set();
1932
+ watcher.on("all", (event, path) => {
1933
+ const changed = event === "change" ? /* @__PURE__ */ new Set([path]) : null;
1934
+ clear(changed);
1935
+ if (changed === null) burst = null;
1936
+ else burst?.add(path);
1937
+ clearTimeout(trailing);
1938
+ trailing = setTimeout(() => {
1939
+ const covered = burst;
1940
+ burst = /* @__PURE__ */ new Set();
1941
+ clear(covered);
1942
+ }, TRAILING_CLEAR_DELAY_MS);
1943
+ trailing.unref?.();
1944
+ });
1945
+ }
1946
+ /**
1947
+ * The cache.component IDs whose output the changed paths could have
1948
+ * changed: those declared in each changed module and its transitive
1949
+ * importers. Null means every component — a path the graph does not know.
1950
+ *
1951
+ * `componentIds` maps a module ID to the IDs its last transform declared
1952
+ * (`PluginContext.devPrebuiltComponentIds`). `toGraphPath` puts a watcher
1953
+ * path in the graph's path space (symlinks resolved, `/` separators).
1954
+ */
1955
+ function componentsChangedBy(changed, graph, componentIds, toGraphPath) {
1956
+ if (changed === null) return null;
1957
+ const affected = /* @__PURE__ */ new Set();
1958
+ const visited = /* @__PURE__ */ new Set();
1959
+ const pending = [];
1960
+ for (const path of changed) {
1961
+ const nodes = [...graph.getModulesByFile(toGraphPath(path)) ?? []];
1962
+ if (!nodes.some((node) => node.id !== null)) return null;
1963
+ pending.push(...nodes);
1964
+ }
1965
+ while (pending.length > 0) {
1966
+ const module = pending.pop();
1967
+ if (visited.has(module)) continue;
1968
+ visited.add(module);
1969
+ if (module.id !== null) for (const id of componentIds.get(module.id) ?? []) affected.add(id);
1970
+ pending.push(...module.importers);
1971
+ }
1972
+ return [...affected];
1973
+ }
1974
+ // src/plugins/dev-server.ts
1975
+ /**
1976
+ * timber-dev-server — Vite sub-plugin for dev server request handling.
1977
+ *
1978
+ * Registers a configureServer middleware that intercepts requests and
1979
+ * routes them through the timber pipeline:
1980
+ * proxy.ts → canonicalize → route match → middleware → access → render → flush
1981
+ *
1982
+ * The RSC entry module is loaded via Vite's ssrLoadModule, which uses
1983
+ * Vite's dev module graph instead of built bundles. The full pipeline
1984
+ * (including proxy.ts) runs on every request.
1985
+ *
1986
+ * Design docs: 18-build-system.md §"Dev Server", 02-rendering-pipeline.md
1987
+ */
1667
1988
  var RSC_ENTRY_ID = "virtual:timber-rsc-entry";
1668
1989
  /**
1669
1990
  * Exit code used to signal the CLI supervisor that the dev server needs
@@ -1753,13 +2074,50 @@ function timberDevServer(ctx) {
1753
2074
  server.watcher.on("change", onConfigChange);
1754
2075
  server.watcher.on("add", onConfigChange);
1755
2076
  server.watcher.on("unlink", onConfigChange);
2077
+ if (hasSupervisor) server.restart = async () => {
2078
+ const { configFile, mode, root, logger } = server.config;
2079
+ try {
2080
+ await loadConfigFromFile({
2081
+ command: "serve",
2082
+ mode
2083
+ }, configFile || void 0, root, "silent");
2084
+ } catch (error) {
2085
+ logger.error(`[timber] ${configFile ? basename(configFile) : "Vite config"} failed to load — keeping the running server.\n${error instanceof Error ? error.message : String(error)}`, { timestamp: true });
2086
+ return;
2087
+ }
2088
+ console.log("\n[timber] Restarting the dev server process...\n");
2089
+ process.exit(75);
2090
+ };
1756
2091
  listenForClientErrors(server, ctx.root);
2092
+ server.middlewares.use((req, _res, next) => {
2093
+ if (req.url && !req.url.startsWith("/")) {
2094
+ const url = requestTargetUrl("http://localhost", req.url);
2095
+ if (url) req.url = url.pathname + url.search;
2096
+ }
2097
+ next();
2098
+ });
1757
2099
  server.middlewares.use(createGraphEndpointMiddleware(server, ctx));
1758
- const rscHot = server.environments.rsc?.hot;
1759
- server.watcher.on("all", () => {
1760
- rscHot?.send({
2100
+ const toGraphPath = (file) => {
2101
+ if (server.config?.resolve?.preserveSymlinks || file.includes("virtual:")) return file;
2102
+ try {
2103
+ return realpathSync(file);
2104
+ } catch {
2105
+ try {
2106
+ return join(realpathSync(dirname(file)), basename(file));
2107
+ } catch {
2108
+ return file;
2109
+ }
2110
+ }
2111
+ };
2112
+ const rsc = server.environments.rsc;
2113
+ clearDevStoreOnWatcherEvents(server.watcher, (changed) => {
2114
+ if (!rsc) return;
2115
+ const componentIds = componentsChangedBy(changed, rsc.moduleGraph, ctx.devPrebuiltComponentIds ?? /* @__PURE__ */ new Map(), (path) => normalizePath(toGraphPath(path)));
2116
+ const data = componentIds === null ? {} : { componentIds };
2117
+ rsc.hot.send({
1761
2118
  type: "custom",
1762
- event: PREBUILT_DEV_CLEAR_EVENT
2119
+ event: PREBUILT_DEV_CLEAR_EVENT,
2120
+ data
1763
2121
  });
1764
2122
  });
1765
2123
  graphChannel = makeGraphUpdateChannel(ctx, (payload) => server.hot.send(payload), (file, environment) => {
@@ -1771,20 +2129,10 @@ function timberDevServer(ctx) {
1771
2129
  return false;
1772
2130
  }
1773
2131
  return graph.getModuleById(file)?.transformResult != null;
1774
- }, (file) => {
1775
- if (server.config?.resolve?.preserveSymlinks || file.includes("virtual:")) return file;
1776
- try {
1777
- return realpathSync(file);
1778
- } catch {
1779
- try {
1780
- return join(realpathSync(dirname(file)), basename(file));
1781
- } catch {
1782
- return file;
1783
- }
1784
- }
1785
- });
2132
+ }, toGraphPath);
1786
2133
  server.middlewares.use(createTimberMiddleware(server, ctx));
1787
- registerDevDiscovery(server.httpServer, ctx.root, server.config);
2134
+ const hostname = applyDevHostname(server, devRecordRoot(ctx.root, server.config.configFile), ctx.config.dev?.hostname);
2135
+ registerDevDiscovery(server.httpServer, ctx.root, () => advertisedUrls(server.resolvedUrls, hostname, server.config.server), server.config);
1788
2136
  if (ctx.holdingServer) {
1789
2137
  await ctx.holdingServer.close().catch(() => {});
1790
2138
  ctx.holdingServer = null;
@@ -1856,6 +2204,11 @@ function createTimberMiddleware(server, ctx) {
1856
2204
  }
1857
2205
  try {
1858
2206
  const webRequest = toWebRequest(req);
2207
+ if (!webRequest) {
2208
+ res.writeHead(400, { "content-type": "text/plain; charset=utf-8" });
2209
+ res.end("Bad Request");
2210
+ return;
2211
+ }
1859
2212
  const wrapper = server[Symbol.for("timber:dev-request-wrapper")];
1860
2213
  const finalResponse = compressResponse(webRequest, wrapper ? await wrapper(() => handler(webRequest)) : await handler(webRequest));
1861
2214
  res.writeHead(finalResponse.status, [...finalResponse.headers].flat());
@@ -1915,12 +2268,18 @@ function addTimberContext(error) {
1915
2268
  * consulted: dev connections are direct, so the header would be
1916
2269
  * attacker-controlled. (TIM-1067, B32)
1917
2270
  *
2271
+ * Returns null for a request that names no URL — a Host that is not a bare
2272
+ * host[:port], or a request target that does not parse — which the caller
2273
+ * answers with 400. (TIM-1600)
2274
+ *
1918
2275
  * Exported for tests.
1919
2276
  */
1920
2277
  function toWebRequest(nodeReq) {
1921
2278
  const protocol = nodeReq.socket?.encrypted ? "https" : "http";
1922
2279
  const host = nodeReq.headers.host ?? nodeReq.headers[":authority"] ?? "localhost";
1923
- const url = `${protocol}://${host}${nodeReq.url}`;
2280
+ const origin = /[/?#@\\]/.test(host) ? null : URL.parse(`${protocol}://${host}`)?.origin;
2281
+ const url = origin ? requestTargetUrl(origin, nodeReq.url || "/") : null;
2282
+ if (!url) return null;
1924
2283
  const headers = new Headers();
1925
2284
  for (const [key, value] of Object.entries(nodeReq.headers)) {
1926
2285
  if (value === void 0) continue;
@@ -2055,7 +2414,6 @@ function listenForClientErrors(server, projectRoot) {
2055
2414
  }
2056
2415
  });
2057
2416
  }
2058
- //#endregion
2059
2417
  export { formatMissingPeers as a, checkPeerDependencies as i, timberDevServer as n, reportConfigErrors as o, toWebRequest as r, validateConfig as s, RESTART_EXIT_CODE as t };
2060
2418
 
2061
- //# sourceMappingURL=dev-server-DIy-SY-J.js.map
2419
+ //# sourceMappingURL=dev-server-C61GWpGg.js.map