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