devflare 1.0.0-next.5 → 1.0.0-next.51
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 +397 -605
- package/bin/devflare.js +30 -14
- package/dist/_chunks/account-Csog80ie.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-Ccza8VQz.js +24 -0
- package/dist/_chunks/build-artifacts-BNssqhxE.js +483 -0
- package/dist/_chunks/cli-CU7wSG1-.js +1163 -0
- package/dist/_chunks/cloudflare-BaloqI3H.js +157 -0
- package/dist/_chunks/colors-DiK6wPJ5.js +13 -0
- package/dist/_chunks/command-utils-_bGRraDR.js +45 -0
- package/dist/_chunks/compiler-BtLp9T9N.js +500 -0
- package/dist/_chunks/config-QU8UEWmA.js +78 -0
- package/dist/_chunks/config-path-1yI7BiDU.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-aifBaMVv.js +1032 -0
- package/dist/_chunks/dev-DF_3baGr.js +3483 -0
- package/dist/_chunks/doctor-tR9kGT_Z.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-DKPp4wqj.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-OQ2AWpqm.js +1308 -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-CYoHfvQ1.js +123 -0
- package/dist/_chunks/local-workflow-entrypoints-8d_mXh8T.js +90 -0
- package/dist/_chunks/login-rVWUZOKC.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-DRWR0gaB.js +359 -0
- package/dist/_chunks/previews-BxNq8Y_J.js +1134 -0
- package/dist/_chunks/productions-DK7xwbEs.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-B6XiI8Sa.js +851 -0
- package/dist/_chunks/runtime-DL-Nz3k8.js +550 -0
- package/dist/_chunks/schema-normalization-GjhTATHL.js +666 -0
- package/dist/_chunks/secrets-qT1JaBGt.js +95 -0
- package/dist/_chunks/tail-CuWI04BL.js +239 -0
- package/dist/_chunks/token-Dmi0KXyX.js +333 -0
- package/dist/_chunks/tokens-iVcgNXi-.js +221 -0
- package/dist/_chunks/types-BquPXsFg.js +484 -0
- package/dist/_chunks/ui-BUoZApvE.js +103 -0
- package/dist/_chunks/usage-BBTGzjon.js +272 -0
- package/dist/_chunks/vite-D_wLDGBs.js +1267 -0
- package/dist/_chunks/vite-utils-OVLMV605.js +183 -0
- package/dist/_chunks/worker-DEF-e8LL.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 +85 -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 +5705 -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 +309 -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 +2087 -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 +3771 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +267 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +557 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +520 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +802 -0
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
- package/dist/config/schema-types-bindings.d.ts +293 -0
- package/dist/config/schema-types-bindings.d.ts.map +1 -0
- package/dist/config/schema-types-build.d.ts +86 -0
- package/dist/config/schema-types-build.d.ts.map +1 -0
- package/dist/config/schema-types-runtime-server.d.ts +122 -0
- package/dist/config/schema-types-runtime-server.d.ts.map +1 -0
- package/dist/config/schema-types-runtime.d.ts +913 -0
- package/dist/config/schema-types-runtime.d.ts.map +1 -0
- package/dist/config/schema-types.d.ts +458 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +5699 -2021
- 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 +90 -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 +93 -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 +4981 -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,500 @@
|
|
|
1
|
+
import { p as normalizeCompatibilityFlags, u as resolveConfigForEnvironment } from "./loader-OQ2AWpqm.js";
|
|
2
|
+
import { C as browserBindingSchema, _ as normalizeSecretsStoreBinding, a as normalizeD1Binding, b as normalizeVpcServiceBinding, c as normalizeFlagshipBinding, d as normalizeKVBinding, f as normalizeMediaBinding, g as normalizeR2Binding, h as normalizeQueueProducer, i as normalizeArtifactsBinding, l as normalizeHyperdriveBinding, m as normalizePipelineBinding, o as normalizeDOBinding, p as normalizeMtlsCertificateBinding, r as getSingleBrowserBindingName, s as normalizeDispatchNamespaceBinding, u as normalizeImagesBinding, v as normalizeStreamBinding, x as normalizeWorkflowBinding, y as normalizeVpcNetworkBinding } from "./schema-normalization-GjhTATHL.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
|
+
const extras = {
|
|
9
|
+
...normalized.previewDatabaseId !== void 0 && { preview_database_id: normalized.previewDatabaseId },
|
|
10
|
+
...normalized.migrationsTable !== void 0 && { migrations_table: normalized.migrationsTable },
|
|
11
|
+
...normalized.migrationsDir !== void 0 && { migrations_dir: normalized.migrationsDir },
|
|
12
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
13
|
+
};
|
|
14
|
+
if (normalized.databaseId) return {
|
|
15
|
+
binding: bindingName,
|
|
16
|
+
database_id: normalized.databaseId,
|
|
17
|
+
...extras
|
|
18
|
+
};
|
|
19
|
+
if (options.preserveNamedBindings && normalized.name) return {
|
|
20
|
+
binding: bindingName,
|
|
21
|
+
database_name: normalized.name,
|
|
22
|
+
...extras
|
|
23
|
+
};
|
|
24
|
+
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.`);
|
|
25
|
+
}
|
|
26
|
+
function getWranglerKVNamespaceBinding(bindingName, bindingConfig, options = {}) {
|
|
27
|
+
const normalized = normalizeKVBinding(bindingConfig);
|
|
28
|
+
const extras = {
|
|
29
|
+
...normalized.previewId !== void 0 && { preview_id: normalized.previewId },
|
|
30
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
31
|
+
};
|
|
32
|
+
if (normalized.namespaceId) return {
|
|
33
|
+
binding: bindingName,
|
|
34
|
+
id: normalized.namespaceId,
|
|
35
|
+
...extras
|
|
36
|
+
};
|
|
37
|
+
if (options.preserveNamedBindings && normalized.name) return {
|
|
38
|
+
binding: bindingName,
|
|
39
|
+
name: normalized.name,
|
|
40
|
+
...extras
|
|
41
|
+
};
|
|
42
|
+
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.`);
|
|
43
|
+
}
|
|
44
|
+
function getWranglerHyperdriveBinding(bindingName, bindingConfig, options = {}) {
|
|
45
|
+
const normalized = normalizeHyperdriveBinding(bindingConfig);
|
|
46
|
+
if (normalized.configurationId) return {
|
|
47
|
+
binding: bindingName,
|
|
48
|
+
id: normalized.configurationId,
|
|
49
|
+
...normalized.localConnectionString && { localConnectionString: normalized.localConnectionString }
|
|
50
|
+
};
|
|
51
|
+
if (options.preserveNamedBindings && normalized.name) return {
|
|
52
|
+
binding: bindingName,
|
|
53
|
+
name: normalized.name,
|
|
54
|
+
...normalized.localConnectionString && { localConnectionString: normalized.localConnectionString }
|
|
55
|
+
};
|
|
56
|
+
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.`);
|
|
57
|
+
}
|
|
58
|
+
function getWranglerBrowserBinding(browserBindings) {
|
|
59
|
+
if (!browserBindings) return;
|
|
60
|
+
const parsed = browserBindingSchema.parse(browserBindings);
|
|
61
|
+
const bindingName = getSingleBrowserBindingName(parsed);
|
|
62
|
+
if (!bindingName) return;
|
|
63
|
+
const bindingConfig = parsed[bindingName];
|
|
64
|
+
return {
|
|
65
|
+
binding: bindingName,
|
|
66
|
+
...typeof bindingConfig === "object" && bindingConfig.remote !== void 0 && { remote: bindingConfig.remote }
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Compile bindings from devflare format to wrangler format
|
|
71
|
+
*/
|
|
72
|
+
function compileBindings(bindings, result, options = {}, defaultSecretsStoreId) {
|
|
73
|
+
if (bindings.kv) result.kv_namespaces = Object.entries(bindings.kv).map(([binding, namespace]) => {
|
|
74
|
+
return getWranglerKVNamespaceBinding(binding, namespace, options);
|
|
75
|
+
});
|
|
76
|
+
if (bindings.d1) result.d1_databases = Object.entries(bindings.d1).map(([binding, database_id]) => {
|
|
77
|
+
return getWranglerD1DatabaseBinding(binding, database_id, options);
|
|
78
|
+
});
|
|
79
|
+
if (bindings.r2) result.r2_buckets = Object.entries(bindings.r2).map(([binding, config]) => {
|
|
80
|
+
const normalized = normalizeR2Binding(config);
|
|
81
|
+
return {
|
|
82
|
+
binding,
|
|
83
|
+
bucket_name: normalized.bucketName,
|
|
84
|
+
...normalized.previewBucketName !== void 0 && { preview_bucket_name: normalized.previewBucketName },
|
|
85
|
+
...normalized.jurisdiction !== void 0 && { jurisdiction: normalized.jurisdiction },
|
|
86
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
if (bindings.durableObjects) result.durable_objects = { bindings: Object.entries(bindings.durableObjects).map(([name, config]) => {
|
|
90
|
+
const normalized = normalizeDOBinding(config);
|
|
91
|
+
const binding = {
|
|
92
|
+
name,
|
|
93
|
+
class_name: normalized.className
|
|
94
|
+
};
|
|
95
|
+
if (normalized.kind === "cross-worker" && normalized.scriptName) binding.script_name = normalized.scriptName;
|
|
96
|
+
return binding;
|
|
97
|
+
}) };
|
|
98
|
+
if (bindings.queues) {
|
|
99
|
+
result.queues = {};
|
|
100
|
+
if (bindings.queues.producers) result.queues.producers = Object.entries(bindings.queues.producers).map(([binding, config]) => {
|
|
101
|
+
const normalized = normalizeQueueProducer(config);
|
|
102
|
+
return {
|
|
103
|
+
binding,
|
|
104
|
+
queue: normalized.queue,
|
|
105
|
+
...normalized.remote !== void 0 && { remote: normalized.remote },
|
|
106
|
+
...normalized.deliveryDelay !== void 0 && { delivery_delay: normalized.deliveryDelay }
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
if (bindings.queues.consumers) result.queues.consumers = bindings.queues.consumers.map((consumer) => ({
|
|
110
|
+
queue: consumer.queue,
|
|
111
|
+
...consumer.maxBatchSize && { max_batch_size: consumer.maxBatchSize },
|
|
112
|
+
...consumer.maxBatchTimeout && { max_batch_timeout: consumer.maxBatchTimeout },
|
|
113
|
+
...consumer.maxRetries && { max_retries: consumer.maxRetries },
|
|
114
|
+
...consumer.deadLetterQueue && { dead_letter_queue: consumer.deadLetterQueue },
|
|
115
|
+
...consumer.maxConcurrency && { max_concurrency: consumer.maxConcurrency },
|
|
116
|
+
...consumer.retryDelay && { retry_delay: consumer.retryDelay },
|
|
117
|
+
...consumer.visibilityTimeoutMs && { visibility_timeout_ms: consumer.visibilityTimeoutMs }
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
if (bindings.rateLimits) result.ratelimits = Object.entries(bindings.rateLimits).map(([name, config]) => ({
|
|
121
|
+
name,
|
|
122
|
+
namespace_id: config.namespaceId,
|
|
123
|
+
simple: {
|
|
124
|
+
limit: config.simple.limit,
|
|
125
|
+
period: config.simple.period
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
if (bindings.versionMetadata) result.version_metadata = { binding: bindings.versionMetadata.binding };
|
|
129
|
+
if (bindings.workerLoaders) result.worker_loaders = Object.keys(bindings.workerLoaders).map((binding) => ({ binding }));
|
|
130
|
+
if (bindings.mtlsCertificates) result.mtls_certificates = Object.entries(bindings.mtlsCertificates).map(([binding, config]) => {
|
|
131
|
+
const normalized = normalizeMtlsCertificateBinding(config);
|
|
132
|
+
return {
|
|
133
|
+
binding,
|
|
134
|
+
certificate_id: normalized.certificateId,
|
|
135
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
if (bindings.dispatchNamespaces) result.dispatch_namespaces = Object.entries(bindings.dispatchNamespaces).map(([binding, config]) => {
|
|
139
|
+
const normalized = normalizeDispatchNamespaceBinding(config);
|
|
140
|
+
return {
|
|
141
|
+
binding,
|
|
142
|
+
namespace: normalized.namespace,
|
|
143
|
+
...normalized.outbound && { outbound: normalized.outbound },
|
|
144
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
if (bindings.workflows) result.workflows = Object.entries(bindings.workflows).map(([binding, config]) => {
|
|
148
|
+
const normalized = normalizeWorkflowBinding(config);
|
|
149
|
+
return {
|
|
150
|
+
binding,
|
|
151
|
+
name: normalized.name,
|
|
152
|
+
class_name: normalized.className,
|
|
153
|
+
...normalized.scriptName && { script_name: normalized.scriptName },
|
|
154
|
+
...normalized.remote !== void 0 && { remote: normalized.remote },
|
|
155
|
+
...normalized.limits && { limits: normalized.limits }
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
if (bindings.pipelines) result.pipelines = Object.entries(bindings.pipelines).map(([binding, config]) => {
|
|
159
|
+
const normalized = normalizePipelineBinding(config);
|
|
160
|
+
return {
|
|
161
|
+
binding,
|
|
162
|
+
pipeline: normalized.pipeline,
|
|
163
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
if (bindings.images) {
|
|
167
|
+
const [entry] = Object.entries(bindings.images);
|
|
168
|
+
if (entry) {
|
|
169
|
+
const [binding, config] = entry;
|
|
170
|
+
const normalized = normalizeImagesBinding(binding, config);
|
|
171
|
+
result.images = {
|
|
172
|
+
binding: normalized.binding,
|
|
173
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (bindings.media) {
|
|
178
|
+
const [entry] = Object.entries(bindings.media);
|
|
179
|
+
if (entry) {
|
|
180
|
+
const [binding, config] = entry;
|
|
181
|
+
const normalized = normalizeMediaBinding(binding, config);
|
|
182
|
+
result.media = {
|
|
183
|
+
binding: normalized.binding,
|
|
184
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (bindings.artifacts) result.artifacts = Object.entries(bindings.artifacts).map(([binding, config]) => {
|
|
189
|
+
const normalized = normalizeArtifactsBinding(config);
|
|
190
|
+
return {
|
|
191
|
+
binding,
|
|
192
|
+
namespace: normalized.namespace,
|
|
193
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
if (bindings.stream) {
|
|
197
|
+
const [entry] = Object.entries(bindings.stream);
|
|
198
|
+
if (entry) {
|
|
199
|
+
const [binding, config] = entry;
|
|
200
|
+
const normalized = normalizeStreamBinding(binding, config);
|
|
201
|
+
result.stream = {
|
|
202
|
+
binding: normalized.binding,
|
|
203
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (bindings.vpcServices) result.vpc_services = Object.entries(bindings.vpcServices).map(([binding, config]) => {
|
|
208
|
+
const normalized = normalizeVpcServiceBinding(config);
|
|
209
|
+
return {
|
|
210
|
+
binding,
|
|
211
|
+
service_id: normalized.serviceId,
|
|
212
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
if (bindings.vpcNetworks) result.vpc_networks = Object.entries(bindings.vpcNetworks).map(([binding, config]) => {
|
|
216
|
+
const normalized = normalizeVpcNetworkBinding(config);
|
|
217
|
+
if (normalized.tunnelId !== void 0) return {
|
|
218
|
+
binding,
|
|
219
|
+
tunnel_id: normalized.tunnelId,
|
|
220
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
221
|
+
};
|
|
222
|
+
return {
|
|
223
|
+
binding,
|
|
224
|
+
network_id: normalized.networkId,
|
|
225
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
if (bindings.flagship) result.flagship = Object.entries(bindings.flagship).map(([binding, config]) => {
|
|
229
|
+
const normalized = normalizeFlagshipBinding(config);
|
|
230
|
+
return {
|
|
231
|
+
binding,
|
|
232
|
+
app_id: normalized.appId,
|
|
233
|
+
...normalized.remote !== void 0 && { remote: normalized.remote }
|
|
234
|
+
};
|
|
235
|
+
});
|
|
236
|
+
if (bindings.secretsStore) result.secrets_store_secrets = Object.entries(bindings.secretsStore).map(([binding, config]) => {
|
|
237
|
+
const normalized = normalizeSecretsStoreBinding(config, defaultSecretsStoreId, binding);
|
|
238
|
+
return {
|
|
239
|
+
binding,
|
|
240
|
+
store_id: normalized.storeId,
|
|
241
|
+
secret_name: normalized.secretName
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
if (bindings.services) result.services = Object.entries(bindings.services).map(([binding, config]) => ({
|
|
245
|
+
binding,
|
|
246
|
+
service: config.service,
|
|
247
|
+
...config.entrypoint && { entrypoint: config.entrypoint },
|
|
248
|
+
...config.environment && { environment: config.environment },
|
|
249
|
+
...config.remote !== void 0 && { remote: config.remote },
|
|
250
|
+
...config.props !== void 0 && { props: config.props }
|
|
251
|
+
}));
|
|
252
|
+
if (bindings.ai?.binding) result.ai = {
|
|
253
|
+
binding: bindings.ai.binding,
|
|
254
|
+
...bindings.ai.remote !== void 0 && { remote: bindings.ai.remote },
|
|
255
|
+
...bindings.ai.staging !== void 0 && { staging: bindings.ai.staging }
|
|
256
|
+
};
|
|
257
|
+
if (bindings.aiSearchNamespaces) result.ai_search_namespaces = Object.entries(bindings.aiSearchNamespaces).map(([binding, config]) => ({
|
|
258
|
+
binding,
|
|
259
|
+
namespace: config.namespace,
|
|
260
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
261
|
+
}));
|
|
262
|
+
if (bindings.aiSearch) result.ai_search = Object.entries(bindings.aiSearch).map(([binding, config]) => ({
|
|
263
|
+
binding,
|
|
264
|
+
instance_name: config.instanceName,
|
|
265
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
266
|
+
}));
|
|
267
|
+
if (bindings.vectorize) result.vectorize = Object.entries(bindings.vectorize).map(([binding, config]) => ({
|
|
268
|
+
binding,
|
|
269
|
+
index_name: config.indexName,
|
|
270
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
271
|
+
}));
|
|
272
|
+
if (bindings.hyperdrive) result.hyperdrive = Object.entries(bindings.hyperdrive).map(([binding, config]) => {
|
|
273
|
+
return getWranglerHyperdriveBinding(binding, config, options);
|
|
274
|
+
});
|
|
275
|
+
const browserBinding = getWranglerBrowserBinding(bindings.browser);
|
|
276
|
+
if (browserBinding) result.browser = browserBinding;
|
|
277
|
+
if (bindings.analyticsEngine) result.analytics_engine_datasets = Object.entries(bindings.analyticsEngine).map(([binding, config]) => ({
|
|
278
|
+
binding,
|
|
279
|
+
dataset: config.dataset
|
|
280
|
+
}));
|
|
281
|
+
if (bindings.sendEmail) result.send_email = Object.entries(bindings.sendEmail).map(([name, config]) => ({
|
|
282
|
+
name,
|
|
283
|
+
...config.destinationAddress && { destination_address: config.destinationAddress },
|
|
284
|
+
...config.allowedDestinationAddresses && { allowed_destination_addresses: config.allowedDestinationAddresses },
|
|
285
|
+
...config.allowedSenderAddresses && { allowed_sender_addresses: config.allowedSenderAddresses },
|
|
286
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
287
|
+
}));
|
|
288
|
+
}
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/config/compiler/core-helpers.ts
|
|
291
|
+
function compileWranglerMigrations(migrations) {
|
|
292
|
+
return migrations.map((migration) => ({
|
|
293
|
+
tag: migration.tag,
|
|
294
|
+
...migration.new_classes && { new_classes: migration.new_classes },
|
|
295
|
+
...migration.renamed_classes && { renamed_classes: migration.renamed_classes.map((renamedClass) => ({
|
|
296
|
+
from: renamedClass.from,
|
|
297
|
+
to: renamedClass.to
|
|
298
|
+
})) },
|
|
299
|
+
...migration.deleted_classes && { deleted_classes: migration.deleted_classes },
|
|
300
|
+
...migration.new_sqlite_classes && { new_sqlite_classes: migration.new_sqlite_classes }
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
303
|
+
function compileModuleOptions(config, result) {
|
|
304
|
+
if (config.rules && config.rules.length > 0) result.rules = config.rules;
|
|
305
|
+
if (config.findAdditionalModules !== void 0) result.find_additional_modules = config.findAdditionalModules;
|
|
306
|
+
if (config.baseDir) result.base_dir = config.baseDir;
|
|
307
|
+
if (config.preserveFileNames !== void 0) result.preserve_file_names = config.preserveFileNames;
|
|
308
|
+
if (config.logpush !== void 0) result.logpush = config.logpush;
|
|
309
|
+
if (config.uploadSourceMaps !== void 0) result.upload_source_maps = config.uploadSourceMaps;
|
|
310
|
+
if (config.keepVars !== void 0) result.keep_vars = config.keepVars;
|
|
311
|
+
}
|
|
312
|
+
function compileContainers(config, result) {
|
|
313
|
+
if (!config.containers || config.containers.length === 0) return;
|
|
314
|
+
result.containers = config.containers.map((container) => ({
|
|
315
|
+
class_name: container.className,
|
|
316
|
+
image: container.image,
|
|
317
|
+
...container.maxInstances !== void 0 && { max_instances: container.maxInstances },
|
|
318
|
+
...container.instanceType && { instance_type: container.instanceType },
|
|
319
|
+
...container.name && { name: container.name },
|
|
320
|
+
...container.imageBuildContext && { image_build_context: container.imageBuildContext },
|
|
321
|
+
...container.imageVars && { image_vars: container.imageVars },
|
|
322
|
+
...container.rolloutActiveGracePeriod !== void 0 && { rollout_active_grace_period: container.rolloutActiveGracePeriod },
|
|
323
|
+
...container.rolloutStepPercentage !== void 0 && { rollout_step_percentage: container.rolloutStepPercentage }
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/config/compiler/paths.ts
|
|
328
|
+
/**
|
|
329
|
+
* Convert WranglerConfig to JSONC string with comments
|
|
330
|
+
*/
|
|
331
|
+
function stringifyConfig(config) {
|
|
332
|
+
return `// Generated by devflare — Do not edit directly
|
|
333
|
+
// Edit devflare.config.ts instead
|
|
334
|
+
|
|
335
|
+
` + JSON.stringify(config, null, " ");
|
|
336
|
+
}
|
|
337
|
+
function rebasePathForConfigDir(projectRoot, configDir, pathValue) {
|
|
338
|
+
return relative(configDir, isAbsolute(pathValue) ? pathValue : resolve(projectRoot, pathValue)).replace(/\\/g, "/");
|
|
339
|
+
}
|
|
340
|
+
function isLocalContainerPath(pathValue) {
|
|
341
|
+
return pathValue === "Dockerfile" || pathValue.startsWith(".") || pathValue.startsWith("/") || pathValue.startsWith("\\") || isAbsolute(pathValue) || pathValue.endsWith("/Dockerfile") || pathValue.endsWith("\\Dockerfile");
|
|
342
|
+
}
|
|
343
|
+
function pathIsInsideDirectory(directoryPath, candidatePath) {
|
|
344
|
+
const normalizedDirectoryPath = directoryPath.replace(/\\/g, "/");
|
|
345
|
+
const normalizedCandidatePath = candidatePath.replace(/\\/g, "/");
|
|
346
|
+
return normalizedCandidatePath === normalizedDirectoryPath || normalizedCandidatePath.startsWith(`${normalizedDirectoryPath}/`);
|
|
347
|
+
}
|
|
348
|
+
function isolateViteBuildOutputPaths(projectRoot, config) {
|
|
349
|
+
const assetsDirectory = config.assets?.directory;
|
|
350
|
+
if (!assetsDirectory) return config;
|
|
351
|
+
const isolatedAssetsDirectoryPath = resolve(projectRoot, ".devflare", "vite-build-output", basename(assetsDirectory));
|
|
352
|
+
const isolatedAssetsDirectory = relative(projectRoot, isolatedAssetsDirectoryPath).replace(/\\/g, "/");
|
|
353
|
+
const isolatedConfig = {
|
|
354
|
+
...config,
|
|
355
|
+
assets: config.assets ? {
|
|
356
|
+
...config.assets,
|
|
357
|
+
directory: isolatedAssetsDirectory
|
|
358
|
+
} : config.assets
|
|
359
|
+
};
|
|
360
|
+
if (!config.main) return isolatedConfig;
|
|
361
|
+
const originalAssetsDirectoryPath = resolve(projectRoot, assetsDirectory);
|
|
362
|
+
const originalMainEntryPath = resolve(projectRoot, config.main);
|
|
363
|
+
if (!pathIsInsideDirectory(originalAssetsDirectoryPath, originalMainEntryPath)) return isolatedConfig;
|
|
364
|
+
const isolatedMainEntryPath = resolve(isolatedAssetsDirectoryPath, relative(originalAssetsDirectoryPath, originalMainEntryPath));
|
|
365
|
+
return {
|
|
366
|
+
...isolatedConfig,
|
|
367
|
+
main: relative(projectRoot, isolatedMainEntryPath).replace(/\\/g, "/")
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function rebaseWranglerConfigPaths(projectRoot, configDir, config) {
|
|
371
|
+
return {
|
|
372
|
+
...config,
|
|
373
|
+
...config.main ? { main: rebasePathForConfigDir(projectRoot, configDir, config.main) } : {},
|
|
374
|
+
...config.assets?.directory ? { assets: {
|
|
375
|
+
...config.assets,
|
|
376
|
+
directory: rebasePathForConfigDir(projectRoot, configDir, config.assets.directory)
|
|
377
|
+
} } : {},
|
|
378
|
+
...config.containers ? { containers: config.containers.map((container) => ({
|
|
379
|
+
...container,
|
|
380
|
+
image: isLocalContainerPath(container.image) ? rebasePathForConfigDir(projectRoot, configDir, container.image) : container.image,
|
|
381
|
+
...container.image_build_context && { image_build_context: rebasePathForConfigDir(projectRoot, configDir, container.image_build_context) }
|
|
382
|
+
})) } : {}
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Write wrangler.jsonc file to the specified directory
|
|
387
|
+
*
|
|
388
|
+
* @param cwd - Working directory to write to
|
|
389
|
+
* @param config - Wrangler configuration to write
|
|
390
|
+
* @param filename - Optional filename (default: 'wrangler.jsonc')
|
|
391
|
+
* @returns Path to the written file
|
|
392
|
+
*/
|
|
393
|
+
async function writeWranglerConfig(cwd, config, filename = "wrangler.jsonc") {
|
|
394
|
+
const { resolve } = await import("pathe");
|
|
395
|
+
const fs = await import("node:fs/promises");
|
|
396
|
+
try {
|
|
397
|
+
await fs.mkdir(cwd, { recursive: true });
|
|
398
|
+
} catch {}
|
|
399
|
+
const content = stringifyConfig(config);
|
|
400
|
+
const wranglerPath = resolve(cwd, filename);
|
|
401
|
+
await fs.writeFile(wranglerPath, content, "utf-8");
|
|
402
|
+
return wranglerPath;
|
|
403
|
+
}
|
|
404
|
+
async function readWranglerConfig(filePath) {
|
|
405
|
+
const fs = await import("node:fs/promises");
|
|
406
|
+
const { parse } = await import("jsonc-parser");
|
|
407
|
+
const parsedConfig = parse(await fs.readFile(filePath, "utf-8"));
|
|
408
|
+
if (!parsedConfig || typeof parsedConfig !== "object") throw new Error(`Could not parse Wrangler config at ${filePath}.`);
|
|
409
|
+
return parsedConfig;
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/config/compiler.ts
|
|
413
|
+
/**
|
|
414
|
+
* Compile a phase-resolved DevflareConfig to WranglerConfig.
|
|
415
|
+
*
|
|
416
|
+
* R1 step 3: input is type-narrowed to `ResolvedConfig` (`LocalConfig | DeployConfig`)
|
|
417
|
+
* so callers cannot accidentally pass a raw `DevflareConfig` whose KV/D1/Hyperdrive
|
|
418
|
+
* bindings might still be name-only. The runtime throw remains as a defense-in-depth
|
|
419
|
+
* guard for callers that bypass the type system.
|
|
420
|
+
*
|
|
421
|
+
* @param config - A phase-resolved devflare configuration (`LocalConfig` or `DeployConfig`)
|
|
422
|
+
* @param environment - Optional environment name for env-specific overrides
|
|
423
|
+
* @returns Wrangler-compatible configuration object
|
|
424
|
+
*/
|
|
425
|
+
function compileConfig(config, environment) {
|
|
426
|
+
return compileConfigInternal(config, environment);
|
|
427
|
+
}
|
|
428
|
+
function compileBuildConfig(config, environment, options = {}) {
|
|
429
|
+
return compileConfigInternal(config, environment, {
|
|
430
|
+
preserveNamedBindings: true,
|
|
431
|
+
alreadyResolved: options.alreadyResolved
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
function compileConfigInternal(config, environment, options = {}) {
|
|
435
|
+
const resolvedConfig = options.alreadyResolved ? config : resolveConfigForEnvironment(config, environment);
|
|
436
|
+
const mergedConfig = {
|
|
437
|
+
...resolvedConfig,
|
|
438
|
+
compatibilityFlags: normalizeCompatibilityFlags(resolvedConfig.compatibilityFlags)
|
|
439
|
+
};
|
|
440
|
+
const result = {
|
|
441
|
+
name: mergedConfig.name,
|
|
442
|
+
compatibility_date: mergedConfig.compatibilityDate,
|
|
443
|
+
preview_urls: true,
|
|
444
|
+
workers_dev: mergedConfig.workersDev ?? true,
|
|
445
|
+
...mergedConfig.complianceRegion !== void 0 && { compliance_region: mergedConfig.complianceRegion }
|
|
446
|
+
};
|
|
447
|
+
if (mergedConfig.accountId) result.account_id = mergedConfig.accountId;
|
|
448
|
+
const mainEntry = mergedConfig.files?.fetch;
|
|
449
|
+
if (typeof mainEntry === "string") result.main = mainEntry;
|
|
450
|
+
compileModuleOptions(mergedConfig, result);
|
|
451
|
+
if (mergedConfig.compatibilityFlags && mergedConfig.compatibilityFlags.length > 0) result.compatibility_flags = mergedConfig.compatibilityFlags;
|
|
452
|
+
if (mergedConfig.bindings) compileBindings(mergedConfig.bindings, result, options, mergedConfig.secretsStoreId);
|
|
453
|
+
if (mergedConfig.triggers?.crons && mergedConfig.triggers.crons.length > 0) result.triggers = { crons: mergedConfig.triggers.crons };
|
|
454
|
+
if (mergedConfig.tailConsumers && mergedConfig.tailConsumers.length > 0) result.tail_consumers = mergedConfig.tailConsumers.map((consumer) => typeof consumer === "string" ? { service: consumer } : {
|
|
455
|
+
service: consumer.service,
|
|
456
|
+
...consumer.environment && { environment: consumer.environment }
|
|
457
|
+
});
|
|
458
|
+
if (mergedConfig.streamingTailConsumers && mergedConfig.streamingTailConsumers.length > 0) result.streaming_tail_consumers = mergedConfig.streamingTailConsumers.map((consumer) => typeof consumer === "string" ? { service: consumer } : {
|
|
459
|
+
service: consumer.service,
|
|
460
|
+
...consumer.environment && { environment: consumer.environment }
|
|
461
|
+
});
|
|
462
|
+
if (mergedConfig.vars && Object.keys(mergedConfig.vars).length > 0) result.vars = mergedConfig.vars;
|
|
463
|
+
const secrets = toWranglerSecretsConfig(mergedConfig.secrets);
|
|
464
|
+
if (secrets) result.secrets = secrets;
|
|
465
|
+
if (mergedConfig.routes && mergedConfig.routes.length > 0) result.routes = mergedConfig.routes.map((route) => ({
|
|
466
|
+
pattern: route.pattern,
|
|
467
|
+
...route.zone_name && { zone_name: route.zone_name },
|
|
468
|
+
...route.zone_id && { zone_id: route.zone_id },
|
|
469
|
+
...route.custom_domain !== void 0 && { custom_domain: route.custom_domain },
|
|
470
|
+
...route.enabled !== void 0 && { enabled: route.enabled },
|
|
471
|
+
...route.previews_enabled !== void 0 && { previews_enabled: route.previews_enabled }
|
|
472
|
+
}));
|
|
473
|
+
if (mergedConfig.assets?.directory) result.assets = {
|
|
474
|
+
directory: mergedConfig.assets.directory,
|
|
475
|
+
...mergedConfig.assets.binding && { binding: mergedConfig.assets.binding },
|
|
476
|
+
...mergedConfig.assets.html_handling && { html_handling: mergedConfig.assets.html_handling },
|
|
477
|
+
...mergedConfig.assets.not_found_handling && { not_found_handling: mergedConfig.assets.not_found_handling },
|
|
478
|
+
...mergedConfig.assets.run_worker_first !== void 0 && { run_worker_first: mergedConfig.assets.run_worker_first }
|
|
479
|
+
};
|
|
480
|
+
if (mergedConfig.placement) result.placement = mergedConfig.placement;
|
|
481
|
+
if (mergedConfig.observability) result.observability = mergedConfig.observability;
|
|
482
|
+
if (mergedConfig.limits) result.limits = mergedConfig.limits;
|
|
483
|
+
compileContainers(mergedConfig, result);
|
|
484
|
+
if (mergedConfig.migrations && mergedConfig.migrations.length > 0) result.migrations = compileWranglerMigrations(mergedConfig.migrations);
|
|
485
|
+
if (mergedConfig.wrangler?.passthrough) Object.assign(result, mergedConfig.wrangler.passthrough);
|
|
486
|
+
return result;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Compile DevflareConfig to programmatic config for @cloudflare/vite-plugin.
|
|
490
|
+
* This is used instead of wrangler.jsonc in dev mode.
|
|
491
|
+
*
|
|
492
|
+
* @param config - The devflare configuration
|
|
493
|
+
* @param environment - Optional environment name for env-specific overrides
|
|
494
|
+
* @returns Config object compatible with cloudflare({ config: ... })
|
|
495
|
+
*/
|
|
496
|
+
function compileToProgrammaticConfig(config, environment, options = {}) {
|
|
497
|
+
return options.preserveNamedBindings ? compileBuildConfig(config, environment) : compileConfig(config, environment);
|
|
498
|
+
}
|
|
499
|
+
//#endregion
|
|
500
|
+
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 };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { d as resolveConfigEnvVars } from "./preview-C3Cdr8an.js";
|
|
2
|
+
import { a as ConfigResourceResolutionError, o as loadResolvedConfig, r as loadConfig, s as resolveResources } from "./loader-OQ2AWpqm.js";
|
|
3
|
+
import { n as compileConfig, t as compileBuildConfig } from "./compiler-BtLp9T9N.js";
|
|
4
|
+
//#region src/cli/commands/config.ts
|
|
5
|
+
function isSupportedFormat(value) {
|
|
6
|
+
return value === "devflare" || value === "wrangler";
|
|
7
|
+
}
|
|
8
|
+
function isSupportedPhase(value) {
|
|
9
|
+
return value === "build" || value === "local" || value === "deploy";
|
|
10
|
+
}
|
|
11
|
+
async function loadConfigForPhase(options) {
|
|
12
|
+
if (options.phase === "deploy") return await resolveConfigEnvVars(await loadResolvedConfig({
|
|
13
|
+
cwd: options.cwd,
|
|
14
|
+
configFile: options.configPath,
|
|
15
|
+
environment: options.environment
|
|
16
|
+
}), {
|
|
17
|
+
cwd: options.cwd,
|
|
18
|
+
configPath: options.configPath,
|
|
19
|
+
mode: "build"
|
|
20
|
+
});
|
|
21
|
+
return await resolveConfigEnvVars(await resolveResources(await loadConfig({
|
|
22
|
+
cwd: options.cwd,
|
|
23
|
+
configFile: options.configPath
|
|
24
|
+
}), {
|
|
25
|
+
phase: options.phase,
|
|
26
|
+
environment: options.environment
|
|
27
|
+
}), {
|
|
28
|
+
cwd: options.cwd,
|
|
29
|
+
configPath: options.configPath,
|
|
30
|
+
mode: options.phase === "local" ? "dev" : "build"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async function runConfigCommand(parsed, logger, options) {
|
|
34
|
+
const cwd = options.cwd || process.cwd();
|
|
35
|
+
const configPath = parsed.options.config;
|
|
36
|
+
const environment = parsed.options.env;
|
|
37
|
+
const subcommand = parsed.args[0] ?? "print";
|
|
38
|
+
const format = parsed.options.format ?? "devflare";
|
|
39
|
+
const phaseOption = parsed.options.local === true ? "local" : parsed.options.phase ?? "deploy";
|
|
40
|
+
if (subcommand !== "print") {
|
|
41
|
+
logger.error(`Unknown config subcommand: ${subcommand}`);
|
|
42
|
+
logger.info("Supported subcommands: print");
|
|
43
|
+
return { exitCode: 1 };
|
|
44
|
+
}
|
|
45
|
+
if (!isSupportedFormat(format)) {
|
|
46
|
+
logger.error(`Unsupported config format: ${format}`);
|
|
47
|
+
logger.info("Supported formats: devflare, wrangler");
|
|
48
|
+
return { exitCode: 1 };
|
|
49
|
+
}
|
|
50
|
+
if (!isSupportedPhase(phaseOption)) {
|
|
51
|
+
logger.error(`Unsupported config phase: ${phaseOption}`);
|
|
52
|
+
logger.info("Supported phases: build, local, deploy");
|
|
53
|
+
return { exitCode: 1 };
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const resolvedConfig = await loadConfigForPhase({
|
|
57
|
+
cwd,
|
|
58
|
+
configPath,
|
|
59
|
+
environment,
|
|
60
|
+
phase: phaseOption
|
|
61
|
+
});
|
|
62
|
+
const output = format === "wrangler" ? phaseOption === "build" ? compileBuildConfig(resolvedConfig, void 0, { alreadyResolved: true }) : compileConfig(resolvedConfig) : resolvedConfig;
|
|
63
|
+
const text = JSON.stringify(output, null, " ");
|
|
64
|
+
if (!options.silent) process.stdout.write(`${text}\n`);
|
|
65
|
+
return {
|
|
66
|
+
exitCode: 0,
|
|
67
|
+
output: text
|
|
68
|
+
};
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (error instanceof Error) {
|
|
71
|
+
logger.error("Config command failed:", error.message);
|
|
72
|
+
if (error instanceof ConfigResourceResolutionError) logger.info("For offline inspection, run `devflare config --phase local` or `devflare config --phase build --format wrangler`.");
|
|
73
|
+
}
|
|
74
|
+
return { exitCode: 1 };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { runConfigCommand };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { i as resolveConfigPath } from "./loader-OQ2AWpqm.js";
|
|
2
|
+
import { i as findFiles } from "./glob-CmQOvunB.js";
|
|
3
|
+
import { stat } from "node:fs/promises";
|
|
4
|
+
//#region src/cli/config-path.ts
|
|
5
|
+
const CONFIG_FILE_EXTENSIONS = [
|
|
6
|
+
".ts",
|
|
7
|
+
".mts",
|
|
8
|
+
".js",
|
|
9
|
+
".mjs"
|
|
10
|
+
];
|
|
11
|
+
const SUPPORTED_CONFIG_FILENAMES = CONFIG_FILE_EXTENSIONS.map((extension) => `devflare.config${extension}`);
|
|
12
|
+
function hasKnownConfigExtension(filePath) {
|
|
13
|
+
return CONFIG_FILE_EXTENSIONS.some((extension) => filePath.endsWith(extension));
|
|
14
|
+
}
|
|
15
|
+
async function getExistingFilePath(filePath) {
|
|
16
|
+
try {
|
|
17
|
+
return (await stat(filePath)).isFile() ? filePath : null;
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function resolveConfigCandidatePath(candidatePath) {
|
|
23
|
+
const candidates = [candidatePath];
|
|
24
|
+
if (!hasKnownConfigExtension(candidatePath)) for (const extension of CONFIG_FILE_EXTENSIONS) candidates.push(`${candidatePath}${extension}`);
|
|
25
|
+
for (const candidate of candidates) {
|
|
26
|
+
const existingFilePath = await getExistingFilePath(candidate);
|
|
27
|
+
if (existingFilePath) return existingFilePath;
|
|
28
|
+
}
|
|
29
|
+
return await resolveConfigPath(candidatePath) ?? null;
|
|
30
|
+
}
|
|
31
|
+
async function findConfigPathsUnderDirectory(rootDir) {
|
|
32
|
+
const matches = await findFiles([...SUPPORTED_CONFIG_FILENAMES, ...SUPPORTED_CONFIG_FILENAMES.map((filename) => `**/${filename}`)], {
|
|
33
|
+
cwd: rootDir,
|
|
34
|
+
absolute: true
|
|
35
|
+
});
|
|
36
|
+
return [...new Set(matches)].sort((left, right) => left.localeCompare(right));
|
|
37
|
+
}
|
|
38
|
+
function formatSupportedConfigFilenames() {
|
|
39
|
+
return SUPPORTED_CONFIG_FILENAMES.join(", ");
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { formatSupportedConfigFilenames as n, resolveConfigCandidatePath as r, findConfigPathsUnderDirectory as t };
|