@cloudflare/config 0.11.0 → 0.13.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.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerLoaderBinding, H as VpcServiceBinding, I as TypedPipelineBinding, J as bindings, K as WorkerReference, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, T as PipelineBinding, U as WebSearchBinding, V as VpcNetworkBinding, W as WorkerBinding, X as WorkerConfigInput, Y as WorkerConfigExport, Z as defineWorker, _ as FlagshipBinding, _t as InferDurableNamespaces, a as AiBinding, at as Triggers, b as JsonBinding, bt as UnwrapConfig, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ConfigContext, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as WorkflowBinding, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as InferEnv, w as MtlsCertificateBinding, x as KvBinding, y as ImagesBinding, yt as InferMainModule, z as VectorizeBinding } from "./public-E85Be_2R.mjs";
1
+ import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, Ct as UnwrapConfig, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerReference, H as VpcServiceBinding, I as TypedPipelineBinding, J as WorkerConfigExport, K as WorkflowBinding, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, St as InferMainModule, T as PipelineBinding, U as WorkerBinding, V as VpcNetworkBinding, W as WorkerLoaderBinding, X as defineWorker, Y as WorkerConfigInput, Z as ContainerConfig, _ as FlagshipBinding, _t as ContainerConfigInput, a as AiBinding, at as Triggers, b as JsonBinding, bt as InferDurableNamespaces, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ContainerConfigExport, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as bindings, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as defineContainer, w as MtlsCertificateBinding, x as KvBinding, xt as InferEnv, y as ImagesBinding, yt as ConfigContext, z as VectorizeBinding } from "./public-B4i-aaaO.mjs";
2
2
  import * as z from "zod";
3
3
  import { RawConfig } from "@cloudflare/workers-utils";
4
4
 
@@ -290,11 +290,6 @@ declare const KnownBindingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
290
290
  remote?: boolean | undefined;
291
291
  } | undefined;
292
292
  }>>, z.ZodObject<{
293
- type: z.ZodLiteral<"web-search">;
294
- dev: z.ZodOptional<z.ZodObject<{
295
- remote: z.ZodOptional<z.ZodBoolean>;
296
- }, z.core.$strict>>;
297
- }, z.core.$strict>, z.ZodObject<{
298
293
  type: z.ZodLiteral<"worker">;
299
294
  worker: z.ZodString;
300
295
  exportName: z.ZodOptional<z.ZodString>;
@@ -321,6 +316,215 @@ declare const BindingSchema: z.ZodType<BindingOutput, BindingInput>;
321
316
  declare function validateSingletonBindings(env: Record<string, {
322
317
  type: string;
323
318
  }>, ctx: z.RefinementCtx): void;
319
+ /**
320
+ * Input Container schema — validates user-authored `cloudflare.config.ts`
321
+ * Container exports. Dockerfiles are built by the consuming build tool.
322
+ */
323
+ declare const InputContainerSchema: z.ZodUnion<readonly [z.ZodObject<{
324
+ type: z.ZodLiteral<"container">;
325
+ name: z.ZodString;
326
+ observability: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
327
+ enabled: z.ZodOptional<z.ZodBoolean>;
328
+ logs: z.ZodOptional<z.ZodObject<{
329
+ enabled: z.ZodOptional<z.ZodBoolean>;
330
+ }, z.core.$strict>>;
331
+ targetInstancePercentage: z.ZodOptional<z.ZodNumber>;
332
+ }, z.core.$strict>, z.ZodObject<{
333
+ enabled: z.ZodOptional<z.ZodBoolean>;
334
+ logs: z.ZodOptional<z.ZodObject<{
335
+ enabled: z.ZodOptional<z.ZodBoolean>;
336
+ }, z.core.$strict>>;
337
+ targetInstanceCount: z.ZodOptional<z.ZodNumber>;
338
+ }, z.core.$strict>]>>;
339
+ unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
340
+ maxInstances: z.ZodDefault<z.ZodNumber>;
341
+ instanceType: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
342
+ basic: "basic";
343
+ lite: "lite";
344
+ "standard-1": "standard-1";
345
+ "standard-2": "standard-2";
346
+ "standard-3": "standard-3";
347
+ "standard-4": "standard-4";
348
+ }>, z.ZodObject<{
349
+ vcpu: z.ZodOptional<z.ZodNumber>;
350
+ memoryMib: z.ZodOptional<z.ZodNumber>;
351
+ diskMb: z.ZodOptional<z.ZodNumber>;
352
+ }, z.core.$strict>]>>;
353
+ schedulingPolicy: z.ZodOptional<z.ZodEnum<{
354
+ default: "default";
355
+ regional: "regional";
356
+ }>>;
357
+ ssh: z.ZodOptional<z.ZodObject<{
358
+ enabled: z.ZodBoolean;
359
+ port: z.ZodOptional<z.ZodNumber>;
360
+ }, z.core.$strict>>;
361
+ authorizedKeys: z.ZodOptional<z.ZodArray<z.ZodObject<{
362
+ name: z.ZodString;
363
+ publicKey: z.ZodString;
364
+ }, z.core.$strict>>>;
365
+ constraints: z.ZodOptional<z.ZodObject<{
366
+ regions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
367
+ ENAM: "ENAM";
368
+ WNAM: "WNAM";
369
+ EEUR: "EEUR";
370
+ WEUR: "WEUR";
371
+ APAC: "APAC";
372
+ SAM: "SAM";
373
+ ME: "ME";
374
+ OC: "OC";
375
+ AFR: "AFR";
376
+ }>>>;
377
+ jurisdiction: z.ZodOptional<z.ZodEnum<{
378
+ eu: "eu";
379
+ fedramp: "fedramp";
380
+ }>>;
381
+ }, z.core.$strict>>;
382
+ rollout: z.ZodOptional<z.ZodObject<{
383
+ kind: z.ZodOptional<z.ZodEnum<{
384
+ none: "none";
385
+ "full-auto": "full-auto";
386
+ "full-manual": "full-manual";
387
+ }>>;
388
+ stepPercentage: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>;
389
+ activeGracePeriod: z.ZodOptional<z.ZodNumber>;
390
+ }, z.core.$strict>>;
391
+ image: z.ZodUnion<readonly [z.ZodObject<{
392
+ dockerfile: z.ZodString;
393
+ buildContext: z.ZodOptional<z.ZodString>;
394
+ buildVars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
395
+ }, z.core.$strict>, z.ZodObject<{
396
+ reference: z.ZodString;
397
+ }, z.core.$strict>]>;
398
+ }, z.core.$strict>, z.ZodObject<{
399
+ type: z.ZodLiteral<"container">;
400
+ name: z.ZodString;
401
+ observability: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
402
+ enabled: z.ZodOptional<z.ZodBoolean>;
403
+ logs: z.ZodOptional<z.ZodObject<{
404
+ enabled: z.ZodOptional<z.ZodBoolean>;
405
+ }, z.core.$strict>>;
406
+ targetInstancePercentage: z.ZodOptional<z.ZodNumber>;
407
+ }, z.core.$strict>, z.ZodObject<{
408
+ enabled: z.ZodOptional<z.ZodBoolean>;
409
+ logs: z.ZodOptional<z.ZodObject<{
410
+ enabled: z.ZodOptional<z.ZodBoolean>;
411
+ }, z.core.$strict>>;
412
+ targetInstanceCount: z.ZodOptional<z.ZodNumber>;
413
+ }, z.core.$strict>]>>;
414
+ unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
415
+ schedulingPolicy: z.ZodLiteral<"durable-object">;
416
+ images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
417
+ dockerfile: z.ZodString;
418
+ buildContext: z.ZodOptional<z.ZodString>;
419
+ buildVars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
420
+ }, z.core.$strict>, z.ZodObject<{
421
+ reference: z.ZodString;
422
+ }, z.core.$strict>]>>>;
423
+ }, z.core.$strict>]>;
424
+ type ParsedInputContainerConfig = z.output<typeof InputContainerSchema>;
425
+ /**
426
+ * Output Container schema — validates Container configs in the Build Output
427
+ * Specification, after any Dockerfile has been built into a local or remote
428
+ * image reference.
429
+ */
430
+ declare const OutputContainerSchema: z.ZodUnion<readonly [z.ZodObject<{
431
+ type: z.ZodLiteral<"container">;
432
+ name: z.ZodString;
433
+ observability: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
434
+ enabled: z.ZodOptional<z.ZodBoolean>;
435
+ logs: z.ZodOptional<z.ZodObject<{
436
+ enabled: z.ZodOptional<z.ZodBoolean>;
437
+ }, z.core.$strict>>;
438
+ targetInstancePercentage: z.ZodOptional<z.ZodNumber>;
439
+ }, z.core.$strict>, z.ZodObject<{
440
+ enabled: z.ZodOptional<z.ZodBoolean>;
441
+ logs: z.ZodOptional<z.ZodObject<{
442
+ enabled: z.ZodOptional<z.ZodBoolean>;
443
+ }, z.core.$strict>>;
444
+ targetInstanceCount: z.ZodOptional<z.ZodNumber>;
445
+ }, z.core.$strict>]>>;
446
+ unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
447
+ maxInstances: z.ZodDefault<z.ZodNumber>;
448
+ instanceType: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
449
+ basic: "basic";
450
+ lite: "lite";
451
+ "standard-1": "standard-1";
452
+ "standard-2": "standard-2";
453
+ "standard-3": "standard-3";
454
+ "standard-4": "standard-4";
455
+ }>, z.ZodObject<{
456
+ vcpu: z.ZodOptional<z.ZodNumber>;
457
+ memoryMib: z.ZodOptional<z.ZodNumber>;
458
+ diskMb: z.ZodOptional<z.ZodNumber>;
459
+ }, z.core.$strict>]>>;
460
+ schedulingPolicy: z.ZodOptional<z.ZodEnum<{
461
+ default: "default";
462
+ regional: "regional";
463
+ }>>;
464
+ ssh: z.ZodOptional<z.ZodObject<{
465
+ enabled: z.ZodBoolean;
466
+ port: z.ZodOptional<z.ZodNumber>;
467
+ }, z.core.$strict>>;
468
+ authorizedKeys: z.ZodOptional<z.ZodArray<z.ZodObject<{
469
+ name: z.ZodString;
470
+ publicKey: z.ZodString;
471
+ }, z.core.$strict>>>;
472
+ constraints: z.ZodOptional<z.ZodObject<{
473
+ regions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
474
+ ENAM: "ENAM";
475
+ WNAM: "WNAM";
476
+ EEUR: "EEUR";
477
+ WEUR: "WEUR";
478
+ APAC: "APAC";
479
+ SAM: "SAM";
480
+ ME: "ME";
481
+ OC: "OC";
482
+ AFR: "AFR";
483
+ }>>>;
484
+ jurisdiction: z.ZodOptional<z.ZodEnum<{
485
+ eu: "eu";
486
+ fedramp: "fedramp";
487
+ }>>;
488
+ }, z.core.$strict>>;
489
+ rollout: z.ZodOptional<z.ZodObject<{
490
+ kind: z.ZodOptional<z.ZodEnum<{
491
+ none: "none";
492
+ "full-auto": "full-auto";
493
+ "full-manual": "full-manual";
494
+ }>>;
495
+ stepPercentage: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>;
496
+ activeGracePeriod: z.ZodOptional<z.ZodNumber>;
497
+ }, z.core.$strict>>;
498
+ image: z.ZodUnion<readonly [z.ZodObject<{
499
+ reference: z.ZodString;
500
+ }, z.core.$strict>, z.ZodObject<{
501
+ localReference: z.ZodString;
502
+ }, z.core.$strict>]>;
503
+ }, z.core.$strict>, z.ZodObject<{
504
+ type: z.ZodLiteral<"container">;
505
+ name: z.ZodString;
506
+ observability: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
507
+ enabled: z.ZodOptional<z.ZodBoolean>;
508
+ logs: z.ZodOptional<z.ZodObject<{
509
+ enabled: z.ZodOptional<z.ZodBoolean>;
510
+ }, z.core.$strict>>;
511
+ targetInstancePercentage: z.ZodOptional<z.ZodNumber>;
512
+ }, z.core.$strict>, z.ZodObject<{
513
+ enabled: z.ZodOptional<z.ZodBoolean>;
514
+ logs: z.ZodOptional<z.ZodObject<{
515
+ enabled: z.ZodOptional<z.ZodBoolean>;
516
+ }, z.core.$strict>>;
517
+ targetInstanceCount: z.ZodOptional<z.ZodNumber>;
518
+ }, z.core.$strict>]>>;
519
+ unsafe: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
520
+ schedulingPolicy: z.ZodLiteral<"durable-object">;
521
+ images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
522
+ reference: z.ZodString;
523
+ }, z.core.$strict>, z.ZodObject<{
524
+ localReference: z.ZodString;
525
+ }, z.core.$strict>]>>>;
526
+ }, z.core.$strict>]>;
527
+ type ParsedOutputContainerConfig = z.output<typeof OutputContainerSchema>;
324
528
  declare const DurableObjectCreatedExportSchema: z.ZodObject<{
325
529
  type: z.ZodLiteral<"durable-object">;
326
530
  state: z.ZodOptional<z.ZodLiteral<"created">>;
@@ -815,15 +1019,18 @@ declare function generateTypes({
815
1019
  /**
816
1020
  * Convert a parsed `@cloudflare/config` config into a Wrangler `RawConfig`.
817
1021
  *
818
- * The caller is responsible for unwrapping any function/promise wrapper around
819
- * the config and validating it against `InputWorkerSchema` before passing it in.
1022
+ * The caller is responsible for unwrapping any function/promise wrappers and
1023
+ * validating the configs against their corresponding input schemas before
1024
+ * passing them in.
820
1025
  *
821
1026
  * @param workerConfig The parsed (post-validation) Worker config.
822
1027
  * @param settingsConfig The optional parsed settings config, whose fields
823
1028
  * are merged onto the result.
1029
+ * @param containerExports The parsed Container exports to include in the
1030
+ * result.
824
1031
  * @returns The corresponding Wrangler `RawConfig`.
825
1032
  */
826
- declare function convertToWranglerConfig(workerConfig: ParsedInputWorkerConfig, settingsConfig?: ParsedInputSettingsConfig): RawConfig;
1033
+ declare function convertToWranglerConfig(workerConfig: ParsedInputWorkerConfig, settingsConfig?: ParsedInputSettingsConfig, containerExports?: ParsedInputContainerConfig[]): RawConfig;
827
1034
  //#endregion
828
1035
  //#region src/load.d.ts
829
1036
  /**
@@ -888,8 +1095,9 @@ declare function registerConfigHooks(): () => void;
888
1095
  //#endregion
889
1096
  //#region src/config-loader.d.ts
890
1097
  type ParsedConfigExports = {
1098
+ default?: ParsedInputWorkerConfig;
891
1099
  settings?: ParsedInputSettingsConfig;
892
- } & Record<string, ParsedInputWorkerConfig>;
1100
+ } & Record<string, ParsedInputContainerConfig | ParsedInputWorkerConfig>;
893
1101
  type ConfigParseResult = z.ZodSafeParseSuccess<ParsedConfigExports> | z.ZodSafeParseError<unknown>;
894
1102
  interface LoadAndValidateConfigResult {
895
1103
  /**
@@ -903,9 +1111,10 @@ interface LoadAndValidateConfigResult {
903
1111
  /**
904
1112
  * Resolve and validate loaded `cloudflare.config.ts` exports.
905
1113
  *
906
- * Config inputs are resolved once by identity. Top-level Worker exports are
907
- * also parsed once by identity; unexported references are resolved only far
908
- * enough to replace the reference with the Worker's name.
1114
+ * Config inputs are resolved once by identity. Top-level Worker and Container
1115
+ * exports are also parsed once by identity. References are resolved only far
1116
+ * enough to replace them with resource names, then Container links are
1117
+ * validated across the exported resources.
909
1118
  */
910
1119
  declare function resolveAndValidateConfigExports(exports: Record<string, unknown>, ctx: ConfigContext): Promise<ConfigParseResult>;
911
1120
  /**
@@ -915,4 +1124,4 @@ declare function loadAndValidateConfig(configPath: string, ctx: ConfigContext, o
915
1124
  include?: string[];
916
1125
  }): Promise<LoadAndValidateConfigResult>;
917
1126
  //#endregion
918
- export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, AnalyticsEngineDatasetBindingSchema, ArtifactsBinding, AssetsBinding, AssetsSchema, BindingDevOptions, BindingSchema, Bindings, BrowserBinding, BrowserBindingSchema, ConfigContext, type ConfigParseResult, ConnectTrigger, D1Binding, D1BindingSchema, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectCreatedExportSchema, DurableObjectDeletedExport, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExport, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExport, DurableObjectRenamedExportSchema, DurableObjectTransferredExport, DurableObjectTransferredExportSchema, EmailTrigger, ExportSchema, Exports, FetchTrigger, FlagshipBinding, FlagshipBindingSchema, HyperdriveBinding, HyperdriveBindingSchema, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, InputSettingsSchema, InputWorkerSchema, JsonBinding, KVBindingSchema, KnownBindingSchema, KvBinding, type LoadAndValidateConfigResult, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputSettingsSchema, OutputWorkerSchema, type ParsedConfigExports, type ParsedInputSettingsConfig, type ParsedInputWorkerConfig, type ParsedOutputSettingsConfig, type ParsedOutputWorkerConfig, PipelineBinding, QueueBinding, QueueBindingSchema, QueueConsumerTrigger, R2Binding, R2BindingSchema, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigExport, SettingsConfigInput, StreamBinding, TailConsumerSchema, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnsafeBindingSchema, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerBindingSchema, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerEntrypointExportSchema, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, convertToWranglerConfig, defineSettings, defineWorker, exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveAndValidateConfigExports, triggers, validateSingletonBindings };
1127
+ export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, AnalyticsEngineDatasetBindingSchema, ArtifactsBinding, AssetsBinding, AssetsSchema, BindingDevOptions, BindingSchema, Bindings, BrowserBinding, BrowserBindingSchema, ConfigContext, type ConfigParseResult, ConnectTrigger, ContainerConfig, ContainerConfigExport, ContainerConfigInput, D1Binding, D1BindingSchema, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectCreatedExportSchema, DurableObjectDeletedExport, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExport, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExport, DurableObjectRenamedExportSchema, DurableObjectTransferredExport, DurableObjectTransferredExportSchema, EmailTrigger, ExportSchema, Exports, FetchTrigger, FlagshipBinding, FlagshipBindingSchema, HyperdriveBinding, HyperdriveBindingSchema, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, InputContainerSchema, InputSettingsSchema, InputWorkerSchema, JsonBinding, KVBindingSchema, KnownBindingSchema, KvBinding, type LoadAndValidateConfigResult, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputContainerSchema, OutputSettingsSchema, OutputWorkerSchema, type ParsedConfigExports, type ParsedInputContainerConfig, type ParsedInputSettingsConfig, type ParsedInputWorkerConfig, type ParsedOutputContainerConfig, type ParsedOutputSettingsConfig, type ParsedOutputWorkerConfig, PipelineBinding, QueueBinding, QueueBindingSchema, QueueConsumerTrigger, R2Binding, R2BindingSchema, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigExport, SettingsConfigInput, StreamBinding, TailConsumerSchema, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnsafeBindingSchema, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WorkerBinding, WorkerBindingSchema, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerEntrypointExportSchema, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, convertToWranglerConfig, defineContainer, defineSettings, defineWorker, exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveAndValidateConfigExports, triggers, validateSingletonBindings };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as bindings, i as triggers, n as defineWorker, r as exports$1, t as defineSettings } from "./public-bN7EDGtD.mjs";
1
+ import { a as triggers, i as exports$1, n as defineWorker, o as bindings, r as defineContainer, t as defineSettings } from "./public-Dyr8BJqf.mjs";
2
2
  import * as nodeModule from "node:module";
3
3
  import * as z from "zod";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -201,10 +201,6 @@ const KnownBindingSchema = z.discriminatedUnion("type", [
201
201
  const value = input;
202
202
  return value.tunnelId !== void 0 && value.networkId !== void 0 ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`;
203
203
  } }),
204
- z.strictObject({
205
- type: z.literal("web-search"),
206
- dev: RemoteBindingDevSchema.optional()
207
- }),
208
204
  WorkerBindingSchema,
209
205
  z.strictObject({ type: z.literal("worker-loader") })
210
206
  ]);
@@ -243,8 +239,7 @@ const SINGLETON_BINDING_TYPES = new Set([
243
239
  "images",
244
240
  "media",
245
241
  "stream",
246
- "version-metadata",
247
- "web-search"
242
+ "version-metadata"
248
243
  ]);
249
244
  const listFormatter = new Intl.ListFormat("en-US");
250
245
  function validateSingletonBindings(env, ctx) {
@@ -263,6 +258,136 @@ function validateSingletonBindings(env, ctx) {
263
258
  });
264
259
  }
265
260
  const EnvSchema = z.record(z.string(), BindingSchema).superRefine(validateSingletonBindings).optional();
261
+ const ContainerImageDockerfileSchema = z.strictObject({
262
+ dockerfile: z.string().min(1),
263
+ buildContext: z.string().optional(),
264
+ buildVars: z.record(z.string(), z.string()).optional()
265
+ });
266
+ const ContainerImageReferenceSchema = z.strictObject({ reference: z.string().min(1) });
267
+ const ContainerImageLocalReferenceSchema = z.strictObject({ localReference: z.string().min(1) });
268
+ const InputContainerImageSchema = z.union([ContainerImageDockerfileSchema, ContainerImageReferenceSchema]);
269
+ const OutputContainerImageSchema = z.union([ContainerImageReferenceSchema, ContainerImageLocalReferenceSchema]);
270
+ const VALID_ROLLOUT_STEP_PERCENTAGES = new Set([
271
+ 5,
272
+ 10,
273
+ 20,
274
+ 25,
275
+ 50,
276
+ 100
277
+ ]);
278
+ const ContainerRolloutStepPercentageSchema = z.union([z.number(), z.array(z.number())]).superRefine((stepPercentage, ctx) => {
279
+ if (typeof stepPercentage === "number") {
280
+ if (!VALID_ROLLOUT_STEP_PERCENTAGES.has(stepPercentage)) ctx.addIssue({
281
+ code: "custom",
282
+ message: "A rollout step percentage must be one of 5, 10, 20, 25, 50, or 100"
283
+ });
284
+ return;
285
+ }
286
+ if (stepPercentage.length === 0) {
287
+ ctx.addIssue({
288
+ code: "custom",
289
+ message: "A rollout must contain at least one step percentage"
290
+ });
291
+ return;
292
+ }
293
+ for (const [index, step] of stepPercentage.entries()) {
294
+ if (step < 10 || step > 100) ctx.addIssue({
295
+ code: "custom",
296
+ path: [index],
297
+ message: "Rollout step percentages must be between 10 and 100"
298
+ });
299
+ const previousStep = stepPercentage[index - 1];
300
+ if (previousStep !== void 0 && step < previousStep) ctx.addIssue({
301
+ code: "custom",
302
+ path: [index],
303
+ message: "Rollout step percentages must be in ascending order"
304
+ });
305
+ }
306
+ const lastIndex = stepPercentage.length - 1;
307
+ if (stepPercentage[lastIndex] !== 100) ctx.addIssue({
308
+ code: "custom",
309
+ path: [lastIndex],
310
+ message: "The final rollout step percentage must be 100"
311
+ });
312
+ });
313
+ function validateContainerRelationships(container, ctx) {
314
+ const stepPercentage = container.rollout?.stepPercentage;
315
+ if (Array.isArray(stepPercentage) && container.maxInstances !== void 0 && stepPercentage.length > container.maxInstances) ctx.addIssue({
316
+ code: "custom",
317
+ path: ["rollout", "stepPercentage"],
318
+ message: "A rollout cannot contain more steps than the maximum number of instances"
319
+ });
320
+ }
321
+ const ContainerObservabilityBaseSchema = z.strictObject({
322
+ enabled: z.boolean().optional(),
323
+ logs: z.strictObject({ enabled: z.boolean().optional() }).optional()
324
+ });
325
+ const ContainerObservabilitySchema = z.union([ContainerObservabilityBaseSchema.extend({ targetInstancePercentage: z.number().min(0).max(100).optional() }), ContainerObservabilityBaseSchema.extend({ targetInstanceCount: z.number().int().nonnegative().optional() })]);
326
+ const BaseContainerSchema = z.strictObject({
327
+ type: z.literal("container"),
328
+ name: z.string().min(1),
329
+ observability: ContainerObservabilitySchema.optional(),
330
+ unsafe: z.record(z.string(), z.unknown()).optional()
331
+ });
332
+ const StandardContainerBaseSchema = BaseContainerSchema.extend({
333
+ maxInstances: z.number().int().nonnegative().default(20),
334
+ instanceType: z.union([z.enum([
335
+ "basic",
336
+ "lite",
337
+ "standard-1",
338
+ "standard-2",
339
+ "standard-3",
340
+ "standard-4"
341
+ ]), z.strictObject({
342
+ vcpu: z.number().min(.0625).optional(),
343
+ memoryMib: z.number().nonnegative().optional(),
344
+ diskMb: z.number().nonnegative().optional()
345
+ })]).optional(),
346
+ schedulingPolicy: z.enum(["default", "regional"]).optional(),
347
+ ssh: z.strictObject({
348
+ enabled: z.boolean(),
349
+ port: z.number().int().min(1).max(65535).optional()
350
+ }).optional(),
351
+ authorizedKeys: z.array(z.strictObject({
352
+ name: z.string(),
353
+ publicKey: z.string()
354
+ })).optional(),
355
+ constraints: z.strictObject({
356
+ regions: z.array(z.enum([
357
+ "ENAM",
358
+ "WNAM",
359
+ "EEUR",
360
+ "WEUR",
361
+ "APAC",
362
+ "SAM",
363
+ "ME",
364
+ "OC",
365
+ "AFR"
366
+ ])).optional(),
367
+ jurisdiction: z.enum(["eu", "fedramp"]).optional()
368
+ }).optional(),
369
+ rollout: z.strictObject({
370
+ kind: z.enum([
371
+ "full-auto",
372
+ "none",
373
+ "full-manual"
374
+ ]).optional(),
375
+ stepPercentage: ContainerRolloutStepPercentageSchema.optional(),
376
+ activeGracePeriod: z.number().nonnegative().optional()
377
+ }).optional()
378
+ });
379
+ const DurableObjectContainerBaseSchema = BaseContainerSchema.extend({ schedulingPolicy: z.literal("durable-object") });
380
+ /**
381
+ * Input Container schema — validates user-authored `cloudflare.config.ts`
382
+ * Container exports. Dockerfiles are built by the consuming build tool.
383
+ */
384
+ const InputContainerSchema = z.union([StandardContainerBaseSchema.extend({ image: InputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: z.record(z.string(), InputContainerImageSchema).optional() })]);
385
+ /**
386
+ * Output Container schema — validates Container configs in the Build Output
387
+ * Specification, after any Dockerfile has been built into a local or remote
388
+ * image reference.
389
+ */
390
+ const OutputContainerSchema = z.union([StandardContainerBaseSchema.extend({ image: OutputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: z.record(z.string(), OutputContainerImageSchema).optional() })]);
266
391
  const DurableObjectCreatedExportSchema = z.strictObject({
267
392
  type: z.literal("durable-object"),
268
393
  state: z.literal("created").optional(),
@@ -441,8 +566,13 @@ const InputSettingsSchema = z.strictObject({
441
566
  * Build Output Specification. Adds the `mode` the build was produced in.
442
567
  */
443
568
  const OutputSettingsSchema = InputSettingsSchema.extend({ mode: z.string().optional() });
569
+ const DEFAULT_EXPORT_NAME = "default";
444
570
  const SETTINGS_EXPORT_NAME = "settings";
445
- const SUPPORTED_EXPORT_TYPES = new Set(["worker", "settings"]);
571
+ const SUPPORTED_EXPORT_TYPES = new Set([
572
+ "container",
573
+ "worker",
574
+ "settings"
575
+ ]);
446
576
  function invalidConfigExportMessage(exportName) {
447
577
  return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
448
578
  }
@@ -459,6 +589,15 @@ const ConfigExportsTypeSchema = z.record(z.string(), z.unknown()).check((ctx) =>
459
589
  });
460
590
  continue;
461
591
  }
592
+ if (key === DEFAULT_EXPORT_NAME && type !== "worker") {
593
+ ctx.issues.push({
594
+ code: "custom",
595
+ input: value,
596
+ path: [key],
597
+ message: `The \`${DEFAULT_EXPORT_NAME}\` export is reserved for a \`worker\` config; found a \`${type}\` config.`
598
+ });
599
+ continue;
600
+ }
462
601
  const isSettingsName = key === SETTINGS_EXPORT_NAME;
463
602
  const isSettingsType = type === "settings";
464
603
  if (isSettingsType && !isSettingsName) ctx.issues.push({
@@ -656,18 +795,26 @@ __name(createFatalError, "createFatalError");
656
795
 
657
796
  //#endregion
658
797
  //#region src/convert.ts
798
+ const ROLLOUT_KIND_MAP = {
799
+ "full-auto": "full_auto",
800
+ "full-manual": "full_manual",
801
+ none: "none"
802
+ };
659
803
  /**
660
804
  * Convert a parsed `@cloudflare/config` config into a Wrangler `RawConfig`.
661
805
  *
662
- * The caller is responsible for unwrapping any function/promise wrapper around
663
- * the config and validating it against `InputWorkerSchema` before passing it in.
806
+ * The caller is responsible for unwrapping any function/promise wrappers and
807
+ * validating the configs against their corresponding input schemas before
808
+ * passing them in.
664
809
  *
665
810
  * @param workerConfig The parsed (post-validation) Worker config.
666
811
  * @param settingsConfig The optional parsed settings config, whose fields
667
812
  * are merged onto the result.
813
+ * @param containerExports The parsed Container exports to include in the
814
+ * result.
668
815
  * @returns The corresponding Wrangler `RawConfig`.
669
816
  */
670
- function convertToWranglerConfig(workerConfig, settingsConfig) {
817
+ function convertToWranglerConfig(workerConfig, settingsConfig, containerExports = []) {
671
818
  const result = {};
672
819
  convertTopLevel(workerConfig, result);
673
820
  convertBindingsAndAssets(workerConfig, result);
@@ -676,8 +823,50 @@ function convertToWranglerConfig(workerConfig, settingsConfig) {
676
823
  convertTriggers(workerConfig, result);
677
824
  convertTailConsumers(workerConfig, result);
678
825
  if (settingsConfig !== void 0) convertSettings(settingsConfig, result);
826
+ if (containerExports.length > 0) result.containers = containerExports.map((container) => convertContainer(container));
679
827
  return result;
680
828
  }
829
+ function convertContainer(container) {
830
+ if (container.schedulingPolicy === "durable-object") throw new UserError("Durable Object-managed Containers are not currently supported by `convertToWranglerConfig()`.", { telemetryMessage: false });
831
+ const converted = { name: container.name };
832
+ if (container.observability !== void 0) converted.observability = convertContainerObservability(container.observability);
833
+ if (container.unsafe !== void 0) converted.unsafe = container.unsafe;
834
+ converted.image = "dockerfile" in container.image ? container.image.dockerfile : container.image.reference;
835
+ converted.max_instances = container.maxInstances;
836
+ if ("dockerfile" in container.image) {
837
+ if (container.image.buildContext !== void 0) converted.image_build_context = container.image.buildContext;
838
+ if (container.image.buildVars !== void 0) converted.image_vars = container.image.buildVars;
839
+ }
840
+ if (container.instanceType !== void 0) if (typeof container.instanceType === "string") converted.instance_type = container.instanceType;
841
+ else {
842
+ const instanceType = {};
843
+ if (container.instanceType.vcpu !== void 0) instanceType.vcpu = container.instanceType.vcpu;
844
+ if (container.instanceType.memoryMib !== void 0) instanceType.memory_mib = container.instanceType.memoryMib;
845
+ if (container.instanceType.diskMb !== void 0) instanceType.disk_mb = container.instanceType.diskMb;
846
+ converted.instance_type = instanceType;
847
+ }
848
+ if (container.schedulingPolicy !== void 0) converted.scheduling_policy = container.schedulingPolicy;
849
+ if (container.ssh !== void 0) converted.ssh = container.ssh;
850
+ if (container.authorizedKeys !== void 0) converted.authorized_keys = container.authorizedKeys.map(({ name, publicKey }) => ({
851
+ name,
852
+ public_key: publicKey
853
+ }));
854
+ if (container.constraints !== void 0) converted.constraints = container.constraints;
855
+ if (container.rollout !== void 0) {
856
+ if (container.rollout.kind !== void 0) converted.rollout_kind = ROLLOUT_KIND_MAP[container.rollout.kind];
857
+ if (container.rollout.stepPercentage !== void 0) converted.rollout_step_percentage = container.rollout.stepPercentage;
858
+ if (container.rollout.activeGracePeriod !== void 0) converted.rollout_active_grace_period = container.rollout.activeGracePeriod;
859
+ }
860
+ return converted;
861
+ }
862
+ function convertContainerObservability(observability) {
863
+ const converted = {};
864
+ if (observability.enabled !== void 0) converted.enabled = observability.enabled;
865
+ if (observability.logs !== void 0) converted.logs = observability.logs;
866
+ if ("targetInstancePercentage" in observability && observability.targetInstancePercentage !== void 0) converted.target_instance_percentage = observability.targetInstancePercentage;
867
+ if ("targetInstanceCount" in observability && observability.targetInstanceCount !== void 0) converted.target_instance_count = observability.targetInstanceCount;
868
+ return converted;
869
+ }
681
870
  /**
682
871
  * Merge a parsed settings config's fields (`account_id`, `compliance_region`)
683
872
  * onto an existing Wrangler `RawConfig`.
@@ -1005,12 +1194,6 @@ function convertBindingsAndAssets(config, result) {
1005
1194
  remote: binding.dev?.remote
1006
1195
  }));
1007
1196
  break;
1008
- case "web-search":
1009
- result.websearch = omitUndefined({
1010
- binding: name,
1011
- remote: binding.dev?.remote
1012
- });
1013
- break;
1014
1197
  case "worker":
1015
1198
  services.push(omitUndefined({
1016
1199
  binding: name,
@@ -1351,6 +1534,9 @@ function isRecord(value) {
1351
1534
  function isConfigReference(value) {
1352
1535
  return typeof value === "function" || isRecord(value);
1353
1536
  }
1537
+ function normalizeConfigReference(reference, resolved, expectedType) {
1538
+ return isRecord(resolved) && resolved.type === expectedType && typeof resolved.name === "string" ? resolved.name : reference;
1539
+ }
1354
1540
  function createDefinitionResolver(ctx) {
1355
1541
  const resolvedDefinitions = /* @__PURE__ */ new Map();
1356
1542
  return (input) => {
@@ -1371,7 +1557,7 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
1371
1557
  const target = await resolveDefinition(binding.worker);
1372
1558
  env[bindingName] = {
1373
1559
  ...binding,
1374
- worker: isRecord(target) ? target.name : void 0
1560
+ worker: normalizeConfigReference(binding.worker, target, "worker")
1375
1561
  };
1376
1562
  }
1377
1563
  return {
@@ -1379,22 +1565,151 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
1379
1565
  env
1380
1566
  };
1381
1567
  }
1568
+ async function normalizeContainerReferences(resolved, resolveDefinition, resolvedExports) {
1569
+ const issues = [];
1570
+ if (!isRecord(resolved) || !isRecord(resolved.exports)) return {
1571
+ value: resolved,
1572
+ issues
1573
+ };
1574
+ const workerExports = { ...resolved.exports };
1575
+ for (const [exportName, workerExport] of Object.entries(workerExports)) {
1576
+ if (!isRecord(workerExport) || workerExport.type !== "durable-object" || workerExport.container === void 0) continue;
1577
+ const reference = workerExport.container;
1578
+ if (typeof reference === "string") {
1579
+ issues.push({
1580
+ code: "custom",
1581
+ input: reference,
1582
+ path: [
1583
+ "exports",
1584
+ exportName,
1585
+ "container"
1586
+ ],
1587
+ message: "Container provided as a string. Reference an exported Container definition instead."
1588
+ });
1589
+ workerExports[exportName] = {
1590
+ ...workerExport,
1591
+ container: void 0
1592
+ };
1593
+ continue;
1594
+ }
1595
+ const target = await resolveDefinition(reference);
1596
+ if (isRecord(target) && target.type === "container" && typeof target.name === "string" && !Object.values(resolvedExports).includes(target)) {
1597
+ issues.push({
1598
+ code: "custom",
1599
+ input: reference,
1600
+ path: [
1601
+ "exports",
1602
+ exportName,
1603
+ "container"
1604
+ ],
1605
+ message: `The referenced Container "${target.name}" is not exported.`
1606
+ });
1607
+ workerExports[exportName] = {
1608
+ ...workerExport,
1609
+ container: void 0
1610
+ };
1611
+ continue;
1612
+ }
1613
+ workerExports[exportName] = {
1614
+ ...workerExport,
1615
+ container: normalizeConfigReference(reference, target, "container")
1616
+ };
1617
+ }
1618
+ return {
1619
+ value: {
1620
+ ...resolved,
1621
+ exports: workerExports
1622
+ },
1623
+ issues
1624
+ };
1625
+ }
1626
+ async function normalizeConfigReferences(resolved, resolveDefinition, resolvedExports) {
1627
+ return normalizeContainerReferences(await normalizeWorkerReferences(resolved, resolveDefinition), resolveDefinition, resolvedExports);
1628
+ }
1382
1629
  function prefixIssues(issues, prefix) {
1383
1630
  return issues.map((issue) => ({
1384
1631
  ...issue,
1385
1632
  path: [prefix, ...issue.path]
1386
1633
  }));
1387
1634
  }
1635
+ function validateUniqueResourceNames(configExports) {
1636
+ const issues = [];
1637
+ const exportNameByResourceName = {
1638
+ container: /* @__PURE__ */ new Map(),
1639
+ worker: /* @__PURE__ */ new Map()
1640
+ };
1641
+ for (const [exportName, config] of Object.entries(configExports)) {
1642
+ if (config.type !== "container" && config.type !== "worker") continue;
1643
+ const resourceType = config.type === "container" ? "Container" : "Worker";
1644
+ const exportNames = exportNameByResourceName[config.type];
1645
+ const previousExportName = exportNames.get(config.name);
1646
+ if (previousExportName !== void 0) {
1647
+ issues.push({
1648
+ code: "custom",
1649
+ input: config.name,
1650
+ path: [exportName, "name"],
1651
+ message: `The ${resourceType} name "${config.name}" is also used by the "${previousExportName}" export. ${resourceType} names must be unique.`
1652
+ });
1653
+ continue;
1654
+ }
1655
+ exportNames.set(config.name, exportName);
1656
+ }
1657
+ return issues;
1658
+ }
1659
+ function validateContainerExportLinks(configExports) {
1660
+ const issues = [];
1661
+ const containerNames = /* @__PURE__ */ new Set();
1662
+ for (const config of Object.values(configExports)) if (config.type === "container") containerNames.add(config.name);
1663
+ const firstReferenceByContainerName = /* @__PURE__ */ new Map();
1664
+ for (const [workerExportName, config] of Object.entries(configExports)) {
1665
+ if (config.type !== "worker") continue;
1666
+ for (const [durableObjectExportName, workerExport] of Object.entries(config.exports ?? {})) {
1667
+ if (workerExport.type !== "durable-object" || !("container" in workerExport) || workerExport.container === void 0) continue;
1668
+ const containerName = workerExport.container;
1669
+ const path = [
1670
+ workerExportName,
1671
+ "exports",
1672
+ durableObjectExportName,
1673
+ "container"
1674
+ ];
1675
+ if (!containerNames.has(containerName)) {
1676
+ issues.push({
1677
+ code: "custom",
1678
+ input: containerName,
1679
+ path,
1680
+ message: `The Container "${containerName}" is not exported from this configuration.`
1681
+ });
1682
+ continue;
1683
+ }
1684
+ const firstReference = firstReferenceByContainerName.get(containerName);
1685
+ if (firstReference !== void 0) {
1686
+ issues.push({
1687
+ code: "custom",
1688
+ input: containerName,
1689
+ path,
1690
+ message: `The Container "${containerName}" is already referenced by "${firstReference.workerExportName}.exports.${firstReference.durableObjectExportName}". A Container can only be linked to one Durable Object.`
1691
+ });
1692
+ continue;
1693
+ }
1694
+ firstReferenceByContainerName.set(containerName, {
1695
+ workerExportName,
1696
+ durableObjectExportName
1697
+ });
1698
+ }
1699
+ }
1700
+ return issues;
1701
+ }
1388
1702
  /**
1389
1703
  * Resolve and validate loaded `cloudflare.config.ts` exports.
1390
1704
  *
1391
- * Config inputs are resolved once by identity. Top-level Worker exports are
1392
- * also parsed once by identity; unexported references are resolved only far
1393
- * enough to replace the reference with the Worker's name.
1705
+ * Config inputs are resolved once by identity. Top-level Worker and Container
1706
+ * exports are also parsed once by identity. References are resolved only far
1707
+ * enough to replace them with resource names, then Container links are
1708
+ * validated across the exported resources.
1394
1709
  */
1395
1710
  async function resolveAndValidateConfigExports(exports$2, ctx) {
1396
1711
  const resolveDefinition = createDefinitionResolver(ctx);
1397
- const parsedWorkers = /* @__PURE__ */ new Map();
1712
+ const parsedResources = /* @__PURE__ */ new Map();
1398
1713
  const resolvedExports = {};
1399
1714
  for (const [name, input] of Object.entries(exports$2)) resolvedExports[name] = await resolveDefinition(input);
1400
1715
  const typeResult = ConfigExportsTypeSchema.safeParse(resolvedExports);
@@ -1408,17 +1723,20 @@ async function resolveAndValidateConfigExports(exports$2, ctx) {
1408
1723
  for (const [name, input] of Object.entries(exports$2)) {
1409
1724
  const resolved = resolvedExports[name];
1410
1725
  if (!isRecord(resolved)) continue;
1411
- if (resolved.type === "worker") {
1412
- let result = parsedWorkers.get(input);
1413
- if (!result) {
1414
- result = InputWorkerSchema.safeParse(await normalizeWorkerReferences(resolved, resolveDefinition));
1415
- parsedWorkers.set(input, result);
1416
- if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
1417
- }
1418
- if (result.success) data[name] = result.data;
1419
- continue;
1726
+ if (resolved.type !== "worker" && resolved.type !== "container") continue;
1727
+ let result = parsedResources.get(input);
1728
+ if (!result) {
1729
+ if (resolved.type === "worker") {
1730
+ const normalized = await normalizeConfigReferences(resolved, resolveDefinition, resolvedExports);
1731
+ issues.push(...prefixIssues(normalized.issues, name));
1732
+ result = InputWorkerSchema.safeParse(normalized.value);
1733
+ } else result = InputContainerSchema.safeParse(resolved);
1734
+ parsedResources.set(input, result);
1735
+ if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
1420
1736
  }
1737
+ if (result.success) data[name] = result.data;
1421
1738
  }
1739
+ issues.push(...validateUniqueResourceNames(data), ...validateContainerExportLinks(data));
1422
1740
  return issues.length > 0 ? {
1423
1741
  success: false,
1424
1742
  error: new z.ZodError(issues)
@@ -1439,4 +1757,4 @@ async function loadAndValidateConfig(configPath, ctx, options) {
1439
1757
  }
1440
1758
 
1441
1759
  //#endregion
1442
- export { AnalyticsEngineDatasetBindingSchema, AssetsSchema, BindingSchema, BrowserBindingSchema, D1BindingSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, ExportSchema, FlagshipBindingSchema, HyperdriveBindingSchema, InputSettingsSchema, InputWorkerSchema, KVBindingSchema, KnownBindingSchema, ModuleTypeSchema, OutputSettingsSchema, OutputWorkerSchema, QueueBindingSchema, R2BindingSchema, TailConsumerSchema, UnsafeBindingSchema, WorkerBindingSchema, WorkerEntrypointExportSchema, bindings, convertToWranglerConfig, defineSettings, defineWorker, exports$1 as exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveAndValidateConfigExports, triggers, validateSingletonBindings };
1760
+ export { AnalyticsEngineDatasetBindingSchema, AssetsSchema, BindingSchema, BrowserBindingSchema, D1BindingSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectExpectingTransferExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, ExportSchema, FlagshipBindingSchema, HyperdriveBindingSchema, InputContainerSchema, InputSettingsSchema, InputWorkerSchema, KVBindingSchema, KnownBindingSchema, ModuleTypeSchema, OutputContainerSchema, OutputSettingsSchema, OutputWorkerSchema, QueueBindingSchema, R2BindingSchema, TailConsumerSchema, UnsafeBindingSchema, WorkerBindingSchema, WorkerEntrypointExportSchema, bindings, convertToWranglerConfig, defineContainer, defineSettings, defineWorker, exports$1 as exports, generateTypes, loadAndValidateConfig, loadConfig, registerConfigHooks, resolveAndValidateConfigExports, triggers, validateSingletonBindings };
@@ -82,7 +82,6 @@ interface BindingTypeMap<TBinding> {
82
82
  "version-metadata": WorkerVersionMetadata;
83
83
  "vpc-service": Fetcher;
84
84
  "vpc-network": Fetcher;
85
- "web-search": WebSearch;
86
85
  worker: Fetcher;
87
86
  "worker-loader": WorkerLoader;
88
87
  workflow: Workflow;
@@ -231,6 +230,25 @@ type ConfigWithType<T$1 extends ConfigObject, TType extends string> = T$1 & {
231
230
  type: TType;
232
231
  };
233
232
  //#endregion
233
+ //#region src/container-definition.d.ts
234
+ type ContainerConfigExport<T$1 extends ContainerConfig = ContainerConfig> = ConfigInput<T$1>;
235
+ type DistributiveOmit<T$1, K$1 extends PropertyKey> = T$1 extends unknown ? Omit<T$1, K$1> : never;
236
+ /**
237
+ * Authored Container config shape — {@link ContainerConfig} without the `type`
238
+ * discriminant, which `defineContainer` injects.
239
+ */
240
+ type ContainerConfigInput = DistributiveOmit<ContainerConfig, "type">;
241
+ /** Declare a Container application. */
242
+ declare const defineContainer: <const TInput extends ConfigInput<ContainerConfigInput>>(config: TInput) => TInput extends ((ctx: ConfigContext) => infer TResult) ? (ctx: ConfigContext) => TResult extends Promise<infer TConfig extends {
243
+ [x: string]: unknown;
244
+ }> ? Promise<ConfigWithType<TConfig, "container">> : TResult extends {
245
+ [x: string]: unknown;
246
+ } ? ConfigWithType<TResult, "container"> : never : TInput extends Promise<infer TConfig extends {
247
+ [x: string]: unknown;
248
+ }> ? Promise<ConfigWithType<TConfig, "container">> : TInput extends {
249
+ [x: string]: unknown;
250
+ } ? ConfigWithType<TInput, "container"> : never;
251
+ //#endregion
234
252
  //#region src/exports.d.ts
235
253
  /**
236
254
  * Storage backend for the Durable Object.
@@ -238,17 +256,16 @@ type ConfigWithType<T$1 extends ConfigObject, TType extends string> = T$1 & {
238
256
  * Containers are only supported on the SQLite storage engine, so `container` is
239
257
  * only offered alongside `storage: "sqlite"`.
240
258
  */
241
- type DurableObjectStorageOptions = {
259
+ type DurableObjectStorageOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
242
260
  /**
243
261
  * Selects the SQLite-backed storage engine (recommended for new
244
262
  * classes).
245
263
  */
246
264
  storage: "sqlite";
247
265
  /**
248
- * Attach a container to this Durable Object, by container name. The
249
- * name must match an entry in the top level `containers` array.
266
+ * Attach a Container application to this Durable Object by config reference.
250
267
  */
251
- container?: string;
268
+ container?: TContainer;
252
269
  } | {
253
270
  /** Selects the legacy key-value storage engine. */
254
271
  storage: "legacy-kv";
@@ -261,9 +278,9 @@ type DurableObjectStorageOptions = {
261
278
  *
262
279
  * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
263
280
  */
264
- type DurableObjectCreatedExportOptions = {
281
+ type DurableObjectCreatedExportOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
265
282
  state?: "created";
266
- } & DurableObjectStorageOptions;
283
+ } & DurableObjectStorageOptions<TContainer>;
267
284
  /**
268
285
  * Retire a provisioned Durable Object namespace whose class has
269
286
  * been removed from code.
@@ -303,14 +320,14 @@ interface DurableObjectTransferredExportOptions {
303
320
  * Prepare to receive cross-Worker Durable Object transfer.
304
321
  * Once the source Worker's `transferred` export is deployed, this entry becomes a normal live `durable-object` export.
305
322
  */
306
- type DurableObjectExpectingTransferExportOptions = {
323
+ type DurableObjectExpectingTransferExportOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
307
324
  state: "expecting-transfer";
308
325
  /**
309
326
  * The source Worker for the two-phase cross-Worker transfer.
310
327
  */
311
328
  transferFrom: string;
312
- } & DurableObjectStorageOptions;
313
- type DurableObjectCreatedExport = DurableObjectCreatedExportOptions & {
329
+ } & DurableObjectStorageOptions<TContainer>;
330
+ type DurableObjectCreatedExport<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = DurableObjectCreatedExportOptions<TContainer> & {
314
331
  type: "durable-object";
315
332
  };
316
333
  interface DurableObjectDeletedExport extends DurableObjectDeletedExportOptions {
@@ -322,7 +339,7 @@ interface DurableObjectRenamedExport extends DurableObjectRenamedExportOptions {
322
339
  interface DurableObjectTransferredExport extends DurableObjectTransferredExportOptions {
323
340
  type: "durable-object";
324
341
  }
325
- type DurableObjectExpectingTransferExport = DurableObjectExpectingTransferExportOptions & {
342
+ type DurableObjectExpectingTransferExport<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = DurableObjectExpectingTransferExportOptions<TContainer> & {
326
343
  type: "durable-object";
327
344
  };
328
345
  type DurableObjectExportOptions = DurableObjectCreatedExportOptions | DurableObjectDeletedExportOptions | DurableObjectRenamedExportOptions | DurableObjectTransferredExportOptions | DurableObjectExpectingTransferExportOptions;
@@ -349,7 +366,7 @@ interface Exports {
349
366
  *
350
367
  * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
351
368
  */
352
- durableObject(options: DurableObjectCreatedExportOptions): DurableObjectCreatedExport;
369
+ durableObject<TContainer extends ContainerConfigExport | undefined = undefined>(options: DurableObjectCreatedExportOptions<TContainer>): DurableObjectCreatedExport<TContainer>;
353
370
  /**
354
371
  * Retire a provisioned Durable Object namespace whose class has been removed from code.
355
372
  */
@@ -366,7 +383,7 @@ interface Exports {
366
383
  * Prepare to receive cross-Worker Durable Object transfer.
367
384
  * The source Worker must follow up with a deployment containing a `transferred` export to commit the transfer.
368
385
  */
369
- durableObject(options: DurableObjectExpectingTransferExportOptions): DurableObjectExpectingTransferExport;
386
+ durableObject<TContainer extends ContainerConfigExport | undefined = undefined>(options: DurableObjectExpectingTransferExportOptions<TContainer>): DurableObjectExpectingTransferExport<TContainer>;
370
387
  durableObject(options: DurableObjectExportOptions): DurableObjectExports;
371
388
  /** Declares a WorkerEntrypoint export defined by this Worker. */
372
389
  worker(options?: WorkerEntrypointExportOptions): WorkerEntrypointExport;
@@ -376,12 +393,17 @@ interface Exports {
376
393
  *
377
394
  * @example
378
395
  * ```typescript
379
- * import { defineWorker, exports } from "@cloudflare/config";
396
+ * import { defineContainer, defineWorker, exports } from "@cloudflare/config";
397
+ *
398
+ * const myContainer = defineContainer({
399
+ * name: "my-container",
400
+ * image: { dockerfile: "./Dockerfile" },
401
+ * });
380
402
  *
381
403
  * export default defineWorker({
382
404
  * exports: {
383
405
  * MyDurableObject: exports.durableObject({ storage: "sqlite" }),
384
- * MyContainerDO: exports.durableObject({ storage: "sqlite", container: "my-container" }),
406
+ * MyContainerDO: exports.durableObject({ storage: "sqlite", container: myContainer }),
385
407
  * OldClass: exports.durableObject({ state: "deleted" }),
386
408
  * OldName: exports.durableObject({ state: "renamed", renamedTo: "NewName" }),
387
409
  * Outgoing: exports.durableObject({ state: "transferred", transferredTo: "target-worker" }),
@@ -560,7 +582,7 @@ declare const triggers: Triggers;
560
582
  /**
561
583
  * Union of all binding definitions accepted in `env`.
562
584
  */
563
- type Binding = AgentMemoryBinding | AiBinding | AiSearchBinding | AiSearchNamespaceBinding | AnalyticsEngineDatasetBinding | ArtifactsBinding | AssetsBinding | BrowserBinding | D1Binding | DispatchNamespaceBinding | DurableObjectBinding | FlagshipBinding | HyperdriveBinding | ImagesBinding$1 | JsonBinding | KvBinding | LogfwdrBinding | MediaBinding$1 | MtlsCertificateBinding | PipelineBinding | QueueBinding | R2Binding | RateLimitBinding | SecretBinding | SecretsStoreSecretBinding | SendEmailBinding | StreamBinding$1 | TextBinding | UnsafeBinding | VectorizeBinding | VersionMetadataBinding | VpcNetworkBinding | VpcServiceBinding | WebSearchBinding | WorkerBinding | WorkerLoaderBinding;
585
+ type Binding = AgentMemoryBinding | AiBinding | AiSearchBinding | AiSearchNamespaceBinding | AnalyticsEngineDatasetBinding | ArtifactsBinding | AssetsBinding | BrowserBinding | D1Binding | DispatchNamespaceBinding | DurableObjectBinding | FlagshipBinding | HyperdriveBinding | ImagesBinding$1 | JsonBinding | KvBinding | LogfwdrBinding | MediaBinding$1 | MtlsCertificateBinding | PipelineBinding | QueueBinding | R2Binding | RateLimitBinding | SecretBinding | SecretsStoreSecretBinding | SendEmailBinding | StreamBinding$1 | TextBinding | UnsafeBinding | VectorizeBinding | VersionMetadataBinding | VpcNetworkBinding | VpcServiceBinding | WorkerBinding | WorkerLoaderBinding;
564
586
  /**
565
587
  * Union of all trigger definitions accepted in `triggers`.
566
588
  */
@@ -571,6 +593,181 @@ type Trigger = ConnectTrigger | EmailTrigger | FetchTrigger | QueueConsumerTrigg
571
593
  * classes and tombstone lifecycle operations.
572
594
  */
573
595
  type Export = DurableObjectCreatedExport | DurableObjectDeletedExport | DurableObjectRenamedExport | DurableObjectTransferredExport | DurableObjectExpectingTransferExport | WorkerEntrypointExport;
596
+ /** An image source accepted in an authored Container configuration. */
597
+ type ContainerImage = {
598
+ /** The path to a Dockerfile. */
599
+ dockerfile: string;
600
+ /**
601
+ * Build context of the application.
602
+ *
603
+ * @default The directory containing `dockerfile`.
604
+ */
605
+ buildContext?: string;
606
+ /** Image variables available to the image at build time only. */
607
+ buildVars?: Record<string, string>;
608
+ } | {
609
+ /**
610
+ * Reference to an existing image.
611
+ *
612
+ * For supported registries, refer to
613
+ * https://developers.cloudflare.com/containers/guides/image-management/#use-pre-built-container-images
614
+ */
615
+ reference: string;
616
+ };
617
+ /** Fields shared by all Container application configurations. */
618
+ interface BaseContainerConfig {
619
+ /**
620
+ * Discriminates this config as a Container config.
621
+ *
622
+ * Injected automatically by `defineContainer`; only needs to be written by
623
+ * hand when authoring a raw config object without the helper.
624
+ */
625
+ type: "container";
626
+ /**
627
+ * Name of the application.
628
+ *
629
+ * This is also the identifier used to reference the Container from a Durable
630
+ * Object's `exports` entry via its `container` field.
631
+ */
632
+ name: string;
633
+ /** Configures observability for Container instances. */
634
+ observability?: {
635
+ /** Whether observability is enabled. */
636
+ enabled?: boolean;
637
+ logs?: {
638
+ /** Whether log collection is enabled. */
639
+ enabled?: boolean;
640
+ };
641
+ } & ({
642
+ /** Percentage of Container instances targeted for observability. */
643
+ targetInstancePercentage?: number;
644
+ targetInstanceCount?: never;
645
+ } | {
646
+ targetInstancePercentage?: never;
647
+ /** Number of Container instances targeted for observability. */
648
+ targetInstanceCount?: number;
649
+ });
650
+ /**
651
+ * Passed through without client-side validation or transformation.
652
+ *
653
+ * @hidden
654
+ */
655
+ unsafe?: Record<string, unknown>;
656
+ }
657
+ /** A Container application managed with a standard scheduling policy. */
658
+ interface StandardContainerConfig extends BaseContainerConfig {
659
+ /** The image to build or deploy. */
660
+ image: ContainerImage;
661
+ /**
662
+ * Maximum number of application instances.
663
+ *
664
+ * @default 20
665
+ */
666
+ maxInstances?: number;
667
+ /**
668
+ * The instance type to be used for the Container.
669
+ * Select from one of the following named instance types:
670
+ *
671
+ * - lite: 1/16 vCPU, 256 MiB memory, and 2 GB disk
672
+ * - basic: 1/4 vCPU, 1 GiB memory, and 4 GB disk
673
+ * - standard-1: 1/2 vCPU, 4 GiB memory, and 8 GB disk
674
+ * - standard-2: 1 vCPU, 6 GiB memory, and 12 GB disk
675
+ * - standard-3: 2 vCPU, 8 GiB memory, and 16 GB disk
676
+ * - standard-4: 4 vCPU, 12 GiB memory, and 20 GB disk
677
+ *
678
+ * Customers on an enterprise plan have the additional option to set custom
679
+ * limits.
680
+ *
681
+ * @default "lite"
682
+ */
683
+ instanceType?: "basic" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | {
684
+ /** @default 0.0625 (1/16 vCPU) */
685
+ vcpu?: number;
686
+ /** @default 256 MiB */
687
+ memoryMib?: number;
688
+ /** @default 2 GB */
689
+ diskMb?: number;
690
+ };
691
+ /**
692
+ * The scheduling policy of the application.
693
+ *
694
+ * @default "default"
695
+ */
696
+ schedulingPolicy?: "default" | "regional";
697
+ ssh?: {
698
+ /**
699
+ * If enabled, users with write access to the Container application can
700
+ * connect to it over SSH.
701
+ *
702
+ * @default false
703
+ */
704
+ enabled: boolean;
705
+ /**
706
+ * Port that the SSH service is running on.
707
+ *
708
+ * @default 22
709
+ */
710
+ port?: number;
711
+ };
712
+ /** SSH public keys to put in the Container's authorized_keys file. */
713
+ authorizedKeys?: Array<{
714
+ name: string;
715
+ publicKey: string;
716
+ }>;
717
+ /** Scheduling constraints for Container placement. */
718
+ constraints?: {
719
+ /** Limit Container placement to specific geographic regions. */
720
+ regions?: Array<"ENAM" | "WNAM" | "EEUR" | "WEUR" | "APAC" | "SAM" | "ME" | "OC" | "AFR">;
721
+ /** Restrict Containers to compliance boundaries. */
722
+ jurisdiction?: "eu" | "fedramp";
723
+ };
724
+ rollout?: {
725
+ /**
726
+ * How a rollout should be created. It supports the following modes:
727
+ *
728
+ * - full-auto: The Container application will be rolled out fully
729
+ * automatically.
730
+ * - none: The Container application will not have a rollout or update.
731
+ * - full-manual: The Container application will be rolled out by manually
732
+ * progressing through the rollout steps.
733
+ *
734
+ * @default "full-auto"
735
+ * @hidden
736
+ */
737
+ kind?: "full-auto" | "none" | "full-manual";
738
+ /**
739
+ * Configures what percentage of instances should be updated at each step of
740
+ * a rollout. You can specify this as a single number or an array of numbers.
741
+ *
742
+ * If this is a single number, each step will progress by that percentage.
743
+ * The options are 5, 10, 20, 25, 50, or 100.
744
+ *
745
+ * If this is an array, each step specifies the cumulative rollout progress.
746
+ * The final step must be 100.
747
+ *
748
+ * @default [10, 100]
749
+ */
750
+ stepPercentage?: number | number[];
751
+ /**
752
+ * Configures the grace period, in seconds, for active instances before they
753
+ * are shut down during a rollout.
754
+ *
755
+ * @default 0
756
+ */
757
+ activeGracePeriod?: number;
758
+ };
759
+ }
760
+ /** A Container application managed by a Durable Object. */
761
+ interface DurableObjectContainerConfig extends BaseContainerConfig {
762
+ schedulingPolicy: "durable-object";
763
+ /** Named images that the Durable Object can start. */
764
+ images?: Record<string, ContainerImage>;
765
+ }
766
+ /**
767
+ * Container application configuration. This is the input shape passed to
768
+ * `defineContainer` and is validated at runtime by `InputContainerSchema`.
769
+ */
770
+ type ContainerConfig = DurableObjectContainerConfig | StandardContainerConfig;
574
771
  /**
575
772
  * Worker configuration. This is the input shape passed to
576
773
  * [`defineWorker`](https://developers.cloudflare.com/workers/wrangler/configuration/).
@@ -1363,17 +1560,6 @@ interface VpcServiceBindingOptions {
1363
1560
  interface VpcServiceBinding extends VpcServiceBindingOptions {
1364
1561
  type: "vpc-service";
1365
1562
  }
1366
- interface WebSearchBindingOptions {
1367
- /** Options that only apply during local development. */
1368
- dev?: BindingDevOptions;
1369
- }
1370
- /**
1371
- * Cloudflare Web Search binding. There is exactly one shared web corpus, so
1372
- * the binding is zero-config — only the variable name is required.
1373
- */
1374
- interface WebSearchBinding extends WebSearchBindingOptions {
1375
- type: "web-search";
1376
- }
1377
1563
  interface WorkerBindingOptions<TWorker$1 extends WorkerReference = WorkerReference, TExportName$1 extends WorkerEntrypointExportName<TWorker$1> | undefined = WorkerEntrypointExportName<TWorker$1> | undefined> {
1378
1564
  /** The name or config of the bound Worker. */
1379
1565
  worker: TWorker$1;
@@ -1567,11 +1753,6 @@ interface Bindings {
1567
1753
  vpcNetwork(options: VpcNetworkBindingOptions): VpcNetworkBinding;
1568
1754
  /** Binding to a VPC service. */
1569
1755
  vpcService(options: VpcServiceBindingOptions): VpcServiceBinding;
1570
- /**
1571
- * Cloudflare Web Search binding. There is exactly one shared web corpus, so
1572
- * the binding is zero-config — only the variable name is required.
1573
- */
1574
- webSearch(options?: WebSearchBindingOptions): WebSearchBinding;
1575
1756
  /**
1576
1757
  * Service binding (Worker-to-Worker). `worker` is the name or config of the
1577
1758
  * bound Worker; `exportName` selects a named `WorkerEntrypoint` export
@@ -1606,4 +1787,4 @@ declare const defineSettings: <const TInput extends ConfigInput<SettingsConfigIn
1606
1787
  [x: string]: unknown;
1607
1788
  } ? ConfigWithType<TInput, "settings"> : never;
1608
1789
  //#endregion
1609
- export { WorkerConfig as $, SecretsStoreSecretBinding as A, VersionMetadataBinding as B, MediaBinding$1 as C, R2Binding as D, QueueBinding as E, TypedKvBinding as F, WorkerLoaderBinding as G, VpcServiceBinding as H, TypedPipelineBinding as I, bindings as J, WorkerReference as K, TypedQueueBinding as L, StreamBinding$1 as M, TextBinding as N, RateLimitBinding as O, TypedAiBinding as P, SettingsConfig as Q, UnsafeBinding as R, LogfwdrBinding as S, PipelineBinding as T, WebSearchBinding as U, VpcNetworkBinding as V, WorkerBinding as W, WorkerConfigInput as X, WorkerConfigExport as Y, defineWorker as Z, FlagshipBinding as _, InferDurableNamespaces as _t, AiBinding as a, Triggers as at, JsonBinding as b, UnwrapConfig as bt, AnalyticsEngineDatasetBinding as c, DurableObjectDeletedExport as ct, BindingDevOptions as d, DurableObjectTransferredExport as dt, ConnectTrigger as et, Bindings as f, Exports as ft, DurableObjectBinding as g, ConfigContext as gt, DispatchNamespaceBinding as h, exports as ht, AgentMemoryBinding as i, ScheduledTrigger as it, SendEmailBinding as j, SecretBinding as k, ArtifactsBinding as l, DurableObjectExpectingTransferExport as lt, D1Binding as m, WorkerEntrypointExportOptions as mt, SettingsConfigInput as n, FetchTrigger as nt, AiSearchBinding as o, triggers as ot, BrowserBinding as p, WorkerEntrypointExport as pt, WorkflowBinding as q, defineSettings as r, QueueConsumerTrigger as rt, AiSearchNamespaceBinding as s, DurableObjectCreatedExport as st, SettingsConfigExport as t, EmailTrigger as tt, AssetsBinding as u, DurableObjectRenamedExport as ut, HyperdriveBinding as v, InferEnv as vt, MtlsCertificateBinding as w, KvBinding as x, ImagesBinding$1 as y, InferMainModule as yt, VectorizeBinding as z };
1790
+ export { WorkerConfig as $, SecretsStoreSecretBinding as A, VersionMetadataBinding as B, MediaBinding$1 as C, UnwrapConfig as Ct, R2Binding as D, QueueBinding as E, TypedKvBinding as F, WorkerReference as G, VpcServiceBinding as H, TypedPipelineBinding as I, WorkerConfigExport as J, WorkflowBinding as K, TypedQueueBinding as L, StreamBinding$1 as M, TextBinding as N, RateLimitBinding as O, TypedAiBinding as P, SettingsConfig as Q, UnsafeBinding as R, LogfwdrBinding as S, InferMainModule as St, PipelineBinding as T, WorkerBinding as U, VpcNetworkBinding as V, WorkerLoaderBinding as W, defineWorker as X, WorkerConfigInput as Y, ContainerConfig as Z, FlagshipBinding as _, ContainerConfigInput as _t, AiBinding as a, Triggers as at, JsonBinding as b, InferDurableNamespaces as bt, AnalyticsEngineDatasetBinding as c, DurableObjectDeletedExport as ct, BindingDevOptions as d, DurableObjectTransferredExport as dt, ConnectTrigger as et, Bindings as f, Exports as ft, DurableObjectBinding as g, ContainerConfigExport as gt, DispatchNamespaceBinding as h, exports as ht, AgentMemoryBinding as i, ScheduledTrigger as it, SendEmailBinding as j, SecretBinding as k, ArtifactsBinding as l, DurableObjectExpectingTransferExport as lt, D1Binding as m, WorkerEntrypointExportOptions as mt, SettingsConfigInput as n, FetchTrigger as nt, AiSearchBinding as o, triggers as ot, BrowserBinding as p, WorkerEntrypointExport as pt, bindings as q, defineSettings as r, QueueConsumerTrigger as rt, AiSearchNamespaceBinding as s, DurableObjectCreatedExport as st, SettingsConfigExport as t, EmailTrigger as tt, AssetsBinding as u, DurableObjectRenamedExport as ut, HyperdriveBinding as v, defineContainer as vt, MtlsCertificateBinding as w, KvBinding as x, InferEnv as xt, ImagesBinding$1 as y, ConfigContext as yt, VectorizeBinding as z };
@@ -119,10 +119,6 @@ const bindings = {
119
119
  type: "vpc-network",
120
120
  ...options
121
121
  }),
122
- webSearch: (options) => ({
123
- type: "web-search",
124
- ...options
125
- }),
126
122
  worker: (options) => ({
127
123
  type: "worker",
128
124
  ...options
@@ -193,12 +189,17 @@ function worker(options = {}) {
193
189
  *
194
190
  * @example
195
191
  * ```typescript
196
- * import { defineWorker, exports } from "@cloudflare/config";
192
+ * import { defineContainer, defineWorker, exports } from "@cloudflare/config";
193
+ *
194
+ * const myContainer = defineContainer({
195
+ * name: "my-container",
196
+ * image: { dockerfile: "./Dockerfile" },
197
+ * });
197
198
  *
198
199
  * export default defineWorker({
199
200
  * exports: {
200
201
  * MyDurableObject: exports.durableObject({ storage: "sqlite" }),
201
- * MyContainerDO: exports.durableObject({ storage: "sqlite", container: "my-container" }),
202
+ * MyContainerDO: exports.durableObject({ storage: "sqlite", container: myContainer }),
202
203
  * OldClass: exports.durableObject({ state: "deleted" }),
203
204
  * OldName: exports.durableObject({ state: "renamed", renamedTo: "NewName" }),
204
205
  * Outgoing: exports.durableObject({ state: "transferred", transferredTo: "target-worker" }),
@@ -236,6 +237,11 @@ function createConfigDefiner(type) {
236
237
  return define;
237
238
  }
238
239
 
240
+ //#endregion
241
+ //#region src/container-definition.ts
242
+ /** Declare a Container application. */
243
+ const defineContainer = createConfigDefiner("container");
244
+
239
245
  //#endregion
240
246
  //#region src/worker-definition.ts
241
247
  const defineWorker = createConfigDefiner("worker");
@@ -249,4 +255,4 @@ const defineWorker = createConfigDefiner("worker");
249
255
  const defineSettings = createConfigDefiner("settings");
250
256
 
251
257
  //#endregion
252
- export { bindings as a, triggers as i, defineWorker as n, exports as r, defineSettings as t };
258
+ export { triggers as a, exports as i, defineWorker as n, bindings as o, defineContainer as r, defineSettings as t };
package/dist/public.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerLoaderBinding, H as VpcServiceBinding, I as TypedPipelineBinding, J as bindings, K as WorkerReference, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, T as PipelineBinding, U as WebSearchBinding, V as VpcNetworkBinding, W as WorkerBinding, X as WorkerConfigInput, Y as WorkerConfigExport, Z as defineWorker, _ as FlagshipBinding, _t as InferDurableNamespaces, a as AiBinding, at as Triggers, b as JsonBinding, bt as UnwrapConfig, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ConfigContext, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as WorkflowBinding, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as InferEnv, w as MtlsCertificateBinding, x as KvBinding, y as ImagesBinding, yt as InferMainModule, z as VectorizeBinding } from "./public-E85Be_2R.mjs";
2
- export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BindingDevOptions, Bindings, BrowserBinding, ConfigContext, ConnectTrigger, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigExport, SettingsConfigInput, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, defineSettings, defineWorker, exports, triggers };
1
+ import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, Ct as UnwrapConfig, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerReference, H as VpcServiceBinding, I as TypedPipelineBinding, J as WorkerConfigExport, K as WorkflowBinding, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, St as InferMainModule, T as PipelineBinding, U as WorkerBinding, V as VpcNetworkBinding, W as WorkerLoaderBinding, X as defineWorker, Y as WorkerConfigInput, Z as ContainerConfig, _ as FlagshipBinding, _t as ContainerConfigInput, a as AiBinding, at as Triggers, b as JsonBinding, bt as InferDurableNamespaces, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ContainerConfigExport, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as bindings, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as defineContainer, w as MtlsCertificateBinding, x as KvBinding, xt as InferEnv, y as ImagesBinding, yt as ConfigContext, z as VectorizeBinding } from "./public-B4i-aaaO.mjs";
2
+ 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, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigExport, SettingsConfigInput, 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 };
package/dist/public.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as bindings, i as triggers, n as defineWorker, r as exports, t as defineSettings } from "./public-bN7EDGtD.mjs";
1
+ import { a as triggers, i as exports, n as defineWorker, o as bindings, r as defineContainer, t as defineSettings } from "./public-Dyr8BJqf.mjs";
2
2
 
3
- export { bindings, defineSettings, defineWorker, exports, triggers };
3
+ export { bindings, defineContainer, defineSettings, defineWorker, exports, triggers };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/config",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Definitions and utilities for configuring Cloudflare Workers and related products. This is not yet stable enough for external use — APIs may change without notice.",
5
5
  "homepage": "https://github.com/cloudflare/workers-sdk/tree/main/packages/config#readme",
6
6
  "bugs": {
@@ -31,13 +31,13 @@
31
31
  "zod": "4.4.3"
32
32
  },
33
33
  "devDependencies": {
34
- "@cloudflare/workers-types": "^5.20260908.1",
34
+ "@cloudflare/workers-types": "^5.20260915.1",
35
35
  "ts-dedent": "^2.2.0",
36
36
  "tsdown": "0.16.3",
37
37
  "typescript": "5.8.3",
38
38
  "vitest": "4.1.0",
39
39
  "@cloudflare/workers-tsconfig": "0.0.0",
40
- "@cloudflare/workers-utils": "0.37.0"
40
+ "@cloudflare/workers-utils": "0.39.0"
41
41
  },
42
42
  "workers-sdk": {
43
43
  "prerelease": true