void 1.2.1 → 1.4.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 (200) hide show
  1. package/dist/{account-cmd-CdUll_35.mjs → account-cmd-HP8bixYo.mjs} +3 -3
  2. package/dist/{application-analysis-fEqoSeMp.mjs → application-analysis-DDOQwiXk.mjs} +18 -12
  3. package/dist/{application-routing-DAhNP4u3.mjs → application-routing-4719u_kf.mjs} +3 -1
  4. package/dist/auth-g2TQbDLD.d.mts +70 -0
  5. package/dist/{auth-link-C87vGXM-.mjs → auth-link-CedYpDCy.mjs} +3 -3
  6. package/dist/{auth-router-6I81r-ix.mjs → auth-router-vafo7x8w.mjs} +11 -6
  7. package/dist/{better-auth-shared-D-6z0q0f.mjs → better-auth-shared-7FM3Uk2N.mjs} +48 -2
  8. package/dist/{better-auth-shared-DVk2DkTW.d.mts → better-auth-shared-BHB8kiTE.d.mts} +1 -1
  9. package/dist/{build-cmd-ex1g-j_e.mjs → build-cmd-9vUAQ1_V.mjs} +1 -1
  10. package/dist/{cache-oHzrnY3z.mjs → cache-jvwLNb0h.mjs} +1 -1
  11. package/dist/{cancel-deploy-viAMD0Q_.mjs → cancel-deploy-Dw0UmWKO.mjs} +1 -1
  12. package/dist/{cf-build-output-BhVxldCw.mjs → cf-build-output-XpNR9zoh.mjs} +122 -5
  13. package/dist/cf-build-output-bd8Uwv1P.mjs +1 -0
  14. package/dist/{cf-worker-settings-BECvvTVd.mjs → cf-worker-settings-Dg27RzyT.mjs} +11 -5
  15. package/dist/cli/cli.mjs +41 -32
  16. package/dist/cli/cloudflare-operation-process.mjs +35 -8
  17. package/dist/cli/env-schema-probe.mjs +2 -2
  18. package/dist/{client-BEkdj1kx.mjs → client-B3LnB_bE.mjs} +8 -1
  19. package/dist/client-BZb9j66F.mjs +1 -0
  20. package/dist/{cloudflare-auth-Byo_0_N9.mjs → cloudflare-auth-DyD_kVFr.mjs} +1 -1
  21. package/dist/{cloudflare-cmd-DMzCv12s.mjs → cloudflare-cmd-D-b_u3T4.mjs} +2 -2
  22. package/dist/{cloudflare-config-DchHxPTo.mjs → cloudflare-config-CH1AylZT.mjs} +14 -3
  23. package/dist/{cloudflare-connect-CCRTVg-I.mjs → cloudflare-connect-zTJh8UnN.mjs} +2 -2
  24. package/dist/{cloudflare-operations-Dh9dEHJj.mjs → cloudflare-operations-Bc-7fN44.mjs} +4 -4
  25. package/dist/{cloudflare-operations-DsSaw2BT.mjs → cloudflare-operations-BtulCNOg.mjs} +1 -1
  26. package/dist/{config-BU6hMu1W.mjs → config-BV2ASlpn.mjs} +1 -1
  27. package/dist/{config-DQfHOKh9.d.mts → config-CAdZVTLN.d.mts} +4 -1
  28. package/dist/config-D-6q7EBH.mjs +87 -0
  29. package/dist/{config-DHgSEWT7.mjs → config-OFOAimzt.mjs} +5 -3
  30. package/dist/config-entry.d.mts +1 -1
  31. package/dist/{config-BIaXIkkv.mjs → config-tqMM6DwY.mjs} +1 -1
  32. package/dist/{connect-k7R2rPVA.mjs → connect-BOM6zvFX.mjs} +4 -4
  33. package/dist/{create-project-DV71ol5d.mjs → create-project-Bxd02EHN.mjs} +1 -1
  34. package/dist/{create-project-DTuy-l0z.mjs → create-project-C2K0DN2O.mjs} +1 -1
  35. package/dist/{db-DVOkLH5X.mjs → db-Cdvr3zwG.mjs} +18 -18
  36. package/dist/{db-types-NGxPwnlt.mjs → db-types-0eCiqYb1.mjs} +1 -1
  37. package/dist/{delete-BbP5eopu.mjs → delete-lETE6Tpt.mjs} +1 -1
  38. package/dist/deploy-CX94CmKa.mjs +2 -0
  39. package/dist/{deploy-7H32EnUs.mjs → deploy-CdM-LAxX.mjs} +473 -148
  40. package/dist/{deploy-managed-static-DlvcvnQT.mjs → deploy-managed-static-DjeBFG2c.mjs} +43 -20
  41. package/dist/{deploy-transport-BzGEj0Ge.mjs → deploy-transport-DIq_gFTP.mjs} +14 -13
  42. package/dist/deploy.d.mts +2 -0
  43. package/dist/deploy.mjs +8 -5
  44. package/dist/{dispatch-DoUnxTNo.mjs → dispatch-CLa2LThw.mjs} +76 -7
  45. package/dist/{domain-CA2wBgra.mjs → domain-DyhNtdYf.mjs} +2 -2
  46. package/dist/{email-DXpCc77w.mjs → email-DM2wDcBN.mjs} +59 -10
  47. package/dist/{email-cloudflare-D03g2TkS.mjs → email-cloudflare-PMbAev9Q.mjs} +124 -10
  48. package/dist/{env-DgOQ9_8S.mjs → env-78hbN-oI.mjs} +3 -3
  49. package/dist/{env-BJjULvL0.mjs → env-BaMz0j7H.mjs} +6 -1
  50. package/dist/{env-validation-Dwq3PJzK.mjs → env-validation-B3VobvXm.mjs} +2 -1
  51. package/dist/{env-validation-BmsdCZEk.mjs → env-validation-BUfFZ6bt.mjs} +1 -1
  52. package/dist/error-pages-CLIJ7aYq.mjs +37 -0
  53. package/dist/gen-BhWBT4iu.mjs +1 -0
  54. package/dist/{gen-BfmcIi2g.mjs → gen-CFmsUsW1.mjs} +3 -3
  55. package/dist/{github-cmd-CY9LUqLh.mjs → github-cmd-De-_IWbM.mjs} +1 -1
  56. package/dist/{handler-BbkSPzGF.d.mts → handler-BHktmuTL.d.mts} +4 -2
  57. package/dist/{headers-D522zd0A.mjs → headers--vaK_chu.mjs} +1 -1
  58. package/dist/{help-CxSlPpzJ.mjs → help-CKbrhZha.mjs} +16 -1
  59. package/dist/help-qOZr3wng.mjs +1 -0
  60. package/dist/index.d.mts +3 -5
  61. package/dist/index.mjs +370 -140
  62. package/dist/{info-7VDlhtyy.mjs → info-Yg0-V5Rs.mjs} +4 -4
  63. package/dist/{init-DxYyOs4-.mjs → init-CDiJQycf.mjs} +241 -206
  64. package/dist/{link-Ddmod1dZ.mjs → link-Dllip08S.mjs} +2 -2
  65. package/dist/{list-MogaugiO.mjs → list-BYRP6am0.mjs} +2 -2
  66. package/dist/{live-Bt8Y_0bg.d.mts → live-BllfDuzA.d.mts} +2 -2
  67. package/dist/{local-d1-BHBnKWRb.mjs → local-d1-CAwAs9GH.mjs} +1 -1
  68. package/dist/login-BAPmYnb7.mjs +1 -0
  69. package/dist/{login-Cttnagmm.mjs → login-PcFy5mlC.mjs} +2 -2
  70. package/dist/{logs-CAszUWZI.mjs → logs-DmJTBhed.mjs} +2 -2
  71. package/dist/{migrate-DyT2jJ8y.mjs → migrate-B8S2xTcb.mjs} +5 -66
  72. package/dist/migrate-BIYTPQE6.mjs +1 -0
  73. package/dist/nitro.mjs +4 -4
  74. package/dist/{node-WB7c2N4L.mjs → node-CDOPrGSl.mjs} +5 -5
  75. package/dist/{operator-args-UnE8Y2eK.mjs → operator-args-BsJIYXaT.mjs} +8 -1
  76. package/dist/operator-cmd-CjazwOyb.mjs +1 -0
  77. package/dist/{operator-cmd-skshjMGl.mjs → operator-cmd-DmkmS2wL.mjs} +4 -3
  78. package/dist/pages/client.d.mts +32 -4
  79. package/dist/pages/client.mjs +186 -29
  80. package/dist/pages/index.d.mts +34 -2
  81. package/dist/pages/index.mjs +96 -55
  82. package/dist/pages/islands-plugin.d.mts +1 -1
  83. package/dist/pages/islands-plugin.mjs +9 -3
  84. package/dist/pages/protocol.d.mts +2 -2
  85. package/dist/platform-args-BC8_hsDj.mjs +1 -0
  86. package/dist/{platform-args-DVbVClZl.mjs → platform-args-BMD2gjc_.mjs} +1 -1
  87. package/dist/{platform-auth-config-C-pm5Qzx.mjs → platform-auth-config-CImnfohz.mjs} +3 -3
  88. package/dist/{platform-auth-protection-SHhvim1L.mjs → platform-auth-protection-BogLhtHi.mjs} +2 -2
  89. package/dist/{platform-auth-recovery-DXVWs-wA.mjs → platform-auth-recovery-B-mEaWEi.mjs} +2 -2
  90. package/dist/{platform-cmd-PiNRkopU.mjs → platform-cmd-CV8NxIIn.mjs} +1 -1
  91. package/dist/{platform-cmd-D5I1beUX.mjs → platform-cmd-DZK2ixMl.mjs} +4 -4
  92. package/dist/{platform-domain-jpmBfZeb.mjs → platform-domain-CRvelPGE.mjs} +2 -2
  93. package/dist/{platform-lifecycle-DyKmuNY6.mjs → platform-lifecycle-CPYY7E9B.mjs} +103 -41
  94. package/dist/{platform-lifecycle-DH3Yr1qQ.mjs → platform-lifecycle-DwXq7kZt.mjs} +1 -1
  95. package/dist/{platform-management--vDwSn35.mjs → platform-management-BOnGbMSM.mjs} +1 -1
  96. package/dist/{platform-management-7m-PLaPJ.mjs → platform-management-lXdgGgAM.mjs} +1 -1
  97. package/dist/{platform-recovery-BiNpZZab.mjs → platform-recovery-noaALXnE.mjs} +2 -2
  98. package/dist/{plugin-inference-DUjCd55H.mjs → plugin-inference-CeiB6BG5.mjs} +53 -18
  99. package/dist/{prepare-BcAE5Sdj.mjs → prepare-BuOS18AM.mjs} +1 -1
  100. package/dist/{prepare-DA-17DhO.mjs → prepare-D604Yiyr.mjs} +12 -8
  101. package/dist/prepare-DU-tOpS5.mjs +1 -0
  102. package/dist/{prerender-render-Cijv7UFo.mjs → prerender-render-CaShbHJ3.mjs} +13 -1
  103. package/dist/prerender-render.d.mts +1 -0
  104. package/dist/prerender-render.mjs +1 -1
  105. package/dist/{project-cmd-DA4K5faU.mjs → project-cmd-DBYqAIbe.mjs} +15 -15
  106. package/dist/{project-team-CQBNveX3.mjs → project-team-BjCLgTRC.mjs} +1 -1
  107. package/dist/{project-token-CCalFyQf.mjs → project-token-BB6PwaA9.mjs} +1 -1
  108. package/dist/{project-tsconfig-Itv1f4WC.mjs → project-tsconfig-CVvk6Z_e.mjs} +24 -2
  109. package/dist/{project-zero-trust-DPnkiEuT.mjs → project-zero-trust-CWDh1P_t.mjs} +1 -1
  110. package/dist/{protocol-BBDpJz3G.d.mts → protocol-D5XDySYu.d.mts} +2 -2
  111. package/dist/{provision-BFLCrnUp.mjs → provision-DfxLCg-d.mjs} +1 -1
  112. package/dist/{provision-DtROpNNI.mjs → provision-DztLJ97X.mjs} +24 -8
  113. package/dist/{requests-BpH0kImL.mjs → requests-D_pbzDyz.mjs} +1 -1
  114. package/dist/{rollback-CXS1tAa-.mjs → rollback-CjfIYsJx.mjs} +2 -2
  115. package/dist/{route-types-BZi26DVS.mjs → route-types-DvEGmPif.mjs} +109 -30
  116. package/dist/routes-stub.d.mts +22 -13
  117. package/dist/runtime/auth.d.mts +2 -2
  118. package/dist/runtime/better-auth-mysql.d.mts +1 -1
  119. package/dist/runtime/better-auth-mysql.mjs +1 -1
  120. package/dist/runtime/better-auth-pg.d.mts +1 -1
  121. package/dist/runtime/better-auth-pg.mjs +1 -1
  122. package/dist/runtime/better-auth.d.mts +1 -1
  123. package/dist/runtime/better-auth.mjs +1 -1
  124. package/dist/runtime/client-react.d.mts +1 -1
  125. package/dist/runtime/client-solid.d.mts +1 -1
  126. package/dist/runtime/client-svelte.d.mts +1 -1
  127. package/dist/runtime/client-vue.d.mts +1 -1
  128. package/dist/runtime/client.d.mts +1 -1
  129. package/dist/runtime/handler.d.mts +1 -1
  130. package/dist/runtime/live-client.d.mts +1 -1
  131. package/dist/runtime/live.d.mts +1 -1
  132. package/dist/runtime/log.mjs +19 -1
  133. package/dist/runtime/routing.d.mts +5 -4
  134. package/dist/runtime/routing.mjs +14 -73
  135. package/dist/runtime/validator.d.mts +1 -1
  136. package/dist/runtime/ws-server.d.mts +3 -3
  137. package/dist/runtime/ws.d.mts +1 -1
  138. package/dist/runtime/ws.mjs +4 -2
  139. package/dist/{scan-8IzYXiU_.mjs → scan-N9WzdcAl.mjs} +302 -23
  140. package/dist/{secret-BbXHfLAt.mjs → secret-3X0PxmuX.mjs} +9 -12
  141. package/dist/static-asset-marker-Btf-6oCD.mjs +32 -0
  142. package/dist/{types-7AIz0OZu.d.mts → types-w72dljaA.d.mts} +6 -1
  143. package/dist/{version-metadata-tS39iW09.mjs → version-metadata-D2vfMQzv.mjs} +2 -1
  144. package/dist/worker-conditions-AWFRcFxR.mjs +11 -0
  145. package/dist/{wrangler-F96NnLyb.mjs → wrangler-I-scB_1t.mjs} +82 -13
  146. package/dist/wrangler-UnwdISay.mjs +1 -0
  147. package/dist/{wrapper-D3sZyh2C.mjs → wrapper-BBl1rC32.mjs} +8 -12
  148. package/dist/{ws-BH-im_tX.d.mts → ws-B3ClMVDh.d.mts} +3 -2
  149. package/docs/guide/auth.md +4 -2
  150. package/docs/guide/edge/redirects.md +22 -0
  151. package/docs/guide/edge/static-assets.md +10 -0
  152. package/docs/guide/email/domains.md +1 -1
  153. package/docs/guide/email/receiving.md +2 -0
  154. package/docs/guide/email/sending.md +1 -1
  155. package/docs/guide/pages-routing/actions-and-forms.md +43 -13
  156. package/docs/guide/pages-routing/markdown.md +2 -0
  157. package/docs/guide/pages-routing/overview.md +33 -2
  158. package/docs/guide/platform/administration/email.md +18 -0
  159. package/docs/guide/platform/installation/maintenance.md +3 -1
  160. package/docs/guide/platform/installation/prerequisites.md +9 -4
  161. package/docs/guide/platform/installation/uninstall.md +2 -0
  162. package/docs/guide/queues.md +13 -1
  163. package/docs/guide/server-routing.md +40 -2
  164. package/docs/guide/ssg.md +8 -0
  165. package/docs/guide/type-safety.md +7 -7
  166. package/docs/guide/websockets.md +4 -2
  167. package/docs/integrations/cloudflare.md +16 -7
  168. package/docs/reference/api/auth.md +6 -2
  169. package/docs/reference/api/deploy.md +9 -5
  170. package/docs/reference/api/pages.md +6 -4
  171. package/docs/reference/cli/deploy.md +10 -9
  172. package/docs/reference/cli/email.md +13 -0
  173. package/docs/reference/cli/platform-email.md +2 -2
  174. package/docs/reference/cli.md +1 -0
  175. package/docs/reference/config.md +11 -1
  176. package/docs/reference/structure.md +3 -1
  177. package/package.json +9 -7
  178. package/schema.json +4 -0
  179. package/skills/void/SKILL.md +1 -1
  180. package/templates/assets/icons.svg +49 -0
  181. package/templates/assets/react.svg +1 -0
  182. package/templates/assets/solid.svg +1 -0
  183. package/templates/assets/stack.svg +35 -0
  184. package/templates/assets/svelte.svg +1 -0
  185. package/templates/assets/void.svg +5 -0
  186. package/templates/assets/vue.svg +1 -0
  187. package/dist/auth-DkcFflXV.d.mts +0 -42
  188. package/dist/cf-build-output-BJHuSsVN.mjs +0 -1
  189. package/dist/client-BiRDZTSd.mjs +0 -1
  190. package/dist/config-CyUJzi3q.mjs +0 -32
  191. package/dist/deploy-CE0Ev0Ob.mjs +0 -2
  192. package/dist/gen-NrOlWZaG.mjs +0 -1
  193. package/dist/help-BeAFFE5C.mjs +0 -1
  194. package/dist/login-DgDwlKc_.mjs +0 -1
  195. package/dist/migrate-n49ZeS1X.mjs +0 -1
  196. package/dist/operator-cmd-d2MvJOrl.mjs +0 -1
  197. package/dist/parse-filename-DioPHiR9.mjs +0 -77
  198. package/dist/platform-args-kQrgxScY.mjs +0 -1
  199. package/dist/prepare-C4I0f--h.mjs +0 -1
  200. package/dist/wrangler-BLb3_luP.mjs +0 -1
package/dist/index.mjs CHANGED
@@ -1,49 +1,49 @@
1
1
  import { n as __toESM } from "./rolldown-runtime-3h0WiCiA.mjs";
2
2
  import { a as join, c as resolve, i as isAbsolute, n as dirname, o as normalize, s as relative } from "./dist-ipQi0Q8y.mjs";
3
3
  import { t as require_picocolors } from "./picocolors-BsDfhxIw.mjs";
4
- import { l as inferBindingsFromSource, n as FRAMEWORK_SCAN_DIRS, p as applyBindingOverrides, t as DEFAULT_SCAN_DIRS, u as staticModuleReferences } from "./plugin-inference-DUjCd55H.mjs";
4
+ import { l as inferBindingsFromSource, m as applyBindingOverrides, n as FRAMEWORK_SCAN_DIRS, t as DEFAULT_SCAN_DIRS, u as staticModuleReferences } from "./plugin-inference-CeiB6BG5.mjs";
5
5
  import { n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-DGu_QZ_Q.mjs";
6
- import { n as loadVoidAuthConfig } from "./config-CyUJzi3q.mjs";
7
- import { c as getDatabaseCasing, l as getDatabaseDialect, p as readConfig, u as isNodeTarget } from "./config-DHgSEWT7.mjs";
6
+ import { i as loadVoidAuthConfig, n as devAuthConfigImporter, o as viteAuthConfigImporter, t as AUTH_CONFIG_ENVIRONMENT } from "./config-D-6q7EBH.mjs";
7
+ import { c as getDatabaseCasing, l as getDatabaseDialect, p as readConfig, u as isNodeTarget } from "./config-OFOAimzt.mjs";
8
+ import { f as invalidateSourceAnalysis, o as resolveLayoutIds, p as isRouteEnabledForEnvironment } from "./scan-N9WzdcAl.mjs";
8
9
  import { i as isMemberExpression, n as isIdentifier, r as isLiteral } from "./ast-CsZ_q_gc.mjs";
9
10
  import { n as bindingResolver } from "./ast-bindings-C3yaPs1y.mjs";
10
- import { a as hasSandboxSqliteMigration, c as sandboxContainerConfig, i as assertSandboxNamespaceConfig, n as DEFAULT_SANDBOX_CLASS_NAME, p as scanJobsSync, r as SANDBOX_MIGRATION_TAG, s as resolveSandboxConfig, t as analyzeApplicationSync, u as scanQueuesSync } from "./application-analysis-fEqoSeMp.mjs";
11
- import { t as isRouteEnabledForEnvironment } from "./parse-filename-DioPHiR9.mjs";
12
- import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-BEM8ZuGP.mjs";
13
- import { r as hasEmailHandlers } from "./email-B9ayYQEG.mjs";
11
+ import { a as hasSandboxSqliteMigration, c as sandboxContainerConfig, i as assertSandboxNamespaceConfig, n as DEFAULT_SANDBOX_CLASS_NAME, p as scanJobsSync, r as SANDBOX_MIGRATION_TAG, s as resolveSandboxConfig, t as analyzeApplicationSync, u as scanQueuesSync } from "./application-analysis-DDOQwiXk.mjs";
14
12
  import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-BMwmN5Ae.mjs";
15
13
  import { t as MagicString } from "./dist-Cegxq8gs.mjs";
16
- import { i as resolveLayoutIds } from "./scan-8IzYXiU_.mjs";
14
+ import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-BEM8ZuGP.mjs";
15
+ import { r as hasEmailHandlers } from "./email-B9ayYQEG.mjs";
17
16
  import { a as resolveDistDir, c as hasDocumentRoutes, n as collectRevalidate, o as resolveWorkerDirName, r as hasRevalidate, s as hasApiRoutes, t as collectPages, u as resolveAssetRoutingPolicy } from "./isr-config-fZaJJ8t7.mjs";
18
- import { n as mergeRoutingRules, t as lintRoutingPhases } from "./headers-D522zd0A.mjs";
17
+ import { n as mergeRoutingRules, t as lintRoutingPhases } from "./headers--vaK_chu.mjs";
19
18
  import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-rqDnVsJN.mjs";
20
- import { a as restoreCloudflarePreviewPointer, r as materializeCloudflareConfig, s as stashCloudflareDeployPointer } from "./cloudflare-config-DchHxPTo.mjs";
21
- import { A as syncWranglerWebSockets, E as resolveLiveBindingConfig, O as syncWranglerBindings, T as readWranglerWebSocketTombstones, a as LIVE_MIGRATION_TAG, b as readRootWranglerConfig, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as normalizeWranglerCompatibilityFlags, h as nextDurableObjectMigrationTag, k as syncWranglerDurableObjects, m as hasDurableObjectSqliteMigration, p as findBindingNameOwner, u as ensureWranglerCompat, v as readExistingLiveBindingConfig, x as readWranglerCompat } from "./wrangler-F96NnLyb.mjs";
22
- import { n as writeLocalD1PersistState, t as resolveLocalD1Target } from "./local-d1-BHBnKWRb.mjs";
19
+ import { c as stashCloudflareDeployPointer, i as materializeCloudflareConfig, o as restoreCloudflarePreviewPointer } from "./cloudflare-config-CH1AylZT.mjs";
20
+ import { A as syncWranglerWebSockets, E as resolveLiveBindingConfig, O as syncWranglerBindings, T as readWranglerWebSocketTombstones, a as LIVE_MIGRATION_TAG, b as readRootWranglerConfig, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as normalizeWranglerCompatibilityFlags, h as nextDurableObjectMigrationTag, k as syncWranglerDurableObjects, m as hasDurableObjectSqliteMigration, p as findBindingNameOwner, u as ensureWranglerCompat, v as readExistingLiveBindingConfig, x as readWranglerCompat } from "./wrangler-I-scB_1t.mjs";
21
+ import { n as writeLocalD1PersistState, t as resolveLocalD1Target } from "./local-d1-CAwAs9GH.mjs";
23
22
  import { n as scopedAccessCredentials } from "./cf-access-BM9G0lhO.mjs";
24
23
  import { n as ensurePlatformProxyAccess } from "./cf-access-CWP4avfP.mjs";
25
24
  import { a as getApiUrl, c as getToken, o as getProxyUrl } from "./auth-B6iOCjKI.mjs";
26
- import { r as writeFileIfChanged } from "./project-tsconfig-Itv1f4WC.mjs";
27
- import { n as drizzlePlugin, t as generateQueueResolverSource } from "./dispatch-DoUnxTNo.mjs";
25
+ import { i as writeFileIfChanged, r as syncAuthTypesInProjectTsconfig } from "./project-tsconfig-CVvk6Z_e.mjs";
26
+ import { a as readDeployBuildQueueNames, r as cloudflareQueueName, s as drizzlePlugin, t as generateQueueResolverSource } from "./dispatch-CLa2LThw.mjs";
28
27
  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-D0jxye_D.mjs";
29
28
  import { n as scanWranglerDotenvKeys } from "./dotenv-CNazY3-w.mjs";
30
- 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";
29
+ import { a as findReservedEnvKeys, c as reservedEnvKeysMessage, i as findLegacyEnvFiles, l as resolveRemoteMode, o as isClientEnvKey, r as LOCAL_ENV_FILE, s as loadLocalEnv } from "./env-BaMz0j7H.mjs";
31
30
  import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-BicfKBhV.mjs";
32
31
  import { t as loadUserEnvFile } from "./load-user-env-DD5qveNU.mjs";
33
32
  import { n as INTERNAL_BINDING_PREFIXES, t as INTERNAL_BINDING_EXACT_NAMES } from "./env-raw-D74P4ebM.mjs";
34
33
  import { t as ASSET_EXTENSIONS } from "./routing-assets-DdSFxoLp.mjs";
35
- import { r as selectNativeVersionMetadataBinding, t as CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV } from "./version-metadata-tS39iW09.mjs";
36
- import { f as prerenderPages, n as SEND_EMAIL_BINDING, p as prerenderPagesNode } from "./email-cloudflare-D03g2TkS.mjs";
34
+ import { t as assertNoPrerenderFailures } from "./prerender-render-CaShbHJ3.mjs";
35
+ import { r as selectNativeVersionMetadataBinding, t as CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV } from "./version-metadata-D2vfMQzv.mjs";
36
+ import { d as isGeneratedAssetHeaders, f as resolveAssetWorkerBypass, g as prerenderPagesNode, h as prerenderPages, n as SEND_EMAIL_BINDING, u as isAssetBypassRule } from "./email-cloudflare-PMbAev9Q.mjs";
37
37
  import { r as defer } from "./validation-error-Dg9Recn1.mjs";
38
38
  import { i as safeJsonStringify } from "./protocol-DimNxVRr.mjs";
39
- import { n as completeApplicationAnalysis } from "./application-routing-DAhNP4u3.mjs";
40
- import { n as generateQueueTypes, t as generateRouteTypes } from "./route-types-BZi26DVS.mjs";
39
+ import { n as completeApplicationAnalysis } from "./application-routing-4719u_kf.mjs";
40
+ import { a as syncAuthTypesFile, i as removeAuthTypesIfPresent, n as generateQueueTypes, t as generateRouteTypes } from "./route-types-DvEGmPif.mjs";
41
41
  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";
42
42
  import module, { builtinModules, createRequire } from "node:module";
43
43
  import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
44
44
  import { cloudflare } from "@cloudflare/vite-plugin";
45
+ import { createRunnableDevEnvironment, defaultServerConditions, isRunnableDevEnvironment, loadEnv, normalizePath, parseSync, resolveEnvPrefix } from "vite";
45
46
  import { fileURLToPath, pathToFileURL } from "node:url";
46
- import { defaultServerConditions, loadEnv, normalizePath, parseSync, resolveEnvPrefix } from "vite";
47
47
  import { appendSqliteClassMigration } from "@void/deploy-core";
48
48
  import { randomBytes, timingSafeEqual } from "node:crypto";
49
49
  import { homedir } from "node:os";
@@ -489,7 +489,7 @@ function readVoidDevCredentials(root) {
489
489
  */
490
490
  async function runAiSetupPrompt(root, token, apiUrl, server) {
491
491
  const { select, text, isCancel, log } = await import("./dist-B1PLt4_8.mjs");
492
- const { PlatformClient } = await import("./client-BiRDZTSd.mjs");
492
+ const { PlatformClient } = await import("./client-BZb9j66F.mjs");
493
493
  const { attachSelectedPlatform, writeProjectConfig } = await import("./project-zdB3fs9G.mjs");
494
494
  const { inferDefaultSlug } = await import("./resolve-project-DD1vu8s9.mjs");
495
495
  const { printSuccess } = await import("./output-BW9uK099.mjs");
@@ -519,7 +519,7 @@ async function runAiSetupPrompt(root, token, apiUrl, server) {
519
519
  let slug;
520
520
  if (result === "__create__") {
521
521
  const { validateProjectSlug } = await import("./project-slug-6cyz8E7k.mjs");
522
- const { createProjectWithSlugRetry } = await import("./create-project-DTuy-l0z.mjs");
522
+ const { createProjectWithSlugRetry } = await import("./create-project-C2K0DN2O.mjs");
523
523
  let created;
524
524
  try {
525
525
  created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
@@ -2154,6 +2154,27 @@ function pushDefaultErrorPageHelpers(lines, options) {
2154
2154
  lines.push("app.onError(__errorRenderer.onError);");
2155
2155
  }
2156
2156
  /**
2157
+ * Returns a lookup that gives each key its own identifier suffix. The suffix
2158
+ * keeps the key's ASCII letters and digits; keys that clean up to the same
2159
+ * text (user-list.ts and user_list.ts, or two CJK names of one length) get a
2160
+ * counter so the generated consts never clash.
2161
+ */
2162
+ function createIdentifierNames() {
2163
+ const byKey = /* @__PURE__ */ new Map();
2164
+ const used = /* @__PURE__ */ new Set();
2165
+ return (key) => {
2166
+ const known = byKey.get(key);
2167
+ if (known !== void 0) return known;
2168
+ let base = "";
2169
+ for (const char of key.split("")) base += char >= "0" && char <= "9" || char >= "a" && char <= "z" || char >= "A" && char <= "Z" ? char : "_";
2170
+ let name = base;
2171
+ for (let n = 2; used.has(name); n++) name = `${base}_${n}`;
2172
+ used.add(name);
2173
+ byKey.set(key, name);
2174
+ return name;
2175
+ };
2176
+ }
2177
+ /**
2157
2178
  * Generate the code for the virtual route table module (virtual:void-routes).
2158
2179
  * This module creates a Hono app with:
2159
2180
  * - Middleware registered via app.use()
@@ -2253,9 +2274,10 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2253
2274
  lines.push("");
2254
2275
  }
2255
2276
  const seenFiles = /* @__PURE__ */ new Set();
2277
+ const routeNames = createIdentifierNames();
2256
2278
  for (const route of scan.routes) {
2257
2279
  const filePath = `${routesDir}/${route.filePath}`;
2258
- const loaderName = `_load_${route.filePath.replace(/[^a-zA-Z0-9]/g, "_")}`;
2280
+ const loaderName = `_load_${routeNames(route.filePath)}`;
2259
2281
  if (!seenFiles.has(route.filePath)) {
2260
2282
  seenFiles.add(route.filePath);
2261
2283
  lines.push(`const ${loaderName} = __createModuleLoader(() => import(${JSON.stringify(filePath)}), ${JSON.stringify(options.dev !== true)});`);
@@ -2295,11 +2317,12 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2295
2317
  lines.push("export const VoidLiveStreamDurableObject = __createLiveDurableObject();");
2296
2318
  lines.push("");
2297
2319
  }
2298
- if (pages && scan.pages.pages.length > 0) compilePageRoutes(lines, scan, pages, options);
2320
+ const pageNames = createIdentifierNames();
2321
+ if (pages && scan.pages.pages.length > 0) compilePageRoutes(lines, scan, pages, options, pageNames);
2299
2322
  for (let i = 0; i < webSockets.length; i++) lines.push(`app.all(${JSON.stringify(webSockets[i].pattern)}, __markRouteHandler((c) => __forwardWebSocketRequest(c.req.raw, c.env, __voidWebSocketRoutes[${i}])));`);
2300
2323
  if (webSockets.length > 0) lines.push("");
2301
2324
  if (pages && scan.pages.pages.length > 0) lines.push(`app.notFound(__createPagesFallback({ routing: __routingRuntime, errors: __errorRenderer, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${fallbackRulesJson} }));`);
2302
- compilePrerenderCollector(lines, scan, ssr, options);
2325
+ compilePrerenderCollector(lines, scan, ssr, options, pageNames);
2303
2326
  if (ssr) {
2304
2327
  lines.push(`const getClientAssetTags = __createClientAssetTags(${JSON.stringify({
2305
2328
  entryId: ssr.clientEntryRelativePath,
@@ -2364,7 +2387,9 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2364
2387
  lines.push("");
2365
2388
  }
2366
2389
  if (scan.queues.length > 0) {
2367
- lines.push(generateQueueResolverSource(scan.queues.map((queue) => queue.name)));
2390
+ const queueNames = scan.queues.map((queue) => queue.name);
2391
+ const cloudflareNames = options.cloudflareQueueNames;
2392
+ lines.push(generateQueueResolverSource(queueNames, cloudflareNames && queueNames.map((name) => cloudflareQueueName(name, cloudflareNames))));
2368
2393
  lines.push("");
2369
2394
  lines.push("export async function __processQueue(payload, env) {");
2370
2395
  lines.push(" const queueSuffix = payload.queue;");
@@ -2546,7 +2571,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2546
2571
  lines.push(`export default app;`);
2547
2572
  return lines.join("\n");
2548
2573
  }
2549
- function compilePrerenderCollector(lines, scan, ssr, options) {
2574
+ function compilePrerenderCollector(lines, scan, ssr, options, pageNames) {
2550
2575
  const staticPaths = scan.pages.pages.filter((page) => page.shouldPrerender && page.params.length === 0 && !page.catchAll).map((page) => page.pattern);
2551
2576
  const dynamicPages = scan.pages.pages.filter((page) => page.shouldPrerender && page.hasGetPrerenderPaths && (page.params.length > 0 || page.catchAll));
2552
2577
  const explicitPaths = options.explicitPrerenderPaths ?? [];
@@ -2566,7 +2591,7 @@ function compilePrerenderCollector(lines, scan, ssr, options) {
2566
2591
  lines.push(` const paths = [];`);
2567
2592
  for (const path of staticPaths) lines.push(` paths.push(${JSON.stringify(path)});`);
2568
2593
  for (const page of dynamicPages) {
2569
- const loaderName = `_pload_${page.componentId.replace(/[^a-zA-Z0-9]/g, "_")}`;
2594
+ const loaderName = `_pload_${pageNames(page.componentId)}`;
2570
2595
  lines.push(` {`);
2571
2596
  lines.push(` const mod = await ${loaderName}();`);
2572
2597
  lines.push(` if (typeof mod.getPrerenderPaths === "function") {`);
@@ -2599,7 +2624,7 @@ function compilePrerenderCollector(lines, scan, ssr, options) {
2599
2624
  lines.push(`}`);
2600
2625
  lines.push("");
2601
2626
  }
2602
- function compilePageRoutes(lines, scan, pages, options) {
2627
+ function compilePageRoutes(lines, scan, pages, options, pageNames) {
2603
2628
  lines.push(`import { renderPage } from "virtual:void-pages-renderer";`);
2604
2629
  if (options.dev) lines.push(`import { getVoidPagesDevCss } from "virtual:void-pages-dev-assets";`);
2605
2630
  const hasIslandPages = scan.pages.pages.some((p) => p.renderMode === "island");
@@ -2664,7 +2689,7 @@ function compilePageRoutes(lines, scan, pages, options) {
2664
2689
  })}${devCssOption} }, __loadPagesManifest);`);
2665
2690
  const seenServerFiles = /* @__PURE__ */ new Set();
2666
2691
  for (const page of scan.pages.pages) {
2667
- const safeId = page.componentId.replace(/[^a-zA-Z0-9]/g, "_");
2692
+ const safeId = pageNames(page.componentId);
2668
2693
  let serverImportPath = null;
2669
2694
  if (page.serverPath) serverImportPath = `${pages.pagesDir}/${page.serverPath}`;
2670
2695
  if (serverImportPath && !seenServerFiles.has(serverImportPath)) {
@@ -2720,7 +2745,7 @@ const serveWithAssets = __createAssetFallback(${JSON.stringify({
2720
2745
  * proxy-backed versions.
2721
2746
  */
2722
2747
  function compileWorkerEntry(options = {}) {
2723
- 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;
2748
+ const { hasQueues = false, versionMetadataBinding, alwaysUseHttps = false, remote, assetsDir = "assets", webSocketClasses = [], runtimeEnvPath = "void/_env", runtimeEmailPath = "void/email", envSchemaModule, sandbox, serveSpaFallback = false, hasEmail = false, live, dev = false, isr, notFound = "none", durableObjects = [] } = options;
2724
2749
  const remotePath = remote?.remotePath;
2725
2750
  const remoteBindingNames = JSON.stringify(remote?.bindingNames);
2726
2751
  const createRemoteEnvCall = `createRemoteEnv(env${remote?.bindingNames ? `, ${remoteBindingNames}` : ""})`;
@@ -2756,7 +2781,7 @@ const __filterInternalBindings = (env) => __filterBindings(env, ${JSON.stringify
2756
2781
  app, assets: serveWithAssets, withRawEnv: __withRawEnv, withRuntimeEnv,
2757
2782
  filterBindings: __filterInternalBindings,
2758
2783
  internalRoute: __voidHandleInternalRoute,
2759
- 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) }" : ""}
2784
+ collectPrerenderPaths: __voidCollectPrerenderPaths${alwaysUseHttps ? ", alwaysUseHttps: true" : ""}${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) }" : ""}
2760
2785
  })`;
2761
2786
  const remoteEnvSwap = remotePath ? ` if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};\n` : "";
2762
2787
  const scheduledHandler = `async function handleScheduled(controller, env, ctx) {
@@ -2768,7 +2793,7 @@ ${envValidateCall}${remoteEnvSwap}${isrDeploymentStamp} const userEnv = __filte
2768
2793
  const emailHandler = hasEmail ? `async function handleEmail(envelope, env, ctx) {
2769
2794
  ${envValidateCall}${remoteEnvSwap} const userEnv = __filterInternalBindings(env);
2770
2795
  const __relayed = typeof envelope.viaDomain === "string" && envelope.viaDomain.length > 0;
2771
- const __slug = __relayed ? undefined : (typeof env.__VOID_PROJECT_SLUG === "string" && env.__VOID_PROJECT_SLUG.length > 0 ? env.__VOID_PROJECT_SLUG : undefined);
2796
+ const __slug = __relayed || typeof env.__VOID_PROJECT_SLUG !== "string" || env.__VOID_PROJECT_SLUG.length === 0 ? undefined : (String(envelope.to || "").split("@")[0].split("+")[0] || env.__VOID_PROJECT_SLUG);
2772
2797
  const { message, getActions } = __createMessageProxy(envelope, { slug: __slug });
2773
2798
  await __withRawEnv(env, () => withRuntimeEnv(env, () => __emailHandler(message, userEnv, ctx, { slug: __slug })));
2774
2799
  const __actions = getActions();
@@ -3294,8 +3319,8 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
3294
3319
  const hasSqlMigrations = existsSync(migrationsDir);
3295
3320
  if (!hasSqlMigrations && !auth?.enabled) return;
3296
3321
  const migrateAuth = async (databaseUrl) => {
3297
- const { runLocalVoidAuthMigrations } = await import("./node-WB7c2N4L.mjs");
3298
- await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth?.configPath, databaseUrl);
3322
+ const { runLocalVoidAuthMigrations } = await import("./node-CDOPrGSl.mjs");
3323
+ await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth?.configPath, databaseUrl, devAuthConfigImporter(server));
3299
3324
  };
3300
3325
  const mysqlAuth = dialect === "mysql" && auth?.enabled === true;
3301
3326
  const logApplied = (applied) => {
@@ -3579,19 +3604,20 @@ function createFrameworkPlugins(input) {
3579
3604
  const syncFrameworkCompat = (compat) => {
3580
3605
  if (ensureWranglerCompatibilityDate(root, compat.compatibilityDate)) voidLog("Synced compatibility_date to Cloudflare config");
3581
3606
  };
3607
+ const ensureFrameworkCompat = () => ensureWranglerCompat(root, config, void 0, { rootWrangler: true });
3582
3608
  const wranglerCompatPlugin = {
3583
3609
  name: "void:wrangler-compat",
3584
3610
  enforce: "pre",
3585
3611
  config(_, env) {
3586
- syncFrameworkCompat(ensureWranglerCompat(root, config));
3612
+ syncFrameworkCompat(ensureFrameworkCompat());
3587
3613
  if (env.command !== "serve") return;
3588
3614
  if (ensureWranglerNodejsAlsFlag(root)) voidLog("Synced nodejs_als to Cloudflare config");
3589
3615
  },
3590
3616
  buildStart() {
3591
- syncFrameworkCompat(ensureWranglerCompat(root, config));
3617
+ syncFrameworkCompat(ensureFrameworkCompat());
3592
3618
  },
3593
3619
  configureServer() {
3594
- syncFrameworkCompat(ensureWranglerCompat(root, config));
3620
+ syncFrameworkCompat(ensureFrameworkCompat());
3595
3621
  }
3596
3622
  };
3597
3623
  const syncFrameworkBindings = (command) => {
@@ -3806,6 +3832,7 @@ function honoMiddleware(getApp) {
3806
3832
  response.headers.forEach((value, key) => {
3807
3833
  res.setHeader(key, value);
3808
3834
  });
3835
+ res.setHeader("set-cookie", response.headers.getSetCookie());
3809
3836
  if (response.body) {
3810
3837
  const reader = response.body.getReader();
3811
3838
  while (true) {
@@ -3967,7 +3994,7 @@ function prerenderPlugin(root, config) {
3967
3994
  voidLog("No pages to prerender");
3968
3995
  return;
3969
3996
  }
3970
- if (result.failed.length > 0) voidWarn(`${result.failed.length} page(s) failed to prerender`);
3997
+ assertNoPrerenderFailures(result.failed);
3971
3998
  }
3972
3999
  };
3973
4000
  }
@@ -4159,10 +4186,13 @@ function restartPlugin() {
4159
4186
  }
4160
4187
  //#endregion
4161
4188
  //#region src/client-asset-manifest.ts
4162
- /** Attach cache provenance to the existing manifest without changing its entry inventory. */
4189
+ /**
4190
+ * Attach cache provenance to the existing manifest without changing its entry inventory.
4191
+ * Returns the stamped immutable files, sorted, relative to the client root.
4192
+ */
4163
4193
  function stampClientAssetCachePolicy(bundle, manifestPath, headerRules = []) {
4164
4194
  const asset = bundle[manifestPath];
4165
- if (asset?.type !== "asset") return;
4195
+ if (asset?.type !== "asset") return [];
4166
4196
  const fingerprinted = /* @__PURE__ */ new Set();
4167
4197
  const authoredCachePatterns = headerRules.filter((rule) => rule.headers.some(([name]) => name.toLowerCase() === "cache-control")).map((rule) => rule.pattern);
4168
4198
  for (const pattern of authoredCachePatterns) compilePattern(pattern);
@@ -4170,9 +4200,13 @@ function stampClientAssetCachePolicy(bundle, manifestPath, headerRules = []) {
4170
4200
  if (!authoredCachePatterns.some((pattern) => matchPattern(pattern, "/" + item.fileName))) fingerprinted.add(item.fileName);
4171
4201
  }
4172
4202
  const manifest = JSON.parse(String(asset.source));
4173
- for (const entry of Object.values(manifest)) if (entry.file && fingerprinted.has(entry.file)) entry.immutableFiles = [entry.file];
4174
- else delete entry.immutableFiles;
4203
+ const stamped = /* @__PURE__ */ new Set();
4204
+ for (const entry of Object.values(manifest)) if (entry.file && fingerprinted.has(entry.file)) {
4205
+ entry.immutableFiles = [entry.file];
4206
+ stamped.add(entry.file);
4207
+ } else delete entry.immutableFiles;
4175
4208
  asset.source = JSON.stringify(manifest, null, 2);
4209
+ return [...stamped].sort();
4176
4210
  }
4177
4211
  //#endregion
4178
4212
  //#region src/plugin-routing.ts
@@ -4201,6 +4235,20 @@ function routingPlugin(root, options) {
4201
4235
  let previewing = false;
4202
4236
  let ssr = null;
4203
4237
  let authConfigPath = null;
4238
+ const routeInputsKey = () => JSON.stringify([
4239
+ scan,
4240
+ authConfigPath,
4241
+ ssr,
4242
+ compileOptions.auth
4243
+ ]);
4244
+ let generatedRouteInputs;
4245
+ let generatedFiles;
4246
+ let pendingRegeneration = Promise.resolve();
4247
+ function regenerateInOrder(regenerate) {
4248
+ const result = pendingRegeneration.then(regenerate);
4249
+ pendingRegeneration = result.then(() => {}, () => {});
4250
+ return result;
4251
+ }
4204
4252
  const paths = readProjectPaths(root);
4205
4253
  const routesDir = paths.routesDir;
4206
4254
  const middlewareDir = paths.middlewareDir;
@@ -4210,6 +4258,8 @@ function routingPlugin(root, options) {
4210
4258
  const pagesDir = paths.pagesDir;
4211
4259
  const ssrDir = paths.ssrDir;
4212
4260
  const authConfigPaths = new Set(paths.authConfigCandidates.map((path) => normalizePath(path)));
4261
+ let authConfigEnvironment;
4262
+ let authConfigStale = false;
4213
4263
  const envFilePaths = new Set(paths.envFileCandidates.map((path) => normalizePath(path)));
4214
4264
  const normalizedRoutesDir = normalizePath(routesDir);
4215
4265
  const normalizedMiddlewareDir = normalizePath(middlewareDir);
@@ -4237,9 +4287,10 @@ function routingPlugin(root, options) {
4237
4287
  }
4238
4288
  async function rescan(refresh = false) {
4239
4289
  const analysis = options.getApplicationAnalysis(routeEnvironment, refresh);
4240
- scan = (await completeApplicationAnalysis(analysis)).scan;
4241
- authConfigPath = analysis.authConfigPath;
4290
+ const nextScan = (await completeApplicationAnalysis(analysis)).scan;
4242
4291
  const entries = validateSsrEntries(root, paths);
4292
+ scan = nextScan;
4293
+ authConfigPath = analysis.authConfigPath;
4243
4294
  ssr = entries ? {
4244
4295
  serverEntryPath: entries.server.absolutePath,
4245
4296
  clientEntryRelativePath: entries.client.relativePath
@@ -4321,13 +4372,51 @@ function routingPlugin(root, options) {
4321
4372
  providers: config.auth?.providers ?? null
4322
4373
  };
4323
4374
  }
4375
+ /**
4376
+ * Size and mtime of every generated file, or undefined when one is missing.
4377
+ * Another void process in the same root (a build, `void db generate`) can
4378
+ * rewrite them, and the dev watcher ignores `.void/`.
4379
+ */
4380
+ function generatedFilesSignature() {
4381
+ const files = [
4382
+ "routes.d.ts",
4383
+ "queues.d.ts",
4384
+ ...options.target ? ["app.ts", "index.ts"] : ["entry.ts"],
4385
+ ...compileOptions.auth ? [
4386
+ "better-auth-db.ts",
4387
+ "better-auth-schema.ts",
4388
+ ...compileOptions.auth.authConfigPath ? ["auth.d.ts"] : []
4389
+ ] : []
4390
+ ];
4391
+ const parts = [];
4392
+ for (const file of files) {
4393
+ const stat = statSync(join(outDir, file), { throwIfNoEntry: false });
4394
+ if (!stat?.isFile()) return;
4395
+ parts.push(`${file}:${stat.size}:${stat.mtimeMs}`);
4396
+ }
4397
+ return parts.join("|");
4398
+ }
4399
+ async function loadAuthConfig(configPath) {
4400
+ const environment = authConfigEnvironment;
4401
+ if (authConfigStale && environment) environment.moduleGraph.invalidateAll();
4402
+ authConfigStale = false;
4403
+ try {
4404
+ return await loadVoidAuthConfig(configPath, environment ? (path) => environment.runner.import(path) : viteAuthConfigImporter(root, resolvedConfig?.mode, resolvedConfig?.resolve));
4405
+ } catch (error) {
4406
+ authConfigStale = true;
4407
+ throw error;
4408
+ }
4409
+ }
4324
4410
  async function writeAuthDatabaseFiles() {
4325
- if (!compileOptions.auth) return;
4411
+ if (!compileOptions.auth) {
4412
+ if (removeAuthTypesIfPresent(outDir)) syncAuthTypesInProjectTsconfig(root);
4413
+ return;
4414
+ }
4326
4415
  const { generateVoidAuthDatabaseModule, generateVoidAuthDrizzleSchema } = await import("./drizzle-9TubSZvI.mjs");
4327
4416
  const authRuntime = {
4328
4417
  dialect: compileOptions.auth.dialect,
4329
4418
  providers: compileOptions.auth.providers,
4330
- userConfig: await loadVoidAuthConfig(compileOptions.auth.authConfigPath)
4419
+ userConfig: await loadAuthConfig(compileOptions.auth.authConfigPath)
4331
4420
  };
4332
4421
  const env = {
4333
4422
  ...resolvedConfig?.command === "serve" ? loadLocalEnv(root) : {},
@@ -4340,6 +4429,8 @@ function routingPlugin(root, options) {
4340
4429
  schemaImportPath: authSchemaPath,
4341
4430
  drizzleAdapterPath
4342
4431
  }));
4432
+ syncAuthTypesFile(compileOptions.auth.authConfigPath, outDir);
4433
+ syncAuthTypesInProjectTsconfig(root);
4343
4434
  }
4344
4435
  let resolvedConfig = null;
4345
4436
  let isrRevalidate;
@@ -4362,7 +4453,8 @@ function routingPlugin(root, options) {
4362
4453
  return framework ? `${base}:${framework}` : base;
4363
4454
  }
4364
4455
  function isPotentialAuthConfigPath(path) {
4365
- return authConfigPaths.has(normalizePath(path));
4456
+ const normalized = normalizePath(path);
4457
+ return authConfigPaths.has(normalized) || (authConfigEnvironment?.moduleGraph.getModulesByFile(normalized)?.size ?? 0) > 0;
4366
4458
  }
4367
4459
  function isPotentialEnvFilePath(path) {
4368
4460
  return envFilePaths.has(normalizePath(path));
@@ -4395,6 +4487,61 @@ function routingPlugin(root, options) {
4395
4487
  notFound: options.routing?.notFound
4396
4488
  });
4397
4489
  }
4490
+ let clientImmutableFiles = [];
4491
+ /**
4492
+ * The generated `_headers` text when this build can skip the Worker for its
4493
+ * hashed files, and the new `wrangler.json` text when it changes; null when
4494
+ * there is no built Worker config. Reads only, so a read failure leaves the
4495
+ * output unchanged.
4496
+ */
4497
+ function planAssetWorkerBypass(clientDir, assetsDir, userHeaders) {
4498
+ if (!scan || !resolvedConfig || compileOptions.managedDispatch) return null;
4499
+ let wranglerPath;
4500
+ let wrangler;
4501
+ try {
4502
+ const distDir = resolveDistDir(root);
4503
+ wranglerPath = join(distDir, resolveWorkerDirName(distDir), "wrangler.json");
4504
+ wrangler = JSON.parse(readFileSync(wranglerPath, "utf8"));
4505
+ } catch {
4506
+ return null;
4507
+ }
4508
+ const assets = wrangler?.assets;
4509
+ if (!assets || typeof assets !== "object" || typeof assets.directory !== "string" || resolve(dirname(wranglerPath), assets.directory) !== clientDir) return null;
4510
+ const revalidate = options.routing?.revalidate;
4511
+ const facts = {
4512
+ runWorkerFirst: assets.run_worker_first,
4513
+ notFoundHandling: assets.not_found_handling,
4514
+ base: resolvedConfig.base,
4515
+ hasMiddleware: scan.middleware.length > 0,
4516
+ authEnabled: compileOptions.auth !== null,
4517
+ headerRuleCount: compileOptions.headerRules?.length ?? 0,
4518
+ redirectRuleCount: compileOptions.redirectRules?.length ?? 0,
4519
+ fallbackRuleCount: compileOptions.fallbackRules?.length ?? 0,
4520
+ publicEdgeFiles: publicDir !== null && (existsSync(join(publicDir, "_headers")) || existsSync(join(publicDir, "_redirects"))),
4521
+ patterns: [
4522
+ ...scan.routes.map((route) => route.pattern),
4523
+ ...scan.pages.pages.map((page) => page.pattern),
4524
+ ...(scan.websockets ?? []).map((route) => route.pattern),
4525
+ ...(options.prerenderPaths ?? []).filter((path) => typeof path === "string"),
4526
+ ...revalidate && typeof revalidate === "object" ? Object.keys(revalidate) : []
4527
+ ],
4528
+ assetsDir,
4529
+ immutableFiles: clientImmutableFiles
4530
+ };
4531
+ const bypass = userHeaders ? null : resolveAssetWorkerBypass(facts);
4532
+ const runWorkerFirst = bypass?.runWorkerFirst ?? (isAssetBypassRule(assets.run_worker_first, assetsDir) ? ["/**"] : null);
4533
+ return {
4534
+ headers: bypass?.headers ?? null,
4535
+ wranglerPath,
4536
+ wranglerText: runWorkerFirst && JSON.stringify({
4537
+ ...wrangler,
4538
+ assets: {
4539
+ ...assets,
4540
+ run_worker_first: runWorkerFirst
4541
+ }
4542
+ })
4543
+ };
4544
+ }
4398
4545
  const sandboxEntry = options.hasSandbox ? {
4399
4546
  bindingName: options.sandboxBindingName,
4400
4547
  className: options.sandboxClassName,
@@ -4410,6 +4557,7 @@ function routingPlugin(root, options) {
4410
4557
  const policy = resolveCurrentAssetRoutingPolicy();
4411
4558
  writeFileIfChanged(join(outDir, "entry.ts"), compileWorkerEntry({
4412
4559
  versionMetadataBinding: options.getVersionMetadataBinding?.(),
4560
+ alwaysUseHttps: options.routing?.alwaysUseHttps === true && resolvedConfig?.command === "build" && !compileOptions.managedDispatch,
4413
4561
  hasQueues: scan.queues.length > 0,
4414
4562
  remote,
4415
4563
  assetsDir: resolvedConfig?.build.assetsDir,
@@ -4449,6 +4597,7 @@ function routingPlugin(root, options) {
4449
4597
  authClientPath = resolveAuthClientPath(config);
4450
4598
  compileOptions.dev = config.command === "serve" && !previewing;
4451
4599
  compileOptions.assetsDir = config.build.assetsDir;
4600
+ compileOptions.cloudflareQueueNames = config.command === "build" ? readDeployBuildQueueNames() : void 0;
4452
4601
  compileOptions.reactRefresh = config.plugins.some((plugin) => plugin.name === "vite:react-babel" || plugin.name === "vite:react-refresh" || plugin.name === "vite:react-swc");
4453
4602
  const resolvedPublicDir = config.publicDir && config.publicDir.length > 0 ? config.publicDir : null;
4454
4603
  if (resolvedPublicDir !== publicDir) {
@@ -4459,26 +4608,39 @@ function routingPlugin(root, options) {
4459
4608
  config(_, env) {
4460
4609
  previewing = env.isPreview === true;
4461
4610
  routeEnvironment = env.command === "serve" && !env.isPreview ? "dev" : "prod";
4611
+ const authConfigEnvironmentConfig = routeEnvironment === "dev" ? { environments: { [AUTH_CONFIG_ENVIRONMENT]: {
4612
+ consumer: "server",
4613
+ dev: { createEnvironment: (name, config) => createRunnableDevEnvironment(name, config, {
4614
+ hot: false,
4615
+ runnerOptions: { hmr: false }
4616
+ }) }
4617
+ } } } : {};
4462
4618
  compileOptions.hasLive = options.live !== void 0;
4463
4619
  compileOptions.managedDispatch = !options.target && env.command === "build" && Boolean(process.env.VOID_DEPLOY_PROJECT_ID);
4464
- if (env.command === "serve" && options.isAuthEnabled()) return { resolve: { alias: [
4465
- "client",
4466
- "react",
4467
- "vue",
4468
- "svelte",
4469
- "solid"
4470
- ].flatMap((sub) => {
4471
- try {
4472
- return [{
4473
- find: `better-auth/${sub}`,
4474
- replacement: resolveFile(`better-auth/${sub}`)
4475
- }];
4476
- } catch {
4477
- return [];
4478
- }
4479
- }) } };
4620
+ if (env.command === "serve" && options.isAuthEnabled()) {
4621
+ const resolvedAliases = [
4622
+ "client",
4623
+ "react",
4624
+ "vue",
4625
+ "svelte",
4626
+ "solid"
4627
+ ].flatMap((sub) => {
4628
+ try {
4629
+ return [{
4630
+ find: new RegExp(`^better-auth/${sub}$`),
4631
+ replacement: resolveFile(`better-auth/${sub}`)
4632
+ }];
4633
+ } catch {
4634
+ return [];
4635
+ }
4636
+ });
4637
+ return {
4638
+ ...authConfigEnvironmentConfig,
4639
+ resolve: { alias: resolvedAliases }
4640
+ };
4641
+ }
4480
4642
  const entries = validateSsrEntries(root, paths);
4481
- if (env.command !== "build") return;
4643
+ if (env.command !== "build") return authConfigEnvironmentConfig;
4482
4644
  return { build: {
4483
4645
  manifest: entries ? true : _.build?.manifest ?? true,
4484
4646
  ...entries ? { rollupOptions: { input: entries.client.absolutePath } } : {}
@@ -4488,42 +4650,71 @@ function routingPlugin(root, options) {
4488
4650
  order: "post",
4489
4651
  handler(_output, bundle) {
4490
4652
  const manifest = this.environment.config.build.manifest;
4491
- if (this.environment.name === "client" && manifest) stampClientAssetCachePolicy(bundle, typeof manifest === "string" ? manifest : ".vite/manifest.json", compileOptions.headerRules);
4653
+ if (this.environment.name === "client") clientImmutableFiles = manifest ? stampClientAssetCachePolicy(bundle, typeof manifest === "string" ? manifest : ".vite/manifest.json", compileOptions.headerRules) : [];
4492
4654
  }
4493
4655
  },
4494
- async buildStart() {
4495
- await rescan();
4496
- if (options.target && (scan?.websockets?.length ?? 0) > 0) throw new Error("routing: WebSocket routes require the default Cloudflare target.");
4497
- resolveAuthCompileOptions();
4498
- await writeAuthDatabaseFiles();
4499
- writeRouteTypes();
4500
- writeQueueTypes();
4501
- if (!options.target) {
4502
- const migrationsDir = paths.migrationsDir;
4503
- if (existsSync(migrationsDir) || compileOptions.auth) {
4504
- const { collectMigrations } = await import("./collect-BWhkgtAn.mjs");
4505
- const { buildMigrationPlanBundle } = await import("./plan-CKX_jWnD.mjs");
4506
- const migrations = existsSync(migrationsDir) ? collectMigrations(migrationsDir) : [];
4507
- const dialect = getDatabaseDialect(readConfig(root));
4508
- compileOptions.migrationHandlerPath = resolveFile(dialect === "postgresql" ? "#self/runtime/migration-handler-pg" : dialect === "mysql" ? "#self/runtime/migration-handler-mysql" : "#self/runtime/migration-handler");
4509
- compileOptions.migrations = migrations;
4510
- compileOptions.migrationPlanBundle = dialect === "sqlite" ? buildMigrationPlanBundle(migrations) : void 0;
4656
+ writeBundle() {
4657
+ if (!options.assetWorkerBypass || options.target || resolvedConfig?.command !== "build" || this.environment.name !== "client") return;
4658
+ const { outDir, assetsDir } = this.environment.config.build;
4659
+ const clientDir = resolve(resolvedConfig.root, outDir);
4660
+ const headersPath = join(clientDir, "_headers");
4661
+ let generatedHeaders = false;
4662
+ let userHeaders = false;
4663
+ if (existsSync(headersPath)) {
4664
+ try {
4665
+ generatedHeaders = isGeneratedAssetHeaders(readFileSync(headersPath, "utf8"));
4666
+ } catch {
4667
+ return;
4511
4668
  }
4669
+ userHeaders = !generatedHeaders;
4512
4670
  }
4513
- if (options.target) writeNodeEntries(options.target);
4514
- else {
4515
- const buildConfig = readConfig(root);
4516
- const merged = collectRevalidate(buildConfig, scan.pages);
4517
- const configuredRevalidate = buildConfig.routing?.revalidate;
4518
- const emitIsr = resolvedConfig?.command === "build" && !process.env.VOID_DEPLOY_PROJECT_ID && hasRevalidate(merged);
4519
- isrRevalidate = emitIsr ? merged : void 0;
4520
- isrPages = emitIsr ? collectPages(scan.pages, configuredRevalidate) : void 0;
4521
- isrPathRevalidate = emitIsr && configuredRevalidate && typeof configuredRevalidate === "object" ? configuredRevalidate : void 0;
4522
- writeWorkerEntry(emitIsr ? {
4523
- runtimePath: resolveFile("@void/isr/runtime"),
4524
- queryAllowlist: buildConfig.routing?.revalidateQueryAllowlist
4525
- } : void 0);
4526
- }
4671
+ const plan = planAssetWorkerBypass(clientDir, assetsDir, userHeaders);
4672
+ if (plan?.headers) writeFileSync(headersPath, plan.headers);
4673
+ else if (generatedHeaders) rmSync(headersPath);
4674
+ if (plan?.wranglerText) writeFileSync(plan.wranglerPath, plan.wranglerText);
4675
+ },
4676
+ buildStart() {
4677
+ return regenerateInOrder(async () => {
4678
+ generatedRouteInputs = void 0;
4679
+ await rescan();
4680
+ if (options.target && (scan?.websockets?.length ?? 0) > 0) throw new Error("routing: WebSocket routes require the default Cloudflare target.");
4681
+ resolveAuthCompileOptions();
4682
+ const nextRouteInputs = routeInputsKey();
4683
+ await writeAuthDatabaseFiles();
4684
+ writeRouteTypes();
4685
+ writeQueueTypes();
4686
+ if (!options.target) {
4687
+ const migrationsDir = paths.migrationsDir;
4688
+ if (existsSync(migrationsDir) || compileOptions.auth) {
4689
+ const { collectMigrations } = await import("./collect-BWhkgtAn.mjs");
4690
+ const { buildMigrationPlanBundle } = await import("./plan-CKX_jWnD.mjs");
4691
+ const migrations = existsSync(migrationsDir) ? collectMigrations(migrationsDir) : [];
4692
+ const dialect = getDatabaseDialect(readConfig(root));
4693
+ compileOptions.migrationHandlerPath = resolveFile(dialect === "postgresql" ? "#self/runtime/migration-handler-pg" : dialect === "mysql" ? "#self/runtime/migration-handler-mysql" : "#self/runtime/migration-handler");
4694
+ compileOptions.migrations = migrations;
4695
+ compileOptions.migrationPlanBundle = dialect === "sqlite" ? buildMigrationPlanBundle(migrations) : void 0;
4696
+ }
4697
+ }
4698
+ if (options.target) writeNodeEntries(options.target);
4699
+ else {
4700
+ const buildConfig = readConfig(root);
4701
+ const merged = collectRevalidate(buildConfig, scan.pages);
4702
+ const configuredRevalidate = buildConfig.routing?.revalidate;
4703
+ const emitIsr = resolvedConfig?.command === "build" && !process.env.VOID_DEPLOY_PROJECT_ID && hasRevalidate(merged);
4704
+ isrRevalidate = emitIsr ? merged : void 0;
4705
+ isrPages = emitIsr ? collectPages(scan.pages, configuredRevalidate) : void 0;
4706
+ isrPathRevalidate = emitIsr && configuredRevalidate && typeof configuredRevalidate === "object" ? configuredRevalidate : void 0;
4707
+ writeWorkerEntry(emitIsr ? {
4708
+ runtimePath: resolveFile("@void/isr/runtime"),
4709
+ queryAllowlist: buildConfig.routing?.revalidateQueryAllowlist
4710
+ } : void 0);
4711
+ }
4712
+ generatedRouteInputs = nextRouteInputs;
4713
+ generatedFiles = generatedFilesSignature();
4714
+ });
4715
+ },
4716
+ watchChange(id) {
4717
+ invalidateSourceAnalysis(id);
4527
4718
  },
4528
4719
  resolveId: {
4529
4720
  filter: { id: RESOLVE_ID_FILTER },
@@ -4544,44 +4735,79 @@ function routingPlugin(root, options) {
4544
4735
  if (virtualClient?.[1] === "worker") return compileWorkerClient(getClientAuthPath(id), Boolean(options.target));
4545
4736
  if (id !== VIRTUAL_ROUTES_ID) return;
4546
4737
  if (this?.environment?.name === "client") throw new Error(`${VIRTUAL_ROUTES_ID} is server-only and cannot be loaded by client code.`);
4547
- if (!scan) await rescan();
4738
+ if (!scan) await regenerateInOrder(() => rescan());
4548
4739
  return compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, ssr, compileOptions, getPagesCompileOptions(), isrRevalidate, isrPages, isrPathRevalidate);
4549
4740
  }
4550
4741
  },
4742
+ hotUpdate() {
4743
+ if (this.environment.name === "void_auth_config") return [];
4744
+ },
4551
4745
  configureServer(devServer) {
4746
+ const authEnvironment = devServer.environments[AUTH_CONFIG_ENVIRONMENT];
4747
+ authConfigEnvironment = authEnvironment && isRunnableDevEnvironment(authEnvironment) ? authEnvironment : void 0;
4552
4748
  const watcher = devServer.watcher;
4553
4749
  const handleFileChange = async (path, event) => {
4554
4750
  const normalizedPath = normalizePath(path);
4555
- 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;
4556
- await rescan(true);
4557
- resolveAuthCompileOptions();
4558
- if (event !== "change" && options.onDevAssetRoutingPolicyChange?.(resolveCurrentAssetRoutingPolicy()) === true) {
4559
- await devServer.restart();
4560
- return;
4561
- }
4562
- await writeAuthDatabaseFiles();
4563
- writeRouteTypes();
4564
- writeQueueTypes();
4565
- if (options.target) writeNodeEntries(options.target);
4566
- else writeWorkerEntry(void 0);
4567
- const structural = event !== "change";
4568
- const pageManifestChanged = isInDirectory(normalizedPath, normalizedPagesDir) && (structural || normalizedPath.endsWith(".md"));
4569
- for (const env of Object.values(devServer.environments)) {
4570
- if (pageManifestChanged) for (const id of PAGE_VIRTUAL_MODULE_IDS) {
4571
- const pageMod = env.moduleGraph.getModuleById(id);
4572
- if (pageMod) env.moduleGraph.invalidateModule(pageMod);
4751
+ invalidateSourceAnalysis(normalizedPath);
4752
+ const authConfigChanged = isPotentialAuthConfigPath(normalizedPath);
4753
+ if (authConfigChanged) authConfigStale = true;
4754
+ const authImportCreated = event === "add" && authConfigStale && compileOptions.auth !== null;
4755
+ if (!(isInDirectory(normalizedPath, normalizedRoutesDir) || isInDirectory(normalizedPath, normalizedMiddlewareDir) || isInDirectory(normalizedPath, normalizedJobsDir) || isInDirectory(normalizedPath, normalizedQueuesDir) || isInDirectory(normalizedPath, normalizedEmailDir) || isInDirectory(normalizedPath, normalizedPagesDir) || authConfigChanged || authImportCreated || isPotentialEnvFilePath(normalizedPath)) && !ssrEntryAbsPaths.has(normalizedPath)) return;
4756
+ if (await regenerateInOrder(async () => {
4757
+ invalidateSourceAnalysis(normalizedPath);
4758
+ if (event !== "change" || authConfigChanged || isPotentialEnvFilePath(normalizedPath) || ssrEntryAbsPaths.has(normalizedPath)) generatedRouteInputs = void 0;
4759
+ try {
4760
+ await rescan(true);
4761
+ } catch (error) {
4762
+ const message = error instanceof Error ? error.message : String(error);
4763
+ if (!(message.startsWith("pages:") && isInDirectory(normalizedPath, normalizedPagesDir) && (event !== "change" || normalizedPath.endsWith(".md")) && resolvedConfig?.plugins?.some((plugin) => plugin.name.endsWith(":pages")) === true)) devServer.config.logger.error(message, {
4764
+ error: error instanceof Error ? error : void 0,
4765
+ timestamp: true
4766
+ });
4767
+ return;
4573
4768
  }
4574
- const mod = env.moduleGraph.getModuleById(VIRTUAL_ROUTES_ID);
4575
- if (mod) {
4576
- env.moduleGraph.invalidateModule(mod);
4577
- if (structural) env.hot.send({ type: "full-reload" });
4769
+ resolveAuthCompileOptions();
4770
+ const nextRouteInputs = routeInputsKey();
4771
+ const currentFiles = generatedFilesSignature();
4772
+ const routeInputsChanged = nextRouteInputs !== generatedRouteInputs || currentFiles === void 0 || currentFiles !== generatedFiles;
4773
+ if (routeInputsChanged) generatedRouteInputs = void 0;
4774
+ if (event !== "change" && options.onDevAssetRoutingPolicyChange?.(resolveCurrentAssetRoutingPolicy()) === true) return true;
4775
+ if (routeInputsChanged) {
4776
+ await writeAuthDatabaseFiles();
4777
+ writeRouteTypes();
4778
+ writeQueueTypes();
4779
+ if (options.target) writeNodeEntries(options.target);
4780
+ else writeWorkerEntry(void 0);
4578
4781
  }
4579
- }
4580
- if (/\.island\./.test(normalizedPath) || normalizedPath.endsWith(".md")) devServer.environments.client?.hot.send({ type: "full-reload" });
4782
+ const structural = event !== "change";
4783
+ const pageManifestChanged = isInDirectory(normalizedPath, normalizedPagesDir) && (structural || normalizedPath.endsWith(".md"));
4784
+ for (const env of Object.values(devServer.environments)) {
4785
+ if (pageManifestChanged) for (const id of PAGE_VIRTUAL_MODULE_IDS) {
4786
+ const pageMod = env.moduleGraph.getModuleById(id);
4787
+ if (pageMod) env.moduleGraph.invalidateModule(pageMod);
4788
+ }
4789
+ const mod = env.moduleGraph.getModuleById(VIRTUAL_ROUTES_ID);
4790
+ if (mod && routeInputsChanged) {
4791
+ env.moduleGraph.invalidateModule(mod);
4792
+ if (structural) env.hot.send({ type: "full-reload" });
4793
+ }
4794
+ }
4795
+ if (/\.island\./.test(normalizedPath) || normalizedPath.endsWith(".md")) devServer.environments.client?.hot.send({ type: "full-reload" });
4796
+ if (routeInputsChanged) {
4797
+ generatedRouteInputs = nextRouteInputs;
4798
+ generatedFiles = generatedFilesSignature();
4799
+ }
4800
+ })) await devServer.restart();
4581
4801
  };
4582
- watcher.on("add", (path) => handleFileChange(path, "add"));
4583
- watcher.on("change", (path) => handleFileChange(path, "change"));
4584
- watcher.on("unlink", (path) => handleFileChange(path, "unlink"));
4802
+ const onFileChange = (path, event) => handleFileChange(path, event).catch((error) => {
4803
+ devServer.config.logger.error(error instanceof Error ? error.message : String(error), {
4804
+ error: error instanceof Error ? error : void 0,
4805
+ timestamp: true
4806
+ });
4807
+ });
4808
+ watcher.on("add", (path) => onFileChange(path, "add"));
4809
+ watcher.on("change", (path) => onFileChange(path, "change"));
4810
+ watcher.on("unlink", (path) => onFileChange(path, "unlink"));
4585
4811
  if (publicDir) {
4586
4812
  const redirectsPath = join(publicDir, "_redirects");
4587
4813
  const headersPath = join(publicDir, "_headers");
@@ -4780,19 +5006,22 @@ function mergeWorkerBindings(resolved, input) {
4780
5006
  vars.__VOID_EMAIL_FROM = config.email.from;
4781
5007
  result.vars = vars;
4782
5008
  }
4783
- if (queues.length > 0) result.queues = {
4784
- producers: queues.map((q) => ({
4785
- queue: q.name,
4786
- binding: q.bindingName
4787
- })),
4788
- consumers: queues.map((q) => ({
4789
- queue: q.name,
4790
- ...q.maxBatchSize != null && { max_batch_size: q.maxBatchSize },
4791
- ...q.maxBatchTimeout != null && { max_batch_timeout: q.maxBatchTimeout },
4792
- ...q.maxRetries != null && { max_retries: q.maxRetries },
4793
- ...q.retryDelay != null && { retry_delay: q.retryDelay }
4794
- }))
4795
- };
5009
+ if (queues.length > 0) {
5010
+ const cloudflareNames = viteCommand === "build" ? readDeployBuildQueueNames() : void 0;
5011
+ result.queues = {
5012
+ producers: queues.map((q) => ({
5013
+ queue: cloudflareQueueName(q.name, cloudflareNames),
5014
+ binding: q.bindingName
5015
+ })),
5016
+ consumers: queues.map((q) => ({
5017
+ queue: cloudflareQueueName(q.name, cloudflareNames),
5018
+ ...q.maxBatchSize != null && { max_batch_size: q.maxBatchSize },
5019
+ ...q.maxBatchTimeout != null && { max_batch_timeout: q.maxBatchTimeout },
5020
+ ...q.maxRetries != null && { max_retries: q.maxRetries },
5021
+ ...q.retryDelay != null && { retry_delay: q.retryDelay }
5022
+ }))
5023
+ };
5024
+ }
4796
5025
  if (environmentWebsocketRoutes.length > 0) {
4797
5026
  const existingDurableObjectBindings = resolved.durable_objects?.bindings ?? [];
4798
5027
  for (const route of environmentWebsocketRoutes) {
@@ -5349,7 +5578,7 @@ function voidPlugin(options) {
5349
5578
  dir: assetRoutingPublicDir,
5350
5579
  routing: config.routing
5351
5580
  });
5352
- if (!managedCloudflareBuild && (rules.headerRules.length > 0 || rules.redirectRules.length > 0 || (rules.fallbackRules?.length ?? 0) > 0)) {
5581
+ if (!managedCloudflareBuild && (config.routing?.alwaysUseHttps === true || rules.headerRules.length > 0 || rules.redirectRules.length > 0 || (rules.fallbackRules?.length ?? 0) > 0)) {
5353
5582
  policy.assetConfig.run_worker_first = ["/**"];
5354
5583
  if (rules.fallbackRules?.length && policy.assetConfig.not_found_handling === "single-page-application") {
5355
5584
  policy.assetConfig.not_found_handling = "none";
@@ -5413,7 +5642,8 @@ function voidPlugin(options) {
5413
5642
  },
5414
5643
  durableObjects,
5415
5644
  websocketTombstones,
5416
- onDevAssetRoutingPolicyChange: updateDevAssetRoutingPolicy
5645
+ onDevAssetRoutingPolicyChange: updateDevAssetRoutingPolicy,
5646
+ assetWorkerBypass: true
5417
5647
  }),
5418
5648
  drizzlePlugin(root, true, dialect, {
5419
5649
  d1BindingName: bindingNames?.d1,