void 0.21.9 → 0.23.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.
- package/README.md +5 -1
- package/dist/{account-cmd-DZZGK80W.mjs → account-cmd-C84Ee8cO.mjs} +5 -5
- package/dist/{scan-ClYmX3sa.mjs → application-analysis-BVsVqc11.mjs} +135 -18
- package/dist/application-routing-B7QEjqSR.mjs +27 -0
- package/dist/{auth-CZuiVsFh.mjs → auth-CCjt0hcq.mjs} +1 -1
- package/dist/{auth-DLNN0D3Z.mjs → auth-CSkdO2Bb.mjs} +4 -47
- package/dist/{auth-link-B_CeugBw.mjs → auth-link-CioEg6uY.mjs} +5 -5
- package/dist/{auth-router-BgEFRuvZ.mjs → auth-router-BsR981d4.mjs} +5 -5
- package/dist/{better-auth-shared-rsBGBvWJ.mjs → better-auth-shared-hy6RPh9W.mjs} +13 -2
- package/dist/{build-cmd-Dpt0jd-x.mjs → build-cmd-LzvNJORH.mjs} +19 -7
- package/dist/{cache-7_UeZdTk.mjs → cache-C4MvnrMH.mjs} +4 -4
- package/dist/{cancel-deploy-D23R1RXT.mjs → cancel-deploy-abUxpP2n.mjs} +4 -4
- package/dist/{cf-build-output-CGT03qCD.mjs → cf-build-output-BPqOT964.mjs} +141 -63
- package/dist/cf-build-output-_0HNWysu.mjs +2 -0
- package/dist/cli/cli.mjs +114 -460
- package/dist/cli/cloudflare-operation-process.mjs +1103 -0
- package/dist/cli/env-schema-probe.d.mts +2 -1
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-Cu7jWiF1.mjs +2 -0
- package/dist/{client-QTl6ko_D.mjs → client-RV8NVeB8.mjs} +165 -21
- package/dist/{cloudflare-auth-C4_GPZr0.mjs → cloudflare-auth-Qdc7tw8F.mjs} +41 -43
- package/dist/{cloudflare-cmd-bSmZ1d5L.mjs → cloudflare-cmd-BcrVyTmJ.mjs} +9 -10
- package/dist/cloudflare-config-Bktvwtpf.mjs +182 -0
- package/dist/{cloudflare-connect-jAwacxxP.mjs → cloudflare-connect-B8uPZ4nx.mjs} +4 -4
- package/dist/{cloudflare-operations-BipGMJ5O.mjs → cloudflare-operations-AiWashgg.mjs} +1 -1
- package/dist/{cloudflare-operations-sMZXpk_S.mjs → cloudflare-operations-fxHb-byx.mjs} +118 -203
- package/dist/{preset-UHj9ARyP.mjs → cloudflare-process-B-wekeR6.mjs} +93 -6
- package/dist/{config-CF69HgXc.d.mts → config-BMHb8RCj.d.mts} +2 -2
- package/dist/{config-CafTW6Cz.mjs → config-Br_JZD6u.mjs} +2 -7
- package/dist/config-C_XRIPx2.mjs +89 -0
- package/dist/{config-s7Xj7tPb.mjs → config-CyQ-wVd7.mjs} +1 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config-write-BSduPMY8.mjs → config-write-B1f88wJA.mjs} +1 -1
- package/dist/{connect-BsUSRzln.mjs → connect-Bd4kJd9U.mjs} +6 -6
- package/dist/{create-project-BniEV0OW.mjs → create-project-Boczwj5r.mjs} +1 -1
- package/dist/{create-project-DBfFSZKY.mjs → create-project-bMf6ffLZ.mjs} +9 -5
- package/dist/{db-hRrvZaq_.mjs → db-8uG64XLl.mjs} +26 -26
- package/dist/{delete-D6dZ9B6B.mjs → delete-NvbiyeJf.mjs} +4 -4
- package/dist/{deploy-WaAQez1O.mjs → deploy-DzAIwqNU.mjs} +944 -607
- package/dist/{deploy-DDz7c8LK.mjs → deploy-bjXdFCtn.mjs} +1 -1
- package/dist/{dist-BR1quN_w.mjs → dist-AoCzRTJE.mjs} +226 -60
- package/dist/{dist-C5fND3R0.mjs → dist-BuDuKZJv.mjs} +1 -1
- package/dist/{dist-Dn6nn2IU.mjs → dist-CTBk70IR.mjs} +42 -42
- package/dist/{domain-Dmhvb2oU.mjs → domain-y5Tvydvo.mjs} +5 -5
- package/dist/{email-DFi-s2t4.mjs → email-B3umsW75.mjs} +15 -30
- package/dist/{env-Csi-tMbT.mjs → env-BS6qYHDb.mjs} +6 -6
- package/dist/{env-public-D_6u46fX.d.mts → env-public-BX_r8HR6.d.mts} +2 -1
- package/dist/{env-validation-BB4GkLxn.mjs → env-validation-BPn7vk-V.mjs} +18 -71
- package/dist/{env-validation-BXge7uyK.mjs → env-validation-DbTg7-ar.mjs} +1 -1
- package/dist/{fetch-CXDChK7B.mjs → fetch-BIZJh7vR.mjs} +2 -2
- package/dist/{fetch-stream-AOByI7Ki.mjs → fetch-stream-IvCYKyQL.mjs} +24 -4
- package/dist/{gen-Dz3X1Qab.mjs → gen-B580--vC.mjs} +5 -5
- package/dist/gen-BVaUUumi.mjs +2 -0
- package/dist/{github-cmd-BED3_9JD.mjs → github-cmd-v45BdfKX.mjs} +6 -8
- package/dist/{handler-BXJTXd02.d.mts → handler-CZ4nAylQ.d.mts} +2 -1
- package/dist/{headers-BOg_velo.mjs → headers-DWi2IXWx.mjs} +1 -1
- package/dist/help-DofyZuY7.mjs +2 -0
- package/dist/{help-DC7gdz7L.mjs → help-daGKjXGk.mjs} +268 -666
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +305 -1490
- package/dist/info-B97bTX9N.mjs +113 -0
- package/dist/{init-WO0JlPx8.mjs → init-Bvy7zrBo.mjs} +51 -20
- package/dist/limits-Bq5LG8Id.d.mts +27 -0
- package/dist/limits-Cjuk2VPm.mjs +68 -0
- package/dist/{link-CsHOinF7.mjs → link-CDqqCjFl.mjs} +5 -5
- package/dist/{list-CDb-4bZ1.mjs → list-CZj0dzKY.mjs} +5 -5
- package/dist/{live-CKiJilLr.d.mts → live-Chw1eIMv.d.mts} +1 -1
- package/dist/{local-d1-CC8sKFGu.mjs → local-d1-2CMnpuW_.mjs} +2 -2
- package/dist/login-DYt_An22.mjs +2 -0
- package/dist/{login-DvqXsfGs.mjs → login-UZKFM_u7.mjs} +5 -5
- package/dist/{logs-BdfiOezj.mjs → logs-CUZ6t9t3.mjs} +5 -5
- package/dist/migrate-8_2u55MD.mjs +2 -0
- package/dist/{migrate-B8KuoYsO.mjs → migrate-DHul7PRV.mjs} +5 -4
- package/dist/{node-BM43oz4G.mjs → node-BkyRWRx8.mjs} +2 -2
- package/dist/operator-args-CLgKGlwU.mjs +690 -0
- package/dist/{operator-cmd-03819ATr.mjs → operator-cmd-DBA6dl0m.mjs} +69 -23
- package/dist/output-Dm_A4Tbv.mjs +81 -0
- package/dist/pages/client.d.mts +34 -2
- package/dist/pages/client.mjs +59 -3
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +3 -3
- package/dist/pages/islands-plugin.d.mts +16 -6
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +2 -308
- package/dist/{parse-filename-DioPHiR9.mjs → parse-filename-CUbj-1MP.mjs} +35 -1
- package/dist/{output-CCH48AMM.mjs → picocolors-BTps1_gs.mjs} +2 -76
- package/dist/plan-D1Q5rf-r.mjs +2 -0
- package/dist/plan-NPpwZ_kc.mjs +58 -0
- package/dist/platform-args-BJdRtlLq.mjs +506 -0
- package/dist/platform-args-D3RXyR6h.mjs +2 -0
- package/dist/{platform-auth-config-z92h63q5.mjs → platform-auth-config-B56E9YP1.mjs} +4 -4
- package/dist/{platform-auth-protection-DeE3yr2R.mjs → platform-auth-protection-BDWO_aER.mjs} +3 -3
- package/dist/{platform-auth-recovery-o_340Ixx.mjs → platform-auth-recovery-1gg4CSRe.mjs} +4 -4
- package/dist/{platform-cmd-C4ZV3Vpy.mjs → platform-cmd-Bt-1w6pY.mjs} +1 -1
- package/dist/{platform-cmd-DNl8WosH.mjs → platform-cmd-DMcQStSc.mjs} +26 -5
- package/dist/{platform-domain-CU1JtJkW.mjs → platform-domain-BNkcz0OB.mjs} +36 -9
- package/dist/{platform-lifecycle-Bc047IeT.mjs → platform-lifecycle-9OyBALhH.mjs} +850 -276
- package/dist/{platform-lifecycle-Bs2qx1E3.mjs → platform-lifecycle-BE6C_jxh.mjs} +1 -1
- package/dist/{platform-management-CVpGI9Y5.mjs → platform-management-CjwLVQwN.mjs} +59 -11
- package/dist/{platform-management-C8tt6D8h.mjs → platform-management-CnyTdcWX.mjs} +1 -1
- package/dist/platform-plans-config-BNGKGr4P.mjs +359 -0
- package/dist/{platform-recovery-dvUaptLr.mjs → platform-recovery-D6KSpuFm.mjs} +2 -2
- package/dist/{plugin-inference-BMfKRSqE.mjs → plugin-inference-CXWnn79A.mjs} +174 -64
- package/dist/{prepare-DyZ-Yok5.mjs → prepare-B5Mkic5u.mjs} +3 -3
- package/dist/{prepare-C3kt3Rst.mjs → prepare-DOsL0CC9.mjs} +4 -20
- package/dist/prepare-cgvDMtSb.mjs +2 -0
- package/dist/{project-cmd-B44I8J_W.mjs → project-cmd-CNzrqvBv.mjs} +30 -16
- package/dist/{project-team-BkbYIsXN.mjs → project-team-DQOWPfQT.mjs} +4 -4
- package/dist/{project-token-C8xEEQnB.mjs → project-token-CTDYU0Cc.mjs} +4 -4
- package/dist/project-zero-trust-BNAkW-_0.mjs +63 -0
- package/dist/{protocol-ZH3jP4a7.d.mts → protocol-CjF_iI9X.d.mts} +2 -2
- package/dist/protocol-U7bfjHmA.mjs +331 -0
- package/dist/{provision-DNtrtaVD.mjs → provision-C4ORE7G7.mjs} +1 -1
- package/dist/{provision-BhreDAOS.mjs → provision-CJFgTZY8.mjs} +111 -215
- package/dist/{requests-DFyhBMaf.mjs → requests-MhxYnau8.mjs} +4 -4
- package/dist/resource-name-C7LVpcRm.mjs +11 -0
- package/dist/{rollback-DHHxXZiS.mjs → rollback-CJ6iSDoU.mjs} +5 -5
- package/dist/route-url-CG7U-cRN.mjs +15 -0
- package/dist/{runner-B8wXwWlo.mjs → runner-CXA9Fh8h.mjs} +1 -1
- package/dist/{runner-p-dMs2UN.mjs → runner-Ol0TNjk6.mjs} +2 -2
- package/dist/runtime/ai.d.mts +12 -8
- package/dist/runtime/ai.mjs +84 -17
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.mjs +2 -2
- package/dist/runtime/client-solid.mjs +2 -2
- package/dist/runtime/client-svelte.mjs +2 -2
- package/dist/runtime/client-vue.mjs +2 -2
- package/dist/runtime/client.mjs +2 -2
- package/dist/runtime/durable.d.mts +3 -1
- package/dist/runtime/durable.mjs +4 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/kv.mjs +0 -1
- package/dist/runtime/limits.d.mts +2 -0
- package/dist/runtime/limits.mjs +2 -0
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +25 -16
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/migration-handler.mjs +62 -42
- package/dist/runtime/route-url.d.mts +4 -0
- package/dist/runtime/route-url.mjs +2 -0
- package/dist/runtime/routing.d.mts +180 -0
- package/dist/runtime/routing.mjs +1082 -0
- package/dist/runtime/sandbox-container.d.mts +3 -0
- package/dist/runtime/sandbox-container.mjs +2 -0
- package/dist/runtime/sandbox.d.mts +4 -32
- package/dist/runtime/sandbox.mjs +151 -75
- package/dist/runtime/sse.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +4 -2
- package/dist/runtime/ws-server.mjs +27 -2
- package/dist/runtime/ws.d.mts +2 -2
- package/dist/runtime/ws.mjs +8 -6
- package/dist/sandbox-XZAqzFlG.d.mts +52 -0
- package/dist/sandbox-container-Bo0eiFKz.d.mts +73 -0
- package/dist/sandbox-container-C6ItmVuN.mjs +281 -0
- package/dist/{scan-4tfN-PSn.mjs → scan-C7okrLyM.mjs} +4 -35
- package/dist/{secret-DN9sSNiV.mjs → secret-Dli5fP0B.mjs} +6 -6
- package/dist/{skills-O6FUaizK.mjs → skills-D1II1Juz.mjs} +1 -1
- package/dist/{sse-BaC1jXko.mjs → sse-CQNaDFFV.mjs} +6 -3
- package/dist/{subcommand-prompt-BuGYkAkC.mjs → subcommand-prompt-CY1C4fvl.mjs} +2 -2
- package/dist/validate-Dq_L3s0S.mjs +2 -0
- package/dist/{validate-CIUwFpjB.mjs → validate-ctOrgiS3.mjs} +2 -1
- package/dist/{wrangler-BymcxrRa.mjs → wrangler-7K-bW_DL.mjs} +14 -235
- package/dist/{ws-BwcqizuH.d.mts → ws-CL1w7GXU.d.mts} +13 -2
- package/package.json +48 -33
- package/sandbox.Dockerfile +4 -0
- package/schema.json +10 -22
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +34 -157
- package/skills/void/SKILL.md +50 -133
- package/skills/void/docs/guide/ai.md +94 -84
- package/skills/void/docs/guide/app-types.md +3 -32
- package/skills/void/docs/guide/auth.md +12 -116
- package/skills/void/docs/guide/database/d1.md +9 -54
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +5 -26
- package/skills/void/docs/guide/database.md +23 -75
- package/skills/void/docs/guide/deployment.md +27 -113
- package/skills/void/docs/guide/durable-state.md +43 -18
- package/skills/void/docs/guide/edge/headers.md +3 -47
- package/skills/void/docs/guide/edge/prerendering.md +5 -20
- package/skills/void/docs/guide/edge/redirects.md +11 -64
- package/skills/void/docs/guide/edge/revalidation.md +6 -19
- package/skills/void/docs/guide/edge/rewrites.md +56 -284
- package/skills/void/docs/guide/edge/static-assets.md +23 -72
- package/skills/void/docs/guide/email/domains.md +112 -0
- package/skills/void/docs/guide/email/receiving.md +139 -0
- package/skills/void/docs/guide/email/sending.md +231 -0
- package/skills/void/docs/guide/email.md +13 -619
- package/skills/void/docs/guide/env-migration.md +11 -11
- package/skills/void/docs/guide/env-vars.md +9 -29
- package/skills/void/docs/guide/index.md +0 -15
- package/skills/void/docs/guide/jobs.md +3 -18
- package/skills/void/docs/guide/kv.md +5 -11
- package/skills/void/docs/guide/live.md +5 -56
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +78 -125
- package/skills/void/docs/guide/pages-routing/head.md +10 -10
- package/skills/void/docs/guide/pages-routing/islands.md +6 -36
- package/skills/void/docs/guide/pages-routing/layouts.md +6 -128
- package/skills/void/docs/guide/pages-routing/loaders.md +3 -19
- package/skills/void/docs/guide/pages-routing/markdown.md +13 -171
- package/skills/void/docs/guide/pages-routing/overview.md +7 -17
- package/skills/void/docs/guide/pages-routing/view-transitions.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +1 -4
- package/skills/void/docs/guide/platform/administration/email.md +35 -8
- package/skills/void/docs/guide/platform/administration/operations.md +26 -4
- package/skills/void/docs/guide/platform/administration/plans.md +126 -0
- package/skills/void/docs/guide/platform/administration/projects.md +5 -2
- package/skills/void/docs/guide/platform/administration/zero-trust.md +189 -0
- package/skills/void/docs/guide/platform/development/local.md +2 -2
- package/skills/void/docs/guide/platform/development/runtime.md +3 -13
- package/skills/void/docs/guide/platform/development/schema-ci.md +0 -58
- package/skills/void/docs/guide/platform/installation/credentials.md +6 -4
- package/skills/void/docs/guide/platform/installation/domains.md +31 -3
- package/skills/void/docs/guide/platform/installation/first-deployment.md +6 -0
- package/skills/void/docs/guide/platform/installation/maintenance.md +3 -1
- package/skills/void/docs/guide/platform/installation/prerequisites.md +21 -16
- package/skills/void/docs/guide/platform/installation/setup.md +9 -5
- package/skills/void/docs/guide/platform/installation/uninstall.md +17 -2
- package/skills/void/docs/guide/platform-administration.md +2 -0
- package/skills/void/docs/guide/queues.md +7 -9
- package/skills/void/docs/guide/quickstart.md +38 -37
- package/skills/void/docs/guide/remote-dev.md +4 -9
- package/skills/void/docs/guide/sandboxes.md +78 -41
- package/skills/void/docs/guide/server-routing.md +9 -72
- package/skills/void/docs/guide/sse.md +4 -18
- package/skills/void/docs/guide/ssg.md +3 -15
- package/skills/void/docs/guide/ssr.md +14 -62
- package/skills/void/docs/guide/storage.md +9 -4
- package/skills/void/docs/guide/type-safety.md +3 -14
- package/skills/void/docs/guide/typed-fetch.md +3 -7
- package/skills/void/docs/guide/websockets.md +68 -40
- package/skills/void/docs/integrations/agents.md +3 -3
- package/skills/void/docs/integrations/cloudflare.md +85 -316
- package/skills/void/docs/integrations/frameworks/analog.md +5 -64
- package/skills/void/docs/integrations/frameworks/astro.md +4 -73
- package/skills/void/docs/integrations/frameworks/nuxt.md +5 -62
- package/skills/void/docs/integrations/frameworks/overview.md +11 -54
- package/skills/void/docs/integrations/frameworks/react-router.md +5 -60
- package/skills/void/docs/integrations/frameworks/sveltekit.md +6 -65
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +4 -62
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -69
- package/skills/void/docs/reference/api/auth.md +156 -0
- package/skills/void/docs/reference/api/client.md +87 -0
- package/skills/void/docs/reference/api/database.md +95 -0
- package/skills/void/docs/reference/api/durable.md +46 -0
- package/skills/void/docs/reference/api/env.md +50 -0
- package/skills/void/docs/reference/api/handlers.md +254 -0
- package/skills/void/docs/reference/api/pages.md +241 -0
- package/skills/void/docs/reference/api/plugin.md +39 -0
- package/skills/void/docs/reference/api/resources.md +109 -0
- package/skills/void/docs/reference/api/rewrites.md +76 -0
- package/skills/void/docs/reference/api/types.md +92 -0
- package/skills/void/docs/reference/api.md +56 -1218
- package/skills/void/docs/reference/cli/auth.md +88 -0
- package/skills/void/docs/reference/cli/database.md +128 -0
- package/skills/void/docs/reference/cli/deploy.md +85 -0
- package/skills/void/docs/reference/cli/domains.md +41 -0
- package/skills/void/docs/reference/cli/email.md +129 -0
- package/skills/void/docs/reference/cli/generate.md +116 -0
- package/skills/void/docs/reference/cli/github.md +189 -0
- package/skills/void/docs/reference/cli/platform-config.md +92 -0
- package/skills/void/docs/reference/cli/platform-email.md +81 -0
- package/skills/void/docs/reference/cli/platform-installation.md +127 -0
- package/skills/void/docs/reference/cli/platform-operations.md +90 -0
- package/skills/void/docs/reference/cli/platform-users.md +89 -0
- package/skills/void/docs/reference/cli/platform-zero-trust.md +45 -0
- package/skills/void/docs/reference/cli/platform.md +70 -0
- package/skills/void/docs/reference/cli/project.md +214 -0
- package/skills/void/docs/reference/cli/secrets.md +76 -0
- package/skills/void/docs/reference/cli/setup.md +70 -0
- package/skills/void/docs/reference/cli.md +33 -1621
- package/skills/void/docs/reference/config.md +26 -32
- package/skills/void/docs/reference/resource-inference.md +3 -58
- package/skills/void/docs/reference/structure.md +14 -41
- package/dist/canonical-json-DuDiiUsQ.mjs +0 -13
- package/dist/cli/cf-compat.mjs +0 -968
- package/dist/client-4cDVv7BO.mjs +0 -2
- package/dist/gen-Vnv2f65C.mjs +0 -2
- package/dist/help-DQMfeKMz.mjs +0 -2
- package/dist/login-DFQk7rbW.mjs +0 -2
- package/dist/migrate-TsHGBnDA.mjs +0 -2
- package/dist/plan-BEZ8VJW0.mjs +0 -256
- package/dist/plan-DpuOr14e.mjs +0 -2
- package/dist/prepare-BZXkjdNe.mjs +0 -2
- package/dist/validate-EKmJWxmy.mjs +0 -2
- /package/dist/cli/{cf-compat.d.mts → cloudflare-operation-process.d.mts} +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { a as join } from "./dist-BVqXeR_h.mjs";
|
|
2
|
+
import "./project-paths-GgcMozYz.mjs";
|
|
3
|
+
import { m as readConfig } from "./config-Br_JZD6u.mjs";
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
import { parse } from "jsonc-parser";
|
|
7
|
+
import { isDeepStrictEqual } from "node:util";
|
|
8
|
+
//#region src/cloudflare-config.ts
|
|
9
|
+
const MATERIALIZED_CLOUDFLARE_FILE = ".void-wrangler.jsonc";
|
|
10
|
+
const VOID_LOCK_FILE = "void.lock.json";
|
|
11
|
+
const PREVIEW_POINTER_FILE = "preview-deploy-config.json";
|
|
12
|
+
function isObject(value) {
|
|
13
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
function arrayIdentity(value) {
|
|
16
|
+
if (isObject(value)) {
|
|
17
|
+
for (const key of [
|
|
18
|
+
"binding",
|
|
19
|
+
"name",
|
|
20
|
+
"tag",
|
|
21
|
+
"class_name",
|
|
22
|
+
"pattern",
|
|
23
|
+
"route"
|
|
24
|
+
]) if (typeof value[key] === "string") return `${key}:${value[key]}`;
|
|
25
|
+
}
|
|
26
|
+
return JSON.stringify(value) ?? String(value);
|
|
27
|
+
}
|
|
28
|
+
/** Keep authored values authoritative while retaining fields produced by Void. */
|
|
29
|
+
function mergeConfig(previous, resolved, authored) {
|
|
30
|
+
if (isDeepStrictEqual(previous, authored)) return resolved;
|
|
31
|
+
if (Array.isArray(previous) && Array.isArray(resolved) && Array.isArray(authored)) {
|
|
32
|
+
const previousByIdentity = new Map(previous.map((item) => [arrayIdentity(item), item]));
|
|
33
|
+
const resolvedByIdentity = new Map(resolved.map((item) => [arrayIdentity(item), item]));
|
|
34
|
+
const authoredIdentities = new Set(authored.map(arrayIdentity));
|
|
35
|
+
return [...authored.map((item) => {
|
|
36
|
+
const identity = arrayIdentity(item);
|
|
37
|
+
return previousByIdentity.has(identity) && resolvedByIdentity.has(identity) ? mergeConfig(previousByIdentity.get(identity), resolvedByIdentity.get(identity), item) : item;
|
|
38
|
+
}), ...resolved.filter((item) => {
|
|
39
|
+
const identity = arrayIdentity(item);
|
|
40
|
+
return !previousByIdentity.has(identity) && !authoredIdentities.has(identity);
|
|
41
|
+
})];
|
|
42
|
+
}
|
|
43
|
+
if (isObject(previous) && isObject(resolved) && isObject(authored)) {
|
|
44
|
+
const result = {};
|
|
45
|
+
for (const key of /* @__PURE__ */ new Set([
|
|
46
|
+
...Object.keys(previous),
|
|
47
|
+
...Object.keys(resolved),
|
|
48
|
+
...Object.keys(authored)
|
|
49
|
+
])) {
|
|
50
|
+
if (!(key in authored)) {
|
|
51
|
+
if (!(key in previous) && key in resolved) Object.defineProperty(result, key, {
|
|
52
|
+
value: resolved[key],
|
|
53
|
+
enumerable: true,
|
|
54
|
+
writable: true,
|
|
55
|
+
configurable: true
|
|
56
|
+
});
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const value = mergeConfig(previous[key], resolved[key], authored[key]);
|
|
60
|
+
Object.defineProperty(result, key, {
|
|
61
|
+
value,
|
|
62
|
+
enumerable: true,
|
|
63
|
+
writable: true,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
return authored;
|
|
70
|
+
}
|
|
71
|
+
function parseCloudflareText(text, path) {
|
|
72
|
+
const errors = [];
|
|
73
|
+
const value = parse(text.replace(/^\uFEFF/, ""), errors, { allowTrailingComma: true });
|
|
74
|
+
if (errors.length > 0 || !isObject(value)) throw new Error(`config: ${path} must contain a valid JSON/JSONC object.`);
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
function readState(root) {
|
|
78
|
+
const path = join(root, VOID_LOCK_FILE);
|
|
79
|
+
if (!existsSync(path)) return;
|
|
80
|
+
let value;
|
|
81
|
+
try {
|
|
82
|
+
value = JSON.parse(readFileSync(path, "utf8"));
|
|
83
|
+
} catch {
|
|
84
|
+
throw new Error(`config: Invalid ${VOID_LOCK_FILE}. Fix or restore it before continuing.`);
|
|
85
|
+
}
|
|
86
|
+
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.`);
|
|
87
|
+
const state = value;
|
|
88
|
+
if (!isDeepStrictEqual(parseCloudflareText(state.text, "void.lock.json"), state.resolved)) state.text = `${provenance(state.text)}${JSON.stringify(state.resolved, null, 2)}\n`;
|
|
89
|
+
return state;
|
|
90
|
+
}
|
|
91
|
+
function writeAtomic(path, content) {
|
|
92
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
93
|
+
writeFileSync(temporary, content, { flag: "wx" });
|
|
94
|
+
try {
|
|
95
|
+
renameSync(temporary, path);
|
|
96
|
+
} finally {
|
|
97
|
+
rmSync(temporary, { force: true });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function writeState(root, state) {
|
|
101
|
+
const path = join(root, VOID_LOCK_FILE);
|
|
102
|
+
const content = `${JSON.stringify(state, null, 2)}\n`;
|
|
103
|
+
if (existsSync(path)) try {
|
|
104
|
+
if (isDeepStrictEqual(JSON.parse(readFileSync(path, "utf8")), state)) return;
|
|
105
|
+
} catch {}
|
|
106
|
+
writeAtomic(path, content);
|
|
107
|
+
}
|
|
108
|
+
/** Keep Vite preview usable without leaving Wrangler's implicit deploy pointer after a build. */
|
|
109
|
+
function stashCloudflareDeployPointer(root) {
|
|
110
|
+
const pointer = join(root, ".wrangler", "deploy", "config.json");
|
|
111
|
+
if (!existsSync(pointer)) return;
|
|
112
|
+
const directory = join(root, ".void");
|
|
113
|
+
mkdirSync(directory, { recursive: true });
|
|
114
|
+
writeAtomic(join(directory, PREVIEW_POINTER_FILE), readFileSync(pointer, "utf8"));
|
|
115
|
+
rmSync(pointer, { force: true });
|
|
116
|
+
}
|
|
117
|
+
function restoreCloudflarePreviewPointer(root) {
|
|
118
|
+
const saved = join(root, ".void", PREVIEW_POINTER_FILE);
|
|
119
|
+
if (!existsSync(saved)) return false;
|
|
120
|
+
const directory = join(root, ".wrangler", "deploy");
|
|
121
|
+
mkdirSync(directory, { recursive: true });
|
|
122
|
+
writeAtomic(join(directory, "config.json"), readFileSync(saved, "utf8"));
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
/** Preserve Void's JSONC provenance comments when authored settings change. */
|
|
126
|
+
function provenance(text) {
|
|
127
|
+
const lines = text.match(/^\s*\/\/ void:(?:managed-queues|published-traffic):v1:[A-Za-z0-9_-]+\s*$/gm);
|
|
128
|
+
return lines ? `${lines.join("\n")}\n` : "";
|
|
129
|
+
}
|
|
130
|
+
/** Resolve the config file passed to Cloudflare tooling. Typed projects use a generated file. */
|
|
131
|
+
function materializeCloudflareConfig(root) {
|
|
132
|
+
if (!existsSync(join(root, "void.config.ts"))) {
|
|
133
|
+
for (const name of ["wrangler.jsonc", "wrangler.json"]) if (existsSync(join(root, name))) return join(root, name);
|
|
134
|
+
return join(root, "wrangler.jsonc");
|
|
135
|
+
}
|
|
136
|
+
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.");
|
|
137
|
+
const authored = readConfig(root).cloudflare ?? {};
|
|
138
|
+
const state = readState(root);
|
|
139
|
+
const resolved = state ? mergeConfig(state.source, state.resolved, authored) : authored;
|
|
140
|
+
const text = state && isDeepStrictEqual(resolved, state.resolved) && isDeepStrictEqual(authored, state.source) ? state.text : `${provenance(state?.text ?? "")}${JSON.stringify(resolved, null, 2)}\n`;
|
|
141
|
+
const path = join(root, MATERIALIZED_CLOUDFLARE_FILE);
|
|
142
|
+
if (!existsSync(path) || readFileSync(path, "utf8") !== text) writeAtomic(path, text);
|
|
143
|
+
if (state) writeState(root, {
|
|
144
|
+
version: 1,
|
|
145
|
+
source: authored,
|
|
146
|
+
resolved,
|
|
147
|
+
text
|
|
148
|
+
});
|
|
149
|
+
return path;
|
|
150
|
+
}
|
|
151
|
+
/** Record Cloudflare settings written by Void so later builds reproduce them. */
|
|
152
|
+
function persistCloudflareConfig(root) {
|
|
153
|
+
if (!existsSync(join(root, "void.config.ts"))) return;
|
|
154
|
+
const path = join(root, MATERIALIZED_CLOUDFLARE_FILE);
|
|
155
|
+
if (!existsSync(path)) throw new Error(`config: Missing generated ${MATERIALIZED_CLOUDFLARE_FILE}.`);
|
|
156
|
+
const text = readFileSync(path, "utf8");
|
|
157
|
+
const resolved = parseCloudflareText(text, path);
|
|
158
|
+
const authored = readConfig(root).cloudflare ?? {};
|
|
159
|
+
if (readState(root) || !isDeepStrictEqual(resolved, authored) || text !== `${JSON.stringify(authored, null, 2)}\n`) writeState(root, {
|
|
160
|
+
version: 1,
|
|
161
|
+
source: authored,
|
|
162
|
+
resolved,
|
|
163
|
+
text
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/** Seed the checked-in lock from a root Wrangler file during migration. */
|
|
167
|
+
function seedCloudflareConfig(root, source, text) {
|
|
168
|
+
const existing = readState(root);
|
|
169
|
+
if (existing) {
|
|
170
|
+
if (isDeepStrictEqual(existing.source, source) && isDeepStrictEqual(existing.resolved, source)) return;
|
|
171
|
+
throw new Error(`migrate: ${VOID_LOCK_FILE} already exists with different settings. Resolve it before migrating.`);
|
|
172
|
+
}
|
|
173
|
+
if (!isDeepStrictEqual(parseCloudflareText(text, ".void-wrangler.jsonc"), source)) throw new Error("migrate: The Cloudflare config changed during migration. Retry.");
|
|
174
|
+
writeState(root, {
|
|
175
|
+
version: 1,
|
|
176
|
+
source,
|
|
177
|
+
resolved: source,
|
|
178
|
+
text
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
export { restoreCloudflarePreviewPointer as a, persistCloudflareConfig as i, VOID_LOCK_FILE as n, seedCloudflareConfig as o, materializeCloudflareConfig as r, stashCloudflareDeployPointer as s, MATERIALIZED_CLOUDFLARE_FILE as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as join, t as basename } from "./dist-BVqXeR_h.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { I as select, W as isCancel, j as log } from "./dist-
|
|
4
|
-
import {
|
|
2
|
+
import { A as writeProvisionedWranglerConfig, i as LATEST_KNOWN_COMPAT_DATE, y as readRootWranglerConfig } from "./wrangler-7K-bW_DL.mjs";
|
|
3
|
+
import { I as select, W as isCancel, j as log } from "./dist-CTBk70IR.mjs";
|
|
4
|
+
import { i as ensureCloudflareAuthentication, r as createBundledCloudflareAuthRunner } from "./cloudflare-auth-Qdc7tw8F.mjs";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
//#region src/cli/cloudflare-connect.ts
|
|
7
7
|
async function connectCloudflare(root, interactive = Boolean(process.stdin.isTTY)) {
|
|
@@ -24,7 +24,7 @@ async function connectCloudflare(root, interactive = Boolean(process.stdin.isTTY
|
|
|
24
24
|
interactive,
|
|
25
25
|
requireAccounts: true,
|
|
26
26
|
runWrangler: createBundledCloudflareAuthRunner(root),
|
|
27
|
-
|
|
27
|
+
configPath: existingConfigPath
|
|
28
28
|
});
|
|
29
29
|
let account = accounts.find((entry) => entry.id === pinnedAccount);
|
|
30
30
|
if (pinnedAccount && !account) throw new Error(`connect: The signed-in Cloudflare session cannot access account ${pinnedAccount}.`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as resolveCloudflareD1Context, b as tailCloudflareWorker, c as listCloudflareDomains, g as readCloudflareWorkerStatus, h as readCloudflareD1Migrations, l as listCloudflareSecrets, m as putCloudflareSecret, n as applyCloudflareD1Migrations, o as deleteCloudflareSecret, r as changeCloudflareDomain, s as executeCloudflareD1Sql, t as activateCloudflareExistingVersion, v as resolveCloudflareOperationContext, y as syncCloudflareSecrets } from "./cloudflare-operations-
|
|
1
|
+
import { _ as resolveCloudflareD1Context, b as tailCloudflareWorker, c as listCloudflareDomains, g as readCloudflareWorkerStatus, h as readCloudflareD1Migrations, l as listCloudflareSecrets, m as putCloudflareSecret, n as applyCloudflareD1Migrations, o as deleteCloudflareSecret, r as changeCloudflareDomain, s as executeCloudflareD1Sql, t as activateCloudflareExistingVersion, v as resolveCloudflareOperationContext, y as syncCloudflareSecrets } from "./cloudflare-operations-fxHb-byx.mjs";
|
|
2
2
|
export { activateCloudflareExistingVersion, applyCloudflareD1Migrations, changeCloudflareDomain, deleteCloudflareSecret, executeCloudflareD1Sql, listCloudflareDomains, listCloudflareSecrets, putCloudflareSecret, readCloudflareD1Migrations, readCloudflareWorkerStatus, resolveCloudflareD1Context, resolveCloudflareOperationContext, syncCloudflareSecrets, tailCloudflareWorker };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as join } from "./dist-BVqXeR_h.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { i as persistCloudflareConfig, r as materializeCloudflareConfig } from "./cloudflare-config-Bktvwtpf.mjs";
|
|
3
|
+
import { C as readWranglerPublishedTrafficSnapshot, j as writeWranglerPublishedTrafficSnapshot, k as updateWranglerCustomDomain, x as readWranglerCustomDomains } from "./wrangler-7K-bW_DL.mjs";
|
|
3
4
|
import { r as scanWranglerDotenvKeys } from "./dotenv-VQxupEUv.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { _ as resolvePinnedApiBaseUrl, g as provisionEnv, r as assertNoTransportRedirectInProjectDotenv, s as deleteEnvVarCaseAware } from "./provision-
|
|
5
|
+
import { t as createCloudflareProcessRunner } from "./cloudflare-process-B-wekeR6.mjs";
|
|
6
|
+
import { _ as resolvePinnedApiBaseUrl, g as provisionEnv, r as assertNoTransportRedirectInProjectDotenv, s as deleteEnvVarCaseAware } from "./provision-CJFgTZY8.mjs";
|
|
6
7
|
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7
8
|
import { tmpdir } from "node:os";
|
|
8
|
-
import { spawnSync } from "node:child_process";
|
|
9
9
|
import { deployCloudflareVersionTraffic, encodeCloudflareVersionMessage, parseCloudflareVersionMessage, parseRootWranglerConfig, readBindingFieldPresence, readCloudflareTriggerConfig, readWranglerTopLevelString, resolveD1MigrateTarget, stabilizeCloudflareVersionTriggers } from "@void/deploy-cloudflare";
|
|
10
10
|
//#region src/cli/cloudflare-operations.ts
|
|
11
11
|
function resolveCloudflareOperationContext(root, runner) {
|
|
@@ -28,13 +28,11 @@ function resolveCloudflareOperationContext(root, runner) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
async function listCloudflareSecrets(context) {
|
|
31
|
-
const parsed = parseJson((await run(context,
|
|
32
|
-
"secret",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"json"
|
|
37
|
-
])).stdout, "Cloudflare secret list");
|
|
31
|
+
const parsed = parseJson((await run(context, {
|
|
32
|
+
type: "secret.list",
|
|
33
|
+
configPath: context.configPath,
|
|
34
|
+
workerName: context.workerName
|
|
35
|
+
})).data, "Cloudflare secret list");
|
|
38
36
|
if (!Array.isArray(parsed)) throw new Error("Cloudflare secret list returned an unexpected response.");
|
|
39
37
|
return parsed.map((entry) => {
|
|
40
38
|
if (typeof entry !== "object" || entry === null) return null;
|
|
@@ -43,28 +41,28 @@ async function listCloudflareSecrets(context) {
|
|
|
43
41
|
}).filter((name) => name !== null).sort();
|
|
44
42
|
}
|
|
45
43
|
async function putCloudflareSecret(context, name, value) {
|
|
46
|
-
await run(context,
|
|
47
|
-
"secret",
|
|
48
|
-
"put",
|
|
44
|
+
await run(context, {
|
|
45
|
+
type: "secret.put",
|
|
49
46
|
name,
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
configPath: context.configPath,
|
|
48
|
+
workerName: context.workerName
|
|
49
|
+
}, { input: value });
|
|
52
50
|
}
|
|
53
51
|
async function syncCloudflareSecrets(context, secrets) {
|
|
54
52
|
const values = Object.fromEntries(secrets.map(({ name, value }) => [name, value]));
|
|
55
|
-
await run(context,
|
|
56
|
-
"secret",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
await run(context, {
|
|
54
|
+
type: "secret.bulk",
|
|
55
|
+
configPath: context.configPath,
|
|
56
|
+
workerName: context.workerName
|
|
57
|
+
}, { input: `${JSON.stringify(values)}\n` });
|
|
60
58
|
}
|
|
61
59
|
async function deleteCloudflareSecret(context, name) {
|
|
62
|
-
await run(context,
|
|
63
|
-
"secret",
|
|
64
|
-
"delete",
|
|
60
|
+
await run(context, {
|
|
61
|
+
type: "secret.delete",
|
|
65
62
|
name,
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
configPath: context.configPath,
|
|
64
|
+
workerName: context.workerName
|
|
65
|
+
});
|
|
68
66
|
}
|
|
69
67
|
function resolveCloudflareD1Context(root, binding, runner) {
|
|
70
68
|
const operation = resolveCloudflareOperationContext(root, runner);
|
|
@@ -84,18 +82,12 @@ function resolveCloudflareD1Context(root, binding, runner) {
|
|
|
84
82
|
};
|
|
85
83
|
}
|
|
86
84
|
async function executeCloudflareD1Sql(context, sql) {
|
|
87
|
-
const parsed = parseJson((await run(context.operation,
|
|
88
|
-
"d1",
|
|
89
|
-
|
|
90
|
-
context.migrateToken,
|
|
91
|
-
"--remote",
|
|
92
|
-
"--command",
|
|
85
|
+
const parsed = parseJson((await run(context.operation, {
|
|
86
|
+
type: "d1.execute",
|
|
87
|
+
database: context.migrateToken,
|
|
93
88
|
sql,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
context.operation.configPath,
|
|
97
|
-
"--env="
|
|
98
|
-
])).stdout, "Cloudflare D1 execute");
|
|
89
|
+
configPath: context.operation.configPath
|
|
90
|
+
})).data, "Cloudflare D1 execute");
|
|
99
91
|
if (!Array.isArray(parsed)) throw new Error("Cloudflare D1 execute returned an unexpected response.");
|
|
100
92
|
const rows = [];
|
|
101
93
|
for (const item of parsed) {
|
|
@@ -116,46 +108,38 @@ async function readCloudflareD1Migrations(context) {
|
|
|
116
108
|
}
|
|
117
109
|
}
|
|
118
110
|
async function applyCloudflareD1Migrations(context) {
|
|
119
|
-
await run(context.operation,
|
|
120
|
-
"d1",
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"--remote",
|
|
125
|
-
"-c",
|
|
126
|
-
context.operation.configPath,
|
|
127
|
-
"--env="
|
|
128
|
-
], { capture: false });
|
|
111
|
+
await run(context.operation, {
|
|
112
|
+
type: "d1.migrations.apply",
|
|
113
|
+
database: context.migrateToken,
|
|
114
|
+
configPath: context.operation.configPath
|
|
115
|
+
}, { capture: false });
|
|
129
116
|
}
|
|
130
117
|
async function readCloudflareWorkerStatus(context) {
|
|
131
118
|
const [deployment, deployments, versions] = await Promise.all([
|
|
132
|
-
run(context,
|
|
133
|
-
"deployments",
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
...targetArgs(context),
|
|
148
|
-
"--json"
|
|
149
|
-
])
|
|
119
|
+
run(context, {
|
|
120
|
+
type: "deployments.status",
|
|
121
|
+
configPath: context.configPath,
|
|
122
|
+
workerName: context.workerName
|
|
123
|
+
}),
|
|
124
|
+
run(context, {
|
|
125
|
+
type: "deployments.list",
|
|
126
|
+
configPath: context.configPath,
|
|
127
|
+
workerName: context.workerName
|
|
128
|
+
}),
|
|
129
|
+
run(context, {
|
|
130
|
+
type: "versions.list",
|
|
131
|
+
configPath: context.configPath,
|
|
132
|
+
workerName: context.workerName
|
|
133
|
+
})
|
|
150
134
|
]);
|
|
151
|
-
const activeVersionId = parseActiveVersionId(deployment.
|
|
152
|
-
const deployedVersionIds = parseCloudflareDeployedVersionIds(deployments.
|
|
135
|
+
const activeVersionId = parseActiveVersionId(deployment.data);
|
|
136
|
+
const deployedVersionIds = parseCloudflareDeployedVersionIds(deployments.data);
|
|
153
137
|
if (activeVersionId && !deployedVersionIds.includes(activeVersionId)) deployedVersionIds.push(activeVersionId);
|
|
154
138
|
return {
|
|
155
139
|
workerName: context.workerName,
|
|
156
140
|
activeVersionId,
|
|
157
141
|
deployedVersionIds,
|
|
158
|
-
versions: parseCloudflareVersions(versions.
|
|
142
|
+
versions: parseCloudflareVersions(versions.data)
|
|
159
143
|
};
|
|
160
144
|
}
|
|
161
145
|
/** Return only versions that Cloudflare records as members of a production deployment. */
|
|
@@ -221,15 +205,16 @@ async function activateCloudflareExistingVersion(context, target, current) {
|
|
|
221
205
|
const expectedVersionId = current?.id ?? await readActiveCloudflareVersionId(context);
|
|
222
206
|
const ownerBeforeActivation = await readActiveCloudflareVersionId(context);
|
|
223
207
|
if (ownerBeforeActivation !== expectedVersionId) throw new Error(`Cloudflare production changed from ${expectedVersionId ?? "no active version"} to ${ownerBeforeActivation ?? "no active version"} before rollback activation. Retry from fresh deployment status.`);
|
|
224
|
-
await run(context,
|
|
225
|
-
"versions",
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
208
|
+
await run(context, {
|
|
209
|
+
type: "versions.deploy",
|
|
210
|
+
versions: [{
|
|
211
|
+
versionId: target.id,
|
|
212
|
+
percentage: 100
|
|
213
|
+
}],
|
|
214
|
+
configPath: context.configPath,
|
|
215
|
+
workerName: context.workerName,
|
|
216
|
+
message
|
|
217
|
+
}, { capture: false });
|
|
233
218
|
const knownTriggerConfigs = { [target.id]: targetTriggerConfig };
|
|
234
219
|
if (currentTriggerConfig && current) knownTriggerConfigs[current.id] = currentTriggerConfig;
|
|
235
220
|
const triggers = await stabilizeCloudflareVersionTriggers({
|
|
@@ -272,15 +257,16 @@ async function activateCloudflareExistingVersion(context, target, current) {
|
|
|
272
257
|
}
|
|
273
258
|
let recoveryFailure = null;
|
|
274
259
|
try {
|
|
275
|
-
await run(context,
|
|
276
|
-
"versions",
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
260
|
+
await run(context, {
|
|
261
|
+
type: "versions.deploy",
|
|
262
|
+
versions: [{
|
|
263
|
+
versionId: current.id,
|
|
264
|
+
percentage: 100
|
|
265
|
+
}],
|
|
266
|
+
configPath: context.configPath,
|
|
267
|
+
workerName: context.workerName,
|
|
268
|
+
message: `Void automatic rollback after trigger synchronization failed.`
|
|
269
|
+
}, { capture: false });
|
|
284
270
|
const restoredTriggers = await stabilizeCloudflareVersionTriggers({
|
|
285
271
|
runWrangler: context.runWrangler,
|
|
286
272
|
workerName: context.workerName,
|
|
@@ -305,27 +291,21 @@ async function activateCloudflareExistingVersion(context, target, current) {
|
|
|
305
291
|
throw new Error(recoveryFailure ? `Cloudflare trigger synchronization failed after activating ${target.id}, and automatic recovery also failed: ${recoveryFailure}` : `Cloudflare trigger synchronization failed after activating ${target.id}; traffic and triggers were restored to ${current.id}.`);
|
|
306
292
|
}
|
|
307
293
|
async function readActiveCloudflareVersionId(context) {
|
|
308
|
-
return parseActiveVersionId((await run(context,
|
|
309
|
-
"deployments",
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
])).stdout);
|
|
294
|
+
return parseActiveVersionId((await run(context, {
|
|
295
|
+
type: "deployments.status",
|
|
296
|
+
configPath: context.configPath,
|
|
297
|
+
workerName: context.workerName
|
|
298
|
+
})).data);
|
|
314
299
|
}
|
|
315
300
|
async function tailCloudflareWorker(context, options) {
|
|
316
|
-
|
|
317
|
-
"tail",
|
|
318
|
-
context.workerName,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
];
|
|
325
|
-
if (options.filter) args.push("--search", options.filter);
|
|
326
|
-
if (options.versionId) args.push("--version-id", options.versionId);
|
|
327
|
-
if (options.status) args.push("--status", options.status);
|
|
328
|
-
await run(context, args, { capture: false });
|
|
301
|
+
await run(context, {
|
|
302
|
+
type: "tail",
|
|
303
|
+
workerName: context.workerName,
|
|
304
|
+
configPath: context.configPath,
|
|
305
|
+
search: options.filter,
|
|
306
|
+
versionId: options.versionId,
|
|
307
|
+
status: options.status
|
|
308
|
+
}, { capture: false });
|
|
329
309
|
}
|
|
330
310
|
function listCloudflareDomains(root) {
|
|
331
311
|
return readWranglerCustomDomains(root).domains;
|
|
@@ -336,11 +316,6 @@ async function changeCloudflareDomain(root, hostname, action, runner, emptyDomai
|
|
|
336
316
|
const original = readFileSync(before.configPath, "utf-8");
|
|
337
317
|
const update = updateWranglerCustomDomain(root, hostname, action);
|
|
338
318
|
if (!update.modified) return update;
|
|
339
|
-
if (update.domains.length === 0 && !emptyDomainPublisher && !resolveCloudflareApiToken()) {
|
|
340
|
-
writeFileSync(before.configPath, original);
|
|
341
|
-
persistCloudflareConfig(root);
|
|
342
|
-
throw new Error("Deleting the final Cloudflare custom domain requires CLOUDFLARE_API_TOKEN for the empty-domain API update. Export a scoped token with Workers Scripts: Edit permission and retry. No local or remote state changed.");
|
|
343
|
-
}
|
|
344
319
|
const triggerConfigDir = mkdtempSync(join(tmpdir(), "void-domain-triggers-"));
|
|
345
320
|
const triggerConfigPath = join(triggerConfigDir, "wrangler.json");
|
|
346
321
|
const deployRoutes = async () => {
|
|
@@ -349,15 +324,11 @@ async function changeCloudflareDomain(root, hostname, action, runner, emptyDomai
|
|
|
349
324
|
return;
|
|
350
325
|
}
|
|
351
326
|
writeDomainTriggerConfig(context, before.configPath, triggerConfigPath);
|
|
352
|
-
await run(context,
|
|
353
|
-
"triggers",
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
"--env=",
|
|
358
|
-
"--name",
|
|
359
|
-
context.workerName
|
|
360
|
-
], { capture: false });
|
|
327
|
+
await run(context, {
|
|
328
|
+
type: "triggers.deploy",
|
|
329
|
+
configPath: triggerConfigPath,
|
|
330
|
+
workerName: context.workerName
|
|
331
|
+
}, { capture: false });
|
|
361
332
|
};
|
|
362
333
|
try {
|
|
363
334
|
await deployRoutes();
|
|
@@ -385,37 +356,16 @@ async function changeCloudflareDomain(root, hostname, action, runner, emptyDomai
|
|
|
385
356
|
return update;
|
|
386
357
|
}
|
|
387
358
|
/**
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
* domain. Direct API access is deliberately limited to an explicit API token;
|
|
392
|
-
* OAuth credential storage is Wrangler-private and must not be scraped.
|
|
359
|
+
* Publish an explicit empty Custom Domain set through the pinned cf transport.
|
|
360
|
+
* Trigger deploy omits empty domain sets; this operation must reconcile them
|
|
361
|
+
* explicitly using the same verified browser/API credentials as other commands.
|
|
393
362
|
*/
|
|
394
363
|
async function publishEmptyCloudflareCustomDomainSet(context) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
headers: {
|
|
400
|
-
Authorization: `Bearer ${token}`,
|
|
401
|
-
"Content-Type": "application/json"
|
|
402
|
-
},
|
|
403
|
-
body: JSON.stringify({
|
|
404
|
-
override_scope: true,
|
|
405
|
-
override_existing_origin: false,
|
|
406
|
-
override_existing_dns_record: false,
|
|
407
|
-
origins: []
|
|
408
|
-
}),
|
|
409
|
-
redirect: "error",
|
|
410
|
-
signal: AbortSignal.timeout(3e4)
|
|
364
|
+
await run(context, {
|
|
365
|
+
type: "triggers.clear-domains",
|
|
366
|
+
configPath: context.configPath,
|
|
367
|
+
workerName: context.workerName
|
|
411
368
|
});
|
|
412
|
-
let body;
|
|
413
|
-
try {
|
|
414
|
-
body = await response.json();
|
|
415
|
-
} catch {
|
|
416
|
-
throw new Error(`Cloudflare returned HTTP ${response.status} with a non-JSON custom-domain response.`);
|
|
417
|
-
}
|
|
418
|
-
if (!response.ok || typeof body !== "object" || body === null || body.success !== true) throw new Error(`Cloudflare rejected the empty custom-domain set (HTTP ${response.status}).`);
|
|
419
369
|
}
|
|
420
370
|
/** Adapt the direct empty-domain API call to the deployment package's result contract. */
|
|
421
371
|
function createCloudflareEmptyDomainPublisher(context) {
|
|
@@ -441,11 +391,11 @@ function createCloudflareEmptyDomainPublisher(context) {
|
|
|
441
391
|
function createCloudflareEmptyCronPublisher(context) {
|
|
442
392
|
return async () => {
|
|
443
393
|
try {
|
|
444
|
-
return await run(context,
|
|
445
|
-
"triggers",
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
394
|
+
return await run(context, {
|
|
395
|
+
type: "triggers.clear-crons",
|
|
396
|
+
configPath: context.configPath,
|
|
397
|
+
workerName: context.workerName
|
|
398
|
+
});
|
|
449
399
|
} catch (error) {
|
|
450
400
|
return {
|
|
451
401
|
status: 1,
|
|
@@ -456,9 +406,6 @@ function createCloudflareEmptyCronPublisher(context) {
|
|
|
456
406
|
}
|
|
457
407
|
};
|
|
458
408
|
}
|
|
459
|
-
function resolveCloudflareApiToken() {
|
|
460
|
-
return process.env.CLOUDFLARE_API_TOKEN || process.env.CF_API_TOKEN || void 0;
|
|
461
|
-
}
|
|
462
409
|
/**
|
|
463
410
|
* Build a route-only Wrangler config for a domain update. `triggers deploy`
|
|
464
411
|
* also reconciles cron, queue-consumer, and workflow triggers found in its
|
|
@@ -479,15 +426,6 @@ function writeDomainTriggerConfig(context, sourceConfigPath, triggerConfigPath)
|
|
|
479
426
|
if (compatibilityDate) config.compatibility_date = compatibilityDate;
|
|
480
427
|
writeFileSync(triggerConfigPath, `${JSON.stringify(config, null, 2)}\n`);
|
|
481
428
|
}
|
|
482
|
-
function targetArgs(context) {
|
|
483
|
-
return [
|
|
484
|
-
"-c",
|
|
485
|
-
context.configPath,
|
|
486
|
-
"--env=",
|
|
487
|
-
"--name",
|
|
488
|
-
context.workerName
|
|
489
|
-
];
|
|
490
|
-
}
|
|
491
429
|
async function run(context, args, options) {
|
|
492
430
|
const result = await Promise.resolve(context.runWrangler(args, {
|
|
493
431
|
capture: options?.capture ?? true,
|
|
@@ -495,44 +433,24 @@ async function run(context, args, options) {
|
|
|
495
433
|
}));
|
|
496
434
|
if (result.status !== 0 || result.signal != null || result.error !== void 0 && result.error !== null && result.error !== "") {
|
|
497
435
|
const detail = result.stderr.trim() || result.stdout.trim() || result.error || "unknown error";
|
|
498
|
-
throw new Error(`Cloudflare command failed (${args.
|
|
436
|
+
throw new Error(`Cloudflare command failed (${args.type}, exit ${result.status}): ${detail}`);
|
|
499
437
|
}
|
|
500
438
|
return result;
|
|
501
439
|
}
|
|
502
440
|
function createCloudflareOperationRunner(root, accountId, apiBaseUrl) {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
env
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
encoding: "utf-8",
|
|
517
|
-
input: options.input,
|
|
518
|
-
stdio: options.input !== void 0 ? [
|
|
519
|
-
"pipe",
|
|
520
|
-
options.capture ? "pipe" : "inherit",
|
|
521
|
-
options.capture ? "pipe" : "inherit"
|
|
522
|
-
] : options.capture ? [
|
|
523
|
-
"ignore",
|
|
524
|
-
"pipe",
|
|
525
|
-
"pipe"
|
|
526
|
-
] : "inherit"
|
|
527
|
-
});
|
|
528
|
-
return {
|
|
529
|
-
status: typeof result.status === "number" ? result.status : 1,
|
|
530
|
-
stdout: result.stdout ?? "",
|
|
531
|
-
stderr: result.stderr ?? "",
|
|
532
|
-
signal: result.signal ?? null,
|
|
533
|
-
error: result.error?.message ?? null
|
|
534
|
-
};
|
|
535
|
-
};
|
|
441
|
+
return createCloudflareProcessRunner({
|
|
442
|
+
root,
|
|
443
|
+
accountId,
|
|
444
|
+
apiBaseUrl,
|
|
445
|
+
env: () => {
|
|
446
|
+
const env = provisionEnv({
|
|
447
|
+
accountId,
|
|
448
|
+
apiBaseUrl
|
|
449
|
+
});
|
|
450
|
+
deleteEnvVarCaseAware(env, "WRANGLER_CI_OVERRIDE_NAME");
|
|
451
|
+
return env;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
536
454
|
}
|
|
537
455
|
function discoverRootWranglerConfig(root) {
|
|
538
456
|
return materializeCloudflareConfig(root);
|
|
@@ -551,11 +469,8 @@ function assertNoOperationConfigOverride(root) {
|
|
|
551
469
|
}
|
|
552
470
|
}
|
|
553
471
|
function parseJson(value, label) {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
} catch {
|
|
557
|
-
throw new Error(`${label} did not return valid JSON.`);
|
|
558
|
-
}
|
|
472
|
+
if (value === void 0) throw new Error(label + " did not return structured data.");
|
|
473
|
+
return value;
|
|
559
474
|
}
|
|
560
475
|
function errorMessage(error) {
|
|
561
476
|
return error instanceof Error ? error.message : String(error);
|