@cloudflare/vite-plugin 1.54.8 → 1.54.10

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,6 +1,6 @@
1
1
  import { Pipeline, PipelineRecord } from "cloudflare:pipelines";
2
2
 
3
- //#region ../config/dist/public-E85Be_2R.d.mts
3
+ //#region ../config/dist/public-B4i-aaaO.d.mts
4
4
 
5
5
  //#region src/inference.d.ts
6
6
  /**
@@ -83,7 +83,6 @@ interface BindingTypeMap<TBinding> {
83
83
  "version-metadata": WorkerVersionMetadata;
84
84
  "vpc-service": Fetcher;
85
85
  "vpc-network": Fetcher;
86
- "web-search": WebSearch;
87
86
  worker: Fetcher;
88
87
  "worker-loader": WorkerLoader;
89
88
  workflow: Workflow;
@@ -232,6 +231,25 @@ type ConfigWithType<T$1 extends ConfigObject, TType extends string> = T$1 & {
232
231
  type: TType;
233
232
  };
234
233
  //#endregion
234
+ //#region src/container-definition.d.ts
235
+ type ContainerConfigExport<T$1 extends ContainerConfig = ContainerConfig> = ConfigInput<T$1>;
236
+ type DistributiveOmit<T$1, K$1 extends PropertyKey> = T$1 extends unknown ? Omit<T$1, K$1> : never;
237
+ /**
238
+ * Authored Container config shape — {@link ContainerConfig} without the `type`
239
+ * discriminant, which `defineContainer` injects.
240
+ */
241
+ type ContainerConfigInput = DistributiveOmit<ContainerConfig, "type">;
242
+ /** Declare a Container application. */
243
+ declare const defineContainer: <const TInput extends ConfigInput<ContainerConfigInput>>(config: TInput) => TInput extends ((ctx: ConfigContext) => infer TResult) ? (ctx: ConfigContext) => TResult extends Promise<infer TConfig extends {
244
+ [x: string]: unknown;
245
+ }> ? Promise<ConfigWithType<TConfig, "container">> : TResult extends {
246
+ [x: string]: unknown;
247
+ } ? ConfigWithType<TResult, "container"> : never : TInput extends Promise<infer TConfig extends {
248
+ [x: string]: unknown;
249
+ }> ? Promise<ConfigWithType<TConfig, "container">> : TInput extends {
250
+ [x: string]: unknown;
251
+ } ? ConfigWithType<TInput, "container"> : never;
252
+ //#endregion
235
253
  //#region src/exports.d.ts
236
254
  /**
237
255
  * Storage backend for the Durable Object.
@@ -239,17 +257,16 @@ type ConfigWithType<T$1 extends ConfigObject, TType extends string> = T$1 & {
239
257
  * Containers are only supported on the SQLite storage engine, so `container` is
240
258
  * only offered alongside `storage: "sqlite"`.
241
259
  */
242
- type DurableObjectStorageOptions = {
260
+ type DurableObjectStorageOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
243
261
  /**
244
262
  * Selects the SQLite-backed storage engine (recommended for new
245
263
  * classes).
246
264
  */
247
265
  storage: "sqlite";
248
266
  /**
249
- * Attach a container to this Durable Object, by container name. The
250
- * name must match an entry in the top level `containers` array.
267
+ * Attach a Container application to this Durable Object by config reference.
251
268
  */
252
- container?: string;
269
+ container?: TContainer;
253
270
  } | {
254
271
  /** Selects the legacy key-value storage engine. */
255
272
  storage: "legacy-kv";
@@ -262,9 +279,9 @@ type DurableObjectStorageOptions = {
262
279
  *
263
280
  * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
264
281
  */
265
- type DurableObjectCreatedExportOptions = {
282
+ type DurableObjectCreatedExportOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
266
283
  state?: "created";
267
- } & DurableObjectStorageOptions;
284
+ } & DurableObjectStorageOptions<TContainer>;
268
285
  /**
269
286
  * Retire a provisioned Durable Object namespace whose class has
270
287
  * been removed from code.
@@ -304,14 +321,14 @@ interface DurableObjectTransferredExportOptions {
304
321
  * Prepare to receive cross-Worker Durable Object transfer.
305
322
  * Once the source Worker's `transferred` export is deployed, this entry becomes a normal live `durable-object` export.
306
323
  */
307
- type DurableObjectExpectingTransferExportOptions = {
324
+ type DurableObjectExpectingTransferExportOptions<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = {
308
325
  state: "expecting-transfer";
309
326
  /**
310
327
  * The source Worker for the two-phase cross-Worker transfer.
311
328
  */
312
329
  transferFrom: string;
313
- } & DurableObjectStorageOptions;
314
- type DurableObjectCreatedExport = DurableObjectCreatedExportOptions & {
330
+ } & DurableObjectStorageOptions<TContainer>;
331
+ type DurableObjectCreatedExport<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = DurableObjectCreatedExportOptions<TContainer> & {
315
332
  type: "durable-object";
316
333
  };
317
334
  interface DurableObjectDeletedExport extends DurableObjectDeletedExportOptions {
@@ -323,7 +340,7 @@ interface DurableObjectRenamedExport extends DurableObjectRenamedExportOptions {
323
340
  interface DurableObjectTransferredExport extends DurableObjectTransferredExportOptions {
324
341
  type: "durable-object";
325
342
  }
326
- type DurableObjectExpectingTransferExport = DurableObjectExpectingTransferExportOptions & {
343
+ type DurableObjectExpectingTransferExport<TContainer extends ContainerConfigExport | undefined = ContainerConfigExport | undefined> = DurableObjectExpectingTransferExportOptions<TContainer> & {
327
344
  type: "durable-object";
328
345
  };
329
346
  type DurableObjectExportOptions = DurableObjectCreatedExportOptions | DurableObjectDeletedExportOptions | DurableObjectRenamedExportOptions | DurableObjectTransferredExportOptions | DurableObjectExpectingTransferExportOptions;
@@ -350,7 +367,7 @@ interface Exports {
350
367
  *
351
368
  * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
352
369
  */
353
- durableObject(options: DurableObjectCreatedExportOptions): DurableObjectCreatedExport;
370
+ durableObject<TContainer extends ContainerConfigExport | undefined = undefined>(options: DurableObjectCreatedExportOptions<TContainer>): DurableObjectCreatedExport<TContainer>;
354
371
  /**
355
372
  * Retire a provisioned Durable Object namespace whose class has been removed from code.
356
373
  */
@@ -367,7 +384,7 @@ interface Exports {
367
384
  * Prepare to receive cross-Worker Durable Object transfer.
368
385
  * The source Worker must follow up with a deployment containing a `transferred` export to commit the transfer.
369
386
  */
370
- durableObject(options: DurableObjectExpectingTransferExportOptions): DurableObjectExpectingTransferExport;
387
+ durableObject<TContainer extends ContainerConfigExport | undefined = undefined>(options: DurableObjectExpectingTransferExportOptions<TContainer>): DurableObjectExpectingTransferExport<TContainer>;
371
388
  durableObject(options: DurableObjectExportOptions): DurableObjectExports;
372
389
  /** Declares a WorkerEntrypoint export defined by this Worker. */
373
390
  worker(options?: WorkerEntrypointExportOptions): WorkerEntrypointExport;
@@ -377,12 +394,17 @@ interface Exports {
377
394
  *
378
395
  * @example
379
396
  * ```typescript
380
- * import { defineWorker, exports } from "@cloudflare/config";
397
+ * import { defineContainer, defineWorker, exports } from "@cloudflare/config";
398
+ *
399
+ * const myContainer = defineContainer({
400
+ * name: "my-container",
401
+ * image: { dockerfile: "./Dockerfile" },
402
+ * });
381
403
  *
382
404
  * export default defineWorker({
383
405
  * exports: {
384
406
  * MyDurableObject: exports.durableObject({ storage: "sqlite" }),
385
- * MyContainerDO: exports.durableObject({ storage: "sqlite", container: "my-container" }),
407
+ * MyContainerDO: exports.durableObject({ storage: "sqlite", container: myContainer }),
386
408
  * OldClass: exports.durableObject({ state: "deleted" }),
387
409
  * OldName: exports.durableObject({ state: "renamed", renamedTo: "NewName" }),
388
410
  * Outgoing: exports.durableObject({ state: "transferred", transferredTo: "target-worker" }),
@@ -561,7 +583,7 @@ declare const triggers: Triggers;
561
583
  /**
562
584
  * Union of all binding definitions accepted in `env`.
563
585
  */
564
- 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;
586
+ 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;
565
587
  /**
566
588
  * Union of all trigger definitions accepted in `triggers`.
567
589
  */
@@ -572,6 +594,181 @@ type Trigger = ConnectTrigger | EmailTrigger | FetchTrigger | QueueConsumerTrigg
572
594
  * classes and tombstone lifecycle operations.
573
595
  */
574
596
  type Export = DurableObjectCreatedExport | DurableObjectDeletedExport | DurableObjectRenamedExport | DurableObjectTransferredExport | DurableObjectExpectingTransferExport | WorkerEntrypointExport;
597
+ /** An image source accepted in an authored Container configuration. */
598
+ type ContainerImage = {
599
+ /** The path to a Dockerfile. */
600
+ dockerfile: string;
601
+ /**
602
+ * Build context of the application.
603
+ *
604
+ * @default The directory containing `dockerfile`.
605
+ */
606
+ buildContext?: string;
607
+ /** Image variables available to the image at build time only. */
608
+ buildVars?: Record<string, string>;
609
+ } | {
610
+ /**
611
+ * Reference to an existing image.
612
+ *
613
+ * For supported registries, refer to
614
+ * https://developers.cloudflare.com/containers/guides/image-management/#use-pre-built-container-images
615
+ */
616
+ reference: string;
617
+ };
618
+ /** Fields shared by all Container application configurations. */
619
+ interface BaseContainerConfig {
620
+ /**
621
+ * Discriminates this config as a Container config.
622
+ *
623
+ * Injected automatically by `defineContainer`; only needs to be written by
624
+ * hand when authoring a raw config object without the helper.
625
+ */
626
+ type: "container";
627
+ /**
628
+ * Name of the application.
629
+ *
630
+ * This is also the identifier used to reference the Container from a Durable
631
+ * Object's `exports` entry via its `container` field.
632
+ */
633
+ name: string;
634
+ /** Configures observability for Container instances. */
635
+ observability?: {
636
+ /** Whether observability is enabled. */
637
+ enabled?: boolean;
638
+ logs?: {
639
+ /** Whether log collection is enabled. */
640
+ enabled?: boolean;
641
+ };
642
+ } & ({
643
+ /** Percentage of Container instances targeted for observability. */
644
+ targetInstancePercentage?: number;
645
+ targetInstanceCount?: never;
646
+ } | {
647
+ targetInstancePercentage?: never;
648
+ /** Number of Container instances targeted for observability. */
649
+ targetInstanceCount?: number;
650
+ });
651
+ /**
652
+ * Passed through without client-side validation or transformation.
653
+ *
654
+ * @hidden
655
+ */
656
+ unsafe?: Record<string, unknown>;
657
+ }
658
+ /** A Container application managed with a standard scheduling policy. */
659
+ interface StandardContainerConfig extends BaseContainerConfig {
660
+ /** The image to build or deploy. */
661
+ image: ContainerImage;
662
+ /**
663
+ * Maximum number of application instances.
664
+ *
665
+ * @default 20
666
+ */
667
+ maxInstances?: number;
668
+ /**
669
+ * The instance type to be used for the Container.
670
+ * Select from one of the following named instance types:
671
+ *
672
+ * - lite: 1/16 vCPU, 256 MiB memory, and 2 GB disk
673
+ * - basic: 1/4 vCPU, 1 GiB memory, and 4 GB disk
674
+ * - standard-1: 1/2 vCPU, 4 GiB memory, and 8 GB disk
675
+ * - standard-2: 1 vCPU, 6 GiB memory, and 12 GB disk
676
+ * - standard-3: 2 vCPU, 8 GiB memory, and 16 GB disk
677
+ * - standard-4: 4 vCPU, 12 GiB memory, and 20 GB disk
678
+ *
679
+ * Customers on an enterprise plan have the additional option to set custom
680
+ * limits.
681
+ *
682
+ * @default "lite"
683
+ */
684
+ instanceType?: "basic" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | {
685
+ /** @default 0.0625 (1/16 vCPU) */
686
+ vcpu?: number;
687
+ /** @default 256 MiB */
688
+ memoryMib?: number;
689
+ /** @default 2 GB */
690
+ diskMb?: number;
691
+ };
692
+ /**
693
+ * The scheduling policy of the application.
694
+ *
695
+ * @default "default"
696
+ */
697
+ schedulingPolicy?: "default" | "regional";
698
+ ssh?: {
699
+ /**
700
+ * If enabled, users with write access to the Container application can
701
+ * connect to it over SSH.
702
+ *
703
+ * @default false
704
+ */
705
+ enabled: boolean;
706
+ /**
707
+ * Port that the SSH service is running on.
708
+ *
709
+ * @default 22
710
+ */
711
+ port?: number;
712
+ };
713
+ /** SSH public keys to put in the Container's authorized_keys file. */
714
+ authorizedKeys?: Array<{
715
+ name: string;
716
+ publicKey: string;
717
+ }>;
718
+ /** Scheduling constraints for Container placement. */
719
+ constraints?: {
720
+ /** Limit Container placement to specific geographic regions. */
721
+ regions?: Array<"ENAM" | "WNAM" | "EEUR" | "WEUR" | "APAC" | "SAM" | "ME" | "OC" | "AFR">;
722
+ /** Restrict Containers to compliance boundaries. */
723
+ jurisdiction?: "eu" | "fedramp";
724
+ };
725
+ rollout?: {
726
+ /**
727
+ * How a rollout should be created. It supports the following modes:
728
+ *
729
+ * - full-auto: The Container application will be rolled out fully
730
+ * automatically.
731
+ * - none: The Container application will not have a rollout or update.
732
+ * - full-manual: The Container application will be rolled out by manually
733
+ * progressing through the rollout steps.
734
+ *
735
+ * @default "full-auto"
736
+ * @hidden
737
+ */
738
+ kind?: "full-auto" | "none" | "full-manual";
739
+ /**
740
+ * Configures what percentage of instances should be updated at each step of
741
+ * a rollout. You can specify this as a single number or an array of numbers.
742
+ *
743
+ * If this is a single number, each step will progress by that percentage.
744
+ * The options are 5, 10, 20, 25, 50, or 100.
745
+ *
746
+ * If this is an array, each step specifies the cumulative rollout progress.
747
+ * The final step must be 100.
748
+ *
749
+ * @default [10, 100]
750
+ */
751
+ stepPercentage?: number | number[];
752
+ /**
753
+ * Configures the grace period, in seconds, for active instances before they
754
+ * are shut down during a rollout.
755
+ *
756
+ * @default 0
757
+ */
758
+ activeGracePeriod?: number;
759
+ };
760
+ }
761
+ /** A Container application managed by a Durable Object. */
762
+ interface DurableObjectContainerConfig extends BaseContainerConfig {
763
+ schedulingPolicy: "durable-object";
764
+ /** Named images that the Durable Object can start. */
765
+ images?: Record<string, ContainerImage>;
766
+ }
767
+ /**
768
+ * Container application configuration. This is the input shape passed to
769
+ * `defineContainer` and is validated at runtime by `InputContainerSchema`.
770
+ */
771
+ type ContainerConfig = DurableObjectContainerConfig | StandardContainerConfig;
575
772
  /**
576
773
  * Worker configuration. This is the input shape passed to
577
774
  * [`defineWorker`](https://developers.cloudflare.com/workers/wrangler/configuration/).
@@ -1364,17 +1561,6 @@ interface VpcServiceBindingOptions {
1364
1561
  interface VpcServiceBinding extends VpcServiceBindingOptions {
1365
1562
  type: "vpc-service";
1366
1563
  }
1367
- interface WebSearchBindingOptions {
1368
- /** Options that only apply during local development. */
1369
- dev?: BindingDevOptions;
1370
- }
1371
- /**
1372
- * Cloudflare Web Search binding. There is exactly one shared web corpus, so
1373
- * the binding is zero-config — only the variable name is required.
1374
- */
1375
- interface WebSearchBinding extends WebSearchBindingOptions {
1376
- type: "web-search";
1377
- }
1378
1564
  interface WorkerBindingOptions<TWorker$1 extends WorkerReference = WorkerReference, TExportName$1 extends WorkerEntrypointExportName<TWorker$1> | undefined = WorkerEntrypointExportName<TWorker$1> | undefined> {
1379
1565
  /** The name or config of the bound Worker. */
1380
1566
  worker: TWorker$1;
@@ -1568,11 +1754,6 @@ interface Bindings {
1568
1754
  vpcNetwork(options: VpcNetworkBindingOptions): VpcNetworkBinding;
1569
1755
  /** Binding to a VPC service. */
1570
1756
  vpcService(options: VpcServiceBindingOptions): VpcServiceBinding;
1571
- /**
1572
- * Cloudflare Web Search binding. There is exactly one shared web corpus, so
1573
- * the binding is zero-config — only the variable name is required.
1574
- */
1575
- webSearch(options?: WebSearchBindingOptions): WebSearchBinding;
1576
1757
  /**
1577
1758
  * Service binding (Worker-to-Worker). `worker` is the name or config of the
1578
1759
  * bound Worker; `exportName` selects a named `WorkerEntrypoint` export
@@ -1608,5 +1789,5 @@ declare const defineSettings: <const TInput extends ConfigInput<SettingsConfigIn
1608
1789
  } ? ConfigWithType<TInput, "settings"> : never;
1609
1790
  //#endregion
1610
1791
  //#endregion
1611
- 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$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, WebSearchBinding, WorkerBinding, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, defineSettings, defineWorker, exports, triggers };
1792
+ 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 };
1612
1793
  //# sourceMappingURL=experimental-config.d.mts.map