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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/agent-skill.md +21 -5
  2. package/dist/_chunks/{actions-vBHr2vqd.js → actions-7dTXYJfu.js} +53 -24
  3. package/dist/_chunks/actions-7dTXYJfu.js.map +1 -0
  4. package/dist/_chunks/{als-registry-BZqHCtq-.js → als-registry-DpygwCp0.js} +2 -3
  5. package/dist/_chunks/{als-registry-BZqHCtq-.js.map → als-registry-DpygwCp0.js.map} +1 -1
  6. package/dist/_chunks/{als-slots-BEEIPKYm.js → als-slots-kbQrHTzm.js} +2 -3
  7. package/dist/_chunks/{als-slots-BEEIPKYm.js.map → als-slots-kbQrHTzm.js.map} +1 -1
  8. package/dist/_chunks/{base-path-DaQrzbez.js → base-path-DDIx0FXe.js} +2 -3
  9. package/dist/_chunks/{base-path-DaQrzbez.js.map → base-path-DDIx0FXe.js.map} +1 -1
  10. package/dist/_chunks/{build-manifest-DWppEdLB.js → build-manifest-Y4jl7nwU.js} +2 -3
  11. package/dist/_chunks/{build-manifest-DWppEdLB.js.map → build-manifest-Y4jl7nwU.js.map} +1 -1
  12. package/dist/_chunks/{build-output-helper-RV_BRcF1.js → build-output-helper-B7wWGTfR.js} +14 -10
  13. package/dist/_chunks/build-output-helper-B7wWGTfR.js.map +1 -0
  14. package/dist/_chunks/{cache-api-DdcDLpBj.js → cache-api-TDZ4hlDc.js} +190 -38
  15. package/dist/_chunks/cache-api-TDZ4hlDc.js.map +1 -0
  16. package/dist/_chunks/{canonicalize-BAWkWiKK.js → canonicalize-CqK135BN.js} +29 -4
  17. package/dist/_chunks/{canonicalize-BAWkWiKK.js.map → canonicalize-CqK135BN.js.map} +1 -1
  18. package/dist/_chunks/chains-CwOr3Myj.js +1 -0
  19. package/dist/_chunks/{chains-BchW_AtW.js → chains-Dgm3PrMe.js} +3 -4
  20. package/dist/_chunks/{chains-BchW_AtW.js.map → chains-Dgm3PrMe.js.map} +1 -1
  21. package/dist/_chunks/{classify-IqzMpxMs.js → classify--_kINHQV.js} +4 -5
  22. package/dist/_chunks/{classify-IqzMpxMs.js.map → classify--_kINHQV.js.map} +1 -1
  23. package/dist/_chunks/{cli-check-DQne_YhU.js → cli-check-Dv3f8d2j.js} +5 -6
  24. package/dist/_chunks/{cli-check-DQne_YhU.js.map → cli-check-Dv3f8d2j.js.map} +1 -1
  25. package/dist/_chunks/{cli-context-_mPttGGY.js → cli-context-CbZp32SK.js} +3 -4
  26. package/dist/_chunks/{cli-context-_mPttGGY.js.map → cli-context-CbZp32SK.js.map} +1 -1
  27. package/dist/_chunks/cli-context-n5hmkdla.js +1 -0
  28. package/dist/_chunks/cli-dev-status-prPMLU8G.js +138 -0
  29. package/dist/_chunks/cli-dev-status-prPMLU8G.js.map +1 -0
  30. package/dist/_chunks/cli-init-BoXOYYil.js +196 -0
  31. package/dist/_chunks/cli-init-BoXOYYil.js.map +1 -0
  32. package/dist/_chunks/{cli-schema-sync-BS-RFGE2.js → cli-schema-sync-DIPurq7X.js} +4 -5
  33. package/dist/_chunks/{cli-schema-sync-BS-RFGE2.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
  34. package/dist/_chunks/{cli-schema-sync-v872sHms.js → cli-schema-sync-uq72EZmD.js} +1 -1
  35. package/dist/_chunks/{client-dep-entries-BJyP9SIu.js → client-dep-entries-CP7AkMCM.js} +4 -5
  36. package/dist/_chunks/{client-dep-entries-BJyP9SIu.js.map → client-dep-entries-CP7AkMCM.js.map} +1 -1
  37. package/dist/_chunks/{cloudflare-Byxl8FWP.js → cloudflare-B75X6u4O.js} +10 -13
  38. package/dist/_chunks/{cloudflare-Byxl8FWP.js.map → cloudflare-B75X6u4O.js.map} +1 -1
  39. package/dist/_chunks/{codec-registry-oOUxugz3.js → codec-registry-CPc6bjVl.js} +2 -3
  40. package/dist/_chunks/{codec-registry-oOUxugz3.js.map → codec-registry-CPc6bjVl.js.map} +1 -1
  41. package/dist/_chunks/{codegen-Bps1sLKJ.js → codegen-B9oWkWGf.js} +5 -8
  42. package/dist/_chunks/{codegen-Bps1sLKJ.js.map → codegen-B9oWkWGf.js.map} +1 -1
  43. package/dist/_chunks/{convention-lint-VwzrtjIt.js → convention-lint-hZwz5wd4.js} +8 -11
  44. package/dist/_chunks/{convention-lint-VwzrtjIt.js.map → convention-lint-hZwz5wd4.js.map} +1 -1
  45. package/dist/_chunks/dev-discovery-YnabkCKD.js +238 -0
  46. package/dist/_chunks/dev-discovery-YnabkCKD.js.map +1 -0
  47. package/dist/_chunks/{dev-server-BNr5drEO.js → dev-server-B7o4As0l.js} +383 -55
  48. package/dist/_chunks/dev-server-B7o4As0l.js.map +1 -0
  49. package/dist/_chunks/dev-server-hZzmbMvK.js +1 -0
  50. package/dist/_chunks/{dev-store-BOa304m_.js → dev-store-BvdqtHvK.js} +82 -38
  51. package/dist/_chunks/dev-store-BvdqtHvK.js.map +1 -0
  52. package/dist/_chunks/{dist-DtrJyBbw.js → dist-C1Rjlo6s.js} +3 -5
  53. package/dist/_chunks/{dist-DtrJyBbw.js.map → dist-C1Rjlo6s.js.map} +1 -1
  54. package/dist/_chunks/{error-boundary-Bc8QPZuq.js → error-boundary-DRQXGWCp.js} +20 -27
  55. package/dist/_chunks/{error-boundary-Bc8QPZuq.js.map → error-boundary-DRQXGWCp.js.map} +1 -1
  56. package/dist/_chunks/{fast-hash-C-tVYrLb.js → fast-hash-DddxkU5Y.js} +2 -3
  57. package/dist/_chunks/{fast-hash-C-tVYrLb.js.map → fast-hash-DddxkU5Y.js.map} +1 -1
  58. package/dist/_chunks/{flight-source-node-BdHUOUqg.js → flight-source-node-0Tp6evlz.js} +6 -8
  59. package/dist/_chunks/flight-source-node-0Tp6evlz.js.map +1 -0
  60. package/dist/_chunks/{format-BKclgVbk.js → format-DuPOoXUP.js} +2 -3
  61. package/dist/_chunks/{format-BKclgVbk.js.map → format-DuPOoXUP.js.map} +1 -1
  62. package/dist/_chunks/{fs-identity-BRKuL215.js → fs-identity-BmQ_Agg-.js} +3 -5
  63. package/dist/_chunks/{fs-identity-BRKuL215.js.map → fs-identity-BmQ_Agg-.js.map} +1 -1
  64. package/dist/_chunks/{global-context-B9PFncvb.js → global-context-DbxNWeBP.js} +2 -3
  65. package/dist/_chunks/{global-context-B9PFncvb.js.map → global-context-DbxNWeBP.js.map} +1 -1
  66. package/dist/_chunks/{graph-cache-CYiUS2aS.js → graph-cache-B1LAg4t7.js} +5 -89
  67. package/dist/_chunks/graph-cache-B1LAg4t7.js.map +1 -0
  68. package/dist/_chunks/{href-validation-BIrxavIy.js → href-validation-CEZy1V-k.js} +4 -7
  69. package/dist/_chunks/{href-validation-BIrxavIy.js.map → href-validation-CEZy1V-k.js.map} +1 -1
  70. package/dist/_chunks/{json-lossy-check-C3Sht92C.js → json-lossy-check-DVkLUlfC.js} +3 -4
  71. package/dist/_chunks/{json-lossy-check-C3Sht92C.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
  72. package/dist/_chunks/{live-graph-DEu_GWbc.js → live-graph-BcVjQ1Te.js} +6 -7
  73. package/dist/_chunks/{live-graph-DEu_GWbc.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
  74. package/dist/_chunks/{logger-CI_hThfy.js → logger-CWk44DLp.js} +89 -47
  75. package/dist/_chunks/logger-CWk44DLp.js.map +1 -0
  76. package/dist/_chunks/{metadata-routes-B3XJNyIH.js → metadata-routes-BL26HCDd.js} +2 -3
  77. package/dist/_chunks/{metadata-routes-B3XJNyIH.js.map → metadata-routes-BL26HCDd.js.map} +1 -1
  78. package/dist/_chunks/{navigation-root-BQfo1-kG.js → navigation-root-M3B2ZrdO.js} +6 -10
  79. package/dist/_chunks/{navigation-root-BQfo1-kG.js.map → navigation-root-M3B2ZrdO.js.map} +1 -1
  80. package/dist/_chunks/{node-response-bF0bKoig.js → node-response-B9aviPDa.js} +43 -9
  81. package/dist/_chunks/node-response-B9aviPDa.js.map +1 -0
  82. package/dist/_chunks/{param-value-C8TNYchQ.js → param-value-DqlGfF57.js} +2 -3
  83. package/dist/_chunks/{param-value-C8TNYchQ.js.map → param-value-DqlGfF57.js.map} +1 -1
  84. package/dist/_chunks/{plugin-context-uDHFqHHJ.js → plugin-context-BfSRKJfz.js} +1 -1
  85. package/dist/_chunks/{plugin-context-DxMMvjUt.js → plugin-context-FCkaNLUB.js} +4 -6
  86. package/dist/_chunks/plugin-context-FCkaNLUB.js.map +1 -0
  87. package/dist/_chunks/{poison-rules-DoEhbqaY.js → poison-rules-Bmz-lCPi.js} +2 -3
  88. package/dist/_chunks/{poison-rules-DoEhbqaY.js.map → poison-rules-Bmz-lCPi.js.map} +1 -1
  89. package/dist/_chunks/{poison-scan-DTWIfNgD.js → poison-scan-DJYxZc_7.js} +4 -5
  90. package/dist/_chunks/{poison-scan-DTWIfNgD.js.map → poison-scan-DJYxZc_7.js.map} +1 -1
  91. package/dist/_chunks/{purge-store-WZaxu-3m.js → purge-store-8BqLAYZ1.js} +2 -3
  92. package/dist/_chunks/{purge-store-WZaxu-3m.js.map → purge-store-8BqLAYZ1.js.map} +1 -1
  93. package/dist/_chunks/{render-timeout-Ln_u7fX-.js → render-timeout-MrrqD1wd.js} +2 -3
  94. package/dist/_chunks/{render-timeout-Ln_u7fX-.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
  95. package/dist/_chunks/{resolve-schema-CkAInout.js → resolve-schema-B-aCuTu3.js} +3 -4
  96. package/dist/_chunks/{resolve-schema-CkAInout.js.map → resolve-schema-B-aCuTu3.js.map} +1 -1
  97. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js → rsc-cache-key-D0cb0Gmc.js} +2 -3
  98. package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js.map → rsc-cache-key-D0cb0Gmc.js.map} +1 -1
  99. package/dist/_chunks/{rsc-media-type-DDc7duTD.js → rsc-media-type-m8jz9u6_.js} +2 -3
  100. package/dist/_chunks/{rsc-media-type-DDc7duTD.js.map → rsc-media-type-m8jz9u6_.js.map} +1 -1
  101. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js → rsc-payload-path-EphpDB-J.js} +2 -3
  102. package/dist/_chunks/{rsc-payload-path-dffcs4jp.js.map → rsc-payload-path-EphpDB-J.js.map} +1 -1
  103. package/dist/_chunks/{scan-BoP17W3w.js → scan-CyizcBiX.js} +2 -3
  104. package/dist/_chunks/{scan-BoP17W3w.js.map → scan-CyizcBiX.js.map} +1 -1
  105. package/dist/_chunks/{scanner-C8fdKvKG.js → scanner-CJC-ScJU.js} +15 -23
  106. package/dist/_chunks/{scanner-C8fdKvKG.js.map → scanner-CJC-ScJU.js.map} +1 -1
  107. package/dist/_chunks/{schema-bridge-DpOmvZlI.js → schema-bridge-DyRs3cqy.js} +2 -3
  108. package/dist/_chunks/{schema-bridge-DpOmvZlI.js.map → schema-bridge-DyRs3cqy.js.map} +1 -1
  109. package/dist/_chunks/{segment-classify-C539Pa2O.js → segment-classify-Ho8jXWeC.js} +3 -5
  110. package/dist/_chunks/{segment-classify-C539Pa2O.js.map → segment-classify-Ho8jXWeC.js.map} +1 -1
  111. package/dist/_chunks/{segment-context-D3DNxKFq.js → segment-context-CYiGTi3K.js} +4 -6
  112. package/dist/_chunks/{segment-context-D3DNxKFq.js.map → segment-context-CYiGTi3K.js.map} +1 -1
  113. package/dist/_chunks/{segment-keys-D5hu1hz4.js → segment-keys-Y60KNc8C.js} +2 -3
  114. package/dist/_chunks/{segment-keys-D5hu1hz4.js.map → segment-keys-Y60KNc8C.js.map} +1 -1
  115. package/dist/_chunks/{singleflight-BeVMMKi0.js → singleflight-BChPMjwH.js} +2 -3
  116. package/dist/_chunks/{singleflight-BeVMMKi0.js.map → singleflight-BChPMjwH.js.map} +1 -1
  117. package/dist/_chunks/{sizeof-CO3dk0V1.js → sizeof-DG4W40lv.js} +3 -4
  118. package/dist/_chunks/{sizeof-CO3dk0V1.js.map → sizeof-DG4W40lv.js.map} +1 -1
  119. package/dist/_chunks/{ssr-data-nA3I70_n.js → ssr-data-9hPtcNOr.js} +3 -4
  120. package/dist/_chunks/{ssr-data-nA3I70_n.js.map → ssr-data-9hPtcNOr.js.map} +1 -1
  121. package/dist/_chunks/{state-BhNGPsdi.js → state-B-EBjeER.js} +2 -3
  122. package/dist/_chunks/{state-BhNGPsdi.js.map → state-B-EBjeER.js.map} +1 -1
  123. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js → status-page-marker-XIQXlTOb.js} +8 -13
  124. package/dist/_chunks/{status-page-marker-BRX9Ib-d.js.map → status-page-marker-XIQXlTOb.js.map} +1 -1
  125. package/dist/_chunks/{tree-match-6yihorhk.js → tree-match-Bqdr9szG.js} +2 -3
  126. package/dist/_chunks/{tree-match-6yihorhk.js.map → tree-match-Bqdr9szG.js.map} +1 -1
  127. package/dist/_chunks/{use-query-states-I3JMng6J.js → use-query-states-pkDV-jSg.js} +4 -7
  128. package/dist/_chunks/{use-query-states-I3JMng6J.js.map → use-query-states-pkDV-jSg.js.map} +1 -1
  129. package/dist/_chunks/{walkers-BqzxnwGC.js → walkers-DIE203ir.js} +6 -8
  130. package/dist/_chunks/{walkers-BqzxnwGC.js.map → walkers-DIE203ir.js.map} +1 -1
  131. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js → write-file-atomic-DW8m_Atv.js} +2 -3
  132. package/dist/_chunks/{write-file-atomic-D1qWqHb4.js.map → write-file-atomic-DW8m_Atv.js.map} +1 -1
  133. package/dist/adapters/build-output-helper.d.ts +10 -1
  134. package/dist/adapters/build-output-helper.d.ts.map +1 -1
  135. package/dist/adapters/cloudflare-dev.js +2 -3
  136. package/dist/adapters/cloudflare-kv-cache.js +3 -4
  137. package/dist/adapters/cloudflare.d.ts.map +1 -1
  138. package/dist/adapters/cloudflare.js +1 -1
  139. package/dist/adapters/nitro-presets.d.ts +6 -0
  140. package/dist/adapters/nitro-presets.d.ts.map +1 -1
  141. package/dist/adapters/nitro-preview.d.ts.map +1 -1
  142. package/dist/adapters/nitro.d.ts.map +1 -1
  143. package/dist/adapters/nitro.js +94 -57
  144. package/dist/adapters/nitro.js.map +1 -1
  145. package/dist/analyze/crawl-entry.js +7 -9
  146. package/dist/analyze/crawl-entry.js.map +1 -1
  147. package/dist/analyze/graph-command.d.ts.map +1 -1
  148. package/dist/analyze/graph-command.js +19 -105
  149. package/dist/analyze/graph-command.js.map +1 -1
  150. package/dist/cache/index.js +3 -3
  151. package/dist/cache/key-discipline.d.ts +61 -0
  152. package/dist/cache/key-discipline.d.ts.map +1 -0
  153. package/dist/cache/stores/cloudflare-kv.js +1 -2
  154. package/dist/cache/stores/memory.js +2 -3
  155. package/dist/cache/stores/redis.js +1 -2
  156. package/dist/cache/stores/vercel.js +1 -2
  157. package/dist/cache/timber-cache.d.ts +5 -1
  158. package/dist/cache/timber-cache.d.ts.map +1 -1
  159. package/dist/cdn/cloudflare-purge.js +1 -2
  160. package/dist/cdn/fastly-purge.js +1 -2
  161. package/dist/cdn/index.js +2 -3
  162. package/dist/cdn/workers-cache-purge.js +3 -5
  163. package/dist/cdn/workers-cache-purge.js.map +1 -1
  164. package/dist/cli-dev-status.d.ts +75 -0
  165. package/dist/cli-dev-status.d.ts.map +1 -0
  166. package/dist/cli-init.d.ts +72 -0
  167. package/dist/cli-init.d.ts.map +1 -0
  168. package/dist/cli.d.ts +4 -12
  169. package/dist/cli.d.ts.map +1 -1
  170. package/dist/cli.js +27 -54
  171. package/dist/cli.js.map +1 -1
  172. package/dist/client/error-boundary.d.ts.map +1 -1
  173. package/dist/client/error-boundary.js +1 -1
  174. package/dist/client/index.js +22 -34
  175. package/dist/client/index.js.map +1 -1
  176. package/dist/client/internal.js +13 -18
  177. package/dist/client/internal.js.map +1 -1
  178. package/dist/client/use-cookie.d.ts +18 -5
  179. package/dist/client/use-cookie.d.ts.map +1 -1
  180. package/dist/codec.js +2 -3
  181. package/dist/config-types.d.ts +40 -5
  182. package/dist/config-types.d.ts.map +1 -1
  183. package/dist/config-validation.d.ts.map +1 -1
  184. package/dist/cookies/define-cookie.d.ts.map +1 -1
  185. package/dist/cookies/index.js +40 -67
  186. package/dist/cookies/index.js.map +1 -1
  187. package/dist/cookies/json-cookie.d.ts +4 -4
  188. package/dist/index.d.ts.map +1 -1
  189. package/dist/index.js +698 -237
  190. package/dist/index.js.map +1 -1
  191. package/dist/params/index.js +3 -4
  192. package/dist/plugin-context.d.ts +7 -0
  193. package/dist/plugin-context.d.ts.map +1 -1
  194. package/dist/plugins/dev-discovery.d.ts +69 -5
  195. package/dist/plugins/dev-discovery.d.ts.map +1 -1
  196. package/dist/plugins/dev-hostname.d.ts +152 -0
  197. package/dist/plugins/dev-hostname.d.ts.map +1 -0
  198. package/dist/plugins/dev-server.d.ts +5 -1
  199. package/dist/plugins/dev-server.d.ts.map +1 -1
  200. package/dist/plugins/dev-store-clear.d.ts +59 -4
  201. package/dist/plugins/dev-store-clear.d.ts.map +1 -1
  202. package/dist/plugins/graph-endpoint.d.ts +4 -2
  203. package/dist/plugins/graph-endpoint.d.ts.map +1 -1
  204. package/dist/plugins/optimize-package-imports-defaults.d.ts +13 -0
  205. package/dist/plugins/optimize-package-imports-defaults.d.ts.map +1 -0
  206. package/dist/plugins/optimize-package-imports.d.ts +113 -0
  207. package/dist/plugins/optimize-package-imports.d.ts.map +1 -0
  208. package/dist/plugins/prebuilt.d.ts.map +1 -1
  209. package/dist/routing/index.js +4 -4
  210. package/dist/rsc-runtime/rsc.d.ts +2 -1
  211. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  212. package/dist/rsc-runtime/server-references.d.ts +8 -0
  213. package/dist/rsc-runtime/server-references.d.ts.map +1 -0
  214. package/dist/search-params/index.js +5 -7
  215. package/dist/search-params/index.js.map +1 -1
  216. package/dist/server/access-gate.d.ts +12 -0
  217. package/dist/server/access-gate.d.ts.map +1 -1
  218. package/dist/server/canonicalize.d.ts +21 -0
  219. package/dist/server/canonicalize.d.ts.map +1 -1
  220. package/dist/server/cookie-context.d.ts +8 -1
  221. package/dist/server/cookie-context.d.ts.map +1 -1
  222. package/dist/server/flight-source-node.d.ts.map +1 -1
  223. package/dist/server/flight-source.d.ts.map +1 -1
  224. package/dist/server/index.d.ts +1 -1
  225. package/dist/server/index.d.ts.map +1 -1
  226. package/dist/server/index.js +8 -13
  227. package/dist/server/index.js.map +1 -1
  228. package/dist/server/interception-gates.d.ts +49 -0
  229. package/dist/server/interception-gates.d.ts.map +1 -0
  230. package/dist/server/internal.js +1061 -943
  231. package/dist/server/internal.js.map +1 -1
  232. package/dist/server/logger.d.ts +17 -0
  233. package/dist/server/logger.d.ts.map +1 -1
  234. package/dist/server/param-coercion.d.ts +8 -0
  235. package/dist/server/param-coercion.d.ts.map +1 -1
  236. package/dist/server/pipeline-interception.d.ts +34 -4
  237. package/dist/server/pipeline-interception.d.ts.map +1 -1
  238. package/dist/server/pipeline-metadata-route.d.ts +24 -0
  239. package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
  240. package/dist/server/pipeline-metadata.d.ts +3 -2
  241. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  242. package/dist/server/pipeline-phases.d.ts +9 -3
  243. package/dist/server/pipeline-phases.d.ts.map +1 -1
  244. package/dist/server/pipeline.d.ts +18 -0
  245. package/dist/server/pipeline.d.ts.map +1 -1
  246. package/dist/server/prebuilt/dev-store.d.ts +68 -22
  247. package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
  248. package/dist/server/prebuilt/overlay.d.ts +8 -0
  249. package/dist/server/prebuilt/overlay.d.ts.map +1 -1
  250. package/dist/server/prebuilt-runtime.d.ts.map +1 -1
  251. package/dist/server/primitives.d.ts +13 -0
  252. package/dist/server/primitives.d.ts.map +1 -1
  253. package/dist/server/render-utils.d.ts +21 -0
  254. package/dist/server/render-utils.d.ts.map +1 -1
  255. package/dist/server/request-context.d.ts +14 -0
  256. package/dist/server/request-context.d.ts.map +1 -1
  257. package/dist/server/route-element-builder.d.ts.map +1 -1
  258. package/dist/server/route-handler.d.ts +7 -0
  259. package/dist/server/route-handler.d.ts.map +1 -1
  260. package/dist/server/route-matcher.d.ts +14 -3
  261. package/dist/server/route-matcher.d.ts.map +1 -1
  262. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  263. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  264. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  265. package/dist/server/signal-identity.d.ts +6 -0
  266. package/dist/server/signal-identity.d.ts.map +1 -1
  267. package/dist/server/traced-access.d.ts +18 -0
  268. package/dist/server/traced-access.d.ts.map +1 -0
  269. package/dist/server/tracing.d.ts.map +1 -1
  270. package/dist/server/types.d.ts +5 -4
  271. package/dist/server/types.d.ts.map +1 -1
  272. package/dist/shims/font-google.js +1 -2
  273. package/dist/shims/font-local.js +1 -2
  274. package/dist/shims/headers.d.ts +11 -4
  275. package/dist/shims/headers.d.ts.map +1 -1
  276. package/docs/api/30-api-server.mdx +3 -1
  277. package/docs/api/32-api-cache.mdx +1 -1
  278. package/docs/api/34-api-config.mdx +42 -0
  279. package/docs/api/36-cli.mdx +72 -6
  280. package/docs/learn/01-quick-start.mdx +1 -1
  281. package/docs/learn/06-typed-params.mdx +2 -2
  282. package/docs/learn/10-caching.mdx +26 -5
  283. package/llms.txt +1 -1
  284. package/package.json +12 -12
  285. package/src/adapters/build-output-helper.ts +26 -4
  286. package/src/adapters/cloudflare.ts +1 -0
  287. package/src/adapters/nitro-presets.ts +15 -0
  288. package/src/adapters/nitro-preview.ts +66 -34
  289. package/src/adapters/nitro.ts +14 -6
  290. package/src/analyze/graph-command.ts +25 -133
  291. package/src/cache/key-discipline.ts +218 -0
  292. package/src/cache/timber-cache.ts +42 -5
  293. package/src/cli-dev-status.ts +196 -0
  294. package/src/cli-init.ts +278 -0
  295. package/src/cli.ts +33 -79
  296. package/src/client/error-boundary.tsx +19 -2
  297. package/src/client/use-cookie.ts +33 -21
  298. package/src/config-types.ts +40 -5
  299. package/src/config-validation.ts +37 -0
  300. package/src/cookies/define-cookie.ts +10 -46
  301. package/src/cookies/json-cookie.ts +4 -4
  302. package/src/index.ts +2 -0
  303. package/src/plugin-context.ts +7 -0
  304. package/src/plugins/dev-discovery.ts +216 -6
  305. package/src/plugins/dev-hostname.ts +322 -0
  306. package/src/plugins/dev-server.ts +96 -37
  307. package/src/plugins/dev-store-clear.ts +105 -7
  308. package/src/plugins/graph-endpoint.ts +15 -3
  309. package/src/plugins/optimize-package-imports-defaults.ts +88 -0
  310. package/src/plugins/optimize-package-imports.ts +439 -0
  311. package/src/plugins/prebuilt.ts +9 -0
  312. package/src/rsc-runtime/rsc.ts +7 -3
  313. package/src/rsc-runtime/server-references.ts +73 -0
  314. package/src/rsc-runtime/vendor-types.d.ts +9 -0
  315. package/src/server/access-gate.tsx +32 -20
  316. package/src/server/action-handler.ts +40 -34
  317. package/src/server/canonicalize.ts +27 -0
  318. package/src/server/cookie-context.ts +11 -3
  319. package/src/server/flight-source-node.ts +5 -2
  320. package/src/server/flight-source.ts +4 -3
  321. package/src/server/index.ts +6 -1
  322. package/src/server/interception-gates.ts +94 -0
  323. package/src/server/logger.ts +23 -0
  324. package/src/server/param-coercion.ts +22 -0
  325. package/src/server/pipeline-interception.ts +64 -4
  326. package/src/server/pipeline-metadata-route.ts +242 -0
  327. package/src/server/pipeline-metadata.ts +7 -5
  328. package/src/server/pipeline-phases.ts +71 -131
  329. package/src/server/pipeline.ts +20 -2
  330. package/src/server/prebuilt/dev-store.ts +113 -34
  331. package/src/server/prebuilt/overlay.ts +18 -0
  332. package/src/server/prebuilt-runtime.ts +43 -44
  333. package/src/server/primitives.ts +14 -0
  334. package/src/server/render-utils.ts +25 -0
  335. package/src/server/request-context.ts +27 -3
  336. package/src/server/route-element-builder.ts +15 -2
  337. package/src/server/route-handler.ts +3 -2
  338. package/src/server/route-matcher.ts +48 -33
  339. package/src/server/rsc-entry/api-handler.ts +2 -33
  340. package/src/server/rsc-entry/index.ts +8 -3
  341. package/src/server/rsc-entry/rsc-stream.ts +7 -1
  342. package/src/server/signal-identity.ts +30 -12
  343. package/src/server/traced-access.ts +50 -0
  344. package/src/server/tracing.ts +18 -1
  345. package/src/server/types.ts +5 -4
  346. package/src/shims/headers.ts +12 -4
  347. package/dist/_chunks/actions-vBHr2vqd.js.map +0 -1
  348. package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
  349. package/dist/_chunks/cache-api-DdcDLpBj.js.map +0 -1
  350. package/dist/_chunks/chains-B8TCLved.js +0 -1
  351. package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
  352. package/dist/_chunks/dev-server-BNr5drEO.js.map +0 -1
  353. package/dist/_chunks/dev-server-CUg7Mqh_.js +0 -1
  354. package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
  355. package/dist/_chunks/flight-source-node-BdHUOUqg.js.map +0 -1
  356. package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
  357. package/dist/_chunks/logger-CI_hThfy.js.map +0 -1
  358. package/dist/_chunks/node-response-bF0bKoig.js.map +0 -1
  359. package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
  360. package/dist/server/prebuilt/key-discipline.d.ts +0 -52
  361. package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
  362. package/src/server/prebuilt/key-discipline.ts +0 -122
@@ -1,6 +1,6 @@
1
- import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-CkAInout.js";
2
- import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-oOUxugz3.js";
3
- //#region src/params/define-schema.ts
1
+ import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-B-aCuTu3.js";
2
+ import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-CPc6bjVl.js";
3
+ // src/params/define-schema.ts
4
4
  /**
5
5
  * Define the global segment param schema.
6
6
  *
@@ -28,7 +28,6 @@ import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry
28
28
  function defineSchema(config) {
29
29
  return config;
30
30
  }
31
- //#endregion
32
31
  export { defineSchema, getLinkCodec, resolveSchemaCodecs, setLinkCodecs, toBracketKey };
33
32
 
34
33
  //# sourceMappingURL=index.js.map
@@ -137,6 +137,13 @@ export interface PluginContext {
137
137
  * RSC generateBundle alongside routePrebuiltComponents.
138
138
  */
139
139
  prebuiltLazyChunks?: Map<string, string>;
140
+ /**
141
+ * Dev only: RSC module ID → the cache.component IDs its last transform
142
+ * declared. Written by timber-prebuilt's transform, read by
143
+ * timber-dev-server to scope a dev store clear to the components a saved
144
+ * module could have changed (plugins/dev-store-clear.ts, TIM-1599).
145
+ */
146
+ devPrebuiltComponentIds?: Map<string, string[]>;
140
147
  /**
141
148
  * Content-keyed AST parse memo shared across cache/prebuilt/prerender-sugar
142
149
  * transforms. Collapses both cross-plugin and cross-environment duplicate
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-context.d.ts","sourceRoot":"","sources":["../src/plugin-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAA0B,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAI/E,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAIlF,qEAAqE;AACrE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,uB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AgB,EACxB,UAAU,EAAE,gBAAgB,GAC3B,MAAM,EAAE,CAgBV;AAWD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,gBAAgB,GAC3B,gBAAgB,CAiBlB"}
@@ -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;
@@ -25,9 +26,24 @@
25
26
  * Design doc: 47-module-environment-tooling.md §5, 21-dev-server.md.
26
27
  */
27
28
  import type { Server } from 'node:net';
29
+ import type { AdvertisedUrls } from './dev-hostname.ts';
28
30
  /** Relative path of the discovery directory within the project root. */
29
31
  export declare const DEV_DISCOVERY_DIR: string;
30
32
  export interface DevRecord {
33
+ /**
34
+ * The URL the server printed and opened — Vite's `resolvedUrls` pick,
35
+ * with the app's dev hostname applied (`http://blog.localhost:3000/`,
36
+ * see plugins/dev-hostname.ts). What `timber dev status` reports. Taken
37
+ * from Vite rather than rebuilt from `host`, so the two cannot disagree.
38
+ */
39
+ url: string;
40
+ /**
41
+ * The same server for non-browser HTTP clients: `url` at plain
42
+ * `localhost` when that resolves and verifies (see `loopbackUrl` in
43
+ * plugins/dev-hostname.ts). Computed by the server, which alone knows its
44
+ * TLS certificate.
45
+ */
46
+ loopbackUrl: string;
31
47
  port: number;
32
48
  pid: number;
33
49
  /**
@@ -87,19 +103,32 @@ export interface DevRecord {
87
103
  }
88
104
  /** Best-effort "is this pid alive" — signal 0 probes without killing. */
89
105
  export declare function isPidAlive(pid: number): boolean;
106
+ /**
107
+ * The directory whose `.timber/dev/` holds a server's record: the Vite
108
+ * config file's directory, falling back to the resolved root for an inline
109
+ * (`configFile: false`) server. Every consumer — `timber dev status`,
110
+ * `timber graph`, the VS Code extension — locates an app by its config or
111
+ * package directory without evaluating Vite, so the record goes where they
112
+ * look rather than under a `root` the config may move elsewhere.
113
+ */
114
+ export declare function devRecordRoot(root: string, configFile: string | false | undefined): string;
90
115
  /**
91
116
  * Register discovery-record lifecycle handlers on the dev server's HTTP
92
117
  * server. Writes `.timber/dev/<pid>-<port>-<token>.json` once the server is
93
118
  * listening (the bound port is only known then) and removes exactly
94
119
  * that record on clean shutdown.
95
120
  *
121
+ * `urls` is read when the server starts listening: the URLs to advertise
122
+ * (`advertisedUrls`). With none, nothing is written — a record no one can
123
+ * open is not worth advertising.
124
+ *
96
125
  * All filesystem work is best-effort: a failure to write or remove a
97
126
  * record must never break the dev server. `httpServer` is null in
98
127
  * middleware mode — no port exists, so there is nothing to advertise.
99
128
  * Typed as `net.Server` — the common base of Vite's `http.Server` and
100
129
  * `Http2SecureServer` variants, which carries the events and `address()`.
101
130
  */
102
- export declare function registerDevDiscovery(httpServer: Server | null, root: string, config?: {
131
+ export declare function registerDevDiscovery(httpServer: Server | null, root: string, urls: () => AdvertisedUrls | undefined, config?: {
103
132
  configFile?: string | false;
104
133
  base?: string;
105
134
  server?: {
@@ -120,4 +149,39 @@ export declare function registerDevDiscovery(httpServer: Server | null, root: st
120
149
  };
121
150
  webSocketToken?: string;
122
151
  }): void;
152
+ /**
153
+ * `GET /__timber/status` — the dev server's identity probe. Answers
154
+ * `{ pid }` with the serving process's pid, so a consumer can confirm the
155
+ * server on a record's port is the one that wrote the record (a crashed
156
+ * server's port may since have been taken by another process).
157
+ */
158
+ export declare const STATUS_ENDPOINT_PATH = "/__timber/status";
159
+ /** Probe deadline: discovery must never hold a CLI hostage. */
160
+ export declare const DEV_PROBE_TIMEOUT_MS = 2000;
161
+ /**
162
+ * Records under `<root>/.timber/dev/` that are well-formed and name a live
163
+ * pid. These are candidates, not proof: the caller still has to probe the
164
+ * endpoint (`readLiveDevRecords`, or `timber graph`'s own graph request,
165
+ * which doubles as its probe). A missing directory or unreadable record is
166
+ * absence, never an error.
167
+ */
168
+ export declare function readDevRecords(root: string): DevRecord[];
169
+ /**
170
+ * Records whose server answers the status probe with the record's own pid —
171
+ * the full "pid alive AND probe succeeds" validation. Probes run in
172
+ * parallel, each under `DEV_PROBE_TIMEOUT_MS`.
173
+ */
174
+ export declare function readLiveDevRecords(root: string): Promise<DevRecord[]>;
175
+ /**
176
+ * HTTP(S) GET against a record's server with a wall-clock deadline and a
177
+ * response-size limit, returning the parsed JSON body or null on any failure
178
+ * (non-200, bad JSON, timeout, connection error). Uses node:http/https
179
+ * directly — `fetch` silently strips the Host header, which the endpoint's
180
+ * DNS-rebinding defense needs to see as a localhost form.
181
+ *
182
+ * The wall-clock timer covers both connection and body streaming — node's
183
+ * `timeout` option is an INACTIVITY timeout that resets on every chunk, so a
184
+ * slow-drip response would never fire it.
185
+ */
186
+ export declare function probeDevServer(record: DevRecord, path: string, timeoutMs: number): Promise<unknown>;
123
187
  //# sourceMappingURL=dev-discovery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-discovery.d.ts","sourceRoot":"","sources":["../../src/plugins/dev-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMvC,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,QAAyB,CAAC;AAExD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ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<name>.localhost:<port>`.
3
+ *
4
+ * Cookies are not scoped by port, so every app served on `localhost` shares
5
+ * one cookie jar: two apps on :3000 and :3001 overwrite each other's
6
+ * sessions, and service workers stuck to `localhost:3000` carry over to
7
+ * whichever project next gets that port. Browsers resolve
8
+ * `*.localhost` (at any depth) to loopback with no DNS or `/etc/hosts` setup,
9
+ * so giving each app its own name gives it its own cookie jar.
10
+ *
11
+ * This only changes the URL Vite prints, opens, and records for discovery.
12
+ * Nothing is proxied, no `Host` is rewritten, and plain `localhost:<port>`
13
+ * keeps working. Vite's host check already accepts `*.localhost`.
14
+ *
15
+ * See design/21-dev-server.md §"Dev Hostnames" (TIM-1613).
16
+ */
17
+ /**
18
+ * Reduce arbitrary text to one DNS label: lowercase, anything outside
19
+ * `[a-z0-9-]` becomes `-`, runs of `-` collapse, no leading or trailing
20
+ * `-`, at most 63 characters. May return '' when nothing usable is left.
21
+ */
22
+ export declare function sanitizeLabel(raw: string): string;
23
+ /**
24
+ * Why a `dev.hostname` value is unusable, or null when it is fine. Accepts
25
+ * `false` (opt out: keep plain `localhost`) or a dot-separated sequence of
26
+ * DNS labels, case-insensitively, with or without a trailing `.localhost`.
27
+ */
28
+ export declare function devHostnameError(value: unknown): string | null;
29
+ export interface DevHostnameSource {
30
+ /** `dev.hostname` from timber.config.ts. */
31
+ override?: string | false;
32
+ /** `name` from the app's package.json, if it has one. */
33
+ packageName?: unknown;
34
+ /** The app directory's own name. */
35
+ dirName: string;
36
+ }
37
+ /**
38
+ * The dev hostname for an app. In order:
39
+ *
40
+ * 1. `dev.hostname`, when set (`false` → plain `localhost`). An invalid value
41
+ * throws; config validation reports it as fatal before this runs.
42
+ * 2. package.json `name`, unless it is a placeholder. Preferred over the
43
+ * directory because it is stable across clones and worktrees, so OAuth
44
+ * callback URLs registered against it keep working, and because monorepo
45
+ * directories are generic (`apps/web` everywhere).
46
+ * 3. The directory name.
47
+ * 4. Plain `localhost`, when nothing usable is left after sanitizing.
48
+ */
49
+ export declare function deriveDevHostname(source: DevHostnameSource): string;
50
+ /**
51
+ * `deriveDevHostname` for the app in `appDir` — the directory its
52
+ * `.timber/` lives in (`devRecordRoot`), where its package.json is. A
53
+ * missing or unreadable package.json falls through to the directory name.
54
+ */
55
+ export declare function resolveDevHostname(appDir: string, override: string | false | undefined): string;
56
+ /**
57
+ * Whether a TLS `cert` option (PEM string or Buffer, a path to one, or an
58
+ * array of them — Node's `tls` shape plus Vite's paths) names `hostname`.
59
+ * A `pfx`-only config has no `cert` and so keeps `localhost`. An https dev server prints the
60
+ * named URL only when it does: a trusted certificate issued for `localhost`
61
+ * alone (mkcert's default) would turn a working URL into a certificate error.
62
+ */
63
+ export declare function certCoversHostname(cert: unknown, hostname: string): boolean;
64
+ /**
65
+ * The hostname to print for this server, after the https check. `https` is
66
+ * Vite's resolved `server.https` (undefined for plain http).
67
+ */
68
+ export declare function effectiveDevHostname(hostname: string, https: {
69
+ cert?: unknown;
70
+ } | undefined): string;
71
+ /**
72
+ * Vite's `server.resolvedUrls` shape — the URLs it prints under Local and
73
+ * Network and picks from for `server.open`.
74
+ */
75
+ export interface ResolvedServerUrls {
76
+ local: string[];
77
+ network: string[];
78
+ }
79
+ /**
80
+ * Rename the `localhost` entries of `urls.local` to `hostname`. Only those:
81
+ * an explicit loopback IP (`host: '127.0.0.1'`) is what the developer asked
82
+ * to see, certificate-derived names already name a host, and network URLs
83
+ * are other machines' way in. Idempotent: a renamed URL is no longer a
84
+ * `localhost` URL.
85
+ */
86
+ export declare function withDevHostname<T extends ResolvedServerUrls>(urls: T, hostname: string): T;
87
+ /**
88
+ * The same URL through plain `localhost`: what a non-browser HTTP client can
89
+ * reach. Browsers and curl resolve `*.localhost` themselves, but Node, Python
90
+ * and other clients ask the OS, and not every resolver (glibc without
91
+ * systemd-resolved) maps `*.localhost` to loopback. The server answers both
92
+ * names, so only the hostname changes. Other URLs are returned unchanged.
93
+ *
94
+ * Under https the swap also has to survive TLS hostname verification: a
95
+ * certificate issued for `blog.localhost` alone fails for `localhost`
96
+ * (`ERR_TLS_CERT_ALTNAME_INVALID`), so the named URL is kept unless the
97
+ * certificate covers `localhost` too. `https` is Vite's `server.https`.
98
+ */
99
+ export declare function loopbackUrl(href: string, https: {
100
+ cert?: unknown;
101
+ } | undefined): string;
102
+ /**
103
+ * The URL a server is opened at, after the rename: Vite's own choice, as its
104
+ * `getServerUrlByHost` makes it for `server.open` — the first URL containing
105
+ * a string `server.host`, else `local[0]`, else `network[0]`. The discovery
106
+ * record stores this, so `timber dev status` reports the URL Vite opens.
107
+ */
108
+ export declare function primaryServerUrl(urls: ResolvedServerUrls | null | undefined, hostname: string, serverHost: string | boolean | undefined): string | undefined;
109
+ /** The URLs a discovery record advertises. */
110
+ export interface AdvertisedUrls {
111
+ /** What the server printed and opens (`primaryServerUrl`). */
112
+ url: string;
113
+ /** The same server for non-browser HTTP clients (`loopbackUrl`). */
114
+ loopbackUrl: string;
115
+ }
116
+ /**
117
+ * The record's URLs, computed by the server, which alone knows its
118
+ * certificate. `server` is Vite's resolved `server` config.
119
+ */
120
+ export declare function advertisedUrls(urls: ResolvedServerUrls | null | undefined, hostname: string, server: {
121
+ host?: string | boolean;
122
+ https?: {
123
+ cert?: unknown;
124
+ };
125
+ } | undefined): AdvertisedUrls | undefined;
126
+ /** The slice of `ViteDevServer` the rename needs. */
127
+ interface DevHostnameServer {
128
+ httpServer: {
129
+ on(event: 'listening', listener: () => void): unknown;
130
+ } | null;
131
+ resolvedUrls: ResolvedServerUrls | null;
132
+ config: {
133
+ server?: {
134
+ https?: {
135
+ cert?: unknown;
136
+ };
137
+ };
138
+ };
139
+ }
140
+ /**
141
+ * Resolve the app's dev hostname and rename the printed/opened URL once the
142
+ * server is listening. Returns the hostname so the discovery record can
143
+ * describe the same URL (`primaryServerUrl`).
144
+ *
145
+ * Vite assigns `resolvedUrls` in a `listening` listener it *prepends* in
146
+ * `listen()`, after every `configureServer` hook has run, so this listener
147
+ * always sees them; `printUrls()` and `openBrowser()` run after `listen()`
148
+ * resolves. Middleware mode has no `httpServer` and prints nothing.
149
+ */
150
+ export declare function applyDevHostname(server: DevHostnameServer, appDir: string, override: string | false | undefined): string;
151
+ export {};
152
+ //# sourceMappingURL=dev-hostname.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-hostname.d.ts","sourceRoot":"","sources":["../../src/plugins/dev-hostname.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0BH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQjD;AAeD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAoB9D;AAOD,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC1B,yDAAyD;IACzD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAWnE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAY/F;AAkBD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAW3E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,GACpC,MAAM,CAGR;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;C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A;aAAE,CAAA;SAAE,CAAA;KAAE,CAAC;CACrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GACnC,MAAM,CAWR"}
@@ -39,7 +39,11 @@ export declare function timberDevServer(ctx: PluginContext): Plugin;
39
39
  * consulted: dev connections are direct, so the header would be
40
40
  * attacker-controlled. (TIM-1067, B32)
41
41
  *
42
+ * Returns null for a request that names no URL — a Host that is not a bare
43
+ * host[:port], or a request target that does not parse — which the caller
44
+ * answers with 400. (TIM-1600)
45
+ *
42
46
  * Exported for tests.
43
47
  */
44
- export declare function toWebRequest(nodeReq: IncomingMessage): Request;
48
+ export declare function toWebRequest(nodeReq: IncomingMessage): Request | null;
45
49
  //# sourceMappingURL=dev-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/plugins/dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAsB,KAAK,MAAM,EAA2C,MAAM,MAAM,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAC;AAKjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAgC1D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AA2BpC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAyM1D;AAyND;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAuC9D"}
1
+ {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/plugins/dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAGL,KAAK,MAAM,EAGZ,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAC;AAKjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAiC1D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AA2BpC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CA4O1D;AAgOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,GAAG,IAAI,CA6CrE"}
@@ -2,6 +2,32 @@
2
2
  * Clear the cache.component dev store on every dev-server watcher event
3
3
  * (TIM-1588, server/prebuilt/dev-store.ts) — and once more shortly after.
4
4
  *
5
+ * A clear is scoped when the RSC module graph can say what a save changed
6
+ * (TIM-1599). A `change` to a file the graph knows as a module can only have
7
+ * changed the output of the modules that import it, transitively, so only
8
+ * the components declared in those modules (and in the file itself) are
9
+ * dropped. Element props need no tracking: non-slot element props make a
10
+ * render unkeyable, and slot content is composed live (design/45 §Cache Key,
11
+ * §Slot Components). Nested cache.component children are baked flat into
12
+ * their parent, whose module imports them, so the walk reaches the parent.
13
+ *
14
+ * The graph also holds file-only entries: files a plugin declared with
15
+ * `addWatchFile`. Tailwind's plugin declares every file its scanner finds,
16
+ * markdown and JSON included, as a dependency of the stylesheet. A file-only
17
+ * entry says what watches the file, never what reads it with fs, so a file
18
+ * with no module node clears everything. When the walk meets one on its way
19
+ * up (a module Tailwind also scans), it goes through it to the stylesheet's
20
+ * importers, which costs extra re-renders of components declared up that
21
+ * chain and never a stale one.
22
+ *
23
+ * Everything else clears every component: a file the graph does not know as
24
+ * a module (markdown or JSON read with fs), and an add or a delete (a glob
25
+ * or a route scan may pick it up). The decision is graph membership, never
26
+ * the file's extension. Not covered: a module loaded by a variable dynamic
27
+ * `import()` that Vite cannot analyze has no importer edge, and a component
28
+ * that reads a project module with fs is not that module's importer. A hard
29
+ * reload covers both.
30
+ *
5
31
  * Vite's watcher (chokidar) throttles `change`: once it emits one for a
6
32
  * path, it DROPS every further `change` for that path for 50ms, and never
7
33
  * emits a trailing event for them. So a save is invisible when it lands
@@ -13,16 +39,45 @@
13
39
  * fs was read again on every request.
14
40
  *
15
41
  * The trailing clear lands after that window closes, so it follows any
16
- * write whose event was dropped. A render that started before it cannot
17
- * store (the clear records an invalidation of everything), and a render
42
+ * write whose event was dropped. A dropped event is always for a path the
43
+ * burst already reported, so the trailing clear covers every path seen in
44
+ * the burst, and resolves them against the graph again when it fires: a
45
+ * request between the saves may have re-transformed a module and given its
46
+ * call sites new IDs. A render of a covered component that started before
47
+ * it cannot store (the clear records an invalidation of it), and a render
18
48
  * after it reads the file as written. Debounced, so a burst of saves gets
19
49
  * one trailing clear, after the last of them. The cost is at most one
20
50
  * extra re-render per save, in dev only.
21
51
  */
22
52
  /** The part of Vite's `FSWatcher` this needs. */
23
53
  interface WatcherEvents {
24
- on(event: 'all', listener: () => void): unknown;
54
+ on(event: 'all', listener: (event: string, path: string) => void): unknown;
55
+ }
56
+ /**
57
+ * What a clear covers: the paths changed in place, or null for anything
58
+ * else (an add, a delete, a directory event), which clears everything.
59
+ */
60
+ export type ChangedPaths = ReadonlySet<string> | null;
61
+ export declare function clearDevStoreOnWatcherEvents(watcher: WatcherEvents, clear: (changed: ChangedPaths) => void): void;
62
+ /** The part of Vite's `EnvironmentModuleNode` the walk reads. */
63
+ export interface GraphModule {
64
+ /** Null for a file-only entry (`addWatchFile`), which declares nothing. */
65
+ id: string | null;
66
+ importers: Set<GraphModule>;
67
+ }
68
+ /** The part of Vite's `EnvironmentModuleGraph` the walk reads. */
69
+ export interface ModuleGraphView {
70
+ getModulesByFile(file: string): Set<GraphModule> | undefined;
25
71
  }
26
- export declare function clearDevStoreOnWatcherEvents(watcher: WatcherEvents, clear: () => void): void;
72
+ /**
73
+ * The cache.component IDs whose output the changed paths could have
74
+ * changed: those declared in each changed module and its transitive
75
+ * importers. Null means every component — a path the graph does not know.
76
+ *
77
+ * `componentIds` maps a module ID to the IDs its last transform declared
78
+ * (`PluginContext.devPrebuiltComponentIds`). `toGraphPath` puts a watcher
79
+ * path in the graph's path space (symlinks resolved, `/` separators).
80
+ */
81
+ export declare function componentsChangedBy(changed: ChangedPaths, graph: ModuleGraphView, componentIds: ReadonlyMap<string, readonly string[]>, toGraphPath: (path: string) => string): string[] | null;
27
82
  export {};
28
83
  //# sourceMappingURL=dev-store-clear.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-store-clear.d.ts","sourceRoot":"","sources":["../../src/plugins/dev-store-clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAYH,iDAAiD;AACjD,UAAU,aAAa;IACrB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;CACjD;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAS5F"}
1
+ {"version":3,"file":"dev-store-clear.d.ts","sourceRoot":"","sources":["../../src/plugins/dev-store-clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAYH,iDAAiD;AACjD,UAAU,aAAa;IACrB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC;CAC5E;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAEtD,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,GACrC,IAAI,CAkBN;AAED,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CAC7B;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;CAC9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,eAAe,EACtB,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,EACpD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GACpC,MAAM,EAAE,GAAG,IAAI,CAsBjB"}
@@ -1,5 +1,6 @@
1
1
  /**
2
- * graph-endpoint — `GET /__timber/graph` on the dev server.
2
+ * graph-endpoint — `GET /__timber/graph` (and the `GET /__timber/status`
3
+ * identity probe) on the dev server.
3
4
  *
4
5
  * The fast path of design/47: when a dev server runs, the env module
5
6
  * graphs are already resident and classification is a lookup. Serves
@@ -51,7 +52,8 @@ export declare function isAllowedGraphHost(hostHeader: string | undefined, allow
51
52
  /** Origin check: absent is fine (CLI probe); present must pass the host allowlist. */
52
53
  export declare function isAllowedGraphOrigin(originHeader: string | undefined, allowedHosts: true | string[] | undefined): boolean;
53
54
  /**
54
- * Create the Connect middleware handling GET /__timber/graph.
55
+ * Create the Connect middleware handling GET /__timber/graph and the
56
+ * GET /__timber/status identity probe.
55
57
  *
56
58
  * Query surface: `?file=<path>` (absolute or project-root-relative) or
57
59
  * `?all=1`. Anything else is a 400 — fail loudly, like the CLI.
@@ -1 +1 @@
1
- {"version":3,"file":"graph-endpoint.d.ts","sourceRoot":"","sources":["../../src/plugins/graph-endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAA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AAI,KAAG,OAAO,CAAC,IAAI,CAAC,CA2M1F;AAED,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACrC,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,+DAA+D;AAC/D,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1C;;;;OAIG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACpD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,EAC3C,IAAI,EAAE,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,EACzE,aAAa,CAAC,EAAE,iBAAiB,EAMjC,YAAY,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAuB,GACtD,kBAAkB,CA2GpB"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Import specifiers whose barrel imports timber rewrites by default.
3
+ *
4
+ * Copied from Next.js's built-in `optimizePackageImports` list
5
+ * (packages/next/src/server/config.ts, vercel/next.js@50bf604f2), so an app
6
+ * moving from Next gets the same set without configuring it. Entries are exact
7
+ * import specifiers, not package names: a package with several icon entry
8
+ * points (`react-icons/fa`, `@heroicons/react/24/solid`) lists each one.
9
+ *
10
+ * See design/21-dev-server.md §"Barrel Import Optimization".
11
+ */
12
+ export declare const DEFAULT_OPTIMIZE_PACKAGE_IMPORTS: readonly string[];
13
+ //# sourceMappingURL=optimize-package-imports-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimize-package-imports-defaults.d.ts","sourceRoot":"","sources":["../../src/plugins/optimize-package-imports-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAAS,MAAM,EA4E7D,CAAC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * timber-optimize-package-imports — rewrites named imports from a listed
3
+ * barrel package into imports of only the modules that define those names.
4
+ *
5
+ * In dev, `@vitejs/plugin-rsc` keeps packages with a `react` peer dependency
6
+ * in the rsc and ssr module graphs without pre-bundling them, so on the server
7
+ * `import { Play } from 'lucide-react'` enters lucide's barrel and Vite
8
+ * transforms all ~2,000 icon modules it re-exports, once per environment. A
9
+ * build loads all of them too, before tree-shaking. The
10
+ * rewrite turns that import into one of the icon's own file:
11
+ *
12
+ * import { Play } from 'lucide-react'
13
+ * → import { default as Play } from "/…/lucide-react/dist/esm/icons/play.mjs";
14
+ *
15
+ * Next.js does the same for its `optimizePackageImports` list
16
+ * (next-barrel-loader.ts, optimize_barrel.rs). It applies to every environment
17
+ * in builds; in dev, to the server environments and only for packages Vite
18
+ * compiles itself (the client environment pre-bundles them; the server
19
+ * environments hand most other packages to Node). See design/21-dev-server.md
20
+ * §"Barrel Import Optimization".
21
+ *
22
+ * Every rule here leans toward leaving the import alone. A missed rewrite costs
23
+ * compile time; a wrong one breaks the app. An import is rewritten only when
24
+ * the barrel is a pure barrel (nothing but imports and re-exports) and every
25
+ * imported name is in its export map with a target that resolves to a file.
26
+ */
27
+ import { MagicString } from 'magic-string';
28
+ import { type Plugin } from 'vite';
29
+ import type { PluginContext } from '../plugin-context.ts';
30
+ type Lang = 'js' | 'jsx' | 'ts' | 'tsx';
31
+ /** Where a barrel's export comes from. */
32
+ export interface BarrelExport {
33
+ /** The specifier as written in the barrel (`'./icons/play.mjs'`). */
34
+ source: string;
35
+ /** The name in `source`: an export name, `'default'`, or `'*'` for a namespace. */
36
+ imported: string;
37
+ }
38
+ /** Export name → origin, for the names a barrel states explicitly. */
39
+ export type BarrelExportMap = ReadonlyMap<string, BarrelExport>;
40
+ /** A barrel the rewrite may import past, as seen from one importer. */
41
+ export interface ResolvedBarrel {
42
+ exports: BarrelExportMap;
43
+ /** Resolve a source from `exports` relative to the barrel; null = leave the import alone. */
44
+ resolveTarget(source: string): Promise<string | null>;
45
+ }
46
+ /**
47
+ * Merge the user's list with the defaults (Next's semantics: the user list
48
+ * adds, never replaces). Config validation reports invalid entries without
49
+ * stopping the dev server, so only the valid ones (non-empty strings) are used
50
+ * here; a string list is not spread into characters, and an empty entry does
51
+ * not match every quoted empty string.
52
+ */
53
+ export declare function resolveOptimizedPackages(user: readonly string[] | undefined): ReadonlySet<string>;
54
+ /**
55
+ * Read a barrel's export map, or null when the file is not a pure barrel.
56
+ *
57
+ * A pure barrel holds only imports, re-exports, and `export { local }` of an
58
+ * imported binding (`import * as icons from './icons'; export { icons }`, which
59
+ * lucide-react's barrel opens with). Anything that runs code of its own, a
60
+ * declaration, an expression, a bare side-effect import, makes it not a barrel:
61
+ * importing past it would skip that code. So does any directive except
62
+ * `'use strict'`: a `'use client'` or `'use server'` barrel is a boundary
63
+ * plugin-rsc draws around the barrel module itself, and importing past it would
64
+ * load the re-exported files on the wrong side of it.
65
+ *
66
+ * `export default local` is not followed even when `local` is imported: it
67
+ * exports the value `local` held when the barrel ran, not a live binding, so
68
+ * importing `local` directly would see later reassignments the barrel's
69
+ * default never does. `export { local as default }` is live and is followed.
70
+ *
71
+ * A source-phase or deferred import, or import attributes, change what the
72
+ * barrel's binding is, so a barrel using them is not followed. An
73
+ * `export {} from` with no names only runs the module, like a bare import.
74
+ *
75
+ * `export * from` adds no entries. A name it might supply is not in the map, so
76
+ * an import of that name falls back; explicit exports shadow star exports, so
77
+ * every name that is in the map is exact.
78
+ */
79
+ export declare function readBarrelExportMap(code: string, lang: Lang): BarrelExportMap | null;
80
+ /**
81
+ * Rewrite every import and `export { … } from` of a listed specifier whose
82
+ * names the barrel's export map covers. Returns null when nothing changed.
83
+ *
84
+ * Replacements stay on the statement's own lines, so positions after it keep
85
+ * their line numbers even before the source map is applied.
86
+ */
87
+ export declare function rewriteBarrelImports(code: string, packages: ReadonlySet<string>, loadBarrel: (specifier: string) => Promise<ResolvedBarrel | null>): Promise<MagicString | null>;
88
+ /** The resolve options that decide whether a server environment externalizes a package. */
89
+ export interface ExternalizationConfig {
90
+ noExternal: string | RegExp | readonly (string | RegExp)[] | true;
91
+ external: readonly string[] | true;
92
+ }
93
+ /**
94
+ * Whether the environment loads `specifier` through Vite rather than handing
95
+ * it to Node. Only those imports are rewritten.
96
+ *
97
+ * A server environment externalizes most of node_modules in dev: Node loads
98
+ * the package natively, so its barrel costs nothing to compile. Rewriting such
99
+ * an import to a file path would pull that file into Vite's module graph
100
+ * while any other import of the package stayed external, two instances of one
101
+ * module. In dev, plugin-rsc keeps packages with a `react` peer dependency
102
+ * (lucide-react, the icon sets, the component libraries) out of
103
+ * externalization, and timber's production build sets `noExternal: true`.
104
+ *
105
+ * Vite's own check is internal, so this is its conservative subset: the
106
+ * package must match `resolve.noExternal` exactly (a string or a RegExp) and
107
+ * `resolve.external` must not name it. A glob string in `noExternal` does
108
+ * not match here, which only costs the optimization.
109
+ */
110
+ export declare function isLoadedThroughVite(specifier: string, config: ExternalizationConfig): boolean;
111
+ export declare function timberOptimizePackageImports(ctx: PluginContext): Plugin;
112
+ export {};
113
+ //# sourceMappingURL=optimize-package-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimize-package-imports.d.ts","sourceRoot":"","sources":["../../src/plugins/optimize-package-imports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CA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GAAG;IAAE,GAAG,EAAE,iBAAiB,CAAA;CAAE,CA4StF"}
@@ -1,5 +1,5 @@
1
- import { a as INTERCEPTION_MARKERS, i as DEFAULT_PAGE_EXTENSIONS, n as classifyUrlSegment, t as classifySegment } from "../_chunks/segment-classify-C539Pa2O.js";
2
- import { d as collectInterceptionRewrites, n as scanRoutes } from "../_chunks/scanner-C8fdKvKG.js";
3
- import { t as generateRouteMap } from "../_chunks/codegen-Bps1sLKJ.js";
4
- import { n as collectDynamicSegmentsFromTree, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "../_chunks/walkers-BqzxnwGC.js";
1
+ import { a as INTERCEPTION_MARKERS, i as DEFAULT_PAGE_EXTENSIONS, n as classifyUrlSegment, t as classifySegment } from "../_chunks/segment-classify-Ho8jXWeC.js";
2
+ import { d as collectInterceptionRewrites, n as scanRoutes } from "../_chunks/scanner-CJC-ScJU.js";
3
+ import { t as generateRouteMap } from "../_chunks/codegen-B9oWkWGf.js";
4
+ import { n as collectDynamicSegmentsFromTree, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "../_chunks/walkers-DIE203ir.js";
5
5
  export { DEFAULT_PAGE_EXTENSIONS, INTERCEPTION_MARKERS, classifySegment, classifyUrlSegment, collectDynamicSegmentsFromTree, collectInterceptionRewrites, collectLeafRoutes, generateRouteMap, scanRoutes, validateSchemaAgainstRoutes };