void 1.11.0 → 1.12.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 (343) hide show
  1. package/dist/{account-cmd-Bbr5cHjm.mjs → account-cmd-D_0qJ9fx.mjs} +6 -6
  2. package/dist/{agents-DRo8gzni.mjs → agents-64FnLwxP.mjs} +6 -5
  3. package/dist/{application-analysis-XyUuNqYA.mjs → application-analysis-Cx2S63z5.mjs} +48 -22
  4. package/dist/{application-routing-DATqynKH.mjs → application-routing-BAXpnawu.mjs} +1 -1
  5. package/dist/{assets-DZBd7yqh.mjs → assets-Br6_BeFJ.mjs} +34 -27
  6. package/dist/{ast-Cv0JwXqb.mjs → ast-BkPQu7A0.mjs} +5 -1
  7. package/dist/{auth-BN0NU9dz.mjs → auth-Boz0lrb3.mjs} +1 -1
  8. package/dist/{auth-CCk9Seol.mjs → auth-DlLDymuc.mjs} +24 -12
  9. package/dist/{auth-link-CVxoyU81.mjs → auth-link-C97r9p2N.mjs} +6 -6
  10. package/dist/{auth-router-ChXKduRM.mjs → auth-router-BmzEgzYx.mjs} +5 -5
  11. package/dist/{better-auth-shared-B8W8tZxP.d.mts → better-auth-shared-BS3pDQbT.d.mts} +6 -6
  12. package/dist/{better-auth-shared-DRHo5FoG.mjs → better-auth-shared-BcqDt-37.mjs} +7 -2
  13. package/dist/{build-cmd-C3b13rRf.mjs → build-cmd-BaFsyZrz.mjs} +13 -12
  14. package/dist/{cache-B1WzZV60.mjs → cache-xO711ATQ.mjs} +6 -6
  15. package/dist/{cancel-deploy-BggXixU_.mjs → cancel-deploy-Di11ynsr.mjs} +5 -5
  16. package/dist/{cf-access-pejlJmuy.mjs → cf-access-DmkKPcAI.mjs} +0 -8
  17. package/dist/{cf-access-Dnyw8KFY.mjs → cf-access-FaIm95jA.mjs} +8 -4
  18. package/dist/{cf-build-output-bBx1gDll.mjs → cf-build-output-Ca201_n1.mjs} +27 -25
  19. package/dist/cf-build-output-Dy7N0hQN.mjs +1 -0
  20. package/dist/{cf-command-values-Ccl-zRhl.mjs → cf-command-values-5BPBRc9Z.mjs} +1 -1
  21. package/dist/cf-config-migrate-D271BTiw.mjs +1664 -0
  22. package/dist/{cf-worker-settings-CARs4Wy9.mjs → cf-worker-settings-BBdlhm9U.mjs} +1 -1
  23. package/dist/cli/cli.mjs +1 -1
  24. package/dist/cli/cloudflare-operation-process.mjs +17 -14
  25. package/dist/cli/env-schema-probe.d.mts +3 -1
  26. package/dist/cli/env-schema-probe.mjs +7 -8
  27. package/dist/{cli-main-DW09sVsT.mjs → cli-main-DlW6lB8s.mjs} +142 -88
  28. package/dist/{client-DGfZTE4V.mjs → client-DkYzDEC0.mjs} +1 -1
  29. package/dist/{client-DF6U7KLP.mjs → client-ImIe7Mjq.mjs} +186 -17
  30. package/dist/{cloudflare-auth-pNvmT6kL.mjs → cloudflare-auth-eWfhdZCk.mjs} +1 -1
  31. package/dist/{cloudflare-cmd-BOhToob3.mjs → cloudflare-cmd-SsFlJe2B.mjs} +7 -8
  32. package/dist/{cloudflare-config-D1dMHbvz.mjs → cloudflare-config-D9UFH_A5.mjs} +2 -2
  33. package/dist/{cloudflare-connect-DTrsIBAa.mjs → cloudflare-connect-BgpHcSg3.mjs} +3 -3
  34. package/dist/{cloudflare-operations-DmqtzoX4.mjs → cloudflare-operations-BF0PSErW.mjs} +12 -20
  35. package/dist/{cloudflare-operations-BditDbcd.mjs → cloudflare-operations-dpRD-2Px.mjs} +1 -1
  36. package/dist/cloudflare-process-60r4Z2Zf.mjs +671 -0
  37. package/dist/cloudflare-user-output-CCR99eQY.mjs +19 -0
  38. package/dist/collect-B6nlSnsb.mjs +1 -0
  39. package/dist/{collect-C6Blu9yw.mjs → collect-rNLybAnF.mjs} +3 -3
  40. package/dist/{config-Do7gJI3T.mjs → config-BFX5ZB1J.mjs} +5 -4
  41. package/dist/{config-CeZd67L0.mjs → config-BSoW3QCB.mjs} +5 -5
  42. package/dist/{config-DYW2TBgz.d.mts → config-DA6ZbLXO.d.mts} +1 -1
  43. package/dist/{config-dMSpL-ml.mjs → config-DtjrUtPo.mjs} +1 -1
  44. package/dist/{config-BmvqLnbi.mjs → config-Dv5jri1-.mjs} +4 -4
  45. package/dist/config-entry.d.mts +1 -1
  46. package/dist/{connect-B3bKxRzX.mjs → connect-DDRQGfFE.mjs} +9 -9
  47. package/dist/{create-project-DLUlxmf5.mjs → create-project-CY7sP8sI.mjs} +7 -6
  48. package/dist/{create-project-By7ymK7F.mjs → create-project-Dro3K-az.mjs} +1 -1
  49. package/dist/{db-3qsP21pH.mjs → db-DmlaWVBu.mjs} +120 -103
  50. package/dist/db-seed-loader-Bcz_SutQ.mjs +253 -0
  51. package/dist/{db-types-DC7KJLx2.mjs → db-types-B4Cf9dzR.mjs} +1 -1
  52. package/dist/{delete-HbFqgEFC.mjs → delete-Uuq9ch6o.mjs} +6 -6
  53. package/dist/{deploy-2QjsBEGw.mjs → deploy-B9E7_rHC.mjs} +218 -553
  54. package/dist/deploy-BB3rsZbP.mjs +2 -0
  55. package/dist/{deploy-managed-static-JoNP3cec.mjs → deploy-managed-static-IKZyuc1W.mjs} +115 -194
  56. package/dist/deploy-security-notice-C3LalelR.mjs +192 -0
  57. package/dist/{deploy-transport-QAkhJYRI.mjs → deploy-transport-BKP_oV9q.mjs} +4 -4
  58. package/dist/deploy.mjs +9 -9
  59. package/dist/{dev-inbox-BiamQEAa.mjs → dev-inbox-ClVjKEHy.mjs} +1 -1
  60. package/dist/direct-r2-upload-DFXLWfXV.mjs +204 -0
  61. package/dist/discover-D2KGP3cR.mjs +1 -0
  62. package/dist/{discover-Vd18lHsj.mjs → discover-IcspacCg.mjs} +1 -1
  63. package/dist/{dispatch-BlOYh1Vc.mjs → dispatch-DIhDA3NI.mjs} +11 -10
  64. package/dist/{dist-Cp4b1_T9.mjs → dist-C47zy_kJ.mjs} +1 -1
  65. package/dist/{dist-STQXl8ck.mjs → dist-Cr_xGE_K.mjs} +73 -38
  66. package/dist/{domain-COkVSfII.mjs → domain-B_xY1yZ5.mjs} +8 -10
  67. package/dist/{dotenv-CEI8hapP.mjs → dotenv-BG6RQavH.mjs} +2 -2
  68. package/dist/{drizzle-BXVOa6Jg.mjs → drizzle-BJDMPrj7.mjs} +3 -4
  69. package/dist/{drizzle-CvSGrvdl.mjs → drizzle-CQ5jWuDL.mjs} +1 -1
  70. package/dist/{email-Dj02fLgQ.mjs → email-BIC15L7a.mjs} +33 -30
  71. package/dist/{email-cloudflare-DDknDAgp.mjs → email-cloudflare-C447nOqq.mjs} +29 -38
  72. package/dist/{email-pattern-BYr-EFq5.mjs → email-pattern-bRna9MOJ.mjs} +2 -2
  73. package/dist/{entry-DMgR7XOf.mjs → entry-Bwb9ev8K.mjs} +13 -10
  74. package/dist/{env-BA7e5yzp.mjs → env-DJPZYHT5.mjs} +8 -8
  75. package/dist/{env-UqS-21xi.mjs → env-EjHqc7m9.mjs} +1 -1
  76. package/dist/{env-types-WEZw5D-r.mjs → env-types-D2hBodXP.mjs} +2 -19
  77. package/dist/{env-validation-DfJ9Fzfa.mjs → env-validation-D-v5_CWL.mjs} +13 -13
  78. package/dist/{env-validation-ly_Q9Kgd.mjs → env-validation-j9pjCDfA.mjs} +1 -1
  79. package/dist/{error-pages-QNeBXiRR.mjs → error-pages-GORL6F_e.mjs} +1 -1
  80. package/dist/{fetch-CbI6lNnk.d.mts → fetch-CczQyIed.d.mts} +1 -1
  81. package/dist/{fetch-DdK9eGin.mjs → fetch-CiEsvjpP.mjs} +1 -1
  82. package/dist/{fetch-stream-DQAavFdm.mjs → fetch-stream-BIG5lHW6.mjs} +3 -4
  83. package/dist/{fetch-stream-DoED9atq.d.mts → fetch-stream-DRX8-83b.d.mts} +2 -2
  84. package/dist/gen-CQDiPi8m.mjs +1 -0
  85. package/dist/{gen-EMpnzNGz.mjs → gen-DiTZlDx8.mjs} +21 -18
  86. package/dist/{generate-BOp1g1H_.mjs → generate-C3ZAqCy-.mjs} +1 -1
  87. package/dist/{generate-CWb8aOsm.mjs → generate-Dq2Bgw75.mjs} +6 -6
  88. package/dist/{git-metadata-Cukp5kV5.mjs → git-metadata-BEokJ6US.mjs} +1 -1
  89. package/dist/{github-cmd-8bXgJNAQ.mjs → github-cmd-DPmby8x-.mjs} +14 -9
  90. package/dist/{handler-w_FAiIRu.mjs → handler-DCrDLzw2.mjs} +3 -3
  91. package/dist/has-own-key-D9QEnAkF.mjs +5 -0
  92. package/dist/{head-0o0QoREY.mjs → head-BwQ5kgqt.mjs} +5 -4
  93. package/dist/{head-CVO92KEx.d.mts → head-fUp8n_QJ.d.mts} +9 -4
  94. package/dist/{headers-BjgvlY29.mjs → headers-DqBsjDxg.mjs} +7 -7
  95. package/dist/{help-DCQKp3Kp.mjs → help-9wfMyXHb.mjs} +130 -60
  96. package/dist/help-Dy3w4rPq.mjs +1 -0
  97. package/dist/{inbound-BHt4dIlL.d.mts → inbound-CwgZSqFI.d.mts} +9 -3
  98. package/dist/{inbound--OF7zkwX.mjs → inbound-feMn1Rxx.mjs} +7 -7
  99. package/dist/{index-CmqHYj2R.d.mts → index-8cAgNdb6.d.mts} +1 -1
  100. package/dist/{index-BTmhCDbw.d.mts → index-BQ5qYiAw.d.mts} +2 -2
  101. package/dist/{index-BESZTC1z.d.mts → index-BYcWajVp.d.mts} +2 -1
  102. package/dist/{index-BXdP39qx.d.mts → index-Dn2mkPr2.d.mts} +24 -23
  103. package/dist/index.d.mts +2 -2
  104. package/dist/index.mjs +341 -444
  105. package/dist/{info--jdAIsJN.mjs → info-BWEWaOBo.mjs} +4 -4
  106. package/dist/{init-BLZvktk_.mjs → init-BuTPVLPO.mjs} +69 -335
  107. package/dist/{isr-config-Czzb4mIq.mjs → isr-config-DiTnL9Tb.mjs} +5 -5
  108. package/dist/{link-DPJ4jN7y.mjs → link-BiesPyT4.mjs} +7 -7
  109. package/dist/{list-B-au6xJt.mjs → list-CkonftPQ.mjs} +11 -7
  110. package/dist/{live-DvtxTUhW.mjs → live-dvGThbwy.mjs} +14 -17
  111. package/dist/{load-user-env-BltIJLtl.mjs → load-user-env-B8qC0Q2Y.mjs} +1 -1
  112. package/dist/{local-d1-C6xn26Nl.mjs → local-d1-CYOYkVwO.mjs} +3 -3
  113. package/dist/{login-p1_BMgXg.mjs → login-BSOSah1j.mjs} +8 -6
  114. package/dist/login-DWCZeCX9.mjs +1 -0
  115. package/dist/{logs-UNH3vQeX.mjs → logs-HOBUnroa.mjs} +9 -9
  116. package/dist/{migrate-9dlt6Mxu.mjs → migrate-BNZL1hee.mjs} +9 -10
  117. package/dist/migrate-C9aoWLvY.mjs +1 -0
  118. package/dist/{migrations-Cbns2RAm.mjs → migrations-CUHhX65Y.mjs} +5 -5
  119. package/dist/{mime-BGoZ8ZLL.mjs → mime-Btw9R3CC.mjs} +26 -12
  120. package/dist/{mysql-sql-SlpS6OMg.mjs → mysql-sql-CB52k8tQ.mjs} +45 -22
  121. package/dist/nitro.d.mts +3 -0
  122. package/dist/nitro.mjs +14 -5
  123. package/dist/{node-DqkiQujF.mjs → node-DVJWfV6s.mjs} +6 -6
  124. package/dist/{operator-ai-logging-BQ6mOgQs.mjs → operator-ai-logging-ZDqqhnIq.mjs} +11 -10
  125. package/dist/operator-args-DCkWbgT-.mjs +1499 -0
  126. package/dist/{operator-auth-CD3pap65.mjs → operator-auth-BjoPLgja.mjs} +2 -2
  127. package/dist/{operator-client-XvXTkea6.mjs → operator-client-DzebIntv.mjs} +3 -3
  128. package/dist/{operator-cmd-CKbZbNKn.mjs → operator-cmd-AZoeI9Pl.mjs} +28 -12
  129. package/dist/operator-cmd-DEnHFmJF.mjs +1 -0
  130. package/dist/operator-security-Bo26FP01.mjs +263 -0
  131. package/dist/{output-Bc8ixgPF.mjs → output-BZLnu0z8.mjs} +13 -3
  132. package/dist/output-D7K9TWIA.mjs +1 -0
  133. package/dist/{package-json-DvS6IFRv.mjs → package-json-4xUI3xLz.mjs} +1 -1
  134. package/dist/pages/client.d.mts +53 -30
  135. package/dist/pages/client.mjs +93 -31
  136. package/dist/pages/head.d.mts +1 -1
  137. package/dist/pages/head.mjs +1 -1
  138. package/dist/pages/index.d.mts +2 -2
  139. package/dist/pages/index.mjs +7 -7
  140. package/dist/pages/islands-plugin.d.mts +26 -8
  141. package/dist/pages/islands-plugin.mjs +61 -22
  142. package/dist/pages/protocol.d.mts +2 -2
  143. package/dist/pages/protocol.mjs +1 -1
  144. package/dist/pages/serialize.mjs +1 -1
  145. package/dist/{pgpass-CEtnBOZO.mjs → pgpass-BLPoYN9_.mjs} +3 -2
  146. package/dist/platform-args-DNbNZ_RR.mjs +1 -0
  147. package/dist/{platform-args-DQSMW4EP.mjs → platform-args-lwCyQ6Xy.mjs} +37 -9
  148. package/dist/{platform-auth-config-D80AKe72.mjs → platform-auth-config-DLRMPw1G.mjs} +26 -23
  149. package/dist/{platform-auth-protection-k1Ox-u9T.mjs → platform-auth-protection-HSmLmD3d.mjs} +10 -10
  150. package/dist/{platform-auth-recovery-D-hKehPy.mjs → platform-auth-recovery-BXPhTlKa.mjs} +11 -9
  151. package/dist/{platform-cmd-Dtz5lw7R.mjs → platform-cmd-CqRjxFEU.mjs} +1 -1
  152. package/dist/{platform-cmd-DQ0Wi61H.mjs → platform-cmd-DJ-fOYhL.mjs} +11 -11
  153. package/dist/{platform-discovery-B0eZjZ3B.mjs → platform-discovery-CLxtixHJ.mjs} +1 -1
  154. package/dist/{platform-domain-BMGS4l74.mjs → platform-domain-CRsRJOws.mjs} +14 -10
  155. package/dist/{platform-lifecycle-y4AfmC7M.mjs → platform-lifecycle-bx_kpqo7.mjs} +1 -1
  156. package/dist/{platform-lifecycle-BCkNQNsQ.mjs → platform-lifecycle-fau3VKv6.mjs} +755 -207
  157. package/dist/platform-management-BRGhD-oF.mjs +1 -0
  158. package/dist/{platform-management-Cj2aXFqD.mjs → platform-management-CnKBdDx5.mjs} +227 -58
  159. package/dist/{platform-plans-config-CrUUzEl9.mjs → platform-plans-config-2C3_5EDs.mjs} +112 -35
  160. package/dist/{platform-recovery-DKZnALHI.mjs → platform-recovery-poxgOOAY.mjs} +5 -5
  161. package/dist/{platform-registry-DZ_2Xuqd.mjs → platform-registry-DHH6fivm.mjs} +6 -5
  162. package/dist/{platform-setup-CKmSEb1J.mjs → platform-setup-DYylapHD.mjs} +26 -12
  163. package/dist/{plugin-inference-B_urWd5Z.mjs → plugin-inference-7O11_E4H.mjs} +26 -26
  164. package/dist/{prepare-vCdm5moJ.mjs → prepare-BbvlKreR.mjs} +12 -12
  165. package/dist/prepare-BmG2E6TI.mjs +1 -0
  166. package/dist/{prepare-CU7SZieQ.mjs → prepare-DWjn1Lzd.mjs} +3 -3
  167. package/dist/{project-cmd-B4cgPSi4.mjs → project-cmd-DyUEFi2b.mjs} +30 -24
  168. package/dist/{project-CLwxcEdq.mjs → project-dh9431bN.mjs} +2 -2
  169. package/dist/{project-paths-CUhCPMpK.mjs → project-paths-2ENfCCih.mjs} +4 -3
  170. package/dist/project-security--tYGFPGo.mjs +1340 -0
  171. package/dist/project-security-DZEQgnsS.mjs +1 -0
  172. package/dist/{project-team-BdX6anO3.mjs → project-team-BszTHgzC.mjs} +8 -8
  173. package/dist/{project-token-C1rcq8Xb.mjs → project-token-DBDy4NdV.mjs} +6 -6
  174. package/dist/{project-tsconfig-MyRJgufB.mjs → project-tsconfig-BOA4ym99.mjs} +25 -5
  175. package/dist/{project-DVsTAWFh.mjs → project-uXKua1it.mjs} +1 -1
  176. package/dist/project-zero-trust-D9sUouij.mjs +210 -0
  177. package/dist/{protocol-W5EQcIzN.mjs → protocol-CE3wP-H1.mjs} +5 -5
  178. package/dist/{protocol-BlAiF-hc.d.mts → protocol-ERy-n3jf.d.mts} +7 -4
  179. package/dist/{provision-DWnnKdT-.mjs → provision-Bh44omGA.mjs} +30 -22
  180. package/dist/{provision-CGI-T0mq.mjs → provision-DFv7SJDn.mjs} +1 -1
  181. package/dist/{public-B80SwOFp.d.mts → public-DB9C2Cy_.d.mts} +5 -2
  182. package/dist/{raw-7pQirZpQ.mjs → raw-5rak34QN.mjs} +2 -1
  183. package/dist/{redirect-Dqb4fEc5.mjs → redirect-DD825Stf.mjs} +1 -1
  184. package/dist/{requests-D6MaLS_Y.mjs → requests-CBokjiOi.mjs} +6 -6
  185. package/dist/{resolve-project-Da3OgCU1.mjs → resolve-project-8WZ3iVmr.mjs} +3 -3
  186. package/dist/resolve-project-YsTH-U9I.mjs +1 -0
  187. package/dist/{rollback-Bs8I8PF8.mjs → rollback-CEeHNFUn.mjs} +16 -7
  188. package/dist/route-types-CSed9-Dp.mjs +435 -0
  189. package/dist/{route-url-BBdkU7rb.mjs → route-url-B41eQ8QI.mjs} +1 -1
  190. package/dist/{route-url-Di1kB8D_.d.mts → route-url-Bd6IX-JZ.d.mts} +2 -1
  191. package/dist/routes-stub.d.mts +1 -1
  192. package/dist/routes-stub.mjs +1 -1
  193. package/dist/{runner-CTk21HrO.mjs → runner-Bf94YVJK.mjs} +1 -1
  194. package/dist/{runner-CMZb7jNU.mjs → runner-CeguHWJx.mjs} +3 -2
  195. package/dist/{runner-mysql-CJ-HyqxV.mjs → runner-mysql-3XDKrn-g.mjs} +13 -9
  196. package/dist/{runner-mysql-C_PrAUTm.mjs → runner-mysql-r688x6Y9.mjs} +1 -1
  197. package/dist/{runner-pg-mYc75KfH.mjs → runner-pg-Buzw17hl.mjs} +1 -1
  198. package/dist/{runner-pg-2pjltt0t.mjs → runner-pg-DMJquR3d.mjs} +1 -1
  199. package/dist/runtime/ai/index.mjs +2 -2
  200. package/dist/runtime/auth/better-auth-d1.d.mts +1 -1
  201. package/dist/runtime/auth/better-auth-d1.mjs +2 -2
  202. package/dist/runtime/auth/better-auth-mysql.d.mts +1 -1
  203. package/dist/runtime/auth/better-auth-mysql.mjs +2 -2
  204. package/dist/runtime/auth/better-auth-postgres.d.mts +1 -1
  205. package/dist/runtime/auth/better-auth-postgres.mjs +3 -3
  206. package/dist/runtime/client/fetch-server.d.mts +1 -1
  207. package/dist/runtime/client/fetch-server.mjs +2 -2
  208. package/dist/runtime/client/fetch-stream.d.mts +2 -2
  209. package/dist/runtime/client/fetch-stream.mjs +1 -1
  210. package/dist/runtime/client/fetch.d.mts +1 -1
  211. package/dist/runtime/client/fetch.mjs +1 -1
  212. package/dist/runtime/client/index.d.mts +2 -2
  213. package/dist/runtime/client/index.mjs +2 -2
  214. package/dist/runtime/client/react.d.mts +2 -2
  215. package/dist/runtime/client/react.mjs +2 -2
  216. package/dist/runtime/client/solid.d.mts +2 -2
  217. package/dist/runtime/client/solid.mjs +2 -2
  218. package/dist/runtime/client/svelte.d.mts +2 -2
  219. package/dist/runtime/client/svelte.mjs +2 -2
  220. package/dist/runtime/client/vue.d.mts +2 -2
  221. package/dist/runtime/client/vue.mjs +2 -2
  222. package/dist/runtime/db/index.d.mts +1 -1
  223. package/dist/runtime/db/index.mjs +3 -3
  224. package/dist/runtime/db/migrations/mysql-handler.mjs +1 -1
  225. package/dist/runtime/db/migrations/postgres-handler.mjs +1 -1
  226. package/dist/runtime/db/session.d.mts +1 -1
  227. package/dist/runtime/db/session.mjs +1 -1
  228. package/dist/runtime/durable/index.mjs +7 -5
  229. package/dist/runtime/email/index.d.mts +1 -1
  230. package/dist/runtime/email/index.mjs +14 -11
  231. package/dist/runtime/email/testing.d.mts +1 -1
  232. package/dist/runtime/email/testing.mjs +4 -4
  233. package/dist/runtime/env/public-client.d.mts +4 -1
  234. package/dist/runtime/env/public.d.mts +1 -1
  235. package/dist/runtime/env/public.mjs +2 -2
  236. package/dist/runtime/env/runtime.mjs +1 -1
  237. package/dist/runtime/handler/index.d.mts +1 -1
  238. package/dist/runtime/handler/index.mjs +1 -1
  239. package/dist/runtime/handler/validator.d.mts +1 -1
  240. package/dist/runtime/handler/validator.mjs +1 -1
  241. package/dist/runtime/isr/index.mjs +1 -1
  242. package/dist/runtime/kv/index.mjs +1 -1
  243. package/dist/runtime/live/client.d.mts +2 -2
  244. package/dist/runtime/live/client.mjs +7 -7
  245. package/dist/runtime/live/index.d.mts +1 -1
  246. package/dist/runtime/live/index.mjs +1 -1
  247. package/dist/runtime/live/server.mjs +3 -3
  248. package/dist/runtime/queues/index.mjs +2 -2
  249. package/dist/runtime/remote/index.d.mts +5 -1
  250. package/dist/runtime/remote/index.mjs +10 -9
  251. package/dist/runtime/routing/index.d.mts +11 -12
  252. package/dist/runtime/routing/index.mjs +69 -65
  253. package/dist/runtime/routing/route-url.d.mts +1 -1
  254. package/dist/runtime/routing/route-url.mjs +1 -1
  255. package/dist/runtime/sandbox/index.d.mts +1 -1
  256. package/dist/runtime/sandbox/index.mjs +2 -2
  257. package/dist/runtime/sse/client.d.mts +1 -1
  258. package/dist/runtime/sse/index.mjs +1 -1
  259. package/dist/runtime/storage/index.mjs +1 -1
  260. package/dist/runtime/ws/index.d.mts +1 -1
  261. package/dist/runtime/ws/index.mjs +3 -2
  262. package/dist/runtime/ws/room.d.mts +1 -1
  263. package/dist/runtime/ws/room.mjs +2 -2
  264. package/dist/runtime/ws/server.d.mts +2 -2
  265. package/dist/runtime/ws/server.mjs +1 -1
  266. package/dist/{runtime-zDDinDI5.mjs → runtime-C_VPIJBF.mjs} +1 -1
  267. package/dist/{scan-LjuG3vfA.mjs → scan-Ct_SEzH4.mjs} +36 -29
  268. package/dist/{secret-DdUs8AuR.mjs → secret-Deqo3n_N.mjs} +11 -10
  269. package/dist/security-api-types-CU7zQtr_.mjs +9 -0
  270. package/dist/security-sarif-ClyYwtAW.mjs +123 -0
  271. package/dist/{serialize-Pf-CIQK_.mjs → serialize-BmB4BfKu.mjs} +1 -1
  272. package/dist/{server-CfUbeOjx.mjs → server-T-4mn8zy.mjs} +5 -4
  273. package/dist/{session-Cw8-b8Um.mjs → session-BT8XDkvL.mjs} +1 -1
  274. package/dist/{session-DgNrdNh_.d.mts → session-ouZYD7zb.d.mts} +1 -1
  275. package/dist/{skills-B40svMBE.mjs → skills-C-csz78e.mjs} +3 -3
  276. package/dist/{sse-BXnTfcf3.mjs → sse-D3ab0YQT.mjs} +16 -13
  277. package/dist/{static-exports-DFkzL-NX.mjs → static-exports-s7P86Ngp.mjs} +3 -3
  278. package/dist/{subcommand-prompt-D-m3Umap.mjs → subcommand-prompt-B4LOLosl.mjs} +31 -21
  279. package/dist/sveltekit.mjs +1 -1
  280. package/dist/{terminal-log-text-DNsWJREL.mjs → terminal-log-text-CfS2JKM6.mjs} +1 -1
  281. package/dist/{url-DaehRGKR.mjs → url-DBQluotE.mjs} +4 -1
  282. package/dist/validate-CZYUIfR-.mjs +1 -0
  283. package/dist/{validate-Ddzl-IwT.mjs → validate-CtBWCzez.mjs} +7 -4
  284. package/dist/{validator-Duafcnh7.mjs → validator-Dfh9kCDm.mjs} +5 -5
  285. package/dist/{version-metadata-k6KFiyWt.mjs → version-metadata-DqgLa6gc.mjs} +1 -1
  286. package/dist/{wrangler-v2BmVchV.mjs → wrangler-DVe5KV5G.mjs} +49 -46
  287. package/dist/wrangler-Dq269bjx.mjs +1 -0
  288. package/dist/{wrapper-eh6MpBZA.mjs → wrapper-CcMYpOS8.mjs} +45 -171
  289. package/docs/guide/app-types.md +1 -1
  290. package/docs/guide/auth.md +2 -16
  291. package/docs/guide/database.md +2 -0
  292. package/docs/guide/email/domains.md +1 -1
  293. package/docs/guide/email/sending.md +18 -1
  294. package/docs/guide/pages-routing/actions-and-forms.md +4 -4
  295. package/docs/guide/pages-routing/head.md +20 -2
  296. package/docs/guide/platform/administration/plans.md +13 -0
  297. package/docs/guide/platform/administration/security-audits.md +213 -0
  298. package/docs/guide/platform/administration/zero-trust.md +6 -0
  299. package/docs/guide/platform/installation/ci.md +1 -1
  300. package/docs/guide/platform/installation/credentials.md +23 -20
  301. package/docs/guide/platform/installation/maintenance.md +8 -2
  302. package/docs/guide/platform/installation/prerequisites.md +1 -1
  303. package/docs/guide/platform/installation/uninstall.md +2 -0
  304. package/docs/guide/platform-administration.md +1 -0
  305. package/docs/guide/self-hosted-platform.md +14 -13
  306. package/docs/guide/type-safety.md +1 -1
  307. package/docs/integrations/cloudflare.md +3 -1
  308. package/docs/reference/api/handlers.md +3 -3
  309. package/docs/reference/api/types.md +11 -1
  310. package/docs/reference/cli/deploy.md +5 -1
  311. package/docs/reference/cli/domains.md +1 -1
  312. package/docs/reference/cli/platform-config.md +5 -3
  313. package/docs/reference/cli/platform-installation.md +29 -28
  314. package/docs/reference/cli/platform-security.md +98 -0
  315. package/docs/reference/cli/platform-zero-trust.md +2 -0
  316. package/docs/reference/cli/platform.md +1 -0
  317. package/docs/reference/cli/project.md +57 -0
  318. package/docs/reference/cli.md +3 -1
  319. package/docs/reference/config.md +2 -2
  320. package/package.json +30 -27
  321. package/skills/void/SKILL.md +7 -0
  322. package/dist/cf-build-output-D3_x71H6.mjs +0 -1
  323. package/dist/cf-config-migrate-CHtnM3_C.mjs +0 -348
  324. package/dist/cloudflare-process-wcnaQ5JG.mjs +0 -392
  325. package/dist/cloudflare-user-output-zEwuGrEJ.mjs +0 -19
  326. package/dist/collect-8i0wU63d.mjs +0 -1
  327. package/dist/deploy-DiFfBu8g.mjs +0 -2
  328. package/dist/discover-Diq0l6TZ.mjs +0 -1
  329. package/dist/gen-CuANrEzy.mjs +0 -1
  330. package/dist/help-7EzLA1qP.mjs +0 -1
  331. package/dist/login-apwve7WD.mjs +0 -1
  332. package/dist/migrate-BzRplq7m.mjs +0 -1
  333. package/dist/operator-args-BCCohcz3.mjs +0 -722
  334. package/dist/operator-cmd-D42knxMz.mjs +0 -1
  335. package/dist/output-D4UOUifX.mjs +0 -1
  336. package/dist/platform-args-Rgp86xa7.mjs +0 -1
  337. package/dist/platform-management-CRzeC70H.mjs +0 -1
  338. package/dist/prepare-C2MTqfFv.mjs +0 -1
  339. package/dist/project-zero-trust-CS02LrlK.mjs +0 -64
  340. package/dist/resolve-project-C5wC-Hoi.mjs +0 -1
  341. package/dist/route-types-CrODgORq.mjs +0 -655
  342. package/dist/validate-DY1U9rET.mjs +0 -1
  343. package/dist/wrangler-BPIAJdxA.mjs +0 -1
package/dist/index.mjs CHANGED
@@ -1,51 +1,52 @@
1
1
  import { n as __toESM } from "./rolldown-runtime-uD8oG6U2.mjs";
2
- import { a as join, c as resolve, i as isAbsolute, n as dirname, o as normalize, s as relative, t as basename } from "./dist-DMYe8CZJ.mjs";
2
+ import { a as join, c as resolve, i as isAbsolute, l as toSlash, n as dirname, o as normalize, s as relative, t as basename } from "./dist-DMYe8CZJ.mjs";
3
3
  import { t as require_picocolors } from "./picocolors-D1NxSLw-.mjs";
4
- import { a as hasSandboxSqliteMigration, c as sandboxContainerConfig, f as scanQueuesSync, h as scanJobsSync, i as assertSandboxNamespaceConfig, n as DEFAULT_SANDBOX_CLASS_NAME, r as SANDBOX_MIGRATION_TAG, s as resolveSandboxConfig, t as analyzeApplicationSync, u as hasEmailHandlers } from "./application-analysis-XyUuNqYA.mjs";
5
- import { l as inferBindingsFromSource, m as applyBindingOverrides, n as FRAMEWORK_SCAN_DIRS, t as DEFAULT_SCAN_DIRS, u as staticModuleReferences } from "./plugin-inference-B_urWd5Z.mjs";
6
- import { a as isAssetBypassRule, d as hasDocumentRoutes, l as edgeRulesNeedWorker, n as mergeRoutingRules, o as isGeneratedAssetHeaders, p as resolveAssetRoutingPolicy, s as resolveAssetWorkerBypass, t as lintRoutingPhases, u as hasApiRoutes } from "./headers-BjgvlY29.mjs";
7
- import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-CLwxcEdq.mjs";
8
- import { A as syncWranglerWebSockets, E as resolveLiveBindingConfig, O as syncWranglerBindings, T as readWranglerWebSocketTombstones, a as LIVE_MIGRATION_TAG, b as readRootWranglerConfig, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as normalizeWranglerCompatibilityFlags, h as nextDurableObjectMigrationTag, k as syncWranglerDurableObjects, m as hasDurableObjectSqliteMigration, p as findBindingNameOwner, u as ensureWranglerCompat, v as readExistingLiveBindingConfig, x as readWranglerCompat } from "./wrangler-v2BmVchV.mjs";
9
- import { c as stashCloudflareDeployPointer, i as materializeCloudflareConfig, l as ensureGitignoreLines, o as restoreCloudflarePreviewPointer } from "./cloudflare-config-D1dMHbvz.mjs";
10
- import { a as syncAuthTypesFile, i as removeAuthTypesIfPresent, n as generateQueueTypes, s as syncBindingTypes, t as generateRouteTypes } from "./route-types-CrODgORq.mjs";
11
- import { c as getDatabaseCasing, l as getDatabaseDialect, p as readConfig, u as isNodeTarget } from "./config-BmvqLnbi.mjs";
12
- import { n as writeLocalD1PersistState, t as resolveLocalD1Target } from "./local-d1-C6xn26Nl.mjs";
4
+ import { a as assertSandboxNamespaceConfig, c as resolveSandboxConfig, d as hasEmailHandlers, g as scanJobsSync, i as SANDBOX_MIGRATION_TAG, l as sandboxContainerConfig, n as getNativeWorkerSourceFiles, o as hasSandboxSqliteMigration, p as scanQueuesSync, r as DEFAULT_SANDBOX_CLASS_NAME, t as analyzeApplicationSync } from "./application-analysis-Cx2S63z5.mjs";
5
+ import { l as inferBindingsFromSource, m as applyBindingOverrides, n as FRAMEWORK_SCAN_DIRS, t as DEFAULT_SCAN_DIRS, u as staticModuleReferences } from "./plugin-inference-7O11_E4H.mjs";
6
+ import { a as isAssetBypassRule, d as hasDocumentRoutes, l as edgeRulesNeedWorker, n as mergeRoutingRules, o as isGeneratedAssetHeaders, p as resolveAssetRoutingPolicy, s as resolveAssetWorkerBypass, t as lintRoutingPhases, u as hasApiRoutes } from "./headers-DqBsjDxg.mjs";
7
+ import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-dh9431bN.mjs";
8
+ import { A as syncWranglerWebSockets, E as resolveLiveBindingConfig, O as syncWranglerBindings, T as readWranglerWebSocketTombstones, a as LIVE_MIGRATION_TAG, b as readRootWranglerConfig, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as normalizeWranglerCompatibilityFlags, h as nextDurableObjectMigrationTag, k as syncWranglerDurableObjects, m as hasDurableObjectSqliteMigration, p as findBindingNameOwner, u as ensureWranglerCompat, v as readExistingLiveBindingConfig, x as readWranglerCompat } from "./wrangler-DVe5KV5G.mjs";
9
+ import { c as stashCloudflareDeployPointer, i as materializeCloudflareConfig, l as ensureGitignoreLines, o as restoreCloudflarePreviewPointer } from "./cloudflare-config-D9UFH_A5.mjs";
10
+ import { a as syncAuthTypesFile, i as removeAuthTypesIfPresent, n as generateQueueTypes, s as syncBindingTypes, t as generateRouteTypes } from "./route-types-CSed9-Dp.mjs";
11
+ import { c as getDatabaseCasing, l as getDatabaseDialect, p as readConfig, u as isNodeTarget } from "./config-Dv5jri1-.mjs";
12
+ import { n as writeLocalD1PersistState, t as resolveLocalD1Target } from "./local-d1-CYOYkVwO.mjs";
13
13
  import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-D9hwSySP.mjs";
14
- import { a as getApiUrl, c as getToken, o as getProxyUrl } from "./auth-CCk9Seol.mjs";
15
- import { n as ensurePlatformProxyAccess } from "./cf-access-Dnyw8KFY.mjs";
16
- import { n as scopedAccessCredentials } from "./cf-access-pejlJmuy.mjs";
14
+ import { t as Buffer } from "./node-buffer-D7kgjaDs.mjs";
15
+ import { a as getApiUrl, c as getToken, o as getProxyUrl } from "./auth-DlLDymuc.mjs";
16
+ import { n as ensurePlatformProxyAccess } from "./cf-access-FaIm95jA.mjs";
17
+ import { n as scopedAccessCredentials } from "./cf-access-DmkKPcAI.mjs";
17
18
  import { n as readGeneratedWranglerConfigFile } from "./generated-wrangler-config-CoDaaFsA.mjs";
18
- import { t as migrateBuiltWranglerConfig } from "./cf-config-migrate-CHtnM3_C.mjs";
19
+ import { t as migrateBuiltWranglerConfig } from "./cf-config-migrate-D271BTiw.mjs";
19
20
  import { t as writeFileAtomic } from "./atomic-write-DA6eD1Kp.mjs";
20
- import { a as findReservedEnvKeys, c as loadLocalEnv, i as findLegacyEnvFiles, l as reservedEnvKeysMessage, o as isClientEnvKey, r as LOCAL_ENV_FILE, s as legacyEnvExampleHint, u as resolveRemoteMode } from "./env-UqS-21xi.mjs";
21
- import { n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-CUhCPMpK.mjs";
22
- import { a as readDeployBuildQueueNames, r as cloudflareQueueName, s as drizzlePlugin, t as generateQueueResolverSource } from "./dispatch-BlOYh1Vc.mjs";
23
- import { _ as parseCapturedMessage, a as DEV_INBOX_ENV_VAR, c as DEV_INBOX_TOKEN_ENV_VAR, f as clearDevBuffer, g as listDevMessages, l as DEV_INBOX_TOKEN_HEADER, m as findDevMessage, n as DEV_INBOX_ACK_VALUE, o as DEV_INBOX_MAX_CAPTURE_BYTES, s as DEV_INBOX_PREFIX, t as DEV_INBOX_ACK_HEADER, u as DEV_INBOX_TOKEN_QUERY, v as pushToDevBuffer } from "./dev-inbox-BiamQEAa.mjs";
21
+ import { a as findReservedEnvKeys, c as loadLocalEnv, i as findLegacyEnvFiles, l as reservedEnvKeysMessage, o as isClientEnvKey, r as LOCAL_ENV_FILE, s as legacyEnvExampleHint, u as resolveRemoteMode } from "./env-EjHqc7m9.mjs";
22
+ import { n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-2ENfCCih.mjs";
23
+ import { a as readDeployBuildQueueNames, r as cloudflareQueueName, s as drizzlePlugin, t as generateQueueResolverSource } from "./dispatch-DIhDA3NI.mjs";
24
+ import { _ as parseCapturedMessage, a as DEV_INBOX_ENV_VAR, c as DEV_INBOX_TOKEN_ENV_VAR, f as clearDevBuffer, g as listDevMessages, l as DEV_INBOX_TOKEN_HEADER, m as findDevMessage, n as DEV_INBOX_ACK_VALUE, o as DEV_INBOX_MAX_CAPTURE_BYTES, s as DEV_INBOX_PREFIX, t as DEV_INBOX_ACK_HEADER, u as DEV_INBOX_TOKEN_QUERY, v as pushToDevBuffer } from "./dev-inbox-ClVjKEHy.mjs";
24
25
  import { t as MagicString } from "./dist-B6eN80gc.mjs";
25
- import { s as bindingResolver } from "./static-exports-DFkzL-NX.mjs";
26
- import { i as isMemberExpression, n as isIdentifier, r as isLiteral } from "./ast-Cv0JwXqb.mjs";
27
- import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-WEZw5D-r.mjs";
28
- import { i as writeFileIfChanged, r as syncAuthTypesInProjectTsconfig } from "./project-tsconfig-MyRJgufB.mjs";
29
- import { t as loadUserEnvFile } from "./load-user-env-BltIJLtl.mjs";
30
- import { n as scanWranglerDotenvKeys } from "./dotenv-CEI8hapP.mjs";
31
- import { _ as isRouteEnabledForEnvironment, a as createBoundaryManifest, c as resolveLayoutIds, h as invalidateSourceAnalysis, i as patternToRegex } from "./scan-LjuG3vfA.mjs";
32
- import { n as INTERNAL_BINDING_PREFIXES, t as INTERNAL_BINDING_EXACT_NAMES } from "./raw-7pQirZpQ.mjs";
33
- import { t as ASSET_EXTENSIONS } from "./assets-DZBd7yqh.mjs";
34
- import { i as loadVoidAuthConfig, n as devAuthConfigImporter, o as viteAuthConfigImporter, t as AUTH_CONFIG_ENVIRONMENT } from "./config-Do7gJI3T.mjs";
35
- import { a as resolveDistDir, n as collectRevalidate, o as resolveWorkerDirName, r as hasRevalidate, t as collectPages } from "./isr-config-Czzb4mIq.mjs";
26
+ import { s as bindingResolver } from "./static-exports-s7P86Ngp.mjs";
27
+ import { a as isMemberExpression, i as isLiteral, r as isIdentifier, t as asAstProgram } from "./ast-BkPQu7A0.mjs";
28
+ import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-D2hBodXP.mjs";
29
+ import { a as syncAuthTypesInProjectTsconfig, o as writeFileIfChanged } from "./project-tsconfig-BOA4ym99.mjs";
30
+ import { t as loadUserEnvFile } from "./load-user-env-B8qC0Q2Y.mjs";
31
+ import { n as scanWranglerDotenvKeys } from "./dotenv-BG6RQavH.mjs";
32
+ import { _ as isRouteEnabledForEnvironment, a as createBoundaryManifest, c as resolveLayoutIds, h as invalidateSourceAnalysis, i as patternToRegex, x as convertPathToPattern } from "./scan-Ct_SEzH4.mjs";
33
+ import { n as INTERNAL_BINDING_PREFIXES, t as INTERNAL_BINDING_EXACT_NAMES } from "./raw-5rak34QN.mjs";
34
+ import { i as isClientManifest, t as ASSET_EXTENSIONS } from "./assets-Br6_BeFJ.mjs";
35
+ import { i as loadVoidAuthConfig, n as devAuthConfigImporter, o as viteAuthConfigImporter, t as AUTH_CONFIG_ENVIRONMENT } from "./config-BFX5ZB1J.mjs";
36
+ import { a as resolveDistDir, n as collectRevalidate, o as resolveWorkerDirName, r as hasRevalidate, t as collectPages } from "./isr-config-DiTnL9Tb.mjs";
36
37
  import { t as assertNoPrerenderFailures } from "./prerender-render-BAdYhivW.mjs";
37
- import { h as prerenderPagesNode, m as prerenderPages, n as SEND_EMAIL_BINDING } from "./email-cloudflare-DDknDAgp.mjs";
38
- import { a as safeJsonStringify } from "./protocol-W5EQcIzN.mjs";
39
- import { n as completeApplicationAnalysis } from "./application-routing-DATqynKH.mjs";
40
- import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-DMgR7XOf.mjs";
41
- import { r as selectNativeVersionMetadataBinding, t as CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV } from "./version-metadata-k6KFiyWt.mjs";
42
- import { a as defineMiddleware, c as defineScheduled, i as defineHead, n as basicAuth, o as defineQueue, r as defineHandler, s as defineRender, t as VoidAssetRewriteError } from "./handler-w_FAiIRu.mjs";
38
+ import { h as prerenderPagesNode, m as prerenderPages, n as SEND_EMAIL_BINDING } from "./email-cloudflare-C447nOqq.mjs";
39
+ import { a as safeJsonStringify } from "./protocol-CE3wP-H1.mjs";
40
+ import { n as completeApplicationAnalysis } from "./application-routing-BAXpnawu.mjs";
41
+ import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, r as getSsrServerEntryPath, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-Bwb9ev8K.mjs";
42
+ import { r as selectNativeVersionMetadataBinding, t as CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV } from "./version-metadata-DqgLa6gc.mjs";
43
+ import { a as defineMiddleware, c as defineScheduled, i as defineHead, n as basicAuth, o as defineQueue, r as defineHandler, s as defineRender, t as VoidAssetRewriteError } from "./handler-DCrDLzw2.mjs";
43
44
  import { r as defer } from "./validation-error-CtcAvyI7.mjs";
44
45
  import module, { builtinModules, createRequire } from "node:module";
45
46
  import { chmodSync, closeSync, cpSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
46
47
  import { createRunnableDevEnvironment, defaultServerConditions, isFileServingAllowed, isRunnableDevEnvironment, loadEnv, normalizePath, parseSync, resolveEnvPrefix } from "vite";
47
48
  import { fileURLToPath, pathToFileURL } from "node:url";
48
- import { appendSqliteClassMigration } from "@void/deploy-core";
49
+ import { appendSqliteClassMigration, isRecord } from "@void/deploy-core";
49
50
  import { randomBytes, timingSafeEqual } from "node:crypto";
50
51
  import { homedir } from "node:os";
51
52
  import { isDeepStrictEqual, parseEnv } from "node:util";
@@ -265,11 +266,15 @@ var DevCssProvider = class {
265
266
  return assets;
266
267
  }
267
268
  };
268
- async function readJsonBody(req) {
269
+ async function readDevCssRootPhases(req) {
269
270
  const chunks = [];
270
271
  for await (const chunk of req) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
271
- if (chunks.length === 0) return {};
272
- return JSON.parse(Buffer.concat(chunks).toString("utf-8"));
272
+ if (chunks.length === 0) return [];
273
+ const body = JSON.parse(Buffer.concat(chunks).toString("utf8"));
274
+ const rootPhases = isRecord(body) ? body.rootPhases : void 0;
275
+ if (!Array.isArray(rootPhases)) return [];
276
+ if (!rootPhases.every((phase) => Array.isArray(phase) && phase.every((url) => typeof url === "string"))) throw new Error("Invalid dev CSS root phases");
277
+ return rootPhases;
273
278
  }
274
279
  function getInternalDevOrigin(server) {
275
280
  const address = server.httpServer?.address();
@@ -284,7 +289,6 @@ function getInternalDevOrigin(server) {
284
289
  }
285
290
  function pagesDevCssAssetsPlugin(root, token) {
286
291
  const edgeStore = createOrderedEdgeStore(root);
287
- let provider = null;
288
292
  let viteServer = null;
289
293
  return [{
290
294
  name: "void:pages-dev-css-assets",
@@ -323,7 +327,17 @@ async function readDevCssResponse(response) {
323
327
  throw new Error("HTTP " + response.status);
324
328
  }
325
329
  const body = await response.json();
326
- return Array.isArray(body.assets) ? body.assets : [];
330
+ const assets = body?.assets;
331
+ if (
332
+ !Array.isArray(assets) ||
333
+ !assets.every((asset) =>
334
+ asset && typeof asset.url === "string" && typeof asset.css === "string" &&
335
+ (asset.id === undefined || typeof asset.id === "string")
336
+ )
337
+ ) {
338
+ throw new Error("Invalid dev CSS assets");
339
+ }
340
+ return assets;
327
341
  }
328
342
 
329
343
  export async function getVoidPagesDevCss(request, env, payload) {
@@ -372,8 +386,8 @@ export async function getVoidPagesDevCss(request, env, payload) {
372
386
  },
373
387
  configureServer(server) {
374
388
  viteServer = server;
375
- provider = new DevCssProvider(server, root, edgeStore);
376
- const invalidate = () => provider?.invalidate();
389
+ const provider = new DevCssProvider(server, root, edgeStore);
390
+ const invalidate = () => provider.invalidate();
377
391
  server.watcher.on("add", invalidate);
378
392
  server.watcher.on("change", invalidate);
379
393
  server.watcher.on("unlink", invalidate);
@@ -402,8 +416,7 @@ export async function getVoidPagesDevCss(request, env, payload) {
402
416
  return;
403
417
  }
404
418
  try {
405
- const body = await readJsonBody(req);
406
- const rootPhases = Array.isArray(body.rootPhases) ? body.rootPhases : [];
419
+ const rootPhases = await readDevCssRootPhases(req);
407
420
  const assets = await provider.collect(rootPhases);
408
421
  res.statusCode = 200;
409
422
  res.setHeader("Content-Type", "application/json");
@@ -494,11 +507,11 @@ function readVoidDevCredentials(root) {
494
507
  * block the server. On completion, writes project.json and restarts the server.
495
508
  */
496
509
  async function runAiSetupPrompt(root, token, apiUrl, server) {
497
- const { select, text, isCancel, log } = await import("./dist-Cp4b1_T9.mjs");
498
- const { PlatformClient } = await import("./client-DGfZTE4V.mjs");
499
- const { attachSelectedPlatform, writeProjectConfig } = await import("./project-DVsTAWFh.mjs");
500
- const { inferDefaultSlug } = await import("./resolve-project-C5wC-Hoi.mjs");
501
- const { printSuccess } = await import("./output-D4UOUifX.mjs");
510
+ const { select, text, isCancel, log } = await import("./dist-C47zy_kJ.mjs");
511
+ const { PlatformClient } = await import("./client-DkYzDEC0.mjs");
512
+ const { attachSelectedPlatform, writeProjectConfig } = await import("./project-uXKua1it.mjs");
513
+ const { inferDefaultSlug } = await import("./resolve-project-YsTH-U9I.mjs");
514
+ const { printSuccess } = await import("./output-D7K9TWIA.mjs");
502
515
  const client = new PlatformClient(token, { apiUrl });
503
516
  let projects;
504
517
  try {
@@ -525,7 +538,7 @@ async function runAiSetupPrompt(root, token, apiUrl, server) {
525
538
  let slug;
526
539
  if (result === "__create__") {
527
540
  const { validateProjectSlug } = await import("./project-slug-BUy0lmyR.mjs");
528
- const { createProjectWithSlugRetry } = await import("./create-project-By7ymK7F.mjs");
541
+ const { createProjectWithSlugRetry } = await import("./create-project-Dro3K-az.mjs");
529
542
  let created;
530
543
  try {
531
544
  created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
@@ -547,6 +560,10 @@ async function runAiSetupPrompt(root, token, apiUrl, server) {
547
560
  slug = created.slug;
548
561
  } else {
549
562
  const project = projects.find((p) => p.id === result);
563
+ if (!project) {
564
+ voidError("project: Selected project is unavailable.");
565
+ return;
566
+ }
550
567
  projectId = project.id;
551
568
  slug = project.slug;
552
569
  }
@@ -612,7 +629,7 @@ export const storage = new Proxy({}, {
612
629
  // src/plugin-client-stubs.ts
613
630
  function createClientStubsPlugin() {
614
631
  const STUB_PREFIX = "\0void-client-stub:";
615
- const SERVER_ONLY_STUBS = {
632
+ const stubSources = new Map(Object.entries({
616
633
  "void/db": "export const db = {}; export const createDb = () => ({});",
617
634
  "void/kv": "export const kv = {}; export const createKV = () => ({});",
618
635
  "void/ai": "export const ai = {};",
@@ -658,8 +675,8 @@ function createClientStubsPlugin() {
658
675
  `,
659
676
  "void/live": "",
660
677
  "void/durable": ""
661
- };
662
- const STUB_RESOLVE_FILTER = new RegExp(`^(${Object.keys(SERVER_ONLY_STUBS).join("|").replaceAll("/", "\\/")})$`);
678
+ }));
679
+ const STUB_RESOLVE_FILTER = new RegExp(`^(${Array.from(stubSources.keys()).join("|").replaceAll("/", String.raw`\/`)})$`);
663
680
  const STUB_LOAD_FILTER = new RegExp(`^\\0void-client-stub:`);
664
681
  return {
665
682
  name: "void:client-stubs",
@@ -676,7 +693,7 @@ function createClientStubsPlugin() {
676
693
  load: {
677
694
  filter: { id: STUB_LOAD_FILTER },
678
695
  handler(id) {
679
- return SERVER_ONLY_STUBS[id.slice(18)] ?? "export default {};";
696
+ return stubSources.get(id.slice(18)) ?? "export default {};";
680
697
  }
681
698
  }
682
699
  };
@@ -692,11 +709,11 @@ function mergeCloudflareConfig(patch, fallback) {
692
709
  }
693
710
  return result;
694
711
  }
695
- /** Use Cloudflare's public migration API rather than maintaining a second binding translator. */
712
+ /** Translate Void's Wrangler-shaped settings to the configuration that the Cloudflare plugin takes. */
696
713
  function toNativeCloudflareConfig(raw, root) {
697
714
  const packagePath = join(root, "package.json");
698
715
  const packageName = existsSync(packagePath) ? JSON.parse(readFileSync(packagePath, "utf8")).name : void 0;
699
- const name = String(packageName ?? basename(root)).replaceAll("_", "-").replace(/[^a-z0-9- ]/g, "-").replace(/^(-+)|(-+)$/g, "").slice(0, 63) || "my-worker";
716
+ const name = String(packageName ?? basename(root)).replaceAll("_", "-").replaceAll(/[^a-z0-9- ]/g, "-").replaceAll(/^(-+)|(-+)$/g, "").slice(0, 63) || "my-worker";
700
717
  const { env, vars, ...base } = raw;
701
718
  const selected = process.env.CLOUDFLARE_ENV ? env?.[process.env.CLOUDFLARE_ENV] : void 0;
702
719
  const values = selected ? selected.vars : vars;
@@ -733,11 +750,13 @@ function toNativeCloudflareConfig(raw, root) {
733
750
  * even one with a class of the same name, so it stays as written.
734
751
  */
735
752
  function restoreLocalContainerBindings(worker) {
736
- for (const [name, binding] of Object.entries(worker.env ?? {})) {
753
+ const env = worker.env;
754
+ if (!env) return;
755
+ for (const [name, binding] of Object.entries(env)) {
737
756
  if (binding.type !== "unsafe:durable_object_namespace" || Object.keys(binding).some((key) => !["type", "class_name"].includes(key))) continue;
738
757
  const className = binding.class_name;
739
758
  const declaration = worker.exports?.[className];
740
- if (declaration && "container" in declaration) worker.env[name] = {
759
+ if (declaration && "container" in declaration) env[name] = {
741
760
  type: "durable-object",
742
761
  worker: worker.name,
743
762
  exportName: className
@@ -787,13 +806,14 @@ function withLocalPreviewBindings(plugins, root) {
787
806
  const path = getWorkerConfigPath(directory);
788
807
  const worker = JSON.parse(readFileSync(path, "utf8"));
789
808
  worker.env ??= {};
809
+ const inlineBindingTypes = /* @__PURE__ */ new Set([
810
+ "text",
811
+ "json",
812
+ "secret"
813
+ ]);
790
814
  for (const name of Object.keys(loadLocalEnv(root))) {
791
815
  const binding = worker.env[name];
792
- if (!binding || [
793
- "text",
794
- "json",
795
- "secret"
796
- ].includes(binding.type)) worker.env[name] = { type: "secret" };
816
+ if (!binding || inlineBindingTypes.has(binding.type)) worker.env[name] = { type: "secret" };
797
817
  }
798
818
  writeFileAtomic(path, JSON.stringify(worker));
799
819
  return await hook.call(this, {
@@ -886,7 +906,7 @@ function getOrCreateDevTriggerToken(root) {
886
906
  const tokenPath = join(root, ".void", "dev-trigger-token");
887
907
  const readExisting = () => {
888
908
  try {
889
- const existing = readFileSync(tokenPath, "utf-8").trim();
909
+ const existing = readFileSync(tokenPath, "utf8").trim();
890
910
  return existing.length > 0 ? existing : void 0;
891
911
  } catch {
892
912
  return;
@@ -979,7 +999,7 @@ function warnIfPackageJsonIsNotEsm(root) {
979
999
  if (!existsSync(pkgPath)) return;
980
1000
  let pkg;
981
1001
  try {
982
- pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
1002
+ pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
983
1003
  } catch {
984
1004
  return;
985
1005
  }
@@ -1068,6 +1088,7 @@ function cloudflare$1(options) {
1068
1088
  const environment = options.viteEnvironment.name ?? "ssr";
1069
1089
  const destination = outputDirectories.get(environment);
1070
1090
  const client = outputDirectories.get("client");
1091
+ if (!destination || !client) throw new Error("Void requires configured Worker and client output directories.");
1071
1092
  if (!worker.bundleDir || !worker.config.manifest) throw new Error("Void requires a built Cloudflare Worker.");
1072
1093
  for (const directory of [destination, client]) if (directory !== root && isInside(root, directory) && !isInside(directory, worker.bundleDir)) rmSync(directory, {
1073
1094
  recursive: true,
@@ -1156,7 +1177,7 @@ function devTriggersHintPlugin(root, devTriggerToken) {
1156
1177
  afterServerReady(server, () => {
1157
1178
  const address = server.httpServer?.address();
1158
1179
  const port = typeof address === "object" && address ? address.port : null;
1159
- if (port == null) return;
1180
+ if (port === null || port === void 0) return;
1160
1181
  const baseUrl = `http://localhost:${port}`;
1161
1182
  const summary = [];
1162
1183
  if (jobs.length > 0) summary.push(`${jobs.length} cron${jobs.length === 1 ? "" : "s"}`);
@@ -1166,11 +1187,11 @@ function devTriggersHintPlugin(root, devTriggerToken) {
1166
1187
  const authHeader = `x-void-dev-trigger: ${devTriggerToken}`;
1167
1188
  if (jobs.length > 0) {
1168
1189
  const sample = jobs[0].crons[0];
1169
- console.log(` \x1b[2mcurl -X POST ${baseUrl}/__void/scheduled \\\n -H "${authHeader}" \\\n -d '{"cron":"${sample}","scheduledTime":'"$(date +%s000)"'}'\x1b[22m`);
1190
+ console.log(` \u001b[2mcurl -X POST ${baseUrl}/__void/scheduled \\\n -H "${authHeader}" \\\n -d '{"cron":"${sample}","scheduledTime":'"$(date +%s000)"'}'\u001b[22m`);
1170
1191
  }
1171
1192
  if (queues.length > 0) {
1172
1193
  const sample = queues[0].name;
1173
- console.log(` \x1b[2mcurl -X POST ${baseUrl}/__void/queue \\\n -H "${authHeader}" \\\n -d '{"queue":"${sample}","messages":[{"id":"1","timestamp":'"$(date +%s000)"',"body":{},"attempts":1}]}'\x1b[22m`);
1194
+ console.log(` \u001b[2mcurl -X POST ${baseUrl}/__void/queue \\\n -H "${authHeader}" \\\n -d '{"queue":"${sample}","messages":[{"id":"1","timestamp":'"$(date +%s000)"',"body":{},"attempts":1}]}'\u001b[22m`);
1174
1195
  }
1175
1196
  });
1176
1197
  }
@@ -1195,7 +1216,7 @@ function emailDevInboxPlugin(options) {
1195
1216
  const printInboxUrl = () => {
1196
1217
  const address = server.httpServer?.address();
1197
1218
  const port = typeof address === "object" && address ? address.port : null;
1198
- if (port == null) return;
1219
+ if (port === null || port === void 0) return;
1199
1220
  voidLog(`Email inbox: http://localhost:${port}${inboxHref("")}`);
1200
1221
  };
1201
1222
  afterServerReady(server, printInboxUrl);
@@ -1251,7 +1272,7 @@ function emailDevInboxPlugin(options) {
1251
1272
  return;
1252
1273
  }
1253
1274
  if (wantsRaw) {
1254
- const safeId = id.replace(/["\r\n]/g, "");
1275
+ const safeId = id.replaceAll(/["\r\n]/g, "");
1255
1276
  res.writeHead(200, {
1256
1277
  ...SECURITY_HEADERS,
1257
1278
  "Content-Type": "message/rfc822",
@@ -1337,7 +1358,7 @@ async function handleCapture(req, res) {
1337
1358
  }
1338
1359
  }
1339
1360
  function escapeHtml(s) {
1340
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1361
+ return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
1341
1362
  }
1342
1363
  function formatAddress(a) {
1343
1364
  return a.name ? `${a.name} <${a.email}>` : a.email;
@@ -1512,8 +1533,8 @@ function walkEnvReads(program, bindings, visit) {
1512
1533
  for (const { node, name, bindingType } of references) if (resolve(node, name)?.type === bindingType) visit(node);
1513
1534
  }
1514
1535
  /**
1515
- * Collect every `void/env` read. Computed access produces a warning hit
1516
- * with `property === null`; everything else carries the property name.
1536
+ * Collect every `void/env` read. Computed access produces a warning hit;
1537
+ * statically known reads carry the property name.
1517
1538
  */
1518
1539
  function findHits(program, bindings) {
1519
1540
  const hits = [];
@@ -1521,10 +1542,10 @@ function findHits(program, bindings) {
1521
1542
  return hits;
1522
1543
  }
1523
1544
  function recordHit(node, hits) {
1545
+ if (node.start === void 0) throw new Error("Expected an offset for a parsed environment read.");
1524
1546
  if (node.computed) {
1525
1547
  hits.push({
1526
1548
  kind: "warn",
1527
- property: null,
1528
1549
  start: node.start
1529
1550
  });
1530
1551
  return;
@@ -1565,7 +1586,7 @@ function envClientGuardPlugin(root) {
1565
1586
  } catch {
1566
1587
  return;
1567
1588
  }
1568
- const program = parsed.program;
1589
+ const program = asAstProgram(parsed.program);
1569
1590
  const bindings = extractEnvBindings(program);
1570
1591
  if (!bindings) return;
1571
1592
  const hits = findHits(program, bindings);
@@ -1613,6 +1634,7 @@ function findFoldHits(program, bindings) {
1613
1634
  return hits;
1614
1635
  }
1615
1636
  function pushHit(node, hits) {
1637
+ if (node.start === void 0 || node.end === void 0) throw new Error("Expected offsets for a parsed environment read.");
1616
1638
  if (!node.computed && isIdentifier(node.property)) {
1617
1639
  hits.push({
1618
1640
  start: node.start,
@@ -1674,7 +1696,7 @@ function envClientFoldPlugin() {
1674
1696
  } catch {
1675
1697
  return;
1676
1698
  }
1677
- const program = parsed.program;
1699
+ const program = asAstProgram(parsed.program);
1678
1700
  const bindings = extractEnvBindings(program);
1679
1701
  if (!bindings) return;
1680
1702
  const hits = findFoldHits(program, bindings);
@@ -1725,7 +1747,7 @@ function readProcessEnvCopies() {
1725
1747
  * once per environment) see only the shell.
1726
1748
  */
1727
1749
  function stripLocalClientEnv(root, config, before) {
1728
- if (config.envDir === false || realPath(config.envDir) !== realPath(root)) return;
1750
+ if (config.envDir === false || realPath$1(config.envDir) !== realPath$1(root)) return;
1729
1751
  const file = join(root, LOCAL_ENV_FILE);
1730
1752
  if (!existsSync(file)) return;
1731
1753
  const parsed = parseEnv(readFileSync(file, "utf8"));
@@ -1746,7 +1768,7 @@ function stripLocalClientEnv(root, config, before) {
1746
1768
  }
1747
1769
  }
1748
1770
  /** Match Vite's canonical paths, including Windows short names and filesystem casing. */
1749
- function realPath(path) {
1771
+ function realPath$1(path) {
1750
1772
  try {
1751
1773
  return realpathSync.native(path);
1752
1774
  } catch {
@@ -1755,14 +1777,40 @@ function realPath(path) {
1755
1777
  }
1756
1778
  /** Module ids that name an env file: its path as found, and as Vite resolves it. */
1757
1779
  function envFileIdsFor(envFile) {
1758
- return new Set(envFile ? [normalizePath(envFile), normalizePath(realPath(envFile))] : []);
1780
+ return new Set(envFile ? [normalizePath(envFile), normalizePath(realPath$1(envFile))] : []);
1759
1781
  }
1760
1782
  /** A hook filter pattern that matches exactly `id`. */
1761
1783
  function exactId(id) {
1762
- return new RegExp(`^${id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);
1784
+ return new RegExp(`^${id.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)}$`);
1763
1785
  }
1764
1786
  /** Patterns Vite's `define` typically uses for env-shaped constants. */
1765
1787
  const DEFINE_ENV_PATTERN = /^(?:globalThis\.)?(?:process\.env|import\.meta\.env)\.([A-Z_][A-Z0-9_]*)$/;
1788
+ async function warnOnDefineOverlap(define) {
1789
+ const { _hasRegisteredSchema, _getRegisteredSchema } = await loadEnvPublic();
1790
+ if (!_hasRegisteredSchema()) return;
1791
+ const schema = _getRegisteredSchema();
1792
+ if (!schema) return;
1793
+ const overlaps = [];
1794
+ for (const defineKey of Object.keys(define)) {
1795
+ const match = DEFINE_ENV_PATTERN.exec(defineKey);
1796
+ if (!match) continue;
1797
+ const name = match[1];
1798
+ if (name in schema) overlaps.push({
1799
+ defineKey,
1800
+ schemaKey: name
1801
+ });
1802
+ }
1803
+ if (overlaps.length === 0) return;
1804
+ const lines = ["Vite `define` is shadowing schema env keys:"];
1805
+ for (const { defineKey, schemaKey } of overlaps) lines.push(` • "${defineKey}" → schema key "${schemaKey}". The compiled client code receives the define value, but the typed env.X proxy and validation still source from the schema. Prefer one or the other for any given key.`);
1806
+ voidWarn(lines.join("\n"));
1807
+ }
1808
+ async function assertNoReservedSchemaKeys() {
1809
+ const { _hasRegisteredSchema, _getRegisteredSchema } = await loadEnvPublic();
1810
+ if (!_hasRegisteredSchema()) return;
1811
+ const reserved = findReservedEnvKeys(Object.keys(_getRegisteredSchema() ?? {}));
1812
+ if (reserved.length > 0) throw new Error(reservedEnvKeysMessage("env.ts", reserved));
1813
+ }
1766
1814
  /**
1767
1815
  * Vite plugin that auto-discovers `env.ts` at the project root and:
1768
1816
  * - imports it (registering the user's schema via `defineEnv`)
@@ -1813,12 +1861,6 @@ function envSchemaPlugin(root, options = {}) {
1813
1861
  requiredServerKeys
1814
1862
  });
1815
1863
  }
1816
- async function assertNoReservedSchemaKeys() {
1817
- const { _hasRegisteredSchema, _getRegisteredSchema } = await loadEnvPublic();
1818
- if (!_hasRegisteredSchema()) return;
1819
- const reserved = findReservedEnvKeys(Object.keys(_getRegisteredSchema() ?? {}));
1820
- if (reserved.length > 0) throw new Error(reservedEnvKeysMessage("env.ts", reserved));
1821
- }
1822
1864
  function regenerateTypes() {
1823
1865
  if (!envFile) return;
1824
1866
  mkdirSync(outDir, { recursive: true });
@@ -1834,26 +1876,6 @@ function envSchemaPlugin(root, options = {}) {
1834
1876
  voidWarn(err.message);
1835
1877
  }
1836
1878
  }
1837
- async function warnOnDefineOverlap(define) {
1838
- const { _hasRegisteredSchema, _getRegisteredSchema } = await loadEnvPublic();
1839
- if (!_hasRegisteredSchema()) return;
1840
- const schema = _getRegisteredSchema();
1841
- if (!schema) return;
1842
- const overlaps = [];
1843
- for (const defineKey of Object.keys(define)) {
1844
- const match = DEFINE_ENV_PATTERN.exec(defineKey);
1845
- if (!match) continue;
1846
- const name = match[1];
1847
- if (name in schema) overlaps.push({
1848
- defineKey,
1849
- schemaKey: name
1850
- });
1851
- }
1852
- if (overlaps.length === 0) return;
1853
- const lines = ["Vite `define` is shadowing schema env keys:"];
1854
- for (const { defineKey, schemaKey } of overlaps) lines.push(` • "${defineKey}" → schema key "${schemaKey}". The compiled client code receives the define value, but the typed env.X proxy and validation still source from the schema. Prefer one or the other for any given key.`);
1855
- voidWarn(lines.join("\n"));
1856
- }
1857
1879
  async function validateAndWarn() {
1858
1880
  if (!envFile) return;
1859
1881
  const { _hasRegisteredSchema, validateAllEnv } = await loadEnvPublic();
@@ -2147,7 +2169,7 @@ export async function handleDevTrigger(request, env, ctx) {
2147
2169
  function removeGitignoreLines(root, lines) {
2148
2170
  const gitignorePath = join(root, ".gitignore");
2149
2171
  if (lines.length === 0 || !existsSync(gitignorePath)) return;
2150
- const contents = readFileSync(gitignorePath, "utf-8");
2172
+ const contents = readFileSync(gitignorePath, "utf8");
2151
2173
  const remove = new Set(lines);
2152
2174
  const next = contents.split("\n").filter((line) => !remove.has(line.trim())).join("\n");
2153
2175
  if (next !== contents) writeFileSync(gitignorePath, next);
@@ -2455,8 +2477,7 @@ function pushDefaultErrorPageHelpers(lines, options) {
2455
2477
  dev: options.dev === true,
2456
2478
  projectRoot: options.projectRoot,
2457
2479
  homeDir: options.homeDir
2458
- })});`);
2459
- lines.push("app.onError(__createPageErrorHandler(__matchedRoutes, __errorRenderer.onError));");
2480
+ })});`, "app.onError(__createPageErrorHandler(__matchedRoutes, __errorRenderer.onError));");
2460
2481
  }
2461
2482
  /**
2462
2483
  * Returns a lookup that gives each key its own identifier suffix. The suffix
@@ -2490,9 +2511,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2490
2511
  const auth = options.auth;
2491
2512
  const webSockets = scan.websockets ?? [];
2492
2513
  const managedDispatch = options.nodeTarget !== true && options.dev !== true && options.managedDispatch === true;
2493
- lines.push(`import { AsyncLocalStorage } from "node:async_hooks";`);
2494
- lines.push(`import { Hono } from ${JSON.stringify(options.honoPath)};`);
2495
- lines.push(`import { createRoutingRuntime as __createRoutingRuntime, createHttpRouteHandler as __createHttpRouteHandler, createErrorRenderer as __createErrorRenderer, createPageGetHandler as __createPageGetHandler, createStaticNotFound as __createStaticNotFound, createPageMutationHandler as __createPageMutationHandler, createNamedActionMarker as __createNamedActionMarker, markRouteHandler as __markRouteHandler, createPagesFallback as __createPagesFallback, createModuleLoader as __createModuleLoader, createClientAssetTags as __createClientAssetTags, createManifestLoader as __createManifestLoader, createSsrFallback as __createSsrFallback, createAssetNotFound as __createAssetNotFound, buildPrerenderPath as __buildPrerenderPath } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};`);
2514
+ lines.push(`import { AsyncLocalStorage } from "node:async_hooks";`, `import { Hono, createRoutingRuntime as __createRoutingRuntime, createHttpRouteHandler as __createHttpRouteHandler, createErrorRenderer as __createErrorRenderer, createPageGetHandler as __createPageGetHandler, createStaticNotFound as __createStaticNotFound, createPageMutationHandler as __createPageMutationHandler, createNamedActionMarker as __createNamedActionMarker, markRouteHandler as __markRouteHandler, createPagesFallback as __createPagesFallback, createModuleLoader as __createModuleLoader, createClientAssetTags as __createClientAssetTags, createManifestLoader as __createManifestLoader, createSsrFallback as __createSsrFallback, createAssetNotFound as __createAssetNotFound, buildPrerenderPath as __buildPrerenderPath } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};`);
2496
2515
  if (pages) lines.push(`import { createPageErrorHandler as __createPageErrorHandler } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};`);
2497
2516
  if (options.nodeTarget) lines.push(`const withRuntimeEnv = (_env, fn) => fn();`);
2498
2517
  else lines.push(`import { withRuntimeEnv } from ${JSON.stringify(options.runtimeEnvPath)};`);
@@ -2503,9 +2522,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2503
2522
  "runVoidAuthMigrations"
2504
2523
  ];
2505
2524
  if (webSockets.length > 0) authImports.push("resolveVoidAuthState as __resolveVoidAuthStateRuntime");
2506
- lines.push(`import { ${authImports.join(", ")} } from ${JSON.stringify(auth.authRuntimePath)};`);
2507
- lines.push(`import { __voidAuthDatabase } from ${JSON.stringify(auth.authDatabasePath)};`);
2508
- lines.push(`import { migrationSchema as __voidAuthMigrationSchema } from ${JSON.stringify(auth.authSchemaPath)};`);
2525
+ lines.push(`import { ${authImports.join(", ")} } from ${JSON.stringify(auth.authRuntimePath)};`, `import { __voidAuthDatabase } from ${JSON.stringify(auth.authDatabasePath)};`, `import { migrationSchema as __voidAuthMigrationSchema } from ${JSON.stringify(auth.authSchemaPath)};`);
2509
2526
  if (auth.authConfigPath) lines.push(`import __voidAuthConfig from ${JSON.stringify(auth.authConfigPath)};`);
2510
2527
  }
2511
2528
  if ((webSockets.length > 0 || options.webSocketTombstones?.length) && options.webSocketRuntimePath) lines.push(`import { createWebSocketDurableObject as __createWebSocketDurableObject, createWebSocketTombstoneDurableObject as __createWebSocketTombstoneDurableObject, forwardWebSocketRequest as __forwardWebSocketRequest, __registerWebSocketRoutes } from ${JSON.stringify(options.webSocketRuntimePath)};`);
@@ -2540,48 +2557,29 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2540
2557
  nodeTarget: options.nodeTarget === true,
2541
2558
  managedDispatch,
2542
2559
  blockedAssetExtensions: blockedExts
2543
- })});`);
2544
- lines.push("export const requestContext = __routingRuntime.requestContext;");
2545
- lines.push("app.use(__routingRuntime.contextMiddleware);");
2546
- lines.push("app.use(__routingRuntime.requestMiddleware);");
2547
- lines.push("");
2560
+ })});`, "export const requestContext = __routingRuntime.requestContext;", "app.use(__routingRuntime.contextMiddleware);", "app.use(__routingRuntime.requestMiddleware);", "");
2548
2561
  const emitEdgeRules = !managedDispatch;
2549
2562
  const fallbackRulesJson = JSON.stringify(emitEdgeRules && options.fallbackRules?.length ? options.dev ? options.fallbackRules : stripOriginForProd(options.fallbackRules) : void 0);
2550
2563
  if (emitEdgeRules && options.redirectRules?.length) compileRoutingRulesMiddleware(lines, options.redirectRules, options.dev === true);
2551
2564
  if (pages) {
2552
- lines.push(`import { matchedRoutes as __matchedRoutes } from ${JSON.stringify(options.honoRoutePath)};`);
2565
+ lines.push(`import { matchedRoutes as __matchedRoutes } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};`);
2553
2566
  if (scan.pages.pages.some((page) => page.methods.includes("actions"))) lines.push("app.use(__createNamedActionMarker(__matchedRoutes));");
2554
2567
  }
2555
2568
  const headerRules = emitEdgeRules ? options.headerRules : void 0;
2556
2569
  if (headerRules?.length) lines.push(`const __headerRules = ${JSON.stringify(headerRules)};`);
2557
2570
  if (auth) {
2558
2571
  if (headerRules?.length) lines.push("app.use(\"*\", __routingRuntime.headerMiddleware(__headerRules, \"auth-error\"));");
2559
- lines.push("app.use(async (c, next) => {");
2560
- lines.push(" return runVoidAuthMiddleware(c, next, __voidAuthOptions, __voidAuthDatabase);");
2561
- lines.push("});");
2562
- lines.push("");
2572
+ lines.push("app.use(async (c, next) => {", " return runVoidAuthMiddleware(c, next, __voidAuthOptions, __voidAuthDatabase);", "});", "");
2563
2573
  }
2564
2574
  if (headerRules?.length) lines.push("app.use(\"*\", __routingRuntime.headerMiddleware(__headerRules));");
2565
2575
  for (let i = 0; i < scan.middleware.length; i++) lines.push(`app.use(middleware${i});`);
2566
2576
  if (scan.middleware.length > 0) lines.push("");
2567
2577
  for (let i = 0; i < webSockets.length; i++) {
2568
2578
  const route = webSockets[i];
2569
- lines.push(`app.all(${JSON.stringify(route.pattern)}, async (c, next) => {`);
2570
- lines.push(` if (c.req.raw.headers.get("upgrade")?.toLowerCase() !== "websocket") return next();`);
2571
- lines.push(` return __forwardWebSocketRequest(c.req.raw, c.env, __voidWebSocketRoutes[${i}]);`);
2572
- lines.push("});");
2579
+ lines.push(`app.all(${JSON.stringify(route.pattern)}, async (c, next) => {`, ` if (c.req.raw.headers.get("upgrade")?.toLowerCase() !== "websocket") return next();`, ` return __forwardWebSocketRequest(c.req.raw, c.env, __voidWebSocketRoutes[${i}]);`, "});");
2573
2580
  }
2574
2581
  if (webSockets.length > 0) lines.push("");
2575
- if (auth) {
2576
- lines.push("app.all(\"/api/auth\", __markRouteHandler(async (c) => {");
2577
- lines.push(" return handleVoidAuthRequest(c, __voidAuthOptions, __voidAuthDatabase);");
2578
- lines.push("}));");
2579
- lines.push("");
2580
- lines.push("app.all(\"/api/auth/*\", __markRouteHandler(async (c) => {");
2581
- lines.push(" return handleVoidAuthRequest(c, __voidAuthOptions, __voidAuthDatabase);");
2582
- lines.push("}));");
2583
- lines.push("");
2584
- }
2582
+ if (auth) lines.push("app.all(\"/api/auth\", __markRouteHandler(async (c) => {", " return handleVoidAuthRequest(c, __voidAuthOptions, __voidAuthDatabase);", "}));", "", "app.all(\"/api/auth/*\", __markRouteHandler(async (c) => {", " return handleVoidAuthRequest(c, __voidAuthOptions, __voidAuthDatabase);", "}));", "");
2585
2583
  const seenFiles = /* @__PURE__ */ new Set();
2586
2584
  const routeNames = createIdentifierNames();
2587
2585
  for (const route of scan.routes) {
@@ -2610,25 +2608,20 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2610
2608
  ...route.name !== void 0 && { name: route.name }
2611
2609
  })}, ${auth ? "__voidAuthOptions" : "undefined"}, ${auth ? "__resolveVoidAuthState" : "undefined"});`);
2612
2610
  }
2613
- lines.push("");
2614
- lines.push(`const __voidWebSocketRoutes = ${JSON.stringify(webSockets.map((route) => ({
2611
+ lines.push("", `const __voidWebSocketRoutes = ${JSON.stringify(webSockets.map((route) => ({
2615
2612
  pattern: route.pattern,
2616
2613
  params: route.params,
2617
2614
  className: route.className,
2618
2615
  bindingName: route.bindingName,
2619
2616
  mode: route.mode,
2620
2617
  ...route.name !== void 0 && { name: route.name }
2621
- })))};`);
2622
- lines.push("");
2618
+ })))};`, "");
2623
2619
  }
2624
2620
  for (let i = 0; i < webSockets.length; i++) lines.push(`__voidWebSocketRoutes[${i}].key = websocket${i}.key;`);
2625
2621
  if (webSockets.length > 0 && options.webSocketRuntimePath) lines.push("__registerWebSocketRoutes(__voidWebSocketRoutes);");
2626
2622
  for (const className of options.webSocketTombstones ?? []) lines.push(`export const ${className} = __createWebSocketTombstoneDurableObject(${JSON.stringify(className)});`);
2627
2623
  if (options.webSocketTombstones?.length) lines.push("");
2628
- if (options.hasLive) {
2629
- lines.push("export const VoidLiveStreamDurableObject = __createLiveDurableObject();");
2630
- lines.push("");
2631
- }
2624
+ if (options.hasLive) lines.push("export const VoidLiveStreamDurableObject = __createLiveDurableObject();", "");
2632
2625
  const pageNames = createIdentifierNames();
2633
2626
  if (pages && (scan.pages.pages.length > 0 || scan.pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory))) compilePageRoutes(lines, scan, pages, options, pageNames);
2634
2627
  if (!pages || !createBoundaryManifest(scan.pages).root) lines.push("export async function __voidRenderStaticNotFound() { return new Response(null, { status: 204 }); }");
@@ -2660,112 +2653,28 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2660
2653
  const job = scan.jobs[i];
2661
2654
  lines.push(`const job${i}Crons = ${JSON.stringify(job.crons)};`);
2662
2655
  }
2663
- lines.push("");
2664
- lines.push("export async function scheduled(controller, env, ctx) {");
2665
- lines.push(" const run = async (job, loadJob) => {");
2666
- lines.push(" try {");
2667
- lines.push(" const mod = await loadJob();");
2668
- lines.push(" if (typeof mod.default === 'function') await mod.default(controller, env, ctx);");
2669
- lines.push(" } catch (error) {");
2670
- lines.push(" console.error(`[void] Scheduled job ${job} failed for cron \"${controller.cron}\":`, error);");
2671
- lines.push(" return { job, error };");
2672
- lines.push(" }");
2673
- lines.push(" };");
2674
- lines.push(" const tasks = [];");
2656
+ lines.push("", "export async function scheduled(controller, env, ctx) {", " const run = async (job, loadJob) => {", " try {", " const mod = await loadJob();", " if (typeof mod.default === 'function') await mod.default(controller, env, ctx);", " } catch (error) {", " console.error(`[void] Scheduled job ${job} failed for cron \"${controller.cron}\":`, error);", " return { job, error };", " }", " };", " const tasks = [];");
2675
2657
  for (let i = 0; i < scan.jobs.length; i++) {
2676
2658
  const job = scan.jobs[i];
2677
2659
  const filePath = JSON.stringify(`${jobsDir}/${job.filePath}`);
2678
2660
  const label = JSON.stringify(relative(options.projectRoot, `${jobsDir}/${job.filePath}`));
2679
2661
  lines.push(` if (job${i}Crons.includes(controller.cron)) tasks.push(run(${label}, () => import(${filePath})));`);
2680
2662
  }
2681
- lines.push(" const failures = (await Promise.all(tasks)).filter(Boolean);");
2682
- lines.push(" if (failures.length) {");
2683
- lines.push(" throw new AggregateError(failures.map((failure) => failure.error), `Scheduled jobs failed: ${failures.map((failure) => failure.job).join(\", \")}`);");
2684
- lines.push(" }");
2685
- lines.push("}");
2686
- lines.push("");
2687
- } else {
2688
- lines.push("export async function scheduled() {}");
2689
- lines.push("");
2690
- }
2691
- if (scan.jobs.length > 0 || scan.queues.length > 0) {
2692
- lines.push("function __voidTriggerUnauthorized(c) {");
2693
- lines.push(" const __token = c.req.header(\"x-void-internal\");");
2694
- lines.push(" const __expected = __getRawEnv()?.__VOID_PROXY_TOKEN;");
2695
- lines.push(" const __devToken = c.req.header(\"x-void-dev-trigger\");");
2696
- lines.push(" return __VOID_SERVE ? __devToken !== __VOID_DEV_TRIGGER_TOKEN : __expected ? __token !== __expected : __token !== __VOID_BUILD_KEY;");
2697
- lines.push("}");
2698
- lines.push("");
2699
- }
2700
- if (scan.jobs.length > 0) {
2701
- lines.push("const __scheduledHandler = async (c) => {");
2702
- lines.push(" if (__voidTriggerUnauthorized(c)) return c.json({ error: \"unauthorized\" }, 401);");
2703
- lines.push(" const { cron, scheduledTime } = await c.req.json();");
2704
- lines.push(" const controller = { cron, scheduledTime, noRetry() {} };");
2705
- lines.push(" await scheduled(controller, c.env, c.executionCtx);");
2706
- lines.push(" return c.json({ ok: true });");
2707
- lines.push("};");
2708
- lines.push("app.post(\"/__void/scheduled\", __markRouteHandler(__scheduledHandler));");
2709
- lines.push("");
2710
- }
2663
+ lines.push(" const failures = (await Promise.all(tasks)).filter(Boolean);", " if (failures.length) {", " throw new AggregateError(failures.map((failure) => failure.error), `Scheduled jobs failed: ${failures.map((failure) => failure.job).join(\", \")}`);", " }", "}", "");
2664
+ } else lines.push("export async function scheduled() {}", "");
2665
+ if (scan.jobs.length > 0 || scan.queues.length > 0) lines.push("function __voidTriggerUnauthorized(c) {", " const __token = c.req.header(\"x-void-internal\");", " const __expected = __getRawEnv()?.__VOID_PROXY_TOKEN;", " const __devToken = c.req.header(\"x-void-dev-trigger\");", " return __VOID_SERVE ? __devToken !== __VOID_DEV_TRIGGER_TOKEN : __expected ? __token !== __expected : __token !== __VOID_BUILD_KEY;", "}", "");
2666
+ if (scan.jobs.length > 0) lines.push("const __scheduledHandler = async (c) => {", " if (__voidTriggerUnauthorized(c)) return c.json({ error: \"unauthorized\" }, 401);", " const { cron, scheduledTime } = await c.req.json();", " const controller = { cron, scheduledTime, noRetry() {} };", " await scheduled(controller, c.env, c.executionCtx);", " return c.json({ ok: true });", "};", "app.post(\"/__void/scheduled\", __markRouteHandler(__scheduledHandler));", "");
2711
2667
  if (scan.queues.length > 0) {
2712
2668
  const queueNames = scan.queues.map((queue) => queue.name);
2713
2669
  const cloudflareNames = options.cloudflareQueueNames;
2714
- lines.push(generateQueueResolverSource(queueNames, cloudflareNames && queueNames.map((name) => cloudflareQueueName(name, cloudflareNames))));
2715
- lines.push("");
2670
+ lines.push(generateQueueResolverSource(queueNames, cloudflareNames && queueNames.map((name) => cloudflareQueueName(name, cloudflareNames))), "");
2716
2671
  const queueLabels = scan.queues.map((queue) => relative(options.projectRoot, `${queuesDir}/${queue.filePath}`));
2717
- lines.push(`const __queueLabels = ${JSON.stringify(queueLabels)};`);
2718
- lines.push("export async function __processQueue(payload, env) {");
2719
- lines.push(" const queueSuffix = payload.queue;");
2720
- lines.push(" const __queueIndex = __resolveQueueIndex(queueSuffix);");
2721
- lines.push(" if (__queueIndex === -1) {");
2722
- lines.push(" const __error = `No unambiguous queue handler matches \"${String(queueSuffix)}\"`;");
2723
- lines.push(" console.error(`[void] ${__error}`);");
2724
- lines.push(" return { ok: false, error: __error };");
2725
- lines.push(" }");
2726
- lines.push(" const __decisions = new Map();");
2727
- lines.push(" function __wrapMsg(m) {");
2728
- lines.push(" let decided = false;");
2729
- lines.push(" return {");
2730
- lines.push(" id: m.id, timestamp: new Date(m.timestamp), body: m.body, attempts: m.attempts,");
2731
- lines.push(" ack() { if (!decided) { decided = true; __decisions.set(m.id, { action: \"ack\" }); } },");
2732
- lines.push(" retry(opts) { if (!decided) { decided = true; __decisions.set(m.id, { action: \"retry\", ...(opts?.delaySeconds != null ? { delaySeconds: opts.delaySeconds } : {}) }); } },");
2733
- lines.push(" };");
2734
- lines.push(" }");
2735
- lines.push(" const __msgs = payload.messages.map(__wrapMsg);");
2736
- lines.push(" const batch = {");
2737
- lines.push(" queue: queueSuffix,");
2738
- lines.push(" messages: __msgs,");
2739
- lines.push(" ackAll() { for (const m of __msgs) m.ack(); },");
2740
- lines.push(" retryAll(opts) { for (const m of __msgs) m.retry(opts); },");
2741
- lines.push(" };");
2742
- lines.push(" let __ok = true;");
2743
- lines.push(" try {");
2744
- lines.push(" switch (__queueIndex) {");
2672
+ lines.push(`const __queueLabels = ${JSON.stringify(queueLabels)};`, "export async function __processQueue(payload, env) {", " const queueSuffix = payload.queue;", " const __queueIndex = __resolveQueueIndex(queueSuffix);", " if (__queueIndex === -1) {", " const __error = `No unambiguous queue handler matches \"${String(queueSuffix)}\"`;", " console.error(`[void] ${__error}`);", " return { ok: false, error: __error };", " }", " const __decisions = new Map();", " function __wrapMsg(m) {", " let decided = false;", " return {", " id: m.id, timestamp: new Date(m.timestamp), body: m.body, attempts: m.attempts,", " ack() { if (!decided) { decided = true; __decisions.set(m.id, { action: \"ack\" }); } },", " retry(opts) { if (!decided) { decided = true; __decisions.set(m.id, { action: \"retry\", ...(opts?.delaySeconds != null ? { delaySeconds: opts.delaySeconds } : {}) }); } },", " };", " }", " const __msgs = payload.messages.map(__wrapMsg);", " const batch = {", " queue: queueSuffix,", " messages: __msgs,", " ackAll() { for (const m of __msgs) m.ack(); },", " retryAll(opts) { for (const m of __msgs) m.retry(opts); },", " };", " let __ok = true;", " try {", " switch (__queueIndex) {");
2745
2673
  for (let i = 0; i < scan.queues.length; i++) {
2746
2674
  const q = scan.queues[i];
2747
- lines.push(` case ${i}: {`);
2748
- lines.push(` const mod = await import(${JSON.stringify(`${queuesDir}/${q.filePath}`)});`);
2749
- lines.push(" if (typeof mod.default === 'function') await mod.default(batch, env);");
2750
- lines.push(" break;");
2751
- lines.push(" }");
2675
+ lines.push(` case ${i}: {`, ` const mod = await import(${JSON.stringify(`${queuesDir}/${q.filePath}`)});`, " if (typeof mod.default === 'function') await mod.default(batch, env);", " break;", " }");
2752
2676
  }
2753
- lines.push(" }");
2754
- lines.push(" } catch (error) {");
2755
- lines.push(" console.error(`[void] Queue handler ${__queueLabels[__queueIndex]} failed for queue \"${String(queueSuffix)}\":`, error);");
2756
- lines.push(" __ok = false;");
2757
- lines.push(" }");
2758
- lines.push(" return { ok: __ok, ...(__decisions.size > 0 ? { decisions: Object.fromEntries(__decisions) } : {}) };");
2759
- lines.push("}");
2760
- lines.push("");
2761
- lines.push("const __queueHandler = async (c) => {");
2762
- lines.push(" if (__voidTriggerUnauthorized(c)) return c.json({ error: \"unauthorized\" }, 401);");
2763
- lines.push(" const payload = await c.req.json();");
2764
- lines.push(" const result = await __processQueue(payload, c.env);");
2765
- lines.push(" return c.json(result);");
2766
- lines.push("};");
2767
- lines.push("app.post(\"/__void/queue\", __markRouteHandler(__queueHandler));");
2768
- lines.push("");
2677
+ lines.push(" }", " } catch (error) {", " console.error(`[void] Queue handler ${__queueLabels[__queueIndex]} failed for queue \"${String(queueSuffix)}\":`, error);", " __ok = false;", " }", " return { ok: __ok, ...(__decisions.size > 0 ? { decisions: Object.fromEntries(__decisions) } : {}) };", "}", "", "const __queueHandler = async (c) => {", " if (__voidTriggerUnauthorized(c)) return c.json({ error: \"unauthorized\" }, 401);", " const payload = await c.req.json();", " const result = await __processQueue(payload, c.env);", " return c.json(result);", "};", "app.post(\"/__void/queue\", __markRouteHandler(__queueHandler));", "");
2769
2678
  }
2770
2679
  const email = scan.email;
2771
2680
  const emailDir = options.emailDir;
@@ -2784,175 +2693,62 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2784
2693
  }
2785
2694
  lines.push("];");
2786
2695
  }
2787
- lines.push("");
2788
- lines.push("export async function __emailHandler(message, env, ctx, __opts) {");
2789
- lines.push(" const __platformTo = message ? message.__voidPlatformTo : undefined;");
2790
- lines.push(" const __to = String((__platformTo ?? (message && message.to)) || \"\");");
2791
- lines.push(" const __localFull = __to.split(\"@\")[0] || \"\";");
2792
- lines.push(" let __local = __localFull;");
2793
- lines.push(" if (__opts && __opts.slug) {");
2794
- lines.push(" const __plus = __localFull.indexOf(\"+\");");
2795
- lines.push(" __local = __plus === -1 ? \"\" : __localFull.slice(__plus + 1);");
2796
- lines.push(" }");
2797
- if (email.addresses.length > 0) {
2798
- lines.push(" for (const __p of __emailPatterns) {");
2799
- lines.push(" const __m = __p.re.exec(__local);");
2800
- lines.push(" if (!__m) continue;");
2801
- lines.push(" const __params = {};");
2802
- lines.push(" for (let __i = 0; __i < __p.params.length; __i++) {");
2803
- lines.push(" __params[__p.params[__i]] = __m[__i + 1];");
2804
- lines.push(" }");
2805
- lines.push(" const __mod = await __p.load();");
2806
- lines.push(" if (typeof __mod.default !== \"function\") {");
2807
- lines.push(" throw new Error(\"email handler at \" + __p.path + \" has no default export\");");
2808
- lines.push(" }");
2809
- lines.push(" return await __mod.default(message, env, ctx, { params: __params });");
2810
- lines.push(" }");
2811
- }
2696
+ lines.push("", "export async function __emailHandler(message, env, ctx, __opts) {", " const __platformTo = message ? message.__voidPlatformTo : undefined;", " const __to = String((__platformTo ?? (message && message.to)) || \"\");", " const __localFull = __to.split(\"@\")[0] || \"\";", " let __local = __localFull;", " if (__opts && __opts.slug) {", " const __plus = __localFull.indexOf(\"+\");", " __local = __plus === -1 ? \"\" : __localFull.slice(__plus + 1);", " }");
2697
+ if (email.addresses.length > 0) lines.push(" for (const __p of __emailPatterns) {", " const __m = __p.re.exec(__local);", " if (!__m) continue;", " const __params = {};", " for (let __i = 0; __i < __p.params.length; __i++) {", " __params[__p.params[__i]] = __m[__i + 1];", " }", " const __mod = await __p.load();", " if (typeof __mod.default !== \"function\") {", " throw new Error(\"email handler at \" + __p.path + \" has no default export\");", " }", " return await __mod.default(message, env, ctx, { params: __params });", " }");
2812
2698
  if (email.defaultHandler) {
2813
2699
  const defaultPath = `${emailDir}/${email.defaultHandler}`;
2814
- lines.push(" const __dmod = await __emailDefault();");
2815
- lines.push(" if (typeof __dmod.default !== \"function\") {");
2816
- lines.push(` throw new Error("email handler at " + ${JSON.stringify(defaultPath)} + " has no default export");`);
2817
- lines.push(" }");
2818
- lines.push(" return await __dmod.default(message, env, ctx, { params: {} });");
2819
- } else {
2820
- lines.push(" if (typeof message.setReject === \"function\") {");
2821
- lines.push(" message.setReject(\"no handler matched recipient \\\"\" + __to + \"\\\" — add email/_default.ts to handle unmatched mail\");");
2822
- lines.push(" }");
2823
- }
2824
- lines.push("}");
2825
- lines.push("");
2700
+ lines.push(" const __dmod = await __emailDefault();", " if (typeof __dmod.default !== \"function\") {", ` throw new Error("email handler at " + ${JSON.stringify(defaultPath)} + " has no default export");`, " }", " return await __dmod.default(message, env, ctx, { params: {} });");
2701
+ } else lines.push(" if (typeof message.setReject === \"function\") {", String.raw` message.setReject("no handler matched recipient \"" + __to + "\" — add email/_default.ts to handle unmatched mail");`, " }");
2702
+ lines.push("}", "");
2826
2703
  }
2827
2704
  if (options.migrationHandlerPath && (options.migrations?.length || auth)) {
2828
2705
  const d1BindingName = options.bindingNames?.d1;
2829
- lines.push(`import { createMigrationHandler as __createMigrationHandler } from ${JSON.stringify(options.migrationHandlerPath)};`);
2830
- lines.push(`const __migrations = ${JSON.stringify(options.migrations)};`);
2831
- lines.push(`const __migrationPlanBundle = ${JSON.stringify(options.migrationPlanBundle)};`);
2706
+ lines.push(`import { createMigrationHandler as __createMigrationHandler } from ${JSON.stringify(options.migrationHandlerPath)};`, `const __migrations = ${JSON.stringify(options.migrations)};`, `const __migrationPlanBundle = ${JSON.stringify(options.migrationPlanBundle)};`);
2832
2707
  if (d1BindingName) lines.push(`function __voidGetMigrationEnv() {
2833
2708
  const env = __getRawEnv();
2834
2709
  if (!env || env[${JSON.stringify(d1BindingName)}] == null) return env;
2835
2710
  return { ...env, DB: env[${JSON.stringify(d1BindingName)}] };
2836
2711
  }`);
2837
2712
  else lines.push("function __voidGetMigrationEnv() { return __getRawEnv(); }");
2838
- lines.push("function __voidCreateMigrationRequestHandler(includeAuthMigrations, includePlanBundle) {");
2839
- lines.push(" return __createMigrationHandler(");
2840
- lines.push(" __voidGetMigrationEnv(),");
2841
- lines.push(" __migrations,");
2713
+ lines.push("function __voidCreateMigrationRequestHandler(includeAuthMigrations, includePlanBundle) {", " return __createMigrationHandler(", " __voidGetMigrationEnv(),", " __migrations,");
2842
2714
  if (auth) lines.push(" includeAuthMigrations ? () => runVoidAuthMigrations(__voidGetMigrationEnv(), __voidAuthOptions, __voidAuthMigrationSchema) : undefined,");
2843
2715
  else lines.push(" undefined,");
2844
- lines.push(" includePlanBundle ? __migrationPlanBundle : undefined,");
2845
- lines.push(" );");
2846
- lines.push("}");
2847
- lines.push("export async function __voidHandleInternalRoute(request) {");
2848
- lines.push(" const url = new URL(request.url);");
2849
- lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate\") {");
2850
- lines.push(` return __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, false)(request);`);
2851
- lines.push(" }");
2852
- lines.push(" if (request.method === \"GET\" && url.pathname === \"/__void/migrate/capabilities\") {");
2853
- lines.push(` return __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, true)(request);`);
2854
- lines.push(" }");
2855
- lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate/app\") {");
2856
- lines.push(" return __voidCreateMigrationRequestHandler(false, true)(request);");
2857
- lines.push(" }");
2858
- lines.push(" if (request.method === \"GET\" && url.pathname.startsWith(\"/__void/migrate/app/attempt/\")) {");
2859
- lines.push(" return __voidCreateMigrationRequestHandler(false, true)(request);");
2860
- lines.push(" }");
2861
- if (auth) {
2862
- lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate/auth\") {");
2863
- lines.push(" return __voidCreateMigrationRequestHandler(true, true)(request);");
2864
- lines.push(" }");
2865
- }
2866
- lines.push(" return null;");
2867
- lines.push("}");
2868
- lines.push(`app.post("/__void/migrate", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, false)(c.req.raw)));`);
2869
- lines.push(`app.get("/__void/migrate/capabilities", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, true)(c.req.raw)));`);
2870
- lines.push("app.post(\"/__void/migrate/app\", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(false, true)(c.req.raw)));");
2871
- lines.push("app.get(\"/__void/migrate/app/attempt/:attemptId\", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(false, true)(c.req.raw)));");
2716
+ lines.push(" includePlanBundle ? __migrationPlanBundle : undefined,", " );", "}", "export async function __voidHandleInternalRoute(request) {", " const url = new URL(request.url);", " if (request.method === \"POST\" && url.pathname === \"/__void/migrate\") {", ` return __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, false)(request);`, " }", " if (request.method === \"GET\" && url.pathname === \"/__void/migrate/capabilities\") {", ` return __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, true)(request);`, " }", " if (request.method === \"POST\" && url.pathname === \"/__void/migrate/app\") {", " return __voidCreateMigrationRequestHandler(false, true)(request);", " }", " if (request.method === \"GET\" && url.pathname.startsWith(\"/__void/migrate/app/attempt/\")) {", " return __voidCreateMigrationRequestHandler(false, true)(request);", " }");
2717
+ if (auth) lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate/auth\") {", " return __voidCreateMigrationRequestHandler(true, true)(request);", " }");
2718
+ lines.push(" return null;", "}", `app.post("/__void/migrate", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, false)(c.req.raw)));`, `app.get("/__void/migrate/capabilities", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, true)(c.req.raw)));`, "app.post(\"/__void/migrate/app\", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(false, true)(c.req.raw)));", "app.get(\"/__void/migrate/app/attempt/:attemptId\", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(false, true)(c.req.raw)));");
2872
2719
  if (auth) lines.push("app.post(\"/__void/migrate/auth\", __markRouteHandler((c) => __voidCreateMigrationRequestHandler(true, true)(c.req.raw)));");
2873
2720
  lines.push("");
2874
- } else {
2875
- lines.push("export async function __voidHandleInternalRoute() { return null; }");
2876
- lines.push("");
2877
- }
2878
- if (options.bindingHandlerPath) {
2879
- lines.push(`import { createBindingHandler as __createBindingHandler } from ${JSON.stringify(options.bindingHandlerPath)};`);
2880
- lines.push("let __voidBindingApp;");
2881
- lines.push("app.all(\"/__void/*\", __markRouteHandler(async (c) => {");
2882
- lines.push(" if (!__voidBindingApp) __voidBindingApp = __createBindingHandler(__getRawEnv());");
2883
- lines.push(" const url = new URL(c.req.url);");
2884
- lines.push(" url.pathname = url.pathname.slice(7);");
2885
- lines.push(" return __voidBindingApp.fetch(new Request(url.toString(), c.req.raw));");
2886
- lines.push("}));");
2887
- lines.push("");
2888
- }
2889
- lines.push("const __rawEnvStore = new AsyncLocalStorage();");
2890
- lines.push("export function __withRawEnv(env, fn) { return __rawEnvStore.run(env, fn); }");
2891
- lines.push("function __getRawEnv() { return __rawEnvStore.getStore(); }");
2892
- lines.push(`export const __VOID_BUILD_KEY = ${JSON.stringify(crypto.randomUUID())};`);
2893
- lines.push(`export const __VOID_DEV_TRIGGER_TOKEN = ${JSON.stringify(options.devTriggerToken ?? crypto.randomUUID())};`);
2894
- lines.push(`const __VOID_SERVE = ${JSON.stringify(options.dev === true)};`);
2895
- lines.push(`export const __VOID_ISR_REVALIDATE = ${JSON.stringify(mergedRevalidate)};`);
2896
- lines.push(`export const __VOID_ISR_PAGES = ${JSON.stringify(isrPages)};`);
2897
- lines.push(`export const __VOID_ISR_PATH_REVALIDATE = ${JSON.stringify(isrPathRevalidate)};`);
2898
- lines.push(`export const __VOID_ISR_DEPLOYMENT_ID = ${JSON.stringify(crypto.randomUUID())};`);
2899
- lines.push("");
2900
- lines.push(`export default app;`);
2721
+ } else lines.push("export async function __voidHandleInternalRoute() { return null; }", "");
2722
+ if (options.bindingHandlerPath) lines.push(`import { createBindingHandler as __createBindingHandler } from ${JSON.stringify(options.bindingHandlerPath)};`, "let __voidBindingApp;", "app.all(\"/__void/*\", __markRouteHandler(async (c) => {", " if (!__voidBindingApp) __voidBindingApp = __createBindingHandler(__getRawEnv());", " const url = new URL(c.req.url);", " url.pathname = url.pathname.slice(7);", " return __voidBindingApp.fetch(new Request(url.toString(), c.req.raw));", "}));", "");
2723
+ lines.push("const __rawEnvStore = new AsyncLocalStorage();", "export function __withRawEnv(env, fn) { return __rawEnvStore.run(env, fn); }", "function __getRawEnv() { return __rawEnvStore.getStore(); }", `export const __VOID_BUILD_KEY = ${JSON.stringify(crypto.randomUUID())};`, `export const __VOID_DEV_TRIGGER_TOKEN = ${JSON.stringify(options.devTriggerToken ?? crypto.randomUUID())};`, `const __VOID_SERVE = ${JSON.stringify(options.dev === true)};`, `export const __VOID_ISR_REVALIDATE = ${JSON.stringify(mergedRevalidate)};`, `export const __VOID_ISR_PAGES = ${JSON.stringify(isrPages)};`, `export const __VOID_ISR_PATH_REVALIDATE = ${JSON.stringify(isrPathRevalidate)};`, `export const __VOID_ISR_DEPLOYMENT_ID = ${JSON.stringify(crypto.randomUUID())};`, "", `export default app;`);
2901
2724
  return lines.join("\n");
2902
2725
  }
2903
2726
  function compilePrerenderCollector(lines, scan, ssr, options, pageNames, pagesDirRelative) {
2904
2727
  const staticPaths = scan.pages.pages.filter((page) => page.shouldPrerender && page.params.length === 0 && !page.catchAll).map((page) => page.pattern);
2905
2728
  const dynamicPages = scan.pages.pages.filter((page) => page.shouldPrerender && page.hasGetPrerenderPaths && (page.params.length > 0 || page.catchAll));
2906
2729
  const explicitPaths = options.explicitPrerenderPaths ?? [];
2907
- lines.push(`export async function __voidCollectPrerenderPaths(request, env, ctx) {`);
2908
- lines.push(` return withRuntimeEnv(env, async () => {`);
2730
+ lines.push(`export async function __voidCollectPrerenderPaths(request, env, ctx) {`, ` return withRuntimeEnv(env, async () => {`);
2909
2731
  if (options.nodeTarget) lines.push(` return requestContext.run({ request }, async () => {`);
2910
2732
  else lines.push(` return requestContext.run({ request, executionCtx: ctx }, async () => {`);
2911
2733
  lines.push(` const paths = [];`);
2912
2734
  for (const path of staticPaths) lines.push(` paths.push(${JSON.stringify(path)});`);
2913
2735
  for (const page of dynamicPages) {
2914
2736
  const loaderName = `_pload_${pageNames(page.componentId)}`;
2915
- lines.push(` {`);
2916
- lines.push(` const mod = await ${loaderName}();`);
2917
- lines.push(` if (typeof mod.getPrerenderPaths === "function") {`);
2918
- lines.push(` const paramSets = await mod.getPrerenderPaths();`);
2919
- lines.push(` if (Array.isArray(paramSets)) {`);
2737
+ lines.push(` {`, ` const mod = await ${loaderName}();`, ` if (typeof mod.getPrerenderPaths === "function") {`, ` const paramSets = await mod.getPrerenderPaths();`, ` if (Array.isArray(paramSets)) {`);
2920
2738
  const file = [pagesDirRelative, page.serverPath ?? page.componentPath].filter(Boolean).join("/");
2921
- lines.push(` for (let index = 0; index < paramSets.length; index++) {`);
2922
- lines.push(` paths.push(__buildPrerenderPath(${JSON.stringify(page.pattern)}, paramSets[index], ${JSON.stringify(file)}, index));`);
2923
- lines.push(` }`);
2924
- lines.push(` }`);
2925
- lines.push(` }`);
2926
- lines.push(` }`);
2927
- }
2928
- if (ssr) {
2929
- lines.push(` {`);
2930
- lines.push(` const mod = await import(${JSON.stringify(ssr.serverEntryPath)});`);
2931
- lines.push(` if (typeof mod.getPrerenderPaths === "function") {`);
2932
- lines.push(` const ssrPaths = await mod.getPrerenderPaths();`);
2933
- lines.push(` if (Array.isArray(ssrPaths)) {`);
2934
- lines.push(` for (const path of ssrPaths) {`);
2935
- lines.push(` if (typeof path === "string") paths.push(path);`);
2936
- lines.push(` }`);
2937
- lines.push(` }`);
2938
- lines.push(` }`);
2939
- lines.push(` }`);
2739
+ lines.push(` for (let index = 0; index < paramSets.length; index++) {`, ` paths.push(__buildPrerenderPath(${JSON.stringify(page.pattern)}, paramSets[index], ${JSON.stringify(file)}, index));`, ` }`, ` }`, ` }`, ` }`);
2940
2740
  }
2741
+ if (ssr) lines.push(` {`, ` const mod = await import(${JSON.stringify(ssr.serverEntryPath)});`, ` if (typeof mod.getPrerenderPaths === "function") {`, ` const ssrPaths = await mod.getPrerenderPaths();`, ` if (Array.isArray(ssrPaths)) {`, ` for (const path of ssrPaths) {`, ` if (typeof path === "string") paths.push(path);`, ` }`, ` }`, ` }`, ` }`);
2941
2742
  for (const path of explicitPaths) lines.push(` paths.push(${JSON.stringify(path)});`);
2942
- lines.push(options.trailingSlash ? ` return [...new Set(paths.map((path) => path.endsWith("/") ? path : path + "/"))];` : ` return [...new Set(paths)];`);
2943
- lines.push(` });`);
2944
- lines.push(` });`);
2945
- lines.push(`}`);
2946
- lines.push("");
2743
+ lines.push(options.trailingSlash ? ` return [...new Set(paths.map((path) => path.endsWith("/") ? path : path + "/"))];` : ` return [...new Set(paths)];`, ` });`, ` });`, `}`, "");
2947
2744
  }
2745
+ const virtualDevUrl = (id) => "/@id/__x00__" + id;
2948
2746
  function compilePageRoutes(lines, scan, pages, options, pageNames) {
2949
2747
  lines.push(`import { renderPage } from "virtual:void-pages-renderer";`);
2950
2748
  if (options.dev) lines.push(`import { getVoidPagesDevCss } from "virtual:void-pages-dev-assets";`);
2951
2749
  const hasIslandPages = scan.pages.pages.some((p) => p.renderMode === "island");
2952
2750
  if (hasIslandPages) lines.push(`import { renderIslandPage } from "virtual:void-islands-renderer";`);
2953
- lines.push("");
2954
- lines.push(`const __voidHeadConfig = ${JSON.stringify(pages.headConfig ?? null)};`);
2955
- lines.push("");
2751
+ lines.push("", `const __voidHeadConfig = ${JSON.stringify(pages.headConfig ?? null)};`, "");
2956
2752
  pushDefaultErrorPageHelpers(lines, options);
2957
2753
  const relPagesDir = pages.pagesDirRelative;
2958
2754
  const pageCssKeys = {};
@@ -2960,7 +2756,6 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
2960
2756
  const boundaryManifest = createBoundaryManifest(scan.pages);
2961
2757
  const projectRoot = options.projectRoot;
2962
2758
  const toDevRootUrl = (absolutePath) => "/" + absolutePath.replaceAll("\\", "/").slice(projectRoot.replaceAll("\\", "/").length + 1);
2963
- const virtualDevUrl = (id) => "/@id/__x00__" + id;
2964
2759
  for (const page of scan.pages.pages) {
2965
2760
  const keys = [];
2966
2761
  const routeRootPhases = [[virtualDevUrl(page.island ? pages.islandClientEntryId ?? pages.clientEntryId : pages.clientEntryId)]];
@@ -2983,17 +2778,16 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
2983
2778
  }
2984
2779
  }
2985
2780
  keys.push(`${relPagesDir}/${page.componentPath}`);
2986
- routeRootPhases.push(layoutRoots);
2987
- routeRootPhases.push([toDevRootUrl(`${pages.pagesDir}/${page.componentPath}`)]);
2781
+ routeRootPhases.push(layoutRoots, [toDevRootUrl(`${pages.pagesDir}/${page.componentPath}`)]);
2988
2782
  pageCssKeys[page.componentId] = keys;
2989
2783
  pageDevRootPhases[page.componentId] = routeRootPhases.filter((phase) => phase.length > 0);
2990
2784
  }
2991
2785
  for (const plan of Object.values(boundaryManifest.plans)) {
2992
- const files = [...scan.pages.layouts, ...scan.pages.namedLayouts].filter((layout) => {
2786
+ const files = [...scan.pages.layouts, ...scan.pages.namedLayouts].flatMap((layout) => {
2993
2787
  const id = "name" in layout ? layout.directory ? layout.directory + "/_layouts/" + layout.name : "_layouts/" + layout.name : layout.directory ? layout.directory + "/layout" : "layout";
2994
2788
  const key = scan.pages.pages.some((page) => page.componentId === id) ? id.replace(/(^|\/)([^/]+)$/, "$1_$2") : id;
2995
- return plan.layouts.includes(key);
2996
- }).map((layout) => layout.filePath);
2789
+ return plan.layouts.includes(key) ? [layout.filePath] : [];
2790
+ });
2997
2791
  files.push(plan.filePath);
2998
2792
  pageCssKeys[plan.id] = files.map((file) => `${relPagesDir}/${file}`);
2999
2793
  pageDevRootPhases[plan.id] = [[virtualDevUrl(pages.clientEntryId)], files.map((file) => toDevRootUrl(`${pages.pagesDir}/${file}`))];
@@ -3225,15 +3019,14 @@ ${entryClass}`;
3225
3019
  * Generate the app module — exports the Hono app with static asset serving.
3226
3020
  * This is the entry imported by `vite preview` and can be used programmatically.
3227
3021
  */
3228
- function compileNodeApp(target, honoPath, envSchemaModule) {
3022
+ function compileNodeApp(target, envSchemaModule) {
3229
3023
  const staticImport = target === "bun" ? `import { serveStatic } from "hono/bun";` : target === "deno" ? `import { serveStatic } from "hono/deno";` : `import { serveStatic } from "@hono/node-server/serve-static";`;
3230
3024
  const envSchemaImport = envSchemaModule ? `import ${JSON.stringify(envSchemaModule.importPath)};\nimport { _validateEnvOnce } from ${JSON.stringify(envSchemaModule.helperPath)};\n` : "";
3231
3025
  const envMiddleware = envSchemaModule ? `app.use("*", async (c, next) => { if (!(((c.req.method === "POST" && c.req.path === "/__void/prerender-paths") || (c.req.method === "GET" && c.req.path === "/__void/static-not-found")) && c.env?.__VOID_PRERENDER === "1")) await _validateEnvOnce(${target === "deno" ? "Deno.env.toObject()" : "process.env"}); return next(); });\n` : "";
3232
3026
  return `${staticImport}
3233
3027
  import { fileURLToPath } from "node:url";
3234
- import { Hono } from ${JSON.stringify(honoPath)};
3235
3028
  import innerApp, { __voidCollectPrerenderPaths, __voidRenderStaticNotFound } from "virtual:void-routes";
3236
- import { prerenderPathsResponse as __prerenderPathsResponse } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};
3029
+ import { Hono, prerenderPathsResponse as __prerenderPathsResponse } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};
3237
3030
  ${envSchemaImport}
3238
3031
  // dist/client, created on first use so a server that supplies its own ASSETS
3239
3032
  // (a single executable, for one) never looks for a directory it doesn't have.
@@ -3297,9 +3090,7 @@ function stripOriginForProd(rules) {
3297
3090
  return rules.map(({ origin: _origin, ...rest }) => rest);
3298
3091
  }
3299
3092
  function compileRoutingRulesMiddleware(lines, rules, dev) {
3300
- lines.push("// Routing rules: redirects + rewrites (applied before route handlers)");
3301
- lines.push(`const __routingRules = ${JSON.stringify(dev ? rules : stripOriginForProd(rules))};`);
3302
- lines.push("app.use(\"*\", __routingRuntime.routingMiddleware(__routingRules));");
3093
+ lines.push("// Routing rules: redirects + rewrites (applied before route handlers)", `const __routingRules = ${JSON.stringify(dev ? rules : stripOriginForProd(rules))};`, "app.use(\"*\", __routingRuntime.routingMiddleware(__routingRules));");
3303
3094
  }
3304
3095
  /** Generate the server-side fetch client, which calls `app.fetch()` with the current request's credentials. */
3305
3096
  function compileWorkerClient(authClientPath, nodeTarget = false) {
@@ -3407,7 +3198,7 @@ function generateClassATriggerWrapper(root, framework, original, isBuild, dialec
3407
3198
  const scoped = dialect !== "sqlite";
3408
3199
  const fetchMethod = scoped ? ` fetch(request, env, ctx) {
3409
3200
  return withRuntimeEnv(env, async () => {
3410
- ${fetchBody.replace(/^/gm, " ")}
3201
+ ${fetchBody.replaceAll(/^/gm, " ")}
3411
3202
  });
3412
3203
  },` : ` async fetch(request, env, ctx) {
3413
3204
  ${fetchBody}
@@ -3649,6 +3440,9 @@ function readDatabaseUrl(root) {
3649
3440
  function readAuthDatabaseUrl(root) {
3650
3441
  return process.env.DATABASE_URL || readDatabaseUrl(root) || void 0;
3651
3442
  }
3443
+ const logApplied = (applied) => {
3444
+ if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
3445
+ };
3652
3446
  /**
3653
3447
  * Vite plugin that runs local migrations on dev server startup.
3654
3448
  * For SQLite/D1: applies migrations to the local miniflare database.
@@ -3664,13 +3458,10 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
3664
3458
  const hasSqlMigrations = existsSync(migrationsDir);
3665
3459
  if (!hasSqlMigrations && !auth?.enabled) return;
3666
3460
  const migrateAuth = async (databaseUrl) => {
3667
- const { runLocalVoidAuthMigrations } = await import("./node-DqkiQujF.mjs");
3461
+ const { runLocalVoidAuthMigrations } = await import("./node-DVJWfV6s.mjs");
3668
3462
  await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth?.configPath, databaseUrl, devAuthConfigImporter(server));
3669
3463
  };
3670
3464
  const mysqlAuth = dialect === "mysql" && auth?.enabled === true;
3671
- const logApplied = (applied) => {
3672
- if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
3673
- };
3674
3465
  const refuse = (err) => {
3675
3466
  afterServerReady(server, () => {
3676
3467
  console.log();
@@ -3679,7 +3470,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
3679
3470
  };
3680
3471
  try {
3681
3472
  if (dialect !== "sqlite") {
3682
- const { collectMigrations } = await import("./collect-8i0wU63d.mjs");
3473
+ const { collectMigrations } = await import("./collect-B6nlSnsb.mjs");
3683
3474
  const allMigrations = collectMigrations(migrationsDir);
3684
3475
  const runFiles = dialect === "mysql" ? allMigrations.length > 0 : hasSqlMigrations;
3685
3476
  const url = runFiles ? readDatabaseUrl(root) : void 0;
@@ -3693,8 +3484,8 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
3693
3484
  }
3694
3485
  const authWithFiles = authUrl !== void 0 && authUrl === url;
3695
3486
  if (url) {
3696
- const { validateMigrations } = await import("./validate-DY1U9rET.mjs");
3697
- const appliedNames = dialect === "mysql" ? await import("./runner-mysql-C_PrAUTm.mjs").then((runner) => runner.getMySqlAppliedMigrations(url)) : await import("./runner-pg-2pjltt0t.mjs").then((runner) => runner.getPgAppliedMigrations(url));
3487
+ const { validateMigrations } = await import("./validate-CZYUIfR-.mjs");
3488
+ const appliedNames = dialect === "mysql" ? await import("./runner-mysql-r688x6Y9.mjs").then((runner) => runner.getMySqlAppliedMigrations(url)) : await import("./runner-pg-DMJquR3d.mjs").then((runner) => runner.getPgAppliedMigrations(url));
3698
3489
  const appliedSet = new Set(appliedNames);
3699
3490
  const pending = allMigrations.filter((migration) => !appliedSet.has(migration.name));
3700
3491
  if (pending.length > 0) try {
@@ -3703,20 +3494,20 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
3703
3494
  refuse(err);
3704
3495
  return;
3705
3496
  }
3706
- const applied = dialect === "mysql" ? await import("./runner-mysql-C_PrAUTm.mjs").then((runner) => runner.runMySqlMigrations(migrationsDir, url, authWithFiles ? async (names) => {
3497
+ const applied = dialect === "mysql" ? await import("./runner-mysql-r688x6Y9.mjs").then((runner) => runner.runMySqlMigrations(migrationsDir, url, authWithFiles ? async (names) => {
3707
3498
  logApplied(names);
3708
3499
  await migrateAuth(url);
3709
- } : void 0)) : await import("./runner-pg-2pjltt0t.mjs").then((runner) => runner.runPgMigrations(migrationsDir, url));
3500
+ } : void 0)) : await import("./runner-pg-DMJquR3d.mjs").then((runner) => runner.runPgMigrations(migrationsDir, url));
3710
3501
  if (!authWithFiles) logApplied(applied);
3711
3502
  }
3712
3503
  if (authUrl && !authWithFiles) {
3713
- const { withMySqlMigrationLockAt } = await import("./runner-mysql-C_PrAUTm.mjs");
3504
+ const { withMySqlMigrationLockAt } = await import("./runner-mysql-r688x6Y9.mjs");
3714
3505
  await withMySqlMigrationLockAt(authUrl, () => migrateAuth(authUrl));
3715
3506
  }
3716
3507
  } else if (hasSqlMigrations) {
3717
- const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-CTk21HrO.mjs");
3718
- const { collectMigrations } = await import("./collect-8i0wU63d.mjs");
3719
- const { validateMigrations } = await import("./validate-DY1U9rET.mjs");
3508
+ const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-Bf94YVJK.mjs");
3509
+ const { collectMigrations } = await import("./collect-B6nlSnsb.mjs");
3510
+ const { validateMigrations } = await import("./validate-CZYUIfR-.mjs");
3720
3511
  const dbPath = getMiniflareDatabasePath(persistRoot, databaseId);
3721
3512
  const allMigrations = collectMigrations(migrationsDir);
3722
3513
  const appliedRows = await getAppliedMigrations(dbPath);
@@ -3872,16 +3663,43 @@ async function readWorkerdNodeBuiltins(compat) {
3872
3663
  });
3873
3664
  return /* @__PURE__ */ new Set([...external.map((name) => name.replace(/^node:/, "")), "process"]);
3874
3665
  }
3875
- function createServerRuntimeOptimizerPlugin(dialect, readCompat) {
3666
+ function createServerRuntimeOptimizerPlugin(dialect, readCompat, ssrEntry = null, nativeWorker) {
3876
3667
  let workerdNodeBuiltins;
3668
+ let scanNativeWorker = false;
3669
+ let hasExplicitWorkerEntries = false;
3877
3670
  return {
3878
3671
  name: "void:server-runtime-optimizer",
3879
- configEnvironment(name, environment) {
3672
+ config: {
3673
+ order: "pre",
3674
+ handler(config, { command, isPreview }) {
3675
+ scanNativeWorker = nativeWorker !== void 0 && command === "serve" && !isPreview;
3676
+ if (!scanNativeWorker) return;
3677
+ const optimizer = config.environments?.[DEFAULT_WORKER_ENVIRONMENT_NAME]?.optimizeDeps;
3678
+ hasExplicitWorkerEntries = optimizer?.entries !== void 0;
3679
+ if (typeof optimizer?.entries === "string") optimizer.entries = [optimizer.entries];
3680
+ }
3681
+ },
3682
+ async configEnvironment(name, environment) {
3880
3683
  if (name === "client") return;
3881
3684
  if (!environment.resolve?.conditions?.includes("workerd")) return { optimizeDeps: { exclude: ["void"] } };
3685
+ const entries = ssrEntry ? [ssrEntry] : [];
3686
+ if (name === "void_worker" && scanNativeWorker && nativeWorker) {
3687
+ const optimizer = environment.optimizeDeps ??= {};
3688
+ const generatedEntry = join(nativeWorker.root, ".void/entry.ts");
3689
+ const configured = optimizer.entries ?? generatedEntry;
3690
+ optimizer.entries = (Array.isArray(configured) ? configured : [configured]).map((entry) => entry === generatedEntry ? convertPathToPattern(entry) : entry);
3691
+ if (!hasExplicitWorkerEntries) entries.push(...await nativeWorker.scan());
3692
+ }
3882
3693
  return { optimizeDeps: {
3883
3694
  exclude: ["void", "better-auth"],
3884
- include: ["void > email-validator", ...DATABASE_DRIVER_DEPS[dialect]]
3695
+ ...entries.length > 0 ? { entries: entries.map(convertPathToPattern) } : {},
3696
+ include: [
3697
+ "void > devalue",
3698
+ "void > email-validator",
3699
+ "void > hono",
3700
+ "void > hono/route",
3701
+ ...DATABASE_DRIVER_DEPS[dialect]
3702
+ ]
3885
3703
  } };
3886
3704
  },
3887
3705
  resolveId: {
@@ -3918,7 +3736,7 @@ function injectSvelteKitBuildHooks(code, id, envModule) {
3918
3736
  }
3919
3737
  function editGetHooks(code, id, prologue, handleWrapper) {
3920
3738
  if (!code.includes("get_hooks")) return;
3921
- const hooks = (parseSync(id, code).program.body ?? []).filter((node) => node.type === "ExportNamedDeclaration").map((node) => node.declaration).filter((node) => {
3739
+ const hooks = (asAstProgram(parseSync(id, code).program).body ?? []).filter((node) => node.type === "ExportNamedDeclaration").map((node) => node.declaration).filter((node) => {
3922
3740
  const name = node?.id;
3923
3741
  return node?.type === "FunctionDeclaration" && isIdentifier(name) && name.name === "get_hooks";
3924
3742
  });
@@ -3937,9 +3755,75 @@ function editGetHooks(code, id, prologue, handleWrapper) {
3937
3755
  // src/plugin-framework.ts
3938
3756
  const handlerFile = fileURLToPath(import.meta.resolve("#self/handler"));
3939
3757
  const envModuleFile = fileURLToPath(import.meta.resolve("#self/_env"));
3940
- const voidDir = dirname(fileURLToPath(import.meta.url));
3758
+ const envPublicFile = fileURLToPath(import.meta.resolve("#self/env"));
3759
+ const voidDir = toSlash(import.meta.dirname);
3941
3760
  const ASTRO_SERVER_ENTRY = "@astrojs/cloudflare/entrypoints/server";
3942
3761
  const ASTRO_SCOPED_SERVER_ENTRY = "\0void:astro-server-entry";
3762
+ /**
3763
+ * A define value as Vite writes it into code (its handleDefineValue): a string is code, anything
3764
+ * else is JSON.
3765
+ */
3766
+ function defineValue(value) {
3767
+ if (value === void 0) return "undefined";
3768
+ return typeof value === "string" ? value : JSON.stringify(value);
3769
+ }
3770
+ /** The real path, so a symlinked id (`preserveSymlinks`) or a Windows short name still matches. */
3771
+ function realPath(file) {
3772
+ try {
3773
+ return normalizePath(realpathSync.native(file));
3774
+ } catch {
3775
+ return normalizePath(file);
3776
+ }
3777
+ }
3778
+ const IMPORT_META_ENV = "import.meta.env";
3779
+ function isNameChar(char) {
3780
+ return char !== void 0 && (char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char >= "0" && char <= "9" || char === "_" || char === "$");
3781
+ }
3782
+ /**
3783
+ * Where `import.meta.env` stands on its own: not inside a longer name, and not a property like
3784
+ * `a.import.meta.env`.
3785
+ */
3786
+ function findImportMetaEnv(code) {
3787
+ const starts = [];
3788
+ let index = code.indexOf(IMPORT_META_ENV);
3789
+ while (index !== -1) {
3790
+ const before = code[index - 1];
3791
+ if (!isNameChar(before) && before !== "." && !isNameChar(code[index + 15])) starts.push(index);
3792
+ index = code.indexOf(IMPORT_META_ENV, index + 15);
3793
+ }
3794
+ return starts;
3795
+ }
3796
+ function createAstroPublicEnvPlugin(file = envPublicFile) {
3797
+ const envPublicPath = realPath(file);
3798
+ let astroBuildEnv = {};
3799
+ return {
3800
+ name: "void:astro-public-env",
3801
+ apply: "build",
3802
+ enforce: "pre",
3803
+ configResolved(resolvedConfig) {
3804
+ astroBuildEnv = resolvedConfig.env;
3805
+ },
3806
+ transform: {
3807
+ filter: { id: /[\\/]env[\\/]public\.mjs$/ },
3808
+ handler(code, id) {
3809
+ if (this.environment?.name === "client" || realPath(id) !== envPublicPath) return;
3810
+ const values = {};
3811
+ for (const [key, value] of Object.entries(astroBuildEnv)) if (isClientEnvKey(key)) values[key] = JSON.stringify(value);
3812
+ for (const [key, value] of Object.entries(this.environment.config.define ?? {})) {
3813
+ const name = key.slice(16);
3814
+ if (key.startsWith("import.meta.env.") && isClientEnvKey(name)) values[name] = value;
3815
+ }
3816
+ const object = `{${Object.keys(values).sort().map((key) => `${JSON.stringify(key)}: ${defineValue(values[key])}`).join(", ")}}`;
3817
+ const ms = new MagicString(code);
3818
+ for (const start of findImportMetaEnv(code)) ms.overwrite(start, start + 15, `(${object})`);
3819
+ return ms.hasChanged() ? {
3820
+ code: ms.toString(),
3821
+ map: ms.generateMap({ hires: true })
3822
+ } : void 0;
3823
+ }
3824
+ }
3825
+ };
3826
+ }
3943
3827
  function createFrameworkPlugins(input) {
3944
3828
  const { localD1, root, directCloudflareDestination, bindings, config, dialect, application, bindingNames, websocketRoutes, liveConfig, detected, clientStubsPlugin, serverRuntimeOptimizerPlugin, devTriggerToken, implicitDeployGuard } = input;
3945
3829
  const frameworkPersistRoot = localD1.persistRoot;
@@ -4059,6 +3943,7 @@ export default {
4059
3943
  }
4060
3944
  }
4061
3945
  } : void 0;
3946
+ const astroPublicEnvPlugin = detected.name === "astro" ? createAstroPublicEnvPlugin() : void 0;
4062
3947
  const svelteKitWorkerBuildPlugin = detected.class === "b" && dialect !== "sqlite" ? {
4063
3948
  name: "void:sveltekit-worker-build",
4064
3949
  apply: "build",
@@ -4104,6 +3989,7 @@ export default {
4104
3989
  wranglerSyncPlugin,
4105
3990
  ...nuxtVite8WebSocketCompatPlugin ? [nuxtVite8WebSocketCompatPlugin] : [],
4106
3991
  ...astroServerEntryPlugin ? [astroServerEntryPlugin] : [],
3992
+ ...astroPublicEnvPlugin ? [astroPublicEnvPlugin] : [],
4107
3993
  svelteKitHooksInjectPlugin,
4108
3994
  ...svelteKitWorkerBuildPlugin ? [svelteKitWorkerBuildPlugin] : [],
4109
3995
  ...svelteKitD1CasingBuildPlugin ? [svelteKitD1CasingBuildPlugin] : [],
@@ -4138,7 +4024,7 @@ const CF_ONLY_REGEX = new RegExp(`^(${[
4138
4024
  "void/ai",
4139
4025
  "void/sandbox",
4140
4026
  "void/env"
4141
- ].map((s) => s.replace("/", "\\/")).join("|")})$`);
4027
+ ].map((s) => s.replace("/", String.raw`\/`)).join("|")})$`);
4142
4028
  /**
4143
4029
  * Bridge Node.js HTTP to Web API and serve via a Hono app.
4144
4030
  * Used by both dev server and preview server middleware.
@@ -4159,12 +4045,13 @@ function honoMiddleware(getApp, isViteFile) {
4159
4045
  const headers = new Headers();
4160
4046
  for (const [key, value] of Object.entries(req.headers)) if (value) headers.set(key, Array.isArray(value) ? value.join(", ") : value);
4161
4047
  const hasBody = req.method !== "GET" && req.method !== "HEAD";
4162
- const request = new Request(url.toString(), {
4048
+ const init = {
4163
4049
  method: req.method,
4164
4050
  headers,
4165
4051
  body: hasBody ? req : void 0,
4166
4052
  duplex: hasBody ? "half" : void 0
4167
- });
4053
+ };
4054
+ const request = new Request(url.toString(), init);
4168
4055
  const response = await app.fetch(request);
4169
4056
  if (response.status === 404 && (await isViteFile?.(request) || !response.headers.get("content-type")?.includes("text/html") && !response.headers.has("X-VoidPages"))) {
4170
4057
  next();
@@ -4576,13 +4463,15 @@ function restartPlugin() {
4576
4463
  function stampClientAssetCachePolicy(bundle, manifestPath, headerRules = []) {
4577
4464
  const asset = bundle[manifestPath];
4578
4465
  if (asset?.type !== "asset") return [];
4466
+ const source = typeof asset.source === "string" ? asset.source : new TextDecoder().decode(asset.source);
4467
+ const manifest = JSON.parse(source);
4468
+ if (!isClientManifest(manifest)) throw new Error(`Invalid Vite client manifest in ${manifestPath}`);
4579
4469
  const fingerprinted = /* @__PURE__ */ new Set();
4580
- const authoredCachePatterns = headerRules.filter((rule) => rule.headers.some(([name]) => name.toLowerCase() === "cache-control")).map((rule) => rule.pattern);
4470
+ const authoredCachePatterns = headerRules.flatMap((rule) => rule.headers.some(([name]) => name.toLowerCase() === "cache-control") ? [rule.pattern] : []);
4581
4471
  for (const pattern of authoredCachePatterns) compilePattern(pattern);
4582
4472
  for (const item of Object.values(bundle)) if (item.type === "chunk" && typeof item.preliminaryFileName === "string" && item.preliminaryFileName !== item.fileName) {
4583
4473
  if (!authoredCachePatterns.some((pattern) => matchPattern(pattern, "/" + item.fileName))) fingerprinted.add(item.fileName);
4584
4474
  }
4585
- const manifest = JSON.parse(String(asset.source));
4586
4475
  const stamped = /* @__PURE__ */ new Set();
4587
4476
  for (const entry of Object.values(manifest)) if (entry.file && fingerprinted.has(entry.file)) {
4588
4477
  entry.immutableFiles = [entry.file];
@@ -4605,6 +4494,18 @@ const PAGE_VIRTUAL_MODULE_IDS = [
4605
4494
  ];
4606
4495
  const RESOLVE_ID_FILTER = /^(virtual:void-(routes|client-worker(?::(react|vue|svelte|solid))?|client-browser(?::(react|vue|svelte|solid))?)|void(\/client(\/(react|vue|svelte|solid))?|\/queues)?)$/;
4607
4496
  const LOAD_ID_FILTER = /^virtual:void-(routes|client-worker(?::(react|vue|svelte|solid))?|client-browser(?::(react|vue|svelte|solid))?)$/;
4497
+ function resolveAuthClientFramework(config) {
4498
+ return [
4499
+ "react",
4500
+ "vue",
4501
+ "svelte",
4502
+ "solid"
4503
+ ].find((framework) => config.plugins.some((plugin) => plugin.name === `void-${framework}:pages`));
4504
+ }
4505
+ const resolveFile = (specifier) => fileURLToPath(import.meta.resolve(specifier));
4506
+ function isInDirectory(path, directory) {
4507
+ return path === directory || path.startsWith(directory + "/");
4508
+ }
4608
4509
  /**
4609
4510
  * Vite plugin that provides file-based routing.
4610
4511
  * - Scans routes/ and middleware/ directories
@@ -4650,14 +4551,11 @@ function routingPlugin(root, options) {
4650
4551
  const normalizedQueuesDir = normalizePath(queuesDir);
4651
4552
  const normalizedEmailDir = normalizePath(emailDir);
4652
4553
  const normalizedPagesDir = normalizePath(pagesDir);
4653
- const ssrEntryAbsPaths = new Set([...SSR_SERVER_ENTRY_RELATIVE_PATHS, ...SSR_CLIENT_ENTRY_RELATIVE_PATHS].map((path) => normalizePath(join(ssrDir, path.split("/").pop()))));
4554
+ const ssrEntryAbsPaths = new Set([...SSR_SERVER_ENTRY_RELATIVE_PATHS, ...SSR_CLIENT_ENTRY_RELATIVE_PATHS].map((path) => normalizePath(join(ssrDir, path.slice(path.lastIndexOf("/") + 1)))));
4654
4555
  function hasEmailHandlers() {
4655
4556
  const email = scan?.email;
4656
4557
  return Boolean(email && (email.addresses.length > 0 || email.defaultHandler));
4657
4558
  }
4658
- function isInDirectory(path, directory) {
4659
- return path === directory || path.startsWith(directory + "/");
4660
- }
4661
4559
  function writeRouteTypes() {
4662
4560
  if (!scan) return;
4663
4561
  const { dts } = generateRouteTypes(scan, routesDir, outDir, pagesDir, { typedRoutes: options.routing?.typedRoutes });
@@ -4680,7 +4578,6 @@ function routingPlugin(root, options) {
4680
4578
  clientEntryRelativePath: entries.client.relativePath
4681
4579
  } : null;
4682
4580
  }
4683
- const resolveFile = (specifier) => fileURLToPath(import.meta.resolve(specifier));
4684
4581
  const handlerFile = resolveFile("#self/handler");
4685
4582
  const authRuntimeDir = dirname(resolveFile("void/auth"));
4686
4583
  const fetchPath = resolveFile("#self/runtime/fetch");
@@ -4709,8 +4606,6 @@ function routingPlugin(root, options) {
4709
4606
  const runtimeEmailPath = resolveFile("#self/email");
4710
4607
  const compileOptions = {
4711
4608
  trailingSlash: options.routing?.trailingSlash,
4712
- honoPath: resolveFile("hono"),
4713
- honoRoutePath: resolveFile("hono/route"),
4714
4609
  runtimeEnvPath: resolveFile("#self/_env"),
4715
4610
  emailDir,
4716
4611
  projectRoot: root,
@@ -4797,7 +4692,7 @@ function routingPlugin(root, options) {
4797
4692
  if (removeAuthTypesIfPresent(outDir)) syncAuthTypesInProjectTsconfig(root);
4798
4693
  return;
4799
4694
  }
4800
- const { generateVoidAuthDatabaseModule, generateVoidAuthDrizzleSchema } = await import("./drizzle-CvSGrvdl.mjs");
4695
+ const { generateVoidAuthDatabaseModule, generateVoidAuthDrizzleSchema } = await import("./drizzle-CQ5jWuDL.mjs");
4801
4696
  const authRuntime = {
4802
4697
  dialect: compileOptions.auth.dialect,
4803
4698
  providers: compileOptions.auth.providers,
@@ -4822,14 +4717,6 @@ function routingPlugin(root, options) {
4822
4717
  let isrRevalidate;
4823
4718
  let isrPages;
4824
4719
  let isrPathRevalidate;
4825
- function resolveAuthClientFramework(config) {
4826
- return [
4827
- "react",
4828
- "vue",
4829
- "svelte",
4830
- "solid"
4831
- ].find((framework) => config.plugins.some((plugin) => plugin.name === `void-${framework}:pages`));
4832
- }
4833
4720
  function getClientAuthPath(id) {
4834
4721
  const framework = VIRTUAL_CLIENT_RE.exec(id)?.[2];
4835
4722
  return framework ? explicitAuthClientPaths[framework] : authClientPath;
@@ -4849,7 +4736,7 @@ function routingPlugin(root, options) {
4849
4736
  function getPagesCompileOptions() {
4850
4737
  if (!scan || scan.pages.pages.length === 0 && !scan.pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory)) return null;
4851
4738
  const hasIslandPages = scan.pages.pages.some((p) => p.island);
4852
- const mdPlugin = resolvedConfig?.plugins?.find((p) => p.name === "void-md");
4739
+ const mdPlugin = resolvedConfig?.plugins?.find((plugin) => plugin.name === "void-md");
4853
4740
  const mdClientEntryId = hasIslandPages && mdPlugin?.api?.clientEntryId ? mdPlugin.api.clientEntryId : void 0;
4854
4741
  return {
4855
4742
  pagesDir,
@@ -4860,8 +4747,12 @@ function routingPlugin(root, options) {
4860
4747
  headConfig: options.headConfig
4861
4748
  };
4862
4749
  }
4750
+ function completedScan() {
4751
+ if (!scan) throw new Error("Expected route analysis to complete before generating routes.");
4752
+ return scan;
4753
+ }
4863
4754
  function resolveCurrentAssetRoutingPolicy() {
4864
- const { pages, routes, websockets = [], middleware } = scan;
4755
+ const { pages, routes, websockets = [], middleware } = completedScan();
4865
4756
  return resolveAssetRoutingPolicy({
4866
4757
  isSsr: Boolean(ssr),
4867
4758
  hasPages: pages.pages.length > 0 || !!pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory),
@@ -4960,19 +4851,20 @@ function routingPlugin(root, options) {
4960
4851
  runtimePath: sandboxRuntimePath
4961
4852
  } : false;
4962
4853
  function writeNodeEntries(target) {
4963
- writeFileIfChanged(join(outDir, "app.ts"), compileNodeApp(target, compileOptions.honoPath, getEnvSchemaModule()));
4854
+ writeFileIfChanged(join(outDir, "app.ts"), compileNodeApp(target, getEnvSchemaModule()));
4964
4855
  writeFileIfChanged(join(outDir, "index.ts"), compileNodeServer(target));
4965
4856
  }
4966
4857
  /** Write the Cloudflare worker entry from the completed scan. */
4967
4858
  function writeWorkerEntry(isr) {
4859
+ const { queues, websockets = [] } = completedScan();
4968
4860
  const policy = resolveCurrentAssetRoutingPolicy();
4969
4861
  writeFileIfChanged(join(outDir, "entry.ts"), compileWorkerEntry({
4970
4862
  versionMetadataBinding: options.getVersionMetadataBinding?.(),
4971
4863
  alwaysUseHttps: options.routing?.alwaysUseHttps === true && resolvedConfig?.command === "build" && !compileOptions.managedDispatch,
4972
- hasQueues: scan.queues.length > 0,
4864
+ hasQueues: queues.length > 0,
4973
4865
  remote,
4974
4866
  assetsDir: resolvedConfig?.build.assetsDir,
4975
- webSocketClasses: [...(scan.websockets ?? []).map((route) => route.className), ...options.websocketTombstones ?? []],
4867
+ webSocketClasses: [...websockets.map((route) => route.className), ...options.websocketTombstones ?? []],
4976
4868
  runtimeEnvPath: compileOptions.runtimeEnvPath,
4977
4869
  runtimeEmailPath,
4978
4870
  envSchemaModule: getEnvSchemaModule(),
@@ -5087,7 +4979,7 @@ function routingPlugin(root, options) {
5087
4979
  if (!options.target) {
5088
4980
  const migrationsDir = paths.migrationsDir;
5089
4981
  if (existsSync(migrationsDir) || compileOptions.auth) {
5090
- const { collectMigrations } = await import("./collect-8i0wU63d.mjs");
4982
+ const { collectMigrations } = await import("./collect-B6nlSnsb.mjs");
5091
4983
  const { buildMigrationPlanBundle } = await import("./plan-CQ-N4gws.mjs");
5092
4984
  const migrations = existsSync(migrationsDir) ? collectMigrations(migrationsDir) : [];
5093
4985
  const dialect = getDatabaseDialect(readConfig(root));
@@ -5099,11 +4991,12 @@ function routingPlugin(root, options) {
5099
4991
  if (options.target) writeNodeEntries(options.target);
5100
4992
  else {
5101
4993
  const buildConfig = readConfig(root);
5102
- const merged = collectRevalidate(buildConfig, scan.pages);
4994
+ const { pages } = completedScan();
4995
+ const merged = collectRevalidate(buildConfig, pages);
5103
4996
  const configuredRevalidate = buildConfig.routing?.revalidate;
5104
4997
  const emitIsr = resolvedConfig?.command === "build" && !process.env.VOID_DEPLOY_PROJECT_ID && hasRevalidate(merged);
5105
4998
  isrRevalidate = emitIsr ? merged : void 0;
5106
- isrPages = emitIsr ? collectPages(scan.pages, configuredRevalidate) : void 0;
4999
+ isrPages = emitIsr ? collectPages(pages, configuredRevalidate) : void 0;
5107
5000
  isrPathRevalidate = emitIsr && configuredRevalidate && typeof configuredRevalidate === "object" ? configuredRevalidate : void 0;
5108
5001
  writeWorkerEntry(emitIsr ? {
5109
5002
  runtimePath: resolveFile("@void/isr/runtime"),
@@ -5137,7 +5030,7 @@ function routingPlugin(root, options) {
5137
5030
  if (id !== VIRTUAL_ROUTES_ID) return;
5138
5031
  if (this?.environment?.name === "client") throw new Error(`${VIRTUAL_ROUTES_ID} is server-only and cannot be loaded by client code.`);
5139
5032
  if (!scan) await regenerateInOrder(() => rescan());
5140
- return compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, ssr, compileOptions, getPagesCompileOptions(), isrRevalidate, isrPages, isrPathRevalidate);
5033
+ return compileRouteTable(completedScan(), routesDir, middlewareDir, jobsDir, queuesDir, ssr, compileOptions, getPagesCompileOptions(), isrRevalidate, isrPages, isrPathRevalidate);
5141
5034
  }
5142
5035
  },
5143
5036
  hotUpdate() {
@@ -5418,11 +5311,11 @@ function mergeWorkerBindings(resolved, input) {
5418
5311
  })),
5419
5312
  consumers: queues.map((q) => ({
5420
5313
  queue: cloudflareQueueName(q.name, cloudflareNames),
5421
- ...q.maxBatchSize != null && { max_batch_size: q.maxBatchSize },
5422
- ...q.maxBatchTimeout != null && { max_batch_timeout: q.maxBatchTimeout },
5423
- ...q.maxConcurrency != null && { max_concurrency: q.maxConcurrency },
5424
- ...q.maxRetries != null && { max_retries: q.maxRetries },
5425
- ...q.retryDelay != null && { retry_delay: q.retryDelay }
5314
+ ...q.maxBatchSize !== null && q.maxBatchSize !== void 0 && { max_batch_size: q.maxBatchSize },
5315
+ ...q.maxBatchTimeout !== null && q.maxBatchTimeout !== void 0 && { max_batch_timeout: q.maxBatchTimeout },
5316
+ ...q.maxConcurrency !== null && q.maxConcurrency !== void 0 && { max_concurrency: q.maxConcurrency },
5317
+ ...q.maxRetries !== null && q.maxRetries !== void 0 && { max_retries: q.maxRetries },
5318
+ ...q.retryDelay !== null && q.retryDelay !== void 0 && { retry_delay: q.retryDelay }
5426
5319
  }))
5427
5320
  };
5428
5321
  }
@@ -5625,7 +5518,10 @@ function voidPlugin(options) {
5625
5518
  const hasInboundEmail = hasEmailHandlers(application.email);
5626
5519
  if (detected && hasInboundEmail) throw new Error("email: inbound email handlers are only supported in Void apps. Remove the email/ directory — `sendEmail` from void/email keeps working.");
5627
5520
  const clientStubsPlugin = createClientStubsPlugin();
5628
- const serverRuntimeOptimizerPlugin = createServerRuntimeOptimizerPlugin(dialect, () => readWranglerCompat(root, config));
5521
+ const serverRuntimeOptimizerPlugin = createServerRuntimeOptimizerPlugin(dialect, () => readWranglerCompat(root, config), framework ? null : getSsrServerEntryPath(root), detected || isNodeTarget(config.target) ? void 0 : {
5522
+ root,
5523
+ scan: () => getNativeWorkerSourceFiles(application)
5524
+ });
5629
5525
  const queues = framework ? [] : application.queues;
5630
5526
  const websocketRoutes = framework ? [] : application.allWebsockets;
5631
5527
  const durableObjects = application.durableObjects;
@@ -5808,8 +5704,8 @@ function voidPlugin(options) {
5808
5704
  if (hintShown) return;
5809
5705
  if (!watchDirs.some((d) => path.startsWith(d))) return;
5810
5706
  try {
5811
- const code = readFileSync(path, "utf-8");
5812
- const fileBindings = applyBindingOverrides(inferBindingsFromSource(code, path.split("/").pop()), config.inference?.bindings);
5707
+ const code = readFileSync(path, "utf8");
5708
+ const fileBindings = applyBindingOverrides(inferBindingsFromSource(code, path.slice(path.lastIndexOf("/") + 1)), config.inference?.bindings);
5813
5709
  const newBindings = [];
5814
5710
  if (fileBindings.needsD1 && !bindings.needsD1) newBindings.push("D1 (void/db)");
5815
5711
  if (fileBindings.needsKV && !bindings.needsKV) newBindings.push("KV (void/kv)");
@@ -6078,7 +5974,8 @@ function voidPlugin(options) {
6078
5974
  viteEnvironment: { name: DEFAULT_WORKER_ENVIRONMENT_NAME },
6079
5975
  config: mergeBindings,
6080
5976
  finalizeAssets(clientDir, environment) {
6081
- (environment?.config.plugins.find((plugin) => plugin.name === routes.name))?.api.finalizeCloudflareAssets(clientDir, environment.config.build.assetsDir);
5977
+ if (!environment) return;
5978
+ environment.config.plugins.find((plugin) => plugin.name === routes.name)?.api.finalizeCloudflareAssets(clientDir, environment.config.build.assetsDir);
6082
5979
  }
6083
5980
  }),
6084
5981
  prerenderPlugin(root, config),