@depup/cloudflare__vite-plugin 1.56.0-depup.2 → 1.57.0-depup.0

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.
@@ -1,7 +1,174 @@
1
1
  import { Pipeline, PipelineRecord } from "cloudflare:pipelines";
2
2
 
3
- //#region ../config/dist/public-CFsFemEv.d.mts
3
+ //#region ../config/dist/public-fVh2BrM5.d.mts
4
4
 
5
+ //#region src/exports.d.ts
6
+ /**
7
+ * Storage backend for the Durable Object.
8
+ *
9
+ * Containers are only supported on the SQLite storage engine, so `container` is
10
+ * only offered alongside `storage: "sqlite"`.
11
+ */
12
+ type DurableObjectStorageOptions<TContainer extends ContainerDefinition | undefined = ContainerDefinition | undefined> = {
13
+ /**
14
+ * Selects the SQLite-backed storage engine (recommended for new
15
+ * classes).
16
+ */
17
+ storage: "sqlite";
18
+ /**
19
+ * Attach a Container application to this Durable Object by config reference.
20
+ */
21
+ container?: TContainer;
22
+ } | {
23
+ /** Selects the legacy key-value storage engine. */
24
+ storage: "legacy-kv";
25
+ };
26
+ /**
27
+ * Declares a provisioned Durable Object class exported from this Worker.
28
+ *
29
+ * For more information about Durable Objects, see the documentation at
30
+ * https://developers.cloudflare.com/workers/learning/using-durable-objects
31
+ *
32
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
33
+ */
34
+ type DurableObjectCreatedExportOptions<TContainer extends ContainerDefinition | undefined = ContainerDefinition | undefined> = {
35
+ state?: "created";
36
+ } & DurableObjectStorageOptions<TContainer>;
37
+ /**
38
+ * Retire a provisioned Durable Object namespace whose class has
39
+ * been removed from code.
40
+ *
41
+ * During deploy, the class must not be exported in the uploaded code, and no
42
+ * other Worker may hold a `durableObject` binding to the namespace.
43
+ */
44
+ interface DurableObjectDeletedExportOptions {
45
+ state: "deleted";
46
+ }
47
+ /**
48
+ * Rename a provisioned Durable Object namespace's class. The
49
+ * `renamedTo` value must also appear as a live (`state: "created"`)
50
+ * `durableObject` entry in the same `exports` map.
51
+ */
52
+ interface DurableObjectRenamedExportOptions {
53
+ state: "renamed";
54
+ /**
55
+ * The destination class name. Must be a valid JavaScript identifier and
56
+ * must appear as a live (`state: "created"`) `durableObject` entry in the
57
+ * same `exports` map.
58
+ */
59
+ renamedTo: string;
60
+ }
61
+ /**
62
+ * Transfer ownership of a Durable Object namespace to another Worker in the same account.
63
+ * The target Worker must first deploy an `expectingTransfer` entry naming this Worker via `transferFrom`.
64
+ */
65
+ interface DurableObjectTransferredExportOptions {
66
+ state: "transferred";
67
+ /**
68
+ * The destination Worker. Must reference a Worker in the same account.
69
+ */
70
+ transferredTo: string;
71
+ }
72
+ /**
73
+ * Prepare to receive cross-Worker Durable Object transfer.
74
+ * Once the source Worker's `transferred` export is deployed, this entry becomes a normal live `durable-object` export.
75
+ */
76
+ type DurableObjectExpectingTransferExportOptions<TContainer extends ContainerDefinition | undefined = ContainerDefinition | undefined> = {
77
+ state: "expecting-transfer";
78
+ /**
79
+ * The source Worker for the two-phase cross-Worker transfer.
80
+ */
81
+ transferFrom: string;
82
+ } & DurableObjectStorageOptions<TContainer>;
83
+ type DurableObjectCreatedExport<TContainer extends ContainerDefinition | undefined = ContainerDefinition | undefined> = DurableObjectCreatedExportOptions<TContainer> & {
84
+ type: "durable-object";
85
+ };
86
+ interface DurableObjectDeletedExport extends DurableObjectDeletedExportOptions {
87
+ type: "durable-object";
88
+ }
89
+ interface DurableObjectRenamedExport extends DurableObjectRenamedExportOptions {
90
+ type: "durable-object";
91
+ }
92
+ interface DurableObjectTransferredExport extends DurableObjectTransferredExportOptions {
93
+ type: "durable-object";
94
+ }
95
+ type DurableObjectExpectingTransferExport<TContainer extends ContainerDefinition | undefined = ContainerDefinition | undefined> = DurableObjectExpectingTransferExportOptions<TContainer> & {
96
+ type: "durable-object";
97
+ };
98
+ type DurableObjectExportOptions = DurableObjectCreatedExportOptions | DurableObjectDeletedExportOptions | DurableObjectRenamedExportOptions | DurableObjectTransferredExportOptions | DurableObjectExpectingTransferExportOptions;
99
+ type DurableObjectExports = DurableObjectCreatedExport | DurableObjectDeletedExport | DurableObjectRenamedExport | DurableObjectTransferredExport | DurableObjectExpectingTransferExport;
100
+ interface WorkerEntrypointExportOptions {
101
+ cache?: {
102
+ /** Whether cache is enabled for this entrypoint. */
103
+ enabled: boolean;
104
+ };
105
+ }
106
+ interface WorkerEntrypointExport extends WorkerEntrypointExportOptions {
107
+ type: "worker";
108
+ }
109
+ /**
110
+ * Configuration for named exports declared by the Worker. Each entry's
111
+ * key is the exported class name; the value configures the export.
112
+ */
113
+ interface Exports {
114
+ /**
115
+ * Declares a Durable Object class defined by this Worker.
116
+ *
117
+ * For more information about Durable Objects, see the documentation at
118
+ * https://developers.cloudflare.com/workers/learning/using-durable-objects
119
+ *
120
+ * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
121
+ */
122
+ durableObject<TContainer extends ContainerDefinition | undefined = undefined>(options: DurableObjectCreatedExportOptions<TContainer>): DurableObjectCreatedExport<TContainer>;
123
+ /**
124
+ * Retire a provisioned Durable Object namespace whose class has been removed from code.
125
+ */
126
+ durableObject(options: DurableObjectDeletedExportOptions): DurableObjectDeletedExport;
127
+ /**
128
+ * Rename a provisioned Durable Object namespace's class.
129
+ */
130
+ durableObject(options: DurableObjectRenamedExportOptions): DurableObjectRenamedExport;
131
+ /**
132
+ * Transfer ownership of a Durable Object namespace to another Worker in the same account.
133
+ */
134
+ durableObject(options: DurableObjectTransferredExportOptions): DurableObjectTransferredExport;
135
+ /**
136
+ * Prepare to receive cross-Worker Durable Object transfer.
137
+ * The source Worker must follow up with a deployment containing a `transferred` export to commit the transfer.
138
+ */
139
+ durableObject<TContainer extends ContainerDefinition | undefined = undefined>(options: DurableObjectExpectingTransferExportOptions<TContainer>): DurableObjectExpectingTransferExport<TContainer>;
140
+ durableObject(options: DurableObjectExportOptions): DurableObjectExports;
141
+ /** Declares a WorkerEntrypoint export defined by this Worker. */
142
+ worker(options?: WorkerEntrypointExportOptions): WorkerEntrypointExport;
143
+ }
144
+ /**
145
+ * Exports builder for configuring Worker exports.
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * import { defineConfig, defineContainer, defineWorker, exports } from "@cloudflare/config";
150
+ *
151
+ * const myContainer = defineContainer({
152
+ * name: "my-container",
153
+ * image: { dockerfile: "./Dockerfile" },
154
+ * });
155
+ *
156
+ * const worker = defineWorker({
157
+ * exports: {
158
+ * MyDurableObject: exports.durableObject({ storage: "sqlite" }),
159
+ * MyContainerDO: exports.durableObject({ storage: "sqlite", container: myContainer }),
160
+ * OldClass: exports.durableObject({ state: "deleted" }),
161
+ * OldName: exports.durableObject({ state: "renamed", renamedTo: "NewName" }),
162
+ * Outgoing: exports.durableObject({ state: "transferred", transferredTo: "target-worker" }),
163
+ * Incoming: exports.durableObject({ state: "expecting-transfer", storage: "sqlite", transferFrom: "source-worker" }),
164
+ * },
165
+ * });
166
+ *
167
+ * export default defineConfig({ worker, containers: [myContainer] });
168
+ * ```
169
+ */
170
+ declare const exports: Exports;
171
+ //#endregion
5
172
  //#region src/inference.d.ts
6
173
  /**
7
174
  * The Worker's entry module, imported with the `{ type: "cf-worker" }` import attribute
@@ -133,7 +300,7 @@ type InferWorkerEntrypointExports<TUnwrappedConfig> = Exclude<keyof InferMainMod
133
300
  * Unwrap function and promise types to get the underlying config.
134
301
  * Use this to normalize a config before passing it to other inference utilities.
135
302
  */
136
- type UnwrapConfig<TConfig$1> = TConfig$1 extends ((...args: any[]) => infer TReturn) ? UnwrapConfig<TReturn> : TConfig$1 extends Promise<infer TCompletion> ? UnwrapConfig<TCompletion> : TConfig$1;
303
+ type UnwrapConfig<TConfig> = TConfig extends ((...args: any[]) => infer TReturn) ? UnwrapConfig<TReturn> : TConfig extends Promise<infer TCompletion> ? UnwrapConfig<TCompletion> : TConfig;
137
304
  /**
138
305
  * Infer the `Env` interface type from a Worker config.
139
306
  *
@@ -203,219 +370,6 @@ type InferMainModule<TUnwrappedConfig> = TUnwrappedConfig extends {
203
370
  entrypoint: infer TModule extends WorkerModule;
204
371
  } ? TModule : DefaultModule;
205
372
  //#endregion
206
- //#region src/utils.d.ts
207
- /**
208
- * Represents any valid JSON value.
209
- */
210
- type Json = string | number | boolean | null | Json[] | {
211
- [key: string]: Json;
212
- };
213
- //#endregion
214
- //#region src/definition.d.ts
215
- interface ConfigContext {
216
- isPreview: boolean;
217
- /**
218
- * The mode the config is being evaluated in.
219
- * Set via the `--mode` CLI flag.
220
- * In Vite the mode defaults to `development` in `vite dev` and `production` in `vite build` ([more info](https://vite.dev/guide/env-and-mode.html#modes)).
221
- * In Wrangler the mode defaults to `undefined`.
222
- */
223
- mode: string | undefined;
224
- }
225
- /**
226
- * The authored config in any of its supported shapes: a plain value, a promise,
227
- * or a function of {@link ConfigContext}.
228
- */
229
- type ConfigInput<T$1> = T$1 | Promise<T$1> | ((ctx: ConfigContext) => T$1 | Promise<T$1>);
230
- type ConfigObject = Record<string, unknown>;
231
- type ConfigWithType<T$1 extends ConfigObject, TType extends string> = T$1 & {
232
- type: TType;
233
- };
234
- //#endregion
235
- //#region src/container-definition.d.ts
236
- type ContainerConfigExport<T$1 extends ContainerConfig = ContainerConfig> = ConfigInput<T$1>;
237
- type DistributiveOmit<T$1, K$1 extends PropertyKey> = T$1 extends unknown ? Omit<T$1, K$1> : never;
238
- /**
239
- * Authored Container config shape — {@link ContainerConfig} without the `type`
240
- * discriminant, which `defineContainer` injects.
241
- */
242
- type ContainerConfigInput = DistributiveOmit<ContainerConfig, "type">;
243
- /** Declare a Container application. */
244
- declare const defineContainer: <const TInput extends ConfigInput<ContainerConfigInput>>(config: TInput) => TInput extends ((ctx: ConfigContext) => infer TResult) ? (ctx: ConfigContext) => TResult extends Promise<infer TConfig extends {
245
- [x: string]: unknown;
246
- }> ? Promise<ConfigWithType<TConfig, "container">> : TResult extends {
247
- [x: string]: unknown;
248
- } ? ConfigWithType<TResult, "container"> : never : TInput extends Promise<infer TConfig extends {
249
- [x: string]: unknown;
250
- }> ? Promise<ConfigWithType<TConfig, "container">> : TInput extends {
251
- [x: string]: unknown;
252
- } ? ConfigWithType<TInput, "container"> : never;
253
- //#endregion
254
- //#region src/exports.d.ts
255
- /**
256
- * Storage backend for the Durable Object.
257
- *
258
- * Containers are only supported on the SQLite storage engine, so `container` is
259
- * only offered alongside `storage: "sqlite"`.
260
- */
261
- type DurableObjectStorageOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
262
- /**
263
- * Selects the SQLite-backed storage engine (recommended for new
264
- * classes).
265
- */
266
- storage: "sqlite";
267
- /**
268
- * Attach a Container application to this Durable Object by config reference.
269
- */
270
- container?: TContainer;
271
- } | {
272
- /** Selects the legacy key-value storage engine. */
273
- storage: "legacy-kv";
274
- };
275
- /**
276
- * Declares a provisioned Durable Object class exported from this Worker.
277
- *
278
- * For more information about Durable Objects, see the documentation at
279
- * https://developers.cloudflare.com/workers/learning/using-durable-objects
280
- *
281
- * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
282
- */
283
- type DurableObjectCreatedExportOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
284
- state?: "created";
285
- } & DurableObjectStorageOptions<TContainer>;
286
- /**
287
- * Retire a provisioned Durable Object namespace whose class has
288
- * been removed from code.
289
- *
290
- * During deploy, the class must not be exported in the uploaded code, and no
291
- * other Worker may hold a `durableObject` binding to the namespace.
292
- */
293
- interface DurableObjectDeletedExportOptions {
294
- state: "deleted";
295
- }
296
- /**
297
- * Rename a provisioned Durable Object namespace's class. The
298
- * `renamedTo` value must also appear as a live (`state: "created"`)
299
- * `durableObject` entry in the same `exports` map.
300
- */
301
- interface DurableObjectRenamedExportOptions {
302
- state: "renamed";
303
- /**
304
- * The destination class name. Must be a valid JavaScript identifier and
305
- * must appear as a live (`state: "created"`) `durableObject` entry in the
306
- * same `exports` map.
307
- */
308
- renamedTo: string;
309
- }
310
- /**
311
- * Transfer ownership of a Durable Object namespace to another Worker in the same account.
312
- * The target Worker must first deploy an `expectingTransfer` entry naming this Worker via `transferFrom`.
313
- */
314
- interface DurableObjectTransferredExportOptions {
315
- state: "transferred";
316
- /**
317
- * The destination Worker. Must reference a Worker in the same account.
318
- */
319
- transferredTo: string;
320
- }
321
- /**
322
- * Prepare to receive cross-Worker Durable Object transfer.
323
- * Once the source Worker's `transferred` export is deployed, this entry becomes a normal live `durable-object` export.
324
- */
325
- type DurableObjectExpectingTransferExportOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
326
- state: "expecting-transfer";
327
- /**
328
- * The source Worker for the two-phase cross-Worker transfer.
329
- */
330
- transferFrom: string;
331
- } & DurableObjectStorageOptions<TContainer>;
332
- type DurableObjectCreatedExport<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = DurableObjectCreatedExportOptions<TContainer> & {
333
- type: "durable-object";
334
- };
335
- interface DurableObjectDeletedExport extends DurableObjectDeletedExportOptions {
336
- type: "durable-object";
337
- }
338
- interface DurableObjectRenamedExport extends DurableObjectRenamedExportOptions {
339
- type: "durable-object";
340
- }
341
- interface DurableObjectTransferredExport extends DurableObjectTransferredExportOptions {
342
- type: "durable-object";
343
- }
344
- type DurableObjectExpectingTransferExport<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = DurableObjectExpectingTransferExportOptions<TContainer> & {
345
- type: "durable-object";
346
- };
347
- type DurableObjectExportOptions = DurableObjectCreatedExportOptions | DurableObjectDeletedExportOptions | DurableObjectRenamedExportOptions | DurableObjectTransferredExportOptions | DurableObjectExpectingTransferExportOptions;
348
- type DurableObjectExports = DurableObjectCreatedExport | DurableObjectDeletedExport | DurableObjectRenamedExport | DurableObjectTransferredExport | DurableObjectExpectingTransferExport;
349
- interface WorkerEntrypointExportOptions {
350
- cache?: {
351
- /** Whether cache is enabled for this entrypoint. */
352
- enabled: boolean;
353
- };
354
- }
355
- interface WorkerEntrypointExport extends WorkerEntrypointExportOptions {
356
- type: "worker";
357
- }
358
- /**
359
- * Configuration for named exports declared by the Worker. Each entry's
360
- * key is the exported class name; the value configures the export.
361
- */
362
- interface Exports {
363
- /**
364
- * Declares a Durable Object class defined by this Worker.
365
- *
366
- * For more information about Durable Objects, see the documentation at
367
- * https://developers.cloudflare.com/workers/learning/using-durable-objects
368
- *
369
- * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
370
- */
371
- durableObject<TContainer extends ContainerConfigExport | undefined = undefined>(options: DurableObjectCreatedExportOptions<TContainer>): DurableObjectCreatedExport<TContainer>;
372
- /**
373
- * Retire a provisioned Durable Object namespace whose class has been removed from code.
374
- */
375
- durableObject(options: DurableObjectDeletedExportOptions): DurableObjectDeletedExport;
376
- /**
377
- * Rename a provisioned Durable Object namespace's class.
378
- */
379
- durableObject(options: DurableObjectRenamedExportOptions): DurableObjectRenamedExport;
380
- /**
381
- * Transfer ownership of a Durable Object namespace to another Worker in the same account.
382
- */
383
- durableObject(options: DurableObjectTransferredExportOptions): DurableObjectTransferredExport;
384
- /**
385
- * Prepare to receive cross-Worker Durable Object transfer.
386
- * The source Worker must follow up with a deployment containing a `transferred` export to commit the transfer.
387
- */
388
- durableObject<TContainer extends ContainerConfigExport | undefined = undefined>(options: DurableObjectExpectingTransferExportOptions<TContainer>): DurableObjectExpectingTransferExport<TContainer>;
389
- durableObject(options: DurableObjectExportOptions): DurableObjectExports;
390
- /** Declares a WorkerEntrypoint export defined by this Worker. */
391
- worker(options?: WorkerEntrypointExportOptions): WorkerEntrypointExport;
392
- }
393
- /**
394
- * Exports builder for configuring Worker exports.
395
- *
396
- * @example
397
- * ```typescript
398
- * import { defineContainer, defineWorker, exports } from "@cloudflare/config";
399
- *
400
- * const myContainer = defineContainer({
401
- * name: "my-container",
402
- * image: { dockerfile: "./Dockerfile" },
403
- * });
404
- *
405
- * export default defineWorker({
406
- * exports: {
407
- * MyDurableObject: exports.durableObject({ storage: "sqlite" }),
408
- * MyContainerDO: exports.durableObject({ storage: "sqlite", container: myContainer }),
409
- * OldClass: exports.durableObject({ state: "deleted" }),
410
- * OldName: exports.durableObject({ state: "renamed", renamedTo: "NewName" }),
411
- * Outgoing: exports.durableObject({ state: "transferred", transferredTo: "target-worker" }),
412
- * Incoming: exports.durableObject({ state: "expecting-transfer", storage: "sqlite", transferFrom: "source-worker" }),
413
- * },
414
- * });
415
- * ```
416
- */
417
- declare const exports: Exports;
418
- //#endregion
419
373
  //#region src/triggers.d.ts
420
374
  interface FetchTriggerOptions {
421
375
  /**
@@ -564,23 +518,47 @@ interface Triggers {
564
518
  *
565
519
  * @example
566
520
  * ```typescript
567
- * import { defineWorker, triggers } from "@cloudflare/config";
521
+ * import { defineConfig, triggers } from "@cloudflare/config";
568
522
  *
569
- * export default defineWorker({
570
- * triggers: [
571
- * triggers.fetch({ pattern: "example.com/*", zone: "example.com" }),
572
- * triggers.queue({ name: "my-queue" }),
573
- * triggers.scheduled({ schedule: "0 * * * *" }),
574
- * triggers.scheduled({ schedule: "30 0 * * *" }),
575
- * triggers.email({ addresses: ["support@example.com"] }),
576
- * triggers.connect({ protocol: "tcp", port: 5432 }),
577
- * ],
523
+ * export default defineConfig({
524
+ * worker: {
525
+ * name: "my-worker",
526
+ * compatibilityDate: "2026-09-17",
527
+ * triggers: [
528
+ * triggers.fetch({ pattern: "example.com/*", zone: "example.com" }),
529
+ * triggers.queue({ name: "my-queue" }),
530
+ * triggers.scheduled({ schedule: "0 * * * *" }),
531
+ * triggers.scheduled({ schedule: "30 0 * * *" }),
532
+ * triggers.email({ addresses: ["support@example.com"] }),
533
+ * triggers.connect({ protocol: "tcp", port: 5432 }),
534
+ * ],
535
+ * },
578
536
  * });
579
537
  * ```
580
538
  */
581
539
  declare const triggers: Triggers;
582
540
  //#endregion
583
541
  //#region src/types.d.ts
542
+ /** Account-level values shared by the resources in a configuration. */
543
+ interface Settings {
544
+ /**
545
+ * This is the ID of the account associated with your zone. It can also be
546
+ * specified through the `CLOUDFLARE_ACCOUNT_ID` environment variable.
547
+ */
548
+ accountId?: string;
549
+ /**
550
+ * The compliance boundary in which commands should operate. When omitted,
551
+ * this can be supplied through `CLOUDFLARE_COMPLIANCE_REGION`.
552
+ */
553
+ complianceRegion?: "public" | "fedramp-high";
554
+ }
555
+ /** The authored shape of `cloudflare.config.ts`'s default export. */
556
+ interface CloudflareConfig extends Settings {
557
+ /** The Worker defined by this configuration. */
558
+ worker?: ConfigInput<WorkerConfig>;
559
+ /** Container applications defined by this configuration. */
560
+ containers?: ConfigInput<ContainerConfig>[];
561
+ }
584
562
  /**
585
563
  * Union of all binding definitions accepted in `env`.
586
564
  */
@@ -637,13 +615,6 @@ type StandardContainerObservabilityConfig = ContainerObservabilityConfig & ({
637
615
  });
638
616
  /** Fields shared by all Container application configurations. */
639
617
  interface BaseContainerConfig {
640
- /**
641
- * Discriminates this config as a Container config.
642
- *
643
- * Injected automatically by `defineContainer`; only needs to be written by
644
- * hand when authoring a raw config object without the helper.
645
- */
646
- type: "container";
647
618
  /**
648
619
  * Name of the application.
649
620
  *
@@ -776,24 +747,17 @@ interface DurableObjectContainerConfig extends BaseContainerConfig {
776
747
  }
777
748
  /**
778
749
  * Container application configuration. This is the input shape passed to
779
- * `defineContainer` and is validated at runtime by `InputContainerSchema`.
750
+ * `defineContainer` and parsed at runtime by `InputContainerSchema`.
780
751
  */
781
752
  type ContainerConfig = DurableObjectContainerConfig | StandardContainerConfig;
782
753
  /**
783
754
  * Worker configuration. This is the input shape passed to
784
755
  * [`defineWorker`](https://developers.cloudflare.com/workers/wrangler/configuration/).
785
756
  *
786
- * Fields are validated at runtime by `InputWorkerSchema` and normalised before
757
+ * Fields are parsed and normalised at runtime by `InputWorkerSchema` before
787
758
  * being passed to downstream tooling.
788
759
  */
789
760
  interface WorkerConfig {
790
- /**
791
- * Discriminates this config as a Worker config.
792
- *
793
- * Injected automatically by `defineWorker`; only needs to be written by
794
- * hand when authoring a raw config object without the helper.
795
- */
796
- type: "worker";
797
761
  /**
798
762
  * The name of your Worker.
799
763
  */
@@ -822,8 +786,10 @@ interface WorkerConfig {
822
786
  *
823
787
  * @example
824
788
  * ```ts
789
+ * import { defineConfig, defineWorker } from "@cloudflare/config";
825
790
  * import * as entrypoint from "./src" with { type: "cf-worker" };
826
- * export default defineWorker({ entrypoint });
791
+ * const worker = defineWorker({ entrypoint });
792
+ * export default defineConfig({ worker });
827
793
  * ```
828
794
  */
829
795
  entrypoint?: string | WorkerModule;
@@ -1049,52 +1015,81 @@ interface WorkerConfig {
1049
1015
  */
1050
1016
  exports?: Record<string, Export>;
1051
1017
  }
1052
- /**
1053
- * Settings shared by the other exports.
1054
- * Authored as a named `settings` export via
1055
- * `defineSettings`.
1056
- */
1057
- interface SettingsConfig {
1058
- /**
1059
- * Discriminates this config as a settings config.
1060
- *
1061
- * Injected automatically by `defineSettings`; only needs to be written by
1062
- * hand when authoring a raw config object without the helper.
1063
- */
1064
- type: "settings";
1065
- /**
1066
- * This is the ID of the account associated with your zone.
1067
- * You might have more than one account, so make sure to use
1068
- * the ID of the account associated with the zone/route you
1069
- * provide, if you provide one. It can also be specified through
1070
- * the CLOUDFLARE_ACCOUNT_ID environment variable.
1071
- */
1072
- accountId?: string;
1018
+ //#endregion
1019
+ //#region src/definition.d.ts
1020
+ interface ConfigContext {
1021
+ /** Whether the config is being evaluated for a Preview build. */
1022
+ isPreview: boolean;
1073
1023
  /**
1074
- * Specify the compliance region mode of the Worker.
1075
- *
1076
- * Although if the user does not specify a compliance region, the default is `public`,
1077
- * it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.
1024
+ * The mode the config is being evaluated in.
1025
+ * Set via the `--mode` CLI flag.
1026
+ * In Vite the mode defaults to `development` in `vite dev` and `production` in `vite build` ([more info](https://vite.dev/guide/env-and-mode.html#modes)).
1027
+ * In Wrangler the mode defaults to `undefined`.
1078
1028
  */
1079
- complianceRegion?: "public" | "fedramp-high";
1029
+ mode: string | undefined;
1080
1030
  }
1031
+ /**
1032
+ * A configuration value, promise, or factory. Factories can be passed directly
1033
+ * for automatic resolution with the current context or called explicitly with
1034
+ * another context before they are used.
1035
+ */
1036
+ type ConfigInput<T$1> = T$1 | Promise<T$1> | ((ctx: ConfigContext) => T$1 | Promise<T$1>);
1037
+ type ContainerDefinition<T$1 extends ContainerConfig = ContainerConfig> = ConfigInput<T$1>;
1038
+ type WorkerDefinition<T$1 extends WorkerConfig = WorkerConfig> = ConfigInput<T$1>;
1039
+ /** A Worker name, value, promise, or context-aware factory. */
1040
+ type WorkerReference = string | WorkerDefinition;
1041
+ /**
1042
+ * Used to define the default export in `cloudflare.config.ts`.
1043
+ *
1044
+ * @example
1045
+ * ```typescript
1046
+ * import { defineConfig } from "@cloudflare/config";
1047
+ *
1048
+ * export default defineConfig({
1049
+ * worker: {
1050
+ * name: "my-worker",
1051
+ * compatibilityDate: "2026-09-17",
1052
+ * },
1053
+ * });
1054
+ * ```
1055
+ */
1056
+ declare const defineConfig: <const TInput extends ConfigInput<CloudflareConfig>>(config: TInput) => TInput;
1057
+ /**
1058
+ * Define a Container.
1059
+ *
1060
+ * @example
1061
+ * ```typescript
1062
+ * import { defineContainer } from "@cloudflare/config";
1063
+ *
1064
+ * const container = defineContainer({
1065
+ * name: "my-container",
1066
+ * image: { dockerfile: "./Dockerfile" },
1067
+ * });
1068
+ * ```
1069
+ */
1070
+ declare const defineContainer: <const TInput extends ConfigInput<ContainerConfig>>(config: TInput) => TInput;
1071
+ /**
1072
+ * Define a Worker.
1073
+ *
1074
+ * @example
1075
+ * ```typescript
1076
+ * import { defineWorker } from "@cloudflare/config";
1077
+ *
1078
+ * const worker = defineWorker({
1079
+ * name: "my-worker",
1080
+ * compatibilityDate: "2026-09-17",
1081
+ * });
1082
+ * ```
1083
+ */
1084
+ declare const defineWorker: <const TInput extends ConfigInput<WorkerConfig>>(config: TInput) => TInput;
1081
1085
  //#endregion
1082
- //#region src/worker-definition.d.ts
1083
- type WorkerConfigExport<T$1 extends WorkerConfig = WorkerConfig> = ConfigInput<T$1>;
1084
- /**
1085
- * Authored Worker config shape — {@link WorkerConfig} without the `type`
1086
- * discriminant, which `defineWorker` injects.
1087
- */
1088
- type WorkerConfigInput = Omit<WorkerConfig, "type">;
1089
- declare const defineWorker: <const TInput extends ConfigInput<WorkerConfigInput>>(config: TInput) => TInput extends ((ctx: ConfigContext) => infer TResult) ? (ctx: ConfigContext) => TResult extends Promise<infer TConfig extends {
1090
- [x: string]: unknown;
1091
- }> ? Promise<ConfigWithType<TConfig, "worker">> : TResult extends {
1092
- [x: string]: unknown;
1093
- } ? ConfigWithType<TResult, "worker"> : never : TInput extends Promise<infer TConfig extends {
1094
- [x: string]: unknown;
1095
- }> ? Promise<ConfigWithType<TConfig, "worker">> : TInput extends {
1096
- [x: string]: unknown;
1097
- } ? ConfigWithType<TInput, "worker"> : never;
1086
+ //#region src/utils.d.ts
1087
+ /**
1088
+ * Represents any valid JSON value.
1089
+ */
1090
+ type Json = string | number | boolean | null | Json[] | {
1091
+ [key: string]: Json;
1092
+ };
1098
1093
  //#endregion
1099
1094
  //#region src/bindings.d.ts
1100
1095
  /** Options that control a binding during local development. */
@@ -1244,7 +1239,6 @@ interface DispatchNamespaceBindingOptions {
1244
1239
  interface DispatchNamespaceBinding extends DispatchNamespaceBindingOptions {
1245
1240
  type: "dispatch-namespace";
1246
1241
  }
1247
- type WorkerReference = string | WorkerConfigExport;
1248
1242
  type ReferencedWorkerConfig<TWorker$1 extends WorkerReference> = TWorker$1 extends string ? never : UnwrapConfig<TWorker$1>;
1249
1243
  type DurableObjectExportName<TWorker$1 extends WorkerReference> = TWorker$1 extends string ? string : InferDurableNamespaces<ReferencedWorkerConfig<TWorker$1>>;
1250
1244
  type WorkerEntrypointExportName<TWorker$1 extends WorkerReference> = TWorker$1 extends string ? string : InferWorkerEntrypointExports<ReferencedWorkerConfig<TWorker$1>>;
@@ -1782,27 +1776,6 @@ interface Bindings {
1782
1776
  }
1783
1777
  declare const bindings: Bindings;
1784
1778
  //#endregion
1785
- //#region src/settings-definition.d.ts
1786
- type SettingsConfigExport<T$1 extends SettingsConfig = SettingsConfig> = ConfigInput<T$1>;
1787
- /**
1788
- * Authored settings config shape — {@link SettingsConfig} without the `type`
1789
- * discriminant, which `defineSettings` injects.
1790
- */
1791
- type SettingsConfigInput = Omit<SettingsConfig, "type">;
1792
- /**
1793
- * Declare shared settings.
1794
- * Authored as a named `settings` export.
1795
- */
1796
- declare const defineSettings: <const TInput extends ConfigInput<SettingsConfigInput>>(config: TInput) => TInput extends ((ctx: ConfigContext) => infer TResult) ? (ctx: ConfigContext) => TResult extends Promise<infer TConfig extends {
1797
- [x: string]: unknown;
1798
- }> ? Promise<ConfigWithType<TConfig, "settings">> : TResult extends {
1799
- [x: string]: unknown;
1800
- } ? ConfigWithType<TResult, "settings"> : never : TInput extends Promise<infer TConfig extends {
1801
- [x: string]: unknown;
1802
- }> ? Promise<ConfigWithType<TConfig, "settings">> : TInput extends {
1803
- [x: string]: unknown;
1804
- } ? ConfigWithType<TInput, "settings"> : never;
1805
- //#endregion
1806
1779
  //#endregion
1807
- export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BindingDevOptions, Bindings, BrowserBinding, ConfigContext, ConnectTrigger, ContainerConfig, ContainerConfigExport, ContainerConfigInput, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding$1 as ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding$1 as MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigExport, SettingsConfigInput, StreamBinding$1 as StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WorkerBinding, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, defineContainer, defineSettings, defineWorker, exports, triggers };
1780
+ export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BindingDevOptions, Bindings, BrowserBinding, CloudflareConfig, ConfigContext, ConnectTrigger, ContainerConfig, ContainerDefinition, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding$1 as ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding$1 as MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, Settings, StreamBinding$1 as StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WorkerBinding, WorkerConfig, WorkerDefinition, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, defineConfig, defineContainer, defineWorker, exports, triggers };
1808
1781
  //# sourceMappingURL=experimental-config.d.mts.map