devflare 1.0.0-next.14 → 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 -1784
- package/README.md +391 -32
- 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 +1651 -34
- 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/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- 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 +5 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts +1 -0
- 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 +60 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- 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 +640 -3669
- 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-fjwke42y.js +59 -0
- 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-c1xc1gq9.js → dev-2pd33m28.js} +392 -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-z4ffybce.js → doctor-04ammrrh.js} +67 -31
- 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-dr6sbp8d.js → index-0kfzdywd.js} +15 -2
- package/dist/index-0w826dsr.js +379 -0
- package/dist/{index-rfhx0yd5.js → index-11m5a8wd.js} +110 -32
- package/dist/{index-xxwbb2nt.js → index-1sp39f2f.js} +114 -58
- package/dist/index-2jnrqbny.js +1301 -0
- package/dist/index-2pb7b9mw.js +378 -0
- package/dist/{index-0kzg8wed.js → index-2x53aqjm.js} +1071 -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-zbvmtcn2.js → index-74198nxd.js} +179 -77
- package/dist/index-7g8zyws4.js +192 -0
- 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 +23 -14
- package/dist/src/cli/index.js +3 -1
- package/dist/src/cloudflare/index.js +49 -2
- package/dist/src/config-entry.js +14 -0
- package/dist/src/index.js +33 -20
- package/dist/src/runtime/index.js +3 -9
- package/dist/src/sveltekit/index.js +10 -7
- package/dist/src/test/index.js +16 -18
- package/dist/src/vite/index.js +7 -4
- 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-sffr9681.js → types-0sqwkp7x.js} +244 -139
- 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-8psavtg6.js +0 -420
- package/dist/build-n639efmn.js +0 -101
- package/dist/deploy-zvnq6xh7.js +0 -117
- package/dist/index-2q3pmzrx.js +0 -90
- package/dist/index-f4q0jbnj.js +0 -195
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-wyf3s77s.js +0 -343
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensureGeneratedDirectory,
|
|
3
|
+
getGeneratedArtifactPaths
|
|
4
|
+
} from "./index-aabgympv.js";
|
|
5
|
+
import {
|
|
6
|
+
preparePreviewScopedResourcesForDeploy
|
|
7
|
+
} from "./index-k6vq6kkt.js";
|
|
8
|
+
import {
|
|
9
|
+
getDependencies
|
|
10
|
+
} from "./index-1xpj0m4r.js";
|
|
11
|
+
import {
|
|
12
|
+
bundleWorkerEntry
|
|
13
|
+
} from "./index-9fbtk7gv.js";
|
|
14
|
+
import {
|
|
15
|
+
detectViteProject
|
|
16
|
+
} from "./index-y1d8za14.js";
|
|
17
|
+
import {
|
|
18
|
+
logLine
|
|
19
|
+
} from "./index-stgn34cr.js";
|
|
20
|
+
import {
|
|
21
|
+
resolvePackageSpecifier
|
|
22
|
+
} from "./index-82f1z98k.js";
|
|
23
|
+
import {
|
|
24
|
+
prepareComposedWorkerEntrypoint,
|
|
25
|
+
resolveEffectiveViteProject,
|
|
26
|
+
writeGeneratedViteConfig
|
|
27
|
+
} from "./index-74198nxd.js";
|
|
28
|
+
import {
|
|
29
|
+
compileConfig,
|
|
30
|
+
isolateViteBuildOutputPaths,
|
|
31
|
+
rebaseWranglerConfigPaths,
|
|
32
|
+
writeWranglerConfig
|
|
33
|
+
} from "./index-pnbs1b8k.js";
|
|
34
|
+
import {
|
|
35
|
+
loadConfig,
|
|
36
|
+
resolveConfigResources,
|
|
37
|
+
resolveMaterializedConfigResources
|
|
38
|
+
} from "./index-6psz1h4c.js";
|
|
39
|
+
import {
|
|
40
|
+
__require
|
|
41
|
+
} from "./index-37x76zdn.js";
|
|
42
|
+
|
|
43
|
+
// src/cli/deploy-strategy.ts
|
|
44
|
+
function normalizeBranchScope(value) {
|
|
45
|
+
const trimmed = value?.trim();
|
|
46
|
+
return trimmed ? trimmed : undefined;
|
|
47
|
+
}
|
|
48
|
+
function shouldIncludePreviewCrons(config) {
|
|
49
|
+
return config.previews?.includeCrons === true;
|
|
50
|
+
}
|
|
51
|
+
function omitQueueConsumers(config) {
|
|
52
|
+
if (!config.bindings?.queues?.consumers?.length) {
|
|
53
|
+
return config;
|
|
54
|
+
}
|
|
55
|
+
const nextBindings = {
|
|
56
|
+
...config.bindings
|
|
57
|
+
};
|
|
58
|
+
const nextQueues = {
|
|
59
|
+
...nextBindings.queues
|
|
60
|
+
};
|
|
61
|
+
delete nextQueues.consumers;
|
|
62
|
+
if (!nextQueues.producers || Object.keys(nextQueues.producers).length === 0) {
|
|
63
|
+
delete nextBindings.queues;
|
|
64
|
+
} else {
|
|
65
|
+
nextBindings.queues = nextQueues;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
...config,
|
|
69
|
+
bindings: nextBindings
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function omitCronTriggers(config) {
|
|
73
|
+
if (!config.triggers?.crons?.length) {
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
const nextTriggers = {
|
|
77
|
+
...config.triggers
|
|
78
|
+
};
|
|
79
|
+
delete nextTriggers.crons;
|
|
80
|
+
if (Object.keys(nextTriggers).length === 0) {
|
|
81
|
+
const { triggers: _triggers, ...rest } = config;
|
|
82
|
+
return rest;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
...config,
|
|
86
|
+
triggers: nextTriggers
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function applyDeploymentStrategy(config, options = {}) {
|
|
90
|
+
const branchScope = normalizeBranchScope(options.previewBranch) ?? normalizeBranchScope(options.branchName);
|
|
91
|
+
const isBranchScopedPreviewDeploy = !options.preview && options.environment === "preview" && Boolean(branchScope);
|
|
92
|
+
if (!isBranchScopedPreviewDeploy) {
|
|
93
|
+
return {
|
|
94
|
+
config,
|
|
95
|
+
strategy: "default",
|
|
96
|
+
omittedResources: []
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const omittedResources = [];
|
|
100
|
+
let nextConfig = config;
|
|
101
|
+
if (nextConfig.bindings?.queues?.consumers?.length) {
|
|
102
|
+
nextConfig = omitQueueConsumers(nextConfig);
|
|
103
|
+
omittedResources.push("queue-consumers");
|
|
104
|
+
}
|
|
105
|
+
if (!shouldIncludePreviewCrons(nextConfig) && nextConfig.triggers?.crons?.length) {
|
|
106
|
+
nextConfig = omitCronTriggers(nextConfig);
|
|
107
|
+
omittedResources.push("cron-triggers");
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
config: nextConfig,
|
|
111
|
+
strategy: "branch-scoped-preview",
|
|
112
|
+
branchScope,
|
|
113
|
+
omittedResources
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function describeDeploymentStrategy(result) {
|
|
117
|
+
if (result.strategy !== "branch-scoped-preview" || result.omittedResources.length === 0) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const labels = result.omittedResources.map((resource) => {
|
|
121
|
+
return resource === "queue-consumers" ? "queue consumers" : "cron triggers";
|
|
122
|
+
});
|
|
123
|
+
const formattedLabels = labels.length === 2 ? `${labels[0]} and ${labels[1]}` : labels[0];
|
|
124
|
+
const scopeSuffix = result.branchScope ? ` (${result.branchScope})` : "";
|
|
125
|
+
return `Branch-scoped preview deploy detected${scopeSuffix}; omitting shared ${formattedLabels} from the deployed Wrangler config to avoid singleton Cloudflare resource conflicts.`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// src/cli/commands/build-artifacts.ts
|
|
129
|
+
import { dirname, relative, resolve } from "pathe";
|
|
130
|
+
function summarizePreviewScopedResourceNames(resources) {
|
|
131
|
+
const segments = [
|
|
132
|
+
resources.kv.length > 0 ? `KV ${resources.kv.length}` : null,
|
|
133
|
+
resources.d1.length > 0 ? `D1 ${resources.d1.length}` : null,
|
|
134
|
+
resources.r2.length > 0 ? `R2 ${resources.r2.length}` : null,
|
|
135
|
+
resources.queues.length > 0 ? `Queues ${resources.queues.length}` : null,
|
|
136
|
+
resources.vectorize.length > 0 ? `Vectorize ${resources.vectorize.length}` : null,
|
|
137
|
+
resources.hyperdrive.length > 0 ? `Hyperdrive ${resources.hyperdrive.length}` : null,
|
|
138
|
+
resources.analyticsEngine.length > 0 ? `Analytics ${resources.analyticsEngine.length}` : null,
|
|
139
|
+
resources.browser.length > 0 ? `Browser ${resources.browser.length}` : null
|
|
140
|
+
].filter((segment) => segment !== null);
|
|
141
|
+
return segments.length > 0 ? segments.join(" · ") : null;
|
|
142
|
+
}
|
|
143
|
+
function getBuildArtifactPaths(cwd) {
|
|
144
|
+
return getGeneratedArtifactPaths(cwd);
|
|
145
|
+
}
|
|
146
|
+
function isNestedPath(parentPath, candidatePath) {
|
|
147
|
+
const normalizedParentPath = parentPath.replace(/\\/g, "/");
|
|
148
|
+
const normalizedCandidatePath = candidatePath.replace(/\\/g, "/");
|
|
149
|
+
return normalizedCandidatePath.startsWith(`${normalizedParentPath}/`);
|
|
150
|
+
}
|
|
151
|
+
function isolateViteBuildOutputPaths2(cwd, wranglerConfig) {
|
|
152
|
+
return isolateViteBuildOutputPaths(cwd, wranglerConfig);
|
|
153
|
+
}
|
|
154
|
+
function getViteBuildCleanupTargets(cwd, wranglerConfig) {
|
|
155
|
+
const targets = [];
|
|
156
|
+
const assetsDirectory = wranglerConfig.assets?.directory;
|
|
157
|
+
const mainEntry = wranglerConfig.main;
|
|
158
|
+
if (assetsDirectory) {
|
|
159
|
+
targets.push(resolve(cwd, assetsDirectory));
|
|
160
|
+
}
|
|
161
|
+
if (mainEntry) {
|
|
162
|
+
const mainEntryPath = resolve(cwd, mainEntry);
|
|
163
|
+
const isCoveredByAssetsDirectory = targets.some((targetPath) => {
|
|
164
|
+
return mainEntryPath === targetPath || isNestedPath(targetPath, mainEntryPath);
|
|
165
|
+
});
|
|
166
|
+
if (!isCoveredByAssetsDirectory) {
|
|
167
|
+
targets.push(mainEntryPath);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return targets;
|
|
171
|
+
}
|
|
172
|
+
function shouldRetryCleanup(error) {
|
|
173
|
+
if (!error || typeof error !== "object") {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
const errorCode = error.code;
|
|
177
|
+
return errorCode === "EBUSY" || errorCode === "EPERM" || errorCode === "ENOTEMPTY";
|
|
178
|
+
}
|
|
179
|
+
async function getCleanupFileSystem() {
|
|
180
|
+
return await import("node:fs/promises");
|
|
181
|
+
}
|
|
182
|
+
async function pathExists(cleanupFs, targetPath) {
|
|
183
|
+
try {
|
|
184
|
+
await cleanupFs.access(targetPath);
|
|
185
|
+
return true;
|
|
186
|
+
} catch {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function createDeferredCleanupPath(targetPath, uniqueSuffix) {
|
|
191
|
+
const suffix = uniqueSuffix ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
192
|
+
return `${targetPath}.devflare-stale-${suffix}`;
|
|
193
|
+
}
|
|
194
|
+
async function tryMoveLockedPathAside(targetPath, logger, cleanupFs) {
|
|
195
|
+
if (!await pathExists(cleanupFs, targetPath)) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
const deferredCleanupPath = createDeferredCleanupPath(targetPath);
|
|
199
|
+
try {
|
|
200
|
+
await cleanupFs.rename(targetPath, deferredCleanupPath);
|
|
201
|
+
} catch {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
logger.warn(`Moved locked build output aside to ${deferredCleanupPath} after repeated cleanup failures; continuing build`);
|
|
205
|
+
try {
|
|
206
|
+
await cleanupFs.rm(deferredCleanupPath, {
|
|
207
|
+
recursive: true,
|
|
208
|
+
force: true
|
|
209
|
+
});
|
|
210
|
+
} catch (error) {
|
|
211
|
+
const cleanupErrorCode = error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : "an unknown error";
|
|
212
|
+
logger.warn(`Deferred cleanup for ${deferredCleanupPath} is still blocked by ${cleanupErrorCode}; you can remove it manually later`);
|
|
213
|
+
}
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
async function removePathWithRetries(targetPath, logger, attempts = 5, cleanupFs) {
|
|
217
|
+
const fs = cleanupFs ?? await getCleanupFileSystem();
|
|
218
|
+
let lastError;
|
|
219
|
+
for (let attempt = 1;attempt <= attempts; attempt++) {
|
|
220
|
+
try {
|
|
221
|
+
await fs.rm(targetPath, {
|
|
222
|
+
recursive: true,
|
|
223
|
+
force: true
|
|
224
|
+
});
|
|
225
|
+
return;
|
|
226
|
+
} catch (error) {
|
|
227
|
+
lastError = error;
|
|
228
|
+
if (!shouldRetryCleanup(error) || attempt === attempts) {
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
logger.warn(`Retrying cleanup for ${targetPath} after ${error.code} (${attempt}/${attempts})`);
|
|
232
|
+
await new Promise((resolveRetry) => setTimeout(resolveRetry, attempt * 100));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (shouldRetryCleanup(lastError) && await tryMoveLockedPathAside(targetPath, logger, fs)) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (shouldRetryCleanup(lastError)) {
|
|
239
|
+
const cleanupErrorCode = lastError instanceof Error && "code" in lastError && typeof lastError.code === "string" ? lastError.code : "an unknown error";
|
|
240
|
+
logger.warn(`Continuing build without pre-clean for ${targetPath} because cleanup is still blocked by ${cleanupErrorCode}`);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
throw lastError;
|
|
244
|
+
}
|
|
245
|
+
async function cleanupViteBuildOutputs(cwd, wranglerConfig, logger) {
|
|
246
|
+
const cleanupTargets = getViteBuildCleanupTargets(cwd, wranglerConfig);
|
|
247
|
+
for (const cleanupTarget of cleanupTargets) {
|
|
248
|
+
await removePathWithRetries(cleanupTarget, logger);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async function writeDeployRedirect(cwd, generatedConfigPath) {
|
|
252
|
+
const fs = await import("node:fs/promises");
|
|
253
|
+
const paths = getBuildArtifactPaths(cwd);
|
|
254
|
+
await ensureGeneratedDirectory(paths.deployDir);
|
|
255
|
+
const configPath = relative(paths.deployDir, generatedConfigPath).replace(/\\/g, "/");
|
|
256
|
+
await fs.writeFile(paths.deployRedirectPath, `${JSON.stringify({ configPath }, null, "\t")}
|
|
257
|
+
`, "utf-8");
|
|
258
|
+
}
|
|
259
|
+
async function readDeployRedirect(cwd) {
|
|
260
|
+
const fs = await import("node:fs/promises");
|
|
261
|
+
const paths = getBuildArtifactPaths(cwd);
|
|
262
|
+
try {
|
|
263
|
+
const rawConfig = await fs.readFile(paths.deployRedirectPath, "utf-8");
|
|
264
|
+
const parsed = JSON.parse(rawConfig);
|
|
265
|
+
if (typeof parsed.configPath !== "string" || parsed.configPath.length === 0) {
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
return resolve(dirname(paths.deployRedirectPath), parsed.configPath);
|
|
269
|
+
} catch {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
async function writeGeneratedDeployWranglerConfig(cwd, wranglerConfig, options = {}) {
|
|
274
|
+
const paths = getBuildArtifactPaths(cwd);
|
|
275
|
+
await ensureGeneratedDirectory(paths.buildDir, true);
|
|
276
|
+
const buildConfig = rebaseWranglerConfigPaths(cwd, paths.buildDir, wranglerConfig);
|
|
277
|
+
if (options.main) {
|
|
278
|
+
buildConfig.main = options.main;
|
|
279
|
+
}
|
|
280
|
+
await writeWranglerConfig(paths.buildDir, buildConfig, "wrangler.jsonc");
|
|
281
|
+
return paths.buildWranglerConfigPath;
|
|
282
|
+
}
|
|
283
|
+
async function writeGeneratedDevWranglerConfig(cwd, wranglerConfig) {
|
|
284
|
+
const paths = getGeneratedArtifactPaths(cwd);
|
|
285
|
+
await ensureGeneratedDirectory(paths.devflareDir, true);
|
|
286
|
+
const devConfig = rebaseWranglerConfigPaths(cwd, paths.devflareDir, wranglerConfig);
|
|
287
|
+
await writeWranglerConfig(paths.devflareDir, devConfig, "wrangler.jsonc");
|
|
288
|
+
return paths.devWranglerConfigPath;
|
|
289
|
+
}
|
|
290
|
+
async function buildWorkerOnlyDeployArtifact(cwd, wranglerConfig, config, logger) {
|
|
291
|
+
if (!wranglerConfig.main) {
|
|
292
|
+
return await writeGeneratedDeployWranglerConfig(cwd, wranglerConfig);
|
|
293
|
+
}
|
|
294
|
+
const paths = getBuildArtifactPaths(cwd);
|
|
295
|
+
const bundledMainEntryPath = await bundleWorkerEntry({
|
|
296
|
+
cwd,
|
|
297
|
+
inputFile: resolve(cwd, wranglerConfig.main),
|
|
298
|
+
outFile: paths.buildWorkerPath,
|
|
299
|
+
rolldownOptions: config.rolldown?.options,
|
|
300
|
+
sourcemap: config.rolldown?.sourcemap,
|
|
301
|
+
minify: config.rolldown?.minify,
|
|
302
|
+
logger
|
|
303
|
+
});
|
|
304
|
+
logLine(logger, `Generated deploy artifact: ${relative(cwd, bundledMainEntryPath).replace(/\\/g, "/")}`);
|
|
305
|
+
return await writeGeneratedDeployWranglerConfig(cwd, wranglerConfig, {
|
|
306
|
+
main: "./worker.js"
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
async function resolveLocalViteExecutable(cwd, fs) {
|
|
310
|
+
const viteExecutablePath = resolvePackageSpecifier("vite/bin/vite.js", cwd);
|
|
311
|
+
try {
|
|
312
|
+
await fs.access(viteExecutablePath);
|
|
313
|
+
} catch {
|
|
314
|
+
throw new Error(`Could not resolve a local Vite CLI entrypoint from ${cwd}. Install vite in this package before running a Vite-backed Devflare build.`);
|
|
315
|
+
}
|
|
316
|
+
return viteExecutablePath;
|
|
317
|
+
}
|
|
318
|
+
async function prepareBuildArtifacts(parsed, logger, options) {
|
|
319
|
+
const cwd = options.cwd || process.cwd();
|
|
320
|
+
const configPath = parsed.options.config;
|
|
321
|
+
const environment = parsed.options.env;
|
|
322
|
+
const rawConfig = await loadConfig({ cwd, configFile: configPath });
|
|
323
|
+
const shouldPreparePreviewScopedResources = parsed.command === "deploy" && environment === "preview";
|
|
324
|
+
const previewScopedResources = shouldPreparePreviewScopedResources ? await preparePreviewScopedResourcesForDeploy(rawConfig, { environment }) : null;
|
|
325
|
+
const config = previewScopedResources ? await resolveMaterializedConfigResources(previewScopedResources.config, {
|
|
326
|
+
accountId: previewScopedResources.accountId,
|
|
327
|
+
cloudflare: previewScopedResources.resourceResolutionCloudflare
|
|
328
|
+
}) : await resolveConfigResources(rawConfig, { environment });
|
|
329
|
+
const createdPreviewResourcesSummary = previewScopedResources ? summarizePreviewScopedResourceNames(previewScopedResources.created) : null;
|
|
330
|
+
if (createdPreviewResourcesSummary) {
|
|
331
|
+
logLine(logger, `Provisioned preview-scoped resources: ${createdPreviewResourcesSummary}`);
|
|
332
|
+
}
|
|
333
|
+
const existingPreviewResourcesSummary = previewScopedResources ? summarizePreviewScopedResourceNames(previewScopedResources.existing) : null;
|
|
334
|
+
if (existingPreviewResourcesSummary) {
|
|
335
|
+
logLine(logger, `Reused preview-scoped resources: ${existingPreviewResourcesSummary}`);
|
|
336
|
+
}
|
|
337
|
+
for (const warning of previewScopedResources?.warnings ?? []) {
|
|
338
|
+
logger.warn(warning);
|
|
339
|
+
}
|
|
340
|
+
logLine(logger, `Building: ${config.name}`);
|
|
341
|
+
const composedMainEntry = await prepareComposedWorkerEntrypoint(cwd, config, environment);
|
|
342
|
+
const deps = await getDependencies();
|
|
343
|
+
const viteProject = resolveEffectiveViteProject(await detectViteProject(cwd, deps.fs), config, environment);
|
|
344
|
+
const deploymentStrategy = applyDeploymentStrategy(config, {
|
|
345
|
+
environment,
|
|
346
|
+
preview: parsed.options.preview === true,
|
|
347
|
+
branchName: parsed.options["branch-name"],
|
|
348
|
+
previewBranch: process.env.DEVFLARE_PREVIEW_BRANCH
|
|
349
|
+
});
|
|
350
|
+
const deploymentStrategyMessage = describeDeploymentStrategy(deploymentStrategy);
|
|
351
|
+
if (deploymentStrategyMessage) {
|
|
352
|
+
logLine(logger, deploymentStrategyMessage);
|
|
353
|
+
}
|
|
354
|
+
const devWranglerConfig = viteProject.shouldStartVite ? isolateViteBuildOutputPaths2(cwd, compileConfig(config)) : compileConfig(config);
|
|
355
|
+
const deployWranglerConfig = viteProject.shouldStartVite ? isolateViteBuildOutputPaths2(cwd, compileConfig(deploymentStrategy.config)) : compileConfig(deploymentStrategy.config);
|
|
356
|
+
if (viteProject.shouldStartVite) {
|
|
357
|
+
if (composedMainEntry) {
|
|
358
|
+
deployWranglerConfig.main = composedMainEntry;
|
|
359
|
+
logLine(logger, `Generated composed worker entry: ${composedMainEntry}`);
|
|
360
|
+
}
|
|
361
|
+
} else if (composedMainEntry) {
|
|
362
|
+
const bundledMainEntryPath = await bundleWorkerEntry({
|
|
363
|
+
cwd,
|
|
364
|
+
inputFile: resolve(cwd, composedMainEntry),
|
|
365
|
+
outFile: resolve(cwd, ".devflare", "worker-entrypoints", "main.js"),
|
|
366
|
+
rolldownOptions: config.rolldown?.options,
|
|
367
|
+
sourcemap: config.rolldown?.sourcemap,
|
|
368
|
+
minify: config.rolldown?.minify,
|
|
369
|
+
logger
|
|
370
|
+
});
|
|
371
|
+
const bundledMainPath = relative(cwd, bundledMainEntryPath).replace(/\\/g, "/");
|
|
372
|
+
devWranglerConfig.main = bundledMainPath;
|
|
373
|
+
deployWranglerConfig.main = bundledMainPath;
|
|
374
|
+
logLine(logger, `Generated bundled worker entry: ${bundledMainPath}`);
|
|
375
|
+
}
|
|
376
|
+
const generatedDevConfigPath = await writeGeneratedDevWranglerConfig(cwd, devWranglerConfig);
|
|
377
|
+
logger.debug(`Generated dev Wrangler config: ${relative(cwd, generatedDevConfigPath).replace(/\\/g, "/")}`);
|
|
378
|
+
let deployConfigPath;
|
|
379
|
+
if (viteProject.shouldStartVite) {
|
|
380
|
+
const generatedViteConfigPath = await writeGeneratedViteConfig({
|
|
381
|
+
cwd,
|
|
382
|
+
configPath,
|
|
383
|
+
environment,
|
|
384
|
+
localConfigPath: viteProject.viteConfigPath
|
|
385
|
+
});
|
|
386
|
+
const viteExecutablePath = await resolveLocalViteExecutable(cwd, deps.fs);
|
|
387
|
+
await cleanupViteBuildOutputs(cwd, devWranglerConfig, logger);
|
|
388
|
+
logLine(logger, "Running vite build...");
|
|
389
|
+
const buildProc = await deps.exec.exec(viteExecutablePath, ["build", "--config", generatedViteConfigPath], {
|
|
390
|
+
cwd,
|
|
391
|
+
stdio: "inherit",
|
|
392
|
+
env: {
|
|
393
|
+
...process.env,
|
|
394
|
+
DEVFLARE_BUILD: "true"
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
if (buildProc.exitCode !== 0) {
|
|
398
|
+
throw new Error("Build failed");
|
|
399
|
+
}
|
|
400
|
+
const existingDeployConfigPath = await readDeployRedirect(cwd);
|
|
401
|
+
const generatedDeployConfigPath = deployWranglerConfig.main && deployWranglerConfig.main !== devWranglerConfig.main ? await buildWorkerOnlyDeployArtifact(cwd, deployWranglerConfig, config, logger) : await writeGeneratedDeployWranglerConfig(cwd, deployWranglerConfig);
|
|
402
|
+
deployConfigPath = existingDeployConfigPath && existingDeployConfigPath !== generatedDeployConfigPath ? existingDeployConfigPath : generatedDeployConfigPath;
|
|
403
|
+
} else {
|
|
404
|
+
logLine(logger, "Skipping Vite build (no effective Vite config found for this package)");
|
|
405
|
+
deployConfigPath = await buildWorkerOnlyDeployArtifact(cwd, deployWranglerConfig, config, logger);
|
|
406
|
+
}
|
|
407
|
+
await writeDeployRedirect(cwd, deployConfigPath);
|
|
408
|
+
logLine(logger, `Generated deploy Wrangler config: ${relative(cwd, deployConfigPath).replace(/\\/g, "/")}`);
|
|
409
|
+
logLine(logger, `Generated deploy redirect: ${relative(cwd, getBuildArtifactPaths(cwd).deployRedirectPath).replace(/\\/g, "/")}`);
|
|
410
|
+
return {
|
|
411
|
+
config,
|
|
412
|
+
wranglerConfig: deployWranglerConfig,
|
|
413
|
+
deployConfigPath,
|
|
414
|
+
viteProject
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export { applyDeploymentStrategy, describeDeploymentStrategy, prepareBuildArtifacts };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveConfigForEnvironment
|
|
3
|
+
} from "./index-yzddwp02.js";
|
|
4
|
+
|
|
5
|
+
// src/cli/commands/previews-support/family.ts
|
|
6
|
+
function compareConfiguredWorkerFamilies(left, right) {
|
|
7
|
+
if (left.role === "primary" && right.role !== "primary") {
|
|
8
|
+
return -1;
|
|
9
|
+
}
|
|
10
|
+
if (left.role !== "primary" && right.role === "primary") {
|
|
11
|
+
return 1;
|
|
12
|
+
}
|
|
13
|
+
return left.baseName.localeCompare(right.baseName);
|
|
14
|
+
}
|
|
15
|
+
function comparePreviewScopeRows(left, right) {
|
|
16
|
+
const leftTime = left.updatedAt?.getTime() ?? 0;
|
|
17
|
+
const rightTime = right.updatedAt?.getTime() ?? 0;
|
|
18
|
+
if (rightTime !== leftTime) {
|
|
19
|
+
return rightTime - leftTime;
|
|
20
|
+
}
|
|
21
|
+
return left.scope.localeCompare(right.scope);
|
|
22
|
+
}
|
|
23
|
+
function collectConfiguredWorkerFamilies(config, environment) {
|
|
24
|
+
const resolvedConfig = resolveConfigForEnvironment(config, environment);
|
|
25
|
+
const families = new Map;
|
|
26
|
+
families.set(resolvedConfig.name, {
|
|
27
|
+
baseName: resolvedConfig.name,
|
|
28
|
+
roleLabel: "primary",
|
|
29
|
+
role: "primary"
|
|
30
|
+
});
|
|
31
|
+
for (const [bindingName, binding] of Object.entries(resolvedConfig.bindings?.services ?? {})) {
|
|
32
|
+
const existing = families.get(binding.service);
|
|
33
|
+
if (existing) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
families.set(binding.service, {
|
|
37
|
+
baseName: binding.service,
|
|
38
|
+
roleLabel: bindingName,
|
|
39
|
+
role: "service"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return Array.from(families.values()).sort(compareConfiguredWorkerFamilies);
|
|
43
|
+
}
|
|
44
|
+
function getWorkerUrl(workerName, workersSubdomain) {
|
|
45
|
+
if (!workersSubdomain) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
return `https://${workerName}.${workersSubdomain}.workers.dev`;
|
|
49
|
+
}
|
|
50
|
+
function getWorkerScopeSuffix(workerName, baseName) {
|
|
51
|
+
if (!workerName.startsWith(`${baseName}-`)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const suffix = workerName.slice(baseName.length + 1).trim();
|
|
55
|
+
return suffix || undefined;
|
|
56
|
+
}
|
|
57
|
+
function buildStableWorkerRowsFromLiveWorkers(families, workers, workersSubdomain) {
|
|
58
|
+
const workersByName = new Map(workers.map((worker) => [worker.name, worker]));
|
|
59
|
+
return families.map((family) => {
|
|
60
|
+
const worker = workersByName.get(family.baseName);
|
|
61
|
+
const status = worker ? "active" : "missing";
|
|
62
|
+
return {
|
|
63
|
+
workerName: family.baseName,
|
|
64
|
+
role: family.roleLabel,
|
|
65
|
+
status,
|
|
66
|
+
updatedAt: worker?.modifiedOn,
|
|
67
|
+
url: worker ? getWorkerUrl(family.baseName, workersSubdomain) : undefined
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function getDedicatedPreviewFamilyNamesFromWorkers(families, workers) {
|
|
72
|
+
const familyNames = new Set;
|
|
73
|
+
const workerNames = workers.map((worker) => worker.name);
|
|
74
|
+
for (const family of families) {
|
|
75
|
+
if (family.role === "primary") {
|
|
76
|
+
familyNames.add(family.baseName);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (workerNames.some((workerName) => Boolean(getWorkerScopeSuffix(workerName, family.baseName)))) {
|
|
80
|
+
familyNames.add(family.baseName);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return familyNames;
|
|
84
|
+
}
|
|
85
|
+
function buildPreviewScopeRowsFromLiveWorkers(families, workers, workersSubdomain) {
|
|
86
|
+
const workersByName = new Map(workers.map((worker) => [worker.name, worker]));
|
|
87
|
+
const previewFamilyNames = getDedicatedPreviewFamilyNamesFromWorkers(families, workers);
|
|
88
|
+
const expectedFamilies = families.filter((family) => previewFamilyNames.has(family.baseName));
|
|
89
|
+
const workerCandidatesByScope = buildPreviewWorkerCandidatesByScope(families, workers);
|
|
90
|
+
return Array.from(workerCandidatesByScope.keys()).map((scope) => {
|
|
91
|
+
const resolvedFamilies = expectedFamilies.map((family) => ({
|
|
92
|
+
family,
|
|
93
|
+
worker: workersByName.get(`${family.baseName}-${scope}`)
|
|
94
|
+
}));
|
|
95
|
+
const presentFamilies = resolvedFamilies.filter((entry) => entry.worker);
|
|
96
|
+
const updatedAt = presentFamilies.reduce((latest, entry) => {
|
|
97
|
+
const currentDate = entry.worker?.modifiedOn;
|
|
98
|
+
if (!currentDate) {
|
|
99
|
+
return latest;
|
|
100
|
+
}
|
|
101
|
+
if (!latest || currentDate.getTime() > latest.getTime()) {
|
|
102
|
+
return currentDate;
|
|
103
|
+
}
|
|
104
|
+
return latest;
|
|
105
|
+
}, undefined);
|
|
106
|
+
const primaryEntry = resolvedFamilies.find((entry) => entry.family.role === "primary");
|
|
107
|
+
const entryWorker = primaryEntry?.worker ?? presentFamilies[0]?.worker;
|
|
108
|
+
const missingLabels = resolvedFamilies.filter((entry) => !entry.worker).map((entry) => entry.family.role === "primary" ? "primary" : entry.family.roleLabel);
|
|
109
|
+
const notes = [];
|
|
110
|
+
if (missingLabels.length > 0) {
|
|
111
|
+
notes.push(`missing ${missingLabels.join(", ")}`);
|
|
112
|
+
}
|
|
113
|
+
const strategy = "dedicated workers";
|
|
114
|
+
const status = presentFamilies.length === resolvedFamilies.length ? "ready" : "partial";
|
|
115
|
+
return {
|
|
116
|
+
scope,
|
|
117
|
+
strategy,
|
|
118
|
+
workersLabel: `${presentFamilies.length}/${resolvedFamilies.length}`,
|
|
119
|
+
status,
|
|
120
|
+
updatedAt,
|
|
121
|
+
notes: notes.length > 0 ? notes.join(" · ") : undefined,
|
|
122
|
+
entryUrl: entryWorker ? getWorkerUrl(entryWorker.name, workersSubdomain) : undefined
|
|
123
|
+
};
|
|
124
|
+
}).sort(comparePreviewScopeRows);
|
|
125
|
+
}
|
|
126
|
+
function buildPreviewWorkerCandidatesByScope(families, workers) {
|
|
127
|
+
const candidates = new Map;
|
|
128
|
+
for (const worker of workers) {
|
|
129
|
+
for (const family of families) {
|
|
130
|
+
const scope = getWorkerScopeSuffix(worker.name, family.baseName);
|
|
131
|
+
if (!scope) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const names = candidates.get(scope) ?? new Set;
|
|
135
|
+
names.add(worker.name);
|
|
136
|
+
candidates.set(scope, names);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return new Map(Array.from(candidates.entries()).map(([scope, workerNames]) => {
|
|
140
|
+
return [scope, Array.from(workerNames).sort((left, right) => left.localeCompare(right))];
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
function orderPreviewWorkerNamesForDeletion(workerNames, scope, families) {
|
|
144
|
+
const familyPriority = new Map;
|
|
145
|
+
for (const family of families) {
|
|
146
|
+
familyPriority.set(family.baseName, {
|
|
147
|
+
priority: family.role === "primary" ? 0 : 1,
|
|
148
|
+
roleLabel: family.roleLabel
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
const resolveFamilyForWorker = (workerName) => {
|
|
152
|
+
for (const family of families) {
|
|
153
|
+
if (getWorkerScopeSuffix(workerName, family.baseName) === scope) {
|
|
154
|
+
const resolved = familyPriority.get(family.baseName);
|
|
155
|
+
if (resolved) {
|
|
156
|
+
return {
|
|
157
|
+
priority: resolved.priority,
|
|
158
|
+
roleLabel: resolved.roleLabel,
|
|
159
|
+
baseName: family.baseName
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
priority: 2,
|
|
166
|
+
roleLabel: workerName
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
return [...workerNames].sort((left, right) => {
|
|
170
|
+
const leftFamily = resolveFamilyForWorker(left);
|
|
171
|
+
const rightFamily = resolveFamilyForWorker(right);
|
|
172
|
+
if (leftFamily.priority !== rightFamily.priority) {
|
|
173
|
+
return leftFamily.priority - rightFamily.priority;
|
|
174
|
+
}
|
|
175
|
+
if (leftFamily.roleLabel !== rightFamily.roleLabel) {
|
|
176
|
+
return leftFamily.roleLabel.localeCompare(rightFamily.roleLabel);
|
|
177
|
+
}
|
|
178
|
+
if (leftFamily.baseName && rightFamily.baseName && leftFamily.baseName !== rightFamily.baseName) {
|
|
179
|
+
return leftFamily.baseName.localeCompare(rightFamily.baseName);
|
|
180
|
+
}
|
|
181
|
+
return left.localeCompare(right);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { collectConfiguredWorkerFamilies, buildStableWorkerRowsFromLiveWorkers, buildPreviewScopeRowsFromLiveWorkers, buildPreviewWorkerCandidatesByScope, orderPreviewWorkerNamesForDeletion };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadConfig,
|
|
3
|
+
resolveConfigPath
|
|
4
|
+
} from "./index-0apbm26n.js";
|
|
5
|
+
import {
|
|
6
|
+
getEffectiveAccountId,
|
|
7
|
+
getPrimaryAccount,
|
|
8
|
+
getWorkspaceAccountId
|
|
9
|
+
} from "./index-jb75kwa4.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/command-utils.ts
|
|
12
|
+
function asOptionalString(value) {
|
|
13
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
14
|
+
}
|
|
15
|
+
function resolveNamedSelection(options) {
|
|
16
|
+
if (options.explicitValue) {
|
|
17
|
+
return {
|
|
18
|
+
value: options.explicitValue,
|
|
19
|
+
source: "option"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (options.fallbackValue) {
|
|
23
|
+
return {
|
|
24
|
+
value: options.fallbackValue,
|
|
25
|
+
source: "arg"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (options.configuredValue) {
|
|
29
|
+
return {
|
|
30
|
+
value: options.configuredValue,
|
|
31
|
+
source: "config"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
value: undefined,
|
|
36
|
+
source: "none"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async function getConfiguredAccountId(cwd) {
|
|
40
|
+
const workspaceAccountId = getWorkspaceAccountId();
|
|
41
|
+
if (workspaceAccountId) {
|
|
42
|
+
return workspaceAccountId;
|
|
43
|
+
}
|
|
44
|
+
const envAccountId = process.env.CLOUDFLARE_ACCOUNT_ID?.trim();
|
|
45
|
+
if (envAccountId) {
|
|
46
|
+
return envAccountId;
|
|
47
|
+
}
|
|
48
|
+
const configPath = await resolveConfigPath(cwd);
|
|
49
|
+
if (!configPath) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const config = await loadConfig({ cwd });
|
|
54
|
+
return config.accountId;
|
|
55
|
+
} catch {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async function resolveCloudflareAccountId(options) {
|
|
60
|
+
if (options.explicitAccountId) {
|
|
61
|
+
return options.explicitAccountId;
|
|
62
|
+
}
|
|
63
|
+
if (options.configuredAccountId) {
|
|
64
|
+
return options.configuredAccountId;
|
|
65
|
+
}
|
|
66
|
+
const primaryAccount = await getPrimaryAccount(options.apiOptions);
|
|
67
|
+
if (!primaryAccount) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const effective = await getEffectiveAccountId(primaryAccount.id);
|
|
71
|
+
return effective.accountId;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { asOptionalString, resolveNamedSelection, getConfiguredAccountId, resolveCloudflareAccountId };
|