devflare 1.0.0-next.15 → 1.0.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LLM.md +9360 -1819
- package/README.md +313 -39
- package/bin/devflare.js +17 -7
- package/dist/account-0w8wdzjv.js +475 -0
- package/dist/account-eygq6qx7.js +475 -0
- package/dist/account-fw8nafav.js +475 -0
- package/dist/account-pzq69nys.js +475 -0
- package/dist/account-s66jb15j.js +475 -0
- package/dist/api-d6ekexs5.js +25 -0
- package/dist/bridge/index.d.ts +1 -1
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/protocol.d.ts +1 -1
- package/dist/bridge/protocol.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +0 -4
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/serialization.d.ts.map +1 -1
- package/dist/bridge/server.d.ts +1 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/browser-shim/handler.d.ts +1 -1
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser.d.ts +1648 -38
- package/dist/browser.d.ts.map +1 -1
- package/dist/build-1kmkwqgh.js +53 -0
- package/dist/build-506kjhcm.js +53 -0
- package/dist/build-66866ahs.js +53 -0
- package/dist/build-g1adm3ww.js +53 -0
- package/dist/build-p3r3117t.js +53 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +24 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +0 -1
- package/dist/bundler/worker-bundler.d.ts.map +1 -1
- package/dist/cli/command-utils.d.ts +18 -0
- package/dist/cli/command-utils.d.ts.map +1 -0
- package/dist/cli/commands/account.d.ts +1 -1
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +27 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/family.d.ts +10 -0
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/render.d.ts +8 -0
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/theme.d.ts +10 -0
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/types.d.ts +70 -0
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
- package/dist/cli/commands/previews.d.ts +4 -0
- package/dist/cli/commands/previews.d.ts.map +1 -0
- package/dist/cli/commands/productions.d.ts +4 -0
- package/dist/cli/commands/productions.d.ts.map +1 -0
- package/dist/cli/commands/token.d.ts +4 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +44 -0
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/models.d.ts +27 -0
- package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +4 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/config-path.d.ts +2 -1
- package/dist/cli/config-path.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/preview-bindings.d.ts +42 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +11 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/cli/ui.d.ts +37 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/workspace-build-guard.d.ts +14 -0
- package/dist/cli/workspace-build-guard.d.ts.map +1 -0
- package/dist/cloudflare/account-core.d.ts +6 -0
- package/dist/cloudflare/account-core.d.ts.map +1 -0
- package/dist/cloudflare/account-resources.d.ts +40 -0
- package/dist/cloudflare/account-resources.d.ts.map +1 -0
- package/dist/cloudflare/account-status.d.ts +11 -0
- package/dist/cloudflare/account-status.d.ts.map +1 -0
- package/dist/cloudflare/account-workers.d.ts +14 -0
- package/dist/cloudflare/account-workers.d.ts.map +1 -0
- package/dist/cloudflare/account.d.ts +7 -64
- package/dist/cloudflare/account.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts +4 -0
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +57 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/kv-namespace.d.ts +3 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-records.d.ts +61 -0
- package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-store.d.ts +14 -0
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-types.d.ts +103 -0
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry.d.ts +42 -0
- package/dist/cloudflare/preview-registry.d.ts.map +1 -0
- package/dist/cloudflare/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/tokens.d.ts +18 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +122 -5
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/compiler.d.ts +4 -0
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/framework-providers.d.ts +9 -0
- package/dist/config/framework-providers.d.ts.map +1 -0
- package/dist/config/index.d.ts +4 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/preview-resources.d.ts +77 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +31 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +0 -22
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve.d.ts +1 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resource-resolution.d.ts +21 -5
- package/dist/config/resource-resolution.d.ts.map +1 -1
- package/dist/config/schema-bindings.d.ts +693 -0
- package/dist/config/schema-bindings.d.ts.map +1 -0
- package/dist/config/schema-build.d.ts +67 -0
- package/dist/config/schema-build.d.ts.map +1 -0
- package/dist/config/schema-env.d.ts +1341 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +64 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +230 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema.d.ts +542 -3736
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config-entry.d.ts +5 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/{config-v9tr4rts.js → config-fjwke42y.js} +6 -4
- package/dist/config-hwdqjse7.js +59 -0
- package/dist/config-pxvewrhv.js +59 -0
- package/dist/config-q0g5qdga.js +59 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/deploy-7nmzc9r8.js +609 -0
- package/dist/deploy-csfhdr64.js +691 -0
- package/dist/deploy-ex4g5avz.js +621 -0
- package/dist/deploy-jnb0bhka.js +609 -0
- package/dist/deploy-tp0g6qdp.js +609 -0
- package/dist/deploy-ykpcjkc2.js +690 -0
- package/dist/{dev-ymtphbkg.js → dev-2pd33m28.js} +386 -348
- package/dist/dev-7ef5e2j1.js +2409 -0
- package/dist/dev-8nssqatr.js +2409 -0
- package/dist/dev-grznx8fn.js +2409 -0
- package/dist/dev-server/d1-migrations.d.ts +14 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +8 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -1
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +14 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +1 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts +11 -0
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
- package/dist/dev-server/worker-surface-paths.d.ts +6 -0
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
- package/dist/{doctor-xv4gm1h4.js → doctor-04ammrrh.js} +67 -32
- package/dist/doctor-fmjj65mc.js +245 -0
- package/dist/doctor-fzkznce1.js +245 -0
- package/dist/doctor-sa5xv1bz.js +245 -0
- package/dist/index-091sh1ma.js +1229 -0
- package/dist/index-0apbm26n.js +788 -0
- package/dist/index-0eqksag4.js +418 -0
- package/dist/{index-k8vh558d.js → index-0kfzdywd.js} +15 -2
- package/dist/index-0w826dsr.js +379 -0
- package/dist/{index-5s1bz1e0.js → index-11m5a8wd.js} +100 -22
- package/dist/{index-0rsa2c1t.js → index-1sp39f2f.js} +110 -57
- package/dist/index-2jnrqbny.js +1301 -0
- package/dist/index-2pb7b9mw.js +378 -0
- package/dist/{index-3a4mmn57.js → index-2x53aqjm.js} +1065 -890
- package/dist/index-3ke5d2vn.js +1229 -0
- package/dist/index-43dq8yx8.js +788 -0
- package/dist/index-4rrttqj5.js +378 -0
- package/dist/index-4v9bc2pc.js +1367 -0
- package/dist/index-61jsjnsv.js +280 -0
- package/dist/index-6jef5emv.js +176 -0
- package/dist/index-6psz1h4c.js +788 -0
- package/dist/index-72mve6vh.js +168 -0
- package/dist/{index-zvgc3e0c.js → index-74198nxd.js} +159 -63
- package/dist/{index-7bq4xq84.js → index-7g8zyws4.js} +7 -12
- package/dist/index-7kcxjhta.js +456 -0
- package/dist/index-7v583xan.js +418 -0
- package/dist/index-7x0ybbtx.js +133 -0
- package/dist/index-816krz9p.js +52 -0
- package/dist/index-82f1z98k.js +41 -0
- package/dist/index-8t5nb4qx.js +133 -0
- package/dist/index-9az6s7ad.js +52 -0
- package/dist/{index-59df49vn.js → index-9ba1etyz.js} +29 -51
- package/dist/{index-001mw014.js → index-9fbtk7gv.js} +134 -248
- package/dist/index-9n6djthj.js +490 -0
- package/dist/index-aabgympv.js +39 -0
- package/dist/index-b8m6883k.js +74 -0
- package/dist/{index-5yxg30va.js → index-cgbvmse6.js} +15 -6
- package/dist/index-d8etnfef.js +1229 -0
- package/dist/index-e9yw4d6y.js +133 -0
- package/dist/index-epw1jxz5.js +1204 -0
- package/dist/index-f85s8gj3.js +2649 -0
- package/dist/index-fe2ngvh7.js +1229 -0
- package/dist/index-fvsadj32.js +192 -0
- package/dist/index-gs4y9gdf.js +456 -0
- package/dist/{index-fef08w43.js → index-h18pxvzs.js} +7 -6
- package/dist/index-hfj1a2c4.js +2649 -0
- package/dist/{index-8gtqgb3q.js → index-hjy8ctpc.js} +14 -92
- package/dist/index-htzf0py1.js +1204 -0
- package/dist/index-j185x270.js +897 -0
- package/dist/index-jb75kwa4.js +519 -0
- package/dist/index-jwd8pcb2.js +897 -0
- package/dist/index-k29yjhv0.js +52 -0
- package/dist/index-k6vq6kkt.js +456 -0
- package/dist/{index-vky23txa.js → index-m3fmw6mx.js} +2 -2
- package/dist/index-maxpsfk8.js +402 -0
- package/dist/index-mbdmrner.js +402 -0
- package/dist/index-mea5bc45.js +418 -0
- package/dist/index-mqekt778.js +185 -0
- package/dist/index-na3mnm1k.js +74 -0
- package/dist/index-p03n4qet.js +1367 -0
- package/dist/index-p296ban8.js +191 -0
- package/dist/index-pnbs1b8k.js +280 -0
- package/dist/index-q4kaz181.js +1207 -0
- package/dist/index-ry131z23.js +378 -0
- package/dist/index-sgb7c8nm.js +402 -0
- package/dist/index-sqrksgb2.js +133 -0
- package/dist/index-stgn34cr.js +148 -0
- package/dist/{index-v8vvsn9x.js → index-t08te69w.js} +1 -18
- package/dist/index-thna1tkd.js +280 -0
- package/dist/index-v5nmqthy.js +74 -0
- package/dist/{index-n932ytmq.js → index-vt4yxkmf.js} +2 -2
- package/dist/index-wyq6c6yj.js +402 -0
- package/dist/index-wztc9stx.js +418 -0
- package/dist/index-x9cwdxw5.js +456 -0
- package/dist/index-xk9djfjp.js +519 -0
- package/dist/index-yc0gcchc.js +418 -0
- package/dist/index-yqbxjysa.js +897 -0
- package/dist/index-yzddwp02.js +788 -0
- package/dist/index-zfhq6s96.js +74 -0
- package/dist/index-zt22fe2j.js +54 -0
- package/dist/index-zyt5byt6.js +2649 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/{init-na2atvz2.js → init-r4hnxan3.js} +24 -17
- package/dist/login-2hnz4m4n.js +77 -0
- package/dist/login-5bsxxpvc.js +77 -0
- package/dist/login-6tzvczw2.js +77 -0
- package/dist/login-bhaw72zc.js +77 -0
- package/dist/login-x8tgckqm.js +77 -0
- package/dist/previews-3rn8mz2c.js +1168 -0
- package/dist/previews-d487qde5.js +1200 -0
- package/dist/previews-gm3z0syj.js +1168 -0
- package/dist/previews-j9ymq4ys.js +1169 -0
- package/dist/previews-q031mx34.js +1168 -0
- package/dist/productions-120xg0aq.js +505 -0
- package/dist/productions-5ev5qweg.js +505 -0
- package/dist/productions-me3tdvr9.js +505 -0
- package/dist/productions-p5rbgp2f.js +505 -0
- package/dist/productions-x9p0pym1.js +505 -0
- package/dist/runtime/context-events.d.ts +13 -0
- package/dist/runtime/context-events.d.ts.map +1 -0
- package/dist/runtime/context-types.d.ts +82 -0
- package/dist/runtime/context-types.d.ts.map +1 -0
- package/dist/runtime/context.d.ts +6 -267
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +3 -3
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/middleware.d.ts +8 -38
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/src/browser.js +9 -17
- package/dist/src/cli/index.js +3 -1
- package/dist/src/cloudflare/index.js +49 -3
- package/dist/src/config-entry.js +14 -0
- package/dist/src/index.js +24 -20
- package/dist/src/runtime/index.js +3 -9
- package/dist/src/sveltekit/index.js +10 -8
- package/dist/src/test/index.js +16 -19
- package/dist/src/vite/index.js +7 -5
- package/dist/sveltekit/platform.d.ts +1 -1
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/cf.d.ts +10 -10
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +1 -6
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/queue.d.ts.map +1 -1
- package/dist/test/remote-ai.d.ts.map +1 -1
- package/dist/test/remote-cloudflare.d.ts +13 -0
- package/dist/test/remote-cloudflare.d.ts.map +1 -0
- package/dist/test/remote-vectorize.d.ts.map +1 -1
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +0 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-durable-objects.d.ts +6 -0
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
- package/dist/test/simple-context-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
- package/dist/test/simple-context-paths.d.ts +40 -0
- package/dist/test/simple-context-paths.d.ts.map +1 -0
- package/dist/test/simple-context.d.ts +1 -23
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/token-kedhcret.js +419 -0
- package/dist/token-m8jmnjwk.js +419 -0
- package/dist/{types-158m16vd.js → types-0sqwkp7x.js} +244 -140
- package/dist/types-1gwr2ex6.js +572 -0
- package/dist/types-6e5yx6km.js +572 -0
- package/dist/types-p0gckpn6.js +572 -0
- package/dist/utils/send-email.d.ts.map +1 -1
- package/dist/vite/config-file.d.ts.map +1 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-0srh2jfr.js +513 -0
- package/dist/worker-4xrfd10a.js +513 -0
- package/dist/worker-entry/composed-worker.d.ts +0 -7
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/dist/worker-entry/surface-paths.d.ts +15 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-qtam8grz.js +513 -0
- package/dist/worker-qzm0b7br.js +513 -0
- package/dist/worker-y9ha6g44.js +513 -0
- package/package.json +17 -10
- package/R2.md +0 -200
- package/dist/account-spa7gzsn.js +0 -421
- package/dist/build-zv25ke4s.js +0 -102
- package/dist/deploy-6xmqvv06.js +0 -118
- package/dist/index-2q3pmzrx.js +0 -90
- package/dist/index-6nb7w45m.js +0 -79
- package/dist/index-tksw7gpy.js +0 -503
- package/dist/index-v43z02tr.js +0 -205
- package/dist/index-xdq9ery1.js +0 -664
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
|
@@ -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,25 +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 {
|
|
27
41
|
getLocalD1DatabaseIdentifier,
|
|
42
|
+
getLocalKVNamespaceIdentifier,
|
|
43
|
+
getSingleBrowserBindingName,
|
|
28
44
|
loadConfig,
|
|
29
45
|
resolveConfigPath
|
|
30
|
-
} from "./index-
|
|
31
|
-
import"./index-
|
|
32
|
-
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";
|
|
33
51
|
import {
|
|
34
52
|
__require
|
|
35
53
|
} from "./index-37x76zdn.js";
|
|
36
54
|
|
|
37
55
|
// src/cli/commands/dev.ts
|
|
38
56
|
import { createConsola } from "consola";
|
|
39
|
-
import { relative, resolve as
|
|
57
|
+
import { relative, resolve as resolve4 } from "pathe";
|
|
40
58
|
|
|
41
59
|
// src/dev-server/server.ts
|
|
42
|
-
import {
|
|
60
|
+
import { resolve as resolve3 } from "pathe";
|
|
43
61
|
|
|
44
62
|
// src/browser-shim/server.ts
|
|
45
63
|
import { homedir } from "node:os";
|
|
@@ -812,170 +830,89 @@ async function checkRemoteBindingRequirements(config) {
|
|
|
812
830
|
};
|
|
813
831
|
}
|
|
814
832
|
|
|
815
|
-
// src/dev-server/
|
|
816
|
-
|
|
817
|
-
var
|
|
818
|
-
function
|
|
819
|
-
|
|
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);
|
|
820
841
|
}
|
|
821
|
-
function
|
|
822
|
-
|
|
823
|
-
const match = COMPATIBILITY_DATE_FALLBACK_REGEX.exec(normalizedMessage);
|
|
824
|
-
if (!match) {
|
|
825
|
-
return null;
|
|
826
|
-
}
|
|
827
|
-
const [, _supportedDate, requestedDate, fallbackDate] = match;
|
|
828
|
-
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);
|
|
829
844
|
}
|
|
830
|
-
function
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
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]);
|
|
839
854
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
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;
|
|
843
873
|
}
|
|
844
|
-
originalInfo(notice);
|
|
845
|
-
};
|
|
846
|
-
return log;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
// src/dev-server/runtime-stdio.ts
|
|
850
|
-
import { createInterface } from "node:readline";
|
|
851
|
-
function writeStdout(logger, message) {
|
|
852
|
-
if (typeof logger?.log === "function") {
|
|
853
|
-
logger.log(message);
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
if (typeof logger?.info === "function") {
|
|
857
|
-
logger.info(message);
|
|
858
|
-
return;
|
|
859
874
|
}
|
|
860
|
-
|
|
875
|
+
logger?.warn(`Failed to apply migrations to ${bindingName}: ${getErrorMessage(lastError)}`);
|
|
861
876
|
}
|
|
862
|
-
function
|
|
863
|
-
|
|
864
|
-
|
|
877
|
+
async function runD1Migrations(options) {
|
|
878
|
+
const { cwd, config, miniflarePort, logger } = options;
|
|
879
|
+
if (!config?.bindings?.d1) {
|
|
865
880
|
return;
|
|
866
881
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
createInterface({ input: stdout }).on("line", (data) => {
|
|
872
|
-
writeStdout(logger, data);
|
|
873
|
-
});
|
|
874
|
-
createInterface({ input: stderr }).on("line", (data) => {
|
|
875
|
-
writeStderr(logger, data);
|
|
876
|
-
});
|
|
877
|
-
};
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
// src/dev-server/server.ts
|
|
881
|
-
var DEFAULT_FETCH_ENTRY_FILES = [
|
|
882
|
-
"src/fetch.ts",
|
|
883
|
-
"src/fetch.js",
|
|
884
|
-
"src/fetch.mts",
|
|
885
|
-
"src/fetch.mjs"
|
|
886
|
-
];
|
|
887
|
-
var DEFAULT_QUEUE_ENTRY_FILES = [
|
|
888
|
-
"src/queue.ts",
|
|
889
|
-
"src/queue.js",
|
|
890
|
-
"src/queue.mts",
|
|
891
|
-
"src/queue.mjs"
|
|
892
|
-
];
|
|
893
|
-
var DEFAULT_SCHEDULED_ENTRY_FILES = [
|
|
894
|
-
"src/scheduled.ts",
|
|
895
|
-
"src/scheduled.js",
|
|
896
|
-
"src/scheduled.mts",
|
|
897
|
-
"src/scheduled.mjs"
|
|
898
|
-
];
|
|
899
|
-
var DEFAULT_EMAIL_ENTRY_FILES = [
|
|
900
|
-
"src/email.ts",
|
|
901
|
-
"src/email.js",
|
|
902
|
-
"src/email.mts",
|
|
903
|
-
"src/email.mjs"
|
|
904
|
-
];
|
|
905
|
-
var DEFAULT_TRANSPORT_ENTRY_FILES = [
|
|
906
|
-
"src/transport.ts",
|
|
907
|
-
"src/transport.js",
|
|
908
|
-
"src/transport.mts",
|
|
909
|
-
"src/transport.mjs"
|
|
910
|
-
];
|
|
911
|
-
var INTERNAL_APP_SERVICE_BINDING = "__DEVFLARE_APP";
|
|
912
|
-
function formatErrorMessage(error) {
|
|
913
|
-
return error instanceof Error ? error.message : String(error);
|
|
914
|
-
}
|
|
915
|
-
async function resolveWorkerHandlerPath(cwd, configuredPath, defaultEntries) {
|
|
916
|
-
if (configuredPath === false) {
|
|
917
|
-
return null;
|
|
918
|
-
}
|
|
919
|
-
const fs = await import("node:fs/promises");
|
|
920
|
-
const candidates = new Set;
|
|
921
|
-
if (typeof configuredPath === "string" && configuredPath) {
|
|
922
|
-
candidates.add(configuredPath);
|
|
923
|
-
}
|
|
924
|
-
for (const defaultEntry of defaultEntries) {
|
|
925
|
-
candidates.add(defaultEntry);
|
|
926
|
-
}
|
|
927
|
-
for (const candidate of candidates) {
|
|
928
|
-
const absolutePath = resolve(cwd, candidate);
|
|
929
|
-
try {
|
|
930
|
-
await fs.access(absolutePath);
|
|
931
|
-
return absolutePath;
|
|
932
|
-
} catch {
|
|
933
|
-
continue;
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
return null;
|
|
937
|
-
}
|
|
938
|
-
async function resolveMainWorkerSurfacePaths(cwd, config) {
|
|
939
|
-
return {
|
|
940
|
-
fetch: await resolveWorkerHandlerPath(cwd, config.files?.fetch, DEFAULT_FETCH_ENTRY_FILES),
|
|
941
|
-
queue: await resolveWorkerHandlerPath(cwd, config.files?.queue, DEFAULT_QUEUE_ENTRY_FILES),
|
|
942
|
-
scheduled: await resolveWorkerHandlerPath(cwd, config.files?.scheduled, DEFAULT_SCHEDULED_ENTRY_FILES),
|
|
943
|
-
email: await resolveWorkerHandlerPath(cwd, config.files?.email, DEFAULT_EMAIL_ENTRY_FILES)
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
function hasWorkerSurfacePaths(surfacePaths) {
|
|
947
|
-
return Object.values(surfacePaths).some((surfacePath) => typeof surfacePath === "string" && surfacePath.length > 0);
|
|
948
|
-
}
|
|
949
|
-
function addWorkerWatchRoots(roots, cwd, configuredPath, defaultEntries) {
|
|
950
|
-
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");
|
|
951
886
|
return;
|
|
952
887
|
}
|
|
953
|
-
|
|
954
|
-
|
|
888
|
+
const files = readdirSync(migrationsDir).filter((file) => file.endsWith(".sql")).sort();
|
|
889
|
+
if (files.length === 0) {
|
|
890
|
+
logger?.debug("No SQL migration files found");
|
|
955
891
|
return;
|
|
956
892
|
}
|
|
957
|
-
|
|
958
|
-
|
|
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)`);
|
|
959
900
|
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
for (const surfacePath of Object.values(mainWorkerSurfacePaths)) {
|
|
964
|
-
if (surfacePath) {
|
|
965
|
-
roots.add(dirname(surfacePath));
|
|
966
|
-
}
|
|
901
|
+
if (allStatements.length === 0) {
|
|
902
|
+
logger?.debug("No executable D1 migration statements found");
|
|
903
|
+
return;
|
|
967
904
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
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
|
+
});
|
|
976
912
|
}
|
|
977
|
-
return [...roots];
|
|
978
913
|
}
|
|
914
|
+
|
|
915
|
+
// src/dev-server/gateway-script.ts
|
|
979
916
|
function getGatewayScript(wsRoutes = [], debug = false, appServiceBindingName = null) {
|
|
980
917
|
const wsRoutesJson = JSON.stringify(wsRoutes);
|
|
981
918
|
const appServiceBindingJson = JSON.stringify(appServiceBindingName);
|
|
@@ -1530,6 +1467,252 @@ function base64ToArrayBuffer(base64) {
|
|
|
1530
1467
|
}
|
|
1531
1468
|
`;
|
|
1532
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
|
+
}
|
|
1533
1716
|
function createDevServer(options) {
|
|
1534
1717
|
const {
|
|
1535
1718
|
cwd,
|
|
@@ -1571,11 +1754,10 @@ function createDevServer(options) {
|
|
|
1571
1754
|
bundledMainWorkerScriptPath = await bundleWorkerEntry({
|
|
1572
1755
|
cwd,
|
|
1573
1756
|
inputFile: mainWorkerScriptPath,
|
|
1574
|
-
outFile:
|
|
1757
|
+
outFile: resolve3(cwd, ".devflare", "worker-entrypoints", "main.js"),
|
|
1575
1758
|
rolldownOptions: config.rolldown?.options,
|
|
1576
1759
|
sourcemap: config.rolldown?.sourcemap,
|
|
1577
1760
|
minify: config.rolldown?.minify,
|
|
1578
|
-
target: config.rolldown?.target,
|
|
1579
1761
|
logger
|
|
1580
1762
|
});
|
|
1581
1763
|
logger?.debug(`Bundled main worker → ${bundledMainWorkerScriptPath}`);
|
|
@@ -1585,7 +1767,7 @@ function createDevServer(options) {
|
|
|
1585
1767
|
throw new Error("Config not loaded");
|
|
1586
1768
|
const loadedConfig = config;
|
|
1587
1769
|
const bindings = loadedConfig.bindings ?? {};
|
|
1588
|
-
const persistPath =
|
|
1770
|
+
const persistPath = resolve3(cwd, ".devflare/data");
|
|
1589
1771
|
const appWorkerName = loadedConfig.name;
|
|
1590
1772
|
const shouldRunMainWorker = !enableVite && (hasWorkerSurfacePaths(mainWorkerSurfacePaths) || Boolean(mainWorkerRoutes?.routes.length));
|
|
1591
1773
|
const queueProducers = (() => {
|
|
@@ -1661,7 +1843,11 @@ function createDevServer(options) {
|
|
|
1661
1843
|
modules: true,
|
|
1662
1844
|
compatibilityDate: loadedConfig.compatibilityDate,
|
|
1663
1845
|
compatibilityFlags: compatFlags,
|
|
1664
|
-
...bindings.kv && {
|
|
1846
|
+
...bindings.kv && {
|
|
1847
|
+
kvNamespaces: Object.fromEntries(Object.entries(bindings.kv).map(([bindingName, bindingConfig]) => {
|
|
1848
|
+
return [bindingName, getLocalKVNamespaceIdentifier(bindingConfig)];
|
|
1849
|
+
}))
|
|
1850
|
+
},
|
|
1665
1851
|
...bindings.r2 && { r2Buckets: bindings.r2 },
|
|
1666
1852
|
...bindings.d1 && {
|
|
1667
1853
|
d1Databases: Object.fromEntries(Object.entries(bindings.d1).map(([bindingName, bindingConfig]) => {
|
|
@@ -1703,7 +1889,7 @@ function createDevServer(options) {
|
|
|
1703
1889
|
});
|
|
1704
1890
|
gatewayWorker.routes = ["*"];
|
|
1705
1891
|
const hasDurableObjectBundles = !!doResult && doResult.bundles.size > 0;
|
|
1706
|
-
const browserBindingName = bindings.browser
|
|
1892
|
+
const browserBindingName = getSingleBrowserBindingName(bindings.browser);
|
|
1707
1893
|
const needsBrowserWorker = Boolean(browserBindingName && (hasDurableObjectBundles || shouldRunMainWorker));
|
|
1708
1894
|
if (!shouldRunMainWorker && !hasDurableObjectBundles && !needsBrowserWorker) {
|
|
1709
1895
|
return {
|
|
@@ -1848,7 +2034,7 @@ function createDevServer(options) {
|
|
|
1848
2034
|
}
|
|
1849
2035
|
async function resolveWorkerConfigWatchPath() {
|
|
1850
2036
|
if (configPath) {
|
|
1851
|
-
const explicitPath =
|
|
2037
|
+
const explicitPath = resolve3(cwd, configPath);
|
|
1852
2038
|
const fs = await import("node:fs/promises");
|
|
1853
2039
|
try {
|
|
1854
2040
|
await fs.access(explicitPath);
|
|
@@ -1866,7 +2052,7 @@ function createDevServer(options) {
|
|
|
1866
2052
|
const composedMainEntry = await prepareComposedWorkerEntrypoint(cwd, config, undefined, {
|
|
1867
2053
|
devInternalEmail: true
|
|
1868
2054
|
});
|
|
1869
|
-
mainWorkerScriptPath = composedMainEntry ?
|
|
2055
|
+
mainWorkerScriptPath = composedMainEntry ? resolve3(cwd, composedMainEntry) : null;
|
|
1870
2056
|
if (mainWorkerScriptPath) {
|
|
1871
2057
|
await bundleMainWorker();
|
|
1872
2058
|
} else {
|
|
@@ -1907,7 +2093,7 @@ function createDevServer(options) {
|
|
|
1907
2093
|
await refreshWorkerOnlySurfaceState();
|
|
1908
2094
|
await reloadMiniflare(currentDoResult);
|
|
1909
2095
|
}
|
|
1910
|
-
async function
|
|
2096
|
+
async function startWorkerSourceWatcher2() {
|
|
1911
2097
|
if (enableVite || !config) {
|
|
1912
2098
|
return;
|
|
1913
2099
|
}
|
|
@@ -1915,173 +2101,18 @@ function createDevServer(options) {
|
|
|
1915
2101
|
if (watchTargets.length === 0) {
|
|
1916
2102
|
return;
|
|
1917
2103
|
}
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
};
|
|
1926
|
-
let reloadTimeout = null;
|
|
1927
|
-
let reloadInProgress = false;
|
|
1928
|
-
let pendingReloadPath = null;
|
|
1929
|
-
const triggerReload = async (filePath) => {
|
|
1930
|
-
if (reloadInProgress) {
|
|
1931
|
-
pendingReloadPath = filePath;
|
|
1932
|
-
return;
|
|
1933
|
-
}
|
|
1934
|
-
reloadInProgress = true;
|
|
1935
|
-
try {
|
|
1936
|
-
const normalizedConfigPath = resolvedWorkerConfigPath ? normalizePath(resolvedWorkerConfigPath) : null;
|
|
1937
|
-
if (normalizedConfigPath && normalizePath(filePath) === normalizedConfigPath) {
|
|
1938
|
-
logger?.info(`Devflare config changed: ${filePath}`);
|
|
1939
|
-
await reloadWorkerOnlyConfig();
|
|
1940
|
-
return;
|
|
1941
|
-
}
|
|
1942
|
-
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 () => {
|
|
1943
2111
|
await refreshWorkerOnlySurfaceState();
|
|
1944
2112
|
await reloadMiniflare(currentDoResult);
|
|
1945
|
-
} catch (error) {
|
|
1946
|
-
logger?.error("Worker source reload failed:", error);
|
|
1947
|
-
} finally {
|
|
1948
|
-
reloadInProgress = false;
|
|
1949
|
-
if (pendingReloadPath) {
|
|
1950
|
-
const nextPath = pendingReloadPath;
|
|
1951
|
-
pendingReloadPath = null;
|
|
1952
|
-
await triggerReload(nextPath);
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
};
|
|
1956
|
-
const scheduleReload = (filePath) => {
|
|
1957
|
-
if (reloadTimeout) {
|
|
1958
|
-
clearTimeout(reloadTimeout);
|
|
1959
|
-
}
|
|
1960
|
-
reloadTimeout = setTimeout(() => {
|
|
1961
|
-
triggerReload(filePath);
|
|
1962
|
-
}, 150);
|
|
1963
|
-
};
|
|
1964
|
-
workerWatchTargets = watchTargets;
|
|
1965
|
-
workerSourceWatcher = chokidar.watch(watchTargets, {
|
|
1966
|
-
ignoreInitial: true,
|
|
1967
|
-
usePolling: isWindows,
|
|
1968
|
-
interval: isWindows ? 300 : undefined,
|
|
1969
|
-
awaitWriteFinish: {
|
|
1970
|
-
stabilityThreshold: 100,
|
|
1971
|
-
pollInterval: 50
|
|
1972
|
-
},
|
|
1973
|
-
ignored: (filePath) => isIgnoredPath(filePath)
|
|
1974
|
-
});
|
|
1975
|
-
const onFileEvent = (filePath) => {
|
|
1976
|
-
if (isIgnoredPath(filePath)) {
|
|
1977
|
-
return;
|
|
1978
2113
|
}
|
|
1979
|
-
scheduleReload(filePath);
|
|
1980
|
-
};
|
|
1981
|
-
workerSourceWatcher.on("change", onFileEvent);
|
|
1982
|
-
workerSourceWatcher.on("add", onFileEvent);
|
|
1983
|
-
workerSourceWatcher.on("unlink", onFileEvent);
|
|
1984
|
-
workerSourceWatcher.on("error", (error) => {
|
|
1985
|
-
logger?.error("Worker source watcher error:", error);
|
|
1986
|
-
});
|
|
1987
|
-
await new Promise((resolvePromise, rejectPromise) => {
|
|
1988
|
-
const handleReady = () => {
|
|
1989
|
-
workerSourceWatcher?.off("error", handleInitialError);
|
|
1990
|
-
logger?.info(`Worker source watcher ready (${watchTargets.length} target(s))`);
|
|
1991
|
-
resolvePromise();
|
|
1992
|
-
};
|
|
1993
|
-
const handleInitialError = (error) => {
|
|
1994
|
-
workerSourceWatcher?.off("ready", handleReady);
|
|
1995
|
-
rejectPromise(error instanceof Error ? error : new Error(String(error)));
|
|
1996
|
-
};
|
|
1997
|
-
workerSourceWatcher?.once("ready", handleReady);
|
|
1998
|
-
workerSourceWatcher?.once("error", handleInitialError);
|
|
1999
2114
|
});
|
|
2000
2115
|
}
|
|
2001
|
-
async function runD1Migrations() {
|
|
2002
|
-
if (!miniflare || !config?.bindings?.d1)
|
|
2003
|
-
return;
|
|
2004
|
-
const { existsSync: existsSync2, readdirSync, readFileSync } = await import("node:fs");
|
|
2005
|
-
const migrationsDir = resolve(cwd, "migrations");
|
|
2006
|
-
if (!existsSync2(migrationsDir)) {
|
|
2007
|
-
logger?.debug("No migrations/ directory found, skipping D1 migrations");
|
|
2008
|
-
return;
|
|
2009
|
-
}
|
|
2010
|
-
const files = readdirSync(migrationsDir).filter((f) => f.endsWith(".sql")).sort();
|
|
2011
|
-
if (files.length === 0) {
|
|
2012
|
-
logger?.debug("No SQL migration files found");
|
|
2013
|
-
return;
|
|
2014
|
-
}
|
|
2015
|
-
logger?.info(`Running ${files.length} D1 migration(s)...`);
|
|
2016
|
-
const allStatements = [];
|
|
2017
|
-
for (const file of files) {
|
|
2018
|
-
const sql = readFileSync(resolve(migrationsDir, file), "utf-8");
|
|
2019
|
-
const cleanedSql = sql.split(`
|
|
2020
|
-
`).filter((line) => !line.trim().startsWith("--")).join(`
|
|
2021
|
-
`);
|
|
2022
|
-
const statements = cleanedSql.split(";").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
2023
|
-
allStatements.push(...statements);
|
|
2024
|
-
logger?.debug(`File ${file}: ${statements.length} statement(s)`);
|
|
2025
|
-
}
|
|
2026
|
-
for (const [bindingName] of Object.entries(config.bindings.d1)) {
|
|
2027
|
-
for (let attempt = 0;attempt < 5; attempt++) {
|
|
2028
|
-
await new Promise((r) => setTimeout(r, 500 * (attempt + 1)));
|
|
2029
|
-
try {
|
|
2030
|
-
const response = await fetch(`http://127.0.0.1:${miniflarePort}/_devflare/migrate`, {
|
|
2031
|
-
method: "POST",
|
|
2032
|
-
headers: { "Content-Type": "application/json" },
|
|
2033
|
-
body: JSON.stringify({ bindingName, statements: allStatements })
|
|
2034
|
-
});
|
|
2035
|
-
if (!response.ok) {
|
|
2036
|
-
const text = await response.text();
|
|
2037
|
-
throw new Error(`HTTP ${response.status}: ${text}`);
|
|
2038
|
-
}
|
|
2039
|
-
const result = await response.json();
|
|
2040
|
-
if (result.success) {
|
|
2041
|
-
logger?.success(`D1 migrations applied to ${bindingName}`);
|
|
2042
|
-
break;
|
|
2043
|
-
} else {
|
|
2044
|
-
throw new Error(result.error || "Unknown error");
|
|
2045
|
-
}
|
|
2046
|
-
} catch (error) {
|
|
2047
|
-
if (attempt === 4) {
|
|
2048
|
-
logger?.warn(`Failed to apply migrations to ${bindingName}: ${error}`);
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
async function startVite() {
|
|
2055
|
-
const { spawn } = await import("node:child_process");
|
|
2056
|
-
const args = ["vite", "dev", "--port", String(vitePort)];
|
|
2057
|
-
if (generatedViteConfigPath) {
|
|
2058
|
-
args.push("--config", generatedViteConfigPath);
|
|
2059
|
-
}
|
|
2060
|
-
viteProcess = spawn("bunx", args, {
|
|
2061
|
-
cwd,
|
|
2062
|
-
stdio: ["inherit", "pipe", "pipe"],
|
|
2063
|
-
windowsHide: true,
|
|
2064
|
-
env: {
|
|
2065
|
-
...process.env,
|
|
2066
|
-
DEVFLARE_DEV: "true",
|
|
2067
|
-
DEVFLARE_BRIDGE_PORT: String(miniflarePort),
|
|
2068
|
-
FORCE_COLOR: "1"
|
|
2069
|
-
}
|
|
2070
|
-
});
|
|
2071
|
-
const readyUrl = await waitForViteReady(viteProcess, {
|
|
2072
|
-
onStdout(chunk) {
|
|
2073
|
-
process.stdout.write(chunk);
|
|
2074
|
-
},
|
|
2075
|
-
onStderr(chunk) {
|
|
2076
|
-
process.stderr.write(chunk);
|
|
2077
|
-
}
|
|
2078
|
-
});
|
|
2079
|
-
if (readyUrl) {
|
|
2080
|
-
logger?.success(`Vite dev server started on ${readyUrl}`);
|
|
2081
|
-
return;
|
|
2082
|
-
}
|
|
2083
|
-
logger?.warn("Vite process started, but the final local URL could not be confirmed yet");
|
|
2084
|
-
}
|
|
2085
2116
|
async function start() {
|
|
2086
2117
|
logger?.info("Starting unified dev server...");
|
|
2087
2118
|
config = await loadConfig({ cwd, configFile: configPath });
|
|
@@ -2131,7 +2162,7 @@ function createDevServer(options) {
|
|
|
2131
2162
|
logger?.info("");
|
|
2132
2163
|
}
|
|
2133
2164
|
}
|
|
2134
|
-
const browserBinding = config.bindings?.browser
|
|
2165
|
+
const browserBinding = getSingleBrowserBindingName(config.bindings?.browser);
|
|
2135
2166
|
if (browserBinding) {
|
|
2136
2167
|
logger?.info(`Starting Browser Rendering shim (binding: ${browserBinding})...`);
|
|
2137
2168
|
browserShim = createBrowserShim({
|
|
@@ -2145,7 +2176,7 @@ function createDevServer(options) {
|
|
|
2145
2176
|
const doPattern = config.files?.durableObjects;
|
|
2146
2177
|
let doResult = null;
|
|
2147
2178
|
if (typeof doPattern === "string" && doPattern) {
|
|
2148
|
-
const outDir =
|
|
2179
|
+
const outDir = resolve3(cwd, ".devflare/do-bundles");
|
|
2149
2180
|
doBundler = createDOBundler({
|
|
2150
2181
|
cwd,
|
|
2151
2182
|
pattern: doPattern,
|
|
@@ -2164,14 +2195,20 @@ function createDevServer(options) {
|
|
|
2164
2195
|
}
|
|
2165
2196
|
currentDoResult = doResult;
|
|
2166
2197
|
await startMiniflare(doResult);
|
|
2167
|
-
await
|
|
2198
|
+
await startWorkerSourceWatcher2();
|
|
2168
2199
|
if (enableVite) {
|
|
2169
|
-
await
|
|
2200
|
+
viteProcess = await startViteProcess({
|
|
2201
|
+
cwd,
|
|
2202
|
+
vitePort,
|
|
2203
|
+
miniflarePort,
|
|
2204
|
+
generatedViteConfigPath,
|
|
2205
|
+
logger
|
|
2206
|
+
});
|
|
2170
2207
|
} else {
|
|
2171
2208
|
logger?.info("Vite startup skipped (no effective Vite config found for this package)");
|
|
2172
2209
|
}
|
|
2173
2210
|
await new Promise((r) => setTimeout(r, 1000));
|
|
2174
|
-
await runD1Migrations();
|
|
2211
|
+
await runD1Migrations({ cwd, config, miniflarePort, logger });
|
|
2175
2212
|
}
|
|
2176
2213
|
async function stop() {
|
|
2177
2214
|
if (doBundler) {
|
|
@@ -2213,11 +2250,11 @@ async function createLogWriter(cwd, options) {
|
|
|
2213
2250
|
const fs = await import("node:fs");
|
|
2214
2251
|
let logPath;
|
|
2215
2252
|
if (options.logTemp) {
|
|
2216
|
-
logPath =
|
|
2253
|
+
logPath = resolve4(cwd, ".log");
|
|
2217
2254
|
} else {
|
|
2218
2255
|
const now = new Date;
|
|
2219
2256
|
const timestamp = now.toISOString().replace(/[:.]/g, "-").replace("T", "_").slice(0, 19);
|
|
2220
|
-
logPath =
|
|
2257
|
+
logPath = resolve4(cwd, `.log-${timestamp}`);
|
|
2221
2258
|
}
|
|
2222
2259
|
const fileStream = fs.createWriteStream(logPath, { flags: "w" });
|
|
2223
2260
|
const ansiRegex = /\x1b\[[0-9;]*m/g;
|
|
@@ -2248,6 +2285,7 @@ async function runDevCommand(parsed, logger, options) {
|
|
|
2248
2285
|
const persistEnabled = parsed.options.persist === true;
|
|
2249
2286
|
const debugEnabled = parsed.options.debug === true || process.env.DEVFLARE_DEBUG === "true";
|
|
2250
2287
|
const verbose = parsed.options.verbose === true || debugEnabled;
|
|
2288
|
+
const theme = createCliTheme(parsed.options);
|
|
2251
2289
|
const config = await loadConfig({ cwd, configFile: configPath });
|
|
2252
2290
|
const viteProject = resolveEffectiveViteProject(await detectViteProject(cwd), config);
|
|
2253
2291
|
const logWriter = await createLogWriter(cwd, {
|
|
@@ -2256,7 +2294,7 @@ async function runDevCommand(parsed, logger, options) {
|
|
|
2256
2294
|
});
|
|
2257
2295
|
if (logWriter) {
|
|
2258
2296
|
const logFile = relative(cwd, logWriter.path) || ".log";
|
|
2259
|
-
logger
|
|
2297
|
+
logLine(logger, `${dim("logging", theme)} ${logFile}`);
|
|
2260
2298
|
}
|
|
2261
2299
|
const devLogger = createConsola({
|
|
2262
2300
|
level: verbose ? 4 : 3
|
|
@@ -2277,24 +2315,24 @@ async function runDevCommand(parsed, logger, options) {
|
|
|
2277
2315
|
Object.assign(devLogger.debug, wrapLog(devLogger.debug.bind(devLogger), "[DEBUG]"));
|
|
2278
2316
|
}
|
|
2279
2317
|
try {
|
|
2280
|
-
logger
|
|
2318
|
+
logLine(logger);
|
|
2281
2319
|
if (viteProject.shouldStartVite) {
|
|
2282
|
-
logger
|
|
2283
|
-
logger
|
|
2284
|
-
logger
|
|
2285
|
-
logger
|
|
2286
|
-
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");
|
|
2287
2325
|
} else {
|
|
2288
|
-
logger
|
|
2289
|
-
logger
|
|
2290
|
-
logger
|
|
2291
|
-
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)");
|
|
2292
2330
|
if (viteProject.wantsViteIntegration) {
|
|
2293
2331
|
logger.warn("Vite-related settings were detected, but no effective Vite config was available");
|
|
2294
2332
|
logger.warn("Skipping Vite startup and running in worker-only mode");
|
|
2295
2333
|
}
|
|
2296
2334
|
}
|
|
2297
|
-
logger
|
|
2335
|
+
logLine(logger);
|
|
2298
2336
|
const devServer = createDevServer({
|
|
2299
2337
|
cwd,
|
|
2300
2338
|
configPath,
|
|
@@ -2324,8 +2362,8 @@ async function runDevCommand(parsed, logger, options) {
|
|
|
2324
2362
|
const message = reason instanceof Error ? reason.stack ?? reason.message : String(reason);
|
|
2325
2363
|
logger.error(message);
|
|
2326
2364
|
}
|
|
2327
|
-
logger
|
|
2328
|
-
logger
|
|
2365
|
+
logLine(logger);
|
|
2366
|
+
logLine(logger, `${yellow("dev", theme)} ${dim("Shutting down…", theme)}`);
|
|
2329
2367
|
try {
|
|
2330
2368
|
await devServer.stop();
|
|
2331
2369
|
} finally {
|