devflare 1.0.0-next.4 → 1.0.0-next.40
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 +15966 -2139
- package/README.md +393 -605
- package/bin/devflare.js +22 -14
- package/dist/_chunks/account-BtWcv3X9.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-3T6O4uIg.js +24 -0
- package/dist/_chunks/build-artifacts-8TqBSQkG.js +483 -0
- package/dist/_chunks/cli-BTF1X4SG.js +1128 -0
- package/dist/_chunks/cloudflare-BaloqI3H.js +157 -0
- package/dist/_chunks/colors-DiK6wPJ5.js +13 -0
- package/dist/_chunks/command-utils-BsfkmTqh.js +45 -0
- package/dist/_chunks/compiler-uoyAQ8zW.js +424 -0
- package/dist/_chunks/config-D5u-bEkn.js +78 -0
- package/dist/_chunks/config-path-DCPto4XB.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-DMTr6JeR.js +915 -0
- package/dist/_chunks/dev-CvRHmRFZ.js +3456 -0
- package/dist/_chunks/doctor-DIG8DoFU.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-DXC5SdFK.js +143 -0
- package/dist/_chunks/generated-artifacts-dMJY4KAt.js +32 -0
- package/dist/_chunks/glob-CmQOvunB.js +56 -0
- package/dist/_chunks/init-3moXTgpb.js +165 -0
- package/dist/_chunks/loader-DLXO60RO.js +1153 -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-DMmEOygL.js +123 -0
- package/dist/_chunks/local-workflow-entrypoints-Wip3o1u8.js +90 -0
- package/dist/_chunks/login-BmnDzDlH.js +51 -0
- package/dist/_chunks/package-metadata-DAuCkyvK.js +39 -0
- package/dist/_chunks/preferences-BKp_7XJx.js +241 -0
- package/dist/_chunks/preview-BhqDmq8I.js +456 -0
- package/dist/_chunks/preview-registry-ClAbLTHH.js +1186 -0
- package/dist/_chunks/preview-resources-DdXj8LMM.js +358 -0
- package/dist/_chunks/previews-Dlr13x5M.js +1134 -0
- package/dist/_chunks/productions-D3AnOHac.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-Y84HB3Nt.js +133 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-C3FqES2W.js +796 -0
- package/dist/_chunks/runtime-FvXvfuZ2.js +550 -0
- package/dist/_chunks/schema-normalization-DWVleVxo.js +477 -0
- package/dist/_chunks/secrets-70eN0Q6C.js +95 -0
- package/dist/_chunks/token-kguIDmej.js +333 -0
- package/dist/_chunks/tokens-iVcgNXi-.js +221 -0
- package/dist/_chunks/types-OrLbzv4I.js +476 -0
- package/dist/_chunks/ui-BUoZApvE.js +103 -0
- package/dist/_chunks/usage-BBTGzjon.js +272 -0
- package/dist/_chunks/vite-CsI0E-uV.js +1235 -0
- package/dist/_chunks/vite-utils-OVLMV605.js +183 -0
- package/dist/_chunks/worker-CS1jgNFE.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 +75 -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 +4621 -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/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 +112 -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/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 +270 -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/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 +1495 -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 +3023 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +184 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +500 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +378 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +550 -0
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
- package/dist/config/schema-types-bindings.d.ts +254 -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 +4537 -2214
- 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 +59 -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 +74 -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 +102 -60
- 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/binding-hints.d.ts +10 -0
- package/dist/test/binding-hints.d.ts.map +1 -0
- package/dist/test/cf.d.ts +49 -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 +18 -21
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4495 -70
- package/dist/test/offline-bindings.d.ts +81 -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/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 +40 -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/workflows.d.ts +26 -0
- package/dist/test/utilities/workflows.d.ts.map +1 -0
- package/dist/test/utilities.d.ts +10 -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/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-pa8dhm20.js +0 -2162
- 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,157 @@
|
|
|
1
|
+
import { g as isAuthenticated, h as hasWranglerConfig, m as getWranglerAuth, p as getApiToken } from "./api-TzdliH-6.js";
|
|
2
|
+
import { a as setGlobalDefaultAccountId, d as getPrimaryAccount, i as getWorkspaceAccountId, l as getAccountById, n as getEffectiveAccountId, o as setWorkspaceAccountId, r as getGlobalDefaultAccountId, t as clearGlobalDefaultAccountId, u as getAccounts } from "./preferences-BKp_7XJx.js";
|
|
3
|
+
import { C as deleteWorker, D as listWorkerVersions, E as listWorkerDeployments, O as listWorkers, S as DEVFLARE_PREVIEW_REGISTRY_DATABASE, T as getWorkersSubdomain, a as listTrackedPreviewRecords, c as reconcilePreviewRegistry, i as listTrackedDeploymentRecords, k as renameWorker, l as retirePreviewRegistry, n as ensurePreviewRegistry, o as listTrackedPreviewScopeRecords, r as getPreviewRegistryContext, s as listTrackedRegistryState, t as cleanupPreviewRegistry, w as getWorkerVersionDetail } from "./preview-registry-ClAbLTHH.js";
|
|
4
|
+
import { _ as listR2Buckets, b as rawD1DatabaseQuery, f as listAIModels, h as listKVNamespaces, m as listHyperdrives, p as listD1Databases, t as createD1Database, v as listVectorizeIndexes, y as queryD1Database } from "./account-resources-CsmVowJp.js";
|
|
5
|
+
import { a as getUsageSummary, c as recordUsage, d as setLimitsEnabled, f as shouldSkip, i as getUsage, l as resetUsage, n as getAllUsageSummaries, o as isWithinLimits, r as getLimits, s as recordTestUsage, t as canProceedWithTest, u as setLimits } from "./usage-BBTGzjon.js";
|
|
6
|
+
import { a as listAccountTokenPermissionGroups, i as listAccountOwnedAPITokens, n as deleteAccountOwnedAPIToken, o as normalizeDevflareTokenName, t as createAccountOwnedAPIToken } from "./tokens-iVcgNXi-.js";
|
|
7
|
+
//#region src/cloudflare/account-status.ts
|
|
8
|
+
const SERVICE_STATUS_TIMEOUT_MS = 1e4;
|
|
9
|
+
const serviceInventoryFetchers = {
|
|
10
|
+
workers: listWorkers,
|
|
11
|
+
kv: listKVNamespaces,
|
|
12
|
+
d1: listD1Databases,
|
|
13
|
+
hyperdrive: listHyperdrives,
|
|
14
|
+
r2: listR2Buckets,
|
|
15
|
+
vectorize: listVectorizeIndexes,
|
|
16
|
+
ai: listAIModels
|
|
17
|
+
};
|
|
18
|
+
async function withServiceTimeout(operation) {
|
|
19
|
+
let timeoutId = null;
|
|
20
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
21
|
+
timeoutId = setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), SERVICE_STATUS_TIMEOUT_MS);
|
|
22
|
+
});
|
|
23
|
+
try {
|
|
24
|
+
return await Promise.race([operation, timeoutPromise]);
|
|
25
|
+
} finally {
|
|
26
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function createAvailableServiceStatus(service, count) {
|
|
30
|
+
return {
|
|
31
|
+
service,
|
|
32
|
+
available: service === "ai" ? count > 0 : true,
|
|
33
|
+
count
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async function getServiceStatus(accountId, service) {
|
|
37
|
+
const fetchInventory = serviceInventoryFetchers[service];
|
|
38
|
+
if (!fetchInventory) return {
|
|
39
|
+
service,
|
|
40
|
+
available: false
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
return createAvailableServiceStatus(service, (await withServiceTimeout(fetchInventory(accountId))).length);
|
|
44
|
+
} catch {
|
|
45
|
+
return {
|
|
46
|
+
service,
|
|
47
|
+
available: false
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function getAllServiceStatus(accountId) {
|
|
52
|
+
return Promise.all([
|
|
53
|
+
"workers",
|
|
54
|
+
"kv",
|
|
55
|
+
"d1",
|
|
56
|
+
"hyperdrive",
|
|
57
|
+
"r2",
|
|
58
|
+
"vectorize",
|
|
59
|
+
"ai"
|
|
60
|
+
].map((service) => getServiceStatus(accountId, service)));
|
|
61
|
+
}
|
|
62
|
+
async function hasService(accountId, service) {
|
|
63
|
+
return (await getServiceStatus(accountId, service)).available;
|
|
64
|
+
}
|
|
65
|
+
async function getAccountSummary(accountId) {
|
|
66
|
+
const account = await getAccountById(accountId);
|
|
67
|
+
if (!account) return null;
|
|
68
|
+
return {
|
|
69
|
+
account,
|
|
70
|
+
services: await getAllServiceStatus(accountId)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/cloudflare/index.ts
|
|
75
|
+
/**
|
|
76
|
+
* Main account API object
|
|
77
|
+
*
|
|
78
|
+
* Usage:
|
|
79
|
+
* ```ts
|
|
80
|
+
* import { account } from 'devflare/cloudflare'
|
|
81
|
+
*
|
|
82
|
+
* // Check authentication
|
|
83
|
+
* const isLoggedIn = await account.isAuthenticated()
|
|
84
|
+
*
|
|
85
|
+
* // Get primary account
|
|
86
|
+
* const primary = await account.getPrimaryAccount()
|
|
87
|
+
*
|
|
88
|
+
* // List resources (requires accountId)
|
|
89
|
+
* const workers = await account.workers(accountId)
|
|
90
|
+
*
|
|
91
|
+
* // Check usage limits before testing
|
|
92
|
+
* const { allowed } = await account.canProceedWithTest(accountId, 'ai')
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
const account = {
|
|
96
|
+
isAuthenticated,
|
|
97
|
+
hasWranglerConfig,
|
|
98
|
+
getApiToken,
|
|
99
|
+
getWranglerAuth,
|
|
100
|
+
getAccounts,
|
|
101
|
+
getPrimaryAccount,
|
|
102
|
+
getAccountById,
|
|
103
|
+
getAccountSummary,
|
|
104
|
+
workers: listWorkers,
|
|
105
|
+
renameWorker,
|
|
106
|
+
deleteWorker,
|
|
107
|
+
workerVersions: listWorkerVersions,
|
|
108
|
+
workerVersion: getWorkerVersionDetail,
|
|
109
|
+
workerDeployments: listWorkerDeployments,
|
|
110
|
+
workersSubdomain: getWorkersSubdomain,
|
|
111
|
+
kv: listKVNamespaces,
|
|
112
|
+
d1: listD1Databases,
|
|
113
|
+
createD1Database,
|
|
114
|
+
queryD1Database,
|
|
115
|
+
rawD1DatabaseQuery,
|
|
116
|
+
r2: listR2Buckets,
|
|
117
|
+
vectorize: listVectorizeIndexes,
|
|
118
|
+
ai: listAIModels,
|
|
119
|
+
getServiceStatus,
|
|
120
|
+
getAllServiceStatus,
|
|
121
|
+
hasService,
|
|
122
|
+
getUsage,
|
|
123
|
+
recordUsage,
|
|
124
|
+
resetUsage,
|
|
125
|
+
getAllUsageSummaries,
|
|
126
|
+
getUsageSummary,
|
|
127
|
+
getLimits,
|
|
128
|
+
setLimits,
|
|
129
|
+
setLimitsEnabled,
|
|
130
|
+
isWithinLimits,
|
|
131
|
+
canProceedWithTest,
|
|
132
|
+
recordTestUsage,
|
|
133
|
+
shouldSkip,
|
|
134
|
+
getGlobalDefaultAccountId,
|
|
135
|
+
setGlobalDefaultAccountId,
|
|
136
|
+
getWorkspaceAccountId,
|
|
137
|
+
setWorkspaceAccountId,
|
|
138
|
+
getEffectiveAccountId,
|
|
139
|
+
clearGlobalDefaultAccountId,
|
|
140
|
+
listAccountTokenPermissionGroups,
|
|
141
|
+
listAccountOwnedAPITokens,
|
|
142
|
+
createAccountOwnedAPIToken,
|
|
143
|
+
deleteAccountOwnedAPIToken,
|
|
144
|
+
normalizeDevflareTokenName,
|
|
145
|
+
previewRegistryDatabase: DEVFLARE_PREVIEW_REGISTRY_DATABASE,
|
|
146
|
+
ensurePreviewRegistry,
|
|
147
|
+
getPreviewRegistryContext,
|
|
148
|
+
listTrackedPreviewRecords,
|
|
149
|
+
listTrackedRegistryState,
|
|
150
|
+
listTrackedPreviewScopeRecords,
|
|
151
|
+
listTrackedDeploymentRecords,
|
|
152
|
+
reconcilePreviewRegistry,
|
|
153
|
+
cleanupPreviewRegistry,
|
|
154
|
+
retirePreviewRegistry
|
|
155
|
+
};
|
|
156
|
+
//#endregion
|
|
157
|
+
export { account as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/cli/colors.ts
|
|
2
|
+
const BOLD = "\x1B[1m";
|
|
3
|
+
const DIM = "\x1B[2m";
|
|
4
|
+
const RESET = "\x1B[0m";
|
|
5
|
+
const CYAN = "\x1B[36m";
|
|
6
|
+
const CYAN_BOLD = "\x1B[1;36m";
|
|
7
|
+
const WHITE = "\x1B[97m";
|
|
8
|
+
const GREEN = "\x1B[32m";
|
|
9
|
+
const RED = "\x1B[31m";
|
|
10
|
+
const YELLOW = "\x1B[33m";
|
|
11
|
+
const BG_BLUE = "\x1B[44m";
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DIM as a, RESET as c, CYAN_BOLD as i, WHITE as l, BOLD as n, GREEN as o, CYAN as r, RED as s, BG_BLUE as t, YELLOW as u };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { i as resolveConfigPath, r as loadConfig } from "./loader-DLXO60RO.js";
|
|
2
|
+
import { d as getPrimaryAccount, i as getWorkspaceAccountId, n as getEffectiveAccountId } from "./preferences-BKp_7XJx.js";
|
|
3
|
+
//#region src/cli/command-utils.ts
|
|
4
|
+
function asOptionalString(value) {
|
|
5
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
6
|
+
}
|
|
7
|
+
function resolveNamedSelection(options) {
|
|
8
|
+
if (options.explicitValue) return {
|
|
9
|
+
value: options.explicitValue,
|
|
10
|
+
source: "option"
|
|
11
|
+
};
|
|
12
|
+
if (options.fallbackValue) return {
|
|
13
|
+
value: options.fallbackValue,
|
|
14
|
+
source: "arg"
|
|
15
|
+
};
|
|
16
|
+
if (options.configuredValue) return {
|
|
17
|
+
value: options.configuredValue,
|
|
18
|
+
source: "config"
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
value: void 0,
|
|
22
|
+
source: "none"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async function getConfiguredAccountId(cwd) {
|
|
26
|
+
const workspaceAccountId = getWorkspaceAccountId();
|
|
27
|
+
if (workspaceAccountId) return workspaceAccountId;
|
|
28
|
+
const envAccountId = process.env.CLOUDFLARE_ACCOUNT_ID?.trim();
|
|
29
|
+
if (envAccountId) return envAccountId;
|
|
30
|
+
if (!await resolveConfigPath(cwd)) return;
|
|
31
|
+
try {
|
|
32
|
+
return (await loadConfig({ cwd })).accountId;
|
|
33
|
+
} catch {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function resolveCloudflareAccountId(options) {
|
|
38
|
+
if (options.explicitAccountId) return options.explicitAccountId;
|
|
39
|
+
if (options.configuredAccountId) return options.configuredAccountId;
|
|
40
|
+
const primaryAccount = await getPrimaryAccount(options.apiOptions);
|
|
41
|
+
if (!primaryAccount) return;
|
|
42
|
+
return (await getEffectiveAccountId(primaryAccount.id)).accountId;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { resolveNamedSelection as i, getConfiguredAccountId as n, resolveCloudflareAccountId as r, asOptionalString as t };
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { f as normalizeCompatibilityFlags, u as resolveConfigForEnvironment } from "./loader-DLXO60RO.js";
|
|
2
|
+
import { _ as browserBindingSchema, a as normalizeD1Binding, c as normalizeHyperdriveBinding, d as normalizeMediaBinding, f as normalizeMtlsCertificateBinding, h as normalizeWorkflowBinding, i as normalizeArtifactsBinding, l as normalizeImagesBinding, m as normalizeSecretsStoreBinding, o as normalizeDOBinding, p as normalizePipelineBinding, r as getSingleBrowserBindingName, s as normalizeDispatchNamespaceBinding, u as normalizeKVBinding } from "./schema-normalization-DWVleVxo.js";
|
|
3
|
+
import { n as toWranglerSecretsConfig } from "./local-dev-vars-CTSa-wvF.js";
|
|
4
|
+
import { basename, isAbsolute, relative, resolve } from "pathe";
|
|
5
|
+
//#region src/config/compiler/bindings.ts
|
|
6
|
+
function getWranglerD1DatabaseBinding(bindingName, bindingConfig, options = {}) {
|
|
7
|
+
const normalized = normalizeD1Binding(bindingConfig);
|
|
8
|
+
if (normalized.databaseId) return {
|
|
9
|
+
binding: bindingName,
|
|
10
|
+
database_id: normalized.databaseId
|
|
11
|
+
};
|
|
12
|
+
if (options.preserveNamedBindings && normalized.name) return {
|
|
13
|
+
binding: bindingName,
|
|
14
|
+
database_name: normalized.name
|
|
15
|
+
};
|
|
16
|
+
throw new Error(`D1 binding "${bindingName}" is configured by name (${normalized.name}) and must be resolved before compiling Wrangler config. Use loadResolvedConfig() or resolveConfigResources() for build/deploy/automation flows.`);
|
|
17
|
+
}
|
|
18
|
+
function getWranglerKVNamespaceBinding(bindingName, bindingConfig, options = {}) {
|
|
19
|
+
const normalized = normalizeKVBinding(bindingConfig);
|
|
20
|
+
if (normalized.namespaceId) return {
|
|
21
|
+
binding: bindingName,
|
|
22
|
+
id: normalized.namespaceId
|
|
23
|
+
};
|
|
24
|
+
if (options.preserveNamedBindings && normalized.name) return {
|
|
25
|
+
binding: bindingName,
|
|
26
|
+
name: normalized.name
|
|
27
|
+
};
|
|
28
|
+
throw new Error(`KV binding "${bindingName}" is configured by name (${normalized.name}) and must be resolved before compiling Wrangler config. Use loadResolvedConfig() or resolveConfigResources() for build/deploy/automation flows.`);
|
|
29
|
+
}
|
|
30
|
+
function getWranglerHyperdriveBinding(bindingName, bindingConfig, options = {}) {
|
|
31
|
+
const normalized = normalizeHyperdriveBinding(bindingConfig);
|
|
32
|
+
if (normalized.configurationId) return {
|
|
33
|
+
binding: bindingName,
|
|
34
|
+
id: normalized.configurationId,
|
|
35
|
+
...normalized.localConnectionString && { localConnectionString: normalized.localConnectionString }
|
|
36
|
+
};
|
|
37
|
+
if (options.preserveNamedBindings && normalized.name) return {
|
|
38
|
+
binding: bindingName,
|
|
39
|
+
name: normalized.name,
|
|
40
|
+
...normalized.localConnectionString && { localConnectionString: normalized.localConnectionString }
|
|
41
|
+
};
|
|
42
|
+
throw new Error(`Hyperdrive binding "${bindingName}" is configured by name (${normalized.name}) and must be resolved before compiling Wrangler config. Use loadResolvedConfig() or resolveConfigResources() for build/deploy/automation flows.`);
|
|
43
|
+
}
|
|
44
|
+
function getWranglerBrowserBinding(browserBindings) {
|
|
45
|
+
if (!browserBindings) return;
|
|
46
|
+
const parsed = browserBindingSchema.parse(browserBindings);
|
|
47
|
+
const bindingName = getSingleBrowserBindingName(parsed);
|
|
48
|
+
if (!bindingName) return;
|
|
49
|
+
const bindingConfig = parsed[bindingName];
|
|
50
|
+
return {
|
|
51
|
+
binding: bindingName,
|
|
52
|
+
...typeof bindingConfig === "object" && bindingConfig.remote !== void 0 && { remote: bindingConfig.remote }
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Compile bindings from devflare format to wrangler format
|
|
57
|
+
*/
|
|
58
|
+
function compileBindings(bindings, result, options = {}, defaultSecretsStoreId) {
|
|
59
|
+
if (bindings.kv) result.kv_namespaces = Object.entries(bindings.kv).map(([binding, namespace]) => {
|
|
60
|
+
return getWranglerKVNamespaceBinding(binding, namespace, options);
|
|
61
|
+
});
|
|
62
|
+
if (bindings.d1) result.d1_databases = Object.entries(bindings.d1).map(([binding, database_id]) => {
|
|
63
|
+
return getWranglerD1DatabaseBinding(binding, database_id, options);
|
|
64
|
+
});
|
|
65
|
+
if (bindings.r2) result.r2_buckets = Object.entries(bindings.r2).map(([binding, bucket_name]) => ({
|
|
66
|
+
binding,
|
|
67
|
+
bucket_name
|
|
68
|
+
}));
|
|
69
|
+
if (bindings.durableObjects) result.durable_objects = { bindings: Object.entries(bindings.durableObjects).map(([name, config]) => {
|
|
70
|
+
const normalized = normalizeDOBinding(config);
|
|
71
|
+
const binding = {
|
|
72
|
+
name,
|
|
73
|
+
class_name: normalized.className
|
|
74
|
+
};
|
|
75
|
+
if (normalized.kind === "cross-worker" && normalized.scriptName) binding.script_name = normalized.scriptName;
|
|
76
|
+
return binding;
|
|
77
|
+
}) };
|
|
78
|
+
if (bindings.queues) {
|
|
79
|
+
result.queues = {};
|
|
80
|
+
if (bindings.queues.producers) result.queues.producers = Object.entries(bindings.queues.producers).map(([binding, queue]) => ({
|
|
81
|
+
binding,
|
|
82
|
+
queue
|
|
83
|
+
}));
|
|
84
|
+
if (bindings.queues.consumers) result.queues.consumers = bindings.queues.consumers.map((consumer) => ({
|
|
85
|
+
queue: consumer.queue,
|
|
86
|
+
...consumer.maxBatchSize && { max_batch_size: consumer.maxBatchSize },
|
|
87
|
+
...consumer.maxBatchTimeout && { max_batch_timeout: consumer.maxBatchTimeout },
|
|
88
|
+
...consumer.maxRetries && { max_retries: consumer.maxRetries },
|
|
89
|
+
...consumer.deadLetterQueue && { dead_letter_queue: consumer.deadLetterQueue },
|
|
90
|
+
...consumer.maxConcurrency && { max_concurrency: consumer.maxConcurrency },
|
|
91
|
+
...consumer.retryDelay && { retry_delay: consumer.retryDelay }
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
if (bindings.rateLimits) result.ratelimits = Object.entries(bindings.rateLimits).map(([name, config]) => ({
|
|
95
|
+
name,
|
|
96
|
+
namespace_id: config.namespaceId,
|
|
97
|
+
simple: {
|
|
98
|
+
limit: config.simple.limit,
|
|
99
|
+
period: config.simple.period
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
if (bindings.versionMetadata) result.version_metadata = { binding: bindings.versionMetadata.binding };
|
|
103
|
+
if (bindings.workerLoaders) result.worker_loaders = Object.keys(bindings.workerLoaders).map((binding) => ({ binding }));
|
|
104
|
+
if (bindings.mtlsCertificates) result.mtls_certificates = Object.entries(bindings.mtlsCertificates).map(([binding, config]) => {
|
|
105
|
+
const normalized = normalizeMtlsCertificateBinding(config);
|
|
106
|
+
return {
|
|
107
|
+
binding,
|
|
108
|
+
certificate_id: normalized.certificateId,
|
|
109
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
if (bindings.dispatchNamespaces) result.dispatch_namespaces = Object.entries(bindings.dispatchNamespaces).map(([binding, config]) => {
|
|
113
|
+
const normalized = normalizeDispatchNamespaceBinding(config);
|
|
114
|
+
return {
|
|
115
|
+
binding,
|
|
116
|
+
namespace: normalized.namespace,
|
|
117
|
+
...normalized.outbound && { outbound: normalized.outbound },
|
|
118
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
if (bindings.workflows) result.workflows = Object.entries(bindings.workflows).map(([binding, config]) => {
|
|
122
|
+
const normalized = normalizeWorkflowBinding(config);
|
|
123
|
+
return {
|
|
124
|
+
binding,
|
|
125
|
+
name: normalized.name,
|
|
126
|
+
class_name: normalized.className,
|
|
127
|
+
...normalized.scriptName && { script_name: normalized.scriptName },
|
|
128
|
+
...normalized.remote !== void 0 && { remote: normalized.remote },
|
|
129
|
+
...normalized.limits && { limits: normalized.limits }
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
if (bindings.pipelines) result.pipelines = Object.entries(bindings.pipelines).map(([binding, config]) => {
|
|
133
|
+
const normalized = normalizePipelineBinding(config);
|
|
134
|
+
return {
|
|
135
|
+
binding,
|
|
136
|
+
pipeline: normalized.pipeline,
|
|
137
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
if (bindings.images) {
|
|
141
|
+
const [entry] = Object.entries(bindings.images);
|
|
142
|
+
if (entry) {
|
|
143
|
+
const [binding, config] = entry;
|
|
144
|
+
const normalized = normalizeImagesBinding(binding, config);
|
|
145
|
+
result.images = {
|
|
146
|
+
binding: normalized.binding,
|
|
147
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (bindings.media) {
|
|
152
|
+
const [entry] = Object.entries(bindings.media);
|
|
153
|
+
if (entry) {
|
|
154
|
+
const [binding, config] = entry;
|
|
155
|
+
const normalized = normalizeMediaBinding(binding, config);
|
|
156
|
+
result.media = {
|
|
157
|
+
binding: normalized.binding,
|
|
158
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (bindings.artifacts) result.artifacts = Object.entries(bindings.artifacts).map(([binding, config]) => {
|
|
163
|
+
const normalized = normalizeArtifactsBinding(config);
|
|
164
|
+
return {
|
|
165
|
+
binding,
|
|
166
|
+
namespace: normalized.namespace,
|
|
167
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
if (bindings.secretsStore) result.secrets_store_secrets = Object.entries(bindings.secretsStore).map(([binding, config]) => {
|
|
171
|
+
const normalized = normalizeSecretsStoreBinding(config, defaultSecretsStoreId, binding);
|
|
172
|
+
return {
|
|
173
|
+
binding,
|
|
174
|
+
store_id: normalized.storeId,
|
|
175
|
+
secret_name: normalized.secretName
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
if (bindings.services) result.services = Object.entries(bindings.services).map(([binding, config]) => ({
|
|
179
|
+
binding,
|
|
180
|
+
service: config.service,
|
|
181
|
+
...config.entrypoint && { entrypoint: config.entrypoint },
|
|
182
|
+
...config.environment && { environment: config.environment }
|
|
183
|
+
}));
|
|
184
|
+
if (bindings.ai?.binding) result.ai = {
|
|
185
|
+
binding: bindings.ai.binding,
|
|
186
|
+
...bindings.ai.remote !== void 0 && { remote: bindings.ai.remote },
|
|
187
|
+
...bindings.ai.staging !== void 0 && { staging: bindings.ai.staging }
|
|
188
|
+
};
|
|
189
|
+
if (bindings.aiSearchNamespaces) result.ai_search_namespaces = Object.entries(bindings.aiSearchNamespaces).map(([binding, config]) => ({
|
|
190
|
+
binding,
|
|
191
|
+
namespace: config.namespace,
|
|
192
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
193
|
+
}));
|
|
194
|
+
if (bindings.aiSearch) result.ai_search = Object.entries(bindings.aiSearch).map(([binding, config]) => ({
|
|
195
|
+
binding,
|
|
196
|
+
instance_name: config.instanceName,
|
|
197
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
198
|
+
}));
|
|
199
|
+
if (bindings.vectorize) result.vectorize = Object.entries(bindings.vectorize).map(([binding, config]) => ({
|
|
200
|
+
binding,
|
|
201
|
+
index_name: config.indexName,
|
|
202
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
203
|
+
}));
|
|
204
|
+
if (bindings.hyperdrive) result.hyperdrive = Object.entries(bindings.hyperdrive).map(([binding, config]) => {
|
|
205
|
+
return getWranglerHyperdriveBinding(binding, config, options);
|
|
206
|
+
});
|
|
207
|
+
const browserBinding = getWranglerBrowserBinding(bindings.browser);
|
|
208
|
+
if (browserBinding) result.browser = browserBinding;
|
|
209
|
+
if (bindings.analyticsEngine) result.analytics_engine_datasets = Object.entries(bindings.analyticsEngine).map(([binding, config]) => ({
|
|
210
|
+
binding,
|
|
211
|
+
dataset: config.dataset
|
|
212
|
+
}));
|
|
213
|
+
if (bindings.sendEmail) result.send_email = Object.entries(bindings.sendEmail).map(([name, config]) => ({
|
|
214
|
+
name,
|
|
215
|
+
...config.destinationAddress && { destination_address: config.destinationAddress },
|
|
216
|
+
...config.allowedDestinationAddresses && { allowed_destination_addresses: config.allowedDestinationAddresses },
|
|
217
|
+
...config.allowedSenderAddresses && { allowed_sender_addresses: config.allowedSenderAddresses }
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/config/compiler/core-helpers.ts
|
|
222
|
+
function compileWranglerMigrations(migrations) {
|
|
223
|
+
return migrations.map((migration) => ({
|
|
224
|
+
tag: migration.tag,
|
|
225
|
+
...migration.new_classes && { new_classes: migration.new_classes },
|
|
226
|
+
...migration.renamed_classes && { renamed_classes: migration.renamed_classes.map((renamedClass) => ({
|
|
227
|
+
from: renamedClass.from,
|
|
228
|
+
to: renamedClass.to
|
|
229
|
+
})) },
|
|
230
|
+
...migration.deleted_classes && { deleted_classes: migration.deleted_classes },
|
|
231
|
+
...migration.new_sqlite_classes && { new_sqlite_classes: migration.new_sqlite_classes }
|
|
232
|
+
}));
|
|
233
|
+
}
|
|
234
|
+
function compileModuleOptions(config, result) {
|
|
235
|
+
if (config.rules && config.rules.length > 0) result.rules = config.rules;
|
|
236
|
+
if (config.findAdditionalModules !== void 0) result.find_additional_modules = config.findAdditionalModules;
|
|
237
|
+
if (config.baseDir) result.base_dir = config.baseDir;
|
|
238
|
+
if (config.preserveFileNames !== void 0) result.preserve_file_names = config.preserveFileNames;
|
|
239
|
+
if (config.logpush !== void 0) result.logpush = config.logpush;
|
|
240
|
+
if (config.uploadSourceMaps !== void 0) result.upload_source_maps = config.uploadSourceMaps;
|
|
241
|
+
if (config.keepVars !== void 0) result.keep_vars = config.keepVars;
|
|
242
|
+
}
|
|
243
|
+
function compileContainers(config, result) {
|
|
244
|
+
if (!config.containers || config.containers.length === 0) return;
|
|
245
|
+
result.containers = config.containers.map((container) => ({
|
|
246
|
+
class_name: container.className,
|
|
247
|
+
image: container.image,
|
|
248
|
+
...container.maxInstances !== void 0 && { max_instances: container.maxInstances },
|
|
249
|
+
...container.instanceType && { instance_type: container.instanceType },
|
|
250
|
+
...container.name && { name: container.name },
|
|
251
|
+
...container.imageBuildContext && { image_build_context: container.imageBuildContext },
|
|
252
|
+
...container.imageVars && { image_vars: container.imageVars },
|
|
253
|
+
...container.rolloutActiveGracePeriod !== void 0 && { rollout_active_grace_period: container.rolloutActiveGracePeriod },
|
|
254
|
+
...container.rolloutStepPercentage !== void 0 && { rollout_step_percentage: container.rolloutStepPercentage }
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/config/compiler/paths.ts
|
|
259
|
+
/**
|
|
260
|
+
* Convert WranglerConfig to JSONC string with comments
|
|
261
|
+
*/
|
|
262
|
+
function stringifyConfig(config) {
|
|
263
|
+
return `// Generated by devflare — Do not edit directly
|
|
264
|
+
// Edit devflare.config.ts instead
|
|
265
|
+
|
|
266
|
+
` + JSON.stringify(config, null, " ");
|
|
267
|
+
}
|
|
268
|
+
function rebasePathForConfigDir(projectRoot, configDir, pathValue) {
|
|
269
|
+
return relative(configDir, isAbsolute(pathValue) ? pathValue : resolve(projectRoot, pathValue)).replace(/\\/g, "/");
|
|
270
|
+
}
|
|
271
|
+
function isLocalContainerPath(pathValue) {
|
|
272
|
+
return pathValue === "Dockerfile" || pathValue.startsWith(".") || pathValue.startsWith("/") || pathValue.startsWith("\\") || isAbsolute(pathValue) || pathValue.endsWith("/Dockerfile") || pathValue.endsWith("\\Dockerfile");
|
|
273
|
+
}
|
|
274
|
+
function pathIsInsideDirectory(directoryPath, candidatePath) {
|
|
275
|
+
const normalizedDirectoryPath = directoryPath.replace(/\\/g, "/");
|
|
276
|
+
const normalizedCandidatePath = candidatePath.replace(/\\/g, "/");
|
|
277
|
+
return normalizedCandidatePath === normalizedDirectoryPath || normalizedCandidatePath.startsWith(`${normalizedDirectoryPath}/`);
|
|
278
|
+
}
|
|
279
|
+
function isolateViteBuildOutputPaths(projectRoot, config) {
|
|
280
|
+
const assetsDirectory = config.assets?.directory;
|
|
281
|
+
if (!assetsDirectory) return config;
|
|
282
|
+
const isolatedAssetsDirectoryPath = resolve(projectRoot, ".devflare", "vite-build-output", basename(assetsDirectory));
|
|
283
|
+
const isolatedAssetsDirectory = relative(projectRoot, isolatedAssetsDirectoryPath).replace(/\\/g, "/");
|
|
284
|
+
const isolatedConfig = {
|
|
285
|
+
...config,
|
|
286
|
+
assets: config.assets ? {
|
|
287
|
+
...config.assets,
|
|
288
|
+
directory: isolatedAssetsDirectory
|
|
289
|
+
} : config.assets
|
|
290
|
+
};
|
|
291
|
+
if (!config.main) return isolatedConfig;
|
|
292
|
+
const originalAssetsDirectoryPath = resolve(projectRoot, assetsDirectory);
|
|
293
|
+
const originalMainEntryPath = resolve(projectRoot, config.main);
|
|
294
|
+
if (!pathIsInsideDirectory(originalAssetsDirectoryPath, originalMainEntryPath)) return isolatedConfig;
|
|
295
|
+
const isolatedMainEntryPath = resolve(isolatedAssetsDirectoryPath, relative(originalAssetsDirectoryPath, originalMainEntryPath));
|
|
296
|
+
return {
|
|
297
|
+
...isolatedConfig,
|
|
298
|
+
main: relative(projectRoot, isolatedMainEntryPath).replace(/\\/g, "/")
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function rebaseWranglerConfigPaths(projectRoot, configDir, config) {
|
|
302
|
+
return {
|
|
303
|
+
...config,
|
|
304
|
+
...config.main ? { main: rebasePathForConfigDir(projectRoot, configDir, config.main) } : {},
|
|
305
|
+
...config.assets?.directory ? { assets: {
|
|
306
|
+
...config.assets,
|
|
307
|
+
directory: rebasePathForConfigDir(projectRoot, configDir, config.assets.directory)
|
|
308
|
+
} } : {},
|
|
309
|
+
...config.containers ? { containers: config.containers.map((container) => ({
|
|
310
|
+
...container,
|
|
311
|
+
image: isLocalContainerPath(container.image) ? rebasePathForConfigDir(projectRoot, configDir, container.image) : container.image,
|
|
312
|
+
...container.image_build_context && { image_build_context: rebasePathForConfigDir(projectRoot, configDir, container.image_build_context) }
|
|
313
|
+
})) } : {}
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Write wrangler.jsonc file to the specified directory
|
|
318
|
+
*
|
|
319
|
+
* @param cwd - Working directory to write to
|
|
320
|
+
* @param config - Wrangler configuration to write
|
|
321
|
+
* @param filename - Optional filename (default: 'wrangler.jsonc')
|
|
322
|
+
* @returns Path to the written file
|
|
323
|
+
*/
|
|
324
|
+
async function writeWranglerConfig(cwd, config, filename = "wrangler.jsonc") {
|
|
325
|
+
const { resolve } = await import("pathe");
|
|
326
|
+
const fs = await import("node:fs/promises");
|
|
327
|
+
try {
|
|
328
|
+
await fs.mkdir(cwd, { recursive: true });
|
|
329
|
+
} catch {}
|
|
330
|
+
const content = stringifyConfig(config);
|
|
331
|
+
const wranglerPath = resolve(cwd, filename);
|
|
332
|
+
await fs.writeFile(wranglerPath, content, "utf-8");
|
|
333
|
+
return wranglerPath;
|
|
334
|
+
}
|
|
335
|
+
async function readWranglerConfig(filePath) {
|
|
336
|
+
const fs = await import("node:fs/promises");
|
|
337
|
+
const { parse } = await import("jsonc-parser");
|
|
338
|
+
const parsedConfig = parse(await fs.readFile(filePath, "utf-8"));
|
|
339
|
+
if (!parsedConfig || typeof parsedConfig !== "object") throw new Error(`Could not parse Wrangler config at ${filePath}.`);
|
|
340
|
+
return parsedConfig;
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/config/compiler.ts
|
|
344
|
+
/**
|
|
345
|
+
* Compile a phase-resolved DevflareConfig to WranglerConfig.
|
|
346
|
+
*
|
|
347
|
+
* R1 step 3: input is type-narrowed to `ResolvedConfig` (`LocalConfig | DeployConfig`)
|
|
348
|
+
* so callers cannot accidentally pass a raw `DevflareConfig` whose KV/D1/Hyperdrive
|
|
349
|
+
* bindings might still be name-only. The runtime throw remains as a defense-in-depth
|
|
350
|
+
* guard for callers that bypass the type system.
|
|
351
|
+
*
|
|
352
|
+
* @param config - A phase-resolved devflare configuration (`LocalConfig` or `DeployConfig`)
|
|
353
|
+
* @param environment - Optional environment name for env-specific overrides
|
|
354
|
+
* @returns Wrangler-compatible configuration object
|
|
355
|
+
*/
|
|
356
|
+
function compileConfig(config, environment) {
|
|
357
|
+
return compileConfigInternal(config, environment);
|
|
358
|
+
}
|
|
359
|
+
function compileBuildConfig(config, environment, options = {}) {
|
|
360
|
+
return compileConfigInternal(config, environment, {
|
|
361
|
+
preserveNamedBindings: true,
|
|
362
|
+
alreadyResolved: options.alreadyResolved
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function compileConfigInternal(config, environment, options = {}) {
|
|
366
|
+
const resolvedConfig = options.alreadyResolved ? config : resolveConfigForEnvironment(config, environment);
|
|
367
|
+
const mergedConfig = {
|
|
368
|
+
...resolvedConfig,
|
|
369
|
+
compatibilityFlags: normalizeCompatibilityFlags(resolvedConfig.compatibilityFlags)
|
|
370
|
+
};
|
|
371
|
+
const result = {
|
|
372
|
+
name: mergedConfig.name,
|
|
373
|
+
compatibility_date: mergedConfig.compatibilityDate,
|
|
374
|
+
preview_urls: true,
|
|
375
|
+
workers_dev: true
|
|
376
|
+
};
|
|
377
|
+
if (mergedConfig.accountId) result.account_id = mergedConfig.accountId;
|
|
378
|
+
const mainEntry = mergedConfig.files?.fetch;
|
|
379
|
+
if (typeof mainEntry === "string") result.main = mainEntry;
|
|
380
|
+
compileModuleOptions(mergedConfig, result);
|
|
381
|
+
if (mergedConfig.compatibilityFlags && mergedConfig.compatibilityFlags.length > 0) result.compatibility_flags = mergedConfig.compatibilityFlags;
|
|
382
|
+
if (mergedConfig.bindings) compileBindings(mergedConfig.bindings, result, options, mergedConfig.secretsStoreId);
|
|
383
|
+
if (mergedConfig.triggers?.crons && mergedConfig.triggers.crons.length > 0) result.triggers = { crons: mergedConfig.triggers.crons };
|
|
384
|
+
if (mergedConfig.tailConsumers && mergedConfig.tailConsumers.length > 0) result.tail_consumers = mergedConfig.tailConsumers.map((consumer) => typeof consumer === "string" ? { service: consumer } : {
|
|
385
|
+
service: consumer.service,
|
|
386
|
+
...consumer.environment && { environment: consumer.environment }
|
|
387
|
+
});
|
|
388
|
+
if (mergedConfig.vars && Object.keys(mergedConfig.vars).length > 0) result.vars = mergedConfig.vars;
|
|
389
|
+
const secrets = toWranglerSecretsConfig(mergedConfig.secrets);
|
|
390
|
+
if (secrets) result.secrets = secrets;
|
|
391
|
+
if (mergedConfig.routes && mergedConfig.routes.length > 0) result.routes = mergedConfig.routes.map((route) => ({
|
|
392
|
+
pattern: route.pattern,
|
|
393
|
+
...route.zone_name && { zone_name: route.zone_name },
|
|
394
|
+
...route.zone_id && { zone_id: route.zone_id },
|
|
395
|
+
...route.custom_domain !== void 0 && { custom_domain: route.custom_domain }
|
|
396
|
+
}));
|
|
397
|
+
if (mergedConfig.assets?.directory) result.assets = {
|
|
398
|
+
directory: mergedConfig.assets.directory,
|
|
399
|
+
...mergedConfig.assets.binding && { binding: mergedConfig.assets.binding },
|
|
400
|
+
...mergedConfig.assets.html_handling && { html_handling: mergedConfig.assets.html_handling },
|
|
401
|
+
...mergedConfig.assets.not_found_handling && { not_found_handling: mergedConfig.assets.not_found_handling },
|
|
402
|
+
...mergedConfig.assets.run_worker_first !== void 0 && { run_worker_first: mergedConfig.assets.run_worker_first }
|
|
403
|
+
};
|
|
404
|
+
if (mergedConfig.placement) result.placement = mergedConfig.placement;
|
|
405
|
+
if (mergedConfig.observability) result.observability = mergedConfig.observability;
|
|
406
|
+
if (mergedConfig.limits) result.limits = mergedConfig.limits;
|
|
407
|
+
compileContainers(mergedConfig, result);
|
|
408
|
+
if (mergedConfig.migrations && mergedConfig.migrations.length > 0) result.migrations = compileWranglerMigrations(mergedConfig.migrations);
|
|
409
|
+
if (mergedConfig.wrangler?.passthrough) Object.assign(result, mergedConfig.wrangler.passthrough);
|
|
410
|
+
return result;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Compile DevflareConfig to programmatic config for @cloudflare/vite-plugin.
|
|
414
|
+
* This is used instead of wrangler.jsonc in dev mode.
|
|
415
|
+
*
|
|
416
|
+
* @param config - The devflare configuration
|
|
417
|
+
* @param environment - Optional environment name for env-specific overrides
|
|
418
|
+
* @returns Config object compatible with cloudflare({ config: ... })
|
|
419
|
+
*/
|
|
420
|
+
function compileToProgrammaticConfig(config, environment, options = {}) {
|
|
421
|
+
return options.preserveNamedBindings ? compileBuildConfig(config, environment) : compileConfig(config, environment);
|
|
422
|
+
}
|
|
423
|
+
//#endregion
|
|
424
|
+
export { readWranglerConfig as a, writeWranglerConfig as c, isolateViteBuildOutputPaths as i, compileConfig as n, rebaseWranglerConfigPaths as o, compileToProgrammaticConfig as r, stringifyConfig as s, compileBuildConfig as t };
|