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
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bundleWorkerEntry,
|
|
3
3
|
createDOBundler
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-9fbtk7gv.js";
|
|
5
5
|
import {
|
|
6
6
|
detectViteProject,
|
|
7
7
|
stopSpawnedProcessTree,
|
|
8
8
|
waitForViteReady
|
|
9
9
|
} from "./index-y1d8za14.js";
|
|
10
10
|
import {
|
|
11
|
+
createCliTheme,
|
|
12
|
+
cyanBold,
|
|
13
|
+
dim,
|
|
14
|
+
logLine,
|
|
15
|
+
yellow
|
|
16
|
+
} from "./index-stgn34cr.js";
|
|
17
|
+
import"./index-3t6rypgc.js";
|
|
18
|
+
import {
|
|
19
|
+
DEFAULT_EMAIL_ENTRY_FILES,
|
|
20
|
+
DEFAULT_FETCH_ENTRY_FILES,
|
|
21
|
+
DEFAULT_QUEUE_ENTRY_FILES,
|
|
22
|
+
DEFAULT_SCHEDULED_ENTRY_FILES,
|
|
23
|
+
hasWorkerSurfacePaths,
|
|
11
24
|
prepareComposedWorkerEntrypoint,
|
|
12
25
|
resolveEffectiveViteProject,
|
|
26
|
+
resolveWorkerSurfacePaths,
|
|
13
27
|
writeGeneratedViteConfig
|
|
14
|
-
} from "./index-
|
|
28
|
+
} from "./index-j185x270.js";
|
|
15
29
|
import {
|
|
16
30
|
discoverRoutes,
|
|
17
31
|
getRouteDirectoryCandidate
|
|
@@ -21,23 +35,29 @@ import"./index-9wt9x09k.js";
|
|
|
21
35
|
import {
|
|
22
36
|
clearLocalSendEmailBindings,
|
|
23
37
|
setLocalSendEmailBindings
|
|
24
|
-
} from "./index-
|
|
25
|
-
import"./index-
|
|
38
|
+
} from "./index-h18pxvzs.js";
|
|
39
|
+
import"./index-thna1tkd.js";
|
|
26
40
|
import {
|
|
41
|
+
getLocalD1DatabaseIdentifier,
|
|
42
|
+
getLocalKVNamespaceIdentifier,
|
|
43
|
+
getSingleBrowserBindingName,
|
|
27
44
|
loadConfig,
|
|
28
45
|
resolveConfigPath
|
|
29
|
-
} from "./index-
|
|
30
|
-
import"./index-
|
|
46
|
+
} from "./index-0apbm26n.js";
|
|
47
|
+
import"./index-jb75kwa4.js";
|
|
48
|
+
import"./index-0w826dsr.js";
|
|
49
|
+
import"./index-6jef5emv.js";
|
|
50
|
+
import"./index-t08te69w.js";
|
|
31
51
|
import {
|
|
32
52
|
__require
|
|
33
53
|
} from "./index-37x76zdn.js";
|
|
34
54
|
|
|
35
55
|
// src/cli/commands/dev.ts
|
|
36
56
|
import { createConsola } from "consola";
|
|
37
|
-
import { relative, resolve as
|
|
57
|
+
import { relative, resolve as resolve4 } from "pathe";
|
|
38
58
|
|
|
39
59
|
// src/dev-server/server.ts
|
|
40
|
-
import {
|
|
60
|
+
import { resolve as resolve3 } from "pathe";
|
|
41
61
|
|
|
42
62
|
// src/browser-shim/server.ts
|
|
43
63
|
import { homedir } from "node:os";
|
|
@@ -810,170 +830,89 @@ async function checkRemoteBindingRequirements(config) {
|
|
|
810
830
|
};
|
|
811
831
|
}
|
|
812
832
|
|
|
813
|
-
// src/dev-server/
|
|
814
|
-
|
|
815
|
-
var
|
|
816
|
-
function
|
|
817
|
-
|
|
833
|
+
// src/dev-server/d1-migrations.ts
|
|
834
|
+
import { resolve } from "pathe";
|
|
835
|
+
var MIGRATION_RETRY_DELAYS_MS = [500, 1000, 1500, 2000];
|
|
836
|
+
function collectMigrationStatements(sql) {
|
|
837
|
+
const cleanedSql = sql.split(`
|
|
838
|
+
`).filter((line) => !line.trim().startsWith("--")).join(`
|
|
839
|
+
`);
|
|
840
|
+
return cleanedSql.split(";").map((statement) => statement.trim()).filter((statement) => statement.length > 0);
|
|
818
841
|
}
|
|
819
|
-
function
|
|
820
|
-
|
|
821
|
-
const match = COMPATIBILITY_DATE_FALLBACK_REGEX.exec(normalizedMessage);
|
|
822
|
-
if (!match) {
|
|
823
|
-
return null;
|
|
824
|
-
}
|
|
825
|
-
const [, _supportedDate, requestedDate, fallbackDate] = match;
|
|
826
|
-
return `Using latest supported Cloudflare Workers Runtime compatibility date ${fallbackDate} (requested ${requestedDate})`;
|
|
842
|
+
function getErrorMessage(error) {
|
|
843
|
+
return error instanceof Error ? error.message : String(error);
|
|
827
844
|
}
|
|
828
|
-
function
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
845
|
+
async function waitForRetry(delayMs) {
|
|
846
|
+
await new Promise((resolvePromise) => setTimeout(resolvePromise, delayMs));
|
|
847
|
+
}
|
|
848
|
+
async function applyMigrationsToBinding(options) {
|
|
849
|
+
const { bindingName, statements, miniflarePort, logger } = options;
|
|
850
|
+
let lastError;
|
|
851
|
+
for (let attempt = 0;attempt <= MIGRATION_RETRY_DELAYS_MS.length; attempt++) {
|
|
852
|
+
if (attempt > 0) {
|
|
853
|
+
await waitForRetry(MIGRATION_RETRY_DELAYS_MS[attempt - 1]);
|
|
837
854
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
855
|
+
try {
|
|
856
|
+
const response = await fetch(`http://127.0.0.1:${miniflarePort}/_devflare/migrate`, {
|
|
857
|
+
method: "POST",
|
|
858
|
+
headers: { "Content-Type": "application/json" },
|
|
859
|
+
body: JSON.stringify({ bindingName, statements })
|
|
860
|
+
});
|
|
861
|
+
if (!response.ok) {
|
|
862
|
+
const text = await response.text();
|
|
863
|
+
throw new Error(`HTTP ${response.status}: ${text}`);
|
|
864
|
+
}
|
|
865
|
+
const result = await response.json();
|
|
866
|
+
if (result.success) {
|
|
867
|
+
logger?.success(`D1 migrations applied to ${bindingName}`);
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
throw new Error(result.error || "Unknown error");
|
|
871
|
+
} catch (error) {
|
|
872
|
+
lastError = error;
|
|
841
873
|
}
|
|
842
|
-
originalInfo(notice);
|
|
843
|
-
};
|
|
844
|
-
return log;
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
// src/dev-server/runtime-stdio.ts
|
|
848
|
-
import { createInterface } from "node:readline";
|
|
849
|
-
function writeStdout(logger, message) {
|
|
850
|
-
if (typeof logger?.log === "function") {
|
|
851
|
-
logger.log(message);
|
|
852
|
-
return;
|
|
853
|
-
}
|
|
854
|
-
if (typeof logger?.info === "function") {
|
|
855
|
-
logger.info(message);
|
|
856
|
-
return;
|
|
857
874
|
}
|
|
858
|
-
|
|
875
|
+
logger?.warn(`Failed to apply migrations to ${bindingName}: ${getErrorMessage(lastError)}`);
|
|
859
876
|
}
|
|
860
|
-
function
|
|
861
|
-
|
|
862
|
-
|
|
877
|
+
async function runD1Migrations(options) {
|
|
878
|
+
const { cwd, config, miniflarePort, logger } = options;
|
|
879
|
+
if (!config?.bindings?.d1) {
|
|
863
880
|
return;
|
|
864
881
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
createInterface({ input: stdout }).on("line", (data) => {
|
|
870
|
-
writeStdout(logger, data);
|
|
871
|
-
});
|
|
872
|
-
createInterface({ input: stderr }).on("line", (data) => {
|
|
873
|
-
writeStderr(logger, data);
|
|
874
|
-
});
|
|
875
|
-
};
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
// src/dev-server/server.ts
|
|
879
|
-
var DEFAULT_FETCH_ENTRY_FILES = [
|
|
880
|
-
"src/fetch.ts",
|
|
881
|
-
"src/fetch.js",
|
|
882
|
-
"src/fetch.mts",
|
|
883
|
-
"src/fetch.mjs"
|
|
884
|
-
];
|
|
885
|
-
var DEFAULT_QUEUE_ENTRY_FILES = [
|
|
886
|
-
"src/queue.ts",
|
|
887
|
-
"src/queue.js",
|
|
888
|
-
"src/queue.mts",
|
|
889
|
-
"src/queue.mjs"
|
|
890
|
-
];
|
|
891
|
-
var DEFAULT_SCHEDULED_ENTRY_FILES = [
|
|
892
|
-
"src/scheduled.ts",
|
|
893
|
-
"src/scheduled.js",
|
|
894
|
-
"src/scheduled.mts",
|
|
895
|
-
"src/scheduled.mjs"
|
|
896
|
-
];
|
|
897
|
-
var DEFAULT_EMAIL_ENTRY_FILES = [
|
|
898
|
-
"src/email.ts",
|
|
899
|
-
"src/email.js",
|
|
900
|
-
"src/email.mts",
|
|
901
|
-
"src/email.mjs"
|
|
902
|
-
];
|
|
903
|
-
var DEFAULT_TRANSPORT_ENTRY_FILES = [
|
|
904
|
-
"src/transport.ts",
|
|
905
|
-
"src/transport.js",
|
|
906
|
-
"src/transport.mts",
|
|
907
|
-
"src/transport.mjs"
|
|
908
|
-
];
|
|
909
|
-
var INTERNAL_APP_SERVICE_BINDING = "__DEVFLARE_APP";
|
|
910
|
-
function formatErrorMessage(error) {
|
|
911
|
-
return error instanceof Error ? error.message : String(error);
|
|
912
|
-
}
|
|
913
|
-
async function resolveWorkerHandlerPath(cwd, configuredPath, defaultEntries) {
|
|
914
|
-
if (configuredPath === false) {
|
|
915
|
-
return null;
|
|
916
|
-
}
|
|
917
|
-
const fs = await import("node:fs/promises");
|
|
918
|
-
const candidates = new Set;
|
|
919
|
-
if (typeof configuredPath === "string" && configuredPath) {
|
|
920
|
-
candidates.add(configuredPath);
|
|
921
|
-
}
|
|
922
|
-
for (const defaultEntry of defaultEntries) {
|
|
923
|
-
candidates.add(defaultEntry);
|
|
924
|
-
}
|
|
925
|
-
for (const candidate of candidates) {
|
|
926
|
-
const absolutePath = resolve(cwd, candidate);
|
|
927
|
-
try {
|
|
928
|
-
await fs.access(absolutePath);
|
|
929
|
-
return absolutePath;
|
|
930
|
-
} catch {
|
|
931
|
-
continue;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
return null;
|
|
935
|
-
}
|
|
936
|
-
async function resolveMainWorkerSurfacePaths(cwd, config) {
|
|
937
|
-
return {
|
|
938
|
-
fetch: await resolveWorkerHandlerPath(cwd, config.files?.fetch, DEFAULT_FETCH_ENTRY_FILES),
|
|
939
|
-
queue: await resolveWorkerHandlerPath(cwd, config.files?.queue, DEFAULT_QUEUE_ENTRY_FILES),
|
|
940
|
-
scheduled: await resolveWorkerHandlerPath(cwd, config.files?.scheduled, DEFAULT_SCHEDULED_ENTRY_FILES),
|
|
941
|
-
email: await resolveWorkerHandlerPath(cwd, config.files?.email, DEFAULT_EMAIL_ENTRY_FILES)
|
|
942
|
-
};
|
|
943
|
-
}
|
|
944
|
-
function hasWorkerSurfacePaths(surfacePaths) {
|
|
945
|
-
return Object.values(surfacePaths).some((surfacePath) => typeof surfacePath === "string" && surfacePath.length > 0);
|
|
946
|
-
}
|
|
947
|
-
function addWorkerWatchRoots(roots, cwd, configuredPath, defaultEntries) {
|
|
948
|
-
if (configuredPath === false || configuredPath === null) {
|
|
882
|
+
const { existsSync: existsSync2, readdirSync, readFileSync } = await import("node:fs");
|
|
883
|
+
const migrationsDir = resolve(cwd, "migrations");
|
|
884
|
+
if (!existsSync2(migrationsDir)) {
|
|
885
|
+
logger?.debug("No migrations/ directory found, skipping D1 migrations");
|
|
949
886
|
return;
|
|
950
887
|
}
|
|
951
|
-
|
|
952
|
-
|
|
888
|
+
const files = readdirSync(migrationsDir).filter((file) => file.endsWith(".sql")).sort();
|
|
889
|
+
if (files.length === 0) {
|
|
890
|
+
logger?.debug("No SQL migration files found");
|
|
953
891
|
return;
|
|
954
892
|
}
|
|
955
|
-
|
|
956
|
-
|
|
893
|
+
logger?.info(`Running ${files.length} D1 migration(s)...`);
|
|
894
|
+
const allStatements = [];
|
|
895
|
+
for (const file of files) {
|
|
896
|
+
const sql = readFileSync(resolve(migrationsDir, file), "utf-8");
|
|
897
|
+
const statements = collectMigrationStatements(sql);
|
|
898
|
+
allStatements.push(...statements);
|
|
899
|
+
logger?.debug(`File ${file}: ${statements.length} statement(s)`);
|
|
957
900
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
for (const surfacePath of Object.values(mainWorkerSurfacePaths)) {
|
|
962
|
-
if (surfacePath) {
|
|
963
|
-
roots.add(dirname(surfacePath));
|
|
964
|
-
}
|
|
901
|
+
if (allStatements.length === 0) {
|
|
902
|
+
logger?.debug("No executable D1 migration statements found");
|
|
903
|
+
return;
|
|
965
904
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
roots.add(routeDirectory.absoluteDir);
|
|
905
|
+
for (const [bindingName] of Object.entries(config.bindings.d1)) {
|
|
906
|
+
await applyMigrationsToBinding({
|
|
907
|
+
bindingName,
|
|
908
|
+
statements: allStatements,
|
|
909
|
+
miniflarePort,
|
|
910
|
+
logger
|
|
911
|
+
});
|
|
974
912
|
}
|
|
975
|
-
return [...roots];
|
|
976
913
|
}
|
|
914
|
+
|
|
915
|
+
// src/dev-server/gateway-script.ts
|
|
977
916
|
function getGatewayScript(wsRoutes = [], debug = false, appServiceBindingName = null) {
|
|
978
917
|
const wsRoutesJson = JSON.stringify(wsRoutes);
|
|
979
918
|
const appServiceBindingJson = JSON.stringify(appServiceBindingName);
|
|
@@ -1528,6 +1467,252 @@ function base64ToArrayBuffer(base64) {
|
|
|
1528
1467
|
}
|
|
1529
1468
|
`;
|
|
1530
1469
|
}
|
|
1470
|
+
|
|
1471
|
+
// src/dev-server/miniflare-log.ts
|
|
1472
|
+
var ANSI_ESCAPE_REGEX = /\u001B\[[0-9;]*m/g;
|
|
1473
|
+
var COMPATIBILITY_DATE_FALLBACK_REGEX = /^The latest compatibility date supported by the installed Cloudflare Workers Runtime is "([^"]+)", but you've requested "([^"]+)"\. Falling back to "([^"]+)"\.\.\.$/;
|
|
1474
|
+
function normalizeMiniflareMessage(message) {
|
|
1475
|
+
return message.replace(ANSI_ESCAPE_REGEX, "").replace(/\s+/g, " ").trim();
|
|
1476
|
+
}
|
|
1477
|
+
function formatCompatibilityDateFallbackNotice(message) {
|
|
1478
|
+
const normalizedMessage = normalizeMiniflareMessage(message);
|
|
1479
|
+
const match = COMPATIBILITY_DATE_FALLBACK_REGEX.exec(normalizedMessage);
|
|
1480
|
+
if (!match) {
|
|
1481
|
+
return null;
|
|
1482
|
+
}
|
|
1483
|
+
const [, _supportedDate, requestedDate, fallbackDate] = match;
|
|
1484
|
+
return `Using latest supported Cloudflare Workers Runtime compatibility date ${fallbackDate} (requested ${requestedDate})`;
|
|
1485
|
+
}
|
|
1486
|
+
function createCompatibilityAwareMiniflareLog(BaseLog, level, logger) {
|
|
1487
|
+
const log = new BaseLog(level);
|
|
1488
|
+
const originalWarn = log.warn.bind(log);
|
|
1489
|
+
const originalInfo = log.info.bind(log);
|
|
1490
|
+
log.warn = (message) => {
|
|
1491
|
+
const notice = formatCompatibilityDateFallbackNotice(message);
|
|
1492
|
+
if (!notice) {
|
|
1493
|
+
originalWarn(message);
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1496
|
+
if (logger) {
|
|
1497
|
+
logger.info(notice);
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
originalInfo(notice);
|
|
1501
|
+
};
|
|
1502
|
+
return log;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
// src/dev-server/runtime-stdio.ts
|
|
1506
|
+
import { createInterface } from "node:readline";
|
|
1507
|
+
function writeStdout(logger, message) {
|
|
1508
|
+
if (typeof logger?.log === "function") {
|
|
1509
|
+
logger.log(message);
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
if (typeof logger?.info === "function") {
|
|
1513
|
+
logger.info(message);
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
console.log(message);
|
|
1517
|
+
}
|
|
1518
|
+
function writeStderr(logger, message) {
|
|
1519
|
+
if (typeof logger?.error === "function") {
|
|
1520
|
+
logger.error(message);
|
|
1521
|
+
return;
|
|
1522
|
+
}
|
|
1523
|
+
console.error(message);
|
|
1524
|
+
}
|
|
1525
|
+
function createRuntimeStdioForwarder(logger) {
|
|
1526
|
+
return (stdout, stderr) => {
|
|
1527
|
+
createInterface({ input: stdout }).on("line", (data) => {
|
|
1528
|
+
writeStdout(logger, data);
|
|
1529
|
+
});
|
|
1530
|
+
createInterface({ input: stderr }).on("line", (data) => {
|
|
1531
|
+
writeStderr(logger, data);
|
|
1532
|
+
});
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
// src/dev-server/vite-process.ts
|
|
1537
|
+
import { spawn } from "node:child_process";
|
|
1538
|
+
async function startViteProcess(options) {
|
|
1539
|
+
const {
|
|
1540
|
+
cwd,
|
|
1541
|
+
vitePort,
|
|
1542
|
+
miniflarePort,
|
|
1543
|
+
generatedViteConfigPath,
|
|
1544
|
+
logger
|
|
1545
|
+
} = options;
|
|
1546
|
+
const args = ["vite", "dev", "--port", String(vitePort)];
|
|
1547
|
+
if (generatedViteConfigPath) {
|
|
1548
|
+
args.push("--config", generatedViteConfigPath);
|
|
1549
|
+
}
|
|
1550
|
+
const viteProcess = spawn("bunx", args, {
|
|
1551
|
+
cwd,
|
|
1552
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
1553
|
+
windowsHide: true,
|
|
1554
|
+
env: {
|
|
1555
|
+
...process.env,
|
|
1556
|
+
DEVFLARE_DEV: "true",
|
|
1557
|
+
DEVFLARE_BRIDGE_PORT: String(miniflarePort),
|
|
1558
|
+
FORCE_COLOR: "1"
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
const readyUrl = await waitForViteReady(viteProcess, {
|
|
1562
|
+
onStdout(chunk) {
|
|
1563
|
+
process.stdout.write(chunk);
|
|
1564
|
+
},
|
|
1565
|
+
onStderr(chunk) {
|
|
1566
|
+
process.stderr.write(chunk);
|
|
1567
|
+
}
|
|
1568
|
+
});
|
|
1569
|
+
if (readyUrl) {
|
|
1570
|
+
logger?.success(`Vite dev server started on ${readyUrl}`);
|
|
1571
|
+
return viteProcess;
|
|
1572
|
+
}
|
|
1573
|
+
logger?.warn("Vite process started, but the final local URL could not be confirmed yet");
|
|
1574
|
+
return viteProcess;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
// src/dev-server/worker-surface-paths.ts
|
|
1578
|
+
import { dirname, resolve as resolve2 } from "pathe";
|
|
1579
|
+
var DEFAULT_TRANSPORT_ENTRY_FILES = [
|
|
1580
|
+
"src/transport.ts",
|
|
1581
|
+
"src/transport.js",
|
|
1582
|
+
"src/transport.mts",
|
|
1583
|
+
"src/transport.mjs"
|
|
1584
|
+
];
|
|
1585
|
+
var resolveMainWorkerSurfacePaths = resolveWorkerSurfacePaths;
|
|
1586
|
+
function addWorkerWatchRoots(roots, cwd, configuredPath, defaultEntries) {
|
|
1587
|
+
if (configuredPath === false || configuredPath === null) {
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
if (typeof configuredPath === "string" && configuredPath) {
|
|
1591
|
+
roots.add(dirname(resolve2(cwd, configuredPath)));
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
for (const defaultEntry of defaultEntries) {
|
|
1595
|
+
roots.add(dirname(resolve2(cwd, defaultEntry)));
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
function collectWorkerWatchRoots(cwd, config, mainWorkerSurfacePaths) {
|
|
1599
|
+
const roots = new Set;
|
|
1600
|
+
for (const surfacePath of Object.values(mainWorkerSurfacePaths)) {
|
|
1601
|
+
if (surfacePath) {
|
|
1602
|
+
roots.add(dirname(surfacePath));
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
addWorkerWatchRoots(roots, cwd, config.files?.fetch, DEFAULT_FETCH_ENTRY_FILES);
|
|
1606
|
+
addWorkerWatchRoots(roots, cwd, config.files?.queue, DEFAULT_QUEUE_ENTRY_FILES);
|
|
1607
|
+
addWorkerWatchRoots(roots, cwd, config.files?.scheduled, DEFAULT_SCHEDULED_ENTRY_FILES);
|
|
1608
|
+
addWorkerWatchRoots(roots, cwd, config.files?.email, DEFAULT_EMAIL_ENTRY_FILES);
|
|
1609
|
+
addWorkerWatchRoots(roots, cwd, config.files?.transport, DEFAULT_TRANSPORT_ENTRY_FILES);
|
|
1610
|
+
const routeDirectory = getRouteDirectoryCandidate(cwd, config);
|
|
1611
|
+
if (routeDirectory) {
|
|
1612
|
+
roots.add(routeDirectory.absoluteDir);
|
|
1613
|
+
}
|
|
1614
|
+
return [...roots];
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
// src/dev-server/worker-source-watcher.ts
|
|
1618
|
+
async function startWorkerSourceWatcher(options) {
|
|
1619
|
+
const { watchTargets, resolvedWorkerConfigPath, logger, onConfigChange, onWorkerChange } = options;
|
|
1620
|
+
if (watchTargets.length === 0) {
|
|
1621
|
+
return null;
|
|
1622
|
+
}
|
|
1623
|
+
const chokidar = await import("chokidar");
|
|
1624
|
+
const isWindows = process.platform === "win32";
|
|
1625
|
+
const ignoredSegments = ["/node_modules/", "/.git/", "/.devflare/", "/dist/"];
|
|
1626
|
+
const normalizePath = (filePath) => filePath.replace(/\\/g, "/");
|
|
1627
|
+
const isIgnoredPath = (filePath) => {
|
|
1628
|
+
const normalizedPath = normalizePath(filePath);
|
|
1629
|
+
return ignoredSegments.some((segment) => normalizedPath.includes(segment));
|
|
1630
|
+
};
|
|
1631
|
+
let reloadTimeout = null;
|
|
1632
|
+
let reloadInProgress = false;
|
|
1633
|
+
let pendingReloadPath = null;
|
|
1634
|
+
const flushPendingReload = async () => {
|
|
1635
|
+
if (!pendingReloadPath) {
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
const nextPath = pendingReloadPath;
|
|
1639
|
+
pendingReloadPath = null;
|
|
1640
|
+
await triggerReload(nextPath);
|
|
1641
|
+
};
|
|
1642
|
+
const triggerReload = async (filePath) => {
|
|
1643
|
+
if (reloadInProgress) {
|
|
1644
|
+
pendingReloadPath = filePath;
|
|
1645
|
+
return;
|
|
1646
|
+
}
|
|
1647
|
+
reloadInProgress = true;
|
|
1648
|
+
try {
|
|
1649
|
+
const normalizedConfigPath = resolvedWorkerConfigPath ? normalizePath(resolvedWorkerConfigPath) : null;
|
|
1650
|
+
if (normalizedConfigPath && normalizePath(filePath) === normalizedConfigPath) {
|
|
1651
|
+
logger?.info(`Devflare config changed: ${filePath}`);
|
|
1652
|
+
await onConfigChange();
|
|
1653
|
+
return;
|
|
1654
|
+
}
|
|
1655
|
+
logger?.info(`Worker source changed: ${filePath}`);
|
|
1656
|
+
await onWorkerChange();
|
|
1657
|
+
} catch (error) {
|
|
1658
|
+
logger?.error("Worker source reload failed:", error);
|
|
1659
|
+
} finally {
|
|
1660
|
+
reloadInProgress = false;
|
|
1661
|
+
await flushPendingReload();
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
const scheduleReload = (filePath) => {
|
|
1665
|
+
if (reloadTimeout) {
|
|
1666
|
+
clearTimeout(reloadTimeout);
|
|
1667
|
+
}
|
|
1668
|
+
reloadTimeout = setTimeout(() => {
|
|
1669
|
+
reloadTimeout = null;
|
|
1670
|
+
triggerReload(filePath);
|
|
1671
|
+
}, 150);
|
|
1672
|
+
};
|
|
1673
|
+
const watcher = chokidar.watch(watchTargets, {
|
|
1674
|
+
ignoreInitial: true,
|
|
1675
|
+
usePolling: isWindows,
|
|
1676
|
+
interval: isWindows ? 300 : undefined,
|
|
1677
|
+
awaitWriteFinish: {
|
|
1678
|
+
stabilityThreshold: 100,
|
|
1679
|
+
pollInterval: 50
|
|
1680
|
+
},
|
|
1681
|
+
ignored: (filePath) => isIgnoredPath(filePath)
|
|
1682
|
+
});
|
|
1683
|
+
const onFileEvent = (filePath) => {
|
|
1684
|
+
if (isIgnoredPath(filePath)) {
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
scheduleReload(filePath);
|
|
1688
|
+
};
|
|
1689
|
+
watcher.on("change", onFileEvent);
|
|
1690
|
+
watcher.on("add", onFileEvent);
|
|
1691
|
+
watcher.on("unlink", onFileEvent);
|
|
1692
|
+
watcher.on("error", (error) => {
|
|
1693
|
+
logger?.error("Worker source watcher error:", error);
|
|
1694
|
+
});
|
|
1695
|
+
await new Promise((resolvePromise, rejectPromise) => {
|
|
1696
|
+
const handleReady = () => {
|
|
1697
|
+
watcher.off("error", handleInitialError);
|
|
1698
|
+
logger?.info(`Worker source watcher ready (${watchTargets.length} target(s))`);
|
|
1699
|
+
resolvePromise();
|
|
1700
|
+
};
|
|
1701
|
+
const handleInitialError = (error) => {
|
|
1702
|
+
watcher.off("ready", handleReady);
|
|
1703
|
+
rejectPromise(error instanceof Error ? error : new Error(String(error)));
|
|
1704
|
+
};
|
|
1705
|
+
watcher.once("ready", handleReady);
|
|
1706
|
+
watcher.once("error", handleInitialError);
|
|
1707
|
+
});
|
|
1708
|
+
return watcher;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
// src/dev-server/server.ts
|
|
1712
|
+
var INTERNAL_APP_SERVICE_BINDING = "__DEVFLARE_APP";
|
|
1713
|
+
function formatErrorMessage(error) {
|
|
1714
|
+
return error instanceof Error ? error.message : String(error);
|
|
1715
|
+
}
|
|
1531
1716
|
function createDevServer(options) {
|
|
1532
1717
|
const {
|
|
1533
1718
|
cwd,
|
|
@@ -1569,11 +1754,10 @@ function createDevServer(options) {
|
|
|
1569
1754
|
bundledMainWorkerScriptPath = await bundleWorkerEntry({
|
|
1570
1755
|
cwd,
|
|
1571
1756
|
inputFile: mainWorkerScriptPath,
|
|
1572
|
-
outFile:
|
|
1757
|
+
outFile: resolve3(cwd, ".devflare", "worker-entrypoints", "main.js"),
|
|
1573
1758
|
rolldownOptions: config.rolldown?.options,
|
|
1574
1759
|
sourcemap: config.rolldown?.sourcemap,
|
|
1575
1760
|
minify: config.rolldown?.minify,
|
|
1576
|
-
target: config.rolldown?.target,
|
|
1577
1761
|
logger
|
|
1578
1762
|
});
|
|
1579
1763
|
logger?.debug(`Bundled main worker → ${bundledMainWorkerScriptPath}`);
|
|
@@ -1583,7 +1767,7 @@ function createDevServer(options) {
|
|
|
1583
1767
|
throw new Error("Config not loaded");
|
|
1584
1768
|
const loadedConfig = config;
|
|
1585
1769
|
const bindings = loadedConfig.bindings ?? {};
|
|
1586
|
-
const persistPath =
|
|
1770
|
+
const persistPath = resolve3(cwd, ".devflare/data");
|
|
1587
1771
|
const appWorkerName = loadedConfig.name;
|
|
1588
1772
|
const shouldRunMainWorker = !enableVite && (hasWorkerSurfacePaths(mainWorkerSurfacePaths) || Boolean(mainWorkerRoutes?.routes.length));
|
|
1589
1773
|
const queueProducers = (() => {
|
|
@@ -1659,9 +1843,17 @@ function createDevServer(options) {
|
|
|
1659
1843
|
modules: true,
|
|
1660
1844
|
compatibilityDate: loadedConfig.compatibilityDate,
|
|
1661
1845
|
compatibilityFlags: compatFlags,
|
|
1662
|
-
...bindings.kv && {
|
|
1846
|
+
...bindings.kv && {
|
|
1847
|
+
kvNamespaces: Object.fromEntries(Object.entries(bindings.kv).map(([bindingName, bindingConfig]) => {
|
|
1848
|
+
return [bindingName, getLocalKVNamespaceIdentifier(bindingConfig)];
|
|
1849
|
+
}))
|
|
1850
|
+
},
|
|
1663
1851
|
...bindings.r2 && { r2Buckets: bindings.r2 },
|
|
1664
|
-
...bindings.d1 && {
|
|
1852
|
+
...bindings.d1 && {
|
|
1853
|
+
d1Databases: Object.fromEntries(Object.entries(bindings.d1).map(([bindingName, bindingConfig]) => {
|
|
1854
|
+
return [bindingName, getLocalD1DatabaseIdentifier(bindingConfig)];
|
|
1855
|
+
}))
|
|
1856
|
+
},
|
|
1665
1857
|
...Object.keys(workerBindings).length > 0 && { bindings: workerBindings },
|
|
1666
1858
|
...sendEmailConfig && { email: sendEmailConfig },
|
|
1667
1859
|
...queueProducers && { queueProducers },
|
|
@@ -1697,7 +1889,7 @@ function createDevServer(options) {
|
|
|
1697
1889
|
});
|
|
1698
1890
|
gatewayWorker.routes = ["*"];
|
|
1699
1891
|
const hasDurableObjectBundles = !!doResult && doResult.bundles.size > 0;
|
|
1700
|
-
const browserBindingName = bindings.browser
|
|
1892
|
+
const browserBindingName = getSingleBrowserBindingName(bindings.browser);
|
|
1701
1893
|
const needsBrowserWorker = Boolean(browserBindingName && (hasDurableObjectBundles || shouldRunMainWorker));
|
|
1702
1894
|
if (!shouldRunMainWorker && !hasDurableObjectBundles && !needsBrowserWorker) {
|
|
1703
1895
|
return {
|
|
@@ -1842,7 +2034,7 @@ function createDevServer(options) {
|
|
|
1842
2034
|
}
|
|
1843
2035
|
async function resolveWorkerConfigWatchPath() {
|
|
1844
2036
|
if (configPath) {
|
|
1845
|
-
const explicitPath =
|
|
2037
|
+
const explicitPath = resolve3(cwd, configPath);
|
|
1846
2038
|
const fs = await import("node:fs/promises");
|
|
1847
2039
|
try {
|
|
1848
2040
|
await fs.access(explicitPath);
|
|
@@ -1860,7 +2052,7 @@ function createDevServer(options) {
|
|
|
1860
2052
|
const composedMainEntry = await prepareComposedWorkerEntrypoint(cwd, config, undefined, {
|
|
1861
2053
|
devInternalEmail: true
|
|
1862
2054
|
});
|
|
1863
|
-
mainWorkerScriptPath = composedMainEntry ?
|
|
2055
|
+
mainWorkerScriptPath = composedMainEntry ? resolve3(cwd, composedMainEntry) : null;
|
|
1864
2056
|
if (mainWorkerScriptPath) {
|
|
1865
2057
|
await bundleMainWorker();
|
|
1866
2058
|
} else {
|
|
@@ -1901,7 +2093,7 @@ function createDevServer(options) {
|
|
|
1901
2093
|
await refreshWorkerOnlySurfaceState();
|
|
1902
2094
|
await reloadMiniflare(currentDoResult);
|
|
1903
2095
|
}
|
|
1904
|
-
async function
|
|
2096
|
+
async function startWorkerSourceWatcher2() {
|
|
1905
2097
|
if (enableVite || !config) {
|
|
1906
2098
|
return;
|
|
1907
2099
|
}
|
|
@@ -1909,173 +2101,18 @@ function createDevServer(options) {
|
|
|
1909
2101
|
if (watchTargets.length === 0) {
|
|
1910
2102
|
return;
|
|
1911
2103
|
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
};
|
|
1920
|
-
let reloadTimeout = null;
|
|
1921
|
-
let reloadInProgress = false;
|
|
1922
|
-
let pendingReloadPath = null;
|
|
1923
|
-
const triggerReload = async (filePath) => {
|
|
1924
|
-
if (reloadInProgress) {
|
|
1925
|
-
pendingReloadPath = filePath;
|
|
1926
|
-
return;
|
|
1927
|
-
}
|
|
1928
|
-
reloadInProgress = true;
|
|
1929
|
-
try {
|
|
1930
|
-
const normalizedConfigPath = resolvedWorkerConfigPath ? normalizePath(resolvedWorkerConfigPath) : null;
|
|
1931
|
-
if (normalizedConfigPath && normalizePath(filePath) === normalizedConfigPath) {
|
|
1932
|
-
logger?.info(`Devflare config changed: ${filePath}`);
|
|
1933
|
-
await reloadWorkerOnlyConfig();
|
|
1934
|
-
return;
|
|
1935
|
-
}
|
|
1936
|
-
logger?.info(`Worker source changed: ${filePath}`);
|
|
2104
|
+
workerWatchTargets = watchTargets;
|
|
2105
|
+
workerSourceWatcher = await startWorkerSourceWatcher({
|
|
2106
|
+
watchTargets,
|
|
2107
|
+
resolvedWorkerConfigPath,
|
|
2108
|
+
logger,
|
|
2109
|
+
onConfigChange: reloadWorkerOnlyConfig,
|
|
2110
|
+
onWorkerChange: async () => {
|
|
1937
2111
|
await refreshWorkerOnlySurfaceState();
|
|
1938
2112
|
await reloadMiniflare(currentDoResult);
|
|
1939
|
-
} catch (error) {
|
|
1940
|
-
logger?.error("Worker source reload failed:", error);
|
|
1941
|
-
} finally {
|
|
1942
|
-
reloadInProgress = false;
|
|
1943
|
-
if (pendingReloadPath) {
|
|
1944
|
-
const nextPath = pendingReloadPath;
|
|
1945
|
-
pendingReloadPath = null;
|
|
1946
|
-
await triggerReload(nextPath);
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
};
|
|
1950
|
-
const scheduleReload = (filePath) => {
|
|
1951
|
-
if (reloadTimeout) {
|
|
1952
|
-
clearTimeout(reloadTimeout);
|
|
1953
|
-
}
|
|
1954
|
-
reloadTimeout = setTimeout(() => {
|
|
1955
|
-
triggerReload(filePath);
|
|
1956
|
-
}, 150);
|
|
1957
|
-
};
|
|
1958
|
-
workerWatchTargets = watchTargets;
|
|
1959
|
-
workerSourceWatcher = chokidar.watch(watchTargets, {
|
|
1960
|
-
ignoreInitial: true,
|
|
1961
|
-
usePolling: isWindows,
|
|
1962
|
-
interval: isWindows ? 300 : undefined,
|
|
1963
|
-
awaitWriteFinish: {
|
|
1964
|
-
stabilityThreshold: 100,
|
|
1965
|
-
pollInterval: 50
|
|
1966
|
-
},
|
|
1967
|
-
ignored: (filePath) => isIgnoredPath(filePath)
|
|
1968
|
-
});
|
|
1969
|
-
const onFileEvent = (filePath) => {
|
|
1970
|
-
if (isIgnoredPath(filePath)) {
|
|
1971
|
-
return;
|
|
1972
2113
|
}
|
|
1973
|
-
scheduleReload(filePath);
|
|
1974
|
-
};
|
|
1975
|
-
workerSourceWatcher.on("change", onFileEvent);
|
|
1976
|
-
workerSourceWatcher.on("add", onFileEvent);
|
|
1977
|
-
workerSourceWatcher.on("unlink", onFileEvent);
|
|
1978
|
-
workerSourceWatcher.on("error", (error) => {
|
|
1979
|
-
logger?.error("Worker source watcher error:", error);
|
|
1980
|
-
});
|
|
1981
|
-
await new Promise((resolvePromise, rejectPromise) => {
|
|
1982
|
-
const handleReady = () => {
|
|
1983
|
-
workerSourceWatcher?.off("error", handleInitialError);
|
|
1984
|
-
logger?.info(`Worker source watcher ready (${watchTargets.length} target(s))`);
|
|
1985
|
-
resolvePromise();
|
|
1986
|
-
};
|
|
1987
|
-
const handleInitialError = (error) => {
|
|
1988
|
-
workerSourceWatcher?.off("ready", handleReady);
|
|
1989
|
-
rejectPromise(error instanceof Error ? error : new Error(String(error)));
|
|
1990
|
-
};
|
|
1991
|
-
workerSourceWatcher?.once("ready", handleReady);
|
|
1992
|
-
workerSourceWatcher?.once("error", handleInitialError);
|
|
1993
2114
|
});
|
|
1994
2115
|
}
|
|
1995
|
-
async function runD1Migrations() {
|
|
1996
|
-
if (!miniflare || !config?.bindings?.d1)
|
|
1997
|
-
return;
|
|
1998
|
-
const { existsSync: existsSync2, readdirSync, readFileSync } = await import("node:fs");
|
|
1999
|
-
const migrationsDir = resolve(cwd, "migrations");
|
|
2000
|
-
if (!existsSync2(migrationsDir)) {
|
|
2001
|
-
logger?.debug("No migrations/ directory found, skipping D1 migrations");
|
|
2002
|
-
return;
|
|
2003
|
-
}
|
|
2004
|
-
const files = readdirSync(migrationsDir).filter((f) => f.endsWith(".sql")).sort();
|
|
2005
|
-
if (files.length === 0) {
|
|
2006
|
-
logger?.debug("No SQL migration files found");
|
|
2007
|
-
return;
|
|
2008
|
-
}
|
|
2009
|
-
logger?.info(`Running ${files.length} D1 migration(s)...`);
|
|
2010
|
-
const allStatements = [];
|
|
2011
|
-
for (const file of files) {
|
|
2012
|
-
const sql = readFileSync(resolve(migrationsDir, file), "utf-8");
|
|
2013
|
-
const cleanedSql = sql.split(`
|
|
2014
|
-
`).filter((line) => !line.trim().startsWith("--")).join(`
|
|
2015
|
-
`);
|
|
2016
|
-
const statements = cleanedSql.split(";").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
2017
|
-
allStatements.push(...statements);
|
|
2018
|
-
logger?.debug(`File ${file}: ${statements.length} statement(s)`);
|
|
2019
|
-
}
|
|
2020
|
-
for (const [bindingName] of Object.entries(config.bindings.d1)) {
|
|
2021
|
-
for (let attempt = 0;attempt < 5; attempt++) {
|
|
2022
|
-
await new Promise((r) => setTimeout(r, 500 * (attempt + 1)));
|
|
2023
|
-
try {
|
|
2024
|
-
const response = await fetch(`http://127.0.0.1:${miniflarePort}/_devflare/migrate`, {
|
|
2025
|
-
method: "POST",
|
|
2026
|
-
headers: { "Content-Type": "application/json" },
|
|
2027
|
-
body: JSON.stringify({ bindingName, statements: allStatements })
|
|
2028
|
-
});
|
|
2029
|
-
if (!response.ok) {
|
|
2030
|
-
const text = await response.text();
|
|
2031
|
-
throw new Error(`HTTP ${response.status}: ${text}`);
|
|
2032
|
-
}
|
|
2033
|
-
const result = await response.json();
|
|
2034
|
-
if (result.success) {
|
|
2035
|
-
logger?.success(`D1 migrations applied to ${bindingName}`);
|
|
2036
|
-
break;
|
|
2037
|
-
} else {
|
|
2038
|
-
throw new Error(result.error || "Unknown error");
|
|
2039
|
-
}
|
|
2040
|
-
} catch (error) {
|
|
2041
|
-
if (attempt === 4) {
|
|
2042
|
-
logger?.warn(`Failed to apply migrations to ${bindingName}: ${error}`);
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
async function startVite() {
|
|
2049
|
-
const { spawn } = await import("node:child_process");
|
|
2050
|
-
const args = ["vite", "dev", "--port", String(vitePort)];
|
|
2051
|
-
if (generatedViteConfigPath) {
|
|
2052
|
-
args.push("--config", generatedViteConfigPath);
|
|
2053
|
-
}
|
|
2054
|
-
viteProcess = spawn("bunx", args, {
|
|
2055
|
-
cwd,
|
|
2056
|
-
stdio: ["inherit", "pipe", "pipe"],
|
|
2057
|
-
windowsHide: true,
|
|
2058
|
-
env: {
|
|
2059
|
-
...process.env,
|
|
2060
|
-
DEVFLARE_DEV: "true",
|
|
2061
|
-
DEVFLARE_BRIDGE_PORT: String(miniflarePort),
|
|
2062
|
-
FORCE_COLOR: "1"
|
|
2063
|
-
}
|
|
2064
|
-
});
|
|
2065
|
-
const readyUrl = await waitForViteReady(viteProcess, {
|
|
2066
|
-
onStdout(chunk) {
|
|
2067
|
-
process.stdout.write(chunk);
|
|
2068
|
-
},
|
|
2069
|
-
onStderr(chunk) {
|
|
2070
|
-
process.stderr.write(chunk);
|
|
2071
|
-
}
|
|
2072
|
-
});
|
|
2073
|
-
if (readyUrl) {
|
|
2074
|
-
logger?.success(`Vite dev server started on ${readyUrl}`);
|
|
2075
|
-
return;
|
|
2076
|
-
}
|
|
2077
|
-
logger?.warn("Vite process started, but the final local URL could not be confirmed yet");
|
|
2078
|
-
}
|
|
2079
2116
|
async function start() {
|
|
2080
2117
|
logger?.info("Starting unified dev server...");
|
|
2081
2118
|
config = await loadConfig({ cwd, configFile: configPath });
|
|
@@ -2125,7 +2162,7 @@ function createDevServer(options) {
|
|
|
2125
2162
|
logger?.info("");
|
|
2126
2163
|
}
|
|
2127
2164
|
}
|
|
2128
|
-
const browserBinding = config.bindings?.browser
|
|
2165
|
+
const browserBinding = getSingleBrowserBindingName(config.bindings?.browser);
|
|
2129
2166
|
if (browserBinding) {
|
|
2130
2167
|
logger?.info(`Starting Browser Rendering shim (binding: ${browserBinding})...`);
|
|
2131
2168
|
browserShim = createBrowserShim({
|
|
@@ -2139,7 +2176,7 @@ function createDevServer(options) {
|
|
|
2139
2176
|
const doPattern = config.files?.durableObjects;
|
|
2140
2177
|
let doResult = null;
|
|
2141
2178
|
if (typeof doPattern === "string" && doPattern) {
|
|
2142
|
-
const outDir =
|
|
2179
|
+
const outDir = resolve3(cwd, ".devflare/do-bundles");
|
|
2143
2180
|
doBundler = createDOBundler({
|
|
2144
2181
|
cwd,
|
|
2145
2182
|
pattern: doPattern,
|
|
@@ -2158,14 +2195,20 @@ function createDevServer(options) {
|
|
|
2158
2195
|
}
|
|
2159
2196
|
currentDoResult = doResult;
|
|
2160
2197
|
await startMiniflare(doResult);
|
|
2161
|
-
await
|
|
2198
|
+
await startWorkerSourceWatcher2();
|
|
2162
2199
|
if (enableVite) {
|
|
2163
|
-
await
|
|
2200
|
+
viteProcess = await startViteProcess({
|
|
2201
|
+
cwd,
|
|
2202
|
+
vitePort,
|
|
2203
|
+
miniflarePort,
|
|
2204
|
+
generatedViteConfigPath,
|
|
2205
|
+
logger
|
|
2206
|
+
});
|
|
2164
2207
|
} else {
|
|
2165
2208
|
logger?.info("Vite startup skipped (no effective Vite config found for this package)");
|
|
2166
2209
|
}
|
|
2167
2210
|
await new Promise((r) => setTimeout(r, 1000));
|
|
2168
|
-
await runD1Migrations();
|
|
2211
|
+
await runD1Migrations({ cwd, config, miniflarePort, logger });
|
|
2169
2212
|
}
|
|
2170
2213
|
async function stop() {
|
|
2171
2214
|
if (doBundler) {
|
|
@@ -2207,11 +2250,11 @@ async function createLogWriter(cwd, options) {
|
|
|
2207
2250
|
const fs = await import("node:fs");
|
|
2208
2251
|
let logPath;
|
|
2209
2252
|
if (options.logTemp) {
|
|
2210
|
-
logPath =
|
|
2253
|
+
logPath = resolve4(cwd, ".log");
|
|
2211
2254
|
} else {
|
|
2212
2255
|
const now = new Date;
|
|
2213
2256
|
const timestamp = now.toISOString().replace(/[:.]/g, "-").replace("T", "_").slice(0, 19);
|
|
2214
|
-
logPath =
|
|
2257
|
+
logPath = resolve4(cwd, `.log-${timestamp}`);
|
|
2215
2258
|
}
|
|
2216
2259
|
const fileStream = fs.createWriteStream(logPath, { flags: "w" });
|
|
2217
2260
|
const ansiRegex = /\x1b\[[0-9;]*m/g;
|
|
@@ -2242,6 +2285,7 @@ async function runDevCommand(parsed, logger, options) {
|
|
|
2242
2285
|
const persistEnabled = parsed.options.persist === true;
|
|
2243
2286
|
const debugEnabled = parsed.options.debug === true || process.env.DEVFLARE_DEBUG === "true";
|
|
2244
2287
|
const verbose = parsed.options.verbose === true || debugEnabled;
|
|
2288
|
+
const theme = createCliTheme(parsed.options);
|
|
2245
2289
|
const config = await loadConfig({ cwd, configFile: configPath });
|
|
2246
2290
|
const viteProject = resolveEffectiveViteProject(await detectViteProject(cwd), config);
|
|
2247
2291
|
const logWriter = await createLogWriter(cwd, {
|
|
@@ -2250,7 +2294,7 @@ async function runDevCommand(parsed, logger, options) {
|
|
|
2250
2294
|
});
|
|
2251
2295
|
if (logWriter) {
|
|
2252
2296
|
const logFile = relative(cwd, logWriter.path) || ".log";
|
|
2253
|
-
logger
|
|
2297
|
+
logLine(logger, `${dim("logging", theme)} ${logFile}`);
|
|
2254
2298
|
}
|
|
2255
2299
|
const devLogger = createConsola({
|
|
2256
2300
|
level: verbose ? 4 : 3
|
|
@@ -2271,24 +2315,24 @@ async function runDevCommand(parsed, logger, options) {
|
|
|
2271
2315
|
Object.assign(devLogger.debug, wrapLog(devLogger.debug.bind(devLogger), "[DEBUG]"));
|
|
2272
2316
|
}
|
|
2273
2317
|
try {
|
|
2274
|
-
logger
|
|
2318
|
+
logLine(logger);
|
|
2275
2319
|
if (viteProject.shouldStartVite) {
|
|
2276
|
-
logger
|
|
2277
|
-
logger
|
|
2278
|
-
logger
|
|
2279
|
-
logger
|
|
2280
|
-
logger
|
|
2320
|
+
logLine(logger, `${cyanBold("dev", theme)} ${dim("Unified Dev Server", theme)}`);
|
|
2321
|
+
logLine(logger, " ├─ Vite: Full HMR for frontend");
|
|
2322
|
+
logLine(logger, " ├─ Miniflare: All Cloudflare bindings");
|
|
2323
|
+
logLine(logger, " ├─ Rolldown: Worker + DO bundling with watch");
|
|
2324
|
+
logLine(logger, " └─ Bridge: WebSocket RPC connection");
|
|
2281
2325
|
} else {
|
|
2282
|
-
logger
|
|
2283
|
-
logger
|
|
2284
|
-
logger
|
|
2285
|
-
logger
|
|
2326
|
+
logLine(logger, `${cyanBold("dev", theme)} ${dim("Worker Dev Server", theme)}`);
|
|
2327
|
+
logLine(logger, " ├─ Miniflare: All Cloudflare bindings");
|
|
2328
|
+
logLine(logger, " ├─ Rolldown: Worker + DO bundling with watch");
|
|
2329
|
+
logLine(logger, " └─ Vite: Disabled (no effective Vite config found)");
|
|
2286
2330
|
if (viteProject.wantsViteIntegration) {
|
|
2287
2331
|
logger.warn("Vite-related settings were detected, but no effective Vite config was available");
|
|
2288
2332
|
logger.warn("Skipping Vite startup and running in worker-only mode");
|
|
2289
2333
|
}
|
|
2290
2334
|
}
|
|
2291
|
-
logger
|
|
2335
|
+
logLine(logger);
|
|
2292
2336
|
const devServer = createDevServer({
|
|
2293
2337
|
cwd,
|
|
2294
2338
|
configPath,
|
|
@@ -2318,8 +2362,8 @@ async function runDevCommand(parsed, logger, options) {
|
|
|
2318
2362
|
const message = reason instanceof Error ? reason.stack ?? reason.message : String(reason);
|
|
2319
2363
|
logger.error(message);
|
|
2320
2364
|
}
|
|
2321
|
-
logger
|
|
2322
|
-
logger
|
|
2365
|
+
logLine(logger);
|
|
2366
|
+
logLine(logger, `${yellow("dev", theme)} ${dim("Shutting down…", theme)}`);
|
|
2323
2367
|
try {
|
|
2324
2368
|
await devServer.stop();
|
|
2325
2369
|
} finally {
|