devflare 1.0.0-next.15 → 1.0.0-next.16
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/LLM.md +9360 -1819
- package/README.md +313 -39
- package/bin/devflare.js +17 -7
- package/dist/account-0w8wdzjv.js +475 -0
- package/dist/account-eygq6qx7.js +475 -0
- package/dist/account-fw8nafav.js +475 -0
- package/dist/account-pzq69nys.js +475 -0
- package/dist/account-s66jb15j.js +475 -0
- package/dist/api-d6ekexs5.js +25 -0
- package/dist/bridge/index.d.ts +1 -1
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/protocol.d.ts +1 -1
- package/dist/bridge/protocol.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +0 -4
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/serialization.d.ts.map +1 -1
- package/dist/bridge/server.d.ts +1 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/browser-shim/handler.d.ts +1 -1
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser.d.ts +1648 -38
- package/dist/browser.d.ts.map +1 -1
- package/dist/build-1kmkwqgh.js +53 -0
- package/dist/build-506kjhcm.js +53 -0
- package/dist/build-66866ahs.js +53 -0
- package/dist/build-g1adm3ww.js +53 -0
- package/dist/build-p3r3117t.js +53 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +24 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +0 -1
- package/dist/bundler/worker-bundler.d.ts.map +1 -1
- 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 +1 -1
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +27 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- 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/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 +44 -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.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 +2 -1
- package/dist/cli/config-path.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/preview-bindings.d.ts +42 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +11 -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/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 +4 -0
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +57 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/kv-namespace.d.ts +3 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -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-records.d.ts +61 -0
- package/dist/cloudflare/preview-registry-records.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-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/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/tokens.d.ts +18 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +122 -5
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/compiler.d.ts +4 -0
- package/dist/config/compiler.d.ts.map +1 -1
- 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 +4 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/preview-resources.d.ts +77 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +31 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +0 -22
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve.d.ts +1 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resource-resolution.d.ts +21 -5
- package/dist/config/resource-resolution.d.ts.map +1 -1
- package/dist/config/schema-bindings.d.ts +693 -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 +1341 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +64 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +230 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema.d.ts +542 -3736
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config-entry.d.ts +5 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/{config-v9tr4rts.js → config-fjwke42y.js} +6 -4
- package/dist/config-hwdqjse7.js +59 -0
- package/dist/config-pxvewrhv.js +59 -0
- package/dist/config-q0g5qdga.js +59 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/deploy-7nmzc9r8.js +609 -0
- package/dist/deploy-csfhdr64.js +691 -0
- package/dist/deploy-ex4g5avz.js +621 -0
- package/dist/deploy-jnb0bhka.js +609 -0
- package/dist/deploy-tp0g6qdp.js +609 -0
- package/dist/deploy-ykpcjkc2.js +690 -0
- package/dist/{dev-ymtphbkg.js → dev-2pd33m28.js} +386 -348
- package/dist/dev-7ef5e2j1.js +2409 -0
- package/dist/dev-8nssqatr.js +2409 -0
- package/dist/dev-grznx8fn.js +2409 -0
- package/dist/dev-server/d1-migrations.d.ts +14 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +8 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -1
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +14 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +1 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts +11 -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/{doctor-xv4gm1h4.js → doctor-04ammrrh.js} +67 -32
- package/dist/doctor-fmjj65mc.js +245 -0
- package/dist/doctor-fzkznce1.js +245 -0
- package/dist/doctor-sa5xv1bz.js +245 -0
- package/dist/index-091sh1ma.js +1229 -0
- package/dist/index-0apbm26n.js +788 -0
- package/dist/index-0eqksag4.js +418 -0
- package/dist/{index-k8vh558d.js → index-0kfzdywd.js} +15 -2
- package/dist/index-0w826dsr.js +379 -0
- package/dist/{index-5s1bz1e0.js → index-11m5a8wd.js} +100 -22
- package/dist/{index-0rsa2c1t.js → index-1sp39f2f.js} +110 -57
- package/dist/index-2jnrqbny.js +1301 -0
- package/dist/index-2pb7b9mw.js +378 -0
- package/dist/{index-3a4mmn57.js → index-2x53aqjm.js} +1065 -890
- package/dist/index-3ke5d2vn.js +1229 -0
- package/dist/index-43dq8yx8.js +788 -0
- package/dist/index-4rrttqj5.js +378 -0
- package/dist/index-4v9bc2pc.js +1367 -0
- package/dist/index-61jsjnsv.js +280 -0
- package/dist/index-6jef5emv.js +176 -0
- package/dist/index-6psz1h4c.js +788 -0
- package/dist/index-72mve6vh.js +168 -0
- package/dist/{index-zvgc3e0c.js → index-74198nxd.js} +159 -63
- package/dist/{index-7bq4xq84.js → index-7g8zyws4.js} +7 -12
- package/dist/index-7kcxjhta.js +456 -0
- package/dist/index-7v583xan.js +418 -0
- package/dist/index-7x0ybbtx.js +133 -0
- package/dist/index-816krz9p.js +52 -0
- package/dist/index-82f1z98k.js +41 -0
- package/dist/index-8t5nb4qx.js +133 -0
- package/dist/index-9az6s7ad.js +52 -0
- package/dist/{index-59df49vn.js → index-9ba1etyz.js} +29 -51
- package/dist/{index-001mw014.js → index-9fbtk7gv.js} +134 -248
- package/dist/index-9n6djthj.js +490 -0
- package/dist/index-aabgympv.js +39 -0
- package/dist/index-b8m6883k.js +74 -0
- package/dist/{index-5yxg30va.js → index-cgbvmse6.js} +15 -6
- package/dist/index-d8etnfef.js +1229 -0
- package/dist/index-e9yw4d6y.js +133 -0
- package/dist/index-epw1jxz5.js +1204 -0
- package/dist/index-f85s8gj3.js +2649 -0
- package/dist/index-fe2ngvh7.js +1229 -0
- package/dist/index-fvsadj32.js +192 -0
- package/dist/index-gs4y9gdf.js +456 -0
- package/dist/{index-fef08w43.js → index-h18pxvzs.js} +7 -6
- package/dist/index-hfj1a2c4.js +2649 -0
- package/dist/{index-8gtqgb3q.js → index-hjy8ctpc.js} +14 -92
- package/dist/index-htzf0py1.js +1204 -0
- package/dist/index-j185x270.js +897 -0
- package/dist/index-jb75kwa4.js +519 -0
- package/dist/index-jwd8pcb2.js +897 -0
- package/dist/index-k29yjhv0.js +52 -0
- package/dist/index-k6vq6kkt.js +456 -0
- package/dist/{index-vky23txa.js → index-m3fmw6mx.js} +2 -2
- package/dist/index-maxpsfk8.js +402 -0
- package/dist/index-mbdmrner.js +402 -0
- package/dist/index-mea5bc45.js +418 -0
- package/dist/index-mqekt778.js +185 -0
- package/dist/index-na3mnm1k.js +74 -0
- package/dist/index-p03n4qet.js +1367 -0
- package/dist/index-p296ban8.js +191 -0
- package/dist/index-pnbs1b8k.js +280 -0
- package/dist/index-q4kaz181.js +1207 -0
- package/dist/index-ry131z23.js +378 -0
- package/dist/index-sgb7c8nm.js +402 -0
- package/dist/index-sqrksgb2.js +133 -0
- package/dist/index-stgn34cr.js +148 -0
- package/dist/{index-v8vvsn9x.js → index-t08te69w.js} +1 -18
- package/dist/index-thna1tkd.js +280 -0
- package/dist/index-v5nmqthy.js +74 -0
- package/dist/{index-n932ytmq.js → index-vt4yxkmf.js} +2 -2
- package/dist/index-wyq6c6yj.js +402 -0
- package/dist/index-wztc9stx.js +418 -0
- package/dist/index-x9cwdxw5.js +456 -0
- package/dist/index-xk9djfjp.js +519 -0
- package/dist/index-yc0gcchc.js +418 -0
- package/dist/index-yqbxjysa.js +897 -0
- package/dist/index-yzddwp02.js +788 -0
- package/dist/index-zfhq6s96.js +74 -0
- package/dist/index-zt22fe2j.js +54 -0
- package/dist/index-zyt5byt6.js +2649 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/{init-na2atvz2.js → init-r4hnxan3.js} +24 -17
- package/dist/login-2hnz4m4n.js +77 -0
- package/dist/login-5bsxxpvc.js +77 -0
- package/dist/login-6tzvczw2.js +77 -0
- package/dist/login-bhaw72zc.js +77 -0
- package/dist/login-x8tgckqm.js +77 -0
- package/dist/previews-3rn8mz2c.js +1168 -0
- package/dist/previews-d487qde5.js +1200 -0
- package/dist/previews-gm3z0syj.js +1168 -0
- package/dist/previews-j9ymq4ys.js +1169 -0
- package/dist/previews-q031mx34.js +1168 -0
- package/dist/productions-120xg0aq.js +505 -0
- package/dist/productions-5ev5qweg.js +505 -0
- package/dist/productions-me3tdvr9.js +505 -0
- package/dist/productions-p5rbgp2f.js +505 -0
- package/dist/productions-x9p0pym1.js +505 -0
- 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 +6 -267
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +3 -3
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/middleware.d.ts +8 -38
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/src/browser.js +9 -17
- package/dist/src/cli/index.js +3 -1
- package/dist/src/cloudflare/index.js +49 -3
- package/dist/src/config-entry.js +14 -0
- package/dist/src/index.js +24 -20
- package/dist/src/runtime/index.js +3 -9
- package/dist/src/sveltekit/index.js +10 -8
- package/dist/src/test/index.js +16 -19
- package/dist/src/vite/index.js +7 -5
- package/dist/sveltekit/platform.d.ts +1 -1
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/cf.d.ts +10 -10
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +1 -6
- package/dist/test/index.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +0 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- 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-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.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.d.ts +1 -23
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/token-kedhcret.js +419 -0
- package/dist/token-m8jmnjwk.js +419 -0
- package/dist/{types-158m16vd.js → types-0sqwkp7x.js} +244 -140
- package/dist/types-1gwr2ex6.js +572 -0
- package/dist/types-6e5yx6km.js +572 -0
- package/dist/types-p0gckpn6.js +572 -0
- package/dist/utils/send-email.d.ts.map +1 -1
- package/dist/vite/config-file.d.ts.map +1 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-0srh2jfr.js +513 -0
- package/dist/worker-4xrfd10a.js +513 -0
- package/dist/worker-entry/composed-worker.d.ts +0 -7
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/dist/worker-entry/surface-paths.d.ts +15 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-qtam8grz.js +513 -0
- package/dist/worker-qzm0b7br.js +513 -0
- package/dist/worker-y9ha6g44.js +513 -0
- package/package.json +17 -10
- package/R2.md +0 -200
- package/dist/account-spa7gzsn.js +0 -421
- package/dist/build-zv25ke4s.js +0 -102
- package/dist/deploy-6xmqvv06.js +0 -118
- package/dist/index-2q3pmzrx.js +0 -90
- package/dist/index-6nb7w45m.js +0 -79
- package/dist/index-tksw7gpy.js +0 -503
- package/dist/index-v43z02tr.js +0 -205
- package/dist/index-xdq9ery1.js +0 -664
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
package/dist/index-tksw7gpy.js
DELETED
|
@@ -1,503 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getEffectiveAccountId,
|
|
3
|
-
getPrimaryAccount,
|
|
4
|
-
listD1Databases
|
|
5
|
-
} from "./index-xdq9ery1.js";
|
|
6
|
-
|
|
7
|
-
// src/config/schema.ts
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
var dateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
|
10
|
-
var compatibilityDateSchema = z.string().regex(dateRegex, {
|
|
11
|
-
message: "Compatibility date must be in YYYY-MM-DD format"
|
|
12
|
-
});
|
|
13
|
-
var routesConfigSchema = z.object({
|
|
14
|
-
dir: z.string(),
|
|
15
|
-
prefix: z.string().optional()
|
|
16
|
-
});
|
|
17
|
-
var filesSchema = z.object({
|
|
18
|
-
fetch: z.union([z.string(), z.literal(false)]).optional(),
|
|
19
|
-
queue: z.union([z.string(), z.literal(false)]).optional(),
|
|
20
|
-
scheduled: z.union([z.string(), z.literal(false)]).optional(),
|
|
21
|
-
email: z.union([z.string(), z.literal(false)]).optional(),
|
|
22
|
-
durableObjects: z.union([z.string(), z.literal(false)]).optional(),
|
|
23
|
-
entrypoints: z.union([z.string(), z.literal(false)]).optional(),
|
|
24
|
-
workflows: z.union([z.string(), z.literal(false)]).optional(),
|
|
25
|
-
routes: z.union([routesConfigSchema, z.literal(false)]).optional(),
|
|
26
|
-
transport: z.union([z.string(), z.null()]).optional()
|
|
27
|
-
}).optional();
|
|
28
|
-
var durableObjectBindingSchema = z.custom((val) => {
|
|
29
|
-
if (typeof val === "string")
|
|
30
|
-
return true;
|
|
31
|
-
if (val && typeof val === "object" && "className" in val) {
|
|
32
|
-
const obj = val;
|
|
33
|
-
return typeof obj.className === "string";
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
}, {
|
|
37
|
-
message: "Expected string or { className: string, scriptName?: string }"
|
|
38
|
-
});
|
|
39
|
-
var queueConsumerSchema = z.object({
|
|
40
|
-
queue: z.string(),
|
|
41
|
-
maxBatchSize: z.number().optional(),
|
|
42
|
-
maxBatchTimeout: z.number().optional(),
|
|
43
|
-
maxRetries: z.number().optional(),
|
|
44
|
-
deadLetterQueue: z.string().optional(),
|
|
45
|
-
maxConcurrency: z.number().optional(),
|
|
46
|
-
retryDelay: z.number().optional()
|
|
47
|
-
});
|
|
48
|
-
var queuesConfigSchema = z.object({
|
|
49
|
-
producers: z.record(z.string(), z.string()).optional(),
|
|
50
|
-
consumers: z.array(queueConsumerSchema).optional()
|
|
51
|
-
});
|
|
52
|
-
var serviceBindingSchema = z.custom((val) => {
|
|
53
|
-
if (typeof val !== "object" && typeof val !== "function")
|
|
54
|
-
return false;
|
|
55
|
-
const obj = val;
|
|
56
|
-
const service = obj.service;
|
|
57
|
-
if (typeof service !== "string")
|
|
58
|
-
return false;
|
|
59
|
-
return true;
|
|
60
|
-
}, {
|
|
61
|
-
message: "Expected service binding object with { service: string } or ref().worker"
|
|
62
|
-
});
|
|
63
|
-
var aiBindingSchema = z.object({
|
|
64
|
-
binding: z.string()
|
|
65
|
-
});
|
|
66
|
-
var vectorizeBindingSchema = z.object({
|
|
67
|
-
indexName: z.string()
|
|
68
|
-
});
|
|
69
|
-
var hyperdriveBindingSchema = z.object({
|
|
70
|
-
id: z.string()
|
|
71
|
-
});
|
|
72
|
-
var browserBindingSchema = z.object({
|
|
73
|
-
binding: z.string()
|
|
74
|
-
});
|
|
75
|
-
var analyticsBindingSchema = z.object({
|
|
76
|
-
dataset: z.string()
|
|
77
|
-
});
|
|
78
|
-
var sendEmailBindingSchema = z.object({
|
|
79
|
-
destinationAddress: z.string().optional(),
|
|
80
|
-
allowedDestinationAddresses: z.array(z.string()).optional(),
|
|
81
|
-
allowedSenderAddresses: z.array(z.string()).optional()
|
|
82
|
-
}).refine((binding) => {
|
|
83
|
-
return !(binding.destinationAddress && binding.allowedDestinationAddresses);
|
|
84
|
-
}, {
|
|
85
|
-
message: "sendEmail bindings must use either destinationAddress or allowedDestinationAddresses, not both",
|
|
86
|
-
path: ["allowedDestinationAddresses"]
|
|
87
|
-
});
|
|
88
|
-
var d1BindingByIdSchema = z.object({
|
|
89
|
-
id: z.string()
|
|
90
|
-
}).strict();
|
|
91
|
-
var d1BindingByNameSchema = z.object({
|
|
92
|
-
name: z.string()
|
|
93
|
-
}).strict();
|
|
94
|
-
var d1BindingSchema = z.union([
|
|
95
|
-
z.string(),
|
|
96
|
-
d1BindingByIdSchema,
|
|
97
|
-
d1BindingByNameSchema
|
|
98
|
-
]);
|
|
99
|
-
var bindingsSchema = z.object({
|
|
100
|
-
kv: z.record(z.string(), z.string()).optional(),
|
|
101
|
-
d1: z.record(z.string(), d1BindingSchema).optional(),
|
|
102
|
-
r2: z.record(z.string(), z.string()).optional(),
|
|
103
|
-
durableObjects: z.record(z.string(), durableObjectBindingSchema).optional(),
|
|
104
|
-
queues: queuesConfigSchema.optional(),
|
|
105
|
-
services: z.record(z.string(), serviceBindingSchema).optional(),
|
|
106
|
-
ai: aiBindingSchema.optional(),
|
|
107
|
-
vectorize: z.record(z.string(), vectorizeBindingSchema).optional(),
|
|
108
|
-
hyperdrive: z.record(z.string(), hyperdriveBindingSchema).optional(),
|
|
109
|
-
browser: browserBindingSchema.optional(),
|
|
110
|
-
analyticsEngine: z.record(z.string(), analyticsBindingSchema).optional(),
|
|
111
|
-
sendEmail: z.record(z.string(), sendEmailBindingSchema).optional()
|
|
112
|
-
}).optional();
|
|
113
|
-
var triggersSchema = z.object({
|
|
114
|
-
crons: z.array(z.string()).optional()
|
|
115
|
-
}).optional();
|
|
116
|
-
var secretConfigSchema = z.object({
|
|
117
|
-
required: z.boolean().optional().default(true)
|
|
118
|
-
});
|
|
119
|
-
var routeConfigSchema = z.object({
|
|
120
|
-
pattern: z.string(),
|
|
121
|
-
zone_name: z.string().optional(),
|
|
122
|
-
zone_id: z.string().optional(),
|
|
123
|
-
custom_domain: z.boolean().optional()
|
|
124
|
-
});
|
|
125
|
-
var wsRouteConfigSchema = z.object({
|
|
126
|
-
pattern: z.string(),
|
|
127
|
-
doNamespace: z.string(),
|
|
128
|
-
idParam: z.string().default("id"),
|
|
129
|
-
forwardPath: z.string().default("/websocket")
|
|
130
|
-
});
|
|
131
|
-
var assetsConfigSchema = z.object({
|
|
132
|
-
directory: z.string(),
|
|
133
|
-
binding: z.string().optional()
|
|
134
|
-
}).optional();
|
|
135
|
-
var observabilitySchema = z.object({
|
|
136
|
-
enabled: z.boolean().optional(),
|
|
137
|
-
head_sampling_rate: z.number().min(0).max(1).optional()
|
|
138
|
-
}).optional();
|
|
139
|
-
var limitsSchema = z.object({
|
|
140
|
-
cpu_ms: z.number().optional()
|
|
141
|
-
}).optional();
|
|
142
|
-
var rolldownOptionsSchema = z.custom((value) => {
|
|
143
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
144
|
-
}, {
|
|
145
|
-
message: "Expected Rolldown options object"
|
|
146
|
-
});
|
|
147
|
-
var rolldownConfigSchema = z.object({
|
|
148
|
-
target: z.string().optional(),
|
|
149
|
-
minify: z.boolean().optional(),
|
|
150
|
-
sourcemap: z.boolean().optional(),
|
|
151
|
-
options: rolldownOptionsSchema.optional()
|
|
152
|
-
}).optional();
|
|
153
|
-
var viteConfigSchema = z.object({
|
|
154
|
-
plugins: z.array(z.unknown()).optional()
|
|
155
|
-
}).catchall(z.unknown()).optional();
|
|
156
|
-
var buildConfigSchema = z.object({
|
|
157
|
-
target: z.string().optional(),
|
|
158
|
-
minify: z.boolean().optional(),
|
|
159
|
-
sourcemap: z.boolean().optional(),
|
|
160
|
-
rolldownOptions: rolldownOptionsSchema.optional()
|
|
161
|
-
}).optional();
|
|
162
|
-
function normalizeViteConfig(vite, plugins) {
|
|
163
|
-
const normalizedVite = {
|
|
164
|
-
...plugins !== undefined ? { plugins } : {},
|
|
165
|
-
...vite ?? {}
|
|
166
|
-
};
|
|
167
|
-
return Object.keys(normalizedVite).length > 0 ? normalizedVite : undefined;
|
|
168
|
-
}
|
|
169
|
-
function normalizeRolldownConfig(rolldown, build) {
|
|
170
|
-
const normalizedRolldown = {
|
|
171
|
-
...build?.target !== undefined ? { target: build.target } : {},
|
|
172
|
-
...build?.minify !== undefined ? { minify: build.minify } : {},
|
|
173
|
-
...build?.sourcemap !== undefined ? { sourcemap: build.sourcemap } : {},
|
|
174
|
-
...build?.rolldownOptions !== undefined ? { options: build.rolldownOptions } : {},
|
|
175
|
-
...rolldown ?? {}
|
|
176
|
-
};
|
|
177
|
-
return Object.keys(normalizedRolldown).length > 0 ? normalizedRolldown : undefined;
|
|
178
|
-
}
|
|
179
|
-
var migrationSchema = z.object({
|
|
180
|
-
tag: z.string(),
|
|
181
|
-
new_classes: z.array(z.string()).optional(),
|
|
182
|
-
renamed_classes: z.array(z.object({
|
|
183
|
-
from: z.string(),
|
|
184
|
-
to: z.string()
|
|
185
|
-
})).optional(),
|
|
186
|
-
deleted_classes: z.array(z.string()).optional(),
|
|
187
|
-
new_sqlite_classes: z.array(z.string()).optional()
|
|
188
|
-
});
|
|
189
|
-
var wranglerConfigSchema = z.object({
|
|
190
|
-
passthrough: z.record(z.string(), z.unknown()).optional()
|
|
191
|
-
}).optional();
|
|
192
|
-
var envConfigSchema = z.object({
|
|
193
|
-
name: z.string().optional(),
|
|
194
|
-
compatibilityDate: compatibilityDateSchema.optional(),
|
|
195
|
-
compatibilityFlags: z.array(z.string()).optional(),
|
|
196
|
-
files: filesSchema,
|
|
197
|
-
bindings: bindingsSchema,
|
|
198
|
-
triggers: triggersSchema,
|
|
199
|
-
vars: z.record(z.string(), z.string()).optional(),
|
|
200
|
-
secrets: z.record(z.string(), secretConfigSchema).optional(),
|
|
201
|
-
routes: z.array(routeConfigSchema).optional(),
|
|
202
|
-
assets: assetsConfigSchema,
|
|
203
|
-
limits: limitsSchema,
|
|
204
|
-
observability: observabilitySchema,
|
|
205
|
-
migrations: z.array(migrationSchema).optional(),
|
|
206
|
-
rolldown: rolldownConfigSchema,
|
|
207
|
-
vite: viteConfigSchema,
|
|
208
|
-
wrangler: wranglerConfigSchema
|
|
209
|
-
}).partial();
|
|
210
|
-
var envConfigSchemaInner = envConfigSchema.extend({
|
|
211
|
-
build: buildConfigSchema,
|
|
212
|
-
plugins: z.array(z.unknown()).optional()
|
|
213
|
-
}).transform((config) => {
|
|
214
|
-
const normalizedVite = normalizeViteConfig(config.vite, config.plugins);
|
|
215
|
-
const normalizedRolldown = normalizeRolldownConfig(config.rolldown, config.build);
|
|
216
|
-
const {
|
|
217
|
-
build: _legacyBuild,
|
|
218
|
-
plugins: _legacyPlugins,
|
|
219
|
-
vite: _vite,
|
|
220
|
-
rolldown: _rolldown,
|
|
221
|
-
...rest
|
|
222
|
-
} = config;
|
|
223
|
-
return {
|
|
224
|
-
...rest,
|
|
225
|
-
...normalizedVite ? { vite: normalizedVite } : {},
|
|
226
|
-
...normalizedRolldown ? { rolldown: normalizedRolldown } : {}
|
|
227
|
-
};
|
|
228
|
-
});
|
|
229
|
-
function getCurrentDate() {
|
|
230
|
-
const now = new Date;
|
|
231
|
-
return now.toISOString().split("T")[0];
|
|
232
|
-
}
|
|
233
|
-
var FORCED_COMPATIBILITY_FLAGS = ["nodejs_compat", "nodejs_als"];
|
|
234
|
-
var canonicalConfigSchema = z.object({
|
|
235
|
-
name: z.string({
|
|
236
|
-
required_error: "Worker name is required"
|
|
237
|
-
}),
|
|
238
|
-
accountId: z.string().optional(),
|
|
239
|
-
compatibilityDate: compatibilityDateSchema.optional().default(getCurrentDate),
|
|
240
|
-
compatibilityFlags: z.array(z.string()).optional().transform((flags = []) => {
|
|
241
|
-
const merged = new Set([...FORCED_COMPATIBILITY_FLAGS, ...flags]);
|
|
242
|
-
return [...merged];
|
|
243
|
-
}),
|
|
244
|
-
files: filesSchema,
|
|
245
|
-
bindings: bindingsSchema,
|
|
246
|
-
triggers: triggersSchema,
|
|
247
|
-
vars: z.record(z.string(), z.string()).optional(),
|
|
248
|
-
secrets: z.record(z.string(), secretConfigSchema).optional(),
|
|
249
|
-
routes: z.array(routeConfigSchema).optional(),
|
|
250
|
-
wsRoutes: z.array(wsRouteConfigSchema).optional(),
|
|
251
|
-
assets: assetsConfigSchema,
|
|
252
|
-
limits: limitsSchema,
|
|
253
|
-
observability: observabilitySchema,
|
|
254
|
-
migrations: z.array(migrationSchema).optional(),
|
|
255
|
-
rolldown: rolldownConfigSchema,
|
|
256
|
-
vite: viteConfigSchema,
|
|
257
|
-
env: z.record(z.string(), envConfigSchemaInner).optional(),
|
|
258
|
-
wrangler: wranglerConfigSchema
|
|
259
|
-
});
|
|
260
|
-
var configSchema = canonicalConfigSchema.extend({
|
|
261
|
-
build: buildConfigSchema,
|
|
262
|
-
plugins: z.array(z.unknown()).optional()
|
|
263
|
-
}).transform((config) => {
|
|
264
|
-
const normalizedVite = normalizeViteConfig(config.vite, config.plugins);
|
|
265
|
-
const normalizedRolldown = normalizeRolldownConfig(config.rolldown, config.build);
|
|
266
|
-
const {
|
|
267
|
-
build: _legacyBuild,
|
|
268
|
-
plugins: _legacyPlugins,
|
|
269
|
-
vite: _vite,
|
|
270
|
-
rolldown: _rolldown,
|
|
271
|
-
...rest
|
|
272
|
-
} = config;
|
|
273
|
-
return {
|
|
274
|
-
...rest,
|
|
275
|
-
...normalizedVite ? { vite: normalizedVite } : {},
|
|
276
|
-
...normalizedRolldown ? { rolldown: normalizedRolldown } : {}
|
|
277
|
-
};
|
|
278
|
-
});
|
|
279
|
-
function normalizeDOBinding(config) {
|
|
280
|
-
if (typeof config === "string") {
|
|
281
|
-
return { className: config };
|
|
282
|
-
}
|
|
283
|
-
return {
|
|
284
|
-
className: config.className,
|
|
285
|
-
scriptName: config.scriptName,
|
|
286
|
-
__ref: config.__ref
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
function normalizeD1Binding(config) {
|
|
290
|
-
if (typeof config === "string") {
|
|
291
|
-
return { databaseId: config };
|
|
292
|
-
}
|
|
293
|
-
if ("id" in config) {
|
|
294
|
-
return { databaseId: config.id };
|
|
295
|
-
}
|
|
296
|
-
return { name: config.name };
|
|
297
|
-
}
|
|
298
|
-
function getLocalD1DatabaseIdentifier(config) {
|
|
299
|
-
const normalized = normalizeD1Binding(config);
|
|
300
|
-
return normalized.databaseId ?? normalized.name ?? "";
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// src/config/loader.ts
|
|
304
|
-
import { loadConfig as c12LoadConfig } from "c12";
|
|
305
|
-
import { existsSync } from "node:fs";
|
|
306
|
-
import { join } from "pathe";
|
|
307
|
-
var CONFIG_FILES = [
|
|
308
|
-
"devflare.config.ts",
|
|
309
|
-
"devflare.config.mts",
|
|
310
|
-
"devflare.config.js",
|
|
311
|
-
"devflare.config.mjs"
|
|
312
|
-
];
|
|
313
|
-
async function resolveConfigPath(cwd) {
|
|
314
|
-
for (const file of CONFIG_FILES) {
|
|
315
|
-
const path = join(cwd, file);
|
|
316
|
-
if (existsSync(path)) {
|
|
317
|
-
return path;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
async function loadConfig(options = {}) {
|
|
323
|
-
const cwd = options.cwd ?? process.cwd();
|
|
324
|
-
const configFile = options.configFile ?? "devflare.config";
|
|
325
|
-
const { config, configFile: loadedFile } = await c12LoadConfig({
|
|
326
|
-
name: "devflare",
|
|
327
|
-
cwd,
|
|
328
|
-
configFile,
|
|
329
|
-
defaultConfig: undefined,
|
|
330
|
-
rcFile: false,
|
|
331
|
-
globalRc: false,
|
|
332
|
-
dotenv: false
|
|
333
|
-
});
|
|
334
|
-
if (!config || !loadedFile) {
|
|
335
|
-
throw new ConfigNotFoundError(cwd, configFile);
|
|
336
|
-
}
|
|
337
|
-
const result = configSchema.safeParse(config);
|
|
338
|
-
if (!result.success) {
|
|
339
|
-
throw new ConfigValidationError(result.error.issues, loadedFile);
|
|
340
|
-
}
|
|
341
|
-
return result.data;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
class ConfigNotFoundError extends Error {
|
|
345
|
-
cwd;
|
|
346
|
-
configFile;
|
|
347
|
-
code = "CONFIG_NOT_FOUND";
|
|
348
|
-
constructor(cwd, configFile) {
|
|
349
|
-
super(`Config file not found in ${cwd}.
|
|
350
|
-
` + `Expected one of: ${CONFIG_FILES.join(", ")}
|
|
351
|
-
` + `Run 'devflare init' to create a new config.`);
|
|
352
|
-
this.cwd = cwd;
|
|
353
|
-
this.configFile = configFile;
|
|
354
|
-
this.name = "ConfigNotFoundError";
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
class ConfigValidationError extends Error {
|
|
359
|
-
issues;
|
|
360
|
-
configFile;
|
|
361
|
-
code = "CONFIG_VALIDATION_ERROR";
|
|
362
|
-
constructor(issues, configFile) {
|
|
363
|
-
const issueMessages = issues.map((i) => ` - ${i.path.join(".")}: ${i.message}`).join(`
|
|
364
|
-
`);
|
|
365
|
-
super(`Invalid config in ${configFile}:
|
|
366
|
-
${issueMessages}`);
|
|
367
|
-
this.issues = issues;
|
|
368
|
-
this.configFile = configFile;
|
|
369
|
-
this.name = "ConfigValidationError";
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// src/config/resolve.ts
|
|
374
|
-
import { defu } from "defu";
|
|
375
|
-
function resolveConfigForEnvironment(config, environment) {
|
|
376
|
-
if (environment && config.env?.[environment]) {
|
|
377
|
-
return defu(config.env[environment], config);
|
|
378
|
-
}
|
|
379
|
-
return config;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// src/config/resource-resolution.ts
|
|
383
|
-
var defaultCloudflareApi = {
|
|
384
|
-
getPrimaryAccount,
|
|
385
|
-
getEffectiveAccountId,
|
|
386
|
-
listD1Databases
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
class ConfigResourceResolutionError extends Error {
|
|
390
|
-
code = "CONFIG_RESOURCE_RESOLUTION_ERROR";
|
|
391
|
-
constructor(message, cause) {
|
|
392
|
-
super(message);
|
|
393
|
-
this.name = "ConfigResourceResolutionError";
|
|
394
|
-
if (cause !== undefined) {
|
|
395
|
-
this.cause = cause;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
function resolveCloudflareApi(overrides) {
|
|
400
|
-
return {
|
|
401
|
-
...defaultCloudflareApi,
|
|
402
|
-
...overrides ?? {}
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
function materializeLocalD1Bindings(bindings) {
|
|
406
|
-
return Object.fromEntries(Object.entries(bindings).map(([bindingName, bindingConfig]) => {
|
|
407
|
-
return [bindingName, getLocalD1DatabaseIdentifier(bindingConfig)];
|
|
408
|
-
}));
|
|
409
|
-
}
|
|
410
|
-
async function resolveLookupAccountId(config, options, cloudflareApi) {
|
|
411
|
-
const explicitAccountId = options.accountId ?? config.accountId;
|
|
412
|
-
if (explicitAccountId) {
|
|
413
|
-
return explicitAccountId;
|
|
414
|
-
}
|
|
415
|
-
let primaryAccount;
|
|
416
|
-
try {
|
|
417
|
-
primaryAccount = await cloudflareApi.getPrimaryAccount();
|
|
418
|
-
} catch (error) {
|
|
419
|
-
throw new ConfigResourceResolutionError("Could not resolve D1 database names because Devflare could not read your Cloudflare accounts. Set accountId in devflare.config.ts, configure a workspace/global default account, or log in with Wrangler.", error);
|
|
420
|
-
}
|
|
421
|
-
if (!primaryAccount) {
|
|
422
|
-
throw new ConfigResourceResolutionError("Could not resolve D1 database names because no Cloudflare account is available. Set accountId in devflare.config.ts, configure a workspace/global default account, or log in with Wrangler.");
|
|
423
|
-
}
|
|
424
|
-
try {
|
|
425
|
-
const { accountId } = await cloudflareApi.getEffectiveAccountId(primaryAccount.id);
|
|
426
|
-
return accountId;
|
|
427
|
-
} catch (error) {
|
|
428
|
-
throw new ConfigResourceResolutionError(`Could not determine the effective Cloudflare account for D1 name resolution after selecting primary account ${primaryAccount.id}.`, error);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
function formatMissingD1Bindings(missing) {
|
|
432
|
-
return missing.map(({ bindingName, databaseName }) => `${bindingName} → ${databaseName}`).join(", ");
|
|
433
|
-
}
|
|
434
|
-
function resolveConfigForLocalRuntime(config, environment) {
|
|
435
|
-
const resolvedConfig = resolveConfigForEnvironment(config, environment);
|
|
436
|
-
if (!resolvedConfig.bindings?.d1) {
|
|
437
|
-
return resolvedConfig;
|
|
438
|
-
}
|
|
439
|
-
return {
|
|
440
|
-
...resolvedConfig,
|
|
441
|
-
bindings: {
|
|
442
|
-
...resolvedConfig.bindings,
|
|
443
|
-
d1: materializeLocalD1Bindings(resolvedConfig.bindings.d1)
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
async function resolveConfigResources(config, options = {}) {
|
|
448
|
-
const resolvedConfig = resolveConfigForEnvironment(config, options.environment);
|
|
449
|
-
const d1Bindings = resolvedConfig.bindings?.d1;
|
|
450
|
-
if (!d1Bindings) {
|
|
451
|
-
return resolvedConfig;
|
|
452
|
-
}
|
|
453
|
-
const pendingNameBindings = Object.entries(d1Bindings).map(([bindingName, bindingConfig]) => {
|
|
454
|
-
const normalized = normalizeD1Binding(bindingConfig);
|
|
455
|
-
return normalized.databaseId ? null : {
|
|
456
|
-
bindingName,
|
|
457
|
-
databaseName: normalized.name ?? ""
|
|
458
|
-
};
|
|
459
|
-
}).filter((binding) => binding !== null);
|
|
460
|
-
if (pendingNameBindings.length === 0) {
|
|
461
|
-
return {
|
|
462
|
-
...resolvedConfig,
|
|
463
|
-
bindings: {
|
|
464
|
-
...resolvedConfig.bindings,
|
|
465
|
-
d1: materializeLocalD1Bindings(d1Bindings)
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
const cloudflareApi = resolveCloudflareApi(options.cloudflare);
|
|
470
|
-
const accountId = await resolveLookupAccountId(resolvedConfig, options, cloudflareApi);
|
|
471
|
-
let databases;
|
|
472
|
-
try {
|
|
473
|
-
databases = await cloudflareApi.listD1Databases(accountId);
|
|
474
|
-
} catch (error) {
|
|
475
|
-
throw new ConfigResourceResolutionError(`Could not list D1 databases for Cloudflare account ${accountId} while resolving name-based D1 bindings.`, error);
|
|
476
|
-
}
|
|
477
|
-
const databaseIdsByName = new Map(databases.map((database) => [database.name, database.id]));
|
|
478
|
-
const missingBindings = pendingNameBindings.filter(({ databaseName }) => {
|
|
479
|
-
return !databaseIdsByName.has(databaseName);
|
|
480
|
-
});
|
|
481
|
-
if (missingBindings.length > 0) {
|
|
482
|
-
throw new ConfigResourceResolutionError(`Could not find D1 database(s) for ${formatMissingD1Bindings(missingBindings)} in Cloudflare account ${accountId}.`);
|
|
483
|
-
}
|
|
484
|
-
return {
|
|
485
|
-
...resolvedConfig,
|
|
486
|
-
bindings: {
|
|
487
|
-
...resolvedConfig.bindings,
|
|
488
|
-
d1: Object.fromEntries(Object.entries(d1Bindings).map(([bindingName, bindingConfig]) => {
|
|
489
|
-
const normalized = normalizeD1Binding(bindingConfig);
|
|
490
|
-
return [
|
|
491
|
-
bindingName,
|
|
492
|
-
normalized.databaseId ?? databaseIdsByName.get(normalized.name ?? "") ?? ""
|
|
493
|
-
];
|
|
494
|
-
}))
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
async function loadResolvedConfig(options = {}) {
|
|
499
|
-
const config = await loadConfig(options);
|
|
500
|
-
return resolveConfigResources(config, options);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
export { configSchema, normalizeDOBinding, normalizeD1Binding, getLocalD1DatabaseIdentifier, resolveConfigForEnvironment, ConfigResourceResolutionError, resolveConfigForLocalRuntime, resolveConfigResources, loadResolvedConfig, resolveConfigPath, loadConfig, ConfigNotFoundError, ConfigValidationError };
|
package/dist/index-v43z02tr.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getPackageVersion
|
|
3
|
-
} from "./index-6h8xbs75.js";
|
|
4
|
-
import {
|
|
5
|
-
__require
|
|
6
|
-
} from "./index-37x76zdn.js";
|
|
7
|
-
|
|
8
|
-
// src/cli/index.ts
|
|
9
|
-
import { createConsola } from "consola";
|
|
10
|
-
var COMMANDS = ["init", "dev", "build", "deploy", "types", "doctor", "config", "account", "ai", "remote", "help", "version"];
|
|
11
|
-
function parseArgs(argv) {
|
|
12
|
-
const args = [];
|
|
13
|
-
const options = {};
|
|
14
|
-
let command = "help";
|
|
15
|
-
let unknownCommand;
|
|
16
|
-
let i = 0;
|
|
17
|
-
while (i < argv.length) {
|
|
18
|
-
const arg = argv[i];
|
|
19
|
-
if (arg === "--help" || arg === "-h") {
|
|
20
|
-
return { command: "help", args: [], options: {} };
|
|
21
|
-
}
|
|
22
|
-
if (arg === "--version" || arg === "-v") {
|
|
23
|
-
return { command: "version", args: [], options: {} };
|
|
24
|
-
}
|
|
25
|
-
if (arg.startsWith("-") && !/^-\d/.test(arg)) {
|
|
26
|
-
const isLongFlag = arg.startsWith("--");
|
|
27
|
-
const key = isLongFlag ? arg.slice(2) : arg.slice(1);
|
|
28
|
-
const nextArg = argv[i + 1];
|
|
29
|
-
if (nextArg && !nextArg.startsWith("-")) {
|
|
30
|
-
options[key] = nextArg;
|
|
31
|
-
i += 2;
|
|
32
|
-
} else {
|
|
33
|
-
options[key] = true;
|
|
34
|
-
i++;
|
|
35
|
-
}
|
|
36
|
-
} else if (!command || command === "help") {
|
|
37
|
-
if (COMMANDS.includes(arg)) {
|
|
38
|
-
command = arg;
|
|
39
|
-
} else {
|
|
40
|
-
command = "help";
|
|
41
|
-
unknownCommand = arg;
|
|
42
|
-
}
|
|
43
|
-
i++;
|
|
44
|
-
} else {
|
|
45
|
-
args.push(arg);
|
|
46
|
-
i++;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return { command, args, options, unknownCommand };
|
|
50
|
-
}
|
|
51
|
-
function getHelpText() {
|
|
52
|
-
return `
|
|
53
|
-
devflare - Config compiler + CLI orchestrator for Cloudflare Workers
|
|
54
|
-
|
|
55
|
-
Usage:
|
|
56
|
-
devflare <command> [options]
|
|
57
|
-
|
|
58
|
-
Commands:
|
|
59
|
-
init [name] Create a new devflare project
|
|
60
|
-
dev Start the development server
|
|
61
|
-
build Build for production
|
|
62
|
-
deploy Deploy to Cloudflare
|
|
63
|
-
types Generate TypeScript types
|
|
64
|
-
doctor Check project configuration
|
|
65
|
-
config Print resolved Devflare/Wrangler config
|
|
66
|
-
account View Cloudflare account info
|
|
67
|
-
ai View AI models and pricing
|
|
68
|
-
remote Manage remote test mode (AI, Vectorize)
|
|
69
|
-
help Show command overview
|
|
70
|
-
version Show the installed devflare version
|
|
71
|
-
|
|
72
|
-
Common Options:
|
|
73
|
-
--config <path> Used by dev, build, deploy, types, doctor, and config
|
|
74
|
-
--env <name> Used by build, deploy, and config to select config.env[name]
|
|
75
|
-
--debug Enable debug output for supported commands
|
|
76
|
-
-h, --help Show help
|
|
77
|
-
-v, --version Show version
|
|
78
|
-
|
|
79
|
-
Dev Options:
|
|
80
|
-
--port <port> Preferred Vite dev server port (default: 5173)
|
|
81
|
-
--persist Persist Miniflare storage data
|
|
82
|
-
--verbose Enable verbose logging
|
|
83
|
-
--log Log all output to a timestamped .log-* file and the terminal
|
|
84
|
-
--log-temp Log all output to .log (overwritten) and the terminal
|
|
85
|
-
|
|
86
|
-
Build / Deploy:
|
|
87
|
-
build --env <name> Use config.env[name]
|
|
88
|
-
deploy --env <name> Use config.env[name]
|
|
89
|
-
deploy --dry-run Print the generated Wrangler config without deploying
|
|
90
|
-
|
|
91
|
-
Types / Doctor:
|
|
92
|
-
types --output <path> Write generated types to a custom path
|
|
93
|
-
doctor --config <path> Check a specific devflare config file
|
|
94
|
-
config print --json Print resolved config as JSON
|
|
95
|
-
config print --format wrangler Print resolved Wrangler config JSON
|
|
96
|
-
|
|
97
|
-
Account / Remote:
|
|
98
|
-
account --account <id> Use a specific Cloudflare account
|
|
99
|
-
remote status Show current remote-mode status
|
|
100
|
-
remote enable [minutes] Enable remote mode (default: 30 minutes)
|
|
101
|
-
remote disable Disable remote mode
|
|
102
|
-
|
|
103
|
-
Notes:
|
|
104
|
-
• Worker-only mode is the default when the current package has no local vite.config.*
|
|
105
|
-
• Vite is started only when the current package provides a local vite.config.*
|
|
106
|
-
• Higher-level build flows currently synthesize a composed worker entry when worker surfaces are discovered
|
|
107
|
-
|
|
108
|
-
Examples:
|
|
109
|
-
devflare init my-app
|
|
110
|
-
devflare dev # Start worker-only or unified dev server
|
|
111
|
-
devflare dev --port 3000 # Custom Vite port when Vite is enabled
|
|
112
|
-
devflare dev --persist # Persist storage between restarts
|
|
113
|
-
devflare dev --log-temp # Log output to .log file
|
|
114
|
-
devflare build
|
|
115
|
-
devflare deploy --env production
|
|
116
|
-
`.trim();
|
|
117
|
-
}
|
|
118
|
-
async function runCli(argv, options = {}) {
|
|
119
|
-
const logger = createConsola({
|
|
120
|
-
level: options.silent ? -999 : 3,
|
|
121
|
-
formatOptions: {
|
|
122
|
-
date: false
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
const parsed = parseArgs(argv);
|
|
126
|
-
if (parsed.unknownCommand) {
|
|
127
|
-
logger.error(`Unknown command: ${parsed.unknownCommand}`);
|
|
128
|
-
logger.info("Run `devflare --help` for available commands");
|
|
129
|
-
return { exitCode: 1 };
|
|
130
|
-
}
|
|
131
|
-
switch (parsed.command) {
|
|
132
|
-
case "help":
|
|
133
|
-
logger.info(getHelpText());
|
|
134
|
-
return { exitCode: 0, output: getHelpText() };
|
|
135
|
-
case "version":
|
|
136
|
-
const version = await getPackageVersion();
|
|
137
|
-
logger.info(`devflare v${version}`);
|
|
138
|
-
return { exitCode: 0, output: version };
|
|
139
|
-
case "init":
|
|
140
|
-
return runInit(parsed, logger, options);
|
|
141
|
-
case "dev":
|
|
142
|
-
return runDev(parsed, logger, options);
|
|
143
|
-
case "build":
|
|
144
|
-
return runBuild(parsed, logger, options);
|
|
145
|
-
case "deploy":
|
|
146
|
-
return runDeploy(parsed, logger, options);
|
|
147
|
-
case "types":
|
|
148
|
-
return runTypes(parsed, logger, options);
|
|
149
|
-
case "doctor":
|
|
150
|
-
return runDoctor(parsed, logger, options);
|
|
151
|
-
case "config":
|
|
152
|
-
return runConfig(parsed, logger, options);
|
|
153
|
-
case "account":
|
|
154
|
-
return runAccount(parsed, logger, options);
|
|
155
|
-
case "ai":
|
|
156
|
-
return runAI();
|
|
157
|
-
case "remote":
|
|
158
|
-
return runRemote(parsed, logger, options);
|
|
159
|
-
default:
|
|
160
|
-
logger.error(`Unknown command: ${parsed.command}`);
|
|
161
|
-
return { exitCode: 1 };
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async function runInit(parsed, logger, options) {
|
|
165
|
-
const { runInitCommand } = await import("./init-na2atvz2.js");
|
|
166
|
-
return runInitCommand(parsed, logger, options);
|
|
167
|
-
}
|
|
168
|
-
async function runDev(parsed, logger, options) {
|
|
169
|
-
const { runDevCommand } = await import("./dev-ymtphbkg.js");
|
|
170
|
-
return runDevCommand(parsed, logger, options);
|
|
171
|
-
}
|
|
172
|
-
async function runBuild(parsed, logger, options) {
|
|
173
|
-
const { runBuildCommand } = await import("./build-zv25ke4s.js");
|
|
174
|
-
return runBuildCommand(parsed, logger, options);
|
|
175
|
-
}
|
|
176
|
-
async function runDeploy(parsed, logger, options) {
|
|
177
|
-
const { runDeployCommand } = await import("./deploy-6xmqvv06.js");
|
|
178
|
-
return runDeployCommand(parsed, logger, options);
|
|
179
|
-
}
|
|
180
|
-
async function runTypes(parsed, logger, options) {
|
|
181
|
-
const { runTypesCommand } = await import("./types-158m16vd.js");
|
|
182
|
-
return runTypesCommand(parsed, logger, options);
|
|
183
|
-
}
|
|
184
|
-
async function runDoctor(parsed, logger, options) {
|
|
185
|
-
const { runDoctorCommand } = await import("./doctor-xv4gm1h4.js");
|
|
186
|
-
return runDoctorCommand(parsed, logger, options);
|
|
187
|
-
}
|
|
188
|
-
async function runConfig(parsed, logger, options) {
|
|
189
|
-
const { runConfigCommand } = await import("./config-v9tr4rts.js");
|
|
190
|
-
return runConfigCommand(parsed, logger, options);
|
|
191
|
-
}
|
|
192
|
-
async function runAccount(parsed, logger, options) {
|
|
193
|
-
const { runAccountCommand } = await import("./account-spa7gzsn.js");
|
|
194
|
-
return runAccountCommand(parsed, logger, options);
|
|
195
|
-
}
|
|
196
|
-
async function runAI() {
|
|
197
|
-
const { runAICommand } = await import("./ai-dx4fr9jh.js");
|
|
198
|
-
return runAICommand();
|
|
199
|
-
}
|
|
200
|
-
async function runRemote(parsed, logger, options) {
|
|
201
|
-
const { runRemoteCommand } = await import("./remote-q59qk463.js");
|
|
202
|
-
return runRemoteCommand(parsed, logger, options);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export { parseArgs, runCli };
|