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
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
5
|
//#region src/cli/env-schema-probe.ts
|
|
6
6
|
/**
|
|
7
|
-
* The self-host `void deploy --
|
|
7
|
+
* The self-host `void deploy --platform cloudflare` orchestrator validates the REAL
|
|
8
8
|
* build artifact (`dist/ssr/wrangler.json` `vars`) instead of predicting it. Two
|
|
9
9
|
* pieces still need project code, and BOTH run here — in an ISOLATED SUBPROCESS —
|
|
10
10
|
* because the orchestrator runs in a credential-bearing PARENT (CF Access service
|
|
@@ -169,7 +169,7 @@ function emitResult(result) {
|
|
|
169
169
|
* facts. The import stays isolated because env.ts is arbitrary project code.
|
|
170
170
|
*/
|
|
171
171
|
async function runFactsChild(root) {
|
|
172
|
-
const { deriveSelfHostSchemaFacts, SelfHostSchemaError } = await import("../env-validation-
|
|
172
|
+
const { deriveSelfHostSchemaFacts, SelfHostSchemaError } = await import("../env-validation-DbTg7-ar.mjs");
|
|
173
173
|
try {
|
|
174
174
|
emitResult({
|
|
175
175
|
kind: "ok",
|
|
@@ -194,7 +194,7 @@ async function runFactsChild(root) {
|
|
|
194
194
|
* fault → fail closed as a values-free schema error.
|
|
195
195
|
*/
|
|
196
196
|
async function runValidateEmittedChild(root) {
|
|
197
|
-
const { computeInvalidEmittedKeys, readEmittedWorkerVars, SelfHostSchemaError } = await import("../env-validation-
|
|
197
|
+
const { computeInvalidEmittedKeys, readEmittedWorkerVars, SelfHostSchemaError } = await import("../env-validation-DbTg7-ar.mjs");
|
|
198
198
|
const emitted = readEmittedWorkerVars(root);
|
|
199
199
|
if (!emitted.ok) {
|
|
200
200
|
emitResult({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as join } from "./dist-BVqXeR_h.mjs";
|
|
2
2
|
import { t as cfAccessHeaders } from "./cf-access-DRsQRe6k.mjs";
|
|
3
|
-
import { a as getApiUrl } from "./auth-
|
|
3
|
+
import { a as getApiUrl } from "./auth-CSkdO2Bb.mjs";
|
|
4
4
|
import { s as normalizePlatformApiUrl } from "./platform-registry-QBa4DK32.mjs";
|
|
5
5
|
import { i as isCloudflareAccessChallenge, n as ensurePlatformAccessToken, t as ensureCloudflaredToken } from "./cf-access-P0iZnu0q.mjs";
|
|
6
6
|
import { n as getPackageDir } from "./agents-B_pX_HmQ.mjs";
|
|
@@ -152,10 +152,11 @@ function isPreflightRejection(error) {
|
|
|
152
152
|
* the server's precheck, the only atomic (project-locked) verdict: if
|
|
153
153
|
* an earlier attempt or a concurrent deploy is still in flight, the
|
|
154
154
|
* replay is rejected with 409 and surfaced as a deploy conflict
|
|
155
|
-
* naming the deployment id.
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
155
|
+
* naming the deployment id. Receipt-aware platforms additionally bind
|
|
156
|
+
* the stable invocation key to the accepted artifact, so an accepted
|
|
157
|
+
* request can be recovered without creating another execution. Older
|
|
158
|
+
* platforms retain their concurrency guard. No client-side deployment
|
|
159
|
+
* lookup may authorize replay or identify an unrelated conflicting row.
|
|
159
160
|
*/
|
|
160
161
|
const DEPLOY_POST_MAX_RETRIES = 3;
|
|
161
162
|
const DEPLOY_POST_BACKOFF_MS = [
|
|
@@ -163,6 +164,24 @@ const DEPLOY_POST_BACKOFF_MS = [
|
|
|
163
164
|
5e3,
|
|
164
165
|
1e4
|
|
165
166
|
];
|
|
167
|
+
const DEPLOY_OBSERVATION_TIMEOUT_MS = 3e4;
|
|
168
|
+
const DEPLOY_OBSERVATION_DEADLINE_MS = 18e5;
|
|
169
|
+
const DEPLOY_OBSERVATION_BACKOFF_MS = [
|
|
170
|
+
1e3,
|
|
171
|
+
2e3,
|
|
172
|
+
5e3,
|
|
173
|
+
1e4,
|
|
174
|
+
3e4
|
|
175
|
+
];
|
|
176
|
+
const DEPLOY_EVENT_MAX_BYTES = 1048576;
|
|
177
|
+
var DeploymentProtocolError = class extends Error {};
|
|
178
|
+
function parseDeployEvent(value) {
|
|
179
|
+
if (!value || typeof value !== "object" || !("event" in value) || typeof value.event !== "string") throw new DeploymentProtocolError("Invalid deployment event from platform.");
|
|
180
|
+
const event = value;
|
|
181
|
+
if (event.seq !== void 0 && (!Number.isSafeInteger(event.seq) || event.seq < 1)) throw new DeploymentProtocolError("Invalid deployment event sequence from platform.");
|
|
182
|
+
if (event.event === "start" && typeof event.deploymentId !== "string" || event.event === "done" && (typeof event.deployment !== "string" || typeof event.url !== "string" || !Array.isArray(event.urls) || !event.urls.every((url) => typeof url === "string") || !Number.isSafeInteger(event.assets) || event.assets < 0 || !Number.isSafeInteger(event.workers) || event.workers < 0 || event.published !== void 0 && typeof event.published !== "boolean") || event.event === "error" && (typeof event.message !== "string" || typeof event.step !== "string")) throw new DeploymentProtocolError("Invalid deployment result from platform.");
|
|
183
|
+
return event;
|
|
184
|
+
}
|
|
166
185
|
/**
|
|
167
186
|
* HTTP client for the Void platform API.
|
|
168
187
|
*/
|
|
@@ -237,10 +256,10 @@ var PlatformClient = class {
|
|
|
237
256
|
if (!res.ok) await throwPlatformApiError("Failed to list projects", res);
|
|
238
257
|
return res.json();
|
|
239
258
|
}
|
|
240
|
-
/** A lightweight project list for interactive linking
|
|
259
|
+
/** A lightweight project list for interactive linking. */
|
|
241
260
|
async listProjectChoices() {
|
|
242
261
|
const res = await this.request(`${this.baseUrl}/projects/choices`, { headers: { ...this.authHeaders } });
|
|
243
|
-
if (res.status === 404)
|
|
262
|
+
if (res.status === 404) throw new Error("This platform does not support project lookup. Ask its administrator to upgrade the platform runtime.");
|
|
244
263
|
if (!res.ok) await throwPlatformApiError("Failed to list project choices", res);
|
|
245
264
|
return res.json();
|
|
246
265
|
}
|
|
@@ -251,12 +270,12 @@ var PlatformClient = class {
|
|
|
251
270
|
if (!res.ok) await throwPlatformApiError("Failed to get project", res);
|
|
252
271
|
return res.json();
|
|
253
272
|
}
|
|
254
|
-
/**
|
|
273
|
+
/** Resolve a slug through the current platform contract. */
|
|
255
274
|
async findProjectBySlug(slug) {
|
|
256
275
|
const url = new URL(`${this.baseUrl}/projects/resolve`);
|
|
257
276
|
url.searchParams.set("slug", slug);
|
|
258
277
|
const res = await this.request(url.toString(), { headers: { ...this.authHeaders } });
|
|
259
|
-
if (res.status === 404)
|
|
278
|
+
if (res.status === 404) throw new Error("This platform does not support project lookup. Ask its administrator to upgrade the platform runtime.");
|
|
260
279
|
if (!res.ok) await throwPlatformApiError("Failed to resolve project", res);
|
|
261
280
|
return (await res.json()).project;
|
|
262
281
|
}
|
|
@@ -265,6 +284,31 @@ var PlatformClient = class {
|
|
|
265
284
|
if (!res.ok) await throwPlatformApiError("Failed to list project tokens", res, "owner");
|
|
266
285
|
return res.json();
|
|
267
286
|
}
|
|
287
|
+
async getProjectZeroTrust(projectId) {
|
|
288
|
+
const res = await this.request(`${this.baseUrl}/projects/${projectId}/zero-trust`, { headers: { ...this.authHeaders } });
|
|
289
|
+
if (!res.ok) await throwPlatformApiError("Failed to inspect project Zero Trust", res, "read");
|
|
290
|
+
return res.json();
|
|
291
|
+
}
|
|
292
|
+
async setProjectZeroTrust(projectId, protectedProject) {
|
|
293
|
+
const res = await this.request(`${this.baseUrl}/projects/${projectId}/zero-trust`, {
|
|
294
|
+
method: "PUT",
|
|
295
|
+
headers: {
|
|
296
|
+
"Content-Type": "application/json",
|
|
297
|
+
...this.authHeaders
|
|
298
|
+
},
|
|
299
|
+
body: JSON.stringify({ protected: protectedProject })
|
|
300
|
+
});
|
|
301
|
+
if (!res.ok) await throwPlatformApiError("Failed to update project Zero Trust", res, "settings");
|
|
302
|
+
return res.json();
|
|
303
|
+
}
|
|
304
|
+
async reconcileProjectZeroTrust(projectId) {
|
|
305
|
+
const res = await this.request(`${this.baseUrl}/projects/${projectId}/zero-trust/reconcile`, {
|
|
306
|
+
method: "POST",
|
|
307
|
+
headers: { ...this.authHeaders }
|
|
308
|
+
});
|
|
309
|
+
if (!res.ok) await throwPlatformApiError("Failed to reconcile project Zero Trust", res, "settings");
|
|
310
|
+
return res.json();
|
|
311
|
+
}
|
|
268
312
|
async createProjectToken(projectId, input) {
|
|
269
313
|
const res = await this.request(`${this.baseUrl}/projects/${projectId}/tokens`, {
|
|
270
314
|
method: "POST",
|
|
@@ -481,7 +525,8 @@ var PlatformClient = class {
|
|
|
481
525
|
method: "POST",
|
|
482
526
|
headers: {
|
|
483
527
|
"Content-Type": "application/json",
|
|
484
|
-
...this.authHeaders
|
|
528
|
+
...this.authHeaders,
|
|
529
|
+
"x-void-deploy-idempotency-key": crypto.randomUUID()
|
|
485
530
|
},
|
|
486
531
|
body: JSON.stringify(payload)
|
|
487
532
|
});
|
|
@@ -543,6 +588,24 @@ var PlatformClient = class {
|
|
|
543
588
|
}
|
|
544
589
|
throw new PlatformApiError("Deploy failed", res.status, body, isCloudflareAccessChallenge(res) ? void 0 : "deploy");
|
|
545
590
|
}
|
|
591
|
+
const receipt = res.headers.get("x-void-deployment-id");
|
|
592
|
+
if (receipt !== null && !/^[A-Za-z0-9_-]{1,128}$/.test(receipt)) {
|
|
593
|
+
res.body?.cancel().catch(() => {});
|
|
594
|
+
throw new Error("Invalid deployment receipt from platform.");
|
|
595
|
+
}
|
|
596
|
+
let cursor = 0;
|
|
597
|
+
let terminal = false;
|
|
598
|
+
if (!res.body) {
|
|
599
|
+
if (receipt) {
|
|
600
|
+
yield {
|
|
601
|
+
event: "start",
|
|
602
|
+
deploymentId: receipt
|
|
603
|
+
};
|
|
604
|
+
yield* this.followDeploymentEvents(projectId, receipt, cursor);
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
throw new Error("Platform returned no deployment event stream.");
|
|
608
|
+
}
|
|
546
609
|
const reader = res.body.getReader();
|
|
547
610
|
const decoder = new TextDecoder();
|
|
548
611
|
let buffer = "";
|
|
@@ -551,10 +614,49 @@ var PlatformClient = class {
|
|
|
551
614
|
const startedAt = Date.now();
|
|
552
615
|
let eventCount = 0;
|
|
553
616
|
let lastEventName = "<none>";
|
|
617
|
+
let streamFinished = false;
|
|
618
|
+
let readTimer;
|
|
619
|
+
const read = async () => {
|
|
620
|
+
if (!receipt) return reader.read();
|
|
621
|
+
try {
|
|
622
|
+
return await Promise.race([reader.read(), new Promise((_, reject) => {
|
|
623
|
+
readTimer = setTimeout(() => reject(/* @__PURE__ */ new TypeError("Deployment event stream timed out.")), DEPLOY_OBSERVATION_TIMEOUT_MS);
|
|
624
|
+
})]);
|
|
625
|
+
} finally {
|
|
626
|
+
clearTimeout(readTimer);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
const parseLine = (line) => {
|
|
630
|
+
if (Buffer.byteLength(line) > DEPLOY_EVENT_MAX_BYTES) throw new DeploymentProtocolError("Deployment event exceeds the platform response limit.");
|
|
631
|
+
if (!line.trim()) return null;
|
|
632
|
+
const event = parseDeployEvent(JSON.parse(line));
|
|
633
|
+
if (event.seq !== void 0) {
|
|
634
|
+
if (event.seq <= cursor) return null;
|
|
635
|
+
cursor = event.seq;
|
|
636
|
+
}
|
|
637
|
+
eventCount++;
|
|
638
|
+
lastEventName = event.event;
|
|
639
|
+
cliLog?.info("deploy_event", {
|
|
640
|
+
eventCount,
|
|
641
|
+
event: lastEventName,
|
|
642
|
+
raw: line.slice(0, 200)
|
|
643
|
+
});
|
|
644
|
+
if (receipt && event.event === "start") return null;
|
|
645
|
+
terminal = event.event === "done" || event.event === "error";
|
|
646
|
+
return event;
|
|
647
|
+
};
|
|
554
648
|
try {
|
|
649
|
+
if (receipt) yield {
|
|
650
|
+
event: "start",
|
|
651
|
+
deploymentId: receipt
|
|
652
|
+
};
|
|
555
653
|
while (true) {
|
|
556
|
-
const { done, value } = await
|
|
654
|
+
const { done, value } = await read();
|
|
557
655
|
if (done) {
|
|
656
|
+
streamFinished = true;
|
|
657
|
+
buffer += decoder.decode();
|
|
658
|
+
const event = parseLine(buffer);
|
|
659
|
+
if (event) yield event;
|
|
558
660
|
cliLog?.info("deploy_stream_eof", {
|
|
559
661
|
bytesRead,
|
|
560
662
|
eventCount,
|
|
@@ -572,18 +674,13 @@ var PlatformClient = class {
|
|
|
572
674
|
while ((newlineIdx = buffer.indexOf("\n")) !== -1) {
|
|
573
675
|
const line = buffer.slice(0, newlineIdx);
|
|
574
676
|
buffer = buffer.slice(newlineIdx + 1);
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
eventCount++;
|
|
578
|
-
lastEventName = event.event ?? "<no-event-field>";
|
|
579
|
-
cliLog?.info("deploy_event", {
|
|
580
|
-
eventCount,
|
|
581
|
-
event: lastEventName,
|
|
582
|
-
raw: line.slice(0, 200)
|
|
583
|
-
});
|
|
677
|
+
const event = parseLine(line);
|
|
678
|
+
if (event) {
|
|
584
679
|
yield event;
|
|
680
|
+
if (terminal) return;
|
|
585
681
|
}
|
|
586
682
|
}
|
|
683
|
+
if (Buffer.byteLength(buffer) > DEPLOY_EVENT_MAX_BYTES) throw new DeploymentProtocolError("Deployment event exceeds the platform response limit.");
|
|
587
684
|
}
|
|
588
685
|
} catch (err) {
|
|
589
686
|
cliLog?.error("deploy_stream_error", err, {
|
|
@@ -591,8 +688,55 @@ var PlatformClient = class {
|
|
|
591
688
|
eventCount,
|
|
592
689
|
lastEvent: lastEventName
|
|
593
690
|
});
|
|
594
|
-
throw err;
|
|
691
|
+
if (!receipt || err instanceof DeploymentProtocolError || err instanceof SyntaxError || err instanceof DOMException && err.name === "AbortError") throw err;
|
|
692
|
+
} finally {
|
|
693
|
+
clearTimeout(readTimer);
|
|
694
|
+
if (!streamFinished) reader.cancel().catch(() => {});
|
|
695
|
+
reader.releaseLock();
|
|
696
|
+
}
|
|
697
|
+
if (receipt && !terminal) yield* this.followDeploymentEvents(projectId, receipt, cursor);
|
|
698
|
+
}
|
|
699
|
+
async *followDeploymentEvents(projectId, deploymentId, since) {
|
|
700
|
+
let cursor = since;
|
|
701
|
+
let failures = 0;
|
|
702
|
+
const deadline = Date.now() + DEPLOY_OBSERVATION_DEADLINE_MS;
|
|
703
|
+
while (Date.now() < deadline) {
|
|
704
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(projectId)}/deployments/${encodeURIComponent(deploymentId)}/events?since=${cursor}`;
|
|
705
|
+
let page;
|
|
706
|
+
try {
|
|
707
|
+
const response = await this.request(url, {
|
|
708
|
+
headers: { ...this.authHeaders },
|
|
709
|
+
signal: AbortSignal.timeout(DEPLOY_OBSERVATION_TIMEOUT_MS)
|
|
710
|
+
});
|
|
711
|
+
if (!response.ok) await throwPlatformApiError("Failed to observe deployment", response, "read");
|
|
712
|
+
page = await response.json();
|
|
713
|
+
} catch (err) {
|
|
714
|
+
if (!(err instanceof TypeError || err instanceof DOMException && err.name === "TimeoutError" || err instanceof PlatformApiError && (err.status === 429 || err.status >= 500)) || failures >= DEPLOY_OBSERVATION_BACKOFF_MS.length) throw err;
|
|
715
|
+
const delayMs = DEPLOY_OBSERVATION_BACKOFF_MS[failures++];
|
|
716
|
+
this.cliLog?.warn("deploy_observation_retry", {
|
|
717
|
+
deploymentId,
|
|
718
|
+
cursor,
|
|
719
|
+
delayMs
|
|
720
|
+
});
|
|
721
|
+
await sleep(delayMs);
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
failures = 0;
|
|
725
|
+
if (!page || page.deploymentId !== deploymentId || !Array.isArray(page.events) || page.events.length > 1e3 || !Number.isSafeInteger(page.lastSeq) || page.lastSeq < cursor || typeof page.terminal !== "boolean") throw new Error("Invalid deployment observation response from platform.");
|
|
726
|
+
let previousSeq = 0;
|
|
727
|
+
for (const row of page.events) {
|
|
728
|
+
if (!row || !Number.isSafeInteger(row.seq) || row.seq <= previousSeq || row.seq > page.lastSeq) throw new Error("Invalid deployment observation sequence from platform.");
|
|
729
|
+
previousSeq = row.seq;
|
|
730
|
+
const event = parseDeployEvent(row.event);
|
|
731
|
+
if (row.seq <= cursor) continue;
|
|
732
|
+
cursor = row.seq;
|
|
733
|
+
if (event.event !== "start") yield event;
|
|
734
|
+
if (event.event === "done" || event.event === "error") return;
|
|
735
|
+
}
|
|
736
|
+
if (page.terminal) throw new Error("Platform finished deployment without a terminal result.");
|
|
737
|
+
await sleep(1e3);
|
|
595
738
|
}
|
|
739
|
+
throw new Error(`Timed out observing deployment ${deploymentId}. Inspect with \`void project status\`.`);
|
|
596
740
|
}
|
|
597
741
|
async listSecrets(projectId) {
|
|
598
742
|
const res = await this.request(`${this.baseUrl}/projects/${projectId}/secrets`, { headers: { ...this.authHeaders } });
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as resolveWranglerArgv } from "./preset-UHj9ARyP.mjs";
|
|
1
|
+
import { c as resolveCloudflareOperationArgv, n as decodeCloudflareOperationResult, r as encodeCloudflareOperation } from "./cloudflare-process-B-wekeR6.mjs";
|
|
3
2
|
import { execFile, spawn, spawnSync } from "node:child_process";
|
|
4
3
|
//#region src/cli/cloudflare-auth.ts
|
|
5
4
|
var CloudflareAuthenticationError = class extends Error {
|
|
@@ -23,27 +22,25 @@ async function ensureCloudflareAuthentication(options) {
|
|
|
23
22
|
if (overrides.length > 0) throw new CloudflareAuthenticationError(`Cloudflare browser login cannot replace credentials supplied by ${overrides.join(", ")}. Remove these overrides from this shell and rerun \`void cloudflare login\`.`, "environment-credentials");
|
|
24
23
|
}
|
|
25
24
|
if (options.acceptApiToken && !options.requireAccounts && (process.env.CLOUDFLARE_API_TOKEN?.trim() || process.env.CF_API_TOKEN?.trim())) return { accounts: [] };
|
|
26
|
-
const run = async (
|
|
25
|
+
const run = async (operation, capture) => {
|
|
27
26
|
if (options.beforeRun && !options.beforeRun()) throw new CloudflareAuthenticationError("", "uploader-changed");
|
|
28
|
-
return await options.runWrangler(
|
|
27
|
+
return await options.runWrangler(operation, capture);
|
|
28
|
+
};
|
|
29
|
+
const whoami = {
|
|
30
|
+
type: "auth.whoami",
|
|
31
|
+
...options.configPath ? { configPath: options.configPath } : {}
|
|
29
32
|
};
|
|
30
|
-
const whoamiArgs = [
|
|
31
|
-
"whoami",
|
|
32
|
-
"--json",
|
|
33
|
-
...options.whoamiArgs ?? []
|
|
34
|
-
];
|
|
35
33
|
const readSession = async () => {
|
|
36
|
-
const result = await run(
|
|
34
|
+
const result = await run(whoami, true);
|
|
37
35
|
if (!isCleanExit(result)) return null;
|
|
38
|
-
const session = parseCloudflareAuthSession(result.
|
|
36
|
+
const session = parseCloudflareAuthSession(result.data);
|
|
39
37
|
if (options.requireAccounts) return session && session.accounts.length > 0 ? session : null;
|
|
40
|
-
return session
|
|
38
|
+
return session;
|
|
41
39
|
};
|
|
42
40
|
const existing = options.forceLogin ? null : await readSession();
|
|
43
41
|
if (existing) return existing;
|
|
44
42
|
if (!(options.interactive ?? (process.stdin.isTTY && process.stdout.isTTY))) throw new CloudflareAuthenticationError("Cloudflare authentication is required. Set CLOUDFLARE_API_TOKEN in CI, or run `void cloudflare login` in an interactive terminal.", "not-authenticated");
|
|
45
|
-
|
|
46
|
-
if (!isCleanExit(await run(["login"], false))) throw new CloudflareAuthenticationError("Cloudflare browser sign-in did not complete. Run `void cloudflare login` to try again.", "login");
|
|
43
|
+
if (!isCleanExit(await run({ type: "auth.login" }, false))) throw new CloudflareAuthenticationError("Cloudflare browser sign-in did not complete. Run `void cloudflare login` to try again.", "login");
|
|
47
44
|
const authenticated = await readSession();
|
|
48
45
|
if (!authenticated) throw new CloudflareAuthenticationError("Cloudflare sign-in completed without a usable session. Run `void cloudflare login` to try again.", "not-authenticated");
|
|
49
46
|
return authenticated;
|
|
@@ -55,13 +52,7 @@ function cloudflareCredentialOverrides(source = process.env) {
|
|
|
55
52
|
const email = ["CLOUDFLARE_EMAIL", "CF_EMAIL"].find((key) => Boolean(source[key]));
|
|
56
53
|
return [...tokens, ...key && email ? [key, email] : []];
|
|
57
54
|
}
|
|
58
|
-
function parseCloudflareAuthSession(
|
|
59
|
-
let value;
|
|
60
|
-
try {
|
|
61
|
-
value = JSON.parse(stdout.trim());
|
|
62
|
-
} catch {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
55
|
+
function parseCloudflareAuthSession(value) {
|
|
65
56
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
66
57
|
const record = value;
|
|
67
58
|
if (record.loggedIn !== true || !Array.isArray(record.accounts)) return null;
|
|
@@ -82,39 +73,49 @@ function parseCloudflareAuthSession(stdout) {
|
|
|
82
73
|
};
|
|
83
74
|
}
|
|
84
75
|
function createBundledCloudflareAuthRunner(root) {
|
|
85
|
-
const [command, ...prefix] =
|
|
86
|
-
return (
|
|
87
|
-
const
|
|
76
|
+
const [command, ...prefix] = resolveCloudflareOperationArgv(root);
|
|
77
|
+
return (operation, capture) => {
|
|
78
|
+
const args = encodeCloudflareOperation(operation);
|
|
79
|
+
const env = cloudflareAuthCommandEnvironment(operation);
|
|
80
|
+
const streaming = cloudflareAuthNeedsTerminal(operation);
|
|
88
81
|
const result = spawnSync(command, [...prefix, ...args], {
|
|
89
82
|
cwd: root,
|
|
90
83
|
encoding: "utf8",
|
|
91
84
|
env,
|
|
92
85
|
maxBuffer: 10485760,
|
|
93
86
|
shell: false,
|
|
94
|
-
stdio:
|
|
87
|
+
stdio: streaming ? "inherit" : [
|
|
95
88
|
"ignore",
|
|
96
89
|
"pipe",
|
|
97
90
|
"pipe"
|
|
98
|
-
]
|
|
91
|
+
],
|
|
99
92
|
timeout: 6e5,
|
|
100
93
|
windowsHide: true
|
|
101
94
|
});
|
|
102
|
-
|
|
95
|
+
const raw = {
|
|
103
96
|
status: result.status,
|
|
104
|
-
stderr:
|
|
105
|
-
stdout:
|
|
97
|
+
stderr: streaming ? "" : result.stderr || "",
|
|
98
|
+
stdout: streaming ? "" : result.stdout || "",
|
|
106
99
|
signal: result.signal,
|
|
107
100
|
error: result.error?.message
|
|
108
101
|
};
|
|
102
|
+
if (streaming) return raw;
|
|
103
|
+
const decoded = decodeCloudflareOperationResult(raw);
|
|
104
|
+
if (!capture) {
|
|
105
|
+
if (decoded.stdout) process.stdout.write(decoded.stdout);
|
|
106
|
+
if (decoded.stderr) process.stderr.write(decoded.stderr);
|
|
107
|
+
}
|
|
108
|
+
return decoded;
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
/** Run a captured auth command without blocking terminal input or exposing credentials. */
|
|
112
|
-
function runCloudflareAuthCommand(root,
|
|
113
|
-
const [command, ...prefix] =
|
|
114
|
-
|
|
112
|
+
function runCloudflareAuthCommand(root, operation, signal) {
|
|
113
|
+
const [command, ...prefix] = resolveCloudflareOperationArgv(root);
|
|
114
|
+
const args = encodeCloudflareOperation(operation);
|
|
115
|
+
if (cloudflareAuthNeedsTerminal(operation)) return new Promise((resolve) => {
|
|
115
116
|
const child = spawn(command, [...prefix, ...args], {
|
|
116
117
|
cwd: root,
|
|
117
|
-
env: cloudflareAuthCommandEnvironment(
|
|
118
|
+
env: cloudflareAuthCommandEnvironment(operation),
|
|
118
119
|
shell: false,
|
|
119
120
|
signal,
|
|
120
121
|
stdio: "inherit",
|
|
@@ -142,29 +143,29 @@ function runCloudflareAuthCommand(root, args, signal) {
|
|
|
142
143
|
execFile(command, [...prefix, ...args], {
|
|
143
144
|
cwd: root,
|
|
144
145
|
encoding: "utf8",
|
|
145
|
-
env: cloudflareAuthCommandEnvironment(
|
|
146
|
+
env: cloudflareAuthCommandEnvironment(operation),
|
|
146
147
|
maxBuffer: 10485760,
|
|
147
148
|
shell: false,
|
|
148
149
|
signal,
|
|
149
150
|
timeout: 6e5,
|
|
150
151
|
windowsHide: true
|
|
151
152
|
}, (error, stdout, stderr) => {
|
|
152
|
-
resolve({
|
|
153
|
+
resolve(decodeCloudflareOperationResult({
|
|
153
154
|
status: error ? typeof error.code === "number" ? error.code : null : 0,
|
|
154
155
|
stderr,
|
|
155
156
|
stdout,
|
|
156
157
|
signal: error?.signal,
|
|
157
158
|
error: error?.message
|
|
158
|
-
});
|
|
159
|
+
}));
|
|
159
160
|
}).stdin?.end();
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
|
-
function cloudflareAuthCommandEnvironment(
|
|
163
|
+
function cloudflareAuthCommandEnvironment(operation, source = process.env) {
|
|
163
164
|
return cloudflareAuthEnvironment(source);
|
|
164
165
|
}
|
|
165
166
|
/** Browser login must display cf's prompts before it completes. */
|
|
166
|
-
function cloudflareAuthNeedsTerminal(
|
|
167
|
-
return
|
|
167
|
+
function cloudflareAuthNeedsTerminal(operation) {
|
|
168
|
+
return operation.type === "auth.login";
|
|
168
169
|
}
|
|
169
170
|
function cloudflareAuthEnvironment(source = process.env) {
|
|
170
171
|
const env = { ...source };
|
|
@@ -183,8 +184,5 @@ function cloudflareAuthEnvironment(source = process.env) {
|
|
|
183
184
|
function isCleanExit(result) {
|
|
184
185
|
return result.status === 0 && result.signal == null && (result.error == null || result.error === "");
|
|
185
186
|
}
|
|
186
|
-
function announceCloudflareLogin() {
|
|
187
|
-
log.info("Opening Cloudflare login in your browser. Compare the code below with the browser prompt. Press Ctrl+C to cancel.");
|
|
188
|
-
}
|
|
189
187
|
//#endregion
|
|
190
|
-
export {
|
|
188
|
+
export { parseCloudflareAuthSession as a, ensureCloudflareAuthentication as i, cloudflareCredentialOverrides as n, runCloudflareAuthCommand as o, createBundledCloudflareAuthRunner as r, CloudflareAuthenticationError as t };
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import { t as basename } from "./dist-BVqXeR_h.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { j as log } from "./dist-
|
|
4
|
-
import { a as
|
|
2
|
+
import { y as readRootWranglerConfig } from "./wrangler-7K-bW_DL.mjs";
|
|
3
|
+
import { j as log } from "./dist-CTBk70IR.mjs";
|
|
4
|
+
import { a as parseCloudflareAuthSession, i as ensureCloudflareAuthentication, n as cloudflareCredentialOverrides, r as createBundledCloudflareAuthRunner } from "./cloudflare-auth-Qdc7tw8F.mjs";
|
|
5
5
|
//#region src/cli/cloudflare-cmd.ts
|
|
6
6
|
async function runCloudflareCommand(root, args) {
|
|
7
7
|
const runWrangler = createBundledCloudflareAuthRunner(root);
|
|
8
8
|
switch (args.subcommand) {
|
|
9
|
-
case "login":
|
|
10
|
-
|
|
9
|
+
case "login":
|
|
10
|
+
await ensureCloudflareAuthentication({
|
|
11
11
|
runWrangler,
|
|
12
12
|
forceLogin: true
|
|
13
13
|
});
|
|
14
|
-
log
|
|
14
|
+
console.log("Successfully logged in.");
|
|
15
15
|
return;
|
|
16
|
-
}
|
|
17
16
|
case "status": {
|
|
18
|
-
const result = await runWrangler(
|
|
19
|
-
const session = result.status === 0 && !result.signal && !result.error ? parseCloudflareAuthSession(result.
|
|
17
|
+
const result = await runWrangler({ type: "auth.whoami" }, true);
|
|
18
|
+
const session = result.status === 0 && !result.signal && !result.error ? parseCloudflareAuthSession(result.data) : null;
|
|
20
19
|
if (!session) throw new Error("Not signed in to Cloudflare. Run `void cloudflare login`.");
|
|
21
20
|
log.info(formatSession(root, session));
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
23
|
case "logout": {
|
|
25
|
-
if ((await runWrangler(
|
|
24
|
+
if ((await runWrangler({ type: "auth.logout" }, true)).status !== 0) throw new Error("Could not remove the local Cloudflare browser session.");
|
|
26
25
|
const overrides = cloudflareCredentialOverrides();
|
|
27
26
|
if (overrides.length > 0) log.warn(`Removed the local Cloudflare browser session. Environment credentials remain active: ${overrides.join(", ")}.`);
|
|
28
27
|
else log.success("Signed out of Cloudflare.");
|