devflare 1.0.0-next.17 → 1.0.0-next.18

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 CHANGED
@@ -56,7 +56,7 @@ Keep the day-to-day Devflare surfaces easy to scan: runtime model, HTTP split, a
56
56
  - **Frameworks** — Choose the right host lane for worker-rendered Svelte, standalone Vite apps, and full SvelteKit shells without losing the worker-first mental model.
57
57
  - [Svelte in workers](/docs/svelte-with-rolldown) — When a worker-only fetch surface or Durable Object imports `.svelte`, add the Svelte compiler to `rolldown.options.plugins`. That compilation belongs to Devflare’s worker bundler, not the main Vite plugin chain.
58
58
  - [Vite standalone](/docs/vite-standalone) — An effective Vite config is what opts the package into Vite-backed flows: a local `vite.config.*`, a non-empty `config.vite`, or both together. Use `devflare/vite` when the package really is a Vite app and you want Devflare to keep Worker config, Durable Objects, and generated Wrangler output aligned underneath it.
59
- - [SvelteKit](/docs/sveltekit-with-devflare) — Point Devflare at SvelteKits Cloudflare worker output—often via `files.fetch`, but sometimes by handing `wrangler.passthrough.main` the adapter worker directly—keep `sveltekit()` in `vite.config.ts`, and compose `devflare/sveltekit` into `src/hooks.server.ts` so local platform bindings line up with the Worker runtime Devflare manages.
59
+ - [SvelteKit](/docs/sveltekit-with-devflare) — Hand SvelteKit's Cloudflare adapter output to Devflare via `wrangler.passthrough.main` (the adapter worker is a build artifact and does not exist until `vite build` runs), keep `sveltekit()` in `vite.config.ts`, and compose `devflare/sveltekit` into `src/hooks.server.ts` so local platform bindings line up with the Worker runtime Devflare manages.
60
60
 
61
61
  ### Ship & operate
62
62
  Deploy explicitly, choose the right preview model, manage preview lifecycle cleanly, and keep CI/CD plus verification honest.
@@ -4196,7 +4196,7 @@ That means you should think in terms of host ownership, not a separate CLI mode.
4196
4196
 
4197
4197
  ### Compose Devflare with SvelteKit by letting SvelteKit host the app and Devflare supply the Worker platform
4198
4198
 
4199
- > Point Devflare at SvelteKits Cloudflare worker output—often via `files.fetch`, but sometimes by handing `wrangler.passthrough.main` the adapter worker directly—keep `sveltekit()` in `vite.config.ts`, and compose `devflare/sveltekit` into `src/hooks.server.ts` so local platform bindings line up with the Worker runtime Devflare manages.
4199
+ > Hand SvelteKit's Cloudflare adapter output to Devflare via `wrangler.passthrough.main` (the adapter worker is a build artifact and does not exist until `vite build` runs), keep `sveltekit()` in `vite.config.ts`, and compose `devflare/sveltekit` into `src/hooks.server.ts` so local platform bindings line up with the Worker runtime Devflare manages.
4200
4200
 
4201
4201
  | Field | Value |
4202
4202
  | --- | --- |
@@ -4212,14 +4212,16 @@ This is the path for full SvelteKit apps where the framework owns the outer shel
4212
4212
  | Fact | Value |
4213
4213
  | --- | --- |
4214
4214
  | Best for | Full SvelteKit apps that deploy through Devflare |
4215
- | Worker entry | The adapter worker output your package actually emits, commonly `.svelte-kit/cloudflare/_worker.js` or a repo-specific path such as `.adapter-cloudflare/_worker.js` |
4215
+ | Worker entry | The adapter worker output your package actually emits, commonly `.svelte-kit/cloudflare/_worker.js` or a repo-specific path such as `.adapter-cloudflare/_worker.js`, wired via `wrangler.passthrough.main` |
4216
4216
  | Hook helper | `devflare/sveltekit` |
4217
4217
 
4218
4218
  #### Wire the SvelteKit package like a SvelteKit app first
4219
4219
 
4220
4220
  SvelteKit still owns the app shell, routing, and framework build. Devflare plugs Worker-aware config, generated Wrangler output, and any Durable Object discovery into that Vite-driven flow.
4221
4221
 
4222
- Keep Devflare aligned with the adapter output your package actually emits. Many packages do that with `files.fetch` and an adapter default such as `.svelte-kit/cloudflare/_worker.js`. The documentation app in this repository instead points `wrangler.passthrough.main` at its configured `.adapter-cloudflare/_worker.js` output, which is equally valid when the package already owns the adapter worker directly.
4222
+ The adapter worker is a **build artifact** — `@sveltejs/adapter-cloudflare` only writes `.svelte-kit/cloudflare/_worker.js` (or your repo's equivalent, like `.adapter-cloudflare/_worker.js`) during `vite build`. Devflare resolves handler paths *before* the framework build runs, so pointing `files.fetch` at that path fails on a clean checkout with `Configured fetch handler "…" was not found`. Use `wrangler.passthrough.main` instead: devflare skips composition entirely for the worker entry, and wrangler picks up the adapter output post-build.
4223
+
4224
+ If you also have queue handlers, scheduled handlers, durable objects, or routes, keep those in `files.queue` / `files.scheduled` / `files.durableObjects` / `files.routes` as normal source files — composition still applies to those surfaces.
4223
4225
 
4224
4226
  ##### Example — `devflare.config.ts`
4225
4227
 
@@ -4229,8 +4231,16 @@ import { defineConfig } from 'devflare/config'
4229
4231
  export default defineConfig({
4230
4232
  name: 'notes-app',
4231
4233
  files: {
4232
- fetch: '.svelte-kit/cloudflare/_worker.js',
4234
+ // fetch is supplied by SvelteKit's adapter output below;
4235
+ // keep this false so devflare does not try to compose around an unbuilt artifact.
4236
+ fetch: false,
4233
4237
  durableObjects: 'src/do/**/*.ts'
4238
+ },
4239
+ wrangler: {
4240
+ passthrough: {
4241
+ // SvelteKit's @sveltejs/adapter-cloudflare writes this file during vite build.
4242
+ main: '.svelte-kit/cloudflare/_worker.js'
4243
+ }
4234
4244
  }
4235
4245
  })
4236
4246
  ```
@@ -0,0 +1,54 @@
1
+ import {
2
+ prepareBuildArtifacts
3
+ } from "./index-xec4p3v5.js";
4
+ import"./index-aabgympv.js";
5
+ import"./index-z9gy8w6b.js";
6
+ import"./index-7e359eb5.js";
7
+ import"./index-gn5wy09x.js";
8
+ import"./index-6h8xbs75.js";
9
+ import {
10
+ createCliTheme,
11
+ cyanBold,
12
+ dim,
13
+ logLine
14
+ } from "./index-stgn34cr.js";
15
+ import"./index-3t6rypgc.js";
16
+ import"./index-t4fhcx1n.js";
17
+ import"./index-fgk87mk2.js";
18
+ import"./index-3e7by9sy.js";
19
+ import"./index-rbht7m9r.js";
20
+ import"./index-65e7xx1a.js";
21
+ import"./index-vhqww6tt.js";
22
+ import"./index-kawa49m8.js";
23
+ import"./index-5vzcszr2.js";
24
+ import"./index-1d4jg11n.js";
25
+ import"./index-mg8vwqxf.js";
26
+ import"./index-c0whkev9.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,5 +1,6 @@
1
1
  import { type ConsolaInstance } from 'consola';
2
2
  import type { CliOptions, ParsedArgs } from '../index';
3
+ import type { FileSystem } from '../dependencies';
3
4
  import { type DevflareConfig } from '../../config';
4
5
  import { type WranglerConfig } from '../../config/compiler';
5
6
  import { type EffectiveViteProjectDetection } from '../../vite';
@@ -22,6 +23,18 @@ export declare function getViteBuildCleanupTargets(cwd: string, wranglerConfig:
22
23
  export declare function createDeferredCleanupPath(targetPath: string, uniqueSuffix?: string): string;
23
24
  export declare function removePathWithRetries(targetPath: string, logger: ConsolaInstance, attempts?: number, cleanupFs?: CleanupFileSystem): Promise<void>;
24
25
  export declare function cleanupViteBuildOutputs(cwd: string, wranglerConfig: WranglerConfig, logger: ConsolaInstance): Promise<void>;
26
+ export declare function resolveLocalViteExecutable(cwd: string, fs: FileSystem): Promise<string>;
27
+ /**
28
+ * Walk up the directory tree from `startDir` looking for
29
+ * `node_modules/<segments>`. Returns the first match or null.
30
+ *
31
+ * This preserves the workspace-local (symlinked) path rather than the
32
+ * package manager's underlying cache realpath, which matters for Node
33
+ * package resolution semantics under Bun on Windows.
34
+ */
35
+ export declare function findWorkspaceLocalBinary(startDir: string, fs: FileSystem, segments: readonly string[]): Promise<string | null>;
36
+ /** True when the current process is Bun (and `bun` is therefore on PATH). */
37
+ export declare function isRunningUnderBun(): boolean;
25
38
  export declare function prepareBuildArtifacts(parsed: ParsedArgs, logger: ConsolaInstance, options: CliOptions): Promise<PreparedBuildArtifactsResult>;
26
39
  export {};
27
40
  //# sourceMappingURL=build-artifacts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-artifacts.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build-artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEtD,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EAKN,KAAK,cAAc,EACnB,MAAM,uBAAuB,CAAA;AAM9B,OAAO,EAGN,KAAK,6BAA6B,EAClC,MAAM,YAAY,CAAA;AAanB,MAAM,WAAW,4BAA4B;IAC5C,MAAM,EAAE,cAAc,CAAA;IACtB,cAAc,EAAE,cAAc,CAAA;IAC9B,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,6BAA6B,CAAA;CAC1C;AAMD,UAAU,iBAAiB;IAC1B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,EAAE,CACD,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QACR,SAAS,EAAE,OAAO,CAAA;QAClB,KAAK,EAAE,OAAO,CAAA;KACd,GACC,OAAO,CAAC,IAAI,CAAC,CAAA;CAChB;AAaD,wBAAgB,2BAA2B,CAC1C,GAAG,EAAE,MAAM,EACX,cAAc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G,IAAI,CAAC,CAkBxB;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C;AAED,wBAAsB,qBAAqB,CAC1C,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,4BAA4B,CAAC,CA4JvC"}
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parseArgs,
3
3
  runCli
4
- } from "../index-da397xcx.js";
4
+ } from "../index-dmf76tac.js";
5
5
  import"../index-6h8xbs75.js";
6
6
  import"../index-stgn34cr.js";
7
7
  import"../index-3t6rypgc.js";