devflare 1.0.0-next.5 → 1.0.0-next.50
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 +17312 -2139
- package/README.md +394 -605
- package/bin/devflare.js +30 -14
- package/dist/_chunks/account-BI3WZMDy.js +462 -0
- package/dist/_chunks/account-resources-CsmVowJp.js +159 -0
- package/dist/_chunks/ai-CBEuLdoP.js +322 -0
- package/dist/_chunks/api-TzdliH-6.js +568 -0
- package/dist/_chunks/build-artifacts-DU5V0J0Z.js +483 -0
- package/dist/_chunks/build-e0KR38-4.js +24 -0
- package/dist/_chunks/cli-DuUz10Mn.js +1163 -0
- package/dist/_chunks/cloudflare-BaloqI3H.js +157 -0
- package/dist/_chunks/colors-DiK6wPJ5.js +13 -0
- package/dist/_chunks/command-utils-DA0Qx9_K.js +45 -0
- package/dist/_chunks/compiler-Zw16C9Pi.js +489 -0
- package/dist/_chunks/config-Brju62xy.js +78 -0
- package/dist/_chunks/config-path-DaL1ylZ_.js +42 -0
- package/dist/_chunks/context-CX50Y2Kb.js +2250 -0
- package/dist/_chunks/decorators-QmV57ixr.js +19 -0
- package/dist/_chunks/dependencies-C2oxFjU_.js +57 -0
- package/dist/_chunks/deploy-B-Kku1Vk.js +1032 -0
- package/dist/_chunks/dev-D4e_RRZn.js +3471 -0
- package/dist/_chunks/doctor-jm_K4dxL.js +219 -0
- package/dist/_chunks/durable-object-DMtH0XYX.js +234 -0
- package/dist/_chunks/env-S0_nMVz1.js +125 -0
- package/dist/_chunks/family-_9-mGSfO.js +143 -0
- package/dist/_chunks/generated-artifacts-dMJY4KAt.js +32 -0
- package/dist/_chunks/glob-CmQOvunB.js +56 -0
- package/dist/_chunks/init-DnkJOmpW.js +165 -0
- package/dist/_chunks/loader-Cr0_OWPy.js +1288 -0
- package/dist/_chunks/local-dev-vars-CTSa-wvF.js +81 -0
- package/dist/_chunks/local-hyperdrive-CJ90j46O.js +119 -0
- package/dist/_chunks/local-media-bindings-DsAW4AMF.js +335 -0
- package/dist/_chunks/local-secrets-DMPkmOn3.js +123 -0
- package/dist/_chunks/local-workflow-entrypoints-Cq_WJajd.js +90 -0
- package/dist/_chunks/login-FjTAAQbi.js +51 -0
- package/dist/_chunks/package-metadata-DjHBLB-z.js +39 -0
- package/dist/_chunks/preferences-BKp_7XJx.js +241 -0
- package/dist/_chunks/preview-C3Cdr8an.js +462 -0
- package/dist/_chunks/preview-registry-ClAbLTHH.js +1186 -0
- package/dist/_chunks/preview-resources-CGMBjsYB.js +359 -0
- package/dist/_chunks/previews-C7hs9-BT.js +1134 -0
- package/dist/_chunks/productions-T9Als4fE.js +411 -0
- package/dist/_chunks/ref-CYJNAAe_.js +178 -0
- package/dist/_chunks/remote-CZnP-HLJ.js +79 -0
- package/dist/_chunks/remote-config-D39BY9ji.js +132 -0
- package/dist/_chunks/resolve-package-qizBfCIm.js +152 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-BFYCqHb-.js +833 -0
- package/dist/_chunks/runtime-DL-Nz3k8.js +550 -0
- package/dist/_chunks/schema-normalization-BCwTLTGp.js +660 -0
- package/dist/_chunks/secrets-DIpJGe6C.js +95 -0
- package/dist/_chunks/tail-IY-ijYmv.js +239 -0
- package/dist/_chunks/token-Dmi0KXyX.js +333 -0
- package/dist/_chunks/tokens-iVcgNXi-.js +221 -0
- package/dist/_chunks/types-DoKsMYfm.js +484 -0
- package/dist/_chunks/ui-BUoZApvE.js +103 -0
- package/dist/_chunks/usage-BBTGzjon.js +272 -0
- package/dist/_chunks/vite-CGtVNf5E.js +1267 -0
- package/dist/_chunks/vite-utils-OVLMV605.js +183 -0
- package/dist/_chunks/worker-BEZI4od1.js +410 -0
- package/dist/_chunks/worker-bundler-dTTnYU3n.js +458 -0
- package/dist/_chunks/worker-entrypoint-CQW77lG8.js +247 -0
- package/dist/_chunks/workerName-CFJsLZA-.js +23 -0
- package/dist/bridge/client.d.ts +49 -7
- package/dist/bridge/client.d.ts.map +1 -1
- 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.d.ts +82 -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/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/{serialization.d.ts → v2/value-serialization.d.ts} +40 -18
- 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/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 +5411 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +80 -0
- 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/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 +298 -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 +12 -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 +2025 -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 +3579 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +265 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +508 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +508 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +767 -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.d.ts +917 -0
- package/dist/config/schema-types-runtime.d.ts.map +1 -0
- package/dist/config/schema-types.d.ts +424 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +5324 -2011
- 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-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 +21 -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 +81 -0
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts +36 -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 +82 -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-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 +15 -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/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 +9 -298
- 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 +10 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -111
- package/dist/runtime/middleware.d.ts +119 -67
- package/dist/runtime/middleware.d.ts.map +1 -1
- 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 +313 -167
- 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 +20 -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 +4971 -70
- package/dist/test/offline-bindings.d.ts +115 -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 +10 -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 +43 -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/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 +13 -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 -339
- 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 +7 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -0
- 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 +159 -116
- 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.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-mnf6v8gd.js +0 -53
- package/dist/deploy-nhceck39.js +0 -70
- package/dist/dev-b9dmrj7b.js +0 -2417
- package/dist/doctor-fmgb3d28.js +0 -190
- package/dist/durable-object-t4kbb0yt.js +0 -13
- package/dist/index-07q6yxyc.js +0 -168
- 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-67qcae0f.js +0 -183
- package/dist/index-a855bdsx.js +0 -18
- package/dist/index-d8bdkx2h.js +0 -109
- package/dist/index-ep3445yc.js +0 -2225
- package/dist/index-gz1gndna.js +0 -307
- package/dist/index-hcex3rgh.js +0 -266
- package/dist/index-m2q41jwa.js +0 -462
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-pf5s73n9.js +0 -1413
- package/dist/index-rbht7m9r.js +0 -36
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- 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-5nyrz1sz.js +0 -454
- package/dist/worker-entrypoint-m9th0rg0.js +0 -13
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { r as loadConfig, t as ConfigNotFoundError } from "./loader-Cr0_OWPy.js";
|
|
2
|
+
import { t as account } from "./cloudflare-BaloqI3H.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-BUoZApvE.js";
|
|
4
|
+
import { i as findFiles } from "./glob-CmQOvunB.js";
|
|
5
|
+
import { i as resolveNamedSelection, r as resolveCloudflareAccountId, t as asOptionalString } from "./command-utils-DA0Qx9_K.js";
|
|
6
|
+
import { t as getDependencies } from "./dependencies-C2oxFjU_.js";
|
|
7
|
+
import { i as collectConfiguredWorkerFamilies } from "./family-_9-mGSfO.js";
|
|
8
|
+
//#region src/cli/commands/productions.ts
|
|
9
|
+
const CLI_API_OPTIONS = { timeout: 1e4 };
|
|
10
|
+
const PRODUCTION_SUBCOMMANDS = [
|
|
11
|
+
"list",
|
|
12
|
+
"versions",
|
|
13
|
+
"rollback",
|
|
14
|
+
"delete"
|
|
15
|
+
];
|
|
16
|
+
const VERSION_LIST_LIMIT = 10;
|
|
17
|
+
function isProductionSubcommand(value) {
|
|
18
|
+
return PRODUCTION_SUBCOMMANDS.includes(value);
|
|
19
|
+
}
|
|
20
|
+
function shortenVersionId(versionId, length = 12) {
|
|
21
|
+
return versionId.length <= length ? versionId : `${versionId.slice(0, length)}…`;
|
|
22
|
+
}
|
|
23
|
+
function selectDeploymentVersionId(deployment) {
|
|
24
|
+
return deployment.versions.find((version) => version.percentage === 100)?.versionId ?? deployment.versions[0]?.versionId;
|
|
25
|
+
}
|
|
26
|
+
function getWorkerVersionTimestamp(version) {
|
|
27
|
+
return version.metadata.modifiedOn ?? version.metadata.createdOn;
|
|
28
|
+
}
|
|
29
|
+
function formatRecordDate(date) {
|
|
30
|
+
return date ? date.toISOString().slice(0, 19).replace("T", " ") : "N/A";
|
|
31
|
+
}
|
|
32
|
+
function formatWorkerStatus(status, theme) {
|
|
33
|
+
switch (status) {
|
|
34
|
+
case "active": return green(status, theme);
|
|
35
|
+
case "undeployed": return yellow(status, theme);
|
|
36
|
+
default: return red(status, theme);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function formatVersionStatus(status, theme) {
|
|
40
|
+
switch (status) {
|
|
41
|
+
case "active": return green(status, theme);
|
|
42
|
+
default: return whiteDim(status, theme);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function shouldReplaceConfiguredWorkerFamily(existing, candidate) {
|
|
46
|
+
return !existing || candidate.role === "primary" && existing.role !== "primary";
|
|
47
|
+
}
|
|
48
|
+
function mergeConfiguredWorkerFamily(families, candidate) {
|
|
49
|
+
if (shouldReplaceConfiguredWorkerFamily(families.get(candidate.baseName), candidate)) families.set(candidate.baseName, candidate);
|
|
50
|
+
}
|
|
51
|
+
async function discoverProductionConfigs(cwd, configFile, environment) {
|
|
52
|
+
const families = /* @__PURE__ */ new Map();
|
|
53
|
+
const primaryFamilyNames = /* @__PURE__ */ new Set();
|
|
54
|
+
const accountIds = /* @__PURE__ */ new Set();
|
|
55
|
+
let defaultWorkerName;
|
|
56
|
+
let defaultWorkerNameSource = "none";
|
|
57
|
+
const loadAndCollect = async (candidateConfigFile) => {
|
|
58
|
+
try {
|
|
59
|
+
const config = await loadConfig({
|
|
60
|
+
cwd,
|
|
61
|
+
configFile: candidateConfigFile
|
|
62
|
+
});
|
|
63
|
+
const resolvedFamilies = collectConfiguredWorkerFamilies(config, environment);
|
|
64
|
+
for (const family of resolvedFamilies) {
|
|
65
|
+
mergeConfiguredWorkerFamily(families, family);
|
|
66
|
+
if (family.role === "primary") primaryFamilyNames.add(family.baseName);
|
|
67
|
+
}
|
|
68
|
+
if (config.accountId?.trim()) accountIds.add(config.accountId.trim());
|
|
69
|
+
if (!defaultWorkerName) {
|
|
70
|
+
defaultWorkerName = resolvedFamilies.find((family) => family.role === "primary")?.baseName;
|
|
71
|
+
defaultWorkerNameSource = defaultWorkerName ? "config" : "none";
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (error instanceof ConfigNotFoundError) return false;
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
if (configFile) await loadAndCollect(configFile);
|
|
80
|
+
else if (!await loadAndCollect()) {
|
|
81
|
+
const configPaths = (await findFiles("**/devflare.config.{ts,js,mjs,cjs}", {
|
|
82
|
+
cwd,
|
|
83
|
+
absolute: true
|
|
84
|
+
})).sort((left, right) => left.localeCompare(right));
|
|
85
|
+
for (const configPath of configPaths) await loadAndCollect(configPath);
|
|
86
|
+
}
|
|
87
|
+
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`.");
|
|
88
|
+
return {
|
|
89
|
+
accountId: Array.from(accountIds)[0],
|
|
90
|
+
defaultWorkerName,
|
|
91
|
+
defaultWorkerNameSource,
|
|
92
|
+
families: Array.from(families.values()).sort((left, right) => {
|
|
93
|
+
if (left.role === "primary" && right.role !== "primary") return -1;
|
|
94
|
+
if (left.role !== "primary" && right.role === "primary") return 1;
|
|
95
|
+
return left.baseName.localeCompare(right.baseName);
|
|
96
|
+
}),
|
|
97
|
+
primaryFamilyNames: Array.from(primaryFamilyNames).sort((left, right) => left.localeCompare(right))
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async function resolveAccountId(parsed, discovery) {
|
|
101
|
+
return resolveCloudflareAccountId({
|
|
102
|
+
explicitAccountId: asOptionalString(parsed.options.account),
|
|
103
|
+
configuredAccountId: discovery.accountId,
|
|
104
|
+
apiOptions: CLI_API_OPTIONS
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function resolveWorkerName(parsed, discovery, fallbackArg) {
|
|
108
|
+
const selection = resolveNamedSelection({
|
|
109
|
+
explicitValue: asOptionalString(parsed.options.worker),
|
|
110
|
+
fallbackValue: fallbackArg,
|
|
111
|
+
configuredValue: discovery.defaultWorkerName
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
workerName: selection.value,
|
|
115
|
+
source: selection.value === discovery.defaultWorkerName ? discovery.defaultWorkerNameSource : selection.source
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async function resolveContext(parsed, options, subcommand, fallbackArg) {
|
|
119
|
+
const cwd = options.cwd ?? process.cwd();
|
|
120
|
+
const configFile = asOptionalString(parsed.options.config);
|
|
121
|
+
const environment = asOptionalString(parsed.options.env) ?? "production";
|
|
122
|
+
const explicitAccountId = asOptionalString(parsed.options.account);
|
|
123
|
+
const explicitWorkerName = asOptionalString(parsed.options.worker) ?? fallbackArg;
|
|
124
|
+
const discovery = Boolean(configFile) || !explicitAccountId || !explicitWorkerName ? await discoverProductionConfigs(cwd, configFile, environment) : {
|
|
125
|
+
accountId: void 0,
|
|
126
|
+
defaultWorkerName: void 0,
|
|
127
|
+
defaultWorkerNameSource: "none",
|
|
128
|
+
families: [],
|
|
129
|
+
primaryFamilyNames: []
|
|
130
|
+
};
|
|
131
|
+
const accountId = await resolveAccountId(parsed, discovery);
|
|
132
|
+
const workerSelection = resolveWorkerName(parsed, discovery, fallbackArg);
|
|
133
|
+
if (!accountId) throw new Error("No Cloudflare account could be resolved. Use --account or configure accountId in devflare.config.*.");
|
|
134
|
+
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.`);
|
|
135
|
+
return {
|
|
136
|
+
accountId,
|
|
137
|
+
workerName: workerSelection.workerName,
|
|
138
|
+
workerNameSource: workerSelection.source,
|
|
139
|
+
discovery
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function getProductionUrl(workerName, workersSubdomain) {
|
|
143
|
+
if (!workersSubdomain) return;
|
|
144
|
+
return `https://${workerName}.${workersSubdomain.trim().replace(/^https?:\/\//i, "").replace(/\.workers\.dev\/?$/i, "")}.workers.dev`;
|
|
145
|
+
}
|
|
146
|
+
async function buildProductionRows(accountId, families, apiOptions) {
|
|
147
|
+
const [liveWorkers, workersSubdomain] = await Promise.all([account.workers(accountId, apiOptions), account.workersSubdomain(accountId, apiOptions)]);
|
|
148
|
+
const workersByName = new Map(liveWorkers.map((worker) => [worker.name, worker]));
|
|
149
|
+
return Promise.all(families.map(async (family) => {
|
|
150
|
+
const worker = workersByName.get(family.baseName);
|
|
151
|
+
if (!worker) return {
|
|
152
|
+
workerName: family.baseName,
|
|
153
|
+
role: family.roleLabel,
|
|
154
|
+
status: "missing",
|
|
155
|
+
url: getProductionUrl(family.baseName, workersSubdomain)
|
|
156
|
+
};
|
|
157
|
+
const latestDeployment = [...await account.workerDeployments(accountId, family.baseName, apiOptions)].sort((left, right) => {
|
|
158
|
+
return right.createdOn.getTime() - left.createdOn.getTime();
|
|
159
|
+
})[0];
|
|
160
|
+
const activeVersionId = latestDeployment ? selectDeploymentVersionId(latestDeployment) : void 0;
|
|
161
|
+
return {
|
|
162
|
+
workerName: family.baseName,
|
|
163
|
+
role: family.roleLabel,
|
|
164
|
+
status: latestDeployment ? "active" : "undeployed",
|
|
165
|
+
deployedAt: latestDeployment?.createdOn ?? worker.modifiedOn,
|
|
166
|
+
versionId: activeVersionId,
|
|
167
|
+
source: latestDeployment?.source,
|
|
168
|
+
url: getProductionUrl(family.baseName, workersSubdomain)
|
|
169
|
+
};
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
function buildProductionColumns(theme) {
|
|
173
|
+
return [
|
|
174
|
+
{
|
|
175
|
+
label: "Worker",
|
|
176
|
+
width: 34,
|
|
177
|
+
value: (row) => row.workerName
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
label: "Role",
|
|
181
|
+
width: 18,
|
|
182
|
+
value: (row) => row.role
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
label: "Status",
|
|
186
|
+
width: 10,
|
|
187
|
+
value: (row) => formatWorkerStatus(row.status, theme)
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
label: "Deployed",
|
|
191
|
+
width: 19,
|
|
192
|
+
value: (row) => whiteDim(formatRecordDate(row.deployedAt), theme)
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
label: "Version",
|
|
196
|
+
width: 13,
|
|
197
|
+
value: (row) => row.versionId ? shortenVersionId(row.versionId) : dim("N/A", theme)
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: "Source",
|
|
201
|
+
width: 14,
|
|
202
|
+
value: (row) => row.source ?? dim("N/A", theme)
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: "URL",
|
|
206
|
+
value: (row) => row.url ?? "N/A"
|
|
207
|
+
}
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
function buildVersionColumns(theme) {
|
|
211
|
+
return [
|
|
212
|
+
{
|
|
213
|
+
label: "Version",
|
|
214
|
+
width: 13,
|
|
215
|
+
value: (row) => shortenVersionId(row.versionId)
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: "Status",
|
|
219
|
+
width: 8,
|
|
220
|
+
value: (row) => formatVersionStatus(row.status, theme)
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: "Updated",
|
|
224
|
+
width: 19,
|
|
225
|
+
value: (row) => whiteDim(formatRecordDate(row.updatedAt), theme)
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
label: "Last deployed",
|
|
229
|
+
width: 19,
|
|
230
|
+
value: (row) => whiteDim(formatRecordDate(row.deployedAt), theme)
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
label: "Source",
|
|
234
|
+
value: (row) => row.source ?? dim("N/A", theme)
|
|
235
|
+
}
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
async function loadWorkerVersionOverview(accountId, workerName, apiOptions) {
|
|
239
|
+
const [versions, deployments] = await Promise.all([account.workerVersions(accountId, workerName, apiOptions), account.workerDeployments(accountId, workerName, apiOptions)]);
|
|
240
|
+
const productionVersions = versions.filter((version) => version.id).filter((version) => version.metadata.hasPreview !== true).sort((left, right) => {
|
|
241
|
+
const leftTime = getWorkerVersionTimestamp(left)?.getTime() ?? 0;
|
|
242
|
+
return (getWorkerVersionTimestamp(right)?.getTime() ?? 0) - leftTime;
|
|
243
|
+
}).slice(0, VERSION_LIST_LIMIT);
|
|
244
|
+
const activeVersionIds = new Set((deployments[0]?.versions ?? []).map((version) => version.versionId));
|
|
245
|
+
const latestDeploymentByVersionId = /* @__PURE__ */ new Map();
|
|
246
|
+
for (const deployment of deployments) for (const version of deployment.versions) {
|
|
247
|
+
const existing = latestDeploymentByVersionId.get(version.versionId);
|
|
248
|
+
if (!existing || deployment.createdOn.getTime() > existing.getTime()) latestDeploymentByVersionId.set(version.versionId, deployment.createdOn);
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
workerName,
|
|
252
|
+
rows: productionVersions.map((version) => ({
|
|
253
|
+
versionId: version.id,
|
|
254
|
+
status: activeVersionIds.has(version.id) ? "active" : "stored",
|
|
255
|
+
updatedAt: getWorkerVersionTimestamp(version),
|
|
256
|
+
deployedAt: latestDeploymentByVersionId.get(version.id),
|
|
257
|
+
source: version.metadata.source
|
|
258
|
+
}))
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function showProductionOverview(logger, context, rows, theme) {
|
|
262
|
+
logLine(logger);
|
|
263
|
+
if (context.discovery.primaryFamilyNames.length === 1) {
|
|
264
|
+
logLine(logger, formatLabelValue("worker family", green(context.discovery.primaryFamilyNames[0], theme), theme));
|
|
265
|
+
logLine(logger, formatLabelValue("related", whiteDim(String(Math.max(context.discovery.families.length - 1, 0)), theme), theme));
|
|
266
|
+
} else if (context.discovery.primaryFamilyNames.length > 1) {
|
|
267
|
+
logLine(logger, formatLabelValue("configured", whiteDim(`${context.discovery.primaryFamilyNames.length} primary workers`, theme), theme));
|
|
268
|
+
logLine(logger, formatLabelValue("tracked", whiteDim(`${context.discovery.families.length} workers`, theme), theme));
|
|
269
|
+
} else if (context.workerName) logLine(logger, formatLabelValue("worker", green(context.workerName, theme), theme));
|
|
270
|
+
if (rows.length === 0) {
|
|
271
|
+
logLine(logger);
|
|
272
|
+
logLine(logger, dim("No production Workers matched the current selection.", theme));
|
|
273
|
+
logLine(logger);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
logLine(logger);
|
|
277
|
+
logTable(logger, {
|
|
278
|
+
title: "Productions",
|
|
279
|
+
rows,
|
|
280
|
+
columns: buildProductionColumns(theme),
|
|
281
|
+
theme,
|
|
282
|
+
titleAccent: "green"
|
|
283
|
+
});
|
|
284
|
+
logLine(logger);
|
|
285
|
+
logLine(logger, dim("Use `devflare productions versions` for recent production versions, or `rollback` / `delete` to mutate one Worker.", theme));
|
|
286
|
+
logLine(logger);
|
|
287
|
+
}
|
|
288
|
+
function showWorkerVersions(logger, overviews, theme) {
|
|
289
|
+
logLine(logger);
|
|
290
|
+
if (overviews.length === 0) {
|
|
291
|
+
logLine(logger, dim("No production versions were found for the current selection.", theme));
|
|
292
|
+
logLine(logger);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
for (const [index, overview] of overviews.entries()) {
|
|
296
|
+
if (index > 0) logLine(logger);
|
|
297
|
+
logLine(logger, `${bold("worker", theme)} ${green(overview.workerName, theme)}`);
|
|
298
|
+
if (overview.rows.length === 0) {
|
|
299
|
+
logLine(logger, dim("No stored production versions were found for this Worker.", theme));
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
logTable(logger, {
|
|
303
|
+
title: "Versions",
|
|
304
|
+
rows: overview.rows,
|
|
305
|
+
columns: buildVersionColumns(theme),
|
|
306
|
+
theme,
|
|
307
|
+
titleAccent: "cyan"
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
logLine(logger);
|
|
311
|
+
}
|
|
312
|
+
async function runRollback(context, parsed, options, logger, theme) {
|
|
313
|
+
if (!context.workerName) {
|
|
314
|
+
logger.error("A worker name is required for production rollback.");
|
|
315
|
+
return { exitCode: 1 };
|
|
316
|
+
}
|
|
317
|
+
const versionId = asOptionalString(parsed.options.version) || asOptionalString(parsed.options["version-id"]);
|
|
318
|
+
if (!(parsed.options.apply === true)) {
|
|
319
|
+
logger.success(`Production rollback dry run complete for ${context.workerName}`);
|
|
320
|
+
logger.info(versionId ? `Would roll back ${context.workerName} to version ${versionId}` : `Would roll back ${context.workerName} to the previously deployed production version`);
|
|
321
|
+
return { exitCode: 0 };
|
|
322
|
+
}
|
|
323
|
+
const rollbackMessage = asOptionalString(parsed.options.message) ?? `Rolled back ${context.workerName} via devflare productions rollback`;
|
|
324
|
+
const rollbackArgs = ["wrangler", "rollback"];
|
|
325
|
+
if (versionId) rollbackArgs.push(versionId);
|
|
326
|
+
rollbackArgs.push("--name", context.workerName, "--message", rollbackMessage);
|
|
327
|
+
logLine(logger);
|
|
328
|
+
logLine(logger, `${cyanBold("productions rollback", theme)} ${dim(`Rolling back ${context.workerName}`, theme)}`);
|
|
329
|
+
const deps = await getDependencies();
|
|
330
|
+
const cwd = options.cwd ?? process.cwd();
|
|
331
|
+
if ((await deps.exec.exec("bunx", rollbackArgs, {
|
|
332
|
+
cwd,
|
|
333
|
+
stdio: "inherit"
|
|
334
|
+
})).exitCode !== 0) {
|
|
335
|
+
logger.error(`Rollback failed for ${context.workerName}`);
|
|
336
|
+
return { exitCode: 1 };
|
|
337
|
+
}
|
|
338
|
+
const deployments = await account.workerDeployments(context.accountId, context.workerName, CLI_API_OPTIONS);
|
|
339
|
+
const activeVersionId = deployments[0] ? selectDeploymentVersionId(deployments[0]) : void 0;
|
|
340
|
+
logger.success(`Rolled back production deployment for ${context.workerName}`);
|
|
341
|
+
if (activeVersionId) logger.info(`Active version: ${activeVersionId}`);
|
|
342
|
+
return { exitCode: 0 };
|
|
343
|
+
}
|
|
344
|
+
async function runDelete(context, parsed, logger) {
|
|
345
|
+
if (!context.workerName) {
|
|
346
|
+
logger.error("A worker name is required for production deletion.");
|
|
347
|
+
return { exitCode: 1 };
|
|
348
|
+
}
|
|
349
|
+
if (!(parsed.options.apply === true)) {
|
|
350
|
+
logger.success(`Production delete dry run complete for ${context.workerName}`);
|
|
351
|
+
logger.info(`Would delete Worker script ${context.workerName}`);
|
|
352
|
+
logger.warn("Deleting a production Worker script does not automatically delete KV, D1, R2, queue, or other account resources.");
|
|
353
|
+
return { exitCode: 0 };
|
|
354
|
+
}
|
|
355
|
+
await account.deleteWorker(context.accountId, context.workerName, CLI_API_OPTIONS);
|
|
356
|
+
logger.success(`Deleted production Worker script ${context.workerName}`);
|
|
357
|
+
logger.warn("Devflare deleted the Worker script only. Review any shared account resources separately before cleaning them up.");
|
|
358
|
+
return { exitCode: 0 };
|
|
359
|
+
}
|
|
360
|
+
async function runProductionsCommand(parsed, logger, options) {
|
|
361
|
+
if (!await account.isAuthenticated()) {
|
|
362
|
+
logger.error("Not authenticated with Cloudflare");
|
|
363
|
+
logger.info("Run `devflare login` first.");
|
|
364
|
+
return { exitCode: 1 };
|
|
365
|
+
}
|
|
366
|
+
const rawSubcommand = parsed.args[0];
|
|
367
|
+
const fallbackWorkerArg = rawSubcommand && !isProductionSubcommand(rawSubcommand) ? rawSubcommand : parsed.args[1];
|
|
368
|
+
const subcommand = rawSubcommand && isProductionSubcommand(rawSubcommand) ? rawSubcommand : "list";
|
|
369
|
+
const theme = createCliTheme(parsed.options);
|
|
370
|
+
if (rawSubcommand && !isProductionSubcommand(rawSubcommand) && parsed.args.length > 2) {
|
|
371
|
+
logger.error(`Unknown productions subcommand: ${rawSubcommand}`);
|
|
372
|
+
logger.info(`Available productions subcommands: ${PRODUCTION_SUBCOMMANDS.join(", ")}`);
|
|
373
|
+
return { exitCode: 1 };
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
const context = await resolveContext(parsed, options, subcommand, fallbackWorkerArg);
|
|
377
|
+
const selectedFamilies = context.discovery.families.length > 0 ? context.discovery.families : context.workerName ? [{
|
|
378
|
+
baseName: context.workerName,
|
|
379
|
+
roleLabel: "selected worker",
|
|
380
|
+
role: "primary"
|
|
381
|
+
}] : [];
|
|
382
|
+
switch (subcommand) {
|
|
383
|
+
case "versions": {
|
|
384
|
+
const workerNames = Array.from(new Set(context.workerName ? [context.workerName] : selectedFamilies.map((family) => family.baseName))).sort((left, right) => left.localeCompare(right));
|
|
385
|
+
if (workerNames.length === 0) {
|
|
386
|
+
logger.error("No production Workers could be resolved. Use --worker or run inside a configured package.");
|
|
387
|
+
return { exitCode: 1 };
|
|
388
|
+
}
|
|
389
|
+
showWorkerVersions(logger, await Promise.all(workerNames.map((workerName) => loadWorkerVersionOverview(context.accountId, workerName, CLI_API_OPTIONS))), theme);
|
|
390
|
+
return { exitCode: 0 };
|
|
391
|
+
}
|
|
392
|
+
case "rollback": return runRollback(context, parsed, options, logger, theme);
|
|
393
|
+
case "delete": return runDelete(context, parsed, logger);
|
|
394
|
+
default:
|
|
395
|
+
if (selectedFamilies.length === 0) {
|
|
396
|
+
logger.error("No production Workers could be resolved. Use --worker, --config, or run inside a configured package.");
|
|
397
|
+
return { exitCode: 1 };
|
|
398
|
+
}
|
|
399
|
+
showProductionOverview(logger, context, await buildProductionRows(context.accountId, selectedFamilies, CLI_API_OPTIONS), theme);
|
|
400
|
+
return { exitCode: 0 };
|
|
401
|
+
}
|
|
402
|
+
} catch (error) {
|
|
403
|
+
if (error instanceof Error) {
|
|
404
|
+
logger.error(error.message);
|
|
405
|
+
return { exitCode: 1 };
|
|
406
|
+
}
|
|
407
|
+
throw error;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
export { runProductionsCommand };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
//#region src/config/define.ts
|
|
2
|
+
function defineConfig(config) {
|
|
3
|
+
if (typeof config === "function") {
|
|
4
|
+
const result = config();
|
|
5
|
+
if (result instanceof Promise) return result;
|
|
6
|
+
return result;
|
|
7
|
+
}
|
|
8
|
+
return config;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/config/ref.ts
|
|
12
|
+
const resolvedCache = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
const pendingResolutions = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
const PENDING_REF_VALUE = "<pending>";
|
|
15
|
+
/**
|
|
16
|
+
* Extract the import specifier string from an import-thunk function's source.
|
|
17
|
+
*
|
|
18
|
+
* Uses a narrow regex over `fn.toString()`. To avoid returning bogus paths for
|
|
19
|
+
* minified or hand-written functions that do not contain a parseable
|
|
20
|
+
* `import(...)` call, the result is validated before being returned.
|
|
21
|
+
*
|
|
22
|
+
* Throws a clear error instead of returning a silent placeholder when the
|
|
23
|
+
* function source is not in a recognized shape.
|
|
24
|
+
*/
|
|
25
|
+
function extractConfigPathFromImportFn(fn) {
|
|
26
|
+
let source;
|
|
27
|
+
try {
|
|
28
|
+
source = Function.prototype.toString.call(fn);
|
|
29
|
+
} catch {
|
|
30
|
+
return PENDING_REF_VALUE;
|
|
31
|
+
}
|
|
32
|
+
if (!/import\s*\(/.test(source)) return PENDING_REF_VALUE;
|
|
33
|
+
const match = source.match(/import\s*\(\s*(['"`])([^'"`]+)\1\s*\)/);
|
|
34
|
+
const raw = match?.[2];
|
|
35
|
+
if (!raw || raw.length === 0) throw new Error("ref() could not extract a config path from the import function source. The specifier must be a static string literal — dynamic or computed specifiers (e.g. template literals with expressions) are not supported. If this input has been minified, pass an unminified config source.");
|
|
36
|
+
if (match?.[1] === "`" && /\$\{/.test(raw)) throw new Error("ref() import specifier is a template literal with an embedded expression. The specifier must be a static string literal so the config path can be resolved ahead of time.");
|
|
37
|
+
if (raw.length < 2 && !/[./]/.test(raw)) throw new Error(`ref() extracted a suspiciously short config path (${JSON.stringify(raw)}). This usually indicates a minified bundle where the original specifier was rewritten. Pass an unminified config source.`);
|
|
38
|
+
return raw;
|
|
39
|
+
}
|
|
40
|
+
function ref(nameOrImport, maybeImport) {
|
|
41
|
+
const nameOverride = typeof nameOrImport === "string" ? nameOrImport : void 0;
|
|
42
|
+
let importFn;
|
|
43
|
+
if (typeof nameOrImport === "function") importFn = nameOrImport;
|
|
44
|
+
else if (typeof maybeImport === "function") importFn = maybeImport;
|
|
45
|
+
if (!importFn) throw new Error("ref() requires an import function");
|
|
46
|
+
const resolvedImportFn = importFn;
|
|
47
|
+
const configPath = extractConfigPathFromImportFn(resolvedImportFn);
|
|
48
|
+
const doBindingCache = /* @__PURE__ */ new Map();
|
|
49
|
+
async function doResolve() {
|
|
50
|
+
const cached = resolvedCache.get(proxy);
|
|
51
|
+
if (cached) return cached;
|
|
52
|
+
const pending = pendingResolutions.get(proxy);
|
|
53
|
+
if (pending) return pending;
|
|
54
|
+
const trackedPromise = (async () => {
|
|
55
|
+
const module = await resolvedImportFn();
|
|
56
|
+
const config = "default" in module ? module.default : module;
|
|
57
|
+
if (!config.name && !nameOverride) throw new Error("Referenced config must have a \"name\" property");
|
|
58
|
+
const resolved = {
|
|
59
|
+
name: nameOverride ?? config.name,
|
|
60
|
+
config,
|
|
61
|
+
configPath
|
|
62
|
+
};
|
|
63
|
+
resolvedCache.set(proxy, resolved);
|
|
64
|
+
return resolved;
|
|
65
|
+
})().finally(() => {
|
|
66
|
+
pendingResolutions.delete(proxy);
|
|
67
|
+
});
|
|
68
|
+
pendingResolutions.set(proxy, trackedPromise);
|
|
69
|
+
return trackedPromise;
|
|
70
|
+
}
|
|
71
|
+
function getResolved() {
|
|
72
|
+
const cached = resolvedCache.get(proxy);
|
|
73
|
+
if (cached) return cached;
|
|
74
|
+
throw new Error("ref() not yet resolved. Call ref().resolve() first, or use top-level await in your config file to resolve all refs before exporting.");
|
|
75
|
+
}
|
|
76
|
+
function createWorkerBinding(entrypoint) {
|
|
77
|
+
return {
|
|
78
|
+
get service() {
|
|
79
|
+
const cached = resolvedCache.get(proxy);
|
|
80
|
+
if (cached) return cached.name;
|
|
81
|
+
if (nameOverride) return nameOverride;
|
|
82
|
+
return PENDING_REF_VALUE;
|
|
83
|
+
},
|
|
84
|
+
entrypoint,
|
|
85
|
+
__ref: proxy
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const workerAccessor = new Proxy((entrypoint) => createWorkerBinding(entrypoint), { get(target, prop) {
|
|
89
|
+
if (prop === "service") {
|
|
90
|
+
const cached = resolvedCache.get(proxy);
|
|
91
|
+
if (cached) return cached.name;
|
|
92
|
+
if (nameOverride) return nameOverride;
|
|
93
|
+
return PENDING_REF_VALUE;
|
|
94
|
+
}
|
|
95
|
+
if (prop === "entrypoint") return void 0;
|
|
96
|
+
if (prop === "__ref") return proxy;
|
|
97
|
+
return Reflect.get(target, prop);
|
|
98
|
+
} });
|
|
99
|
+
function createDOBinding(bindingName) {
|
|
100
|
+
const cachedBinding = doBindingCache.get(bindingName);
|
|
101
|
+
if (cachedBinding) return cachedBinding;
|
|
102
|
+
const doBinding = {
|
|
103
|
+
get className() {
|
|
104
|
+
const cached = resolvedCache.get(proxy);
|
|
105
|
+
if (cached?.config.bindings?.durableObjects) {
|
|
106
|
+
const doConfig = cached.config.bindings.durableObjects[bindingName];
|
|
107
|
+
if (typeof doConfig === "string") return doConfig;
|
|
108
|
+
if (doConfig && typeof doConfig === "object" && "className" in doConfig) return doConfig.className;
|
|
109
|
+
}
|
|
110
|
+
return PENDING_REF_VALUE;
|
|
111
|
+
},
|
|
112
|
+
get scriptName() {
|
|
113
|
+
const cached = resolvedCache.get(proxy);
|
|
114
|
+
if (cached) return cached.name;
|
|
115
|
+
if (nameOverride) return nameOverride;
|
|
116
|
+
return PENDING_REF_VALUE;
|
|
117
|
+
},
|
|
118
|
+
kind: "cross-worker",
|
|
119
|
+
__ref: proxy
|
|
120
|
+
};
|
|
121
|
+
doBindingCache.set(bindingName, doBinding);
|
|
122
|
+
return doBinding;
|
|
123
|
+
}
|
|
124
|
+
const knownProps = new Set([
|
|
125
|
+
"name",
|
|
126
|
+
"config",
|
|
127
|
+
"configPath",
|
|
128
|
+
"worker",
|
|
129
|
+
"__import",
|
|
130
|
+
"__nameOverride",
|
|
131
|
+
"resolve",
|
|
132
|
+
"then"
|
|
133
|
+
]);
|
|
134
|
+
const proxy = new Proxy({
|
|
135
|
+
get name() {
|
|
136
|
+
return getResolved().name;
|
|
137
|
+
},
|
|
138
|
+
get config() {
|
|
139
|
+
return getResolved().config;
|
|
140
|
+
},
|
|
141
|
+
configPath,
|
|
142
|
+
worker: workerAccessor,
|
|
143
|
+
__import: resolvedImportFn,
|
|
144
|
+
__nameOverride: nameOverride,
|
|
145
|
+
resolve: doResolve
|
|
146
|
+
}, {
|
|
147
|
+
get(target, prop) {
|
|
148
|
+
if (typeof prop === "string" && knownProps.has(prop)) return Reflect.get(target, prop);
|
|
149
|
+
if (typeof prop === "symbol") return Reflect.get(target, prop);
|
|
150
|
+
if (typeof prop === "string" && /^[A-Z][A-Z0-9_]*$/.test(prop)) {
|
|
151
|
+
const cached = resolvedCache.get(proxy);
|
|
152
|
+
if (cached) {
|
|
153
|
+
const doBindings = cached.config.bindings?.durableObjects;
|
|
154
|
+
if (!doBindings || !(prop in doBindings)) return;
|
|
155
|
+
}
|
|
156
|
+
return createDOBinding(prop);
|
|
157
|
+
}
|
|
158
|
+
return Reflect.get(target, prop);
|
|
159
|
+
},
|
|
160
|
+
has(target, prop) {
|
|
161
|
+
if (typeof prop === "string") {
|
|
162
|
+
if (knownProps.has(prop)) return true;
|
|
163
|
+
if (/^[A-Z][A-Z0-9_]*$/.test(prop)) {
|
|
164
|
+
const cached = resolvedCache.get(proxy);
|
|
165
|
+
if (cached) {
|
|
166
|
+
const doBindings = cached.config.bindings?.durableObjects;
|
|
167
|
+
return !!doBindings && prop in doBindings;
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return Reflect.has(target, prop);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return proxy;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
export { defineConfig as n, ref as t };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { a as DIM, c as RESET, n as BOLD, o as GREEN, s as RED, u as YELLOW } from "./colors-DiK6wPJ5.js";
|
|
2
|
+
import { n as enableRemoteMode, r as getEffectiveRemoteModeStatus, t as disableRemoteMode } from "./remote-config-D39BY9ji.js";
|
|
3
|
+
//#region src/cli/commands/remote.ts
|
|
4
|
+
function log(message = "") {
|
|
5
|
+
console.log(message);
|
|
6
|
+
}
|
|
7
|
+
function showStatus() {
|
|
8
|
+
const status = getEffectiveRemoteModeStatus();
|
|
9
|
+
log();
|
|
10
|
+
log(`${BOLD}Remote Test Mode${RESET}`);
|
|
11
|
+
log();
|
|
12
|
+
if (status.isActive) {
|
|
13
|
+
log(` ${GREEN}●${RESET} ${BOLD}Enabled${RESET}`);
|
|
14
|
+
if (status.source === "env") {
|
|
15
|
+
log(` Source: ${YELLOW}DEVFLARE_REMOTE${RESET} environment variable`);
|
|
16
|
+
log(` ${DIM}(unset the variable to disable)${RESET}`);
|
|
17
|
+
} else {
|
|
18
|
+
log(` Expires in ${status.remainingMinutes} minute(s)`);
|
|
19
|
+
log(` ${DIM}At: ${status.expiresAt?.toLocaleTimeString()}${RESET}`);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
log(` ${DIM}○${RESET} Disabled`);
|
|
23
|
+
log(` ${DIM}Remote-only tests (AI, Vectorize) will be skipped${RESET}`);
|
|
24
|
+
}
|
|
25
|
+
log();
|
|
26
|
+
log(`${DIM}Commands:${RESET}`);
|
|
27
|
+
log(` devflare remote enable [minutes] Enable for N minutes (default: 30)`);
|
|
28
|
+
log(` devflare remote disable Disable immediately`);
|
|
29
|
+
log(` devflare remote status Show current status`);
|
|
30
|
+
log();
|
|
31
|
+
}
|
|
32
|
+
function enable(inputMinutes) {
|
|
33
|
+
const actualMinutes = enableRemoteMode(inputMinutes);
|
|
34
|
+
const status = getEffectiveRemoteModeStatus();
|
|
35
|
+
log();
|
|
36
|
+
if (inputMinutes !== actualMinutes) log(`${YELLOW}⚠${RESET} Invalid duration, using ${actualMinutes} minute(s)`);
|
|
37
|
+
log(`${GREEN}✓${RESET} Remote test mode ${BOLD}enabled${RESET} for ${actualMinutes} minute(s)`);
|
|
38
|
+
log(` Expires at: ${status.expiresAt?.toLocaleTimeString()}`);
|
|
39
|
+
log();
|
|
40
|
+
log(`${YELLOW}⚠${RESET} Remote tests use real Cloudflare infrastructure and may incur costs.`);
|
|
41
|
+
log(` Run ${DIM}devflare remote disable${RESET} when done.`);
|
|
42
|
+
log();
|
|
43
|
+
}
|
|
44
|
+
function disable() {
|
|
45
|
+
const statusBefore = getEffectiveRemoteModeStatus();
|
|
46
|
+
disableRemoteMode();
|
|
47
|
+
log();
|
|
48
|
+
log(`${GREEN}✓${RESET} Remote test mode ${BOLD}disabled${RESET}`);
|
|
49
|
+
if (statusBefore.envVarSet) {
|
|
50
|
+
log();
|
|
51
|
+
log(`${YELLOW}⚠${RESET} Note: ${BOLD}DEVFLARE_REMOTE${RESET} environment variable is still set.`);
|
|
52
|
+
log(` Remote mode will remain active until you unset it.`);
|
|
53
|
+
} else log(` Remote-only tests (AI, Vectorize) will now be skipped.`);
|
|
54
|
+
log();
|
|
55
|
+
}
|
|
56
|
+
function runRemoteCommand(parsed, _logger, _options) {
|
|
57
|
+
const subcommand = parsed.args[0];
|
|
58
|
+
const arg = parsed.args[1];
|
|
59
|
+
switch (subcommand) {
|
|
60
|
+
case "enable": {
|
|
61
|
+
const minutes = arg ? Number.parseInt(arg, 10) : 30;
|
|
62
|
+
enable(Number.isNaN(minutes) ? 30 : minutes);
|
|
63
|
+
return { exitCode: 0 };
|
|
64
|
+
}
|
|
65
|
+
case "disable":
|
|
66
|
+
disable();
|
|
67
|
+
return { exitCode: 0 };
|
|
68
|
+
case "status":
|
|
69
|
+
case void 0:
|
|
70
|
+
showStatus();
|
|
71
|
+
return { exitCode: 0 };
|
|
72
|
+
default:
|
|
73
|
+
log(`${RED}Unknown subcommand:${RESET} ${subcommand}`);
|
|
74
|
+
log(`Run ${DIM}devflare remote${RESET} for usage.`);
|
|
75
|
+
return { exitCode: 1 };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { runRemoteCommand };
|