@lunora/config 1.0.0-alpha.459 → 1.0.0-alpha.460
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/dist/cli/index.mjs +1 -1
- package/dist/cloudflare/index.d.mts +1097 -1068
- package/dist/cloudflare/index.d.ts +1097 -1068
- package/dist/cloudflare/index.mjs +1 -1
- package/dist/index.d.mts +119 -6
- package/dist/index.d.ts +119 -6
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-CR06-eW7.mjs +1 -0
- package/dist/packem_shared/{CLOUDFLARE_CLI_CONFIG_WARNING_ENV-BKMrOuXV.mjs → CLOUDFLARE_CLI_CONFIG_WARNING_ENV-75Y5zVF8.mjs} +1 -1
- package/dist/packem_shared/{COMPOSED_WORKER_ENTRY-BcFt6ts5.mjs → COMPOSED_WORKER_ENTRY-LpLlp-aF.mjs} +1 -1
- package/dist/packem_shared/{DEFAULT_DEPLOY_TARGET-DllYb7Tj.mjs → DEFAULT_DEPLOY_TARGET-CAJl2nEI.mjs} +1 -1
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-hBT89IXh.mjs +6 -0
- package/dist/packem_shared/{DEV_WORKER_ENV_VALUE-DdPmCpf3.mjs → DEV_WORKER_ENV_VALUE-FoysLtF0.mjs} +1 -1
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-Cq0oj0_9.mjs +9 -0
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CPWkw-qE.mjs +1 -0
- package/dist/packem_shared/{POLICY_SCAFFOLD_ENDPOINT-uJ8CZJh-.mjs → POLICY_SCAFFOLD_ENDPOINT-UcPFeEyM.mjs} +1 -1
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-D66_hwjD.mjs +1 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-BPxR2Ht_.mjs +1 -0
- package/dist/packem_shared/{SCHEMA_EDIT_ENDPOINT-C4h_C4TI.mjs → SCHEMA_EDIT_ENDPOINT-C-ic_pvD.mjs} +1 -1
- package/dist/packem_shared/{STUDIO_PATH-C6kNFiHy.mjs → STUDIO_PATH-CDf-EtPs.mjs} +1 -1
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-Zw1oiigQ.mjs +1 -0
- package/dist/packem_shared/WRANGLER_FILES-BF8PUjuo.mjs +1 -0
- package/dist/packem_shared/{assertBuildTargetMatches-CqrrwiQ-.mjs → assertBuildTargetMatches-tkKAa5zl.mjs} +1 -1
- package/dist/packem_shared/{assertWranglerSatisfiesSchema-071lEemx.mjs → assertWranglerSatisfiesSchema-CZWQnfly.mjs} +1 -1
- package/dist/packem_shared/{bindingsNeedingDatabase-6eD6Qtqf.mjs → bindingsNeedingDatabase-3KyGflIq.mjs} +1 -1
- package/dist/packem_shared/buildPackageSecretsBlock-DrSD60vH.mjs +19 -0
- package/dist/packem_shared/{celld-config-DoBVipuN.mjs → celld-config-CpvLkAEg.mjs} +1 -1
- package/dist/packem_shared/checkDevEnv-egiW2lSF.mjs +3 -0
- package/dist/packem_shared/{collectExportGaps-C5OYqfkE.mjs → collectExportGaps-BYo3bcXi.mjs} +2 -2
- package/dist/packem_shared/{createStudioDocumentCache-B3Sf1bIl.mjs → createStudioDocumentCache-XBG1aWbl.mjs} +1 -1
- package/dist/packem_shared/{describePreservedCrons-Bt2rPPeY.mjs → describePreservedCrons-i5XT6rtl.mjs} +1 -1
- package/dist/packem_shared/devTriggerHints-CN_RJxWW.mjs +1 -0
- package/dist/packem_shared/{devVariablesStamp-Cetr3qFz.mjs → devVariablesStamp-BQkGEn9d.mjs} +1 -1
- package/dist/packem_shared/{emitProjectAssetHeaders-2FtExZPG.mjs → emitProjectAssetHeaders-6iinmRWE.mjs} +1 -1
- package/dist/packem_shared/guards-CoCtgpeR.mjs +1 -0
- package/dist/packem_shared/hasCloudflareCredentials-ByCrwaLT.mjs +1 -0
- package/dist/packem_shared/inferLunoraBindings-Biq1OW9V.mjs +1 -0
- package/dist/packem_shared/{materializeServiceDevConfigs-qUY4_iu1.mjs → materializeServiceDevConfigs-CI1HXv7f.mjs} +1 -1
- package/dist/packem_shared/pendingBindingChanges-5fPhwxMt.mjs +1 -0
- package/dist/packem_shared/{infer-bindings.d-Tkaosiub.d.mts → placeholder-ids.d-DvGHP6bl.d.mts} +18 -18
- package/dist/packem_shared/{infer-bindings.d-Tkaosiub.d.ts → placeholder-ids.d-DvGHP6bl.d.ts} +18 -18
- package/dist/packem_shared/queue-info-D38n7YdX.mjs +1 -0
- package/dist/packem_shared/reconcile-services-CjgIJKim.mjs +1 -0
- package/dist/packem_shared/reconcileWranglerBindings-D7mXDfAe.mjs +1 -0
- package/dist/packem_shared/{reconcileWranglerCompatibilityDate-hocXEuRA.mjs → reconcileWranglerCompatibilityDate-Cj94osA-.mjs} +1 -1
- package/dist/packem_shared/scanWranglerVariablesForSecrets-DojbojUo.mjs +1 -0
- package/dist/packem_shared/secret-key-xi4VK8Jw.mjs +1 -0
- package/dist/packem_shared/{startCelldDevSession-Bg_RN5uf.mjs → startCelldDevSession-DQ7YylR_.mjs} +1 -1
- package/dist/packem_shared/validate-bindings-CQbR23li.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-CKXL6P6s.mjs +1 -0
- package/dist/packem_shared/{worker-entry-checks-CHrum2AN.mjs → worker-entry-checks-DH-ApvvX.mjs} +1 -1
- package/dist/packem_shared/wranglerCodegenInputs-Cz9ByxSo.mjs +1 -0
- package/dist/packem_shared/{write-atomic-NN-EjI8U.mjs → write-atomic-CcNMkFsX.mjs} +1 -1
- package/dist/studio-host/index.mjs +1 -1
- package/package.json +4 -2
- package/dist/packem_shared/BINDING_MANIFEST_VERSION-CfXEYG8e.mjs +0 -1
- package/dist/packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs +0 -6
- package/dist/packem_shared/LUNORA_EVENT_SOURCE-D_VGT1JJ.mjs +0 -9
- package/dist/packem_shared/PACKAGE_SECRETS_REGISTRY-CnY7jg9j.mjs +0 -1
- package/dist/packem_shared/REMOTE_ELIGIBLE_KEYS-DooK0pzs.mjs +0 -1
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-CKjEIFrf.mjs +0 -1
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-YnIX5BDi.mjs +0 -1
- package/dist/packem_shared/WRANGLER_FILES-UNW-xY5u.mjs +0 -1
- package/dist/packem_shared/buildPackageSecretsBlock-B4Odg5OF.mjs +0 -19
- package/dist/packem_shared/hasCloudflareCredentials-Bak5w1_6.mjs +0 -1
- package/dist/packem_shared/inferLunoraBindings-D0QDcugr.mjs +0 -1
- package/dist/packem_shared/package-secrets-registry-TouCAMQN.mjs +0 -1
- package/dist/packem_shared/reconcile-assets-h8q3F4Sy.mjs +0 -1
- package/dist/packem_shared/reconcile-services-C4TwY8YH.mjs +0 -1
- package/dist/packem_shared/reconcileBindingsSafely-BI6znzGg.mjs +0 -1
- package/dist/packem_shared/scanWranglerVariablesForSecrets-CkonQUdG.mjs +0 -1
- package/dist/packem_shared/spa-assets-BwJFTBeO.mjs +0 -1
- package/dist/packem_shared/withTailConsumer-_EZ9WqMc.mjs +0 -1
- package/dist/packem_shared/wranglerCodegenInputs-BZUWdHzz.mjs +0 -1
|
@@ -1,543 +1,349 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/
|
|
1
|
+
import { G as GeneratedClassModule, I as InferredBindings, D as DiscoveryCache, S as SchemaInfo } from "../packem_shared/placeholder-ids.d-DvGHP6bl.mjs";
|
|
2
|
+
export { H as HYPERDRIVE_PLACEHOLDER_ID } from "../packem_shared/placeholder-ids.d-DvGHP6bl.mjs";
|
|
3
3
|
import { D as DeployDriver } from "../packem_shared/deploy-driver.d-CHVNQFV2.mjs";
|
|
4
4
|
import { WranglerQueueProducerIR, WranglerVariableIR } from '@lunora/codegen';
|
|
5
5
|
/** Apply one structural jsonc edit and return the rewritten text (a no-op edit returns the input). */
|
|
6
6
|
declare const applyModify: (text: string, path: ReadonlyArray<number | string>, value: unknown) => string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
cache?: DiscoveryCache;
|
|
11
|
-
/** Absolute path to the project root holding `wrangler.jsonc`. */
|
|
12
|
-
projectRoot: string;
|
|
13
|
-
/** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
|
|
14
|
-
schemaDir: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Throw unless `wrangler.jsonc` satisfies the schema's binding requirements.
|
|
18
|
-
*
|
|
19
|
-
* Non-blocking validator warnings go to `warn`. `remedy` closes both error
|
|
20
|
-
* messages — the caller's own "and restart the dev server" / "and rebuild" —
|
|
21
|
-
* since that is the only part a reader acts on differently per front-end.
|
|
22
|
-
*
|
|
23
|
-
* Must run AFTER binding provisioning: the bindings this requires are largely the
|
|
24
|
-
* ones Lunora writes itself, so validating first fails the very first build of any
|
|
25
|
-
* project that declares a `.global()` table or a container.
|
|
26
|
-
*/
|
|
27
|
-
declare const assertWranglerSatisfiesSchema: (options: AssertWranglerOptions, warn: (message: string) => void, remedy: string) => void;
|
|
28
|
-
/** `Cross-Origin-Opener-Policy` values. `false` omits the header. */
|
|
29
|
-
type CrossOriginOpenerPolicy = "same-origin" | "same-origin-allow-popups" | "unsafe-none";
|
|
30
|
-
/** Per-header overrides for the baseline security headers. `false` omits the header. */
|
|
31
|
-
interface SecurityHeadersOptions {
|
|
32
|
-
/**
|
|
33
|
-
* `Cross-Origin-Opener-Policy`. Defaults to `same-origin-allow-popups`: a
|
|
34
|
-
* cross-origin page that opens yours gets no handle on it, while a popup your
|
|
35
|
-
* page opens (an OAuth provider, a payment sheet) can still message back
|
|
36
|
-
* through `window.opener`. `same-origin` severs that too; `false` omits the header.
|
|
37
|
-
*/
|
|
38
|
-
crossOriginOpenerPolicy?: CrossOriginOpenerPolicy | false;
|
|
39
|
-
/**
|
|
40
|
-
* `Content-Security-Policy`. Omitted (`undefined`) applies a restrictive
|
|
41
|
-
* `default-src 'none'` policy to **non-HTML** responses, and a conservative
|
|
42
|
-
* hardening policy to **HTML** responses (`base-uri 'none'; object-src
|
|
43
|
-
* 'none'; frame-ancestors …`) — this does NOT set `default-src`/`script-src`,
|
|
44
|
-
* so it never blocks a page's own scripts/styles/images/fetches. Pass a string
|
|
45
|
-
* to apply that exact policy to every response (HTML included); `false` to
|
|
46
|
-
* never send one. Neither can be combined with {@link frameAncestors}: put the
|
|
47
|
-
* `frame-ancestors` directive in the string.
|
|
48
|
-
*/
|
|
49
|
-
csp?: string | false;
|
|
50
|
-
/**
|
|
51
|
-
* Origins allowed to embed your HTML pages in a frame, besides your own
|
|
52
|
-
* (e.g. `["https://partner.example"]`). Sets the HTML policy's
|
|
53
|
-
* `frame-ancestors 'self' <origins>` and drops `X-Frame-Options`, which
|
|
54
|
-
* cannot express a list (browsers that understand `frame-ancestors` ignore
|
|
55
|
-
* it anyway). Cannot be combined with `frameOptions: "DENY"`, a `csp` string,
|
|
56
|
-
* or `csp: false` (which would leave no header restricting framing).
|
|
57
|
-
*/
|
|
58
|
-
frameAncestors?: ReadonlyArray<string>;
|
|
59
|
-
/** `X-Frame-Options` (clickjacking). Defaults to `SAMEORIGIN`. `false` omits it. */
|
|
60
|
-
frameOptions?: "DENY" | "SAMEORIGIN" | false;
|
|
61
|
-
/** `Strict-Transport-Security`. The Worker sends it only over HTTPS. `false` omits it. */
|
|
62
|
-
hsts?: boolean | {
|
|
63
|
-
includeSubDomains?: boolean;
|
|
64
|
-
maxAge?: number;
|
|
65
|
-
preload?: boolean;
|
|
66
|
-
};
|
|
67
|
-
/** `Permissions-Policy`. Defaults to a minimal deny list. `false` omits it. */
|
|
68
|
-
permissionsPolicy?: string | false;
|
|
69
|
-
/** `Referrer-Policy`. Defaults to `strict-origin-when-cross-origin`. `false` omits it. */
|
|
70
|
-
referrerPolicy?: string | false;
|
|
71
|
-
}
|
|
72
|
-
interface AssetHeadersOptions {
|
|
73
|
-
/**
|
|
74
|
-
* The security headers to write for `/*`, in the runtime's `security.headers`
|
|
75
|
-
* shape: `undefined` or `true` for the defaults, `false` for none.
|
|
76
|
-
*/
|
|
77
|
-
headers: boolean | SecurityHeadersOptions | undefined;
|
|
7
|
+
interface Manifest {
|
|
8
|
+
/** The manifest's `lunora` value, when it has one and it is an object. */
|
|
9
|
+
lunora: Record<string, unknown> | undefined;
|
|
78
10
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* (`single-page-application`, `404-page`): `_headers` matches the request
|
|
84
|
-
* path, so a request for a chunk a later deploy removed would get the
|
|
85
|
-
* fallback page with this policy, and keep it for a year.
|
|
11
|
+
* `true` when the manifest holds a `lunora` value that is NOT a plain object.
|
|
12
|
+
* {@link readManifest} normalises that to `lunora: undefined`, but the TEXT
|
|
13
|
+
* still has it — and `modify(text, ["lunora", "crons"], …)` throws
|
|
14
|
+
* `Can not add index to parent of type string` on a scalar or array parent.
|
|
86
15
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/** Header names left out of the block because a rule outside it already sets them. */
|
|
91
|
-
deferred: string[];
|
|
92
|
-
/** Absolute path of the `_headers` file, or `undefined` when there is none. */
|
|
93
|
-
path: string | undefined;
|
|
94
|
-
/** Non-fatal notes for the build log. */
|
|
95
|
-
warnings: string[];
|
|
16
|
+
lunoraIsForeign: boolean;
|
|
17
|
+
path: string;
|
|
18
|
+
text: string;
|
|
96
19
|
}
|
|
97
|
-
/** Rewrite `<directory>/_headers` with the managed block; a file left holding nothing is removed. */
|
|
98
|
-
declare const writeAssetHeaders: (directory: string, options: AssetHeadersOptions) => AssetHeadersResult;
|
|
99
20
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* # Why translate rather than ask for a second config
|
|
103
|
-
*
|
|
104
|
-
* `wrangler.jsonc` is already the source of truth for what an app needs, and
|
|
105
|
-
* Lunora already infers and reconciles it — `inferLunoraBindings` decides that
|
|
106
|
-
* a project needs a shard namespace and a bucket, `reconcileWranglerBindings`
|
|
107
|
-
* writes them. Asking a developer to restate all of that in an
|
|
108
|
-
* `alchemy.run.ts` would give the project two sources of truth that drift, and
|
|
109
|
-
* the drift would surface as a deploy that provisions something the app does
|
|
110
|
-
* not bind.
|
|
111
|
-
*
|
|
112
|
-
* So Alchemy is an implementation detail of `deploy`, not a thing to configure:
|
|
113
|
-
* read the config, emit the program, run it.
|
|
114
|
-
*
|
|
115
|
-
* # Why this emits source rather than calling Alchemy
|
|
116
|
-
*
|
|
117
|
-
* `alchemy@0.93` has thirty dependencies, nine of them Node-shaped —
|
|
118
|
-
* `wrangler`, `miniflare`, `esbuild`, `execa`, `find-process`, `glob`, `open`,
|
|
119
|
-
* `proper-lockfile`, `signal-exit`. `@lunora/config` is imported by
|
|
120
|
-
* `@lunora/vite`, so importing Alchemy here would push that tree into every
|
|
121
|
-
* project that merely wanted to read `lunora.config.*`, and into any bundle
|
|
122
|
-
* targeting workerd — where none of it survives.
|
|
123
|
-
*
|
|
124
|
-
* Emitting text keeps this module pure and dependency-free. Alchemy is invoked
|
|
125
|
-
* as a CLI against the generated file, so it only has to exist on the machine
|
|
126
|
-
* that deploys.
|
|
127
|
-
*
|
|
128
|
-
* # Adoption, not re-creation
|
|
21
|
+
* The project manifest, or `undefined` when it is missing or is not readable
|
|
22
|
+
* JSON.
|
|
129
23
|
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* create alongside — the one outcome a deploy must never have.
|
|
24
|
+
* Unreadable reads as "no ownership recorded" rather than throwing: this runs
|
|
25
|
+
* inside a deploy and inside every dev-server schema save, where a manifest that
|
|
26
|
+
* broken already fails for reasons that have nothing to do with the record.
|
|
134
27
|
*/
|
|
135
|
-
|
|
28
|
+
declare const readManifest: (projectRoot: string) => Manifest | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Set `lunora.<key>` to `value`, or drop it when `value` is `undefined` — and
|
|
31
|
+
* the `lunora` object with it, when nothing else lives there, so a project with
|
|
32
|
+
* nothing recorded keeps an unmarked manifest.
|
|
33
|
+
*/
|
|
34
|
+
declare const recordManifestKey: (manifest: Manifest, key: string, value: unknown) => void;
|
|
35
|
+
/** The `wrangler.jsonc` shape the validator reads, and the report it returns. */
|
|
136
36
|
interface WranglerDurableObjectBinding$1 {
|
|
137
37
|
class_name?: string;
|
|
138
38
|
name?: string;
|
|
39
|
+
/** Present when the class lives in ANOTHER Worker — then it is that script's to export, not this entry's. */
|
|
139
40
|
script_name?: string;
|
|
140
41
|
}
|
|
141
|
-
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
bindings?: ReadonlyArray<WranglerDurableObjectBinding$1>;
|
|
152
|
-
};
|
|
153
|
-
kv_namespaces?: ReadonlyArray<{
|
|
154
|
-
binding?: string;
|
|
155
|
-
id?: string;
|
|
156
|
-
}>;
|
|
157
|
-
main?: string;
|
|
158
|
-
/** `new_sqlite_classes` marks which DO classes get SQLite storage — Alchemy needs that per namespace. */
|
|
159
|
-
migrations?: ReadonlyArray<{
|
|
160
|
-
new_classes?: ReadonlyArray<string>;
|
|
161
|
-
new_sqlite_classes?: ReadonlyArray<string>;
|
|
162
|
-
}>;
|
|
163
|
-
name?: string;
|
|
164
|
-
/** Only `producers` translate; a `consumers` entry is dropped and reported as `queues.consumers`. */
|
|
165
|
-
queues?: {
|
|
166
|
-
consumers?: ReadonlyArray<{
|
|
167
|
-
queue?: string;
|
|
168
|
-
}>;
|
|
169
|
-
producers?: ReadonlyArray<{
|
|
170
|
-
binding?: string;
|
|
171
|
-
queue?: string;
|
|
172
|
-
}>;
|
|
173
|
-
};
|
|
174
|
-
r2_buckets?: ReadonlyArray<{
|
|
175
|
-
binding?: string;
|
|
176
|
-
bucket_name?: string;
|
|
177
|
-
}>;
|
|
178
|
-
triggers?: {
|
|
179
|
-
crons?: ReadonlyArray<string>;
|
|
180
|
-
};
|
|
181
|
-
vars?: Readonly<Record<string, unknown>>;
|
|
182
|
-
}
|
|
183
|
-
/** What the translation could not carry over, so the caller can say so out loud. */
|
|
184
|
-
interface AlchemyTranslation {
|
|
185
|
-
/** The emitted program source. */
|
|
186
|
-
source: string;
|
|
187
|
-
/**
|
|
188
|
-
* Bindings present in `wrangler.jsonc` that this translation drops.
|
|
189
|
-
*
|
|
190
|
-
* Reported rather than silently omitted: a deploy that quietly loses a
|
|
191
|
-
* Vectorize index produces a worker whose `env.POSTS_SEARCH` is undefined
|
|
192
|
-
* at runtime, and nothing in the build says why.
|
|
193
|
-
*/
|
|
194
|
-
unsupported: ReadonlyArray<string>;
|
|
42
|
+
/**
|
|
43
|
+
* A `tail_consumers` entry: a Worker that receives this Worker's tail events
|
|
44
|
+
* (logs, exceptions, fetch metadata) for forwarding to an external sink. See
|
|
45
|
+
* `withTailConsumer` for the wiring helper.
|
|
46
|
+
*/
|
|
47
|
+
interface TailConsumer {
|
|
48
|
+
/** Optional Cloudflare environment of the consumer Worker. */
|
|
49
|
+
environment?: string;
|
|
50
|
+
/** Name of the Worker that consumes tail events. */
|
|
51
|
+
service?: string;
|
|
195
52
|
}
|
|
196
53
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* @param config The parsed `wrangler.jsonc`.
|
|
202
|
-
* @returns the program source, plus whatever could not be carried over.
|
|
54
|
+
* `observability.traces` — Workers Traces. `destinations` names OpenTelemetry
|
|
55
|
+
* export destinations configured in the dashboard; `persist: false` exports
|
|
56
|
+
* without also storing in Cloudflare (default `true`).
|
|
57
|
+
* https://developers.cloudflare.com/workers/observability/opentelemetry-export/
|
|
203
58
|
*/
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
59
|
+
interface WranglerObservabilityTraces {
|
|
60
|
+
destinations?: ReadonlyArray<string>;
|
|
61
|
+
enabled?: boolean;
|
|
62
|
+
/** Fraction of requests traced, 0–1. */
|
|
63
|
+
head_sampling_rate?: number;
|
|
64
|
+
persist?: boolean;
|
|
65
|
+
}
|
|
207
66
|
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* resource for that type, omitted when the config does not carry them (an id
|
|
211
|
-
* Lunora could not mint is absent here exactly as it is absent from the config).
|
|
67
|
+
* `observability.logs` — Workers Logs. Same export knobs as traces, plus
|
|
68
|
+
* `invocation_logs` (the per-invocation summary line; default `true`).
|
|
212
69
|
*/
|
|
213
|
-
interface
|
|
214
|
-
|
|
215
|
-
binding: string;
|
|
216
|
-
/**
|
|
217
|
-
* Durable Object / Workflow / Container class the Worker must export. Present
|
|
218
|
-
* for the class-backed binding types, so a deployer can assert the bundle
|
|
219
|
-
* exports it before publishing.
|
|
220
|
-
*/
|
|
221
|
-
className?: string;
|
|
222
|
-
/** Bucket name (`r2`), database name (`d1`), dataset (`analytics_engine`), queue name (`queue`), index (`vectorize`), stream (`pipeline`), namespace (`artifacts`, `ai_search_namespace`), instance (`ai_search`), Worker name (`service`). */
|
|
223
|
-
resource?: string;
|
|
224
|
-
/** Remote resource id, when the config declares one (`d1`, `kv`, `hyperdrive`, `vpc_service`, `vpc_network`). */
|
|
225
|
-
resourceId?: string;
|
|
226
|
-
/** For `durable_object`: whether the class uses SQLite storage (`new_sqlite_classes`). */
|
|
227
|
-
sqlite?: boolean;
|
|
228
|
-
/** The kind of resource, keyed to the wrangler section it came from. */
|
|
229
|
-
type: "ai" | "ai_search" | "ai_search_namespace" | "analytics_engine" | "analytics_sql" | "artifacts" | "assets" | "browser" | "container" | "d1" | "durable_object" | "hyperdrive" | "images" | "kv" | "media" | "pipeline" | "queue_consumer" | "queue_producer" | "r2" | "service" | "stream" | "vectorize" | "vpc_network" | "vpc_service" | "workflow";
|
|
70
|
+
interface WranglerObservabilityLogs extends WranglerObservabilityTraces {
|
|
71
|
+
invocation_logs?: boolean;
|
|
230
72
|
}
|
|
231
|
-
/** The
|
|
232
|
-
interface
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
* Wrangler sections present in the config that this version does not model,
|
|
245
|
-
* by field name. Empty for a fully-understood config; non-empty is a prompt to
|
|
246
|
-
* extend the collector, and is surfaced to the user rather than silently
|
|
247
|
-
* dropped.
|
|
248
|
-
*/
|
|
249
|
-
unknown: ReadonlyArray<string>;
|
|
250
|
-
/** Names of `vars` entries. Values are deliberately excluded — a manifest is committed and read by CI, and a `vars` entry can hold a value a project would rather not publish. */
|
|
251
|
-
vars: ReadonlyArray<string>;
|
|
252
|
-
/** Schema version — {@link BINDING_MANIFEST_VERSION}. */
|
|
253
|
-
version: number;
|
|
73
|
+
/** The wrangler `observability` block (Workers Logs + Traces). */
|
|
74
|
+
interface WranglerObservability {
|
|
75
|
+
enabled?: boolean;
|
|
76
|
+
/** Fraction of requests logged, 0–1 (wrangler's default is 1: every request). */
|
|
77
|
+
head_sampling_rate?: number;
|
|
78
|
+
/** Workers Issues — detects and groups production failures. */
|
|
79
|
+
issues?: {
|
|
80
|
+
enabled?: boolean;
|
|
81
|
+
};
|
|
82
|
+
logs?: WranglerObservabilityLogs;
|
|
83
|
+
/** Strip query strings from request URLs in logs and traces (wrangler's default is `false`). */
|
|
84
|
+
redact_query_string?: boolean;
|
|
85
|
+
traces?: WranglerObservabilityTraces;
|
|
254
86
|
}
|
|
255
87
|
/**
|
|
256
|
-
* The
|
|
257
|
-
*
|
|
258
|
-
*
|
|
88
|
+
* The `observability` block Lunora writes when a project has none — by
|
|
89
|
+
* `lunora dev`'s binding reconcile and by `lunora init`'s scaffold. Logs on,
|
|
90
|
+
* every request sampled: the right default while an app is small, and what
|
|
91
|
+
* `lunora doctor`'s `observability-full-sampling` advisory then flags once
|
|
92
|
+
* Workers Observability is billed. One constant so the writers and the doctor
|
|
93
|
+
* cannot drift apart.
|
|
259
94
|
*/
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
95
|
+
declare const DEFAULT_OBSERVABILITY: Readonly<{
|
|
96
|
+
enabled: true;
|
|
97
|
+
head_sampling_rate: 1;
|
|
98
|
+
redact_query_string: true;
|
|
99
|
+
}>;
|
|
100
|
+
/** One signal's effective sampling, as {@link resolveObservabilitySampling} resolves it. */
|
|
101
|
+
interface ObservabilitySignalSampling {
|
|
102
|
+
enabled: boolean;
|
|
103
|
+
/** Fraction of requests sampled, 0–1. */
|
|
104
|
+
headSamplingRate: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The effective logs / traces sampling an `observability` block deploys with,
|
|
108
|
+
* defaults applied. An absent block is {@link DEFAULT_OBSERVABILITY}, which is
|
|
109
|
+
* what Lunora reconciles it to. Inside a present block, logs are on unless the
|
|
110
|
+
* block (or its `logs` sub-block) turns them off; traces are opt-in
|
|
111
|
+
* (`traces.enabled: true`); and an unset rate is wrangler's own default of 1.
|
|
112
|
+
* `logs.*` overrides the top-level switch and rate.
|
|
113
|
+
*/
|
|
114
|
+
declare const resolveObservabilitySampling: (block: WranglerObservability | undefined) => {
|
|
115
|
+
logs: ObservabilitySignalSampling;
|
|
116
|
+
traces: ObservabilitySignalSampling;
|
|
117
|
+
};
|
|
118
|
+
/** A wrangler `containers[]` entry (parsed from untrusted JSONC). */
|
|
119
|
+
interface WranglerContainerEntry {
|
|
120
|
+
class_name?: string;
|
|
121
|
+
image?: string;
|
|
122
|
+
/** Named images under the `durable_object` scheduling policy. */
|
|
123
|
+
images?: Record<string, {
|
|
124
|
+
build_context?: string;
|
|
125
|
+
build_vars?: Record<string, string>;
|
|
126
|
+
dockerfile?: string;
|
|
127
|
+
image?: string;
|
|
128
|
+
} | null | undefined>;
|
|
129
|
+
instance_type?: string | {
|
|
130
|
+
disk_mb?: number;
|
|
131
|
+
memory_mib?: number;
|
|
132
|
+
vcpu?: number;
|
|
263
133
|
};
|
|
134
|
+
max_instances?: number;
|
|
135
|
+
scheduling_policy?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A wrangler `workflows[]` entry (parsed from untrusted JSONC). Unlike
|
|
139
|
+
* containers, workflows are NOT Durable Objects — the entry stands alone (no
|
|
140
|
+
* `durable_objects` binding, no migration class).
|
|
141
|
+
*/
|
|
142
|
+
interface WranglerWorkflowEntry {
|
|
143
|
+
binding?: string;
|
|
144
|
+
class_name?: string;
|
|
145
|
+
/** `{ success_retention?, error_retention? }` durations; shape-checked by `validateWorkflowSettings`. */
|
|
146
|
+
default_retention?: unknown;
|
|
147
|
+
/** `{ steps? }`; shape-checked by `validateWorkflowSettings`. */
|
|
148
|
+
limits?: unknown;
|
|
149
|
+
name?: string;
|
|
150
|
+
/** Cron strings that each start an instance; shape-checked by `validateWorkflowSettings`. */
|
|
151
|
+
schedules?: unknown;
|
|
152
|
+
/** Present when the class lives in ANOTHER Worker — then it is that script's to export. */
|
|
153
|
+
script_name?: string;
|
|
154
|
+
}
|
|
155
|
+
/** A wrangler `queues.producers[]` entry — a `Queue` binding sending to `queue`. */
|
|
156
|
+
interface WranglerQueueProducer {
|
|
157
|
+
binding?: string;
|
|
158
|
+
delivery_delay?: number;
|
|
159
|
+
queue?: string;
|
|
160
|
+
}
|
|
161
|
+
/** A wrangler `queues.consumers[]` entry — push (worker) or `type: "http_pull"`. */
|
|
162
|
+
interface WranglerQueueConsumer {
|
|
163
|
+
dead_letter_queue?: string;
|
|
164
|
+
max_batch_size?: number;
|
|
165
|
+
max_batch_timeout?: number;
|
|
166
|
+
max_concurrency?: number;
|
|
167
|
+
max_retries?: number;
|
|
168
|
+
queue?: string;
|
|
169
|
+
retry_delay?: number;
|
|
170
|
+
type?: string;
|
|
171
|
+
}
|
|
172
|
+
interface WranglerConfig {
|
|
173
|
+
account_id?: unknown;
|
|
174
|
+
ai?: {
|
|
175
|
+
binding?: unknown;
|
|
176
|
+
} | null;
|
|
264
177
|
ai_search?: ReadonlyArray<{
|
|
265
178
|
binding?: string;
|
|
266
179
|
instance_name?: string;
|
|
267
|
-
|
|
180
|
+
remote?: boolean;
|
|
181
|
+
} | null | undefined>;
|
|
268
182
|
ai_search_namespaces?: ReadonlyArray<{
|
|
269
183
|
binding?: string;
|
|
270
184
|
namespace?: string;
|
|
271
|
-
|
|
272
|
-
|
|
185
|
+
remote?: boolean;
|
|
186
|
+
} | null | undefined>;
|
|
273
187
|
analytics?: {
|
|
274
|
-
binding?:
|
|
275
|
-
|
|
188
|
+
binding?: unknown;
|
|
189
|
+
remote?: boolean;
|
|
190
|
+
} | null;
|
|
276
191
|
analytics_engine_datasets?: ReadonlyArray<{
|
|
277
192
|
binding?: string;
|
|
278
193
|
dataset?: string;
|
|
279
|
-
}>;
|
|
194
|
+
} | null | undefined>;
|
|
280
195
|
artifacts?: ReadonlyArray<{
|
|
281
196
|
binding?: string;
|
|
282
197
|
namespace?: string;
|
|
283
|
-
|
|
284
|
-
|
|
198
|
+
remote?: boolean;
|
|
199
|
+
} | null | undefined>;
|
|
285
200
|
assets?: {
|
|
286
201
|
binding?: string;
|
|
287
202
|
directory?: string;
|
|
203
|
+
html_handling?: string;
|
|
204
|
+
not_found_handling?: string;
|
|
205
|
+
run_worker_first?: boolean | ReadonlyArray<string>;
|
|
288
206
|
};
|
|
289
207
|
browser?: {
|
|
290
208
|
binding?: string;
|
|
291
209
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
210
|
+
cache?: {
|
|
211
|
+
enabled?: boolean;
|
|
212
|
+
} | null;
|
|
213
|
+
compatibility_date?: string;
|
|
214
|
+
compatibility_flags?: ReadonlyArray<string>;
|
|
215
|
+
containers?: ReadonlyArray<WranglerContainerEntry | null | undefined>;
|
|
216
|
+
d1_databases?: ReadonlyArray<{
|
|
217
|
+
binding?: string;
|
|
218
|
+
database_id?: string;
|
|
219
|
+
database_name?: string;
|
|
220
|
+
migrations_dir?: string;
|
|
221
|
+
migrations_pattern?: string;
|
|
222
|
+
} | null | undefined>;
|
|
223
|
+
dispatch_namespaces?: ReadonlyArray<{
|
|
224
|
+
binding?: string;
|
|
225
|
+
namespace?: string;
|
|
226
|
+
outbound?: unknown;
|
|
227
|
+
} | null | undefined>;
|
|
228
|
+
durable_objects?: {
|
|
229
|
+
bindings?: ReadonlyArray<WranglerDurableObjectBinding$1>;
|
|
230
|
+
};
|
|
231
|
+
env?: Record<string, WranglerConfig>;
|
|
298
232
|
exports?: Record<string, {
|
|
299
|
-
|
|
233
|
+
cache?: {
|
|
234
|
+
enabled?: boolean;
|
|
235
|
+
} | null;
|
|
236
|
+
default_retention?: unknown;
|
|
237
|
+
limits?: unknown;
|
|
238
|
+
name?: unknown;
|
|
239
|
+
schedules?: unknown;
|
|
300
240
|
type?: string;
|
|
241
|
+
} | null> | null;
|
|
242
|
+
flagship?: ReadonlyArray<{
|
|
243
|
+
app_id?: string;
|
|
244
|
+
binding?: string;
|
|
301
245
|
} | null | undefined>;
|
|
302
246
|
hyperdrive?: ReadonlyArray<{
|
|
303
247
|
binding?: string;
|
|
304
248
|
id?: string;
|
|
305
|
-
|
|
249
|
+
localConnectionString?: string;
|
|
250
|
+
} | null | undefined>;
|
|
306
251
|
images?: {
|
|
307
252
|
binding?: string;
|
|
308
253
|
};
|
|
254
|
+
k2?: ReadonlyArray<unknown>;
|
|
255
|
+
kv_namespaces?: ReadonlyArray<{
|
|
256
|
+
binding?: string;
|
|
257
|
+
id?: string;
|
|
258
|
+
} | null | undefined>;
|
|
259
|
+
limits?: {
|
|
260
|
+
cpu_ms?: number;
|
|
261
|
+
};
|
|
262
|
+
logpush?: boolean;
|
|
263
|
+
main?: string;
|
|
309
264
|
media?: {
|
|
310
265
|
binding?: string;
|
|
311
266
|
};
|
|
312
|
-
|
|
267
|
+
migrations?: ReadonlyArray<{
|
|
268
|
+
deleted_classes?: ReadonlyArray<string>;
|
|
269
|
+
new_classes?: ReadonlyArray<string>;
|
|
270
|
+
new_sqlite_classes?: ReadonlyArray<string>;
|
|
271
|
+
renamed_classes?: ReadonlyArray<{
|
|
272
|
+
from?: string;
|
|
273
|
+
to?: string;
|
|
274
|
+
} | null | undefined>;
|
|
275
|
+
} | null | undefined>;
|
|
276
|
+
mtls_certificates?: ReadonlyArray<{
|
|
277
|
+
binding?: string;
|
|
278
|
+
certificate_id?: string;
|
|
279
|
+
} | null | undefined>;
|
|
280
|
+
observability?: WranglerObservability;
|
|
313
281
|
pipelines?: ReadonlyArray<{
|
|
314
282
|
binding?: string;
|
|
315
283
|
pipeline?: string;
|
|
316
284
|
stream?: string;
|
|
317
|
-
}>;
|
|
318
|
-
|
|
285
|
+
} | null | undefined>;
|
|
286
|
+
placement?: {
|
|
287
|
+
host?: string;
|
|
288
|
+
hostname?: string;
|
|
289
|
+
mode?: string;
|
|
290
|
+
region?: string;
|
|
291
|
+
};
|
|
319
292
|
queues?: {
|
|
320
|
-
consumers?: ReadonlyArray<
|
|
321
|
-
|
|
322
|
-
}>;
|
|
323
|
-
producers?: ReadonlyArray<{
|
|
324
|
-
binding?: string;
|
|
325
|
-
queue?: string;
|
|
326
|
-
}>;
|
|
293
|
+
consumers?: ReadonlyArray<WranglerQueueConsumer | null | undefined>;
|
|
294
|
+
producers?: ReadonlyArray<WranglerQueueProducer | null | undefined>;
|
|
327
295
|
};
|
|
328
|
-
|
|
296
|
+
r2_buckets?: ReadonlyArray<{
|
|
297
|
+
binding?: string;
|
|
298
|
+
bucket_name?: string;
|
|
299
|
+
jurisdiction?: string;
|
|
300
|
+
} | null | undefined>;
|
|
301
|
+
secrets?: {
|
|
302
|
+
required?: unknown;
|
|
303
|
+
} | null;
|
|
304
|
+
secrets_store_secrets?: ReadonlyArray<{
|
|
305
|
+
binding?: string;
|
|
306
|
+
secret_name?: string;
|
|
307
|
+
store_id?: string;
|
|
308
|
+
} | null | undefined>;
|
|
309
|
+
send_email?: ReadonlyArray<{
|
|
310
|
+
allowed_destination_addresses?: ReadonlyArray<string>;
|
|
311
|
+
destination_address?: string;
|
|
312
|
+
name?: string;
|
|
313
|
+
} | null | undefined>;
|
|
329
314
|
services?: ReadonlyArray<{
|
|
330
315
|
binding?: string;
|
|
331
316
|
entrypoint?: string;
|
|
317
|
+
environment?: string;
|
|
332
318
|
service?: string;
|
|
333
|
-
}>;
|
|
319
|
+
} | null | undefined>;
|
|
334
320
|
stream?: {
|
|
335
321
|
binding?: string;
|
|
336
322
|
};
|
|
323
|
+
tail_consumers?: ReadonlyArray<TailConsumer | null | undefined>;
|
|
324
|
+
vars?: Record<string, unknown>;
|
|
337
325
|
vectorize?: ReadonlyArray<{
|
|
338
326
|
binding?: string;
|
|
339
327
|
index_name?: string;
|
|
340
|
-
}>;
|
|
328
|
+
} | null | undefined>;
|
|
341
329
|
vpc_networks?: ReadonlyArray<{
|
|
342
330
|
binding?: string;
|
|
343
331
|
network_id?: string;
|
|
332
|
+
remote?: boolean;
|
|
344
333
|
tunnel_id?: string;
|
|
345
|
-
}>;
|
|
334
|
+
} | null | undefined>;
|
|
346
335
|
vpc_services?: ReadonlyArray<{
|
|
347
336
|
binding?: string;
|
|
337
|
+
remote?: boolean;
|
|
348
338
|
service_id?: string;
|
|
349
|
-
}>;
|
|
350
|
-
workflows?: ReadonlyArray<
|
|
351
|
-
binding?: string;
|
|
352
|
-
class_name?: string;
|
|
353
|
-
name?: string;
|
|
354
|
-
}>;
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Build the manifest for a parsed `wrangler.jsonc`.
|
|
358
|
-
*
|
|
359
|
-
* Pure: reads nothing and writes nothing, so the caller decides where the
|
|
360
|
-
* document lands and the mapping stays testable as a plain object comparison.
|
|
361
|
-
* @param config The parsed, already-reconciled `wrangler.jsonc`.
|
|
362
|
-
* @returns the requirements document.
|
|
363
|
-
*/
|
|
364
|
-
declare const buildBindingManifest: (config: ManifestConfigShape) => BindingManifest;
|
|
365
|
-
/** Env var the once-per-process-tree guard behind {@link warnCloudflareCliConfigOnce} sets. */
|
|
366
|
-
declare const CLOUDFLARE_CLI_CONFIG_WARNING_ENV = "LUNORA_CF_CONFIG_WARNING_SHOWN";
|
|
367
|
-
/** A detected Cloudflare CLI config: what was found, and what to do about it. */
|
|
368
|
-
interface CloudflareCliConfigFinding {
|
|
369
|
-
/** What to do — `cf` resource commands are fine, lifecycle commands are not. Links the tracking issue. */
|
|
370
|
-
fix: string;
|
|
371
|
-
/** One line: which file was found, where, and why it is a problem. */
|
|
372
|
-
message: string;
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Detect a Cloudflare CLI config (`cloudflare.config.{ts,mts,js,mjs}`) in
|
|
376
|
-
* `projectRoot`, or `undefined` when there is none. The message names the
|
|
377
|
-
* wrangler config actually present (`wrangler.jsonc` / `wrangler.json`), or says
|
|
378
|
-
* "in the project root" when there is none yet.
|
|
379
|
-
*/
|
|
380
|
-
declare const detectCloudflareCliConfig: (projectRoot: string) => CloudflareCliConfigFinding | undefined;
|
|
381
|
-
/**
|
|
382
|
-
* Warn through `warn` when `projectRoot` holds a Cloudflare CLI config — once
|
|
383
|
-
* per process tree (a rebuild, a dev-server restart, or a child process that
|
|
384
|
-
* inherited the env stays quiet). The guard is read before the filesystem probe,
|
|
385
|
-
* and claimed only when there is something to say. Non-blocking by design: the
|
|
386
|
-
* risk is a separate `cf` lifecycle command, not anything Lunora runs. Returns
|
|
387
|
-
* whether it warned.
|
|
388
|
-
*/
|
|
389
|
-
declare const warnCloudflareCliConfigOnce: (projectRoot: string, warn: (message: string) => void) => boolean;
|
|
390
|
-
/** The Cloudflare deploy driver. */
|
|
391
|
-
declare const CLOUDFLARE_DRIVER: DeployDriver;
|
|
392
|
-
/**
|
|
393
|
-
* The `global_fetch_strictly_public` compatibility flag: every global `fetch` from
|
|
394
|
-
* the Worker goes out to the public internet, never to a private or special-use
|
|
395
|
-
* address. `workersCimdFetch()` from `@lunora/auth/cimd/workers` refuses to build
|
|
396
|
-
* without it, and `lunora doctor` checks for it wherever that transport is imported.
|
|
397
|
-
*/
|
|
398
|
-
declare const GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG = "global_fetch_strictly_public";
|
|
399
|
-
/** Inputs, injectable so tests never read the real home directory or env. */
|
|
400
|
-
interface CloudflareCredentialProbe {
|
|
401
|
-
env?: Record<string, string | undefined>;
|
|
402
|
-
home?: string;
|
|
403
|
-
/** Project whose `.env` files are read; omit to skip them. */
|
|
404
|
-
projectRoot?: string;
|
|
405
|
-
}
|
|
406
|
-
declare const hasCloudflareCredentials: (probe?: CloudflareCredentialProbe) => boolean;
|
|
407
|
-
/** Which kind of temp config a file is, in its name. */
|
|
408
|
-
type DevConfigKind = "dev" | "service";
|
|
409
|
-
/** A remote-only binding a logged-out dev session leaves out: which kind it is, and the name the app gave it. */
|
|
410
|
-
interface WithheldBinding {
|
|
411
|
-
binding: string;
|
|
412
|
-
kind: "ai" | "artifacts";
|
|
413
|
-
}
|
|
414
|
-
/** The slice of a worker config the rule reads. */
|
|
415
|
-
interface RemoteOnlyBindings {
|
|
416
|
-
ai?: {
|
|
417
|
-
binding?: string;
|
|
418
|
-
} | null;
|
|
419
|
-
artifacts?: ReadonlyArray<{
|
|
420
|
-
binding?: string;
|
|
421
|
-
} | null | undefined> | null;
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* The bindings to withhold from a logged-out dev session. Workers AI and Artifacts have no
|
|
425
|
-
* local simulator, so each opens a remote proxy session at boot that fails without a login and
|
|
426
|
-
* takes the dev server down. The credential probe runs only when one of them is declared.
|
|
427
|
-
*/
|
|
428
|
-
declare const withheldBindings: (config: RemoteOnlyBindings | undefined, hasCredentials: () => boolean) => WithheldBinding[];
|
|
429
|
-
/** The one dev warning for a withheld binding, shared by `lunora dev` and `@lunora/vite`. */
|
|
430
|
-
declare const describeWithheld: ({ binding, kind }: WithheldBinding) => string;
|
|
431
|
-
/** The slice of PGlite this module drives, so a test can stand in for the WASM engine. */
|
|
432
|
-
interface PgliteRuntime {
|
|
433
|
-
createServer: (dataDirectory: string) => Promise<{
|
|
434
|
-
connectionString: string;
|
|
435
|
-
stop: () => Promise<void>;
|
|
436
|
-
}>;
|
|
437
|
-
}
|
|
438
|
-
interface StartLocalHyperdriveOptions {
|
|
439
|
-
/** Defaults to `process.env`; the connection strings are written here and removed again by `stop`. */
|
|
440
|
-
env?: NodeJS.ProcessEnv;
|
|
441
|
-
/** Injection seam; defaults to the real PGlite. Resolves `undefined` when it is not installed. */
|
|
442
|
-
load?: () => Promise<PgliteRuntime | undefined>;
|
|
443
|
-
/** Called once with a line to show the developer when the database could not be started. */
|
|
444
|
-
onWarning?: (message: string) => void;
|
|
445
|
-
projectRoot: string;
|
|
446
|
-
/** The wrangler config the session actually runs (the Cloudflare plugin's `configPath`); defaults to the project's own. */
|
|
447
|
-
wranglerConfigPath?: string;
|
|
448
|
-
}
|
|
449
|
-
interface LocalHyperdrive {
|
|
450
|
-
/** The bindings served by PGlite. */
|
|
451
|
-
bindings: string[];
|
|
452
|
-
stop: () => Promise<void>;
|
|
453
|
-
}
|
|
454
|
-
/** The Hyperdrive bindings in `wrangler.jsonc` that nothing local backs yet. */
|
|
455
|
-
declare const bindingsNeedingDatabase: (projectRoot: string, env: NodeJS.ProcessEnv, wranglerEnvironment?: string | undefined, configPath?: string) => string[];
|
|
456
|
-
/**
|
|
457
|
-
* Start a PGlite for every Hyperdrive binding with no local database, and point
|
|
458
|
-
* wrangler at it through its environment variable. Resolves `undefined` when
|
|
459
|
-
* there is nothing to serve, or when PGlite is not installed (after saying how
|
|
460
|
-
* to install it).
|
|
461
|
-
*/
|
|
462
|
-
declare const startLocalHyperdrive: (options: StartLocalHyperdriveOptions) => Promise<LocalHyperdrive | undefined>;
|
|
463
|
-
interface Manifest {
|
|
464
|
-
/** The manifest's `lunora` value, when it has one and it is an object. */
|
|
465
|
-
lunora: Record<string, unknown> | undefined;
|
|
466
|
-
/**
|
|
467
|
-
* `true` when the manifest holds a `lunora` value that is NOT a plain object.
|
|
468
|
-
* {@link readManifest} normalises that to `lunora: undefined`, but the TEXT
|
|
469
|
-
* still has it — and `modify(text, ["lunora", "crons"], …)` throws
|
|
470
|
-
* `Can not add index to parent of type string` on a scalar or array parent.
|
|
471
|
-
*/
|
|
472
|
-
lunoraIsForeign: boolean;
|
|
473
|
-
path: string;
|
|
474
|
-
text: string;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* The project manifest, or `undefined` when it is missing or is not readable
|
|
478
|
-
* JSON.
|
|
479
|
-
*
|
|
480
|
-
* Unreadable reads as "no ownership recorded" rather than throwing: this runs
|
|
481
|
-
* inside a deploy and inside every dev-server schema save, where a manifest that
|
|
482
|
-
* broken already fails for reasons that have nothing to do with the record.
|
|
483
|
-
*/
|
|
484
|
-
declare const readManifest: (projectRoot: string) => Manifest | undefined;
|
|
485
|
-
/**
|
|
486
|
-
* Set `lunora.<key>` to `value`, or drop it when `value` is `undefined` — and
|
|
487
|
-
* the `lunora` object with it, when nothing else lives there, so a project with
|
|
488
|
-
* nothing recorded keeps an unmarked manifest.
|
|
489
|
-
*/
|
|
490
|
-
declare const recordManifestKey: (manifest: Manifest, key: string, value: unknown) => void;
|
|
491
|
-
interface ProjectAssetHeadersInput {
|
|
492
|
-
/**
|
|
493
|
-
* The build's directory of content-hashed files, relative to `outputDirectory`
|
|
494
|
-
* (Vite's `build.assetsDir`, Astro's `_astro`, Rsbuild's `static`). Pass it only when
|
|
495
|
-
* the integration can vouch that every file it writes there carries a content hash.
|
|
496
|
-
*/
|
|
497
|
-
hashedDirectory?: string;
|
|
498
|
-
/**
|
|
499
|
-
* The file-name patterns (relative to `outputDirectory`, Rollup placeholders) the build names its hashed files
|
|
500
|
-
* with. Given, every file the build left in `hashedDirectory` must have such a name, or the directory is not
|
|
501
|
-
* cached for good: a plugin can emit a fixed name there that the patterns never see.
|
|
502
|
-
*/
|
|
503
|
-
hashedNamePatterns?: ReadonlyArray<string>;
|
|
504
|
-
/** Absolute directory the build wrote its client output to. */
|
|
505
|
-
outputDirectory: string;
|
|
506
|
-
projectRoot: string;
|
|
507
|
-
/** Absolute `public/` directory the build copies verbatim into `outputDirectory`, if any. */
|
|
508
|
-
publicDirectory?: string;
|
|
509
|
-
/**
|
|
510
|
-
* Write only when `outputDirectory` is the `assets.directory` wrangler deploys.
|
|
511
|
-
* `@lunora/vite` passes `false`: with `@cloudflare/vite-plugin` in the build, the
|
|
512
|
-
* client `outDir` is the assets root even when wrangler declares no `assets` block.
|
|
513
|
-
*/
|
|
514
|
-
requireAssetsDirectory: boolean;
|
|
515
|
-
/** Schema directory relative to `projectRoot`; `lunora.config` is looked up from it. Defaults to `lunora`. */
|
|
516
|
-
schemaDir?: string;
|
|
517
|
-
/** The deploy target an integration was configured with; resolved from `lunora.config` when omitted. Only `"cloudflare"` serves `_headers`. */
|
|
518
|
-
target?: string;
|
|
519
|
-
/** Absolute path of the wrangler config the build deploys (`@cloudflare/vite-plugin`'s `configPath`). Defaults to the project's own. */
|
|
520
|
-
wranglerPath?: string;
|
|
339
|
+
} | null | undefined>;
|
|
340
|
+
workflows?: ReadonlyArray<WranglerWorkflowEntry | null | undefined>;
|
|
521
341
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
342
|
+
interface WranglerValidationReport {
|
|
343
|
+
errors: string[];
|
|
344
|
+
valid: boolean;
|
|
345
|
+
warnings: string[];
|
|
526
346
|
}
|
|
527
|
-
type ProjectAssetHeadersOutcome = {
|
|
528
|
-
reason: string;
|
|
529
|
-
written: false;
|
|
530
|
-
} | {
|
|
531
|
-
result: AssetHeadersResult;
|
|
532
|
-
written: true;
|
|
533
|
-
};
|
|
534
|
-
/**
|
|
535
|
-
* Write the managed `_headers` block for one build output and report it through
|
|
536
|
-
* the build's logger: the headers left to the user's own rules, then each
|
|
537
|
-
* warning. The single entry point every bundler integration calls after its
|
|
538
|
-
* client build.
|
|
539
|
-
*/
|
|
540
|
-
declare const emitProjectAssetHeaders: (input: ProjectAssetHeadersInput, logger: AssetHeadersLogger) => ProjectAssetHeadersOutcome;
|
|
541
347
|
/**
|
|
542
348
|
* A container/workflow that is declared (so codegen emits its class) but the
|
|
543
349
|
* worker entry never re-exports — the one wiring step the generators can't always
|
|
@@ -595,697 +401,920 @@ interface ReconcileBindingsResult {
|
|
|
595
401
|
*
|
|
596
402
|
* Exported because reconciliation is not the only caller that needs the answer:
|
|
597
403
|
* `lunora codegen` and `lunora doctor` both want the gaps WITHOUT rewriting
|
|
598
|
-
* `wrangler.jsonc`, which is the rest of what
|
|
404
|
+
* `wrangler.jsonc`, which is the rest of what `reconcileWranglerBindings` (`apply-bindings.ts`)
|
|
599
405
|
* does. Deriving them again from `inferred.{containers,workflows,agents}` at each
|
|
600
406
|
* call site is how one kind ends up silently uncovered.
|
|
601
407
|
*/
|
|
602
408
|
declare const collectExportGaps: (inferred: InferredBindings) => ExportGap[];
|
|
603
|
-
/**
|
|
604
|
-
|
|
605
|
-
*
|
|
606
|
-
* Writes only when something is missing; returns `changed: false` when the
|
|
607
|
-
* config already satisfies the inferred needs.
|
|
608
|
-
*
|
|
609
|
-
* `environment`, when passed, does NOT change where this provisions — every
|
|
610
|
-
* step below still only ADDS to the TOP-LEVEL config; wrangler's `env.<name>`
|
|
611
|
-
* blocks have no auto-provisioning path today. The one write into the block is
|
|
612
|
-
* {@link reconcileEnvQueues}, which retunes queue consumers the block already
|
|
613
|
-
* declares and adds nothing. Otherwise it is used only to emit an
|
|
614
|
-
* advisory warning, because bindings (`durable_objects`, `d1_databases`, …)
|
|
615
|
-
* are non-inheritable (see `wrangler-environment.ts`'s `NON_INHERITABLE_KEYS`):
|
|
616
|
-
* a `--env production` deploy needs its OWN copy of each one, and silently
|
|
617
|
-
* writing only to the top level would leave that gap unmentioned. Extending
|
|
618
|
-
* the JSONC writer itself to target `env.<name>.*` idempotently for every
|
|
619
|
-
* binding kind here is a separate, larger change (each of the ~10 pipeline
|
|
620
|
-
* steps below reads AND writes the top-level path) that this fix does not
|
|
621
|
-
* attempt — `lunora deploy --env <name>` now VALIDATES the env-scoped view
|
|
622
|
-
* (closing the reported gap), it just doesn't yet auto-provision it.
|
|
623
|
-
*/
|
|
624
|
-
declare const reconcileWranglerBindings: (projectRoot: string, inferred: InferredBindings, { environment, target }?: {
|
|
409
|
+
/** Plan and apply in one pass: what `lunora deploy` and the dev-start reconcile run. */
|
|
410
|
+
declare const reconcileWranglerBindings: (projectRoot: string, inferred: InferredBindings, options?: {
|
|
625
411
|
environment?: string;
|
|
626
412
|
target?: string;
|
|
627
413
|
}) => ReconcileBindingsResult;
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
wranglerPath?: string;
|
|
414
|
+
/** The project coordinates the validator needs. */
|
|
415
|
+
interface AssertWranglerOptions {
|
|
416
|
+
/** Memoises the schema discovery, shared with binding inference. */
|
|
417
|
+
cache?: DiscoveryCache;
|
|
418
|
+
/** Absolute path to the project root holding `wrangler.jsonc`. */
|
|
419
|
+
projectRoot: string;
|
|
420
|
+
/** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
|
|
421
|
+
schemaDir: string;
|
|
637
422
|
}
|
|
638
423
|
/**
|
|
639
|
-
*
|
|
640
|
-
*
|
|
424
|
+
* Throw unless `wrangler.jsonc` satisfies the schema's binding requirements.
|
|
425
|
+
*
|
|
426
|
+
* Non-blocking validator warnings go to `warn`. `remedy` closes both error
|
|
427
|
+
* messages — the caller's own "and restart the dev server" / "and rebuild" —
|
|
428
|
+
* since that is the only part a reader acts on differently per front-end.
|
|
429
|
+
*
|
|
430
|
+
* Must run AFTER binding provisioning: the bindings this requires are largely the
|
|
431
|
+
* ones Lunora writes itself, so validating first fails the very first build of any
|
|
432
|
+
* project that declares a `.global()` table or a container.
|
|
641
433
|
*/
|
|
642
|
-
declare const
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
434
|
+
declare const assertWranglerSatisfiesSchema: (options: AssertWranglerOptions, warn: (message: string) => void, remedy: string) => void;
|
|
435
|
+
/** `Cross-Origin-Opener-Policy` values. `false` omits the header. */
|
|
436
|
+
type CrossOriginOpenerPolicy = "same-origin" | "same-origin-allow-popups" | "unsafe-none";
|
|
437
|
+
/** Per-header overrides for the baseline security headers. `false` omits the header. */
|
|
438
|
+
interface SecurityHeadersOptions {
|
|
646
439
|
/**
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
* does and the one thing worth printing.
|
|
440
|
+
* `Cross-Origin-Opener-Policy`. Defaults to `same-origin-allow-popups`: a
|
|
441
|
+
* cross-origin page that opens yours gets no handle on it, while a popup your
|
|
442
|
+
* page opens (an OAuth provider, a payment sheet) can still message back
|
|
443
|
+
* through `window.opener`. `same-origin` severs that too; `false` omits the header.
|
|
652
444
|
*/
|
|
653
|
-
|
|
654
|
-
/** Human-readable reason when reconciliation was skipped (for logging). */
|
|
655
|
-
reason?: string;
|
|
445
|
+
crossOriginOpenerPolicy?: CrossOriginOpenerPolicy | false;
|
|
656
446
|
/**
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
447
|
+
* `Content-Security-Policy`. Omitted (`undefined`) applies a restrictive
|
|
448
|
+
* `default-src 'none'` policy to **non-HTML** responses, and a conservative
|
|
449
|
+
* hardening policy to **HTML** responses (`base-uri 'none'; object-src
|
|
450
|
+
* 'none'; frame-ancestors …`) — this does NOT set `default-src`/`script-src`,
|
|
451
|
+
* so it never blocks a page's own scripts/styles/images/fetches. Pass a string
|
|
452
|
+
* to apply that exact policy to every response (HTML included); `false` to
|
|
453
|
+
* never send one. Neither can be combined with {@link frameAncestors}: put the
|
|
454
|
+
* `frame-ancestors` directive in the string.
|
|
455
|
+
*/
|
|
456
|
+
csp?: string | false;
|
|
457
|
+
/**
|
|
458
|
+
* Origins allowed to embed your HTML pages in a frame, besides your own
|
|
459
|
+
* (e.g. `["https://partner.example"]`). Sets the HTML policy's
|
|
460
|
+
* `frame-ancestors 'self' <origins>` and drops `X-Frame-Options`, which
|
|
461
|
+
* cannot express a list (browsers that understand `frame-ancestors` ignore
|
|
462
|
+
* it anyway). Cannot be combined with `frameOptions: "DENY"`, a `csp` string,
|
|
463
|
+
* or `csp: false` (which would leave no header restricting framing).
|
|
464
|
+
*/
|
|
465
|
+
frameAncestors?: ReadonlyArray<string>;
|
|
466
|
+
/** `X-Frame-Options` (clickjacking). Defaults to `SAMEORIGIN`. `false` omits it. */
|
|
467
|
+
frameOptions?: "DENY" | "SAMEORIGIN" | false;
|
|
468
|
+
/** `Strict-Transport-Security`. The Worker sends it only over HTTPS. `false` omits it. */
|
|
469
|
+
hsts?: boolean | {
|
|
470
|
+
includeSubDomains?: boolean;
|
|
471
|
+
maxAge?: number;
|
|
472
|
+
preload?: boolean;
|
|
473
|
+
};
|
|
474
|
+
/** `Permissions-Policy`. Defaults to a minimal deny list. `false` omits it. */
|
|
475
|
+
permissionsPolicy?: string | false;
|
|
476
|
+
/** `Referrer-Policy`. Defaults to `strict-origin-when-cross-origin`. `false` omits it. */
|
|
477
|
+
referrerPolicy?: string | false;
|
|
478
|
+
}
|
|
479
|
+
interface AssetHeadersOptions {
|
|
480
|
+
/**
|
|
481
|
+
* The security headers to write for `/*`, in the runtime's `security.headers`
|
|
482
|
+
* shape: `undefined` or `true` for the defaults, `false` for none.
|
|
483
|
+
*/
|
|
484
|
+
headers: boolean | SecurityHeadersOptions | undefined;
|
|
485
|
+
/**
|
|
486
|
+
* The directory, relative to the assets root, that holds only content-hashed
|
|
487
|
+
* files (Vite's `build.assetsDir`). Its files get {@link IMMUTABLE_CACHE_CONTROL}.
|
|
488
|
+
* Omit it when that cannot be promised: one unhashed file there would be
|
|
489
|
+
* cached for a year. Omit it too when `not_found_handling` is a fallback
|
|
490
|
+
* (`single-page-application`, `404-page`): `_headers` matches the request
|
|
491
|
+
* path, so a request for a chunk a later deploy removed would get the
|
|
492
|
+
* fallback page with this policy, and keep it for a year.
|
|
662
493
|
*/
|
|
494
|
+
immutableDirectory?: string;
|
|
495
|
+
}
|
|
496
|
+
interface AssetHeadersResult {
|
|
497
|
+
/** Header names left out of the block because a rule outside it already sets them. */
|
|
498
|
+
deferred: string[];
|
|
499
|
+
/** Absolute path of the `_headers` file, or `undefined` when there is none. */
|
|
500
|
+
path: string | undefined;
|
|
501
|
+
/** Non-fatal notes for the build log. */
|
|
663
502
|
warnings: string[];
|
|
664
|
-
/** Resolved wrangler path, or `undefined` when none was found. */
|
|
665
|
-
wranglerPath?: string;
|
|
666
503
|
}
|
|
504
|
+
/** Rewrite `<directory>/_headers` with the managed block; a file left holding nothing is removed. */
|
|
505
|
+
declare const writeAssetHeaders: (directory: string, options: AssetHeadersOptions) => AssetHeadersResult;
|
|
667
506
|
/**
|
|
668
|
-
*
|
|
669
|
-
* config `triggers.crons` array, preserving comments and formatting via
|
|
670
|
-
* `jsonc-parser`'s structural edits.
|
|
671
|
-
*
|
|
672
|
-
* **This does not own the whole array.** Two runtime cron surfaces live on
|
|
673
|
-
* `createWorker` rather than in `lunora/crons.ts`: `backupCron` (the nightly
|
|
674
|
-
* NDJSON backup) and `crons` (handlers keyed by expression). Replacing the array
|
|
675
|
-
* wholesale deleted both on the next `lunora deploy` or dev-server schema save,
|
|
676
|
-
* silently — the nightly backup simply stopped. So an entry this reconciler did
|
|
677
|
-
* not generate is the user's, is kept, and is reported in
|
|
678
|
-
* {@link ReconcileResult.preserved}.
|
|
507
|
+
* Translate a `wrangler.jsonc` into an [Alchemy](https://alchemy.run) program.
|
|
679
508
|
*
|
|
680
|
-
*
|
|
681
|
-
* `cronTriggers` like any declared cron — kept because it is generated, and
|
|
682
|
-
* cleared when the entry stops declaring it. What it cannot resolve is the
|
|
683
|
-
* dynamic case, and that case is supported: `.extend((env) => ({ backupCron:
|
|
684
|
-
* env.NIGHTLY_CRON }))` is the documented escape hatch, and its value exists
|
|
685
|
-
* only at runtime. That residue — plus a computed `crons` key, a spread options
|
|
686
|
-
* object, and anything a project put in `triggers.crons` for its own reasons —
|
|
687
|
-
* is what the preserve rule below is for. It is not redundant with discovery; it
|
|
688
|
-
* is the half discovery provably cannot reach.
|
|
509
|
+
* # Why translate rather than ask for a second config
|
|
689
510
|
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
511
|
+
* `wrangler.jsonc` is already the source of truth for what an app needs, and
|
|
512
|
+
* Lunora already infers and reconciles it — `inferLunoraBindings` decides that
|
|
513
|
+
* a project needs a shard namespace and a bucket, `reconcileWranglerBindings`
|
|
514
|
+
* writes them. Asking a developer to restate all of that in an
|
|
515
|
+
* `alchemy.run.ts` would give the project two sources of truth that drift, and
|
|
516
|
+
* the drift would surface as a deploy that provisions something the app does
|
|
517
|
+
* not bind.
|
|
694
518
|
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
* removed cron firing forever.
|
|
519
|
+
* So Alchemy is an implementation detail of `deploy`, not a thing to configure:
|
|
520
|
+
* read the config, emit the program, run it.
|
|
698
521
|
*
|
|
699
|
-
*
|
|
700
|
-
* `wrangler.jsonc`. A `//` marker inside the config does not: wrangler tolerates
|
|
701
|
-
* one in either (both go through its JSONC parser), but the project's own
|
|
702
|
-
* `JSON.parse`, its deploy wrapper and its editor's JSON schema validation all
|
|
703
|
-
* break the moment a `.json` grows a comment. Nor can the record be a plain key
|
|
704
|
-
* in the wrangler config — wrangler reports unknown fields ("Unexpected fields
|
|
705
|
-
* found in top-level field") on every command.
|
|
522
|
+
* # Why this emits source rather than calling Alchemy
|
|
706
523
|
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
524
|
+
* `alchemy@0.93` has thirty dependencies, nine of them Node-shaped —
|
|
525
|
+
* `wrangler`, `miniflare`, `esbuild`, `execa`, `find-process`, `glob`, `open`,
|
|
526
|
+
* `proper-lockfile`, `signal-exit`. `@lunora/config` is imported by
|
|
527
|
+
* `@lunora/vite`, so importing Alchemy here would push that tree into every
|
|
528
|
+
* project that merely wanted to read `lunora.config.*`, and into any bundle
|
|
529
|
+
* targeting workerd — where none of it survives.
|
|
711
530
|
*
|
|
712
|
-
*
|
|
713
|
-
*
|
|
714
|
-
*
|
|
531
|
+
* Emitting text keeps this module pure and dependency-free. Alchemy is invoked
|
|
532
|
+
* as a CLI against the generated file, so it only has to exist on the machine
|
|
533
|
+
* that deploys.
|
|
715
534
|
*
|
|
716
|
-
*
|
|
717
|
-
* manifest — treats every entry as the user's, which is the safe direction: a
|
|
718
|
-
* wrongly-kept trigger costs one no-op invocation, a wrongly-deleted one
|
|
719
|
-
* silently ends the backups. It becomes precise after a codegen run that still
|
|
720
|
-
* declares the cron; upgrading and deleting a cron in the same change records an
|
|
721
|
-
* empty set, and that orphan is then kept for good.
|
|
535
|
+
* # Adoption, not re-creation
|
|
722
536
|
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
|
|
727
|
-
declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: ReadonlyArray<string>) => ReconcileResult;
|
|
728
|
-
/**
|
|
729
|
-
* The one log line worth printing for a reconcile that kept entries it does not
|
|
730
|
-
* own, or `undefined` when it owned the whole array. Lives here rather than in
|
|
731
|
-
* each caller because `lunora deploy` and the Vite plugin print it verbatim and
|
|
732
|
-
* had already drifted into two copies of the same sentence.
|
|
537
|
+
* Every resource is emitted with `adopt: true`. A project translated from an
|
|
538
|
+
* existing `wrangler.jsonc` already *has* its D1 database and its bucket, with
|
|
539
|
+
* data in them. Without adoption Alchemy would treat them as new and try to
|
|
540
|
+
* create alongside — the one outcome a deploy must never have.
|
|
733
541
|
*/
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
/** Absolute path to the project root holding `wrangler.jsonc`. */
|
|
740
|
-
projectRoot: string;
|
|
741
|
-
/** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
|
|
742
|
-
schemaDir: string;
|
|
743
|
-
/** The deploy target; wrangler settings only Cloudflare reads are written only for `"cloudflare"` (or when omitted). */
|
|
744
|
-
target?: string;
|
|
542
|
+
/** A Durable Object binding as `wrangler.jsonc` spells it. */
|
|
543
|
+
interface WranglerDurableObjectBinding {
|
|
544
|
+
class_name?: string;
|
|
545
|
+
name?: string;
|
|
546
|
+
script_name?: string;
|
|
745
547
|
}
|
|
746
|
-
/** The
|
|
747
|
-
interface
|
|
748
|
-
|
|
749
|
-
|
|
548
|
+
/** The slice of `wrangler.jsonc` that translates into Alchemy resources. */
|
|
549
|
+
interface WranglerConfigShape {
|
|
550
|
+
compatibility_date?: string;
|
|
551
|
+
compatibility_flags?: ReadonlyArray<string>;
|
|
552
|
+
d1_databases?: ReadonlyArray<{
|
|
553
|
+
binding?: string;
|
|
554
|
+
database_id?: string;
|
|
555
|
+
database_name?: string;
|
|
556
|
+
}>;
|
|
557
|
+
durable_objects?: {
|
|
558
|
+
bindings?: ReadonlyArray<WranglerDurableObjectBinding>;
|
|
559
|
+
};
|
|
560
|
+
kv_namespaces?: ReadonlyArray<{
|
|
561
|
+
binding?: string;
|
|
562
|
+
id?: string;
|
|
563
|
+
}>;
|
|
564
|
+
main?: string;
|
|
565
|
+
/** `new_sqlite_classes` marks which DO classes get SQLite storage — Alchemy needs that per namespace. */
|
|
566
|
+
migrations?: ReadonlyArray<{
|
|
567
|
+
new_classes?: ReadonlyArray<string>;
|
|
568
|
+
new_sqlite_classes?: ReadonlyArray<string>;
|
|
569
|
+
}>;
|
|
570
|
+
name?: string;
|
|
571
|
+
/** Only `producers` translate; a `consumers` entry is dropped and reported as `queues.consumers`. */
|
|
572
|
+
queues?: {
|
|
573
|
+
consumers?: ReadonlyArray<{
|
|
574
|
+
queue?: string;
|
|
575
|
+
}>;
|
|
576
|
+
producers?: ReadonlyArray<{
|
|
577
|
+
binding?: string;
|
|
578
|
+
queue?: string;
|
|
579
|
+
}>;
|
|
580
|
+
};
|
|
581
|
+
r2_buckets?: ReadonlyArray<{
|
|
582
|
+
binding?: string;
|
|
583
|
+
bucket_name?: string;
|
|
584
|
+
}>;
|
|
585
|
+
triggers?: {
|
|
586
|
+
crons?: ReadonlyArray<string>;
|
|
587
|
+
};
|
|
588
|
+
vars?: Readonly<Record<string, unknown>>;
|
|
589
|
+
}
|
|
590
|
+
/** What the translation could not carry over, so the caller can say so out loud. */
|
|
591
|
+
interface AlchemyTranslation {
|
|
592
|
+
/** The emitted program source. */
|
|
593
|
+
source: string;
|
|
594
|
+
/**
|
|
595
|
+
* Bindings present in `wrangler.jsonc` that this translation drops.
|
|
596
|
+
*
|
|
597
|
+
* Reported rather than silently omitted: a deploy that quietly loses a
|
|
598
|
+
* Vectorize index produces a worker whose `env.POSTS_SEARCH` is undefined
|
|
599
|
+
* at runtime, and nothing in the build says why.
|
|
600
|
+
*/
|
|
601
|
+
unsupported: ReadonlyArray<string>;
|
|
750
602
|
}
|
|
751
603
|
/**
|
|
752
|
-
*
|
|
753
|
-
* into `wrangler.jsonc` (Durable Objects, their migration classes, and the
|
|
754
|
-
* `DB` D1 binding for `.global()` schemas). Best-effort and idempotent — runs
|
|
755
|
-
* once at startup so the user never hand-writes binding boilerplate. A failure
|
|
756
|
-
* here must never abort codegen; the wrangler validator reports real problems.
|
|
604
|
+
* Translate a parsed `wrangler.jsonc` into an Alchemy program.
|
|
757
605
|
*
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
606
|
+
* Pure: it reads nothing and writes nothing, so the caller decides where the
|
|
607
|
+
* source lands and the whole thing stays testable as a string comparison.
|
|
608
|
+
* @param config The parsed `wrangler.jsonc`.
|
|
609
|
+
* @returns the program source, plus whatever could not be carried over.
|
|
761
610
|
*/
|
|
762
|
-
declare const
|
|
763
|
-
/**
|
|
764
|
-
declare const
|
|
611
|
+
declare const wranglerToAlchemy: (config: WranglerConfigShape) => AlchemyTranslation;
|
|
612
|
+
/** Schema version of the emitted document, so a consumer can gate on shape changes. */
|
|
613
|
+
declare const BINDING_MANIFEST_VERSION = 1;
|
|
765
614
|
/**
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
*
|
|
770
|
-
* `"array"` is a top-level array of binding objects (`d1_databases`,
|
|
771
|
-
* `kv_namespaces`, `r2_buckets`, `vectorize`, `services`). `"producers"` is
|
|
772
|
-
* `queues.producers[]` — consumers are NOT remoted (their schema has no `remote`
|
|
773
|
-
* field) and the edit path is two levels deep. `"object"` is a single binding
|
|
774
|
-
* object, not an array (`ai`), whose edit path targets the section key directly.
|
|
775
|
-
*
|
|
776
|
-
* Every kind here was confirmed against `wrangler/config-schema.json`: the
|
|
777
|
-
* entry's schema declares a `remote` property. Deliberately omits
|
|
778
|
-
* `durable_objects` (no CF remote-DO mode; shards stay local) and sections whose
|
|
779
|
-
* schema has no `remote` field (`hyperdrive`, `analytics_engine_datasets`,
|
|
780
|
-
* `secrets_store_secrets`, queue consumers, …). Widening further is a one-line
|
|
781
|
-
* table edit.
|
|
615
|
+
* One resource the built Worker expects to be bound to. `binding` is the name the
|
|
616
|
+
* Worker reads off `env`; the remaining fields are whatever identifies the
|
|
617
|
+
* resource for that type, omitted when the config does not carry them (an id
|
|
618
|
+
* Lunora could not mint is absent here exactly as it is absent from the config).
|
|
782
619
|
*/
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
620
|
+
interface BindingRequirement {
|
|
621
|
+
/** The `env` property name the Worker reads. */
|
|
622
|
+
binding: string;
|
|
623
|
+
/**
|
|
624
|
+
* Durable Object / Workflow / Container class the Worker must export. Present
|
|
625
|
+
* for the class-backed binding types, so a deployer can assert the bundle
|
|
626
|
+
* exports it before publishing.
|
|
627
|
+
*/
|
|
628
|
+
className?: string;
|
|
629
|
+
/** Bucket name (`r2`), database name (`d1`), dataset (`analytics_engine`), queue name (`queue`), index (`vectorize`), stream (`pipeline`), namespace (`artifacts`, `ai_search_namespace`), instance (`ai_search`), Worker name (`service`). */
|
|
630
|
+
resource?: string;
|
|
631
|
+
/** Remote resource id, when the config declares one (`d1`, `kv`, `hyperdrive`, `vpc_service`, `vpc_network`). */
|
|
632
|
+
resourceId?: string;
|
|
633
|
+
/** For `durable_object`: whether the class uses SQLite storage (`new_sqlite_classes`). */
|
|
634
|
+
sqlite?: boolean;
|
|
635
|
+
/** The kind of resource, keyed to the wrangler section it came from. */
|
|
636
|
+
type: "ai" | "ai_search" | "ai_search_namespace" | "analytics_engine" | "analytics_sql" | "artifacts" | "assets" | "browser" | "container" | "d1" | "durable_object" | "hyperdrive" | "images" | "kv" | "media" | "pipeline" | "queue_consumer" | "queue_producer" | "r2" | "service" | "stream" | "vectorize" | "vpc_network" | "vpc_service" | "workflow";
|
|
637
|
+
}
|
|
638
|
+
/** The document the `lunora build --emit-bindings` flag writes. */
|
|
639
|
+
interface BindingManifest {
|
|
640
|
+
/** Every resource the Worker expects, sorted by `type` then `binding` so the file is diff-stable. */
|
|
641
|
+
bindings: ReadonlyArray<BindingRequirement>;
|
|
642
|
+
/** `compatibility_date`, when declared. */
|
|
643
|
+
compatibilityDate?: string;
|
|
644
|
+
/** `compatibility_flags`, when declared. */
|
|
645
|
+
compatibilityFlags?: ReadonlyArray<string>;
|
|
646
|
+
/** Cron expressions the Worker must be triggered on (`triggers.crons`). */
|
|
647
|
+
crons: ReadonlyArray<string>;
|
|
648
|
+
/**
|
|
649
|
+
* Config keys whose value is not the shape wrangler expects — `kv_namespaces`
|
|
650
|
+
* as an object, a `null` entry in `queues.producers` — sorted. Whatever they
|
|
651
|
+
* held is left out of `bindings`: the builder reads a hand-edited config
|
|
652
|
+
* during `lunora dev`, where throwing would abort the start, and wrangler
|
|
653
|
+
* reports the bad key itself when it loads the file.
|
|
654
|
+
*/
|
|
655
|
+
malformed: ReadonlyArray<string>;
|
|
656
|
+
/** Worker name from `wrangler.jsonc`. */
|
|
657
|
+
name?: string;
|
|
658
|
+
/**
|
|
659
|
+
* Wrangler sections present in the config that this version does not model,
|
|
660
|
+
* by field name. Empty for a fully-understood config; non-empty is a prompt to
|
|
661
|
+
* extend the collector, and is surfaced to the user rather than silently
|
|
662
|
+
* dropped.
|
|
663
|
+
*/
|
|
664
|
+
unknown: ReadonlyArray<string>;
|
|
665
|
+
/** Names of `vars` entries. Values are deliberately excluded — a manifest is committed and read by CI, and a `vars` entry can hold a value a project would rather not publish. */
|
|
666
|
+
vars: ReadonlyArray<string>;
|
|
667
|
+
/** Schema version — {@link BINDING_MANIFEST_VERSION}. */
|
|
668
|
+
version: number;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* The wider config this reads. {@link WranglerConfigShape} covers what the
|
|
672
|
+
* Alchemy translation models; a manifest additionally reports the sections that
|
|
673
|
+
* translation lists as unsupported, so those are declared here.
|
|
674
|
+
*/
|
|
675
|
+
interface ManifestConfigShape extends WranglerConfigShape {
|
|
676
|
+
ai?: {
|
|
677
|
+
binding?: string;
|
|
795
678
|
};
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
679
|
+
ai_search?: ReadonlyArray<{
|
|
680
|
+
binding?: string;
|
|
681
|
+
instance_name?: string;
|
|
682
|
+
}>;
|
|
683
|
+
ai_search_namespaces?: ReadonlyArray<{
|
|
684
|
+
binding?: string;
|
|
685
|
+
namespace?: string;
|
|
686
|
+
}>;
|
|
687
|
+
/** The Analytics SQL binding — a parameterless `{ binding }`, distinct from `analytics_engine_datasets`. */
|
|
688
|
+
analytics?: {
|
|
689
|
+
binding?: string;
|
|
799
690
|
};
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
691
|
+
analytics_engine_datasets?: ReadonlyArray<{
|
|
692
|
+
binding?: string;
|
|
693
|
+
dataset?: string;
|
|
694
|
+
}>;
|
|
695
|
+
artifacts?: ReadonlyArray<{
|
|
696
|
+
binding?: string;
|
|
697
|
+
namespace?: string;
|
|
698
|
+
}>;
|
|
699
|
+
/** Static assets carry a real `binding` the Worker reads (`env.ASSETS`). */
|
|
700
|
+
assets?: {
|
|
701
|
+
binding?: string;
|
|
702
|
+
directory?: string;
|
|
803
703
|
};
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
readonly shape: "array";
|
|
704
|
+
browser?: {
|
|
705
|
+
binding?: string;
|
|
807
706
|
};
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
707
|
+
containers?: ReadonlyArray<{
|
|
708
|
+
class_name?: string;
|
|
709
|
+
image?: string;
|
|
710
|
+
max_instances?: number;
|
|
711
|
+
}>;
|
|
712
|
+
/** Top-level exports; only `type: "workflow"` entries map to a binding requirement (see {@link collectWorkflowExports}). */
|
|
713
|
+
exports?: Record<string, {
|
|
714
|
+
name?: string;
|
|
715
|
+
type?: string;
|
|
716
|
+
} | null | undefined>;
|
|
717
|
+
hyperdrive?: ReadonlyArray<{
|
|
718
|
+
binding?: string;
|
|
719
|
+
id?: string;
|
|
720
|
+
}>;
|
|
721
|
+
images?: {
|
|
722
|
+
binding?: string;
|
|
811
723
|
};
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
readonly shape: "array";
|
|
724
|
+
media?: {
|
|
725
|
+
binding?: string;
|
|
815
726
|
};
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
727
|
+
/** `pipeline` is wrangler's deprecated spelling of `stream`; both are read. */
|
|
728
|
+
pipelines?: ReadonlyArray<{
|
|
729
|
+
binding?: string;
|
|
730
|
+
pipeline?: string;
|
|
731
|
+
stream?: string;
|
|
732
|
+
}>;
|
|
733
|
+
/** Adds `consumers` — the Alchemy translation models producers only. */
|
|
734
|
+
queues?: {
|
|
735
|
+
consumers?: ReadonlyArray<{
|
|
736
|
+
queue?: string;
|
|
737
|
+
}>;
|
|
738
|
+
producers?: ReadonlyArray<{
|
|
739
|
+
binding?: string;
|
|
740
|
+
queue?: string;
|
|
741
|
+
}>;
|
|
819
742
|
};
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
743
|
+
/** Service bindings to sibling Workers; `service` is the Worker name. */
|
|
744
|
+
services?: ReadonlyArray<{
|
|
745
|
+
binding?: string;
|
|
746
|
+
entrypoint?: string;
|
|
747
|
+
service?: string;
|
|
748
|
+
}>;
|
|
749
|
+
stream?: {
|
|
750
|
+
binding?: string;
|
|
823
751
|
};
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
* materializer prepends the section key and appends `"remote"`.
|
|
843
|
-
*/
|
|
844
|
-
path: ReadonlyArray<number | string>;
|
|
845
|
-
/** The wrangler config key the entry lives under. */
|
|
846
|
-
section: RemoteEligibleKey;
|
|
752
|
+
vectorize?: ReadonlyArray<{
|
|
753
|
+
binding?: string;
|
|
754
|
+
index_name?: string;
|
|
755
|
+
}>;
|
|
756
|
+
vpc_networks?: ReadonlyArray<{
|
|
757
|
+
binding?: string;
|
|
758
|
+
network_id?: string;
|
|
759
|
+
tunnel_id?: string;
|
|
760
|
+
}>;
|
|
761
|
+
vpc_services?: ReadonlyArray<{
|
|
762
|
+
binding?: string;
|
|
763
|
+
service_id?: string;
|
|
764
|
+
}>;
|
|
765
|
+
workflows?: ReadonlyArray<{
|
|
766
|
+
binding?: string;
|
|
767
|
+
class_name?: string;
|
|
768
|
+
name?: string;
|
|
769
|
+
}>;
|
|
847
770
|
}
|
|
848
|
-
/**
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
771
|
+
/**
|
|
772
|
+
* Build the manifest for a parsed `wrangler.jsonc`.
|
|
773
|
+
*
|
|
774
|
+
* Pure: reads nothing and writes nothing, so the caller decides where the
|
|
775
|
+
* document lands and the mapping stays testable as a plain object comparison.
|
|
776
|
+
*
|
|
777
|
+
* Total over any parsed JSON: the config is user-edited and read on every
|
|
778
|
+
* `lunora dev` start, so a section of the wrong shape lands in
|
|
779
|
+
* {@link BindingManifest.malformed} instead of throwing.
|
|
780
|
+
* @param config The parsed, already-reconciled `wrangler.jsonc`.
|
|
781
|
+
* @returns the requirements document.
|
|
782
|
+
*/
|
|
783
|
+
declare const buildBindingManifest: (config: ManifestConfigShape) => BindingManifest;
|
|
784
|
+
/** Env var the once-per-process-tree guard behind {@link warnCloudflareCliConfigOnce} sets. */
|
|
785
|
+
declare const CLOUDFLARE_CLI_CONFIG_WARNING_ENV = "LUNORA_CF_CONFIG_WARNING_SHOWN";
|
|
786
|
+
/** A detected Cloudflare CLI config: what was found, and what to do about it. */
|
|
787
|
+
interface CloudflareCliConfigFinding {
|
|
788
|
+
/** What to do — `cf` resource commands are fine, lifecycle commands are not. Links the tracking issue. */
|
|
789
|
+
fix: string;
|
|
790
|
+
/** One line: which file was found, where, and why it is a problem. */
|
|
791
|
+
message: string;
|
|
863
792
|
}
|
|
864
793
|
/**
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
*
|
|
868
|
-
*
|
|
794
|
+
* Detect a Cloudflare CLI config (`cloudflare.config.{ts,mts,js,mjs}`) in
|
|
795
|
+
* `projectRoot`, or `undefined` when there is none. The message names the
|
|
796
|
+
* wrangler config actually present (`wrangler.jsonc` / `wrangler.json`), or says
|
|
797
|
+
* "in the project root" when there is none yet.
|
|
869
798
|
*/
|
|
870
|
-
declare const
|
|
799
|
+
declare const detectCloudflareCliConfig: (projectRoot: string) => CloudflareCliConfigFinding | undefined;
|
|
871
800
|
/**
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
*
|
|
875
|
-
*
|
|
876
|
-
*
|
|
801
|
+
* Warn through `warn` when `projectRoot` holds a Cloudflare CLI config — once
|
|
802
|
+
* per process tree (a rebuild, a dev-server restart, or a child process that
|
|
803
|
+
* inherited the env stays quiet). The guard is read before the filesystem probe,
|
|
804
|
+
* and claimed only when there is something to say. Non-blocking by design: the
|
|
805
|
+
* risk is a separate `cf` lifecycle command, not anything Lunora runs. Returns
|
|
806
|
+
* whether it warned.
|
|
877
807
|
*/
|
|
878
|
-
declare const
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
hasCredentials?: () => boolean;
|
|
882
|
-
projectRoot: string;
|
|
883
|
-
/** Proxy the eligible bindings to the deployed resources (`--remote` / `LUNORA_REMOTE`). Off, only the logged-out `ai` withholding applies. */
|
|
884
|
-
remote: boolean;
|
|
885
|
-
}
|
|
886
|
-
interface MaterializeDevResult {
|
|
887
|
-
/** Removes the temp config. Always safe to call: idempotent, and a no-op when nothing was written. */
|
|
888
|
-
cleanup: () => void;
|
|
889
|
-
/** The temp config to pass to `wrangler dev --config`, or `undefined` to run the user's file unchanged. */
|
|
890
|
-
configPath?: string;
|
|
891
|
-
/** Why remote mode produced no temp config, for the dev log. Only set when nothing was written. */
|
|
892
|
-
reason?: string;
|
|
893
|
-
/** The bindings flipped to remote, for the dev banner. */
|
|
894
|
-
remoteBindings: RemoteBindingPlan[];
|
|
895
|
-
/** The `ai` binding name left out for lack of Cloudflare credentials, for the dev warning. */
|
|
896
|
-
withheld: WithheldBinding[];
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* Write the temp wrangler config a dev session runs with: the user's file with any
|
|
900
|
-
* eligible bindings flipped to `"remote": true` (when `remote` is set), and the
|
|
901
|
-
* `ai` binding removed when the session has no Cloudflare login. See `dev-config.ts`
|
|
902
|
-
* for why the `ai` removal exists.
|
|
903
|
-
*
|
|
904
|
-
* The temp file sits beside the source `wrangler.jsonc`, not in an OS temp dir,
|
|
905
|
-
* because wrangler resolves a config's relative `main`/`assets`/`migrations_dir`
|
|
906
|
-
* paths against the config file's own directory. Returns no `configPath` when there
|
|
907
|
-
* is nothing to change, so the caller runs the user's file unchanged.
|
|
908
|
-
*/
|
|
909
|
-
declare const materializeDevWranglerConfig: (options: MaterializeDevOptions) => MaterializeDevResult;
|
|
808
|
+
declare const warnCloudflareCliConfigOnce: (projectRoot: string, warn: (message: string) => void) => boolean;
|
|
809
|
+
/** The Cloudflare deploy driver. */
|
|
810
|
+
declare const CLOUDFLARE_DRIVER: DeployDriver;
|
|
910
811
|
/**
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
*
|
|
812
|
+
* The `global_fetch_strictly_public` compatibility flag: every global `fetch` from
|
|
813
|
+
* the Worker goes out to the public internet, never to a private or special-use
|
|
814
|
+
* address. `workersCimdFetch()` from `@lunora/auth/cimd/workers` refuses to build
|
|
815
|
+
* without it, and `lunora doctor` checks for it wherever that transport is imported.
|
|
914
816
|
*/
|
|
915
|
-
declare const
|
|
916
|
-
/**
|
|
917
|
-
interface
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
817
|
+
declare const GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG = "global_fetch_strictly_public";
|
|
818
|
+
/** Inputs, injectable so tests never read the real home directory or env. */
|
|
819
|
+
interface CloudflareCredentialProbe {
|
|
820
|
+
env?: Record<string, string | undefined>;
|
|
821
|
+
home?: string;
|
|
822
|
+
/** Project whose `.env` files are read; omit to skip them. */
|
|
823
|
+
projectRoot?: string;
|
|
824
|
+
}
|
|
825
|
+
declare const hasCloudflareCredentials: (probe?: CloudflareCredentialProbe) => boolean;
|
|
826
|
+
/** Which kind of temp config a file is, in its name. */
|
|
827
|
+
type DevConfigKind = "dev" | "service";
|
|
828
|
+
/** A remote-only binding a logged-out dev session leaves out: which kind it is, and the name the app gave it. */
|
|
829
|
+
interface WithheldBinding {
|
|
830
|
+
binding: string;
|
|
831
|
+
kind: "ai" | "artifacts";
|
|
832
|
+
}
|
|
833
|
+
/** The slice of a worker config the rule reads. */
|
|
834
|
+
interface RemoteOnlyBindings {
|
|
835
|
+
ai?: {
|
|
836
|
+
binding?: string;
|
|
837
|
+
} | null;
|
|
838
|
+
artifacts?: ReadonlyArray<{
|
|
839
|
+
binding?: string;
|
|
840
|
+
} | null | undefined> | null;
|
|
928
841
|
}
|
|
929
842
|
/**
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
*
|
|
933
|
-
* 2. then `LUNORA_REMOTE` in the environment,
|
|
934
|
-
* 3. then the `remote` key in `lunora.config.*` (lowest — a project default).
|
|
935
|
-
*
|
|
936
|
-
* The flag and env are one-directional (they can only turn remote *on*); only
|
|
937
|
-
* the config preference carries a meaningful `false`, and it applies solely when
|
|
938
|
-
* neither stronger signal is present. So a project that sets `"remote": false`
|
|
939
|
-
* is still overridable per-run by `--remote` or `LUNORA_REMOTE=1`.
|
|
843
|
+
* The bindings to withhold from a logged-out dev session. Workers AI and Artifacts have no
|
|
844
|
+
* local simulator, so each opens a remote proxy session at boot that fails without a login and
|
|
845
|
+
* takes the dev server down. The credential probe runs only when one of them is declared.
|
|
940
846
|
*/
|
|
941
|
-
declare const
|
|
942
|
-
/** The
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
847
|
+
declare const withheldBindings: (config: RemoteOnlyBindings | undefined, hasCredentials: () => boolean) => WithheldBinding[];
|
|
848
|
+
/** The one dev warning for a withheld binding, shared by `lunora dev` and `@lunora/vite`. */
|
|
849
|
+
declare const describeWithheld: ({ binding, kind }: WithheldBinding) => string;
|
|
850
|
+
/** The slice of PGlite this module drives, so a test can stand in for the WASM engine. */
|
|
851
|
+
interface PgliteRuntime {
|
|
852
|
+
createServer: (dataDirectory: string) => Promise<{
|
|
853
|
+
connectionString: string;
|
|
854
|
+
stop: () => Promise<void>;
|
|
855
|
+
}>;
|
|
949
856
|
}
|
|
950
|
-
interface
|
|
951
|
-
/**
|
|
952
|
-
|
|
953
|
-
/**
|
|
857
|
+
interface StartLocalHyperdriveOptions {
|
|
858
|
+
/** Defaults to `process.env`; the connection strings are written here and removed again by `stop`. */
|
|
859
|
+
env?: NodeJS.ProcessEnv;
|
|
860
|
+
/** Injection seam; defaults to the real PGlite. Resolves `undefined` when it is not installed. */
|
|
861
|
+
load?: () => Promise<PgliteRuntime | undefined>;
|
|
862
|
+
/** Called once with a line to show the developer when the database could not be started. */
|
|
863
|
+
onWarning?: (message: string) => void;
|
|
954
864
|
projectRoot: string;
|
|
865
|
+
/** The wrangler config the session actually runs (the Cloudflare plugin's `configPath`); defaults to the project's own. */
|
|
866
|
+
wranglerConfigPath?: string;
|
|
955
867
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
declare const materializeServiceDevConfigs: (wranglerPaths: ReadonlyArray<string>, options: ServiceMaterializeOptions) => ServiceDevConfigs;
|
|
961
|
-
/**
|
|
962
|
-
* The Cloudflare toolchain ranges a scaffolded Lunora app declares — the one
|
|
963
|
-
* source for `lunora init`'s overlay. The `templates/*` starters are fetched at
|
|
964
|
-
* runtime and cannot import this, so `tests/vis-templates` asserts that every
|
|
965
|
-
* template declaring one of these packages declares exactly this range.
|
|
966
|
-
*
|
|
967
|
-
* `@cloudflare/workers-types` is on the v5 line: v4 ended at 4.20260702.1, and
|
|
968
|
-
* v5's root entrypoint is the latest runtime (AI Search, Artifacts, Analytics
|
|
969
|
-
* SQL, tracing `setStatus`). `wrangler` >= 4.145.0 accepts the Analytics SQL
|
|
970
|
-
* `analytics` binding that `ctx.analyticsSql` makes `lunora dev` write, and
|
|
971
|
-
* >= 4.142.0 declares and runs Workflows in `exports`, which codegen writes.
|
|
972
|
-
* `@cloudflare/vite-plugin` matches the wrangler it embeds.
|
|
973
|
-
*
|
|
974
|
-
* Bump it together with the `cloudflare` / `vite` catalogs in `pnpm-workspace.yaml`.
|
|
975
|
-
*/
|
|
976
|
-
declare const CLOUDFLARE_TOOLCHAIN_VERSIONS: Readonly<Record<"@cloudflare/vite-plugin" | "@cloudflare/workers-types" | "wrangler", string>>;
|
|
977
|
-
/** The `wrangler.jsonc` shape the validator reads, and the report it returns. */
|
|
978
|
-
interface WranglerDurableObjectBinding {
|
|
979
|
-
class_name?: string;
|
|
980
|
-
name?: string;
|
|
981
|
-
/** Present when the class lives in ANOTHER Worker — then it is that script's to export, not this entry's. */
|
|
982
|
-
script_name?: string;
|
|
868
|
+
interface LocalHyperdrive {
|
|
869
|
+
/** The bindings served by PGlite. */
|
|
870
|
+
bindings: string[];
|
|
871
|
+
stop: () => Promise<void>;
|
|
983
872
|
}
|
|
873
|
+
/** The Hyperdrive bindings in `wrangler.jsonc` that nothing local backs yet. */
|
|
874
|
+
declare const bindingsNeedingDatabase: (projectRoot: string, env: NodeJS.ProcessEnv, wranglerEnvironment?: string | undefined, configPath?: string) => string[];
|
|
984
875
|
/**
|
|
985
|
-
*
|
|
986
|
-
*
|
|
987
|
-
*
|
|
876
|
+
* Start a PGlite for every Hyperdrive binding with no local database, and point
|
|
877
|
+
* wrangler at it through its environment variable. Resolves `undefined` when
|
|
878
|
+
* there is nothing to serve, or when PGlite is not installed (after saying how
|
|
879
|
+
* to install it).
|
|
988
880
|
*/
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
881
|
+
declare const startLocalHyperdrive: (options: StartLocalHyperdriveOptions) => Promise<LocalHyperdrive | undefined>;
|
|
882
|
+
interface ProjectAssetHeadersInput {
|
|
883
|
+
/**
|
|
884
|
+
* The build's directory of content-hashed files, relative to `outputDirectory`
|
|
885
|
+
* (Vite's `build.assetsDir`, Astro's `_astro`, Rsbuild's `static`). Pass it only when
|
|
886
|
+
* the integration can vouch that every file it writes there carries a content hash.
|
|
887
|
+
*/
|
|
888
|
+
hashedDirectory?: string;
|
|
889
|
+
/**
|
|
890
|
+
* The file-name patterns (relative to `outputDirectory`, Rollup placeholders) the build names its hashed files
|
|
891
|
+
* with. Given, every file the build left in `hashedDirectory` must have such a name, or the directory is not
|
|
892
|
+
* cached for good: a plugin can emit a fixed name there that the patterns never see.
|
|
893
|
+
*/
|
|
894
|
+
hashedNamePatterns?: ReadonlyArray<string>;
|
|
895
|
+
/** Absolute directory the build wrote its client output to. */
|
|
896
|
+
outputDirectory: string;
|
|
897
|
+
projectRoot: string;
|
|
898
|
+
/** Absolute `public/` directory the build copies verbatim into `outputDirectory`, if any. */
|
|
899
|
+
publicDirectory?: string;
|
|
900
|
+
/**
|
|
901
|
+
* Write only when `outputDirectory` is the `assets.directory` wrangler deploys.
|
|
902
|
+
* `@lunora/vite` passes `false`: with `@cloudflare/vite-plugin` in the build, the
|
|
903
|
+
* client `outDir` is the assets root even when wrangler declares no `assets` block.
|
|
904
|
+
*/
|
|
905
|
+
requireAssetsDirectory: boolean;
|
|
906
|
+
/** Schema directory relative to `projectRoot`; `lunora.config` is looked up from it. Defaults to `lunora`. */
|
|
907
|
+
schemaDir?: string;
|
|
908
|
+
/** The deploy target an integration was configured with; resolved from `lunora.config` when omitted. Only `"cloudflare"` serves `_headers`. */
|
|
909
|
+
target?: string;
|
|
910
|
+
/** Absolute path of the wrangler config the build deploys (`@cloudflare/vite-plugin`'s `configPath`). Defaults to the project's own. */
|
|
911
|
+
wranglerPath?: string;
|
|
994
912
|
}
|
|
995
|
-
/**
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
* https://developers.cloudflare.com/workers/observability/opentelemetry-export/
|
|
1000
|
-
*/
|
|
1001
|
-
interface WranglerObservabilityTraces {
|
|
1002
|
-
destinations?: ReadonlyArray<string>;
|
|
1003
|
-
enabled?: boolean;
|
|
1004
|
-
/** Fraction of requests traced, 0–1. */
|
|
1005
|
-
head_sampling_rate?: number;
|
|
1006
|
-
persist?: boolean;
|
|
913
|
+
/** Where an integration's build log goes. */
|
|
914
|
+
interface AssetHeadersLogger {
|
|
915
|
+
info: (message: string) => void;
|
|
916
|
+
warn: (message: string) => void;
|
|
1007
917
|
}
|
|
918
|
+
type ProjectAssetHeadersOutcome = {
|
|
919
|
+
reason: string;
|
|
920
|
+
written: false;
|
|
921
|
+
} | {
|
|
922
|
+
result: AssetHeadersResult;
|
|
923
|
+
written: true;
|
|
924
|
+
};
|
|
1008
925
|
/**
|
|
1009
|
-
* `
|
|
1010
|
-
*
|
|
926
|
+
* Write the managed `_headers` block for one build output and report it through
|
|
927
|
+
* the build's logger: the headers left to the user's own rules, then each
|
|
928
|
+
* warning. The single entry point every bundler integration calls after its
|
|
929
|
+
* client build.
|
|
1011
930
|
*/
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
/**
|
|
1019
|
-
|
|
1020
|
-
/**
|
|
1021
|
-
|
|
1022
|
-
enabled?: boolean;
|
|
1023
|
-
};
|
|
1024
|
-
logs?: WranglerObservabilityLogs;
|
|
1025
|
-
/** Strip query strings from request URLs in logs and traces (wrangler's default is `false`). */
|
|
1026
|
-
redact_query_string?: boolean;
|
|
1027
|
-
traces?: WranglerObservabilityTraces;
|
|
931
|
+
declare const emitProjectAssetHeaders: (input: ProjectAssetHeadersInput, logger: AssetHeadersLogger) => ProjectAssetHeadersOutcome;
|
|
932
|
+
interface ReconcileCompatibilityDateResult {
|
|
933
|
+
/** `true` when `wrangler.jsonc` was rewritten. */
|
|
934
|
+
changed: boolean;
|
|
935
|
+
/** The new date value, or the existing one when unchanged. */
|
|
936
|
+
date: string | undefined;
|
|
937
|
+
/** Human-readable reason when reconciliation was skipped. */
|
|
938
|
+
reason?: string;
|
|
939
|
+
/** Resolved wrangler path, or `undefined` when none was found. */
|
|
940
|
+
wranglerPath?: string;
|
|
1028
941
|
}
|
|
1029
942
|
/**
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1032
|
-
* every request sampled: the right default while an app is small, and what
|
|
1033
|
-
* `lunora doctor`'s `observability-full-sampling` advisory then flags once
|
|
1034
|
-
* Workers Observability is billed. One constant so the writers and the doctor
|
|
1035
|
-
* cannot drift apart.
|
|
943
|
+
* Reconcile the `compatibility_date` in `wrangler.jsonc` when Workers Cache
|
|
944
|
+
* is enabled but the date is below the minimum required.
|
|
1036
945
|
*/
|
|
1037
|
-
declare const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
946
|
+
declare const reconcileWranglerCompatibilityDate: (projectRoot: string) => ReconcileCompatibilityDateResult;
|
|
947
|
+
interface ReconcileResult {
|
|
948
|
+
/** `true` when the wrangler config's `triggers.crons` was rewritten. */
|
|
949
|
+
changed: boolean;
|
|
950
|
+
/**
|
|
951
|
+
* Entries left in `triggers.crons` that this reconciler did not generate and
|
|
952
|
+
* does not own — a hand-written `backupCron` trigger, or anything already
|
|
953
|
+
* there before ownership was first recorded. Non-empty means the array is
|
|
954
|
+
* NOT the codegen-derived set, which is the surprising half of what this
|
|
955
|
+
* does and the one thing worth printing.
|
|
956
|
+
*/
|
|
957
|
+
preserved: string[];
|
|
958
|
+
/** Human-readable reason when reconciliation was skipped (for logging). */
|
|
959
|
+
reason?: string;
|
|
960
|
+
/**
|
|
961
|
+
* Problems with the ownership record itself, for the caller to `warn`. A
|
|
962
|
+
* damaged `lunora.crons` is not fatal — the reconciler degrades to add-only
|
|
963
|
+
* — but the degradation is invisible: the generated cron it wrote last pass
|
|
964
|
+
* is reported back as hand-written and is then kept for good. Silence is
|
|
965
|
+
* what turns a merge conflict into a permanent orphan.
|
|
966
|
+
*/
|
|
967
|
+
warnings: string[];
|
|
968
|
+
/** Resolved wrangler path, or `undefined` when none was found. */
|
|
969
|
+
wranglerPath?: string;
|
|
1047
970
|
}
|
|
1048
971
|
/**
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
* `
|
|
972
|
+
* Reconcile the codegen-derived cron schedules into the project's wrangler
|
|
973
|
+
* config `triggers.crons` array, preserving comments and formatting via
|
|
974
|
+
* `jsonc-parser`'s structural edits.
|
|
975
|
+
*
|
|
976
|
+
* **This does not own the whole array.** Two runtime cron surfaces live on
|
|
977
|
+
* `createWorker` rather than in `lunora/crons.ts`: `backupCron` (the nightly
|
|
978
|
+
* NDJSON backup) and `crons` (handlers keyed by expression). Replacing the array
|
|
979
|
+
* wholesale deleted both on the next `lunora deploy` or dev-server schema save,
|
|
980
|
+
* silently — the nightly backup simply stopped. So an entry this reconciler did
|
|
981
|
+
* not generate is the user's, is kept, and is reported in
|
|
982
|
+
* {@link ReconcileResult.preserved}.
|
|
983
|
+
*
|
|
984
|
+
* Codegen now scans the worker entry for both, so the STATIC case arrives in
|
|
985
|
+
* `cronTriggers` like any declared cron — kept because it is generated, and
|
|
986
|
+
* cleared when the entry stops declaring it. What it cannot resolve is the
|
|
987
|
+
* dynamic case, and that case is supported: `.extend((env) => ({ backupCron:
|
|
988
|
+
* env.NIGHTLY_CRON }))` is the documented escape hatch, and its value exists
|
|
989
|
+
* only at runtime. That residue — plus a computed `crons` key, a spread options
|
|
990
|
+
* object, and anything a project put in `triggers.crons` for its own reasons —
|
|
991
|
+
* is what the preserve rule below is for. It is not redundant with discovery; it
|
|
992
|
+
* is the half discovery provably cannot reach.
|
|
993
|
+
*
|
|
994
|
+
* Ownership is recorded in the project's `package.json` under `lunora.crons`,
|
|
995
|
+
* which is why a REMOVED generated cron still gets cleared (it is in the record
|
|
996
|
+
* and no longer in `cronTriggers`) while a hand-written one never is. Three
|
|
997
|
+
* properties pick that location:
|
|
998
|
+
*
|
|
999
|
+
* COMMITTED, so it survives a fresh clone. Gitignored `.lunora/` state does not:
|
|
1000
|
+
* a CI-only deploy finds none, and falling back to add-only there leaves a
|
|
1001
|
+
* removed cron firing forever.
|
|
1002
|
+
*
|
|
1003
|
+
* VALID JSON, so `wrangler.json` — a supported config name — behaves exactly like
|
|
1004
|
+
* `wrangler.jsonc`. A `//` marker inside the config does not: wrangler tolerates
|
|
1005
|
+
* one in either (both go through its JSONC parser), but the project's own
|
|
1006
|
+
* `JSON.parse`, its deploy wrapper and its editor's JSON schema validation all
|
|
1007
|
+
* break the moment a `.json` grows a comment. Nor can the record be a plain key
|
|
1008
|
+
* in the wrangler config — wrangler reports unknown fields ("Unexpected fields
|
|
1009
|
+
* found in top-level field") on every command.
|
|
1010
|
+
*
|
|
1011
|
+
* READ AND WRITTEN AT ONE ADDRESS. A comment has to be found textually on the way
|
|
1012
|
+
* in and positioned structurally on the way out, and those are not the same
|
|
1013
|
+
* place: a stale duplicate higher in the file was read as the record and deleted
|
|
1014
|
+
* the user's backup trigger.
|
|
1015
|
+
*
|
|
1016
|
+
* The wrangler config is rewritten only when an entry actually moves, so
|
|
1017
|
+
* {@link ReconcileResult.changed} means what a `synced N cron trigger(s)` log
|
|
1018
|
+
* claims it means.
|
|
1019
|
+
*
|
|
1020
|
+
* A project with nothing recorded yet — one predating this, or one with no
|
|
1021
|
+
* manifest — treats every entry as the user's, which is the safe direction: a
|
|
1022
|
+
* wrongly-kept trigger costs one no-op invocation, a wrongly-deleted one
|
|
1023
|
+
* silently ends the backups. It becomes precise after a codegen run that still
|
|
1024
|
+
* declares the cron; upgrading and deleting a cron in the same change records an
|
|
1025
|
+
* empty set, and that orphan is then kept for good.
|
|
1026
|
+
*
|
|
1027
|
+
* This intentionally writes the SAME `triggers.crons` shape the
|
|
1028
|
+
* `@lunora/config` validator accepts, so the wrangler validator never fights the
|
|
1029
|
+
* generated value.
|
|
1055
1030
|
*/
|
|
1056
|
-
declare const
|
|
1057
|
-
logs: ObservabilitySignalSampling;
|
|
1058
|
-
traces: ObservabilitySignalSampling;
|
|
1059
|
-
};
|
|
1060
|
-
/** A wrangler `containers[]` entry (parsed from untrusted JSONC). */
|
|
1061
|
-
interface WranglerContainerEntry {
|
|
1062
|
-
class_name?: string;
|
|
1063
|
-
image?: string;
|
|
1064
|
-
/** Named images under the `durable_object` scheduling policy. */
|
|
1065
|
-
images?: Record<string, {
|
|
1066
|
-
build_context?: string;
|
|
1067
|
-
build_vars?: Record<string, string>;
|
|
1068
|
-
dockerfile?: string;
|
|
1069
|
-
image?: string;
|
|
1070
|
-
} | null | undefined>;
|
|
1071
|
-
instance_type?: string | {
|
|
1072
|
-
disk_mb?: number;
|
|
1073
|
-
memory_mib?: number;
|
|
1074
|
-
vcpu?: number;
|
|
1075
|
-
};
|
|
1076
|
-
max_instances?: number;
|
|
1077
|
-
scheduling_policy?: string;
|
|
1078
|
-
}
|
|
1031
|
+
declare const reconcileWranglerCrons: (projectRoot: string, cronTriggers: ReadonlyArray<string>) => ReconcileResult;
|
|
1079
1032
|
/**
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1082
|
-
* `
|
|
1033
|
+
* The one log line worth printing for a reconcile that kept entries it does not
|
|
1034
|
+
* own, or `undefined` when it owned the whole array. Lives here rather than in
|
|
1035
|
+
* each caller because `lunora deploy` and the Vite plugin print it verbatim and
|
|
1036
|
+
* had already drifted into two copies of the same sentence.
|
|
1083
1037
|
*/
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
/**
|
|
1088
|
-
|
|
1089
|
-
/**
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
script_name?: string;
|
|
1096
|
-
}
|
|
1097
|
-
/** A wrangler `queues.producers[]` entry — a `Queue` binding sending to `queue`. */
|
|
1098
|
-
interface WranglerQueueProducer {
|
|
1099
|
-
binding?: string;
|
|
1100
|
-
delivery_delay?: number;
|
|
1101
|
-
queue?: string;
|
|
1038
|
+
declare const describePreservedCrons: (preserved: ReadonlyArray<string>) => string | undefined;
|
|
1039
|
+
/** The project coordinates every reconciler here needs. */
|
|
1040
|
+
interface ReconcileProject {
|
|
1041
|
+
/** Memoises the source scans, so a caller that also validates or reconciles again parses the project once. */
|
|
1042
|
+
cache?: DiscoveryCache;
|
|
1043
|
+
/** Absolute path to the project root holding `wrangler.jsonc`. */
|
|
1044
|
+
projectRoot: string;
|
|
1045
|
+
/** The schema directory, relative to `projectRoot` (usually `"lunora"`). */
|
|
1046
|
+
schemaDir: string;
|
|
1047
|
+
/** The deploy target; wrangler settings only Cloudflare reads are written only for `"cloudflare"` (or when omitted). */
|
|
1048
|
+
target?: string;
|
|
1102
1049
|
}
|
|
1103
|
-
/**
|
|
1104
|
-
interface
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
max_batch_timeout?: number;
|
|
1108
|
-
max_concurrency?: number;
|
|
1109
|
-
max_retries?: number;
|
|
1110
|
-
queue?: string;
|
|
1111
|
-
retry_delay?: number;
|
|
1112
|
-
type?: string;
|
|
1050
|
+
/** The two logger methods every reconciler here needs; `info` is optional on Vite's. */
|
|
1051
|
+
interface ReconcileLogger {
|
|
1052
|
+
info?: (message: string) => void;
|
|
1053
|
+
warn: (message: string) => void;
|
|
1113
1054
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1055
|
+
/**
|
|
1056
|
+
* Infer the Cloudflare bindings the project's code implies and reconcile them
|
|
1057
|
+
* into `wrangler.jsonc` (Durable Objects, their migration classes, and the
|
|
1058
|
+
* `DB` D1 binding for `.global()` schemas). Best-effort and idempotent — runs at
|
|
1059
|
+
* dev startup (and on every `@lunora/rspack` pass) so the user never hand-writes
|
|
1060
|
+
* binding boilerplate. A failure here must never abort codegen; the wrangler
|
|
1061
|
+
* validator reports real problems.
|
|
1062
|
+
*
|
|
1063
|
+
* `onExportGaps` (dev only) is invoked when a declared container/workflow isn't
|
|
1064
|
+
* re-exported by the worker entry, so the caller can raise it in the browser
|
|
1065
|
+
* error overlay in addition to the console warning.
|
|
1066
|
+
*/
|
|
1067
|
+
declare const reconcileBindingsSafely: (options: ReconcileProject, logger: ReconcileLogger, onExportGaps?: (gaps: ReadonlyArray<ExportGap>) => void) => Promise<void>;
|
|
1068
|
+
/**
|
|
1069
|
+
* The bindings a {@link reconcileBindingsSafely} pass would add or retune right
|
|
1070
|
+
* now, as its log labels (a dev sidecar's prefixed with its file) — from the same plan, written
|
|
1071
|
+
* nowhere. For a dev server that provisions only at startup: a save that
|
|
1072
|
+
* declares a queue, reads `ctx.kv` or exports a workflow leaves the running
|
|
1073
|
+
* worker without that binding until the server restarts, and this is how the
|
|
1074
|
+
* watcher finds out. Empty when the config is in sync or the scan fails (a
|
|
1075
|
+
* half-typed source must not read as a change).
|
|
1076
|
+
*
|
|
1077
|
+
* `cache` is required: a watcher calls this on every save, and clears it when
|
|
1078
|
+
* the sources move.
|
|
1079
|
+
*/
|
|
1080
|
+
declare const pendingBindingChanges: (options: ReconcileProject & {
|
|
1081
|
+
cache: DiscoveryCache;
|
|
1082
|
+
}) => Promise<string[]>;
|
|
1083
|
+
/** Reconcile cron triggers and the compatibility date into `wrangler.jsonc`. */
|
|
1084
|
+
declare const reconcileWranglerExtras: (projectRoot: string, cronTriggers: ReadonlyArray<string>, logger: ReconcileLogger) => void;
|
|
1085
|
+
/**
|
|
1086
|
+
* The wrangler config sections Lunora can safely flip to remote mode in dev,
|
|
1087
|
+
* each with the human label used in logs and the structural `shape` the entry
|
|
1088
|
+
* lives in.
|
|
1089
|
+
*
|
|
1090
|
+
* `"array"` is a top-level array of binding objects (`d1_databases`,
|
|
1091
|
+
* `kv_namespaces`, `r2_buckets`, `vectorize`, `services`). `"producers"` is
|
|
1092
|
+
* `queues.producers[]` — consumers are NOT remoted (their schema has no `remote`
|
|
1093
|
+
* field) and the edit path is two levels deep. `"object"` is a single binding
|
|
1094
|
+
* object, not an array (`ai`), whose edit path targets the section key directly.
|
|
1095
|
+
*
|
|
1096
|
+
* Every kind here was confirmed against `wrangler/config-schema.json`: the
|
|
1097
|
+
* entry's schema declares a `remote` property. Deliberately omits
|
|
1098
|
+
* `durable_objects` (no CF remote-DO mode; shards stay local) and sections whose
|
|
1099
|
+
* schema has no `remote` field (`hyperdrive`, `analytics_engine_datasets`,
|
|
1100
|
+
* `secrets_store_secrets`, queue consumers, …). Widening further is a one-line
|
|
1101
|
+
* table edit.
|
|
1102
|
+
*/
|
|
1103
|
+
declare const REMOTE_ELIGIBLE_KEYS: {
|
|
1104
|
+
readonly ai: {
|
|
1105
|
+
readonly label: "AI";
|
|
1106
|
+
readonly shape: "object";
|
|
1148
1107
|
};
|
|
1149
|
-
|
|
1150
|
-
|
|
1108
|
+
readonly ai_search: {
|
|
1109
|
+
readonly label: "AI Search";
|
|
1110
|
+
readonly shape: "array";
|
|
1151
1111
|
};
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
compatibility_date?: string;
|
|
1156
|
-
compatibility_flags?: ReadonlyArray<string>;
|
|
1157
|
-
containers?: ReadonlyArray<WranglerContainerEntry | null | undefined>;
|
|
1158
|
-
d1_databases?: ReadonlyArray<{
|
|
1159
|
-
binding?: string;
|
|
1160
|
-
database_id?: string;
|
|
1161
|
-
database_name?: string;
|
|
1162
|
-
migrations_dir?: string;
|
|
1163
|
-
migrations_pattern?: string;
|
|
1164
|
-
} | null | undefined>;
|
|
1165
|
-
dispatch_namespaces?: ReadonlyArray<{
|
|
1166
|
-
binding?: string;
|
|
1167
|
-
namespace?: string;
|
|
1168
|
-
outbound?: unknown;
|
|
1169
|
-
} | null | undefined>;
|
|
1170
|
-
durable_objects?: {
|
|
1171
|
-
bindings?: ReadonlyArray<WranglerDurableObjectBinding>;
|
|
1112
|
+
readonly ai_search_namespaces: {
|
|
1113
|
+
readonly label: "AI Search namespace";
|
|
1114
|
+
readonly shape: "array";
|
|
1172
1115
|
};
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
enabled?: boolean;
|
|
1177
|
-
} | null;
|
|
1178
|
-
default_retention?: unknown;
|
|
1179
|
-
limits?: unknown;
|
|
1180
|
-
name?: unknown;
|
|
1181
|
-
schedules?: unknown;
|
|
1182
|
-
type?: string;
|
|
1183
|
-
} | null> | null;
|
|
1184
|
-
flagship?: ReadonlyArray<{
|
|
1185
|
-
app_id?: string;
|
|
1186
|
-
binding?: string;
|
|
1187
|
-
} | null | undefined>;
|
|
1188
|
-
hyperdrive?: ReadonlyArray<{
|
|
1189
|
-
binding?: string;
|
|
1190
|
-
id?: string;
|
|
1191
|
-
localConnectionString?: string;
|
|
1192
|
-
} | null | undefined>;
|
|
1193
|
-
images?: {
|
|
1194
|
-
binding?: string;
|
|
1116
|
+
readonly analytics: {
|
|
1117
|
+
readonly label: "Analytics SQL";
|
|
1118
|
+
readonly shape: "object";
|
|
1195
1119
|
};
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
id?: string;
|
|
1200
|
-
} | null | undefined>;
|
|
1201
|
-
limits?: {
|
|
1202
|
-
cpu_ms?: number;
|
|
1120
|
+
readonly d1_databases: {
|
|
1121
|
+
readonly label: "D1";
|
|
1122
|
+
readonly shape: "array";
|
|
1203
1123
|
};
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
binding?: string;
|
|
1124
|
+
readonly kv_namespaces: {
|
|
1125
|
+
readonly label: "KV";
|
|
1126
|
+
readonly shape: "array";
|
|
1208
1127
|
};
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
new_sqlite_classes?: ReadonlyArray<string>;
|
|
1213
|
-
renamed_classes?: ReadonlyArray<{
|
|
1214
|
-
from?: string;
|
|
1215
|
-
to?: string;
|
|
1216
|
-
} | null | undefined>;
|
|
1217
|
-
} | null | undefined>;
|
|
1218
|
-
mtls_certificates?: ReadonlyArray<{
|
|
1219
|
-
binding?: string;
|
|
1220
|
-
certificate_id?: string;
|
|
1221
|
-
} | null | undefined>;
|
|
1222
|
-
observability?: WranglerObservability;
|
|
1223
|
-
pipelines?: ReadonlyArray<{
|
|
1224
|
-
binding?: string;
|
|
1225
|
-
pipeline?: string;
|
|
1226
|
-
stream?: string;
|
|
1227
|
-
} | null | undefined>;
|
|
1228
|
-
placement?: {
|
|
1229
|
-
host?: string;
|
|
1230
|
-
hostname?: string;
|
|
1231
|
-
mode?: string;
|
|
1232
|
-
region?: string;
|
|
1128
|
+
readonly queues: {
|
|
1129
|
+
readonly label: "Queue";
|
|
1130
|
+
readonly shape: "producers";
|
|
1233
1131
|
};
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1132
|
+
readonly r2_buckets: {
|
|
1133
|
+
readonly label: "R2";
|
|
1134
|
+
readonly shape: "array";
|
|
1237
1135
|
};
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
jurisdiction?: string;
|
|
1242
|
-
} | null | undefined>;
|
|
1243
|
-
secrets?: {
|
|
1244
|
-
required?: unknown;
|
|
1245
|
-
} | null;
|
|
1246
|
-
secrets_store_secrets?: ReadonlyArray<{
|
|
1247
|
-
binding?: string;
|
|
1248
|
-
secret_name?: string;
|
|
1249
|
-
store_id?: string;
|
|
1250
|
-
} | null | undefined>;
|
|
1251
|
-
send_email?: ReadonlyArray<{
|
|
1252
|
-
allowed_destination_addresses?: ReadonlyArray<string>;
|
|
1253
|
-
destination_address?: string;
|
|
1254
|
-
name?: string;
|
|
1255
|
-
} | null | undefined>;
|
|
1256
|
-
services?: ReadonlyArray<{
|
|
1257
|
-
binding?: string;
|
|
1258
|
-
entrypoint?: string;
|
|
1259
|
-
environment?: string;
|
|
1260
|
-
service?: string;
|
|
1261
|
-
} | null | undefined>;
|
|
1262
|
-
stream?: {
|
|
1263
|
-
binding?: string;
|
|
1136
|
+
readonly services: {
|
|
1137
|
+
readonly label: "Service";
|
|
1138
|
+
readonly shape: "array";
|
|
1264
1139
|
};
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
} | null | undefined>;
|
|
1277
|
-
vpc_services?: ReadonlyArray<{
|
|
1278
|
-
binding?: string;
|
|
1279
|
-
remote?: boolean;
|
|
1280
|
-
service_id?: string;
|
|
1281
|
-
} | null | undefined>;
|
|
1282
|
-
workflows?: ReadonlyArray<WranglerWorkflowEntry | null | undefined>;
|
|
1140
|
+
readonly vectorize: {
|
|
1141
|
+
readonly label: "Vectorize";
|
|
1142
|
+
readonly shape: "array";
|
|
1143
|
+
};
|
|
1144
|
+
};
|
|
1145
|
+
type RemoteEligibleKey = keyof typeof REMOTE_ELIGIBLE_KEYS;
|
|
1146
|
+
/** One binding object as it appears in any eligible section. */
|
|
1147
|
+
interface BindingEntry {
|
|
1148
|
+
binding?: string;
|
|
1149
|
+
id?: unknown;
|
|
1150
|
+
remote?: boolean;
|
|
1283
1151
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1152
|
+
/** One binding entry we mark remote, with enough provenance to log + edit it. */
|
|
1153
|
+
interface RemoteBindingPlan {
|
|
1154
|
+
/** The binding name as declared in the config (e.g. `"DB"`, `"FILES"`). */
|
|
1155
|
+
binding: string;
|
|
1156
|
+
/** Short kind label for logging (`"D1"`, `"KV"`, `"R2"`, `"Vectorize"`, …). */
|
|
1157
|
+
kind: string;
|
|
1158
|
+
/**
|
|
1159
|
+
* The jsonc edit path within {@link RemoteBindingPlan.section}, relative to
|
|
1160
|
+
* the section key: `[index]` for an `"array"` section, `["producers", index]`
|
|
1161
|
+
* for a queue producer, or `[]` for the single-object `ai` section. The
|
|
1162
|
+
* materializer prepends the section key and appends `"remote"`.
|
|
1163
|
+
*/
|
|
1164
|
+
path: ReadonlyArray<number | string>;
|
|
1165
|
+
/** The wrangler config key the entry lives under. */
|
|
1166
|
+
section: RemoteEligibleKey;
|
|
1167
|
+
}
|
|
1168
|
+
/** The structural slice of a wrangler config the remote planner reads. */
|
|
1169
|
+
interface RemoteWranglerShape {
|
|
1170
|
+
ai?: BindingEntry | null;
|
|
1171
|
+
ai_search?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1172
|
+
ai_search_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1173
|
+
analytics?: BindingEntry | null;
|
|
1174
|
+
artifacts?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1175
|
+
d1_databases?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1176
|
+
kv_namespaces?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1177
|
+
queues?: {
|
|
1178
|
+
producers?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1179
|
+
} | null;
|
|
1180
|
+
r2_buckets?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1181
|
+
services?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1182
|
+
vectorize?: ReadonlyArray<BindingEntry | null | undefined>;
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Inspect a parsed wrangler config and list every eligible binding that should
|
|
1186
|
+
* be flipped to remote mode. Pure — no file-system access, no mutation. An
|
|
1187
|
+
* entry already carrying `"remote": true` is still reported (so logging is
|
|
1188
|
+
* complete) but the materializer's edit is a harmless no-op for it.
|
|
1189
|
+
*/
|
|
1190
|
+
declare const planRemoteBindings: (parsed: RemoteWranglerShape) => RemoteBindingPlan[];
|
|
1191
|
+
/**
|
|
1192
|
+
* Inject `"remote": true` onto each planned binding in the config `text`,
|
|
1193
|
+
* comment-preservingly via jsonc edits. Pure string→string; the edits target
|
|
1194
|
+
* disjoint entries so applying them sequentially is safe. The edit path is
|
|
1195
|
+
* `[section, ...plan.path, "remote"]`, which resolves to the array element, the
|
|
1196
|
+
* `queues.producers[i]` entry, or the single `ai` object as the plan demands.
|
|
1197
|
+
*/
|
|
1198
|
+
declare const injectRemoteFlags: (text: string, plans: ReadonlyArray<RemoteBindingPlan>) => string;
|
|
1199
|
+
interface MaterializeDevOptions {
|
|
1200
|
+
/** Whether wrangler can authenticate; defaults to a probe of `projectRoot`. */
|
|
1201
|
+
hasCredentials?: () => boolean;
|
|
1202
|
+
projectRoot: string;
|
|
1203
|
+
/** Proxy the eligible bindings to the deployed resources (`--remote` / `LUNORA_REMOTE`). Off, only the logged-out `ai` withholding applies. */
|
|
1204
|
+
remote: boolean;
|
|
1205
|
+
}
|
|
1206
|
+
interface MaterializeDevResult {
|
|
1207
|
+
/** Removes the temp config. Always safe to call: idempotent, and a no-op when nothing was written. */
|
|
1208
|
+
cleanup: () => void;
|
|
1209
|
+
/** The temp config to pass to `wrangler dev --config`, or `undefined` to run the user's file unchanged. */
|
|
1210
|
+
configPath?: string;
|
|
1211
|
+
/** Why remote mode produced no temp config, for the dev log. Only set when nothing was written. */
|
|
1212
|
+
reason?: string;
|
|
1213
|
+
/** The bindings flipped to remote, for the dev banner. */
|
|
1214
|
+
remoteBindings: RemoteBindingPlan[];
|
|
1215
|
+
/** The `ai` binding name left out for lack of Cloudflare credentials, for the dev warning. */
|
|
1216
|
+
withheld: WithheldBinding[];
|
|
1288
1217
|
}
|
|
1218
|
+
/** A dev session's remote-binding decision, as `lunora dev` and `vite dev` both act on it. */
|
|
1219
|
+
interface RemotePlan {
|
|
1220
|
+
/** The bindings flipped to remote, as `NAME (kind)` labels for the banner. */
|
|
1221
|
+
bindings: string[];
|
|
1222
|
+
/** Removes the temp config. Idempotent, and a no-op when nothing was written; every shutdown path calls it. */
|
|
1223
|
+
cleanup: () => void;
|
|
1224
|
+
/** The temp config the worker runs with, or `undefined` to run the user's file unchanged. */
|
|
1225
|
+
configPath?: string;
|
|
1226
|
+
/** Whether remote mode was requested. */
|
|
1227
|
+
enabled: boolean;
|
|
1228
|
+
/** Why remote mode didn't take effect despite being requested, for logging. */
|
|
1229
|
+
reason?: string;
|
|
1230
|
+
/** Remote-only bindings (`ai`, `artifacts`) left out for lack of Cloudflare credentials, for the dev warning. */
|
|
1231
|
+
withheld: WithheldBinding[];
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* The {@link RemotePlan} a materialization amounts to, with `enabled` saying
|
|
1235
|
+
* whether remote mode was asked for. The one place the `NAME (kind)` banner
|
|
1236
|
+
* labels are spelled, so `lunora dev` and `vite dev` print the same list.
|
|
1237
|
+
*/
|
|
1238
|
+
declare const toRemotePlan: (result: MaterializeDevResult, enabled: boolean) => RemotePlan;
|
|
1239
|
+
/**
|
|
1240
|
+
* Write the temp wrangler config a dev session runs with: the user's file with any
|
|
1241
|
+
* eligible bindings flipped to `"remote": true` (when `remote` is set), and the
|
|
1242
|
+
* `ai` binding removed when the session has no Cloudflare login. See `dev-config.ts`
|
|
1243
|
+
* for why the `ai` removal exists.
|
|
1244
|
+
*
|
|
1245
|
+
* The temp file sits beside the source `wrangler.jsonc`, not in an OS temp dir,
|
|
1246
|
+
* because wrangler resolves a config's relative `main`/`assets`/`migrations_dir`
|
|
1247
|
+
* paths against the config file's own directory. Returns no `configPath` when there
|
|
1248
|
+
* is nothing to change, so the caller runs the user's file unchanged.
|
|
1249
|
+
*/
|
|
1250
|
+
declare const materializeDevWranglerConfig: (options: MaterializeDevOptions) => MaterializeDevResult;
|
|
1251
|
+
/**
|
|
1252
|
+
* Parse a `LUNORA_REMOTE` env value into the on/off decision. Truthy when set to
|
|
1253
|
+
* `"1"` or `"true"` (case-insensitive); anything else — unset, `"0"`, `"false"`,
|
|
1254
|
+
* empty — is off. Mirrors the `"1" | "true"` convention used across the runtime.
|
|
1255
|
+
*/
|
|
1256
|
+
declare const isRemoteEnvEnabled: (value: string | undefined) => boolean;
|
|
1257
|
+
/** The three inputs that can switch remote-binding dev on, in precedence order. */
|
|
1258
|
+
interface RemoteEnableInputs {
|
|
1259
|
+
/**
|
|
1260
|
+
* The `remote` preference from `lunora.config.*` (the lowest-priority signal).
|
|
1261
|
+
* `undefined` means "no project preference"; an explicit `false` here loses
|
|
1262
|
+
* to neither the flag nor the env when those are absent — it just stays off.
|
|
1263
|
+
*/
|
|
1264
|
+
configPreference?: boolean;
|
|
1265
|
+
/** The raw `LUNORA_REMOTE` env value (parsed with {@link isRemoteEnvEnabled}). */
|
|
1266
|
+
envValue?: string;
|
|
1267
|
+
/** The explicit `--remote` CLI flag — `true` when passed, `undefined`/`false` otherwise. */
|
|
1268
|
+
flag?: boolean;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Resolve whether remote-binding dev is on, with a clear precedence:
|
|
1272
|
+
*
|
|
1273
|
+
* 1. an explicit `--remote` flag (highest — a deliberate per-invocation choice),
|
|
1274
|
+
* 2. then `LUNORA_REMOTE` in the environment,
|
|
1275
|
+
* 3. then the `remote` key in `lunora.config.*` (lowest — a project default).
|
|
1276
|
+
*
|
|
1277
|
+
* The flag and env are one-directional (they can only turn remote *on*); only
|
|
1278
|
+
* the config preference carries a meaningful `false`, and it applies solely when
|
|
1279
|
+
* neither stronger signal is present. So a project that sets `"remote": false`
|
|
1280
|
+
* is still overridable per-run by `--remote` or `LUNORA_REMOTE=1`.
|
|
1281
|
+
*/
|
|
1282
|
+
declare const resolveRemoteEnabled: (inputs: RemoteEnableInputs) => boolean;
|
|
1283
|
+
/** The configs to pass as `--config`, in input order, and what was done to them. */
|
|
1284
|
+
interface ServiceDevConfigs {
|
|
1285
|
+
/** Unlinks every copy written. Idempotent, never throws — a no-op when none was. */
|
|
1286
|
+
cleanup: () => void;
|
|
1287
|
+
configPaths: string[];
|
|
1288
|
+
/** The remote-only bindings (`ai`, `artifacts`) left out of a service copy for lack of Cloudflare credentials, for the dev warning. */
|
|
1289
|
+
withheld: WithheldBinding[];
|
|
1290
|
+
}
|
|
1291
|
+
interface ServiceMaterializeOptions {
|
|
1292
|
+
/** Whether wrangler can authenticate; defaults to a probe of `projectRoot`. */
|
|
1293
|
+
hasCredentials?: () => boolean;
|
|
1294
|
+
/** The app's folder, where `wrangler dev` runs and whose `.env` files it reads. */
|
|
1295
|
+
projectRoot: string;
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Resolve the `--config` path of each service the shared `wrangler dev` session
|
|
1299
|
+
* runs, writing a copy only for a service that needs one (see the module doc).
|
|
1300
|
+
*/
|
|
1301
|
+
declare const materializeServiceDevConfigs: (wranglerPaths: ReadonlyArray<string>, options: ServiceMaterializeOptions) => ServiceDevConfigs;
|
|
1302
|
+
/**
|
|
1303
|
+
* The Cloudflare toolchain ranges a scaffolded Lunora app declares — the one
|
|
1304
|
+
* source for `lunora init`'s overlay. The `templates/*` starters are fetched at
|
|
1305
|
+
* runtime and cannot import this, so `tests/vis-templates` asserts that every
|
|
1306
|
+
* template declaring one of these packages declares exactly this range.
|
|
1307
|
+
*
|
|
1308
|
+
* `@cloudflare/workers-types` is on the v5 line: v4 ended at 4.20260702.1, and
|
|
1309
|
+
* v5's root entrypoint is the latest runtime (AI Search, Artifacts, Analytics
|
|
1310
|
+
* SQL, tracing `setStatus`). `wrangler` >= 4.145.0 accepts the Analytics SQL
|
|
1311
|
+
* `analytics` binding that `ctx.analyticsSql` makes `lunora dev` write, and
|
|
1312
|
+
* >= 4.142.0 declares and runs Workflows in `exports`, which codegen writes.
|
|
1313
|
+
* `@cloudflare/vite-plugin` matches the wrangler it embeds.
|
|
1314
|
+
*
|
|
1315
|
+
* Bump it together with the `cloudflare` / `vite` catalogs in `pnpm-workspace.yaml`.
|
|
1316
|
+
*/
|
|
1317
|
+
declare const CLOUDFLARE_TOOLCHAIN_VERSIONS: Readonly<Record<"@cloudflare/vite-plugin" | "@cloudflare/workers-types" | "wrangler", string>>;
|
|
1289
1318
|
/**
|
|
1290
1319
|
* Return a new `WranglerConfig` with `consumer` present in `tail_consumers`,
|
|
1291
1320
|
* wiring this Worker to forward its tail events (logs/exceptions) to another
|
|
@@ -1444,7 +1473,7 @@ declare const validateWranglerConfig: (wranglerInput: WranglerConfig | undefined
|
|
|
1444
1473
|
* `{ valid, errors, warnings }`.
|
|
1445
1474
|
*/
|
|
1446
1475
|
declare const validateWrangler: typeof validateWranglerConfig;
|
|
1447
|
-
export { type AlchemyTranslation, type AssertWranglerOptions, type AssetHeadersLogger, type AssetHeadersOptions, type AssetHeadersResult, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, type CloudflareCredentialProbe, DEFAULT_OBSERVABILITY, type DevConfigKind, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type LocalHyperdrive, type Manifest, type ManifestConfigShape, type MaterializeDevOptions, type MaterializeDevResult, type ObservabilitySignalSampling, type ProjectAssetHeadersInput, type ProjectAssetHeadersOutcome, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WithheldBinding, type WranglerCacheShape, type WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
|
|
1476
|
+
export { type AlchemyTranslation, type AssertWranglerOptions, type AssetHeadersLogger, type AssetHeadersOptions, type AssetHeadersResult, BINDING_MANIFEST_VERSION, type BindingManifest, type BindingRequirement, CLOUDFLARE_CLI_CONFIG_WARNING_ENV, CLOUDFLARE_DRIVER, CLOUDFLARE_TOOLCHAIN_VERSIONS, type CloudflareCliConfigFinding, type CloudflareCredentialProbe, DEFAULT_OBSERVABILITY, type DevConfigKind, type ExportGap, GLOBAL_FETCH_STRICTLY_PUBLIC_FLAG, type LocalHyperdrive, type Manifest, type ManifestConfigShape, type MaterializeDevOptions, type MaterializeDevResult, type ObservabilitySignalSampling, type ProjectAssetHeadersInput, type ProjectAssetHeadersOutcome, REMOTE_ELIGIBLE_KEYS, REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type ReadWranglerResult, type ReconcileBindingsResult, type ReconcileCompatibilityDateResult, type ReconcileResult as ReconcileCronsResult, type ReconcileProject, type RemoteBindingPlan, type RemoteEnableInputs, type RemotePlan, type RemoteWranglerShape, type ServiceDevConfigs, type TailConsumer, UNEXPORTED_CLASS_MARKER, WORKERS_CACHE_MIN_DATE, WRANGLER_FILES, type WithheldBinding, type WranglerCacheShape, type WranglerCodegenInputs, type WranglerConfig, type WranglerConfigShape, type WranglerContainerEntry, type WranglerEnvironmentMerge, type WranglerObservability, type WranglerObservabilityLogs, type WranglerObservabilityTraces, type WranglerProjectValidationOptions, type WranglerProjectValidationResult, type WranglerValidationReport, type WranglerWorkflowEntry,
|
|
1448
1477
|
/**
|
|
1449
1478
|
* `@lunora/config/cloudflare` — the wrangler layer.
|
|
1450
1479
|
*
|
|
@@ -1460,4 +1489,4 @@ export { type AlchemyTranslation, type AssertWranglerOptions, type AssetHeadersL
|
|
|
1460
1489
|
* Plan 114 §5.3 (D6): a package carrying real provider code isolates it behind a
|
|
1461
1490
|
* subpath rather than relocating wholesale.
|
|
1462
1491
|
*/
|
|
1463
|
-
applyModify, assertWranglerSatisfiesSchema, bindingsNeedingDatabase, buildBindingManifest, collectExportGaps, describePreservedCrons, describeWithheld, detectCloudflareCliConfig, emitProjectAssetHeaders, findWranglerFile, hasCloudflareCredentials, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeDevWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, planRemoteBindings, readManifest, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, recordManifestKey, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, startLocalHyperdrive, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, withheldBindings, wranglerCodegenInputs, wranglerToAlchemy, writeAssetHeaders };
|
|
1492
|
+
applyModify, assertWranglerSatisfiesSchema, bindingsNeedingDatabase, buildBindingManifest, collectExportGaps, describePreservedCrons, describeWithheld, detectCloudflareCliConfig, emitProjectAssetHeaders, findWranglerFile, hasCloudflareCredentials, injectRemoteFlags, isCacheEnabled, isRemoteEnvEnabled, materializeDevWranglerConfig, materializeServiceDevConfigs, mergeWranglerEnvironment, pendingBindingChanges, planRemoteBindings, readManifest, readWranglerJsonc, reconcileBindingsSafely, reconcileWranglerBindings, reconcileWranglerCompatibilityDate, reconcileWranglerCrons, reconcileWranglerExtras, recordManifestKey, resolveObservabilitySampling, resolveRemoteEnabled, scanWranglerVariablesForSecrets, startLocalHyperdrive, toRemotePlan, validateWrangler, validateWranglerConfig, validateWranglerProject, warnCloudflareCliConfigOnce, withTailConsumer, withheldBindings, wranglerCodegenInputs, wranglerToAlchemy, writeAssetHeaders };
|