@builtbyfriends/bwf 0.0.0-stage → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS_TEMPLATE.md +4 -0
- package/LICENSE +22 -0
- package/README.md +48 -2
- package/dist/account-cmd-Cj0I2_bJ.mjs +45 -0
- package/dist/agents-BLiMq9E1.mjs +113 -0
- package/dist/application-analysis-C9Ck2Yeg.mjs +1498 -0
- package/dist/application-routing-DbR-W5lG.mjs +25 -0
- package/dist/atomic-write-DA6eD1Kp.mjs +17 -0
- package/dist/auth-BKsUmWbT.d.mts +77 -0
- package/dist/auth-DkvoW5hB.mjs +33 -0
- package/dist/auth-aKyIWkdS.mjs +1 -0
- package/dist/auth-client-6-Ft9i9T.d.mts +5 -0
- package/dist/auth-client-DwCdwKbw.mjs +5 -0
- package/dist/auth-client-react-CJdeErvM.mjs +5 -0
- package/dist/auth-client-react-DvQLe5Zb.d.mts +5 -0
- package/dist/auth-link-D-DddkCQ.mjs +26 -0
- package/dist/auth-migrations-DDeifS3v.mjs +206 -0
- package/dist/auth-router-tWzIwf8f.mjs +66 -0
- package/dist/auth-xnkmpZUl.mjs +311 -0
- package/dist/base64-ikl9yBy3.mjs +15 -0
- package/dist/better-auth-shared-Br6TNaYJ.mjs +473 -0
- package/dist/better-auth-shared-CsBNvPOU.d.mts +56 -0
- package/dist/build-cmd-BnZezraT.mjs +153 -0
- package/dist/build-output-dir-Clj_unKN.mjs +402 -0
- package/dist/cancel-deploy-DKAj5U1Z.mjs +57 -0
- package/dist/cf-access-Bhz9wX6p.mjs +131 -0
- package/dist/cf-access-CUP5L08W.mjs +67 -0
- package/dist/cf-build-output-DA6uJomQ.mjs +1 -0
- package/dist/cf-build-output-DNQTwMNU.mjs +438 -0
- package/dist/cf-command-values-2kOtxMo1.mjs +26 -0
- package/dist/cf-config-migrate-COOCi4Ge.mjs +330 -0
- package/dist/cf-worker-settings-CIh4t_yG.mjs +41 -0
- package/dist/cli/cli.d.mts +1 -0
- package/dist/cli/cli.mjs +88 -0
- package/dist/cli/cloudflare-operation-process.d.mts +1 -0
- package/dist/cli/cloudflare-operation-process.mjs +1284 -0
- package/dist/cli/env-schema-probe.d.mts +43 -0
- package/dist/cli/env-schema-probe.mjs +165 -0
- package/dist/cli-main-HeXRQml6.mjs +1846 -0
- package/dist/client-D3D5RM5h.mjs +940 -0
- package/dist/client-VF2Nzc7Z.mjs +1 -0
- package/dist/cloudflare-auth-jb-1e43r.mjs +152 -0
- package/dist/cloudflare-cmd-B62t8Fm-.mjs +59 -0
- package/dist/cloudflare-config-i8yanry0.mjs +186 -0
- package/dist/cloudflare-connect-x7IsYghw.mjs +55 -0
- package/dist/cloudflare-operations-BeK7bhnP.mjs +627 -0
- package/dist/cloudflare-operations-C3Uu0Emj.mjs +1 -0
- package/dist/cloudflare-process-Cc6oiJqk.mjs +309 -0
- package/dist/cloudflare-user-output-CqONaAbP.mjs +19 -0
- package/dist/collect-8i0wU63d.mjs +1 -0
- package/dist/collect-C6Blu9yw.mjs +48 -0
- package/dist/config-CN_RFRkS.mjs +86 -0
- package/dist/config-D5G-Tx6o.mjs +1 -0
- package/dist/config-DOaFIK3w.mjs +88 -0
- package/dist/config-entry.d.mts +202 -0
- package/dist/config-entry.mjs +6 -0
- package/dist/config-tNx0HlFv.mjs +516 -0
- package/dist/connect-hLPNppu3.mjs +84 -0
- package/dist/create-project-B35ux-LA.mjs +126 -0
- package/dist/create-project-tJ1KwNss.mjs +1 -0
- package/dist/database-provider-DkZo4VwN.mjs +5 -0
- package/dist/database-provider.d.mts +25 -0
- package/dist/database-provider.mjs +1 -0
- package/dist/db-BH_md90k.mjs +1735 -0
- package/dist/delete-BSKI7V23.mjs +65 -0
- package/dist/deploy-C8KHBNsh.mjs +6512 -0
- package/dist/deploy-DCZBr7Ey.mjs +2 -0
- package/dist/deploy.d.mts +31 -0
- package/dist/deploy.mjs +118 -0
- package/dist/dev-inbox-I0nqTCdf.mjs +216 -0
- package/dist/discover-DJPmQcL5.mjs +36 -0
- package/dist/discover-EVuydEoM.mjs +1 -0
- package/dist/dist-B6eN80gc.mjs +1612 -0
- package/dist/dist-Cp4b1_T9.mjs +1 -0
- package/dist/dist-DMYe8CZJ.mjs +48 -0
- package/dist/dist-STQXl8ck.mjs +1878 -0
- package/dist/domain-C4ZhEiFG.mjs +149 -0
- package/dist/dotenv-4NdUCXbB.mjs +156 -0
- package/dist/drizzle-DqVFXtlc.mjs +306 -0
- package/dist/drizzle-Ds5P0n-S.mjs +1 -0
- package/dist/edge.d.mts +2 -0
- package/dist/edge.mjs +1 -0
- package/dist/email-B3TWga7x.mjs +742 -0
- package/dist/email-C_ATvNIG.mjs +2865 -0
- package/dist/email-cloudflare-DuAc9zny.mjs +854 -0
- package/dist/email-protocol-CZ0bAkI8.mjs +81 -0
- package/dist/env-CTAo8ifZ.mjs +73 -0
- package/dist/env-DUyTzroe.mjs +88 -0
- package/dist/env-Dl4Wggec.mjs +71 -0
- package/dist/env-helpers-BX0APszT.mjs +135 -0
- package/dist/env-helpers-U56xuFgL.d.mts +20 -0
- package/dist/env-mask-BsHxq3R8.mjs +46 -0
- package/dist/env-public-Cw_xPi1D.d.mts +119 -0
- package/dist/env-raw-Bo6TtrHU.mjs +41 -0
- package/dist/env-types-Bg-dTh8u.mjs +56 -0
- package/dist/env-validation-BufZConV.mjs +488 -0
- package/dist/env-validation-DPqDo4DU.mjs +1 -0
- package/dist/fetch-CBgyyhzm.d.mts +87 -0
- package/dist/fetch-error-DmlRM6e4.mjs +264 -0
- package/dist/fetch-stream-2GUN3YN1.mjs +102 -0
- package/dist/fetch-stream-bUXynOyZ.d.mts +32 -0
- package/dist/fetch-tpPiSK10.mjs +25 -0
- package/dist/gen-dc13IRXh.mjs +509 -0
- package/dist/gen-kQqhFyOP.mjs +1 -0
- package/dist/generate-BgtlYpKg.mjs +1 -0
- package/dist/generate-Da9mWKzU.mjs +80 -0
- package/dist/generated-wrangler-config-CoDaaFsA.mjs +17 -0
- package/dist/git-metadata-Cukp5kV5.mjs +82 -0
- package/dist/github-cmd-DT5Onu6E.mjs +690 -0
- package/dist/handler-CJ7DiiRF.mjs +161 -0
- package/dist/handler-CVsIfRv7.d.mts +279 -0
- package/dist/help-Bpv6Qeqn.mjs +1946 -0
- package/dist/help-CfZ4Bsw5.mjs +1 -0
- package/dist/inbound-CqubE-9T.d.mts +311 -0
- package/dist/inbound-lHugZPuK.mjs +509 -0
- package/dist/index.d.mts +64 -0
- package/dist/index.mjs +4163 -0
- package/dist/info-CLQoCenb.mjs +109 -0
- package/dist/init-DRUR0j8C.mjs +2486 -0
- package/dist/limits-CMmYT2l8.d.mts +16 -0
- package/dist/limits-D27Lp6FP.mjs +46 -0
- package/dist/link-DinwJnon.mjs +52 -0
- package/dist/list-B84t4BhW.mjs +130 -0
- package/dist/live-Dui0-aj_.d.mts +105 -0
- package/dist/live-saC8barp.mjs +410 -0
- package/dist/load-user-env-g0ahkZcj.mjs +34 -0
- package/dist/local-d1-C3EeOV7-.mjs +103 -0
- package/dist/log-JDnPc0cF.mjs +23 -0
- package/dist/login-Bl5lH8nH.mjs +87 -0
- package/dist/login-DoI7AsbY.mjs +1 -0
- package/dist/logs-CaT2N2f7.mjs +129 -0
- package/dist/migrate-CbGscX-V.mjs +125 -0
- package/dist/migrate-Ce3JKLVs.mjs +1 -0
- package/dist/migration-handler-22qiuWPq.mjs +469 -0
- package/dist/migration-handler-Bb2BJh6g.d.mts +38 -0
- package/dist/mime-BMUN_QKG.mjs +1004 -0
- package/dist/mysql-migration-sql-CNuBSqdx.mjs +239 -0
- package/dist/neon-CJzQSycr.mjs +52 -0
- package/dist/node-tfv-3v0V.mjs +64 -0
- package/dist/operator-ai-logging-Ay7M4KWw.mjs +121 -0
- package/dist/operator-args-BFg32YyY.mjs +722 -0
- package/dist/operator-auth-DdYZYEkO.mjs +47 -0
- package/dist/operator-client-DBujdELO.mjs +82 -0
- package/dist/operator-cmd-C73WWJBl.mjs +443 -0
- package/dist/operator-cmd-CdZytuAF.mjs +1 -0
- package/dist/output-Bb34lF0w.mjs +173 -0
- package/dist/output-CVolXKC1.mjs +1 -0
- package/dist/package-DO4d3Qz5.mjs +1444 -0
- package/dist/package-json-DvS6IFRv.mjs +43 -0
- package/dist/pg-DoyPxa_X.mjs +15 -0
- package/dist/picocolors-D1NxSLw-.mjs +71 -0
- package/dist/plan-BHNt1QhK.mjs +1 -0
- package/dist/plan-DX4_-OM5.mjs +58 -0
- package/dist/platform-args-NI_vfWvD.mjs +538 -0
- package/dist/platform-args-ZC1-A1N9.mjs +1 -0
- package/dist/platform-auth-config-d-lY5-aY.mjs +371 -0
- package/dist/platform-auth-protection-Dhw7lUCk.mjs +231 -0
- package/dist/platform-auth-recovery-DaCc0tlx.mjs +309 -0
- package/dist/platform-cmd-5Ry-C9im.mjs +193 -0
- package/dist/platform-cmd-5oZq91lI.mjs +1 -0
- package/dist/platform-discovery-Bxg9aZXU.mjs +40 -0
- package/dist/platform-domain-DLVdGvGG.mjs +256 -0
- package/dist/platform-lifecycle-CUgjipXO.mjs +1 -0
- package/dist/platform-lifecycle-fRt5VMls.mjs +8928 -0
- package/dist/platform-management-5hEsRfR2.mjs +1 -0
- package/dist/platform-management-Djh1hzLP.mjs +1607 -0
- package/dist/platform-plans-config-CkbUKFpm.mjs +447 -0
- package/dist/platform-recovery-Cghx7FCR.mjs +96 -0
- package/dist/platform-registry-x1m9HBxf.mjs +450 -0
- package/dist/platform-runtime-logs-kkoiYFpF.mjs +72 -0
- package/dist/platform-setup-SfwCwnZg.mjs +306 -0
- package/dist/prepare-B9mB47T5.mjs +84 -0
- package/dist/prepare-DNIq07so.mjs +13 -0
- package/dist/prepare-LHkyJqxi.mjs +1 -0
- package/dist/project-CC7eN00D.mjs +141 -0
- package/dist/project-DcSd4BeI.mjs +1 -0
- package/dist/project-cmd-DTF19-fC.mjs +109 -0
- package/dist/project-paths-iXHKRTTQ.mjs +159 -0
- package/dist/project-slug-BUy0lmyR.mjs +1 -0
- package/dist/project-slug-CO6ci9XG.mjs +7 -0
- package/dist/project-team-CvdLhDF2.mjs +129 -0
- package/dist/project-token-CwZdUEGu.mjs +70 -0
- package/dist/project-tsconfig-P9X952KG.mjs +98 -0
- package/dist/project-zero-trust-CKDoPdN1.mjs +64 -0
- package/dist/providers-Cd3c7wi0.mjs +64 -0
- package/dist/providers-Df69hb_X.d.mts +5 -0
- package/dist/provision-DGlFJ3T9.mjs +1 -0
- package/dist/provision-mYVLuQiy.mjs +1814 -0
- package/dist/queues-Bc3FsBQT.d.mts +5 -0
- package/dist/r2-conditions-DSLmkiR5.mjs +60 -0
- package/dist/requests-DNhfyF3l.mjs +52 -0
- package/dist/resolve-project-BCsAMDRA.mjs +47 -0
- package/dist/resolve-project-DhU9_lIo.mjs +1 -0
- package/dist/resource-name-DlJ9QXzg.mjs +10 -0
- package/dist/response-HmNjB30w.mjs +29 -0
- package/dist/rollback-BvCHol52.mjs +150 -0
- package/dist/rolldown-runtime-uD8oG6U2.mjs +24 -0
- package/dist/route-types-CRWhr93D.mjs +592 -0
- package/dist/route-url-BIDZT78M.mjs +58 -0
- package/dist/route-url-Bla3Upsy.d.mts +42 -0
- package/dist/routes-stub.d.mts +24 -0
- package/dist/routes-stub.mjs +1 -0
- package/dist/routing-assets-CSheDWWM.mjs +54 -0
- package/dist/rpc-DcByS_q0.d.mts +39 -0
- package/dist/rpc-DtxIN9Tv.mjs +19 -0
- package/dist/runner-CPerdjIl.mjs +163 -0
- package/dist/runner-CUNtS5x7.mjs +1 -0
- package/dist/runner-mysql-7aA5hGoM.mjs +145 -0
- package/dist/runner-mysql-DrMKw203.mjs +1 -0
- package/dist/runner-pg-2pjltt0t.mjs +1 -0
- package/dist/runner-pg-mYc75KfH.mjs +61 -0
- package/dist/runtime/ai.d.mts +50 -0
- package/dist/runtime/ai.mjs +455 -0
- package/dist/runtime/auth-client-react.d.mts +2 -0
- package/dist/runtime/auth-client-react.mjs +1 -0
- package/dist/runtime/auth-client.d.mts +2 -0
- package/dist/runtime/auth-client.mjs +1 -0
- package/dist/runtime/auth.d.mts +2 -0
- package/dist/runtime/auth.mjs +1 -0
- package/dist/runtime/better-auth-mysql.d.mts +5 -0
- package/dist/runtime/better-auth-mysql.mjs +21 -0
- package/dist/runtime/better-auth-pg.d.mts +5 -0
- package/dist/runtime/better-auth-pg.mjs +21 -0
- package/dist/runtime/better-auth.d.mts +6 -0
- package/dist/runtime/better-auth.mjs +22 -0
- package/dist/runtime/client-react.d.mts +5 -0
- package/dist/runtime/client-react.mjs +5 -0
- package/dist/runtime/client.d.mts +5 -0
- package/dist/runtime/client.mjs +5 -0
- package/dist/runtime/db-mysql.d.mts +2 -0
- package/dist/runtime/db-mysql.mjs +1 -0
- package/dist/runtime/db-pg.d.mts +2 -0
- package/dist/runtime/db-pg.mjs +1 -0
- package/dist/runtime/db.d.mts +17 -0
- package/dist/runtime/db.mjs +36 -0
- package/dist/runtime/drizzle-arktype.d.mts +1 -0
- package/dist/runtime/drizzle-arktype.mjs +2 -0
- package/dist/runtime/drizzle-valibot.d.mts +1 -0
- package/dist/runtime/drizzle-valibot.mjs +2 -0
- package/dist/runtime/drizzle-zod.d.mts +1 -0
- package/dist/runtime/drizzle-zod.mjs +2 -0
- package/dist/runtime/durable.d.mts +64 -0
- package/dist/runtime/durable.mjs +165 -0
- package/dist/runtime/email/testing.d.mts +108 -0
- package/dist/runtime/email/testing.mjs +268 -0
- package/dist/runtime/email-protocol.d.mts +25 -0
- package/dist/runtime/email-protocol.mjs +1 -0
- package/dist/runtime/email.d.mts +26 -0
- package/dist/runtime/email.mjs +524 -0
- package/dist/runtime/env-public-client.d.mts +19 -0
- package/dist/runtime/env-public-client.mjs +55 -0
- package/dist/runtime/env-public.d.mts +4 -0
- package/dist/runtime/env-public.mjs +277 -0
- package/dist/runtime/env.d.mts +12 -0
- package/dist/runtime/env.mjs +1 -0
- package/dist/runtime/fetch-server.d.mts +6 -0
- package/dist/runtime/fetch-server.mjs +29 -0
- package/dist/runtime/fetch-stream.d.mts +3 -0
- package/dist/runtime/fetch-stream.mjs +3 -0
- package/dist/runtime/fetch.d.mts +2 -0
- package/dist/runtime/fetch.mjs +3 -0
- package/dist/runtime/handler.d.mts +3 -0
- package/dist/runtime/handler.mjs +1 -0
- package/dist/runtime/kv.d.mts +45 -0
- package/dist/runtime/kv.mjs +103 -0
- package/dist/runtime/limits.d.mts +2 -0
- package/dist/runtime/limits.mjs +1 -0
- package/dist/runtime/live-client.d.mts +40 -0
- package/dist/runtime/live-client.mjs +282 -0
- package/dist/runtime/live-server.d.mts +11 -0
- package/dist/runtime/live-server.mjs +419 -0
- package/dist/runtime/live.d.mts +3 -0
- package/dist/runtime/live.mjs +1 -0
- package/dist/runtime/log.d.mts +24 -0
- package/dist/runtime/log.mjs +57 -0
- package/dist/runtime/migration-handler-mysql.d.mts +2 -0
- package/dist/runtime/migration-handler-mysql.mjs +111 -0
- package/dist/runtime/migration-handler-pg.d.mts +2 -0
- package/dist/runtime/migration-handler-pg.mjs +94 -0
- package/dist/runtime/migration-handler.d.mts +2 -0
- package/dist/runtime/migration-handler.mjs +1 -0
- package/dist/runtime/procedure.d.mts +27 -0
- package/dist/runtime/procedure.mjs +36 -0
- package/dist/runtime/procedures.d.mts +24 -0
- package/dist/runtime/procedures.mjs +56 -0
- package/dist/runtime/queues.d.mts +2 -0
- package/dist/runtime/queues.mjs +8 -0
- package/dist/runtime/remote/binding-handler.d.mts +11 -0
- package/dist/runtime/remote/binding-handler.mjs +227 -0
- package/dist/runtime/remote/index.d.mts +12 -0
- package/dist/runtime/remote/index.mjs +467 -0
- package/dist/runtime/response.d.mts +11 -0
- package/dist/runtime/response.mjs +1 -0
- package/dist/runtime/route-url.d.mts +2 -0
- package/dist/runtime/route-url.mjs +1 -0
- package/dist/runtime/routing.d.mts +53 -0
- package/dist/runtime/routing.mjs +425 -0
- package/dist/runtime/rpc-react.d.mts +16 -0
- package/dist/runtime/rpc-react.mjs +50 -0
- package/dist/runtime/rpc.d.mts +2 -0
- package/dist/runtime/rpc.mjs +1 -0
- package/dist/runtime/sandbox-container.d.mts +3 -0
- package/dist/runtime/sandbox-container.mjs +1 -0
- package/dist/runtime/sandbox.d.mts +5 -0
- package/dist/runtime/sandbox.mjs +196 -0
- package/dist/runtime/schema-d1.d.mts +1 -0
- package/dist/runtime/schema-d1.mjs +2 -0
- package/dist/runtime/schema-mysql.d.mts +1 -0
- package/dist/runtime/schema-mysql.mjs +2 -0
- package/dist/runtime/schema-pg.d.mts +1 -0
- package/dist/runtime/schema-pg.mjs +2 -0
- package/dist/runtime/seed.d.mts +34 -0
- package/dist/runtime/seed.mjs +5 -0
- package/dist/runtime/sse-client.d.mts +31 -0
- package/dist/runtime/sse-client.mjs +42 -0
- package/dist/runtime/sse.d.mts +32 -0
- package/dist/runtime/sse.mjs +1 -0
- package/dist/runtime/storage.d.mts +4 -0
- package/dist/runtime/storage.mjs +13 -0
- package/dist/runtime/validator.d.mts +2 -0
- package/dist/runtime/validator.mjs +1 -0
- package/dist/runtime/ws-server.d.mts +26 -0
- package/dist/runtime/ws-server.mjs +297 -0
- package/dist/runtime/ws.d.mts +2 -0
- package/dist/runtime/ws.mjs +108 -0
- package/dist/sandbox-CWDjoEG2.d.mts +50 -0
- package/dist/sandbox-container-BqamdFCx.d.mts +73 -0
- package/dist/sandbox-container-d1AHLpgn.mjs +291 -0
- package/dist/secret-DCF9RXTc.mjs +146 -0
- package/dist/skills-Dr3AjuBF.mjs +63 -0
- package/dist/sqlite-validation-CLJXXN93.mjs +24 -0
- package/dist/sse-CxR30yMF.mjs +174 -0
- package/dist/standard-schema-CuDawHOC.d.mts +40 -0
- package/dist/static-asset-marker-mWMX2dLa.mjs +38 -0
- package/dist/subcommand-prompt-B9yUo--u.mjs +370 -0
- package/dist/terminal-log-text-DNsWJREL.mjs +31 -0
- package/dist/types-D7-4tBu7.d.mts +1 -0
- package/dist/untrusted-env-lL7RkYiC.mjs +50 -0
- package/dist/validate-B-zsjhiz.mjs +162 -0
- package/dist/validate-DbqGdPPY.mjs +1 -0
- package/dist/validator-8-NZs2Xr.mjs +168 -0
- package/dist/version-metadata-DsSoNsKJ.mjs +23 -0
- package/dist/wrangler-DU784Dkf.mjs +1452 -0
- package/dist/wrangler-Rr9_76DQ.mjs +1 -0
- package/dist/ws-Q_osq9VK.d.mts +137 -0
- package/dist/yarn-pnp-DgWbE7z5.mjs +91 -0
- package/docs/guide/ai.md +273 -0
- package/docs/guide/app-types.md +101 -0
- package/docs/guide/auth.md +255 -0
- package/docs/guide/database/d1.md +86 -0
- package/docs/guide/database/mysql.md +72 -0
- package/docs/guide/database/postgresql.md +94 -0
- package/docs/guide/database.md +454 -0
- package/docs/guide/deployment.md +124 -0
- package/docs/guide/durable-state.md +192 -0
- package/docs/guide/edge/headers.md +47 -0
- package/docs/guide/edge/redirects.md +85 -0
- package/docs/guide/edge/rewrites.md +119 -0
- package/docs/guide/edge/static-assets.md +94 -0
- package/docs/guide/email/domains.md +119 -0
- package/docs/guide/email/receiving.md +142 -0
- package/docs/guide/email/sending.md +262 -0
- package/docs/guide/email.md +23 -0
- package/docs/guide/env-vars.md +115 -0
- package/docs/guide/index.md +37 -0
- package/docs/guide/jobs.md +80 -0
- package/docs/guide/kv.md +100 -0
- package/docs/guide/live.md +181 -0
- package/docs/guide/platform/administration/access.md +165 -0
- package/docs/guide/platform/administration/connected-apps.md +84 -0
- package/docs/guide/platform/administration/email.md +169 -0
- package/docs/guide/platform/administration/operations.md +100 -0
- package/docs/guide/platform/administration/plans.md +156 -0
- package/docs/guide/platform/administration/projects.md +74 -0
- package/docs/guide/platform/administration/zero-trust.md +205 -0
- package/docs/guide/platform/development/local.md +122 -0
- package/docs/guide/platform/development/runtime.md +115 -0
- package/docs/guide/platform/development/schema-ci.md +44 -0
- package/docs/guide/platform/installation/ci.md +62 -0
- package/docs/guide/platform/installation/credentials.md +140 -0
- package/docs/guide/platform/installation/domains.md +120 -0
- package/docs/guide/platform/installation/first-deployment.md +95 -0
- package/docs/guide/platform/installation/maintenance.md +250 -0
- package/docs/guide/platform/installation/prerequisites.md +176 -0
- package/docs/guide/platform/installation/setup.md +300 -0
- package/docs/guide/platform/installation/uninstall.md +110 -0
- package/docs/guide/platform-administration.md +19 -0
- package/docs/guide/platform-development.md +16 -0
- package/docs/guide/procedures.md +48 -0
- package/docs/guide/project-collaboration.md +99 -0
- package/docs/guide/queues.md +149 -0
- package/docs/guide/quickstart.md +129 -0
- package/docs/guide/remote-dev.md +67 -0
- package/docs/guide/sandboxes.md +134 -0
- package/docs/guide/self-hosted-platform.md +45 -0
- package/docs/guide/server-routing.md +283 -0
- package/docs/guide/sse.md +174 -0
- package/docs/guide/storage.md +82 -0
- package/docs/guide/testing.md +64 -0
- package/docs/guide/type-safety.md +270 -0
- package/docs/guide/typed-fetch.md +98 -0
- package/docs/guide/websockets.md +230 -0
- package/docs/index.md +102 -0
- package/docs/integrations/agents.md +38 -0
- package/docs/integrations/cloudflare.md +241 -0
- package/docs/integrations/hono.md +127 -0
- package/docs/reference/api/auth.md +195 -0
- package/docs/reference/api/client.md +90 -0
- package/docs/reference/api/database.md +118 -0
- package/docs/reference/api/deploy.md +63 -0
- package/docs/reference/api/durable.md +47 -0
- package/docs/reference/api/env.md +51 -0
- package/docs/reference/api/handlers.md +189 -0
- package/docs/reference/api/plugin.md +40 -0
- package/docs/reference/api/resources.md +116 -0
- package/docs/reference/api/rewrites.md +111 -0
- package/docs/reference/api/types.md +126 -0
- package/docs/reference/api.md +71 -0
- package/docs/reference/cli/auth.md +87 -0
- package/docs/reference/cli/database.md +159 -0
- package/docs/reference/cli/deploy.md +117 -0
- package/docs/reference/cli/domains.md +42 -0
- package/docs/reference/cli/email.md +145 -0
- package/docs/reference/cli/generate.md +113 -0
- package/docs/reference/cli/github.md +181 -0
- package/docs/reference/cli/platform-config.md +93 -0
- package/docs/reference/cli/platform-email.md +81 -0
- package/docs/reference/cli/platform-installation.md +166 -0
- package/docs/reference/cli/platform-operations.md +90 -0
- package/docs/reference/cli/platform-users.md +159 -0
- package/docs/reference/cli/platform-zero-trust.md +60 -0
- package/docs/reference/cli/platform.md +78 -0
- package/docs/reference/cli/project.md +208 -0
- package/docs/reference/cli/secrets.md +79 -0
- package/docs/reference/cli/setup.md +88 -0
- package/docs/reference/cli.md +115 -0
- package/docs/reference/config.md +478 -0
- package/docs/reference/resource-inference.md +72 -0
- package/docs/reference/structure.md +138 -0
- package/package.json +389 -3
- package/sandbox.Dockerfile +4 -0
- package/schema.json +353 -0
- package/skills/bwf/SKILL.md +100 -0
- package/skills/migrate-vite-cloudflare-to-bwf/SKILL.md +53 -0
- package/templates/assets/bwf.svg +5 -0
- package/templates/assets/icons.svg +49 -0
- package/templates/assets/react.svg +1 -0
- package/templates/assets/stack.svg +35 -0
|
@@ -0,0 +1,1444 @@
|
|
|
1
|
+
import { a as join, c as resolve, n as dirname, r as extname, s as relative } from "./dist-DMYe8CZJ.mjs";
|
|
2
|
+
import { D as needsApplicationDatabase } from "./application-analysis-C9Ck2Yeg.mjs";
|
|
3
|
+
import { n as readProjectPaths } from "./project-paths-iXHKRTTQ.mjs";
|
|
4
|
+
import { t as discoverSchema } from "./discover-DJPmQcL5.mjs";
|
|
5
|
+
import { t as collectMigrations } from "./collect-C6Blu9yw.mjs";
|
|
6
|
+
import { i as mergeRoutingRules, r as lintRoutingPhases } from "./build-output-dir-Clj_unKN.mjs";
|
|
7
|
+
import { l as writeProjectConfig, o as shouldLinkDeployProject, t as attachSelectedPlatform } from "./project-CC7eN00D.mjs";
|
|
8
|
+
import { E as syncWranglerBindings, a as LIVE_MIGRATION_TAG, g as readExistingLiveBindingConfig, m as normalizeWranglerCompatibilityFlags, u as ensureWranglerCompat, w as resolveLiveBindingConfig } from "./wrangler-DU784Dkf.mjs";
|
|
9
|
+
import { n as buildMigrationPlanBundle } from "./plan-DX4_-OM5.mjs";
|
|
10
|
+
import { l as getTokenSource } from "./auth-xnkmpZUl.mjs";
|
|
11
|
+
import { t as findEnvFile } from "./env-types-Bg-dTh8u.mjs";
|
|
12
|
+
import { r as writeDrizzleConfig, t as PLACEHOLDER_DB_URL } from "./config-DOaFIK3w.mjs";
|
|
13
|
+
import { i as validateMigrations, r as listDrizzleArtifacts, t as assertJournalCoherence } from "./validate-B-zsjhiz.mjs";
|
|
14
|
+
import { n as buildEnv } from "./untrusted-env-lL7RkYiC.mjs";
|
|
15
|
+
import { L as log$1, X as text, tt as isCancel } from "./dist-STQXl8ck.mjs";
|
|
16
|
+
import { t as formatCloudflareUserMessage } from "./cloudflare-user-output-CqONaAbP.mjs";
|
|
17
|
+
import { c as parsePlatformErrorBody, i as isCliOutdatedError, l as platformErrorMessage, n as PlatformApiError, o as isHeadersTimeoutError } from "./client-D3D5RM5h.mjs";
|
|
18
|
+
import { f as import_picocolors, o as formatCount, u as getErrorMessage } from "./output-Bb34lF0w.mjs";
|
|
19
|
+
import { a as promptProjectSelection, i as reportProjectCreationWarnings, o as promptProjectSetupAction, r as promptAndCreateProject } from "./create-project-B35ux-LA.mjs";
|
|
20
|
+
import { a as detectPreset, l as resolveProjectCommand, o as formatProjectCommand } from "./cloudflare-process-Cc6oiJqk.mjs";
|
|
21
|
+
import { d as formatEnvReport, g as validateProdEnv, u as fetchRemoteSecretNames } from "./env-validation-BufZConV.mjs";
|
|
22
|
+
import { n as drizzleKitBin } from "./yarn-pnp-DgWbE7z5.mjs";
|
|
23
|
+
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
24
|
+
import { createDeployArtifact, createDeployUploadPayload } from "@builtbyfriends/deploy-core";
|
|
25
|
+
import { createHash } from "node:crypto";
|
|
26
|
+
import { execSync, spawnSync } from "node:child_process";
|
|
27
|
+
import { getContentType } from "@builtbyfriends/edge";
|
|
28
|
+
import { hash } from "blake3-jit";
|
|
29
|
+
import ignore from "ignore";
|
|
30
|
+
// src/cli/deploy-helpers.ts
|
|
31
|
+
const log = {
|
|
32
|
+
error: (message) => log$1.error(formatCloudflareUserMessage(message)),
|
|
33
|
+
info: (message) => log$1.info(formatCloudflareUserMessage(message)),
|
|
34
|
+
message: (message) => log$1.message(formatCloudflareUserMessage(message)),
|
|
35
|
+
step: (message) => log$1.step(formatCloudflareUserMessage(message)),
|
|
36
|
+
warn: (message) => log$1.warn(formatCloudflareUserMessage(message))
|
|
37
|
+
};
|
|
38
|
+
var DeployEventError = class extends Error {};
|
|
39
|
+
const EMPTY_BINDINGS = {
|
|
40
|
+
needsD1: false,
|
|
41
|
+
needsKV: false,
|
|
42
|
+
needsR2: false,
|
|
43
|
+
needsAuth: false,
|
|
44
|
+
needsQueues: false,
|
|
45
|
+
needsAI: false,
|
|
46
|
+
needsSandbox: false
|
|
47
|
+
};
|
|
48
|
+
function readLiveBindingConfigFromDeployment(deployment) {
|
|
49
|
+
if (!deployment?.manifest) return;
|
|
50
|
+
let manifest;
|
|
51
|
+
try {
|
|
52
|
+
manifest = JSON.parse(deployment.manifest);
|
|
53
|
+
} catch {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (typeof manifest.live?.bindingName !== "string" || typeof manifest.live.className !== "string") return;
|
|
57
|
+
return {
|
|
58
|
+
bindingName: manifest.live.bindingName,
|
|
59
|
+
className: manifest.live.className
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async function ensurePreviouslyDeployedLiveBindingConfig(root, client, projectId, cliLog) {
|
|
63
|
+
if (readExistingLiveBindingConfig(root)) return false;
|
|
64
|
+
const { deployments, activeDeploymentId } = await client.listDeployments(projectId);
|
|
65
|
+
const live = readLiveBindingConfigFromDeployment(deployments.find((deployment) => deployment.id === activeDeploymentId));
|
|
66
|
+
if (!live) return false;
|
|
67
|
+
const synced = syncWranglerBindings(root, {
|
|
68
|
+
...EMPTY_BINDINGS,
|
|
69
|
+
needsLive: true
|
|
70
|
+
}, { live });
|
|
71
|
+
if (synced) cliLog?.info("live_binding_restored", {
|
|
72
|
+
bindingName: live.bindingName,
|
|
73
|
+
className: live.className
|
|
74
|
+
});
|
|
75
|
+
return synced;
|
|
76
|
+
}
|
|
77
|
+
async function resolveDeployLiveBindingConfig(root, client, projectId, opts) {
|
|
78
|
+
if (!opts.needsLive) return;
|
|
79
|
+
await ensurePreviouslyDeployedLiveBindingConfig(root, client, projectId, opts.cliLog);
|
|
80
|
+
return resolveLiveBindingConfig(root, {
|
|
81
|
+
reservedBindings: opts.webSockets.map((route) => route.bindingName),
|
|
82
|
+
reservedClasses: [...opts.webSockets.map((route) => route.className), opts.sandboxClassName]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function getExitCode(error) {
|
|
86
|
+
if (typeof error === "object" && error !== null && "status" in error && typeof error.status === "number") return error.status;
|
|
87
|
+
return 1;
|
|
88
|
+
}
|
|
89
|
+
function resolveDeployWranglerCompat(root, config, buildOutputDir, requirements) {
|
|
90
|
+
const compat = ensureWranglerCompat(root, config, buildOutputDir);
|
|
91
|
+
const compatibilityFlags = normalizeWranglerCompatibilityFlags(compat.compatibilityFlags, { needsNodejsCompat: requirements?.authEnabled === true || requirements?.dialect !== void 0 && requirements.dialect !== "sqlite" || requirements?.needsSandbox === true });
|
|
92
|
+
return compatibilityFlags === compat.compatibilityFlags ? compat : {
|
|
93
|
+
...compat,
|
|
94
|
+
compatibilityFlags
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function resolveDeployWorkerMain(config, buildOutputDir) {
|
|
98
|
+
try {
|
|
99
|
+
const wrangler = JSON.parse(readFileSync(join(buildOutputDir, "wrangler.json"), "utf-8"));
|
|
100
|
+
return typeof wrangler.main === "string" && wrangler.main.length > 0 ? wrangler.main : void 0;
|
|
101
|
+
} catch {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function assertWorkerMainUploaded(workerFiles, workerMain) {
|
|
106
|
+
if (!workerMain || workerFiles.size === 0) return;
|
|
107
|
+
if (!workerFiles.has(workerMain)) throw new Error(`deploy: Worker entry '${workerMain}' from wrangler.json was not found in uploaded worker modules.`);
|
|
108
|
+
}
|
|
109
|
+
function assertProjectDeployAccess(project) {
|
|
110
|
+
if (project?.role === "reader") throw new Error(`deploy: You have reader access to "${project.slug}" and cannot deploy. Ask a project admin or owner to grant collaborator access, or choose another project with \`--project <slug>\`.`);
|
|
111
|
+
}
|
|
112
|
+
async function promptDeployProjectConfig(root, client, cliLog) {
|
|
113
|
+
const projects = await client.listProjectChoices();
|
|
114
|
+
const link = shouldLinkDeployProject(root, client.apiUrl);
|
|
115
|
+
const deployableProjects = projects.filter((project) => project.role !== "reader");
|
|
116
|
+
if (deployableProjects.length !== projects.length) log.warn("Projects with reader access are hidden from deploy selection. Ask a project admin or owner to grant collaborator access to deploy to them.");
|
|
117
|
+
if (await promptProjectSetupAction("Set up a bwf project for deploy:", {
|
|
118
|
+
includeLink: deployableProjects.length > 0,
|
|
119
|
+
...link ? {} : { link: false }
|
|
120
|
+
}) === "create") return promptAndCreateProject(root, client, { link });
|
|
121
|
+
const result = await promptProjectSelection(deployableProjects, "Select a project to deploy to:", root, {
|
|
122
|
+
confirmExisting: true,
|
|
123
|
+
includeCreate: false,
|
|
124
|
+
...link ? {} : { link: false }
|
|
125
|
+
});
|
|
126
|
+
if (result.action === "create") throw new Error("Unexpected project selection result.");
|
|
127
|
+
const config = {
|
|
128
|
+
projectId: result.project.id,
|
|
129
|
+
slug: result.project.slug
|
|
130
|
+
};
|
|
131
|
+
if (link) {
|
|
132
|
+
writeProjectConfig(root, attachSelectedPlatform(config, client.apiUrl));
|
|
133
|
+
log.step(`Linked to ${import_picocolors.default.blue(config.slug)}`);
|
|
134
|
+
cliLog?.info("project_linked", {
|
|
135
|
+
projectId: config.projectId,
|
|
136
|
+
slug: config.slug
|
|
137
|
+
});
|
|
138
|
+
} else log.step(`Using ${import_picocolors.default.blue(config.slug)} for this deployment. Saved destination unchanged.`);
|
|
139
|
+
return config;
|
|
140
|
+
}
|
|
141
|
+
function resolveStaticBuildCommand(preset, buildOverride, hasExplicitDir = false) {
|
|
142
|
+
if (hasExplicitDir) return null;
|
|
143
|
+
return buildOverride ?? preset.buildCommand;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Resolve the build command for a FULL bwf app deploy.
|
|
147
|
+
*
|
|
148
|
+
* `inference.build` wins when set, matching the static
|
|
149
|
+
* path's `resolveStaticBuildCommand`, so an app that needs more than one build
|
|
150
|
+
* step (an SSG that emits the site, then bwf's build packaging it via
|
|
151
|
+
* `publicDir` alongside the worker) can express it.
|
|
152
|
+
*
|
|
153
|
+
* The two returned strings are deliberately different for the FALLBACK: `label`
|
|
154
|
+
* goes to the user (`formatProjectCommand` rewrites `vite` → `vp` without
|
|
155
|
+
* expanding an absolute bin path), `command` is what actually runs
|
|
156
|
+
* (`resolveProjectCommand` expands to the local bin). A configured command is
|
|
157
|
+
* the user's own text and is used verbatim for both, so what is printed is
|
|
158
|
+
* exactly what is executed.
|
|
159
|
+
*/
|
|
160
|
+
function resolveFullDeployBuildCommand(root, buildOverride, fallbackBuildCommand = "vite build") {
|
|
161
|
+
if (buildOverride) return {
|
|
162
|
+
label: buildOverride,
|
|
163
|
+
command: buildOverride
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
label: formatProjectCommand(root, fallbackBuildCommand),
|
|
167
|
+
command: resolveProjectCommand(root, fallbackBuildCommand)
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function resolveStaticDeployPreset(root, bwfConfig, options) {
|
|
171
|
+
if (options?.dir) return detectPreset(root, {
|
|
172
|
+
dir: options.dir,
|
|
173
|
+
spa: options.spa
|
|
174
|
+
});
|
|
175
|
+
const appType = bwfConfig.inference?.appType;
|
|
176
|
+
if (appType === "static" || appType === "spa") {
|
|
177
|
+
const outputDir = bwfConfig.inference?.outputDir;
|
|
178
|
+
const preset = {
|
|
179
|
+
buildCommand: null,
|
|
180
|
+
outputDir: outputDir ? resolve(root, outputDir) : join(root, "dist"),
|
|
181
|
+
appType
|
|
182
|
+
};
|
|
183
|
+
const detectedPreset = detectPreset(root, { spa: options?.spa });
|
|
184
|
+
if (detectedPreset) {
|
|
185
|
+
preset.buildCommand = detectedPreset.buildCommand;
|
|
186
|
+
if (!outputDir) preset.outputDir = detectedPreset.outputDir;
|
|
187
|
+
}
|
|
188
|
+
return preset;
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
async function createProjectFromSlug(root, client, slug, cliLog) {
|
|
193
|
+
log.step(`Creating project ${import_picocolors.default.blue(slug)}...`);
|
|
194
|
+
cliLog?.info("project_create_start", { slug });
|
|
195
|
+
const project = await client.createProject(slug);
|
|
196
|
+
const config = {
|
|
197
|
+
projectId: project.id,
|
|
198
|
+
slug: project.slug
|
|
199
|
+
};
|
|
200
|
+
if (shouldLinkDeployProject(root, client.apiUrl)) writeProjectConfig(root, attachSelectedPlatform(config, client.apiUrl));
|
|
201
|
+
log.step(`Project created: ${import_picocolors.default.blue(config.slug)}`);
|
|
202
|
+
reportProjectCreationWarnings(project);
|
|
203
|
+
cliLog?.info("project_create_success", {
|
|
204
|
+
projectId: config.projectId,
|
|
205
|
+
slug: config.slug
|
|
206
|
+
});
|
|
207
|
+
return config;
|
|
208
|
+
}
|
|
209
|
+
function getGitCommit(root) {
|
|
210
|
+
try {
|
|
211
|
+
const githubSha = process.env.GITHUB_SHA?.trim();
|
|
212
|
+
if (githubSha && /^[0-9a-f]{7,64}$/i.test(githubSha)) return githubSha;
|
|
213
|
+
const gitEnv = buildEnv();
|
|
214
|
+
execSync("git rev-parse --is-inside-work-tree", {
|
|
215
|
+
cwd: root,
|
|
216
|
+
stdio: "ignore",
|
|
217
|
+
env: gitEnv
|
|
218
|
+
});
|
|
219
|
+
if (execSync("git status --porcelain", {
|
|
220
|
+
cwd: root,
|
|
221
|
+
encoding: "utf-8",
|
|
222
|
+
env: gitEnv
|
|
223
|
+
}).trim() !== "") return null;
|
|
224
|
+
return execSync("git rev-parse HEAD", {
|
|
225
|
+
cwd: root,
|
|
226
|
+
encoding: "utf-8",
|
|
227
|
+
env: gitEnv
|
|
228
|
+
}).trim();
|
|
229
|
+
} catch {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Check journal coherence and validate the checked-in migrations of a managed
|
|
235
|
+
* deploy. Logs and exits on failure; returns `undefined` when there are none.
|
|
236
|
+
*/
|
|
237
|
+
function validateDeployMigrations(migrationsDir, rawMigrations, sourceRelative) {
|
|
238
|
+
try {
|
|
239
|
+
assertJournalCoherence(migrationsDir, rawMigrations, sourceRelative);
|
|
240
|
+
} catch (err) {
|
|
241
|
+
log.error(getErrorMessage(err));
|
|
242
|
+
process.exit(1);
|
|
243
|
+
}
|
|
244
|
+
if (rawMigrations.length === 0) return;
|
|
245
|
+
try {
|
|
246
|
+
const validated = validateMigrations(rawMigrations);
|
|
247
|
+
log.info(`Found ${formatCount(validated.length, "migration")}`);
|
|
248
|
+
return validated;
|
|
249
|
+
} catch (err) {
|
|
250
|
+
log.error(getErrorMessage(err));
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Ensure a managed external SQL project has Hyperdrive, prompting for the
|
|
256
|
+
* connection string when it is missing.
|
|
257
|
+
*/
|
|
258
|
+
async function ensureManagedHyperdrive(client, projectId, dialect) {
|
|
259
|
+
let resources = null;
|
|
260
|
+
try {
|
|
261
|
+
resources = await client.getResources(projectId);
|
|
262
|
+
} catch {}
|
|
263
|
+
if (!resources || resources.some((resource) => resource.type === "hyperdrive")) return;
|
|
264
|
+
const connectionString = await text({
|
|
265
|
+
message: `Your project uses ${dialect === "mysql" ? "MySQL" : "PostgreSQL"}. Enter your connection string:`,
|
|
266
|
+
placeholder: dialect === "mysql" ? "mysql://user:pass@host:3306/dbname" : "postgresql://user:pass@host:5432/dbname",
|
|
267
|
+
validate(value) {
|
|
268
|
+
if (!(dialect === "mysql" ? value?.startsWith("mysql://") : value?.startsWith("postgres://") || value?.startsWith("postgresql://"))) return dialect === "mysql" ? "Must start with \"mysql://\"" : "Must start with \"postgres://\" or \"postgresql://\"";
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
if (isCancel(connectionString)) {
|
|
272
|
+
log.info("Deploy cancelled.");
|
|
273
|
+
process.exit(0);
|
|
274
|
+
}
|
|
275
|
+
await client.provisionDatabase(projectId, connectionString);
|
|
276
|
+
log.step("Hyperdrive provisioned.");
|
|
277
|
+
}
|
|
278
|
+
/** Convert scanned cron jobs and queues into deploy-manifest entries. */
|
|
279
|
+
function toManifestSchedulesAndQueues(jobs, queues) {
|
|
280
|
+
return {
|
|
281
|
+
schedules: jobs.flatMap((job) => job.crons.map((cron) => ({
|
|
282
|
+
name: job.name,
|
|
283
|
+
cron
|
|
284
|
+
}))),
|
|
285
|
+
queues: queues.map((q) => ({
|
|
286
|
+
name: q.name,
|
|
287
|
+
bindingName: q.bindingName,
|
|
288
|
+
...q.maxBatchSize != null && { maxBatchSize: q.maxBatchSize },
|
|
289
|
+
...q.maxBatchTimeout != null && { maxBatchTimeout: q.maxBatchTimeout },
|
|
290
|
+
...q.maxRetries != null && { maxRetries: q.maxRetries },
|
|
291
|
+
...q.retryDelay != null && { retryDelay: q.retryDelay }
|
|
292
|
+
}))
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* If the project has an `env.ts`, validate its schema against the union of
|
|
297
|
+
* build-shell public values and remote secret names. Hard-error before upload so
|
|
298
|
+
* deploys never ship missing required env vars.
|
|
299
|
+
*/
|
|
300
|
+
async function assertEnvSchemaValid(root, client, projectId, workerVars) {
|
|
301
|
+
if (findEnvFile(root) == null) return;
|
|
302
|
+
const remoteSecrets = await fetchRemoteSecretNames(client, projectId);
|
|
303
|
+
const { hasSchema, report } = await validateProdEnv(root, {
|
|
304
|
+
productionOnly: true,
|
|
305
|
+
remoteSecrets,
|
|
306
|
+
workerVars
|
|
307
|
+
});
|
|
308
|
+
if (!hasSchema || report.valid) return;
|
|
309
|
+
const formatted = formatEnvReport(report);
|
|
310
|
+
log.error(`Env validation failed:\n${formatted}`);
|
|
311
|
+
if (report.missing.length > 0) log.info("Upload missing server values with `bwf secret put <NAME>`; set VITE_* values in the build shell or schema defaults.");
|
|
312
|
+
throw new DeployEventError("deploy: Aborting because env.ts schema is not satisfied.");
|
|
313
|
+
}
|
|
314
|
+
// src/cli/deploy-drift.ts
|
|
315
|
+
const deployDriftCheckDir = join(".bwf", "deploy-drift-check");
|
|
316
|
+
/** Top-level entries never copied into the isolated drift-check project. */
|
|
317
|
+
const DRIFT_PROJECT_SKIPPED_ENTRIES = /* @__PURE__ */ new Set([
|
|
318
|
+
".git",
|
|
319
|
+
".bwf",
|
|
320
|
+
"node_modules",
|
|
321
|
+
"dist",
|
|
322
|
+
"build",
|
|
323
|
+
".wrangler",
|
|
324
|
+
".turbo",
|
|
325
|
+
".next",
|
|
326
|
+
".output"
|
|
327
|
+
]);
|
|
328
|
+
function assertDeploySchemaDriftFree(root, dialect) {
|
|
329
|
+
try {
|
|
330
|
+
if (!hasDeploySchemaDrift(root, dialect)) return;
|
|
331
|
+
} catch (error) {
|
|
332
|
+
log.error(getErrorMessage(error));
|
|
333
|
+
process.exit(1);
|
|
334
|
+
}
|
|
335
|
+
log.error(getDeploySchemaDriftMessage(root));
|
|
336
|
+
process.exit(1);
|
|
337
|
+
}
|
|
338
|
+
function hasDeploySchemaDrift(root, dialect) {
|
|
339
|
+
const authSchemaPath = join(root, ".bwf", "better-auth-schema.ts");
|
|
340
|
+
if (!discoverSchema(root, readProjectPaths(root)) && !existsSync(authSchemaPath)) return false;
|
|
341
|
+
const driftRoot = mkDeployDriftCheckRoot(root);
|
|
342
|
+
const driftProjectRoot = join(driftRoot, "project");
|
|
343
|
+
createDeployDriftProject(root, driftProjectRoot);
|
|
344
|
+
try {
|
|
345
|
+
const migrationsDir = readProjectPaths(driftProjectRoot).migrationsDir;
|
|
346
|
+
const before = snapshotDir(migrationsDir);
|
|
347
|
+
const driftAuthSchemaPath = join(driftProjectRoot, ".bwf", "better-auth-schema.ts");
|
|
348
|
+
const output = runDrizzleKitGenerate(driftProjectRoot, writeDrizzleConfig(driftProjectRoot, PLACEHOLDER_DB_URL[dialect], dialect, { additionalSchemas: existsSync(driftAuthSchemaPath) ? [driftAuthSchemaPath] : void 0 }));
|
|
349
|
+
const snapshotsEqual = migrationSnapshotsEqual(before, snapshotDir(migrationsDir));
|
|
350
|
+
if (snapshotsEqual && !output.includes("No schema changes, nothing to migrate")) throw new Error(output || "drizzle-kit generate finished without reporting schema status.");
|
|
351
|
+
return !snapshotsEqual;
|
|
352
|
+
} catch (error) {
|
|
353
|
+
throw new Error(formatDeploySchemaDriftCheckError(error));
|
|
354
|
+
} finally {
|
|
355
|
+
rmSync(driftRoot, {
|
|
356
|
+
recursive: true,
|
|
357
|
+
force: true
|
|
358
|
+
});
|
|
359
|
+
cleanupDeployDriftCheckRoot(root);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function runDrizzleKitGenerate(root, configPath) {
|
|
363
|
+
const result = spawnSync(process.execPath, [
|
|
364
|
+
drizzleKitBin,
|
|
365
|
+
"generate",
|
|
366
|
+
"--config",
|
|
367
|
+
configPath
|
|
368
|
+
], {
|
|
369
|
+
cwd: root,
|
|
370
|
+
encoding: "utf-8",
|
|
371
|
+
env: buildEnv()
|
|
372
|
+
});
|
|
373
|
+
const stderr = (result.stderr ?? "").trim();
|
|
374
|
+
const output = [stderr, (result.stdout ?? "").trim()].filter(Boolean).join("\n").trim();
|
|
375
|
+
if (result.error) throw result.error;
|
|
376
|
+
if (stderr) throw new Error(output);
|
|
377
|
+
if (result.status !== 0) throw new Error(output || `drizzle-kit generate exited with code ${result.status}.`);
|
|
378
|
+
return output;
|
|
379
|
+
}
|
|
380
|
+
function getDeploySchemaDriftMessage(root) {
|
|
381
|
+
const migrationsDir = readProjectPaths(root).migrationsDir;
|
|
382
|
+
if (collectMigrations(migrationsDir).length > 0 && !existsSync(join(migrationsDir, "meta", "_journal.json")) && listDrizzleArtifacts(migrationsDir).length === 0) return [`Missing Drizzle metadata in ${`${relative(root, migrationsDir)}/`}.`, "See https://void.cloud/guide/database#hand-written-migrations"].join("\n");
|
|
383
|
+
return [`Schema drift detected between your Drizzle schema and ${relative(root, migrationsDir)}/.`, "Run `bwf db generate`, review the generated migration, commit it yourself, then rerun `bwf deploy`."].join("\n");
|
|
384
|
+
}
|
|
385
|
+
function formatDeploySchemaDriftCheckError(error) {
|
|
386
|
+
const detail = getErrorMessage(error);
|
|
387
|
+
return [
|
|
388
|
+
"Failed to check Drizzle schema drift during deploy.",
|
|
389
|
+
"Run `bwf db generate` locally, fix any reported issues, review the generated migration, commit it yourself, then rerun `bwf deploy`.",
|
|
390
|
+
...detail ? [detail] : []
|
|
391
|
+
].join("\n\n");
|
|
392
|
+
}
|
|
393
|
+
function createDeployDriftProject(root, driftProjectRoot) {
|
|
394
|
+
mkdirSync(driftProjectRoot, { recursive: true });
|
|
395
|
+
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
396
|
+
if (DRIFT_PROJECT_SKIPPED_ENTRIES.has(entry.name)) continue;
|
|
397
|
+
const source = join(root, entry.name);
|
|
398
|
+
const target = join(driftProjectRoot, entry.name);
|
|
399
|
+
cpSync(source, target, { recursive: true });
|
|
400
|
+
}
|
|
401
|
+
const authSchemaPath = join(root, ".bwf", "better-auth-schema.ts");
|
|
402
|
+
if (existsSync(authSchemaPath)) {
|
|
403
|
+
const target = join(driftProjectRoot, ".bwf", "better-auth-schema.ts");
|
|
404
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
405
|
+
cpSync(authSchemaPath, target);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function mkDeployDriftCheckRoot(root) {
|
|
409
|
+
const driftCheckDir = join(root, deployDriftCheckDir);
|
|
410
|
+
rmSync(driftCheckDir, {
|
|
411
|
+
recursive: true,
|
|
412
|
+
force: true
|
|
413
|
+
});
|
|
414
|
+
mkdirSync(driftCheckDir, { recursive: true });
|
|
415
|
+
return mkdtempSync(join(driftCheckDir, "check-"));
|
|
416
|
+
}
|
|
417
|
+
function cleanupDeployDriftCheckRoot(root) {
|
|
418
|
+
const driftCheckDir = join(root, deployDriftCheckDir);
|
|
419
|
+
try {
|
|
420
|
+
if (existsSync(driftCheckDir) && readdirSync(driftCheckDir).length === 0) rmSync(driftCheckDir, {
|
|
421
|
+
recursive: true,
|
|
422
|
+
force: true
|
|
423
|
+
});
|
|
424
|
+
} catch {}
|
|
425
|
+
}
|
|
426
|
+
function snapshotDir(root) {
|
|
427
|
+
if (!existsSync(root)) return {};
|
|
428
|
+
const snapshot = {};
|
|
429
|
+
collectSnapshotFiles(root, root, snapshot);
|
|
430
|
+
return snapshot;
|
|
431
|
+
}
|
|
432
|
+
function collectSnapshotFiles(current, root, snapshot) {
|
|
433
|
+
for (const entry of readdirSync(current, { withFileTypes: true })) {
|
|
434
|
+
const fullPath = join(current, entry.name);
|
|
435
|
+
if (entry.isDirectory()) {
|
|
436
|
+
collectSnapshotFiles(fullPath, root, snapshot);
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
snapshot[relative(root, fullPath)] = readFileSync(fullPath, "utf-8");
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
function migrationSnapshotsEqual(left, right) {
|
|
443
|
+
const leftEntries = Object.entries(left).sort(([a], [b]) => a.localeCompare(b));
|
|
444
|
+
const rightEntries = Object.entries(right).sort(([a], [b]) => a.localeCompare(b));
|
|
445
|
+
if (leftEntries.length !== rightEntries.length) return false;
|
|
446
|
+
return leftEntries.every(([leftPath, leftContent], index) => {
|
|
447
|
+
const [rightPath, rightContent] = rightEntries[index] ?? [];
|
|
448
|
+
return leftPath === rightPath && leftContent === rightContent;
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
// src/cli/deploy-errors.ts
|
|
452
|
+
const BODY_SNIPPET_MAX = 200;
|
|
453
|
+
function trimSnippet(body) {
|
|
454
|
+
const collapsed = body.replace(/\s+/g, " ").trim();
|
|
455
|
+
if (collapsed.length <= BODY_SNIPPET_MAX) return collapsed;
|
|
456
|
+
return `${collapsed.slice(0, BODY_SNIPPET_MAX)}...`;
|
|
457
|
+
}
|
|
458
|
+
function appendDeploymentLine(message, deploymentId) {
|
|
459
|
+
return deploymentId ? `${message}\nDeployment: ${deploymentId}` : message;
|
|
460
|
+
}
|
|
461
|
+
function appendLogLine(message, logPath) {
|
|
462
|
+
return logPath ? `${message}\nDetailed log: ${logPath}` : message;
|
|
463
|
+
}
|
|
464
|
+
function appendTrailingLines(message, deploymentId, logPath) {
|
|
465
|
+
return appendLogLine(appendDeploymentLine(message, deploymentId), logPath);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Describe the deepest `cause` of an error in one short line, e.g.
|
|
469
|
+
* `getaddrinfo ENOTFOUND api.example.com` under `fetch failed`.
|
|
470
|
+
*/
|
|
471
|
+
function describeRootCause(err) {
|
|
472
|
+
let root = err;
|
|
473
|
+
for (let depth = 0; depth < 6; depth++) {
|
|
474
|
+
const cause = root.cause;
|
|
475
|
+
if (cause === null || typeof cause !== "object") break;
|
|
476
|
+
root = cause;
|
|
477
|
+
}
|
|
478
|
+
if (root === err) return null;
|
|
479
|
+
const { code, message } = root;
|
|
480
|
+
const text = typeof message === "string" ? message.trim() : "";
|
|
481
|
+
const codeText = typeof code === "string" ? code : "";
|
|
482
|
+
if (!text) return codeText || null;
|
|
483
|
+
return codeText && !text.includes(codeText) ? `${codeText}: ${text}` : text;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Format a server-emitted `event: 'error'` payload with an optional deployment id.
|
|
487
|
+
*/
|
|
488
|
+
function formatDeployFailureMessage(message, deploymentId, logPath) {
|
|
489
|
+
return appendTrailingLines(message, deploymentId, logPath);
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Format the "stream ended cleanly but no terminal event arrived" case.
|
|
493
|
+
*
|
|
494
|
+
* This is the only call site that should emit the bare "Connection lost during
|
|
495
|
+
* deploy" message — the server closed the NDJSON stream without emitting
|
|
496
|
+
* `done` or `error`, so there is no underlying error to carry.
|
|
497
|
+
*/
|
|
498
|
+
function formatConnectionLostMessage(deploymentId, logPath) {
|
|
499
|
+
return appendTrailingLines("deploy: Connection lost during deploy.", deploymentId, logPath);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Convert an exception thrown during the deploy NDJSON stream into a
|
|
503
|
+
* user-facing `Error` with a readable message.
|
|
504
|
+
*
|
|
505
|
+
* Four cases:
|
|
506
|
+
* 1. `PlatformApiError` with 409 + a JSON body carrying `{error, deployment}`
|
|
507
|
+
* — surface the server-supplied error and prefer the body's deployment id.
|
|
508
|
+
* 2. Any other `PlatformApiError` — retain the client's actionable message and
|
|
509
|
+
* structured error fields; opaque provider failures use a trimmed body snippet.
|
|
510
|
+
* 3. A headers timeout on the last deploy POST attempt — the platform sent
|
|
511
|
+
* no response in time. Explain that the deploy may still finish and how
|
|
512
|
+
* to check and retry.
|
|
513
|
+
* 4. Anything else — preserve the original message, plus its root cause when
|
|
514
|
+
* there is one, under a `Connection lost during deploy: <original>`
|
|
515
|
+
* prefix so the caller can still tell network, parse, and transport
|
|
516
|
+
* errors apart.
|
|
517
|
+
*/
|
|
518
|
+
function formatStreamDeployError(err, deploymentId, logPath) {
|
|
519
|
+
if (err instanceof PlatformApiError) {
|
|
520
|
+
const parsed = parsePlatformErrorBody(err.body);
|
|
521
|
+
const parsedError = platformErrorMessage(parsed) ?? parsed?.error ?? null;
|
|
522
|
+
const effectiveDeploymentId = parsed?.deployment ?? null ?? deploymentId;
|
|
523
|
+
if (isCliOutdatedError(err) && parsed?.message) {
|
|
524
|
+
err.message = appendTrailingLines(err.message, effectiveDeploymentId, logPath);
|
|
525
|
+
return err;
|
|
526
|
+
}
|
|
527
|
+
if (parsedError || err.status === 401 || err.status === 403 || parsed !== null) {
|
|
528
|
+
err.message = appendTrailingLines(`deploy: ${err.message}`, effectiveDeploymentId, logPath);
|
|
529
|
+
return err;
|
|
530
|
+
}
|
|
531
|
+
const detail = trimSnippet(err.body);
|
|
532
|
+
err.message = appendTrailingLines(detail ? `deploy: Deploy failed (HTTP ${err.status}): ${detail}` : `deploy: Deploy failed (HTTP ${err.status}).`, effectiveDeploymentId, logPath);
|
|
533
|
+
return err;
|
|
534
|
+
}
|
|
535
|
+
if (isHeadersTimeoutError(err)) {
|
|
536
|
+
const lines = [`deploy: The bwf platform did not respond while preparing the deploy. Tried 4 times; the last try waited 5 minutes.`, "It may still finish. Check `bwf project status`, then run `bwf deploy` again to retry."];
|
|
537
|
+
if (logPath) lines.push("If this keeps happening, share the detailed log below.");
|
|
538
|
+
return new Error(appendTrailingLines(lines.join("\n"), deploymentId, logPath));
|
|
539
|
+
}
|
|
540
|
+
const original = err instanceof Error ? err.message : String(err);
|
|
541
|
+
const rootCause = err instanceof Error ? describeRootCause(err) : null;
|
|
542
|
+
const detail = rootCause && rootCause !== original ? ` (${rootCause})` : "";
|
|
543
|
+
return new Error(appendTrailingLines(`deploy: Connection lost during deploy: '${original}'${detail}.`, deploymentId, logPath));
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Maximum retry attempts for a single R2 PUT before giving up. Matched to
|
|
547
|
+
* the design doc 0068 spec, with rate limits retried alongside 5xx errors.
|
|
548
|
+
*/
|
|
549
|
+
const MAX_R2_PUT_RETRIES = 3;
|
|
550
|
+
/**
|
|
551
|
+
* Retry backoff delays in milliseconds. After transient attempt `i` fails we
|
|
552
|
+
* sleep `RETRY_BACKOFF_MS[i]` before retrying. Indexed from 0; once the
|
|
553
|
+
* array is exhausted we surface the error.
|
|
554
|
+
*/
|
|
555
|
+
const RETRY_BACKOFF_MS = [
|
|
556
|
+
250,
|
|
557
|
+
500,
|
|
558
|
+
1e3
|
|
559
|
+
];
|
|
560
|
+
var DirectR2PutError = class extends Error {
|
|
561
|
+
status;
|
|
562
|
+
hash;
|
|
563
|
+
path;
|
|
564
|
+
/**
|
|
565
|
+
* `body` is the response body text (may be empty / non-text). Useful in
|
|
566
|
+
* the surface error so users can correlate against R2-side errors like
|
|
567
|
+
* `BadDigest` (Content-MD5 mismatch) or signature errors.
|
|
568
|
+
*/
|
|
569
|
+
body;
|
|
570
|
+
constructor(status, hash, path, body) {
|
|
571
|
+
super(`R2 PUT failed for ${path} (${hash}): ${status}${body ? ` ${body}` : ""}`);
|
|
572
|
+
this.name = "DirectR2PutError";
|
|
573
|
+
this.status = status;
|
|
574
|
+
this.hash = hash;
|
|
575
|
+
this.path = path;
|
|
576
|
+
this.body = body;
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* Issue direct-to-R2 PUTs for every item in `items` (assets or Worker
|
|
581
|
+
* modules), bounded to `R2_PUT_CONCURRENCY`. Surfaces the first failure
|
|
582
|
+
* (429/5xx after retry exhaustion, other 4xx immediately) as a `DirectR2PutError`
|
|
583
|
+
* carrying the item path and hash so the user can correlate against the
|
|
584
|
+
* JSONL log.
|
|
585
|
+
*
|
|
586
|
+
* Logs `r2_put_start` / `r2_put_end` per asset, plus `r2_put_retry` on
|
|
587
|
+
* each retry attempt. Per-asset durations help identify slow uploads.
|
|
588
|
+
*
|
|
589
|
+
* Memory: each successful PUT clears `item.body` and invokes `onAfterPut`
|
|
590
|
+
* so the caller can drop its own ref (e.g. delete from the in-memory
|
|
591
|
+
* `assetFiles` cache). For huge deploys this keeps peak memory bounded by
|
|
592
|
+
* the upload concurrency rather than the total bundle size.
|
|
593
|
+
*/
|
|
594
|
+
async function uploadAssetsToR2(items, cliLog, fetchImpl = fetch, onAfterPut) {
|
|
595
|
+
if (items.length === 0) return;
|
|
596
|
+
let firstError = null;
|
|
597
|
+
let nextIndex = 0;
|
|
598
|
+
const workerCount = Math.min(10, items.length);
|
|
599
|
+
const workers = [];
|
|
600
|
+
for (let w = 0; w < workerCount; w++) workers.push((async () => {
|
|
601
|
+
while (firstError === null) {
|
|
602
|
+
const i = nextIndex++;
|
|
603
|
+
if (i >= items.length) return;
|
|
604
|
+
try {
|
|
605
|
+
await uploadOne(items[i], cliLog, fetchImpl);
|
|
606
|
+
} catch (err) {
|
|
607
|
+
if (firstError === null) firstError = err;
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
items[i].body = void 0;
|
|
611
|
+
onAfterPut?.(items[i]);
|
|
612
|
+
}
|
|
613
|
+
})());
|
|
614
|
+
await Promise.all(workers);
|
|
615
|
+
if (firstError !== null) throw firstError;
|
|
616
|
+
}
|
|
617
|
+
async function uploadOne(item, cliLog, fetchImpl) {
|
|
618
|
+
if (!item.body) throw new Error(`internal: uploadOne invoked for ${item.path} with no body`);
|
|
619
|
+
const body = item.body;
|
|
620
|
+
const startedAt = Date.now();
|
|
621
|
+
cliLog?.info("r2_put_start", {
|
|
622
|
+
hash: item.hash,
|
|
623
|
+
path: item.path,
|
|
624
|
+
sizeBytes: body.length
|
|
625
|
+
});
|
|
626
|
+
let attempt = 0;
|
|
627
|
+
while (true) {
|
|
628
|
+
let res;
|
|
629
|
+
try {
|
|
630
|
+
res = await fetchImpl(item.url, {
|
|
631
|
+
method: "PUT",
|
|
632
|
+
body: new Uint8Array(body),
|
|
633
|
+
headers: item.headers
|
|
634
|
+
});
|
|
635
|
+
} catch (err) {
|
|
636
|
+
if (attempt < MAX_R2_PUT_RETRIES) {
|
|
637
|
+
cliLog?.warn("r2_put_retry", {
|
|
638
|
+
hash: item.hash,
|
|
639
|
+
path: item.path,
|
|
640
|
+
attempt: attempt + 1,
|
|
641
|
+
status: 0,
|
|
642
|
+
error: err instanceof Error ? err.message : String(err)
|
|
643
|
+
});
|
|
644
|
+
await sleep(RETRY_BACKOFF_MS[attempt]);
|
|
645
|
+
attempt++;
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
cliLog?.error("r2_put_end", err, {
|
|
649
|
+
hash: item.hash,
|
|
650
|
+
path: item.path,
|
|
651
|
+
durationMs: Date.now() - startedAt,
|
|
652
|
+
status: 0
|
|
653
|
+
});
|
|
654
|
+
throw new DirectR2PutError(0, item.hash, item.path, err instanceof Error ? err.message : String(err));
|
|
655
|
+
}
|
|
656
|
+
if (res.ok) {
|
|
657
|
+
cliLog?.info("r2_put_end", {
|
|
658
|
+
hash: item.hash,
|
|
659
|
+
path: item.path,
|
|
660
|
+
durationMs: Date.now() - startedAt,
|
|
661
|
+
status: res.status
|
|
662
|
+
});
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
const errBody = await safeReadText(res);
|
|
666
|
+
if ((res.status === 429 || res.status >= 500) && attempt < MAX_R2_PUT_RETRIES) {
|
|
667
|
+
cliLog?.warn("r2_put_retry", {
|
|
668
|
+
hash: item.hash,
|
|
669
|
+
path: item.path,
|
|
670
|
+
attempt: attempt + 1,
|
|
671
|
+
status: res.status,
|
|
672
|
+
body: truncate(errBody)
|
|
673
|
+
});
|
|
674
|
+
await sleep(res.status === 429 ? Math.max(1e3, RETRY_BACKOFF_MS[attempt]) : RETRY_BACKOFF_MS[attempt]);
|
|
675
|
+
attempt++;
|
|
676
|
+
continue;
|
|
677
|
+
}
|
|
678
|
+
cliLog?.error("r2_put_end", void 0, {
|
|
679
|
+
hash: item.hash,
|
|
680
|
+
path: item.path,
|
|
681
|
+
durationMs: Date.now() - startedAt,
|
|
682
|
+
status: res.status,
|
|
683
|
+
body: truncate(errBody)
|
|
684
|
+
});
|
|
685
|
+
throw new DirectR2PutError(res.status, item.hash, item.path, truncate(errBody));
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
async function safeReadText(res) {
|
|
689
|
+
try {
|
|
690
|
+
return await res.text();
|
|
691
|
+
} catch {
|
|
692
|
+
return "";
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
function truncate(s) {
|
|
696
|
+
return s.length > 500 ? `${s.slice(0, 500)}...` : s;
|
|
697
|
+
}
|
|
698
|
+
function sleep(ms) {
|
|
699
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
700
|
+
}
|
|
701
|
+
// src/cli/deploy-managed-events.ts
|
|
702
|
+
/**
|
|
703
|
+
* Apply the visible side effects of a streamed deploy event (spinner
|
|
704
|
+
* message or log warning). Returns a discriminated result so the caller
|
|
705
|
+
* advances its own state (deploymentId capture, final return, error
|
|
706
|
+
* throw). Pure function of (event, s) so the switch stays unit-testable.
|
|
707
|
+
*/
|
|
708
|
+
function applyDeployEvent(event, s) {
|
|
709
|
+
switch (event.event) {
|
|
710
|
+
case "start":
|
|
711
|
+
s.message("Deploying...");
|
|
712
|
+
return {
|
|
713
|
+
kind: "start",
|
|
714
|
+
deploymentId: event.deploymentId
|
|
715
|
+
};
|
|
716
|
+
case "heartbeat":
|
|
717
|
+
if (event.status === "recovering") s.message("Recovering interrupted deployment...");
|
|
718
|
+
return { kind: "continue" };
|
|
719
|
+
case "asset_upload":
|
|
720
|
+
if (event.new > 0) s.message(`Uploading assets (${event.new} new, ${event.cached} cached)`);
|
|
721
|
+
else s.message(`Uploading assets (${event.total} cached)`);
|
|
722
|
+
return { kind: "continue" };
|
|
723
|
+
case "provisioning":
|
|
724
|
+
s.message(`Provisioning ${event.bindings.join(", ")}`);
|
|
725
|
+
return { kind: "continue" };
|
|
726
|
+
case "worker_readiness":
|
|
727
|
+
s.message("Waiting for worker to become reachable...");
|
|
728
|
+
return { kind: "continue" };
|
|
729
|
+
case "migration_start":
|
|
730
|
+
s.message(`Checking ${event.pending} bundled migration${event.pending === 1 ? "" : "s"}...`);
|
|
731
|
+
return { kind: "continue" };
|
|
732
|
+
case "migration_warning":
|
|
733
|
+
log.warn(event.message);
|
|
734
|
+
return { kind: "continue" };
|
|
735
|
+
case "migration":
|
|
736
|
+
s.message(`Applied migration: ${event.name} (${event.durationMs}ms)`);
|
|
737
|
+
return { kind: "continue" };
|
|
738
|
+
case "worker_upload":
|
|
739
|
+
s.message("Uploading worker...");
|
|
740
|
+
return { kind: "continue" };
|
|
741
|
+
case "queue_setup":
|
|
742
|
+
s.message(`Configuring queue consumers: ${event.queues.join(", ")}`);
|
|
743
|
+
return { kind: "continue" };
|
|
744
|
+
case "queue_consumer_conflict":
|
|
745
|
+
log.warn(`Queue consumer conflict on "${event.queue}": owned by "${event.ownerScript}". Messages for this queue will not be delivered to this deployment until the owning script is removed.`);
|
|
746
|
+
return { kind: "continue" };
|
|
747
|
+
case "done":
|
|
748
|
+
if (event.published === false) s.stop("Deployed, but routing was not published — the project may be unreachable or still serving the previous deploy. Re-run `bwf deploy` to publish routing.");
|
|
749
|
+
else s.clear();
|
|
750
|
+
return {
|
|
751
|
+
kind: "done",
|
|
752
|
+
event
|
|
753
|
+
};
|
|
754
|
+
case "error":
|
|
755
|
+
s.stop("Deploy failed");
|
|
756
|
+
return {
|
|
757
|
+
kind: "error",
|
|
758
|
+
message: event.message
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
return { kind: "continue" };
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Apply a streamed `DeployEvent` iterator to the spinner / cliLog and
|
|
765
|
+
* resolve with the terminal `done` event (or throw on terminal error /
|
|
766
|
+
* connection loss).
|
|
767
|
+
*/
|
|
768
|
+
async function streamDeployEvents(projectId, events, s, cliLog) {
|
|
769
|
+
const startedAt = Date.now();
|
|
770
|
+
let deploymentId = null;
|
|
771
|
+
let lastProgressAt = startedAt;
|
|
772
|
+
let waitNotice;
|
|
773
|
+
let interrupted = false;
|
|
774
|
+
cliLog?.info("stream_start", { projectId });
|
|
775
|
+
const onSigint = () => {
|
|
776
|
+
interrupted = true;
|
|
777
|
+
s.stop("Deploy interrupted");
|
|
778
|
+
if (deploymentId) log.info(`Deployment: ${deploymentId}`);
|
|
779
|
+
else log.info("Deployment id was not received before the interrupt.");
|
|
780
|
+
cliLog?.warn("stream_interrupted", { deploymentId });
|
|
781
|
+
cliLog?.close().catch(() => {});
|
|
782
|
+
process.exit(130);
|
|
783
|
+
};
|
|
784
|
+
process.once("SIGINT", onSigint);
|
|
785
|
+
try {
|
|
786
|
+
for await (const event of events) {
|
|
787
|
+
if (event.event === "heartbeat") {
|
|
788
|
+
const fields = {
|
|
789
|
+
deploymentId,
|
|
790
|
+
step: event.step,
|
|
791
|
+
status: event.status,
|
|
792
|
+
recoveryAt: event.recoveryAt
|
|
793
|
+
};
|
|
794
|
+
if (event.status === "recovering" && waitNotice !== "recovering") {
|
|
795
|
+
log.info(`Deployment ${deploymentId ?? event.deploymentId ?? ""} is recovering; waiting for its result.`);
|
|
796
|
+
cliLog?.info("deploy_recovering", fields);
|
|
797
|
+
waitNotice = "recovering";
|
|
798
|
+
} else if (Date.now() - lastProgressAt >= 9e4 && waitNotice === void 0) {
|
|
799
|
+
log.warn(`Deployment ${deploymentId ?? event.deploymentId ?? ""} has not reported new progress for 90 seconds (last reported progress: ${event.step.replaceAll("_", " ")}).` + (event.recoveryAt ? ` Automatic recovery can start after ${event.recoveryAt} if execution was interrupted.` : "") + " Inspect with `bwf project status`.");
|
|
800
|
+
cliLog?.warn("deploy_progress_stalled", fields);
|
|
801
|
+
waitNotice = "stalled";
|
|
802
|
+
}
|
|
803
|
+
} else {
|
|
804
|
+
lastProgressAt = Date.now();
|
|
805
|
+
waitNotice = void 0;
|
|
806
|
+
}
|
|
807
|
+
const result = applyDeployEvent(event, s);
|
|
808
|
+
if (result.kind === "start") {
|
|
809
|
+
deploymentId = result.deploymentId;
|
|
810
|
+
cliLog?.info("stream_deployment_id", { deploymentId });
|
|
811
|
+
} else if (result.kind === "done") {
|
|
812
|
+
const degraded = result.event.published === false;
|
|
813
|
+
cliLog?.info(degraded ? "deploy_degraded" : "deploy_success", {
|
|
814
|
+
deploymentId,
|
|
815
|
+
url: result.event.url,
|
|
816
|
+
assets: result.event.assets,
|
|
817
|
+
workers: result.event.workers,
|
|
818
|
+
durationMs: Date.now() - startedAt,
|
|
819
|
+
degraded
|
|
820
|
+
});
|
|
821
|
+
return result.event;
|
|
822
|
+
} else if (result.kind === "error") {
|
|
823
|
+
cliLog?.error("deploy_server_error", void 0, {
|
|
824
|
+
deploymentId,
|
|
825
|
+
message: result.message
|
|
826
|
+
});
|
|
827
|
+
throw new DeployEventError(formatDeployFailureMessage(result.message, deploymentId, cliLog?.path ?? null));
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
} catch (err) {
|
|
831
|
+
if (err instanceof DeployEventError || interrupted) throw err;
|
|
832
|
+
cliLog?.error("stream_deploy_caught", err, { deploymentId });
|
|
833
|
+
s.stop("Deploy failed");
|
|
834
|
+
throw formatStreamDeployError(err, deploymentId, cliLog?.path ?? null);
|
|
835
|
+
} finally {
|
|
836
|
+
process.removeListener("SIGINT", onSigint);
|
|
837
|
+
}
|
|
838
|
+
cliLog?.warn("stream_no_terminal_event", { deploymentId });
|
|
839
|
+
s.stop("Deploy failed");
|
|
840
|
+
throw new Error(formatConnectionLostMessage(deploymentId, cliLog?.path ?? null));
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Upload Worker modules straight to R2 and return the `workerInput` that
|
|
844
|
+
* finalization names them by. The platform checks the Worker against
|
|
845
|
+
* Cloudflare's size limit when it issues the URLs, so a Worker that is too
|
|
846
|
+
* large fails before any bytes are sent. Each buffer leaves `workerFiles`
|
|
847
|
+
* once R2 acknowledges its PUT.
|
|
848
|
+
*/
|
|
849
|
+
async function uploadWorkerModules(client, projectId, workerFiles, s, cliLog) {
|
|
850
|
+
const modules = Array.from(workerFiles, ([name, body]) => ({
|
|
851
|
+
name,
|
|
852
|
+
size: body.length,
|
|
853
|
+
sha256: createHash("sha256").update(body).digest("hex")
|
|
854
|
+
}));
|
|
855
|
+
s.message(`Requesting upload URLs for ${formatCount(modules.length, "worker module")}...`);
|
|
856
|
+
cliLog?.info("worker_presign_request_start", {
|
|
857
|
+
moduleCount: modules.length,
|
|
858
|
+
totalBytes: modules.reduce((total, module) => total + module.size, 0)
|
|
859
|
+
});
|
|
860
|
+
const presignStartedAt = Date.now();
|
|
861
|
+
const { id, urls } = await client.requestWorkerUploadUrls(projectId, modules);
|
|
862
|
+
cliLog?.info("worker_presign_request_end", {
|
|
863
|
+
uploadId: id,
|
|
864
|
+
durationMs: Date.now() - presignStartedAt
|
|
865
|
+
});
|
|
866
|
+
const items = modules.map((module, index) => ({
|
|
867
|
+
path: module.name,
|
|
868
|
+
hash: module.sha256,
|
|
869
|
+
body: workerFiles.get(module.name),
|
|
870
|
+
url: urls[index].url,
|
|
871
|
+
headers: urls[index].headers
|
|
872
|
+
}));
|
|
873
|
+
s.message(`Uploading ${formatCount(items.length, "worker module")} to R2...`);
|
|
874
|
+
await uploadAssetsToR2(items, cliLog, void 0, (item) => {
|
|
875
|
+
workerFiles.delete(item.path);
|
|
876
|
+
});
|
|
877
|
+
return {
|
|
878
|
+
id,
|
|
879
|
+
modules
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Direct-to-R2 deploy orchestration. Issues presigned PUT URLs for each
|
|
884
|
+
* needed asset, uploads bytes directly to R2, then calls the manifest-only
|
|
885
|
+
* deploy endpoint to finalize. When the platform supports it, Worker modules
|
|
886
|
+
* go to R2 the same way, before the assets.
|
|
887
|
+
*
|
|
888
|
+
* Key invariants:
|
|
889
|
+
* 1. No needed assets → skip presign + R2 PUT phase entirely (saves a
|
|
890
|
+
* round-trip when every asset was already present from a prior deploy).
|
|
891
|
+
* 2. Asset and Worker bytes come exclusively from the in-memory
|
|
892
|
+
* `assetFiles` / `workerFiles` caches computed by `collectAndHashAssets`
|
|
893
|
+
* and `collectWorkerFiles` — files are NEVER re-read from disk during
|
|
894
|
+
* this flow.
|
|
895
|
+
* 3. R2 PUT failures (4xx, 5xx, network) are surfaced with the asset
|
|
896
|
+
* path + hash (or Worker module name + SHA-256) so the user can
|
|
897
|
+
* correlate against the JSONL trace.
|
|
898
|
+
*/
|
|
899
|
+
async function streamDirectR2Deploy({ client, projectId, manifest, assetManifest, assetFiles, needed, gitMetadata, preflightUsed, workerFiles, spinner: s, cliLog }) {
|
|
900
|
+
const workerInput = workerFiles && workerFiles.size > 0 && await client.supportsDirectWorkerUpload() ? await uploadWorkerModules(client, projectId, workerFiles, s, cliLog) : void 0;
|
|
901
|
+
if (needed.length > 0) {
|
|
902
|
+
const neededPaths = new Set(needed);
|
|
903
|
+
const preBufferCount = assetFiles.size;
|
|
904
|
+
for (const path of assetFiles.keys()) if (!neededPaths.has(path)) assetFiles.delete(path);
|
|
905
|
+
if (assetFiles.size !== preBufferCount) cliLog?.info("asset_cache_pruned", {
|
|
906
|
+
before: preBufferCount,
|
|
907
|
+
after: assetFiles.size
|
|
908
|
+
});
|
|
909
|
+
s.message(`Requesting upload URLs for ${formatCount(needed.length, "asset")}...`);
|
|
910
|
+
const seenBlake3 = /* @__PURE__ */ new Set();
|
|
911
|
+
const uniqueNeeded = [];
|
|
912
|
+
for (const path of needed) {
|
|
913
|
+
const entry = assetManifest[path];
|
|
914
|
+
if (!entry) throw new Error(`internal: preflight returned ${path} but assetManifest has no entry`);
|
|
915
|
+
if (seenBlake3.has(entry.blake3)) continue;
|
|
916
|
+
seenBlake3.add(entry.blake3);
|
|
917
|
+
uniqueNeeded.push(path);
|
|
918
|
+
}
|
|
919
|
+
const assetsToUpload = uniqueNeeded.map((path) => {
|
|
920
|
+
const entry = assetManifest[path];
|
|
921
|
+
return {
|
|
922
|
+
blake3: entry.blake3,
|
|
923
|
+
md5: entry.md5,
|
|
924
|
+
size: entry.size,
|
|
925
|
+
contentType: getContentType(path)
|
|
926
|
+
};
|
|
927
|
+
});
|
|
928
|
+
cliLog?.info("presign_request_start", {
|
|
929
|
+
assetCount: assetsToUpload.length,
|
|
930
|
+
dedupedFrom: needed.length
|
|
931
|
+
});
|
|
932
|
+
const presignStartedAt = Date.now();
|
|
933
|
+
const urls = await client.requestUploadUrls(projectId, assetsToUpload);
|
|
934
|
+
cliLog?.info("presign_request_end", {
|
|
935
|
+
urlsReceived: Object.keys(urls).length,
|
|
936
|
+
durationMs: Date.now() - presignStartedAt
|
|
937
|
+
});
|
|
938
|
+
const items = uniqueNeeded.map((path) => {
|
|
939
|
+
const entry = assetManifest[path];
|
|
940
|
+
const presigned = urls[entry.blake3];
|
|
941
|
+
if (!presigned) throw new Error(`Platform did not return an upload URL for ${path} (blake3=${entry.blake3}). This indicates a server-side bug or a stale client.`);
|
|
942
|
+
const body = assetFiles.get(path);
|
|
943
|
+
if (!body) throw new Error(`internal: asset ${path} declared in manifest but missing from buffer cache`);
|
|
944
|
+
return {
|
|
945
|
+
path,
|
|
946
|
+
hash: entry.blake3,
|
|
947
|
+
body,
|
|
948
|
+
url: presigned.url,
|
|
949
|
+
headers: presigned.headers
|
|
950
|
+
};
|
|
951
|
+
});
|
|
952
|
+
s.message(`Uploading ${formatCount(items.length, "asset")} to R2...`);
|
|
953
|
+
await uploadAssetsToR2(items, cliLog, void 0, (item) => {
|
|
954
|
+
assetFiles.delete(item.path);
|
|
955
|
+
});
|
|
956
|
+
} else {
|
|
957
|
+
assetFiles.clear();
|
|
958
|
+
cliLog?.info("presign_skipped", { reason: "no_needed_assets" });
|
|
959
|
+
}
|
|
960
|
+
let encodedWorkerFiles;
|
|
961
|
+
if (!workerInput && workerFiles && workerFiles.size > 0) {
|
|
962
|
+
encodedWorkerFiles = {};
|
|
963
|
+
for (const [relPath, buf] of workerFiles) encodedWorkerFiles[relPath] = buf.toString("base64");
|
|
964
|
+
}
|
|
965
|
+
const artifact = createDeployArtifact({
|
|
966
|
+
manifest,
|
|
967
|
+
assetManifest,
|
|
968
|
+
workerFiles: encodedWorkerFiles
|
|
969
|
+
});
|
|
970
|
+
const payload = createDeployUploadPayload(artifact, {
|
|
971
|
+
source: getTokenSource(),
|
|
972
|
+
commit: gitMetadata?.commit ?? null,
|
|
973
|
+
repositoryUrl: gitMetadata?.repositoryUrl ?? null,
|
|
974
|
+
commitUrl: gitMetadata?.commitUrl ?? null,
|
|
975
|
+
gitRef: gitMetadata?.gitRef ?? null,
|
|
976
|
+
preflight: preflightUsed ? "true" : null
|
|
977
|
+
}, workerInput);
|
|
978
|
+
s.message("Finalizing deploy...");
|
|
979
|
+
cliLog?.info("finalize_start", {
|
|
980
|
+
workerFileCount: workerInput?.modules.length ?? workerFiles?.size ?? 0,
|
|
981
|
+
...workerInput && { workerUploadId: workerInput.id },
|
|
982
|
+
assetCount: Object.keys(assetManifest).length
|
|
983
|
+
});
|
|
984
|
+
const finalizeStartedAt = Date.now();
|
|
985
|
+
try {
|
|
986
|
+
return await streamDeployEvents(projectId, client.finalizeDeploy(projectId, payload), s, cliLog);
|
|
987
|
+
} finally {
|
|
988
|
+
cliLog?.info("finalize_end", { durationMs: Date.now() - finalizeStartedAt });
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Surface a persistent warning when a deploy committed live but its routing
|
|
993
|
+
* KV was not published. Uses `log.warn` (not the spinner) so the warning
|
|
994
|
+
* survives the following `note`/`outro` calls and the user sees it after the
|
|
995
|
+
* deploy summary. The deploy is still committed — this is a warning, not a
|
|
996
|
+
* failure, so the process exit code is unaffected.
|
|
997
|
+
*/
|
|
998
|
+
function warnUnpublishedRouting(result) {
|
|
999
|
+
if (result.published !== false) return;
|
|
1000
|
+
log.warn("Routing was not published for this deploy. The project may be unreachable (first deploy) or still serving the previous deploy. Re-run `bwf deploy` to publish routing.");
|
|
1001
|
+
}
|
|
1002
|
+
/** Merge `_headers` / `_redirects` in `dir` with `bwf.config.ts` routing rules, then lint them. */
|
|
1003
|
+
function mergeAndLintRoutingRules(dir, routing) {
|
|
1004
|
+
const merged = mergeRoutingRules({
|
|
1005
|
+
dir,
|
|
1006
|
+
routing
|
|
1007
|
+
});
|
|
1008
|
+
warnRedundantForceOn3xx(merged.redundantForceOn3xx);
|
|
1009
|
+
lintRoutingPhases(merged);
|
|
1010
|
+
return merged;
|
|
1011
|
+
}
|
|
1012
|
+
/** Warn once about `!` suffixes on 3xx `_redirects` entries, which are no-ops. */
|
|
1013
|
+
function warnRedundantForceOn3xx(count) {
|
|
1014
|
+
if (count === 0) return;
|
|
1015
|
+
log.warn(`Found ${count} redundant "!" on 3xx entries in _redirects (these always force by nature; safe to remove).`);
|
|
1016
|
+
}
|
|
1017
|
+
// src/shared/collect-files.ts
|
|
1018
|
+
/**
|
|
1019
|
+
* Every non-directory path under `dir`, depth first. Unlike
|
|
1020
|
+
* `readdirSync(dir, { recursive: true })`, it does not descend into
|
|
1021
|
+
* symlinked directories.
|
|
1022
|
+
*/
|
|
1023
|
+
function collectFiles(dir) {
|
|
1024
|
+
const files = [];
|
|
1025
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
1026
|
+
const fullPath = join(dir, entry.name);
|
|
1027
|
+
if (entry.isDirectory()) files.push(...collectFiles(fullPath));
|
|
1028
|
+
else files.push(fullPath);
|
|
1029
|
+
}
|
|
1030
|
+
return files;
|
|
1031
|
+
}
|
|
1032
|
+
// src/cli/package.ts
|
|
1033
|
+
const textEncoder = new TextEncoder();
|
|
1034
|
+
/**
|
|
1035
|
+
* Strip dev-only / internal-only fields from each rule before shipping the
|
|
1036
|
+
* manifest. The resulting entries contain only `{ source, destination, status }`.
|
|
1037
|
+
*
|
|
1038
|
+
* - `origin` is used to build the `X-Nosam-Routing` trace header during local
|
|
1039
|
+
* dev; the deployed platform doesn't consume it.
|
|
1040
|
+
* - `force` is used internally by the CLI/router to split rules into the
|
|
1041
|
+
* `redirectRules` (pre-asset, always-fires) and `fallbackRules` (post-asset,
|
|
1042
|
+
* only when the asset resolver 404s) buckets and to label the trace header
|
|
1043
|
+
* on `node`/`bun`/`deno` targets. The platform dispatch worker decides phase
|
|
1044
|
+
* purely from which array the rule lives in, so shipping `force` is dead weight.
|
|
1045
|
+
*
|
|
1046
|
+
* Keep in sync with `stripOriginForProd` in `router/compile.ts`, which strips
|
|
1047
|
+
* only `origin` because the Node/Bun/Deno-target generated code still reads
|
|
1048
|
+
* `force` at runtime to label the dev trace header.
|
|
1049
|
+
*/
|
|
1050
|
+
function stripDevOnlyRuleFields(rules) {
|
|
1051
|
+
if (!rules) return rules;
|
|
1052
|
+
return rules.map(({ origin: _origin, force: _force, ...rest }) => rest);
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Layer user `routing.fallbacks` over the SPA default. The platform SPA switch
|
|
1056
|
+
* is global, so a SPA with user fallbacks turns it off and appends a synthetic
|
|
1057
|
+
* `/* -> /index.html` rule after them (first match wins). An explicit
|
|
1058
|
+
* `routing.notFound` is resolved first, so overriding away from SPA also skips
|
|
1059
|
+
* the synthetic rule. `detectPreset` classes a plain Vite MPA as `spa`, so this
|
|
1060
|
+
* override is its only escape hatch.
|
|
1061
|
+
*/
|
|
1062
|
+
function resolveSpaFallbackChain(appType, fallbackRules, notFound) {
|
|
1063
|
+
const userRules = fallbackRules && fallbackRules.length > 0 ? fallbackRules : void 0;
|
|
1064
|
+
const handling = notFound ?? (appType === "spa" ? "single-page-application" : appType === "static" ? "404-page" : "none");
|
|
1065
|
+
if (handling !== "single-page-application") return {
|
|
1066
|
+
assetConfig: { not_found_handling: handling },
|
|
1067
|
+
fallbackRules: userRules
|
|
1068
|
+
};
|
|
1069
|
+
if (!userRules) return {
|
|
1070
|
+
assetConfig: { not_found_handling: "single-page-application" },
|
|
1071
|
+
fallbackRules: void 0
|
|
1072
|
+
};
|
|
1073
|
+
if (userRules.some((r) => r.host === void 0 && r.source === "/*" && r.destination === "/index.html")) return {
|
|
1074
|
+
assetConfig: { not_found_handling: "none" },
|
|
1075
|
+
fallbackRules: userRules
|
|
1076
|
+
};
|
|
1077
|
+
const syntheticSpaFallback = {
|
|
1078
|
+
source: "/*",
|
|
1079
|
+
destination: "/index.html",
|
|
1080
|
+
status: 200,
|
|
1081
|
+
force: false,
|
|
1082
|
+
origin: "spa-default"
|
|
1083
|
+
};
|
|
1084
|
+
return {
|
|
1085
|
+
assetConfig: { not_found_handling: "none" },
|
|
1086
|
+
fallbackRules: [...userRules, syntheticSpaFallback]
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
function isNotFoundError(err) {
|
|
1090
|
+
return err instanceof Error && err.code === "ENOENT";
|
|
1091
|
+
}
|
|
1092
|
+
const PROGRESS_CHUNK = 50;
|
|
1093
|
+
/**
|
|
1094
|
+
* Yield to the event loop every PROGRESS_CHUNK iterations so spinner ticks
|
|
1095
|
+
* can repaint, and emit a progress message via onProgress. Otherwise the
|
|
1096
|
+
* tight sync loop blocks the spinner interval and the user sees no updates.
|
|
1097
|
+
*/
|
|
1098
|
+
async function tickProgress(i, total, onProgress, label) {
|
|
1099
|
+
if (!onProgress) return;
|
|
1100
|
+
if (i % PROGRESS_CHUNK !== 0 && i !== total) return;
|
|
1101
|
+
onProgress(`${label} (${i}/${total})`);
|
|
1102
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Compute a CF-compatible asset hash: BLAKE3 of base64(content) + extension,
|
|
1106
|
+
* first 32 hex chars. Matches Wrangler's hashFile algorithm exactly.
|
|
1107
|
+
* Must match the API's computeAssetHash algorithm exactly.
|
|
1108
|
+
*/
|
|
1109
|
+
function computeAssetHash(content, filePath) {
|
|
1110
|
+
const base64 = content.toString("base64");
|
|
1111
|
+
const ext = extname(filePath).substring(1);
|
|
1112
|
+
const input = textEncoder.encode(base64 + ext);
|
|
1113
|
+
return Buffer.from(hash(input)).toString("hex").slice(0, 32);
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Compute MD5 of raw content as a 32-char lowercase hex string.
|
|
1117
|
+
*
|
|
1118
|
+
* Used as the wire-level upload-integrity primitive on direct-to-R2 PUTs:
|
|
1119
|
+
* R2's S3 compatibility layer enforces `Content-MD5` (RFC 1864) on PutObject,
|
|
1120
|
+
* so the upload itself fails if uploaded bytes don't match the declared MD5.
|
|
1121
|
+
* MD5 collision resistance is acceptable here because (a) this hash is purely
|
|
1122
|
+
* an upload-integrity primitive (BLAKE3 remains the canonical content key),
|
|
1123
|
+
* and (b) project-scoped storage (`assets/${projectId}/${blake3}`) means any
|
|
1124
|
+
* collision attack is exploitable only against the attacker's own project.
|
|
1125
|
+
*/
|
|
1126
|
+
function computeMd5(content) {
|
|
1127
|
+
return createHash("md5").update(content).digest("hex");
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Create a filter function that excludes .assetsignore, _headers, _redirects,
|
|
1131
|
+
* OS metadata files, dotenv files, deploy-internal patterns, and any patterns
|
|
1132
|
+
* listed in a .assetsignore file.
|
|
1133
|
+
* Matches Wrangler's createAssetsIgnoreFunction from workers-shared/utils/helpers.ts.
|
|
1134
|
+
*/
|
|
1135
|
+
function createAssetsIgnoreFunction(dir, extraPatterns = []) {
|
|
1136
|
+
const patterns = [
|
|
1137
|
+
"/.assetsignore",
|
|
1138
|
+
"/_redirects",
|
|
1139
|
+
"/_headers",
|
|
1140
|
+
".DS_Store",
|
|
1141
|
+
".env",
|
|
1142
|
+
".env.*",
|
|
1143
|
+
...extraPatterns
|
|
1144
|
+
];
|
|
1145
|
+
const assetsIgnorePath = join(dir, ".assetsignore");
|
|
1146
|
+
let assetsIgnoreFilePresent = false;
|
|
1147
|
+
if (existsSync(assetsIgnorePath)) {
|
|
1148
|
+
assetsIgnoreFilePresent = true;
|
|
1149
|
+
const content = readFileSync(assetsIgnorePath, "utf-8");
|
|
1150
|
+
patterns.push(...content.split("\n"));
|
|
1151
|
+
}
|
|
1152
|
+
const ig = ignore().add(patterns);
|
|
1153
|
+
const isIgnored = (relativePath) => {
|
|
1154
|
+
const normalized = relativePath.startsWith("/") ? relativePath.slice(1) : relativePath;
|
|
1155
|
+
return ig.test(normalized).ignored;
|
|
1156
|
+
};
|
|
1157
|
+
return {
|
|
1158
|
+
isIgnored,
|
|
1159
|
+
assetsIgnoreFilePresent
|
|
1160
|
+
};
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Guard against accidentally uploading _worker.js as a static asset.
|
|
1164
|
+
* Matches Wrangler's errorOnLegacyPagesWorkerJSAsset behavior:
|
|
1165
|
+
* throws only when no .assetsignore file exists (if .assetsignore is present
|
|
1166
|
+
* but doesn't exclude _worker.js, the user intentionally wants to upload it).
|
|
1167
|
+
*/
|
|
1168
|
+
function checkWorkerJsAsset(relativePath, assetsIgnoreFilePresent) {
|
|
1169
|
+
if (assetsIgnoreFilePresent) return;
|
|
1170
|
+
const name = relativePath.startsWith("/") ? relativePath.slice(1) : relativePath;
|
|
1171
|
+
if (name === "_worker.js" || name.startsWith("_worker.js/")) throw new Error(`deploy: Refusing to upload _worker.js ${name === "_worker.js" ? "file" : "directory"} as an asset. This could expose private server-side code to the public Internet. If this is unintended, remove it or add a .assetsignore file containing "_worker.js". If intentional, add an empty .assetsignore file to suppress this error.`);
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Collect all files in a directory, compute hashes, and return both the
|
|
1175
|
+
* manifest (for preflight) and the raw file map (for selective packaging).
|
|
1176
|
+
*
|
|
1177
|
+
* Each file is read from disk exactly once. Both BLAKE3 (storage key) and
|
|
1178
|
+
* MD5 (R2 upload-integrity) digests are derived from that single buffer.
|
|
1179
|
+
*/
|
|
1180
|
+
async function collectAndHashAssets(dir, onProgress, opts = {}) {
|
|
1181
|
+
const assetManifest = {};
|
|
1182
|
+
const assetFiles = /* @__PURE__ */ new Map();
|
|
1183
|
+
try {
|
|
1184
|
+
const { isIgnored, assetsIgnoreFilePresent } = createAssetsIgnoreFunction(dir, opts.ignorePatterns);
|
|
1185
|
+
const files = collectAssetFiles(dir, isIgnored);
|
|
1186
|
+
let processed = 0;
|
|
1187
|
+
for (const filePath of files) {
|
|
1188
|
+
processed++;
|
|
1189
|
+
await tickProgress(processed, files.length, onProgress, "Hashing assets");
|
|
1190
|
+
const relativePath = "/" + relative(dir, filePath);
|
|
1191
|
+
checkWorkerJsAsset(relativePath, assetsIgnoreFilePresent);
|
|
1192
|
+
const content = readFileSync(filePath);
|
|
1193
|
+
const blake3 = computeAssetHash(content, filePath);
|
|
1194
|
+
assetManifest[relativePath] = {
|
|
1195
|
+
blake3,
|
|
1196
|
+
md5: computeMd5(content),
|
|
1197
|
+
size: content.length,
|
|
1198
|
+
hash: blake3
|
|
1199
|
+
};
|
|
1200
|
+
assetFiles.set(relativePath, content);
|
|
1201
|
+
}
|
|
1202
|
+
} catch (err) {
|
|
1203
|
+
if (!isNotFoundError(err)) throw err;
|
|
1204
|
+
}
|
|
1205
|
+
return {
|
|
1206
|
+
assetManifest,
|
|
1207
|
+
assetFiles
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
function toWebSocketManifest(routes) {
|
|
1211
|
+
if (!routes || routes.length === 0) return;
|
|
1212
|
+
return {
|
|
1213
|
+
routes: routes.map((route) => ({
|
|
1214
|
+
pattern: route.pattern,
|
|
1215
|
+
filePath: route.filePath,
|
|
1216
|
+
className: route.className,
|
|
1217
|
+
mode: route.mode,
|
|
1218
|
+
hasAuthGate: route.hasAuthGate
|
|
1219
|
+
})),
|
|
1220
|
+
classes: routes.map((route) => route.className)
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
function toSandboxManifest(sandbox) {
|
|
1224
|
+
return {
|
|
1225
|
+
controllerProtocol: 2,
|
|
1226
|
+
bindingName: sandbox.binding,
|
|
1227
|
+
className: sandbox.className,
|
|
1228
|
+
containerName: sandbox.containerName,
|
|
1229
|
+
image: sandbox.platformImage,
|
|
1230
|
+
...sandbox.instanceType && { instanceType: sandbox.instanceType }
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
function toLiveManifest(live) {
|
|
1234
|
+
const bindingName = live?.bindingName ?? "BWF_LIVE";
|
|
1235
|
+
const className = live?.className ?? "NosamLiveStreamDurableObject";
|
|
1236
|
+
return {
|
|
1237
|
+
bindingName,
|
|
1238
|
+
className,
|
|
1239
|
+
storage: "sqlite",
|
|
1240
|
+
classes: [className],
|
|
1241
|
+
migrations: [{
|
|
1242
|
+
tag: LIVE_MIGRATION_TAG,
|
|
1243
|
+
newSqliteClasses: [className]
|
|
1244
|
+
}]
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* If the user configured `routing.fallbacks` on an app whose resolved
|
|
1249
|
+
* `not_found_handling` is not `single-page-application`, the platform still
|
|
1250
|
+
* applies the rules but no `/* -> /index.html` SPA shell is synthesised —
|
|
1251
|
+
* unmatched paths fall through to the platform 404. Returns the warning
|
|
1252
|
+
* message string when that mismatch is detected, or `null` otherwise. Pure
|
|
1253
|
+
* function; callers decide whether/how to surface the message (CLI progress,
|
|
1254
|
+
* `console.warn`, etc.).
|
|
1255
|
+
*
|
|
1256
|
+
* The message names `not_found_handling` rather than the app type because an
|
|
1257
|
+
* explicit `routing.notFound` can land here too — the app may well be a SPA.
|
|
1258
|
+
*/
|
|
1259
|
+
function detectNonSpaFallbackWarning(assetConfig, fallbackRules) {
|
|
1260
|
+
if (assetConfig?.not_found_handling === "single-page-application") return null;
|
|
1261
|
+
if (!fallbackRules || fallbackRules.length === 0) return null;
|
|
1262
|
+
return "routing.fallbacks is set but not_found_handling is not \"single-page-application\"; fallbacks will be applied, but no \"/* -> /index.html\" SPA shell fallback is synthesised — unmatched paths fall through to the platform 404.";
|
|
1263
|
+
}
|
|
1264
|
+
/** Add the database, KV, R2, and AI bindings to a bwf manifest. */
|
|
1265
|
+
function applyResourceBindings(manifest, bindings, migrationCount, dialect, bindingNames) {
|
|
1266
|
+
if (needsApplicationDatabase(bindings, migrationCount)) {
|
|
1267
|
+
if (dialect !== "sqlite") manifest.bindings.hyperdrive = ["HYPERDRIVE"];
|
|
1268
|
+
else manifest.bindings.d1 = [bindingNames?.d1 ?? "DB"];
|
|
1269
|
+
}
|
|
1270
|
+
if (bindings.needsKV) manifest.bindings.kv = [bindingNames?.kv ?? "KV"];
|
|
1271
|
+
if (bindings.needsR2) manifest.bindings.r2 = [bindingNames?.r2 ?? "STORAGE"];
|
|
1272
|
+
if (bindings.needsAI) manifest.bindings.ai = true;
|
|
1273
|
+
}
|
|
1274
|
+
/** Describe bundled migrations; SQLite migrations also carry their plan bundle. */
|
|
1275
|
+
function toMigrationsManifest(migrations, dialect) {
|
|
1276
|
+
const planBundle = dialect === "sqlite" ? buildMigrationPlanBundle(migrations) : void 0;
|
|
1277
|
+
return {
|
|
1278
|
+
dialect,
|
|
1279
|
+
...planBundle ? {
|
|
1280
|
+
classifierVersion: planBundle.classifierVersion,
|
|
1281
|
+
migrationListHash: planBundle.migrationListHash,
|
|
1282
|
+
protocolVersion: planBundle.protocolVersion,
|
|
1283
|
+
stability: planBundle.plans.some((plan) => plan.stability === "legacy") ? "legacy" : "stable"
|
|
1284
|
+
} : {},
|
|
1285
|
+
pending: migrations.length
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Build a Nosam-app deploy manifest from the inferred bindings + per-feature
|
|
1290
|
+
* inputs. Pure shape transformation: reads no files, has no I/O.
|
|
1291
|
+
*
|
|
1292
|
+
* Note: callers are responsible for surfacing the non-SPA-fallbacks warning
|
|
1293
|
+
* (see `detectNonSpaFallbackWarning`) before invoking this builder. The
|
|
1294
|
+
* builder itself stays I/O-free.
|
|
1295
|
+
*/
|
|
1296
|
+
function buildBwfManifest(opts) {
|
|
1297
|
+
const { bindings, migrations, schedules, ssr, vars, queues, assetConfig, options, hashedAssetsPrefix, headerRules, redirectRules, fallbackRules, dialect, webSockets } = opts;
|
|
1298
|
+
const resolvedDialect = dialect ?? "sqlite";
|
|
1299
|
+
const manifest = {
|
|
1300
|
+
version: 3,
|
|
1301
|
+
assetManifestVersion: 2,
|
|
1302
|
+
bindings: {}
|
|
1303
|
+
};
|
|
1304
|
+
if (opts.alwaysUseHttps !== void 0) manifest.alwaysUseHttps = opts.alwaysUseHttps;
|
|
1305
|
+
if (opts.durableObjects?.length) {
|
|
1306
|
+
manifest.version = 4;
|
|
1307
|
+
manifest.durableObjects = { bindings: opts.durableObjects.map(({ bindingName, className }) => ({
|
|
1308
|
+
bindingName,
|
|
1309
|
+
className,
|
|
1310
|
+
storage: "sqlite"
|
|
1311
|
+
})) };
|
|
1312
|
+
}
|
|
1313
|
+
if (opts.hasEmailHandlers) manifest.emailProtocolVersion = 1;
|
|
1314
|
+
if (bindings.needsAuth) manifest.auth = true;
|
|
1315
|
+
if (opts.bindings.needsR2 && opts.storage?.locationHint) {
|
|
1316
|
+
manifest.storage = opts.storage;
|
|
1317
|
+
manifest.version = 5;
|
|
1318
|
+
}
|
|
1319
|
+
applyResourceBindings(manifest, bindings, migrations?.length ?? 0, resolvedDialect, options?.bindingNames);
|
|
1320
|
+
if (bindings.needsSandbox) {
|
|
1321
|
+
if (!options?.sandbox) throw new Error("deploy: Sandbox bindings require sandbox package options.");
|
|
1322
|
+
manifest.sandbox = toSandboxManifest({
|
|
1323
|
+
...options.sandbox,
|
|
1324
|
+
binding: options.bindingNames?.sandbox ?? options.sandbox.binding
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
if (bindings.needsLive) manifest.live = toLiveManifest(options?.live);
|
|
1328
|
+
if (migrations && migrations.length > 0) manifest.migrations = toMigrationsManifest(migrations, resolvedDialect);
|
|
1329
|
+
if (schedules && schedules.length > 0) manifest.schedules = schedules;
|
|
1330
|
+
if (queues && queues.length > 0) manifest.queues = queues;
|
|
1331
|
+
if (ssr) manifest.ssr = true;
|
|
1332
|
+
manifest.type = "nosam";
|
|
1333
|
+
let resolvedAssetConfig = assetConfig;
|
|
1334
|
+
let resolvedFallbackRules = fallbackRules;
|
|
1335
|
+
if (assetConfig?.not_found_handling === "single-page-application") {
|
|
1336
|
+
const chain = resolveSpaFallbackChain("spa", fallbackRules);
|
|
1337
|
+
resolvedAssetConfig = {
|
|
1338
|
+
...assetConfig,
|
|
1339
|
+
...chain.assetConfig
|
|
1340
|
+
};
|
|
1341
|
+
resolvedFallbackRules = chain.fallbackRules;
|
|
1342
|
+
}
|
|
1343
|
+
if (resolvedAssetConfig) manifest.assetConfig = resolvedAssetConfig;
|
|
1344
|
+
if (vars && Object.keys(vars).length > 0) manifest.vars = vars;
|
|
1345
|
+
if (options?.workerMain) manifest.workerMain = options.workerMain;
|
|
1346
|
+
if (options?.compatibilityDate) manifest.compatibilityDate = options.compatibilityDate;
|
|
1347
|
+
if (options?.compatibilityFlags && options.compatibilityFlags.length > 0) manifest.compatibilityFlags = options.compatibilityFlags;
|
|
1348
|
+
if (options?.cpuMs) manifest.limits = { cpuMs: options.cpuMs };
|
|
1349
|
+
if (hashedAssetsPrefix) manifest.hashedAssetsPrefix = hashedAssetsPrefix;
|
|
1350
|
+
if (headerRules && headerRules.length > 0) manifest.headerRules = headerRules;
|
|
1351
|
+
if (redirectRules && redirectRules.length > 0) manifest.redirectRules = stripDevOnlyRuleFields(redirectRules);
|
|
1352
|
+
if (resolvedFallbackRules && resolvedFallbackRules.length > 0) manifest.fallbackRules = stripDevOnlyRuleFields(resolvedFallbackRules);
|
|
1353
|
+
const websocketManifest = toWebSocketManifest(webSockets);
|
|
1354
|
+
if (websocketManifest) manifest.websocket = websocketManifest;
|
|
1355
|
+
return manifest;
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Read every worker module under `workerDir` once and return them as a map
|
|
1359
|
+
* keyed by relative path. Skipped files (build metadata, wrangler config,
|
|
1360
|
+
* non-module extensions) are filtered out by `isWorkerModule`. Reads each
|
|
1361
|
+
* file from disk exactly once — buffer threading downstream is the caller's
|
|
1362
|
+
* responsibility.
|
|
1363
|
+
*/
|
|
1364
|
+
function collectWorkerFiles(workerDir) {
|
|
1365
|
+
const out = /* @__PURE__ */ new Map();
|
|
1366
|
+
let workerPaths;
|
|
1367
|
+
try {
|
|
1368
|
+
workerPaths = collectFiles(workerDir);
|
|
1369
|
+
} catch (err) {
|
|
1370
|
+
if (isNotFoundError(err)) return out;
|
|
1371
|
+
throw err;
|
|
1372
|
+
}
|
|
1373
|
+
for (const filePath of workerPaths) {
|
|
1374
|
+
const relativePath = relative(workerDir, filePath);
|
|
1375
|
+
if (!isWorkerModule(relativePath)) continue;
|
|
1376
|
+
out.set(relativePath, readFileSync(filePath));
|
|
1377
|
+
}
|
|
1378
|
+
return out;
|
|
1379
|
+
}
|
|
1380
|
+
const WRANGLER_HTML_HANDLING = /* @__PURE__ */ new Set([
|
|
1381
|
+
"auto-trailing-slash",
|
|
1382
|
+
"force-trailing-slash",
|
|
1383
|
+
"drop-trailing-slash",
|
|
1384
|
+
"none"
|
|
1385
|
+
]);
|
|
1386
|
+
/** Read `assets.html_handling` from a materialized root Wrangler config object. */
|
|
1387
|
+
function readWranglerHtmlHandling(rootConfig) {
|
|
1388
|
+
const assets = rootConfig.assets;
|
|
1389
|
+
if (typeof assets !== "object" || assets === null || Array.isArray(assets)) return;
|
|
1390
|
+
const value = assets.html_handling;
|
|
1391
|
+
return typeof value === "string" && WRANGLER_HTML_HANDLING.has(value) ? value : void 0;
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Build a static-deploy manifest. Pure shape transformation — no I/O.
|
|
1395
|
+
*/
|
|
1396
|
+
function buildStaticManifest(opts) {
|
|
1397
|
+
const { appType, hashedAssetsPrefix, headerRules, redirectRules, fallbackRules, notFound, html_handling } = opts;
|
|
1398
|
+
const { assetConfig, fallbackRules: resolvedFallbackRules } = resolveSpaFallbackChain(appType, fallbackRules, notFound);
|
|
1399
|
+
const resolvedAssetConfig = html_handling === void 0 ? assetConfig : {
|
|
1400
|
+
...assetConfig,
|
|
1401
|
+
html_handling
|
|
1402
|
+
};
|
|
1403
|
+
const manifest = {
|
|
1404
|
+
version: 3,
|
|
1405
|
+
assetManifestVersion: 2,
|
|
1406
|
+
bindings: {},
|
|
1407
|
+
type: appType,
|
|
1408
|
+
...opts.alwaysUseHttps !== void 0 ? { alwaysUseHttps: opts.alwaysUseHttps } : {},
|
|
1409
|
+
assetConfig: resolvedAssetConfig
|
|
1410
|
+
};
|
|
1411
|
+
if (hashedAssetsPrefix) manifest.hashedAssetsPrefix = hashedAssetsPrefix;
|
|
1412
|
+
if (headerRules && headerRules.length > 0) manifest.headerRules = headerRules;
|
|
1413
|
+
if (redirectRules && redirectRules.length > 0) manifest.redirectRules = stripDevOnlyRuleFields(redirectRules);
|
|
1414
|
+
if (resolvedFallbackRules && resolvedFallbackRules.length > 0) manifest.fallbackRules = stripDevOnlyRuleFields(resolvedFallbackRules);
|
|
1415
|
+
return manifest;
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Check if a file (by relative path) should be included as a worker module.
|
|
1419
|
+
* Skips build metadata and files with extensions CF Workers can't handle as modules.
|
|
1420
|
+
*/
|
|
1421
|
+
function isWorkerModule(relativePath) {
|
|
1422
|
+
const norm = relativePath.replace(/\\/g, "/");
|
|
1423
|
+
if (norm.includes("/.vite/") || norm.startsWith(".vite/")) return false;
|
|
1424
|
+
if (norm === "wrangler.json" || norm === "wrangler.jsonc") return false;
|
|
1425
|
+
return /\.(js|mjs|cjs|wasm|map|txt)$/.test(norm);
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Recursively collect static asset file paths, refusing symlinks so deploys
|
|
1429
|
+
* cannot publish bytes from outside the intended asset root.
|
|
1430
|
+
*/
|
|
1431
|
+
function collectAssetFiles(root, isIgnored, dir = root) {
|
|
1432
|
+
const files = [];
|
|
1433
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
1434
|
+
for (const entry of entries) {
|
|
1435
|
+
const fullPath = join(dir, entry.name);
|
|
1436
|
+
const relativePath = "/" + relative(root, fullPath);
|
|
1437
|
+
if (isIgnored(relativePath)) continue;
|
|
1438
|
+
if (entry.isSymbolicLink()) throw new Error(`deploy: Refusing to upload symlink as an asset: ${relativePath}`);
|
|
1439
|
+
if (entry.isDirectory()) files.push(...collectAssetFiles(root, isIgnored, fullPath));
|
|
1440
|
+
else files.push(fullPath);
|
|
1441
|
+
}
|
|
1442
|
+
return files;
|
|
1443
|
+
}
|
|
1444
|
+
export { resolveDeployWorkerMain as C, resolveStaticDeployPreset as D, resolveStaticBuildCommand as E, toManifestSchedulesAndQueues as O, resolveDeployLiveBindingConfig as S, resolveFullDeployBuildCommand as T, ensureManagedHyperdrive as _, detectNonSpaFallbackWarning as a, log as b, streamDirectR2Deploy as c, getDeploySchemaDriftMessage as d, hasDeploySchemaDrift as f, createProjectFromSlug as g, assertWorkerMainUploaded as h, collectWorkerFiles as i, validateDeployMigrations as k, warnUnpublishedRouting as l, assertProjectDeployAccess as m, buildStaticManifest as n, readWranglerHtmlHandling as o, assertEnvSchemaValid as p, collectAndHashAssets as r, mergeAndLintRoutingRules as s, buildBwfManifest as t, assertDeploySchemaDriftFree as u, getExitCode as v, resolveDeployWranglerCompat as w, promptDeployProjectConfig as x, getGitCommit as y };
|