void 1.12.2 → 1.13.0

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 (372) hide show
  1. package/README.md +1 -0
  2. package/dist/{account-cmd-CdJQba_Q.mjs → account-cmd-4fQiXYX7.mjs} +6 -6
  3. package/dist/{application-analysis-DVeN8yoi.mjs → application-analysis-BjEwHTV2.mjs} +19 -13
  4. package/dist/{application-routing-KKw4Y84h.mjs → application-routing-COCfD2yc.mjs} +1 -1
  5. package/dist/args-DrnTI35r.mjs +88 -0
  6. package/dist/args-MnQnqypt.mjs +1 -0
  7. package/dist/{auth-CqwJwItO.mjs → auth-CeBmolb-.mjs} +3 -3
  8. package/dist/{auth-A7cZ8aXA.mjs → auth-CvaDxOMi.mjs} +1 -1
  9. package/dist/{auth-link-D9MWA_dj.mjs → auth-link-I4omV0pL.mjs} +6 -6
  10. package/dist/{auth-router-FskgTU3B.mjs → auth-router-CXq4q7bb.mjs} +6 -5
  11. package/dist/{better-auth-shared-BS3pDQbT.d.mts → better-auth-shared-CrIkcN8I.d.mts} +2 -1
  12. package/dist/bindings-C7zOgxT3.d.mts +28 -0
  13. package/dist/browser-run-BKgZVwLk.mjs +124 -0
  14. package/dist/{build-cmd-B7OJ0U5R.mjs → build-cmd-Biz6u4rn.mjs} +6 -6
  15. package/dist/{cache-wSpi3aeM.mjs → cache-WkLMUrjQ.mjs} +6 -6
  16. package/dist/{cancel-deploy-DMWzkAlb.mjs → cancel-deploy-BRsrmyTk.mjs} +6 -5
  17. package/dist/{cf-access-DHklo7Rg.mjs → cf-access-B21j-nd6.mjs} +1 -1
  18. package/dist/{cf-build-output-Cso7Vh-t.mjs → cf-build-output-G-7Tdd8b.mjs} +6 -5
  19. package/dist/cf-build-output-Qc43LWzE.mjs +1 -0
  20. package/dist/{cf-command-values-5BPBRc9Z.mjs → cf-command-values-cUnJwCyG.mjs} +24 -1
  21. package/dist/{cf-config-migrate-D271BTiw.mjs → cf-config-migrate-CsbQGzMf.mjs} +200 -94
  22. package/dist/cf-user-agent-HHTRzfud.mjs +15 -0
  23. package/dist/cf-version-api-BWHMVtzw.mjs +1 -0
  24. package/dist/cf-version-api-XEEK2B9A.mjs +856 -0
  25. package/dist/cf-worker-settings-DJKdy97k.mjs +127 -0
  26. package/dist/cli/cli.mjs +1 -1
  27. package/dist/cli/cloudflare-operation-process.mjs +111 -47
  28. package/dist/cli/env-schema-probe.mjs +3 -3
  29. package/dist/cli/json-command-process.d.mts +6 -0
  30. package/dist/cli/json-command-process.mjs +91 -0
  31. package/dist/{cli-main-DaLrQfPS.mjs → cli-main-CJTGhcYN.mjs} +84 -113
  32. package/dist/{client-eLZwqkPH.mjs → client-0um7Lzze.mjs} +1 -1
  33. package/dist/{client-DE2m2ldh.mjs → client-BEHI4UWn.mjs} +14 -8
  34. package/dist/{cloudflare-auth-eWfhdZCk.mjs → cloudflare-auth-iOgRurWm.mjs} +1 -1
  35. package/dist/{cloudflare-cmd-SsFlJe2B.mjs → cloudflare-cmd-DsSlXbNy.mjs} +5 -5
  36. package/dist/{cloudflare-config-D9UFH_A5.mjs → cloudflare-config-KPHKf57C.mjs} +2 -2
  37. package/dist/{cloudflare-connect-BgpHcSg3.mjs → cloudflare-connect-bEtneBjT.mjs} +5 -4
  38. package/dist/{cloudflare-operations-ByjFGats.mjs → cloudflare-operations-BmICrRnm.mjs} +1 -1
  39. package/dist/{cloudflare-operations-BIRQkYwL.mjs → cloudflare-operations-D-9psgPQ.mjs} +19 -11
  40. package/dist/cloudflare-preview-8eLSQPdO.mjs +1 -0
  41. package/dist/cloudflare-preview-BaeU-m74.mjs +112 -0
  42. package/dist/{cloudflare-process-60r4Z2Zf.mjs → cloudflare-process-DFNpqV_m.mjs} +57 -29
  43. package/dist/cloudflare-user-output-DFbD0l4l.mjs +36 -0
  44. package/dist/collect-Aam0GwAU.mjs +1 -0
  45. package/dist/{collect-rNLybAnF.mjs → collect-KC4cizWM.mjs} +6 -1
  46. package/dist/{config-DA6ZbLXO.d.mts → config-BdmM5ZzP.d.mts} +12 -2
  47. package/dist/{config-BFX5ZB1J.mjs → config-CUYGZqdN.mjs} +2 -2
  48. package/dist/{config-BSoW3QCB.mjs → config-C_UjzkVS.mjs} +3 -3
  49. package/dist/{config-DtjrUtPo.mjs → config-Ge-MytMU.mjs} +1 -1
  50. package/dist/{config-Dv5jri1-.mjs → config-KZAiI3gG.mjs} +32 -6
  51. package/dist/config-entry.d.mts +1 -1
  52. package/dist/config-write-dKLINlm2.mjs +80 -0
  53. package/dist/{connect-WG4TcR_d.mjs → connect-Bqq3b9sX.mjs} +10 -9
  54. package/dist/{create-project-CbuDH5Hv.mjs → create-project-MXoP_rte.mjs} +1 -1
  55. package/dist/{create-project-8FdN6D2i.mjs → create-project-T-9AIQDe.mjs} +7 -6
  56. package/dist/{db-BSuWV1PI.mjs → db-B3eoVDNA.mjs} +50 -47
  57. package/dist/{db-args-CiQVg8SJ.mjs → db-args-BcvTZ8KE.mjs} +1 -1
  58. package/dist/db-args-Cx1y4vZn.mjs +1 -0
  59. package/dist/{db-types-B4Cf9dzR.mjs → db-types-BpgXVtQZ.mjs} +1 -1
  60. package/dist/{delete-WtLEfap2.mjs → delete-Cf6SroAw.mjs} +7 -6
  61. package/dist/deploy-DZ9j7MC4.mjs +2 -0
  62. package/dist/{deploy-DtJeunLF.mjs → deploy-UojYUEWr.mjs} +803 -1415
  63. package/dist/{deploy-managed-static-BWBsxOww.mjs → deploy-managed-static-DV_OmTWf.mjs} +54 -393
  64. package/dist/{deploy-security-notice-IRGy6Edf.mjs → deploy-security-notice-3jX71IeP.mjs} +6 -4
  65. package/dist/deploy-summary-Dkl0zvQy.mjs +377 -0
  66. package/dist/{deploy-transport-BKP_oV9q.mjs → deploy-transport-4ISWxx8n.mjs} +4 -3
  67. package/dist/deploy.mjs +14 -10
  68. package/dist/discover-BZWVWeQs.mjs +1 -0
  69. package/dist/{discover-IcspacCg.mjs → discover-BeFs7OPS.mjs} +1 -1
  70. package/dist/{dispatch-DIhDA3NI.mjs → dispatch-BUKbPdqb.mjs} +7 -7
  71. package/dist/{dist-Cr_xGE_K.mjs → dist-BngS28id.mjs} +6 -6
  72. package/dist/{dist-C47zy_kJ.mjs → dist-x99fIj4n.mjs} +1 -1
  73. package/dist/{domain-mweyYXSw.mjs → domain-BK6NWkWK.mjs} +7 -7
  74. package/dist/{drizzle-BJDMPrj7.mjs → drizzle-CnSbVeiZ.mjs} +12 -13
  75. package/dist/{drizzle-CQ5jWuDL.mjs → drizzle-CrkwVwK8.mjs} +1 -1
  76. package/dist/{email-DoDqRH6i.mjs → email-BBSDV0J5.mjs} +13 -12
  77. package/dist/{email-cloudflare-DeYH3Ke7.mjs → email-cloudflare-C-guKEbz.mjs} +10 -8
  78. package/dist/{env-DaAoYR2-.mjs → env-BVnKiGYJ.mjs} +8 -8
  79. package/dist/{env-EjHqc7m9.mjs → env-CU2tMDdO.mjs} +6 -1
  80. package/dist/{env-types-D2hBodXP.mjs → env-types-B33fEHRH.mjs} +1 -1
  81. package/dist/{env-validation-j9pjCDfA.mjs → env-validation-BnAsx6gz.mjs} +1 -1
  82. package/dist/{env-validation-D-v5_CWL.mjs → env-validation-SXsjd6-Z.mjs} +4 -4
  83. package/dist/{fetch-CiEsvjpP.mjs → fetch-DL7OCgwB.mjs} +1 -1
  84. package/dist/{fetch-stream-BIG5lHW6.mjs → fetch-stream-DEilLTCc.mjs} +2 -2
  85. package/dist/{gen-aOtHhZLD.mjs → gen-BxuIN1bz.mjs} +10 -9
  86. package/dist/gen-DaayFP9v.mjs +1 -0
  87. package/dist/{generate-Dq2Bgw75.mjs → generate-Ck-L3e0e.mjs} +1 -1
  88. package/dist/{generate-C3ZAqCy-.mjs → generate-t1dDUYZZ.mjs} +1 -1
  89. package/dist/{github-cmd-BR19Ffdz.mjs → github-cmd-B7U9Hjmi.mjs} +7 -6
  90. package/dist/{handler-DCrDLzw2.mjs → handler-2wAywJgj.mjs} +11 -9
  91. package/dist/{headers-DqBsjDxg.mjs → headers-DPI4MDGC.mjs} +1 -1
  92. package/dist/{help-DvClCzqL.mjs → help-Bgiu5PMX.mjs} +36 -4
  93. package/dist/help-DWGHmt_n.mjs +1 -0
  94. package/dist/html-5sfGLjiI.d.mts +3 -0
  95. package/dist/html-DPSOBDCh.mjs +1 -0
  96. package/dist/{index-Dn2mkPr2.d.mts → index-CqF8_p9C.d.mts} +5 -105
  97. package/dist/index-Cvqotnhc.d.mts +91 -0
  98. package/dist/{index-BQ5qYiAw.d.mts → index-DAinHkj8.d.mts} +1 -1
  99. package/dist/{index-8cAgNdb6.d.mts → index-lnEWwVAS.d.mts} +1 -1
  100. package/dist/index.d.mts +3 -2
  101. package/dist/index.mjs +536 -170
  102. package/dist/{info-P6MBiVJi.mjs → info-7COlpAfY.mjs} +32 -20
  103. package/dist/{init-B2VZ2Hut.mjs → init-DftAx3L4.mjs} +237 -88
  104. package/dist/input-jcps6lAn.mjs +64 -0
  105. package/dist/interactive-prompts-EK0dilFu.mjs +43 -0
  106. package/dist/{limits-BCoQLpn3.mjs → limits-3I3VdX2E.mjs} +4 -1
  107. package/dist/{link-Dyz9IGcM.mjs → link-C3WMNFTG.mjs} +7 -7
  108. package/dist/{list-VGYBMjmx.mjs → list-K4EGVUZN.mjs} +9 -9
  109. package/dist/{load-user-env-B8qC0Q2Y.mjs → load-user-env-uMmQJ-Th.mjs} +1 -1
  110. package/dist/{local-d1-CYOYkVwO.mjs → local-d1-BtLCVC1p.mjs} +2 -2
  111. package/dist/login-BJwPhV_S.mjs +1 -0
  112. package/dist/{login-jUBgfvzk.mjs → login-DaugBfBG.mjs} +6 -5
  113. package/dist/{logs-kS1wuR4b.mjs → logs-BR2szdN5.mjs} +6 -6
  114. package/dist/migrate-BHD46A31.mjs +1 -0
  115. package/dist/{migrate-BNZL1hee.mjs → migrate-Dtlg8fC6.mjs} +7 -7
  116. package/dist/nitro.mjs +3 -3
  117. package/dist/{node-DVJWfV6s.mjs → node-BbKlLpHa.mjs} +5 -5
  118. package/dist/{operator-ai-logging-DD0n6zc2.mjs → operator-ai-logging-4Nvs6Ut3.mjs} +5 -5
  119. package/dist/{operator-args-nvetCWuz.mjs → operator-args-DWvqq3Ws.mjs} +31 -15
  120. package/dist/{operator-auth-DMvn-y9X.mjs → operator-auth-DtRMGXYY.mjs} +2 -2
  121. package/dist/{operator-client-dFNnXfyB.mjs → operator-client-BG0VIMMM.mjs} +2 -2
  122. package/dist/operator-cmd-CR3Q9k4c.mjs +1 -0
  123. package/dist/{operator-cmd-wML5HNfS.mjs → operator-cmd-D4YcMKO-.mjs} +9 -9
  124. package/dist/{operator-security-D5MToU0p.mjs → operator-security-nVLo8vDt.mjs} +11 -5
  125. package/dist/{output-BZLnu0z8.mjs → output-DhJgS6Ve.mjs} +1 -1
  126. package/dist/output-OYwcEwok.mjs +1 -0
  127. package/dist/pages/client.d.mts +34 -20
  128. package/dist/pages/client.mjs +172 -74
  129. package/dist/pages/index.d.mts +11 -4
  130. package/dist/pages/index.mjs +5 -5
  131. package/dist/pages/islands-plugin.d.mts +2 -2
  132. package/dist/pages/islands-plugin.mjs +5 -3
  133. package/dist/pages/protocol.d.mts +3 -3
  134. package/dist/pages/protocol.mjs +3 -3
  135. package/dist/pages/serialize.d.mts +2 -2
  136. package/dist/pages/serialize.mjs +1 -1
  137. package/dist/parse-filename-DIPUjoCh.d.mts +2 -0
  138. package/dist/platform-C3Q44RJ8.mjs +250 -0
  139. package/dist/platform-args-BSyVZESg.mjs +1 -0
  140. package/dist/{platform-args-CvZSuhYS.mjs → platform-args-BnocJDC_.mjs} +1 -1
  141. package/dist/{platform-auth-config-Bv3oQ2gE.mjs → platform-auth-config-BbfNhjBc.mjs} +9 -9
  142. package/dist/{platform-auth-protection-OqzfhXwx.mjs → platform-auth-protection-BHPV4MUf.mjs} +9 -8
  143. package/dist/{platform-auth-recovery-rmIYjXST.mjs → platform-auth-recovery-DE0nArYy.mjs} +8 -7
  144. package/dist/{platform-cmd-D_4z2Ijv.mjs → platform-cmd-CLRU3BRb.mjs} +11 -10
  145. package/dist/{platform-cmd-B3rO4RhU.mjs → platform-cmd-Cs2LkT5L.mjs} +1 -1
  146. package/dist/{platform-discovery-CLxtixHJ.mjs → platform-discovery-CKeeeD82.mjs} +1 -1
  147. package/dist/{platform-domain-CUq9odbd.mjs → platform-domain-kn3WuKPG.mjs} +6 -5
  148. package/dist/{platform-lifecycle-DOSYo0UI.mjs → platform-lifecycle-BoCEYy2w.mjs} +1 -1
  149. package/dist/{platform-lifecycle-DuoVruij.mjs → platform-lifecycle-CKwOg8wz.mjs} +164 -72
  150. package/dist/{platform-management-D_gt3qLb.mjs → platform-management-CaSdFthX.mjs} +1 -1
  151. package/dist/{platform-management-MmO9IubR.mjs → platform-management-fyrsq2Ra.mjs} +27 -14
  152. package/dist/{platform-plans-config-DiydtNKY.mjs → platform-plans-config-BSI-6Inu.mjs} +11 -5
  153. package/dist/{platform-recovery-P_FVslfd.mjs → platform-recovery-PwJ54AIZ.mjs} +3 -3
  154. package/dist/{platform-registry-DHH6fivm.mjs → platform-registry-zHH3RiIm.mjs} +2 -1
  155. package/dist/{platform-setup-Lph9i-rh.mjs → platform-setup-DwYITHfY.mjs} +3 -3
  156. package/dist/{plugin-inference-COlq96WJ.mjs → plugin-inference-D5MjBVMB.mjs} +60 -142
  157. package/dist/prepare-CLl_TA_r.mjs +1 -0
  158. package/dist/{prepare-WvijE289.mjs → prepare-DZEs5AGr.mjs} +3 -3
  159. package/dist/{prepare-co1o1FFd.mjs → prepare-DhVzN7CB.mjs} +14 -12
  160. package/dist/{project-uXKua1it.mjs → project-BXpm-vgG.mjs} +1 -1
  161. package/dist/{project-dh9431bN.mjs → project-DC-BqHef.mjs} +1 -1
  162. package/dist/{project-cmd-BWJTplpc.mjs → project-cmd-BKN3qT4R.mjs} +31 -21
  163. package/dist/{project-paths-2ENfCCih.mjs → project-paths-BeAxxqGh.mjs} +1 -1
  164. package/dist/{project-security-BV1xfj1K.mjs → project-security-B-SHxprt.mjs} +1 -1
  165. package/dist/{project-security-CY_aahvW.mjs → project-security-BWTd6cTU.mjs} +87 -46
  166. package/dist/{project-team-BlIFXlmT.mjs → project-team-jcn9reIB.mjs} +6 -6
  167. package/dist/{project-token-CMsB7I1-.mjs → project-token-BHkBKtzt.mjs} +6 -6
  168. package/dist/{project-tsconfig-BOA4ym99.mjs → project-tsconfig-LjgxDdj_.mjs} +1 -1
  169. package/dist/{project-zero-trust-BI6pdpx4.mjs → project-zero-trust-2t_qI6xa.mjs} +4 -4
  170. package/dist/{protocol-4rEnumif.mjs → protocol-DhMbnxzy.mjs} +120 -35
  171. package/dist/{protocol-ERy-n3jf.d.mts → protocol-wG7JP5Mm.d.mts} +27 -4
  172. package/dist/{provision-DFv7SJDn.mjs → provision-C04aXE3a.mjs} +1 -1
  173. package/dist/{provision-Bh44omGA.mjs → provision-CQykn8gu.mjs} +8 -4
  174. package/dist/{redirect-Dyvuil0Q.mjs → redirect-DjyA_hx_.mjs} +1 -1
  175. package/dist/{requests-CfmJxNYg.mjs → requests-BznxnxTT.mjs} +5 -5
  176. package/dist/resolve-project-Bob_rEi2.mjs +1 -0
  177. package/dist/{resolve-project-8WZ3iVmr.mjs → resolve-project-s_FGWyr-.mjs} +2 -2
  178. package/dist/resource-binding-5nI30acw.mjs +20 -0
  179. package/dist/{resource-name-DlJ9QXzg.mjs → resource-name-D_gw36kh.mjs} +5 -1
  180. package/dist/{rollback-DL5HuAsM.mjs → rollback-CLiINtpt.mjs} +25 -14
  181. package/dist/{route-types-CSed9-Dp.mjs → route-types-DxvqN5bL.mjs} +59 -9
  182. package/dist/{route-url-B41eQ8QI.mjs → route-url-CRC8yR_2.mjs} +2 -3
  183. package/dist/{route-url-Bd6IX-JZ.d.mts → route-url-zDfC-7DD.d.mts} +33 -5
  184. package/dist/routes-stub.d.mts +18 -2
  185. package/dist/routes-stub.mjs +1 -1
  186. package/dist/{runner-CeguHWJx.mjs → runner-CnUrhc8H.mjs} +1 -1
  187. package/dist/{runner-mysql-DOjbj-N1.mjs → runner-mysql-CW6bFa67.mjs} +1 -1
  188. package/dist/{runner-mysql-D549vGGm.mjs → runner-mysql-DSLGFOlC.mjs} +1 -1
  189. package/dist/{runner-pg-Buzw17hl.mjs → runner-pg-BcGF7iBR.mjs} +1 -1
  190. package/dist/{runner-pg-DMJquR3d.mjs → runner-pg-OeP0JpEo.mjs} +1 -1
  191. package/dist/{runner-Bf94YVJK.mjs → runner-rnXCGa20.mjs} +1 -1
  192. package/dist/runtime/ai/index.mjs +1 -1
  193. package/dist/runtime/auth/better-auth-d1.d.mts +1 -1
  194. package/dist/runtime/auth/better-auth-mysql.d.mts +1 -1
  195. package/dist/runtime/auth/better-auth-postgres.d.mts +1 -1
  196. package/dist/runtime/client/fetch-server.mjs +1 -1
  197. package/dist/runtime/client/fetch-stream.mjs +1 -1
  198. package/dist/runtime/client/fetch.mjs +1 -1
  199. package/dist/runtime/client/index.mjs +2 -2
  200. package/dist/runtime/client/react.mjs +2 -2
  201. package/dist/runtime/client/solid.mjs +2 -2
  202. package/dist/runtime/client/svelte.mjs +2 -2
  203. package/dist/runtime/client/vue.mjs +2 -2
  204. package/dist/runtime/durable/index.mjs +11 -26
  205. package/dist/runtime/env/runtime.d.mts +2 -10
  206. package/dist/runtime/handler/index.d.mts +3 -2
  207. package/dist/runtime/handler/index.mjs +2 -2
  208. package/dist/runtime/handler/validator.d.mts +1 -1
  209. package/dist/runtime/handler/validator.mjs +1 -1
  210. package/dist/runtime/html.d.mts +2 -0
  211. package/dist/runtime/html.mjs +1 -0
  212. package/dist/runtime/image/index.d.mts +103 -0
  213. package/dist/runtime/image/index.mjs +89 -0
  214. package/dist/runtime/jsx/index.d.mts +3 -0
  215. package/dist/runtime/jsx/index.mjs +2 -0
  216. package/dist/runtime/jsx/jsx-dev-runtime.d.mts +1 -0
  217. package/dist/runtime/jsx/jsx-dev-runtime.mjs +2 -0
  218. package/dist/runtime/jsx/jsx-runtime.d.mts +1 -0
  219. package/dist/runtime/jsx/jsx-runtime.mjs +2 -0
  220. package/dist/runtime/limits/index.mjs +1 -1
  221. package/dist/runtime/live/client.d.mts +2 -2
  222. package/dist/runtime/live/index.d.mts +1 -1
  223. package/dist/runtime/routing/index.d.mts +87 -4
  224. package/dist/runtime/routing/index.mjs +59 -20
  225. package/dist/runtime/routing/route-url.d.mts +2 -2
  226. package/dist/runtime/routing/route-url.mjs +1 -1
  227. package/dist/runtime/sandbox/index.mjs +1 -1
  228. package/dist/runtime/sse/client.d.mts +1 -1
  229. package/dist/runtime/workflows/entry.d.mts +8 -0
  230. package/dist/runtime/workflows/entry.mjs +49 -0
  231. package/dist/runtime/workflows/index.d.mts +3 -0
  232. package/dist/runtime/workflows/index.mjs +77 -0
  233. package/dist/runtime/ws/index.d.mts +1 -1
  234. package/dist/runtime/ws/index.mjs +2 -2
  235. package/dist/runtime/ws/room.d.mts +1 -1
  236. package/dist/runtime/ws/server.d.mts +2 -2
  237. package/dist/runtime-Db72hLY-.d.mts +11 -0
  238. package/dist/scan-BxhB4BA-.mjs +946 -0
  239. package/dist/scan-D2ISAobj.mjs +308 -0
  240. package/dist/{secret-C-WBaUSS.mjs → secret-Ck9N5xbU.mjs} +9 -8
  241. package/dist/{security-sarif-ClyYwtAW.mjs → security-sarif-DzTIqNwZ.mjs} +1 -1
  242. package/dist/{serialize-DN-envGQ.d.mts → serialize-Dr9B-0yV.d.mts} +10 -1
  243. package/dist/{serialize-BmB4BfKu.mjs → serialize-nW4IeEBI.mjs} +23 -2
  244. package/dist/{skills-C-csz78e.mjs → skills-BR7YHAF7.mjs} +1 -1
  245. package/dist/{scan-Ct_SEzH4.mjs → source-analysis-cache-Ccm_JSOl.mjs} +340 -902
  246. package/dist/standard-schema-DvMcZGMK.mjs +8 -0
  247. package/dist/{subcommand-prompt-B4LOLosl.mjs → subcommand-prompt-AFf2LcrC.mjs} +2 -2
  248. package/dist/{types-FDH6NuY1.d.mts → types-RYVujNS6.d.mts} +4 -2
  249. package/dist/{version-metadata-DqgLa6gc.mjs → untrusted-env-4oW0TdBP.mjs} +1 -23
  250. package/dist/{url-DBQluotE.mjs → url-DAQ1c3lh.mjs} +45 -1
  251. package/dist/{validate-CtBWCzez.mjs → validate-B1PsQ_mt.mjs} +1 -1
  252. package/dist/validate-p9b3r1k4.mjs +1 -0
  253. package/dist/{validation-error-CtcAvyI7.mjs → validation-error-EKI0wMWX.mjs} +2 -2
  254. package/dist/{validator-Dfh9kCDm.mjs → validator-JJcf9E48.mjs} +5 -8
  255. package/dist/version-metadata-CEla0kgi.mjs +23 -0
  256. package/dist/{wrangler-DVe5KV5G.mjs → wrangler-AyMfdVJK.mjs} +34 -69
  257. package/dist/wrangler-BT7qrzWc.mjs +1 -0
  258. package/dist/{wrapper-CcMYpOS8.mjs → wrapper-DPlTBVOx.mjs} +5 -5
  259. package/docs/guide/ai.md +1 -1
  260. package/docs/guide/app-types.md +6 -23
  261. package/docs/guide/auth.md +2 -4
  262. package/docs/guide/database/d1.md +21 -67
  263. package/docs/guide/database/mysql.md +8 -0
  264. package/docs/guide/database/postgresql.md +2 -2
  265. package/docs/guide/database.md +1 -1
  266. package/docs/guide/deployment.md +18 -0
  267. package/docs/guide/edge/prerendering.md +3 -7
  268. package/docs/guide/edge/redirects.md +1 -1
  269. package/docs/guide/edge/revalidation.md +8 -17
  270. package/docs/guide/edge/rewrites.md +1 -1
  271. package/docs/guide/edge/static-assets.md +10 -22
  272. package/docs/guide/email/domains.md +3 -1
  273. package/docs/guide/email/receiving.md +2 -2
  274. package/docs/guide/email/sending.md +3 -1
  275. package/docs/guide/env-vars.md +2 -0
  276. package/docs/guide/image-generation.md +142 -0
  277. package/docs/guide/index.md +17 -15
  278. package/docs/guide/jobs.md +2 -4
  279. package/docs/guide/kv.md +1 -1
  280. package/docs/guide/og-images.md +83 -0
  281. package/docs/guide/pages-routing/actions-and-forms.md +6 -4
  282. package/docs/guide/pages-routing/errors.md +20 -4
  283. package/docs/guide/pages-routing/head.md +5 -5
  284. package/docs/guide/pages-routing/islands.md +4 -14
  285. package/docs/guide/pages-routing/markdown.md +2 -2
  286. package/docs/guide/pages-routing/overview.md +129 -15
  287. package/docs/guide/platform/administration/plans.md +47 -16
  288. package/docs/guide/platform/administration/projects.md +10 -0
  289. package/docs/guide/platform/administration/security-audits.md +76 -30
  290. package/docs/guide/platform/administration/zero-trust.md +1 -1
  291. package/docs/guide/platform/installation/ci.md +0 -4
  292. package/docs/guide/platform/installation/credentials.md +1 -1
  293. package/docs/guide/platform/installation/maintenance.md +10 -10
  294. package/docs/guide/platform/installation/prerequisites.md +3 -1
  295. package/docs/guide/platform/installation/setup.md +7 -15
  296. package/docs/guide/platform/installation/uninstall.md +6 -12
  297. package/docs/guide/project-collaboration.md +1 -4
  298. package/docs/guide/queues.md +6 -8
  299. package/docs/guide/quickstart.md +6 -8
  300. package/docs/guide/sandboxes.md +1 -1
  301. package/docs/guide/self-hosted-platform.md +4 -7
  302. package/docs/guide/server-routing.md +5 -3
  303. package/docs/guide/ssg.md +1 -1
  304. package/docs/guide/type-safety.md +74 -10
  305. package/docs/guide/websockets.md +5 -7
  306. package/docs/guide/workflows.md +122 -0
  307. package/docs/index.md +2 -3
  308. package/docs/integrations/agents.md +3 -16
  309. package/docs/integrations/cloudflare.md +98 -2
  310. package/docs/integrations/frameworks/analog.md +9 -11
  311. package/docs/integrations/frameworks/astro.md +16 -17
  312. package/docs/integrations/frameworks/nuxt.md +11 -13
  313. package/docs/integrations/frameworks/overview.md +18 -20
  314. package/docs/integrations/frameworks/react-router.md +55 -6
  315. package/docs/integrations/frameworks/sveltekit.md +8 -6
  316. package/docs/integrations/frameworks/tanstack-start.md +10 -6
  317. package/docs/integrations/hono.md +27 -12
  318. package/docs/integrations/nodejs-bun-deno.md +10 -2
  319. package/docs/reference/api/database.md +8 -10
  320. package/docs/reference/api/env.md +2 -2
  321. package/docs/reference/api/handlers.md +1 -1
  322. package/docs/reference/api/html.md +45 -0
  323. package/docs/reference/api/pages.md +118 -167
  324. package/docs/reference/api/rewrites.md +5 -5
  325. package/docs/reference/api/types.md +13 -6
  326. package/docs/reference/api/workflows.md +48 -0
  327. package/docs/reference/api.md +7 -1
  328. package/docs/reference/cli/database.md +22 -10
  329. package/docs/reference/cli/deploy.md +49 -4
  330. package/docs/reference/cli/domains.md +7 -3
  331. package/docs/reference/cli/email.md +3 -1
  332. package/docs/reference/cli/platform-installation.md +9 -53
  333. package/docs/reference/cli/platform-security.md +36 -8
  334. package/docs/reference/cli/platform-users.md +11 -1
  335. package/docs/reference/cli/platform-zero-trust.md +1 -1
  336. package/docs/reference/cli/project.md +52 -11
  337. package/docs/reference/cli/setup.md +8 -10
  338. package/docs/reference/cli.md +49 -47
  339. package/docs/reference/config.md +22 -8
  340. package/docs/reference/resource-inference.md +8 -1
  341. package/docs/reference/structure.md +5 -0
  342. package/package.json +52 -25
  343. package/schema.json +20 -1
  344. package/skills/void/SKILL.md +60 -54
  345. package/dist/cf-build-output-Wpk_e5CI.mjs +0 -1
  346. package/dist/cf-worker-settings-BBdlhm9U.mjs +0 -41
  347. package/dist/cli/db-execute-process.d.mts +0 -2
  348. package/dist/cli/db-execute-process.mjs +0 -57
  349. package/dist/cloudflare-user-output-CCR99eQY.mjs +0 -19
  350. package/dist/collect-B6nlSnsb.mjs +0 -1
  351. package/dist/db-args-BvMwAber.mjs +0 -1
  352. package/dist/deploy-GT4CW5fs.mjs +0 -2
  353. package/dist/discover-D2KGP3cR.mjs +0 -1
  354. package/dist/entry-Bwb9ev8K.mjs +0 -113
  355. package/dist/gen-vhBDHs3q.mjs +0 -1
  356. package/dist/help-fKPzcTJv.mjs +0 -1
  357. package/dist/isr-config-DiTnL9Tb.mjs +0 -115
  358. package/dist/login-BbSQTZ6d.mjs +0 -1
  359. package/dist/migrate-C9aoWLvY.mjs +0 -1
  360. package/dist/operator-cmd-jnjzuJKX.mjs +0 -1
  361. package/dist/output-D7K9TWIA.mjs +0 -1
  362. package/dist/platform-args-CMwMoiLp.mjs +0 -1
  363. package/dist/prepare-DcwigRUS.mjs +0 -1
  364. package/dist/providers-D5P8j_8D.d.mts +0 -5
  365. package/dist/resolve-project-YsTH-U9I.mjs +0 -1
  366. package/dist/static-exports-s7P86Ngp.mjs +0 -354
  367. package/dist/validate-CZYUIfR-.mjs +0 -1
  368. package/dist/wrangler-Dq269bjx.mjs +0 -1
  369. package/docs/guide/platform/development/local.md +0 -120
  370. package/docs/guide/platform/development/runtime.md +0 -115
  371. package/docs/guide/platform/development/schema-ci.md +0 -44
  372. package/docs/guide/platform-development.md +0 -16
@@ -1,12 +1,7 @@
1
1
  import { n as __toESM, t as __commonJSMin } from "./rolldown-runtime-uD8oG6U2.mjs";
2
- import { a as join, l as toSlash, n as dirname$1, r as extname, t as basename$1 } from "./dist-DMYe8CZJ.mjs";
3
- import { p as readConfig } from "./config-Dv5jri1-.mjs";
4
- import { i as voidWarn } from "./log-D9hwSySP.mjs";
5
- import { n as readProjectPaths } from "./project-paths-2ENfCCih.mjs";
6
- import { i as staticLiteral, n as readStaticExports, o as bindingNames, r as staticExports, t as mayExportAll } from "./static-exports-s7P86Ngp.mjs";
2
+ import { l as toSlash } from "./dist-DMYe8CZJ.mjs";
7
3
  import { i as isLiteral, r as isIdentifier, s as moduleExportName, t as asAstProgram } from "./ast-BkPQu7A0.mjs";
8
- import { t as MagicString } from "./dist-B6eN80gc.mjs";
9
- import { existsSync, readFileSync, statSync } from "node:fs";
4
+ import { readFileSync, statSync } from "node:fs";
10
5
  import { parseSync } from "vite";
11
6
  import * as nativeFs from "fs";
12
7
  import { readdir, readdirSync as readdirSync$1, realpath, realpathSync as realpathSync$1, stat, statSync as statSync$1 } from "fs";
@@ -2727,129 +2722,357 @@ function globSync(globInput, options) {
2727
2722
  const [crawler, relative] = getCrawler(globInput, options);
2728
2723
  return crawler ? formatPaths(crawler.sync(), relative) : [];
2729
2724
  }
2730
- // src/shared/route-extensions.ts
2731
- const ROUTE_EXTENSIONS = [
2732
- "ts",
2733
- "tsx",
2734
- "js",
2735
- "jsx",
2736
- "mjs",
2737
- "mts"
2738
- ];
2739
- const ROUTE_EXTENSIONS_SET = new Set(ROUTE_EXTENSIONS.map((ext) => `.${ext}`));
2740
- // src/router/parse-filename.ts
2741
- const ENV_SUFFIXES = ["dev", "prod"];
2742
- function parsePath(relativePath, isWebSocketRoute) {
2743
- const filePath = relativePath;
2744
- let path = relativePath.replaceAll("\\", "/");
2745
- for (const ext of ROUTE_EXTENSIONS) if (path.endsWith(`.${ext}`)) {
2746
- path = path.slice(0, -(ext.length + 1));
2747
- break;
2725
+ // ../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/walker.js
2726
+ /**
2727
+ * @typedef { import('estree').Node} Node
2728
+ * @typedef {{
2729
+ * skip: () => void;
2730
+ * remove: () => void;
2731
+ * replace: (node: Node) => void;
2732
+ * }} WalkerContext
2733
+ */
2734
+ var WalkerBase = class {
2735
+ constructor() {
2736
+ /** @type {boolean} */
2737
+ this.should_skip = false;
2738
+ /** @type {boolean} */
2739
+ this.should_remove = false;
2740
+ /** @type {Node | null} */
2741
+ this.replacement = null;
2742
+ /** @type {WalkerContext} */
2743
+ this.context = {
2744
+ skip: () => this.should_skip = true,
2745
+ remove: () => this.should_remove = true,
2746
+ replace: (node) => this.replacement = node
2747
+ };
2748
2748
  }
2749
- if (isWebSocketRoute && path.endsWith(".ws")) path = path.slice(0, -3);
2750
- const segments = path.split("/");
2751
- let filename = segments.pop() ?? "";
2752
- let env = null;
2753
- for (const suffix of ENV_SUFFIXES) if (filename.endsWith(`.${suffix}`)) {
2754
- env = suffix;
2755
- filename = filename.slice(0, -(suffix.length + 1));
2756
- break;
2749
+ /**
2750
+ * @template {Node} Parent
2751
+ * @param {Parent | null | undefined} parent
2752
+ * @param {keyof Parent | null | undefined} prop
2753
+ * @param {number | null | undefined} index
2754
+ * @param {Node} node
2755
+ */
2756
+ replace(parent, prop, index, node) {
2757
+ if (parent && prop) {
2758
+ if (index != null)
2759
+ /** @type {Array<Node>} */ parent[prop][index] = node;
2760
+ else
2761
+ /** @type {Node} */ parent[prop] = node;
2762
+ }
2757
2763
  }
2758
- segments.push(filename);
2759
- if (segments.at(-1) === "index") segments.pop();
2760
- const filtered = segments.filter((s) => !s.startsWith("(") || !s.endsWith(")"));
2761
- const params = [];
2762
- let catchAll = false;
2763
- return {
2764
- pattern: "/" + filtered.map((segment) => {
2765
- if (segment.startsWith("[...") && segment.endsWith("]")) {
2766
- const paramName = segment.slice(4, -1);
2767
- catchAll = true;
2768
- if (paramName) {
2769
- params.push(paramName);
2770
- return `:${paramName}{.+}`;
2764
+ /**
2765
+ * @template {Node} Parent
2766
+ * @param {Parent | null | undefined} parent
2767
+ * @param {keyof Parent | null | undefined} prop
2768
+ * @param {number | null | undefined} index
2769
+ */
2770
+ remove(parent, prop, index) {
2771
+ if (parent && prop) {
2772
+ if (index !== null && index !== void 0)
2773
+ /** @type {Array<Node>} */ parent[prop].splice(index, 1);
2774
+ else delete parent[prop];
2775
+ }
2776
+ }
2777
+ };
2778
+ // ../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/sync.js
2779
+ /**
2780
+ * @typedef { import('estree').Node} Node
2781
+ * @typedef { import('./walker.js').WalkerContext} WalkerContext
2782
+ * @typedef {(
2783
+ * this: WalkerContext,
2784
+ * node: Node,
2785
+ * parent: Node | null,
2786
+ * key: string | number | symbol | null | undefined,
2787
+ * index: number | null | undefined
2788
+ * ) => void} SyncHandler
2789
+ */
2790
+ var SyncWalker = class extends WalkerBase {
2791
+ /**
2792
+ *
2793
+ * @param {SyncHandler} [enter]
2794
+ * @param {SyncHandler} [leave]
2795
+ */
2796
+ constructor(enter, leave) {
2797
+ super();
2798
+ /** @type {boolean} */
2799
+ this.should_skip = false;
2800
+ /** @type {boolean} */
2801
+ this.should_remove = false;
2802
+ /** @type {Node | null} */
2803
+ this.replacement = null;
2804
+ /** @type {WalkerContext} */
2805
+ this.context = {
2806
+ skip: () => this.should_skip = true,
2807
+ remove: () => this.should_remove = true,
2808
+ replace: (node) => this.replacement = node
2809
+ };
2810
+ /** @type {SyncHandler | undefined} */
2811
+ this.enter = enter;
2812
+ /** @type {SyncHandler | undefined} */
2813
+ this.leave = leave;
2814
+ }
2815
+ /**
2816
+ * @template {Node} Parent
2817
+ * @param {Node} node
2818
+ * @param {Parent | null} parent
2819
+ * @param {keyof Parent} [prop]
2820
+ * @param {number | null} [index]
2821
+ * @returns {Node | null}
2822
+ */
2823
+ visit(node, parent, prop, index) {
2824
+ if (node) {
2825
+ if (this.enter) {
2826
+ const _should_skip = this.should_skip;
2827
+ const _should_remove = this.should_remove;
2828
+ const _replacement = this.replacement;
2829
+ this.should_skip = false;
2830
+ this.should_remove = false;
2831
+ this.replacement = null;
2832
+ this.enter.call(this.context, node, parent, prop, index);
2833
+ if (this.replacement) {
2834
+ node = this.replacement;
2835
+ this.replace(parent, prop, index, node);
2771
2836
  }
2772
- return "*";
2773
- }
2774
- if (segment.startsWith("[") && segment.endsWith("]")) {
2775
- const paramName = segment.slice(1, -1);
2776
- params.push(paramName);
2777
- return `:${paramName}`;
2778
- }
2779
- return segment;
2780
- }).join("/"),
2781
- methods: [],
2782
- params,
2783
- catchAll,
2784
- env,
2785
- filePath
2786
- };
2787
- }
2837
+ if (this.should_remove) this.remove(parent, prop, index);
2838
+ const skipped = this.should_skip;
2839
+ const removed = this.should_remove;
2840
+ this.should_skip = _should_skip;
2841
+ this.should_remove = _should_remove;
2842
+ this.replacement = _replacement;
2843
+ if (skipped) return node;
2844
+ if (removed) return null;
2845
+ }
2846
+ /** @type {keyof Node} */
2847
+ let key;
2848
+ for (key in node) {
2849
+ /** @type {unknown} */
2850
+ const value = node[key];
2851
+ if (value && typeof value === "object") {
2852
+ if (Array.isArray(value)) {
2853
+ const nodes = value;
2854
+ for (let i = 0; i < nodes.length; i += 1) {
2855
+ const item = nodes[i];
2856
+ if (isNode(item)) {
2857
+ if (!this.visit(item, node, key, i)) i--;
2858
+ }
2859
+ }
2860
+ } else if (isNode(value)) this.visit(value, node, key, null);
2861
+ }
2862
+ }
2863
+ if (this.leave) {
2864
+ const _replacement = this.replacement;
2865
+ const _should_remove = this.should_remove;
2866
+ this.replacement = null;
2867
+ this.should_remove = false;
2868
+ this.leave.call(this.context, node, parent, prop, index);
2869
+ if (this.replacement) {
2870
+ node = this.replacement;
2871
+ this.replace(parent, prop, index, node);
2872
+ }
2873
+ if (this.should_remove) this.remove(parent, prop, index);
2874
+ const removed = this.should_remove;
2875
+ this.replacement = _replacement;
2876
+ this.should_remove = _should_remove;
2877
+ if (removed) return null;
2878
+ }
2879
+ }
2880
+ return node;
2881
+ }
2882
+ };
2788
2883
  /**
2789
- * Parse a route filename (relative to routes/) into a RouteDefinition.
2884
+ * Ducktype a node.
2790
2885
  *
2791
- * Rules (applied in order):
2792
- * 1. Strip file extension (.ts, .tsx, .js, .jsx, .mts, .mjs)
2793
- * 2. Check for env suffix (.dev, .prod) → strip and record
2794
- * 3. Strip trailing "index" segment
2795
- * 4. Remove route group directories: (groupname)
2796
- * 5. Convert [param] → :param, [...param] → :param{.+}, [...] → *
2797
- * 6. Prefix with /
2886
+ * @param {unknown} value
2887
+ * @returns {value is Node}
2798
2888
  */
2799
- function parseRouteFilename(relativePath) {
2800
- return parsePath(relativePath, false);
2801
- }
2802
- /** Parse a `.ws.*` route filename into a regular route definition. */
2803
- function parseWebSocketFilename(relativePath) {
2804
- return parsePath(relativePath, true);
2805
- }
2806
- function isRouteEnabledForEnvironment(route, environment) {
2807
- return environment === void 0 || route.env === null || route.env === environment;
2889
+ function isNode(value) {
2890
+ return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
2808
2891
  }
2809
- // src/router/route-order.ts
2892
+ // ../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/index.js
2810
2893
  /**
2811
- * Classify one segment of a route pattern. `*` and `:name{.+}` match the rest of the path,
2812
- * `:name` matches one segment, and anything else matches as written. Pages match with the
2813
- * same rules on the client (see `patternToRegex`), so ranking and matching agree.
2894
+ * @typedef {import('estree').Node} Node
2895
+ * @typedef {import('./sync.js').SyncHandler} SyncHandler
2896
+ * @typedef {import('./async.js').AsyncHandler} AsyncHandler
2814
2897
  */
2815
- function routeSegmentKind(segment) {
2816
- if (segment === "*") return "rest";
2817
- if (segment.length < 2 || segment[0] !== ":") return "static";
2818
- const name = segment.endsWith("{.+}") ? segment.slice(1, -4) : "";
2819
- return name && !name.includes("{") && !name.includes("}") ? "rest" : "param";
2898
+ /**
2899
+ * @param {Node} ast
2900
+ * @param {{
2901
+ * enter?: SyncHandler
2902
+ * leave?: SyncHandler
2903
+ * }} walker
2904
+ * @returns {Node | null}
2905
+ */
2906
+ function walk(ast, { enter, leave }) {
2907
+ return new SyncWalker(enter, leave).visit(ast, null);
2908
+ }
2909
+ // src/shared/ast-bindings.ts
2910
+ /** Names introduced by a binding pattern, excluding keys and default expressions. */
2911
+ function bindingNames(node) {
2912
+ if (isIdentifier(node)) return [node.name];
2913
+ if (node?.type === "ObjectPattern") return (node.properties ?? []).flatMap((property) => bindingNames(property.type === "RestElement" ? property.argument : property.value));
2914
+ if (node?.type === "ArrayPattern") return (node.elements ?? []).flatMap(bindingNames);
2915
+ if (node?.type === "AssignmentPattern" || node?.type === "RestElement") return bindingNames(node.left ?? node.argument);
2916
+ if (node?.type === "TSParameterProperty") return bindingNames(node.parameter);
2917
+ return [];
2918
+ }
2919
+ const FUNCTIONS = /* @__PURE__ */ new Set([
2920
+ "FunctionDeclaration",
2921
+ "FunctionExpression",
2922
+ "ArrowFunctionExpression"
2923
+ ]);
2924
+ /**
2925
+ * Resolve lexical bindings after collecting declarations, including hoisted and later bindings.
2926
+ * A visitor can collect references in the same pass; return true to retain a node's scope.
2927
+ * Names can limit binding collection when only specific imports need resolution.
2928
+ */
2929
+ function bindingResolver(program, options) {
2930
+ const scopes = /* @__PURE__ */ new WeakMap();
2931
+ const outerScopes = /* @__PURE__ */ new WeakMap();
2932
+ let scope = { varScope: true };
2933
+ const declare = (pattern, declaration, target = scope) => {
2934
+ for (const name of bindingNames(pattern)) if (!options?.names || options.names.has(name)) (target.bindings ??= /* @__PURE__ */ new Map()).set(name, declaration);
2935
+ };
2936
+ walk(program, {
2937
+ enter(raw, rawParent, key) {
2938
+ const node = raw;
2939
+ const parent = rawParent;
2940
+ const outerScope = scope;
2941
+ if (parent?.type === "SwitchStatement" && key === "discriminant") scope = scope.parent;
2942
+ if ([
2943
+ "FunctionDeclaration",
2944
+ "ClassDeclaration",
2945
+ "TSEnumDeclaration",
2946
+ "TSModuleDeclaration"
2947
+ ].includes(node.type)) declare(node.id, node);
2948
+ const isFunction = FUNCTIONS.has(node.type);
2949
+ if (isFunction || node.type === "BlockStatement" || node.type === "StaticBlock" || node.type === "CatchClause" || node.type === "ForStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "SwitchStatement" || node.type === "ClassDeclaration" || node.type === "ClassExpression" || node.type === "TSModuleDeclaration") scope = {
2950
+ parent: scope,
2951
+ varScope: isFunction || node.type === "StaticBlock" || node.type === "TSModuleDeclaration" || node.type === "BlockStatement" && !!parent && FUNCTIONS.has(parent.type)
2952
+ };
2953
+ if (scope !== outerScope) outerScopes.set(node, outerScope);
2954
+ if (!options?.visit || options.visit(node)) scopes.set(node, scope);
2955
+ if (isFunction) {
2956
+ if (node.type === "FunctionExpression") declare(node.id, node);
2957
+ for (const parameter of node.params ?? []) declare(parameter, parameter);
2958
+ } else if (node.type === "ClassDeclaration" || node.type === "ClassExpression") declare(node.id, node);
2959
+ else if (node.type === "CatchClause") declare(node.param, node);
2960
+ else if (node.type === "ImportDeclaration" && node.importKind !== "type") {
2961
+ for (const specifier of node.specifiers ?? []) if (specifier.importKind !== "type") declare(specifier.local, specifier);
2962
+ } else if (node.type === "VariableDeclaration") {
2963
+ let target = scope;
2964
+ if (node.kind === "var") while (!target.varScope && target.parent) target = target.parent;
2965
+ for (const declaration of node.declarations ?? []) declare(declaration.id, declaration, target);
2966
+ }
2967
+ },
2968
+ leave(raw) {
2969
+ const outer = outerScopes.get(raw);
2970
+ if (outer) scope = outer;
2971
+ }
2972
+ });
2973
+ return (node, name) => {
2974
+ let current = scopes.get(node);
2975
+ while (current) {
2976
+ const binding = current.bindings?.get(name);
2977
+ if (binding) return binding;
2978
+ current = current.parent;
2979
+ }
2980
+ };
2820
2981
  }
2821
- const SEGMENT_RANK = {
2822
- static: 0,
2823
- param: 1,
2824
- rest: 2
2825
- };
2982
+ // src/shared/static-exports.ts
2983
+ const LINE_TERMINATORS = /* @__PURE__ */ new Set([
2984
+ "\n",
2985
+ "\r",
2986
+ "\u2028",
2987
+ "\u2029"
2988
+ ]);
2826
2989
  /**
2827
- * Order routes so that, of any two that match the same URL, the more specific one comes first.
2828
- * Hono and the Pages client matcher both use the first match.
2829
- *
2830
- * Catch-all routes come last and fully static routes first. Otherwise the first segment that
2831
- * differs decides: static before `:param` before catch-all. Parameter names never decide, so
2832
- * `/:lang/about` ranks ahead of `/:category/:item`. Two different static segments can't match
2833
- * the same URL, so their text only keeps the order stable.
2990
+ * Whether `export` is followed by `*` once whitespace and comments are skipped,
2991
+ * so a comment between the two still counts. True only means the source needs
2992
+ * parsing: the text may sit in a string or comment. This is a scan because a
2993
+ * regular expression that skips repeated comments can backtrack exponentially.
2834
2994
  */
2835
- function compareRouteSpecificity(a, b) {
2836
- if (a.catchAll !== b.catchAll) return a.catchAll ? 1 : -1;
2837
- const aSegments = a.pattern.split("/");
2838
- const bSegments = b.pattern.split("/");
2839
- const aKinds = aSegments.map(routeSegmentKind);
2840
- const bKinds = bSegments.map(routeSegmentKind);
2841
- const aStatic = aKinds.every((kind) => kind === "static");
2842
- if (aStatic !== bKinds.every((kind) => kind === "static")) return aStatic ? -1 : 1;
2843
- const shared = Math.min(aSegments.length, bSegments.length);
2844
- for (let i = 0; i < shared; i++) {
2845
- const rank = SEGMENT_RANK[aKinds[i]] - SEGMENT_RANK[bKinds[i]];
2846
- if (rank !== 0) return rank;
2847
- if (aKinds[i] === "static" && aSegments[i] !== bSegments[i]) return compareText$1(aSegments[i], bSegments[i]);
2995
+ function mayExportAll(source) {
2996
+ for (let index = source.indexOf("export"); index !== -1; index = source.indexOf("export", index + 1)) {
2997
+ let cursor = index + 6;
2998
+ while (cursor < source.length) if (/\s/.test(source[cursor])) cursor += 1;
2999
+ else if (source.startsWith("/*", cursor)) {
3000
+ const end = source.indexOf("*/", cursor + 2);
3001
+ cursor = end === -1 ? source.length : end + 2;
3002
+ } else if (source.startsWith("//", cursor)) {
3003
+ cursor += 2;
3004
+ while (cursor < source.length && !LINE_TERMINATORS.has(source[cursor])) cursor += 1;
3005
+ } else break;
3006
+ if (source[cursor] === "*") return true;
3007
+ }
3008
+ return false;
3009
+ }
3010
+ const VALUE_DECLARATIONS = /* @__PURE__ */ new Set([
3011
+ "FunctionDeclaration",
3012
+ "ClassDeclaration",
3013
+ "TSEnumDeclaration"
3014
+ ]);
3015
+ /** Read how a parsed module exports `names` without evaluating user code. Type-only exports are skipped. */
3016
+ function staticExports(program, names) {
3017
+ const result = {
3018
+ initializers: /* @__PURE__ */ new Map(),
3019
+ unreadable: /* @__PURE__ */ new Set(),
3020
+ exportsAll: false
3021
+ };
3022
+ const markUnreadable = (name) => {
3023
+ if (name !== void 0 && names.has(name)) result.unreadable.add(name);
3024
+ };
3025
+ for (const statement of program.body ?? []) {
3026
+ if (statement.type === "ExportAllDeclaration") {
3027
+ const exported = statement;
3028
+ if (exported.exportKind === "type") continue;
3029
+ if (exported.exported) markUnreadable(moduleExportName(exported.exported));
3030
+ else result.exportsAll = true;
3031
+ continue;
3032
+ }
3033
+ if (statement.type !== "ExportNamedDeclaration") continue;
3034
+ const exported = statement;
3035
+ if (exported.exportKind === "type") continue;
3036
+ for (const specifier of exported.specifiers ?? []) if (specifier.exportKind !== "type") markUnreadable(moduleExportName(specifier.exported));
3037
+ const declaration = exported.declaration;
3038
+ if (declaration?.type === "VariableDeclaration") {
3039
+ const variables = declaration;
3040
+ for (const variable of variables.declarations ?? []) {
3041
+ if (variables.kind === "const" && isIdentifier(variable.id) && variable.init) {
3042
+ if (names.has(variable.id.name)) result.initializers.set(variable.id.name, variable.init);
3043
+ continue;
3044
+ }
3045
+ for (const name of bindingNames(variable.id)) markUnreadable(name);
3046
+ }
3047
+ } else if (declaration && VALUE_DECLARATIONS.has(declaration.type)) {
3048
+ const id = declaration.id;
3049
+ markUnreadable(isIdentifier(id) ? id.name : void 0);
3050
+ }
2848
3051
  }
2849
- return aSegments.length - bSegments.length || compareText$1(a.pattern, b.pattern);
3052
+ return result;
2850
3053
  }
2851
- function compareText$1(left, right) {
2852
- return left < right ? -1 : left > right ? 1 : 0;
3054
+ /** Parse a module and read how it exports `names` without evaluating user code. */
3055
+ function readStaticExports(filename, source, names) {
3056
+ return staticExports(asAstProgram(parseSync(filename, source).program), names);
3057
+ }
3058
+ function unwrapStaticExpression(node) {
3059
+ while (node && [
3060
+ "ParenthesizedExpression",
3061
+ "TSAsExpression",
3062
+ "TSInstantiationExpression",
3063
+ "TSSatisfiesExpression",
3064
+ "TSTypeAssertion"
3065
+ ].includes(node.type)) node = node.expression;
3066
+ return node;
3067
+ }
3068
+ function staticLiteral(node) {
3069
+ node = unwrapStaticExpression(node);
3070
+ if (isLiteral(node)) return node.value;
3071
+ if (node?.type === "TemplateLiteral") {
3072
+ const expressions = node.expressions;
3073
+ const quasis = node.quasis;
3074
+ if (expressions?.length === 0 && quasis?.length === 1) return quasis[0]?.value?.cooked;
3075
+ }
2853
3076
  }
2854
3077
  // src/shared/source-analysis-cache.ts
2855
3078
  /**
@@ -2893,789 +3116,4 @@ function deriveFromSource(path, kind, derive) {
2893
3116
  function invalidateSourceAnalysis(path) {
2894
3117
  entries.delete(toSlash(path));
2895
3118
  }
2896
- // src/pages/island-imports.ts
2897
- const SCRIPT_ATTRIBUTE_RE = /([^\s"'=/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;
2898
- /** `<script module>` (Svelte 5) or `<script context="module">` (Svelte 4). */
2899
- function isSvelteModuleScript(attributes) {
2900
- for (const [, name, doubleQuoted, singleQuoted, bare] of attributes.matchAll(SCRIPT_ATTRIBUTE_RE)) if (name === "module" || name === "context" && (doubleQuoted ?? singleQuoted ?? bare) === "module") return true;
2901
- return false;
2902
- }
2903
- const MARKDOWN_SCRIPT_RE = /^<script\b[^>]*>([\s\S]*?)<\/script>\s*\n?/;
2904
- /**
2905
- * The whole JS/TS module, each `<script>` block of a Vue/Svelte SFC, or the
2906
- * leading `<script>` block of a Markdown page, with its offset in the file.
2907
- */
2908
- function scriptBlocks(code, filename) {
2909
- if (filename.endsWith(".md")) {
2910
- const match = MARKDOWN_SCRIPT_RE.exec(code);
2911
- if (!match) return [];
2912
- const source = match[1];
2913
- return [{
2914
- source,
2915
- offset: match[0].indexOf(source),
2916
- filename: filename.replace(/\.md$/, ".ts")
2917
- }];
2918
- }
2919
- if (!/\.(?:vue|svelte)$/.test(filename)) return [{
2920
- source: code,
2921
- offset: 0,
2922
- filename
2923
- }];
2924
- const scriptFilename = filename.replace(/\.(?:vue|svelte)$/, ".ts");
2925
- const svelte = filename.endsWith(".svelte");
2926
- return [...code.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)].map((match) => {
2927
- const source = match[2];
2928
- const block = {
2929
- source,
2930
- offset: match.index + match[0].indexOf(source),
2931
- filename: scriptFilename
2932
- };
2933
- if (svelte && !isSvelteModuleScript(match[1])) block.instance = true;
2934
- return block;
2935
- });
2936
- }
2937
- /** Collect stylesheet imports from authored modules without treating dynamic imports or text as dependencies. */
2938
- function findStaticCssImports(code, filename) {
2939
- if (!code.includes("import")) return [];
2940
- const imports = [];
2941
- for (const script of scriptBlocks(code, filename)) {
2942
- if (!script.source.includes("import")) continue;
2943
- const program = asAstProgram(parseSync(script.filename, script.source).program);
2944
- for (const node of program.body ?? []) {
2945
- const source = node.source;
2946
- if (node.type !== "ImportDeclaration" || !isLiteral(source) || typeof source.value !== "string" || !/\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/.test(source.value) || node.start === void 0 || node.end === void 0) continue;
2947
- imports.push({
2948
- statement: script.source.slice(node.start, node.end),
2949
- specifier: source.value
2950
- });
2951
- }
2952
- }
2953
- return imports;
2954
- }
2955
- function editIslandSource(code, edits, options) {
2956
- const ms = new MagicString(code);
2957
- for (const edit of edits) ms.overwrite(edit.start, edit.end, edit.text);
2958
- for (const insertion of options?.insert ?? []) ms.appendLeft(insertion.offset, insertion.text);
2959
- if (options?.prepend) ms.prepend(options.prepend);
2960
- if (options?.append) ms.append(options.append);
2961
- return {
2962
- code: ms.toString(),
2963
- map: ms.generateMap({ hires: true })
2964
- };
2965
- }
2966
- /** Read island import attributes from JS/TS, or the script blocks of an SFC or a Markdown page. */
2967
- function findIslandImports(code, filename) {
2968
- if (!code.includes("import") || !code.includes("island")) return [];
2969
- const imports = [];
2970
- for (const script of scriptBlocks(code, filename)) {
2971
- if (!script.source.includes("island")) continue;
2972
- const program = asAstProgram(parseSync(script.filename, script.source).program);
2973
- for (const node of program.body ?? []) {
2974
- if (node.type !== "ImportDeclaration") continue;
2975
- const specifiers = node.specifiers;
2976
- const attributes = node.attributes;
2977
- const first = specifiers?.[0];
2978
- const attribute = attributes?.[0];
2979
- const key = attribute?.key;
2980
- const value = attribute?.value;
2981
- const source = node.source;
2982
- if (specifiers?.length !== 1 || first?.type !== "ImportDefaultSpecifier" || !isIdentifier(first.local) || attributes?.length !== 1 || !isIdentifier(key) || key.name !== "island" || !isLiteral(value) || typeof value.value !== "string" || !isLiteral(source) || typeof source.value !== "string" || source.start === void 0 || source.end === void 0 || node.start === void 0 || node.end === void 0) continue;
2983
- imports.push({
2984
- start: script.offset + node.start,
2985
- end: script.offset + node.end,
2986
- importName: first.local.name,
2987
- specifierRaw: script.source.slice(source.start, source.end),
2988
- specifier: source.value,
2989
- hydrate: value.value
2990
- });
2991
- }
2992
- }
2993
- return imports;
2994
- }
2995
- // src/pages/layout-resolution.ts
2996
- function isNamedLayout(layout) {
2997
- return "name" in layout;
2998
- }
2999
- function toLayoutId(layout) {
3000
- if (isNamedLayout(layout)) return layout.directory ? `${layout.directory}/_layouts/${layout.name}` : `_layouts/${layout.name}`;
3001
- return layout.directory ? `${layout.directory}/layout` : "layout";
3002
- }
3003
- function resolveLayoutDirectories(componentId, componentPath) {
3004
- if (componentPath) {
3005
- const segments = componentPath.split("/");
3006
- segments.pop();
3007
- return segments.map((_, index) => segments.slice(0, index + 1).join("/"));
3008
- }
3009
- const parts = componentId.split("/");
3010
- return parts.slice(0, -1).map((_, index) => parts.slice(0, index + 1).join("/"));
3011
- }
3012
- /** Resolve the layout chain for a component (innermost last) */
3013
- function resolveLayoutChain(componentId, layouts, componentPath) {
3014
- const chain = [];
3015
- const root = layouts.find((layout) => layout.directory === "");
3016
- if (root) chain.push(root);
3017
- for (const dir of resolveLayoutDirectories(componentId, componentPath)) {
3018
- const layout = layouts.find((candidate) => candidate.directory === dir);
3019
- if (layout) chain.push(layout);
3020
- }
3021
- return chain;
3022
- }
3023
- /** Walk up directory tree to find closest _layouts/<name> */
3024
- function resolveNamedLayout(name, componentId, namedLayouts, componentPath) {
3025
- const dirs = resolveLayoutDirectories(componentId, componentPath).reverse();
3026
- dirs.push("");
3027
- for (const directory of dirs) {
3028
- const found = namedLayouts.find((namedLayout) => namedLayout.name === name && namedLayout.directory === directory);
3029
- if (found) return found;
3030
- }
3031
- return null;
3032
- }
3033
- function resolveEffectiveLayoutEntries(page, layouts, namedLayouts) {
3034
- if (page.layout === false) return [];
3035
- const defaultChain = resolveLayoutChain(page.componentId, layouts, page.componentPath).map((layout) => ({
3036
- id: toLayoutId(layout),
3037
- directory: layout.directory,
3038
- definition: layout
3039
- }));
3040
- if (page.layout === void 0) return defaultChain;
3041
- const isExclusive = page.layout.startsWith("!");
3042
- const resolved = resolveNamedLayout(isExclusive ? page.layout.slice(1) : page.layout, page.componentId, namedLayouts, page.componentPath);
3043
- if (!resolved) return defaultChain;
3044
- const namedEntry = {
3045
- id: toLayoutId(resolved),
3046
- directory: defaultChain.at(-1)?.directory ?? (page.componentPath ?? page.componentId).split("/").slice(0, -1).join("/"),
3047
- definition: resolved
3048
- };
3049
- if (isExclusive || defaultChain.length === 0) {
3050
- namedEntry.directory = (page.componentPath ?? page.componentId).split("/").slice(0, -1).join("/");
3051
- return [namedEntry];
3052
- }
3053
- const chain = [...defaultChain];
3054
- chain[chain.length - 1] = namedEntry;
3055
- return chain;
3056
- }
3057
- /** Resolve effective layout chain accounting for named layout selection */
3058
- function resolveEffectiveLayoutChain(page, layouts, namedLayouts) {
3059
- return resolveEffectiveLayoutEntries(page, layouts, namedLayouts).map((layout) => layout.definition);
3060
- }
3061
- function resolveLayoutIds(page, layouts, namedLayouts) {
3062
- return resolveEffectiveLayoutEntries(page, layouts, namedLayouts).map((layout) => layout.id);
3063
- }
3064
- // src/pages/boundary-plans.ts
3065
- const encloses = (outer, inner) => !outer || outer === inner || inner.startsWith(outer + "/");
3066
- /** Build-local render identities preserve a named layout's logical placement. */
3067
- function createBoundaryManifest(scan) {
3068
- if (!scan.boundaries?.length) return {
3069
- plans: {},
3070
- pages: {}
3071
- };
3072
- const plans = {};
3073
- const pages = {};
3074
- const pageIds = new Set(scan.pages.map((page) => page.componentId));
3075
- const layoutKey = (id) => pageIds.has(id) ? id.replace(/(^|\/)([^/]+)$/, "$1_$2") : id;
3076
- for (const page of scan.pages) {
3077
- const directory = page.componentPath.split("/").slice(0, -1).join("/");
3078
- const layouts = resolveEffectiveLayoutEntries(page, scan.layouts, scan.namedLayouts);
3079
- const candidates = (scan.boundaries ?? []).filter((b) => encloses(b.directory, directory)).sort((a, b) => b.directory.length - a.directory.length);
3080
- const add = (boundary) => {
3081
- const retained = layouts.filter((l) => encloses(l.directory, boundary.directory)).map((l) => layoutKey(l.id));
3082
- const id = `_void:boundary:${JSON.stringify([
3083
- page.componentId,
3084
- boundary.componentId,
3085
- retained
3086
- ])}`;
3087
- plans[id] = {
3088
- id,
3089
- ...boundary,
3090
- source: page.componentId,
3091
- layouts: retained
3092
- };
3093
- return id;
3094
- };
3095
- const errors = candidates.filter((b) => b.kind === "error");
3096
- const notFound = candidates.find((b) => b.kind === "not-found");
3097
- pages[page.componentId] = {
3098
- ...notFound ? {
3099
- notFound: add(notFound),
3100
- notFoundErrors: errors.filter((b) => encloses(b.directory, notFound.directory)).map(add)
3101
- } : {},
3102
- errors: errors.map(add),
3103
- catches: errors.map((b) => ({
3104
- depth: layouts.filter((l) => encloses(l.directory, b.directory)).length,
3105
- plan: add(b)
3106
- }))
3107
- };
3108
- }
3109
- const root = scan.boundaries?.find((b) => b.kind === "not-found" && !b.directory);
3110
- if (root) {
3111
- const id = `_void:boundary:root-not-found:${JSON.stringify(scan.layouts.filter((l) => !l.directory).map((l) => l.filePath))}`;
3112
- plans[id] = {
3113
- id,
3114
- ...root,
3115
- source: id,
3116
- layouts: scan.layouts.filter((l) => !l.directory).map((l) => layoutKey(l.directory ? l.directory + "/layout" : "layout"))
3117
- };
3118
- const error = scan.boundaries?.find((b) => b.kind === "error" && !b.directory);
3119
- const rootErrors = [];
3120
- if (error) {
3121
- const errorId = `_void:boundary:root-error:${id}`;
3122
- plans[errorId] = {
3123
- ...error,
3124
- id: errorId,
3125
- source: id,
3126
- layouts: [...plans[id].layouts]
3127
- };
3128
- rootErrors.push(errorId);
3129
- }
3130
- pages[id] = {
3131
- errors: rootErrors,
3132
- catches: rootErrors.map((plan) => ({
3133
- depth: plans[id].layouts.length,
3134
- plan
3135
- }))
3136
- };
3137
- return {
3138
- plans,
3139
- pages,
3140
- root: id,
3141
- rootErrors
3142
- };
3143
- }
3144
- return {
3145
- plans,
3146
- pages
3147
- };
3148
- }
3149
- // src/pages/manifest.ts
3150
- /**
3151
- * Generates the component import map and layout tree as code strings.
3152
- * Used by both SSR renderer and client entry virtual modules.
3153
- *
3154
- * Client entries load this eagerly, so it grows with every page. Each page id
3155
- * is written once, identical layout chains are shared, and static routes are
3156
- * matched by exact lookup instead of a RegExp per page. The emitted bindings
3157
- * (`components`, `layoutTree`, `routeMeta`, `matchRoute`) keep their shape;
3158
- * `matchRoute` takes a decoded pathname (see `decodePagePath`).
3159
- */
3160
- function generateComponentManifest(scan, pagesDir) {
3161
- const load = (filePath) => `() => import(${JSON.stringify(`${pagesDir}/${filePath}`)})`;
3162
- const pageIds = new Set(scan.pages.map((page) => page.componentId));
3163
- const layoutKey = (id) => {
3164
- if (!pageIds.has(id)) return id;
3165
- const slash = id.lastIndexOf("/");
3166
- return id.slice(0, slash + 1) + "_" + id.slice(slash + 1);
3167
- };
3168
- const chains = [];
3169
- const chainIndexes = /* @__PURE__ */ new Map();
3170
- const staticRows = [];
3171
- const dynamicRows = [];
3172
- let inStaticPrefix = true;
3173
- for (const page of scan.pages) {
3174
- const chain = JSON.stringify(resolveLayoutIds(page, scan.layouts, scan.namedLayouts).map(layoutKey));
3175
- let chainIndex = chain === "[]" ? -1 : chainIndexes.get(chain);
3176
- if (chainIndex === void 0) {
3177
- chainIndex = chains.push(chain) - 1;
3178
- chainIndexes.set(chain, chainIndex);
3179
- }
3180
- const id = JSON.stringify(page.componentId);
3181
- inStaticPrefix &&= isStaticPattern(page.pattern);
3182
- if (inStaticPrefix) {
3183
- const pattern = page.pattern === `/${page.componentId}` ? "" : `, ${JSON.stringify(page.pattern)}`;
3184
- staticRows.push(` [${id}, ${load(page.componentPath)}, ${chainIndex}${pattern}],`);
3185
- } else dynamicRows.push(` [${patternToRegex(page.pattern)}, ${id}, ${load(page.componentPath)}, ${chainIndex}],`);
3186
- }
3187
- const lines = [];
3188
- lines.push("const components = {};", `const __voidLayoutChains = [${chains.join(", ")}];`, "const __voidStaticRoutes = [", ...staticRows, "];", "const __voidDynamicRoutes = [", ...dynamicRows, "];", `const layoutTree = {};
3189
- const __voidStaticRouteIds = new Map();
3190
- for (const [id, load, chain, pattern = "/" + id] of __voidStaticRoutes) {
3191
- components[id] = load;
3192
- if (chain >= 0) layoutTree[id] = __voidLayoutChains[chain];
3193
- if (!__voidStaticRouteIds.has(pattern)) __voidStaticRouteIds.set(pattern, id);
3194
- }
3195
- const routes = [];
3196
- for (const [pattern, id, load, chain] of __voidDynamicRoutes) {
3197
- components[id] = load;
3198
- if (chain >= 0) layoutTree[id] = __voidLayoutChains[chain];
3199
- routes.push({ pattern, id });
3200
- }`);
3201
- for (const layout of [...scan.layouts, ...scan.namedLayouts]) lines.push(`components[${JSON.stringify(layoutKey(toLayoutId(layout)))}] = ${load(layout.filePath)};`);
3202
- for (const boundary of scan.boundaries ?? []) lines.push(`components[${JSON.stringify(boundary.componentId)}] = ${load(boundary.filePath)};`);
3203
- const boundaryManifest = createBoundaryManifest(scan);
3204
- lines.push(`const boundaryManifest = ${JSON.stringify(boundaryManifest)};`);
3205
- for (const plan of Object.values(boundaryManifest.plans)) lines.push(`components[${JSON.stringify(plan.id)}] = ${load(plan.filePath)};`, `layoutTree[${JSON.stringify(plan.id)}] = ${JSON.stringify(plan.layouts)};`);
3206
- lines.push("const routeMeta = {");
3207
- for (const page of scan.pages) {
3208
- const flags = [];
3209
- if (page.island) flags.push("island: true");
3210
- if (page.prerender === false) flags.push("prerender: false");
3211
- if (flags.length > 0) lines.push(` ${JSON.stringify(page.componentId)}: { ${flags.join(", ")} },`);
3212
- }
3213
- lines.push("};");
3214
- for (const plan of Object.values(boundaryManifest.plans)) lines.push(`routeMeta[${JSON.stringify(plan.id)}] = { boundary: true };`);
3215
- lines.push(`function matchRoute(path) {
3216
- const id = __voidStaticRouteIds.get(path);
3217
- if (id !== undefined) return id;
3218
- for (const r of routes) {
3219
- if (r.pattern.test(path)) return r.id;
3220
- }
3221
- return null;
3222
- }`);
3223
- return lines.join("\n");
3224
- }
3225
- const REGEX_SYNTAX = ".*+?^${}()|[]\\";
3226
- /** The capture group for `*`, `:name{.+}` and `:name`; other segments match as written. */
3227
- function captureGroup(segment) {
3228
- switch (routeSegmentKind(segment)) {
3229
- case "rest": return segment === "*" ? "(.*)" : "(.+)";
3230
- case "param": return String.raw`([^\/]+)`;
3231
- case "static": return;
3232
- }
3233
- }
3234
- /** Whether `patternToRegex` matches only the pattern's own text. */
3235
- function isStaticPattern(pattern) {
3236
- return pattern.split("/").every((segment) => routeSegmentKind(segment) === "static");
3237
- }
3238
- /** The RegExp literal a page pattern matches with, the same on the client and the server. */
3239
- function patternToRegex(pattern) {
3240
- const trailingWildcard = pattern.endsWith("/*/");
3241
- return `/^${(trailingWildcard ? pattern.slice(0, -2) : pattern).split("/").map((segment) => {
3242
- const group = captureGroup(segment);
3243
- if (group) return group;
3244
- let literal = "";
3245
- for (const char of segment) literal += REGEX_SYNTAX.includes(char) ? "\\" + char : char;
3246
- return literal;
3247
- }).join(String.raw`\/`)}${trailingWildcard ? String.raw`(?:(.*)\/)?` : ""}$/`;
3248
- }
3249
- // src/pages/scan.ts
3250
- const COMPONENT_EXTENSIONS = [
3251
- "vue",
3252
- "tsx",
3253
- "jsx",
3254
- "svelte",
3255
- "md"
3256
- ];
3257
- const PAGE_METHODS = /* @__PURE__ */ new Set([
3258
- "loader",
3259
- "action",
3260
- "actions"
3261
- ]);
3262
- const MAX_REVALIDATE = 31536e3;
3263
- /** Layout paths already reported; a dev server rescans pages on every file change. */
3264
- const warnedLayoutPaths = /* @__PURE__ */ new Set();
3265
- /** Unreachable pages already reported, for the same reason. */
3266
- const warnedShadowedPages = /* @__PURE__ */ new Set();
3267
- /** Ignored page settings already reported, for the same reason. */
3268
- const warnedPageSettings = /* @__PURE__ */ new Set();
3269
- /**
3270
- * Page settings (layout, revalidate, prerender, ssr) are read from the source
3271
- * without running it. One the source does not show keeps its default, as
3272
- * before, with a warning: a hard error would break builds that already ship it.
3273
- */
3274
- function warnPageSettings(pagesDir, warnings) {
3275
- for (const warning of warnings) {
3276
- const key = `${pagesDir}\0${warning}`;
3277
- if (!warnedPageSettings.has(key)) {
3278
- warnedPageSettings.add(key);
3279
- voidWarn(warning);
3280
- }
3281
- }
3282
- }
3283
- const LAYOUT_EXPORT = /* @__PURE__ */ new Set(["layout"]);
3284
- function mayExportLayout(source) {
3285
- return source.includes("layout") || mayExportAll(source);
3286
- }
3287
- /** The first script block that declares a readable layout wins; warnings only apply when none does. */
3288
- function componentLayout(source, filename) {
3289
- if (!mayExportLayout(source)) return {
3290
- layout: void 0,
3291
- warnings: []
3292
- };
3293
- let ignored;
3294
- let exportsAll = false;
3295
- for (const script of scriptBlocks(source, filename)) {
3296
- if (!mayExportLayout(script.source)) continue;
3297
- const exports = readStaticExports(script.filename, script.source, LAYOUT_EXPORT);
3298
- const initializer = exports.initializers.get("layout");
3299
- const value = staticLiteral(initializer);
3300
- if (typeof value === "string" || value === false) return {
3301
- layout: value,
3302
- warnings: []
3303
- };
3304
- if (script.instance) continue;
3305
- exportsAll ||= exports.exportsAll;
3306
- if (exports.unreadable.has("layout")) ignored ??= `pages: layout in '${filename}' is ignored. Declare it in that file as \`export const layout = '<name>'\`; re-exported layouts and other export forms are not read.`;
3307
- else if (initializer) ignored ??= `pages: layout in '${filename}' is ignored. It must be a string literal or \`false\`, such as \`export const layout = 'landing'\`.`;
3308
- }
3309
- if (ignored) return {
3310
- layout: void 0,
3311
- warnings: [ignored]
3312
- };
3313
- if (exportsAll) return {
3314
- layout: void 0,
3315
- warnings: [`pages: '${filename}' uses \`export * from\`. Void does not read a layout export through it, so declare layout in that file with \`export const\`.`]
3316
- };
3317
- return {
3318
- layout: void 0,
3319
- warnings: []
3320
- };
3321
- }
3322
- const TRANSPARENT_EXPRESSION_TYPES = /* @__PURE__ */ new Set([
3323
- "ParenthesizedExpression",
3324
- "TSAsExpression",
3325
- "TSNonNullExpression",
3326
- "TSSatisfiesExpression",
3327
- "TSTypeAssertion"
3328
- ]);
3329
- function readLiteral(node) {
3330
- while (node && TRANSPARENT_EXPRESSION_TYPES.has(node.type)) node = node.expression;
3331
- return isLiteral(node) ? node.value : void 0;
3332
- }
3333
- const PAGE_SETTINGS = [
3334
- "revalidate",
3335
- "prerender",
3336
- "ssr"
3337
- ];
3338
- const PAGE_SETTING_SET = new Set(PAGE_SETTINGS);
3339
- const PAGE_SETTING_PLACEHOLDERS = {
3340
- revalidate: "<seconds>",
3341
- prerender: "<boolean>",
3342
- ssr: "<boolean>"
3343
- };
3344
- /** Read revalidate, prerender and ssr from a page's server file, collecting warnings for values it cannot read. */
3345
- function readPageSettings(program, filename, metadata) {
3346
- const settings = staticExports(program, PAGE_SETTING_SET);
3347
- for (const name of PAGE_SETTINGS) {
3348
- if (settings.unreadable.has(name)) {
3349
- metadata.warnings.push(`pages: ${name} in '${filename}' is ignored. Declare it in that file as \`export const ${name} = ${PAGE_SETTING_PLACEHOLDERS[name]}\`; re-exported settings and other export forms are not read.`);
3350
- continue;
3351
- }
3352
- const initializer = settings.initializers.get(name);
3353
- if (!initializer) continue;
3354
- const value = readLiteral(initializer);
3355
- if (name === "revalidate") {
3356
- if (typeof value === "number" && Number.isInteger(value) && value >= 0) metadata.revalidate = value;
3357
- else metadata.warnings.push(`pages: revalidate in '${filename}' is ignored. It must be a nonnegative integer literal, such as \`export const revalidate = 3600\`.`);
3358
- } else if (typeof value === "boolean") metadata[name] = value;
3359
- else metadata.warnings.push(`pages: ${name} in '${filename}' is ignored. It must be \`true\` or \`false\`.`);
3360
- }
3361
- if (settings.exportsAll) metadata.warnings.push(`pages: '${filename}' uses \`export * from\`. Void does not see page exports through it, so export loader, action, actions and getPrerenderPaths by name, and declare revalidate, prerender and ssr in that file with \`export const\`.`);
3362
- }
3363
- function detectPageServerMetadata(source, filename) {
3364
- const metadata = {
3365
- methods: [],
3366
- warnings: []
3367
- };
3368
- let parsed;
3369
- try {
3370
- parsed = parseSync(filename, source);
3371
- } catch {
3372
- return metadata;
3373
- }
3374
- const program = asAstProgram(parsed.program);
3375
- for (const node of program.body ?? []) {
3376
- if (node.type !== "ExportNamedDeclaration") continue;
3377
- const exported = node;
3378
- if (exported.exportKind === "type") continue;
3379
- const declaration = exported.declaration;
3380
- if (declaration?.type === "VariableDeclaration") {
3381
- const variables = declaration;
3382
- for (const variable of variables.declarations ?? []) for (const name of bindingNames(variable.id)) if (PAGE_METHODS.has(name)) metadata.methods.push(name);
3383
- else if (name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
3384
- } else if (declaration?.type === "FunctionDeclaration") {
3385
- const functionName = declaration.id;
3386
- if (isIdentifier(functionName)) {
3387
- if (PAGE_METHODS.has(functionName.name)) metadata.methods.push(functionName.name);
3388
- else if (functionName.name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
3389
- }
3390
- }
3391
- for (const specifier of exported.specifiers ?? []) {
3392
- const name = moduleExportName(specifier.exported);
3393
- if (specifier.exportKind === "type" || name === void 0) continue;
3394
- if (PAGE_METHODS.has(name)) metadata.methods.push(name);
3395
- else if (name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
3396
- }
3397
- }
3398
- readPageSettings(program, filename, metadata);
3399
- return metadata;
3400
- }
3401
- function inferAutoPrerender(page, options) {
3402
- const isDynamic = page.params.length > 0 || page.catchAll;
3403
- if (options?.output === "static") return !isDynamic || page.hasGetPrerenderPaths === true;
3404
- return page.island === true && !page.methods.includes("loader") && !isDynamic;
3405
- }
3406
- function resolvePageRendering(page, options) {
3407
- if (page.island && page.ssr === false) throw new Error(`pages: ssr = false is not valid for island page '${page.componentPath}'.`);
3408
- const ssrMode = page.ssr === true ? "server" : page.ssr === false ? "client" : "auto";
3409
- const prerenderMode = page.prerender === true ? "force" : page.prerender === false ? "disabled" : "auto";
3410
- return {
3411
- ssrMode,
3412
- prerenderMode,
3413
- renderMode: page.island === true ? "island" : ssrMode === "client" ? "client" : "server",
3414
- shouldPrerender: prerenderMode === "force" || prerenderMode === "auto" && inferAutoPrerender(page, options)
3415
- };
3416
- }
3417
- /**
3418
- * The environment a file under pages/ is limited to, read from its name the way
3419
- * scanPages does: `home.dev.tsx`, `home.dev.island.vue` and `home.dev.server.ts`
3420
- * give 'dev'. Files the scanner skips (`_` segments, other extensions) give null.
3421
- */
3422
- function pageFileEnvironment(relativePath) {
3423
- const segments = toSlash(relativePath).split("/");
3424
- if (segments.some((segment) => segment.startsWith("_"))) return null;
3425
- const file = segments.at(-1) ?? "";
3426
- const ext = extname(file);
3427
- let base = basename$1(file, ext);
3428
- if (ROUTE_EXTENSIONS_SET.has(ext) && base.endsWith(".server")) base = base.slice(0, -7);
3429
- else if (COMPONENT_EXTENSIONS.includes(ext.slice(1))) {
3430
- if (base.endsWith(".island")) base = base.slice(0, -7);
3431
- } else return null;
3432
- return base.endsWith(".dev") ? "dev" : base.endsWith(".prod") ? "prod" : null;
3433
- }
3434
- async function scanPages(root, options) {
3435
- const trailingSlash = options?.trailingSlash ?? readConfig(root).routing?.trailingSlash;
3436
- const pagesDir = options?.pagesDir ?? options?.paths?.pagesDir ?? readProjectPaths(root).pagesDir;
3437
- if (!existsSync(pagesDir)) return {
3438
- pages: [],
3439
- layouts: [],
3440
- namedLayouts: []
3441
- };
3442
- const files = await glob(`**/*.{${COMPONENT_EXTENSIONS.join(",")}}`, {
3443
- cwd: pagesDir,
3444
- absolute: false
3445
- });
3446
- const pages = [];
3447
- const layouts = [];
3448
- const namedLayouts = [];
3449
- const boundaries = [];
3450
- for (const file of files.sort()) {
3451
- const segments = file.split("/");
3452
- const boundary = /^_(error|not-found)(?:\.(dev|prod))?(\.island)?\.(tsx|jsx|vue|svelte)$/.exec(file.slice(file.lastIndexOf("/") + 1));
3453
- if (boundary && !segments.slice(0, -1).some((segment) => segment.startsWith("_"))) {
3454
- const env = boundary[2];
3455
- if (options?.environment && env && env !== options.environment) continue;
3456
- const base = file.slice(0, -extname(file).length);
3457
- if (boundary[3] || ROUTE_EXTENSIONS.some((ext) => existsSync(join(pagesDir, `${base}.server.${ext}`))) || deriveFromSource(join(pagesDir, file), "page-boundary-layout", (source) => scriptBlocks(source, file).some((script) => readStaticExports(script.filename, script.source, /* @__PURE__ */ new Set(["layout"])).initializers.has("layout")))) throw new Error(`pages: Boundary '${file}' cannot be an island, select a layout, or have a .server companion.`);
3458
- const directory = segments.slice(0, -1).join("/");
3459
- for (const prior of boundaries) {
3460
- const priorEnv = /^_(?:error|not-found)\.(dev|prod)\./.exec(basename$1(prior.filePath))?.[1];
3461
- if (prior.directory === directory && prior.kind === boundary[1] && (!env || !priorEnv || env === priorEnv)) throw new Error(`pages: Ambiguous boundary files '${prior.filePath}' and '${file}'.`);
3462
- }
3463
- boundaries.push({
3464
- kind: boundary[1],
3465
- directory,
3466
- componentId: base,
3467
- filePath: file
3468
- });
3469
- continue;
3470
- }
3471
- if (segments.some((s) => s.startsWith("_") && s !== "_layouts")) continue;
3472
- const ext = extname(file);
3473
- let base = basename$1(file, ext);
3474
- if (base.endsWith(".server") && ROUTE_EXTENSIONS_SET.has(ext)) continue;
3475
- let island;
3476
- let hasIslandSuffix = false;
3477
- if (base.endsWith(".island")) {
3478
- island = true;
3479
- hasIslandSuffix = true;
3480
- base = base.slice(0, -7);
3481
- }
3482
- if (ext === ".md") island = true;
3483
- const layoutsDirIdx = segments.indexOf("_layouts");
3484
- if (layoutsDirIdx !== -1) {
3485
- if (layoutsDirIdx === segments.length - 2) namedLayouts.push({
3486
- name: base,
3487
- directory: segments.slice(0, layoutsDirIdx).join("/"),
3488
- filePath: file,
3489
- island
3490
- });
3491
- continue;
3492
- }
3493
- if (base === "layout") {
3494
- const dir = dirname$1(file);
3495
- layouts.push({
3496
- directory: dir === "." ? "" : dir,
3497
- filePath: file,
3498
- island
3499
- });
3500
- continue;
3501
- }
3502
- const route = parseRouteFilename(hasIslandSuffix ? file.replace(`.island${ext}`, ".ts") : file.replace(ext, ".ts"));
3503
- if (!isRouteEnabledForEnvironment(route, options?.environment)) continue;
3504
- const componentId = file.replace(ext, "").replace(/\.island$/, "").replace(/\/index$/, "").replace(/^index$/, "") || "index";
3505
- let serverPath = null;
3506
- const methods = [];
3507
- let revalidate;
3508
- let prerender;
3509
- let ssr;
3510
- let hasGetPrerenderPaths;
3511
- const serverBase = hasIslandSuffix ? file.replace(`.island${ext}`, "") : file.replace(ext, "");
3512
- for (const serverExt of ROUTE_EXTENSIONS) {
3513
- const candidate = `${serverBase}.server.${serverExt}`;
3514
- if (existsSync(join(pagesDir, candidate))) {
3515
- serverPath = candidate;
3516
- const metadata = deriveFromSource(join(pagesDir, candidate), "page-server", (source) => detectPageServerMetadata(source, candidate));
3517
- methods.push(...metadata.methods);
3518
- revalidate = metadata.revalidate;
3519
- prerender = metadata.prerender;
3520
- ssr = metadata.ssr;
3521
- hasGetPrerenderPaths = metadata.hasGetPrerenderPaths;
3522
- warnPageSettings(pagesDir, metadata.warnings);
3523
- break;
3524
- }
3525
- }
3526
- const rendering = resolvePageRendering({
3527
- componentPath: file,
3528
- island,
3529
- ssr,
3530
- prerender,
3531
- methods,
3532
- params: route.params,
3533
- catchAll: route.catchAll,
3534
- hasGetPrerenderPaths
3535
- }, options);
3536
- if (rendering.shouldPrerender && revalidate === void 0) revalidate = MAX_REVALIDATE;
3537
- let metadata;
3538
- let layout;
3539
- if (ext === ".md") {
3540
- const { default: matter } = await import("gray-matter");
3541
- ({metadata, layout} = deriveFromSource(join(pagesDir, file), "page-markdown", (source) => ({
3542
- metadata: extractFrontmatterMeta(source),
3543
- layout: extractFrontmatterLayout(source, matter)
3544
- })));
3545
- } else {
3546
- const component = deriveFromSource(join(pagesDir, file), "page-layout", (source) => componentLayout(source, file));
3547
- layout = component.layout;
3548
- warnPageSettings(pagesDir, component.warnings);
3549
- }
3550
- pages.push({
3551
- pattern: trailingSlash && route.pattern !== "/" ? `${route.pattern}/` : route.pattern,
3552
- params: route.params,
3553
- catchAll: route.catchAll,
3554
- componentPath: file,
3555
- serverPath,
3556
- methods,
3557
- componentId,
3558
- revalidate,
3559
- prerender,
3560
- ssr,
3561
- ...rendering,
3562
- hasGetPrerenderPaths,
3563
- island,
3564
- metadata: metadata ? { ...metadata } : void 0,
3565
- layout,
3566
- ...route.env ? { env: route.env } : {}
3567
- });
3568
- }
3569
- pages.sort(compareRouteSpecificity);
3570
- if (options?.checkRoutes !== false) {
3571
- const environments = options?.environment ? [options.environment] : ["dev", "prod"];
3572
- for (const environment of environments) {
3573
- const live = pages.filter((page) => isRouteEnabledForEnvironment({ env: page.env ?? null }, environment));
3574
- assertOnePagePerRoute(live);
3575
- warnShadowedPages(pagesDir, live);
3576
- }
3577
- }
3578
- for (const page of pages) {
3579
- if (page.island) continue;
3580
- const dir = dirname$1(page.componentPath);
3581
- const segments = dir === "." ? [] : dir.split("/");
3582
- const ancestors = /* @__PURE__ */ new Set(["", ...segments.map((_, index) => segments.slice(0, index + 1).join("/"))]);
3583
- if (layouts.some((l) => l.island && ancestors.has(l.directory))) throw new Error(`pages: Regular page '${page.componentPath}' is under an island layout. Add a .island suffix.`);
3584
- }
3585
- for (const page of pages) {
3586
- if (page.layout === void 0 || page.layout === false) continue;
3587
- const name = page.layout.startsWith("!") ? page.layout.slice(1) : page.layout;
3588
- if (name.startsWith(".") || name.startsWith("/")) {
3589
- const key = `${pagesDir}\0${page.componentPath}\0${page.layout}`;
3590
- if (!warnedLayoutPaths.has(key)) {
3591
- warnedLayoutPaths.add(key);
3592
- voidWarn(`pages: Page '${page.componentPath}' specifies layout '${page.layout}'. Layout paths are not supported, so the default layouts are used. Use the name of a file in a _layouts/ directory, such as 'landing'.`);
3593
- }
3594
- continue;
3595
- }
3596
- if (!resolveNamedLayout(name, page.componentId, namedLayouts, page.componentPath)) throw new Error(`pages: Page '${page.componentPath}' specifies layout '${page.layout}', but _layouts/${name}.vue was not found in any ancestor directory.`);
3597
- }
3598
- return {
3599
- pages,
3600
- layouts,
3601
- namedLayouts,
3602
- ...boundaries.length ? { boundaries } : {}
3603
- };
3604
- }
3605
- function compareText(left, right) {
3606
- return left < right ? -1 : left > right ? 1 : 0;
3607
- }
3608
- /** Group sorted pages by `key`, keeping only groups with more than one page. */
3609
- function pagesSharing(pages, key) {
3610
- const groups = /* @__PURE__ */ new Map();
3611
- for (const page of pages) {
3612
- const group = groups.get(key(page));
3613
- if (group) group.push(page);
3614
- else groups.set(key(page), [page]);
3615
- }
3616
- return [...groups.values()].filter((group) => group.length > 1);
3617
- }
3618
- /**
3619
- * Two files for one path have no stable winner: the server and the client can
3620
- * each pick a different one, and the order can change between runs.
3621
- */
3622
- function assertOnePagePerRoute(pages) {
3623
- assertNoneShare(pages, (page) => page.pattern, "pages: Multiple page files resolve to the same route:", "Keep one page file per route and rename or remove the others.");
3624
- assertNoneShare(pages, (page) => page.componentId, "pages: Multiple page files resolve to the same page id:", "Rename or remove one of them.");
3625
- }
3626
- function assertNoneShare(pages, key, title, hint) {
3627
- const clashes = pagesSharing(pages, key).map((group) => ({
3628
- key: key(group[0]),
3629
- files: group.map((page) => page.componentPath).sort(compareText)
3630
- })).sort((left, right) => compareText(left.key, right.key)).map((clash) => ` ${JSON.stringify(clash.key)}: ${clash.files.map((file) => JSON.stringify(file)).join(", ")}`);
3631
- if (clashes.length > 0) throw new Error([
3632
- title,
3633
- ...clashes,
3634
- hint
3635
- ].join("\n"));
3636
- }
3637
- /** Dynamic routes that match the same URLs, such as [id] and [slug]: only the first is ever used. */
3638
- function warnShadowedPages(pagesDir, pages) {
3639
- for (const [used, ...shadowed] of pagesSharing(pages, (page) => patternToRegex(page.pattern))) for (const page of shadowed) {
3640
- const key = `${pagesDir}\0${used.componentPath}\0${page.componentPath}`;
3641
- if (warnedShadowedPages.has(key)) continue;
3642
- warnedShadowedPages.add(key);
3643
- voidWarn(`pages: Page '${page.componentPath}' (${page.pattern}) is never used: '${used.componentPath}' (${used.pattern}) matches the same URLs first. Remove one of them.`);
3644
- }
3645
- }
3646
- /** Return the raw YAML frontmatter of markdown source, after any leading <script> block. */
3647
- function markdownFrontmatter(source) {
3648
- return source.replace(MARKDOWN_SCRIPT_RE, "").match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
3649
- }
3650
- /** Read a single-line `key: value` field, stripping surrounding quotes. */
3651
- function frontmatterField(yaml, key) {
3652
- return yaml.match(new RegExp(`^${key}:\\s*(.+)$`, "m"))?.[1]?.trim().replaceAll(/^["']|["']$/g, "");
3653
- }
3654
- /** Extract title and description from YAML frontmatter in markdown source. */
3655
- function extractFrontmatterMeta(source) {
3656
- const yaml = markdownFrontmatter(source);
3657
- if (yaml === void 0) return;
3658
- const title = frontmatterField(yaml, "title");
3659
- const description = frontmatterField(yaml, "description");
3660
- if (!title && !description) return;
3661
- return {
3662
- title,
3663
- description
3664
- };
3665
- }
3666
- /** Extract layout field from YAML frontmatter in markdown source. */
3667
- function extractFrontmatterLayout(source, matter) {
3668
- const yaml = markdownFrontmatter(source);
3669
- if (yaml === void 0) return;
3670
- let frontmatter;
3671
- try {
3672
- frontmatter = matter(`---\n${yaml}\n---`, {}).data;
3673
- } catch {
3674
- return;
3675
- }
3676
- const value = frontmatter.layout;
3677
- if (value === void 0 || value === null || value === "") return;
3678
- if (value === false || value === "false") return false;
3679
- return typeof value === "string" ? value : JSON.stringify(value);
3680
- }
3681
- export { globSync as S, isRouteEnabledForEnvironment as _, createBoundaryManifest as a, ROUTE_EXTENSIONS as b, resolveLayoutIds as c, editIslandSource as d, findIslandImports as f, compareRouteSpecificity as g, invalidateSourceAnalysis as h, patternToRegex as i, resolveNamedLayout as l, deriveFromSource as m, scanPages as n, resolveEffectiveLayoutChain as o, findStaticCssImports as p, generateComponentManifest as r, resolveLayoutChain as s, pageFileEnvironment as t, toLayoutId as u, parseRouteFilename as v, convertPathToPattern as x, parseWebSocketFilename as y };
3119
+ export { staticExports as a, bindingNames as c, convertPathToPattern as d, glob as f, readStaticExports as i, bindingResolver as l, invalidateSourceAnalysis as n, staticLiteral as o, globSync as p, mayExportAll as r, unwrapStaticExpression as s, deriveFromSource as t, walk as u };