devflare 1.0.0-next.7 → 1.0.0-next.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LLM.md +17315 -2144
- package/README.md +398 -607
- package/bin/devflare.js +30 -14
- package/dist/_chunks/account-BHY3fvrA.js +462 -0
- package/dist/_chunks/account-resources-BdKj8q1h.js +159 -0
- package/dist/_chunks/ai-CN_SREim.js +322 -0
- package/dist/_chunks/api-BKClUlUf.js +568 -0
- package/dist/_chunks/build-DplSo6Gc.js +24 -0
- package/dist/_chunks/build-artifacts-CkwCap5N.js +483 -0
- package/dist/_chunks/cli-ZJYtm-lW.js +1214 -0
- package/dist/_chunks/cloudflare-Ic5ubQza.js +157 -0
- package/dist/_chunks/colors-D0NVzAFN.js +13 -0
- package/dist/_chunks/command-utils-DjaaMQX7.js +45 -0
- package/dist/_chunks/compiler-UxXQgEPq.js +521 -0
- package/dist/_chunks/config-path-CYGlwKDs.js +42 -0
- package/dist/_chunks/config-zQd4jmXU.js +78 -0
- package/dist/_chunks/context-DGMev2AF.js +2515 -0
- package/dist/_chunks/decorators-eXNZ1S0N.js +19 -0
- package/dist/_chunks/dependencies-wKqrxKV_.js +57 -0
- package/dist/_chunks/deploy-z1_wbNn2.js +1032 -0
- package/dist/_chunks/dev-BagtFegV.js +952 -0
- package/dist/_chunks/doctor-CAsJ-rSZ.js +219 -0
- package/dist/_chunks/durable-object-DuMPM8re.js +234 -0
- package/dist/_chunks/env-D4uJqqgu.js +125 -0
- package/dist/_chunks/family-BTTpTwUk.js +143 -0
- package/dist/_chunks/generated-artifacts-Bb13pGUG.js +32 -0
- package/dist/_chunks/glob-DRw9sbfF.js +56 -0
- package/dist/_chunks/init-DJ5y3mu5.js +165 -0
- package/dist/_chunks/loader-BC0skbnH.js +1330 -0
- package/dist/_chunks/local-dev-vars-BFLS-HoI.js +81 -0
- package/dist/_chunks/local-hyperdrive-CcORzo76.js +119 -0
- package/dist/_chunks/local-media-bindings-ZQe-epuw.js +335 -0
- package/dist/_chunks/local-secrets-C0n5oRgI.js +123 -0
- package/dist/_chunks/login-CgNcbpEq.js +51 -0
- package/dist/_chunks/package-metadata-CLI488gB.js +39 -0
- package/dist/_chunks/preferences-CbYERA_m.js +241 -0
- package/dist/_chunks/preview-j9Kbx4-G.js +462 -0
- package/dist/_chunks/preview-registry-CTXU4mBc.js +1186 -0
- package/dist/_chunks/preview-resources-CQIu2-NY.js +359 -0
- package/dist/_chunks/previews-BIaw6NVC.js +1133 -0
- package/dist/_chunks/productions-CF8oQcX7.js +504 -0
- package/dist/_chunks/r2-presign-runtime-C75FkLMd.js +291 -0
- package/dist/_chunks/ref-CYJNAAe_.js +178 -0
- package/dist/_chunks/remote-8jEHLVGg.js +79 -0
- package/dist/_chunks/remote-config-Bw6qIVM4.js +132 -0
- package/dist/_chunks/resolve-package-DeJUGxoE.js +152 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-CRXB3-iw.js +851 -0
- package/dist/_chunks/runtime-BlKTWIgD.js +874 -0
- package/dist/_chunks/schema-normalization-CTdiY17P.js +667 -0
- package/dist/_chunks/secrets-BJuEa9Jz.js +95 -0
- package/dist/_chunks/tail-DjGRt8gw.js +239 -0
- package/dist/_chunks/token-wmeF8-IQ.js +333 -0
- package/dist/_chunks/tokens-KaEr4B8e.js +221 -0
- package/dist/_chunks/types-BLGfxIq-.js +484 -0
- package/dist/_chunks/ui-BhCdDC2N.js +103 -0
- package/dist/_chunks/usage-rRusKejc.js +272 -0
- package/dist/_chunks/vite-Bml-Whp8.js +1267 -0
- package/dist/_chunks/vite-process-CDa3yQui.js +2929 -0
- package/dist/_chunks/vite-utils-D8kPPxUy.js +183 -0
- package/dist/_chunks/worker-DgczaXVW.js +410 -0
- package/dist/_chunks/worker-bundler-Isj5jiW6.js +458 -0
- package/dist/_chunks/worker-entrypoint-C8j23t6d.js +247 -0
- package/dist/_chunks/workerName-kEXwmV2m.js +23 -0
- package/dist/_chunks/workspace-CrvqPLTX.js +517 -0
- package/dist/_chunks/workspace-Ds3xMjOE.js +175 -0
- package/dist/bridge/client.d.ts +93 -8
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/do-rpc-dispatch.d.ts +23 -0
- package/dist/bridge/do-rpc-dispatch.d.ts.map +1 -0
- package/dist/bridge/do-websocket-connect.d.ts +33 -0
- package/dist/bridge/do-websocket-connect.d.ts.map +1 -0
- package/dist/bridge/gateway-runtime.d.ts +8 -0
- package/dist/bridge/gateway-runtime.d.ts.map +1 -0
- package/dist/bridge/index.d.ts +6 -6
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/log.d.ts +5 -0
- package/dist/bridge/log.d.ts.map +1 -0
- package/dist/bridge/miniflare-gateway.d.ts +45 -0
- package/dist/bridge/miniflare-gateway.d.ts.map +1 -0
- package/dist/bridge/miniflare.d.ts +92 -2
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +12 -11
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/r2-presign-runtime.d.ts +9 -0
- package/dist/bridge/r2-presign-runtime.d.ts.map +1 -0
- package/dist/bridge/server.d.ts +2 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/bridge/v2/body-streams.d.ts +53 -0
- package/dist/bridge/v2/body-streams.d.ts.map +1 -0
- package/dist/bridge/v2/codec.d.ts +106 -0
- package/dist/bridge/v2/codec.d.ts.map +1 -0
- package/dist/bridge/v2/control-messages.d.ts +46 -0
- package/dist/bridge/v2/control-messages.d.ts.map +1 -0
- package/dist/bridge/v2/frames.d.ts +109 -0
- package/dist/bridge/v2/frames.d.ts.map +1 -0
- package/dist/bridge/v2/index.d.ts +11 -0
- package/dist/bridge/v2/index.d.ts.map +1 -0
- package/dist/bridge/v2/serialization.d.ts +48 -0
- package/dist/bridge/v2/serialization.d.ts.map +1 -0
- package/dist/bridge/v2/transport.d.ts +31 -0
- package/dist/bridge/v2/transport.d.ts.map +1 -0
- package/dist/bridge/v2/value-codec.d.ts +61 -0
- package/dist/bridge/v2/value-codec.d.ts.map +1 -0
- package/dist/bridge/v2/value-serialization.d.ts +139 -0
- package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
- package/dist/bridge/{protocol.d.ts → v2/wire.d.ts} +32 -8
- package/dist/bridge/v2/wire.d.ts.map +1 -0
- package/dist/bridge/v2/ws-relay.d.ts +53 -0
- package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
- package/dist/bridge/websocket-constructor.d.ts +38 -0
- package/dist/bridge/websocket-constructor.d.ts.map +1 -0
- package/dist/browser-shim/handler.d.ts +2 -2
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser-shim/index.d.ts +2 -2
- package/dist/browser-shim/server.d.ts +63 -0
- package/dist/browser-shim/server.d.ts.map +1 -1
- package/dist/browser.d.ts +5778 -43
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +73 -142
- package/dist/bundler/defaults.d.ts +23 -0
- package/dist/bundler/defaults.d.ts.map +1 -0
- package/dist/bundler/do-bundler.d.ts +7 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/index.d.ts +3 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +53 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +13 -0
- package/dist/bundler/worker-bundler.d.ts.map +1 -0
- package/dist/bundler/worker-compat.d.ts +4 -0
- package/dist/bundler/worker-compat.d.ts.map +1 -0
- package/dist/cli/build-manifest.d.ts +66 -0
- package/dist/cli/build-manifest.d.ts.map +1 -0
- package/dist/cli/command-utils.d.ts +18 -0
- package/dist/cli/command-utils.d.ts.map +1 -0
- package/dist/cli/commands/account.d.ts +2 -2
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/ai.d.ts +1 -1
- package/dist/cli/commands/ai.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +40 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts +2 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/deploy/metadata.d.ts +18 -0
- package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
- package/dist/cli/commands/deploy/prepare.d.ts +23 -0
- package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
- package/dist/cli/commands/deploy/runtime.d.ts +4 -0
- package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
- package/dist/cli/commands/deploy/verification.d.ts +36 -0
- package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
- package/dist/cli/commands/deploy.d.ts +2 -2
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts +9 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -2
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/family.d.ts +10 -0
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/render.d.ts +8 -0
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/theme.d.ts +10 -0
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/types.d.ts +70 -0
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
- package/dist/cli/commands/previews.d.ts +4 -0
- package/dist/cli/commands/previews.d.ts.map +1 -0
- package/dist/cli/commands/productions.d.ts +4 -0
- package/dist/cli/commands/productions.d.ts.map +1 -0
- package/dist/cli/commands/remote.d.ts +1 -1
- package/dist/cli/commands/remote.d.ts.map +1 -1
- package/dist/cli/commands/secrets.d.ts +4 -0
- package/dist/cli/commands/secrets.d.ts.map +1 -0
- package/dist/cli/commands/tail.d.ts +44 -0
- package/dist/cli/commands/tail.d.ts.map +1 -0
- package/dist/cli/commands/token.d.ts +4 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +121 -0
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/models.d.ts +27 -0
- package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
- package/dist/cli/commands/types.d.ts +2 -2
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +4 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/commands/workspace.d.ts +8 -0
- package/dist/cli/commands/workspace.d.ts.map +1 -0
- package/dist/cli/config-path.d.ts +6 -0
- package/dist/cli/config-path.d.ts.map +1 -0
- package/dist/cli/dependencies.d.ts +2 -1
- package/dist/cli/dependencies.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/gradual-deploy.d.ts +49 -0
- package/dist/cli/gradual-deploy.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/package-metadata.d.ts +16 -0
- package/dist/cli/package-metadata.d.ts.map +1 -0
- package/dist/cli/preview-bindings.d.ts +49 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +10 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/cli/ui.d.ts +37 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/workspace-build-guard.d.ts +14 -0
- package/dist/cli/workspace-build-guard.d.ts.map +1 -0
- package/dist/cli/wrangler-auth.d.ts +1 -1
- package/dist/cloudflare/account-core.d.ts +6 -0
- package/dist/cloudflare/account-core.d.ts.map +1 -0
- package/dist/cloudflare/account-resources.d.ts +40 -0
- package/dist/cloudflare/account-resources.d.ts.map +1 -0
- package/dist/cloudflare/account-status.d.ts +11 -0
- package/dist/cloudflare/account-status.d.ts.map +1 -0
- package/dist/cloudflare/account-workers.d.ts +14 -0
- package/dist/cloudflare/account-workers.d.ts.map +1 -0
- package/dist/cloudflare/account.d.ts +7 -64
- package/dist/cloudflare/account.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts +71 -3
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/auth.d.ts +1 -1
- package/dist/cloudflare/auth.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +61 -6
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -13
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
- package/dist/cloudflare/kv-namespace.d.ts +4 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
- package/dist/cloudflare/preferences.d.ts +7 -0
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
- package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-records.d.ts +4 -0
- package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
- package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-store.d.ts +14 -0
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
- package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-types.d.ts +103 -0
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry.d.ts +42 -0
- package/dist/cloudflare/preview-registry.d.ts.map +1 -0
- package/dist/cloudflare/preview-urls.d.ts +3 -0
- package/dist/cloudflare/preview-urls.d.ts.map +1 -0
- package/dist/cloudflare/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/remote-config.d.ts.map +1 -1
- package/dist/cloudflare/tokens.d.ts +44 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +124 -7
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts +31 -3
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/binding-resolution-helpers.d.ts +41 -0
- package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
- package/dist/config/compatibility.d.ts +3 -0
- package/dist/config/compatibility.d.ts.map +1 -0
- package/dist/config/compiler/bindings.d.ts +14 -0
- package/dist/config/compiler/bindings.d.ts.map +1 -0
- package/dist/config/compiler/core-helpers.d.ts +6 -0
- package/dist/config/compiler/core-helpers.d.ts.map +1 -0
- package/dist/config/compiler/do-workers.d.ts +34 -0
- package/dist/config/compiler/do-workers.d.ts.map +1 -0
- package/dist/config/compiler/paths.d.ts +18 -0
- package/dist/config/compiler/paths.d.ts.map +1 -0
- package/dist/config/compiler/types.d.ts +308 -0
- package/dist/config/compiler/types.d.ts.map +1 -0
- package/dist/config/compiler.d.ts +22 -134
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/cron.d.ts +19 -0
- package/dist/config/cron.d.ts.map +1 -0
- package/dist/config/define.d.ts +8 -5
- package/dist/config/define.d.ts.map +1 -1
- package/dist/config/deploy-resources.d.ts +58 -0
- package/dist/config/deploy-resources.d.ts.map +1 -0
- package/dist/config/env-vars.d.ts +309 -0
- package/dist/config/env-vars.d.ts.map +1 -0
- package/dist/config/framework-providers.d.ts +9 -0
- package/dist/config/framework-providers.d.ts.map +1 -0
- package/dist/config/index.d.ts +13 -5
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts +2 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/local-dev-vars.d.ts +15 -0
- package/dist/config/local-dev-vars.d.ts.map +1 -0
- package/dist/config/preview-resources.d.ts +83 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +29 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +16 -25
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve-phased.d.ts +72 -0
- package/dist/config/resolve-phased.d.ts.map +1 -0
- package/dist/config/resolve.d.ts +11 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resource-resolution.d.ts +80 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- package/dist/config/schema-bindings.d.ts +2124 -0
- package/dist/config/schema-bindings.d.ts.map +1 -0
- package/dist/config/schema-build.d.ts +67 -0
- package/dist/config/schema-build.d.ts.map +1 -0
- package/dist/config/schema-env.d.ts +3821 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +272 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +597 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +520 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +802 -0
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
- package/dist/config/schema-types-bindings.d.ts +293 -0
- package/dist/config/schema-types-bindings.d.ts.map +1 -0
- package/dist/config/schema-types-build.d.ts +86 -0
- package/dist/config/schema-types-build.d.ts.map +1 -0
- package/dist/config/schema-types-runtime-server.d.ts +196 -0
- package/dist/config/schema-types-runtime-server.d.ts.map +1 -0
- package/dist/config/schema-types-runtime.d.ts +913 -0
- package/dist/config/schema-types-runtime.d.ts.map +1 -0
- package/dist/config/schema-types.d.ts +458 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +5796 -2023
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/service-bindings-validation.d.ts +36 -0
- package/dist/config/service-bindings-validation.d.ts.map +1 -0
- package/dist/config/workspace.d.ts +282 -0
- package/dist/config/workspace.d.ts.map +1 -0
- package/dist/config-entry.d.ts +7 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-entry.js +3 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/decorators/index.d.ts +2 -2
- package/dist/decorators/index.js +2 -9
- package/dist/dev-server/d1-migrations.d.ts +36 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/dev-server-state.d.ts +59 -0
- package/dist/dev-server/dev-server-state.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +22 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/index.d.ts +1 -1
- package/dist/dev-server/miniflare-bindings.d.ts +90 -0
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts +57 -0
- package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -0
- package/dist/dev-server/miniflare-log.d.ts +20 -0
- package/dist/dev-server/miniflare-log.d.ts.map +1 -0
- package/dist/dev-server/miniflare-worker-config.d.ts +100 -0
- package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
- package/dist/dev-server/reload-queue.d.ts +13 -0
- package/dist/dev-server/reload-queue.d.ts.map +1 -0
- package/dist/dev-server/runtime-health.d.ts +79 -0
- package/dist/dev-server/runtime-health.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts +8 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
- package/dist/dev-server/server-startup-helpers.d.ts +84 -0
- package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
- package/dist/dev-server/server.d.ts +2 -0
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +24 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +19 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts +17 -0
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
- package/dist/dev-server/worker-surface-paths.d.ts +6 -0
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
- package/dist/dev-server/workspace/merge-config.d.ts +81 -0
- package/dist/dev-server/workspace/merge-config.d.ts.map +1 -0
- package/dist/dev-server/workspace/prepare-app.d.ts +84 -0
- package/dist/dev-server/workspace/prepare-app.d.ts.map +1 -0
- package/dist/dev-server/workspace/server.d.ts +47 -0
- package/dist/dev-server/workspace/server.d.ts.map +1 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/index.d.ts +8 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -297
- package/dist/runtime/context-events.d.ts +13 -0
- package/dist/runtime/context-events.d.ts.map +1 -0
- package/dist/runtime/context-types.d.ts +82 -0
- package/dist/runtime/context-types.d.ts.map +1 -0
- package/dist/runtime/context.d.ts +20 -44
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +70 -55
- package/dist/runtime/exports.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +11 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -184
- package/dist/runtime/middleware.d.ts +119 -67
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/runtime/r2-presign.d.ts +164 -0
- package/dist/runtime/r2-presign.d.ts.map +1 -0
- package/dist/runtime/router/index.d.ts +7 -0
- package/dist/runtime/router/index.d.ts.map +1 -0
- package/dist/runtime/router/types.d.ts +24 -0
- package/dist/runtime/router/types.d.ts.map +1 -0
- package/dist/runtime/validation.d.ts +18 -4
- package/dist/runtime/validation.d.ts.map +1 -1
- package/dist/secrets/local-secrets.d.ts +46 -0
- package/dist/secrets/local-secrets.d.ts.map +1 -0
- package/dist/shims/local-hyperdrive.d.ts +12 -0
- package/dist/shims/local-hyperdrive.d.ts.map +1 -0
- package/dist/shims/local-media-bindings.d.ts +19 -0
- package/dist/shims/local-media-bindings.d.ts.map +1 -0
- package/dist/shims/local-worker-loader.d.ts +3 -0
- package/dist/shims/local-worker-loader.d.ts.map +1 -0
- package/dist/sveltekit/index.d.ts +1 -1
- package/dist/sveltekit/index.d.ts.map +1 -1
- package/dist/sveltekit/index.js +377 -169
- package/dist/sveltekit/local-bindings.d.ts +4 -0
- package/dist/sveltekit/local-bindings.d.ts.map +1 -0
- package/dist/sveltekit/platform.d.ts +42 -2
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/ai-search.d.ts +39 -0
- package/dist/test/ai-search.d.ts.map +1 -0
- package/dist/test/alarm.d.ts +55 -0
- package/dist/test/alarm.d.ts.map +1 -0
- package/dist/test/binding-hints.d.ts +10 -0
- package/dist/test/binding-hints.d.ts.map +1 -0
- package/dist/test/cf.d.ts +71 -35
- package/dist/test/cf.d.ts.map +1 -1
- package/dist/test/containers.d.ts +87 -0
- package/dist/test/containers.d.ts.map +1 -0
- package/dist/test/email.d.ts +16 -7
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +20 -21
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +5115 -75
- package/dist/test/offline-bindings.d.ts +124 -0
- package/dist/test/offline-bindings.d.ts.map +1 -0
- package/dist/test/queue.d.ts.map +1 -1
- package/dist/test/remote-ai.d.ts.map +1 -1
- package/dist/test/remote-cloudflare.d.ts +13 -0
- package/dist/test/remote-cloudflare.d.ts.map +1 -0
- package/dist/test/remote-vectorize.d.ts.map +1 -1
- package/dist/test/resolve-service-bindings.d.ts +64 -4
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +14 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-bindings.d.ts +13 -0
- package/dist/test/simple-context-bindings.d.ts.map +1 -0
- package/dist/test/simple-context-durable-objects.d.ts +6 -0
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
- package/dist/test/simple-context-env.d.ts +35 -0
- package/dist/test/simple-context-env.d.ts.map +1 -0
- package/dist/test/simple-context-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
- package/dist/test/simple-context-handlers.d.ts +12 -0
- package/dist/test/simple-context-handlers.d.ts.map +1 -0
- package/dist/test/simple-context-lifecycle.d.ts +32 -0
- package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
- package/dist/test/simple-context-mfconfig.d.ts +18 -0
- package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
- package/dist/test/simple-context-multi-worker.d.ts +16 -0
- package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
- package/dist/test/simple-context-paths.d.ts +40 -0
- package/dist/test/simple-context-paths.d.ts.map +1 -0
- package/dist/test/simple-context-runtime.d.ts +19 -0
- package/dist/test/simple-context-runtime.d.ts.map +1 -0
- package/dist/test/simple-context-startup.d.ts +11 -0
- package/dist/test/simple-context-startup.d.ts.map +1 -0
- package/dist/test/simple-context-transport.d.ts +14 -0
- package/dist/test/simple-context-transport.d.ts.map +1 -0
- package/dist/test/simple-context.d.ts +8 -27
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts +3 -2
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/analytics-engine.d.ts +22 -0
- package/dist/test/utilities/analytics-engine.d.ts.map +1 -0
- package/dist/test/utilities/artifacts.d.ts +11 -0
- package/dist/test/utilities/artifacts.d.ts.map +1 -0
- package/dist/test/utilities/context.d.ts +39 -0
- package/dist/test/utilities/context.d.ts.map +1 -0
- package/dist/test/utilities/d1.d.ts +21 -0
- package/dist/test/utilities/d1.d.ts.map +1 -0
- package/dist/test/utilities/env.d.ts +45 -0
- package/dist/test/utilities/env.d.ts.map +1 -0
- package/dist/test/utilities/kv.d.ts +11 -0
- package/dist/test/utilities/kv.d.ts.map +1 -0
- package/dist/test/utilities/media.d.ts +16 -0
- package/dist/test/utilities/media.d.ts.map +1 -0
- package/dist/test/utilities/platform.d.ts +41 -0
- package/dist/test/utilities/platform.d.ts.map +1 -0
- package/dist/test/utilities/queue.d.ts +5 -0
- package/dist/test/utilities/queue.d.ts.map +1 -0
- package/dist/test/utilities/r2.d.ts +2 -0
- package/dist/test/utilities/r2.d.ts.map +1 -0
- package/dist/test/utilities/send-email.d.ts +27 -0
- package/dist/test/utilities/send-email.d.ts.map +1 -0
- package/dist/test/utilities/stream-flagship.d.ts +27 -0
- package/dist/test/utilities/stream-flagship.d.ts.map +1 -0
- package/dist/test/utilities/vectorize.d.ts +38 -0
- package/dist/test/utilities/vectorize.d.ts.map +1 -0
- package/dist/test/utilities/workflows.d.ts +26 -0
- package/dist/test/utilities/workflows.d.ts.map +1 -0
- package/dist/test/utilities.d.ts +14 -98
- package/dist/test/utilities.d.ts.map +1 -1
- package/dist/test/worker.d.ts +6 -0
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/transform/durable-object.d.ts.map +1 -1
- package/dist/transform/index.d.ts +2 -2
- package/dist/transform/worker-entrypoint.d.ts +5 -0
- package/dist/transform/worker-entrypoint.d.ts.map +1 -1
- package/dist/utils/entrypoint-discovery.d.ts +6 -3
- package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
- package/dist/utils/glob.d.ts.map +1 -1
- package/dist/utils/resolve-package.d.ts.map +1 -1
- package/dist/utils/send-email.d.ts +15 -0
- package/dist/utils/send-email.d.ts.map +1 -0
- package/dist/utils/send-email.js +163 -0
- package/dist/vite/config-file.d.ts +25 -0
- package/dist/vite/config-file.d.ts.map +1 -0
- package/dist/vite/index.d.ts +3 -2
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +2 -407
- package/dist/vite/plugin-config-hook.d.ts +28 -0
- package/dist/vite/plugin-config-hook.d.ts.map +1 -0
- package/dist/vite/plugin-context.d.ts +27 -0
- package/dist/vite/plugin-context.d.ts.map +1 -0
- package/dist/vite/plugin-durable-objects.d.ts +18 -0
- package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
- package/dist/vite/plugin-programmatic.d.ts +44 -0
- package/dist/vite/plugin-programmatic.d.ts.map +1 -0
- package/dist/vite/plugin-service-bindings.d.ts +13 -0
- package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
- package/dist/vite/plugin-transform.d.ts +41 -0
- package/dist/vite/plugin-transform.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +10 -41
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-entry/composed-worker.d.ts +5 -8
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
- package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
- package/dist/worker-entry/extensions.d.ts +5 -0
- package/dist/worker-entry/extensions.d.ts.map +1 -0
- package/dist/worker-entry/routes.d.ts +22 -0
- package/dist/worker-entry/routes.d.ts.map +1 -0
- package/dist/worker-entry/surface-paths.d.ts +26 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-entry/validate-fetch-style.d.ts +12 -0
- package/dist/worker-entry/validate-fetch-style.d.ts.map +1 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
- package/package.json +160 -117
- package/R2.md +0 -170
- package/dist/account-rvrj687w.js +0 -397
- package/dist/ai-dx4fr9jh.js +0 -107
- package/dist/bridge/protocol.d.ts.map +0 -1
- package/dist/bridge/serialization.d.ts +0 -83
- package/dist/bridge/serialization.d.ts.map +0 -1
- package/dist/browser-shim/worker.d.ts +0 -14
- package/dist/browser-shim/worker.d.ts.map +0 -1
- package/dist/build-9myaxf07.js +0 -70
- package/dist/deploy-h1wz5p7m.js +0 -86
- package/dist/dev-rsdssknb.js +0 -2707
- package/dist/doctor-v7jy4s3r.js +0 -190
- package/dist/durable-object-t4kbb0yt.js +0 -13
- package/dist/index-18hvb6gb.js +0 -194
- package/dist/index-1xpj0m4r.js +0 -57
- package/dist/index-37x76zdn.js +0 -4
- package/dist/index-3t6rypgc.js +0 -13
- package/dist/index-62b3gt2g.js +0 -12
- package/dist/index-67qcae0f.js +0 -183
- package/dist/index-9ats0s83.js +0 -70
- package/dist/index-a0fjkq68.js +0 -198
- package/dist/index-a855bdsx.js +0 -18
- package/dist/index-ccrh4w3t.js +0 -1133
- package/dist/index-d8bdkx2h.js +0 -109
- package/dist/index-f8qh2tyh.js +0 -2152
- package/dist/index-gz1gndna.js +0 -307
- package/dist/index-hcex3rgh.js +0 -266
- package/dist/index-k7r18na8.js +0 -0
- package/dist/index-n3np2d6t.js +0 -462
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-npc1c8jx.js +0 -44
- package/dist/index-p7g30wd2.js +0 -281
- package/dist/index-rbht7m9r.js +0 -36
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- package/dist/index-v8vvsn9x.js +0 -169
- package/dist/index-z14anrqp.js +0 -226
- package/dist/init-f9mgmew3.js +0 -186
- package/dist/remote-q59qk463.js +0 -97
- package/dist/test/bridge-context.d.ts +0 -76
- package/dist/test/bridge-context.d.ts.map +0 -1
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
- package/dist/types-wdcpnfvy.js +0 -487
- package/dist/worker-entrypoint-m9th0rg0.js +0 -13
package/dist/sveltekit/index.js
CHANGED
|
@@ -1,184 +1,392 @@
|
|
|
1
|
-
import"../
|
|
2
|
-
import"../
|
|
3
|
-
import"../
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "../
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var platformCache = null;
|
|
17
|
-
function getPlatformCacheKey(bridgeUrl) {
|
|
18
|
-
return bridgeUrl;
|
|
1
|
+
import { r as loadConfig } from "../_chunks/loader-BC0skbnH.js";
|
|
2
|
+
import { l as normalizeHyperdriveBinding } from "../_chunks/schema-normalization-CTdiY17P.js";
|
|
3
|
+
import { D as createFetchEvent, I as getClient, M as createEnvProxy, P as setBindingHints, v as runWithEventContext } from "../_chunks/context-DGMev2AF.js";
|
|
4
|
+
import { createLocalSendEmailBinding } from "../utils/send-email.js";
|
|
5
|
+
import { i as extractBindingHints, n as createLocalWorkerLoaderBinding, t as createLocalHyperdrive } from "../_chunks/local-hyperdrive-CcORzo76.js";
|
|
6
|
+
import { t as buildLocalSecretNodeBindings } from "../_chunks/local-secrets-C0n5oRgI.js";
|
|
7
|
+
import { n as createLocalImagesBinding, r as createLocalMediaBinding } from "../_chunks/local-media-bindings-ZQe-epuw.js";
|
|
8
|
+
//#region src/sveltekit/local-bindings.ts
|
|
9
|
+
function buildLocalHyperdriveBindings(config) {
|
|
10
|
+
const bindings = {};
|
|
11
|
+
for (const [name, binding] of Object.entries(config.bindings?.hyperdrive ?? {})) {
|
|
12
|
+
const normalized = normalizeHyperdriveBinding(binding);
|
|
13
|
+
if (normalized.localConnectionString) bindings[name] = createLocalHyperdrive(normalized.localConnectionString);
|
|
14
|
+
}
|
|
15
|
+
return bindings;
|
|
19
16
|
}
|
|
17
|
+
function buildSvelteKitLocalBindings(config, cwd) {
|
|
18
|
+
const bindings = {
|
|
19
|
+
...config.vars ?? {},
|
|
20
|
+
...buildLocalHyperdriveBindings(config),
|
|
21
|
+
...buildLocalSecretNodeBindings(config, cwd)
|
|
22
|
+
};
|
|
23
|
+
for (const [name, binding] of Object.entries(config.bindings?.sendEmail ?? {})) bindings[name] = createLocalSendEmailBinding(binding);
|
|
24
|
+
for (const name of Object.keys(config.bindings?.workerLoaders ?? {})) bindings[name] = createLocalWorkerLoaderBinding();
|
|
25
|
+
for (const name of Object.keys(config.bindings?.images ?? {})) bindings[name] = createLocalImagesBinding();
|
|
26
|
+
for (const name of Object.keys(config.bindings?.media ?? {})) bindings[name] = createLocalMediaBinding();
|
|
27
|
+
return bindings;
|
|
28
|
+
}
|
|
29
|
+
function overlayLocalBindings(baseEnv, localBindings) {
|
|
30
|
+
if (Object.keys(localBindings).length === 0) return baseEnv;
|
|
31
|
+
return new Proxy(baseEnv, {
|
|
32
|
+
get(target, prop, receiver) {
|
|
33
|
+
if (typeof prop === "string" && prop in localBindings) return localBindings[prop];
|
|
34
|
+
return Reflect.get(target, prop, receiver);
|
|
35
|
+
},
|
|
36
|
+
has(target, prop) {
|
|
37
|
+
return typeof prop === "string" && prop in localBindings || Reflect.has(target, prop);
|
|
38
|
+
},
|
|
39
|
+
ownKeys(target) {
|
|
40
|
+
return Array.from(new Set([...Reflect.ownKeys(target), ...Reflect.ownKeys(localBindings)]));
|
|
41
|
+
},
|
|
42
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
43
|
+
if (typeof prop === "string" && prop in localBindings) return {
|
|
44
|
+
configurable: true,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
writable: false,
|
|
47
|
+
value: localBindings[prop]
|
|
48
|
+
};
|
|
49
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/sveltekit/platform.ts
|
|
55
|
+
/** Cached platform keyed by bridgeUrl + binding hint fingerprint */
|
|
56
|
+
let platformCache = null;
|
|
57
|
+
/**
|
|
58
|
+
* Generate a stable fingerprint for binding hints so cached platforms are not
|
|
59
|
+
* shared across configs with differing hint sets.
|
|
60
|
+
*/
|
|
61
|
+
function fingerprintHints(hints) {
|
|
62
|
+
const entries = Object.keys(hints).sort().map((name) => [name, hints[name]]);
|
|
63
|
+
return JSON.stringify(entries);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Generate cache key from options
|
|
67
|
+
*/
|
|
68
|
+
function getPlatformCacheKey(bridgeUrl, hints) {
|
|
69
|
+
return `${bridgeUrl}\u0000${fingerprintHints(hints)}`;
|
|
70
|
+
}
|
|
71
|
+
function shouldUseCachedPlatform(localBindings) {
|
|
72
|
+
return Object.keys(localBindings).length === 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Build a dev-mode ExecutionContext that records `waitUntil()` rejections on
|
|
76
|
+
* the provided `pendingErrors` array. The original console.error log is kept
|
|
77
|
+
* for parity with existing behavior.
|
|
78
|
+
*/
|
|
79
|
+
function createDevExecutionContext(pendingErrors) {
|
|
80
|
+
return {
|
|
81
|
+
waitUntil: (promise) => {
|
|
82
|
+
promise.catch((err) => {
|
|
83
|
+
console.error("[devflare] waitUntil error:", err);
|
|
84
|
+
pendingErrors.push(err);
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
passThroughOnException: () => {}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Total budget for riding out a transient bridge outage while (re)connecting for a request. An HMR worker
|
|
92
|
+
* reload or a brief coordinator restart drops the bridge socket for well under a second; retrying within this
|
|
93
|
+
* window keeps the request's bindings available instead of failing it. Kept modest so a bridge that is
|
|
94
|
+
* genuinely down (devflare not running) still surfaces the error promptly rather than hanging every request.
|
|
95
|
+
*/
|
|
96
|
+
const BRIDGE_CONNECT_MAX_WAIT_MS = 3e3;
|
|
97
|
+
/** Delay between bridge (re)connect attempts within {@link BRIDGE_CONNECT_MAX_WAIT_MS}. */
|
|
98
|
+
const BRIDGE_CONNECT_RETRY_DELAY_MS = 150;
|
|
99
|
+
/**
|
|
100
|
+
* Connect to the bridge, riding out a TRANSIENT outage with a bounded retry.
|
|
101
|
+
*
|
|
102
|
+
* The bridge socket drops for a fraction of a second whenever the dev runtime reloads a worker (HMR /
|
|
103
|
+
* config change) or the coordinator briefly restarts (e.g. after a worker threw). A single per-request
|
|
104
|
+
* `connect()` attempt rejects the instant the socket is refused, which the SvelteKit handle turns into
|
|
105
|
+
* "dropped every binding for this request" — so an unrelated route 500s with a missing D1/KV/R2 binding
|
|
106
|
+
* mid-reload. Retrying for a short window instead lets the reconnect land and the request proceed. The LAST
|
|
107
|
+
* error is rethrown only once the budget is spent (the bridge really is down), so a genuine
|
|
108
|
+
* misconfiguration still fails fast rather than hanging.
|
|
109
|
+
*
|
|
110
|
+
* Exported for unit testing; `sleep`/`now` are injectable so the retry schedule is asserted without real time.
|
|
111
|
+
*
|
|
112
|
+
* @param connect - the bridge client's `connect()`; a fresh attempt each call (the client dedups in-flight ones).
|
|
113
|
+
* @param options - `maxWaitMs` total budget, `retryDelayMs` between attempts, and injectable `sleep`/`now` for tests.
|
|
114
|
+
*/
|
|
115
|
+
async function connectBridgeWithRetry(connect, options = {}) {
|
|
116
|
+
const maxWaitMs = options.maxWaitMs ?? BRIDGE_CONNECT_MAX_WAIT_MS;
|
|
117
|
+
const retryDelayMs = options.retryDelayMs ?? BRIDGE_CONNECT_RETRY_DELAY_MS;
|
|
118
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
119
|
+
const now = options.now ?? Date.now;
|
|
120
|
+
const deadline = now() + maxWaitMs;
|
|
121
|
+
for (;;) try {
|
|
122
|
+
await connect();
|
|
123
|
+
return;
|
|
124
|
+
} catch (error) {
|
|
125
|
+
if (now() + retryDelayMs >= deadline) throw error;
|
|
126
|
+
await sleep(retryDelayMs);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create a platform object that routes bindings through the bridge
|
|
131
|
+
*
|
|
132
|
+
* Use this in dev mode to get access to Miniflare bindings via WebSocket RPC.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* // src/hooks.server.ts
|
|
137
|
+
* import { dev } from '$app/environment'
|
|
138
|
+
* import { createDevflarePlatform } from 'devflare/sveltekit'
|
|
139
|
+
*
|
|
140
|
+
* export async function handle({ event, resolve }) {
|
|
141
|
+
* if (dev && process.env.DEVFLARE_DEV) {
|
|
142
|
+
* // Override platform with bridge-connected proxy
|
|
143
|
+
* event.platform = await createDevflarePlatform({
|
|
144
|
+
* hints: {
|
|
145
|
+
* MY_KV: 'kv',
|
|
146
|
+
* MY_DO: 'do',
|
|
147
|
+
* MY_D1: 'd1',
|
|
148
|
+
* MY_R2: 'r2'
|
|
149
|
+
* }
|
|
150
|
+
* })
|
|
151
|
+
* }
|
|
152
|
+
* return resolve(event)
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
20
156
|
async function createDevflarePlatform(options = {}) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return platform;
|
|
157
|
+
const { bridgeUrl = `ws://localhost:${process.env.DEVFLARE_BRIDGE_PORT ?? 8787}`, hints = {}, localBindings = {} } = options;
|
|
158
|
+
const cacheKey = getPlatformCacheKey(bridgeUrl, hints);
|
|
159
|
+
if (shouldUseCachedPlatform(localBindings) && platformCache?.key === cacheKey) return platformCache.platform;
|
|
160
|
+
const client = getClient({ url: bridgeUrl });
|
|
161
|
+
await connectBridgeWithRetry(() => client.connect());
|
|
162
|
+
const env = overlayLocalBindings(createEnvProxy({
|
|
163
|
+
client,
|
|
164
|
+
hints,
|
|
165
|
+
strict: true
|
|
166
|
+
}), localBindings);
|
|
167
|
+
const pendingErrors = [];
|
|
168
|
+
const platform = {
|
|
169
|
+
env,
|
|
170
|
+
context: createDevExecutionContext(pendingErrors),
|
|
171
|
+
caches: {
|
|
172
|
+
default: createMockCache(),
|
|
173
|
+
open: async (cacheName) => createMockCache()
|
|
174
|
+
},
|
|
175
|
+
cf: {
|
|
176
|
+
colo: "DEV",
|
|
177
|
+
country: "XX",
|
|
178
|
+
city: "Development",
|
|
179
|
+
continent: "XX",
|
|
180
|
+
latitude: "0",
|
|
181
|
+
longitude: "0",
|
|
182
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
183
|
+
region: "Development",
|
|
184
|
+
regionCode: "DEV",
|
|
185
|
+
asn: 0,
|
|
186
|
+
asOrganization: "Devflare Dev"
|
|
187
|
+
},
|
|
188
|
+
pendingErrors
|
|
189
|
+
};
|
|
190
|
+
if (shouldUseCachedPlatform(localBindings)) platformCache = {
|
|
191
|
+
key: cacheKey,
|
|
192
|
+
platform
|
|
193
|
+
};
|
|
194
|
+
return platform;
|
|
60
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Create a simple mock cache for dev mode
|
|
198
|
+
* Note: Cloudflare's Cache interface differs from browser Cache API
|
|
199
|
+
*/
|
|
61
200
|
function createMockCache() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
201
|
+
const store = /* @__PURE__ */ new Map();
|
|
202
|
+
return {
|
|
203
|
+
async match(request) {
|
|
204
|
+
const key = typeof request === "string" ? request : request instanceof URL ? request.href : request.url;
|
|
205
|
+
return store.get(key)?.clone();
|
|
206
|
+
},
|
|
207
|
+
async put(request, response) {
|
|
208
|
+
const key = typeof request === "string" ? request : request instanceof URL ? request.href : request.url;
|
|
209
|
+
store.set(key, response.clone());
|
|
210
|
+
},
|
|
211
|
+
async delete(request) {
|
|
212
|
+
const key = typeof request === "string" ? request : request instanceof URL ? request.href : request.url;
|
|
213
|
+
return store.delete(key);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
77
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Reset the cached platform (for testing)
|
|
219
|
+
*/
|
|
78
220
|
function resetPlatform() {
|
|
79
|
-
|
|
221
|
+
platformCache = null;
|
|
80
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Reset the cached config (for testing)
|
|
225
|
+
*/
|
|
81
226
|
function resetConfigCache() {
|
|
82
|
-
|
|
227
|
+
configCache = null;
|
|
83
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Check if running in devflare dev mode
|
|
231
|
+
*/
|
|
84
232
|
function isDevflareDev() {
|
|
85
|
-
|
|
233
|
+
return process.env.DEVFLARE_DEV === "true";
|
|
86
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Get the bridge port from environment
|
|
237
|
+
*/
|
|
87
238
|
function getBridgePort() {
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
for (const name of Object.keys(bindings.durableObjects)) {
|
|
113
|
-
hints[name] = "do";
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (bindings.queues?.producers) {
|
|
117
|
-
for (const name of Object.keys(bindings.queues.producers)) {
|
|
118
|
-
hints[name] = "queue";
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (bindings.services) {
|
|
122
|
-
for (const name of Object.keys(bindings.services)) {
|
|
123
|
-
hints[name] = "service";
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (bindings.ai?.binding) {
|
|
127
|
-
hints[bindings.ai.binding] = "ai";
|
|
128
|
-
}
|
|
129
|
-
return hints;
|
|
130
|
-
}
|
|
131
|
-
async function loadHintsFromConfig() {
|
|
132
|
-
const cwd = process.cwd();
|
|
133
|
-
if (configCache?.cwd === cwd) {
|
|
134
|
-
const config2 = await configCache.promise;
|
|
135
|
-
return config2 ? extractHintsFromConfig(config2) : {};
|
|
136
|
-
}
|
|
137
|
-
const promise = loadConfig({ cwd }).catch((err) => {
|
|
138
|
-
if (process.env.DEVFLARE_DEBUG) {
|
|
139
|
-
console.warn("[devflare] Failed to load config for hints:", err.message);
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
});
|
|
143
|
-
configCache = { cwd, promise };
|
|
144
|
-
const config = await promise;
|
|
145
|
-
return config ? extractHintsFromConfig(config) : {};
|
|
239
|
+
return Number.parseInt(process.env.DEVFLARE_BRIDGE_PORT ?? "8787", 10);
|
|
240
|
+
}
|
|
241
|
+
/** Cached config promise keyed by cwd + explicit config path */
|
|
242
|
+
let configCache = null;
|
|
243
|
+
function getConfigFileFromEnv() {
|
|
244
|
+
return process.env.DEVFLARE_CONFIG_PATH;
|
|
245
|
+
}
|
|
246
|
+
async function loadConfigFromCurrentCwd() {
|
|
247
|
+
const cwd = process.cwd();
|
|
248
|
+
const configFile = getConfigFileFromEnv();
|
|
249
|
+
if (configCache?.cwd === cwd && configCache.configFile === configFile) return configCache.promise;
|
|
250
|
+
const promise = loadConfig({
|
|
251
|
+
cwd,
|
|
252
|
+
configFile
|
|
253
|
+
}).catch((err) => {
|
|
254
|
+
if (process.env.DEVFLARE_DEBUG) console.warn("[devflare] Failed to load config for hints:", err.message);
|
|
255
|
+
return null;
|
|
256
|
+
});
|
|
257
|
+
configCache = {
|
|
258
|
+
cwd,
|
|
259
|
+
configFile,
|
|
260
|
+
promise
|
|
261
|
+
};
|
|
262
|
+
return promise;
|
|
146
263
|
}
|
|
264
|
+
async function loadPlatformOptionsFromConfig() {
|
|
265
|
+
const cwd = process.cwd();
|
|
266
|
+
const config = await loadConfigFromCurrentCwd();
|
|
267
|
+
if (!config) return {
|
|
268
|
+
hints: {},
|
|
269
|
+
localBindings: {}
|
|
270
|
+
};
|
|
271
|
+
return {
|
|
272
|
+
hints: extractBindingHints(config),
|
|
273
|
+
localBindings: buildSvelteKitLocalBindings(config, cwd)
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function resolveWithPlatformContext(event, resolve, platform) {
|
|
277
|
+
if (!(event.request instanceof Request)) return resolve(event);
|
|
278
|
+
return runWithEventContext(createFetchEvent(event.request, platform.env, platform.context), () => resolve(event));
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Build this request's dev platform, reporting a failure instead of throwing.
|
|
282
|
+
*
|
|
283
|
+
* A dev request should still be served when the bridge is unreachable — just without bindings — so the
|
|
284
|
+
* failure is deliberately swallowed here. Equally deliberately, this covers ONLY the setup: resolving
|
|
285
|
+
* options and connecting. An error raised by the request itself belongs to the request. Catching that
|
|
286
|
+
* here (as one try around setup AND `resolve()` used to) blamed it on the platform, hid the real cause,
|
|
287
|
+
* and re-ran the whole request — repeating every side effect and running the second pass outside the
|
|
288
|
+
* context {@link resolveWithPlatformContext} established for the first.
|
|
289
|
+
*
|
|
290
|
+
* @param resolveOptions - produces the platform options; may itself fail (config load, hint extraction).
|
|
291
|
+
* @returns the platform, or null when it could not be built.
|
|
292
|
+
*/
|
|
293
|
+
async function createPlatformOrReport(resolveOptions) {
|
|
294
|
+
try {
|
|
295
|
+
return await createDevflarePlatform(await resolveOptions());
|
|
296
|
+
} catch (error) {
|
|
297
|
+
console.error("[devflare] Failed to create platform:", error);
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Attach a built platform to the event and resolve the request under its context.
|
|
303
|
+
*
|
|
304
|
+
* @param event - the SvelteKit request event.
|
|
305
|
+
* @param resolve - SvelteKit's resolve for this handle.
|
|
306
|
+
* @param platform - the platform from {@link createPlatformOrReport}.
|
|
307
|
+
*/
|
|
308
|
+
function serveWithPlatform(event, resolve, platform) {
|
|
309
|
+
event.platform = platform;
|
|
310
|
+
return resolveWithPlatformContext(event, resolve, platform);
|
|
311
|
+
}
|
|
312
|
+
async function getAutoPlatformOptions() {
|
|
313
|
+
const options = await loadPlatformOptionsFromConfig();
|
|
314
|
+
setBindingHints(options.hints ?? {});
|
|
315
|
+
return options;
|
|
316
|
+
}
|
|
317
|
+
async function getCustomPlatformOptions(options) {
|
|
318
|
+
if (options.hints) setBindingHints(options.hints);
|
|
319
|
+
return options;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Create a SvelteKit handle that automatically injects the devflare platform
|
|
323
|
+
* in development mode. This eliminates the need for boilerplate in hooks.server.ts.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* // src/hooks.server.ts
|
|
328
|
+
* import { createHandle } from 'devflare/sveltekit'
|
|
329
|
+
*
|
|
330
|
+
* export const handle = createHandle({
|
|
331
|
+
* hints: {
|
|
332
|
+
* MY_KV: 'kv',
|
|
333
|
+
* MY_DO: 'do',
|
|
334
|
+
* MY_D1: 'd1',
|
|
335
|
+
* MY_R2: 'r2'
|
|
336
|
+
* }
|
|
337
|
+
* })
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @example Composing with other handles using SvelteKit's sequence
|
|
341
|
+
* ```ts
|
|
342
|
+
* import { sequence } from '@sveltejs/kit/hooks'
|
|
343
|
+
* import { createHandle } from 'devflare/sveltekit'
|
|
344
|
+
*
|
|
345
|
+
* const devflareHandle = createHandle({ hints: { ... } })
|
|
346
|
+
* const authHandle: Handle = async ({ event, resolve }) => { ... }
|
|
347
|
+
*
|
|
348
|
+
* export const handle = sequence(devflareHandle, authHandle)
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
147
351
|
function createHandle(options = {}) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
export
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
352
|
+
const { shouldEnable, ...platformOptions } = options;
|
|
353
|
+
return async ({ event, resolve }) => {
|
|
354
|
+
if (shouldEnable ? shouldEnable() : process.env.NODE_ENV !== "production" && process.env.DEVFLARE_DEV === "true") {
|
|
355
|
+
const platform = await createPlatformOrReport(() => getCustomPlatformOptions(platformOptions));
|
|
356
|
+
if (platform) return serveWithPlatform(event, resolve, platform);
|
|
357
|
+
}
|
|
358
|
+
return resolve(event);
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Pre-configured SvelteKit handle that auto-loads binding hints from devflare.config.ts.
|
|
363
|
+
*
|
|
364
|
+
* This is the simplest way to integrate devflare with SvelteKit:
|
|
365
|
+
*
|
|
366
|
+
* @example Simplest usage — just re-export
|
|
367
|
+
* ```ts
|
|
368
|
+
* // src/hooks.server.ts
|
|
369
|
+
* export { handle } from 'devflare/sveltekit'
|
|
370
|
+
* ```
|
|
371
|
+
*
|
|
372
|
+
* @example With other handles
|
|
373
|
+
* ```ts
|
|
374
|
+
* // src/hooks.server.ts
|
|
375
|
+
* import { sequence } from '@sveltejs/kit/hooks'
|
|
376
|
+
* import { handle as devflareHandle } from 'devflare/sveltekit'
|
|
377
|
+
*
|
|
378
|
+
* const authHandle: Handle = async ({ event, resolve }) => { ... }
|
|
379
|
+
*
|
|
380
|
+
* export const handle = sequence(devflareHandle, authHandle)
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
const handle = async (input) => {
|
|
384
|
+
const { event, resolve } = input;
|
|
385
|
+
if (process.env.NODE_ENV !== "production" && process.env.DEVFLARE_DEV === "true") {
|
|
386
|
+
const platform = await createPlatformOrReport(getAutoPlatformOptions);
|
|
387
|
+
if (platform) return serveWithPlatform(event, resolve, platform);
|
|
388
|
+
}
|
|
389
|
+
return resolve(event);
|
|
184
390
|
};
|
|
391
|
+
//#endregion
|
|
392
|
+
export { createDevflarePlatform, createHandle, getBridgePort, handle, isDevflareDev, resetConfigCache, resetPlatform };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type DevflareConfig } from '../config/index.js';
|
|
2
|
+
export declare function buildSvelteKitLocalBindings(config: DevflareConfig, cwd: string): Record<string, unknown>;
|
|
3
|
+
export declare function overlayLocalBindings(baseEnv: Record<string, unknown>, localBindings: Record<string, unknown>): Record<string, unknown>;
|
|
4
|
+
//# sourceMappingURL=local-bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-bindings.d.ts","sourceRoot":"","sources":["../../src/sveltekit/local-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA8B,MAAM,WAAW,CAAA;AAoB3E,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwBzB;AAED,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgCzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BindingHints } from '../bridge';
|
|
1
|
+
import { type BindingHints } from '../bridge/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* SvelteKit platform object shape
|
|
4
4
|
*/
|
|
@@ -7,6 +7,11 @@ export interface Platform {
|
|
|
7
7
|
context: ExecutionContext;
|
|
8
8
|
caches: CacheStorage;
|
|
9
9
|
cf: Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Errors captured from `ctx.waitUntil()` rejections in dev mode.
|
|
12
|
+
* Drain via `drainWaitUntilErrors(platform)`.
|
|
13
|
+
*/
|
|
14
|
+
pendingErrors?: unknown[];
|
|
10
15
|
}
|
|
11
16
|
export interface DevflarePlatformOptions {
|
|
12
17
|
/**
|
|
@@ -19,7 +24,40 @@ export interface DevflarePlatformOptions {
|
|
|
19
24
|
* Keys are binding names, values are binding types
|
|
20
25
|
*/
|
|
21
26
|
hints?: BindingHints;
|
|
27
|
+
/**
|
|
28
|
+
* Local Node-side binding shims to prefer over the bridge-backed env.
|
|
29
|
+
* Used by the SvelteKit handle for bindings whose local API exposes
|
|
30
|
+
* synchronous properties or rich transformation objects.
|
|
31
|
+
*/
|
|
32
|
+
localBindings?: Record<string, unknown>;
|
|
22
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Drain errors captured from `ctx.waitUntil()` calls on a dev platform.
|
|
36
|
+
* Returns a snapshot of the pending errors and clears the buffer.
|
|
37
|
+
*/
|
|
38
|
+
export declare function drainWaitUntilErrors(platform: Platform): unknown[];
|
|
39
|
+
/**
|
|
40
|
+
* Connect to the bridge, riding out a TRANSIENT outage with a bounded retry.
|
|
41
|
+
*
|
|
42
|
+
* The bridge socket drops for a fraction of a second whenever the dev runtime reloads a worker (HMR /
|
|
43
|
+
* config change) or the coordinator briefly restarts (e.g. after a worker threw). A single per-request
|
|
44
|
+
* `connect()` attempt rejects the instant the socket is refused, which the SvelteKit handle turns into
|
|
45
|
+
* "dropped every binding for this request" — so an unrelated route 500s with a missing D1/KV/R2 binding
|
|
46
|
+
* mid-reload. Retrying for a short window instead lets the reconnect land and the request proceed. The LAST
|
|
47
|
+
* error is rethrown only once the budget is spent (the bridge really is down), so a genuine
|
|
48
|
+
* misconfiguration still fails fast rather than hanging.
|
|
49
|
+
*
|
|
50
|
+
* Exported for unit testing; `sleep`/`now` are injectable so the retry schedule is asserted without real time.
|
|
51
|
+
*
|
|
52
|
+
* @param connect - the bridge client's `connect()`; a fresh attempt each call (the client dedups in-flight ones).
|
|
53
|
+
* @param options - `maxWaitMs` total budget, `retryDelayMs` between attempts, and injectable `sleep`/`now` for tests.
|
|
54
|
+
*/
|
|
55
|
+
export declare function connectBridgeWithRetry(connect: () => Promise<void>, options?: {
|
|
56
|
+
maxWaitMs?: number;
|
|
57
|
+
retryDelayMs?: number;
|
|
58
|
+
sleep?: (ms: number) => Promise<void>;
|
|
59
|
+
now?: () => number;
|
|
60
|
+
}): Promise<void>;
|
|
23
61
|
/**
|
|
24
62
|
* Create a platform object that routes bindings through the bridge
|
|
25
63
|
*
|
|
@@ -107,6 +145,7 @@ export interface CreateHandleOptions extends DevflarePlatformOptions {
|
|
|
107
145
|
export declare function createHandle<T extends {
|
|
108
146
|
event: {
|
|
109
147
|
platform?: unknown;
|
|
148
|
+
request?: Request;
|
|
110
149
|
};
|
|
111
150
|
resolve: (event: unknown) => Response | Promise<Response>;
|
|
112
151
|
}>(options?: CreateHandleOptions): (input: T) => Promise<Response>;
|
|
@@ -135,7 +174,8 @@ export declare function createHandle<T extends {
|
|
|
135
174
|
export declare const handle: <T extends {
|
|
136
175
|
event: {
|
|
137
176
|
platform?: unknown;
|
|
177
|
+
request?: Request;
|
|
138
178
|
};
|
|
139
|
-
resolve: (event: unknown) =>
|
|
179
|
+
resolve: (event: unknown) => Response | Promise<Response>;
|
|
140
180
|
}>(input: T) => Promise<Response>;
|
|
141
181
|
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/sveltekit/platform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/sveltekit/platform.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAA8C,MAAM,WAAW,CAAA;AAUzF;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,OAAO,EAAE,gBAAgB,CAAA;IACzB,MAAM,EAAE,YAAY,CAAA;IACpB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC3B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IAEpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC;AAkDD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,EAAE,CAQlE;AAYD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,CAC3C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,OAAO,GAAE;IACR,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACb,GACJ,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,sBAAsB,CAC3C,OAAO,GAAE,uBAA4B,GACnC,OAAO,CAAC,QAAQ,CAAC,CAsDnB;AA4BD;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AA8HD;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IACnE;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,YAAY,CAC3B,CAAC,SAAS;IACT,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IAChD,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACzD,EACA,OAAO,GAAE,mBAAwB,GAAG,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAiBpE;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,MAAM,GAClB,CAAC,SAAS;IACT,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IAChD,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACzD,SAEM,CAAC,KACN,OAAO,CAAC,QAAQ,CAalB,CAAA"}
|