void 0.26.1 → 0.28.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 (287) hide show
  1. package/README.md +3 -1
  2. package/dist/{account-cmd-CfUXh_nU.mjs → account-cmd-Ci00cncT.mjs} +5 -5
  3. package/dist/{agents-B_pX_HmQ.mjs → agents-CuNtT0D_.mjs} +5 -2
  4. package/dist/{application-analysis-DKy02UY0.mjs → application-analysis-D72ZQfMZ.mjs} +118 -135
  5. package/dist/{application-routing-DQyUh_5S.mjs → application-routing-Dy589Vgn.mjs} +1 -2
  6. package/dist/atomic-write-Dq6R0BPN.mjs +18 -0
  7. package/dist/{auth-B5_tZLxT.mjs → auth-B6iOCjKI.mjs} +23 -56
  8. package/dist/{auth-link-D5RmKnzh.mjs → auth-link-DWr6Afao.mjs} +10 -10
  9. package/dist/{auth-migrations-BwHgeEsD.mjs → auth-migrations-Cgs0k6lS.mjs} +28 -5
  10. package/dist/{auth-router-Bap-pvbn.mjs → auth-router-DP14wVkZ.mjs} +4 -4
  11. package/dist/auth-wn6F8dB8.mjs +2 -0
  12. package/dist/base64-DVrOndmI.mjs +16 -0
  13. package/dist/{better-auth-shared-CPvWD3nG.d.mts → better-auth-shared-B74NJIus.d.mts} +8 -13
  14. package/dist/{better-auth-shared-DPpj8zxc.mjs → better-auth-shared-CMXlZG7W.mjs} +56 -68
  15. package/dist/{build-cmd-B58c8iS8.mjs → build-cmd-Cr3FJxv0.mjs} +5 -5
  16. package/dist/{cache-Bo52trKF.mjs → cache-D0Tt28cn.mjs} +5 -5
  17. package/dist/{cancel-deploy-BZNz3Q26.mjs → cancel-deploy-CJKvk7AN.mjs} +4 -4
  18. package/dist/{cf-access-TWNzXltp.mjs → cf-access-BM9G0lhO.mjs} +4 -3
  19. package/dist/{cf-access-ngGqZpHZ.mjs → cf-access-CWP4avfP.mjs} +3 -7
  20. package/dist/cf-build-output-2u583yJK.mjs +2 -0
  21. package/dist/{cf-build-output-DjvB_872.mjs → cf-build-output-Bc8i3dzE.mjs} +2 -2
  22. package/dist/cf-user-agent-ChjQp2MU.mjs +33 -0
  23. package/dist/cli/cli.mjs +198 -311
  24. package/dist/cli/cloudflare-operation-process.mjs +46 -14
  25. package/dist/cli/env-schema-probe.d.mts +5 -43
  26. package/dist/cli/env-schema-probe.mjs +14 -80
  27. package/dist/client-C1BjRn3g.mjs +2 -0
  28. package/dist/{client-C2Prx_Bi.mjs → client-DM9Kcf4e.mjs} +161 -415
  29. package/dist/{cloudflare-auth-CuxfF6OA.mjs → cloudflare-auth-CqFBDo52.mjs} +12 -39
  30. package/dist/{cloudflare-cmd-lHqNlJGW.mjs → cloudflare-cmd-CTrn-lXJ.mjs} +6 -5
  31. package/dist/{cloudflare-config-BmhBv3HV.mjs → cloudflare-config-DV60XFFK.mjs} +16 -28
  32. package/dist/{cloudflare-connect-2G3rL2rP.mjs → cloudflare-connect-BosmCNlq.mjs} +3 -3
  33. package/dist/{cloudflare-operations-CwI1bChl.mjs → cloudflare-operations-BKdSfNBN.mjs} +26 -34
  34. package/dist/{cloudflare-operations-BlYLlowZ.mjs → cloudflare-operations-Ds-lX3Ts.mjs} +1 -1
  35. package/dist/{cloudflare-process-2-TfIEzB.mjs → cloudflare-process-CeDWJRhj.mjs} +12 -7
  36. package/dist/collect-NUlJMpLY.mjs +2 -0
  37. package/dist/{collect-DiTn9yr6.mjs → collect-xjffdCdk.mjs} +1 -1
  38. package/dist/{config-CSa15FvD.d.mts → config-7qoq2p9v.d.mts} +2 -2
  39. package/dist/{config-CLYAosnQ.mjs → config-BEm9vRvS.mjs} +11 -5
  40. package/dist/{config-DiowPT80.mjs → config-Bx_1SpnO.mjs} +87 -177
  41. package/dist/config-CNnrSMYm.mjs +2 -0
  42. package/dist/{config-DPByhVck.mjs → config-D0GY5ItR.mjs} +1 -1
  43. package/dist/config-entry.d.mts +1 -1
  44. package/dist/{connect-X0MUA1gk.mjs → connect-nukQSoEO.mjs} +8 -8
  45. package/dist/{create-project-DxiyW6iX.mjs → create-project-D4APeBwX.mjs} +7 -7
  46. package/dist/{create-project-iwkbqiBU.mjs → create-project-DL7YXpjj.mjs} +1 -1
  47. package/dist/{db-XnVMHzoV.mjs → db-27RztQLy.mjs} +173 -263
  48. package/dist/{delete-esYlMiSJ.mjs → delete-BbsZFZIw.mjs} +5 -5
  49. package/dist/deploy-B06EQq4t.mjs +6009 -0
  50. package/dist/deploy-Db2ALnQP.mjs +3 -0
  51. package/dist/deploy-managed-static-CGswbcay.mjs +2277 -0
  52. package/dist/deploy-transport-BiicfoQW.mjs +180 -0
  53. package/dist/deploy.d.mts +10 -0
  54. package/dist/deploy.mjs +82 -0
  55. package/dist/dev-inbox-Rd6j_8vM.mjs +217 -0
  56. package/dist/discover-CTUiSsfG.mjs +2 -0
  57. package/dist/{discover-CkCYv9T_.mjs → discover-D2PGT63u.mjs} +2 -2
  58. package/dist/{dist-BVqXeR_h.mjs → dist-ipQi0Q8y.mjs} +2 -3
  59. package/dist/{domain-CbbBWhWE.mjs → domain-Bfq9n03H.mjs} +7 -22
  60. package/dist/{dotenv-BfU6eqFt.mjs → dotenv-CNazY3-w.mjs} +4 -16
  61. package/dist/{email-d_Aux1vM.mjs → email-BcjSyAL0.mjs} +4 -20
  62. package/dist/{email-CpuT42g7.mjs → email-DIwaQU4P.mjs} +99 -191
  63. package/dist/email-cloudflare-CH053RxK.mjs +1096 -0
  64. package/dist/email-protocol-D9nTvhCp.mjs +82 -0
  65. package/dist/{entry-CMAkqBmU.mjs → entry-ehmBvs5w.mjs} +2 -2
  66. package/dist/{env-BxocywBB.mjs → env-BJjULvL0.mjs} +2 -2
  67. package/dist/{env-DMA3cXZt.mjs → env-BhdWMrNy.mjs} +2 -13
  68. package/dist/{env-w9jOyGZn.mjs → env-C6ipBLp3.mjs} +8 -8
  69. package/dist/{env-public-DR7ZM6d-.d.mts → env-public-CCdykygU.d.mts} +6 -23
  70. package/dist/{env-raw-jZpP5n47.mjs → env-raw-Cklzcde3.mjs} +3 -20
  71. package/dist/{env-types-CwXgeMgL.mjs → env-types-DS2_y4X8.mjs} +2 -2
  72. package/dist/{env-validation-CrVNjsPm.mjs → env-validation-CTn-HhG1.mjs} +1 -1
  73. package/dist/env-validation-cE0zcmzO.mjs +486 -0
  74. package/dist/{gen-DtkQhvQg.mjs → gen-CnN1Xidx.mjs} +131 -253
  75. package/dist/gen-F8pSZnhc.mjs +2 -0
  76. package/dist/{generate-GDbL7sUr.mjs → generate-Dat0UTry.mjs} +38 -4
  77. package/dist/generate-Rii9klHB.mjs +2 -0
  78. package/dist/generated-wrangler-config-DeWj5F9Y.mjs +18 -0
  79. package/dist/{github-cmd-D_FsOFxq.mjs → github-cmd-BdkU4Nhe.mjs} +27 -71
  80. package/dist/{handler-BHAn2fZJ.mjs → handler-BZ1t7-Rv.mjs} +2 -2
  81. package/dist/{handler-CNAwjRcW.d.mts → handler-_PqY82xe.d.mts} +1 -1
  82. package/dist/{headers-DlfR78Nu.mjs → headers-Di1FsD3e.mjs} +26 -81
  83. package/dist/{help-CVFBTmBx.mjs → help-Bug7pyK_.mjs} +18 -10
  84. package/dist/help-s9q7LTcu.mjs +2 -0
  85. package/dist/{inbound-PfQDLXc5.mjs → inbound-DmkTQeWp.mjs} +71 -222
  86. package/dist/{inbound-CH5Mksyy.d.mts → inbound-brj2-TM5.d.mts} +19 -58
  87. package/dist/index.d.mts +2 -18
  88. package/dist/index.mjs +200 -496
  89. package/dist/{info-PYWwkWyt.mjs → info-CujPwtMe.mjs} +5 -5
  90. package/dist/{init-Bw-fRKGp.mjs → init-ZWOJvc-Z.mjs} +179 -388
  91. package/dist/isr-config-DPjXM8J2.mjs +194 -0
  92. package/dist/{link-DlPG8iX3.mjs → link-UEc7bnF4.mjs} +8 -8
  93. package/dist/{list-2GN7_ueV.mjs → list-CuWeOnzk.mjs} +6 -17
  94. package/dist/{live-CgQuTpqD.mjs → live-BxLX-JqJ.mjs} +19 -17
  95. package/dist/{live-Du8jXwOW.d.mts → live-DJONVlQK.d.mts} +1 -1
  96. package/dist/load-user-env-DD5qveNU.mjs +49 -0
  97. package/dist/{local-d1-ga5O_idV.mjs → local-d1-BM3p74mm.mjs} +6 -6
  98. package/dist/{login-D-Q4xw3Q.mjs → login-CZ2Cqa-D.mjs} +11 -11
  99. package/dist/login-DhK7o1oJ.mjs +2 -0
  100. package/dist/{logs-rd8J-OFh.mjs → logs-TihRcLTk.mjs} +5 -5
  101. package/dist/migrate-BgT-hmu8.mjs +2 -0
  102. package/dist/{migrate-NLsjBbuM.mjs → migrate-uFwojusJ.mjs} +69 -21
  103. package/dist/migration-handler-Cg0Y4EPu.mjs +470 -0
  104. package/dist/{migration-handler-DM4clYj5.d.mts → migration-handler-CwlEQUoo.d.mts} +17 -26
  105. package/dist/{mime-DxCznlJq.mjs → mime-srOklVVv.mjs} +92 -395
  106. package/dist/{node-DJicPvPj.mjs → node-DoKbo1SZ.mjs} +8 -24
  107. package/dist/{operator-args-BNsW5gfp.mjs → operator-args-UnE8Y2eK.mjs} +27 -26
  108. package/dist/{operator-auth-AzVLbrr3.mjs → operator-auth-Cr2zCc-J.mjs} +2 -2
  109. package/dist/{operator-client-BQtzyG-g.mjs → operator-client-C-ROjk1I.mjs} +4 -4
  110. package/dist/{operator-cmd-B6f6Cg9Z.mjs → operator-cmd-C5lCctnc.mjs} +8 -8
  111. package/dist/operator-cmd-Cjk5DiRx.mjs +2 -0
  112. package/dist/{output-C50ag2r3.mjs → output-FNHKw5Ac.mjs} +36 -5
  113. package/dist/{package-json-DXfiT1jV.mjs → package-json-BjYqR-So.mjs} +1 -1
  114. package/dist/pages/client.d.mts +1 -1
  115. package/dist/pages/client.mjs +91 -5
  116. package/dist/pages/index.d.mts +1 -2
  117. package/dist/pages/index.mjs +6 -6
  118. package/dist/pages/islands-plugin.mjs +5 -83
  119. package/dist/pages/protocol.d.mts +2 -2
  120. package/dist/pages/protocol.mjs +1 -1
  121. package/dist/pages/serialize.mjs +1 -1
  122. package/dist/{platform-args-BoZkWQnJ.mjs → platform-args-C6Mb_I3a.mjs} +34 -58
  123. package/dist/platform-args-Cm7x-fot.mjs +2 -0
  124. package/dist/{platform-auth-config-n603OANg.mjs → platform-auth-config-CJmNkFT2.mjs} +10 -11
  125. package/dist/{platform-auth-protection-zxDr0hWW.mjs → platform-auth-protection-D5wvsI-Y.mjs} +36 -26
  126. package/dist/{platform-auth-recovery-tw9lgtgE.mjs → platform-auth-recovery-D_0I3n-1.mjs} +8 -9
  127. package/dist/{platform-cmd-C00YM14r.mjs → platform-cmd-Cuj4oUVo.mjs} +1 -1
  128. package/dist/{platform-cmd-B8-bCb7t.mjs → platform-cmd-DxxZO6e5.mjs} +17 -16
  129. package/dist/{platform-discovery-BC0HCKYt.mjs → platform-discovery-CHhNs8Nn.mjs} +1 -1
  130. package/dist/{platform-domain-p0kobLV8.mjs → platform-domain-zLXnW1G_.mjs} +5 -5
  131. package/dist/{platform-lifecycle-D_QEY32D.mjs → platform-lifecycle-DOW-wLfx.mjs} +1398 -2043
  132. package/dist/{platform-lifecycle-vFqtNPPa.mjs → platform-lifecycle-_gfnjUBr.mjs} +1 -1
  133. package/dist/{platform-management-oi-SvI3f.mjs → platform-management-CYrLvTGH.mjs} +1 -1
  134. package/dist/{platform-management-BdYblvvE.mjs → platform-management-t7HKy4-U.mjs} +632 -124
  135. package/dist/{platform-plans-config-CjiFv5J4.mjs → platform-plans-config-CNH6zbPX.mjs} +15 -11
  136. package/dist/{platform-recovery-PvNS9Nl2.mjs → platform-recovery-DeucI7A9.mjs} +6 -9
  137. package/dist/{platform-registry-P387v42A.mjs → platform-registry-B9mWX9LO.mjs} +18 -19
  138. package/dist/{platform-setup-DVe42Ws7.mjs → platform-setup-CTf6MMT9.mjs} +19 -26
  139. package/dist/{plugin-inference-BlQbOL0P.mjs → plugin-inference-DsARdQKE.mjs} +18 -33
  140. package/dist/{prepare-Dq9hTIbo.mjs → prepare-C4zfwks4.mjs} +3 -3
  141. package/dist/{prepare-Do96654b.mjs → prepare-CSH9dKTI.mjs} +11 -13
  142. package/dist/prepare-dr9uxQSV.mjs +2 -0
  143. package/dist/{prerender-render-Ct20jftc.mjs → prerender-render-Bfsumdkv.mjs} +8 -2
  144. package/dist/prerender-render.d.mts +2 -0
  145. package/dist/prerender-render.mjs +2 -2
  146. package/dist/project-DiiOBZPF.mjs +2 -0
  147. package/dist/{project-cmd-ti8_yTcA.mjs → project-cmd-Dq75AXzy.mjs} +19 -19
  148. package/dist/{project-paths-GgcMozYz.mjs → project-paths-DMvEeSau.mjs} +9 -14
  149. package/dist/{project-DQstYTxO.mjs → project-rqDnVsJN.mjs} +8 -4
  150. package/dist/{project-team-CDPE1Tsg.mjs → project-team-B3_QcStG.mjs} +6 -6
  151. package/dist/{project-token-CkZ1cN0Z.mjs → project-token-CvsRvv2I.mjs} +5 -5
  152. package/dist/{project-tsconfig-CVJhNMxs.mjs → project-tsconfig-bveqhlYA.mjs} +3 -5
  153. package/dist/{project-zero-trust-DdjLR61k.mjs → project-zero-trust-D1ICiwN_.mjs} +5 -5
  154. package/dist/{protocol-BPZaNqBo.d.mts → protocol-4H7V_3Os.d.mts} +1 -1
  155. package/dist/{protocol-CfaUwNs8.mjs → protocol-RNP0u7UY.mjs} +9 -3
  156. package/dist/{provision-BfaLiWbj.mjs → provision-DDh7ITVS.mjs} +118 -865
  157. package/dist/{requests-DFAqyYy8.mjs → requests-3CL3BuZh.mjs} +4 -4
  158. package/dist/resolve-project-B9Hr0D3n.mjs +2 -0
  159. package/dist/resolve-project-C_Cu7E8a.mjs +48 -0
  160. package/dist/{rollback-BKYXBduI.mjs → rollback-Ce1d_0J9.mjs} +7 -17
  161. package/dist/{route-types-CbtsIeFn.mjs → route-types-IrBuwJ7u.mjs} +35 -70
  162. package/dist/routing-assets-VkrKIbxE.mjs +139 -0
  163. package/dist/{runner-9wjsSZx-.mjs → runner-B5huK2eC.mjs} +1 -1
  164. package/dist/{runner-DMBKSrRk.mjs → runner-DcVDrzuR.mjs} +7 -28
  165. package/dist/{runner-mysql-CEzKtmFb.mjs → runner-mysql-CCtyI0p6.mjs} +4 -3
  166. package/dist/runner-mysql-CaJq-hd6.mjs +2 -0
  167. package/dist/runner-pg-BJhFZZG4.mjs +2 -0
  168. package/dist/{runner-pg-DV8p_zjA.mjs → runner-pg-CPd-CB_F.mjs} +1 -1
  169. package/dist/runtime/ai.mjs +9 -22
  170. package/dist/runtime/better-auth-mysql.d.mts +2 -5
  171. package/dist/runtime/better-auth-mysql.mjs +6 -31
  172. package/dist/runtime/better-auth-pg.d.mts +2 -5
  173. package/dist/runtime/better-auth-pg.mjs +6 -32
  174. package/dist/runtime/better-auth.d.mts +2 -4
  175. package/dist/runtime/better-auth.mjs +9 -19
  176. package/dist/runtime/db.mjs +1 -1
  177. package/dist/runtime/durable.d.mts +16 -0
  178. package/dist/runtime/durable.mjs +26 -2
  179. package/dist/runtime/email/testing.d.mts +1 -1
  180. package/dist/runtime/email/testing.mjs +9 -23
  181. package/dist/runtime/email-protocol.d.mts +12 -0
  182. package/dist/runtime/email-protocol.mjs +2 -70
  183. package/dist/runtime/email.d.mts +1 -1
  184. package/dist/runtime/email.mjs +79 -221
  185. package/dist/runtime/env-public.d.mts +1 -1
  186. package/dist/runtime/env-public.mjs +12 -38
  187. package/dist/runtime/env.d.mts +1 -12
  188. package/dist/runtime/env.mjs +1 -1
  189. package/dist/runtime/handler.d.mts +1 -1
  190. package/dist/runtime/handler.mjs +1 -1
  191. package/dist/runtime/isr.mjs +1 -1
  192. package/dist/runtime/kv.mjs +1 -1
  193. package/dist/runtime/live-client.d.mts +1 -1
  194. package/dist/runtime/live-server.mjs +1 -16
  195. package/dist/runtime/live.d.mts +1 -1
  196. package/dist/runtime/live.mjs +1 -1
  197. package/dist/runtime/migration-handler-mysql.d.mts +2 -2
  198. package/dist/runtime/migration-handler-mysql.mjs +3 -2
  199. package/dist/runtime/migration-handler-pg.d.mts +2 -2
  200. package/dist/runtime/migration-handler-pg.mjs +1 -1
  201. package/dist/runtime/migration-handler.d.mts +2 -2
  202. package/dist/runtime/migration-handler.mjs +2 -470
  203. package/dist/runtime/queues.mjs +1 -1
  204. package/dist/runtime/remote/binding-handler.mjs +62 -62
  205. package/dist/runtime/remote/index.mjs +16 -77
  206. package/dist/runtime/routing.d.mts +1 -4
  207. package/dist/runtime/routing.mjs +82 -218
  208. package/dist/runtime/sandbox-container.d.mts +2 -2
  209. package/dist/runtime/sandbox-container.mjs +2 -2
  210. package/dist/runtime/sandbox.d.mts +2 -2
  211. package/dist/runtime/sandbox.mjs +13 -6
  212. package/dist/runtime/storage.mjs +1 -1
  213. package/dist/runtime/validator.d.mts +1 -1
  214. package/dist/runtime/ws-server.d.mts +2 -3
  215. package/dist/runtime/ws-server.mjs +6 -28
  216. package/dist/runtime/ws.d.mts +1 -1
  217. package/dist/{sandbox-container-Bo0eiFKz.d.mts → sandbox-container-ChQRum-j.d.mts} +3 -1
  218. package/dist/{sandbox-container-C6ItmVuN.mjs → sandbox-container-DBKIqDEK.mjs} +12 -1
  219. package/dist/{sandbox-C5LFoJMf.d.mts → sandbox-q3waMc2T.d.mts} +1 -1
  220. package/dist/{scan-C3uDzz6J.mjs → scan-C0BMdmEd.mjs} +84 -7
  221. package/dist/{secret-BAt2KMmO.mjs → secret-B5J8bBsI.mjs} +62 -80
  222. package/dist/{serialize-BPvnNQuA.mjs → serialize-BtQyaYoC.mjs} +10 -4
  223. package/dist/{skills-BgVMvQdy.mjs → skills-BJsan98C.mjs} +2 -2
  224. package/dist/{subcommand-prompt-BSlnD1fI.mjs → subcommand-prompt-gQ-NDA-u.mjs} +38 -43
  225. package/dist/sveltekit.mjs +1 -1
  226. package/dist/validate-C9xtFOYR.mjs +2 -0
  227. package/dist/{validate-C9qJArv7.mjs → validate-CheZGRE7.mjs} +4 -8
  228. package/dist/version-metadata-DIrqEHQo.mjs +73 -0
  229. package/dist/{wrangler-D9KTuqnv.mjs → wrangler-BYs07Rxy.mjs} +119 -378
  230. package/dist/{ws-CChrrAU-.d.mts → ws-aKVYB-fA.d.mts} +1 -1
  231. package/dist/yarn-pnp-DLbEFMT0.mjs +92 -0
  232. package/docs/guide/auth.md +2 -0
  233. package/docs/guide/database/postgresql.md +2 -0
  234. package/docs/guide/database.md +2 -0
  235. package/docs/guide/deployment.md +2 -2
  236. package/docs/guide/durable-state.md +24 -0
  237. package/docs/guide/platform/administration/access.md +5 -1
  238. package/docs/guide/platform/administration/connected-apps.md +55 -0
  239. package/docs/guide/platform/installation/credentials.md +3 -1
  240. package/docs/guide/platform/installation/first-deployment.md +1 -1
  241. package/docs/guide/project-collaboration.md +1 -1
  242. package/docs/guide/quickstart.md +2 -0
  243. package/docs/guide/sandboxes.md +2 -0
  244. package/docs/reference/api/deploy.md +23 -0
  245. package/docs/reference/api/pages.md +2 -0
  246. package/docs/reference/api.md +2 -1
  247. package/docs/reference/cli/auth.md +1 -1
  248. package/docs/reference/cli/database.md +9 -3
  249. package/docs/reference/cli/deploy.md +1 -1
  250. package/docs/reference/cli/platform-installation.md +1 -1
  251. package/docs/reference/cli/setup.md +2 -0
  252. package/package.json +14 -17
  253. package/skills/void/SKILL.md +4 -2
  254. package/dist/auth-BgX2qYSY.mjs +0 -2
  255. package/dist/cf-build-output-H9a97vME.mjs +0 -2
  256. package/dist/client-By4JjMw_.mjs +0 -2
  257. package/dist/collect-DLyFDiKW.mjs +0 -2
  258. package/dist/config-5r-YpMC-.mjs +0 -2
  259. package/dist/config-B_ggY-IO.mjs +0 -89
  260. package/dist/config-BtSFvXZx.mjs +0 -2
  261. package/dist/config-write-AHGesphx.mjs +0 -61
  262. package/dist/deploy-BsEvnlJl.mjs +0 -10455
  263. package/dist/deploy-C1d-YTfp.mjs +0 -2
  264. package/dist/dev-inbox-CK-UuPob.mjs +0 -297
  265. package/dist/discover-EDUf6JJw.mjs +0 -2
  266. package/dist/dist-_UUlL6bg.mjs +0 -2
  267. package/dist/env-validation-Dxdx_5wo.mjs +0 -951
  268. package/dist/gen-dA9hW7AV.mjs +0 -2
  269. package/dist/head-client-DzmJGN4C.mjs +0 -90
  270. package/dist/help-DzKUrQvk.mjs +0 -2
  271. package/dist/login-Dc-wuTDq.mjs +0 -2
  272. package/dist/migrate-BHp07yJE.mjs +0 -2
  273. package/dist/operator-cmd-Cwn50lOV.mjs +0 -2
  274. package/dist/pages/head-client.d.mts +0 -13
  275. package/dist/pages/head-client.mjs +0 -2
  276. package/dist/platform-args-DYgITk0D.mjs +0 -2
  277. package/dist/prepare-DRUV-g3X.mjs +0 -2
  278. package/dist/project-BiaPQ7ur.mjs +0 -2
  279. package/dist/provision-Wu9ZBk9L.mjs +0 -2
  280. package/dist/resolve-project-BIeYs9Cw.mjs +0 -2
  281. package/dist/resolve-project-CP8rZs_p.mjs +0 -28
  282. package/dist/runner-mysql-CkFqZ6CE.mjs +0 -2
  283. package/dist/runner-pg-BGYRFdRp.mjs +0 -2
  284. package/dist/runtime/env-helpers.d.mts +0 -2
  285. package/dist/runtime/env-helpers.mjs +0 -2
  286. package/dist/validate-BJr9LfXy.mjs +0 -2
  287. package/dist/yarn-pnp-CUX_iTPA.mjs +0 -188
package/dist/index.mjs CHANGED
@@ -1,43 +1,45 @@
1
1
  import { n as __toESM } from "./rolldown-runtime-DXIUcv95.mjs";
2
- import { a as join, l as relative, n as dirname, u as resolve } from "./dist-BVqXeR_h.mjs";
2
+ import { a as join, c as resolve, n as dirname, s as relative } from "./dist-ipQi0Q8y.mjs";
3
3
  import { t as require_picocolors } from "./picocolors-BTps1_gs.mjs";
4
- import { d as staticModuleReferences, f as walk, m as applyBindingOverrides, n as FRAMEWORK_SCAN_DIRS, t as DEFAULT_SCAN_DIRS, u as inferBindingsFromSource } from "./plugin-inference-BlQbOL0P.mjs";
5
- import { n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-GgcMozYz.mjs";
6
- import { n as loadVoidAuthConfig } from "./config-DPByhVck.mjs";
7
- import { d as isNodeTarget, m as readConfig, u as getDatabaseDialect } from "./config-DiowPT80.mjs";
4
+ import { d as walk, l as inferBindingsFromSource, m as applyBindingOverrides, n as FRAMEWORK_SCAN_DIRS, t as DEFAULT_SCAN_DIRS, u as staticModuleReferences } from "./plugin-inference-DsARdQKE.mjs";
5
+ import { n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-DMvEeSau.mjs";
6
+ import { n as loadVoidAuthConfig } from "./config-D0GY5ItR.mjs";
7
+ import { c as isNodeTarget, d as readConfig, s as getDatabaseDialect } from "./config-Bx_1SpnO.mjs";
8
8
  import { i as isMemberExpression, n as isIdentifier, r as isLiteral } from "./ast-CPGPjb0V.mjs";
9
9
  import { t as isRouteEnabledForEnvironment } from "./parse-filename-CUbj-1MP.mjs";
10
- import { r as scanQueuesSync, s as scanJobsSync, t as analyzeApplicationSync } from "./application-analysis-DKy02UY0.mjs";
11
- import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-CMAkqBmU.mjs";
12
- import { r as hasEmailHandlers } from "./email-d_Aux1vM.mjs";
13
- import { i as resolveLayoutIds } from "./scan-C3uDzz6J.mjs";
14
- import { a as hasSandboxSqliteMigration, c as resolveSandboxConfig, i as assertSandboxNamespaceConfig, l as sandboxContainerConfig, n as DEFAULT_SANDBOX_CLASS_NAME, r as SANDBOX_MIGRATION_TAG } from "./config-B_ggY-IO.mjs";
15
- import { G as hasRevalidate, R as CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV, U as collectPages, W as collectRevalidate, _t as hasApiRoutes, et as resolveDistDir, gt as generateQueueResolverSource, it as resolveWorkerDirName, o as prerenderPages, s as prerenderPagesNode, u as SEND_EMAIL_BINDING, vt as hasDocumentRoutes, yt as resolveAssetRoutingPolicy, z as selectNativeVersionMetadataBinding } from "./deploy-BsEvnlJl.mjs";
16
- import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-vqY3pqwI.mjs";
17
- import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-DlfR78Nu.mjs";
18
- import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-DQstYTxO.mjs";
19
- import { a as restoreCloudflarePreviewPointer, r as materializeCloudflareConfig, s as stashCloudflareDeployPointer } from "./cloudflare-config-BmhBv3HV.mjs";
20
- import { D as syncWranglerBindings, E as resolveLiveBindingConfig, O as syncWranglerDurableObjects, T as readWranglerWebSocketTombstones, a as LIVE_MIGRATION_TAG, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as normalizeWranglerCompatibilityFlags, h as nextDurableObjectMigrationTag, k as syncWranglerWebSockets, m as hasDurableObjectSqliteMigration, p as findBindingNameOwner, u as ensureWranglerCompat, v as readExistingLiveBindingConfig, x as readWranglerCompat } from "./wrangler-D9KTuqnv.mjs";
21
- import { n as writeLocalD1PersistState, t as resolveLocalD1Target } from "./local-d1-ga5O_idV.mjs";
22
- import { n as scopedAccessCredentials } from "./cf-access-TWNzXltp.mjs";
23
- import { r as ensurePlatformProxyAccess } from "./cf-access-ngGqZpHZ.mjs";
24
- import { a as getApiUrl, c as getToken, o as getProxyUrl } from "./auth-B5_tZLxT.mjs";
25
- import { d as printSuccess } from "./output-C50ag2r3.mjs";
26
- import { n as ensureProjectTsconfig, r as writeFileIfChanged } from "./project-tsconfig-CVJhNMxs.mjs";
27
- import { i as generateDbDts, n as generateQueueTypes, r as DRIZZLE_OPERATORS, t as generateRouteTypes } from "./route-types-CbtsIeFn.mjs";
28
- import { t as discoverSchema } from "./discover-CkCYv9T_.mjs";
29
- import { _ as listDevMessages, a as DEV_INBOX_ENV_VAR, b as registerEmailSink, c as DEV_INBOX_TOKEN_ENV_VAR, h as findDevMessage, l as DEV_INBOX_TOKEN_HEADER, n as DEV_INBOX_ACK_VALUE, o as DEV_INBOX_MAX_CAPTURE_BYTES, p as clearDevBuffer, s as DEV_INBOX_PREFIX, t as DEV_INBOX_ACK_HEADER, u as DEV_INBOX_TOKEN_QUERY, v as parseCapturedMessage, y as pushToDevBuffer } from "./dev-inbox-CK-UuPob.mjs";
10
+ import { a as hasSandboxSqliteMigration, c as sandboxContainerConfig, i as assertSandboxNamespaceConfig, m as scanJobsSync, n as DEFAULT_SANDBOX_CLASS_NAME, r as SANDBOX_MIGRATION_TAG, s as resolveSandboxConfig, t as analyzeApplicationSync, u as scanQueuesSync } from "./application-analysis-D72ZQfMZ.mjs";
11
+ import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-ehmBvs5w.mjs";
12
+ import { r as hasEmailHandlers } from "./email-BcjSyAL0.mjs";
30
13
  import { t as MagicString } from "./dist-Cegxq8gs.mjs";
31
- import { n as scanWranglerDotenvKeys } from "./dotenv-BfU6eqFt.mjs";
32
- import { a as isClientEnvKey, c as resolveRemoteMode, i as findReservedEnvKeys, n as LOCAL_ENV_FILE, o as loadLocalEnv, r as findLegacyEnvFiles, s as reservedEnvKeysMessage } from "./env-BxocywBB.mjs";
33
- import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-CwXgeMgL.mjs";
34
- import { y as loadUserEnvFile } from "./env-validation-Dxdx_5wo.mjs";
35
- import { n as INTERNAL_BINDING_PREFIXES, t as INTERNAL_BINDING_EXACT_NAMES } from "./env-raw-jZpP5n47.mjs";
36
- import { n as completeApplicationAnalysis } from "./application-routing-DQyUh_5S.mjs";
14
+ import { i as resolveLayoutIds } from "./scan-C0BMdmEd.mjs";
15
+ import { a as resolveDistDir, c as hasApiRoutes, d as resolveAssetRoutingPolicy, l as hasDocumentRoutes, n as collectRevalidate, o as resolveWorkerDirName, r as hasRevalidate, s as generateQueueResolverSource, t as collectPages } from "./isr-config-DPjXM8J2.mjs";
16
+ import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-vqY3pqwI.mjs";
17
+ import { n as mergeRoutingRules, t as lintRoutingPhases } from "./headers-Di1FsD3e.mjs";
18
+ import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-rqDnVsJN.mjs";
19
+ import { a as restoreCloudflarePreviewPointer, r as materializeCloudflareConfig, s as stashCloudflareDeployPointer } from "./cloudflare-config-DV60XFFK.mjs";
20
+ import { D as syncWranglerBindings, E as resolveLiveBindingConfig, O as syncWranglerDurableObjects, T as readWranglerWebSocketTombstones, a as LIVE_MIGRATION_TAG, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as normalizeWranglerCompatibilityFlags, h as nextDurableObjectMigrationTag, k as syncWranglerWebSockets, m as hasDurableObjectSqliteMigration, p as findBindingNameOwner, u as ensureWranglerCompat, v as readExistingLiveBindingConfig, x as readWranglerCompat } from "./wrangler-BYs07Rxy.mjs";
21
+ import { n as writeLocalD1PersistState, t as resolveLocalD1Target } from "./local-d1-BM3p74mm.mjs";
22
+ import { n as scopedAccessCredentials } from "./cf-access-BM9G0lhO.mjs";
23
+ import { n as ensurePlatformProxyAccess } from "./cf-access-CWP4avfP.mjs";
24
+ import { a as getApiUrl, c as getToken, o as getProxyUrl } from "./auth-B6iOCjKI.mjs";
25
+ import { m as printSuccess } from "./output-FNHKw5Ac.mjs";
26
+ import { n as ensureProjectTsconfig, r as writeFileIfChanged } from "./project-tsconfig-bveqhlYA.mjs";
27
+ import { i as generateDbDts, n as generateQueueTypes, r as DRIZZLE_OPERATORS, t as generateRouteTypes } from "./route-types-IrBuwJ7u.mjs";
28
+ import { t as discoverSchema } from "./discover-D2PGT63u.mjs";
29
+ 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-Rd6j_8vM.mjs";
30
+ import { n as scanWranglerDotenvKeys } from "./dotenv-CNazY3-w.mjs";
31
+ import { a as isClientEnvKey, c as resolveRemoteMode, i as findReservedEnvKeys, n as LOCAL_ENV_FILE, o as loadLocalEnv, r as findLegacyEnvFiles, s as reservedEnvKeysMessage } from "./env-BJjULvL0.mjs";
32
+ import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-DS2_y4X8.mjs";
33
+ import { t as loadUserEnvFile } from "./load-user-env-DD5qveNU.mjs";
34
+ import { n as INTERNAL_BINDING_PREFIXES, t as INTERNAL_BINDING_EXACT_NAMES } from "./env-raw-Cklzcde3.mjs";
35
+ import { t as ASSET_EXTENSIONS } from "./routing-assets-VkrKIbxE.mjs";
36
+ import { r as selectNativeVersionMetadataBinding, t as CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV } from "./version-metadata-DIrqEHQo.mjs";
37
+ import { f as prerenderPages, n as SEND_EMAIL_BINDING, p as prerenderPagesNode } from "./email-cloudflare-CH053RxK.mjs";
37
38
  import { r as defer } from "./validation-error-Dg9Recn1.mjs";
38
- import { i as safeJsonStringify } from "./protocol-CfaUwNs8.mjs";
39
+ import { i as safeJsonStringify } from "./protocol-RNP0u7UY.mjs";
40
+ import { n as completeApplicationAnalysis } from "./application-routing-Dy589Vgn.mjs";
39
41
  import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-CF84FOVM.mjs";
40
- 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-BHAn2fZJ.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-BZ1t7-Rv.mjs";
41
43
  import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
42
44
  import { cloudflare } from "@cloudflare/vite-plugin";
43
45
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -46,7 +48,7 @@ import { appendSqliteClassMigration } from "@void/deploy-core";
46
48
  import { randomBytes, timingSafeEqual } from "node:crypto";
47
49
  import { homedir } from "node:os";
48
50
  import { isDeepStrictEqual, parseEnv } from "node:util";
49
- import { compilePattern } from "@void/edge";
51
+ import { compilePattern, matchPattern } from "@void/edge";
50
52
  //#region src/pages/dev-css-assets.ts
51
53
  var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
52
54
  const DEV_CSS_ASSET_MODULE_ID = "virtual:void-pages-dev-assets";
@@ -139,11 +141,6 @@ function createOrderedEdgeStore(root) {
139
141
  version++;
140
142
  for (const key of aliasesForId(importer)) byKey.set(key, edges);
141
143
  },
142
- deleteForId(id) {
143
- let deleted = false;
144
- for (const key of aliasesForId(id)) deleted = byKey.delete(key) || deleted;
145
- if (deleted) version++;
146
- },
147
144
  getForNode(node) {
148
145
  const keys = [node.url, node.id].filter((value) => typeof value === "string");
149
146
  for (const key of keys) {
@@ -492,10 +489,10 @@ function readVoidDevCredentials(root) {
492
489
  */
493
490
  async function runAiSetupPrompt(root, token, apiUrl, server) {
494
491
  const { select, text, isCancel, log } = await import("./dist-Bx1z6Eva.mjs");
495
- const { PlatformClient } = await import("./client-By4JjMw_.mjs");
496
- const { attachSelectedPlatform, writeProjectConfig } = await import("./project-BiaPQ7ur.mjs");
497
- const { inferDefaultSlug } = await import("./resolve-project-BIeYs9Cw.mjs");
498
- const client = new PlatformClient(token, apiUrl);
492
+ const { PlatformClient } = await import("./client-C1BjRn3g.mjs");
493
+ const { attachSelectedPlatform, writeProjectConfig } = await import("./project-DiiOBZPF.mjs");
494
+ const { inferDefaultSlug } = await import("./resolve-project-B9Hr0D3n.mjs");
495
+ const client = new PlatformClient(token, { apiUrl });
499
496
  let projects;
500
497
  try {
501
498
  projects = await client.listProjects();
@@ -521,7 +518,7 @@ async function runAiSetupPrompt(root, token, apiUrl, server) {
521
518
  let slug;
522
519
  if (result === "__create__") {
523
520
  const { validateProjectSlug } = await import("./project-slug-DofjTFd-.mjs");
524
- const { createProjectWithSlugRetry } = await import("./create-project-iwkbqiBU.mjs");
521
+ const { createProjectWithSlugRetry } = await import("./create-project-DL7YXpjj.mjs");
525
522
  let created;
526
523
  try {
527
524
  created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
@@ -546,7 +543,7 @@ async function runAiSetupPrompt(root, token, apiUrl, server) {
546
543
  projectId = project.id;
547
544
  slug = project.slug;
548
545
  }
549
- writeProjectConfig(root, attachSelectedPlatform(root, {
546
+ writeProjectConfig(root, attachSelectedPlatform({
550
547
  projectId,
551
548
  slug
552
549
  }, client.apiUrl));
@@ -832,15 +829,14 @@ function warnIfPackageJsonIsNotEsm(root) {
832
829
  * and framework mode (SvelteKit, Nuxt, Analog, Astro, TanStack Start, React
833
830
  * Router, vinext) expose `/__void/scheduled` and `/__void/queue`.
834
831
  */
835
- function devTriggersHintPlugin(root, options) {
836
- const { devTriggerToken } = options;
832
+ function devTriggersHintPlugin(root, devTriggerToken) {
837
833
  return {
838
834
  name: "void:dev-triggers-hint",
839
835
  apply: "serve",
840
836
  configureServer(server) {
841
837
  const paths = readProjectPaths(root);
842
- const jobs = scanJobsSync(root, paths.cronsDir);
843
- const queues = scanQueuesSync(root, paths.queuesDir);
838
+ const jobs = scanJobsSync(paths.cronsDir);
839
+ const queues = scanQueuesSync(paths.queuesDir);
844
840
  if (jobs.length === 0 && queues.length === 0) return;
845
841
  afterServerReady(server, () => {
846
842
  const address = server.httpServer?.address();
@@ -1044,24 +1040,17 @@ function createPrimaryDb(d1) {
1044
1040
  `;
1045
1041
  }
1046
1042
  },
1047
- async configureServer(server) {
1043
+ async configureServer() {
1048
1044
  if (!schema) return;
1049
1045
  const migrationsDir = paths.migrationsDir;
1050
1046
  if (!(existsSync(migrationsDir) && readdirSync(migrationsDir).some((f) => f.endsWith(".sql")))) {
1051
1047
  if (dialect === "sqlite") {
1052
- const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-9wjsSZx-.mjs");
1048
+ const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-B5huK2eC.mjs");
1053
1049
  if ((await getApplicationTables(getMiniflareDatabasePath(options.localD1PersistRoot ?? join(root, ".void"), options.localD1DatabaseId ?? "local")).catch(() => [])).length > 0) return;
1054
1050
  }
1055
1051
  voidWarn(`Schema found but no migrations in ${paths.sourceRelative("db/migrations")}/.\n \`void db push\` syncs the schema to your local DB without creating migration files.
1056
1052
  Run \`void db generate\` to create migration files for dev startup and deploy.`);
1057
1053
  }
1058
- const watchPath = schema.path;
1059
- const regenerate = (path) => {
1060
- if (path === watchPath || schema.type === "directory" && path.startsWith(watchPath)) generateDbDts(outDir, schema, dialect);
1061
- };
1062
- server.watcher.on("change", regenerate);
1063
- server.watcher.on("add", regenerate);
1064
- server.watcher.on("unlink", regenerate);
1065
1054
  }
1066
1055
  };
1067
1056
  }
@@ -1076,22 +1065,11 @@ const SECURITY_HEADERS = {
1076
1065
  };
1077
1066
  function emailDevInboxPlugin(options) {
1078
1067
  const { devTriggerToken } = options;
1079
- let unregister;
1080
1068
  /** `href` for an inbox path that keeps the browser session authorized. */
1081
1069
  const inboxHref = (path) => `${DEV_INBOX_PREFIX}${path}?${DEV_INBOX_TOKEN_QUERY}=${encodeURIComponent(devTriggerToken)}`;
1082
1070
  return {
1083
1071
  name: "void:email-dev-inbox",
1084
1072
  apply: "serve",
1085
- buildStart() {
1086
- if (unregister) return;
1087
- unregister = registerEmailSink((m) => pushToDevBuffer(m));
1088
- },
1089
- buildEnd() {
1090
- if (unregister) {
1091
- unregister();
1092
- unregister = void 0;
1093
- }
1094
- },
1095
1073
  configureServer(server) {
1096
1074
  const printInboxUrl = () => {
1097
1075
  const address = server.httpServer?.address();
@@ -1099,7 +1077,7 @@ function emailDevInboxPlugin(options) {
1099
1077
  if (port == null) return;
1100
1078
  voidLog(`Email inbox: http://localhost:${port}${inboxHref("")}`);
1101
1079
  };
1102
- if (server.httpServer) server.httpServer.once("listening", () => setTimeout(printInboxUrl, 100));
1080
+ afterServerReady(server, printInboxUrl);
1103
1081
  server.middlewares.use(DEV_INBOX_PREFIX, (req, res) => {
1104
1082
  const url = new URL(req.url ?? "/", "http://localhost");
1105
1083
  const path = url.pathname;
@@ -1537,38 +1515,24 @@ function pushHit(node, hits) {
1537
1515
  * • Only folds static member access: `env.FOO` and `env["FOO"]`.
1538
1516
  * Dynamic access, destructuring, and reassignment fall through to the
1539
1517
  * runtime Proxy.
1540
- * • Only folds keys with a known build-time value (build shell or schema
1541
- * `.default(...)`). Unknown keys are left as-is
1518
+ * • Only folds keys with a known build-time value (build shell, or a schema
1519
+ * `.default(...)` that the env-schema plugin adds). Unknown keys are left as-is
1542
1520
  * and the Proxy handles them at runtime — no "undefined" shoved in.
1543
1521
  * • Build-only (`apply: 'build'`). Dev runs through the Proxy so local
1544
1522
  * `.env` edits take effect without a full rebuild.
1545
1523
  */
1546
1524
  function envClientFoldPlugin() {
1547
1525
  let loadedEnv = {};
1548
- const schemaDefaults = {};
1549
- /** The merged view the transform consults for each key. */
1550
- function resolveValue(key) {
1551
- if (key in loadedEnv) return loadedEnv[key];
1552
- if (key in schemaDefaults) return schemaDefaults[key];
1553
- }
1554
1526
  return {
1555
1527
  name: "void:env-client-fold",
1556
1528
  apply: "build",
1557
1529
  enforce: "post",
1558
- async configResolved(config) {
1530
+ configResolved(config) {
1559
1531
  loadedEnv = config.env ?? {};
1560
- try {
1561
- const mod = await loadEnvPublic();
1562
- if (mod._hasRegisteredSchema()) {
1563
- const defaults = mod._getSchemaDefaults();
1564
- for (const [key, value] of Object.entries(defaults)) if (isClientEnvKey(key) && !(key in loadedEnv)) schemaDefaults[key] = value;
1565
- }
1566
- } catch {}
1567
1532
  },
1568
1533
  async transform(code, id) {
1569
1534
  if (this.environment?.name !== "client") return;
1570
1535
  if (!isVoidEnvScriptCandidate(id, code)) return;
1571
- if (Object.keys(loadedEnv).length === 0 && Object.keys(schemaDefaults).length === 0) return;
1572
1536
  let parsed;
1573
1537
  try {
1574
1538
  parsed = parseSync(id, code);
@@ -1583,7 +1547,7 @@ function envClientFoldPlugin() {
1583
1547
  let ms = null;
1584
1548
  for (const hit of hits) {
1585
1549
  if (!isClientEnvKey(hit.property)) continue;
1586
- const value = resolveValue(hit.property);
1550
+ const value = loadedEnv[hit.property];
1587
1551
  if (value === void 0) continue;
1588
1552
  if (!ms) ms = new MagicString(code);
1589
1553
  ms.overwrite(hit.start, hit.end, JSON.stringify(value));
@@ -1791,7 +1755,6 @@ function envSchemaPlugin(root, options = {}) {
1791
1755
  },
1792
1756
  async configResolved(config) {
1793
1757
  command = config.command;
1794
- await emitSchemaFacts();
1795
1758
  if (command === "build") stripLocalClientEnv(root, config, processEnvCopiesBefore);
1796
1759
  await applyClientValuesToViteEnv(config);
1797
1760
  if (command === "build" && envFile) {
@@ -1813,7 +1776,6 @@ function envSchemaPlugin(root, options = {}) {
1813
1776
  },
1814
1777
  async configureServer(server) {
1815
1778
  if (!envFile) return;
1816
- await importUserEnv();
1817
1779
  afterServerReady(server, () => {
1818
1780
  validateAndWarn();
1819
1781
  });
@@ -1850,8 +1812,8 @@ function frameworkTriggersDispatchPath(root) {
1850
1812
  */
1851
1813
  function writeFrameworkTriggersDispatch(root, devTriggerToken) {
1852
1814
  const paths = readProjectPaths(root);
1853
- const jobs = scanJobsSync(root, paths.cronsDir);
1854
- const queues = scanQueuesSync(root, paths.queuesDir);
1815
+ const jobs = scanJobsSync(paths.cronsDir);
1816
+ const queues = scanQueuesSync(paths.queuesDir);
1855
1817
  const target = frameworkTriggersDispatchPath(root);
1856
1818
  mkdirSync(dirname(target), { recursive: true });
1857
1819
  writeFileSync(target, generateModule(paths.cronsDir, paths.queuesDir, jobs, queues, devTriggerToken), { mode: DISPATCH_FILE_MODE });
@@ -2026,16 +1988,26 @@ export async function handleDevTrigger(request, env, ctx) {
2026
1988
  }
2027
1989
  `;
2028
1990
  }
2029
- /** Append any missing `lines` to the project's `.gitignore`. */
1991
+ /** Append any missing `lines` to the project's `.gitignore` and return the appended ones. */
2030
1992
  function ensureGitignoreLines(root, lines) {
2031
1993
  const gitignorePath = join(root, ".gitignore");
2032
1994
  let contents = "";
2033
1995
  if (existsSync(gitignorePath)) contents = readFileSync(gitignorePath, "utf-8");
2034
1996
  const existing = new Set(contents.split("\n").map((line) => line.trim()));
2035
1997
  const missing = lines.filter((line) => !existing.has(line));
2036
- if (missing.length === 0) return;
1998
+ if (missing.length === 0) return [];
2037
1999
  const sep = contents.length === 0 || contents.endsWith("\n") ? "" : "\n";
2038
2000
  writeFileSync(gitignorePath, `${contents}${sep}${missing.join("\n")}\n`);
2001
+ return missing;
2002
+ }
2003
+ /** Remove `lines` from the project's `.gitignore`, if it still exists. */
2004
+ function removeGitignoreLines(root, lines) {
2005
+ const gitignorePath = join(root, ".gitignore");
2006
+ if (lines.length === 0 || !existsSync(gitignorePath)) return;
2007
+ const contents = readFileSync(gitignorePath, "utf-8");
2008
+ const remove = new Set(lines);
2009
+ const next = contents.split("\n").filter((line) => !remove.has(line.trim())).join("\n");
2010
+ if (next !== contents) writeFileSync(gitignorePath, next);
2039
2011
  }
2040
2012
  const NITRO_MIDDLEWARE_FILENAME = "__void-dev-trigger.ts";
2041
2013
  function nitroMiddlewareSource(dispatchPath) {
@@ -2246,12 +2218,15 @@ export const onRequest = defineMiddleware(async (context, next) => {
2246
2218
  * one-shot snippet they can paste into their existing middleware.
2247
2219
  *
2248
2220
  * If we wrote the file we remove it on dev-server close so the user's
2249
- * source tree stays clean.
2221
+ * source tree stays clean. `src/middleware.ts` belongs to the user, so the
2222
+ * `.gitignore` line we add for it is removed too; otherwise a middleware they
2223
+ * write later would be silently left out of git.
2250
2224
  */
2251
2225
  function astroDevTriggerInjectPlugin(root) {
2252
2226
  const middlewarePath = join(root, ASTRO_MIDDLEWARE_RELATIVE);
2253
2227
  const middlewareDirIndexPath = join(root, "src", "middleware", "index.ts");
2254
2228
  let wroteFile = false;
2229
+ let addedGitignoreLines = [];
2255
2230
  const ensureFile = () => {
2256
2231
  if (existsSync(middlewarePath) || existsSync(middlewareDirIndexPath)) {
2257
2232
  voidWarn("Astro middleware already exists. To enable /__void/scheduled and /__void/queue,\n add the Void dev-trigger middleware to your existing onRequest sequence.\n See https://void.cloud/guide/jobs#local-development.");
@@ -2263,13 +2238,15 @@ function astroDevTriggerInjectPlugin(root) {
2263
2238
  };
2264
2239
  const cleanup = () => {
2265
2240
  if (wroteFile) rmSync(middlewarePath, { force: true });
2241
+ removeGitignoreLines(root, addedGitignoreLines);
2242
+ addedGitignoreLines = [];
2266
2243
  };
2267
2244
  return {
2268
2245
  name: "void:astro-dev-trigger-inject",
2269
2246
  apply: "serve",
2270
2247
  configureServer(server) {
2271
2248
  ensureFile();
2272
- if (wroteFile) ensureGitignoreLines(root, [ASTRO_MIDDLEWARE_RELATIVE]);
2249
+ if (wroteFile) addedGitignoreLines = ensureGitignoreLines(root, [ASTRO_MIDDLEWARE_RELATIVE]);
2273
2250
  server.httpServer?.once("close", cleanup);
2274
2251
  process.once("exit", cleanup);
2275
2252
  }
@@ -2285,7 +2262,6 @@ function pushDefaultErrorPageHelpers(lines, options) {
2285
2262
  projectRoot: options.projectRoot,
2286
2263
  homeDir: options.homeDir
2287
2264
  })});`);
2288
- lines.push("const serveCustomErrorPage = __errorRenderer.serveCustomPage;");
2289
2265
  lines.push("app.onError(__errorRenderer.onError);");
2290
2266
  }
2291
2267
  /**
@@ -2312,8 +2288,8 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2312
2288
  ];
2313
2289
  if (webSockets.length > 0) authImports.push("resolveVoidAuthState as __resolveVoidAuthStateRuntime");
2314
2290
  lines.push(`import { ${authImports.join(", ")} } from ${JSON.stringify(auth.authRuntimePath)};`);
2315
- if (auth.authDatabasePath) lines.push(`import { __voidAuthDatabase } from ${JSON.stringify(auth.authDatabasePath)};`);
2316
- if (auth.authSchemaPath) lines.push(`import { migrationSchema as __voidAuthMigrationSchema } from ${JSON.stringify(auth.authSchemaPath)};`);
2291
+ lines.push(`import { __voidAuthDatabase } from ${JSON.stringify(auth.authDatabasePath)};`);
2292
+ lines.push(`import { migrationSchema as __voidAuthMigrationSchema } from ${JSON.stringify(auth.authSchemaPath)};`);
2317
2293
  if (auth.authConfigPath) lines.push(`import __voidAuthConfig from ${JSON.stringify(auth.authConfigPath)};`);
2318
2294
  }
2319
2295
  if ((webSockets.length > 0 || options.webSocketTombstones?.length) && options.webSocketRuntimePath) lines.push(`import { createWebSocketDurableObject as __createWebSocketDurableObject, createWebSocketTombstoneDurableObject as __createWebSocketTombstoneDurableObject, forwardWebSocketRequest as __forwardWebSocketRequest } from ${JSON.stringify(options.webSocketRuntimePath)};`);
@@ -2330,39 +2306,10 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2330
2306
  lines.push("");
2331
2307
  if (auth) {
2332
2308
  lines.push(`const __voidAuthOptions = { dialect: ${JSON.stringify(auth.dialect)}, providers: ${JSON.stringify(auth.providers)}, userConfig: ${auth.authConfigPath ? "__voidAuthConfig" : "undefined"}, dev: ${JSON.stringify(options.dev === true)} };`);
2333
- if (webSockets.length > 0) lines.push(`const __resolveVoidAuthState = (request, env, runtime) => __resolveVoidAuthStateRuntime(request, env, runtime${auth.authDatabasePath ? ", __voidAuthDatabase" : ""});`);
2309
+ if (webSockets.length > 0) lines.push("const __resolveVoidAuthState = (request, env, runtime) => __resolveVoidAuthStateRuntime(request, env, runtime, __voidAuthDatabase);");
2334
2310
  lines.push("");
2335
2311
  }
2336
2312
  lines.push(`const app = new Hono();`);
2337
- const ASSET_EXTENSIONS = [
2338
- "png",
2339
- "jpg",
2340
- "jpeg",
2341
- "gif",
2342
- "webp",
2343
- "avif",
2344
- "svg",
2345
- "ico",
2346
- "css",
2347
- "js",
2348
- "mjs",
2349
- "cjs",
2350
- "woff",
2351
- "woff2",
2352
- "ttf",
2353
- "otf",
2354
- "eot",
2355
- "mp4",
2356
- "webm",
2357
- "mp3",
2358
- "wav",
2359
- "pdf",
2360
- "txt",
2361
- "xml",
2362
- "json",
2363
- "wasm",
2364
- "map"
2365
- ];
2366
2313
  const routePatterns = [];
2367
2314
  for (const r of scan.routes) routePatterns.push(r.pattern);
2368
2315
  if (pages && scan.pages.pages.length > 0) for (const p of scan.pages.pages) routePatterns.push(p.pattern);
@@ -2383,11 +2330,12 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2383
2330
  lines.push("app.use(__routingRuntime.requestMiddleware);");
2384
2331
  lines.push("");
2385
2332
  const emitEdgeRules = !managedDispatch;
2333
+ const fallbackRulesJson = JSON.stringify(emitEdgeRules && options.fallbackRules?.length ? options.dev ? options.fallbackRules : stripOriginForProd(options.fallbackRules) : void 0);
2386
2334
  if (emitEdgeRules && options.redirectRules?.length) compileRoutingRulesMiddleware(lines, options.redirectRules, options.dev === true);
2387
2335
  if (emitEdgeRules && options.headerRules?.length) compileHeaderMiddleware(lines, options.headerRules);
2388
2336
  if (auth) {
2389
2337
  lines.push("app.use(async (c, next) => {");
2390
- lines.push(` return runVoidAuthMiddleware(c, next, __voidAuthOptions${auth.authDatabasePath ? ", __voidAuthDatabase" : ""});`);
2338
+ lines.push(" return runVoidAuthMiddleware(c, next, __voidAuthOptions, __voidAuthDatabase);");
2391
2339
  lines.push("});");
2392
2340
  lines.push("");
2393
2341
  }
@@ -2403,11 +2351,11 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2403
2351
  if (webSockets.length > 0) lines.push("");
2404
2352
  if (auth) {
2405
2353
  lines.push("app.all(\"/api/auth\", async (c) => {");
2406
- lines.push(` return handleVoidAuthRequest(c, __voidAuthOptions${auth.authDatabasePath ? ", __voidAuthDatabase" : ""});`);
2354
+ lines.push(" return handleVoidAuthRequest(c, __voidAuthOptions, __voidAuthDatabase);");
2407
2355
  lines.push("});");
2408
2356
  lines.push("");
2409
2357
  lines.push("app.all(\"/api/auth/*\", async (c) => {");
2410
- lines.push(` return handleVoidAuthRequest(c, __voidAuthOptions${auth.authDatabasePath ? ", __voidAuthDatabase" : ""});`);
2358
+ lines.push(" return handleVoidAuthRequest(c, __voidAuthOptions, __voidAuthDatabase);");
2411
2359
  lines.push("});");
2412
2360
  lines.push("");
2413
2361
  }
@@ -2457,7 +2405,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2457
2405
  if (pages && scan.pages.pages.length > 0) compilePageRoutes(lines, scan, pages, options);
2458
2406
  for (let i = 0; i < webSockets.length; i++) lines.push(`app.all(${JSON.stringify(webSockets[i].pattern)}, (c) => __forwardWebSocketRequest(c.req.raw, c.env, __voidWebSocketRoutes[${i}]));`);
2459
2407
  if (webSockets.length > 0) lines.push("");
2460
- if (pages && scan.pages.pages.length > 0) lines.push(`app.notFound(__createPagesFallback({ routing: __routingRuntime, errors: __errorRenderer, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${JSON.stringify(emitEdgeRules && options.fallbackRules?.length ? options.dev ? options.fallbackRules : stripOriginForProd(options.fallbackRules) : void 0)} }));`);
2408
+ if (pages && scan.pages.pages.length > 0) lines.push(`app.notFound(__createPagesFallback({ routing: __routingRuntime, errors: __errorRenderer, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${fallbackRulesJson} }));`);
2461
2409
  compilePrerenderCollector(lines, scan, ssr, options);
2462
2410
  if (ssr) {
2463
2411
  lines.push(`const getClientAssetTags = __createClientAssetTags(${JSON.stringify({
@@ -2467,8 +2415,8 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2467
2415
  dev: options.dev === true,
2468
2416
  reactRefresh: options.reactRefresh
2469
2417
  })});`);
2470
- lines.push(`app.notFound(__createSsrFallback({ routing: __routingRuntime, nodeTarget: ${JSON.stringify(options.nodeTarget === true)}, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${JSON.stringify(emitEdgeRules && options.fallbackRules?.length ? options.dev ? options.fallbackRules : stripOriginForProd(options.fallbackRules) : void 0)}, load: () => import(${JSON.stringify(ssr.serverEntryPath)}), assets: getClientAssetTags }));`);
2471
- } else if (emitEdgeRules && (options.fallbackRules?.length || !options.nodeTarget && options.headerRules?.length) && !(pages && scan.pages.pages.length > 0)) lines.push(`app.notFound(__createAssetNotFound({ routing: __routingRuntime, nodeTarget: ${JSON.stringify(options.nodeTarget === true)}, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${JSON.stringify(options.fallbackRules?.length ? options.dev ? options.fallbackRules : stripOriginForProd(options.fallbackRules) : void 0)} }));`);
2418
+ lines.push(`app.notFound(__createSsrFallback({ routing: __routingRuntime, nodeTarget: ${JSON.stringify(options.nodeTarget === true)}, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${fallbackRulesJson}, load: () => import(${JSON.stringify(ssr.serverEntryPath)}), assets: getClientAssetTags }));`);
2419
+ } else if (emitEdgeRules && (options.fallbackRules?.length || !options.nodeTarget && options.headerRules?.length) && !(pages && scan.pages.pages.length > 0)) lines.push(`app.notFound(__createAssetNotFound({ routing: __routingRuntime, nodeTarget: ${JSON.stringify(options.nodeTarget === true)}, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${fallbackRulesJson} }));`);
2472
2420
  if (scan.jobs.length > 0) {
2473
2421
  for (let i = 0; i < scan.jobs.length; i++) {
2474
2422
  const job = scan.jobs[i];
@@ -2502,14 +2450,18 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2502
2450
  lines.push("export async function scheduled() {}");
2503
2451
  lines.push("");
2504
2452
  }
2505
- if (scan.jobs.length > 0) {
2506
- lines.push("const __scheduledHandler = async (c) => {");
2453
+ if (scan.jobs.length > 0 || scan.queues.length > 0) {
2454
+ lines.push("function __voidTriggerUnauthorized(c) {");
2507
2455
  lines.push(" const __token = c.req.header(\"x-void-internal\");");
2508
2456
  lines.push(" const __expected = __getRawEnv()?.__VOID_PROXY_TOKEN;");
2509
2457
  lines.push(" const __devToken = c.req.header(\"x-void-dev-trigger\");");
2510
- lines.push(" if (__VOID_SERVE ? __devToken !== __VOID_DEV_TRIGGER_TOKEN : __expected ? __token !== __expected : __token !== __VOID_BUILD_KEY) {");
2511
- lines.push(" return c.json({ error: \"unauthorized\" }, 401);");
2512
- lines.push(" }");
2458
+ lines.push(" return __VOID_SERVE ? __devToken !== __VOID_DEV_TRIGGER_TOKEN : __expected ? __token !== __expected : __token !== __VOID_BUILD_KEY;");
2459
+ lines.push("}");
2460
+ lines.push("");
2461
+ }
2462
+ if (scan.jobs.length > 0) {
2463
+ lines.push("const __scheduledHandler = async (c) => {");
2464
+ lines.push(" if (__voidTriggerUnauthorized(c)) return c.json({ error: \"unauthorized\" }, 401);");
2513
2465
  lines.push(" const { cron, scheduledTime } = await c.req.json();");
2514
2466
  lines.push(" const controller = { cron, scheduledTime, noRetry() {} };");
2515
2467
  lines.push(" await scheduled(controller, c.env, c.executionCtx);");
@@ -2560,12 +2512,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2560
2512
  lines.push("}");
2561
2513
  lines.push("");
2562
2514
  lines.push("const __queueHandler = async (c) => {");
2563
- lines.push(" const __token = c.req.header(\"x-void-internal\");");
2564
- lines.push(" const __expected = __getRawEnv()?.__VOID_PROXY_TOKEN;");
2565
- lines.push(" const __devToken = c.req.header(\"x-void-dev-trigger\");");
2566
- lines.push(" if (__VOID_SERVE ? __devToken !== __VOID_DEV_TRIGGER_TOKEN : __expected ? __token !== __expected : __token !== __VOID_BUILD_KEY) {");
2567
- lines.push(" return c.json({ error: \"unauthorized\" }, 401);");
2568
- lines.push(" }");
2515
+ lines.push(" if (__voidTriggerUnauthorized(c)) return c.json({ error: \"unauthorized\" }, 401);");
2569
2516
  lines.push(" const payload = await c.req.json();");
2570
2517
  lines.push(" const result = await __processQueue(payload, c.env);");
2571
2518
  lines.push(" return c.json(result);");
@@ -2635,19 +2582,17 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2635
2582
  lines.push(`import { createMigrationHandler as __createMigrationHandler } from ${JSON.stringify(options.migrationHandlerPath)};`);
2636
2583
  lines.push(`const __migrations = ${JSON.stringify(options.migrations)};`);
2637
2584
  lines.push(`const __migrationPlanBundle = ${JSON.stringify(options.migrationPlanBundle)};`);
2638
- lines.push(`const __migrationDialect = ${JSON.stringify(options.migrationDialect ?? "sqlite")};`);
2639
2585
  if (d1BindingName) lines.push(`function __voidGetMigrationEnv() {
2640
2586
  const env = __getRawEnv();
2641
2587
  if (!env || env[${JSON.stringify(d1BindingName)}] == null) return env;
2642
2588
  return { ...env, DB: env[${JSON.stringify(d1BindingName)}] };
2643
2589
  }`);
2644
2590
  else lines.push("function __voidGetMigrationEnv() { return __getRawEnv(); }");
2645
- lines.push("function __voidCreateMigrationRequestHandler(request, includeAuthMigrations, includePlanBundle) {");
2591
+ lines.push("function __voidCreateMigrationRequestHandler(includeAuthMigrations, includePlanBundle) {");
2646
2592
  lines.push(" return __createMigrationHandler(");
2647
2593
  lines.push(" __voidGetMigrationEnv(),");
2648
2594
  lines.push(" __migrations,");
2649
- lines.push(" __migrationDialect,");
2650
- if (auth) lines.push(` includeAuthMigrations ? () => runVoidAuthMigrations(new Request(request.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}) : undefined,`);
2595
+ if (auth) lines.push(" includeAuthMigrations ? () => runVoidAuthMigrations(__voidGetMigrationEnv(), __voidAuthOptions, __voidAuthMigrationSchema) : undefined,");
2651
2596
  else lines.push(" undefined,");
2652
2597
  lines.push(" includePlanBundle ? __migrationPlanBundle : undefined,");
2653
2598
  lines.push(" );");
@@ -2655,77 +2600,29 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2655
2600
  lines.push("export async function __voidHandleInternalRoute(request) {");
2656
2601
  lines.push(" const url = new URL(request.url);");
2657
2602
  lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate\") {");
2658
- lines.push(` return __voidCreateMigrationRequestHandler(request, ${auth ? "true" : "false"}, false)(request);`);
2603
+ lines.push(` return __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, false)(request);`);
2659
2604
  lines.push(" }");
2660
2605
  lines.push(" if (request.method === \"GET\" && url.pathname === \"/__void/migrate/capabilities\") {");
2661
- lines.push(` return __voidCreateMigrationRequestHandler(request, ${auth ? "true" : "false"}, true)(request);`);
2606
+ lines.push(` return __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, true)(request);`);
2662
2607
  lines.push(" }");
2663
2608
  lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate/app\") {");
2664
- lines.push(" return __voidCreateMigrationRequestHandler(request, false, true)(request);");
2609
+ lines.push(" return __voidCreateMigrationRequestHandler(false, true)(request);");
2665
2610
  lines.push(" }");
2666
2611
  lines.push(" if (request.method === \"GET\" && url.pathname.startsWith(\"/__void/migrate/app/attempt/\")) {");
2667
- lines.push(" return __voidCreateMigrationRequestHandler(request, false, true)(request);");
2612
+ lines.push(" return __voidCreateMigrationRequestHandler(false, true)(request);");
2668
2613
  lines.push(" }");
2669
2614
  if (auth) {
2670
2615
  lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate/auth\") {");
2671
- lines.push(" return __voidCreateMigrationRequestHandler(request, true, true)(request);");
2616
+ lines.push(" return __voidCreateMigrationRequestHandler(true, true)(request);");
2672
2617
  lines.push(" }");
2673
2618
  }
2674
2619
  lines.push(" return null;");
2675
2620
  lines.push("}");
2676
- lines.push("app.post(\"/__void/migrate\", async (c) => {");
2677
- lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
2678
- lines.push(" __voidGetMigrationEnv(),");
2679
- lines.push(" __migrations,");
2680
- lines.push(" __migrationDialect,");
2681
- if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
2682
- else lines.push(" undefined,");
2683
- lines.push(" );");
2684
- lines.push(" return __voidMigrationHandler(c.req.raw);");
2685
- lines.push("});");
2686
- lines.push("app.get(\"/__void/migrate/capabilities\", async (c) => {");
2687
- lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
2688
- lines.push(" __voidGetMigrationEnv(),");
2689
- lines.push(" __migrations,");
2690
- lines.push(" __migrationDialect,");
2691
- if (auth) lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
2692
- else lines.push(" undefined,");
2693
- lines.push(" __migrationPlanBundle,");
2694
- lines.push(" );");
2695
- lines.push(" return __voidMigrationHandler(c.req.raw);");
2696
- lines.push("});");
2697
- lines.push("app.post(\"/__void/migrate/app\", async (c) => {");
2698
- lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
2699
- lines.push(" __voidGetMigrationEnv(),");
2700
- lines.push(" __migrations,");
2701
- lines.push(" __migrationDialect,");
2702
- lines.push(" undefined,");
2703
- lines.push(" __migrationPlanBundle,");
2704
- lines.push(" );");
2705
- lines.push(" return __voidMigrationHandler(c.req.raw);");
2706
- lines.push("});");
2707
- lines.push("app.get(\"/__void/migrate/app/attempt/:attemptId\", async (c) => {");
2708
- lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
2709
- lines.push(" __voidGetMigrationEnv(),");
2710
- lines.push(" __migrations,");
2711
- lines.push(" __migrationDialect,");
2712
- lines.push(" undefined,");
2713
- lines.push(" __migrationPlanBundle,");
2714
- lines.push(" );");
2715
- lines.push(" return __voidMigrationHandler(c.req.raw);");
2716
- lines.push("});");
2717
- if (auth) {
2718
- lines.push("app.post(\"/__void/migrate/auth\", async (c) => {");
2719
- lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
2720
- lines.push(" __voidGetMigrationEnv(),");
2721
- lines.push(" __migrations,");
2722
- lines.push(" __migrationDialect,");
2723
- lines.push(` () => runVoidAuthMigrations(new Request(c.req.url), __voidGetMigrationEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}),`);
2724
- lines.push(" __migrationPlanBundle,");
2725
- lines.push(" );");
2726
- lines.push(" return __voidMigrationHandler(c.req.raw);");
2727
- lines.push("});");
2728
- }
2621
+ lines.push(`app.post("/__void/migrate", (c) => __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, false)(c.req.raw));`);
2622
+ lines.push(`app.get("/__void/migrate/capabilities", (c) => __voidCreateMigrationRequestHandler(${auth ? "true" : "false"}, true)(c.req.raw));`);
2623
+ lines.push("app.post(\"/__void/migrate/app\", (c) => __voidCreateMigrationRequestHandler(false, true)(c.req.raw));");
2624
+ lines.push("app.get(\"/__void/migrate/app/attempt/:attemptId\", (c) => __voidCreateMigrationRequestHandler(false, true)(c.req.raw));");
2625
+ if (auth) lines.push("app.post(\"/__void/migrate/auth\", (c) => __voidCreateMigrationRequestHandler(true, true)(c.req.raw));");
2729
2626
  lines.push("");
2730
2627
  } else {
2731
2628
  lines.push("export async function __voidHandleInternalRoute() { return null; }");
@@ -2905,22 +2802,7 @@ function compilePageRoutes(lines, scan, pages, options) {
2905
2802
  }
2906
2803
  lines.push("");
2907
2804
  }
2908
- /**
2909
- * Generate the asset fallthrough helper shared by native Void workers and
2910
- * Class A framework wrappers. If the app returns 404, check ASSETS binding
2911
- * for static files and set cache headers. Edge caching of hashed assets
2912
- * happens at the dispatch layer (see design doc 0042).
2913
- *
2914
- * `notFound` is the RESOLVED `assetConfig.not_found_handling` for this build
2915
- * (`resolveAssetRoutingPolicy`), and it decides what happens once the asset
2916
- * binding has also answered 404. It is a separate argument from
2917
- * `serveSpaFallback` because the two are not derived from each other: the
2918
- * common worker-first app runs with `not_found_handling: 'none'` and STILL
2919
- * wants the worker-side shell fallback (that is the whole reason the flag
2920
- * exists). They are mutually exclusive in practice — `resolveAssetRoutingPolicy`
2921
- * clears `workerSpaFallback` whenever an explicit `routing.notFound` asks for
2922
- * anything other than the SPA shell.
2923
- */
2805
+ /** Asset fallthrough shared by native Void workers and Class A framework wrappers. */
2924
2806
  function compileAssetFallbackHelper(assetsDir = "assets", serveSpaFallback = false, notFound = "none") {
2925
2807
  return `import { createAssetFallback as __createAssetFallback } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};
2926
2808
  const serveWithAssets = __createAssetFallback(${JSON.stringify({
@@ -2930,9 +2812,6 @@ const serveWithAssets = __createAssetFallback(${JSON.stringify({
2930
2812
  })});
2931
2813
  `;
2932
2814
  }
2933
- function deriveEmailRuntimePath(runtimeEnvPath) {
2934
- return runtimeEnvPath.replace(/_?env(\.[^/]+)?$/, (_m, ext) => "email" + (ext ?? ""));
2935
- }
2936
2815
  /**
2937
2816
  * Generate the Worker entry module code.
2938
2817
  * Re-exports the Hono app from the virtual module with an asset-serving
@@ -2948,7 +2827,7 @@ function deriveEmailRuntimePath(runtimeEnvPath) {
2948
2827
  * proxy-backed versions.
2949
2828
  */
2950
2829
  function compileWorkerEntry(options = {}) {
2951
- const { hasQueues = false, versionMetadataBinding, remote, assetsDir = "assets", webSocketClasses = [], runtimeEnvPath = "void/_env", runtimeEmailPath, envSchemaModule, sandbox, serveSpaFallback = false, hasEmail = false, live, dev = false, isr, notFound = "none", durableObjects = [] } = options;
2830
+ const { hasQueues = false, versionMetadataBinding, remote, assetsDir = "assets", webSocketClasses = [], runtimeEnvPath = "void/_env", runtimeEmailPath = "void/email", envSchemaModule, sandbox, serveSpaFallback = false, hasEmail = false, live, dev = false, isr, notFound = "none", durableObjects = [] } = options;
2952
2831
  const remotePath = remote?.remotePath;
2953
2832
  const remoteBindingNames = JSON.stringify(remote?.bindingNames);
2954
2833
  const createRemoteEnvCall = `createRemoteEnv(env${remote?.bindingNames ? `, ${remoteBindingNames}` : ""})`;
@@ -2986,29 +2865,15 @@ const __filterInternalBindings = (env) => __filterBindings(env, ${JSON.stringify
2986
2865
  internalRoute: __voidHandleInternalRoute,
2987
2866
  collectPrerenderPaths: __voidCollectPrerenderPaths${versionMetadataBinding ? ", versionMetadataBinding: " + JSON.stringify(versionMetadataBinding) : ""}${envSchemaModule ? ", validateEnv: _validateEnvOnce" : ""}${remotePath ? ", remoteEnv: (env) => " + createRemoteEnvCall : ""}${hasEmail ? ", emailReceipt: __handleEmailReceipt" : ""}${isr ? ", isr: { deploymentId: __VOID_ISR_DEPLOYMENT_ID, handle: (request, env, ctx, render) => handleIsr(request, env, ctx, { revalidate: __VOID_ISR_REVALIDATE, pages: __VOID_ISR_PAGES, pathRevalidate: __VOID_ISR_PATH_REVALIDATE, deploymentId: __VOID_ISR_DEPLOYMENT_ID, queryAllowlist: " + JSON.stringify(isr.queryAllowlist) + " }, render) }" : ""}
2988
2867
  })`;
2989
- const scheduledHandler = remotePath ? `async function handleScheduled(controller, env, ctx) {
2990
- ${envValidateCall} if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};
2991
- ${isrDeploymentStamp} const userEnv = __filterInternalBindings(env);
2992
- return withRuntimeEnv(env, () => scheduled(controller, userEnv, ctx));
2993
- }` : `async function handleScheduled(controller, env, ctx) {
2994
- ${envValidateCall}${isrDeploymentStamp} const userEnv = __filterInternalBindings(env);
2868
+ const remoteEnvSwap = remotePath ? ` if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};\n` : "";
2869
+ const scheduledHandler = `async function handleScheduled(controller, env, ctx) {
2870
+ ${envValidateCall}${remoteEnvSwap}${isrDeploymentStamp} const userEnv = __filterInternalBindings(env);
2995
2871
  return withRuntimeEnv(env, () => scheduled(controller, userEnv, ctx));
2996
2872
  }`;
2997
2873
  const emailImport = hasEmail ? ", __emailHandler" : "";
2998
- const emailRuntimePath = runtimeEmailPath ?? deriveEmailRuntimePath(runtimeEnvPath);
2999
- const emailProxyImport = hasEmail ? `import { createMessageProxy as __createMessageProxy, enactEmailActions as __enactEmailActions, isForwardableEmailMessage as __isForwardableEmailMessage } from ${JSON.stringify(emailRuntimePath)};\nimport { EMAIL_PROTOCOL_VERSION as __EMAIL_PROTOCOL_VERSION, encodeEmailActions as __encodeEmailActions, readEmailEnvelope as __readEmailEnvelope, verifyEmailReceiptThroughProxy as __verifyEmailReceiptThroughProxy } from "void/_email-protocol";\n` : "";
3000
- const emailHandler = hasEmail ? remotePath ? `async function handleEmail(envelope, env, ctx) {
3001
- ${envValidateCall} if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};
3002
- const userEnv = __filterInternalBindings(env);
3003
- const __relayed = typeof envelope.viaDomain === "string" && envelope.viaDomain.length > 0;
3004
- const __slug = __relayed ? undefined : (typeof env.__VOID_PROJECT_SLUG === "string" && env.__VOID_PROJECT_SLUG.length > 0 ? env.__VOID_PROJECT_SLUG : undefined);
3005
- const { message, getActions } = __createMessageProxy(envelope, { slug: __slug });
3006
- await __withRawEnv(env, () => withRuntimeEnv(env, () => __emailHandler(message, userEnv, ctx, { slug: __slug })));
3007
- const __actions = getActions();
3008
- if (__isForwardableEmailMessage(envelope)) await __enactEmailActions(envelope, __actions);
3009
- return __actions;
3010
- }` : `async function handleEmail(envelope, env, ctx) {
3011
- ${envValidateCall} const userEnv = __filterInternalBindings(env);
2874
+ const emailProxyImport = hasEmail ? `import { createMessageProxy as __createMessageProxy, enactEmailActions as __enactEmailActions, isForwardableEmailMessage as __isForwardableEmailMessage } from ${JSON.stringify(runtimeEmailPath)};\nimport { EMAIL_PROTOCOL_VERSION as __EMAIL_PROTOCOL_VERSION, encodeEmailActions as __encodeEmailActions, readEmailEnvelope as __readEmailEnvelope, verifyEmailReceiptThroughProxy as __verifyEmailReceiptThroughProxy } from "void/_email-protocol";\n` : "";
2875
+ const emailHandler = hasEmail ? `async function handleEmail(envelope, env, ctx) {
2876
+ ${envValidateCall}${remoteEnvSwap} const userEnv = __filterInternalBindings(env);
3012
2877
  const __relayed = typeof envelope.viaDomain === "string" && envelope.viaDomain.length > 0;
3013
2878
  const __slug = __relayed ? undefined : (typeof env.__VOID_PROJECT_SLUG === "string" && env.__VOID_PROJECT_SLUG.length > 0 ? env.__VOID_PROJECT_SLUG : undefined);
3014
2879
  const { message, getActions } = __createMessageProxy(envelope, { slug: __slug });
@@ -3051,14 +2916,9 @@ ${hasQueues ? ` async queue(batch) { return __voidQueue(batch, this.env, this.c
3051
2916
  }
3052
2917
  await handleEmail(message, this.env, this.ctx);
3053
2918
  }\n` : ""}}`;
3054
- if (hasQueues) return `${sandboxImport}${entryImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleInternalRoute, __withRawEnv, __processQueue${emailImport}${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
3055
- ${durableObjectImports}\n${runtimeEnvImport}${emailProxyImport}${envSchemaImport}${remoteImport}${isrImport}${filterBindingsHelper}${assetHelper}
3056
- ${fetchDeclaration}
3057
- ${scheduledHandler}
3058
- ${emailHandler}
3059
- ${emailReceiptHandler}
3060
- async function __voidQueue(batch, env, ctx) {
3061
- ${envValidateCall}${remotePath ? ` if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};\n` : ""}${isrDeploymentStamp} const userEnv = __filterInternalBindings(env);
2919
+ const queueImport = hasQueues ? ", __processQueue" : "";
2920
+ const queueFunction = hasQueues ? `async function __voidQueue(batch, env, ctx) {
2921
+ ${envValidateCall}${remoteEnvSwap}${isrDeploymentStamp} const userEnv = __filterInternalBindings(env);
3062
2922
  const messages = [...batch.messages].map(m => ({
3063
2923
  id: m.id, timestamp: m.timestamp.toISOString(),
3064
2924
  body: m.body, attempts: m.attempts,
@@ -3078,18 +2938,14 @@ ${envValidateCall}${remotePath ? ` if (env.__VOID_REMOTE === "1") env = ${creat
3078
2938
  if (!__qr.ok) throw new Error("queue: Handler failed.");
3079
2939
  }
3080
2940
 
3081
- ${webSocketClasses.map((name) => `export { ${name} };`).join("\n")}
3082
- ${liveExport}
3083
- ${sandboxExport}
3084
- ${durableObjectExports}
3085
- ${entryClass}`;
3086
- return `${sandboxImport}${entryImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleInternalRoute, __withRawEnv${emailImport}${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
2941
+ ` : "";
2942
+ return `${sandboxImport}${entryImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleInternalRoute, __withRawEnv${queueImport}${emailImport}${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
3087
2943
  ${durableObjectImports}\n${runtimeEnvImport}${emailProxyImport}${envSchemaImport}${remoteImport}${isrImport}${filterBindingsHelper}${assetHelper}
3088
2944
  ${fetchDeclaration}
3089
2945
  ${scheduledHandler}
3090
2946
  ${emailHandler}
3091
2947
  ${emailReceiptHandler}
3092
- ${webSocketClasses.map((name) => `export { ${name} };`).join("\n")}
2948
+ ${queueFunction}${webSocketClasses.map((name) => `export { ${name} };`).join("\n")}
3093
2949
  ${liveExport}
3094
2950
  ${sandboxExport}
3095
2951
  ${durableObjectExports}
@@ -3098,13 +2954,6 @@ ${entryClass}`;
3098
2954
  /**
3099
2955
  * Generate the app module — exports the Hono app with static asset serving.
3100
2956
  * This is the entry imported by `vite preview` and can be used programmatically.
3101
- *
3102
- * When `envSchemaModule` is provided, splices boot-time env validation so it
3103
- * runs on the first request (including the prerender child process spawned
3104
- * by `prerenderPagesNode`). Mirrors `compileWorkerEntry`: a side-effect import
3105
- * registers the schema, and `_validateEnvOnce` throws `EnvValidationError` on
3106
- * bad values. Env source on Node/Bun is `process.env`; on Deno it's
3107
- * `Deno.env.toObject()`.
3108
2957
  */
3109
2958
  function compileNodeApp(target, honoPath, envSchemaModule) {
3110
2959
  const staticImport = target === "bun" ? `import { serveStatic } from "hono/bun";` : target === "deno" ? `import { serveStatic } from "hono/deno";` : `import { serveStatic } from "@hono/node-server/serve-static";`;
@@ -3158,74 +3007,6 @@ function compileBrowserClient(authClientPath, fetchPath, fetchStreamPath) {
3158
3007
  export { fetchStream, StreamError } from ${JSON.stringify(fetchStreamPath)};
3159
3008
  export { auth, createAuthClient } from ${JSON.stringify(authClientPath)};`;
3160
3009
  }
3161
- /**
3162
- * Generate the server-side fetch client module for non-CF targets.
3163
- * Same as compileWorkerClient but without cloudflare:workers dependency.
3164
- * Calls app.fetch() directly (no HTTP round-trip) with ALS context forwarding.
3165
- */
3166
- function compileNodeClient(authClientPath) {
3167
- return `import app, { requestContext } from "virtual:void-routes";
3168
- import { interpolateRouteParams } from ${JSON.stringify(ROUTE_URL_PATH)};
3169
- export { auth, createAuthClient } from ${JSON.stringify(authClientPath)};
3170
-
3171
- export class FetchError extends Error {
3172
- constructor(status, statusText, data) {
3173
- super(\`fetch: Request failed with status \${status}.\`);
3174
- this.name = "FetchError";
3175
- this.status = status;
3176
- this.statusText = statusText;
3177
- this.data = data;
3178
- }
3179
- }
3180
-
3181
- export async function fetch(path, options) {
3182
- let url = interpolateRouteParams(path, options?.params);
3183
-
3184
- if (options?.query) {
3185
- const qs = new URLSearchParams(options.query).toString();
3186
- if (qs) url += "?" + qs;
3187
- }
3188
-
3189
- const method = options?.method ?? "GET";
3190
- const headers = new Headers(options?.headers);
3191
-
3192
- const store = requestContext.getStore();
3193
- if (store?.request) {
3194
- const outerReq = store.request;
3195
- if (!headers.has("cookie")) {
3196
- const cookie = outerReq.headers.get("cookie");
3197
- if (cookie) headers.set("cookie", cookie);
3198
- }
3199
- if (!headers.has("authorization")) {
3200
- const auth = outerReq.headers.get("authorization");
3201
- if (auth) headers.set("authorization", auth);
3202
- }
3203
- }
3204
-
3205
- if (options?.body != null && !headers.has("content-type")) {
3206
- headers.set("content-type", "application/json");
3207
- }
3208
-
3209
- const request = new Request("http://localhost" + url, {
3210
- method,
3211
- headers,
3212
- body: options?.body != null ? JSON.stringify(options.body) : undefined,
3213
- });
3214
-
3215
- const response = await app.fetch(request);
3216
-
3217
- if (response.status === 204) return undefined;
3218
-
3219
- const contentType = response.headers.get("content-type") ?? "";
3220
- const data = contentType.includes("application/json") ? await response.json() : await response.text();
3221
-
3222
- if (!response.ok) {
3223
- throw new FetchError(response.status, response.statusText, data);
3224
- }
3225
-
3226
- return data;
3227
- }`;
3228
- }
3229
3010
  function stripOriginForProd(rules) {
3230
3011
  return rules.map(({ origin: _origin, ...rest }) => rest);
3231
3012
  }
@@ -3239,11 +3020,13 @@ function compileHeaderMiddleware(lines, rules) {
3239
3020
  lines.push(`const __headerRules = ${JSON.stringify(rules)};`);
3240
3021
  lines.push("app.use(\"*\", __routingRuntime.headerMiddleware(__headerRules));");
3241
3022
  }
3242
- function compileWorkerClient(authClientPath) {
3023
+ /** Generate the server-side fetch client, which calls `app.fetch()` with the current request's credentials. */
3024
+ function compileWorkerClient(authClientPath, nodeTarget = false) {
3025
+ const envImport = nodeTarget ? "" : "import { env } from \"cloudflare:workers\";\n";
3026
+ const dispatch = nodeTarget ? "const response = await app.fetch(request);" : "const executionCtx = store?.executionCtx ?? { waitUntil() {}, passThroughOnException() {} };\n const response = await app.fetch(request, env, executionCtx);";
3243
3027
  return `import app, { requestContext } from "virtual:void-routes";
3244
3028
  import { interpolateRouteParams } from ${JSON.stringify(ROUTE_URL_PATH)};
3245
- import { env } from "cloudflare:workers";
3246
- export { auth, createAuthClient } from ${JSON.stringify(authClientPath)};
3029
+ ${envImport}export { auth, createAuthClient } from ${JSON.stringify(authClientPath)};
3247
3030
 
3248
3031
  export class FetchError extends Error {
3249
3032
  constructor(status, statusText, data) {
@@ -3266,7 +3049,6 @@ export async function fetch(path, options) {
3266
3049
  const method = options?.method ?? "GET";
3267
3050
  const headers = new Headers(options?.headers);
3268
3051
 
3269
- // Auto-forward cookie and authorization from the outer request via ALS
3270
3052
  const store = requestContext.getStore();
3271
3053
  if (store?.request) {
3272
3054
  const outerReq = store.request;
@@ -3284,15 +3066,13 @@ export async function fetch(path, options) {
3284
3066
  headers.set("content-type", "application/json");
3285
3067
  }
3286
3068
 
3287
- const request = new Request("http://worker.local" + url, {
3069
+ const request = new Request("${nodeTarget ? "http://localhost" : "http://worker.local"}" + url, {
3288
3070
  method,
3289
3071
  headers,
3290
3072
  body: options?.body != null ? JSON.stringify(options.body) : undefined,
3291
3073
  });
3292
3074
 
3293
- // Use real executionCtx from ALS if available, otherwise provide a no-op fallback
3294
- const executionCtx = store?.executionCtx ?? { waitUntil() {}, passThroughOnException() {} };
3295
- const response = await app.fetch(request, env, executionCtx);
3075
+ ${dispatch}
3296
3076
 
3297
3077
  if (response.status === 204) return undefined;
3298
3078
 
@@ -3460,10 +3240,10 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
3460
3240
  });
3461
3241
  return;
3462
3242
  }
3463
- const { collectMigrations } = await import("./collect-DLyFDiKW.mjs");
3464
- const { validateMigrations } = await import("./validate-BJr9LfXy.mjs");
3243
+ const { collectMigrations } = await import("./collect-NUlJMpLY.mjs");
3244
+ const { validateMigrations } = await import("./validate-C9xtFOYR.mjs");
3465
3245
  const allMigrations = collectMigrations(migrationsDir);
3466
- const appliedNames = dialect === "mysql" ? await import("./runner-mysql-CkFqZ6CE.mjs").then((runner) => runner.getMySqlAppliedMigrations(url)) : await import("./runner-pg-BGYRFdRp.mjs").then((runner) => runner.getPgAppliedMigrations(url));
3246
+ const appliedNames = dialect === "mysql" ? await import("./runner-mysql-CaJq-hd6.mjs").then((runner) => runner.getMySqlAppliedMigrations(url)) : await import("./runner-pg-BJhFZZG4.mjs").then((runner) => runner.getPgAppliedMigrations(url));
3467
3247
  const appliedSet = new Set(appliedNames);
3468
3248
  const pending = allMigrations.filter((migration) => !appliedSet.has(migration.name));
3469
3249
  if (pending.length > 0) try {
@@ -3471,12 +3251,12 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
3471
3251
  } catch (err) {
3472
3252
  voidWarn(err instanceof Error ? err.message : String(err));
3473
3253
  }
3474
- const applied = dialect === "mysql" ? await import("./runner-mysql-CkFqZ6CE.mjs").then((runner) => runner.runMySqlMigrations(migrationsDir, url)) : await import("./runner-pg-BGYRFdRp.mjs").then((runner) => runner.runPgMigrations(migrationsDir, url));
3254
+ const applied = dialect === "mysql" ? await import("./runner-mysql-CaJq-hd6.mjs").then((runner) => runner.runMySqlMigrations(migrationsDir, url)) : await import("./runner-pg-BJhFZZG4.mjs").then((runner) => runner.runPgMigrations(migrationsDir, url));
3475
3255
  if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
3476
3256
  } else if (hasSqlMigrations) {
3477
- const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-9wjsSZx-.mjs");
3478
- const { collectMigrations } = await import("./collect-DLyFDiKW.mjs");
3479
- const { validateMigrations } = await import("./validate-BJr9LfXy.mjs");
3257
+ const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-B5huK2eC.mjs");
3258
+ const { collectMigrations } = await import("./collect-NUlJMpLY.mjs");
3259
+ const { validateMigrations } = await import("./validate-C9xtFOYR.mjs");
3480
3260
  const dbPath = getMiniflareDatabasePath(persistRoot, databaseId);
3481
3261
  const allMigrations = collectMigrations(migrationsDir);
3482
3262
  const appliedRows = await getAppliedMigrations(dbPath);
@@ -3491,7 +3271,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
3491
3271
  if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
3492
3272
  }
3493
3273
  if (auth?.enabled) {
3494
- const { runLocalVoidAuthMigrations } = await import("./node-DJicPvPj.mjs");
3274
+ const { runLocalVoidAuthMigrations } = await import("./node-DoKbo1SZ.mjs");
3495
3275
  await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth.configPath);
3496
3276
  voidLog("Applied Better Auth migrations");
3497
3277
  }
@@ -3589,11 +3369,16 @@ function createWranglerCompatPersistPlugin(root, config) {
3589
3369
  }
3590
3370
  };
3591
3371
  }
3592
- function createServerRuntimeOptimizerPlugin() {
3372
+ function createServerRuntimeOptimizerPlugin(voidOwnsWorkerRuntime) {
3593
3373
  return {
3594
3374
  name: "void:server-runtime-optimizer",
3595
3375
  configEnvironment(name) {
3596
- if (name !== "client") return { optimizeDeps: { exclude: ["void"] } };
3376
+ if (name === "client") return;
3377
+ if (!voidOwnsWorkerRuntime) return { optimizeDeps: { exclude: ["void"] } };
3378
+ return { optimizeDeps: {
3379
+ exclude: ["void"],
3380
+ include: ["void > email-validator"]
3381
+ } };
3597
3382
  }
3598
3383
  };
3599
3384
  }
@@ -3621,7 +3406,7 @@ function injectSvelteKitHooks(code, id, dispatchPath) {
3621
3406
  //#endregion
3622
3407
  //#region src/plugin-framework.ts
3623
3408
  function createFrameworkPlugins(input) {
3624
- const { localD1, root, directCloudflareDestination, bindings, config, dialect, application, bindingNames, websocketRoutes, sandboxConfig, liveConfig, detected, clientStubsPlugin, serverRuntimeOptimizerPlugin, authEnabled, devTriggerToken, implicitDeployGuard } = input;
3409
+ const { localD1, root, directCloudflareDestination, bindings, config, dialect, application, bindingNames, websocketRoutes, liveConfig, detected, clientStubsPlugin, serverRuntimeOptimizerPlugin, devTriggerToken, implicitDeployGuard } = input;
3625
3410
  const frameworkPersistRoot = localD1.persistRoot;
3626
3411
  const syncFrameworkCompat = (compat) => {
3627
3412
  if (ensureWranglerCompatibilityDate(root, compat.compatibilityDate)) voidLog("Synced compatibility_date to Cloudflare config");
@@ -3651,7 +3436,6 @@ function createFrameworkPlugins(input) {
3651
3436
  bindingNames,
3652
3437
  ...directCloudflareDestination && bindings.needsAI ? { directCloudflareAi: { gateway: config.ai?.gateway } } : {},
3653
3438
  websockets: websocketRoutes,
3654
- sandbox: sandboxConfig,
3655
3439
  live: liveConfig
3656
3440
  })) voidLog("Synced bindings to Cloudflare config");
3657
3441
  };
@@ -3705,15 +3489,12 @@ function createFrameworkPlugins(input) {
3705
3489
  envClientFoldPlugin(),
3706
3490
  drizzlePlugin(root, false, dialect, {
3707
3491
  d1BindingName: bindingNames?.d1,
3708
- forceVirtualDb: authEnabled || bindingNames?.d1 !== void 0,
3492
+ forceVirtualDb: bindingNames?.d1 !== void 0,
3709
3493
  localD1DatabaseId: localD1.databaseId,
3710
3494
  localD1PersistRoot: frameworkPersistRoot
3711
3495
  }),
3712
3496
  migrationPlugin(root, dialect, localD1.databaseId, frameworkPersistRoot, { enabled: false }),
3713
- devTriggersHintPlugin(root, {
3714
- framework: true,
3715
- devTriggerToken
3716
- }),
3497
+ devTriggersHintPlugin(root, devTriggerToken),
3717
3498
  frameworkTriggersPlugin(root, { devTriggerToken }),
3718
3499
  ...detected.name === "nuxt" ? [nitroDevTriggerInjectPlugin(root, { serverDir: "server" })] : [],
3719
3500
  ...detected.name === "analog" ? [analogDevTriggerInjectPlugin(root)] : [],
@@ -4096,9 +3877,10 @@ function stampClientAssetCachePolicy(bundle, manifestPath, headerRules = []) {
4096
3877
  const asset = bundle[manifestPath];
4097
3878
  if (asset?.type !== "asset") return;
4098
3879
  const fingerprinted = /* @__PURE__ */ new Set();
4099
- const authoredCachePatterns = headerRules.filter((rule) => rule.headers.some(([name]) => name.toLowerCase() === "cache-control")).map((rule) => compilePattern(rule.pattern).regex);
3880
+ const authoredCachePatterns = headerRules.filter((rule) => rule.headers.some(([name]) => name.toLowerCase() === "cache-control")).map((rule) => rule.pattern);
3881
+ for (const pattern of authoredCachePatterns) compilePattern(pattern);
4100
3882
  for (const item of Object.values(bundle)) if (item.type === "chunk" && typeof item.preliminaryFileName === "string" && item.preliminaryFileName !== item.fileName) {
4101
- if (!authoredCachePatterns.some((pattern) => pattern.test("/" + item.fileName))) fingerprinted.add(item.fileName);
3883
+ if (!authoredCachePatterns.some((pattern) => matchPattern(pattern, "/" + item.fileName))) fingerprinted.add(item.fileName);
4102
3884
  }
4103
3885
  const manifest = JSON.parse(String(asset.source));
4104
3886
  for (const entry of Object.values(manifest)) if (entry.file && fingerprinted.has(entry.file)) entry.immutableFiles = [entry.file];
@@ -4148,7 +3930,6 @@ function routingPlugin(root, options) {
4148
3930
  const normalizedQueuesDir = normalizePath(queuesDir);
4149
3931
  const normalizedEmailDir = normalizePath(emailDir);
4150
3932
  const normalizedPagesDir = normalizePath(pagesDir);
4151
- const normalizedSsrDir = normalizePath(ssrDir);
4152
3933
  const ssrEntryAbsPaths = new Set([...SSR_SERVER_ENTRY_RELATIVE_PATHS, ...SSR_CLIENT_ENTRY_RELATIVE_PATHS].map((path) => normalizePath(join(ssrDir, path.split("/").pop()))));
4153
3934
  function hasEmailHandlers() {
4154
3935
  const email = scan?.email;
@@ -4168,17 +3949,7 @@ function routingPlugin(root, options) {
4168
3949
  writeFileIfChanged(join(outDir, "queues.d.ts"), dts);
4169
3950
  }
4170
3951
  async function rescan(refresh = false) {
4171
- let analysis = options.getApplicationAnalysis?.(routeEnvironment, refresh);
4172
- if (!analysis) {
4173
- const config = readConfig(root);
4174
- analysis = analyzeApplicationSync(root, {
4175
- config: {
4176
- ...config,
4177
- output: options.output ?? config.output
4178
- },
4179
- environment: routeEnvironment
4180
- });
4181
- }
3952
+ const analysis = options.getApplicationAnalysis(routeEnvironment, refresh);
4182
3953
  scan = (await completeApplicationAnalysis(analysis)).scan;
4183
3954
  authConfigPath = analysis.authConfigPath;
4184
3955
  const entries = validateSsrEntries(root, paths);
@@ -4203,8 +3974,7 @@ function routingPlugin(root, options) {
4203
3974
  };
4204
3975
  const remote = options.remoteMode ? {
4205
3976
  bindingNames: options.bindingNames,
4206
- remotePath: resolveFile("#self/remote"),
4207
- envPath: resolveFile("#self/_env")
3977
+ remotePath: resolveFile("#self/remote")
4208
3978
  } : void 0;
4209
3979
  function getEnvSchemaModule() {
4210
3980
  const envFile = findEnvFileForPaths(root, paths);
@@ -4214,10 +3984,10 @@ function routingPlugin(root, options) {
4214
3984
  helperPath: resolveFile("#self/env")
4215
3985
  };
4216
3986
  }
3987
+ const runtimeEmailPath = resolveFile("#self/email");
4217
3988
  const compileOptions = {
4218
3989
  honoPath: resolveFile("hono"),
4219
3990
  runtimeEnvPath: resolveFile("#self/_env"),
4220
- runtimeEmailPath: resolveFile("#self/email"),
4221
3991
  emailDir,
4222
3992
  projectRoot: root,
4223
3993
  homeDir: homedir(),
@@ -4241,10 +4011,7 @@ function routingPlugin(root, options) {
4241
4011
  dir: publicDir,
4242
4012
  routing: options.routing
4243
4013
  });
4244
- lintDuplicateSources(merged.redirectRules, "redirects/rewrites (pre-asset)");
4245
- lintDuplicateSources(merged.fallbackRules, "fallbacks (post-asset)");
4246
- lintDestinationSplats(merged.redirectRules, "redirects/rewrites (pre-asset)");
4247
- lintDestinationSplats(merged.fallbackRules, "fallbacks (post-asset)");
4014
+ lintRoutingPhases(merged);
4248
4015
  compileOptions.headerRules = merged.headerRules.length > 0 ? merged.headerRules : void 0;
4249
4016
  compileOptions.redirectRules = merged.redirectRules.length > 0 ? merged.redirectRules : void 0;
4250
4017
  compileOptions.fallbackRules = merged.fallbackRules;
@@ -4260,8 +4027,8 @@ function routingPlugin(root, options) {
4260
4027
  compileOptions.auth = {
4261
4028
  authRuntimePath: dialect === "postgresql" ? join(runtimeDir, "better-auth-pg.mjs") : dialect === "mysql" ? join(runtimeDir, "better-auth-mysql.mjs") : join(runtimeDir, "better-auth.mjs"),
4262
4029
  authConfigPath,
4263
- authDatabasePath: null,
4264
- authSchemaPath: null,
4030
+ authDatabasePath: join(outDir, "better-auth-db.ts"),
4031
+ authSchemaPath: join(outDir, "better-auth-schema.ts"),
4265
4032
  dialect,
4266
4033
  providers: config.auth?.providers ?? null
4267
4034
  };
@@ -4277,16 +4044,13 @@ function routingPlugin(root, options) {
4277
4044
  ...resolvedConfig?.command === "serve" ? loadLocalEnv(root) : {},
4278
4045
  ...process.env
4279
4046
  };
4280
- const schemaPath = join(outDir, "better-auth-schema.ts");
4281
- const databasePath = join(outDir, "better-auth-db.ts");
4282
- writeFileIfChanged(schemaPath, generateVoidAuthDrizzleSchema(authRuntime, env));
4283
- writeFileIfChanged(databasePath, generateVoidAuthDatabaseModule({
4047
+ const { authSchemaPath, authDatabasePath } = compileOptions.auth;
4048
+ writeFileIfChanged(authSchemaPath, generateVoidAuthDrizzleSchema(authRuntime, env));
4049
+ writeFileIfChanged(authDatabasePath, generateVoidAuthDatabaseModule({
4284
4050
  dialect: compileOptions.auth.dialect,
4285
- schemaImportPath: schemaPath,
4051
+ schemaImportPath: authSchemaPath,
4286
4052
  drizzleAdapterPath
4287
4053
  }));
4288
- compileOptions.auth.authSchemaPath = schemaPath;
4289
- compileOptions.auth.authDatabasePath = databasePath;
4290
4054
  }
4291
4055
  let resolvedConfig = null;
4292
4056
  let isrRevalidate;
@@ -4328,38 +4092,15 @@ function routingPlugin(root, options) {
4328
4092
  headConfig: options.headConfig
4329
4093
  };
4330
4094
  }
4331
- function shouldServeSpaFallback() {
4332
- if (!scan) return false;
4333
- return resolveCurrentAssetRoutingPolicy().workerSpaFallback;
4334
- }
4335
- /**
4336
- * The `not_found_handling` the generated worker entry must agree with. Read
4337
- * off the SAME resolved policy that produces the wrangler asset config, so
4338
- * the emitted `serveWithAssets` can never disagree with the platform switch
4339
- * it is standing in for.
4340
- */
4341
- function currentNotFoundHandling() {
4342
- return resolveCurrentAssetRoutingPolicy().assetConfig.not_found_handling ?? "none";
4343
- }
4344
4095
  function resolveCurrentAssetRoutingPolicy() {
4345
- if (!scan) return resolveAssetRoutingPolicy({
4346
- isSsr: Boolean(ssr),
4347
- hasPages: false,
4348
- hasApiRoutes: compileOptions.auth !== null,
4349
- hasDocumentRoutes: false,
4350
- hasMiddleware: false,
4351
- hasWebSockets: false,
4352
- authEnabled: compileOptions.auth !== null,
4353
- liveEnabled: options.live !== void 0,
4354
- notFound: options.routing?.notFound
4355
- });
4096
+ const { pages, routes, websockets = [], middleware } = scan;
4356
4097
  return resolveAssetRoutingPolicy({
4357
4098
  isSsr: Boolean(ssr),
4358
- hasPages: scan.pages.pages.length > 0,
4359
- hasApiRoutes: hasApiRoutes(scan.routes) || hasApiRoutes(scan.websockets ?? []) || compileOptions.auth !== null,
4360
- hasDocumentRoutes: hasDocumentRoutes(scan.routes),
4361
- hasMiddleware: scan.middleware.length > 0,
4362
- hasWebSockets: hasDocumentRoutes(scan.websockets ?? []),
4099
+ hasPages: pages.pages.length > 0,
4100
+ hasApiRoutes: hasApiRoutes(routes) || hasApiRoutes(websockets) || compileOptions.auth !== null,
4101
+ hasDocumentRoutes: hasDocumentRoutes(routes),
4102
+ hasMiddleware: middleware.length > 0,
4103
+ hasWebSockets: hasDocumentRoutes(websockets),
4363
4104
  authEnabled: compileOptions.auth !== null,
4364
4105
  liveEnabled: options.live !== void 0,
4365
4106
  notFound: options.routing?.notFound
@@ -4377,6 +4118,7 @@ function routingPlugin(root, options) {
4377
4118
  }
4378
4119
  /** Write the Cloudflare worker entry from the completed scan. */
4379
4120
  function writeWorkerEntry(isr) {
4121
+ const policy = resolveCurrentAssetRoutingPolicy();
4380
4122
  writeFileIfChanged(join(outDir, "entry.ts"), compileWorkerEntry({
4381
4123
  versionMetadataBinding: options.getVersionMetadataBinding?.(),
4382
4124
  hasQueues: scan.queues.length > 0,
@@ -4384,15 +4126,15 @@ function routingPlugin(root, options) {
4384
4126
  assetsDir: resolvedConfig?.build.assetsDir,
4385
4127
  webSocketClasses: [...(scan.websockets ?? []).map((route) => route.className), ...options.websocketTombstones ?? []],
4386
4128
  runtimeEnvPath: compileOptions.runtimeEnvPath,
4387
- runtimeEmailPath: compileOptions.runtimeEmailPath,
4129
+ runtimeEmailPath,
4388
4130
  envSchemaModule: getEnvSchemaModule(),
4389
4131
  sandbox: sandboxEntry,
4390
4132
  hasEmail: hasEmailHandlers(),
4391
- serveSpaFallback: shouldServeSpaFallback(),
4133
+ serveSpaFallback: policy.workerSpaFallback,
4392
4134
  live: options.live,
4393
4135
  dev: compileOptions.dev,
4394
4136
  isr,
4395
- notFound: currentNotFoundHandling(),
4137
+ notFound: policy.assetConfig.not_found_handling ?? "none",
4396
4138
  durableObjects: options.durableObjects
4397
4139
  }));
4398
4140
  }
@@ -4404,7 +4146,7 @@ function routingPlugin(root, options) {
4404
4146
  remote,
4405
4147
  webSocketClasses: options.websocketTombstones,
4406
4148
  runtimeEnvPath: compileOptions.runtimeEnvPath,
4407
- runtimeEmailPath: compileOptions.runtimeEmailPath,
4149
+ runtimeEmailPath,
4408
4150
  envSchemaModule: getEnvSchemaModule(),
4409
4151
  sandbox: sandboxEntry,
4410
4152
  live: options.live,
@@ -4470,14 +4212,13 @@ function routingPlugin(root, options) {
4470
4212
  if (!options.target) {
4471
4213
  const migrationsDir = paths.migrationsDir;
4472
4214
  if (existsSync(migrationsDir) || compileOptions.auth) {
4473
- const { collectMigrations } = await import("./collect-DLyFDiKW.mjs");
4215
+ const { collectMigrations } = await import("./collect-NUlJMpLY.mjs");
4474
4216
  const { buildMigrationPlanBundle } = await import("./plan-CH2G51je.mjs");
4475
4217
  const migrations = existsSync(migrationsDir) ? collectMigrations(migrationsDir) : [];
4476
4218
  const dialect = getDatabaseDialect(readConfig(root));
4477
4219
  compileOptions.migrationHandlerPath = resolveFile(dialect === "postgresql" ? "#self/runtime/migration-handler-pg" : dialect === "mysql" ? "#self/runtime/migration-handler-mysql" : "#self/runtime/migration-handler");
4478
4220
  compileOptions.migrations = migrations;
4479
4221
  compileOptions.migrationPlanBundle = dialect === "sqlite" ? buildMigrationPlanBundle(migrations) : void 0;
4480
- compileOptions.migrationDialect = dialect;
4481
4222
  }
4482
4223
  }
4483
4224
  if (options.target) writeNodeEntries(options.target);
@@ -4511,10 +4252,7 @@ function routingPlugin(root, options) {
4511
4252
  async handler(id) {
4512
4253
  const virtualClient = VIRTUAL_CLIENT_RE.exec(id);
4513
4254
  if (virtualClient?.[1] === "browser") return compileBrowserClient(getClientAuthPath(id), fetchPath, fetchStreamPath);
4514
- if (virtualClient?.[1] === "worker") {
4515
- if (options.target) return compileNodeClient(getClientAuthPath(id));
4516
- return compileWorkerClient(getClientAuthPath(id));
4517
- }
4255
+ if (virtualClient?.[1] === "worker") return compileWorkerClient(getClientAuthPath(id), Boolean(options.target));
4518
4256
  if (id !== VIRTUAL_ROUTES_ID) return;
4519
4257
  if (this?.environment?.name === "client") throw new Error(`${VIRTUAL_ROUTES_ID} is server-only and cannot be loaded by client code.`);
4520
4258
  if (!scan) await rescan();
@@ -4525,9 +4263,7 @@ function routingPlugin(root, options) {
4525
4263
  const watcher = devServer.watcher;
4526
4264
  const handleFileChange = async (path, event) => {
4527
4265
  const normalizedPath = normalizePath(path);
4528
- const sourceConventionChanged = isInDirectory(normalizedPath, normalizedRoutesDir) || isInDirectory(normalizedPath, normalizedMiddlewareDir) || isInDirectory(normalizedPath, normalizedJobsDir) || isInDirectory(normalizedPath, normalizedQueuesDir) || isInDirectory(normalizedPath, normalizedEmailDir) || isInDirectory(normalizedPath, normalizedPagesDir) || isPotentialAuthConfigPath(normalizedPath) || isPotentialEnvFilePath(normalizedPath);
4529
- if (!sourceConventionChanged && !isInDirectory(normalizedPath, normalizedSsrDir)) return;
4530
- if (!sourceConventionChanged && isInDirectory(normalizedPath, normalizedSsrDir) && !ssrEntryAbsPaths.has(normalizedPath)) return;
4266
+ if (!(isInDirectory(normalizedPath, normalizedRoutesDir) || isInDirectory(normalizedPath, normalizedMiddlewareDir) || isInDirectory(normalizedPath, normalizedJobsDir) || isInDirectory(normalizedPath, normalizedQueuesDir) || isInDirectory(normalizedPath, normalizedEmailDir) || isInDirectory(normalizedPath, normalizedPagesDir) || isPotentialAuthConfigPath(normalizedPath) || isPotentialEnvFilePath(normalizedPath)) && !ssrEntryAbsPaths.has(normalizedPath)) return;
4531
4267
  await rescan(true);
4532
4268
  resolveAuthCompileOptions();
4533
4269
  if (event !== "change" && options.onDevAssetRoutingPolicyChange?.(resolveCurrentAssetRoutingPolicy()) === true) {
@@ -4720,13 +4456,12 @@ function mergeWorkerBindings(resolved, input) {
4720
4456
  bucket_name: "default"
4721
4457
  }];
4722
4458
  const resolvedAi = resolved.ai;
4723
- const resultAi = result.ai;
4724
4459
  const aiBindingName = resolveWorkersAiBindingName(resolvedAi, bindingNames?.ai);
4725
- if (viteCommand === "serve" && bindings.needsAI && directCloudflareDestination && !resultAi && typeof resolvedAi === "object" && resolvedAi !== null && "binding" in resolvedAi && typeof resolvedAi.binding === "string") result.ai = {
4460
+ if (viteCommand === "serve" && bindings.needsAI && directCloudflareDestination && typeof resolvedAi === "object" && resolvedAi !== null && "binding" in resolvedAi && typeof resolvedAi.binding === "string") result.ai = {
4726
4461
  ...resolvedAi,
4727
4462
  remote: true
4728
4463
  };
4729
- else if (shouldBindWorkersAi(viteCommand, bindings.needsAI, resolvedAi, resultAi, directCloudflareDestination)) result.ai = {
4464
+ else if (shouldBindWorkersAi(viteCommand, bindings.needsAI, resolvedAi, result.ai, directCloudflareDestination)) result.ai = {
4730
4465
  binding: aiBindingName,
4731
4466
  ...viteCommand === "serve" && { remote: true }
4732
4467
  };
@@ -4856,14 +4591,14 @@ function mergeWorkerBindings(resolved, input) {
4856
4591
  result.vars = vars;
4857
4592
  }
4858
4593
  }
4859
- input.versionMetadataBinding = selectNativeVersionMetadataBinding(resolved, {
4594
+ const versionMetadataBinding = selectNativeVersionMetadataBinding(resolved, {
4860
4595
  nativeBuild: viteCommand === "build" && process.env["VOID_CLOUDFLARE_DEPLOY_BUILD"] === "1",
4861
4596
  preserveBindings: process.env[CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV] === "1"
4862
4597
  });
4863
- if (input.versionMetadataBinding) {
4864
- const owner = findBindingNameOwner(result, "version_metadata", input.versionMetadataBinding);
4865
- if (owner) throw new Error(`Cloudflare version metadata binding ${input.versionMetadataBinding} conflicts with ${owner}.`);
4866
- if (!resolved.version_metadata) result.version_metadata = { binding: input.versionMetadataBinding };
4598
+ if (versionMetadataBinding) {
4599
+ const owner = findBindingNameOwner(result, "version_metadata", versionMetadataBinding);
4600
+ if (owner) throw new Error(`Cloudflare version metadata binding ${versionMetadataBinding} conflicts with ${owner}.`);
4601
+ if (!resolved.version_metadata) result.version_metadata = { binding: versionMetadataBinding };
4867
4602
  }
4868
4603
  finalizeDurableObjectPatch(resolved, result, [
4869
4604
  ...environmentWebsocketRoutes.map((route) => ({
@@ -4883,29 +4618,16 @@ function mergeWorkerBindings(resolved, input) {
4883
4618
  class_name: liveConfig.className
4884
4619
  }] : []
4885
4620
  ]);
4886
- return result;
4621
+ return {
4622
+ patch: result,
4623
+ versionMetadataBinding
4624
+ };
4887
4625
  }
4888
4626
  //#endregion
4889
4627
  //#region src/index.ts
4890
4628
  const scheduledPointerCleanups = /* @__PURE__ */ new Set();
4891
4629
  const scheduledPreviewPointerCleanups = /* @__PURE__ */ new Set();
4892
- /**
4893
- * Void plugin — the main entry point.
4894
- *
4895
- * Composes:
4896
- * 1. Routing plugin (file-based routing from routes/ and middleware/)
4897
- * 2. Migration plugin (auto-apply .sql migrations on dev startup)
4898
- * 3. @cloudflare/vite-plugin (workerd runtime, HMR, builds)
4899
- *
4900
- * Binding inference runs synchronously here so results are available
4901
- * before the Cloudflare plugin initializes.
4902
- *
4903
- * The Cloudflare plugin reads Void's generated config and provides it to our
4904
- * config function. Bindings already defined there (with real IDs for
4905
- * production deployment) are preserved — we only add inferred bindings
4906
- * that are missing. This allows `vite build && wrangler deploy` to work
4907
- * for deploying directly to Cloudflare without the Void platform.
4908
- */
4630
+ /** Returns the Vite plugins that build and serve a Void app for its configured target. */
4909
4631
  function voidPlugin(options) {
4910
4632
  const root = process.cwd();
4911
4633
  const directCloudflareDestination = readDeploymentPlatform(root) === "cloudflare";
@@ -4943,7 +4665,7 @@ function voidPlugin(options) {
4943
4665
  };
4944
4666
  let application = analyzeApplicationSync(root, { config });
4945
4667
  const { paths, dialect, bindingNames, authConfigPath } = application;
4946
- const analyses = /* @__PURE__ */ new Map([[void 0, application]]);
4668
+ const analyses = /* @__PURE__ */ new Map();
4947
4669
  const getApplicationAnalysis = (environment, refresh = false) => {
4948
4670
  let result = refresh ? void 0 : analyses.get(environment);
4949
4671
  if (!result) {
@@ -4977,7 +4699,7 @@ function voidPlugin(options) {
4977
4699
  const hasInboundEmail = hasEmailHandlers(application.email);
4978
4700
  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.");
4979
4701
  const clientStubsPlugin = createClientStubsPlugin();
4980
- const serverRuntimeOptimizerPlugin = createServerRuntimeOptimizerPlugin();
4702
+ const serverRuntimeOptimizerPlugin = createServerRuntimeOptimizerPlugin(!isNodeTarget(config.target) && !frameworkOwnsCloudflareRuntime);
4981
4703
  const queues = framework ? [] : application.queues;
4982
4704
  const websocketRoutes = framework ? [] : application.allWebsockets;
4983
4705
  const durableObjects = application.durableObjects;
@@ -5014,12 +4736,10 @@ function voidPlugin(options) {
5014
4736
  application,
5015
4737
  bindingNames,
5016
4738
  websocketRoutes,
5017
- sandboxConfig,
5018
4739
  liveConfig,
5019
4740
  detected,
5020
4741
  clientStubsPlugin,
5021
4742
  serverRuntimeOptimizerPlugin,
5022
- authEnabled,
5023
4743
  devTriggerToken,
5024
4744
  implicitDeployGuard
5025
4745
  });
@@ -5044,7 +4764,7 @@ function voidPlugin(options) {
5044
4764
  const outDir = join(root, ".void");
5045
4765
  mkdirSync(outDir, { recursive: true });
5046
4766
  function mergeBindings(resolved) {
5047
- return mergeWorkerBindings(resolved, {
4767
+ const merged = mergeWorkerBindings(resolved, {
5048
4768
  websocketRoutes,
5049
4769
  routeEnvironment,
5050
4770
  workerConfig,
@@ -5064,14 +4784,10 @@ function voidPlugin(options) {
5064
4784
  shouldEmitLive,
5065
4785
  liveConfig,
5066
4786
  root,
5067
- remoteMode,
5068
- get versionMetadataBinding() {
5069
- return versionMetadataBinding;
5070
- },
5071
- set versionMetadataBinding(value) {
5072
- versionMetadataBinding = value;
5073
- }
4787
+ remoteMode
5074
4788
  });
4789
+ versionMetadataBinding = merged.versionMetadataBinding;
4790
+ return merged.patch;
5075
4791
  }
5076
4792
  function applyEnvSchema(facts) {
5077
4793
  envSchemaFacts = facts;
@@ -5115,27 +4831,23 @@ function voidPlugin(options) {
5115
4831
  return watchConfig;
5116
4832
  },
5117
4833
  configureServer(server) {
5118
- const afterReady = (fn) => {
5119
- if (server.httpServer) server.httpServer.once("listening", () => setTimeout(fn, 100));
5120
- else fn();
5121
- };
5122
4834
  if (remoteMode && (bindings.needsD1 || bindings.needsKV || bindings.needsR2)) {
5123
4835
  const credentials = readVoidDevCredentials(root);
5124
4836
  if (credentials.status === "ok") {
5125
4837
  const lines = [import_picocolors.default.blue("Remote bindings active")];
5126
- if (bindings.needsD1) lines.push(" DB \x1B[2m→ remote D1\x1B[22m");
5127
- if (bindings.needsKV) lines.push(" KV \x1B[2m→ remote KV\x1B[22m");
5128
- if (bindings.needsR2) lines.push(" STORAGE \x1B[2m→ remote R2\x1B[22m");
5129
- afterReady(() => {
4838
+ if (bindings.needsD1) lines.push(` DB ${import_picocolors.default.dim("→ remote D1")}`);
4839
+ if (bindings.needsKV) lines.push(` KV ${import_picocolors.default.dim("→ remote KV")}`);
4840
+ if (bindings.needsR2) lines.push(` STORAGE ${import_picocolors.default.dim("→ remote R2")}`);
4841
+ afterServerReady(server, () => {
5130
4842
  console.log();
5131
4843
  voidLog(lines.join("\n "));
5132
4844
  });
5133
- } else if (credentials.status === "no-token") afterReady(() => {
4845
+ } else if (credentials.status === "no-token") afterServerReady(server, () => {
5134
4846
  console.log();
5135
4847
  voidWarn("Remote mode requires authentication. Run `void account login`, then restart.");
5136
4848
  voidWarn("Falling back to local bindings.");
5137
4849
  });
5138
- else afterReady(() => {
4850
+ else afterServerReady(server, () => {
5139
4851
  console.log();
5140
4852
  voidWarn("Remote mode requires a linked project. Run `void project link` first.");
5141
4853
  voidWarn("Falling back to local bindings.");
@@ -5143,16 +4855,16 @@ function voidPlugin(options) {
5143
4855
  }
5144
4856
  if (bindings.needsAI && !directCloudflareDestination) {
5145
4857
  const credentials = readVoidDevCredentials(root);
5146
- if (credentials.status === "no-token") afterReady(() => {
4858
+ if (credentials.status === "no-token") afterServerReady(server, () => {
5147
4859
  console.log();
5148
4860
  voidWarn("AI requires authentication. Run `void account login`, then restart the dev server.");
5149
4861
  });
5150
4862
  else if (credentials.status === "no-project") {
5151
- if (process.stdin.isTTY) afterReady(() => {
4863
+ if (process.stdin.isTTY) afterServerReady(server, () => {
5152
4864
  console.log();
5153
4865
  runAiSetupPrompt(root, credentials.token, credentials.apiUrl, server);
5154
4866
  });
5155
- else afterReady(() => {
4867
+ else afterServerReady(server, () => {
5156
4868
  console.log();
5157
4869
  voidWarn("AI requires a linked project. Run `void project link` to set one up.");
5158
4870
  });
@@ -5274,10 +4986,7 @@ function voidPlugin(options) {
5274
4986
  ...vinextWorkerEntry ? [vinextWorkerEntry] : [],
5275
4987
  frameworkBuildWrapperPlugin,
5276
4988
  frameworkTriggersPlugin(root, { devTriggerToken }),
5277
- devTriggersHintPlugin(root, {
5278
- framework: true,
5279
- devTriggerToken
5280
- }),
4989
+ devTriggersHintPlugin(root, devTriggerToken),
5281
4990
  ...cloudflare({
5282
4991
  configPath: cloudflareConfigPath,
5283
4992
  ...inspectorPortOption,
@@ -5311,7 +5020,6 @@ function voidPlugin(options) {
5311
5020
  isAuthEnabled: () => false,
5312
5021
  devTriggerToken,
5313
5022
  headConfig: config.head,
5314
- output: config.output,
5315
5023
  prerenderPaths: config.routing?.prerender,
5316
5024
  target: config.target,
5317
5025
  routing: config.routing,
@@ -5396,7 +5104,6 @@ function voidPlugin(options) {
5396
5104
  getVersionMetadataBinding: () => versionMetadataBinding,
5397
5105
  devTriggerToken,
5398
5106
  headConfig: config.head,
5399
- output: config.output,
5400
5107
  prerenderPaths: config.routing?.prerender,
5401
5108
  remoteMode,
5402
5109
  routing: config.routing,
@@ -5425,10 +5132,7 @@ function voidPlugin(options) {
5425
5132
  configPath: authConfigPath
5426
5133
  }),
5427
5134
  prerenderPlugin(root, config),
5428
- devTriggersHintPlugin(root, {
5429
- framework: false,
5430
- devTriggerToken
5431
- }),
5135
+ devTriggersHintPlugin(root, devTriggerToken),
5432
5136
  ...cloudflare({
5433
5137
  configPath: cloudflareConfigPath,
5434
5138
  ...inspectorPortOption,