devflare 1.0.0-next.5 → 1.0.0-next.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LLM.md +17312 -2139
- package/README.md +394 -605
- package/bin/devflare.js +30 -14
- package/dist/_chunks/account-BI3WZMDy.js +462 -0
- package/dist/_chunks/account-resources-CsmVowJp.js +159 -0
- package/dist/_chunks/ai-CBEuLdoP.js +322 -0
- package/dist/_chunks/api-TzdliH-6.js +568 -0
- package/dist/_chunks/build-artifacts-DU5V0J0Z.js +483 -0
- package/dist/_chunks/build-e0KR38-4.js +24 -0
- package/dist/_chunks/cli-DuUz10Mn.js +1163 -0
- package/dist/_chunks/cloudflare-BaloqI3H.js +157 -0
- package/dist/_chunks/colors-DiK6wPJ5.js +13 -0
- package/dist/_chunks/command-utils-DA0Qx9_K.js +45 -0
- package/dist/_chunks/compiler-Zw16C9Pi.js +489 -0
- package/dist/_chunks/config-Brju62xy.js +78 -0
- package/dist/_chunks/config-path-DaL1ylZ_.js +42 -0
- package/dist/_chunks/context-CX50Y2Kb.js +2250 -0
- package/dist/_chunks/decorators-QmV57ixr.js +19 -0
- package/dist/_chunks/dependencies-C2oxFjU_.js +57 -0
- package/dist/_chunks/deploy-B-Kku1Vk.js +1032 -0
- package/dist/_chunks/dev-D4e_RRZn.js +3471 -0
- package/dist/_chunks/doctor-jm_K4dxL.js +219 -0
- package/dist/_chunks/durable-object-DMtH0XYX.js +234 -0
- package/dist/_chunks/env-S0_nMVz1.js +125 -0
- package/dist/_chunks/family-_9-mGSfO.js +143 -0
- package/dist/_chunks/generated-artifacts-dMJY4KAt.js +32 -0
- package/dist/_chunks/glob-CmQOvunB.js +56 -0
- package/dist/_chunks/init-DnkJOmpW.js +165 -0
- package/dist/_chunks/loader-Cr0_OWPy.js +1288 -0
- package/dist/_chunks/local-dev-vars-CTSa-wvF.js +81 -0
- package/dist/_chunks/local-hyperdrive-CJ90j46O.js +119 -0
- package/dist/_chunks/local-media-bindings-DsAW4AMF.js +335 -0
- package/dist/_chunks/local-secrets-DMPkmOn3.js +123 -0
- package/dist/_chunks/local-workflow-entrypoints-Cq_WJajd.js +90 -0
- package/dist/_chunks/login-FjTAAQbi.js +51 -0
- package/dist/_chunks/package-metadata-DjHBLB-z.js +39 -0
- package/dist/_chunks/preferences-BKp_7XJx.js +241 -0
- package/dist/_chunks/preview-C3Cdr8an.js +462 -0
- package/dist/_chunks/preview-registry-ClAbLTHH.js +1186 -0
- package/dist/_chunks/preview-resources-CGMBjsYB.js +359 -0
- package/dist/_chunks/previews-C7hs9-BT.js +1134 -0
- package/dist/_chunks/productions-T9Als4fE.js +411 -0
- package/dist/_chunks/ref-CYJNAAe_.js +178 -0
- package/dist/_chunks/remote-CZnP-HLJ.js +79 -0
- package/dist/_chunks/remote-config-D39BY9ji.js +132 -0
- package/dist/_chunks/resolve-package-qizBfCIm.js +152 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-BFYCqHb-.js +833 -0
- package/dist/_chunks/runtime-DL-Nz3k8.js +550 -0
- package/dist/_chunks/schema-normalization-BCwTLTGp.js +660 -0
- package/dist/_chunks/secrets-DIpJGe6C.js +95 -0
- package/dist/_chunks/tail-IY-ijYmv.js +239 -0
- package/dist/_chunks/token-Dmi0KXyX.js +333 -0
- package/dist/_chunks/tokens-iVcgNXi-.js +221 -0
- package/dist/_chunks/types-DoKsMYfm.js +484 -0
- package/dist/_chunks/ui-BUoZApvE.js +103 -0
- package/dist/_chunks/usage-BBTGzjon.js +272 -0
- package/dist/_chunks/vite-CGtVNf5E.js +1267 -0
- package/dist/_chunks/vite-utils-OVLMV605.js +183 -0
- package/dist/_chunks/worker-BEZI4od1.js +410 -0
- package/dist/_chunks/worker-bundler-dTTnYU3n.js +458 -0
- package/dist/_chunks/worker-entrypoint-CQW77lG8.js +247 -0
- package/dist/_chunks/workerName-CFJsLZA-.js +23 -0
- package/dist/bridge/client.d.ts +49 -7
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/gateway-runtime.d.ts +8 -0
- package/dist/bridge/gateway-runtime.d.ts.map +1 -0
- package/dist/bridge/index.d.ts +6 -6
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/log.d.ts +5 -0
- package/dist/bridge/log.d.ts.map +1 -0
- package/dist/bridge/miniflare.d.ts +82 -2
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +12 -11
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/server.d.ts +2 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/bridge/v2/body-streams.d.ts +53 -0
- package/dist/bridge/v2/body-streams.d.ts.map +1 -0
- package/dist/bridge/v2/codec.d.ts +106 -0
- package/dist/bridge/v2/codec.d.ts.map +1 -0
- package/dist/bridge/v2/control-messages.d.ts +46 -0
- package/dist/bridge/v2/control-messages.d.ts.map +1 -0
- package/dist/bridge/v2/frames.d.ts +109 -0
- package/dist/bridge/v2/frames.d.ts.map +1 -0
- package/dist/bridge/v2/index.d.ts +11 -0
- package/dist/bridge/v2/index.d.ts.map +1 -0
- package/dist/bridge/v2/serialization.d.ts +48 -0
- package/dist/bridge/v2/serialization.d.ts.map +1 -0
- package/dist/bridge/v2/transport.d.ts +31 -0
- package/dist/bridge/v2/transport.d.ts.map +1 -0
- package/dist/bridge/v2/value-codec.d.ts +61 -0
- package/dist/bridge/v2/value-codec.d.ts.map +1 -0
- package/dist/bridge/{serialization.d.ts → v2/value-serialization.d.ts} +40 -18
- package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
- package/dist/bridge/{protocol.d.ts → v2/wire.d.ts} +32 -8
- package/dist/bridge/v2/wire.d.ts.map +1 -0
- package/dist/bridge/v2/ws-relay.d.ts +53 -0
- package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
- package/dist/browser-shim/handler.d.ts +2 -2
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser-shim/index.d.ts +2 -2
- package/dist/browser-shim/server.d.ts +63 -0
- package/dist/browser-shim/server.d.ts.map +1 -1
- package/dist/browser.d.ts +5411 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +80 -0
- package/dist/bundler/defaults.d.ts +23 -0
- package/dist/bundler/defaults.d.ts.map +1 -0
- package/dist/bundler/do-bundler.d.ts +7 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/index.d.ts +3 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +53 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +13 -0
- package/dist/bundler/worker-bundler.d.ts.map +1 -0
- package/dist/bundler/worker-compat.d.ts +4 -0
- package/dist/bundler/worker-compat.d.ts.map +1 -0
- package/dist/cli/build-manifest.d.ts +66 -0
- package/dist/cli/build-manifest.d.ts.map +1 -0
- package/dist/cli/command-utils.d.ts +18 -0
- package/dist/cli/command-utils.d.ts.map +1 -0
- package/dist/cli/commands/account.d.ts +2 -2
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/ai.d.ts +1 -1
- package/dist/cli/commands/ai.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +40 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts +2 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/deploy/metadata.d.ts +18 -0
- package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
- package/dist/cli/commands/deploy/prepare.d.ts +23 -0
- package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
- package/dist/cli/commands/deploy/runtime.d.ts +4 -0
- package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
- package/dist/cli/commands/deploy/verification.d.ts +36 -0
- package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
- package/dist/cli/commands/deploy.d.ts +2 -2
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts +9 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -2
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/family.d.ts +10 -0
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/render.d.ts +8 -0
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/theme.d.ts +10 -0
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/types.d.ts +70 -0
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
- package/dist/cli/commands/previews.d.ts +4 -0
- package/dist/cli/commands/previews.d.ts.map +1 -0
- package/dist/cli/commands/productions.d.ts +4 -0
- package/dist/cli/commands/productions.d.ts.map +1 -0
- package/dist/cli/commands/remote.d.ts +1 -1
- package/dist/cli/commands/remote.d.ts.map +1 -1
- package/dist/cli/commands/secrets.d.ts +4 -0
- package/dist/cli/commands/secrets.d.ts.map +1 -0
- package/dist/cli/commands/tail.d.ts +44 -0
- package/dist/cli/commands/tail.d.ts.map +1 -0
- package/dist/cli/commands/token.d.ts +4 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +121 -0
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/models.d.ts +27 -0
- package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
- package/dist/cli/commands/types.d.ts +2 -2
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +4 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/config-path.d.ts +6 -0
- package/dist/cli/config-path.d.ts.map +1 -0
- package/dist/cli/dependencies.d.ts +2 -1
- package/dist/cli/dependencies.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/gradual-deploy.d.ts +49 -0
- package/dist/cli/gradual-deploy.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/package-metadata.d.ts +16 -0
- package/dist/cli/package-metadata.d.ts.map +1 -0
- package/dist/cli/preview-bindings.d.ts +49 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +10 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/cli/ui.d.ts +37 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/workspace-build-guard.d.ts +14 -0
- package/dist/cli/workspace-build-guard.d.ts.map +1 -0
- package/dist/cli/wrangler-auth.d.ts +1 -1
- package/dist/cloudflare/account-core.d.ts +6 -0
- package/dist/cloudflare/account-core.d.ts.map +1 -0
- package/dist/cloudflare/account-resources.d.ts +40 -0
- package/dist/cloudflare/account-resources.d.ts.map +1 -0
- package/dist/cloudflare/account-status.d.ts +11 -0
- package/dist/cloudflare/account-status.d.ts.map +1 -0
- package/dist/cloudflare/account-workers.d.ts +14 -0
- package/dist/cloudflare/account-workers.d.ts.map +1 -0
- package/dist/cloudflare/account.d.ts +7 -64
- package/dist/cloudflare/account.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts +71 -3
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/auth.d.ts +1 -1
- package/dist/cloudflare/auth.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +61 -6
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -13
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
- package/dist/cloudflare/kv-namespace.d.ts +4 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
- package/dist/cloudflare/preferences.d.ts +7 -0
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
- package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-records.d.ts +4 -0
- package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
- package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-store.d.ts +14 -0
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
- package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-types.d.ts +103 -0
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry.d.ts +42 -0
- package/dist/cloudflare/preview-registry.d.ts.map +1 -0
- package/dist/cloudflare/preview-urls.d.ts +3 -0
- package/dist/cloudflare/preview-urls.d.ts.map +1 -0
- package/dist/cloudflare/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/remote-config.d.ts.map +1 -1
- package/dist/cloudflare/tokens.d.ts +44 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +124 -7
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts +31 -3
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/binding-resolution-helpers.d.ts +41 -0
- package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
- package/dist/config/compatibility.d.ts +3 -0
- package/dist/config/compatibility.d.ts.map +1 -0
- package/dist/config/compiler/bindings.d.ts +14 -0
- package/dist/config/compiler/bindings.d.ts.map +1 -0
- package/dist/config/compiler/core-helpers.d.ts +6 -0
- package/dist/config/compiler/core-helpers.d.ts.map +1 -0
- package/dist/config/compiler/do-workers.d.ts +34 -0
- package/dist/config/compiler/do-workers.d.ts.map +1 -0
- package/dist/config/compiler/paths.d.ts +18 -0
- package/dist/config/compiler/paths.d.ts.map +1 -0
- package/dist/config/compiler/types.d.ts +298 -0
- package/dist/config/compiler/types.d.ts.map +1 -0
- package/dist/config/compiler.d.ts +22 -134
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/cron.d.ts +19 -0
- package/dist/config/cron.d.ts.map +1 -0
- package/dist/config/define.d.ts +8 -5
- package/dist/config/define.d.ts.map +1 -1
- package/dist/config/deploy-resources.d.ts +58 -0
- package/dist/config/deploy-resources.d.ts.map +1 -0
- package/dist/config/env-vars.d.ts +309 -0
- package/dist/config/env-vars.d.ts.map +1 -0
- package/dist/config/framework-providers.d.ts +9 -0
- package/dist/config/framework-providers.d.ts.map +1 -0
- package/dist/config/index.d.ts +12 -5
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts +2 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/local-dev-vars.d.ts +15 -0
- package/dist/config/local-dev-vars.d.ts.map +1 -0
- package/dist/config/preview-resources.d.ts +83 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +29 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +16 -25
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve-phased.d.ts +72 -0
- package/dist/config/resolve-phased.d.ts.map +1 -0
- package/dist/config/resolve.d.ts +11 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resource-resolution.d.ts +80 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- package/dist/config/schema-bindings.d.ts +2025 -0
- package/dist/config/schema-bindings.d.ts.map +1 -0
- package/dist/config/schema-build.d.ts +67 -0
- package/dist/config/schema-build.d.ts.map +1 -0
- package/dist/config/schema-env.d.ts +3579 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +265 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +508 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +508 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +767 -0
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
- package/dist/config/schema-types-bindings.d.ts +293 -0
- package/dist/config/schema-types-bindings.d.ts.map +1 -0
- package/dist/config/schema-types-build.d.ts +86 -0
- package/dist/config/schema-types-build.d.ts.map +1 -0
- package/dist/config/schema-types-runtime.d.ts +917 -0
- package/dist/config/schema-types-runtime.d.ts.map +1 -0
- package/dist/config/schema-types.d.ts +424 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +5324 -2011
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/service-bindings-validation.d.ts +36 -0
- package/dist/config/service-bindings-validation.d.ts.map +1 -0
- package/dist/config-entry.d.ts +7 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-entry.js +3 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/decorators/index.d.ts +2 -2
- package/dist/decorators/index.js +2 -9
- package/dist/dev-server/d1-migrations.d.ts +36 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/dev-server-state.d.ts +59 -0
- package/dist/dev-server/dev-server-state.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +21 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/index.d.ts +1 -1
- package/dist/dev-server/miniflare-bindings.d.ts +81 -0
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts +36 -0
- package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -0
- package/dist/dev-server/miniflare-log.d.ts +20 -0
- package/dist/dev-server/miniflare-log.d.ts.map +1 -0
- package/dist/dev-server/miniflare-worker-config.d.ts +82 -0
- package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
- package/dist/dev-server/reload-queue.d.ts +13 -0
- package/dist/dev-server/reload-queue.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts +8 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
- package/dist/dev-server/server-startup-helpers.d.ts +84 -0
- package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
- package/dist/dev-server/server.d.ts +2 -0
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +15 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +19 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts +17 -0
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
- package/dist/dev-server/worker-surface-paths.d.ts +6 -0
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/index.d.ts +8 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -298
- package/dist/runtime/context-events.d.ts +13 -0
- package/dist/runtime/context-events.d.ts.map +1 -0
- package/dist/runtime/context-types.d.ts +82 -0
- package/dist/runtime/context-types.d.ts.map +1 -0
- package/dist/runtime/context.d.ts +20 -44
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +70 -55
- package/dist/runtime/exports.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +10 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -111
- package/dist/runtime/middleware.d.ts +119 -67
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/runtime/router/index.d.ts +7 -0
- package/dist/runtime/router/index.d.ts.map +1 -0
- package/dist/runtime/router/types.d.ts +24 -0
- package/dist/runtime/router/types.d.ts.map +1 -0
- package/dist/runtime/validation.d.ts +18 -4
- package/dist/runtime/validation.d.ts.map +1 -1
- package/dist/secrets/local-secrets.d.ts +46 -0
- package/dist/secrets/local-secrets.d.ts.map +1 -0
- package/dist/shims/local-hyperdrive.d.ts +12 -0
- package/dist/shims/local-hyperdrive.d.ts.map +1 -0
- package/dist/shims/local-media-bindings.d.ts +19 -0
- package/dist/shims/local-media-bindings.d.ts.map +1 -0
- package/dist/shims/local-worker-loader.d.ts +3 -0
- package/dist/shims/local-worker-loader.d.ts.map +1 -0
- package/dist/sveltekit/index.d.ts +1 -1
- package/dist/sveltekit/index.d.ts.map +1 -1
- package/dist/sveltekit/index.js +313 -167
- package/dist/sveltekit/local-bindings.d.ts +4 -0
- package/dist/sveltekit/local-bindings.d.ts.map +1 -0
- package/dist/sveltekit/platform.d.ts +20 -2
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/ai-search.d.ts +39 -0
- package/dist/test/ai-search.d.ts.map +1 -0
- package/dist/test/alarm.d.ts +55 -0
- package/dist/test/alarm.d.ts.map +1 -0
- package/dist/test/binding-hints.d.ts +10 -0
- package/dist/test/binding-hints.d.ts.map +1 -0
- package/dist/test/cf.d.ts +71 -35
- package/dist/test/cf.d.ts.map +1 -1
- package/dist/test/containers.d.ts +87 -0
- package/dist/test/containers.d.ts.map +1 -0
- package/dist/test/email.d.ts +16 -7
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +20 -21
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4971 -70
- package/dist/test/offline-bindings.d.ts +115 -0
- package/dist/test/offline-bindings.d.ts.map +1 -0
- package/dist/test/queue.d.ts.map +1 -1
- package/dist/test/remote-ai.d.ts.map +1 -1
- package/dist/test/remote-cloudflare.d.ts +13 -0
- package/dist/test/remote-cloudflare.d.ts.map +1 -0
- package/dist/test/remote-vectorize.d.ts.map +1 -1
- package/dist/test/resolve-service-bindings.d.ts +64 -4
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +14 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-bindings.d.ts +13 -0
- package/dist/test/simple-context-bindings.d.ts.map +1 -0
- package/dist/test/simple-context-durable-objects.d.ts +6 -0
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
- package/dist/test/simple-context-env.d.ts +35 -0
- package/dist/test/simple-context-env.d.ts.map +1 -0
- package/dist/test/simple-context-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
- package/dist/test/simple-context-handlers.d.ts +12 -0
- package/dist/test/simple-context-handlers.d.ts.map +1 -0
- package/dist/test/simple-context-lifecycle.d.ts +32 -0
- package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
- package/dist/test/simple-context-mfconfig.d.ts +10 -0
- package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
- package/dist/test/simple-context-multi-worker.d.ts +16 -0
- package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
- package/dist/test/simple-context-paths.d.ts +40 -0
- package/dist/test/simple-context-paths.d.ts.map +1 -0
- package/dist/test/simple-context-runtime.d.ts +19 -0
- package/dist/test/simple-context-runtime.d.ts.map +1 -0
- package/dist/test/simple-context-startup.d.ts +11 -0
- package/dist/test/simple-context-startup.d.ts.map +1 -0
- package/dist/test/simple-context-transport.d.ts +14 -0
- package/dist/test/simple-context-transport.d.ts.map +1 -0
- package/dist/test/simple-context.d.ts +8 -27
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts +3 -2
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/analytics-engine.d.ts +22 -0
- package/dist/test/utilities/analytics-engine.d.ts.map +1 -0
- package/dist/test/utilities/artifacts.d.ts +11 -0
- package/dist/test/utilities/artifacts.d.ts.map +1 -0
- package/dist/test/utilities/context.d.ts +39 -0
- package/dist/test/utilities/context.d.ts.map +1 -0
- package/dist/test/utilities/d1.d.ts +21 -0
- package/dist/test/utilities/d1.d.ts.map +1 -0
- package/dist/test/utilities/env.d.ts +43 -0
- package/dist/test/utilities/env.d.ts.map +1 -0
- package/dist/test/utilities/kv.d.ts +11 -0
- package/dist/test/utilities/kv.d.ts.map +1 -0
- package/dist/test/utilities/media.d.ts +16 -0
- package/dist/test/utilities/media.d.ts.map +1 -0
- package/dist/test/utilities/platform.d.ts +41 -0
- package/dist/test/utilities/platform.d.ts.map +1 -0
- package/dist/test/utilities/queue.d.ts +5 -0
- package/dist/test/utilities/queue.d.ts.map +1 -0
- package/dist/test/utilities/r2.d.ts +2 -0
- package/dist/test/utilities/r2.d.ts.map +1 -0
- package/dist/test/utilities/stream-flagship.d.ts +27 -0
- package/dist/test/utilities/stream-flagship.d.ts.map +1 -0
- package/dist/test/utilities/vectorize.d.ts +38 -0
- package/dist/test/utilities/vectorize.d.ts.map +1 -0
- package/dist/test/utilities/workflows.d.ts +26 -0
- package/dist/test/utilities/workflows.d.ts.map +1 -0
- package/dist/test/utilities.d.ts +13 -98
- package/dist/test/utilities.d.ts.map +1 -1
- package/dist/test/worker.d.ts +6 -0
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/transform/durable-object.d.ts.map +1 -1
- package/dist/transform/index.d.ts +2 -2
- package/dist/transform/worker-entrypoint.d.ts +5 -0
- package/dist/transform/worker-entrypoint.d.ts.map +1 -1
- package/dist/utils/entrypoint-discovery.d.ts +6 -3
- package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
- package/dist/utils/glob.d.ts.map +1 -1
- package/dist/utils/resolve-package.d.ts.map +1 -1
- package/dist/utils/send-email.d.ts +15 -0
- package/dist/utils/send-email.d.ts.map +1 -0
- package/dist/utils/send-email.js +163 -0
- package/dist/vite/config-file.d.ts +25 -0
- package/dist/vite/config-file.d.ts.map +1 -0
- package/dist/vite/index.d.ts +3 -2
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +2 -339
- package/dist/vite/plugin-config-hook.d.ts +28 -0
- package/dist/vite/plugin-config-hook.d.ts.map +1 -0
- package/dist/vite/plugin-context.d.ts +27 -0
- package/dist/vite/plugin-context.d.ts.map +1 -0
- package/dist/vite/plugin-durable-objects.d.ts +18 -0
- package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
- package/dist/vite/plugin-programmatic.d.ts +44 -0
- package/dist/vite/plugin-programmatic.d.ts.map +1 -0
- package/dist/vite/plugin-service-bindings.d.ts +13 -0
- package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
- package/dist/vite/plugin-transform.d.ts +41 -0
- package/dist/vite/plugin-transform.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +10 -41
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-entry/composed-worker.d.ts +7 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -0
- package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
- package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
- package/dist/worker-entry/extensions.d.ts +5 -0
- package/dist/worker-entry/extensions.d.ts.map +1 -0
- package/dist/worker-entry/routes.d.ts +22 -0
- package/dist/worker-entry/routes.d.ts.map +1 -0
- package/dist/worker-entry/surface-paths.d.ts +26 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-entry/validate-fetch-style.d.ts +12 -0
- package/dist/worker-entry/validate-fetch-style.d.ts.map +1 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
- package/package.json +159 -116
- package/R2.md +0 -170
- package/dist/account-rvrj687w.js +0 -397
- package/dist/ai-dx4fr9jh.js +0 -107
- package/dist/bridge/protocol.d.ts.map +0 -1
- package/dist/bridge/serialization.d.ts.map +0 -1
- package/dist/browser-shim/worker.d.ts +0 -14
- package/dist/browser-shim/worker.d.ts.map +0 -1
- package/dist/build-mnf6v8gd.js +0 -53
- package/dist/deploy-nhceck39.js +0 -70
- package/dist/dev-b9dmrj7b.js +0 -2417
- package/dist/doctor-fmgb3d28.js +0 -190
- package/dist/durable-object-t4kbb0yt.js +0 -13
- package/dist/index-07q6yxyc.js +0 -168
- package/dist/index-18hvb6gb.js +0 -194
- package/dist/index-1xpj0m4r.js +0 -57
- package/dist/index-37x76zdn.js +0 -4
- package/dist/index-3t6rypgc.js +0 -13
- package/dist/index-67qcae0f.js +0 -183
- package/dist/index-a855bdsx.js +0 -18
- package/dist/index-d8bdkx2h.js +0 -109
- package/dist/index-ep3445yc.js +0 -2225
- package/dist/index-gz1gndna.js +0 -307
- package/dist/index-hcex3rgh.js +0 -266
- package/dist/index-m2q41jwa.js +0 -462
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-pf5s73n9.js +0 -1413
- package/dist/index-rbht7m9r.js +0 -36
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- package/dist/index-z14anrqp.js +0 -226
- package/dist/init-f9mgmew3.js +0 -186
- package/dist/remote-q59qk463.js +0 -97
- package/dist/test/bridge-context.d.ts +0 -76
- package/dist/test/bridge-context.d.ts.map +0 -1
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
- package/dist/types-5nyrz1sz.js +0 -454
- package/dist/worker-entrypoint-m9th0rg0.js +0 -13
package/dist/index-tk6ej9dj.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_ENTRYPOINT_PATTERN,
|
|
3
|
-
findFiles
|
|
4
|
-
} from "./index-rbht7m9r.js";
|
|
5
|
-
import {
|
|
6
|
-
__require
|
|
7
|
-
} from "./index-37x76zdn.js";
|
|
8
|
-
|
|
9
|
-
// src/utils/entrypoint-discovery.ts
|
|
10
|
-
import { readdirSync, readFileSync } from "fs";
|
|
11
|
-
import { join } from "path";
|
|
12
|
-
var ENTRYPOINT_CLASS_PATTERN = /export\s+class\s+(\w+)\s+extends\s+WorkerEntrypoint/g;
|
|
13
|
-
function findEntrypointClasses(code) {
|
|
14
|
-
const classes = [];
|
|
15
|
-
ENTRYPOINT_CLASS_PATTERN.lastIndex = 0;
|
|
16
|
-
let match;
|
|
17
|
-
while ((match = ENTRYPOINT_CLASS_PATTERN.exec(code)) !== null) {
|
|
18
|
-
classes.push(match[1]);
|
|
19
|
-
}
|
|
20
|
-
return classes;
|
|
21
|
-
}
|
|
22
|
-
var EP_FILE_PATTERN = /^ep\.[^.]+\.ts$/;
|
|
23
|
-
function discoverEntrypointsSync(dir) {
|
|
24
|
-
const discovered = [];
|
|
25
|
-
try {
|
|
26
|
-
const files = readdirSync(dir, { withFileTypes: true });
|
|
27
|
-
for (const file of files) {
|
|
28
|
-
if (file.isFile() && EP_FILE_PATTERN.test(file.name)) {
|
|
29
|
-
const filePath = join(dir, file.name);
|
|
30
|
-
try {
|
|
31
|
-
const code = readFileSync(filePath, "utf-8");
|
|
32
|
-
const classNames = findEntrypointClasses(code);
|
|
33
|
-
for (const className of classNames) {
|
|
34
|
-
discovered.push({ className, filePath });
|
|
35
|
-
}
|
|
36
|
-
} catch {}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
} catch {}
|
|
40
|
-
return discovered;
|
|
41
|
-
}
|
|
42
|
-
async function discoverEntrypointsAsync(cwd, pattern = DEFAULT_ENTRYPOINT_PATTERN) {
|
|
43
|
-
const fs = await import("node:fs/promises");
|
|
44
|
-
const discovered = [];
|
|
45
|
-
const files = await findFiles(pattern, { cwd });
|
|
46
|
-
for (const filePath of files) {
|
|
47
|
-
try {
|
|
48
|
-
const code = await fs.readFile(filePath, "utf-8");
|
|
49
|
-
const classNames = findEntrypointClasses(code);
|
|
50
|
-
for (const className of classNames) {
|
|
51
|
-
discovered.push({ className, filePath });
|
|
52
|
-
}
|
|
53
|
-
} catch {}
|
|
54
|
-
}
|
|
55
|
-
return discovered;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// src/utils/resolve-package.ts
|
|
59
|
-
import { resolve, dirname } from "pathe";
|
|
60
|
-
import { readFileSync as readFileSync2, existsSync } from "node:fs";
|
|
61
|
-
function resolvePackageSpecifier(specifier, fromDir) {
|
|
62
|
-
if (specifier.startsWith(".") || specifier.startsWith("/") || /^[A-Za-z]:/.test(specifier)) {
|
|
63
|
-
return resolve(fromDir, specifier);
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
const parts = specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0];
|
|
67
|
-
const subpath = specifier.startsWith("@") ? specifier.split("/").slice(2).join("/") : specifier.split("/").slice(1).join("/");
|
|
68
|
-
const pkgJsonPath = __require.resolve(`${parts}/package.json`, { paths: [fromDir] });
|
|
69
|
-
const pkgDir = dirname(pkgJsonPath);
|
|
70
|
-
if (subpath) {
|
|
71
|
-
const pkgJson = JSON.parse(readFileSync2(pkgJsonPath, "utf-8"));
|
|
72
|
-
const exportPath = pkgJson.exports?.[`./${subpath}`];
|
|
73
|
-
if (exportPath) {
|
|
74
|
-
const targetPath = typeof exportPath === "string" ? exportPath : exportPath.default || exportPath.import;
|
|
75
|
-
return resolve(pkgDir, targetPath);
|
|
76
|
-
}
|
|
77
|
-
const directPath = resolve(pkgDir, `${subpath}.ts`);
|
|
78
|
-
if (existsSync(directPath))
|
|
79
|
-
return directPath;
|
|
80
|
-
const withExt = resolve(pkgDir, subpath);
|
|
81
|
-
if (existsSync(withExt))
|
|
82
|
-
return withExt;
|
|
83
|
-
if (existsSync(`${withExt}.ts`))
|
|
84
|
-
return `${withExt}.ts`;
|
|
85
|
-
if (existsSync(`${withExt}.js`))
|
|
86
|
-
return `${withExt}.js`;
|
|
87
|
-
}
|
|
88
|
-
return pkgDir;
|
|
89
|
-
} catch {
|
|
90
|
-
return resolve(fromDir, specifier);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export { discoverEntrypointsSync, discoverEntrypointsAsync, resolvePackageSpecifier };
|
package/dist/index-z14anrqp.js
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
// src/transform/worker-entrypoint.ts
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
import MagicString from "magic-string";
|
|
4
|
-
function findExportedFunctions(code) {
|
|
5
|
-
const functions = [];
|
|
6
|
-
const sourceFile = ts.createSourceFile("worker.ts", code, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
7
|
-
function visit(node) {
|
|
8
|
-
if (ts.isFunctionDeclaration(node) && node.name) {
|
|
9
|
-
const modifiers = ts.getModifiers(node);
|
|
10
|
-
const isExported = modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
11
|
-
const isDefault = modifiers?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword);
|
|
12
|
-
if (isExported) {
|
|
13
|
-
const isAsync = modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword) ?? false;
|
|
14
|
-
const funcName = isDefault ? "fetch" : node.name.text;
|
|
15
|
-
const params = node.parameters.map((p) => code.substring(p.getStart(sourceFile), p.getEnd())).join(", ");
|
|
16
|
-
const returnType = node.type ? code.substring(node.type.getStart(sourceFile), node.type.getEnd()) : undefined;
|
|
17
|
-
functions.push({
|
|
18
|
-
name: funcName,
|
|
19
|
-
isAsync,
|
|
20
|
-
params,
|
|
21
|
-
returnType,
|
|
22
|
-
start: node.getStart(sourceFile),
|
|
23
|
-
end: node.getEnd(),
|
|
24
|
-
isDefault
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (ts.isFunctionDeclaration(node) && !node.name) {
|
|
29
|
-
const modifiers = ts.getModifiers(node);
|
|
30
|
-
const isExported = modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
31
|
-
const isDefault = modifiers?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword);
|
|
32
|
-
if (isExported && isDefault) {
|
|
33
|
-
const isAsync = modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword) ?? false;
|
|
34
|
-
const params = node.parameters.map((p) => code.substring(p.getStart(sourceFile), p.getEnd())).join(", ");
|
|
35
|
-
const returnType = node.type ? code.substring(node.type.getStart(sourceFile), node.type.getEnd()) : undefined;
|
|
36
|
-
functions.push({
|
|
37
|
-
name: "fetch",
|
|
38
|
-
isAsync,
|
|
39
|
-
params,
|
|
40
|
-
returnType,
|
|
41
|
-
start: node.getStart(sourceFile),
|
|
42
|
-
end: node.getEnd(),
|
|
43
|
-
isDefault: true
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (ts.isVariableStatement(node)) {
|
|
48
|
-
const modifiers = ts.getModifiers(node);
|
|
49
|
-
const isExported = modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
50
|
-
if (isExported) {
|
|
51
|
-
for (const decl of node.declarationList.declarations) {
|
|
52
|
-
if (ts.isIdentifier(decl.name) && decl.initializer) {
|
|
53
|
-
let funcExpr;
|
|
54
|
-
if (ts.isFunctionExpression(decl.initializer)) {
|
|
55
|
-
funcExpr = decl.initializer;
|
|
56
|
-
} else if (ts.isArrowFunction(decl.initializer)) {
|
|
57
|
-
funcExpr = decl.initializer;
|
|
58
|
-
}
|
|
59
|
-
if (funcExpr) {
|
|
60
|
-
const modifiersArr = ts.getModifiers(funcExpr);
|
|
61
|
-
const isAsync = modifiersArr?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword) ?? (ts.isArrowFunction(funcExpr) && funcExpr.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword)) ?? false;
|
|
62
|
-
const params = funcExpr.parameters.map((p) => code.substring(p.getStart(sourceFile), p.getEnd())).join(", ");
|
|
63
|
-
const returnType = funcExpr.type ? code.substring(funcExpr.type.getStart(sourceFile), funcExpr.type.getEnd()) : undefined;
|
|
64
|
-
functions.push({
|
|
65
|
-
name: decl.name.text,
|
|
66
|
-
isAsync,
|
|
67
|
-
params,
|
|
68
|
-
returnType,
|
|
69
|
-
start: node.getStart(sourceFile),
|
|
70
|
-
end: node.getEnd()
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
ts.forEachChild(node, visit);
|
|
78
|
-
}
|
|
79
|
-
visit(sourceFile);
|
|
80
|
-
return functions;
|
|
81
|
-
}
|
|
82
|
-
function shouldTransformWorker(code, filePath) {
|
|
83
|
-
if (!filePath.endsWith("worker.ts") && !filePath.endsWith("worker.js")) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
const functions = findExportedFunctions(code);
|
|
87
|
-
return functions.length > 0;
|
|
88
|
-
}
|
|
89
|
-
function transformWorkerEntrypoint(code, id, options = {}) {
|
|
90
|
-
const className = options.className ?? "Worker";
|
|
91
|
-
const injectContext = options.injectContext ?? true;
|
|
92
|
-
const functions = findExportedFunctions(code);
|
|
93
|
-
if (functions.length === 0) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
const fetchFn = functions.find((f) => f.name === "fetch");
|
|
97
|
-
const rpcMethods = functions.filter((f) => f.name !== "fetch");
|
|
98
|
-
const s = new MagicString(code);
|
|
99
|
-
const importStatement = `import { WorkerEntrypoint } from 'cloudflare:workers'
|
|
100
|
-
`;
|
|
101
|
-
if (injectContext) {
|
|
102
|
-
s.prepend(`import { runWithContext } from 'devflare/runtime'
|
|
103
|
-
`);
|
|
104
|
-
}
|
|
105
|
-
s.prepend(importStatement);
|
|
106
|
-
for (const fn of functions) {
|
|
107
|
-
const fnCode = code.substring(fn.start, fn.end);
|
|
108
|
-
const internalName = fn.name === "fetch" ? "__originalFetch" : `__original_${fn.name}`;
|
|
109
|
-
if (fn.isDefault) {
|
|
110
|
-
const replacement = fnCode.replace(/^export\s+default\s+(async\s+)?function\s*/, (_, asyncKw) => `const ${internalName} = ${asyncKw || ""}function `);
|
|
111
|
-
s.overwrite(fn.start, fn.end, replacement);
|
|
112
|
-
} else if (fnCode.startsWith("export function") || fnCode.startsWith("export async function")) {
|
|
113
|
-
const replacement = fnCode.replace(/^export\s+(async\s+)?function\s+\w+/, (_, asyncKw) => `${asyncKw || ""}function ${internalName}`);
|
|
114
|
-
s.overwrite(fn.start, fn.end, replacement);
|
|
115
|
-
} else if (fnCode.startsWith("export const")) {
|
|
116
|
-
const replacement = fnCode.replace(/^export\s+const\s+\w+/, () => `const ${internalName}`);
|
|
117
|
-
s.overwrite(fn.start, fn.end, replacement);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
let classBody = `
|
|
121
|
-
|
|
122
|
-
// ============ Devflare WorkerEntrypoint ============
|
|
123
|
-
class ${className} extends WorkerEntrypoint {
|
|
124
|
-
`;
|
|
125
|
-
if (fetchFn) {
|
|
126
|
-
if (injectContext) {
|
|
127
|
-
classBody += ` async fetch(request: Request): Promise<Response> {
|
|
128
|
-
`;
|
|
129
|
-
classBody += ` return runWithContext(
|
|
130
|
-
`;
|
|
131
|
-
classBody += ` this.env,
|
|
132
|
-
`;
|
|
133
|
-
classBody += ` this.ctx,
|
|
134
|
-
`;
|
|
135
|
-
classBody += ` request,
|
|
136
|
-
`;
|
|
137
|
-
classBody += ` () => __originalFetch(request, this.env, this.ctx),
|
|
138
|
-
`;
|
|
139
|
-
classBody += ` 'fetch'
|
|
140
|
-
`;
|
|
141
|
-
classBody += ` )
|
|
142
|
-
`;
|
|
143
|
-
classBody += ` }
|
|
144
|
-
`;
|
|
145
|
-
} else {
|
|
146
|
-
classBody += ` async fetch(request: Request): Promise<Response> {
|
|
147
|
-
`;
|
|
148
|
-
classBody += ` return __originalFetch(request, this.env, this.ctx)
|
|
149
|
-
`;
|
|
150
|
-
classBody += ` }
|
|
151
|
-
`;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
for (const fn of rpcMethods) {
|
|
155
|
-
const asyncPrefix = fn.isAsync ? "async " : "";
|
|
156
|
-
const returnType = fn.returnType ? `: ${fn.returnType}` : "";
|
|
157
|
-
const paramNames = extractParamNames(fn.params);
|
|
158
|
-
classBody += `
|
|
159
|
-
${asyncPrefix}${fn.name}(${fn.params})${returnType} {
|
|
160
|
-
`;
|
|
161
|
-
classBody += ` return __original_${fn.name}(${paramNames})
|
|
162
|
-
`;
|
|
163
|
-
classBody += ` }
|
|
164
|
-
`;
|
|
165
|
-
}
|
|
166
|
-
classBody += `}
|
|
167
|
-
|
|
168
|
-
`;
|
|
169
|
-
classBody += `export { ${className} }
|
|
170
|
-
`;
|
|
171
|
-
classBody += `export { ${className} as default }
|
|
172
|
-
`;
|
|
173
|
-
classBody += `// ============ End Devflare WorkerEntrypoint ============
|
|
174
|
-
`;
|
|
175
|
-
s.append(classBody);
|
|
176
|
-
return {
|
|
177
|
-
code: s.toString(),
|
|
178
|
-
map: s.generateMap({
|
|
179
|
-
source: id,
|
|
180
|
-
file: id + ".map",
|
|
181
|
-
includeContent: true
|
|
182
|
-
}),
|
|
183
|
-
rpcMethods: rpcMethods.map((fn) => fn.name),
|
|
184
|
-
className
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function extractParamNames(params) {
|
|
188
|
-
if (!params.trim())
|
|
189
|
-
return "";
|
|
190
|
-
const tempCode = `function f(${params}) {}`;
|
|
191
|
-
const sourceFile = ts.createSourceFile("temp.ts", tempCode, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
192
|
-
const names = [];
|
|
193
|
-
function visit(node) {
|
|
194
|
-
if (ts.isFunctionDeclaration(node)) {
|
|
195
|
-
for (const param of node.parameters) {
|
|
196
|
-
if (ts.isIdentifier(param.name)) {
|
|
197
|
-
names.push(param.name.text);
|
|
198
|
-
} else if (ts.isObjectBindingPattern(param.name) || ts.isArrayBindingPattern(param.name)) {
|
|
199
|
-
names.push(tempCode.substring(param.name.getStart(sourceFile), param.name.getEnd()));
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
ts.forEachChild(node, visit);
|
|
204
|
-
}
|
|
205
|
-
visit(sourceFile);
|
|
206
|
-
return names.join(", ");
|
|
207
|
-
}
|
|
208
|
-
function generateRpcInterface(functions, interfaceName) {
|
|
209
|
-
const rpcMethods = functions.filter((f) => f.name !== "fetch");
|
|
210
|
-
if (rpcMethods.length === 0) {
|
|
211
|
-
return "";
|
|
212
|
-
}
|
|
213
|
-
let output = `export interface ${interfaceName} {
|
|
214
|
-
`;
|
|
215
|
-
for (const fn of rpcMethods) {
|
|
216
|
-
const returnType = fn.returnType ?? "unknown";
|
|
217
|
-
const promiseReturn = returnType.startsWith("Promise<") ? returnType : `Promise<${returnType}>`;
|
|
218
|
-
output += ` ${fn.name}(${fn.params}): ${promiseReturn}
|
|
219
|
-
`;
|
|
220
|
-
}
|
|
221
|
-
output += `}
|
|
222
|
-
`;
|
|
223
|
-
return output;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export { findExportedFunctions, shouldTransformWorker, transformWorkerEntrypoint, generateRpcInterface };
|
package/dist/init-f9mgmew3.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDependencies
|
|
3
|
-
} from "./index-1xpj0m4r.js";
|
|
4
|
-
import"./index-37x76zdn.js";
|
|
5
|
-
|
|
6
|
-
// src/cli/commands/init.ts
|
|
7
|
-
import { resolve, join } from "pathe";
|
|
8
|
-
var MINIMAL_TEMPLATE = {
|
|
9
|
-
name: "minimal",
|
|
10
|
-
description: "Minimal starter with single handler",
|
|
11
|
-
files: {
|
|
12
|
-
"devflare.config.ts": `import { defineConfig } from 'devflare'
|
|
13
|
-
|
|
14
|
-
export default defineConfig({
|
|
15
|
-
name: '{{PROJECT_NAME}}',
|
|
16
|
-
compatibilityDate: '${new Date().toISOString().split("T")[0]}',
|
|
17
|
-
})
|
|
18
|
-
`,
|
|
19
|
-
"src/index.ts": `import { env, ctx, event, locals } from 'devflare/runtime'
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
async fetch(request: Request): Promise<Response> {
|
|
23
|
-
return new Response('Hello from devflare!')
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
`,
|
|
27
|
-
"package.json": `{
|
|
28
|
-
"name": "{{PROJECT_NAME}}",
|
|
29
|
-
"version": "0.0.1",
|
|
30
|
-
"private": true,
|
|
31
|
-
"type": "module",
|
|
32
|
-
"scripts": {
|
|
33
|
-
"dev": "devflare dev",
|
|
34
|
-
"build": "devflare build",
|
|
35
|
-
"deploy": "devflare deploy",
|
|
36
|
-
"types": "devflare types"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"devflare": "^0.1.0",
|
|
40
|
-
"typescript": "^5.7.0"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`,
|
|
44
|
-
"tsconfig.json": `{
|
|
45
|
-
"compilerOptions": {
|
|
46
|
-
"target": "ESNext",
|
|
47
|
-
"module": "ESNext",
|
|
48
|
-
"moduleResolution": "bundler",
|
|
49
|
-
"strict": true,
|
|
50
|
-
"skipLibCheck": true,
|
|
51
|
-
"types": ["@cloudflare/workers-types"]
|
|
52
|
-
},
|
|
53
|
-
"include": ["src/**/*", "devflare.config.ts"]
|
|
54
|
-
}
|
|
55
|
-
`
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var API_TEMPLATE = {
|
|
59
|
-
name: "api",
|
|
60
|
-
description: "API starter with middleware and routing",
|
|
61
|
-
files: {
|
|
62
|
-
"devflare.config.ts": `import { defineConfig } from 'devflare'
|
|
63
|
-
|
|
64
|
-
export default defineConfig({
|
|
65
|
-
name: '{{PROJECT_NAME}}',
|
|
66
|
-
compatibilityDate: '${new Date().toISOString().split("T")[0]}',
|
|
67
|
-
bindings: {
|
|
68
|
-
// Add your bindings here
|
|
69
|
-
// kv: [{ binding: 'CACHE' }],
|
|
70
|
-
// d1: [{ binding: 'DB', database_name: 'my-db' }],
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
`,
|
|
74
|
-
"src/index.ts": `import { sequence, resolve } from 'devflare/runtime'
|
|
75
|
-
import { corsMiddleware } from './middleware/cors'
|
|
76
|
-
import { apiRouter } from './routes/api'
|
|
77
|
-
|
|
78
|
-
const handler = sequence(
|
|
79
|
-
corsMiddleware
|
|
80
|
-
)(
|
|
81
|
-
resolve(
|
|
82
|
-
apiRouter,
|
|
83
|
-
async () => new Response('Not Found', { status: 404 })
|
|
84
|
-
)
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
export default {
|
|
88
|
-
async fetch(request: Request, env: unknown, ctx: ExecutionContext): Promise<Response> {
|
|
89
|
-
return handler()
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`,
|
|
93
|
-
"src/middleware/cors.ts": `import type { Middleware } from 'devflare/runtime'
|
|
94
|
-
import { event } from 'devflare/runtime'
|
|
95
|
-
|
|
96
|
-
export const corsMiddleware: Middleware = async (next) => {
|
|
97
|
-
// Handle preflight
|
|
98
|
-
if (event.request?.method === 'OPTIONS') {
|
|
99
|
-
return new Response(null, {
|
|
100
|
-
headers: {
|
|
101
|
-
'Access-Control-Allow-Origin': '*',
|
|
102
|
-
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
|
|
103
|
-
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const response = await next()
|
|
109
|
-
const newResponse = new Response(response.body, response)
|
|
110
|
-
newResponse.headers.set('Access-Control-Allow-Origin', '*')
|
|
111
|
-
return newResponse
|
|
112
|
-
}
|
|
113
|
-
`,
|
|
114
|
-
"src/routes/api.ts": `import type { Handler } from 'devflare/runtime'
|
|
115
|
-
import { event, env, locals } from 'devflare/runtime'
|
|
116
|
-
|
|
117
|
-
export const apiRouter: Handler = async () => {
|
|
118
|
-
const request = event.request
|
|
119
|
-
if (!request) return null
|
|
120
|
-
|
|
121
|
-
const url = new URL(request.url)
|
|
122
|
-
|
|
123
|
-
if (url.pathname === '/api/health') {
|
|
124
|
-
return new Response(JSON.stringify({ status: 'ok' }), {
|
|
125
|
-
headers: { 'Content-Type': 'application/json' }
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (url.pathname.startsWith('/api/')) {
|
|
130
|
-
return new Response(JSON.stringify({ error: 'Not found' }), {
|
|
131
|
-
status: 404,
|
|
132
|
-
headers: { 'Content-Type': 'application/json' }
|
|
133
|
-
})
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Not an API route, pass through
|
|
137
|
-
return null
|
|
138
|
-
}
|
|
139
|
-
`,
|
|
140
|
-
"package.json": MINIMAL_TEMPLATE.files["package.json"],
|
|
141
|
-
"tsconfig.json": MINIMAL_TEMPLATE.files["tsconfig.json"]
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
var TEMPLATES = {
|
|
145
|
-
minimal: MINIMAL_TEMPLATE,
|
|
146
|
-
api: API_TEMPLATE
|
|
147
|
-
};
|
|
148
|
-
async function runInitCommand(parsed, logger, options) {
|
|
149
|
-
const projectName = parsed.args[0] || "my-devflare-app";
|
|
150
|
-
const templateName = parsed.options.template || "minimal";
|
|
151
|
-
const cwd = options.cwd || process.cwd();
|
|
152
|
-
logger.info(`Creating new devflare project: ${projectName}`);
|
|
153
|
-
const template = TEMPLATES[templateName];
|
|
154
|
-
if (!template) {
|
|
155
|
-
logger.error(`Unknown template: ${templateName}`);
|
|
156
|
-
logger.info(`Available templates: ${Object.keys(TEMPLATES).join(", ")}`);
|
|
157
|
-
return { exitCode: 1 };
|
|
158
|
-
}
|
|
159
|
-
const projectDir = resolve(cwd, projectName);
|
|
160
|
-
const { fs } = await getDependencies();
|
|
161
|
-
try {
|
|
162
|
-
await fs.access(projectDir);
|
|
163
|
-
logger.error(`Directory already exists: ${projectDir}`);
|
|
164
|
-
return { exitCode: 1 };
|
|
165
|
-
} catch {}
|
|
166
|
-
await fs.mkdir(projectDir, { recursive: true });
|
|
167
|
-
for (const [filePath, content] of Object.entries(template.files)) {
|
|
168
|
-
const fullPath = join(projectDir, filePath);
|
|
169
|
-
const dir = fullPath.substring(0, fullPath.lastIndexOf("/"));
|
|
170
|
-
await fs.mkdir(dir, { recursive: true }).catch(() => {});
|
|
171
|
-
const processedContent = content.replace(/\{\{PROJECT_NAME\}\}/g, projectName);
|
|
172
|
-
await fs.writeFile(fullPath, processedContent, "utf-8");
|
|
173
|
-
logger.info(` Created: ${filePath}`);
|
|
174
|
-
}
|
|
175
|
-
logger.success(`
|
|
176
|
-
Project created successfully!`);
|
|
177
|
-
logger.info(`
|
|
178
|
-
Next steps:`);
|
|
179
|
-
logger.info(` cd ${projectName}`);
|
|
180
|
-
logger.info(` bun install`);
|
|
181
|
-
logger.info(` bun run dev`);
|
|
182
|
-
return { exitCode: 0 };
|
|
183
|
-
}
|
|
184
|
-
export {
|
|
185
|
-
runInitCommand
|
|
186
|
-
};
|
package/dist/remote-q59qk463.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BOLD,
|
|
3
|
-
DIM,
|
|
4
|
-
GREEN,
|
|
5
|
-
RED,
|
|
6
|
-
RESET,
|
|
7
|
-
YELLOW
|
|
8
|
-
} from "./index-3t6rypgc.js";
|
|
9
|
-
import {
|
|
10
|
-
disableRemoteMode,
|
|
11
|
-
enableRemoteMode,
|
|
12
|
-
getEffectiveRemoteModeStatus
|
|
13
|
-
} from "./index-d8bdkx2h.js";
|
|
14
|
-
import"./index-37x76zdn.js";
|
|
15
|
-
|
|
16
|
-
// src/cli/commands/remote.ts
|
|
17
|
-
function log(message = "") {
|
|
18
|
-
console.log(message);
|
|
19
|
-
}
|
|
20
|
-
function showStatus() {
|
|
21
|
-
const status = getEffectiveRemoteModeStatus();
|
|
22
|
-
log();
|
|
23
|
-
log(`${BOLD}Remote Test Mode${RESET}`);
|
|
24
|
-
log();
|
|
25
|
-
if (status.isActive) {
|
|
26
|
-
log(` ${GREEN}●${RESET} ${BOLD}Enabled${RESET}`);
|
|
27
|
-
if (status.source === "env") {
|
|
28
|
-
log(` Source: ${YELLOW}DEVFLARE_REMOTE${RESET} environment variable`);
|
|
29
|
-
log(` ${DIM}(unset the variable to disable)${RESET}`);
|
|
30
|
-
} else {
|
|
31
|
-
log(` Expires in ${status.remainingMinutes} minute(s)`);
|
|
32
|
-
log(` ${DIM}At: ${status.expiresAt?.toLocaleTimeString()}${RESET}`);
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
log(` ${DIM}○${RESET} Disabled`);
|
|
36
|
-
log(` ${DIM}Remote-only tests (AI, Vectorize) will be skipped${RESET}`);
|
|
37
|
-
}
|
|
38
|
-
log();
|
|
39
|
-
log(`${DIM}Commands:${RESET}`);
|
|
40
|
-
log(` devflare remote enable [minutes] Enable for N minutes (default: 30)`);
|
|
41
|
-
log(` devflare remote disable Disable immediately`);
|
|
42
|
-
log(` devflare remote status Show current status`);
|
|
43
|
-
log();
|
|
44
|
-
}
|
|
45
|
-
function enable(inputMinutes) {
|
|
46
|
-
const actualMinutes = enableRemoteMode(inputMinutes);
|
|
47
|
-
const status = getEffectiveRemoteModeStatus();
|
|
48
|
-
log();
|
|
49
|
-
if (inputMinutes !== actualMinutes) {
|
|
50
|
-
log(`${YELLOW}⚠${RESET} Invalid duration, using ${actualMinutes} minute(s)`);
|
|
51
|
-
}
|
|
52
|
-
log(`${GREEN}✓${RESET} Remote test mode ${BOLD}enabled${RESET} for ${actualMinutes} minute(s)`);
|
|
53
|
-
log(` Expires at: ${status.expiresAt?.toLocaleTimeString()}`);
|
|
54
|
-
log();
|
|
55
|
-
log(`${YELLOW}⚠${RESET} Remote tests use real Cloudflare infrastructure and may incur costs.`);
|
|
56
|
-
log(` Run ${DIM}devflare remote disable${RESET} when done.`);
|
|
57
|
-
log();
|
|
58
|
-
}
|
|
59
|
-
function disable() {
|
|
60
|
-
const statusBefore = getEffectiveRemoteModeStatus();
|
|
61
|
-
disableRemoteMode();
|
|
62
|
-
log();
|
|
63
|
-
log(`${GREEN}✓${RESET} Remote test mode ${BOLD}disabled${RESET}`);
|
|
64
|
-
if (statusBefore.envVarSet) {
|
|
65
|
-
log();
|
|
66
|
-
log(`${YELLOW}⚠${RESET} Note: ${BOLD}DEVFLARE_REMOTE${RESET} environment variable is still set.`);
|
|
67
|
-
log(` Remote mode will remain active until you unset it.`);
|
|
68
|
-
} else {
|
|
69
|
-
log(` Remote-only tests (AI, Vectorize) will now be skipped.`);
|
|
70
|
-
}
|
|
71
|
-
log();
|
|
72
|
-
}
|
|
73
|
-
function runRemoteCommand(parsed, _logger, _options) {
|
|
74
|
-
const subcommand = parsed.args[0];
|
|
75
|
-
const arg = parsed.args[1];
|
|
76
|
-
switch (subcommand) {
|
|
77
|
-
case "enable": {
|
|
78
|
-
const minutes = arg ? parseInt(arg, 10) : 30;
|
|
79
|
-
enable(isNaN(minutes) ? 30 : minutes);
|
|
80
|
-
return { exitCode: 0 };
|
|
81
|
-
}
|
|
82
|
-
case "disable":
|
|
83
|
-
disable();
|
|
84
|
-
return { exitCode: 0 };
|
|
85
|
-
case "status":
|
|
86
|
-
case undefined:
|
|
87
|
-
showStatus();
|
|
88
|
-
return { exitCode: 0 };
|
|
89
|
-
default:
|
|
90
|
-
log(`${RED}Unknown subcommand:${RESET} ${subcommand}`);
|
|
91
|
-
log(`Run ${DIM}devflare remote${RESET} for usage.`);
|
|
92
|
-
return { exitCode: 1 };
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
export {
|
|
96
|
-
runRemoteCommand
|
|
97
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { type DevflareConfig } from '../config';
|
|
2
|
-
import { type MiniflareInstance, type MiniflareOptions } from '../bridge/miniflare';
|
|
3
|
-
import { runWithContext } from '../runtime/context';
|
|
4
|
-
export interface BridgeTestContextOptions {
|
|
5
|
-
/** Path to devflare.config.ts */
|
|
6
|
-
configPath?: string;
|
|
7
|
-
/** Direct config object (alternative to configPath) */
|
|
8
|
-
config?: DevflareConfig;
|
|
9
|
-
/** Miniflare options override */
|
|
10
|
-
miniflare?: Partial<MiniflareOptions>;
|
|
11
|
-
/** Port for Miniflare (default: 8787) */
|
|
12
|
-
port?: number;
|
|
13
|
-
/** Persist data between tests */
|
|
14
|
-
persist?: boolean;
|
|
15
|
-
/** Verbose logging */
|
|
16
|
-
verbose?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface BridgeTestContext {
|
|
19
|
-
/** The env object with real bindings */
|
|
20
|
-
env: Record<string, unknown>;
|
|
21
|
-
/** The Miniflare instance */
|
|
22
|
-
miniflare: MiniflareInstance;
|
|
23
|
-
/** Stop the test context */
|
|
24
|
-
stop(): Promise<void>;
|
|
25
|
-
/** Reset all data (clear KV, R2, D1, etc.) */
|
|
26
|
-
reset(): Promise<void>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Create a test context with real Miniflare bindings
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* import { createBridgeTestContext } from 'devflare'
|
|
34
|
-
* import { createEnvProxy } from 'devflare'
|
|
35
|
-
*
|
|
36
|
-
* const bridgeEnv = createEnvProxy({ lazy: true })
|
|
37
|
-
*
|
|
38
|
-
* beforeAll(async () => {
|
|
39
|
-
* await createBridgeTestContext({ configPath: './devflare.config.ts' })
|
|
40
|
-
* })
|
|
41
|
-
*
|
|
42
|
-
* afterAll(async () => {
|
|
43
|
-
* await stopBridgeTestContext()
|
|
44
|
-
* })
|
|
45
|
-
*
|
|
46
|
-
* test('KV works', async () => {
|
|
47
|
-
* await bridgeEnv.MY_KV.put('key', 'value')
|
|
48
|
-
* expect(await bridgeEnv.MY_KV.get('key')).toBe('value')
|
|
49
|
-
* })
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export declare function createBridgeTestContext(options?: BridgeTestContextOptions): Promise<BridgeTestContext>;
|
|
53
|
-
/**
|
|
54
|
-
* Stop the global test context
|
|
55
|
-
*/
|
|
56
|
-
export declare function stopBridgeTestContext(): Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Get the current test context (throws if not initialized)
|
|
59
|
-
*/
|
|
60
|
-
export declare function getBridgeTestContext(): BridgeTestContext;
|
|
61
|
-
/**
|
|
62
|
-
* Direct access to Miniflare bindings in tests
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```ts
|
|
66
|
-
* import { testEnv } from 'devflare/test'
|
|
67
|
-
*
|
|
68
|
-
* test('KV works', async () => {
|
|
69
|
-
* const kv = testEnv.MY_KV as KVNamespace
|
|
70
|
-
* await kv.put('key', 'value')
|
|
71
|
-
* })
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export declare const testEnv: Record<string, unknown>;
|
|
75
|
-
export { runWithContext };
|
|
76
|
-
//# sourceMappingURL=bridge-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-context.d.ts","sourceRoot":"","sources":["../../src/test/bridge-context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,EAA2D,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAG5I,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMnD,MAAM,WAAW,wBAAwB;IACxC,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uDAAuD;IACvD,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACrC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iCAAiC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sBAAsB;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,iBAAiB;IACjC,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,6BAA6B;IAC7B,SAAS,EAAE,iBAAiB,CAAA;IAC5B,4BAA4B;IAC5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACrB,8CAA8C;IAC9C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACtB;AAYD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,uBAAuB,CAC5C,OAAO,GAAE,wBAA6B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAmF5B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAI3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAOxD;AAMD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAM1C,CAAA;AAqBF,OAAO,EAAE,cAAc,EAAE,CAAA"}
|