devflare 1.0.0-next.20 → 1.0.0-next.21

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.
Files changed (58) hide show
  1. package/LLM.md +9 -4
  2. package/README.md +10 -2
  3. package/dist/browser.js +3 -3
  4. package/dist/build-b1z6wqet.js +54 -0
  5. package/dist/build-x7maz3eb.js +54 -0
  6. package/dist/cli/commands/config.d.ts.map +1 -1
  7. package/dist/cli/commands/dev.d.ts +1 -0
  8. package/dist/cli/commands/dev.d.ts.map +1 -1
  9. package/dist/cli/commands/doctor.d.ts.map +1 -1
  10. package/dist/cli/help-pages/pages/core.d.ts.map +1 -1
  11. package/dist/cli/index.js +1 -1
  12. package/dist/config-qj5jw8km.js +93 -0
  13. package/dist/deploy-jf3yczsz.js +1055 -0
  14. package/dist/deploy-xqm869nf.js +1055 -0
  15. package/dist/dev-bgpxrwms.js +2551 -0
  16. package/dist/dev-kzs65xcr.js +2551 -0
  17. package/dist/dev-server/dev-server-state.d.ts +2 -0
  18. package/dist/dev-server/dev-server-state.d.ts.map +1 -1
  19. package/dist/dev-server/miniflare-dev-config.d.ts +4 -0
  20. package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -1
  21. package/dist/dev-server/server.d.ts.map +1 -1
  22. package/dist/dev-zgx7fhe9.js +2553 -0
  23. package/dist/doctor-0a2brpyz.js +259 -0
  24. package/dist/index-05pbj4hy.js +1193 -0
  25. package/dist/index-3edvz3hs.js +124 -0
  26. package/dist/index-50em8s6c.js +898 -0
  27. package/dist/index-666tdx14.js +895 -0
  28. package/dist/index-8p7rxkbs.js +1426 -0
  29. package/dist/index-aqrwyy57.js +288 -0
  30. package/dist/index-bj5avaba.js +109 -0
  31. package/dist/index-dgww0ewn.js +574 -0
  32. package/dist/index-f1yshy4s.js +412 -0
  33. package/dist/index-hpwa6vsw.js +239 -0
  34. package/dist/index-kxc4gtyt.js +574 -0
  35. package/dist/index-nxkesg55.js +68 -0
  36. package/dist/index-p7q23nce.js +1031 -0
  37. package/dist/index-pt49cgjv.js +1426 -0
  38. package/dist/index-rp0aye39.js +1426 -0
  39. package/dist/index-tknbyxzn.js +2202 -0
  40. package/dist/index.js +4 -4
  41. package/dist/runtime/index.js +4 -4
  42. package/dist/sveltekit/index.js +2 -2
  43. package/dist/test/index.js +62 -440
  44. package/dist/test/resolve-service-bindings.d.ts +63 -3
  45. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  46. package/dist/types-vhvt4hvm.js +693 -0
  47. package/dist/utils/send-email.d.ts.map +1 -1
  48. package/dist/utils/send-email.js +1 -1
  49. package/dist/vite/index.js +4 -3
  50. package/dist/vite/plugin-context.d.ts +3 -1
  51. package/dist/vite/plugin-context.d.ts.map +1 -1
  52. package/dist/vite/plugin-programmatic.d.ts.map +1 -1
  53. package/dist/vite/plugin-service-bindings.d.ts +13 -0
  54. package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
  55. package/dist/vite/plugin.d.ts +4 -2
  56. package/dist/vite/plugin.d.ts.map +1 -1
  57. package/dist/worker-entrypoint-3rmzd4c1.js +15 -0
  58. package/package.json +1 -1
package/LLM.md CHANGED
@@ -1278,12 +1278,12 @@ bunx --bun devflare productions rollback --help
1278
1278
  | Command | Primary job | What the deeper help covers |
1279
1279
  | --- | --- | --- |
1280
1280
  | `init` | Scaffold a new package. | Template choice and generated starter scripts. |
1281
- | `dev` | Start local development. | Worker-only defaults, Vite auto-detection, logging, and persistence. |
1281
+ | `dev` | Start local development. | Worker-only defaults, Vite auto-detection, `ref()` service workers, runtime-port selection, logging, and persistence. |
1282
1282
  | `build` | Compile deploy-ready artifacts. | Environment resolution and Wrangler-facing output. |
1283
1283
  | `deploy` | Ship explicitly to production or preview. | Target selection, dry runs, preview naming, messages, and tags. |
1284
1284
  | `types` | Generate `env.d.ts` and typed bindings. | Custom output paths plus entrypoint and Durable Object discovery. |
1285
- | `doctor` | Check local project health. | Config, package, TypeScript, Vite, and generated artifact diagnostics. |
1286
- | `config` | Print resolved config. | `print`, raw Devflare JSON, or compiled Wrangler JSON. |
1285
+ | `doctor` | Check local project health. | Config, package, TypeScript, Vite, scope-aware local/deploy artifact diagnostics, and optional plugin guidance. |
1286
+ | `config` | Print resolved config. | `print`, raw Devflare JSON, compiled Wrangler JSON, and build/local/deploy resolution phases. |
1287
1287
  | `account` | Inspect Cloudflare account inventories and limits. | Resource lists, usage limits, and interactive global/workspace selection. |
1288
1288
  | `login` | Authenticate with Cloudflare via Wrangler. | `--force` behavior and reuse of existing sessions. |
1289
1289
  | `previews` | Operate on preview lifecycle state. | `list`, `bindings`, and `cleanup`. |
@@ -1352,7 +1352,11 @@ When the job changes from building to operating, switch command families instead
1352
1352
  ##### Key points
1353
1353
 
1354
1354
  - Run `types` after binding or entrypoint changes so `env.d.ts` stays honest.
1355
+ - Use `dev --runtime-port <port>` or `DEVFLARE_RUNTIME_PORT` when another local project already owns the default 8787 runtime port.
1356
+ - Use `config --phase local --format wrangler` when you want local config inspection without Cloudflare account lookups.
1357
+ - Use `ref()` service bindings for local full-stack packages; Devflare starts those referenced workers in CLI dev and exposes them as Vite auxiliary workers for framework dev.
1355
1358
  - Run `build` or `config print --format wrangler` when the compiled shape matters more than the dev server feeling healthy.
1359
+ - Use `doctor --scope local` when generated deploy artifacts are intentionally absent during a local-only loop.
1356
1360
  - Keep preview and production intent explicit in the final deploy command instead of hiding it in a generic script name.
1357
1361
  - Use the nested help pages when a lifecycle command reaches `--apply`, account selection, rollback, or cleanup territory.
1358
1362
 
@@ -1389,7 +1393,8 @@ bunx --bun devflare deploy --prod
1389
1393
 
1390
1394
  ```bash
1391
1395
  bunx --bun devflare config print --format wrangler
1392
- bunx --bun devflare doctor
1396
+ bunx --bun devflare config --phase local --format wrangler
1397
+ bunx --bun devflare doctor --scope local
1393
1398
  bunx --bun devflare previews bindings --scope next
1394
1399
  bunx --bun devflare productions versions
1395
1400
  ```
package/README.md CHANGED
@@ -17,10 +17,11 @@ For a worker-only project, install only Devflare:
17
17
  bun add -d devflare
18
18
  ```
19
19
 
20
- For Vite-backed apps, add Vite and the Cloudflare Vite plugin:
20
+ For Vite-backed apps, add Vite. Add the Cloudflare Vite plugin only when your
21
+ own `vite.config.*` calls it directly:
21
22
 
22
23
  ```bash
23
- bun add -d devflare vite @cloudflare/vite-plugin
24
+ bun add -d devflare vite
24
25
  ```
25
26
 
26
27
  Assumptions used by the examples: Wrangler 4, Miniflare 4,
@@ -182,6 +183,13 @@ for examples with file paths.
182
183
  | `devflare version` | print the installed version |
183
184
  | `devflare worker` | run Worker control-plane helpers |
184
185
 
186
+ Useful local-first switches:
187
+
188
+ - `devflare dev --runtime-port 8788` or `DEVFLARE_RUNTIME_PORT=8788` moves the local Miniflare runtime/bridge off the default `127.0.0.1:8787`. `--bridge-port` and `DEVFLARE_BRIDGE_PORT` are aliases for the same runtime port.
189
+ - `devflare doctor --scope local` skips deploy-readiness artifact warnings during a local-only loop.
190
+ - `devflare config --phase local --format wrangler` prints the local-runtime Wrangler shape without Cloudflare account resource lookups.
191
+ - `devflare dev` and `devflare/vite` start `ref()` service-binding workers inside the same local runtime, including their local KV, D1, R2, Queue producer/consumer, vars, Durable Objects, and other Miniflare-backed bindings.
192
+
185
193
  ## Support Stance Index
186
194
 
187
195
  The full support matrix is in `/docs/feature-index`. The short version is:
package/dist/browser.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-62b3gt2g.js";
4
4
  import {
5
5
  env
6
- } from "./index-0wa0ebm1.js";
6
+ } from "./index-nxkesg55.js";
7
7
  import {
8
8
  durableObject,
9
9
  getDurableObjectOptions
@@ -14,8 +14,8 @@ import {
14
14
  getClient,
15
15
  initEnv,
16
16
  setBindingHints
17
- } from "./index-vrps1gky.js";
18
- import"./index-kgstnk6g.js";
17
+ } from "./index-tknbyxzn.js";
18
+ import"./index-hpwa6vsw.js";
19
19
  import {
20
20
  defineConfig,
21
21
  ref
@@ -0,0 +1,54 @@
1
+ import {
2
+ prepareBuildArtifacts
3
+ } from "./index-kxc4gtyt.js";
4
+ import"./index-aabgympv.js";
5
+ import"./index-z9gy8w6b.js";
6
+ import"./index-gn5wy09x.js";
7
+ import"./index-627srx16.js";
8
+ import {
9
+ createCliTheme,
10
+ cyanBold,
11
+ dim,
12
+ logLine
13
+ } from "./index-stgn34cr.js";
14
+ import"./index-3t6rypgc.js";
15
+ import"./index-gq39t0rx.js";
16
+ import"./index-t4fhcx1n.js";
17
+ import"./index-8x745h59.js";
18
+ import"./index-qf2dkqxh.js";
19
+ import"./index-qwgr4q7s.js";
20
+ import"./index-65e7xx1a.js";
21
+ import"./index-vhqww6tt.js";
22
+ import"./index-c3nxftnp.js";
23
+ import"./index-syscwrjp.js";
24
+ import"./index-1d4jg11n.js";
25
+ import"./index-mg8vwqxf.js";
26
+ import"./index-z40mjts9.js";
27
+ import"./index-q8f4kawk.js";
28
+ import"./index-37x76zdn.js";
29
+
30
+ // src/cli/commands/build.ts
31
+ async function runBuildCommand(parsed, logger, options) {
32
+ const theme = createCliTheme(parsed.options);
33
+ logLine(logger);
34
+ logLine(logger, `${cyanBold("build", theme)} ${dim("Preparing production artifacts", theme)}`);
35
+ try {
36
+ await prepareBuildArtifacts(parsed, logger, options);
37
+ logger.success("Generated .devflare/wrangler.jsonc");
38
+ logger.success("Generated .devflare/build/wrangler.jsonc");
39
+ logger.success("Generated .wrangler/deploy/config.json");
40
+ logger.success("Build complete!");
41
+ return { exitCode: 0 };
42
+ } catch (error) {
43
+ if (error instanceof Error) {
44
+ logger.error("Build failed:", error.message);
45
+ if (parsed.options.debug) {
46
+ logger.error(error.stack);
47
+ }
48
+ }
49
+ return { exitCode: 1 };
50
+ }
51
+ }
52
+ export {
53
+ runBuildCommand
54
+ };
@@ -0,0 +1,54 @@
1
+ import {
2
+ prepareBuildArtifacts
3
+ } from "./index-dgww0ewn.js";
4
+ import"./index-aabgympv.js";
5
+ import"./index-z9gy8w6b.js";
6
+ import"./index-gn5wy09x.js";
7
+ import"./index-627srx16.js";
8
+ import {
9
+ createCliTheme,
10
+ cyanBold,
11
+ dim,
12
+ logLine
13
+ } from "./index-stgn34cr.js";
14
+ import"./index-3t6rypgc.js";
15
+ import"./index-666tdx14.js";
16
+ import"./index-05pbj4hy.js";
17
+ import"./index-p7q23nce.js";
18
+ import"./index-3edvz3hs.js";
19
+ import"./index-qwgr4q7s.js";
20
+ import"./index-aqrwyy57.js";
21
+ import"./index-vhqww6tt.js";
22
+ import"./index-c3nxftnp.js";
23
+ import"./index-syscwrjp.js";
24
+ import"./index-1d4jg11n.js";
25
+ import"./index-mg8vwqxf.js";
26
+ import"./index-z40mjts9.js";
27
+ import"./index-q8f4kawk.js";
28
+ import"./index-37x76zdn.js";
29
+
30
+ // src/cli/commands/build.ts
31
+ async function runBuildCommand(parsed, logger, options) {
32
+ const theme = createCliTheme(parsed.options);
33
+ logLine(logger);
34
+ logLine(logger, `${cyanBold("build", theme)} ${dim("Preparing production artifacts", theme)}`);
35
+ try {
36
+ await prepareBuildArtifacts(parsed, logger, options);
37
+ logger.success("Generated .devflare/wrangler.jsonc");
38
+ logger.success("Generated .devflare/build/wrangler.jsonc");
39
+ logger.success("Generated .wrangler/deploy/config.json");
40
+ logger.success("Build complete!");
41
+ return { exitCode: 0 };
42
+ } catch (error) {
43
+ if (error instanceof Error) {
44
+ logger.error("Build failed:", error.message);
45
+ if (parsed.options.debug) {
46
+ logger.error(error.stack);
47
+ }
48
+ }
49
+ return { exitCode: 1 };
50
+ }
51
+ }
52
+ export {
53
+ runBuildCommand
54
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAMjE,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CA6CpB"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAS9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAoCjE,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CA4DpB"}
@@ -1,4 +1,5 @@
1
1
  import { type ConsolaInstance } from 'consola';
2
2
  import type { ParsedArgs, CliOptions, CliResult } from '../index';
3
+ export declare function resolveDevRuntimePort(options: Record<string, string | boolean>, env?: NodeJS.ProcessEnv): number;
3
4
  export declare function runDevCommand(parsed: ParsedArgs, logger: ConsolaInstance, options: CliOptions): Promise<CliResult>;
4
5
  //# sourceMappingURL=dev.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/dev.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE7D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAqEjE,wBAAsB,aAAa,CAClC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CAkKpB"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/dev.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE7D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AA4CjE,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACzC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAClC,MAAM,CAYR;AAsDD,wBAAsB,aAAa,CAClC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CA2KpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAcjE,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CA8OpB"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAejE,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CA0PpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/help-pages/pages/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC,eAAO,MAAM,eAAe,EAAE,QAAQ,EA4VrC,CAAA;AAED,eAAO,MAAM,aAAa,2LAAW,CAAA"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/help-pages/pages/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC,eAAO,MAAM,eAAe,EAAE,QAAQ,EA4WrC,CAAA;AAED,eAAO,MAAM,aAAa,2LAAW,CAAA"}
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parseArgs,
3
3
  runCli
4
- } from "../index-h5dqna7q.js";
4
+ } from "../index-pt49cgjv.js";
5
5
  import"../index-627srx16.js";
6
6
  import"../index-stgn34cr.js";
7
7
  import"../index-3t6rypgc.js";
@@ -0,0 +1,93 @@
1
+ import {
2
+ compileBuildConfig,
3
+ compileConfig
4
+ } from "./index-c3nxftnp.js";
5
+ import {
6
+ ConfigResourceResolutionError,
7
+ loadConfig,
8
+ loadResolvedConfig,
9
+ resolveResources
10
+ } from "./index-syscwrjp.js";
11
+ import"./index-1d4jg11n.js";
12
+ import"./index-mg8vwqxf.js";
13
+ import"./index-z40mjts9.js";
14
+ import"./index-q8f4kawk.js";
15
+ import"./index-37x76zdn.js";
16
+
17
+ // src/cli/commands/config.ts
18
+ function isSupportedFormat(value) {
19
+ return value === "devflare" || value === "wrangler";
20
+ }
21
+ function isSupportedPhase(value) {
22
+ return value === "build" || value === "local" || value === "deploy";
23
+ }
24
+ async function loadConfigForPhase(options) {
25
+ if (options.phase === "deploy") {
26
+ return await loadResolvedConfig({
27
+ cwd: options.cwd,
28
+ configFile: options.configPath,
29
+ environment: options.environment
30
+ });
31
+ }
32
+ const config = await loadConfig({
33
+ cwd: options.cwd,
34
+ configFile: options.configPath
35
+ });
36
+ return await resolveResources(config, {
37
+ phase: options.phase,
38
+ environment: options.environment
39
+ });
40
+ }
41
+ async function runConfigCommand(parsed, logger, options) {
42
+ const cwd = options.cwd || process.cwd();
43
+ const configPath = parsed.options.config;
44
+ const environment = parsed.options.env;
45
+ const subcommand = parsed.args[0] ?? "print";
46
+ const formatOption = parsed.options.format;
47
+ const format = formatOption ?? "devflare";
48
+ const phaseOption = parsed.options.local === true ? "local" : parsed.options.phase ?? "deploy";
49
+ if (subcommand !== "print") {
50
+ logger.error(`Unknown config subcommand: ${subcommand}`);
51
+ logger.info("Supported subcommands: print");
52
+ return { exitCode: 1 };
53
+ }
54
+ if (!isSupportedFormat(format)) {
55
+ logger.error(`Unsupported config format: ${format}`);
56
+ logger.info("Supported formats: devflare, wrangler");
57
+ return { exitCode: 1 };
58
+ }
59
+ if (!isSupportedPhase(phaseOption)) {
60
+ logger.error(`Unsupported config phase: ${phaseOption}`);
61
+ logger.info("Supported phases: build, local, deploy");
62
+ return { exitCode: 1 };
63
+ }
64
+ try {
65
+ const resolvedConfig = await loadConfigForPhase({
66
+ cwd,
67
+ configPath,
68
+ environment,
69
+ phase: phaseOption
70
+ });
71
+ const output = format === "wrangler" ? phaseOption === "build" ? compileBuildConfig(resolvedConfig, undefined, { alreadyResolved: true }) : compileConfig(resolvedConfig) : resolvedConfig;
72
+ const text = JSON.stringify(output, null, "\t");
73
+ if (!options.silent) {
74
+ process.stdout.write(`${text}
75
+ `);
76
+ }
77
+ return {
78
+ exitCode: 0,
79
+ output: text
80
+ };
81
+ } catch (error) {
82
+ if (error instanceof Error) {
83
+ logger.error("Config command failed:", error.message);
84
+ if (error instanceof ConfigResourceResolutionError) {
85
+ logger.info("For offline inspection, run `devflare config --phase local` or `devflare config --phase build --format wrangler`.");
86
+ }
87
+ }
88
+ return { exitCode: 1 };
89
+ }
90
+ }
91
+ export {
92
+ runConfigCommand
93
+ };