wrangler 3.92.0 → 3.94.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.
@@ -92,14 +92,23 @@ declare const AssetConfigSchema: z.ZodObject<{
92
92
 
93
93
  declare type Assets = {
94
94
  /** Absolute path to assets directory */
95
- directory: string;
95
+ directory?: string;
96
+ /** Name of `env` binding property in the User Worker. */
96
97
  binding?: string;
98
+ /** How to handle HTML requests. */
97
99
  html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
100
+ /** How to handle requests that do not match an asset. */
98
101
  not_found_handling?: "single-page-application" | "404-page" | "none";
102
+ /**
103
+ * If true, then respond to requests that match an asset with that asset directly.
104
+ * If false, route every request to the User Worker, whether or not it matches an asset.
105
+ * */
99
106
  experimental_serve_directly?: boolean;
100
107
  };
101
108
 
102
- declare type AssetsOptions = Pick<Assets, "directory" | "binding"> & {
109
+ declare type AssetsOptions = {
110
+ directory: string;
111
+ binding?: string;
103
112
  routingConfig: RoutingConfig;
104
113
  assetConfig: AssetConfig;
105
114
  };
@@ -453,7 +462,7 @@ declare type CfCapnp = {
453
462
 
454
463
  declare interface CfD1Database {
455
464
  binding: string;
456
- database_id?: string;
465
+ database_id?: string | typeof INHERIT_SYMBOL;
457
466
  database_name?: string;
458
467
  preview_database_id?: string;
459
468
  database_internal_env?: string;
@@ -492,7 +501,7 @@ declare interface CfHyperdrive {
492
501
  */
493
502
  declare interface CfKvNamespace {
494
503
  binding: string;
495
- id?: string;
504
+ id?: string | typeof INHERIT_SYMBOL;
496
505
  }
497
506
 
498
507
  declare interface CfLogfwdrBinding {
@@ -568,7 +577,7 @@ declare interface CfQueue {
568
577
 
569
578
  declare interface CfR2Bucket {
570
579
  binding: string;
571
- bucket_name?: string;
580
+ bucket_name?: string | typeof INHERIT_SYMBOL;
572
581
  jurisdiction?: string;
573
582
  }
574
583
 
@@ -763,36 +772,6 @@ declare type CloudchamberConfig = {
763
772
  ipv4?: boolean;
764
773
  };
765
774
 
766
- declare interface ComputedConfigFields {
767
- /** Path to the configuration file (e.g. wrangler.toml/json), if one was provided. */
768
- configPath: string | undefined;
769
- /** A worker's directory. Usually where the Wrangler configuration file is located */
770
- projectRoot: string;
771
- }
772
-
773
- /**
774
- * This is the static type definition for the configuration object.
775
- *
776
- * It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,
777
- * and optionally augment with arguments passed directly to wrangler.
778
- *
779
- * For more information about the configuration object, see the
780
- * documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
781
- *
782
- * Notes:
783
- *
784
- * - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
785
- * in the top level config and should not appear in any environments.
786
- * - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
787
- * - All top level fields in config and environments are optional in the Wrangler configuration file.
788
- *
789
- * Legend for the annotations:
790
- *
791
- * - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
792
- * - `@todo`: there's more work to be done (with details attached).
793
- */
794
- declare type Config = ComputedConfigFields & ConfigFields<DevConfig> & PagesConfigFields & Environment;
795
-
796
775
  declare class ConfigController extends Controller<ConfigControllerEventMap> {
797
776
  #private;
798
777
  latestInput?: StartDevWorkerInput;
@@ -808,6 +787,7 @@ declare type ConfigControllerEventMap = ControllerEventMap & {
808
787
  };
809
788
 
810
789
  declare interface ConfigFields<Dev extends RawDevConfig> {
790
+ configPath: string | undefined;
811
791
  /**
812
792
  * A boolean to enable "legacy" style wrangler environments (from Wrangler v1).
813
793
  * These have been superseded by Services, but there may be projects that won't
@@ -942,6 +922,32 @@ url: string | URL_2 | UrlObject,
942
922
  options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.ConnectOptions, 'origin' | 'path'>
943
923
  ): Promise<Dispatcher.ConnectData>;
944
924
 
925
+ /**
926
+ * Configuration for a container application
927
+ */
928
+ declare type ContainerApp = {
929
+ name: string;
930
+ instances: number;
931
+ scheduling_policy?: "regional" | "moon";
932
+ configuration: {
933
+ image: string;
934
+ labels?: {
935
+ name: string;
936
+ value: string;
937
+ }[];
938
+ secrets?: {
939
+ name: string;
940
+ type: "env";
941
+ secret: string;
942
+ }[];
943
+ };
944
+ constraints?: {
945
+ regions?: string[];
946
+ cities?: string[];
947
+ tier?: number;
948
+ };
949
+ };
950
+
945
951
  declare abstract class Controller<EventMap extends ControllerEventMap = ControllerEventMap> extends TypedEventEmitterImpl<EventMap> {
946
952
  emitErrorEvent(data: ErrorEvent): void;
947
953
  }
@@ -1054,6 +1060,30 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1054
1060
  } | undefined;
1055
1061
  }>;
1056
1062
 
1063
+ declare interface DeprecatedConfigFields {
1064
+ /**
1065
+ * The project "type". A holdover from Wrangler v1.x.
1066
+ * Valid values were "webpack", "javascript", and "rust".
1067
+ *
1068
+ * @deprecated DO NOT USE THIS. Most common features now work out of the box with wrangler, including modules, jsx, typescript, etc. If you need anything more, use a custom build.
1069
+ * @breaking
1070
+ */
1071
+ type?: "webpack" | "javascript" | "rust";
1072
+ /**
1073
+ * Path to the webpack config to use when building your worker.
1074
+ * A holdover from Wrangler v1.x, used with `type: "webpack"`.
1075
+ *
1076
+ * @deprecated DO NOT USE THIS. Most common features now work out of the box with wrangler, including modules, jsx, typescript, etc. If you need anything more, use a custom build.
1077
+ * @breaking
1078
+ */
1079
+ webpack_config?: string;
1080
+ /**
1081
+ * Configuration only used by a standalone use of the miniflare binary.
1082
+ * @deprecated
1083
+ */
1084
+ miniflare?: unknown;
1085
+ }
1086
+
1057
1087
  /**
1058
1088
  * Deprecated upload configuration.
1059
1089
  */
@@ -1478,6 +1508,8 @@ declare interface EnablePagesAssetsServiceBindingOptions {
1478
1508
  declare type Entry = {
1479
1509
  /** A worker's entrypoint */
1480
1510
  file: string;
1511
+ /** A worker's directory. Usually where the Wrangler configuration file is located */
1512
+ projectRoot: string;
1481
1513
  /** Is this a module worker or a service worker? */
1482
1514
  format: CfScriptFormat;
1483
1515
  /** The directory that contains all of a `--no-bundle` worker's modules. Usually `${directory}/src`. Defaults to path.dirname(file) */
@@ -1499,6 +1531,39 @@ declare type Entry = {
1499
1531
  declare interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
1500
1532
  }
1501
1533
 
1534
+ /**
1535
+ * The environment configuration properties that have been deprecated.
1536
+ */
1537
+ declare interface EnvironmentDeprecated {
1538
+ /**
1539
+ * The zone ID of the zone you want to deploy to. You can find this
1540
+ * in your domain page on the dashboard.
1541
+ *
1542
+ * @deprecated This is unnecessary since we can deduce this from routes directly.
1543
+ */
1544
+ zone_id?: string;
1545
+ /**
1546
+ * Legacy way of defining KVNamespaces that is no longer supported.
1547
+ *
1548
+ * @deprecated DO NOT USE. This was a legacy bug from Wrangler v1, that we do not want to support.
1549
+ */
1550
+ "kv-namespaces"?: string;
1551
+ /**
1552
+ * A list of services that your Worker should be bound to.
1553
+ *
1554
+ * @default `[]`
1555
+ * @deprecated DO NOT USE. We'd added this to test the new service binding system, but the proper way to test experimental features is to use `unsafe.bindings` configuration.
1556
+ */
1557
+ experimental_services?: {
1558
+ /** The binding name used to refer to the Service */
1559
+ name: string;
1560
+ /** The name of the Service being bound */
1561
+ service: string;
1562
+ /** The Service's environment */
1563
+ environment: string;
1564
+ }[];
1565
+ }
1566
+
1502
1567
  /**
1503
1568
  * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
1504
1569
  * that can be inherited (and overridden) from the top-level environment.
@@ -1785,6 +1850,24 @@ declare interface EnvironmentInheritable {
1785
1850
  observability: Observability | undefined;
1786
1851
  }
1787
1852
 
1853
+ declare interface EnvironmentMap {
1854
+ /**
1855
+ * The `env` section defines overrides for the configuration for different environments.
1856
+ *
1857
+ * All environment fields can be specified at the top level of the config indicating the default environment settings.
1858
+ *
1859
+ * - Some fields are inherited and overridable in each environment.
1860
+ * - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.
1861
+ *
1862
+ * For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
1863
+ *
1864
+ * @default {}
1865
+ */
1866
+ env?: {
1867
+ [envName: string]: Unstable_RawEnvironment;
1868
+ };
1869
+ }
1870
+
1788
1871
  /**
1789
1872
  * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
1790
1873
  * that cannot be inherited from the top-level environment, and must be defined specifically.
@@ -1848,6 +1931,21 @@ declare interface EnvironmentNonInheritable {
1848
1931
  * @nonInheritable
1849
1932
  */
1850
1933
  cloudchamber: CloudchamberConfig;
1934
+ /**
1935
+ * Container related configuration
1936
+ */
1937
+ containers: {
1938
+ /**
1939
+ * Container app configuration
1940
+ *
1941
+ * NOTE: This field is not automatically inherited from the top level environment,
1942
+ * and so must be specified in every named environment.
1943
+ *
1944
+ * @default `{}`
1945
+ * @nonInheritable
1946
+ */
1947
+ app: ContainerApp[];
1948
+ };
1851
1949
  /**
1852
1950
  * These specify any Workers KV Namespaces you want to
1853
1951
  * access from inside your Worker.
@@ -2657,6 +2755,11 @@ declare type HttpTerminator = {
2657
2755
  */
2658
2756
  declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
2659
2757
 
2758
+ /**
2759
+ * A symbol to inherit a binding from the deployed worker.
2760
+ */
2761
+ declare const INHERIT_SYMBOL: unique symbol;
2762
+
2660
2763
  declare type InspectorProxyWorkerIncomingWebSocketMessage = {
2661
2764
  type: ReloadStartEvent["type"];
2662
2765
  } | {
@@ -2937,13 +3040,23 @@ declare interface MultiCacheQueryOptions extends CacheQueryOptions {
2937
3040
 
2938
3041
  declare type NameOmit<T> = Omit<T, "name">;
2939
3042
 
3043
+ declare type NormalizeAndValidateConfigArgs = {
3044
+ name?: string;
3045
+ env?: string;
3046
+ "legacy-env"?: boolean;
3047
+ "dispatch-namespace"?: string;
3048
+ remote?: boolean;
3049
+ localProtocol?: string;
3050
+ upstreamProtocol?: string;
3051
+ };
3052
+
2940
3053
  declare interface Observability {
2941
3054
  /** If observability is enabled for this Worker */
2942
- enabled: boolean;
3055
+ enabled?: boolean;
2943
3056
  /** The sampling rate */
2944
3057
  head_sampling_rate?: number;
2945
3058
  logs?: {
2946
- enabled: boolean;
3059
+ enabled?: boolean;
2947
3060
  /** The sampling rate */
2948
3061
  head_sampling_rate?: number;
2949
3062
  /** Set to false to disable invocation logs */
@@ -25574,10 +25687,15 @@ declare type ProxyWorkerOutgoingRequestBody = {
25574
25687
  args: Parameters<typeof console.debug>;
25575
25688
  };
25576
25689
 
25577
- declare type QueueConsumer = NonNullable<Config["queues"]["consumers"]>[number];
25690
+ declare type QueueConsumer = NonNullable<Unstable_Config["queues"]["consumers"]>[number];
25578
25691
 
25579
25692
  declare type RawDevConfig = Partial<DevConfig>;
25580
25693
 
25694
+ declare type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {
25695
+ config?: string;
25696
+ script?: string;
25697
+ };
25698
+
25581
25699
  declare type ReadyEvent = {
25582
25700
  type: "ready";
25583
25701
  proxyWorker: Miniflare;
@@ -26003,7 +26121,7 @@ declare interface StartDevWorkerInput {
26003
26121
  jsxFactory?: string;
26004
26122
  jsxFragment?: string;
26005
26123
  tsconfig?: string;
26006
- nodejsCompatMode?: Hook<NodeJSCompatMode, [Config]>;
26124
+ nodejsCompatMode?: Hook<NodeJSCompatMode, [Unstable_Config]>;
26007
26125
  moduleRoot?: string;
26008
26126
  };
26009
26127
  /** Options applying to the worker's development preview environment. */
@@ -26017,7 +26135,7 @@ declare interface StartDevWorkerInput {
26017
26135
  /** Whether the worker runs on the edge or locally. */
26018
26136
  remote?: boolean;
26019
26137
  /** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
26020
- auth?: AsyncHook<CfAccount, [Pick<Config, "account_id">]>;
26138
+ auth?: AsyncHook<CfAccount, [Pick<Unstable_Config, "account_id">]>;
26021
26139
  /** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. */
26022
26140
  persist?: string;
26023
26141
  /** Controls which logs are logged 🤙. */
@@ -26052,8 +26170,8 @@ declare interface StartDevWorkerInput {
26052
26170
  multiworkerPrimary?: boolean;
26053
26171
  };
26054
26172
  legacy?: {
26055
- site?: Hook<Config["site"], [Config]>;
26056
- legacyAssets?: Hook<Config["legacy_assets"], [Config]>;
26173
+ site?: Hook<Unstable_Config["site"], [Unstable_Config]>;
26174
+ legacyAssets?: Hook<Unstable_Config["legacy_assets"], [Unstable_Config]>;
26057
26175
  enableServiceEnvironments?: boolean;
26058
26176
  };
26059
26177
  unsafe?: Omit<CfUnsafe, "bindings">;
@@ -26074,8 +26192,8 @@ declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
26074
26192
  processEntrypoint: boolean;
26075
26193
  };
26076
26194
  legacy: StartDevWorkerInput["legacy"] & {
26077
- legacyAssets?: Config["legacy_assets"];
26078
- site?: Config["site"];
26195
+ legacyAssets?: Unstable_Config["legacy_assets"];
26196
+ site?: Unstable_Config["site"];
26079
26197
  };
26080
26198
  dev: StartDevWorkerInput["dev"] & {
26081
26199
  persist: string;
@@ -26255,10 +26373,39 @@ declare namespace undici {
26255
26373
  }
26256
26374
  }
26257
26375
 
26376
+ export declare interface Unstable_ASSETSBindingsOptions {
26377
+ log: Logger;
26378
+ proxyPort?: number;
26379
+ directory?: string;
26380
+ }
26381
+
26382
+ /**
26383
+ * This is the static type definition for the configuration object.
26384
+ *
26385
+ * It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,
26386
+ * and optionally augment with arguments passed directly to wrangler.
26387
+ *
26388
+ * For more information about the configuration object, see the
26389
+ * documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
26390
+ *
26391
+ * Notes:
26392
+ *
26393
+ * - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
26394
+ * in the top level config and should not appear in any environments.
26395
+ * - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
26396
+ * - All top level fields in config and environments are optional in the Wrangler configuration file.
26397
+ *
26398
+ * Legend for the annotations:
26399
+ *
26400
+ * - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
26401
+ * - `@todo`: there's more work to be done (with details attached).
26402
+ */
26403
+ export declare type Unstable_Config = ConfigFields<DevConfig> & PagesConfigFields & Environment;
26404
+
26258
26405
  /**
26259
26406
  * unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
26260
26407
  */
26261
- export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
26408
+ export declare function unstable_dev(script: string, options?: Unstable_DevOptions, apiOptions?: unknown): Promise<Unstable_DevWorker>;
26262
26409
 
26263
26410
  export declare class unstable_DevEnv extends EventEmitter_2 {
26264
26411
  config: ConfigController;
@@ -26276,37 +26423,7 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
26276
26423
  emitErrorEvent(ev: ErrorEvent): void;
26277
26424
  }
26278
26425
 
26279
- export declare const unstable_generateASSETSBinding: (opts: UnstableASSETSBindingsOptions) => (request: Request_3) => Promise<Response_3>;
26280
-
26281
- export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string): {
26282
- workerOptions: SourcelessWorkerOptions;
26283
- define: Record<string, string>;
26284
- main?: string;
26285
- };
26286
-
26287
- export declare const unstable_pages: {
26288
- deploy: typeof deploy;
26289
- };
26290
-
26291
- /**
26292
- * Split an SQLQuery into an array of statements
26293
- */
26294
- export declare function unstable_splitSqlQuery(sql: string): string[];
26295
-
26296
- export declare function unstable_startWorker(options: StartDevWorkerInput): Promise<Worker>;
26297
-
26298
- export declare const unstable_startWorkerRegistryServer: (port: number) => Promise<{
26299
- server: Server<IncomingMessage, ServerResponse>;
26300
- terminator: HttpTerminator;
26301
- }>;
26302
-
26303
- export declare interface UnstableASSETSBindingsOptions {
26304
- log: Logger;
26305
- proxyPort?: number;
26306
- directory?: string;
26307
- }
26308
-
26309
- export declare interface UnstableDevOptions {
26426
+ export declare interface Unstable_DevOptions {
26310
26427
  config?: string;
26311
26428
  env?: string;
26312
26429
  ip?: string;
@@ -26381,7 +26498,7 @@ export declare interface UnstableDevOptions {
26381
26498
  };
26382
26499
  }
26383
26500
 
26384
- export declare interface UnstableDevWorker {
26501
+ export declare interface Unstable_DevWorker {
26385
26502
  port: number;
26386
26503
  address: string;
26387
26504
  stop: () => Promise<void>;
@@ -26389,6 +26506,53 @@ export declare interface UnstableDevWorker {
26389
26506
  waitUntilExit: () => Promise<void>;
26390
26507
  }
26391
26508
 
26509
+ export declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request_3) => Promise<Response_3>;
26510
+
26511
+ export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string): Unstable_MiniflareWorkerOptions;
26512
+
26513
+ export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config): Unstable_MiniflareWorkerOptions;
26514
+
26515
+ export declare interface Unstable_MiniflareWorkerOptions {
26516
+ workerOptions: SourcelessWorkerOptions;
26517
+ define: Record<string, string>;
26518
+ main?: string;
26519
+ }
26520
+
26521
+ export declare const unstable_pages: {
26522
+ deploy: typeof deploy;
26523
+ };
26524
+
26525
+ export declare type Unstable_RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & Unstable_RawEnvironment & DeprecatedConfigFields & EnvironmentMap & {
26526
+ $schema?: string;
26527
+ };
26528
+
26529
+ /**
26530
+ * The raw environment configuration that we read from the config file.
26531
+ *
26532
+ * All the properties are optional, and will be replaced with defaults in the configuration that
26533
+ * is used in the rest of the codebase.
26534
+ */
26535
+ export declare type Unstable_RawEnvironment = Partial<Environment> & EnvironmentDeprecated;
26536
+
26537
+ /**
26538
+ * Get the Wrangler configuration; read it from the give `configPath` if available.
26539
+ */
26540
+ export declare function unstable_readConfig(args: ReadConfigCommandArgs, options?: {
26541
+ hideWarnings?: boolean;
26542
+ }): Unstable_Config;
26543
+
26544
+ /**
26545
+ * Split an SQLQuery into an array of statements
26546
+ */
26547
+ export declare function unstable_splitSqlQuery(sql: string): string[];
26548
+
26549
+ export declare function unstable_startWorker(options: StartDevWorkerInput): Promise<Worker>;
26550
+
26551
+ export declare const unstable_startWorkerRegistryServer: (port: number) => Promise<{
26552
+ server: Server<IncomingMessage, ServerResponse>;
26553
+ terminator: HttpTerminator;
26554
+ }>;
26555
+
26392
26556
  /** Upgrade to a different protocol. */
26393
26557
  declare function upgrade(
26394
26558
  url: string | URL_2 | UrlObject,