devflare 1.0.0-next.32 → 1.0.0-next.34
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 +9 -9
- package/bin/devflare.js +1 -3
- package/dist/{account-g99mzrqp.js → account-p9eywryw.js} +27 -16
- package/dist/ai-r3zqmxan.js +261 -0
- package/dist/{api-2n6dd2ws.js → api-6z01z734.js} +1 -1
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/bridge/v2/body-streams.d.ts.map +1 -1
- package/dist/bridge/v2/codec.d.ts.map +1 -1
- package/dist/bridge/v2/frames.d.ts.map +1 -1
- package/dist/bridge/v2/value-codec.d.ts.map +1 -1
- package/dist/bridge/v2/value-serialization.d.ts.map +1 -1
- package/dist/bridge/v2/wire.d.ts.map +1 -1
- package/dist/bridge/v2/ws-relay.d.ts +1 -1
- package/dist/bridge/v2/ws-relay.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-shim/server.d.ts.map +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +5 -5
- package/dist/{build-4tyjywn9.js → build-8bn7frg8.js} +16 -16
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts.map +1 -1
- package/dist/bundler/worker-bundler.d.ts.map +1 -1
- package/dist/bundler/worker-compat.d.ts.map +1 -1
- package/dist/cli/build-manifest.d.ts.map +1 -1
- package/dist/cli/command-utils.d.ts.map +1 -1
- package/dist/cli/commands/account.d.ts +1 -1
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/ai.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +3 -3
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -1
- package/dist/cli/commands/build.d.ts +2 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts +2 -2
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts +1 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -2
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +1 -1
- package/dist/cli/commands/login.d.ts.map +1 -1
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -1
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -1
- package/dist/cli/commands/previews-support/render.d.ts +1 -1
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -1
- package/dist/cli/commands/previews-support/theme.d.ts +1 -1
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -1
- package/dist/cli/commands/previews-support/types.d.ts +1 -1
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -1
- package/dist/cli/commands/previews.d.ts.map +1 -1
- package/dist/cli/commands/productions.d.ts +1 -1
- package/dist/cli/commands/productions.d.ts.map +1 -1
- package/dist/cli/commands/remote.d.ts +1 -1
- package/dist/cli/commands/remote.d.ts.map +1 -1
- package/dist/cli/commands/secrets.d.ts.map +1 -1
- package/dist/cli/commands/token.d.ts +2 -2
- package/dist/cli/commands/token.d.ts.map +1 -1
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -1
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -1
- package/dist/cli/commands/types.d.ts +2 -2
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +2 -2
- package/dist/cli/commands/worker.d.ts.map +1 -1
- package/dist/cli/dependencies.d.ts +1 -1
- package/dist/cli/dependencies.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts.map +1 -1
- package/dist/cli/deploy-target.d.ts.map +1 -1
- package/dist/cli/generated-artifacts.d.ts.map +1 -1
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -1
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -1
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -1
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -1
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -1
- package/dist/cli/help-pages/render.d.ts +1 -1
- package/dist/cli/help-pages/render.d.ts.map +1 -1
- package/dist/cli/help-pages/shared.d.ts.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli/preview-bindings.d.ts.map +1 -1
- package/dist/cli/preview.d.ts.map +1 -1
- package/dist/cli/ui.d.ts.map +1 -1
- package/dist/cli/workspace-build-guard.d.ts.map +1 -1
- package/dist/cloudflare/account-core.d.ts.map +1 -1
- package/dist/cloudflare/account-resources.d.ts.map +1 -1
- package/dist/cloudflare/account-status.d.ts.map +1 -1
- package/dist/cloudflare/account-workers.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/auth.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +6 -6
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +6 -6
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -1
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-inference.d.ts +1 -1
- package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-shape.d.ts +1 -1
- package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-types.d.ts +1 -1
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry.d.ts +1 -1
- package/dist/cloudflare/preview-registry.d.ts.map +1 -1
- package/dist/cloudflare/preview-urls.d.ts.map +1 -1
- package/dist/cloudflare/registry-schema.d.ts.map +1 -1
- package/dist/cloudflare/remote-config.d.ts.map +1 -1
- package/dist/cloudflare/tokens.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/binding-resolution-helpers.d.ts.map +1 -1
- package/dist/config/define.d.ts +1 -1
- package/dist/config/define.d.ts.map +1 -1
- package/dist/config/deploy-resources.d.ts +2 -2
- package/dist/config/deploy-resources.d.ts.map +1 -1
- package/dist/config/env-vars.d.ts.map +1 -1
- package/dist/config/framework-providers.d.ts.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/preview-resources.d.ts.map +1 -1
- package/dist/config/preview.d.ts +1 -3
- package/dist/config/preview.d.ts.map +1 -1
- package/dist/config/ref.d.ts +1 -1
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve-phased.d.ts.map +1 -1
- package/dist/config/resource-resolution.d.ts +3 -3
- package/dist/config/resource-resolution.d.ts.map +1 -1
- package/dist/config/schema-bindings.d.ts.map +1 -1
- package/dist/config/schema-build.d.ts.map +1 -1
- package/dist/config/schema-env.d.ts.map +1 -1
- package/dist/config/schema-normalization.d.ts +1 -1
- package/dist/config/schema-normalization.d.ts.map +1 -1
- package/dist/config/schema-runtime.d.ts.map +1 -1
- package/dist/config/schema-types-bindings-resources.d.ts +1 -2
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -1
- package/dist/config/schema-types-bindings.d.ts +1 -1
- package/dist/config/schema-types-bindings.d.ts.map +1 -1
- package/dist/config/schema-types-runtime.d.ts +2 -2
- package/dist/config/schema-types-runtime.d.ts.map +1 -1
- package/dist/config/schema-types.d.ts +1 -1
- package/dist/config/schema-types.d.ts.map +1 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/service-bindings-validation.d.ts.map +1 -1
- package/dist/config-entry.js +2 -2
- package/dist/{config-88sdhx3w.js → config-gphd6wx7.js} +6 -6
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/decorators/index.js +1 -1
- package/dist/{deploy-8fpav2cw.js → deploy-vpcp41fw.js} +19 -19
- package/dist/{dev-nxevkfdv.js → dev-9scy9gap.js} +251 -255
- package/dist/dev-server/d1-migrations.d.ts.map +1 -1
- package/dist/dev-server/dev-server-state.d.ts +2 -2
- package/dist/dev-server/dev-server-state.d.ts.map +1 -1
- package/dist/dev-server/gateway-script.d.ts.map +1 -1
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -1
- package/dist/dev-server/miniflare-dev-config.d.ts +2 -2
- package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -1
- package/dist/dev-server/miniflare-log.d.ts.map +1 -1
- package/dist/dev-server/miniflare-worker-config.d.ts +1 -1
- package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -1
- package/dist/dev-server/server-startup-helpers.d.ts +2 -2
- package/dist/dev-server/server-startup-helpers.d.ts.map +1 -1
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts.map +1 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -1
- package/dist/dev-server/worker-surface-paths.d.ts +1 -1
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -1
- package/dist/{doctor-ztwx1y95.js → doctor-swfeeqny.js} +12 -12
- package/dist/{durable-object-v3gsnybk.js → durable-object-pf6gabpn.js} +1 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/{index-mg8vwqxf.js → index-04wh9bxx.js} +2 -2
- package/dist/{index-fcmj6641.js → index-13sfensw.js} +1 -1
- package/dist/{index-6sj0v0dk.js → index-1trss579.js} +1373 -1358
- package/dist/{index-3jme4hgw.js → index-2xz4etye.js} +25 -33
- package/dist/{index-q8f4kawk.js → index-34dejneh.js} +12 -2
- package/dist/{index-rzp9ejrh.js → index-3t0e51a0.js} +1 -1
- package/dist/{index-ptwem1nt.js → index-3z20d3kd.js} +160 -208
- package/dist/{index-d8bdkx2h.js → index-4xmtkg9g.js} +2 -2
- package/dist/{index-qwgr4q7s.js → index-5dkjffqz.js} +2 -14
- package/dist/{index-aqrwyy57.js → index-7m557715.js} +2 -7
- package/dist/{index-85yjb686.js → index-97rfy7n2.js} +1 -1
- package/dist/{index-11p28kxx.js → index-atwc3csp.js} +1 -1
- package/dist/{index-ft3trvra.js → index-b20xx2vk.js} +5 -19
- package/dist/{index-s3km3y34.js → index-bhxj7ff6.js} +234 -219
- package/dist/{index-3edvz3hs.js → index-by27mzra.js} +4 -4
- package/dist/{index-t9y0sve5.js → index-c4zd39tc.js} +1 -1
- package/dist/{index-69c0ed4a.js → index-dem45895.js} +6 -11
- package/dist/{index-k9x5v335.js → index-dgx495pv.js} +30 -27
- package/dist/{index-7qd7nmdd.js → index-e7xn30bh.js} +2 -2
- package/dist/{index-1d4jg11n.js → index-h7r11y4a.js} +5 -8
- package/dist/{index-vez803pp.js → index-ksqth51q.js} +2 -2
- package/dist/{index-stgn34cr.js → index-maw0jjnn.js} +0 -1
- package/dist/{index-hpwa6vsw.js → index-n4xkaymm.js} +1 -4
- package/dist/{index-dfcp9hsd.js → index-pd97hk2j.js} +64 -72
- package/dist/{index-67gr49zr.js → index-pmnb7eke.js} +3 -3
- package/dist/{index-xz18tstn.js → index-t0r7evpw.js} +9 -9
- package/dist/{index-qz6nbwpw.js → index-t23wq5js.js} +1 -1
- package/dist/{index-hjjfxv02.js → index-w8c8tjc5.js} +1 -1
- package/dist/{index-c8p4njqy.js → index-wxdcrzcp.js} +1 -5
- package/dist/{index-15fpa5tx.js → index-x0wpeb3x.js} +2 -2
- package/dist/{index-qmmqww7h.js → index-x2fd1361.js} +5 -5
- package/dist/{index-a855bdsx.js → index-y7w3x9p1.js} +1 -1
- package/dist/{index-gn5wy09x.js → index-zdd0d9qa.js} +3 -9
- package/dist/index.js +12 -12
- package/dist/{init-cwpergap.js → init-tb8jqgvr.js} +2 -2
- package/dist/{login-r5ve73kf.js → login-7vyzeqy4.js} +10 -10
- package/dist/{previews-qjj98rpp.js → previews-jfbectpc.js} +25 -22
- package/dist/{productions-gzdtge0e.js → productions-49ct4kjm.js} +21 -18
- package/dist/{remote-q59qk463.js → remote-6876k6mz.js} +3 -3
- package/dist/runtime/context-events.d.ts.map +1 -1
- package/dist/runtime/context-types.d.ts.map +1 -1
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +21 -21
- package/dist/runtime/exports.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -5
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/runtime/router/index.d.ts +1 -1
- package/dist/runtime/router/index.d.ts.map +1 -1
- package/dist/runtime/router/types.d.ts.map +1 -1
- package/dist/secrets/local-secrets.d.ts.map +1 -1
- package/dist/{secrets-4w5166km.js → secrets-9ne7armr.js} +7 -7
- package/dist/shims/local-hyperdrive.d.ts.map +1 -1
- package/dist/shims/local-media-bindings.d.ts.map +1 -1
- package/dist/shims/local-worker-loader.d.ts.map +1 -1
- package/dist/sveltekit/index.d.ts.map +1 -1
- package/dist/sveltekit/index.js +12 -15
- package/dist/sveltekit/local-bindings.d.ts.map +1 -1
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/binding-hints.d.ts +3 -4
- package/dist/test/binding-hints.d.ts.map +1 -1
- package/dist/test/cf.d.ts +1 -1
- package/dist/test/containers.d.ts.map +1 -1
- package/dist/test/email.d.ts +4 -4
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.js +1404 -1402
- package/dist/test/offline-bindings.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.map +1 -1
- 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/simple-context-bindings.d.ts.map +1 -1
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -1
- package/dist/test/simple-context-env.d.ts.map +1 -1
- package/dist/test/simple-context-handlers.d.ts.map +1 -1
- package/dist/test/simple-context-lifecycle.d.ts +1 -1
- package/dist/test/simple-context-lifecycle.d.ts.map +1 -1
- package/dist/test/simple-context-mfconfig.d.ts.map +1 -1
- package/dist/test/simple-context-multi-worker.d.ts +1 -1
- package/dist/test/simple-context-multi-worker.d.ts.map +1 -1
- package/dist/test/simple-context-paths.d.ts.map +1 -1
- package/dist/test/simple-context-runtime.d.ts.map +1 -1
- package/dist/test/simple-context-startup.d.ts.map +1 -1
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts +1 -1
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/env.d.ts.map +1 -1
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/{token-35jcdqq8.js → token-yp1qa70y.js} +4 -4
- package/dist/transform/durable-object.d.ts.map +1 -1
- package/dist/transform/worker-entrypoint.d.ts.map +1 -1
- package/dist/{types-6vc02evc.js → types-zekmbebk.js} +16 -18
- package/dist/utils/glob.d.ts.map +1 -1
- package/dist/utils/resolve-package.d.ts.map +1 -1
- package/dist/utils/send-email.d.ts.map +1 -1
- package/dist/utils/send-email.js +1 -1
- package/dist/vite/config-file.d.ts +1 -1
- package/dist/vite/config-file.d.ts.map +1 -1
- package/dist/vite/index.js +12 -12
- package/dist/vite/plugin-config-hook.d.ts.map +1 -1
- package/dist/vite/plugin-context.d.ts.map +1 -1
- package/dist/vite/plugin-durable-objects.d.ts +1 -1
- package/dist/vite/plugin-durable-objects.d.ts.map +1 -1
- package/dist/vite/plugin-programmatic.d.ts.map +1 -1
- package/dist/vite/plugin-service-bindings.d.ts.map +1 -1
- package/dist/vite/plugin-transform.d.ts.map +1 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/{worker-f2v85f7d.js → worker-706g8qeh.js} +14 -14
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/dist/worker-entry/extensions.d.ts.map +1 -1
- package/dist/worker-entry/routes.d.ts.map +1 -1
- package/dist/worker-entry/surface-paths.d.ts.map +1 -1
- package/dist/{worker-entrypoint-3rmzd4c1.js → worker-entrypoint-y8s9kdcx.js} +1 -1
- package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/ai-dx4fr9jh.js +0 -107
- package/dist/{index-vhqww6tt.js → index-p93cngdp.js} +1 -1
|
@@ -9,13 +9,7 @@ async function findFiles(pattern, options) {
|
|
|
9
9
|
cwd,
|
|
10
10
|
absolute,
|
|
11
11
|
gitignore,
|
|
12
|
-
ignore: [
|
|
13
|
-
"**/node_modules/**",
|
|
14
|
-
"**/.devflare/**",
|
|
15
|
-
"**/dist/**",
|
|
16
|
-
"**/build/**",
|
|
17
|
-
"**/.git/**"
|
|
18
|
-
]
|
|
12
|
+
ignore: ["**/node_modules/**", "**/.devflare/**", "**/dist/**", "**/build/**", "**/.git/**"]
|
|
19
13
|
});
|
|
20
14
|
}
|
|
21
15
|
function findFilesSync(pattern, options) {
|
|
@@ -24,13 +18,7 @@ function findFilesSync(pattern, options) {
|
|
|
24
18
|
cwd,
|
|
25
19
|
absolute,
|
|
26
20
|
gitignore,
|
|
27
|
-
ignore: [
|
|
28
|
-
"**/node_modules/**",
|
|
29
|
-
"**/.devflare/**",
|
|
30
|
-
"**/dist/**",
|
|
31
|
-
"**/build/**",
|
|
32
|
-
"**/.git/**"
|
|
33
|
-
]
|
|
21
|
+
ignore: ["**/node_modules/**", "**/.devflare/**", "**/dist/**", "**/build/**", "**/.git/**"]
|
|
34
22
|
});
|
|
35
23
|
}
|
|
36
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/transform/worker-entrypoint.ts
|
|
2
|
-
import ts from "typescript";
|
|
3
2
|
import MagicString from "magic-string";
|
|
3
|
+
import ts from "typescript";
|
|
4
4
|
|
|
5
5
|
// src/worker-entry/extensions.ts
|
|
6
6
|
var SUPPORTED_WORKER_EXTENSIONS = [
|
|
@@ -13,12 +13,7 @@ var SUPPORTED_WORKER_EXTENSIONS = [
|
|
|
13
13
|
".js",
|
|
14
14
|
".jsx"
|
|
15
15
|
];
|
|
16
|
-
var TS_WORKER_EXTENSIONS = [
|
|
17
|
-
".ts",
|
|
18
|
-
".tsx",
|
|
19
|
-
".mts",
|
|
20
|
-
".cts"
|
|
21
|
-
];
|
|
16
|
+
var TS_WORKER_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
22
17
|
|
|
23
18
|
// src/transform/worker-entrypoint.ts
|
|
24
19
|
function findExportedFunctions(code) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mergeConfigForEnvironment
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-pd97hk2j.js";
|
|
4
4
|
import {
|
|
5
5
|
createD1Database,
|
|
6
6
|
createKVNamespace,
|
|
@@ -21,12 +21,12 @@ import {
|
|
|
21
21
|
listQueues,
|
|
22
22
|
listR2Buckets,
|
|
23
23
|
listVectorizeIndexes
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-h7r11y4a.js";
|
|
25
25
|
import {
|
|
26
26
|
isPreviewScopedName,
|
|
27
27
|
materializePreviewScopedConfig,
|
|
28
28
|
materializePreviewScopedString
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-wxdcrzcp.js";
|
|
30
30
|
|
|
31
31
|
// src/config/preview-resources.ts
|
|
32
32
|
var defaultPreviewScopedResourceLifecycleApi = {
|
|
@@ -284,14 +284,7 @@ async function preparePreviewScopedResourcesForDeploy(config, options = {}) {
|
|
|
284
284
|
}
|
|
285
285
|
const cloudflareApi = resolvePreviewScopedResourceLifecycleApi(options.cloudflare);
|
|
286
286
|
const accountId = await resolveLifecycleAccountId(config, options, cloudflareApi);
|
|
287
|
-
const {
|
|
288
|
-
namespaces,
|
|
289
|
-
databases,
|
|
290
|
-
buckets,
|
|
291
|
-
queues,
|
|
292
|
-
vectorizeIndexes,
|
|
293
|
-
hyperdrives
|
|
294
|
-
} = await loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi);
|
|
287
|
+
const { namespaces, databases, buckets, queues, vectorizeIndexes, hyperdrives } = await loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi);
|
|
295
288
|
for (const ref of plan.kv) {
|
|
296
289
|
if (findKVNamespaceByName(namespaces, ref.previewName)) {
|
|
297
290
|
existing.kv.push(ref.previewName);
|
|
@@ -395,14 +388,7 @@ async function cleanupPreviewScopedResources(config, options = {}) {
|
|
|
395
388
|
const cloudflareApi = resolvePreviewScopedResourceLifecycleApi(options.cloudflare);
|
|
396
389
|
const accountId = await resolveLifecycleAccountId(config, options, cloudflareApi);
|
|
397
390
|
const apply = options.apply === true;
|
|
398
|
-
const {
|
|
399
|
-
namespaces,
|
|
400
|
-
databases,
|
|
401
|
-
buckets,
|
|
402
|
-
queues,
|
|
403
|
-
vectorizeIndexes,
|
|
404
|
-
hyperdrives
|
|
405
|
-
} = await loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi);
|
|
391
|
+
const { namespaces, databases, buckets, queues, vectorizeIndexes, hyperdrives } = await loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi);
|
|
406
392
|
const kvCandidates = plan.kv.map((ref) => findKVNamespaceByName(namespaces, ref.previewName)).filter((namespace) => namespace !== undefined);
|
|
407
393
|
for (const namespace of kvCandidates) {
|
|
408
394
|
candidates.kv.push(namespace.name);
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
discoverDurableObjects,
|
|
4
4
|
discoverRoutes,
|
|
5
5
|
resolveServiceBindings
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-dgx495pv.js";
|
|
7
7
|
import {
|
|
8
8
|
DEFAULT_DO_PATTERN
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-5dkjffqz.js";
|
|
10
10
|
import {
|
|
11
11
|
SUPPORTED_WORKER_EXTENSIONS
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-7m557715.js";
|
|
13
13
|
import {
|
|
14
14
|
compileBuildConfig,
|
|
15
15
|
compileConfig,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isolateViteBuildOutputPaths,
|
|
18
18
|
rebaseWranglerConfigPaths,
|
|
19
19
|
writeWranglerConfig
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-w8c8tjc5.js";
|
|
21
21
|
import {
|
|
22
22
|
loadConfig,
|
|
23
23
|
loadResolvedConfig,
|
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
resolveConfigForEnvironment,
|
|
26
26
|
resolveConfigPath,
|
|
27
27
|
resolveResources
|
|
28
|
-
} from "./index-
|
|
28
|
+
} from "./index-pd97hk2j.js";
|
|
29
29
|
import {
|
|
30
30
|
resolveConfigEnvVars
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-wxdcrzcp.js";
|
|
32
32
|
import {
|
|
33
33
|
__require
|
|
34
34
|
} from "./index-37x76zdn.js";
|
|
@@ -36,154 +36,67 @@ import {
|
|
|
36
36
|
// src/vite/plugin.ts
|
|
37
37
|
import { dirname as dirname2, resolve as resolve4 } from "pathe";
|
|
38
38
|
|
|
39
|
-
// src/vite/plugin-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
for (const [filePath, classNames] of discovery.files) {
|
|
49
|
-
const normalizedPath = filePath.replace(/\\/g, "/");
|
|
50
|
-
lines.push(`export { ${classNames.join(", ")} } from '${normalizedPath}'`);
|
|
39
|
+
// src/vite/plugin-config-hook.ts
|
|
40
|
+
async function tryLoadDevflareConfig(cwd, configPath, command) {
|
|
41
|
+
try {
|
|
42
|
+
return await loadConfig({ cwd, configFile: configPath });
|
|
43
|
+
} catch (error) {
|
|
44
|
+
if (command === "build") {
|
|
45
|
+
console.warn("[devflare] Could not load config:", error);
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
51
48
|
}
|
|
52
|
-
lines.push("");
|
|
53
|
-
lines.push("// Default fetch handler for DO worker");
|
|
54
|
-
lines.push("export default {");
|
|
55
|
-
lines.push("\tasync fetch(request: Request): Promise<Response> {");
|
|
56
|
-
lines.push('\t\treturn new Response("Devflare DO Worker", { status: 200 })');
|
|
57
|
-
lines.push("\t}");
|
|
58
|
-
lines.push("}");
|
|
59
|
-
return lines.join(`
|
|
60
|
-
`);
|
|
61
49
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
name: binding.name,
|
|
65
|
-
class_name: binding.class_name
|
|
66
|
-
})) ?? [];
|
|
50
|
+
function buildWorkerNameDefine(lfConfig, existing) {
|
|
51
|
+
const workerNameValue = lfConfig.name ?? "unknown";
|
|
67
52
|
return {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
main: VIRTUAL_DO_ENTRY,
|
|
71
|
-
compatibility_date: wranglerConfig.compatibility_date,
|
|
72
|
-
compatibility_flags: wranglerConfig.compatibility_flags,
|
|
73
|
-
durable_objects: { bindings: doBindings },
|
|
74
|
-
migrations: wranglerConfig.migrations,
|
|
75
|
-
kv_namespaces: wranglerConfig.kv_namespaces,
|
|
76
|
-
d1_databases: wranglerConfig.d1_databases,
|
|
77
|
-
r2_buckets: wranglerConfig.r2_buckets,
|
|
78
|
-
browser: wranglerConfig.browser
|
|
79
|
-
}
|
|
53
|
+
...existing,
|
|
54
|
+
__DEVFLARE_WORKER_NAME__: JSON.stringify(workerNameValue)
|
|
80
55
|
};
|
|
81
56
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
|
|
57
|
+
function buildWebSocketProxyConfig(lfConfig, bridgePort, wsProxyPatterns) {
|
|
58
|
+
const patterns = [...wsProxyPatterns];
|
|
59
|
+
if (lfConfig.wsRoutes && lfConfig.wsRoutes.length > 0) {
|
|
60
|
+
for (const route of lfConfig.wsRoutes) {
|
|
61
|
+
if (!patterns.includes(route.pattern)) {
|
|
62
|
+
patterns.push(route.pattern);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
85
65
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
66
|
+
if (patterns.length === 0)
|
|
67
|
+
return null;
|
|
68
|
+
const proxyConfig = {};
|
|
69
|
+
for (const pattern of patterns) {
|
|
70
|
+
proxyConfig[pattern] = {
|
|
71
|
+
target: `http://127.0.0.1:${bridgePort}`,
|
|
72
|
+
changeOrigin: true,
|
|
73
|
+
ws: true,
|
|
74
|
+
configure: (proxy) => {
|
|
75
|
+
proxy.on("error", (err) => {
|
|
76
|
+
console.error(`[devflare] Proxy error: ${err.message}`);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
89
80
|
}
|
|
81
|
+
if (Object.keys(proxyConfig).length === 0)
|
|
82
|
+
return null;
|
|
83
|
+
console.log(`[devflare] WebSocket proxy configured for: ${patterns.join(", ")}`);
|
|
84
|
+
return proxyConfig;
|
|
90
85
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return `${VIRTUAL_SERVICE_WORKER_PREFIX}${encodeURIComponent(workerName)}`;
|
|
97
|
-
}
|
|
98
|
-
function resolvedVirtualServiceWorkerId(workerName) {
|
|
99
|
-
return `${RESOLVED_VIRTUAL_SERVICE_WORKER_PREFIX}${encodeURIComponent(workerName)}`;
|
|
100
|
-
}
|
|
101
|
-
function objectEntries(record) {
|
|
102
|
-
return record ? Object.entries(record) : [];
|
|
103
|
-
}
|
|
104
|
-
function toWranglerDurableObjectBinding(name, value) {
|
|
105
|
-
if (typeof value === "string") {
|
|
106
|
-
return { name, class_name: value };
|
|
86
|
+
async function buildPluginConfigHookResult(cwd, options, command, existingDefine) {
|
|
87
|
+
const lfConfig = await tryLoadDevflareConfig(cwd, options.configPath, command);
|
|
88
|
+
const returnConfig = {};
|
|
89
|
+
if (lfConfig) {
|
|
90
|
+
returnConfig.define = buildWorkerNameDefine(lfConfig, existingDefine);
|
|
107
91
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
function toWranglerWorkerConfig(worker) {
|
|
115
|
-
const queueProducers = worker.queueProducers ? objectEntries(worker.queueProducers).map(([binding, producer]) => ({
|
|
116
|
-
binding,
|
|
117
|
-
queue: producer.queueName
|
|
118
|
-
})) : undefined;
|
|
119
|
-
const queueConsumers = worker.queueConsumers ? objectEntries(worker.queueConsumers).map(([queue, consumer]) => ({
|
|
120
|
-
queue,
|
|
121
|
-
...consumer.maxBatchSize !== undefined && { max_batch_size: consumer.maxBatchSize },
|
|
122
|
-
...consumer.maxBatchTimeout !== undefined && { max_batch_timeout: consumer.maxBatchTimeout },
|
|
123
|
-
...consumer.maxRetries !== undefined && { max_retries: consumer.maxRetries },
|
|
124
|
-
...typeof consumer.deadLetterQueue === "string" && { dead_letter_queue: consumer.deadLetterQueue },
|
|
125
|
-
...consumer.maxConcurrency !== undefined && { max_concurrency: consumer.maxConcurrency },
|
|
126
|
-
...consumer.retryDelay !== undefined && { retry_delay: consumer.retryDelay }
|
|
127
|
-
})) : undefined;
|
|
128
|
-
const queues = queueProducers || queueConsumers ? {
|
|
129
|
-
...queueProducers && { producers: queueProducers },
|
|
130
|
-
...queueConsumers && { consumers: queueConsumers }
|
|
131
|
-
} : undefined;
|
|
132
|
-
const durableObjectBindings = worker.durableObjects ? objectEntries(worker.durableObjects).map(([name, value]) => toWranglerDurableObjectBinding(name, value)) : [];
|
|
133
|
-
const serviceBindings = worker.serviceBindings ? objectEntries(worker.serviceBindings).map(([binding, target]) => ({
|
|
134
|
-
binding,
|
|
135
|
-
service: target.name,
|
|
136
|
-
...target.entrypoint && { entrypoint: target.entrypoint }
|
|
137
|
-
})) : [];
|
|
138
|
-
const config = {
|
|
139
|
-
name: worker.name,
|
|
140
|
-
main: virtualServiceWorkerId(worker.name),
|
|
141
|
-
compatibility_date: worker.compatibilityDate,
|
|
142
|
-
...worker.compatibilityFlags && { compatibility_flags: worker.compatibilityFlags },
|
|
143
|
-
...worker.bindings && { vars: worker.bindings },
|
|
144
|
-
...worker.kvNamespaces && {
|
|
145
|
-
kv_namespaces: objectEntries(worker.kvNamespaces).map(([binding, id]) => ({
|
|
146
|
-
binding,
|
|
147
|
-
id
|
|
148
|
-
}))
|
|
149
|
-
},
|
|
150
|
-
...worker.r2Buckets && {
|
|
151
|
-
r2_buckets: objectEntries(worker.r2Buckets).map(([binding, bucket_name]) => ({
|
|
152
|
-
binding,
|
|
153
|
-
bucket_name
|
|
154
|
-
}))
|
|
155
|
-
},
|
|
156
|
-
...worker.d1Databases && {
|
|
157
|
-
d1_databases: objectEntries(worker.d1Databases).map(([binding, database_id]) => ({
|
|
158
|
-
binding,
|
|
159
|
-
database_id,
|
|
160
|
-
database_name: database_id
|
|
161
|
-
}))
|
|
162
|
-
},
|
|
163
|
-
...durableObjectBindings.length > 0 && {
|
|
164
|
-
durable_objects: {
|
|
165
|
-
bindings: durableObjectBindings
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
...serviceBindings.length > 0 && {
|
|
169
|
-
services: serviceBindings
|
|
170
|
-
},
|
|
171
|
-
...queues && { queues }
|
|
172
|
-
};
|
|
173
|
-
return config;
|
|
174
|
-
}
|
|
175
|
-
function createAuxiliaryServiceWorkerConfigs(resolution) {
|
|
176
|
-
if (!resolution || resolution.workers.length === 0) {
|
|
177
|
-
return { auxiliaryWorkers: [], virtualModules: new Map };
|
|
92
|
+
if (command === "serve" && process.env.DEVFLARE_DEV && lfConfig) {
|
|
93
|
+
const port = options.bridgePort ?? 8787;
|
|
94
|
+
const proxyConfig = buildWebSocketProxyConfig(lfConfig, port, options.wsProxyPatterns);
|
|
95
|
+
if (proxyConfig) {
|
|
96
|
+
returnConfig.server = { proxy: proxyConfig };
|
|
97
|
+
}
|
|
178
98
|
}
|
|
179
|
-
|
|
180
|
-
const auxiliaryWorkers = resolution.workers.map((worker) => {
|
|
181
|
-
virtualModules.set(resolvedVirtualServiceWorkerId(worker.name), worker.script);
|
|
182
|
-
return {
|
|
183
|
-
config: toWranglerWorkerConfig(worker)
|
|
184
|
-
};
|
|
185
|
-
});
|
|
186
|
-
return { auxiliaryWorkers, virtualModules };
|
|
99
|
+
return Object.keys(returnConfig).length > 0 ? returnConfig : undefined;
|
|
187
100
|
}
|
|
188
101
|
|
|
189
102
|
// src/vite/plugin-context.ts
|
|
@@ -254,9 +167,7 @@ or move the handler to a source file that exists at config time.`);
|
|
|
254
167
|
try {
|
|
255
168
|
await fs.access(absolutePath);
|
|
256
169
|
return absolutePath;
|
|
257
|
-
} catch {
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
170
|
+
} catch {}
|
|
260
171
|
}
|
|
261
172
|
return null;
|
|
262
173
|
}
|
|
@@ -687,6 +598,164 @@ async function prepareComposedWorkerEntrypoint(cwd, config, environment, options
|
|
|
687
598
|
return entryPath;
|
|
688
599
|
}
|
|
689
600
|
|
|
601
|
+
// src/vite/plugin-durable-objects.ts
|
|
602
|
+
var VIRTUAL_DO_ENTRY = "virtual:devflare-do-entry";
|
|
603
|
+
var RESOLVED_VIRTUAL_DO_ENTRY = "\x00" + VIRTUAL_DO_ENTRY;
|
|
604
|
+
function generateVirtualDOEntry(discovery) {
|
|
605
|
+
const lines = [
|
|
606
|
+
"// Auto-generated by devflare — DO entry module",
|
|
607
|
+
"// Re-exports all Durable Object classes discovered from files.durableObjects pattern",
|
|
608
|
+
""
|
|
609
|
+
];
|
|
610
|
+
for (const [filePath, classNames] of discovery.files) {
|
|
611
|
+
const normalizedPath = filePath.replace(/\\/g, "/");
|
|
612
|
+
lines.push(`export { ${classNames.join(", ")} } from '${normalizedPath}'`);
|
|
613
|
+
}
|
|
614
|
+
lines.push("");
|
|
615
|
+
lines.push("// Default fetch handler for DO worker");
|
|
616
|
+
lines.push("export default {");
|
|
617
|
+
lines.push("\tasync fetch(request: Request): Promise<Response> {");
|
|
618
|
+
lines.push('\t\treturn new Response("Devflare DO Worker", { status: 200 })');
|
|
619
|
+
lines.push("\t}");
|
|
620
|
+
lines.push("}");
|
|
621
|
+
return lines.join(`
|
|
622
|
+
`);
|
|
623
|
+
}
|
|
624
|
+
function createAuxiliaryWorkerConfig(wranglerConfig, discovery) {
|
|
625
|
+
const doBindings = wranglerConfig.durable_objects?.bindings?.map((binding) => ({
|
|
626
|
+
name: binding.name,
|
|
627
|
+
class_name: binding.class_name
|
|
628
|
+
})) ?? [];
|
|
629
|
+
return {
|
|
630
|
+
config: {
|
|
631
|
+
name: discovery.workerName,
|
|
632
|
+
main: VIRTUAL_DO_ENTRY,
|
|
633
|
+
compatibility_date: wranglerConfig.compatibility_date,
|
|
634
|
+
compatibility_flags: wranglerConfig.compatibility_flags,
|
|
635
|
+
durable_objects: { bindings: doBindings },
|
|
636
|
+
migrations: wranglerConfig.migrations,
|
|
637
|
+
kv_namespaces: wranglerConfig.kv_namespaces,
|
|
638
|
+
d1_databases: wranglerConfig.d1_databases,
|
|
639
|
+
r2_buckets: wranglerConfig.r2_buckets,
|
|
640
|
+
browser: wranglerConfig.browser
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function logDiscoveredDurableObjects(projectRoot, discovery) {
|
|
645
|
+
if (!discovery || discovery.files.size === 0) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
console.log(`[devflare] Discovered ${discovery.files.size} DO file(s):`);
|
|
649
|
+
for (const [filePath, classes] of discovery.files) {
|
|
650
|
+
console.log(` • ${filePath.replace(projectRoot, ".")} → ${classes.join(", ")}`);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// src/vite/plugin-service-bindings.ts
|
|
655
|
+
var VIRTUAL_SERVICE_WORKER_PREFIX = "virtual:devflare-service-worker/";
|
|
656
|
+
var RESOLVED_VIRTUAL_SERVICE_WORKER_PREFIX = "\x00" + VIRTUAL_SERVICE_WORKER_PREFIX;
|
|
657
|
+
function virtualServiceWorkerId(workerName) {
|
|
658
|
+
return `${VIRTUAL_SERVICE_WORKER_PREFIX}${encodeURIComponent(workerName)}`;
|
|
659
|
+
}
|
|
660
|
+
function resolvedVirtualServiceWorkerId(workerName) {
|
|
661
|
+
return `${RESOLVED_VIRTUAL_SERVICE_WORKER_PREFIX}${encodeURIComponent(workerName)}`;
|
|
662
|
+
}
|
|
663
|
+
function objectEntries(record) {
|
|
664
|
+
return record ? Object.entries(record) : [];
|
|
665
|
+
}
|
|
666
|
+
function toWranglerDurableObjectBinding(name, value) {
|
|
667
|
+
if (typeof value === "string") {
|
|
668
|
+
return { name, class_name: value };
|
|
669
|
+
}
|
|
670
|
+
return {
|
|
671
|
+
name,
|
|
672
|
+
class_name: value.className,
|
|
673
|
+
script_name: value.scriptName
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function toWranglerWorkerConfig(worker) {
|
|
677
|
+
const queueProducers = worker.queueProducers ? objectEntries(worker.queueProducers).map(([binding, producer]) => ({
|
|
678
|
+
binding,
|
|
679
|
+
queue: producer.queueName
|
|
680
|
+
})) : undefined;
|
|
681
|
+
const queueConsumers = worker.queueConsumers ? objectEntries(worker.queueConsumers).map(([queue, consumer]) => ({
|
|
682
|
+
queue,
|
|
683
|
+
...consumer.maxBatchSize !== undefined && {
|
|
684
|
+
max_batch_size: consumer.maxBatchSize
|
|
685
|
+
},
|
|
686
|
+
...consumer.maxBatchTimeout !== undefined && {
|
|
687
|
+
max_batch_timeout: consumer.maxBatchTimeout
|
|
688
|
+
},
|
|
689
|
+
...consumer.maxRetries !== undefined && { max_retries: consumer.maxRetries },
|
|
690
|
+
...typeof consumer.deadLetterQueue === "string" && {
|
|
691
|
+
dead_letter_queue: consumer.deadLetterQueue
|
|
692
|
+
},
|
|
693
|
+
...consumer.maxConcurrency !== undefined && {
|
|
694
|
+
max_concurrency: consumer.maxConcurrency
|
|
695
|
+
},
|
|
696
|
+
...consumer.retryDelay !== undefined && { retry_delay: consumer.retryDelay }
|
|
697
|
+
})) : undefined;
|
|
698
|
+
const queues = queueProducers || queueConsumers ? {
|
|
699
|
+
...queueProducers && { producers: queueProducers },
|
|
700
|
+
...queueConsumers && { consumers: queueConsumers }
|
|
701
|
+
} : undefined;
|
|
702
|
+
const durableObjectBindings = worker.durableObjects ? objectEntries(worker.durableObjects).map(([name, value]) => toWranglerDurableObjectBinding(name, value)) : [];
|
|
703
|
+
const serviceBindings = worker.serviceBindings ? objectEntries(worker.serviceBindings).map(([binding, target]) => ({
|
|
704
|
+
binding,
|
|
705
|
+
service: target.name,
|
|
706
|
+
...target.entrypoint && { entrypoint: target.entrypoint }
|
|
707
|
+
})) : [];
|
|
708
|
+
const config = {
|
|
709
|
+
name: worker.name,
|
|
710
|
+
main: virtualServiceWorkerId(worker.name),
|
|
711
|
+
compatibility_date: worker.compatibilityDate,
|
|
712
|
+
...worker.compatibilityFlags && { compatibility_flags: worker.compatibilityFlags },
|
|
713
|
+
...worker.bindings && { vars: worker.bindings },
|
|
714
|
+
...worker.kvNamespaces && {
|
|
715
|
+
kv_namespaces: objectEntries(worker.kvNamespaces).map(([binding, id]) => ({
|
|
716
|
+
binding,
|
|
717
|
+
id
|
|
718
|
+
}))
|
|
719
|
+
},
|
|
720
|
+
...worker.r2Buckets && {
|
|
721
|
+
r2_buckets: objectEntries(worker.r2Buckets).map(([binding, bucket_name]) => ({
|
|
722
|
+
binding,
|
|
723
|
+
bucket_name
|
|
724
|
+
}))
|
|
725
|
+
},
|
|
726
|
+
...worker.d1Databases && {
|
|
727
|
+
d1_databases: objectEntries(worker.d1Databases).map(([binding, database_id]) => ({
|
|
728
|
+
binding,
|
|
729
|
+
database_id,
|
|
730
|
+
database_name: database_id
|
|
731
|
+
}))
|
|
732
|
+
},
|
|
733
|
+
...durableObjectBindings.length > 0 && {
|
|
734
|
+
durable_objects: {
|
|
735
|
+
bindings: durableObjectBindings
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
...serviceBindings.length > 0 && {
|
|
739
|
+
services: serviceBindings
|
|
740
|
+
},
|
|
741
|
+
...queues && { queues }
|
|
742
|
+
};
|
|
743
|
+
return config;
|
|
744
|
+
}
|
|
745
|
+
function createAuxiliaryServiceWorkerConfigs(resolution) {
|
|
746
|
+
if (!resolution || resolution.workers.length === 0) {
|
|
747
|
+
return { auxiliaryWorkers: [], virtualModules: new Map };
|
|
748
|
+
}
|
|
749
|
+
const virtualModules = new Map;
|
|
750
|
+
const auxiliaryWorkers = resolution.workers.map((worker) => {
|
|
751
|
+
virtualModules.set(resolvedVirtualServiceWorkerId(worker.name), worker.script);
|
|
752
|
+
return {
|
|
753
|
+
config: toWranglerWorkerConfig(worker)
|
|
754
|
+
};
|
|
755
|
+
});
|
|
756
|
+
return { auxiliaryWorkers, virtualModules };
|
|
757
|
+
}
|
|
758
|
+
|
|
690
759
|
// src/vite/plugin-context.ts
|
|
691
760
|
var CONFIG_DIR = ".devflare";
|
|
692
761
|
function removeDevflareHandledServeBindings(config) {
|
|
@@ -704,7 +773,9 @@ async function buildPluginContextState(projectRoot, devflareConfig, environment,
|
|
|
704
773
|
const compiledWranglerConfig = mode === "build" ? compileBuildConfig(effectiveConfig) : compileConfig(effectiveConfig);
|
|
705
774
|
const wranglerConfig = mode === "build" ? isolateViteBuildOutputPaths(projectRoot, compiledWranglerConfig) : removeDevflareHandledServeBindings(compiledWranglerConfig);
|
|
706
775
|
const cloudflareConfig = {
|
|
707
|
-
...mode === "build" ? isolateViteBuildOutputPaths(projectRoot, compileToProgrammaticConfig(effectiveConfig, environment, {
|
|
776
|
+
...mode === "build" ? isolateViteBuildOutputPaths(projectRoot, compileToProgrammaticConfig(effectiveConfig, environment, {
|
|
777
|
+
preserveNamedBindings: true
|
|
778
|
+
})) : removeDevflareHandledServeBindings(compileToProgrammaticConfig(effectiveConfig, environment))
|
|
708
779
|
};
|
|
709
780
|
const composedMainEntry = mode === "build" ? null : await prepareComposedWorkerEntrypoint(projectRoot, effectiveConfig, environment);
|
|
710
781
|
if (composedMainEntry) {
|
|
@@ -781,69 +852,6 @@ async function resolvePluginConfigPath(projectRoot, configPath) {
|
|
|
781
852
|
return await resolveConfigPath(projectRoot) ?? null;
|
|
782
853
|
}
|
|
783
854
|
|
|
784
|
-
// src/vite/plugin-config-hook.ts
|
|
785
|
-
async function tryLoadDevflareConfig(cwd, configPath, command) {
|
|
786
|
-
try {
|
|
787
|
-
return await loadConfig({ cwd, configFile: configPath });
|
|
788
|
-
} catch (error) {
|
|
789
|
-
if (command === "build") {
|
|
790
|
-
console.warn("[devflare] Could not load config:", error);
|
|
791
|
-
}
|
|
792
|
-
return null;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
function buildWorkerNameDefine(lfConfig, existing) {
|
|
796
|
-
const workerNameValue = lfConfig.name ?? "unknown";
|
|
797
|
-
return {
|
|
798
|
-
...existing,
|
|
799
|
-
__DEVFLARE_WORKER_NAME__: JSON.stringify(workerNameValue)
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
function buildWebSocketProxyConfig(lfConfig, bridgePort, wsProxyPatterns) {
|
|
803
|
-
const patterns = [...wsProxyPatterns];
|
|
804
|
-
if (lfConfig.wsRoutes && lfConfig.wsRoutes.length > 0) {
|
|
805
|
-
for (const route of lfConfig.wsRoutes) {
|
|
806
|
-
if (!patterns.includes(route.pattern)) {
|
|
807
|
-
patterns.push(route.pattern);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
if (patterns.length === 0)
|
|
812
|
-
return null;
|
|
813
|
-
const proxyConfig = {};
|
|
814
|
-
for (const pattern of patterns) {
|
|
815
|
-
proxyConfig[pattern] = {
|
|
816
|
-
target: `http://127.0.0.1:${bridgePort}`,
|
|
817
|
-
changeOrigin: true,
|
|
818
|
-
ws: true,
|
|
819
|
-
configure: (proxy) => {
|
|
820
|
-
proxy.on("error", (err) => {
|
|
821
|
-
console.error(`[devflare] Proxy error: ${err.message}`);
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
if (Object.keys(proxyConfig).length === 0)
|
|
827
|
-
return null;
|
|
828
|
-
console.log(`[devflare] WebSocket proxy configured for: ${patterns.join(", ")}`);
|
|
829
|
-
return proxyConfig;
|
|
830
|
-
}
|
|
831
|
-
async function buildPluginConfigHookResult(cwd, options, command, existingDefine) {
|
|
832
|
-
const lfConfig = await tryLoadDevflareConfig(cwd, options.configPath, command);
|
|
833
|
-
const returnConfig = {};
|
|
834
|
-
if (lfConfig) {
|
|
835
|
-
returnConfig.define = buildWorkerNameDefine(lfConfig, existingDefine);
|
|
836
|
-
}
|
|
837
|
-
if (command === "serve" && process.env.DEVFLARE_DEV && lfConfig) {
|
|
838
|
-
const port = options.bridgePort ?? 8787;
|
|
839
|
-
const proxyConfig = buildWebSocketProxyConfig(lfConfig, port, options.wsProxyPatterns);
|
|
840
|
-
if (proxyConfig) {
|
|
841
|
-
returnConfig.server = { proxy: proxyConfig };
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
return Object.keys(returnConfig).length > 0 ? returnConfig : undefined;
|
|
845
|
-
}
|
|
846
|
-
|
|
847
855
|
// src/vite/plugin-transform.ts
|
|
848
856
|
var TRANSFORMABLE_EXTENSIONS = [".ts", ".tsx", ".js"];
|
|
849
857
|
function isTransformCandidate(id) {
|
|
@@ -855,10 +863,7 @@ async function runWorkerEntryTransform(code, id) {
|
|
|
855
863
|
if (!id.endsWith("worker.ts") && !id.endsWith("worker.js")) {
|
|
856
864
|
return null;
|
|
857
865
|
}
|
|
858
|
-
const {
|
|
859
|
-
shouldTransformWorker,
|
|
860
|
-
transformWorkerEntrypoint
|
|
861
|
-
} = await import("./worker-entrypoint-3rmzd4c1.js");
|
|
866
|
+
const { shouldTransformWorker, transformWorkerEntrypoint } = await import("./worker-entrypoint-y8s9kdcx.js");
|
|
862
867
|
if (!shouldTransformWorker(code, id)) {
|
|
863
868
|
return null;
|
|
864
869
|
}
|
|
@@ -876,7 +881,7 @@ async function runDurableObjectTransform(code, id, options) {
|
|
|
876
881
|
if (!code.includes("DurableObject") && !code.includes("@durableObject")) {
|
|
877
882
|
return null;
|
|
878
883
|
}
|
|
879
|
-
const { transformDurableObject } = await import("./durable-object-
|
|
884
|
+
const { transformDurableObject } = await import("./durable-object-pf6gabpn.js");
|
|
880
885
|
return transformDurableObject(code, id);
|
|
881
886
|
}
|
|
882
887
|
async function runDevflareTransform(code, id, options) {
|
|
@@ -897,7 +902,10 @@ async function loadProgrammaticDevflareConfig(options) {
|
|
|
897
902
|
cwd,
|
|
898
903
|
configFile: options.configPath,
|
|
899
904
|
environment: options.environment
|
|
900
|
-
}) : await resolveResources(await loadConfig({ cwd, configFile: options.configPath }), {
|
|
905
|
+
}) : await resolveResources(await loadConfig({ cwd, configFile: options.configPath }), {
|
|
906
|
+
phase: "local",
|
|
907
|
+
environment: options.environment
|
|
908
|
+
});
|
|
901
909
|
const devflareConfig = await resolveConfigEnvVars(resourceResolvedConfig, {
|
|
902
910
|
cwd,
|
|
903
911
|
configPath: options.configPath,
|
|
@@ -935,7 +943,14 @@ async function buildProgrammaticArtifacts(options, mode) {
|
|
|
935
943
|
const serviceBindingResolution = await resolveServiceBindings(devflareConfig, cwd);
|
|
936
944
|
auxiliaryWorkers.push(...createAuxiliaryServiceWorkerConfigs(serviceBindingResolution).auxiliaryWorkers);
|
|
937
945
|
}
|
|
938
|
-
return {
|
|
946
|
+
return {
|
|
947
|
+
cwd,
|
|
948
|
+
devflareConfig,
|
|
949
|
+
composedMainEntry,
|
|
950
|
+
wranglerConfig,
|
|
951
|
+
cloudflareConfig,
|
|
952
|
+
auxiliaryWorkers
|
|
953
|
+
};
|
|
939
954
|
}
|
|
940
955
|
async function getCloudflareConfig(options = {}) {
|
|
941
956
|
const { cloudflareConfig } = await buildProgrammaticArtifacts(options, "programmatic");
|
|
@@ -988,7 +1003,7 @@ function devflarePlugin(options = {}) {
|
|
|
988
1003
|
environment,
|
|
989
1004
|
doTransforms = true,
|
|
990
1005
|
watchConfig = true,
|
|
991
|
-
bridgePort = process.env.DEVFLARE_BRIDGE_PORT ? parseInt(process.env.DEVFLARE_BRIDGE_PORT, 10) : undefined,
|
|
1006
|
+
bridgePort = process.env.DEVFLARE_BRIDGE_PORT ? Number.parseInt(process.env.DEVFLARE_BRIDGE_PORT, 10) : undefined,
|
|
992
1007
|
wsProxyPatterns = []
|
|
993
1008
|
} = options;
|
|
994
1009
|
const state = createPluginState();
|