devflare 1.0.0-next.19 → 1.0.0-next.20
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 +6807 -888
- package/README.md +375 -957
- package/dist/account-05zgta47.js +475 -0
- package/dist/account-b2ag1esh.js +475 -0
- package/dist/account-bxtcz61a.js +475 -0
- package/dist/account-gyfqg964.js +475 -0
- package/dist/account-q6pvs9d9.js +475 -0
- package/dist/account-rp4zbvw1.js +475 -0
- package/dist/bridge/client.d.ts +5 -0
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/gateway-runtime.d.ts +1 -1
- package/dist/bridge/gateway-runtime.d.ts.map +1 -1
- package/dist/bridge/miniflare.d.ts +67 -0
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +2 -1
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/browser.d.ts +2520 -40
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +3 -3
- package/dist/build-2s5paw5p.js +54 -0
- package/dist/build-4c350cp7.js +54 -0
- package/dist/build-e7wym63t.js +54 -0
- package/dist/build-ge6qp3t4.js +54 -0
- package/dist/build-ta8c6t11.js +54 -0
- package/dist/build-wvjj8f28.js +54 -0
- package/dist/build-ypg6f2kw.js +54 -0
- package/dist/build-yts8wwgf.js +54 -0
- package/dist/build-yzkdqexs.js +54 -0
- package/dist/cli/build-manifest.d.ts +12 -0
- package/dist/cli/build-manifest.d.ts.map +1 -1
- 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/secrets.d.ts +4 -0
- package/dist/cli/commands/secrets.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +67 -1
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -1
- package/dist/cli/help-pages/pages/core.d.ts +1 -1
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -1
- package/dist/cli/help-pages/shared.d.ts +1 -1
- package/dist/cli/help-pages/shared.d.ts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli/package-metadata.d.ts.map +1 -1
- package/dist/cli/preview-bindings.d.ts.map +1 -1
- package/dist/cloudflare/index.js +2 -2
- package/dist/cloudflare/preview-registry-store.d.ts +1 -1
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -1
- package/dist/cloudflare/types.d.ts +1 -1
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/config/binding-resolution-helpers.d.ts +5 -0
- package/dist/config/binding-resolution-helpers.d.ts.map +1 -1
- 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 +267 -0
- package/dist/config/compiler/types.d.ts.map +1 -0
- package/dist/config/compiler.d.ts +11 -175
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/deploy-resources.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.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.map +1 -1
- package/dist/config/preview.d.ts.map +1 -1
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resource-resolution.d.ts.map +1 -1
- package/dist/config/schema-bindings.d.ts +559 -19
- package/dist/config/schema-bindings.d.ts.map +1 -1
- package/dist/config/schema-env.d.ts +1306 -34
- package/dist/config/schema-env.d.ts.map +1 -1
- package/dist/config/schema-normalization.d.ts +97 -1
- package/dist/config/schema-normalization.d.ts.map +1 -1
- package/dist/config/schema-runtime.d.ts +245 -7
- package/dist/config/schema-runtime.d.ts.map +1 -1
- package/dist/config/schema.d.ts +2976 -57
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config-6m0n7d84.js +59 -0
- package/dist/config-7cf004ag.js +59 -0
- package/dist/config-b98dp58n.js +59 -0
- package/dist/config-cf3djhqy.js +59 -0
- package/dist/config-entry.js +1 -1
- package/dist/config-wa7hm0w9.js +59 -0
- package/dist/deploy-1jfagtn9.js +1055 -0
- package/dist/deploy-2afw0jfg.js +1055 -0
- package/dist/deploy-2fzj68kq.js +1055 -0
- package/dist/deploy-57nzn9wj.js +1045 -0
- package/dist/deploy-asyryrvm.js +1055 -0
- package/dist/deploy-hc927rw6.js +1045 -0
- package/dist/deploy-pnnf8tgy.js +1045 -0
- package/dist/deploy-q33bw715.js +1055 -0
- package/dist/deploy-tmdgecs3.js +1055 -0
- package/dist/deploy-v0y8kczr.js +1055 -0
- package/dist/deploy-xhj6zbcx.js +1055 -0
- package/dist/dev-1mvcts8w.js +2515 -0
- package/dist/dev-2a283xts.js +2515 -0
- package/dist/dev-62nhytf8.js +2505 -0
- package/dist/dev-75acm2xj.js +2478 -0
- package/dist/dev-802rg9dp.js +2515 -0
- package/dist/dev-d1bb2t0f.js +2515 -0
- package/dist/dev-dwry8494.js +2489 -0
- package/dist/dev-g6112y4w.js +2515 -0
- package/dist/dev-h2kneh95.js +2496 -0
- package/dist/dev-kybq3mwr.js +2489 -0
- package/dist/dev-n8qndkyg.js +2512 -0
- package/dist/dev-p32fkbwf.js +2489 -0
- package/dist/dev-qm9d4mfh.js +2478 -0
- package/dist/dev-rcthnse5.js +2473 -0
- package/dist/dev-server/dev-server-state.d.ts +1 -0
- package/dist/dev-server/dev-server-state.d.ts.map +1 -1
- package/dist/dev-server/miniflare-bindings.d.ts +44 -1
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -1
- package/dist/dev-server/miniflare-dev-config.d.ts +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -1
- package/dist/dev-server/miniflare-log.d.ts +8 -0
- package/dist/dev-server/miniflare-log.d.ts.map +1 -1
- package/dist/dev-server/miniflare-worker-config.d.ts +31 -1
- package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -1
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +1 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -1
- package/dist/dev-tgwja5mz.js +2496 -0
- package/dist/doctor-2shhdak6.js +245 -0
- package/dist/doctor-5g73w40j.js +245 -0
- package/dist/doctor-gamefzcs.js +245 -0
- package/dist/doctor-rn53ctfs.js +245 -0
- package/dist/index-01kehw41.js +348 -0
- package/dist/index-06bg0z9y.js +185 -0
- package/dist/index-0d7tw5r4.js +136 -0
- package/dist/index-0m6e4mxz.js +133 -0
- package/dist/index-0vah20er.js +1410 -0
- package/dist/index-0wa0ebm1.js +68 -0
- package/dist/index-1714y3cz.js +1410 -0
- package/dist/index-1qs5gcm7.js +895 -0
- package/dist/index-29k04v43.js +574 -0
- package/dist/index-2jywf4pz.js +1372 -0
- package/dist/index-2qhk9nbx.js +1372 -0
- package/dist/index-2vq6bveq.js +574 -0
- package/dist/index-36h8gkhb.js +1088 -0
- package/dist/index-38fq7pww.js +560 -0
- package/dist/index-3bxqn033.js +1410 -0
- package/dist/index-3jme4hgw.js +1234 -0
- package/dist/index-3p7s9mk9.js +360 -0
- package/dist/index-47w35sft.js +244 -0
- package/dist/index-4by4c7rm.js +52 -0
- package/dist/index-4phjwd6h.js +412 -0
- package/dist/index-4z5jrw0j.js +594 -0
- package/dist/index-51mzqy0d.js +895 -0
- package/dist/index-53pqqpq9.js +74 -0
- package/dist/index-5enq8ntr.js +1766 -0
- package/dist/index-5fnq9r9m.js +1410 -0
- package/dist/index-5w9f2b17.js +695 -0
- package/dist/index-627srx16.js +45 -0
- package/dist/index-6bqgf5x8.js +227 -0
- package/dist/index-6xknvbyk.js +1088 -0
- package/dist/index-7ef3ktz5.js +1372 -0
- package/dist/index-7hpjfdzh.js +185 -0
- package/dist/index-8052df4m.js +627 -0
- package/dist/index-82epjzrr.js +1410 -0
- package/dist/index-82z7rvz6.js +1238 -0
- package/dist/index-8atc1yb9.js +68 -0
- package/dist/index-8tj0awnv.js +476 -0
- package/dist/index-8x745h59.js +1069 -0
- package/dist/index-9bawzcny.js +574 -0
- package/dist/index-9bjjqdfc.js +236 -0
- package/dist/index-9d7x3vfr.js +236 -0
- package/dist/index-9nf8zs4p.js +1069 -0
- package/dist/index-acwbmagz.js +412 -0
- package/dist/index-aqjdaem7.js +74 -0
- package/dist/index-b6448fd0.js +133 -0
- package/dist/index-b9j55r7q.js +240 -0
- package/dist/index-bdatd1za.js +1372 -0
- package/dist/index-c3nxftnp.js +699 -0
- package/dist/index-c643s0gv.js +488 -0
- package/dist/index-d2md1j3d.js +185 -0
- package/dist/index-dbr6bfz6.js +528 -0
- package/dist/index-dd1g0g7e.js +360 -0
- package/dist/index-dktb9az5.js +1372 -0
- package/dist/index-dm9q84c7.js +360 -0
- package/dist/index-f51mkh13.js +1088 -0
- package/dist/index-f86n1fpd.js +55 -0
- package/dist/index-fnk0tkw7.js +412 -0
- package/dist/index-g5aq66bj.js +1534 -0
- package/dist/index-gj5qh491.js +54 -0
- package/dist/index-gq39t0rx.js +895 -0
- package/dist/index-h5dqna7q.js +1410 -0
- package/dist/index-hjs9j2g9.js +895 -0
- package/dist/index-hn5nbxbt.js +147 -0
- package/dist/index-hpjh0qjx.js +1723 -0
- package/dist/index-hs6ekcfs.js +412 -0
- package/dist/index-jdzrvnfj.js +52 -0
- package/dist/index-jg720mq7.js +476 -0
- package/dist/index-jrzddxvt.js +2167 -0
- package/dist/index-kgstnk6g.js +239 -0
- package/dist/index-khnw972v.js +117 -0
- package/dist/index-kwqff3ba.js +1410 -0
- package/dist/index-m2v0fj08.js +74 -0
- package/dist/index-mjve6tqn.js +447 -0
- package/dist/index-mkxzgn0q.js +1372 -0
- package/dist/index-mzmq3v0d.js +1088 -0
- package/dist/index-ng9n3znd.js +1372 -0
- package/dist/index-nhbkm2ba.js +467 -0
- package/dist/index-nrfhk0k5.js +1088 -0
- package/dist/index-p0zppqxm.js +467 -0
- package/dist/index-pkxf6h87.js +895 -0
- package/dist/index-pqp4312v.js +52 -0
- package/dist/index-pw9jn6kz.js +574 -0
- package/dist/index-q31ne0xa.js +412 -0
- package/dist/index-qf2dkqxh.js +249 -0
- package/dist/index-qmtdf7k5.js +639 -0
- package/dist/index-qwgr4q7s.js +37 -0
- package/dist/index-rab2dfh3.js +494 -0
- package/dist/index-rz7rx80s.js +1410 -0
- package/dist/index-s37h3jgk.js +572 -0
- package/dist/index-sb705m7d.js +52 -0
- package/dist/index-syscwrjp.js +1576 -0
- package/dist/index-t14zr0ys.js +1063 -0
- package/dist/index-tjc99447.js +68 -0
- package/dist/index-v35460hf.js +574 -0
- package/dist/index-v7q00d1e.js +1410 -0
- package/dist/index-vkkmx4xe.js +1372 -0
- package/dist/index-vrps1gky.js +2202 -0
- package/dist/index-w4c9vmvg.js +1517 -0
- package/dist/index-wqd8n2qk.js +574 -0
- package/dist/index-x12e6fzy.js +476 -0
- package/dist/index-xagpz645.js +2199 -0
- package/dist/index-xbth1r6e.js +572 -0
- package/dist/index-xm9fqhcb.js +447 -0
- package/dist/index-y59hnmd0.js +132 -0
- package/dist/index-y7mkb00x.js +133 -0
- package/dist/index-z40mjts9.js +212 -0
- package/dist/index-z5k5bjc7.js +1218 -0
- package/dist/index-z73sytma.js +895 -0
- package/dist/index-zjv6apef.js +1410 -0
- package/dist/index.js +8 -8
- package/dist/init-cwpergap.js +180 -0
- package/dist/login-83bjfhvz.js +77 -0
- package/dist/login-ddw888xb.js +77 -0
- package/dist/login-e7pytkdc.js +77 -0
- package/dist/login-fe0brfcr.js +77 -0
- package/dist/login-h7sm5trm.js +77 -0
- package/dist/login-vd0m3xr4.js +77 -0
- package/dist/previews-2wfvsjfy.js +1337 -0
- package/dist/previews-31feb8r3.js +1337 -0
- package/dist/previews-3w4pxqby.js +1337 -0
- package/dist/previews-93ttrf5f.js +1337 -0
- package/dist/previews-bdrefjzx.js +1337 -0
- package/dist/previews-cfcn56b4.js +1337 -0
- package/dist/previews-mssq1hrm.js +1337 -0
- package/dist/previews-tcaz1gt8.js +1337 -0
- package/dist/productions-4h80j2c7.js +505 -0
- package/dist/productions-86jaqt7m.js +505 -0
- package/dist/productions-bn2q31my.js +505 -0
- package/dist/productions-dv8g7f6g.js +505 -0
- package/dist/productions-e2m9s4tr.js +505 -0
- package/dist/productions-fgshs1m7.js +505 -0
- package/dist/productions-hphmt68n.js +505 -0
- package/dist/productions-vhq7yx86.js +505 -0
- package/dist/runtime/index.js +8 -8
- package/dist/secrets/local-secrets.d.ts +46 -0
- package/dist/secrets/local-secrets.d.ts.map +1 -0
- package/dist/secrets-8wcj47nh.js +91 -0
- package/dist/secrets-b2ww34ta.js +91 -0
- package/dist/secrets-b7g4z621.js +91 -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.js +163 -26
- 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 +8 -0
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/ai-search.d.ts +39 -0
- package/dist/test/ai-search.d.ts.map +1 -0
- package/dist/test/binding-hints.d.ts.map +1 -1
- package/dist/test/cf.d.ts +3 -3
- package/dist/test/containers.d.ts +87 -0
- package/dist/test/containers.d.ts.map +1 -0
- package/dist/test/index.d.ts +4 -1
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +2833 -543
- package/dist/test/local-worker-loader.d.ts +3 -0
- package/dist/test/local-worker-loader.d.ts.map +1 -0
- package/dist/test/offline-bindings.d.ts +65 -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/should-skip.d.ts +14 -0
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-bindings.d.ts.map +1 -1
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -1
- package/dist/test/simple-context-gateway-script.d.ts +1 -1
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -1
- package/dist/test/simple-context-lifecycle.d.ts.map +1 -1
- package/dist/test/simple-context-mfconfig.d.ts +4 -1
- package/dist/test/simple-context-mfconfig.d.ts.map +1 -1
- package/dist/test/simple-context-multi-worker.d.ts.map +1 -1
- package/dist/test/simple-context-startup.d.ts.map +1 -1
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/artifacts.d.ts +11 -0
- package/dist/test/utilities/artifacts.d.ts.map +1 -0
- package/dist/test/utilities/context.d.ts +39 -0
- package/dist/test/utilities/context.d.ts.map +1 -0
- package/dist/test/utilities/d1.d.ts +21 -0
- package/dist/test/utilities/d1.d.ts.map +1 -0
- package/dist/test/utilities/env.d.ts +40 -0
- package/dist/test/utilities/env.d.ts.map +1 -0
- package/dist/test/utilities/kv.d.ts +11 -0
- package/dist/test/utilities/kv.d.ts.map +1 -0
- package/dist/test/utilities/media.d.ts +16 -0
- package/dist/test/utilities/media.d.ts.map +1 -0
- package/dist/test/utilities/platform.d.ts +38 -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 +12 -0
- package/dist/test/utilities/r2.d.ts.map +1 -0
- package/dist/test/utilities/workflows.d.ts +26 -0
- package/dist/test/utilities/workflows.d.ts.map +1 -0
- package/dist/test/utilities.d.ts +10 -106
- package/dist/test/utilities.d.ts.map +1 -1
- package/dist/types-2ejrbba1.js +695 -0
- package/dist/types-7jkbm95a.js +695 -0
- package/dist/types-a2fk9yns.js +695 -0
- package/dist/types-dyb3c6zw.js +695 -0
- package/dist/types-e2n9f3pd.js +695 -0
- package/dist/types-j4s6qcrc.js +695 -0
- package/dist/utils/send-email.d.ts.map +1 -1
- package/dist/utils/send-email.js +1 -1
- package/dist/vite/index.js +6 -6
- package/dist/vite/plugin-context.d.ts.map +1 -1
- package/dist/worker-663em30d.js +513 -0
- package/dist/worker-argxc7fb.js +513 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/dist/worker-entry/surface-paths.d.ts +2 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -1
- package/dist/worker-fcdsnj14.js +513 -0
- package/dist/worker-fk42rzse.js +513 -0
- package/dist/worker-jkemk8d2.js +513 -0
- package/dist/worker-m4ze8djx.js +513 -0
- package/dist/worker-wnan5dca.js +513 -0
- package/dist/worker-yw3atfb1.js +513 -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 +13 -12
package/dist/index.js
CHANGED
|
@@ -4,23 +4,23 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
parseArgs,
|
|
6
6
|
runCli
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
7
|
+
} from "./index-h5dqna7q.js";
|
|
8
|
+
import"./index-627srx16.js";
|
|
9
9
|
import"./index-stgn34cr.js";
|
|
10
10
|
import"./index-3t6rypgc.js";
|
|
11
11
|
import {
|
|
12
12
|
env
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-0wa0ebm1.js";
|
|
14
14
|
import {
|
|
15
15
|
durableObject,
|
|
16
16
|
getDurableObjectOptions
|
|
17
17
|
} from "./index-a855bdsx.js";
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
18
|
+
import"./index-vrps1gky.js";
|
|
19
|
+
import"./index-kgstnk6g.js";
|
|
20
20
|
import {
|
|
21
21
|
compileConfig,
|
|
22
22
|
stringifyConfig
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-c3nxftnp.js";
|
|
24
24
|
import {
|
|
25
25
|
ConfigNotFoundError,
|
|
26
26
|
ConfigResourceResolutionError,
|
|
@@ -28,12 +28,12 @@ import {
|
|
|
28
28
|
configSchema,
|
|
29
29
|
loadConfig,
|
|
30
30
|
loadResolvedConfig
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-syscwrjp.js";
|
|
32
32
|
import"./index-1d4jg11n.js";
|
|
33
33
|
import"./index-mg8vwqxf.js";
|
|
34
34
|
import {
|
|
35
35
|
preview
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-z40mjts9.js";
|
|
37
37
|
import {
|
|
38
38
|
defineConfig,
|
|
39
39
|
ref
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getDependencies
|
|
3
|
+
} from "./index-z9gy8w6b.js";
|
|
4
|
+
import {
|
|
5
|
+
getInitDependencyVersions
|
|
6
|
+
} from "./index-627srx16.js";
|
|
7
|
+
import {
|
|
8
|
+
createCliTheme,
|
|
9
|
+
cyanBold,
|
|
10
|
+
dim,
|
|
11
|
+
green,
|
|
12
|
+
logLine
|
|
13
|
+
} from "./index-stgn34cr.js";
|
|
14
|
+
import"./index-3t6rypgc.js";
|
|
15
|
+
import"./index-37x76zdn.js";
|
|
16
|
+
|
|
17
|
+
// src/cli/commands/init.ts
|
|
18
|
+
import { resolve, join } from "pathe";
|
|
19
|
+
var MINIMAL_TEMPLATE = {
|
|
20
|
+
name: "minimal",
|
|
21
|
+
description: "Minimal starter with single handler",
|
|
22
|
+
files: {
|
|
23
|
+
"devflare.config.ts": `import { defineConfig } from 'devflare/config'
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
name: '{{PROJECT_NAME}}',
|
|
27
|
+
compatibilityDate: '${new Date().toISOString().split("T")[0]}',
|
|
28
|
+
files: {
|
|
29
|
+
fetch: 'src/fetch.ts'
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
`,
|
|
33
|
+
"src/fetch.ts": `import type { FetchEvent } from 'devflare/runtime'
|
|
34
|
+
|
|
35
|
+
export async function fetch({ url }: FetchEvent): Promise<Response> {
|
|
36
|
+
return new Response(
|
|
37
|
+
url.pathname === '/'
|
|
38
|
+
? 'Hello from Devflare'
|
|
39
|
+
: \`Hello from Devflare: \${url.pathname}\`
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
"package.json": `{
|
|
44
|
+
"name": "{{PROJECT_NAME}}",
|
|
45
|
+
"version": "0.0.1",
|
|
46
|
+
"private": true,
|
|
47
|
+
"type": "module",
|
|
48
|
+
"scripts": {
|
|
49
|
+
"dev": "devflare dev",
|
|
50
|
+
"build": "devflare build",
|
|
51
|
+
"deploy": "devflare deploy",
|
|
52
|
+
"types": "devflare types"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@cloudflare/workers-types": "{{WORKERS_TYPES_VERSION}}",
|
|
56
|
+
"devflare": "{{DEVFLARE_VERSION}}",
|
|
57
|
+
"typescript": "{{TYPESCRIPT_VERSION}}",
|
|
58
|
+
"wrangler": "{{WRANGLER_VERSION}}"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
"tsconfig.json": `{
|
|
63
|
+
"compilerOptions": {
|
|
64
|
+
"target": "ESNext",
|
|
65
|
+
"module": "ESNext",
|
|
66
|
+
"moduleResolution": "bundler",
|
|
67
|
+
"strict": true,
|
|
68
|
+
"skipLibCheck": true,
|
|
69
|
+
"types": ["@cloudflare/workers-types"]
|
|
70
|
+
},
|
|
71
|
+
"include": ["src/**/*", "env.d.ts", "devflare.config.ts"]
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var API_TEMPLATE = {
|
|
77
|
+
name: "api",
|
|
78
|
+
description: "API starter with request-wide middleware",
|
|
79
|
+
files: {
|
|
80
|
+
"devflare.config.ts": `import { defineConfig } from 'devflare/config'
|
|
81
|
+
|
|
82
|
+
export default defineConfig({
|
|
83
|
+
name: '{{PROJECT_NAME}}',
|
|
84
|
+
compatibilityDate: '${new Date().toISOString().split("T")[0]}',
|
|
85
|
+
files: {
|
|
86
|
+
fetch: 'src/fetch.ts'
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
`,
|
|
90
|
+
"src/fetch.ts": `import { sequence } from 'devflare/runtime'
|
|
91
|
+
import { corsHandle } from './middleware/cors'
|
|
92
|
+
import { appFetch } from './app'
|
|
93
|
+
|
|
94
|
+
export const handle = sequence(corsHandle, appFetch)
|
|
95
|
+
`,
|
|
96
|
+
"src/middleware/cors.ts": `import type { FetchEvent, ResolveFetch } from 'devflare/runtime'
|
|
97
|
+
|
|
98
|
+
export async function corsHandle(event: FetchEvent, resolve: ResolveFetch): Promise<Response> {
|
|
99
|
+
// Handle preflight
|
|
100
|
+
if (event.request.method === 'OPTIONS') {
|
|
101
|
+
return new Response(null, {
|
|
102
|
+
headers: {
|
|
103
|
+
'Access-Control-Allow-Origin': '*',
|
|
104
|
+
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
|
|
105
|
+
'Access-Control-Allow-Headers': 'Content-Type, Authorization'
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const response = await resolve(event)
|
|
111
|
+
const next = new Response(response.body, response)
|
|
112
|
+
next.headers.set('Access-Control-Allow-Origin', '*')
|
|
113
|
+
return next
|
|
114
|
+
}
|
|
115
|
+
`,
|
|
116
|
+
"src/app.ts": `import type { FetchEvent } from 'devflare/runtime'
|
|
117
|
+
|
|
118
|
+
export async function appFetch({ url }: FetchEvent): Promise<Response> {
|
|
119
|
+
if (url.pathname === '/api/health') {
|
|
120
|
+
return Response.json({ status: 'ok' })
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (url.pathname.startsWith('/api/')) {
|
|
124
|
+
return Response.json({ error: 'Not found' }, { status: 404 })
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return new Response('Not Found', { status: 404 })
|
|
128
|
+
}
|
|
129
|
+
`,
|
|
130
|
+
"package.json": MINIMAL_TEMPLATE.files["package.json"],
|
|
131
|
+
"tsconfig.json": MINIMAL_TEMPLATE.files["tsconfig.json"]
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var TEMPLATES = {
|
|
135
|
+
minimal: MINIMAL_TEMPLATE,
|
|
136
|
+
api: API_TEMPLATE
|
|
137
|
+
};
|
|
138
|
+
async function runInitCommand(parsed, logger, options) {
|
|
139
|
+
const projectName = parsed.args[0] || "my-devflare-app";
|
|
140
|
+
const templateName = parsed.options.template || "minimal";
|
|
141
|
+
const cwd = options.cwd || process.cwd();
|
|
142
|
+
const theme = createCliTheme(parsed.options);
|
|
143
|
+
logLine(logger);
|
|
144
|
+
logLine(logger, `${cyanBold("init", theme)} ${dim("Creating a new Devflare project", theme)}`);
|
|
145
|
+
logLine(logger, `${dim("project", theme)} ${green(projectName, theme)}`);
|
|
146
|
+
const template = TEMPLATES[templateName];
|
|
147
|
+
if (!template) {
|
|
148
|
+
logger.error(`Unknown template: ${templateName}`);
|
|
149
|
+
logger.info(`Available templates: ${Object.keys(TEMPLATES).join(", ")}`);
|
|
150
|
+
return { exitCode: 1 };
|
|
151
|
+
}
|
|
152
|
+
const projectDir = resolve(cwd, projectName);
|
|
153
|
+
const dependencyVersions = await getInitDependencyVersions();
|
|
154
|
+
const { fs } = await getDependencies();
|
|
155
|
+
try {
|
|
156
|
+
await fs.access(projectDir);
|
|
157
|
+
logger.error(`Directory already exists: ${projectDir}`);
|
|
158
|
+
return { exitCode: 1 };
|
|
159
|
+
} catch {}
|
|
160
|
+
await fs.mkdir(projectDir, { recursive: true });
|
|
161
|
+
for (const [filePath, content] of Object.entries(template.files)) {
|
|
162
|
+
const fullPath = join(projectDir, filePath);
|
|
163
|
+
const dir = fullPath.substring(0, fullPath.lastIndexOf("/"));
|
|
164
|
+
await fs.mkdir(dir, { recursive: true }).catch(() => {});
|
|
165
|
+
const processedContent = content.replace(/\{\{PROJECT_NAME\}\}/g, projectName).replace(/\{\{DEVFLARE_VERSION\}\}/g, dependencyVersions.devflare).replace(/\{\{TYPESCRIPT_VERSION\}\}/g, dependencyVersions.typescript).replace(/\{\{WRANGLER_VERSION\}\}/g, dependencyVersions.wrangler).replace(/\{\{WORKERS_TYPES_VERSION\}\}/g, dependencyVersions.workersTypes);
|
|
166
|
+
await fs.writeFile(fullPath, processedContent, "utf-8");
|
|
167
|
+
logLine(logger, ` ${dim("created", theme)} ${filePath}`);
|
|
168
|
+
}
|
|
169
|
+
logger.success("Project created successfully!");
|
|
170
|
+
logLine(logger);
|
|
171
|
+
logLine(logger, dim("next steps", theme));
|
|
172
|
+
logLine(logger, ` cd ${projectName}`);
|
|
173
|
+
logLine(logger, " bun install");
|
|
174
|
+
logLine(logger, " bun run types");
|
|
175
|
+
logLine(logger, " bun run dev");
|
|
176
|
+
return { exitCode: 0 };
|
|
177
|
+
}
|
|
178
|
+
export {
|
|
179
|
+
runInitCommand
|
|
180
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfiguredAccountId
|
|
3
|
+
} from "./index-m2v0fj08.js";
|
|
4
|
+
import {
|
|
5
|
+
account
|
|
6
|
+
} from "./index-y7mkb00x.js";
|
|
7
|
+
import"./index-k7m5f1dg.js";
|
|
8
|
+
import"./index-82z7rvz6.js";
|
|
9
|
+
import {
|
|
10
|
+
getDependencies
|
|
11
|
+
} from "./index-z9gy8w6b.js";
|
|
12
|
+
import {
|
|
13
|
+
createCliTheme,
|
|
14
|
+
dim,
|
|
15
|
+
green,
|
|
16
|
+
logLine,
|
|
17
|
+
whiteDim,
|
|
18
|
+
yellow
|
|
19
|
+
} from "./index-stgn34cr.js";
|
|
20
|
+
import"./index-3t6rypgc.js";
|
|
21
|
+
import"./index-15fpa5tx.js";
|
|
22
|
+
import"./index-g5aq66bj.js";
|
|
23
|
+
import"./index-1d4jg11n.js";
|
|
24
|
+
import"./index-mg8vwqxf.js";
|
|
25
|
+
import"./index-z40mjts9.js";
|
|
26
|
+
import"./index-37x76zdn.js";
|
|
27
|
+
|
|
28
|
+
// src/cli/commands/login.ts
|
|
29
|
+
async function logResolvedAccount(cwd, logger, theme) {
|
|
30
|
+
try {
|
|
31
|
+
const primaryAccount = await account.getPrimaryAccount();
|
|
32
|
+
if (primaryAccount) {
|
|
33
|
+
logLine(logger, `${dim("Primary account:", theme)} ${green(primaryAccount.name, theme)} ${whiteDim(`(${primaryAccount.id})`, theme)}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
const configuredAccountId = await getConfiguredAccountId(cwd);
|
|
38
|
+
if (!configuredAccountId) {
|
|
39
|
+
logLine(logger, dim("Run `devflare account` to inspect available accounts.", theme));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const configuredAccount = await account.getAccountById(configuredAccountId);
|
|
43
|
+
if (configuredAccount) {
|
|
44
|
+
logLine(logger, `${dim("Configured account:", theme)} ${green(configuredAccount.name, theme)} ${whiteDim(`(${configuredAccount.id})`, theme)}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
logLine(logger, `${dim("Configured account ID:", theme)} ${whiteDim(configuredAccountId, theme)}`);
|
|
48
|
+
logLine(logger, dim("Run `devflare account --account <id>` to inspect the configured account.", theme));
|
|
49
|
+
}
|
|
50
|
+
async function runLoginCommand(parsed, logger, options) {
|
|
51
|
+
const force = parsed.options.force === true;
|
|
52
|
+
const cwd = options.cwd ?? process.cwd();
|
|
53
|
+
const theme = createCliTheme(parsed.options);
|
|
54
|
+
if (!force && await account.isAuthenticated()) {
|
|
55
|
+
logger.success("Already authenticated with Cloudflare");
|
|
56
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
57
|
+
logLine(logger, dim("Use `devflare login --force` to open Wrangler login again.", theme));
|
|
58
|
+
return { exitCode: 0 };
|
|
59
|
+
}
|
|
60
|
+
logLine(logger);
|
|
61
|
+
logLine(logger, `${yellow("login", theme)} ${dim("Opening Wrangler login…", theme)}`);
|
|
62
|
+
const deps = await getDependencies();
|
|
63
|
+
const result = await deps.exec.exec("bunx", ["wrangler", "login"], {
|
|
64
|
+
cwd,
|
|
65
|
+
stdio: "inherit"
|
|
66
|
+
});
|
|
67
|
+
if (result.exitCode !== 0) {
|
|
68
|
+
logger.error("Wrangler login failed");
|
|
69
|
+
return { exitCode: 1 };
|
|
70
|
+
}
|
|
71
|
+
logger.success("Authenticated with Cloudflare");
|
|
72
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
73
|
+
return { exitCode: 0 };
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
runLoginCommand
|
|
77
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfiguredAccountId
|
|
3
|
+
} from "./index-m2v0fj08.js";
|
|
4
|
+
import {
|
|
5
|
+
account
|
|
6
|
+
} from "./index-b6448fd0.js";
|
|
7
|
+
import"./index-k7m5f1dg.js";
|
|
8
|
+
import"./index-z5k5bjc7.js";
|
|
9
|
+
import {
|
|
10
|
+
getDependencies
|
|
11
|
+
} from "./index-z9gy8w6b.js";
|
|
12
|
+
import {
|
|
13
|
+
createCliTheme,
|
|
14
|
+
dim,
|
|
15
|
+
green,
|
|
16
|
+
logLine,
|
|
17
|
+
whiteDim,
|
|
18
|
+
yellow
|
|
19
|
+
} from "./index-stgn34cr.js";
|
|
20
|
+
import"./index-3t6rypgc.js";
|
|
21
|
+
import"./index-15fpa5tx.js";
|
|
22
|
+
import"./index-g5aq66bj.js";
|
|
23
|
+
import"./index-1d4jg11n.js";
|
|
24
|
+
import"./index-mg8vwqxf.js";
|
|
25
|
+
import"./index-z40mjts9.js";
|
|
26
|
+
import"./index-37x76zdn.js";
|
|
27
|
+
|
|
28
|
+
// src/cli/commands/login.ts
|
|
29
|
+
async function logResolvedAccount(cwd, logger, theme) {
|
|
30
|
+
try {
|
|
31
|
+
const primaryAccount = await account.getPrimaryAccount();
|
|
32
|
+
if (primaryAccount) {
|
|
33
|
+
logLine(logger, `${dim("Primary account:", theme)} ${green(primaryAccount.name, theme)} ${whiteDim(`(${primaryAccount.id})`, theme)}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
const configuredAccountId = await getConfiguredAccountId(cwd);
|
|
38
|
+
if (!configuredAccountId) {
|
|
39
|
+
logLine(logger, dim("Run `devflare account` to inspect available accounts.", theme));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const configuredAccount = await account.getAccountById(configuredAccountId);
|
|
43
|
+
if (configuredAccount) {
|
|
44
|
+
logLine(logger, `${dim("Configured account:", theme)} ${green(configuredAccount.name, theme)} ${whiteDim(`(${configuredAccount.id})`, theme)}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
logLine(logger, `${dim("Configured account ID:", theme)} ${whiteDim(configuredAccountId, theme)}`);
|
|
48
|
+
logLine(logger, dim("Run `devflare account --account <id>` to inspect the configured account.", theme));
|
|
49
|
+
}
|
|
50
|
+
async function runLoginCommand(parsed, logger, options) {
|
|
51
|
+
const force = parsed.options.force === true;
|
|
52
|
+
const cwd = options.cwd ?? process.cwd();
|
|
53
|
+
const theme = createCliTheme(parsed.options);
|
|
54
|
+
if (!force && await account.isAuthenticated()) {
|
|
55
|
+
logger.success("Already authenticated with Cloudflare");
|
|
56
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
57
|
+
logLine(logger, dim("Use `devflare login --force` to open Wrangler login again.", theme));
|
|
58
|
+
return { exitCode: 0 };
|
|
59
|
+
}
|
|
60
|
+
logLine(logger);
|
|
61
|
+
logLine(logger, `${yellow("login", theme)} ${dim("Opening Wrangler login…", theme)}`);
|
|
62
|
+
const deps = await getDependencies();
|
|
63
|
+
const result = await deps.exec.exec("bunx", ["wrangler", "login"], {
|
|
64
|
+
cwd,
|
|
65
|
+
stdio: "inherit"
|
|
66
|
+
});
|
|
67
|
+
if (result.exitCode !== 0) {
|
|
68
|
+
logger.error("Wrangler login failed");
|
|
69
|
+
return { exitCode: 1 };
|
|
70
|
+
}
|
|
71
|
+
logger.success("Authenticated with Cloudflare");
|
|
72
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
73
|
+
return { exitCode: 0 };
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
runLoginCommand
|
|
77
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfiguredAccountId
|
|
3
|
+
} from "./index-m2v0fj08.js";
|
|
4
|
+
import {
|
|
5
|
+
account
|
|
6
|
+
} from "./index-0m6e4mxz.js";
|
|
7
|
+
import"./index-k7m5f1dg.js";
|
|
8
|
+
import"./index-3jme4hgw.js";
|
|
9
|
+
import {
|
|
10
|
+
getDependencies
|
|
11
|
+
} from "./index-z9gy8w6b.js";
|
|
12
|
+
import {
|
|
13
|
+
createCliTheme,
|
|
14
|
+
dim,
|
|
15
|
+
green,
|
|
16
|
+
logLine,
|
|
17
|
+
whiteDim,
|
|
18
|
+
yellow
|
|
19
|
+
} from "./index-stgn34cr.js";
|
|
20
|
+
import"./index-3t6rypgc.js";
|
|
21
|
+
import"./index-15fpa5tx.js";
|
|
22
|
+
import"./index-g5aq66bj.js";
|
|
23
|
+
import"./index-1d4jg11n.js";
|
|
24
|
+
import"./index-mg8vwqxf.js";
|
|
25
|
+
import"./index-z40mjts9.js";
|
|
26
|
+
import"./index-37x76zdn.js";
|
|
27
|
+
|
|
28
|
+
// src/cli/commands/login.ts
|
|
29
|
+
async function logResolvedAccount(cwd, logger, theme) {
|
|
30
|
+
try {
|
|
31
|
+
const primaryAccount = await account.getPrimaryAccount();
|
|
32
|
+
if (primaryAccount) {
|
|
33
|
+
logLine(logger, `${dim("Primary account:", theme)} ${green(primaryAccount.name, theme)} ${whiteDim(`(${primaryAccount.id})`, theme)}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
const configuredAccountId = await getConfiguredAccountId(cwd);
|
|
38
|
+
if (!configuredAccountId) {
|
|
39
|
+
logLine(logger, dim("Run `devflare account` to inspect available accounts.", theme));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const configuredAccount = await account.getAccountById(configuredAccountId);
|
|
43
|
+
if (configuredAccount) {
|
|
44
|
+
logLine(logger, `${dim("Configured account:", theme)} ${green(configuredAccount.name, theme)} ${whiteDim(`(${configuredAccount.id})`, theme)}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
logLine(logger, `${dim("Configured account ID:", theme)} ${whiteDim(configuredAccountId, theme)}`);
|
|
48
|
+
logLine(logger, dim("Run `devflare account --account <id>` to inspect the configured account.", theme));
|
|
49
|
+
}
|
|
50
|
+
async function runLoginCommand(parsed, logger, options) {
|
|
51
|
+
const force = parsed.options.force === true;
|
|
52
|
+
const cwd = options.cwd ?? process.cwd();
|
|
53
|
+
const theme = createCliTheme(parsed.options);
|
|
54
|
+
if (!force && await account.isAuthenticated()) {
|
|
55
|
+
logger.success("Already authenticated with Cloudflare");
|
|
56
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
57
|
+
logLine(logger, dim("Use `devflare login --force` to open Wrangler login again.", theme));
|
|
58
|
+
return { exitCode: 0 };
|
|
59
|
+
}
|
|
60
|
+
logLine(logger);
|
|
61
|
+
logLine(logger, `${yellow("login", theme)} ${dim("Opening Wrangler login…", theme)}`);
|
|
62
|
+
const deps = await getDependencies();
|
|
63
|
+
const result = await deps.exec.exec("bunx", ["wrangler", "login"], {
|
|
64
|
+
cwd,
|
|
65
|
+
stdio: "inherit"
|
|
66
|
+
});
|
|
67
|
+
if (result.exitCode !== 0) {
|
|
68
|
+
logger.error("Wrangler login failed");
|
|
69
|
+
return { exitCode: 1 };
|
|
70
|
+
}
|
|
71
|
+
logger.success("Authenticated with Cloudflare");
|
|
72
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
73
|
+
return { exitCode: 0 };
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
runLoginCommand
|
|
77
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfiguredAccountId
|
|
3
|
+
} from "./index-53pqqpq9.js";
|
|
4
|
+
import {
|
|
5
|
+
account
|
|
6
|
+
} from "./index-0m6e4mxz.js";
|
|
7
|
+
import"./index-k7m5f1dg.js";
|
|
8
|
+
import"./index-3jme4hgw.js";
|
|
9
|
+
import {
|
|
10
|
+
getDependencies
|
|
11
|
+
} from "./index-z9gy8w6b.js";
|
|
12
|
+
import {
|
|
13
|
+
createCliTheme,
|
|
14
|
+
dim,
|
|
15
|
+
green,
|
|
16
|
+
logLine,
|
|
17
|
+
whiteDim,
|
|
18
|
+
yellow
|
|
19
|
+
} from "./index-stgn34cr.js";
|
|
20
|
+
import"./index-3t6rypgc.js";
|
|
21
|
+
import"./index-15fpa5tx.js";
|
|
22
|
+
import"./index-syscwrjp.js";
|
|
23
|
+
import"./index-1d4jg11n.js";
|
|
24
|
+
import"./index-mg8vwqxf.js";
|
|
25
|
+
import"./index-z40mjts9.js";
|
|
26
|
+
import"./index-37x76zdn.js";
|
|
27
|
+
|
|
28
|
+
// src/cli/commands/login.ts
|
|
29
|
+
async function logResolvedAccount(cwd, logger, theme) {
|
|
30
|
+
try {
|
|
31
|
+
const primaryAccount = await account.getPrimaryAccount();
|
|
32
|
+
if (primaryAccount) {
|
|
33
|
+
logLine(logger, `${dim("Primary account:", theme)} ${green(primaryAccount.name, theme)} ${whiteDim(`(${primaryAccount.id})`, theme)}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
const configuredAccountId = await getConfiguredAccountId(cwd);
|
|
38
|
+
if (!configuredAccountId) {
|
|
39
|
+
logLine(logger, dim("Run `devflare account` to inspect available accounts.", theme));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const configuredAccount = await account.getAccountById(configuredAccountId);
|
|
43
|
+
if (configuredAccount) {
|
|
44
|
+
logLine(logger, `${dim("Configured account:", theme)} ${green(configuredAccount.name, theme)} ${whiteDim(`(${configuredAccount.id})`, theme)}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
logLine(logger, `${dim("Configured account ID:", theme)} ${whiteDim(configuredAccountId, theme)}`);
|
|
48
|
+
logLine(logger, dim("Run `devflare account --account <id>` to inspect the configured account.", theme));
|
|
49
|
+
}
|
|
50
|
+
async function runLoginCommand(parsed, logger, options) {
|
|
51
|
+
const force = parsed.options.force === true;
|
|
52
|
+
const cwd = options.cwd ?? process.cwd();
|
|
53
|
+
const theme = createCliTheme(parsed.options);
|
|
54
|
+
if (!force && await account.isAuthenticated()) {
|
|
55
|
+
logger.success("Already authenticated with Cloudflare");
|
|
56
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
57
|
+
logLine(logger, dim("Use `devflare login --force` to open Wrangler login again.", theme));
|
|
58
|
+
return { exitCode: 0 };
|
|
59
|
+
}
|
|
60
|
+
logLine(logger);
|
|
61
|
+
logLine(logger, `${yellow("login", theme)} ${dim("Opening Wrangler login…", theme)}`);
|
|
62
|
+
const deps = await getDependencies();
|
|
63
|
+
const result = await deps.exec.exec("bunx", ["wrangler", "login"], {
|
|
64
|
+
cwd,
|
|
65
|
+
stdio: "inherit"
|
|
66
|
+
});
|
|
67
|
+
if (result.exitCode !== 0) {
|
|
68
|
+
logger.error("Wrangler login failed");
|
|
69
|
+
return { exitCode: 1 };
|
|
70
|
+
}
|
|
71
|
+
logger.success("Authenticated with Cloudflare");
|
|
72
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
73
|
+
return { exitCode: 0 };
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
runLoginCommand
|
|
77
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfiguredAccountId
|
|
3
|
+
} from "./index-m2v0fj08.js";
|
|
4
|
+
import {
|
|
5
|
+
account
|
|
6
|
+
} from "./index-7r7dfpcm.js";
|
|
7
|
+
import"./index-k7m5f1dg.js";
|
|
8
|
+
import"./index-nbs4q0qg.js";
|
|
9
|
+
import {
|
|
10
|
+
getDependencies
|
|
11
|
+
} from "./index-z9gy8w6b.js";
|
|
12
|
+
import {
|
|
13
|
+
createCliTheme,
|
|
14
|
+
dim,
|
|
15
|
+
green,
|
|
16
|
+
logLine,
|
|
17
|
+
whiteDim,
|
|
18
|
+
yellow
|
|
19
|
+
} from "./index-stgn34cr.js";
|
|
20
|
+
import"./index-3t6rypgc.js";
|
|
21
|
+
import"./index-15fpa5tx.js";
|
|
22
|
+
import"./index-g5aq66bj.js";
|
|
23
|
+
import"./index-1d4jg11n.js";
|
|
24
|
+
import"./index-mg8vwqxf.js";
|
|
25
|
+
import"./index-z40mjts9.js";
|
|
26
|
+
import"./index-37x76zdn.js";
|
|
27
|
+
|
|
28
|
+
// src/cli/commands/login.ts
|
|
29
|
+
async function logResolvedAccount(cwd, logger, theme) {
|
|
30
|
+
try {
|
|
31
|
+
const primaryAccount = await account.getPrimaryAccount();
|
|
32
|
+
if (primaryAccount) {
|
|
33
|
+
logLine(logger, `${dim("Primary account:", theme)} ${green(primaryAccount.name, theme)} ${whiteDim(`(${primaryAccount.id})`, theme)}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
const configuredAccountId = await getConfiguredAccountId(cwd);
|
|
38
|
+
if (!configuredAccountId) {
|
|
39
|
+
logLine(logger, dim("Run `devflare account` to inspect available accounts.", theme));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const configuredAccount = await account.getAccountById(configuredAccountId);
|
|
43
|
+
if (configuredAccount) {
|
|
44
|
+
logLine(logger, `${dim("Configured account:", theme)} ${green(configuredAccount.name, theme)} ${whiteDim(`(${configuredAccount.id})`, theme)}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
logLine(logger, `${dim("Configured account ID:", theme)} ${whiteDim(configuredAccountId, theme)}`);
|
|
48
|
+
logLine(logger, dim("Run `devflare account --account <id>` to inspect the configured account.", theme));
|
|
49
|
+
}
|
|
50
|
+
async function runLoginCommand(parsed, logger, options) {
|
|
51
|
+
const force = parsed.options.force === true;
|
|
52
|
+
const cwd = options.cwd ?? process.cwd();
|
|
53
|
+
const theme = createCliTheme(parsed.options);
|
|
54
|
+
if (!force && await account.isAuthenticated()) {
|
|
55
|
+
logger.success("Already authenticated with Cloudflare");
|
|
56
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
57
|
+
logLine(logger, dim("Use `devflare login --force` to open Wrangler login again.", theme));
|
|
58
|
+
return { exitCode: 0 };
|
|
59
|
+
}
|
|
60
|
+
logLine(logger);
|
|
61
|
+
logLine(logger, `${yellow("login", theme)} ${dim("Opening Wrangler login…", theme)}`);
|
|
62
|
+
const deps = await getDependencies();
|
|
63
|
+
const result = await deps.exec.exec("bunx", ["wrangler", "login"], {
|
|
64
|
+
cwd,
|
|
65
|
+
stdio: "inherit"
|
|
66
|
+
});
|
|
67
|
+
if (result.exitCode !== 0) {
|
|
68
|
+
logger.error("Wrangler login failed");
|
|
69
|
+
return { exitCode: 1 };
|
|
70
|
+
}
|
|
71
|
+
logger.success("Authenticated with Cloudflare");
|
|
72
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
73
|
+
return { exitCode: 0 };
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
runLoginCommand
|
|
77
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfiguredAccountId
|
|
3
|
+
} from "./index-aqjdaem7.js";
|
|
4
|
+
import {
|
|
5
|
+
account
|
|
6
|
+
} from "./index-7r7dfpcm.js";
|
|
7
|
+
import"./index-k7m5f1dg.js";
|
|
8
|
+
import"./index-nbs4q0qg.js";
|
|
9
|
+
import {
|
|
10
|
+
getDependencies
|
|
11
|
+
} from "./index-z9gy8w6b.js";
|
|
12
|
+
import {
|
|
13
|
+
createCliTheme,
|
|
14
|
+
dim,
|
|
15
|
+
green,
|
|
16
|
+
logLine,
|
|
17
|
+
whiteDim,
|
|
18
|
+
yellow
|
|
19
|
+
} from "./index-stgn34cr.js";
|
|
20
|
+
import"./index-3t6rypgc.js";
|
|
21
|
+
import"./index-15fpa5tx.js";
|
|
22
|
+
import"./index-w4c9vmvg.js";
|
|
23
|
+
import"./index-1d4jg11n.js";
|
|
24
|
+
import"./index-mg8vwqxf.js";
|
|
25
|
+
import"./index-z40mjts9.js";
|
|
26
|
+
import"./index-37x76zdn.js";
|
|
27
|
+
|
|
28
|
+
// src/cli/commands/login.ts
|
|
29
|
+
async function logResolvedAccount(cwd, logger, theme) {
|
|
30
|
+
try {
|
|
31
|
+
const primaryAccount = await account.getPrimaryAccount();
|
|
32
|
+
if (primaryAccount) {
|
|
33
|
+
logLine(logger, `${dim("Primary account:", theme)} ${green(primaryAccount.name, theme)} ${whiteDim(`(${primaryAccount.id})`, theme)}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
const configuredAccountId = await getConfiguredAccountId(cwd);
|
|
38
|
+
if (!configuredAccountId) {
|
|
39
|
+
logLine(logger, dim("Run `devflare account` to inspect available accounts.", theme));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const configuredAccount = await account.getAccountById(configuredAccountId);
|
|
43
|
+
if (configuredAccount) {
|
|
44
|
+
logLine(logger, `${dim("Configured account:", theme)} ${green(configuredAccount.name, theme)} ${whiteDim(`(${configuredAccount.id})`, theme)}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
logLine(logger, `${dim("Configured account ID:", theme)} ${whiteDim(configuredAccountId, theme)}`);
|
|
48
|
+
logLine(logger, dim("Run `devflare account --account <id>` to inspect the configured account.", theme));
|
|
49
|
+
}
|
|
50
|
+
async function runLoginCommand(parsed, logger, options) {
|
|
51
|
+
const force = parsed.options.force === true;
|
|
52
|
+
const cwd = options.cwd ?? process.cwd();
|
|
53
|
+
const theme = createCliTheme(parsed.options);
|
|
54
|
+
if (!force && await account.isAuthenticated()) {
|
|
55
|
+
logger.success("Already authenticated with Cloudflare");
|
|
56
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
57
|
+
logLine(logger, dim("Use `devflare login --force` to open Wrangler login again.", theme));
|
|
58
|
+
return { exitCode: 0 };
|
|
59
|
+
}
|
|
60
|
+
logLine(logger);
|
|
61
|
+
logLine(logger, `${yellow("login", theme)} ${dim("Opening Wrangler login…", theme)}`);
|
|
62
|
+
const deps = await getDependencies();
|
|
63
|
+
const result = await deps.exec.exec("bunx", ["wrangler", "login"], {
|
|
64
|
+
cwd,
|
|
65
|
+
stdio: "inherit"
|
|
66
|
+
});
|
|
67
|
+
if (result.exitCode !== 0) {
|
|
68
|
+
logger.error("Wrangler login failed");
|
|
69
|
+
return { exitCode: 1 };
|
|
70
|
+
}
|
|
71
|
+
logger.success("Authenticated with Cloudflare");
|
|
72
|
+
await logResolvedAccount(cwd, logger, theme);
|
|
73
|
+
return { exitCode: 0 };
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
runLoginCommand
|
|
77
|
+
};
|