@lunora/vite 1.0.0-alpha.18 → 1.0.0-alpha.180

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 (33) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +19 -2
  3. package/dist/index.d.mts +434 -263
  4. package/dist/index.d.ts +434 -263
  5. package/dist/index.mjs +3 -155
  6. package/dist/packem_shared/CLASS_A_WIRING-N5ktvdUV.mjs +33 -0
  7. package/dist/packem_shared/DEV_WORKER_ENV_VALUE-CaO3rUSk.mjs +1 -0
  8. package/dist/packem_shared/LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs +1 -0
  9. package/dist/packem_shared/STUDIO_PATH-xwt4m9UW.mjs +1 -0
  10. package/dist/packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs +5 -0
  11. package/dist/packem_shared/checkLunoraProxy-C9M8c5eS.mjs +1 -0
  12. package/dist/packem_shared/codegenPlugin-BIAKVRnd.mjs +3 -0
  13. package/dist/packem_shared/containerLogsPlugin-CWkqSCL3.mjs +1 -0
  14. package/dist/packem_shared/devStatePlugin-CcFV-eBl.mjs +1 -0
  15. package/dist/packem_shared/devVariablesPlugin-DDvQh3l6.mjs +1 -0
  16. package/dist/packem_shared/log-DE48L4Oz.mjs +1 -0
  17. package/dist/packem_shared/logStreamPlugin-DtOu5VX8.mjs +3 -0
  18. package/dist/packem_shared/lunoraSolutionFinder--J0x2mAM.mjs +1 -0
  19. package/dist/packem_shared/planViteRemoteBindings-BKGgYFk4.mjs +1 -0
  20. package/dist/packem_shared/server-close-Qoh4i6Ay.mjs +1 -0
  21. package/dist/packem_shared/wranglerValidatorPlugin-Dma0xUy2.mjs +3 -0
  22. package/package.json +8 -9
  23. package/dist/packem_shared/CLASS_A_WIRING-CZVcjgKo.mjs +0 -106
  24. package/dist/packem_shared/DEV_WORKER_ENV_VALUE-Coo6bgVz.mjs +0 -36
  25. package/dist/packem_shared/STUDIO_PATH-5ppCdBHa.mjs +0 -210
  26. package/dist/packem_shared/WORKER_STARTUP_HINT-DhsXUW8k.mjs +0 -81
  27. package/dist/packem_shared/codegenPlugin-MuvbqAP8.mjs +0 -218
  28. package/dist/packem_shared/devVariablesPlugin-CDNSnvOP.mjs +0 -19
  29. package/dist/packem_shared/log-BjO9EWah.mjs +0 -8
  30. package/dist/packem_shared/logStreamPlugin-CqvZ17kd.mjs +0 -61
  31. package/dist/packem_shared/planViteRemoteBindings-QN5ncUS1.mjs +0 -50
  32. package/dist/packem_shared/reconcileWranglerCrons-PxGwfCp_.mjs +0 -29
  33. package/dist/packem_shared/wranglerValidatorPlugin-CEoJEghS.mjs +0 -66
package/dist/index.d.mts CHANGED
@@ -1,183 +1,258 @@
1
1
  import { CodegenOptions } from '@lunora/codegen';
2
2
  import errorOverlayPlugin from '@visulima/vite-overlay';
3
3
  import { Plugin } from 'vite';
4
- import { FrameworkDetection, DetectedFramework, materializeRemoteWranglerConfig, readProjectRemotePreference } from '@lunora/config';
4
+ import { FrameworkDetection, DetectedFramework, readProjectRemotePreference } from '@lunora/config';
5
5
  export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, detectFramework } from '@lunora/config';
6
+ import { materializeRemoteWranglerConfig } from '@lunora/config/cloudflare';
7
+ export { type ReconcileCronsResult as ReconcileResult, reconcileWranglerCrons } from '@lunora/config/cloudflare';
6
8
  import { AddressInfo } from 'node:net';
7
9
  /** Options forwarded to `@cloudflare/vite-plugin`'s cloudflare plugin. */
8
10
  type CloudflarePluginOptions = Record<string, unknown>;
9
11
  /**
10
- * Options forwarded to `@visulima/vite-overlay`'s error-overlay plugin. Derived
11
- * from the plugin's own factory signature so it tracks the real shape
12
- * (`forwardConsole`, `forwardedConsoleMethods`, `reactPluginName`,
13
- * `solutionFinders`, `showBallonButton`, `vuePluginName`, …).
14
- */
12
+ * Options forwarded to `@visulima/vite-overlay`'s error-overlay plugin. Derived
13
+ * from the plugin's own factory signature so it tracks the real shape
14
+ * (`forwardConsole`, `forwardedConsoleMethods`, `reactPluginName`,
15
+ * `solutionFinders`, `showBallonButton`, `vuePluginName`, …).
16
+ */
15
17
  type OverlayPluginOptions = NonNullable<Parameters<typeof errorOverlayPlugin>[0]>;
18
+ /**
19
+ * Shard Durable Object configuration for the AUTO-COMPOSED class-A worker.
20
+ *
21
+ * A class-A app (TanStack Start, vinext, React Router, SolidStart) has no
22
+ * hand-written worker entry — that is what makes it class A — so it never calls
23
+ * the generated `defineApp()` builder and never reaches `createShardDO(config)`.
24
+ * The composed entry emitted `createShardDO()` bare, which left `cdc` and the
25
+ * whole reactive query cache unreachable for every class-A template no matter
26
+ * what the app wanted. `vite.config.ts` is the one place such an app configures
27
+ * Lunora, so it is where these land — the same route
28
+ * {@link LunoraPluginOptions.allowUnauthenticatedShardAccess} already takes into
29
+ * the same emitted entry.
30
+ *
31
+ * Deliberately only the PLAIN-DATA half of the generated `ShardDOConfig`. The
32
+ * rest of that type is `(env) => …` factories (`scheduler`, `storage`,
33
+ * `vectors`, …) which cannot be written in a config object and which a class-A
34
+ * app reaches by writing its own entry instead.
35
+ *
36
+ * Ignored for class B/C: those pass their config to `createShardDO` directly (or
37
+ * through `defineApp`), and an explicit argument there is unaffected by this.
38
+ */
39
+ interface LunoraShardConfig {
40
+ /** Opt into change-data-capture: every write records a post-image to `__cdc_log`. Backs streaming export, replay-PITR, and shard-local `defineShape` replication. Off by default. */
41
+ cdc?: boolean;
42
+ /** Ceiling on the join keys one relation-crossing `where` predicate may pre-resolve via semijoin before failing closed. Omit for the engine default. */
43
+ maxRelationKeys?: number;
44
+ /**
45
+ * Enable the per-shard reactive query cache: `true` for the defaults, or an
46
+ * options object to tune the caps. Query results are memoized by
47
+ * `(functionPath, args, identity)` and invalidated by the ctx-db write hooks
48
+ * before the subscription broadcast, so a subscriber never observes a
49
+ * pre-write value. Omitted (or `false`) keeps every dispatch re-running its
50
+ * handler.
51
+ */
52
+ reactiveCache?: boolean | {
53
+ maxBytes?: number;
54
+ maxEntries?: number;
55
+ };
56
+ /** Resolution policy for a relation-crossing `where` whose child is co-located in this shard: `"auto"` (cost-based, the engine default), `"always"` (inline correlated EXISTS) or `"never"` (universal semijoin). All three return identical rows. */
57
+ relationExistsPushDown?: "always" | "auto" | "never";
58
+ }
16
59
  interface LunoraPluginOptions {
17
60
  /**
18
- * Which machine-readable API spec(s) codegen emits into `_generated/`.
19
- * `"openapi"` (default) writes `openapi.json` (OpenAPI 3.1; RPC + REST),
20
- * `"openrpc"` writes `openrpc.json` (OpenRPC 1.x; RPC-only), `"both"` writes
21
- * both, and `"none"` writes neither. Forwarded to `runCodegen({ apiSpec })`;
22
- * the value set is derived from `CodegenOptions` so it can't drift.
23
- */
61
+ * Allow a client-named NON-default shard / cross-shard fan-out WITHOUT an
62
+ * `authorizeShard`/`authorizeFanOut` callback. The auto-composed class-A worker
63
+ * (`virtual:lunora/worker`) default-denies such access (403 `FORBIDDEN_SHARD`);
64
+ * set this `true` to opt into open access — only safe when every table is
65
+ * protected by per-row RLS. A production sharded app should configure
66
+ * `authorizeShard` instead (via a hand-written class-B worker). Defaults to `false`.
67
+ */
68
+ allowUnauthenticatedShardAccess?: boolean;
69
+ /**
70
+ * Which machine-readable API spec(s) codegen emits into `_generated/`.
71
+ * `"openapi"` (default) writes `openapi.json` (OpenAPI 3.1; RPC + REST),
72
+ * `"openrpc"` writes `openrpc.json` (OpenRPC 1.x; RPC-only), `"both"` writes
73
+ * both, and `"none"` writes neither. Forwarded to `runCodegen({ apiSpec })`;
74
+ * the value set is derived from `CodegenOptions` so it can't drift.
75
+ */
24
76
  apiSpec?: CodegenOptions["apiSpec"];
25
77
  /** Pass through to `@cloudflare/vite-plugin`. Pass `false` to opt out. Defaults to `true`. */
26
78
  cloudflare?: boolean | CloudflarePluginOptions;
27
- /** Directory name (relative to `projectRoot`) where generated files are written. Defaults to `"lunora/_generated"`. */
28
- generatedDir?: string;
29
79
  /**
30
- * Inject `@visulima/vite-overlay` for runtime errors (dev only). Pass
31
- * `false` to opt out, or an options object to forward to the overlay.
32
- * Defaults to `true`.
33
- */
80
+ * Inject `@visulima/vite-overlay` for runtime errors (dev only). Pass
81
+ * `false` to opt out, or an options object to forward to the overlay.
82
+ * Defaults to `true`.
83
+ */
34
84
  overlay?: boolean | OverlayPluginOptions;
35
85
  /** Project root containing the `lunora/` directory. Defaults to `process.cwd()`. */
36
86
  projectRoot?: string;
37
87
  /** Directory name (relative to `projectRoot`) containing `schema.ts` and function files. Defaults to `"lunora"`. */
38
88
  schemaDir?: string;
89
+ /**
90
+ * Shard DO configuration baked into the auto-composed class-A worker entry —
91
+ * see {@link LunoraShardConfig}. The ONLY way a class-A app can set `cdc` or
92
+ * enable the reactive query cache, since it has no worker entry to call
93
+ * `createShardDO(config)` from. Ignored for class B/C. Defaults to `{}`
94
+ * (byte-identical composed output).
95
+ */
96
+ shard?: LunoraShardConfig;
39
97
  /** Serve the Lunora studio at `/__lunora` during dev. Pass `false` to opt out. Defaults to `true`. */
40
98
  studio?: boolean;
99
+ /**
100
+ * Deploy target the emitted `ctx.*` surface is tailored to. Defaults to
101
+ * `"target"` in `lunora.json`, then `"cloudflare"` — so an existing project
102
+ * emits byte-identical output.
103
+ *
104
+ * Set it here only to override the project config for one build — keeping
105
+ * this and `lunora deploy` on the same target is what the shared resolution
106
+ * in `@lunora/config` exists to guarantee.
107
+ */
108
+ target?: string;
41
109
  /** Validate that `wrangler.jsonc` declares the bindings the schema implies. Defaults to `true`. */
42
110
  validateWrangler?: boolean;
43
111
  }
44
112
  /** Resolved options after merging defaults. */
45
113
  interface ResolvedLunoraPluginOptions {
114
+ allowUnauthenticatedShardAccess: boolean;
46
115
  apiSpec: NonNullable<CodegenOptions["apiSpec"]>;
47
116
  cloudflare: false | CloudflarePluginOptions;
117
+ /**
118
+ * Where codegen writes `_generated/*`, always `<schemaDir>/_generated`.
119
+ *
120
+ * NOT a user option: codegen hardcodes that path (`run-codegen` joins
121
+ * `lunoraDirectory` with `"_generated"`), so a settable override was a no-op
122
+ * everywhere except `frameworkComposePlugin`, which uses it as the composed
123
+ * class-A worker's import base — where a non-default value pointed the
124
+ * emitted imports at a directory nothing writes and broke class-A dev and
125
+ * build. Derived, so the import base cannot disagree with the emitter.
126
+ */
48
127
  generatedDir: string;
49
128
  overlay: false | OverlayPluginOptions;
50
129
  projectRoot: string;
51
130
  schemaDir: string;
131
+ shard: LunoraShardConfig;
52
132
  studio: boolean;
133
+ target: string;
53
134
  validateWrangler: boolean;
54
135
  }
55
136
  /**
56
- * The plugins `lunora()` returns. A mutable `Plugin[]` (not `ReadonlyArray`) so
57
- * it slots directly into Vite's `plugins` — which recursively flattens nested
58
- * plugin arrays — without a spread: `plugins: [lunora()]`.
59
- */
137
+ * The plugins `lunora()` returns. A mutable `Plugin[]` (not `ReadonlyArray`) so
138
+ * it slots directly into Vite's `plugins` — which recursively flattens nested
139
+ * plugin arrays — without a spread: `plugins: [lunora()]`.
140
+ */
60
141
  type LunoraPlugins = Plugin[];
61
142
  /**
62
- * Vite plugin that runs `@lunora/codegen` on startup and on file changes
63
- * inside the lunora schema directory.
64
- */
143
+ * Vite plugin that runs `@lunora/codegen` on startup and on file changes
144
+ * inside the lunora schema directory.
145
+ */
65
146
  declare const codegenPlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
66
- interface ReconcileResult {
67
- /** `true` when `wrangler.jsonc` was rewritten. */
68
- changed: boolean;
69
- /** Human-readable reason when reconciliation was skipped (for logging). */
70
- reason?: string;
71
- /** Resolved wrangler path, or `undefined` when none was found. */
72
- wranglerPath?: string;
73
- }
74
147
  /**
75
- * Reconcile the codegen-derived cron schedules into the project's
76
- * `wrangler.jsonc` `triggers.crons` array, preserving comments and formatting
77
- * via `jsonc-parser`'s structural edits.
78
- *
79
- * When `triggers.crons` already matches `cronTriggers`, nothing is written (so
80
- * we don't churn the file or trip the dev server's file watcher). When the
81
- * project declares no crons, a stale non-empty array is cleared so removed
82
- * crons stop firing.
83
- *
84
- * This intentionally writes the SAME `triggers.crons` shape the
85
- * `@lunora/config` validator accepts, so the wrangler validator never fights
86
- * the generated value.
87
- */
88
- declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: ReadonlyArray<string>) => ReconcileResult;
89
- /**
90
- * Dev-only Vite plugin that prepares `.dev.vars` before the worker boots.
91
- * `@cloudflare/vite-plugin` loads `.dev.vars` into the worker's `env`, but the
92
- * file is gitignored — so a fresh clone has none and the worker throws on the
93
- * first required secret (e.g. `AUTH_SECRET is required`). Two steps, both shared
94
- * with `lunora dev` via `@lunora/config`.
95
- *
96
- * First, {@link ensureDevVariables}: when a `.dev.vars.example` exists, prompt
97
- * to generate `.dev.vars` from it with secrets auto-filled. Second,
98
- * {@link fillDevSecrets}: fill any empty/placeholder secret already in
99
- * `.dev.vars` (a `lunora add`-scaffolded project writes secrets blank) and
100
- * ensure `LUNORA_ADMIN_TOKEN` is present + generated — so the worker boots with
101
- * working secrets and the Studio authenticates without its login gate. No
102
- * prompt: it only generates locally-derivable values and never overwrites a real
103
- * one.
104
- *
105
- * Runs in `configResolved` (awaited by Vite) so it completes before the
106
- * Cloudflare plugin reads the file. Non-interactive runs decline silently.
107
- */
148
+ * Dev-only plugin that tails the local dev containers' own stdout/stderr in the
149
+ * Vite terminal.
150
+ *
151
+ * `@cloudflare/vite-plugin` builds and runs each declared container locally via
152
+ * Docker (image `cloudflare-dev/<class>:<id>`) but only forwards the *worker's*
153
+ * console — the container process's own output is otherwise invisible. This
154
+ * plugin attaches to those Docker log streams (via `@lunora/config`'s
155
+ * `streamContainerLogs`, which lazy-loads `dockerode`) and prints each line
156
+ * through Vite's logger, branded and tagged `container:<name>`.
157
+ *
158
+ * A no-op when the project declares no containers (the common case): discovery
159
+ * returns an empty list, so `dockerode` is never imported and no Docker work
160
+ * starts. Set `LUNORA_CONTAINER_LOGS=0` to opt out. A missing/stopped Docker
161
+ * engine degrades to a single warning rather than breaking dev.
162
+ */
163
+ declare const containerLogsPlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
164
+ /** Vite plugin (serve-only) that writes the dev-server state record on listen and clears it on close. */
165
+ declare const devStatePlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
166
+ /**
167
+ * Dev-only Vite plugin that prepares `.dev.vars` before the worker boots.
168
+ * `@cloudflare/vite-plugin` loads `.dev.vars` into the worker's `env`, but the
169
+ * file is gitignored — so a fresh clone has none and the worker throws on the
170
+ * first required secret (e.g. `AUTH_SECRET is required`). Two steps, both shared
171
+ * with `lunora dev` via `@lunora/config`.
172
+ *
173
+ * First, {@link ensureDevVariables}: when a `.dev.vars.example` exists, prompt
174
+ * to generate `.dev.vars` from it with secrets auto-filled. Second,
175
+ * {@link fillDevSecrets}: fill any empty/placeholder secret already in
176
+ * `.dev.vars` (a `lunora add`-scaffolded project writes secrets blank) and
177
+ * ensure `LUNORA_ADMIN_TOKEN` is present + generated — so the worker boots with
178
+ * working secrets and the Studio authenticates without its login gate. No
179
+ * prompt: it only generates locally-derivable values and never overwrites a real
180
+ * one.
181
+ *
182
+ * Runs in `configResolved` (awaited by Vite) so it completes before the
183
+ * Cloudflare plugin reads the file. Non-interactive runs decline silently.
184
+ */
108
185
  declare const devVariablesPlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
109
186
  /**
110
- * Worker env var the dev tooling sets so the Lunora runtime recognises a
111
- * development deployment (`@lunora/do`'s `isDevEnvironment`) and therefore
112
- * streams every RPC dispatch summary to the terminal by default — the
113
- * `lunora dev` CLI sets the same var via `wrangler dev --var`.
114
- *
115
- * It is injected ONLY during `vite` serve, never a production `vite build`, so
116
- * it can never leak into a deployed worker. A `WORKER_ENV` the user already
117
- * declares (in `wrangler.jsonc` `[vars]` or `.dev.vars`) takes precedence, so
118
- * this only fills the gap when none is set.
119
- */
187
+ * Worker env var the dev tooling sets so the Lunora runtime recognises a
188
+ * development deployment (`@lunora/do`'s `isDevEnvironment`) and therefore
189
+ * streams every RPC dispatch summary to the terminal by default — the
190
+ * `lunora dev` CLI sets the same var via `wrangler dev --var`.
191
+ *
192
+ * It is injected ONLY during `vite` serve, never a production `vite build`, so
193
+ * it can never leak into a deployed worker. A `WORKER_ENV` the user already
194
+ * declares (in `wrangler.jsonc` `[vars]` or `.dev.vars`) takes precedence, so
195
+ * this only fills the gap when none is set.
196
+ */
120
197
  declare const DEV_WORKER_ENV_VAR = "WORKER_ENV";
121
198
  declare const DEV_WORKER_ENV_VALUE = "development";
122
- /** The structural slice of `@cloudflare/vite-plugin`'s worker config we read/write. */
123
- /**
124
- * Wrap the cloudflare-plugin options so the dev worker's `vars` gain a
125
- * `WORKER_ENV` of `development` when — and only when — `isServe()` reports a
126
- * `vite` serve. Any `config` customizer the caller already supplied is
127
- * preserved and applied first; an existing `WORKER_ENV` wins, so a user
128
- * override is never clobbered.
129
- */
199
+ /**
200
+ * Wrap the cloudflare-plugin options so the dev worker's `vars` gain a
201
+ * `WORKER_ENV` of `development` when — and only when — `isServe()` reports a
202
+ * `vite` serve. Any `config` customizer the caller already supplied is
203
+ * preserved and applied first; an existing `WORKER_ENV` wins, so a user
204
+ * override is never clobbered.
205
+ */
130
206
  declare const withDevWorkerEnv: (options: CloudflarePluginOptions, isServe: () => boolean) => CloudflarePluginOptions;
131
207
  /**
132
- * A Vite plugin that captures the resolved command (`serve` vs `build`) so
133
- * {@link withDevWorkerEnv} injects the dev var only during `vite`, plus an
134
- * `isServe` probe sharing the same closure. `enforce: "pre"` so the command is
135
- * captured before the cloudflare plugin resolves its worker config.
136
- */
208
+ * A Vite plugin that captures the resolved command (`serve` vs `build`) so
209
+ * {@link withDevWorkerEnv} injects the dev var only during `vite`, plus an
210
+ * `isServe` probe sharing the same closure. `enforce: "pre"` so the command is
211
+ * captured before the cloudflare plugin resolves its worker config.
212
+ */
137
213
  declare const createCommandProbe: () => {
138
214
  isServe: () => boolean;
139
215
  plugin: Plugin;
140
216
  };
141
217
  /**
142
- * Mutable, plugin-shared context. The `lunora()` factory creates one instance
143
- * and threads it through every Lunora sub-plugin, so detection runs once and
144
- * downstream plugins (codegen, composition, the dev hint) read the same result
145
- * without re-scanning `package.json`. PLAN4 §2.4.
146
- */
218
+ * Mutable, plugin-shared context. The `lunora()` factory creates one instance
219
+ * and threads it through every Lunora sub-plugin, so detection runs once and
220
+ * downstream plugins (codegen, composition, the dev hint) read the same result
221
+ * without re-scanning `package.json`. PLAN4 §2.4.
222
+ */
147
223
  interface LunoraPluginContext {
148
224
  /** The detected framework + class, populated during `config` / `configResolved`. `undefined` until detection runs. */
149
225
  framework?: FrameworkDetection;
150
226
  }
151
- /** Create an empty shared context object for one `lunora()` invocation. */
152
- /**
153
- * The virtual module id the Lunora plugin resolves to a generated, class-A
154
- * worker entry. A class-A template points its wrangler `main` at this id (or
155
- * re-exports it from a one-line `src/server.ts`) and never hand-writes
156
- * `createWorker({ httpRouter })` — the plugin composes the framework's SSR
157
- * handler under `composeWorker`'s `httpRouter` seam for it.
158
- *
159
- * Exposed publicly so `@lunora/cli`'s build/deploy path and the templates can
160
- * reference the same constant rather than re-typing the literal.
161
- */
227
+ /**
228
+ * The virtual module id the Lunora plugin resolves to a generated, class-A
229
+ * worker entry. A class-A template points its wrangler `main` at this id (or
230
+ * re-exports it from a one-line `src/server.ts`) and never hand-writes
231
+ * `createWorker({ httpRouter })` — the plugin composes the framework's SSR
232
+ * handler under `composeWorker`'s `httpRouter` seam for it.
233
+ *
234
+ * Exposed publicly so `@lunora/cli`'s build/deploy path and the templates can
235
+ * reference the same constant rather than re-typing the literal.
236
+ */
162
237
  declare const LUNORA_WORKER_VIRTUAL_ID: string;
163
238
  /**
164
- * Per-class-A-framework wiring the generated worker entry needs: how to obtain
165
- * the framework's SSR handler as a `composeWorker`-compatible `httpRouter`.
166
- *
167
- * `imports` is the full import statement(s) the generated entry needs (each
168
- * framework controls its own import shape — a namespace import, or a named one);
169
- * `handler` is a JS expression (evaluated in the generated module's scope, where
170
- * `imports`' symbols are in scope) that yields an `HttpRouterLike`
171
- * (`{ fetch(request, env?, ctx?) }`). Both are data — not codegen branches — so
172
- * the set of supported class-A frameworks is one readable table and adding a
173
- * framework is a pure data edit.
174
- *
175
- * Honesty note: these handler expressions encode each framework's *documented*
176
- * Cloudflare SSR-handler shape — the same expressions the hand-wired template
177
- * entries use today (React Router's `createRequestHandler` over its virtual
178
- * server build; SolidStart's `cloudflare-module` handler; TanStack Start's
179
- * server entry). The plugin just emits them so the developer doesn't.
180
- */
239
+ * Per-class-A-framework wiring the generated worker entry needs: how to obtain
240
+ * the framework's SSR handler as a `composeWorker`-compatible `httpRouter`.
241
+ *
242
+ * `imports` is the full import statement(s) the generated entry needs (each
243
+ * framework controls its own import shape — a namespace import, or a named one);
244
+ * `handler` is a JS expression (evaluated in the generated module's scope, where
245
+ * `imports`' symbols are in scope) that yields an `HttpRouterLike`
246
+ * (`{ fetch(request, env?, ctx?) }`). Both are data — not codegen branches — so
247
+ * the set of supported class-A frameworks is one readable table and adding a
248
+ * framework is a pure data edit.
249
+ *
250
+ * Honesty note: these handler expressions encode each framework's *documented*
251
+ * Cloudflare SSR-handler shape — the same expressions the hand-wired template
252
+ * entries use today (React Router's `createRequestHandler` over its virtual
253
+ * server build; SolidStart's `cloudflare-module` handler; TanStack Start's
254
+ * server entry). The plugin just emits them so the developer doesn't.
255
+ */
181
256
  interface ClassAWiring {
182
257
  /** JS expression yielding the `httpRouter` ({ fetch }), referencing symbols brought in by `imports`. */
183
258
  handler: string;
@@ -186,62 +261,103 @@ interface ClassAWiring {
186
261
  }
187
262
  declare const CLASS_A_WIRING: Readonly<Partial<Record<DetectedFramework, ClassAWiring>>>;
188
263
  /**
189
- * Whether the detected framework is one the plugin can auto-compose. Only
190
- * class-A frameworks with a known SSR-handler wiring qualify; everything else
191
- * (class B/C, `none`) falls back to the existing flow.
192
- */
264
+ * Whether the detected framework is one the plugin can auto-compose. Only
265
+ * class-A frameworks with a known SSR-handler wiring qualify; everything else
266
+ * (class B/C, `none`) falls back to the existing flow.
267
+ */
193
268
  declare const isAutoComposable: (context: LunoraPluginContext) => boolean;
194
269
  /**
195
- * Build the source of the virtual class-A worker entry. Pure (no fs / no Vite),
196
- * so the emitted composition is unit-testable in isolation.
197
- *
198
- * The emitted module imports the framework SSR handler + the project's
199
- * generated artifacts (functions registry, OpenAPI doc, `createShardDO`) and
200
- * composes them through `composeWorker` — reserved `/_lunora/*` paths route to
201
- * Lunora, everything else falls through to the framework SSR handler. The
202
- * `generatedImportBase` MUST be an absolute filesystem path to the `_generated`
203
- * directory. Virtual modules have no real filesystem path, so relative specifiers
204
- * like `./lunora/_generated/functions` cannot be resolved by Vite/rolldown from a
205
- * virtual module id. Absolute paths are resolved correctly in all environments
206
- * (Vite 8 + rolldown 1.x confirmed).
207
- */
208
- declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, hasContainers?: boolean, useUmbrella?: boolean) => string;
209
- /**
210
- * Vite plugin that auto-composes a detected class-A meta-framework's SSR
211
- * handler with Lunora into one Cloudflare Worker (PLAN4 §2.4 / §3 class-A row).
212
- *
213
- * Mechanism: it resolves the {@link LUNORA_WORKER_VIRTUAL_ID} virtual module to
214
- * a generated worker entry that wires the framework SSR handler under
215
- * `composeWorker`'s `httpRouter` seam — so the developer never writes
216
- * `createWorker({ httpRouter })`. The composed worker is an ordinary module
217
- * entry, so it HMRs under `@cloudflare/vite-plugin` exactly like a hand-written
218
- * one (PLAN4 M5 risk #5): the virtual entry only imports the framework handler
219
- * and the generated artifacts, both of which the framework's plugin + codegen
220
- * already make HMR-aware.
221
- *
222
- * Safety: it is a strict no-op unless `context.framework.class === "A"` with a
223
- * known wiring. For class-C (SPA) projects and undetected frameworks it
224
- * resolves/loads nothing. `cloudflare: false` does NOT disable the virtual
225
- * entry — it only means "don't add the Cloudflare Vite plugin a second time"
226
- * (the user supplied it themselves); the composed worker must still be
227
- * resolvable so the user-supplied CF plugin can find the wrangler `main`.
228
- */
270
+ * The `_generated/` modules whose exported classes wrangler validates a
271
+ * `class_name` against: container Durable Objects, workflow entrypoints, and
272
+ * agent (workflow) entrypoints — the same three kinds `reconcile-bindings`
273
+ * writes into `wrangler.jsonc`. The composed entry star-re-exports each module
274
+ * the project actually has.
275
+ */
276
+ declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "workflows"];
277
+ /** One {@link GENERATED_CLASS_MODULES} entry. */
278
+ type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
279
+ /**
280
+ * Build the source of the virtual class-A worker entry. Pure (no fs / no Vite),
281
+ * so the emitted composition is unit-testable in isolation.
282
+ *
283
+ * The emitted module imports the framework SSR handler + the project's
284
+ * generated artifacts (functions registry, OpenAPI doc, `createShardDO`) and
285
+ * composes them through `composeWorker` — reserved `/_lunora/*` paths route to
286
+ * Lunora, everything else falls through to the framework SSR handler. The
287
+ * `generatedImportBase` MUST be an absolute filesystem path to the `_generated`
288
+ * directory. Virtual modules have no real filesystem path, so relative specifiers
289
+ * like `./lunora/_generated/functions` cannot be resolved by Vite/rolldown from a
290
+ * virtual module id. Absolute paths are resolved correctly in all environments
291
+ * (Vite 8 + rolldown 1.x confirmed).
292
+ */
293
+ declare const buildWorkerEntrySource: (framework: DetectedFramework, generatedImportBase: string, classModules?: ReadonlyArray<GeneratedClassModule>, useUmbrella?: boolean, allowUnauthenticatedShardAccess?: boolean, shard?: LunoraShardConfig) => string;
294
+ /**
295
+ * Vite plugin that auto-composes a detected class-A meta-framework's SSR
296
+ * handler with Lunora into one Cloudflare Worker (PLAN4 §2.4 / §3 class-A row).
297
+ *
298
+ * Mechanism: it resolves the {@link LUNORA_WORKER_VIRTUAL_ID} virtual module to
299
+ * a generated worker entry that wires the framework SSR handler under
300
+ * `composeWorker`'s `httpRouter` seam — so the developer never writes
301
+ * `createWorker({ httpRouter })`. The composed worker is an ordinary module
302
+ * entry, so it HMRs under `@cloudflare/vite-plugin` exactly like a hand-written
303
+ * one (PLAN4 M5 risk #5): the virtual entry only imports the framework handler
304
+ * and the generated artifacts, both of which the framework's plugin + codegen
305
+ * already make HMR-aware.
306
+ *
307
+ * Safety: it is a strict no-op unless `context.framework.class === "A"` with a
308
+ * known wiring. For class-C (SPA) projects and undetected frameworks it
309
+ * resolves/loads nothing. `cloudflare: false` does NOT disable the virtual
310
+ * entry — it only means "don't add the Cloudflare Vite plugin a second time"
311
+ * (the user supplied it themselves); the composed worker must still be
312
+ * resolvable so the user-supplied CF plugin can find the wrangler `main`.
313
+ */
229
314
  declare const frameworkComposePlugin: (options: ResolvedLunoraPluginOptions, context: LunoraPluginContext) => Plugin;
230
315
  /**
231
- * Vite plugin (serve-only) that formats Lunora worker logs in the terminal.
232
- * Patches `process.stdout`/`process.stderr` once the dev server is configured
233
- * and restores them when it closes.
234
- */
316
+ * The custom HMR event the Lunora Vite plugin sends on the client environment's
317
+ * hot channel after a successful codegen run, in place of the old blanket
318
+ * browser `full-reload`. The generated `api`/`server` modules are just
319
+ * `FunctionReference` metadata, so Vite's granular module HMR re-imports the
320
+ * changed `_generated/*` in place; this event is a non-destructive nudge that
321
+ * lets open WebSocket subscriptions, optimistic state, the offline queue, and
322
+ * form state survive a schema save.
323
+ *
324
+ * Kept in its own module (a single source of truth) so the codegen plugin —
325
+ * whose sole export is the plugin factory — can reference it without becoming a
326
+ * mixed default+named module, and so any future client-side listener can agree
327
+ * on the exact string.
328
+ *
329
+ * There is no first-party client listener yet: `@lunora/client` / `@lunora/react`
330
+ * ship as pre-bundled, side-effect-free dependencies where `import.meta.hot` is
331
+ * `undefined` at runtime (Vite's dep optimizer), so a listener there would be
332
+ * dead (and tree-shaken) code. A future app-local or codegen-emitted listener
333
+ * can import this constant to re-validate active queries over the live socket.
334
+ */
335
+ declare const LUNORA_API_UPDATED_EVENT = "lunora:api-updated";
336
+ /**
337
+ * Vite plugin (serve-only) that formats Lunora worker logs in the terminal.
338
+ * Patches `process.stdout`/`process.stderr` fresh for each dev-server generation
339
+ * and restores them when that server closes.
340
+ */
235
341
  declare const logStreamPlugin: () => Plugin;
342
+ /**
343
+ * Warnings for one proxy table. Pure + exported so the behavior is unit-testable
344
+ * without booting a dev server.
345
+ */
346
+ declare const checkLunoraProxy: (proxy: Record<string, unknown> | undefined, label: string) => string[];
347
+ /**
348
+ * Warn when a dev/preview proxy routes `/_lunora/*` without `ws: true` (or with an
349
+ * origin-rewriting `changeOrigin`). See the module docs.
350
+ */
351
+ declare const proxyCheckPlugin: () => Plugin;
236
352
  /** The decision a {@link planViteRemoteBindings} call returns. */
237
353
  interface ViteRemotePlan {
238
354
  /** Idempotent disposer for the temp config; always present + safe to call. */
239
355
  cleanup: () => void;
240
356
  /**
241
- * Absolute path to the materialized temp wrangler config to hand the
242
- * cloudflare plugin's `configPath`, or `undefined` when remote mode is off
243
- * or nothing was materialized (no eligible binding, no wrangler file, …).
244
- */
357
+ * Absolute path to the materialized temp wrangler config to hand the
358
+ * cloudflare plugin's `configPath`, or `undefined` when remote mode is off
359
+ * or nothing was materialized (no eligible binding, no wrangler file, …).
360
+ */
245
361
  configPath?: string;
246
362
  /** Whether remote mode was requested for this dev session. */
247
363
  enabled: boolean;
@@ -260,122 +376,177 @@ interface PlanViteRemoteOptions {
260
376
  remoteEnv?: string;
261
377
  }
262
378
  /**
263
- * Decide whether the Vite dev worker uses remote bindings and, if so,
264
- * materialize the temp config. Pure decision + a single fs write via the
265
- * injected materializer; returns a `cleanup` for the dev server's close hook.
266
- *
267
- * There is no `--remote` flag on the Vite path (Vite has no Lunora CLI flags),
268
- * so the precedence reduces to `LUNORA_REMOTE` env > `lunora.json` `remote`.
269
- */
379
+ * Decide whether the Vite dev worker uses remote bindings and, if so,
380
+ * materialize the temp config. Pure decision + a single fs write via the
381
+ * injected materializer; returns a `cleanup` for the dev server's close hook.
382
+ *
383
+ * There is no `--remote` flag on the Vite path (Vite has no Lunora CLI flags),
384
+ * so the precedence reduces to `LUNORA_REMOTE` env > `lunora.json` `remote`.
385
+ */
270
386
  declare const planViteRemoteBindings: (options: PlanViteRemoteOptions) => ViteRemotePlan;
271
387
  /**
272
- * Wrap the cloudflare-plugin options so the dev worker loads the materialized
273
- * remote temp config (via `configPath`) when — and only when — remote mode is
274
- * on AND it's a `vite` serve. A `configPath` the caller already set wins (their
275
- * explicit choice), and during a production build nothing is injected, so the
276
- * deployed worker is never affected.
277
- *
278
- * Returns the wrapped options plus the plan, so `index.ts` can register the
279
- * cleanup on a close hook. Materialization happens lazily inside the `configPath`
280
- * resolution path: it's only meaningful during serve, but computing it eagerly
281
- * is harmless (the materializer is a no-op when disabled) and keeps the wiring
282
- * simple — the plan is computed once here.
283
- */
284
- declare const withRemoteBindings: (options: CloudflarePluginOptions, isServe: () => boolean, plan: ViteRemotePlan) => CloudflarePluginOptions;
285
- /**
286
- * A tiny Vite plugin that runs the remote temp-config disposer when the dev
287
- * server tears down (`buildEnd` fires on close in serve; `closeBundle` covers
288
- * the build/close path). Idempotent cleanup means firing on both is safe.
289
- */
388
+ * Wrap the cloudflare-plugin options so the dev worker loads the materialized
389
+ * remote temp config (via `configPath`) when — and only when — remote mode is
390
+ * on and a temp config was materialized. A `configPath` the caller already set
391
+ * wins (their explicit choice).
392
+ *
393
+ * Pure decision only — the serve-vs-build gate lives in
394
+ * {@link remoteBindingsConfigPlugin}'s `config` hook, because the resolved Vite
395
+ * `command` is unknown at plugin-factory time (when this runs). An eager serve
396
+ * check here would always read `command` as undefined and strip `configPath`.
397
+ */
398
+ declare const withRemoteBindings: (options: CloudflarePluginOptions, plan: ViteRemotePlan) => CloudflarePluginOptions;
399
+ /**
400
+ * A `enforce: "pre"` plugin whose `config` hook injects the materialized remote
401
+ * temp config into the cloudflare plugin's `configPath` — but only on a `vite`
402
+ * serve, never a production build (so the deployed worker is never affected).
403
+ *
404
+ * The deferral is the whole point: at plugin-factory time Vite has not yet told
405
+ * us `serve` vs `build`, so the check must run in a `config` hook (where
406
+ * `env.command` is known). It mutates the SAME options object handed to
407
+ * `cloudflare()` in place — the cloudflare plugin reads `pluginConfig.configPath`
408
+ * lazily inside its own `config` hook, which runs after this `enforce: "pre"`
409
+ * one, so the injection takes effect. An eager factory-time serve check (the old
410
+ * behaviour) always saw `command` undefined and silently dropped the path, so
411
+ * remote bindings never activated on `vite dev`.
412
+ *
413
+ * When remote mode was requested but nothing materialized (no eligible binding,
414
+ * no wrangler file, …), the plan's `reason` is logged so the degradation isn't
415
+ * silent.
416
+ */
417
+ declare const remoteBindingsConfigPlugin: (options: CloudflarePluginOptions, plan: ViteRemotePlan) => Plugin;
418
+ /**
419
+ * A tiny Vite plugin that runs the remote temp-config disposer when the dev
420
+ * server tears down (`buildEnd` fires on close in serve; `closeBundle` covers
421
+ * the build/close path). Idempotent cleanup means firing on both is safe.
422
+ */
290
423
  declare const remoteBindingsCleanupPlugin: (cleanup: () => void) => Plugin;
424
+ /**
425
+ * A `@visulima/vite-overlay` solution finder. Derived from the overlay's own
426
+ * options type so the shape can't drift from the installed package. The overlay
427
+ * runs every finder it's given (custom finders first, then its built-ins),
428
+ * sorted by `priority` descending, and shows the first non-`undefined` result.
429
+ *
430
+ * Note: this type (and {@link Solution}) is re-exported from `@lunora/vite` and
431
+ * intentionally tracks the installed `@visulima/vite-overlay` — if a future
432
+ * overlay release changes the finder contract, that surfaces here as a compile
433
+ * error rather than a silent drift.
434
+ */
435
+ type SolutionFinder = NonNullable<OverlayPluginOptions["solutionFinders"]>[number];
436
+ /** What a finder may return: a Markdown-rendered `{ header?, body }`, or `undefined` to defer. */
437
+ type Solution = NonNullable<Awaited<ReturnType<SolutionFinder["handle"]>>>;
438
+ /**
439
+ * Lunora's solution finder for the dev error overlay. A single finder that
440
+ * delegates to `@lunora/codegen`'s shared rule table (the same table the
441
+ * standalone `lunora dev` CLI prints to the terminal) and returns the first
442
+ * match — so one `priority` slot covers every Lunora rule and the overlay's
443
+ * built-in finders still run for anything we don't recognize (we return
444
+ * `undefined`).
445
+ *
446
+ * Priority is high so a Lunora-specific hint wins over the overlay's generic
447
+ * finder for the same error; a user's own finder can still outrank it with a
448
+ * higher `priority`.
449
+ */
450
+ declare const lunoraSolutionFinder: SolutionFinder;
451
+ /** The finders Lunora injects into the overlay by default. */
452
+ declare const lunoraSolutionFinders: ReadonlyArray<SolutionFinder>;
291
453
  /** Dev-server path the studio SPA is served from. */
292
454
  declare const STUDIO_PATH = "/__lunora";
293
- /** Static asset routes the studio document references. */
294
-
295
- /**
296
- * Build the user-facing studio URL from the dev server's resolved address.
297
- * Pure so it can be unit-tested without a live server. Prefers Vite's own
298
- * `resolvedUrls.local` (honours `host` / `base` / https); falls back to the raw
299
- * socket address, bracketing IPv6 and normalising the wildcard host.
300
- */
455
+ /**
456
+ * Build the user-facing studio URL from the dev server's resolved address.
457
+ * Pure so it can be unit-tested without a live server. Prefers Vite's own
458
+ * `resolvedUrls.local` (honours `host` / `base` / https); falls back to the raw
459
+ * socket address, bracketing IPv6 and normalising the wildcard host.
460
+ */
301
461
  declare const buildStudioUrl: (input: {
302
462
  address?: AddressInfo | string;
303
463
  base?: string;
304
464
  resolvedLocal?: string;
305
465
  }) => string;
306
466
  /**
307
- * Vite plugin that serves the composed Lunora studio at
308
- * {@link STUDIO_PATH} during dev and prints its URL once the server is
309
- * listening. Dev-only (`apply: "serve"`); it adds nothing to production builds.
310
- *
311
- * Because `lunora dev` spawns Vite, this makes the studio available on
312
- * `lunora dev` and on a plain `vite` with no per-project files. The studio
313
- * is served as a prebuilt static bundle, independent of the host app.
314
- */
467
+ * Vite plugin that serves the composed Lunora studio at
468
+ * {@link STUDIO_PATH} during dev and prints its URL once the server is
469
+ * listening. Dev-only (`apply: "serve"`); it adds nothing to production builds.
470
+ *
471
+ * Because `lunora dev` spawns Vite, this makes the studio available on
472
+ * `lunora dev` and on a plain `vite` with no per-project files. The studio
473
+ * is served as a prebuilt static bundle, independent of the host app.
474
+ */
315
475
  declare const studioPlugin: () => Plugin;
316
476
  /**
317
- * When a module under `lunora/` throws while the Worker entry is first
318
- * evaluated, `@cloudflare/vite-plugin` surfaces the failure from deep inside
319
- * its `runner-worker` running in `workerd`. The real error crosses a workerd
320
- * RPC boundary on the way out, which drops the user-code stack frames — so all
321
- * the dev server sees is a bare, file-less message like:
322
- *
323
- * ```
324
- * TypeError: Cannot read properties of undefined (reading 'string')
325
- * at runInRunnerObject (workers/runner-worker/index.js:107:3)
326
- * at getWorkerEntryExportTypes (workers/runner-worker/index.js:246:24)
327
- * ```
328
- *
329
- * The classic cause is a **circular import**: a `lunora/` query/mutation/action
330
- * module runs `mutation({ args: { x: v.string() } })` at the top level while the
331
- * module it imported `v`/`query`/`mutation` from is still mid-initialization, so
332
- * those bindings read as `undefined`. The message names a validator method
333
- * (`'string'`, `'id'`, …) but never the file.
334
- *
335
- * We can't recover the dropped frames at this layer, but we can recognise the
336
- * shape of the failure and append an actionable hint pointing at the likely
337
- * cause — turning a dead-end stack into something a user can act on.
338
- */
477
+ * When a module under `lunora/` throws while the Worker entry is first
478
+ * evaluated, `@cloudflare/vite-plugin` surfaces the failure from deep inside
479
+ * its `runner-worker` running in `workerd`. The real error crosses a workerd
480
+ * RPC boundary on the way out, which drops the user-code stack frames — so all
481
+ * the dev server sees is a bare, file-less message like:
482
+ *
483
+ * ```
484
+ * TypeError: Cannot read properties of undefined (reading 'string')
485
+ * at runInRunnerObject (workers/runner-worker/index.js:107:3)
486
+ * at getWorkerEntryExportTypes (workers/runner-worker/index.js:246:24)
487
+ * ```
488
+ *
489
+ * The classic cause is a **circular import**: a `lunora/` query/mutation/action
490
+ * module runs `mutation({ args: { x: v.string() } })` at the top level while the
491
+ * module it imported `v`/`query`/`mutation` from is still mid-initialization, so
492
+ * those bindings read as `undefined`. The message names a validator method
493
+ * (`'string'`, `'id'`, …) but never the file.
494
+ *
495
+ * We can't recover the dropped frames at this layer, but we can recognise the
496
+ * shape of the failure and append an actionable hint pointing at the likely
497
+ * cause — turning a dead-end stack into something a user can act on.
498
+ */
339
499
  declare const WORKER_STARTUP_HINT: string;
340
500
  /**
341
- * True when `error` looks like a Worker-entry evaluation failure routed through
342
- * `@cloudflare/vite-plugin`'s runner worker (the stack references the runner
343
- * worker / export-types probe). Kept narrow so we only annotate this specific
344
- * class of dev-startup error.
345
- */
501
+ * True when `error` looks like a Worker-entry evaluation failure routed through
502
+ * `@cloudflare/vite-plugin`'s runner worker (the stack references the runner
503
+ * worker / export-types probe). Kept narrow so we only annotate this specific
504
+ * class of dev-startup error.
505
+ */
346
506
  declare const isWorkerEntryEvalError: (error: unknown) => boolean;
347
507
  /**
348
- * Append {@link WORKER_STARTUP_HINT} to a recognised Worker-entry eval error
349
- * (idempotently). Any other value is returned untouched.
350
- */
508
+ * Append {@link WORKER_STARTUP_HINT} to a recognised Worker-entry eval error
509
+ * (idempotently). Any other value is returned untouched.
510
+ */
351
511
  declare const augmentWorkerStartupError: (error: unknown) => unknown;
352
512
  /**
353
- * Wrap the startup hooks of `@cloudflare/vite-plugin`'s plugins so a Worker-entry
354
- * evaluation failure carries the Lunora hint. Returns a new array; the input
355
- * plugins are shallow-cloned (never mutated in place) so re-using the cloudflare
356
- * plugin instances elsewhere stays safe.
357
- */
513
+ * Wrap the startup hooks of `@cloudflare/vite-plugin`'s plugins so a Worker-entry
514
+ * evaluation failure carries the Lunora hint. Returns a new array; the input
515
+ * plugins are shallow-cloned (never mutated in place) so re-using the cloudflare
516
+ * plugin instances elsewhere stays safe.
517
+ */
358
518
  declare const withWorkerStartupHint: (plugins: ReadonlyArray<Plugin>) => Plugin[];
359
519
  /**
360
- * Vite plugin that validates the project's `wrangler.jsonc` against the
361
- * bindings implied by `lunora/schema.ts`. Throws (Vite renders nicely) on
362
- * missing requirements during `configResolved`. Delegates the parsing /
363
- * validation logic to `@lunora/config` so the rules stay in lockstep with
364
- * the CLI (`lunora deploy`).
365
- */
520
+ * Vite plugin that validates the project's `wrangler.jsonc` against the
521
+ * bindings implied by `lunora/schema.ts`. Throws (Vite renders nicely) on
522
+ * missing requirements during `configResolved`. Delegates the parsing /
523
+ * validation logic to `@lunora/config` so the rules stay in lockstep with
524
+ * the CLI (`lunora deploy`).
525
+ */
366
526
  declare const wranglerValidatorPlugin: (options: ResolvedLunoraPluginOptions) => Plugin;
367
527
  /**
368
- * Lunora Vite plugin. Returns a flat array of Vite plugins that:
369
- *
370
- * 1. Run `@lunora/codegen` on startup + on schema file changes.
371
- * 2. Validate the project's `wrangler.jsonc` against the schema's implied bindings.
372
- * 3. Inject `@visulima/vite-overlay` for runtime error overlays (unless `overlay: false`).
373
- * 4. Include `@cloudflare/vite-plugin` so users get one-import setup (unless `cloudflare: false`).
374
- *
375
- * `@cloudflare/vite-plugin` and `@visulima/vite-overlay` are direct dependencies,
376
- * so they're imported statically — opt out per-feature via the options rather
377
- * than relying on whether they're installed.
378
- */
528
+ * Resolve the `overlay` toggle into the overlay plugin's options — or `false` to
529
+ * skip it. Lunora's solution finders are **prepended** so they run before the
530
+ * overlay's built-ins; a user's own finders are appended and can still win per
531
+ * error via a strictly higher `priority` (equal priority keeps Lunora first,
532
+ * since the overlay sorts stably). Lunora also forwards both `error` AND `warn`
533
+ * console calls by default (the overlay's own default is `["error"]` only) so
534
+ * Lunora's branded `warn` advisories surface in the browser too — the user can
535
+ * override `forwardedConsoleMethods`.
536
+ */
537
+ declare const resolveOverlayOption: (overlay: LunoraPluginOptions["overlay"]) => false | OverlayPluginOptions;
538
+ /**
539
+ * Lunora Vite plugin. Returns a flat array of Vite plugins that:
540
+ *
541
+ * 1. Run `@lunora/codegen` on startup + on schema file changes.
542
+ * 2. Validate the project's `wrangler.jsonc` against the schema's implied bindings.
543
+ * 3. Inject `@visulima/vite-overlay` for runtime error overlays (unless `overlay: false`).
544
+ * 4. Include `@cloudflare/vite-plugin` so users get one-import setup (unless `cloudflare: false`).
545
+ *
546
+ * `@cloudflare/vite-plugin` and `@visulima/vite-overlay` are direct dependencies,
547
+ * so they're imported statically — opt out per-feature via the options rather
548
+ * than relying on whether they're installed.
549
+ */
379
550
  declare const lunora: (options?: LunoraPluginOptions) => LunoraPlugins;
380
- declare const VERSION = "0.0.0";
381
- export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type OverlayPluginOptions, type PlanViteRemoteOptions, type ReconcileResult, type ResolvedLunoraPluginOptions, STUDIO_PATH, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, codegenPlugin, createCommandProbe, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, planViteRemoteBindings, reconcileWranglerCrons, remoteBindingsCleanupPlugin, studioPlugin, withDevWorkerEnv, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
551
+ declare const VERSION: string;
552
+ export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, DEV_WORKER_ENV_VALUE, DEV_WORKER_ENV_VAR, GENERATED_CLASS_MODULES, type GeneratedClassModule, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type LunoraShardConfig, type OverlayPluginOptions, type PlanViteRemoteOptions, type ResolvedLunoraPluginOptions, STUDIO_PATH, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, checkLunoraProxy, codegenPlugin, containerLogsPlugin, createCommandProbe, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, proxyCheckPlugin, remoteBindingsCleanupPlugin, remoteBindingsConfigPlugin, resolveOverlayOption, studioPlugin, withDevWorkerEnv, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };