devflare 1.0.0-next.7 → 1.0.0-next.70
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/LICENSE +21 -0
- package/LLM.md +17315 -2144
- package/README.md +398 -607
- package/bin/devflare.js +30 -14
- package/dist/_chunks/account-BHY3fvrA.js +462 -0
- package/dist/_chunks/account-resources-BdKj8q1h.js +159 -0
- package/dist/_chunks/ai-CN_SREim.js +322 -0
- package/dist/_chunks/api-BKClUlUf.js +568 -0
- package/dist/_chunks/build-DplSo6Gc.js +24 -0
- package/dist/_chunks/build-artifacts-CkwCap5N.js +483 -0
- package/dist/_chunks/cli-ZJYtm-lW.js +1214 -0
- package/dist/_chunks/cloudflare-Ic5ubQza.js +157 -0
- package/dist/_chunks/colors-D0NVzAFN.js +13 -0
- package/dist/_chunks/command-utils-DjaaMQX7.js +45 -0
- package/dist/_chunks/compiler-UxXQgEPq.js +521 -0
- package/dist/_chunks/config-path-CYGlwKDs.js +42 -0
- package/dist/_chunks/config-zQd4jmXU.js +78 -0
- package/dist/_chunks/context-DGMev2AF.js +2515 -0
- package/dist/_chunks/decorators-eXNZ1S0N.js +19 -0
- package/dist/_chunks/dependencies-wKqrxKV_.js +57 -0
- package/dist/_chunks/deploy-z1_wbNn2.js +1032 -0
- package/dist/_chunks/dev-BagtFegV.js +952 -0
- package/dist/_chunks/doctor-CAsJ-rSZ.js +219 -0
- package/dist/_chunks/durable-object-DuMPM8re.js +234 -0
- package/dist/_chunks/env-D4uJqqgu.js +125 -0
- package/dist/_chunks/family-BTTpTwUk.js +143 -0
- package/dist/_chunks/generated-artifacts-Bb13pGUG.js +32 -0
- package/dist/_chunks/glob-DRw9sbfF.js +56 -0
- package/dist/_chunks/init-DJ5y3mu5.js +165 -0
- package/dist/_chunks/loader-BC0skbnH.js +1330 -0
- package/dist/_chunks/local-dev-vars-BFLS-HoI.js +81 -0
- package/dist/_chunks/local-hyperdrive-CcORzo76.js +119 -0
- package/dist/_chunks/local-media-bindings-ZQe-epuw.js +335 -0
- package/dist/_chunks/local-secrets-C0n5oRgI.js +123 -0
- package/dist/_chunks/login-CgNcbpEq.js +51 -0
- package/dist/_chunks/package-metadata-CLI488gB.js +39 -0
- package/dist/_chunks/preferences-CbYERA_m.js +241 -0
- package/dist/_chunks/preview-j9Kbx4-G.js +462 -0
- package/dist/_chunks/preview-registry-CTXU4mBc.js +1186 -0
- package/dist/_chunks/preview-resources-CQIu2-NY.js +359 -0
- package/dist/_chunks/previews-BIaw6NVC.js +1133 -0
- package/dist/_chunks/productions-CF8oQcX7.js +504 -0
- package/dist/_chunks/r2-presign-runtime-C75FkLMd.js +291 -0
- package/dist/_chunks/ref-CYJNAAe_.js +178 -0
- package/dist/_chunks/remote-8jEHLVGg.js +79 -0
- package/dist/_chunks/remote-config-Bw6qIVM4.js +132 -0
- package/dist/_chunks/resolve-package-DeJUGxoE.js +152 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-CRXB3-iw.js +851 -0
- package/dist/_chunks/runtime-BlKTWIgD.js +874 -0
- package/dist/_chunks/schema-normalization-CTdiY17P.js +667 -0
- package/dist/_chunks/secrets-BJuEa9Jz.js +95 -0
- package/dist/_chunks/tail-DjGRt8gw.js +239 -0
- package/dist/_chunks/token-wmeF8-IQ.js +333 -0
- package/dist/_chunks/tokens-KaEr4B8e.js +221 -0
- package/dist/_chunks/types-BLGfxIq-.js +484 -0
- package/dist/_chunks/ui-BhCdDC2N.js +103 -0
- package/dist/_chunks/usage-rRusKejc.js +272 -0
- package/dist/_chunks/vite-Bml-Whp8.js +1267 -0
- package/dist/_chunks/vite-process-CDa3yQui.js +2929 -0
- package/dist/_chunks/vite-utils-D8kPPxUy.js +183 -0
- package/dist/_chunks/worker-DgczaXVW.js +410 -0
- package/dist/_chunks/worker-bundler-Isj5jiW6.js +458 -0
- package/dist/_chunks/worker-entrypoint-C8j23t6d.js +247 -0
- package/dist/_chunks/workerName-kEXwmV2m.js +23 -0
- package/dist/_chunks/workspace-CrvqPLTX.js +517 -0
- package/dist/_chunks/workspace-Ds3xMjOE.js +175 -0
- package/dist/bridge/client.d.ts +93 -8
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/do-rpc-dispatch.d.ts +23 -0
- package/dist/bridge/do-rpc-dispatch.d.ts.map +1 -0
- package/dist/bridge/do-websocket-connect.d.ts +33 -0
- package/dist/bridge/do-websocket-connect.d.ts.map +1 -0
- package/dist/bridge/gateway-runtime.d.ts +8 -0
- package/dist/bridge/gateway-runtime.d.ts.map +1 -0
- package/dist/bridge/index.d.ts +6 -6
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/log.d.ts +5 -0
- package/dist/bridge/log.d.ts.map +1 -0
- package/dist/bridge/miniflare-gateway.d.ts +45 -0
- package/dist/bridge/miniflare-gateway.d.ts.map +1 -0
- package/dist/bridge/miniflare.d.ts +92 -2
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +12 -11
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/r2-presign-runtime.d.ts +9 -0
- package/dist/bridge/r2-presign-runtime.d.ts.map +1 -0
- package/dist/bridge/server.d.ts +2 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/bridge/v2/body-streams.d.ts +53 -0
- package/dist/bridge/v2/body-streams.d.ts.map +1 -0
- package/dist/bridge/v2/codec.d.ts +106 -0
- package/dist/bridge/v2/codec.d.ts.map +1 -0
- package/dist/bridge/v2/control-messages.d.ts +46 -0
- package/dist/bridge/v2/control-messages.d.ts.map +1 -0
- package/dist/bridge/v2/frames.d.ts +109 -0
- package/dist/bridge/v2/frames.d.ts.map +1 -0
- package/dist/bridge/v2/index.d.ts +11 -0
- package/dist/bridge/v2/index.d.ts.map +1 -0
- package/dist/bridge/v2/serialization.d.ts +48 -0
- package/dist/bridge/v2/serialization.d.ts.map +1 -0
- package/dist/bridge/v2/transport.d.ts +31 -0
- package/dist/bridge/v2/transport.d.ts.map +1 -0
- package/dist/bridge/v2/value-codec.d.ts +61 -0
- package/dist/bridge/v2/value-codec.d.ts.map +1 -0
- package/dist/bridge/v2/value-serialization.d.ts +139 -0
- package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
- package/dist/bridge/{protocol.d.ts → v2/wire.d.ts} +32 -8
- package/dist/bridge/v2/wire.d.ts.map +1 -0
- package/dist/bridge/v2/ws-relay.d.ts +53 -0
- package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
- package/dist/bridge/websocket-constructor.d.ts +38 -0
- package/dist/bridge/websocket-constructor.d.ts.map +1 -0
- package/dist/browser-shim/handler.d.ts +2 -2
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser-shim/index.d.ts +2 -2
- package/dist/browser-shim/server.d.ts +63 -0
- package/dist/browser-shim/server.d.ts.map +1 -1
- package/dist/browser.d.ts +5778 -43
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +73 -142
- package/dist/bundler/defaults.d.ts +23 -0
- package/dist/bundler/defaults.d.ts.map +1 -0
- package/dist/bundler/do-bundler.d.ts +7 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/index.d.ts +3 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +53 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +13 -0
- package/dist/bundler/worker-bundler.d.ts.map +1 -0
- package/dist/bundler/worker-compat.d.ts +4 -0
- package/dist/bundler/worker-compat.d.ts.map +1 -0
- package/dist/cli/build-manifest.d.ts +66 -0
- package/dist/cli/build-manifest.d.ts.map +1 -0
- package/dist/cli/command-utils.d.ts +18 -0
- package/dist/cli/command-utils.d.ts.map +1 -0
- package/dist/cli/commands/account.d.ts +2 -2
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/ai.d.ts +1 -1
- package/dist/cli/commands/ai.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +40 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts +2 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/deploy/metadata.d.ts +18 -0
- package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
- package/dist/cli/commands/deploy/prepare.d.ts +23 -0
- package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
- package/dist/cli/commands/deploy/runtime.d.ts +4 -0
- package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
- package/dist/cli/commands/deploy/verification.d.ts +36 -0
- package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
- package/dist/cli/commands/deploy.d.ts +2 -2
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts +9 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -2
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/family.d.ts +10 -0
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/render.d.ts +8 -0
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/theme.d.ts +10 -0
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/types.d.ts +70 -0
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
- package/dist/cli/commands/previews.d.ts +4 -0
- package/dist/cli/commands/previews.d.ts.map +1 -0
- package/dist/cli/commands/productions.d.ts +4 -0
- package/dist/cli/commands/productions.d.ts.map +1 -0
- package/dist/cli/commands/remote.d.ts +1 -1
- package/dist/cli/commands/remote.d.ts.map +1 -1
- package/dist/cli/commands/secrets.d.ts +4 -0
- package/dist/cli/commands/secrets.d.ts.map +1 -0
- package/dist/cli/commands/tail.d.ts +44 -0
- package/dist/cli/commands/tail.d.ts.map +1 -0
- package/dist/cli/commands/token.d.ts +4 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +121 -0
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/models.d.ts +27 -0
- package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
- package/dist/cli/commands/types.d.ts +2 -2
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +4 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/commands/workspace.d.ts +8 -0
- package/dist/cli/commands/workspace.d.ts.map +1 -0
- package/dist/cli/config-path.d.ts +6 -0
- package/dist/cli/config-path.d.ts.map +1 -0
- package/dist/cli/dependencies.d.ts +2 -1
- package/dist/cli/dependencies.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/gradual-deploy.d.ts +49 -0
- package/dist/cli/gradual-deploy.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/package-metadata.d.ts +16 -0
- package/dist/cli/package-metadata.d.ts.map +1 -0
- package/dist/cli/preview-bindings.d.ts +49 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +10 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/cli/ui.d.ts +37 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/workspace-build-guard.d.ts +14 -0
- package/dist/cli/workspace-build-guard.d.ts.map +1 -0
- package/dist/cli/wrangler-auth.d.ts +1 -1
- package/dist/cloudflare/account-core.d.ts +6 -0
- package/dist/cloudflare/account-core.d.ts.map +1 -0
- package/dist/cloudflare/account-resources.d.ts +40 -0
- package/dist/cloudflare/account-resources.d.ts.map +1 -0
- package/dist/cloudflare/account-status.d.ts +11 -0
- package/dist/cloudflare/account-status.d.ts.map +1 -0
- package/dist/cloudflare/account-workers.d.ts +14 -0
- package/dist/cloudflare/account-workers.d.ts.map +1 -0
- package/dist/cloudflare/account.d.ts +7 -64
- package/dist/cloudflare/account.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts +71 -3
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/auth.d.ts +1 -1
- package/dist/cloudflare/auth.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +61 -6
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -13
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
- package/dist/cloudflare/kv-namespace.d.ts +4 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
- package/dist/cloudflare/preferences.d.ts +7 -0
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
- package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-records.d.ts +4 -0
- package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
- package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-store.d.ts +14 -0
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
- package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-types.d.ts +103 -0
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry.d.ts +42 -0
- package/dist/cloudflare/preview-registry.d.ts.map +1 -0
- package/dist/cloudflare/preview-urls.d.ts +3 -0
- package/dist/cloudflare/preview-urls.d.ts.map +1 -0
- package/dist/cloudflare/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/remote-config.d.ts.map +1 -1
- package/dist/cloudflare/tokens.d.ts +44 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +124 -7
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts +31 -3
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/binding-resolution-helpers.d.ts +41 -0
- package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
- package/dist/config/compatibility.d.ts +3 -0
- package/dist/config/compatibility.d.ts.map +1 -0
- package/dist/config/compiler/bindings.d.ts +14 -0
- package/dist/config/compiler/bindings.d.ts.map +1 -0
- package/dist/config/compiler/core-helpers.d.ts +6 -0
- package/dist/config/compiler/core-helpers.d.ts.map +1 -0
- package/dist/config/compiler/do-workers.d.ts +34 -0
- package/dist/config/compiler/do-workers.d.ts.map +1 -0
- package/dist/config/compiler/paths.d.ts +18 -0
- package/dist/config/compiler/paths.d.ts.map +1 -0
- package/dist/config/compiler/types.d.ts +308 -0
- package/dist/config/compiler/types.d.ts.map +1 -0
- package/dist/config/compiler.d.ts +22 -134
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/cron.d.ts +19 -0
- package/dist/config/cron.d.ts.map +1 -0
- package/dist/config/define.d.ts +8 -5
- package/dist/config/define.d.ts.map +1 -1
- package/dist/config/deploy-resources.d.ts +58 -0
- package/dist/config/deploy-resources.d.ts.map +1 -0
- package/dist/config/env-vars.d.ts +309 -0
- package/dist/config/env-vars.d.ts.map +1 -0
- package/dist/config/framework-providers.d.ts +9 -0
- package/dist/config/framework-providers.d.ts.map +1 -0
- package/dist/config/index.d.ts +13 -5
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts +2 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/local-dev-vars.d.ts +15 -0
- package/dist/config/local-dev-vars.d.ts.map +1 -0
- package/dist/config/preview-resources.d.ts +83 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +29 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +16 -25
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve-phased.d.ts +72 -0
- package/dist/config/resolve-phased.d.ts.map +1 -0
- package/dist/config/resolve.d.ts +11 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resource-resolution.d.ts +80 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- package/dist/config/schema-bindings.d.ts +2124 -0
- package/dist/config/schema-bindings.d.ts.map +1 -0
- package/dist/config/schema-build.d.ts +67 -0
- package/dist/config/schema-build.d.ts.map +1 -0
- package/dist/config/schema-env.d.ts +3821 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +272 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +597 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +520 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +802 -0
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
- package/dist/config/schema-types-bindings.d.ts +293 -0
- package/dist/config/schema-types-bindings.d.ts.map +1 -0
- package/dist/config/schema-types-build.d.ts +86 -0
- package/dist/config/schema-types-build.d.ts.map +1 -0
- package/dist/config/schema-types-runtime-server.d.ts +196 -0
- package/dist/config/schema-types-runtime-server.d.ts.map +1 -0
- package/dist/config/schema-types-runtime.d.ts +913 -0
- package/dist/config/schema-types-runtime.d.ts.map +1 -0
- package/dist/config/schema-types.d.ts +458 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +5796 -2023
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/service-bindings-validation.d.ts +36 -0
- package/dist/config/service-bindings-validation.d.ts.map +1 -0
- package/dist/config/workspace.d.ts +282 -0
- package/dist/config/workspace.d.ts.map +1 -0
- package/dist/config-entry.d.ts +7 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-entry.js +3 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/decorators/index.d.ts +2 -2
- package/dist/decorators/index.js +2 -9
- package/dist/dev-server/d1-migrations.d.ts +36 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/dev-server-state.d.ts +59 -0
- package/dist/dev-server/dev-server-state.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +22 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/index.d.ts +1 -1
- package/dist/dev-server/miniflare-bindings.d.ts +90 -0
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts +57 -0
- package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -0
- package/dist/dev-server/miniflare-log.d.ts +20 -0
- package/dist/dev-server/miniflare-log.d.ts.map +1 -0
- package/dist/dev-server/miniflare-worker-config.d.ts +100 -0
- package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
- package/dist/dev-server/reload-queue.d.ts +13 -0
- package/dist/dev-server/reload-queue.d.ts.map +1 -0
- package/dist/dev-server/runtime-health.d.ts +79 -0
- package/dist/dev-server/runtime-health.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts +8 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
- package/dist/dev-server/server-startup-helpers.d.ts +84 -0
- package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
- package/dist/dev-server/server.d.ts +2 -0
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +24 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +19 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts +17 -0
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
- package/dist/dev-server/worker-surface-paths.d.ts +6 -0
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
- package/dist/dev-server/workspace/merge-config.d.ts +81 -0
- package/dist/dev-server/workspace/merge-config.d.ts.map +1 -0
- package/dist/dev-server/workspace/prepare-app.d.ts +84 -0
- package/dist/dev-server/workspace/prepare-app.d.ts.map +1 -0
- package/dist/dev-server/workspace/server.d.ts +47 -0
- package/dist/dev-server/workspace/server.d.ts.map +1 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/index.d.ts +8 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -297
- package/dist/runtime/context-events.d.ts +13 -0
- package/dist/runtime/context-events.d.ts.map +1 -0
- package/dist/runtime/context-types.d.ts +82 -0
- package/dist/runtime/context-types.d.ts.map +1 -0
- package/dist/runtime/context.d.ts +20 -44
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +70 -55
- package/dist/runtime/exports.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +11 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -184
- package/dist/runtime/middleware.d.ts +119 -67
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/runtime/r2-presign.d.ts +164 -0
- package/dist/runtime/r2-presign.d.ts.map +1 -0
- package/dist/runtime/router/index.d.ts +7 -0
- package/dist/runtime/router/index.d.ts.map +1 -0
- package/dist/runtime/router/types.d.ts +24 -0
- package/dist/runtime/router/types.d.ts.map +1 -0
- package/dist/runtime/validation.d.ts +18 -4
- package/dist/runtime/validation.d.ts.map +1 -1
- package/dist/secrets/local-secrets.d.ts +46 -0
- package/dist/secrets/local-secrets.d.ts.map +1 -0
- package/dist/shims/local-hyperdrive.d.ts +12 -0
- package/dist/shims/local-hyperdrive.d.ts.map +1 -0
- package/dist/shims/local-media-bindings.d.ts +19 -0
- package/dist/shims/local-media-bindings.d.ts.map +1 -0
- package/dist/shims/local-worker-loader.d.ts +3 -0
- package/dist/shims/local-worker-loader.d.ts.map +1 -0
- package/dist/sveltekit/index.d.ts +1 -1
- package/dist/sveltekit/index.d.ts.map +1 -1
- package/dist/sveltekit/index.js +377 -169
- package/dist/sveltekit/local-bindings.d.ts +4 -0
- package/dist/sveltekit/local-bindings.d.ts.map +1 -0
- package/dist/sveltekit/platform.d.ts +42 -2
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/ai-search.d.ts +39 -0
- package/dist/test/ai-search.d.ts.map +1 -0
- package/dist/test/alarm.d.ts +55 -0
- package/dist/test/alarm.d.ts.map +1 -0
- package/dist/test/binding-hints.d.ts +10 -0
- package/dist/test/binding-hints.d.ts.map +1 -0
- package/dist/test/cf.d.ts +71 -35
- package/dist/test/cf.d.ts.map +1 -1
- package/dist/test/containers.d.ts +87 -0
- package/dist/test/containers.d.ts.map +1 -0
- package/dist/test/email.d.ts +16 -7
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +20 -21
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +5115 -75
- package/dist/test/offline-bindings.d.ts +124 -0
- package/dist/test/offline-bindings.d.ts.map +1 -0
- package/dist/test/queue.d.ts.map +1 -1
- package/dist/test/remote-ai.d.ts.map +1 -1
- package/dist/test/remote-cloudflare.d.ts +13 -0
- package/dist/test/remote-cloudflare.d.ts.map +1 -0
- package/dist/test/remote-vectorize.d.ts.map +1 -1
- package/dist/test/resolve-service-bindings.d.ts +64 -4
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +14 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-bindings.d.ts +13 -0
- package/dist/test/simple-context-bindings.d.ts.map +1 -0
- package/dist/test/simple-context-durable-objects.d.ts +6 -0
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
- package/dist/test/simple-context-env.d.ts +35 -0
- package/dist/test/simple-context-env.d.ts.map +1 -0
- package/dist/test/simple-context-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
- package/dist/test/simple-context-handlers.d.ts +12 -0
- package/dist/test/simple-context-handlers.d.ts.map +1 -0
- package/dist/test/simple-context-lifecycle.d.ts +32 -0
- package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
- package/dist/test/simple-context-mfconfig.d.ts +18 -0
- package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
- package/dist/test/simple-context-multi-worker.d.ts +16 -0
- package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
- package/dist/test/simple-context-paths.d.ts +40 -0
- package/dist/test/simple-context-paths.d.ts.map +1 -0
- package/dist/test/simple-context-runtime.d.ts +19 -0
- package/dist/test/simple-context-runtime.d.ts.map +1 -0
- package/dist/test/simple-context-startup.d.ts +11 -0
- package/dist/test/simple-context-startup.d.ts.map +1 -0
- package/dist/test/simple-context-transport.d.ts +14 -0
- package/dist/test/simple-context-transport.d.ts.map +1 -0
- package/dist/test/simple-context.d.ts +8 -27
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts +3 -2
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/analytics-engine.d.ts +22 -0
- package/dist/test/utilities/analytics-engine.d.ts.map +1 -0
- package/dist/test/utilities/artifacts.d.ts +11 -0
- package/dist/test/utilities/artifacts.d.ts.map +1 -0
- package/dist/test/utilities/context.d.ts +39 -0
- package/dist/test/utilities/context.d.ts.map +1 -0
- package/dist/test/utilities/d1.d.ts +21 -0
- package/dist/test/utilities/d1.d.ts.map +1 -0
- package/dist/test/utilities/env.d.ts +45 -0
- package/dist/test/utilities/env.d.ts.map +1 -0
- package/dist/test/utilities/kv.d.ts +11 -0
- package/dist/test/utilities/kv.d.ts.map +1 -0
- package/dist/test/utilities/media.d.ts +16 -0
- package/dist/test/utilities/media.d.ts.map +1 -0
- package/dist/test/utilities/platform.d.ts +41 -0
- package/dist/test/utilities/platform.d.ts.map +1 -0
- package/dist/test/utilities/queue.d.ts +5 -0
- package/dist/test/utilities/queue.d.ts.map +1 -0
- package/dist/test/utilities/r2.d.ts +2 -0
- package/dist/test/utilities/r2.d.ts.map +1 -0
- package/dist/test/utilities/send-email.d.ts +27 -0
- package/dist/test/utilities/send-email.d.ts.map +1 -0
- package/dist/test/utilities/stream-flagship.d.ts +27 -0
- package/dist/test/utilities/stream-flagship.d.ts.map +1 -0
- package/dist/test/utilities/vectorize.d.ts +38 -0
- package/dist/test/utilities/vectorize.d.ts.map +1 -0
- package/dist/test/utilities/workflows.d.ts +26 -0
- package/dist/test/utilities/workflows.d.ts.map +1 -0
- package/dist/test/utilities.d.ts +14 -98
- package/dist/test/utilities.d.ts.map +1 -1
- package/dist/test/worker.d.ts +6 -0
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/transform/durable-object.d.ts.map +1 -1
- package/dist/transform/index.d.ts +2 -2
- package/dist/transform/worker-entrypoint.d.ts +5 -0
- package/dist/transform/worker-entrypoint.d.ts.map +1 -1
- package/dist/utils/entrypoint-discovery.d.ts +6 -3
- package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
- package/dist/utils/glob.d.ts.map +1 -1
- package/dist/utils/resolve-package.d.ts.map +1 -1
- package/dist/utils/send-email.d.ts +15 -0
- package/dist/utils/send-email.d.ts.map +1 -0
- package/dist/utils/send-email.js +163 -0
- package/dist/vite/config-file.d.ts +25 -0
- package/dist/vite/config-file.d.ts.map +1 -0
- package/dist/vite/index.d.ts +3 -2
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +2 -407
- package/dist/vite/plugin-config-hook.d.ts +28 -0
- package/dist/vite/plugin-config-hook.d.ts.map +1 -0
- package/dist/vite/plugin-context.d.ts +27 -0
- package/dist/vite/plugin-context.d.ts.map +1 -0
- package/dist/vite/plugin-durable-objects.d.ts +18 -0
- package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
- package/dist/vite/plugin-programmatic.d.ts +44 -0
- package/dist/vite/plugin-programmatic.d.ts.map +1 -0
- package/dist/vite/plugin-service-bindings.d.ts +13 -0
- package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
- package/dist/vite/plugin-transform.d.ts +41 -0
- package/dist/vite/plugin-transform.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +10 -41
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-entry/composed-worker.d.ts +5 -8
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
- package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
- package/dist/worker-entry/extensions.d.ts +5 -0
- package/dist/worker-entry/extensions.d.ts.map +1 -0
- package/dist/worker-entry/routes.d.ts +22 -0
- package/dist/worker-entry/routes.d.ts.map +1 -0
- package/dist/worker-entry/surface-paths.d.ts +26 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-entry/validate-fetch-style.d.ts +12 -0
- package/dist/worker-entry/validate-fetch-style.d.ts.map +1 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
- package/package.json +160 -117
- package/R2.md +0 -170
- package/dist/account-rvrj687w.js +0 -397
- package/dist/ai-dx4fr9jh.js +0 -107
- package/dist/bridge/protocol.d.ts.map +0 -1
- package/dist/bridge/serialization.d.ts +0 -83
- package/dist/bridge/serialization.d.ts.map +0 -1
- package/dist/browser-shim/worker.d.ts +0 -14
- package/dist/browser-shim/worker.d.ts.map +0 -1
- package/dist/build-9myaxf07.js +0 -70
- package/dist/deploy-h1wz5p7m.js +0 -86
- package/dist/dev-rsdssknb.js +0 -2707
- package/dist/doctor-v7jy4s3r.js +0 -190
- package/dist/durable-object-t4kbb0yt.js +0 -13
- package/dist/index-18hvb6gb.js +0 -194
- package/dist/index-1xpj0m4r.js +0 -57
- package/dist/index-37x76zdn.js +0 -4
- package/dist/index-3t6rypgc.js +0 -13
- package/dist/index-62b3gt2g.js +0 -12
- package/dist/index-67qcae0f.js +0 -183
- package/dist/index-9ats0s83.js +0 -70
- package/dist/index-a0fjkq68.js +0 -198
- package/dist/index-a855bdsx.js +0 -18
- package/dist/index-ccrh4w3t.js +0 -1133
- package/dist/index-d8bdkx2h.js +0 -109
- package/dist/index-f8qh2tyh.js +0 -2152
- package/dist/index-gz1gndna.js +0 -307
- package/dist/index-hcex3rgh.js +0 -266
- package/dist/index-k7r18na8.js +0 -0
- package/dist/index-n3np2d6t.js +0 -462
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-npc1c8jx.js +0 -44
- package/dist/index-p7g30wd2.js +0 -281
- package/dist/index-rbht7m9r.js +0 -36
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- package/dist/index-v8vvsn9x.js +0 -169
- package/dist/index-z14anrqp.js +0 -226
- package/dist/init-f9mgmew3.js +0 -186
- package/dist/remote-q59qk463.js +0 -97
- package/dist/test/bridge-context.d.ts +0 -76
- package/dist/test/bridge-context.d.ts.map +0 -1
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
- package/dist/types-wdcpnfvy.js +0 -487
- package/dist/worker-entrypoint-m9th0rg0.js +0 -13
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import { r as loadConfig, t as ConfigNotFoundError } from "./loader-BC0skbnH.js";
|
|
2
|
+
import { t as account } from "./cloudflare-Ic5ubQza.js";
|
|
3
|
+
import { a as cyanBold, d as green, f as logLine, g as yellow, h as whiteDim, l as formatLabelValue, m as red, n as bold, o as dim, p as logTable, r as createCliTheme } from "./ui-BhCdDC2N.js";
|
|
4
|
+
import { i as findFiles } from "./glob-DRw9sbfF.js";
|
|
5
|
+
import { i as resolveNamedSelection, r as resolveCloudflareAccountId, t as asOptionalString } from "./command-utils-DjaaMQX7.js";
|
|
6
|
+
import { t as getDependencies } from "./dependencies-wKqrxKV_.js";
|
|
7
|
+
import { i as collectConfiguredWorkerFamilies } from "./family-BTTpTwUk.js";
|
|
8
|
+
//#region src/cli/commands/productions.ts
|
|
9
|
+
const CLI_API_OPTIONS = { timeout: 1e4 };
|
|
10
|
+
const PRODUCTION_SUBCOMMANDS = [
|
|
11
|
+
"list",
|
|
12
|
+
"versions",
|
|
13
|
+
"deployments",
|
|
14
|
+
"rollback",
|
|
15
|
+
"delete"
|
|
16
|
+
];
|
|
17
|
+
const VERSION_LIST_LIMIT = 10;
|
|
18
|
+
function isProductionSubcommand(value) {
|
|
19
|
+
return PRODUCTION_SUBCOMMANDS.includes(value);
|
|
20
|
+
}
|
|
21
|
+
function shortenVersionId(versionId, length = 12) {
|
|
22
|
+
return versionId.length <= length ? versionId : `${versionId.slice(0, length)}…`;
|
|
23
|
+
}
|
|
24
|
+
function selectDeploymentVersionId(deployment) {
|
|
25
|
+
return deployment.versions.find((version) => version.percentage === 100)?.versionId ?? deployment.versions[0]?.versionId;
|
|
26
|
+
}
|
|
27
|
+
function formatDeploymentSplit(deployment) {
|
|
28
|
+
if (deployment.versions.length === 0) return "N/A";
|
|
29
|
+
return deployment.versions.map((version) => `${version.percentage}% → ${shortenVersionId(version.versionId, 8)}`).join(", ");
|
|
30
|
+
}
|
|
31
|
+
function getWorkerVersionTimestamp(version) {
|
|
32
|
+
return version.metadata.modifiedOn ?? version.metadata.createdOn;
|
|
33
|
+
}
|
|
34
|
+
function formatRecordDate(date) {
|
|
35
|
+
return date ? date.toISOString().slice(0, 19).replace("T", " ") : "N/A";
|
|
36
|
+
}
|
|
37
|
+
function formatWorkerStatus(status, theme) {
|
|
38
|
+
switch (status) {
|
|
39
|
+
case "active": return green(status, theme);
|
|
40
|
+
case "undeployed": return yellow(status, theme);
|
|
41
|
+
default: return red(status, theme);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function formatVersionStatus(status, theme) {
|
|
45
|
+
switch (status) {
|
|
46
|
+
case "active": return green(status, theme);
|
|
47
|
+
default: return whiteDim(status, theme);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function shouldReplaceConfiguredWorkerFamily(existing, candidate) {
|
|
51
|
+
return !existing || candidate.role === "primary" && existing.role !== "primary";
|
|
52
|
+
}
|
|
53
|
+
function mergeConfiguredWorkerFamily(families, candidate) {
|
|
54
|
+
if (shouldReplaceConfiguredWorkerFamily(families.get(candidate.baseName), candidate)) families.set(candidate.baseName, candidate);
|
|
55
|
+
}
|
|
56
|
+
async function discoverProductionConfigs(cwd, configFile, environment) {
|
|
57
|
+
const families = /* @__PURE__ */ new Map();
|
|
58
|
+
const primaryFamilyNames = /* @__PURE__ */ new Set();
|
|
59
|
+
const accountIds = /* @__PURE__ */ new Set();
|
|
60
|
+
let defaultWorkerName;
|
|
61
|
+
let defaultWorkerNameSource = "none";
|
|
62
|
+
const loadAndCollect = async (candidateConfigFile) => {
|
|
63
|
+
try {
|
|
64
|
+
const config = await loadConfig({
|
|
65
|
+
cwd,
|
|
66
|
+
configFile: candidateConfigFile
|
|
67
|
+
});
|
|
68
|
+
const resolvedFamilies = collectConfiguredWorkerFamilies(config, environment);
|
|
69
|
+
for (const family of resolvedFamilies) {
|
|
70
|
+
mergeConfiguredWorkerFamily(families, family);
|
|
71
|
+
if (family.role === "primary") primaryFamilyNames.add(family.baseName);
|
|
72
|
+
}
|
|
73
|
+
if (config.accountId?.trim()) accountIds.add(config.accountId.trim());
|
|
74
|
+
if (!defaultWorkerName) {
|
|
75
|
+
defaultWorkerName = resolvedFamilies.find((family) => family.role === "primary")?.baseName;
|
|
76
|
+
defaultWorkerNameSource = defaultWorkerName ? "config" : "none";
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (error instanceof ConfigNotFoundError) return false;
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
if (configFile) await loadAndCollect(configFile);
|
|
85
|
+
else if (!await loadAndCollect()) {
|
|
86
|
+
const configPaths = (await findFiles("**/devflare.config.{ts,js,mjs,cjs}", {
|
|
87
|
+
cwd,
|
|
88
|
+
absolute: true
|
|
89
|
+
})).sort((left, right) => left.localeCompare(right));
|
|
90
|
+
for (const configPath of configPaths) await loadAndCollect(configPath);
|
|
91
|
+
}
|
|
92
|
+
if (accountIds.size > 1) throw new Error("Multiple Cloudflare account ids were discovered across local Devflare configs. Pass --account to select one account explicitly for `devflare productions`.");
|
|
93
|
+
return {
|
|
94
|
+
accountId: Array.from(accountIds)[0],
|
|
95
|
+
defaultWorkerName,
|
|
96
|
+
defaultWorkerNameSource,
|
|
97
|
+
families: Array.from(families.values()).sort((left, right) => {
|
|
98
|
+
if (left.role === "primary" && right.role !== "primary") return -1;
|
|
99
|
+
if (left.role !== "primary" && right.role === "primary") return 1;
|
|
100
|
+
return left.baseName.localeCompare(right.baseName);
|
|
101
|
+
}),
|
|
102
|
+
primaryFamilyNames: Array.from(primaryFamilyNames).sort((left, right) => left.localeCompare(right))
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
async function resolveAccountId(parsed, discovery) {
|
|
106
|
+
return resolveCloudflareAccountId({
|
|
107
|
+
explicitAccountId: asOptionalString(parsed.options.account),
|
|
108
|
+
configuredAccountId: discovery.accountId,
|
|
109
|
+
apiOptions: CLI_API_OPTIONS
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function resolveWorkerName(parsed, discovery, fallbackArg) {
|
|
113
|
+
const selection = resolveNamedSelection({
|
|
114
|
+
explicitValue: asOptionalString(parsed.options.worker),
|
|
115
|
+
fallbackValue: fallbackArg,
|
|
116
|
+
configuredValue: discovery.defaultWorkerName
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
workerName: selection.value,
|
|
120
|
+
source: selection.value === discovery.defaultWorkerName ? discovery.defaultWorkerNameSource : selection.source
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
async function resolveContext(parsed, options, subcommand, fallbackArg) {
|
|
124
|
+
const cwd = options.cwd ?? process.cwd();
|
|
125
|
+
const configFile = asOptionalString(parsed.options.config);
|
|
126
|
+
const environment = asOptionalString(parsed.options.env) ?? "production";
|
|
127
|
+
const explicitAccountId = asOptionalString(parsed.options.account);
|
|
128
|
+
const explicitWorkerName = asOptionalString(parsed.options.worker) ?? fallbackArg;
|
|
129
|
+
const discovery = Boolean(configFile) || !explicitAccountId || !explicitWorkerName ? await discoverProductionConfigs(cwd, configFile, environment) : {
|
|
130
|
+
accountId: void 0,
|
|
131
|
+
defaultWorkerName: void 0,
|
|
132
|
+
defaultWorkerNameSource: "none",
|
|
133
|
+
families: [],
|
|
134
|
+
primaryFamilyNames: []
|
|
135
|
+
};
|
|
136
|
+
const accountId = await resolveAccountId(parsed, discovery);
|
|
137
|
+
const workerSelection = resolveWorkerName(parsed, discovery, fallbackArg);
|
|
138
|
+
if (!accountId) throw new Error("No Cloudflare account could be resolved. Use --account or configure accountId in devflare.config.*.");
|
|
139
|
+
if ((subcommand === "rollback" || subcommand === "delete") && !workerSelection.workerName) throw new Error(`A worker name is required for productions ${subcommand}. Use --worker or run inside a configured package with a single primary worker.`);
|
|
140
|
+
return {
|
|
141
|
+
accountId,
|
|
142
|
+
workerName: workerSelection.workerName,
|
|
143
|
+
workerNameSource: workerSelection.source,
|
|
144
|
+
discovery
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function getProductionUrl(workerName, workersSubdomain) {
|
|
148
|
+
if (!workersSubdomain) return;
|
|
149
|
+
return `https://${workerName}.${workersSubdomain.trim().replace(/^https?:\/\//i, "").replace(/\.workers\.dev\/?$/i, "")}.workers.dev`;
|
|
150
|
+
}
|
|
151
|
+
async function buildProductionRows(accountId, families, apiOptions) {
|
|
152
|
+
const [liveWorkers, workersSubdomain] = await Promise.all([account.workers(accountId, apiOptions), account.workersSubdomain(accountId, apiOptions)]);
|
|
153
|
+
const workersByName = new Map(liveWorkers.map((worker) => [worker.name, worker]));
|
|
154
|
+
return Promise.all(families.map(async (family) => {
|
|
155
|
+
const worker = workersByName.get(family.baseName);
|
|
156
|
+
if (!worker) return {
|
|
157
|
+
workerName: family.baseName,
|
|
158
|
+
role: family.roleLabel,
|
|
159
|
+
status: "missing",
|
|
160
|
+
url: getProductionUrl(family.baseName, workersSubdomain)
|
|
161
|
+
};
|
|
162
|
+
const latestDeployment = [...await account.workerDeployments(accountId, family.baseName, apiOptions)].sort((left, right) => {
|
|
163
|
+
return right.createdOn.getTime() - left.createdOn.getTime();
|
|
164
|
+
})[0];
|
|
165
|
+
const activeVersionId = latestDeployment ? selectDeploymentVersionId(latestDeployment) : void 0;
|
|
166
|
+
return {
|
|
167
|
+
workerName: family.baseName,
|
|
168
|
+
role: family.roleLabel,
|
|
169
|
+
status: latestDeployment ? "active" : "undeployed",
|
|
170
|
+
deployedAt: latestDeployment?.createdOn ?? worker.modifiedOn,
|
|
171
|
+
versionId: activeVersionId,
|
|
172
|
+
source: latestDeployment?.source,
|
|
173
|
+
url: getProductionUrl(family.baseName, workersSubdomain)
|
|
174
|
+
};
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
function buildProductionColumns(theme) {
|
|
178
|
+
return [
|
|
179
|
+
{
|
|
180
|
+
label: "Worker",
|
|
181
|
+
width: 34,
|
|
182
|
+
value: (row) => row.workerName
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
label: "Role",
|
|
186
|
+
width: 18,
|
|
187
|
+
value: (row) => row.role
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
label: "Status",
|
|
191
|
+
width: 10,
|
|
192
|
+
value: (row) => formatWorkerStatus(row.status, theme)
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
label: "Deployed",
|
|
196
|
+
width: 19,
|
|
197
|
+
value: (row) => whiteDim(formatRecordDate(row.deployedAt), theme)
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: "Version",
|
|
201
|
+
width: 13,
|
|
202
|
+
value: (row) => row.versionId ? shortenVersionId(row.versionId) : dim("N/A", theme)
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: "Source",
|
|
206
|
+
width: 14,
|
|
207
|
+
value: (row) => row.source ?? dim("N/A", theme)
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
label: "URL",
|
|
211
|
+
value: (row) => row.url ?? "N/A"
|
|
212
|
+
}
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
function buildVersionColumns(theme) {
|
|
216
|
+
return [
|
|
217
|
+
{
|
|
218
|
+
label: "Version",
|
|
219
|
+
width: 13,
|
|
220
|
+
value: (row) => shortenVersionId(row.versionId)
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: "Status",
|
|
224
|
+
width: 8,
|
|
225
|
+
value: (row) => formatVersionStatus(row.status, theme)
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
label: "Updated",
|
|
229
|
+
width: 19,
|
|
230
|
+
value: (row) => whiteDim(formatRecordDate(row.updatedAt), theme)
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
label: "Last deployed",
|
|
234
|
+
width: 19,
|
|
235
|
+
value: (row) => whiteDim(formatRecordDate(row.deployedAt), theme)
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
label: "Source",
|
|
239
|
+
value: (row) => row.source ?? dim("N/A", theme)
|
|
240
|
+
}
|
|
241
|
+
];
|
|
242
|
+
}
|
|
243
|
+
async function loadWorkerVersionOverview(accountId, workerName, apiOptions) {
|
|
244
|
+
const [versions, deployments] = await Promise.all([account.workerVersions(accountId, workerName, apiOptions), account.workerDeployments(accountId, workerName, apiOptions)]);
|
|
245
|
+
const productionVersions = versions.filter((version) => version.id).filter((version) => version.metadata.hasPreview !== true).sort((left, right) => {
|
|
246
|
+
const leftTime = getWorkerVersionTimestamp(left)?.getTime() ?? 0;
|
|
247
|
+
return (getWorkerVersionTimestamp(right)?.getTime() ?? 0) - leftTime;
|
|
248
|
+
}).slice(0, VERSION_LIST_LIMIT);
|
|
249
|
+
const activeVersionIds = new Set((deployments[0]?.versions ?? []).map((version) => version.versionId));
|
|
250
|
+
const latestDeploymentByVersionId = /* @__PURE__ */ new Map();
|
|
251
|
+
for (const deployment of deployments) for (const version of deployment.versions) {
|
|
252
|
+
const existing = latestDeploymentByVersionId.get(version.versionId);
|
|
253
|
+
if (!existing || deployment.createdOn.getTime() > existing.getTime()) latestDeploymentByVersionId.set(version.versionId, deployment.createdOn);
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
workerName,
|
|
257
|
+
rows: productionVersions.map((version) => ({
|
|
258
|
+
versionId: version.id,
|
|
259
|
+
status: activeVersionIds.has(version.id) ? "active" : "stored",
|
|
260
|
+
updatedAt: getWorkerVersionTimestamp(version),
|
|
261
|
+
deployedAt: latestDeploymentByVersionId.get(version.id),
|
|
262
|
+
source: version.metadata.source
|
|
263
|
+
}))
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function showProductionOverview(logger, context, rows, theme) {
|
|
267
|
+
logLine(logger);
|
|
268
|
+
if (context.discovery.primaryFamilyNames.length === 1) {
|
|
269
|
+
logLine(logger, formatLabelValue("worker family", green(context.discovery.primaryFamilyNames[0], theme), theme));
|
|
270
|
+
logLine(logger, formatLabelValue("related", whiteDim(String(Math.max(context.discovery.families.length - 1, 0)), theme), theme));
|
|
271
|
+
} else if (context.discovery.primaryFamilyNames.length > 1) {
|
|
272
|
+
logLine(logger, formatLabelValue("configured", whiteDim(`${context.discovery.primaryFamilyNames.length} primary workers`, theme), theme));
|
|
273
|
+
logLine(logger, formatLabelValue("tracked", whiteDim(`${context.discovery.families.length} workers`, theme), theme));
|
|
274
|
+
} else if (context.workerName) logLine(logger, formatLabelValue("worker", green(context.workerName, theme), theme));
|
|
275
|
+
if (rows.length === 0) {
|
|
276
|
+
logLine(logger);
|
|
277
|
+
logLine(logger, dim("No production Workers matched the current selection.", theme));
|
|
278
|
+
logLine(logger);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
logLine(logger);
|
|
282
|
+
logTable(logger, {
|
|
283
|
+
title: "Productions",
|
|
284
|
+
rows,
|
|
285
|
+
columns: buildProductionColumns(theme),
|
|
286
|
+
theme,
|
|
287
|
+
titleAccent: "green"
|
|
288
|
+
});
|
|
289
|
+
logLine(logger);
|
|
290
|
+
logLine(logger, dim("Use `devflare productions versions` for recent production versions, `deployments` for the full deployment history, or `rollback` / `delete` to mutate one Worker.", theme));
|
|
291
|
+
logLine(logger);
|
|
292
|
+
}
|
|
293
|
+
function showWorkerVersions(logger, overviews, theme) {
|
|
294
|
+
logLine(logger);
|
|
295
|
+
if (overviews.length === 0) {
|
|
296
|
+
logLine(logger, dim("No production versions were found for the current selection.", theme));
|
|
297
|
+
logLine(logger);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
for (const [index, overview] of overviews.entries()) {
|
|
301
|
+
if (index > 0) logLine(logger);
|
|
302
|
+
logLine(logger, `${bold("worker", theme)} ${green(overview.workerName, theme)}`);
|
|
303
|
+
if (overview.rows.length === 0) {
|
|
304
|
+
logLine(logger, dim("No stored production versions were found for this Worker.", theme));
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
logTable(logger, {
|
|
308
|
+
title: "Versions",
|
|
309
|
+
rows: overview.rows,
|
|
310
|
+
columns: buildVersionColumns(theme),
|
|
311
|
+
theme,
|
|
312
|
+
titleAccent: "cyan"
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
logLine(logger);
|
|
316
|
+
}
|
|
317
|
+
function buildDeploymentColumns(theme) {
|
|
318
|
+
return [
|
|
319
|
+
{
|
|
320
|
+
label: "Deployed",
|
|
321
|
+
width: 19,
|
|
322
|
+
value: (row) => whiteDim(formatRecordDate(row.createdOn), theme)
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
label: "Deployment",
|
|
326
|
+
width: 12,
|
|
327
|
+
value: (row) => shortenVersionId(row.deploymentId, 11)
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
label: "Strategy",
|
|
331
|
+
width: 12,
|
|
332
|
+
value: (row) => row.strategy || dim("N/A", theme)
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
label: "Traffic split",
|
|
336
|
+
width: 28,
|
|
337
|
+
value: (row) => row.split
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
label: "Source",
|
|
341
|
+
width: 12,
|
|
342
|
+
value: (row) => row.source || dim("N/A", theme)
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
label: "Triggered by",
|
|
346
|
+
width: 18,
|
|
347
|
+
value: (row) => row.triggeredBy ? whiteDim(row.triggeredBy, theme) : dim("N/A", theme)
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
label: "Message",
|
|
351
|
+
value: (row) => row.message ? row.message : dim("N/A", theme)
|
|
352
|
+
}
|
|
353
|
+
];
|
|
354
|
+
}
|
|
355
|
+
async function loadWorkerDeploymentHistory(accountId, workerName, apiOptions) {
|
|
356
|
+
return {
|
|
357
|
+
workerName,
|
|
358
|
+
rows: [...await account.workerDeployments(accountId, workerName, apiOptions)].sort((left, right) => right.createdOn.getTime() - left.createdOn.getTime()).map((deployment) => ({
|
|
359
|
+
createdOn: deployment.createdOn,
|
|
360
|
+
deploymentId: deployment.id,
|
|
361
|
+
strategy: deployment.strategy,
|
|
362
|
+
split: formatDeploymentSplit(deployment),
|
|
363
|
+
source: deployment.source,
|
|
364
|
+
message: deployment.message,
|
|
365
|
+
triggeredBy: deployment.triggeredBy ?? deployment.authorEmail
|
|
366
|
+
}))
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function showWorkerDeployments(logger, overviews, theme) {
|
|
370
|
+
logLine(logger);
|
|
371
|
+
if (overviews.length === 0) {
|
|
372
|
+
logLine(logger, dim("No production deployments were found for the current selection.", theme));
|
|
373
|
+
logLine(logger);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
for (const [index, overview] of overviews.entries()) {
|
|
377
|
+
if (index > 0) logLine(logger);
|
|
378
|
+
logLine(logger, `${bold("worker", theme)} ${green(overview.workerName, theme)}`);
|
|
379
|
+
if (overview.rows.length === 0) {
|
|
380
|
+
logLine(logger, dim("No production deployments were found for this Worker.", theme));
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
logTable(logger, {
|
|
384
|
+
title: "Deployments",
|
|
385
|
+
rows: overview.rows,
|
|
386
|
+
columns: buildDeploymentColumns(theme),
|
|
387
|
+
theme,
|
|
388
|
+
titleAccent: "cyan"
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
logLine(logger);
|
|
392
|
+
}
|
|
393
|
+
async function runRollback(context, parsed, options, logger, theme) {
|
|
394
|
+
if (!context.workerName) {
|
|
395
|
+
logger.error("A worker name is required for production rollback.");
|
|
396
|
+
return { exitCode: 1 };
|
|
397
|
+
}
|
|
398
|
+
const versionId = asOptionalString(parsed.options.version) || asOptionalString(parsed.options["version-id"]);
|
|
399
|
+
if (!(parsed.options.apply === true)) {
|
|
400
|
+
logger.success(`Production rollback dry run complete for ${context.workerName}`);
|
|
401
|
+
logger.info(versionId ? `Would roll back ${context.workerName} to version ${versionId}` : `Would roll back ${context.workerName} to the previously deployed production version`);
|
|
402
|
+
return { exitCode: 0 };
|
|
403
|
+
}
|
|
404
|
+
const rollbackMessage = asOptionalString(parsed.options.message) ?? `Rolled back ${context.workerName} via devflare productions rollback`;
|
|
405
|
+
const rollbackArgs = ["wrangler", "rollback"];
|
|
406
|
+
if (versionId) rollbackArgs.push(versionId);
|
|
407
|
+
rollbackArgs.push("--name", context.workerName, "--message", rollbackMessage);
|
|
408
|
+
logLine(logger);
|
|
409
|
+
logLine(logger, `${cyanBold("productions rollback", theme)} ${dim(`Rolling back ${context.workerName}`, theme)}`);
|
|
410
|
+
const deps = await getDependencies();
|
|
411
|
+
const cwd = options.cwd ?? process.cwd();
|
|
412
|
+
if ((await deps.exec.exec("bunx", rollbackArgs, {
|
|
413
|
+
cwd,
|
|
414
|
+
stdio: "inherit"
|
|
415
|
+
})).exitCode !== 0) {
|
|
416
|
+
logger.error(`Rollback failed for ${context.workerName}`);
|
|
417
|
+
return { exitCode: 1 };
|
|
418
|
+
}
|
|
419
|
+
const deployments = await account.workerDeployments(context.accountId, context.workerName, CLI_API_OPTIONS);
|
|
420
|
+
const activeVersionId = deployments[0] ? selectDeploymentVersionId(deployments[0]) : void 0;
|
|
421
|
+
logger.success(`Rolled back production deployment for ${context.workerName}`);
|
|
422
|
+
if (activeVersionId) logger.info(`Active version: ${activeVersionId}`);
|
|
423
|
+
return { exitCode: 0 };
|
|
424
|
+
}
|
|
425
|
+
async function runDelete(context, parsed, logger) {
|
|
426
|
+
if (!context.workerName) {
|
|
427
|
+
logger.error("A worker name is required for production deletion.");
|
|
428
|
+
return { exitCode: 1 };
|
|
429
|
+
}
|
|
430
|
+
if (!(parsed.options.apply === true)) {
|
|
431
|
+
logger.success(`Production delete dry run complete for ${context.workerName}`);
|
|
432
|
+
logger.info(`Would delete Worker script ${context.workerName}`);
|
|
433
|
+
logger.warn("Deleting a production Worker script does not automatically delete KV, D1, R2, queue, or other account resources.");
|
|
434
|
+
return { exitCode: 0 };
|
|
435
|
+
}
|
|
436
|
+
await account.deleteWorker(context.accountId, context.workerName, CLI_API_OPTIONS);
|
|
437
|
+
logger.success(`Deleted production Worker script ${context.workerName}`);
|
|
438
|
+
logger.warn("Devflare deleted the Worker script only. Review any shared account resources separately before cleaning them up.");
|
|
439
|
+
return { exitCode: 0 };
|
|
440
|
+
}
|
|
441
|
+
function resolveSelectedWorkerNames(context, selectedFamilies) {
|
|
442
|
+
return Array.from(new Set(context.workerName ? [context.workerName] : selectedFamilies.map((family) => family.baseName))).sort((left, right) => left.localeCompare(right));
|
|
443
|
+
}
|
|
444
|
+
async function runProductionsCommand(parsed, logger, options) {
|
|
445
|
+
if (!await account.isAuthenticated()) {
|
|
446
|
+
logger.error("Not authenticated with Cloudflare");
|
|
447
|
+
logger.info("Run `devflare login` first.");
|
|
448
|
+
return { exitCode: 1 };
|
|
449
|
+
}
|
|
450
|
+
const rawSubcommand = parsed.args[0];
|
|
451
|
+
const fallbackWorkerArg = rawSubcommand && !isProductionSubcommand(rawSubcommand) ? rawSubcommand : parsed.args[1];
|
|
452
|
+
const subcommand = rawSubcommand && isProductionSubcommand(rawSubcommand) ? rawSubcommand : "list";
|
|
453
|
+
const theme = createCliTheme(parsed.options);
|
|
454
|
+
if (rawSubcommand && !isProductionSubcommand(rawSubcommand) && parsed.args.length > 2) {
|
|
455
|
+
logger.error(`Unknown productions subcommand: ${rawSubcommand}`);
|
|
456
|
+
logger.info(`Available productions subcommands: ${PRODUCTION_SUBCOMMANDS.join(", ")}`);
|
|
457
|
+
return { exitCode: 1 };
|
|
458
|
+
}
|
|
459
|
+
try {
|
|
460
|
+
const context = await resolveContext(parsed, options, subcommand, fallbackWorkerArg);
|
|
461
|
+
const selectedFamilies = context.discovery.families.length > 0 ? context.discovery.families : context.workerName ? [{
|
|
462
|
+
baseName: context.workerName,
|
|
463
|
+
roleLabel: "selected worker",
|
|
464
|
+
role: "primary"
|
|
465
|
+
}] : [];
|
|
466
|
+
switch (subcommand) {
|
|
467
|
+
case "versions": {
|
|
468
|
+
const workerNames = resolveSelectedWorkerNames(context, selectedFamilies);
|
|
469
|
+
if (workerNames.length === 0) {
|
|
470
|
+
logger.error("No production Workers could be resolved. Use --worker or run inside a configured package.");
|
|
471
|
+
return { exitCode: 1 };
|
|
472
|
+
}
|
|
473
|
+
showWorkerVersions(logger, await Promise.all(workerNames.map((workerName) => loadWorkerVersionOverview(context.accountId, workerName, CLI_API_OPTIONS))), theme);
|
|
474
|
+
return { exitCode: 0 };
|
|
475
|
+
}
|
|
476
|
+
case "deployments": {
|
|
477
|
+
const workerNames = resolveSelectedWorkerNames(context, selectedFamilies);
|
|
478
|
+
if (workerNames.length === 0) {
|
|
479
|
+
logger.error("No production Workers could be resolved. Use --worker or run inside a configured package.");
|
|
480
|
+
return { exitCode: 1 };
|
|
481
|
+
}
|
|
482
|
+
showWorkerDeployments(logger, await Promise.all(workerNames.map((workerName) => loadWorkerDeploymentHistory(context.accountId, workerName, CLI_API_OPTIONS))), theme);
|
|
483
|
+
return { exitCode: 0 };
|
|
484
|
+
}
|
|
485
|
+
case "rollback": return runRollback(context, parsed, options, logger, theme);
|
|
486
|
+
case "delete": return runDelete(context, parsed, logger);
|
|
487
|
+
default:
|
|
488
|
+
if (selectedFamilies.length === 0) {
|
|
489
|
+
logger.error("No production Workers could be resolved. Use --worker, --config, or run inside a configured package.");
|
|
490
|
+
return { exitCode: 1 };
|
|
491
|
+
}
|
|
492
|
+
showProductionOverview(logger, context, await buildProductionRows(context.accountId, selectedFamilies, CLI_API_OPTIONS), theme);
|
|
493
|
+
return { exitCode: 0 };
|
|
494
|
+
}
|
|
495
|
+
} catch (error) {
|
|
496
|
+
if (error instanceof Error) {
|
|
497
|
+
logger.error(error.message);
|
|
498
|
+
return { exitCode: 1 };
|
|
499
|
+
}
|
|
500
|
+
throw error;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
//#endregion
|
|
504
|
+
export { runProductionsCommand };
|