wrangler 3.58.0 → 3.60.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.
@@ -94,51 +94,68 @@ declare type BaseErrorEvent<Source = string, Data = undefined> = {
94
94
  data: Data;
95
95
  };
96
96
 
97
+ declare type BinaryFile = File_2<Uint8Array>;
98
+
97
99
  declare type BinaryType = 'blob' | 'arraybuffer'
98
100
 
99
101
  declare type Binding = {
100
- type: "kv";
101
- id: string;
102
+ type: "plain_text";
103
+ value: string;
102
104
  } | {
103
- type: "r2";
104
- bucket_name: string;
105
+ type: "json";
106
+ value: Json;
107
+ } | ({
108
+ type: "kv_namespace";
109
+ } & BindingOmit<CfKvNamespace>) | ({
110
+ type: "send_email";
111
+ } & BindingOmit<CfSendEmailBindings>) | {
112
+ type: "wasm_module";
113
+ source: BinaryFile;
105
114
  } | {
106
- type: "d1";
107
- /** The binding name used to refer to the D1 database in the worker. */
108
- binding: string;
109
- /** The name of this D1 database. */
110
- database_name: string;
111
- /** The UUID of this D1 database (not required). */
112
- database_id: string;
113
- /** The UUID of this D1 database for Wrangler Dev (if specified). */
114
- preview_database_id?: string;
115
- /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
116
- migrations_table?: string;
117
- /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
118
- migrations_dir?: string;
119
- /** Internal use only. */
120
- database_internal_env?: string;
115
+ type: "text_blob";
116
+ source: File_2;
121
117
  } | {
122
- type: "durable-object";
123
- className: string;
124
- service?: ServiceDesignator;
118
+ type: "browser";
125
119
  } | {
126
- type: "service";
127
- service: ServiceDesignator | ServiceFetch;
120
+ type: "ai";
128
121
  } | {
129
- type: "queue-producer";
130
- name: string;
122
+ type: "version_metadata";
131
123
  } | {
124
+ type: "data_blob";
125
+ source: BinaryFile;
126
+ } | ({
127
+ type: "durable_object_namespace";
128
+ } & BindingOmit<CfDurableObject>) | ({
129
+ type: "queue";
130
+ } & BindingOmit<CfQueue>) | ({
131
+ type: "r2_bucket";
132
+ } & BindingOmit<CfR2Bucket>) | ({
133
+ type: "d1";
134
+ } & Omit<CfD1Database, "binding">) | ({
135
+ type: "vectorize";
136
+ } & Omit<CfVectorize, "binding">) | ({
132
137
  type: "constellation";
133
- project_id: string;
134
- } | {
135
- type: "var";
136
- value: string | Json | Uint8Array;
137
- } | {
138
- type: `unsafe-${string}`;
139
- [key: string]: unknown;
138
+ } & Omit<CfConstellation, "binding">) | ({
139
+ type: "hyperdrive";
140
+ } & Omit<CfHyperdrive, "binding">) | ({
141
+ type: "service";
142
+ } & Omit<CfService, "binding">) | {
143
+ type: "fetcher";
144
+ fetcher: ServiceFetch;
145
+ } | ({
146
+ type: "analytics_engine";
147
+ } & Omit<CfAnalyticsEngineDataset, "binding">) | ({
148
+ type: "dispatch_namespace";
149
+ } & Omit<CfDispatchNamespace, "binding">) | ({
150
+ type: "mtls_certificate";
151
+ } & Omit<CfMTlsCertificate, "binding">) | ({
152
+ type: "logfwdr";
153
+ } & Omit<CfLogfwdrBinding, "name">) | {
154
+ type: `unsafe_${string}`;
140
155
  };
141
156
 
157
+ declare type BindingOmit<T> = Omit<T, "binding" | "name">;
158
+
142
159
  /**
143
160
  * Result of the `getBindingsProxy` utility
144
161
  */
@@ -264,23 +281,26 @@ declare namespace buildConnector {
264
281
  }
265
282
  }
266
283
 
284
+ declare type Bundle = EsbuildBundle;
285
+
267
286
  declare type BundleCompleteEvent = {
268
287
  type: "bundleComplete";
269
288
  config: StartDevWorkerOptions;
270
- bundle: EsbuildBundle;
289
+ bundle: Bundle;
271
290
  };
272
291
 
273
- declare class BundlerController extends Controller {
292
+ declare class BundlerController extends Controller<BundlerControllerEventMap> {
274
293
  onConfigUpdate(_: ConfigUpdateEvent): void;
275
294
  teardown(): Promise<void>;
276
295
  emitBundleStartEvent(data: BundleStartEvent): void;
277
296
  emitBundleCompletetEvent(data: BundleCompleteEvent): void;
278
- on(event: "bundleStart", listener: (_: BundleStartEvent) => void): this;
279
- on(event: "bundleComplete", listener: (_: BundleCompleteEvent) => void): this;
280
- on(event: "error", listener: (_: ErrorEvent) => void): this;
281
- once: typeof BundlerController.on;
282
297
  }
283
298
 
299
+ declare type BundlerControllerEventMap = ControllerEventMap & {
300
+ bundleStart: [BundleStartEvent];
301
+ bundleComplete: [BundleCompleteEvent];
302
+ };
303
+
284
304
  declare type BundleStartEvent = {
285
305
  type: "bundleStart";
286
306
  config: StartDevWorkerOptions;
@@ -378,6 +398,68 @@ declare interface CfAccount {
378
398
  accountId: string;
379
399
  }
380
400
 
401
+ /**
402
+ * A binding to the AI project
403
+ */
404
+ declare interface CfAIBinding {
405
+ binding: string;
406
+ staging?: boolean;
407
+ }
408
+
409
+ declare interface CfAnalyticsEngineDataset {
410
+ binding: string;
411
+ dataset?: string;
412
+ }
413
+
414
+ /**
415
+ * A binding to a browser
416
+ */
417
+ declare interface CfBrowserBinding {
418
+ binding: string;
419
+ }
420
+
421
+ declare type CfCapnp = {
422
+ base_path?: never;
423
+ source_schemas?: never;
424
+ compiled_schema: string;
425
+ } | {
426
+ base_path: string;
427
+ source_schemas: string[];
428
+ compiled_schema?: never;
429
+ };
430
+
431
+ declare interface CfConstellation {
432
+ binding: string;
433
+ project_id: string;
434
+ }
435
+
436
+ declare interface CfD1Database {
437
+ binding: string;
438
+ database_id: string;
439
+ database_name?: string;
440
+ preview_database_id?: string;
441
+ database_internal_env?: string;
442
+ migrations_table?: string;
443
+ migrations_dir?: string;
444
+ }
445
+
446
+ /**
447
+ * A binding to a data blob (in service-worker format)
448
+ */
449
+ declare interface CfDataBlobBindings {
450
+ [key: string]: string | Uint8Array;
451
+ }
452
+
453
+ declare interface CfDispatchNamespace {
454
+ binding: string;
455
+ namespace: string;
456
+ outbound?: {
457
+ service: string;
458
+ environment?: string;
459
+ parameters?: string[];
460
+ };
461
+ }
462
+
381
463
  /**
382
464
  * A Durable Object.
383
465
  */
@@ -388,6 +470,42 @@ declare interface CfDurableObject {
388
470
  environment?: string;
389
471
  }
390
472
 
473
+ declare interface CfDurableObjectMigrations {
474
+ old_tag?: string;
475
+ new_tag: string;
476
+ steps: {
477
+ new_classes?: string[];
478
+ renamed_classes?: {
479
+ from: string;
480
+ to: string;
481
+ }[];
482
+ deleted_classes?: string[];
483
+ }[];
484
+ }
485
+
486
+ declare interface CfHyperdrive {
487
+ binding: string;
488
+ id: string;
489
+ localConnectionString?: string;
490
+ }
491
+
492
+ /**
493
+ * A KV namespace.
494
+ */
495
+ declare interface CfKvNamespace {
496
+ binding: string;
497
+ id: string;
498
+ }
499
+
500
+ declare interface CfLogfwdr {
501
+ bindings: CfLogfwdrBinding[];
502
+ }
503
+
504
+ declare interface CfLogfwdrBinding {
505
+ name: string;
506
+ destination: string;
507
+ }
508
+
391
509
  /**
392
510
  * An imported module.
393
511
  */
@@ -419,6 +537,12 @@ declare interface CfModule {
419
537
  * }
420
538
  */
421
539
  content: string | Buffer;
540
+ /**
541
+ * An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present
542
+ * if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled
543
+ * we need to also copy the relevant sourcemaps into the final out directory.
544
+ */
545
+ sourceMap?: CfWorkerSourceMap;
422
546
  /**
423
547
  * The module type.
424
548
  *
@@ -430,13 +554,193 @@ declare interface CfModule {
430
554
  /**
431
555
  * A module type.
432
556
  */
433
- declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
557
+ declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement" | "nodejs-compat-module";
558
+
559
+ declare interface CfMTlsCertificate {
560
+ binding: string;
561
+ certificate_id: string;
562
+ }
563
+
564
+ declare interface CfPlacement {
565
+ mode: "smart";
566
+ }
567
+
568
+ declare interface CfQueue {
569
+ binding: string;
570
+ queue_name: string;
571
+ delivery_delay?: number;
572
+ }
573
+
574
+ declare interface CfR2Bucket {
575
+ binding: string;
576
+ bucket_name: string;
577
+ jurisdiction?: string;
578
+ }
434
579
 
435
580
  /**
436
581
  * The type of Worker
437
582
  */
438
583
  declare type CfScriptFormat = "modules" | "service-worker";
439
584
 
585
+ /**
586
+ * A binding to send email.
587
+ */
588
+ declare interface CfSendEmailBindings {
589
+ name: string;
590
+ destination_address?: string;
591
+ allowed_destination_addresses?: string[];
592
+ }
593
+
594
+ declare interface CfService {
595
+ binding: string;
596
+ service: string;
597
+ environment?: string;
598
+ entrypoint?: string;
599
+ }
600
+
601
+ declare interface CfTailConsumer {
602
+ service: string;
603
+ environment?: string;
604
+ }
605
+
606
+ /**
607
+ * A binding to a text blob (in service-worker format)
608
+ */
609
+ declare interface CfTextBlobBindings {
610
+ [key: string]: string;
611
+ }
612
+
613
+ declare interface CfUnsafe {
614
+ bindings: CfUnsafeBinding[] | undefined;
615
+ metadata: CfUnsafeMetadata | undefined;
616
+ capnp: CfCapnp | undefined;
617
+ }
618
+
619
+ declare interface CfUnsafeBinding {
620
+ name: string;
621
+ type: string;
622
+ }
623
+
624
+ declare type CfUnsafeMetadata = Record<string, unknown>;
625
+
626
+ declare interface CfUserLimits {
627
+ cpu_ms?: number;
628
+ }
629
+
630
+ /**
631
+ * A map of variable names to values.
632
+ */
633
+ declare interface CfVars {
634
+ [key: string]: string | Json;
635
+ }
636
+
637
+ declare interface CfVectorize {
638
+ binding: string;
639
+ index_name: string;
640
+ }
641
+
642
+ /**
643
+ * A binding to the Worker Version's metadata
644
+ */
645
+ declare interface CfVersionMetadataBinding {
646
+ binding: string;
647
+ }
648
+
649
+ /**
650
+ * A binding to a wasm module (in service-worker format)
651
+ */
652
+ declare interface CfWasmModuleBindings {
653
+ [key: string]: string | Uint8Array;
654
+ }
655
+
656
+ /**
657
+ * Options for creating a `CfWorker`.
658
+ */
659
+ declare interface CfWorkerInit {
660
+ /**
661
+ * The name of the worker.
662
+ */
663
+ name: string | undefined;
664
+ /**
665
+ * The entrypoint module.
666
+ */
667
+ main: CfModule;
668
+ /**
669
+ * The list of additional modules.
670
+ */
671
+ modules: CfModule[] | undefined;
672
+ /**
673
+ * The list of source maps to include on upload.
674
+ */
675
+ sourceMaps: CfWorkerSourceMap[] | undefined;
676
+ /**
677
+ * All the bindings
678
+ */
679
+ bindings: {
680
+ vars: CfVars | undefined;
681
+ kv_namespaces: CfKvNamespace[] | undefined;
682
+ send_email: CfSendEmailBindings[] | undefined;
683
+ wasm_modules: CfWasmModuleBindings | undefined;
684
+ text_blobs: CfTextBlobBindings | undefined;
685
+ browser: CfBrowserBinding | undefined;
686
+ ai: CfAIBinding | undefined;
687
+ version_metadata: CfVersionMetadataBinding | undefined;
688
+ data_blobs: CfDataBlobBindings | undefined;
689
+ durable_objects: {
690
+ bindings: CfDurableObject[];
691
+ } | undefined;
692
+ queues: CfQueue[] | undefined;
693
+ r2_buckets: CfR2Bucket[] | undefined;
694
+ d1_databases: CfD1Database[] | undefined;
695
+ vectorize: CfVectorize[] | undefined;
696
+ constellation: CfConstellation[] | undefined;
697
+ hyperdrive: CfHyperdrive[] | undefined;
698
+ services: CfService[] | undefined;
699
+ analytics_engine_datasets: CfAnalyticsEngineDataset[] | undefined;
700
+ dispatch_namespaces: CfDispatchNamespace[] | undefined;
701
+ mtls_certificates: CfMTlsCertificate[] | undefined;
702
+ logfwdr: CfLogfwdr | undefined;
703
+ unsafe: CfUnsafe | undefined;
704
+ };
705
+ migrations: CfDurableObjectMigrations | undefined;
706
+ compatibility_date: string | undefined;
707
+ compatibility_flags: string[] | undefined;
708
+ usage_model: "bundled" | "unbound" | undefined;
709
+ keepVars: boolean | undefined;
710
+ keepSecrets: boolean | undefined;
711
+ logpush: boolean | undefined;
712
+ placement: CfPlacement | undefined;
713
+ tail_consumers: CfTailConsumer[] | undefined;
714
+ limits: CfUserLimits | undefined;
715
+ annotations?: Record<string, string | undefined>;
716
+ }
717
+
718
+ declare interface CfWorkerSourceMap {
719
+ /**
720
+ * The name of the source map.
721
+ *
722
+ * @example
723
+ * 'out.js.map'
724
+ */
725
+ name: string;
726
+ /**
727
+ * The content of the source map, which is a JSON object described by the v3
728
+ * spec.
729
+ *
730
+ * @example
731
+ * {
732
+ * "version" : 3,
733
+ * "file": "out.js",
734
+ * "sourceRoot": "",
735
+ * "sources": ["foo.js", "bar.js"],
736
+ * "sourcesContent": [null, null],
737
+ * "names": ["src", "maps", "are", "fun"],
738
+ * "mappings": "A,AAAB;;ABCDE;"
739
+ * }
740
+ */
741
+ content: string | Buffer;
742
+ }
743
+
440
744
  /**
441
745
  * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
442
746
  */
@@ -553,17 +857,41 @@ declare type CloudchamberConfig = {
553
857
  memory?: string;
554
858
  };
555
859
 
556
- declare class ConfigController extends EventEmitter_2 {
860
+ /**
861
+ * This is the static type definition for the configuration object.
862
+ *
863
+ * It reflects a normalized and validated version of the configuration that you can write in wrangler.toml,
864
+ * and optionally augment with arguments passed directly to wrangler.
865
+ *
866
+ * For more information about the configuration object, see the
867
+ * documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
868
+ *
869
+ * Notes:
870
+ *
871
+ * - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
872
+ * in the top level config and should not appear in any environments.
873
+ * - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
874
+ * - All top level fields in config and environments are optional in the wrangler.toml file.
875
+ *
876
+ * Legend for the annotations:
877
+ *
878
+ * - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
879
+ * - `@todo`: there's more work to be done (with details attached).
880
+ */
881
+ declare type Config = ConfigFields<DevConfig> & PagesConfigFields & Environment;
882
+
883
+ declare class ConfigController extends Controller<ConfigControllerEventMap> {
557
884
  config?: StartDevWorkerOptions;
558
885
  setOptions(_: StartDevWorkerOptions): void;
559
886
  updateOptions(_: Partial<StartDevWorkerOptions>): void;
560
887
  teardown(): Promise<void>;
561
888
  emitConfigUpdateEvent(data: ConfigUpdateEvent): void;
562
- on(event: "configUpdate", listener: (_: ConfigUpdateEvent) => void): this;
563
- on(event: "error", listener: (_: ErrorEvent) => void): this;
564
- once: typeof ConfigController.on;
565
889
  }
566
890
 
891
+ declare type ConfigControllerEventMap = ControllerEventMap & {
892
+ configUpdate: [ConfigUpdateEvent];
893
+ };
894
+
567
895
  declare interface ConfigFields<Dev extends RawDevConfig> {
568
896
  configPath: string | undefined;
569
897
  /**
@@ -699,7 +1027,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
699
1027
  /**
700
1028
  * The possible types for a `Rule`.
701
1029
  */
702
- declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
1030
+ declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement" | "NodeJsCompatModule";
703
1031
 
704
1032
  declare type ConfigUpdateEvent = {
705
1033
  type: "configUpdate";
@@ -712,9 +1040,14 @@ url: string | URL_2 | UrlObject,
712
1040
  options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.ConnectOptions, 'origin' | 'path'>
713
1041
  ): Promise<Dispatcher.ConnectData>;
714
1042
 
715
- declare abstract class Controller extends EventEmitter_2 {
1043
+ declare abstract class Controller<EventMap extends ControllerEventMap = ControllerEventMap> extends TypedEventEmitterImpl<EventMap> {
1044
+ emitErrorEvent(data: ErrorEvent): void;
716
1045
  }
717
1046
 
1047
+ declare type ControllerEventMap = {
1048
+ error: [ErrorEvent];
1049
+ };
1050
+
718
1051
  declare interface Cookie {
719
1052
  name: string
720
1053
  value: string
@@ -756,7 +1089,7 @@ attributes?: { name?: string, domain?: string }
756
1089
  * NOTE: You will need the `CLOUDFLARE_API_KEY` environment
757
1090
  * variable set
758
1091
  */
759
- declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, args, }: PagesDeployOptions): Promise<{
1092
+ declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, sourceMaps, args, }: PagesDeployOptions): Promise<{
760
1093
  url: string;
761
1094
  id: string;
762
1095
  environment: "production" | "preview";
@@ -819,30 +1152,6 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
819
1152
  } | undefined;
820
1153
  }>;
821
1154
 
822
- declare interface DeprecatedConfigFields {
823
- /**
824
- * The project "type". A holdover from Wrangler v1.x.
825
- * Valid values were "webpack", "javascript", and "rust".
826
- *
827
- * @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.
828
- * @breaking
829
- */
830
- type?: "webpack" | "javascript" | "rust";
831
- /**
832
- * Path to the webpack config to use when building your worker.
833
- * A holdover from Wrangler v1.x, used with `type: "webpack"`.
834
- *
835
- * @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.
836
- * @breaking
837
- */
838
- webpack_config?: string;
839
- /**
840
- * Configuration only used by a standalone use of the miniflare binary.
841
- * @deprecated
842
- */
843
- miniflare?: unknown;
844
- }
845
-
846
1155
  /**
847
1156
  * Deprecated upload configuration.
848
1157
  */
@@ -1280,39 +1589,6 @@ declare type Entry = {
1280
1589
  declare interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
1281
1590
  }
1282
1591
 
1283
- /**
1284
- * The environment configuration properties that have been deprecated.
1285
- */
1286
- declare interface EnvironmentDeprecated {
1287
- /**
1288
- * The zone ID of the zone you want to deploy to. You can find this
1289
- * in your domain page on the dashboard.
1290
- *
1291
- * @deprecated This is unnecessary since we can deduce this from routes directly.
1292
- */
1293
- zone_id?: string;
1294
- /**
1295
- * Legacy way of defining KVNamespaces that is no longer supported.
1296
- *
1297
- * @deprecated DO NOT USE. This was a legacy bug from Wrangler v1, that we do not want to support.
1298
- */
1299
- "kv-namespaces"?: string;
1300
- /**
1301
- * A list of services that your Worker should be bound to.
1302
- *
1303
- * @default `[]`
1304
- * @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.
1305
- */
1306
- experimental_services?: {
1307
- /** The binding name used to refer to the Service */
1308
- name: string;
1309
- /** The name of the Service being bound */
1310
- service: string;
1311
- /** The Service's environment */
1312
- environment: string;
1313
- }[];
1314
- }
1315
-
1316
1592
  /**
1317
1593
  * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
1318
1594
  * that can be inherited (and overridden) from the top-level environment.
@@ -1564,24 +1840,6 @@ declare interface EnvironmentInheritable {
1564
1840
  } | undefined;
1565
1841
  }
1566
1842
 
1567
- declare interface EnvironmentMap {
1568
- /**
1569
- * The `env` section defines overrides for the configuration for different environments.
1570
- *
1571
- * All environment fields can be specified at the top level of the config indicating the default environment settings.
1572
- *
1573
- * - Some fields are inherited and overridable in each environment.
1574
- * - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.
1575
- *
1576
- * For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
1577
- *
1578
- * @default {}
1579
- */
1580
- env?: {
1581
- [envName: string]: RawEnvironment;
1582
- };
1583
- }
1584
-
1585
1843
  /**
1586
1844
  * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
1587
1845
  * that cannot be inherited from the top-level environment, and must be defined specifically.
@@ -1956,7 +2214,7 @@ declare interface EnvironmentNonInheritable {
1956
2214
 
1957
2215
  declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker"> | BaseErrorEvent<"ProxyController", {
1958
2216
  config?: StartDevWorkerOptions;
1959
- bundle?: EsbuildBundle;
2217
+ bundle?: Bundle;
1960
2218
  }>;
1961
2219
 
1962
2220
  declare namespace Errors {
@@ -2086,6 +2344,7 @@ declare namespace Errors {
2086
2344
  declare type EsbuildBundle = {
2087
2345
  id: number;
2088
2346
  path: string;
2347
+ entrypointSource: string;
2089
2348
  entry: Entry;
2090
2349
  type: CfModuleType;
2091
2350
  modules: CfModule[];
@@ -2420,7 +2679,7 @@ declare class Headers implements SpecIterable<[string, string]> {
2420
2679
 
2421
2680
  declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
2422
2681
 
2423
- declare type Hook<T, Args extends unknown[] = unknown[]> = T | Promise<T> | ((...args: Args) => T | Promise<T>);
2682
+ declare type Hook<T extends string | number | object> = T | Promise<T> | (() => T | Promise<T>);
2424
2683
 
2425
2684
  /**
2426
2685
  * @property terminate Terminates HTTP server.
@@ -2464,7 +2723,7 @@ declare interface Interceptable extends Dispatcher {
2464
2723
 
2465
2724
  declare class Logger {
2466
2725
  constructor();
2467
- loggerLevel: "none" | "error" | "warn" | "info" | "log" | "debug";
2726
+ loggerLevel: "error" | "none" | "warn" | "info" | "log" | "debug";
2468
2727
  columns: number;
2469
2728
  debug: (...args: unknown[]) => void;
2470
2729
  debugWithSanitization: (label: string, ...args: unknown[]) => void;
@@ -2682,7 +2941,7 @@ declare class MockScope<TData extends object = object> {
2682
2941
  }
2683
2942
 
2684
2943
  declare interface ModuleRule {
2685
- type: "ESModule" | "CommonJS" | "NodeJSCompat" | "CompiledWasm" | "Text" | "Data";
2944
+ type: "ESModule" | "CommonJS" | "NodeJsCompatModule" | "CompiledWasm" | "Text" | "Data";
2686
2945
  include?: string[];
2687
2946
  fallthrough?: boolean;
2688
2947
  }
@@ -2759,6 +3018,10 @@ declare interface PagesDeployOptions {
2759
3018
  * Default: true
2760
3019
  */
2761
3020
  bundle?: boolean;
3021
+ /**
3022
+ * Whether to upload any server-side sourcemaps with this deployment
3023
+ */
3024
+ sourceMaps: boolean;
2762
3025
  /**
2763
3026
  * Command line args passed to the `pages deploy` cmd
2764
3027
  */
@@ -23138,7 +23401,7 @@ declare namespace ProxyAgent {
23138
23401
  }
23139
23402
  }
23140
23403
 
23141
- declare class ProxyController extends EventEmitter_2 {
23404
+ declare class ProxyController extends Controller<ProxyControllerEventMap> {
23142
23405
  ready: DeferredPromise<ReadyEvent>;
23143
23406
  proxyWorker?: Miniflare;
23144
23407
  proxyWorkerOptions?: MiniflareOptions;
@@ -23162,17 +23425,19 @@ declare class ProxyController extends EventEmitter_2 {
23162
23425
  teardown(): Promise<void>;
23163
23426
  emitReadyEvent(proxyWorker: Miniflare): void;
23164
23427
  emitPreviewTokenExpiredEvent(proxyData: ProxyData): void;
23165
- emitErrorEvent(reason: string, cause: Error | SerializedError): void;
23166
- on(event: "ready", listener: (_: ReadyEvent) => void): this;
23167
- on(event: "previewTokenExpired", listener: (_: PreviewTokenExpiredEvent) => void): this;
23168
- on(event: "error", listener: (_: ErrorEvent) => void): this;
23169
- once: typeof ProxyController.on;
23428
+ emitErrorEvent(data: ErrorEvent): void;
23429
+ emitErrorEvent(reason: string, cause?: Error | SerializedError): void;
23170
23430
  }
23171
23431
 
23432
+ declare type ProxyControllerEventMap = ControllerEventMap & {
23433
+ ready: [ReadyEvent];
23434
+ previewTokenExpired: [PreviewTokenExpiredEvent];
23435
+ };
23436
+
23172
23437
  declare type ProxyData = {
23173
23438
  userWorkerUrl: UrlOriginParts;
23174
23439
  userWorkerInspectorUrl: UrlOriginAndPathnameParts;
23175
- userWorkerInnerUrlOverrides: Partial<UrlOriginParts>;
23440
+ userWorkerInnerUrlOverrides?: Partial<UrlOriginParts>;
23176
23441
  headers: Record<string, string>;
23177
23442
  liveReload?: boolean;
23178
23443
  proxyLogsToController?: boolean;
@@ -23198,20 +23463,10 @@ declare type ProxyWorkerOutgoingRequestBody = {
23198
23463
  args: Parameters<typeof console.debug>;
23199
23464
  };
23200
23465
 
23201
- declare type RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & RawEnvironment & DeprecatedConfigFields & EnvironmentMap & {
23202
- $schema?: string;
23203
- };
23466
+ declare type QueueConsumer = NonNullable<Config["queues"]["consumers"]>[number];
23204
23467
 
23205
23468
  declare type RawDevConfig = Partial<DevConfig>;
23206
23469
 
23207
- /**
23208
- * The raw environment configuration that we read from the config file.
23209
- *
23210
- * All the properties are optional, and will be replaced with defaults in the configuration that
23211
- * is used in the rest of the codebase.
23212
- */
23213
- declare type RawEnvironment = Partial<Environment> & EnvironmentDeprecated;
23214
-
23215
23470
  declare type ReadyEvent = {
23216
23471
  type: "ready";
23217
23472
  proxyWorker: Miniflare;
@@ -23237,14 +23492,14 @@ declare type ReferrerPolicy =
23237
23492
  declare type ReloadCompleteEvent = {
23238
23493
  type: "reloadComplete";
23239
23494
  config: StartDevWorkerOptions;
23240
- bundle: EsbuildBundle;
23495
+ bundle: Bundle;
23241
23496
  proxyData: ProxyData;
23242
23497
  };
23243
23498
 
23244
23499
  declare type ReloadStartEvent = {
23245
23500
  type: "reloadStart";
23246
23501
  config: StartDevWorkerOptions;
23247
- bundle: EsbuildBundle;
23502
+ bundle: Bundle;
23248
23503
  };
23249
23504
 
23250
23505
  declare class Request implements BodyMixin {
@@ -23505,19 +23760,20 @@ declare type Rule = {
23505
23760
  fallthrough?: boolean;
23506
23761
  };
23507
23762
 
23508
- declare abstract class RuntimeController extends Controller {
23763
+ declare abstract class RuntimeController extends Controller<RuntimeControllerEventMap> {
23509
23764
  abstract onBundleStart(_: BundleStartEvent): void;
23510
23765
  abstract onBundleComplete(_: BundleCompleteEvent): void;
23511
23766
  abstract onPreviewTokenExpired(_: PreviewTokenExpiredEvent): void;
23512
23767
  abstract teardown(): Promise<void>;
23513
23768
  abstract emitReloadStartEvent(data: ReloadStartEvent): void;
23514
- abstract emitReloadCompletetEvent(data: ReloadCompleteEvent): void;
23515
- on(event: "reloadStart", listener: (_: ReloadStartEvent) => void): this;
23516
- on(event: "reloadComplete", listener: (_: ReloadCompleteEvent) => void): this;
23517
- on(event: "error", listener: (_: ErrorEvent) => void): this;
23518
- once: typeof RuntimeController.on;
23769
+ abstract emitReloadCompleteEvent(data: ReloadCompleteEvent): void;
23519
23770
  }
23520
23771
 
23772
+ declare type RuntimeControllerEventMap = ControllerEventMap & {
23773
+ reloadStart: [ReloadStartEvent];
23774
+ reloadComplete: [ReloadCompleteEvent];
23775
+ };
23776
+
23521
23777
  /**
23522
23778
  * Convert a MIMEType object to a string.
23523
23779
  * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type
@@ -23531,12 +23787,7 @@ declare type SerializedError = {
23531
23787
  cause?: unknown;
23532
23788
  };
23533
23789
 
23534
- declare interface ServiceDesignator {
23535
- name: string;
23536
- env?: string;
23537
- }
23538
-
23539
- declare type ServiceFetch = (request: Request_2) => Promise<Response_2>;
23790
+ declare type ServiceFetch = (request: Request_2) => Promise<Response_2> | Response_2;
23540
23791
 
23541
23792
  declare function setCookie (headers: Headers, cookie: Cookie): void
23542
23793
 
@@ -23573,7 +23824,7 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
23573
23824
 
23574
23825
  declare interface StartDevWorkerOptions {
23575
23826
  /** The name of the worker. */
23576
- name: string;
23827
+ name?: string;
23577
23828
  /**
23578
23829
  * The javascript or typescript entry-point of the worker.
23579
23830
  * This is the `main` property of a wrangler.toml.
@@ -23581,9 +23832,7 @@ declare interface StartDevWorkerOptions {
23581
23832
  */
23582
23833
  script: File_2<string>;
23583
23834
  /** The configuration of the worker. */
23584
- config?: File_2<string | RawConfig> & {
23585
- env?: string;
23586
- };
23835
+ config?: File_2<Config>;
23587
23836
  /** The compatibility date for the workerd runtime. */
23588
23837
  compatibilityDate?: string;
23589
23838
  /** The compatibility flags for the workerd runtime. */
@@ -23598,6 +23847,19 @@ declare interface StartDevWorkerOptions {
23598
23847
  include?: string[];
23599
23848
  exclude?: string[];
23600
23849
  };
23850
+ /** Service environments. Providing support for existing workers with this property. Don't use this for new workers. */
23851
+ env?: string;
23852
+ /** Wrangler environments, defaults to true. */
23853
+ legacyEnv?: boolean;
23854
+ /**
23855
+ * Whether Wrangler should send usage metrics to Cloudflare for this project.
23856
+ *
23857
+ * When defined this will override any user settings.
23858
+ * Otherwise, Wrangler will use the user's preference.
23859
+ */
23860
+ sendMetrics?: boolean;
23861
+ usageModel?: "bundled" | "unbound";
23862
+ _bindings?: CfWorkerInit["bindings"];
23601
23863
  /** Options applying to the worker's build step. Applies to deploy and dev. */
23602
23864
  build?: {
23603
23865
  /** Whether the worker and its dependencies are bundled. Defaults to true. */
@@ -23649,7 +23911,7 @@ declare interface StartDevWorkerOptions {
23649
23911
  httpsCertPath?: string;
23650
23912
  };
23651
23913
  /** Controls what request.url looks like inside the worker. */
23652
- urlOverrides?: {
23914
+ origin?: {
23653
23915
  hostname?: string;
23654
23916
  secure?: boolean;
23655
23917
  };
@@ -23657,6 +23919,8 @@ declare interface StartDevWorkerOptions {
23657
23919
  outboundService?: ServiceFetch;
23658
23920
  /** An undici MockAgent to declaratively mock fetch calls to particular resources. */
23659
23921
  mockFetch?: undici.MockAgent;
23922
+ /** Gets a fetcher to a specific worker, used for multi-worker development */
23923
+ getRegisteredWorker?(name: string): WorkerDefinition | undefined;
23660
23924
  };
23661
23925
  }
23662
23926
 
@@ -23681,30 +23945,35 @@ declare type Trigger = {
23681
23945
  } | {
23682
23946
  type: "route";
23683
23947
  pattern: string;
23684
- customDomain: true;
23685
- } | {
23948
+ } | ({
23686
23949
  type: "route";
23687
- pattern: string;
23688
- zoneId: string;
23689
- customDomain?: true;
23690
- zoneName?: never;
23691
- } | {
23950
+ } & ZoneIdRoute) | ({
23692
23951
  type: "route";
23693
- pattern: string;
23694
- zoneName: string;
23695
- customDomain?: true;
23696
- zoneId?: never;
23697
- } | {
23698
- type: "schedule";
23699
- schedule: string;
23700
- } | {
23952
+ } & ZoneNameRoute) | ({
23953
+ type: "route";
23954
+ } & CustomDomainRoute) | {
23955
+ type: "cron";
23956
+ cron: string;
23957
+ } | ({
23701
23958
  type: "queue-consumer";
23702
- name: string;
23703
- maxBatchSize?: number;
23704
- maxBatchTimeout?: number;
23705
- maxRetries?: string;
23706
- deadLetterQueue?: string;
23707
- };
23959
+ } & QueueConsumer);
23960
+
23961
+ declare interface TypedEventEmitter<EventMap extends Record<string | symbol, unknown[]>> extends EventEmitter_2 {
23962
+ addListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
23963
+ on<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
23964
+ once<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
23965
+ removeListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
23966
+ off<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
23967
+ removeAllListeners(event?: keyof EventMap): this;
23968
+ listeners<Name extends keyof EventMap>(eventName: Name): ((...args: EventMap[Name]) => void)[];
23969
+ rawListeners<Name extends keyof EventMap>(eventName: Name): ((...args: EventMap[Name]) => void)[];
23970
+ emit<Name extends keyof EventMap>(eventName: Name, ...args: EventMap[Name]): boolean;
23971
+ listenerCount<Name extends keyof EventMap>(eventName: Name, listener?: (...args: EventMap[Name]) => void): number;
23972
+ prependListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
23973
+ prependOnceListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
23974
+ }
23975
+
23976
+ declare const TypedEventEmitterImpl: new <EventMap extends Record<string | symbol, unknown[]>>() => TypedEventEmitter<EventMap>;
23708
23977
 
23709
23978
  declare namespace Undici {
23710
23979
  var Dispatcher: Dispatcher
@@ -23928,7 +24197,6 @@ export declare interface UnstableDevOptions {
23928
24197
  inspect?: boolean;
23929
24198
  local?: boolean;
23930
24199
  accountId?: string;
23931
- updateCheck?: boolean;
23932
24200
  experimental?: {
23933
24201
  processEntrypoint?: boolean;
23934
24202
  additionalModules?: CfModule[];
@@ -23942,6 +24210,7 @@ export declare interface UnstableDevOptions {
23942
24210
  testMode?: boolean;
23943
24211
  testScheduled?: boolean;
23944
24212
  watch?: boolean;
24213
+ devEnv?: boolean;
23945
24214
  };
23946
24215
  }
23947
24216
 
@@ -24036,6 +24305,21 @@ declare interface WebSocketInit {
24036
24305
  headers?: HeadersInit
24037
24306
  }
24038
24307
 
24308
+ declare type WorkerDefinition = {
24309
+ port: number | undefined;
24310
+ protocol: "http" | "https" | undefined;
24311
+ host: string | undefined;
24312
+ mode: "local" | "remote";
24313
+ headers?: Record<string, string>;
24314
+ entrypointAddresses?: WorkerEntrypointsDefinition;
24315
+ durableObjects: {
24316
+ name: string;
24317
+ className: string;
24318
+ }[];
24319
+ durableObjectsHost?: string;
24320
+ durableObjectsPort?: number;
24321
+ };
24322
+
24039
24323
  declare type WorkerEntrypointsDefinition = Record<"default" | string, {
24040
24324
  host: string;
24041
24325
  port: number;