wrangler 3.90.0 → 3.92.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.
@@ -79,12 +79,15 @@ declare type AssetConfig = z.infer<typeof AssetConfigSchema>;
79
79
  declare const AssetConfigSchema: z.ZodObject<{
80
80
  html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
81
81
  not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
82
+ serve_directly: z.ZodOptional<z.ZodBoolean>;
82
83
  }, "strip", z.ZodTypeAny, {
83
84
  html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
84
85
  not_found_handling?: "none" | "single-page-application" | "404-page";
86
+ serve_directly?: boolean;
85
87
  }, {
86
88
  html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
87
89
  not_found_handling?: "none" | "single-page-application" | "404-page";
90
+ serve_directly?: boolean;
88
91
  }>;
89
92
 
90
93
  declare type Assets = {
@@ -93,6 +96,7 @@ declare type Assets = {
93
96
  binding?: string;
94
97
  html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
95
98
  not_found_handling?: "single-page-application" | "404-page" | "none";
99
+ experimental_serve_directly?: boolean;
96
100
  };
97
101
 
98
102
  declare type AssetsOptions = Pick<Assets, "directory" | "binding"> & {
@@ -449,8 +453,8 @@ declare type CfCapnp = {
449
453
 
450
454
  declare interface CfD1Database {
451
455
  binding: string;
452
- database_id: string;
453
- database_name: string;
456
+ database_id?: string;
457
+ database_name?: string;
454
458
  preview_database_id?: string;
455
459
  database_internal_env?: string;
456
460
  migrations_table?: string;
@@ -488,7 +492,7 @@ declare interface CfHyperdrive {
488
492
  */
489
493
  declare interface CfKvNamespace {
490
494
  binding: string;
491
- id: string;
495
+ id?: string;
492
496
  }
493
497
 
494
498
  declare interface CfLogfwdrBinding {
@@ -564,7 +568,7 @@ declare interface CfQueue {
564
568
 
565
569
  declare interface CfR2Bucket {
566
570
  binding: string;
567
- bucket_name: string;
571
+ bucket_name?: string;
568
572
  jurisdiction?: string;
569
573
  }
570
574
 
@@ -759,10 +763,17 @@ declare type CloudchamberConfig = {
759
763
  ipv4?: boolean;
760
764
  };
761
765
 
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
+
762
773
  /**
763
774
  * This is the static type definition for the configuration object.
764
775
  *
765
- * It reflects a normalized and validated version of the configuration that you can write in wrangler.toml,
776
+ * It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,
766
777
  * and optionally augment with arguments passed directly to wrangler.
767
778
  *
768
779
  * For more information about the configuration object, see the
@@ -773,14 +784,14 @@ declare type CloudchamberConfig = {
773
784
  * - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
774
785
  * in the top level config and should not appear in any environments.
775
786
  * - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
776
- * - All top level fields in config and environments are optional in the wrangler.toml file.
787
+ * - All top level fields in config and environments are optional in the Wrangler configuration file.
777
788
  *
778
789
  * Legend for the annotations:
779
790
  *
780
791
  * - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
781
792
  * - `@todo`: there's more work to be done (with details attached).
782
793
  */
783
- declare type Config = ConfigFields<DevConfig> & PagesConfigFields & Environment;
794
+ declare type Config = ComputedConfigFields & ConfigFields<DevConfig> & PagesConfigFields & Environment;
784
795
 
785
796
  declare class ConfigController extends Controller<ConfigControllerEventMap> {
786
797
  #private;
@@ -797,7 +808,6 @@ declare type ConfigControllerEventMap = ControllerEventMap & {
797
808
  };
798
809
 
799
810
  declare interface ConfigFields<Dev extends RawDevConfig> {
800
- configPath: string | undefined;
801
811
  /**
802
812
  * A boolean to enable "legacy" style wrangler environments (from Wrangler v1).
803
813
  * These have been superseded by Services, but there may be projects that won't
@@ -826,7 +836,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
826
836
  /**
827
837
  * The directory containing your static assets.
828
838
  *
829
- * It must be a path relative to your wrangler.toml file.
839
+ * It must be a path relative to your Wrangler configuration file.
830
840
  * Example: bucket = "./public"
831
841
  *
832
842
  * If there is a `site` field then it must contain this `bucket` field.
@@ -904,7 +914,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
904
914
  [key: string]: string;
905
915
  } | undefined;
906
916
  /**
907
- * By default, wrangler.toml is the source of truth for your environment configuration, like a terraform file.
917
+ * By default, the Wrangler configuration file is the source of truth for your environment configuration, like a terraform file.
908
918
  *
909
919
  * If you change your vars in the dashboard, wrangler *will* override/delete them on its next deploy.
910
920
  *
@@ -1006,14 +1016,14 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1006
1016
  type: string;
1007
1017
  };
1008
1018
  latest_stage: {
1019
+ status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
1009
1020
  name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
1010
- status: "active" | "idle" | "success" | "canceled" | "failure" | "skipped";
1011
1021
  started_on: string | null;
1012
1022
  ended_on: string | null;
1013
1023
  };
1014
1024
  stages: {
1025
+ status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
1015
1026
  name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
1016
- status: "active" | "idle" | "success" | "canceled" | "failure" | "skipped";
1017
1027
  started_on: string | null;
1018
1028
  ended_on: string | null;
1019
1029
  }[];
@@ -1021,8 +1031,8 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1021
1031
  modified_on: string;
1022
1032
  short_id: string;
1023
1033
  build_image_major_version: number;
1034
+ kv_namespaces?: any;
1024
1035
  source?: {
1025
- type: "github" | "gitlab";
1026
1036
  config: {
1027
1037
  owner: string;
1028
1038
  repo_name: string;
@@ -1034,8 +1044,8 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1034
1044
  preview_branch_includes?: string[] | undefined;
1035
1045
  preview_branch_excludes?: string[] | undefined;
1036
1046
  };
1047
+ type: "github" | "gitlab";
1037
1048
  } | undefined;
1038
- kv_namespaces?: any;
1039
1049
  env_vars?: any;
1040
1050
  durable_object_namespaces?: any;
1041
1051
  is_skipped?: boolean | undefined;
@@ -1056,9 +1066,9 @@ declare interface DeprecatedUpload {
1056
1066
  format?: "modules" | "service-worker";
1057
1067
  /**
1058
1068
  * The directory you wish to upload your Worker from,
1059
- * relative to the wrangler.toml file.
1069
+ * relative to the Wrangler configuration file.
1060
1070
  *
1061
- * Defaults to the directory containing the wrangler.toml file.
1071
+ * Defaults to the directory containing the Wrangler configuration file.
1062
1072
  *
1063
1073
  * @deprecated
1064
1074
  */
@@ -1468,8 +1478,6 @@ declare interface EnablePagesAssetsServiceBindingOptions {
1468
1478
  declare type Entry = {
1469
1479
  /** A worker's entrypoint */
1470
1480
  file: string;
1471
- /** A worker's directory. Usually where the wrangler.toml file is located */
1472
- projectRoot: string;
1473
1481
  /** Is this a module worker or a service worker? */
1474
1482
  format: CfScriptFormat;
1475
1483
  /** The directory that contains all of a `--no-bundle` worker's modules. Usually `${directory}/src`. Defaults to path.dirname(file) */
@@ -1572,6 +1580,14 @@ declare interface EnvironmentInheritable {
1572
1580
  * @inheritable
1573
1581
  */
1574
1582
  workers_dev: boolean | undefined;
1583
+ /**
1584
+ * Whether we use <version>-<name>.<subdomain>.workers.dev to
1585
+ * serve Preview URLs for your Worker.
1586
+ *
1587
+ * @default `true`
1588
+ * @inheritable
1589
+ */
1590
+ preview_urls: boolean | undefined;
1575
1591
  /**
1576
1592
  * A list of routes that your Worker should be published to.
1577
1593
  * Only one of `routes` or `route` is required.
@@ -1849,7 +1865,7 @@ declare interface EnvironmentNonInheritable {
1849
1865
  /** The binding name used to refer to the KV Namespace */
1850
1866
  binding: string;
1851
1867
  /** The ID of the KV namespace */
1852
- id: string;
1868
+ id?: string;
1853
1869
  /** The ID of the KV namespace used during `wrangler dev` */
1854
1870
  preview_id?: string;
1855
1871
  }[];
@@ -1924,7 +1940,7 @@ declare interface EnvironmentNonInheritable {
1924
1940
  /** The binding name used to refer to the R2 bucket in the Worker. */
1925
1941
  binding: string;
1926
1942
  /** The name of this R2 bucket at the edge. */
1927
- bucket_name: string;
1943
+ bucket_name?: string;
1928
1944
  /** The preview name of this R2 bucket at the edge. */
1929
1945
  preview_bucket_name?: string;
1930
1946
  /** The jurisdiction that the bucket exists in. Default if not present. */
@@ -1943,9 +1959,9 @@ declare interface EnvironmentNonInheritable {
1943
1959
  /** The binding name used to refer to the D1 database in the Worker. */
1944
1960
  binding: string;
1945
1961
  /** The name of this D1 database. */
1946
- database_name: string;
1962
+ database_name?: string;
1947
1963
  /** The UUID of this D1 database (not required). */
1948
- database_id: string;
1964
+ database_id?: string;
1949
1965
  /** The UUID of this D1 database for Wrangler Dev (if specified). */
1950
1966
  preview_database_id?: string;
1951
1967
  /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
@@ -2151,7 +2167,7 @@ declare interface EnvironmentNonInheritable {
2151
2167
  }[];
2152
2168
  }
2153
2169
 
2154
- declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker"> | BaseErrorEvent<"ProxyController", {
2170
+ declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker" | "MultiworkerRuntimeController"> | BaseErrorEvent<"ProxyController", {
2155
2171
  config?: StartDevWorkerOptions;
2156
2172
  bundle?: Bundle;
2157
2173
  }> | BaseErrorEvent<"BundlerController", {
@@ -2540,7 +2556,7 @@ declare class FormData_2 {
2540
2556
  declare type FormDataEntryValue = string | File
2541
2557
 
2542
2558
  /**
2543
- * By reading from a `wrangler.toml` file this function generates proxy binding objects that can be
2559
+ * By reading from a Wrangler configuration file this function generates proxy binding objects that can be
2544
2560
  * used to simulate the interaction with bindings during local development in a Node.js environment
2545
2561
  *
2546
2562
  * @deprecated use `getPlatformProxy` instead
@@ -2560,7 +2576,7 @@ declare function getGlobalDispatcher(): Dispatcher;
2560
2576
  declare function getGlobalOrigin(): URL | undefined;
2561
2577
 
2562
2578
  /**
2563
- * By reading from a `wrangler.toml` file this function generates proxy objects that can be
2579
+ * By reading from a Wrangler configuration file this function generates proxy objects that can be
2564
2580
  * used to simulate the interaction with the Cloudflare platform during local development
2565
2581
  * in a Node.js environment
2566
2582
  *
@@ -2580,19 +2596,12 @@ export declare type GetPlatformProxyOptions = {
2580
2596
  /**
2581
2597
  * The path to the config file to use.
2582
2598
  * If no path is specified the default behavior is to search from the
2583
- * current directory up the filesystem for a `wrangler.toml` to use.
2599
+ * current directory up the filesystem for a Wrangler configuration file to use.
2584
2600
  *
2585
2601
  * Note: this field is optional but if a path is specified it must
2586
2602
  * point to a valid file on the filesystem
2587
2603
  */
2588
2604
  configPath?: string;
2589
- /**
2590
- * Flag to indicate the utility to read a json config file (`wrangler.json`/`wrangler.jsonc`)
2591
- * instead of the toml one (`wrangler.toml`)
2592
- *
2593
- * Note: this feature is experimental
2594
- */
2595
- experimentalJsonConfig?: boolean;
2596
2605
  /**
2597
2606
  * Indicates if and where to persist the bindings data, if not present or `true` it defaults to the same location
2598
2607
  * used by wrangler v3: `.wrangler/state/v3` (so that the same data can be easily used by the caller and wrangler).
@@ -2946,18 +2955,7 @@ declare interface PagesConfigFields {
2946
2955
  /**
2947
2956
  * The directory of static assets to serve.
2948
2957
  *
2949
- * The presence of this field in `wrangler.toml` indicates a Pages project,
2950
- * and will prompt the handling of the configuration file according to the
2951
- * Pages-specific validation rules.
2952
- */
2953
- pages_build_output_dir?: string;
2954
- }
2955
-
2956
- declare interface PagesConfigFields {
2957
- /**
2958
- * The directory of static assets to serve.
2959
- *
2960
- * The presence of this field in `wrangler.toml` indicates a Pages project,
2958
+ * The presence of this field in a Wrangler configuration file indicates a Pages project,
2961
2959
  * and will prompt the handling of the configuration file according to the
2962
2960
  * Pages-specific validation rules.
2963
2961
  */
@@ -25870,10 +25868,13 @@ declare type RoutingConfig = z.infer<typeof RoutingConfigSchema>;
25870
25868
 
25871
25869
  declare const RoutingConfigSchema: z.ZodObject<{
25872
25870
  has_user_worker: z.ZodOptional<z.ZodBoolean>;
25871
+ invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
25873
25872
  }, "strip", z.ZodTypeAny, {
25874
25873
  has_user_worker?: boolean;
25874
+ invoke_user_worker_ahead_of_assets?: boolean;
25875
25875
  }, {
25876
25876
  has_user_worker?: boolean;
25877
+ invoke_user_worker_ahead_of_assets?: boolean;
25877
25878
  }>;
25878
25879
 
25879
25880
  /**
@@ -25952,7 +25953,7 @@ declare interface StartDevWorkerInput {
25952
25953
  name?: string;
25953
25954
  /**
25954
25955
  * The javascript or typescript entry-point of the worker.
25955
- * This is the `main` property of a wrangler.toml.
25956
+ * This is the `main` property of a Wrangler configuration file.
25956
25957
  * You can specify a file path or provide the contents directly.
25957
25958
  */
25958
25959
  entrypoint?: string;
@@ -26043,10 +26044,12 @@ declare interface StartDevWorkerInput {
26043
26044
  /** An undici MockAgent to declaratively mock fetch calls to particular resources. */
26044
26045
  mockFetch?: undici.MockAgent;
26045
26046
  /** Describes the registry of other Workers running locally */
26046
- registry?: WorkerRegistry;
26047
+ registry?: WorkerRegistry | null;
26047
26048
  testScheduled?: boolean;
26048
26049
  /** Whether to use Vectorize mixed mode -- the worker is run locally but accesses to Vectorize are made remotely */
26049
26050
  bindVectorizeToProd?: boolean;
26051
+ /** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
26052
+ multiworkerPrimary?: boolean;
26050
26053
  };
26051
26054
  legacy?: {
26052
26055
  site?: Hook<Config["site"], [Config]>;
@@ -26058,7 +26061,7 @@ declare interface StartDevWorkerInput {
26058
26061
  }
26059
26062
 
26060
26063
  declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
26061
- /** A worker's directory. Usually where the wrangler.toml file is located */
26064
+ /** A worker's directory. Usually where the Wrangler configuration file is located */
26062
26065
  projectRoot: string;
26063
26066
  build: StartDevWorkerInput["build"] & {
26064
26067
  nodejsCompatMode: NodeJSCompatMode;
@@ -26080,6 +26083,7 @@ declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
26080
26083
  };
26081
26084
  entrypoint: string;
26082
26085
  assets?: AssetsOptions;
26086
+ name: string;
26083
26087
  };
26084
26088
 
26085
26089
  /** A faster version of `request`. */
@@ -26325,7 +26329,7 @@ export declare interface UnstableDevOptions {
26325
26329
  vars?: Record<string, string | Json>;
26326
26330
  kv?: {
26327
26331
  binding: string;
26328
- id: string;
26332
+ id?: string;
26329
26333
  preview_id?: string;
26330
26334
  }[];
26331
26335
  durableObjects?: {
@@ -26342,7 +26346,7 @@ export declare interface UnstableDevOptions {
26342
26346
  }[];
26343
26347
  r2?: {
26344
26348
  binding: string;
26345
- bucket_name: string;
26349
+ bucket_name?: string;
26346
26350
  preview_bucket_name?: string;
26347
26351
  }[];
26348
26352
  ai?: {