void 0.20.3 → 0.21.1
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.
- package/README.md +2 -2
- package/dist/agents-gni4eqBu.mjs +111 -0
- package/dist/auth-3sGB0zJ1.mjs +22 -0
- package/dist/{auth-DPl6kck4.mjs → auth-B9_D6ygs.mjs} +6 -241
- package/dist/auth-CAw7zHqj.mjs +2 -0
- package/dist/auth-client-BWBT8HLp.mjs +6 -0
- package/dist/auth-client-Bawdj38n.d.mts +7 -0
- package/dist/auth-client-react-7GFffu8R.d.mts +7 -0
- package/dist/auth-client-react-CMLwT2xI.mjs +6 -0
- package/dist/auth-client-solid-DyTFL4cq.d.mts +7 -0
- package/dist/auth-client-solid-UoreJWZG.mjs +6 -0
- package/dist/auth-client-svelte-Cv_WvrRk.mjs +6 -0
- package/dist/auth-client-svelte-zetW0KIH.d.mts +7 -0
- package/dist/auth-client-vue-CFk7Xbv3.mjs +6 -0
- package/dist/auth-client-vue-bChShbQP.d.mts +7 -0
- package/dist/{auth-cmd-CzwquNiP.mjs → auth-cmd-g_ymMkUe.mjs} +5 -5
- package/dist/{auth-link-ElDTgF7j.mjs → auth-link-DFvxIyZi.mjs} +5 -5
- package/dist/{better-auth-shared-DSCeohOK.d.mts → better-auth-shared-BoVwA5Vm.d.mts} +1 -6
- package/dist/{better-auth-shared-CYw1T3k4.mjs → better-auth-shared-syGYYmnY.mjs} +1 -1
- package/dist/{build-cmd-BpJe6boP.mjs → build-cmd-wJAv808h.mjs} +6 -4
- package/dist/{cache-D98YTqeE.mjs → cache-Be0Fu5Ka.mjs} +6 -4
- package/dist/{cancel-deploy-CPbEQLMG.mjs → cancel-deploy-BgmyOwhe.mjs} +5 -3
- package/dist/cf-access-rAZxzMkL.mjs +181 -0
- package/dist/cf-build-output-CTdlo6Rt.mjs +520 -0
- package/dist/cli/cf-compat.d.mts +1 -0
- package/dist/cli/cf-compat.mjs +944 -0
- package/dist/cli/cli.mjs +60 -38
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-DAAivdid.mjs +2 -0
- package/dist/{client-BQBrZoCX.mjs → client-PdAJ-F0t.mjs} +6 -12
- package/dist/{cloudflare-auth-6M5llVPC.mjs → cloudflare-auth-BCmTc1X_.mjs} +13 -44
- package/dist/{cloudflare-cmd-4RPGN3KB.mjs → cloudflare-cmd-D6PrKn7o.mjs} +4 -7
- package/dist/{cloudflare-connect-t1UU5svD.mjs → cloudflare-connect-DloREDlc.mjs} +6 -6
- package/dist/cloudflare-operations-BHNJVDbN.mjs +2 -0
- package/dist/{cloudflare-operations-BzWnlC1_.mjs → cloudflare-operations-CPEdHYhM.mjs} +37 -39
- package/dist/cloudflare-user-output-Q-k0QoNQ.mjs +20 -0
- package/dist/collect-DAUItMDS.mjs +2 -0
- package/dist/collect-DXHNWHcT.mjs +48 -0
- package/dist/config--T87TD8T.mjs +2 -0
- package/dist/{config-NOG_U1aK.mjs → config-BSe70f4T.mjs} +4 -6
- package/dist/config-DDIFxQYx.mjs +2 -0
- package/dist/{config-uNGuFsI2.mjs → config-Dxr6cTXn.mjs} +22 -37
- package/dist/config-DywxBLQC.d.mts +185 -0
- package/dist/config-entry.d.mts +6 -0
- package/dist/config-entry.mjs +7 -0
- package/dist/config-uP7ZDtVZ.mjs +21 -0
- package/dist/config-write-y3CBI_ux.mjs +60 -0
- package/dist/{connect-WCQZ_u3m.mjs → connect-LnvW4HKx.mjs} +8 -6
- package/dist/{create-project-D0oXA090.mjs → create-project-BZBl_gQ0.mjs} +8 -23
- package/dist/create-project-JV9-6ICF.mjs +2 -0
- package/dist/database-provider-Cx525bwX.mjs +6 -0
- package/dist/database-provider.mjs +1 -5
- package/dist/{db-DJ-9qs3S.mjs → db-Mzv88E1C.mjs} +48 -44
- package/dist/{delete-BZ4-WaGm.mjs → delete-Ri6JemSU.mjs} +6 -4
- package/dist/deploy-DAH2-m_-.mjs +2 -0
- package/dist/{deploy-BAhhcg5q.mjs → deploy-DEsMVrCY.mjs} +796 -198
- package/dist/discover-BBzDZe_o.mjs +2 -0
- package/dist/{discover-xvfrgJeo.mjs → discover-C4O6YxVS.mjs} +3 -8
- package/dist/{dist-BrsS7cai.mjs → dist-4WkAWhWx.mjs} +1 -15
- package/dist/{dist-m40_XgNh.mjs → dist-Bn8Kodjp.mjs} +1 -1
- package/dist/dist-C5fND3R0.mjs +2 -0
- package/dist/dist-D7-nEOXi.mjs +2 -0
- package/dist/{output-B0cfNSx5.mjs → dist-Dn6nn2IU.mjs} +3 -926
- package/dist/{domain-BxAyhxXN.mjs → domain-BA37Ye7T.mjs} +7 -5
- package/dist/{route-types-Da-DpyUp.mjs → drizzle-Beb2Am5S.mjs} +1 -280
- package/dist/{email-Bj7Cvdwp.mjs → email-C5NsxrQG.mjs} +14 -12
- package/dist/{email-Ce6SQq-i.mjs → email-C5kaZXzJ.mjs} +2 -2
- package/dist/{entry-DU3oDoQ3.mjs → entry-DdRFGK0y.mjs} +2 -2
- package/dist/{env-DBKmK4vc.mjs → env-DX_v-Q-v.mjs} +1 -1
- package/dist/{env-DP_EErve.mjs → env-U_ohASB0.mjs} +9 -7
- package/dist/env-Yz4HcvHs.mjs +78 -0
- package/dist/env-helpers--wFmQ_5Q.mjs +136 -0
- package/dist/{env-types-BNPhro-M.mjs → env-types-CWDtqHgw.mjs} +6 -2
- package/dist/{env-validation-CF6KvTRf.mjs → env-validation-BsFEXps5.mjs} +19 -28
- package/dist/env-validation-DIDGM7h4.mjs +2 -0
- package/dist/fetch-CXDChK7B.mjs +18 -0
- package/dist/fetch-_SeGZao9.d.mts +57 -0
- package/dist/fetch-stream-AOByI7Ki.mjs +81 -0
- package/dist/fetch-stream-Bjf0hoZb.d.mts +49 -0
- package/dist/gen-B87rlalt.mjs +2 -0
- package/dist/{gen-B_wPnVTK.mjs → gen-pg-Ojg8Y.mjs} +13 -11
- package/dist/{generate-RTK8_kK1.mjs → generate-C0VY6RVf.mjs} +2 -2
- package/dist/{github-cmd-C-z_xRrQ.mjs → github-cmd-DsrkweIl.mjs} +6 -4
- package/dist/{handler-D1hLsObx.d.mts → handler-BXJTXd02.d.mts} +6 -1
- package/dist/handler-DghKr6dU.mjs +150 -0
- package/dist/head-D_QRR5Yd.mjs +112 -0
- package/dist/head-client-DzmJGN4C.mjs +90 -0
- package/dist/{headers-BAHwgHdW.mjs → headers-B_HBMgi0.mjs} +2 -2
- package/dist/help-B403BLBB.mjs +2 -0
- package/dist/{help-CwOX-zmI.mjs → help-sBhFH6pi.mjs} +17 -12
- package/dist/index.d.mts +2 -20
- package/dist/index.mjs +116 -60
- package/dist/{init-BGktCXgA.mjs → init-C--Yyj1b.mjs} +49 -50
- package/dist/{link-D2kbqhWb.mjs → link-BC-mNG9-.mjs} +7 -5
- package/dist/{list-CvkK_G7k.mjs → list-DHU1Wj6c.mjs} +7 -5
- package/dist/live-CB1y5IuC.mjs +411 -0
- package/dist/live-CKiJilLr.d.mts +105 -0
- package/dist/local-d1-DzykTWY8.mjs +104 -0
- package/dist/login-BwiopVdg.mjs +2 -0
- package/dist/{login-WIjNc77c.mjs → login-jKe_0QZL.mjs} +6 -11
- package/dist/{logs-dLUFCapG.mjs → logs-BG11f5PR.mjs} +6 -4
- package/dist/migrate-BV8qHiCb.mjs +285 -0
- package/dist/migrate-BXY3B3m7.mjs +2 -0
- package/dist/migration-handler-DM4clYj5.d.mts +51 -0
- package/dist/{neon-DHwd2zvC.mjs → neon-n74ta1Pr.mjs} +1 -1
- package/dist/{node-Ez5KW5rn.mjs → node-Cupyf7-s.mjs} +6 -6
- package/dist/{operator-auth-B3e08unv.mjs → operator-auth-BkVgJqv-.mjs} +2 -2
- package/dist/{operator-client-LUZnlnYk.mjs → operator-client-A0iex2yi.mjs} +2 -1
- package/dist/{operator-cmd-CKJ7xIRs.mjs → operator-cmd-BwAS2XZt.mjs} +6 -6
- package/dist/output-CCH48AMM.mjs +146 -0
- package/dist/{package-json-CPoWX79C.mjs → package-json-iCbMg5XF.mjs} +1 -1
- package/dist/pages/client.d.mts +5 -2
- package/dist/pages/client.mjs +5 -3
- package/dist/pages/head-client.mjs +1 -89
- package/dist/pages/head.mjs +1 -111
- package/dist/pages/index.d.mts +2 -3
- package/dist/pages/index.mjs +7 -7
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/prefetch.d.mts +2 -30
- package/dist/pages/prefetch.mjs +1 -89
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +3 -3
- package/dist/pages/serialize.d.mts +2 -9
- package/dist/pages/serialize.mjs +1 -13
- package/dist/plan-BEZ8VJW0.mjs +256 -0
- package/dist/plan-DpuOr14e.mjs +2 -0
- package/dist/{platform-auth-config-CdVWRRJr.mjs → platform-auth-config-C-hv-_Ok.mjs} +6 -6
- package/dist/{platform-auth-protection-Drl0qhrn.mjs → platform-auth-protection-DjTE5Hj-.mjs} +7 -5
- package/dist/{platform-auth-recovery-CmKEWpDo.mjs → platform-auth-recovery-Cr0r8TEb.mjs} +6 -5
- package/dist/{platform-cmd-5q_k56xS.mjs → platform-cmd-0tEh2ZtA.mjs} +8 -5
- package/dist/platform-cmd-DE6dw45v.mjs +2 -0
- package/dist/{platform-domain-4GiDlcqx.mjs → platform-domain-B_7x6Iqx.mjs} +4 -3
- package/dist/platform-lifecycle-Dhx9Pnub.mjs +2 -0
- package/dist/{platform-lifecycle-R9xAxvtG.mjs → platform-lifecycle-Di0LbhPM.mjs} +208 -37
- package/dist/platform-management-B9LUtMt9.mjs +2 -0
- package/dist/{platform-management-BfWsXHEW.mjs → platform-management-eaiaU3uM.mjs} +8 -5
- package/dist/{platform-recovery-CbK-I1FB.mjs → platform-recovery-BxfA8E5C.mjs} +3 -3
- package/dist/platform-registry-BJbgZLS1.mjs +431 -0
- package/dist/{plugin-inference-BDRfZngg.mjs → plugin-inference-DsvtJLll.mjs} +4 -4
- package/dist/prefetch-Bsc_Pb6c.mjs +90 -0
- package/dist/prefetch-Ce6la4EI.d.mts +31 -0
- package/dist/prepare-D4CkM3_v.mjs +2 -0
- package/dist/{prepare-blNRQvQl.mjs → prepare-_T-Haxrr.mjs} +3 -2
- package/dist/{prepare-CtDJjoOj.mjs → prepare-pcWcxSCh.mjs} +13 -11
- package/dist/prerender-render-Cf_WDE9W.mjs +111 -0
- package/dist/prerender-render.mjs +1 -110
- package/dist/{preset-lAy0B0BQ.mjs → preset-Dowh9tTt.mjs} +16 -118
- package/dist/project-BEBFDFLz.mjs +2 -0
- package/dist/project-CWNIPoXc.mjs +209 -0
- package/dist/{project-cmd-CTdmnzvc.mjs → project-cmd-DrnRJdep.mjs} +18 -16
- package/dist/{project-paths-SK8nMHPp.mjs → project-paths-CKQ-Q5JS.mjs} +47 -14
- package/dist/project-slug-23TpquG4.mjs +8 -0
- package/dist/project-slug-DofjTFd-.mjs +2 -0
- package/dist/{project-team-CGxsQe3_.mjs → project-team-CzRbO_kA.mjs} +6 -4
- package/dist/{project-token-Cirx7uwZ.mjs → project-token-Bwxjf4y6.mjs} +6 -4
- package/dist/{project-tsconfig-Ql2XsSQp.mjs → project-tsconfig-CwfqUnVp.mjs} +2 -2
- package/dist/{protocol-C-pqYJjE.d.mts → protocol-ZH3jP4a7.d.mts} +1 -1
- package/dist/providers-BNKRacMr.d.mts +7 -0
- package/dist/provision-CNgEBkVA.mjs +3 -0
- package/dist/{provision-CSJOjjQk.mjs → provision-Cck2m3jJ.mjs} +11 -25
- package/dist/queues-BWKt1Xo4.d.mts +7 -0
- package/dist/{requests-4Nq59hOr.mjs → requests-DwrqUQZ8.mjs} +5 -3
- package/dist/resolve-project-BTotl8Nn.mjs +2 -0
- package/dist/{resolve-project--Vxawf7z.mjs → resolve-project-Xvis70DG.mjs} +2 -8
- package/dist/response-Tn7rU0MV.mjs +30 -0
- package/dist/{rollback-Dr7u0Ljx.mjs → rollback-B4tFWmkN.mjs} +6 -4
- package/dist/{rolldown-runtime-rQ84J-ij.mjs → rolldown-runtime-DXIUcv95.mjs} +1 -10
- package/dist/route-types-Id82-veQ.mjs +280 -0
- package/dist/{local-d1-D2I6Ox5F.mjs → runner-BGVsGgkb.mjs} +6 -114
- package/dist/runner-CQs_cDSG.mjs +2 -0
- package/dist/runner-mysql-1o47achK.mjs +2 -0
- package/dist/{runner-mysql-7BPUNGmL.mjs → runner-mysql-BhwMk2Bm.mjs} +2 -9
- package/dist/{runner-pg-BkEza-dX.mjs → runner-pg-CJ_JeGF6.mjs} +2 -9
- package/dist/runner-pg-D7z01mQS.mjs +2 -0
- package/dist/runtime/ai.mjs +1 -1
- package/dist/runtime/auth-client-react.d.mts +2 -6
- package/dist/runtime/auth-client-react.mjs +1 -5
- package/dist/runtime/auth-client-solid.d.mts +2 -6
- package/dist/runtime/auth-client-solid.mjs +1 -5
- package/dist/runtime/auth-client-svelte.d.mts +2 -6
- package/dist/runtime/auth-client-svelte.mjs +1 -5
- package/dist/runtime/auth-client-vue.d.mts +2 -6
- package/dist/runtime/auth-client-vue.mjs +1 -5
- package/dist/runtime/auth-client.d.mts +2 -6
- package/dist/runtime/auth-client.mjs +1 -5
- package/dist/runtime/auth.mjs +1 -21
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.d.mts +3 -3
- package/dist/runtime/client-react.mjs +3 -3
- package/dist/runtime/client-solid.d.mts +3 -3
- package/dist/runtime/client-solid.mjs +3 -3
- package/dist/runtime/client-svelte.d.mts +3 -3
- package/dist/runtime/client-svelte.mjs +3 -3
- package/dist/runtime/client-vue.d.mts +3 -3
- package/dist/runtime/client-vue.mjs +3 -3
- package/dist/runtime/client.d.mts +3 -3
- package/dist/runtime/client.mjs +3 -3
- package/dist/runtime/db.mjs +1 -1
- package/dist/runtime/durable.mjs +1 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-helpers.mjs +1 -135
- package/dist/runtime/env-public-client.mjs +1 -1
- package/dist/runtime/env-public.mjs +2 -2
- package/dist/runtime/env.mjs +1 -77
- package/dist/runtime/fetch-stream.d.mts +2 -49
- package/dist/runtime/fetch-stream.mjs +2 -80
- package/dist/runtime/fetch.d.mts +2 -57
- package/dist/runtime/fetch.mjs +2 -17
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -149
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +2 -2
- package/dist/runtime/live.d.mts +2 -104
- package/dist/runtime/live.mjs +1 -410
- package/dist/runtime/migration-handler-mysql.d.mts +1 -1
- package/dist/runtime/migration-handler-pg.d.mts +1 -1
- package/dist/runtime/migration-handler.d.mts +2 -50
- package/dist/runtime/queues.d.mts +2 -6
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/response.mjs +1 -29
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/sse.mjs +1 -171
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/validator.mjs +1 -71
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws-server.mjs +2 -2
- package/dist/runtime/ws.d.mts +2 -121
- package/dist/{scan-CpK-57ug.mjs → scan-DJbooZm2.mjs} +3 -3
- package/dist/{scan-BMH4rzlv.mjs → scan-DdDvRCU1.mjs} +8 -26
- package/dist/{secret-AcPi-FoA.mjs → secret-UtrRjhEO.mjs} +8 -6
- package/dist/serialize-BPvnNQuA.mjs +14 -0
- package/dist/serialize-CfSwWfF2.d.mts +10 -0
- package/dist/{skills-C0RvGjeE.mjs → skills-B-690E7h.mjs} +3 -2
- package/dist/sse-BaC1jXko.mjs +172 -0
- package/dist/{subcommand-prompt-Bmyn5Rlc.mjs → subcommand-prompt-BuGYkAkC.mjs} +2 -1
- package/dist/sveltekit.d.mts +2 -1
- package/dist/sveltekit.mjs +3 -2
- package/dist/validate-DqJ33oHj.mjs +2 -0
- package/dist/validate-qNhV00PD.mjs +180 -0
- package/dist/validator-BTOu0fB0.mjs +72 -0
- package/dist/{wrangler--imS8n0d.mjs → wrangler-D01qs6VB.mjs} +259 -71
- package/dist/ws-BwcqizuH.d.mts +122 -0
- package/dist/{yarn-pnp-DxSInkzL.mjs → yarn-pnp-CVEc3gE7.mjs} +1 -1
- package/package.json +19 -8
- package/skills/void/SKILL.md +6 -4
- package/skills/void/docs/guide/ai.md +3 -3
- package/skills/void/docs/guide/app-types.md +12 -11
- package/skills/void/docs/guide/auth.md +2 -2
- package/skills/void/docs/guide/database/d1.md +1 -1
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +3 -3
- package/skills/void/docs/guide/deployment.md +8 -15
- package/skills/void/docs/guide/durable-state.md +2 -2
- package/skills/void/docs/guide/edge/headers.md +3 -3
- package/skills/void/docs/guide/edge/prerendering.md +1 -1
- package/skills/void/docs/guide/edge/redirects.md +4 -4
- package/skills/void/docs/guide/edge/revalidation.md +6 -6
- package/skills/void/docs/guide/edge/rewrites.md +28 -27
- package/skills/void/docs/guide/edge/static-assets.md +1 -1
- package/skills/void/docs/guide/email.md +60 -66
- package/skills/void/docs/guide/env-migration.md +1 -1
- package/skills/void/docs/guide/index.md +15 -41
- package/skills/void/docs/guide/pages-routing/head.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +13 -5
- package/skills/void/docs/guide/platform/administration/projects.md +3 -1
- package/skills/void/docs/guide/platform/installation/ci.md +3 -0
- package/skills/void/docs/guide/platform/installation/credentials.md +15 -5
- package/skills/void/docs/guide/platform/installation/prerequisites.md +2 -0
- package/skills/void/docs/guide/platform/installation/setup.md +1 -1
- package/skills/void/docs/guide/quickstart.md +11 -78
- package/skills/void/docs/guide/remote-dev.md +2 -2
- package/skills/void/docs/guide/sandboxes.md +1 -1
- package/skills/void/docs/guide/ssg.md +1 -1
- package/skills/void/docs/guide/websockets.md +1 -1
- package/skills/void/docs/index.md +17 -17
- package/skills/void/docs/integrations/cloudflare.md +91 -96
- package/skills/void/docs/integrations/frameworks/analog.md +14 -9
- package/skills/void/docs/integrations/frameworks/astro.md +14 -10
- package/skills/void/docs/integrations/frameworks/nuxt.md +14 -9
- package/skills/void/docs/integrations/frameworks/overview.md +35 -29
- package/skills/void/docs/integrations/frameworks/react-router.md +1 -1
- package/skills/void/docs/integrations/frameworks/sveltekit.md +33 -30
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +1 -1
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -5
- package/skills/void/docs/reference/api.md +21 -4
- package/skills/void/docs/reference/cli.md +40 -25
- package/skills/void/docs/reference/config.md +58 -35
- package/skills/void/docs/reference/structure.md +2 -2
- package/dist/validate-tBBN_dXH.mjs +0 -505
|
@@ -1,9 +1,185 @@
|
|
|
1
|
-
import { a as isAbsolute, n as dirname, o as
|
|
1
|
+
import { a as join, i as isAbsolute, n as dirname, o as normalize, t as basename } from "./dist-4WkAWhWx.mjs";
|
|
2
|
+
import "./project-paths-CKQ-Q5JS.mjs";
|
|
3
|
+
import { m as readConfig } from "./config-Dxr6cTXn.mjs";
|
|
2
4
|
import { createRequire } from "node:module";
|
|
3
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4
6
|
import { appendSqliteClassMigration } from "@void/deploy-core";
|
|
5
|
-
import { createHash } from "node:crypto";
|
|
7
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
6
8
|
import { SyntaxKind, applyEdits, createScanner, findNodeAtLocation, modify, parse, parseTree } from "jsonc-parser";
|
|
9
|
+
import { isDeepStrictEqual } from "node:util";
|
|
10
|
+
//#region src/cloudflare-config.ts
|
|
11
|
+
const MATERIALIZED_CLOUDFLARE_FILE = ".void-wrangler.jsonc";
|
|
12
|
+
const VOID_LOCK_FILE = "void.lock.json";
|
|
13
|
+
const PREVIEW_POINTER_FILE = "preview-deploy-config.json";
|
|
14
|
+
function isObject(value) {
|
|
15
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
function arrayIdentity(value) {
|
|
18
|
+
if (isObject(value)) {
|
|
19
|
+
for (const key of [
|
|
20
|
+
"binding",
|
|
21
|
+
"name",
|
|
22
|
+
"tag",
|
|
23
|
+
"class_name",
|
|
24
|
+
"pattern",
|
|
25
|
+
"route"
|
|
26
|
+
]) if (typeof value[key] === "string") return `${key}:${value[key]}`;
|
|
27
|
+
}
|
|
28
|
+
return JSON.stringify(value) ?? String(value);
|
|
29
|
+
}
|
|
30
|
+
/** Keep authored values authoritative while retaining fields produced by Void. */
|
|
31
|
+
function mergeConfig(previous, resolved, authored) {
|
|
32
|
+
if (isDeepStrictEqual(previous, authored)) return resolved;
|
|
33
|
+
if (Array.isArray(previous) && Array.isArray(resolved) && Array.isArray(authored)) {
|
|
34
|
+
const previousByIdentity = new Map(previous.map((item) => [arrayIdentity(item), item]));
|
|
35
|
+
const resolvedByIdentity = new Map(resolved.map((item) => [arrayIdentity(item), item]));
|
|
36
|
+
const authoredIdentities = new Set(authored.map(arrayIdentity));
|
|
37
|
+
return [...authored.map((item) => {
|
|
38
|
+
const identity = arrayIdentity(item);
|
|
39
|
+
return previousByIdentity.has(identity) && resolvedByIdentity.has(identity) ? mergeConfig(previousByIdentity.get(identity), resolvedByIdentity.get(identity), item) : item;
|
|
40
|
+
}), ...resolved.filter((item) => {
|
|
41
|
+
const identity = arrayIdentity(item);
|
|
42
|
+
return !previousByIdentity.has(identity) && !authoredIdentities.has(identity);
|
|
43
|
+
})];
|
|
44
|
+
}
|
|
45
|
+
if (isObject(previous) && isObject(resolved) && isObject(authored)) {
|
|
46
|
+
const result = {};
|
|
47
|
+
for (const key of /* @__PURE__ */ new Set([
|
|
48
|
+
...Object.keys(previous),
|
|
49
|
+
...Object.keys(resolved),
|
|
50
|
+
...Object.keys(authored)
|
|
51
|
+
])) {
|
|
52
|
+
if (!(key in authored)) {
|
|
53
|
+
if (!(key in previous) && key in resolved) Object.defineProperty(result, key, {
|
|
54
|
+
value: resolved[key],
|
|
55
|
+
enumerable: true,
|
|
56
|
+
writable: true,
|
|
57
|
+
configurable: true
|
|
58
|
+
});
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const value = mergeConfig(previous[key], resolved[key], authored[key]);
|
|
62
|
+
Object.defineProperty(result, key, {
|
|
63
|
+
value,
|
|
64
|
+
enumerable: true,
|
|
65
|
+
writable: true,
|
|
66
|
+
configurable: true
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
return authored;
|
|
72
|
+
}
|
|
73
|
+
function parseCloudflareText(text, path) {
|
|
74
|
+
const errors = [];
|
|
75
|
+
const value = parse(text.replace(/^\uFEFF/, ""), errors, { allowTrailingComma: true });
|
|
76
|
+
if (errors.length > 0 || !isObject(value)) throw new Error(`config: ${path} must contain a valid JSON/JSONC object.`);
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
function readState(root) {
|
|
80
|
+
const path = join(root, VOID_LOCK_FILE);
|
|
81
|
+
if (!existsSync(path)) return;
|
|
82
|
+
let value;
|
|
83
|
+
try {
|
|
84
|
+
value = JSON.parse(readFileSync(path, "utf8"));
|
|
85
|
+
} catch {
|
|
86
|
+
throw new Error(`config: Invalid ${VOID_LOCK_FILE}. Fix or restore it before continuing.`);
|
|
87
|
+
}
|
|
88
|
+
if (!isObject(value) || value.version !== 1 || !isObject(value.source) || !isObject(value.resolved) || typeof value.text !== "string") throw new Error(`config: Invalid ${VOID_LOCK_FILE}. Fix or restore it before continuing.`);
|
|
89
|
+
const state = value;
|
|
90
|
+
if (!isDeepStrictEqual(parseCloudflareText(state.text, "void.lock.json"), state.resolved)) state.text = `${provenance(state.text)}${JSON.stringify(state.resolved, null, 2)}\n`;
|
|
91
|
+
return state;
|
|
92
|
+
}
|
|
93
|
+
function writeAtomic(path, content) {
|
|
94
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
95
|
+
writeFileSync(temporary, content, { flag: "wx" });
|
|
96
|
+
try {
|
|
97
|
+
renameSync(temporary, path);
|
|
98
|
+
} finally {
|
|
99
|
+
rmSync(temporary, { force: true });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function writeState(root, state) {
|
|
103
|
+
const path = join(root, VOID_LOCK_FILE);
|
|
104
|
+
const content = `${JSON.stringify(state, null, 2)}\n`;
|
|
105
|
+
if (existsSync(path)) try {
|
|
106
|
+
if (isDeepStrictEqual(JSON.parse(readFileSync(path, "utf8")), state)) return;
|
|
107
|
+
} catch {}
|
|
108
|
+
writeAtomic(path, content);
|
|
109
|
+
}
|
|
110
|
+
/** Keep Vite preview usable without leaving Wrangler's implicit deploy pointer after a build. */
|
|
111
|
+
function stashCloudflareDeployPointer(root) {
|
|
112
|
+
const pointer = join(root, ".wrangler", "deploy", "config.json");
|
|
113
|
+
if (!existsSync(pointer)) return;
|
|
114
|
+
const directory = join(root, ".void");
|
|
115
|
+
mkdirSync(directory, { recursive: true });
|
|
116
|
+
writeAtomic(join(directory, PREVIEW_POINTER_FILE), readFileSync(pointer, "utf8"));
|
|
117
|
+
rmSync(pointer, { force: true });
|
|
118
|
+
}
|
|
119
|
+
function restoreCloudflarePreviewPointer(root) {
|
|
120
|
+
const saved = join(root, ".void", PREVIEW_POINTER_FILE);
|
|
121
|
+
if (!existsSync(saved)) return false;
|
|
122
|
+
const directory = join(root, ".wrangler", "deploy");
|
|
123
|
+
mkdirSync(directory, { recursive: true });
|
|
124
|
+
writeAtomic(join(directory, "config.json"), readFileSync(saved, "utf8"));
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
/** Preserve Void's JSONC provenance comments when authored settings change. */
|
|
128
|
+
function provenance(text) {
|
|
129
|
+
const lines = text.match(/^\s*\/\/ void:(?:managed-queues|published-traffic):v1:[A-Za-z0-9_-]+\s*$/gm);
|
|
130
|
+
return lines ? `${lines.join("\n")}\n` : "";
|
|
131
|
+
}
|
|
132
|
+
/** Resolve the config file passed to Cloudflare tooling. Typed projects use a generated file. */
|
|
133
|
+
function materializeCloudflareConfig(root) {
|
|
134
|
+
if (!existsSync(join(root, "void.config.ts"))) {
|
|
135
|
+
for (const name of ["wrangler.jsonc", "wrangler.json"]) if (existsSync(join(root, name))) return join(root, name);
|
|
136
|
+
return join(root, "wrangler.jsonc");
|
|
137
|
+
}
|
|
138
|
+
if (["wrangler.jsonc", "wrangler.json"].some((name) => existsSync(join(root, name)))) throw new Error("config: Run `void migrate` to move the root Wrangler config into void.config.ts.");
|
|
139
|
+
const authored = readConfig(root).cloudflare ?? {};
|
|
140
|
+
const state = readState(root);
|
|
141
|
+
const resolved = state ? mergeConfig(state.source, state.resolved, authored) : authored;
|
|
142
|
+
const text = state && isDeepStrictEqual(resolved, state.resolved) && isDeepStrictEqual(authored, state.source) ? state.text : `${provenance(state?.text ?? "")}${JSON.stringify(resolved, null, 2)}\n`;
|
|
143
|
+
const path = join(root, MATERIALIZED_CLOUDFLARE_FILE);
|
|
144
|
+
if (!existsSync(path) || readFileSync(path, "utf8") !== text) writeAtomic(path, text);
|
|
145
|
+
if (state) writeState(root, {
|
|
146
|
+
version: 1,
|
|
147
|
+
source: authored,
|
|
148
|
+
resolved,
|
|
149
|
+
text
|
|
150
|
+
});
|
|
151
|
+
return path;
|
|
152
|
+
}
|
|
153
|
+
/** Record Cloudflare settings written by Void so later builds reproduce them. */
|
|
154
|
+
function persistCloudflareConfig(root) {
|
|
155
|
+
if (!existsSync(join(root, "void.config.ts"))) return;
|
|
156
|
+
const path = join(root, MATERIALIZED_CLOUDFLARE_FILE);
|
|
157
|
+
if (!existsSync(path)) throw new Error(`config: Missing generated ${MATERIALIZED_CLOUDFLARE_FILE}.`);
|
|
158
|
+
const text = readFileSync(path, "utf8");
|
|
159
|
+
const resolved = parseCloudflareText(text, path);
|
|
160
|
+
const authored = readConfig(root).cloudflare ?? {};
|
|
161
|
+
if (readState(root) || !isDeepStrictEqual(resolved, authored) || text !== `${JSON.stringify(authored, null, 2)}\n`) writeState(root, {
|
|
162
|
+
version: 1,
|
|
163
|
+
source: authored,
|
|
164
|
+
resolved,
|
|
165
|
+
text
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/** Seed the checked-in lock from a root Wrangler file during migration. */
|
|
169
|
+
function seedCloudflareConfig(root, source, text) {
|
|
170
|
+
const existing = readState(root);
|
|
171
|
+
if (existing) {
|
|
172
|
+
if (isDeepStrictEqual(existing.source, source) && isDeepStrictEqual(existing.resolved, source)) return;
|
|
173
|
+
throw new Error(`migrate: ${VOID_LOCK_FILE} already exists with different settings. Resolve it before migrating.`);
|
|
174
|
+
}
|
|
175
|
+
if (!isDeepStrictEqual(parseCloudflareText(text, ".void-wrangler.jsonc"), source)) throw new Error("migrate: The Cloudflare config changed during migration. Retry.");
|
|
176
|
+
writeState(root, {
|
|
177
|
+
version: 1,
|
|
178
|
+
source,
|
|
179
|
+
resolved: source,
|
|
180
|
+
text
|
|
181
|
+
});
|
|
182
|
+
}
|
|
7
183
|
const SANDBOX_MIGRATION_TAG = "void-sandbox-v1";
|
|
8
184
|
const require = createRequire(import.meta.url);
|
|
9
185
|
function isSandboxEnabled(config) {
|
|
@@ -54,6 +230,14 @@ const UTF8_BOM = "";
|
|
|
54
230
|
const NODEJS_ALS_FLAG = "nodejs_als";
|
|
55
231
|
const NODEJS_COMPAT_FLAG = "nodejs_compat";
|
|
56
232
|
const VOID_CONFIG_FILE = "void.json";
|
|
233
|
+
function projectWranglerPaths(root) {
|
|
234
|
+
if (existsSync(join(root, "void.config.ts"))) return [materializeCloudflareConfig(root)];
|
|
235
|
+
return ["wrangler.jsonc", "wrangler.json"].map((name) => join(root, name));
|
|
236
|
+
}
|
|
237
|
+
function writeProjectWranglerFile(configPath, text) {
|
|
238
|
+
writeFileSync(configPath, text);
|
|
239
|
+
if (basename(configPath) === ".void-wrangler.jsonc") persistCloudflareConfig(dirname(configPath));
|
|
240
|
+
}
|
|
57
241
|
const MANAGED_QUEUES_MARKER = /^\s*\/\/ void:managed-queues:v1:([A-Za-z0-9_-]+)\s*$/m;
|
|
58
242
|
const PUBLISHED_TRAFFIC_MARKER = /^\s*\/\/ void:published-traffic:v1:([A-Za-z0-9_-]+)\s*$/m;
|
|
59
243
|
const DEFAULT_LIVE_BINDING = "VOID_LIVE";
|
|
@@ -61,8 +245,7 @@ const DEFAULT_LIVE_CLASS = "VoidLiveStreamDurableObject";
|
|
|
61
245
|
const LIVE_MIGRATION_TAG = "live-v1";
|
|
62
246
|
/** Read the root Wrangler config with the same JSONC parser used by binding sync. */
|
|
63
247
|
function readRootWranglerConfig(root) {
|
|
64
|
-
for (const
|
|
65
|
-
const configPath = join(root, name);
|
|
248
|
+
for (const configPath of projectWranglerPaths(root)) {
|
|
66
249
|
if (!existsSync(configPath)) continue;
|
|
67
250
|
const parsed = parseJsonc(readFileSync(configPath, "utf-8"));
|
|
68
251
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new SyntaxError(`Failed to parse ${configPath}: expected a JSON object.`);
|
|
@@ -97,7 +280,7 @@ function writeWranglerPublishedTrafficSnapshot(configPath, snapshot, options) {
|
|
|
97
280
|
const existing = PUBLISHED_TRAFFIC_MARKER.exec(raw);
|
|
98
281
|
if (!existing && options?.create === false) return;
|
|
99
282
|
const next = existing ? raw.slice(0, existing.index) + marker + raw.slice(existing.index + existing[0].length) : `${marker}${raw.includes("\r\n") ? "\r\n" : "\n"}${raw}`;
|
|
100
|
-
if (next !== raw)
|
|
283
|
+
if (next !== raw) writeProjectWranglerFile(configPath, next);
|
|
101
284
|
}
|
|
102
285
|
/** Latest compatibility date the Void test suite is pinned against. */
|
|
103
286
|
const LATEST_KNOWN_COMPAT_DATE = "2026-02-24";
|
|
@@ -139,8 +322,8 @@ function readExistingLiveBindingConfig(root) {
|
|
|
139
322
|
} : void 0;
|
|
140
323
|
}
|
|
141
324
|
function readWranglerDurableObjectBindings(root) {
|
|
142
|
-
for (const
|
|
143
|
-
const bindings = parseJsonc(readFileSync(
|
|
325
|
+
for (const path of projectWranglerPaths(root)) try {
|
|
326
|
+
const bindings = parseJsonc(readFileSync(path, "utf-8")).durable_objects?.bindings;
|
|
144
327
|
if (!Array.isArray(bindings)) return [];
|
|
145
328
|
return bindings.filter((binding) => typeof binding.name === "string" && typeof binding.class_name === "string");
|
|
146
329
|
} catch {}
|
|
@@ -195,8 +378,8 @@ function ensureWranglerCompat(root, config, buildOutputDir) {
|
|
|
195
378
|
function readWranglerCompatFields(root, config, buildOutputDir) {
|
|
196
379
|
const voidConfig = config ?? readVoidConfigIfExists(root);
|
|
197
380
|
let raw;
|
|
198
|
-
for (const
|
|
199
|
-
raw = readFileSync(
|
|
381
|
+
for (const path of projectWranglerPaths(root)) try {
|
|
382
|
+
raw = readFileSync(path, "utf-8");
|
|
200
383
|
break;
|
|
201
384
|
} catch {}
|
|
202
385
|
let wranglerDate;
|
|
@@ -243,18 +426,13 @@ function validateCompatDate(value, source) {
|
|
|
243
426
|
if (!COMPAT_DATE_RE.test(value)) throw new Error(`config: "compatibility_date" in ${source} must use YYYY-MM-DD format, got '${value}'.`);
|
|
244
427
|
}
|
|
245
428
|
function readVoidConfigIfExists(root) {
|
|
246
|
-
|
|
247
|
-
if (!existsSync(filePath)) return;
|
|
248
|
-
try {
|
|
249
|
-
const parsed = JSON.parse(readFileSync(filePath, "utf-8"));
|
|
250
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new Error(`config: ${VOID_CONFIG_FILE} must be a JSON object.`);
|
|
251
|
-
return parsed;
|
|
252
|
-
} catch (error) {
|
|
253
|
-
if (error instanceof SyntaxError) throw new Error(`config: Invalid JSON in ${VOID_CONFIG_FILE}.`);
|
|
254
|
-
throw error;
|
|
255
|
-
}
|
|
429
|
+
return existsSync(join(root, VOID_CONFIG_FILE)) || existsSync(join(root, "void.config.ts")) ? readConfig(root) : void 0;
|
|
256
430
|
}
|
|
257
431
|
function ensureVoidCompatibilityDate(root, config) {
|
|
432
|
+
if (existsSync(join(root, "void.config.ts"))) {
|
|
433
|
+
writeProvisionedWranglerConfig(root, { compatibilityDate: LATEST_KNOWN_COMPAT_DATE });
|
|
434
|
+
return LATEST_KNOWN_COMPAT_DATE;
|
|
435
|
+
}
|
|
258
436
|
const filePath = join(root, VOID_CONFIG_FILE);
|
|
259
437
|
let nextConfig = {};
|
|
260
438
|
if (existsSync(filePath)) try {
|
|
@@ -282,18 +460,15 @@ function syncWranglerBindings(root, bindings, options) {
|
|
|
282
460
|
let configPath;
|
|
283
461
|
let parsed;
|
|
284
462
|
let created = false;
|
|
285
|
-
for (const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
} catch {}
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
463
|
+
for (const p of projectWranglerPaths(root)) if (existsSync(p)) {
|
|
464
|
+
configPath = p;
|
|
465
|
+
try {
|
|
466
|
+
parsed = parseJsonc(readFileSync(p, "utf-8"));
|
|
467
|
+
} catch {}
|
|
468
|
+
break;
|
|
294
469
|
}
|
|
295
470
|
if (!configPath || !parsed) {
|
|
296
|
-
configPath =
|
|
471
|
+
configPath = materializeCloudflareConfig(root);
|
|
297
472
|
parsed = {};
|
|
298
473
|
created = true;
|
|
299
474
|
}
|
|
@@ -332,6 +507,31 @@ function syncWranglerBindings(root, bindings, options) {
|
|
|
332
507
|
modified = true;
|
|
333
508
|
}
|
|
334
509
|
}
|
|
510
|
+
if (bindings.needsAI && options?.directCloudflareAi) {
|
|
511
|
+
const existing = parsed.ai;
|
|
512
|
+
const binding = typeof existing?.binding === "string" ? existing.binding : options.bindingNames?.ai ?? "AI";
|
|
513
|
+
const nextAi = {
|
|
514
|
+
...existing ?? {},
|
|
515
|
+
binding,
|
|
516
|
+
remote: true
|
|
517
|
+
};
|
|
518
|
+
if (JSON.stringify(existing) !== JSON.stringify(nextAi)) {
|
|
519
|
+
parsed.ai = nextAi;
|
|
520
|
+
modified = true;
|
|
521
|
+
}
|
|
522
|
+
if (binding !== "AI" || options.directCloudflareAi.gateway) {
|
|
523
|
+
const vars = parsed.vars ?? {};
|
|
524
|
+
const nextVars = {
|
|
525
|
+
...vars,
|
|
526
|
+
...binding !== "AI" ? { __VOID_AI_BINDING: binding } : {},
|
|
527
|
+
...options.directCloudflareAi.gateway ? { __VOID_AI_GATEWAY: options.directCloudflareAi.gateway } : {}
|
|
528
|
+
};
|
|
529
|
+
if (JSON.stringify(vars) !== JSON.stringify(nextVars)) {
|
|
530
|
+
parsed.vars = nextVars;
|
|
531
|
+
modified = true;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
335
535
|
if (options?.websockets) {
|
|
336
536
|
const existing = parsed.durable_objects?.bindings ?? [];
|
|
337
537
|
const migrations = Array.isArray(parsed.migrations) ? parsed.migrations : [];
|
|
@@ -441,7 +641,7 @@ function syncWranglerBindings(root, bindings, options) {
|
|
|
441
641
|
modified = true;
|
|
442
642
|
}
|
|
443
643
|
}
|
|
444
|
-
if (created || modified)
|
|
644
|
+
if (created || modified) writeProjectWranglerFile(configPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
445
645
|
return created || modified;
|
|
446
646
|
}
|
|
447
647
|
const NO_INFERRED_BINDINGS = {
|
|
@@ -461,7 +661,7 @@ function syncWranglerDurableObjects(root, durableObjects) {
|
|
|
461
661
|
}
|
|
462
662
|
/** Persist WebSocket Durable Object bindings and SQLite migration history. */
|
|
463
663
|
function syncWranglerWebSockets(root, websockets) {
|
|
464
|
-
if (websockets.length === 0 && !
|
|
664
|
+
if (websockets.length === 0 && !projectWranglerPaths(root).some((path) => existsSync(path))) return false;
|
|
465
665
|
return writeProvisionedWranglerConfig(root, { webSockets: websockets }).modified;
|
|
466
666
|
}
|
|
467
667
|
/**
|
|
@@ -471,7 +671,7 @@ function syncWranglerWebSockets(root, websockets) {
|
|
|
471
671
|
* requiring provenance from Void's WebSocket migration tag.
|
|
472
672
|
*/
|
|
473
673
|
function readWranglerWebSocketTombstones(root, websockets) {
|
|
474
|
-
const configPath =
|
|
674
|
+
const configPath = projectWranglerPaths(root).find((path) => existsSync(path));
|
|
475
675
|
if (!configPath) return [];
|
|
476
676
|
const parsed = parseJsonc(readFileSync(configPath, "utf-8"));
|
|
477
677
|
const migrations = Array.isArray(parsed.migrations) ? parsed.migrations : [];
|
|
@@ -489,23 +689,20 @@ function ensureWranglerCompatibilityDate(root, compatibilityDate) {
|
|
|
489
689
|
validateCompatDate(compatibilityDate, "void.json worker config");
|
|
490
690
|
let configPath;
|
|
491
691
|
let parsed;
|
|
492
|
-
for (const
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
} catch {}
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
692
|
+
for (const p of projectWranglerPaths(root)) if (existsSync(p)) {
|
|
693
|
+
configPath = p;
|
|
694
|
+
try {
|
|
695
|
+
parsed = parseJsonc(readFileSync(p, "utf-8"));
|
|
696
|
+
} catch {}
|
|
697
|
+
break;
|
|
501
698
|
}
|
|
502
699
|
if (!configPath || !parsed) {
|
|
503
|
-
configPath =
|
|
700
|
+
configPath = materializeCloudflareConfig(root);
|
|
504
701
|
parsed = {};
|
|
505
702
|
}
|
|
506
703
|
if (parsed.compatibility_date === compatibilityDate) return false;
|
|
507
704
|
parsed.compatibility_date = compatibilityDate;
|
|
508
|
-
|
|
705
|
+
writeProjectWranglerFile(configPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
509
706
|
return true;
|
|
510
707
|
}
|
|
511
708
|
/**
|
|
@@ -515,24 +712,21 @@ function ensureWranglerCompatibilityDate(root, compatibilityDate) {
|
|
|
515
712
|
function ensureWranglerNodejsAlsFlag(root) {
|
|
516
713
|
let configPath;
|
|
517
714
|
let parsed;
|
|
518
|
-
for (const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
} catch {}
|
|
525
|
-
break;
|
|
526
|
-
}
|
|
715
|
+
for (const p of projectWranglerPaths(root)) if (existsSync(p)) {
|
|
716
|
+
configPath = p;
|
|
717
|
+
try {
|
|
718
|
+
parsed = parseJsonc(readFileSync(p, "utf-8"));
|
|
719
|
+
} catch {}
|
|
720
|
+
break;
|
|
527
721
|
}
|
|
528
722
|
if (!configPath || !parsed) {
|
|
529
|
-
configPath =
|
|
723
|
+
configPath = materializeCloudflareConfig(root);
|
|
530
724
|
parsed = {};
|
|
531
725
|
}
|
|
532
726
|
const compatibilityFlags = Array.isArray(parsed.compatibility_flags) ? parsed.compatibility_flags : [];
|
|
533
727
|
if (compatibilityFlags.includes(NODEJS_ALS_FLAG)) return false;
|
|
534
728
|
parsed.compatibility_flags = [...compatibilityFlags, NODEJS_ALS_FLAG];
|
|
535
|
-
|
|
729
|
+
writeProjectWranglerFile(configPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
536
730
|
return true;
|
|
537
731
|
}
|
|
538
732
|
function readManagedQueueProvenance(text) {
|
|
@@ -606,7 +800,7 @@ function acknowledgeWranglerManagedQueueRemovals(configPath, removedQueues) {
|
|
|
606
800
|
pendingConsumerRemovals: provenance.pendingConsumerRemovals.filter((queue) => !removed.has(queue))
|
|
607
801
|
});
|
|
608
802
|
const finalText = hasBom ? `${UTF8_BOM}${updated}` : updated;
|
|
609
|
-
if (finalText !== raw)
|
|
803
|
+
if (finalText !== raw) writeProjectWranglerFile(configPath, finalText);
|
|
610
804
|
}
|
|
611
805
|
/**
|
|
612
806
|
* Fill root Wrangler config fields required by generated/provisioned resources, including
|
|
@@ -621,14 +815,11 @@ function acknowledgeWranglerManagedQueueRemovals(configPath, removedQueues) {
|
|
|
621
815
|
function writeProvisionedWranglerConfig(root, patch, options) {
|
|
622
816
|
let configPath = options?.configPath;
|
|
623
817
|
if (configPath === void 0) {
|
|
624
|
-
for (const
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
configPath = p;
|
|
628
|
-
break;
|
|
629
|
-
}
|
|
818
|
+
for (const p of projectWranglerPaths(root)) if (existsSync(p)) {
|
|
819
|
+
configPath = p;
|
|
820
|
+
break;
|
|
630
821
|
}
|
|
631
|
-
configPath ??=
|
|
822
|
+
configPath ??= materializeCloudflareConfig(root);
|
|
632
823
|
}
|
|
633
824
|
const rawContent = existsSync(configPath) ? readFileSync(configPath, "utf-8") : "{}";
|
|
634
825
|
const hasBom = rawContent.startsWith(UTF8_BOM);
|
|
@@ -916,7 +1107,7 @@ function writeProvisionedWranglerConfig(root, patch, options) {
|
|
|
916
1107
|
}
|
|
917
1108
|
const finalText = hasBom ? `${UTF8_BOM}${text}` : text;
|
|
918
1109
|
const modified = finalText !== rawContent;
|
|
919
|
-
if (modified)
|
|
1110
|
+
if (modified) writeProjectWranglerFile(configPath, finalText);
|
|
920
1111
|
return {
|
|
921
1112
|
configPath,
|
|
922
1113
|
modified,
|
|
@@ -982,7 +1173,7 @@ function updateWranglerCustomDomain(root, hostname, action) {
|
|
|
982
1173
|
} else if (action === "delete" && matches.length === 1) text = applyEdits(text, modify(text, ["routes", matches[0]], void 0, { formattingOptions }));
|
|
983
1174
|
const finalText = hasBom ? `${UTF8_BOM}${text}` : text;
|
|
984
1175
|
const modified = finalText !== raw;
|
|
985
|
-
if (modified)
|
|
1176
|
+
if (modified) writeProjectWranglerFile(configPath, finalText);
|
|
986
1177
|
return {
|
|
987
1178
|
configPath,
|
|
988
1179
|
domains: parseCustomDomains(parseJsonc(text).routes, configPath),
|
|
@@ -990,11 +1181,8 @@ function updateWranglerCustomDomain(root, hostname, action) {
|
|
|
990
1181
|
};
|
|
991
1182
|
}
|
|
992
1183
|
function discoverWranglerConfigPath(root) {
|
|
993
|
-
for (const
|
|
994
|
-
|
|
995
|
-
if (existsSync(path)) return path;
|
|
996
|
-
}
|
|
997
|
-
return join(root, "wrangler.jsonc");
|
|
1184
|
+
for (const path of projectWranglerPaths(root)) if (existsSync(path)) return path;
|
|
1185
|
+
return materializeCloudflareConfig(root);
|
|
998
1186
|
}
|
|
999
1187
|
function parseCustomDomains(value, configPath) {
|
|
1000
1188
|
if (value === void 0) return [];
|
|
@@ -1793,4 +1981,4 @@ function canonicalize(value) {
|
|
|
1793
1981
|
return value;
|
|
1794
1982
|
}
|
|
1795
1983
|
//#endregion
|
|
1796
|
-
export { writeWranglerPublishedTrafficSnapshot as A, readWranglerWebSocketTombstones as C, syncWranglerWebSockets as D, syncWranglerDurableObjects as E, isSandboxEnabled as M, requiresSandboxPlatformImage as N, updateWranglerCustomDomain as O, resolveSandboxConfig as P, readWranglerPublishedTrafficSnapshot as S, syncWranglerBindings as T, readProvisionedBindingEntry as _, LIVE_MIGRATION_TAG as a, readWranglerCustomDomains as b, bindingEntriesForField as c, ensureWranglerNodejsAlsFlag as d, findBindingNameOwner as f, readExistingLiveBindingConfig as g, normalizeWranglerCompatibilityFlags as h, LATEST_KNOWN_COMPAT_DATE as i, SANDBOX_MIGRATION_TAG as j, writeProvisionedWranglerConfig as k, ensureWranglerCompat as l, nextDurableObjectMigrationTag as m, DEFAULT_LIVE_CLASS as n, acknowledgeWranglerManagedQueueRemovals as o, hasDurableObjectSqliteMigration as p, FRIENDLY_BINDING_NAMES as r, assertNoDuplicateMembers as s, DEFAULT_LIVE_BINDING as t, ensureWranglerCompatibilityDate as u, readRootWranglerConfig as v, resolveLiveBindingConfig as w, readWranglerManagedQueueCleanupCandidates as x, readWranglerCompat as y };
|
|
1984
|
+
export { writeWranglerPublishedTrafficSnapshot as A, seedCloudflareConfig as B, readWranglerWebSocketTombstones as C, syncWranglerWebSockets as D, syncWranglerDurableObjects as E, MATERIALIZED_CLOUDFLARE_FILE as F, VOID_LOCK_FILE as I, materializeCloudflareConfig as L, isSandboxEnabled as M, requiresSandboxPlatformImage as N, updateWranglerCustomDomain as O, resolveSandboxConfig as P, persistCloudflareConfig as R, readWranglerPublishedTrafficSnapshot as S, syncWranglerBindings as T, stashCloudflareDeployPointer as V, readProvisionedBindingEntry as _, LIVE_MIGRATION_TAG as a, readWranglerCustomDomains as b, bindingEntriesForField as c, ensureWranglerNodejsAlsFlag as d, findBindingNameOwner as f, readExistingLiveBindingConfig as g, normalizeWranglerCompatibilityFlags as h, LATEST_KNOWN_COMPAT_DATE as i, SANDBOX_MIGRATION_TAG as j, writeProvisionedWranglerConfig as k, ensureWranglerCompat as l, nextDurableObjectMigrationTag as m, DEFAULT_LIVE_CLASS as n, acknowledgeWranglerManagedQueueRemovals as o, hasDurableObjectSqliteMigration as p, FRIENDLY_BINDING_NAMES as r, assertNoDuplicateMembers as s, DEFAULT_LIVE_BINDING as t, ensureWranglerCompatibilityDate as u, readRootWranglerConfig as v, resolveLiveBindingConfig as w, readWranglerManagedQueueCleanupCandidates as x, readWranglerCompat as y, restoreCloudflarePreviewPointer as z };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { t as StandardSchemaV1 } from "./standard-schema-Fo_vCAZh.mjs";
|
|
2
|
+
import { r as AuthUser } from "./auth-DkcFflXV.mjs";
|
|
3
|
+
import { a as CloudEnv } from "./handler-BXJTXd02.mjs";
|
|
4
|
+
import { WebSocketRouteMap } from "void/routes";
|
|
5
|
+
//#region src/runtime/ws.d.ts
|
|
6
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
7
|
+
type ParamsRecord = Record<string, string>;
|
|
8
|
+
type WsEntry<P extends keyof WebSocketRouteMap> = WebSocketRouteMap[P];
|
|
9
|
+
type ParamsOf<P extends keyof WebSocketRouteMap> = WsEntry<P> extends {
|
|
10
|
+
params: infer T;
|
|
11
|
+
} ? T : Record<string, never>;
|
|
12
|
+
type ClientEventOf<P extends keyof WebSocketRouteMap> = WsEntry<P> extends {
|
|
13
|
+
client: infer T;
|
|
14
|
+
} ? T : never;
|
|
15
|
+
type ServerEventOf<P extends keyof WebSocketRouteMap> = WsEntry<P> extends {
|
|
16
|
+
server: infer T;
|
|
17
|
+
} ? T : never;
|
|
18
|
+
type HasParams<P extends keyof WebSocketRouteMap> = ParamsOf<P> extends Record<string, never> ? false : [keyof ParamsOf<P>] extends [never] ? false : true;
|
|
19
|
+
type WebSocketConnection<ServerEvent = unknown> = {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly state: unknown;
|
|
22
|
+
send(event: ServerEvent): Promise<void>;
|
|
23
|
+
close(code?: number, reason?: string): void;
|
|
24
|
+
setState(data: unknown): void;
|
|
25
|
+
};
|
|
26
|
+
type RoomController<ServerEvent = unknown> = {
|
|
27
|
+
broadcast(event: ServerEvent, excludeIds?: Array<string>): Promise<void>;
|
|
28
|
+
getConnections(): Iterable<WebSocketConnection<ServerEvent>>;
|
|
29
|
+
getConnection(id: string): WebSocketConnection<ServerEvent> | undefined;
|
|
30
|
+
};
|
|
31
|
+
type WebSocketBaseContext = {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly params: ParamsRecord;
|
|
34
|
+
readonly user: AuthUser | null;
|
|
35
|
+
readonly request: Request;
|
|
36
|
+
readonly env: CloudEnv["Bindings"];
|
|
37
|
+
readonly storage: DurableObjectStorage;
|
|
38
|
+
};
|
|
39
|
+
type RoomContext<ServerEvent = unknown> = WebSocketBaseContext & {
|
|
40
|
+
readonly room: RoomController<ServerEvent>;
|
|
41
|
+
readonly connection: WebSocketConnection<ServerEvent>;
|
|
42
|
+
};
|
|
43
|
+
type SocketContext<ServerEvent = unknown> = WebSocketBaseContext & {
|
|
44
|
+
readonly socket: WebSocketConnection<ServerEvent>;
|
|
45
|
+
};
|
|
46
|
+
type RoomDefinition<ClientSchema extends StandardSchemaV1 = StandardSchemaV1, ServerSchema extends StandardSchemaV1 = StandardSchemaV1> = {
|
|
47
|
+
readonly __kind: "room";
|
|
48
|
+
readonly messages: {
|
|
49
|
+
client: ClientSchema;
|
|
50
|
+
server: ServerSchema;
|
|
51
|
+
};
|
|
52
|
+
onBeforeConnect?: (ctx: RoomContext<StandardSchemaV1.InferInput<ServerSchema>>) => MaybePromise<Response | void>;
|
|
53
|
+
onConnect?: (ctx: RoomContext<StandardSchemaV1.InferInput<ServerSchema>>) => MaybePromise<void>;
|
|
54
|
+
onMessage?: (ctx: RoomContext<StandardSchemaV1.InferInput<ServerSchema>>, event: StandardSchemaV1.InferOutput<ClientSchema>) => MaybePromise<void>;
|
|
55
|
+
onClose?: (ctx: RoomContext<StandardSchemaV1.InferInput<ServerSchema>>, details?: {
|
|
56
|
+
code: number;
|
|
57
|
+
reason: string;
|
|
58
|
+
wasClean: boolean;
|
|
59
|
+
}) => MaybePromise<void>;
|
|
60
|
+
onRequest?: (ctx: RoomContext<StandardSchemaV1.InferInput<ServerSchema>>) => MaybePromise<Response>;
|
|
61
|
+
};
|
|
62
|
+
type SocketDefinition<ClientSchema extends StandardSchemaV1 = StandardSchemaV1, ServerSchema extends StandardSchemaV1 = StandardSchemaV1> = {
|
|
63
|
+
readonly __kind: "socket";
|
|
64
|
+
readonly messages: {
|
|
65
|
+
client: ClientSchema;
|
|
66
|
+
server: ServerSchema;
|
|
67
|
+
};
|
|
68
|
+
onBeforeConnect?: (ctx: SocketContext<StandardSchemaV1.InferInput<ServerSchema>>) => MaybePromise<Response | void>;
|
|
69
|
+
onConnect?: (ctx: SocketContext<StandardSchemaV1.InferInput<ServerSchema>>) => MaybePromise<void>;
|
|
70
|
+
onMessage?: (ctx: SocketContext<StandardSchemaV1.InferInput<ServerSchema>>, event: StandardSchemaV1.InferOutput<ClientSchema>) => MaybePromise<void>;
|
|
71
|
+
onClose?: (ctx: SocketContext<StandardSchemaV1.InferInput<ServerSchema>>, details?: {
|
|
72
|
+
code: number;
|
|
73
|
+
reason: string;
|
|
74
|
+
wasClean: boolean;
|
|
75
|
+
}) => MaybePromise<void>;
|
|
76
|
+
onRequest?: (ctx: SocketContext<StandardSchemaV1.InferInput<ServerSchema>>) => MaybePromise<Response>;
|
|
77
|
+
};
|
|
78
|
+
type AnyWebSocketDefinition = RoomDefinition | SocketDefinition;
|
|
79
|
+
declare function defineRoom<ClientSchema extends StandardSchemaV1, ServerSchema extends StandardSchemaV1>(definition: Omit<RoomDefinition<ClientSchema, ServerSchema>, "__kind">): RoomDefinition<ClientSchema, ServerSchema>;
|
|
80
|
+
declare function defineWebSocket<ClientSchema extends StandardSchemaV1, ServerSchema extends StandardSchemaV1>(definition: Omit<SocketDefinition<ClientSchema, ServerSchema>, "__kind">): SocketDefinition<ClientSchema, ServerSchema>;
|
|
81
|
+
type VoidSocketCloseEvent = {
|
|
82
|
+
code?: number;
|
|
83
|
+
reason?: string;
|
|
84
|
+
wasClean?: boolean;
|
|
85
|
+
};
|
|
86
|
+
type ConnectCommonOptions = {
|
|
87
|
+
baseURL?: string;
|
|
88
|
+
reconnect?: boolean;
|
|
89
|
+
reconnectDelayMs?: number;
|
|
90
|
+
maxReconnectAttempts?: number;
|
|
91
|
+
protocols?: string | Array<string>;
|
|
92
|
+
};
|
|
93
|
+
type ConnectOptions<P extends keyof WebSocketRouteMap> = ConnectCommonOptions & (HasParams<P> extends true ? {
|
|
94
|
+
params: ParamsOf<P>;
|
|
95
|
+
} : {
|
|
96
|
+
params?: never;
|
|
97
|
+
});
|
|
98
|
+
type ListenerMap<ServerEvent> = {
|
|
99
|
+
message: (event: ServerEvent) => void;
|
|
100
|
+
open: () => void;
|
|
101
|
+
close: (event: VoidSocketCloseEvent) => void;
|
|
102
|
+
error: (error: unknown) => void;
|
|
103
|
+
};
|
|
104
|
+
declare class VoidSocket<P extends keyof WebSocketRouteMap & string> {
|
|
105
|
+
private readonly url;
|
|
106
|
+
private readonly options;
|
|
107
|
+
private socket;
|
|
108
|
+
private readonly listeners;
|
|
109
|
+
private readonly buffer;
|
|
110
|
+
private reconnectAttempts;
|
|
111
|
+
private closedByUser;
|
|
112
|
+
constructor(url: string, options: ConnectCommonOptions);
|
|
113
|
+
private emit;
|
|
114
|
+
private connect;
|
|
115
|
+
send(event: ClientEventOf<P>): void;
|
|
116
|
+
close(code?: number, reason?: string): void;
|
|
117
|
+
on<K extends keyof ListenerMap<ServerEventOf<P>>>(type: K, handler: ListenerMap<ServerEventOf<P>>[K]): () => void;
|
|
118
|
+
}
|
|
119
|
+
declare function connect<P extends keyof WebSocketRouteMap & string>(path: HasParams<P> extends false ? P : never): VoidSocket<P>;
|
|
120
|
+
declare function connect<P extends keyof WebSocketRouteMap & string>(path: P, options: ConnectOptions<P>): VoidSocket<P>;
|
|
121
|
+
//#endregion
|
|
122
|
+
export { RoomDefinition as a, VoidSocket as c, WebSocketConnection as d, connect as f, RoomController as i, VoidSocketCloseEvent as l, defineWebSocket as m, ConnectCommonOptions as n, SocketContext as o, defineRoom as p, RoomContext as r, SocketDefinition as s, AnyWebSocketDefinition as t, WebSocketBaseContext as u };
|