wrangler 3.61.0 → 3.63.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.
@@ -28,7 +28,6 @@ import { TLSSocket } from 'tls';
28
28
  import { URL as URL_2 } from 'url';
29
29
  import { UrlObject } from 'url';
30
30
  import { URLSearchParams as URLSearchParams_2 } from 'url';
31
- import { WebSocket as WebSocket_2 } from 'miniflare';
32
31
  import type { WorkerOptions } from 'miniflare';
33
32
  import { Writable } from 'stream';
34
33
 
@@ -73,6 +72,8 @@ declare type ApiCredentials = {
73
72
  authEmail: string;
74
73
  };
75
74
 
75
+ declare type AsyncHook<T extends HookValues, Args extends unknown[] = []> = Hook<T, Args> | Hook<Promise<T>, Args>;
76
+
76
77
  declare class BalancedPool extends Dispatcher {
77
78
  constructor(url: string | string[] | URL_2 | URL_2[], options?: Pool.Options);
78
79
 
@@ -175,7 +176,7 @@ declare type BodyInit =
175
176
  | ArrayBuffer
176
177
  | AsyncIterable<Uint8Array>
177
178
  | Blob_2
178
- | FormData_2
179
+ | FormData
179
180
  | Iterable<Uint8Array>
180
181
  | NodeJS.ArrayBufferView
181
182
  | URLSearchParams_2
@@ -188,7 +189,7 @@ declare interface BodyMixin {
188
189
 
189
190
  readonly arrayBuffer: () => Promise<ArrayBuffer>
190
191
  readonly blob: () => Promise<Blob_2>
191
- readonly formData: () => Promise<FormData_2>
192
+ readonly formData: () => Promise<FormData>
192
193
  readonly json: () => Promise<unknown>
193
194
  readonly text: () => Promise<string>
194
195
  }
@@ -399,26 +400,11 @@ declare interface CfAccount {
399
400
  accountId: string;
400
401
  }
401
402
 
402
- /**
403
- * A binding to the AI project
404
- */
405
- declare interface CfAIBinding {
406
- binding: string;
407
- staging?: boolean;
408
- }
409
-
410
403
  declare interface CfAnalyticsEngineDataset {
411
404
  binding: string;
412
405
  dataset?: string;
413
406
  }
414
407
 
415
- /**
416
- * A binding to a browser
417
- */
418
- declare interface CfBrowserBinding {
419
- binding: string;
420
- }
421
-
422
408
  declare type CfCapnp = {
423
409
  base_path?: never;
424
410
  source_schemas?: never;
@@ -437,20 +423,13 @@ declare interface CfConstellation {
437
423
  declare interface CfD1Database {
438
424
  binding: string;
439
425
  database_id: string;
440
- database_name?: string;
426
+ database_name: string;
441
427
  preview_database_id?: string;
442
428
  database_internal_env?: string;
443
429
  migrations_table?: string;
444
430
  migrations_dir?: string;
445
431
  }
446
432
 
447
- /**
448
- * A binding to a data blob (in service-worker format)
449
- */
450
- declare interface CfDataBlobBindings {
451
- [key: string]: string | Uint8Array;
452
- }
453
-
454
433
  declare interface CfDispatchNamespace {
455
434
  binding: string;
456
435
  namespace: string;
@@ -471,19 +450,6 @@ declare interface CfDurableObject {
471
450
  environment?: string;
472
451
  }
473
452
 
474
- declare interface CfDurableObjectMigrations {
475
- old_tag?: string;
476
- new_tag: string;
477
- steps: {
478
- new_classes?: string[];
479
- renamed_classes?: {
480
- from: string;
481
- to: string;
482
- }[];
483
- deleted_classes?: string[];
484
- }[];
485
- }
486
-
487
453
  declare interface CfHyperdrive {
488
454
  binding: string;
489
455
  id: string;
@@ -498,10 +464,6 @@ declare interface CfKvNamespace {
498
464
  id: string;
499
465
  }
500
466
 
501
- declare interface CfLogfwdr {
502
- bindings: CfLogfwdrBinding[];
503
- }
504
-
505
467
  declare interface CfLogfwdrBinding {
506
468
  name: string;
507
469
  destination: string;
@@ -562,10 +524,6 @@ declare interface CfMTlsCertificate {
562
524
  certificate_id: string;
563
525
  }
564
526
 
565
- declare interface CfPlacement {
566
- mode: "smart";
567
- }
568
-
569
527
  declare interface CfQueue {
570
528
  binding: string;
571
529
  queue_name: string;
@@ -599,18 +557,6 @@ declare interface CfService {
599
557
  entrypoint?: string;
600
558
  }
601
559
 
602
- declare interface CfTailConsumer {
603
- service: string;
604
- environment?: string;
605
- }
606
-
607
- /**
608
- * A binding to a text blob (in service-worker format)
609
- */
610
- declare interface CfTextBlobBindings {
611
- [key: string]: string;
612
- }
613
-
614
560
  declare interface CfUnsafe {
615
561
  bindings: CfUnsafeBinding[] | undefined;
616
562
  metadata: CfUnsafeMetadata | undefined;
@@ -624,98 +570,11 @@ declare interface CfUnsafeBinding {
624
570
 
625
571
  declare type CfUnsafeMetadata = Record<string, unknown>;
626
572
 
627
- declare interface CfUserLimits {
628
- cpu_ms?: number;
629
- }
630
-
631
- /**
632
- * A map of variable names to values.
633
- */
634
- declare interface CfVars {
635
- [key: string]: string | Json;
636
- }
637
-
638
573
  declare interface CfVectorize {
639
574
  binding: string;
640
575
  index_name: string;
641
576
  }
642
577
 
643
- /**
644
- * A binding to the Worker Version's metadata
645
- */
646
- declare interface CfVersionMetadataBinding {
647
- binding: string;
648
- }
649
-
650
- /**
651
- * A binding to a wasm module (in service-worker format)
652
- */
653
- declare interface CfWasmModuleBindings {
654
- [key: string]: string | Uint8Array;
655
- }
656
-
657
- /**
658
- * Options for creating a `CfWorker`.
659
- */
660
- declare interface CfWorkerInit {
661
- /**
662
- * The name of the worker.
663
- */
664
- name: string | undefined;
665
- /**
666
- * The entrypoint module.
667
- */
668
- main: CfModule;
669
- /**
670
- * The list of additional modules.
671
- */
672
- modules: CfModule[] | undefined;
673
- /**
674
- * The list of source maps to include on upload.
675
- */
676
- sourceMaps: CfWorkerSourceMap[] | undefined;
677
- /**
678
- * All the bindings
679
- */
680
- bindings: {
681
- vars: CfVars | undefined;
682
- kv_namespaces: CfKvNamespace[] | undefined;
683
- send_email: CfSendEmailBindings[] | undefined;
684
- wasm_modules: CfWasmModuleBindings | undefined;
685
- text_blobs: CfTextBlobBindings | undefined;
686
- browser: CfBrowserBinding | undefined;
687
- ai: CfAIBinding | undefined;
688
- version_metadata: CfVersionMetadataBinding | undefined;
689
- data_blobs: CfDataBlobBindings | undefined;
690
- durable_objects: {
691
- bindings: CfDurableObject[];
692
- } | undefined;
693
- queues: CfQueue[] | undefined;
694
- r2_buckets: CfR2Bucket[] | undefined;
695
- d1_databases: CfD1Database[] | undefined;
696
- vectorize: CfVectorize[] | undefined;
697
- constellation: CfConstellation[] | undefined;
698
- hyperdrive: CfHyperdrive[] | undefined;
699
- services: CfService[] | undefined;
700
- analytics_engine_datasets: CfAnalyticsEngineDataset[] | undefined;
701
- dispatch_namespaces: CfDispatchNamespace[] | undefined;
702
- mtls_certificates: CfMTlsCertificate[] | undefined;
703
- logfwdr: CfLogfwdr | undefined;
704
- unsafe: CfUnsafe | undefined;
705
- };
706
- migrations: CfDurableObjectMigrations | undefined;
707
- compatibility_date: string | undefined;
708
- compatibility_flags: string[] | undefined;
709
- usage_model: "bundled" | "unbound" | undefined;
710
- keepVars: boolean | undefined;
711
- keepSecrets: boolean | undefined;
712
- logpush: boolean | undefined;
713
- placement: CfPlacement | undefined;
714
- tail_consumers: CfTailConsumer[] | undefined;
715
- limits: CfUserLimits | undefined;
716
- annotations?: Record<string, string | undefined>;
717
- }
718
-
719
578
  declare interface CfWorkerSourceMap {
720
579
  /**
721
580
  * The name of the source map.
@@ -882,11 +741,13 @@ declare type CloudchamberConfig = {
882
741
  declare type Config = ConfigFields<DevConfig> & PagesConfigFields & Environment;
883
742
 
884
743
  declare class ConfigController extends Controller<ConfigControllerEventMap> {
885
- config?: StartDevWorkerOptions;
886
- setOptions(_: StartDevWorkerOptions): void;
887
- updateOptions(_: Partial<StartDevWorkerOptions>): void;
744
+ #private;
745
+ latestInput?: StartDevWorkerInput;
746
+ latestConfig?: StartDevWorkerOptions;
747
+ set(input: StartDevWorkerInput): Promise<StartDevWorkerOptions | undefined>;
748
+ patch(input: Partial<StartDevWorkerInput>): Promise<StartDevWorkerOptions | undefined>;
888
749
  teardown(): Promise<void>;
889
- emitConfigUpdateEvent(data: ConfigUpdateEvent): void;
750
+ emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
890
751
  }
891
752
 
892
753
  declare type ConfigControllerEventMap = ControllerEventMap & {
@@ -990,6 +851,13 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
990
851
  data_blobs: {
991
852
  [key: string]: string;
992
853
  } | undefined;
854
+ /**
855
+ * A map of module aliases. Lets you swap out a module for any others.
856
+ * Corresponds with esbuild's `alias` config
857
+ */
858
+ alias: {
859
+ [key: string]: string;
860
+ } | undefined;
993
861
  /**
994
862
  * By default, wrangler.toml is the source of truth for your environment configuration, like a terraform file.
995
863
  *
@@ -1108,8 +976,8 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1108
976
  modified_on: string;
1109
977
  short_id: string;
1110
978
  build_image_major_version: number;
1111
- kv_namespaces?: any;
1112
979
  source?: {
980
+ type: "github" | "gitlab";
1113
981
  config: {
1114
982
  owner: string;
1115
983
  repo_name: string;
@@ -1121,8 +989,8 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1121
989
  preview_branch_includes?: string[] | undefined;
1122
990
  preview_branch_excludes?: string[] | undefined;
1123
991
  };
1124
- type: "github" | "gitlab";
1125
992
  } | undefined;
993
+ kv_namespaces?: any;
1126
994
  env_vars?: any;
1127
995
  durable_object_namespaces?: any;
1128
996
  is_skipped?: boolean | undefined;
@@ -1207,17 +1075,6 @@ declare type DevToolsEvent<Method extends _EventMethods> = Method extends unknow
1207
1075
  params: _Params<ProtocolMapping.Events[Method]>;
1208
1076
  } : never;
1209
1077
 
1210
- declare interface DevWorker {
1211
- ready: Promise<void>;
1212
- config?: StartDevWorkerOptions;
1213
- setOptions(options: StartDevWorkerOptions): void;
1214
- updateOptions(options: Partial<StartDevWorkerOptions>): void;
1215
- fetch: DispatchFetch;
1216
- scheduled(cron?: string): Promise<void>;
1217
- queue(queueName: string, ...messages: unknown[]): Promise<void>;
1218
- dispose(): Promise<void>;
1219
- }
1220
-
1221
1078
  declare namespace DiagnosticsChannel {
1222
1079
  interface Request {
1223
1080
  origin?: string | URL_2;
@@ -1368,7 +1225,7 @@ declare namespace Dispatcher {
1368
1225
  path: string;
1369
1226
  method: HttpMethod;
1370
1227
  /** Default: `null` */
1371
- body?: string | Buffer | Uint8Array | Readable | null | FormData_2;
1228
+ body?: string | Buffer | Uint8Array | Readable | null | FormData;
1372
1229
  /** Default: `null` */
1373
1230
  headers?: IncomingHttpHeaders | string[] | null;
1374
1231
  /** Query string params to be embedded in the request URL. Default: `null` */
@@ -2451,11 +2308,11 @@ declare class File extends Blob_2 {
2451
2308
  readonly [Symbol.toStringTag]: string
2452
2309
  }
2453
2310
 
2454
- declare type File_2<Contents = string> = {
2455
- path: string;
2311
+ declare type File_2<Contents = string, Path = string> = {
2312
+ path: Path;
2456
2313
  } | {
2457
2314
  contents: Contents;
2458
- path?: string;
2315
+ path?: Path;
2459
2316
  };
2460
2317
 
2461
2318
  declare interface FilePropertyBag extends BlobPropertyBag {
@@ -2502,7 +2359,7 @@ declare class FileReader {
2502
2359
  /**
2503
2360
  * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
2504
2361
  */
2505
- declare class FormData_2 {
2362
+ declare class FormData {
2506
2363
  /**
2507
2364
  * Appends a new value onto an existing key inside a FormData object,
2508
2365
  * or adds the key if it does not already exist.
@@ -2567,7 +2424,7 @@ declare class FormData_2 {
2567
2424
  * Executes given callback function for each field of the FormData instance
2568
2425
  */
2569
2426
  forEach: (
2570
- callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData_2) => void,
2427
+ callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void,
2571
2428
  thisArg?: unknown
2572
2429
  ) => void
2573
2430
 
@@ -2641,7 +2498,12 @@ export declare type GetPlatformProxyOptions = {
2641
2498
  */
2642
2499
  environment?: string;
2643
2500
  /**
2644
- * The path to the config object to use (default `wrangler.toml`)
2501
+ * The path to the config file to use.
2502
+ * If no path is specified the default behavior is to search from the
2503
+ * current directory up the filesystem for a `wrangler.toml` to use.
2504
+ *
2505
+ * Note: this field is optional but if a path is specified it must
2506
+ * point to a valid file on the filesystem
2645
2507
  */
2646
2508
  configPath?: string;
2647
2509
  /**
@@ -2659,6 +2521,12 @@ export declare type GetPlatformProxyOptions = {
2659
2521
  persist?: boolean | {
2660
2522
  path: string;
2661
2523
  };
2524
+ /**
2525
+ * Use the experimental file-based dev registry for service discovery
2526
+ *
2527
+ * Note: this feature is experimental
2528
+ */
2529
+ experimentalRegistry?: boolean;
2662
2530
  };
2663
2531
 
2664
2532
  declare function getSetCookies (headers: Headers): Cookie[]
@@ -2684,7 +2552,9 @@ declare class Headers implements SpecIterable<[string, string]> {
2684
2552
 
2685
2553
  declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
2686
2554
 
2687
- declare type Hook<T extends string | number | object> = T | Promise<T> | (() => T | Promise<T>);
2555
+ declare type Hook<T extends HookValues, Args extends unknown[] = []> = T | ((...args: Args) => T);
2556
+
2557
+ declare type HookValues = string | number | boolean | object | undefined | null;
2688
2558
 
2689
2559
  /**
2690
2560
  * @property terminate Terminates HTTP server.
@@ -2727,6 +2597,7 @@ declare interface Interceptable extends Dispatcher {
2727
2597
  }
2728
2598
 
2729
2599
  declare class Logger {
2600
+ #private;
2730
2601
  constructor();
2731
2602
  loggerLevel: "error" | "none" | "warn" | "info" | "log" | "debug";
2732
2603
  columns: number;
@@ -2737,7 +2608,10 @@ declare class Logger {
2737
2608
  warn: (...args: unknown[]) => void;
2738
2609
  error: (...args: unknown[]) => void;
2739
2610
  table<Keys extends string>(data: TableRow<Keys>[]): void;
2611
+ console<M extends Exclude<keyof Console, "Console">>(method: M, ...args: Parameters<Console[M]>): void;
2740
2612
  private doLog;
2613
+ static registerBeforeLogHook(callback: (() => void) | undefined): void;
2614
+ static registerAfterLogHook(callback: (() => void) | undefined): void;
2741
2615
  private formatMessage;
2742
2616
  }
2743
2617
 
@@ -2783,6 +2657,8 @@ declare interface MIMEType {
2783
2657
  essence: string
2784
2658
  }
2785
2659
 
2660
+ declare type MiniflareWorker = Awaited<ReturnType<Miniflare["getWorker"]>>;
2661
+
2786
2662
  /** A mocked Agent class that implements the Agent API. It allows one to intercept HTTP requests made through undici and return mocked responses instead. */
2787
2663
  declare class MockAgent<TMockAgentOptions extends MockAgent.Options = MockAgent.Options> extends Dispatcher {
2788
2664
  constructor(options?: MockAgent.Options)
@@ -25534,12 +25410,12 @@ declare class ProxyController extends Controller<ProxyControllerEventMap> {
25534
25410
  ready: DeferredPromise<ReadyEvent>;
25535
25411
  proxyWorker?: Miniflare;
25536
25412
  proxyWorkerOptions?: MiniflareOptions;
25537
- inspectorProxyWorkerWebSocket?: DeferredPromise<WebSocket_2>;
25413
+ private inspectorProxyWorkerWebSocket?;
25538
25414
  protected latestConfig?: StartDevWorkerOptions;
25539
25415
  protected latestBundle?: EsbuildBundle;
25540
25416
  secret: `${string}-${string}-${string}-${string}-${string}`;
25541
25417
  protected createProxyWorker(): void;
25542
- reconnectInspectorProxyWorker(): Promise<WebSocket_2 | undefined>;
25418
+ private reconnectInspectorProxyWorker;
25543
25419
  runtimeMessageMutex: Mutex;
25544
25420
  sendMessageToProxyWorker(message: ProxyWorkerIncomingRequestBody, retries?: number): Promise<void>;
25545
25421
  sendMessageToInspectorProxyWorker(message: InspectorProxyWorkerIncomingWebSocketMessage, retries?: number): Promise<void>;
@@ -25552,7 +25428,7 @@ declare class ProxyController extends Controller<ProxyControllerEventMap> {
25552
25428
  onInspectorProxyWorkerRequest(message: InspectorProxyWorkerOutgoingRequestBody): Promise<Response_2>;
25553
25429
  _torndown: boolean;
25554
25430
  teardown(): Promise<void>;
25555
- emitReadyEvent(proxyWorker: Miniflare): void;
25431
+ emitReadyEvent(proxyWorker: Miniflare, url: URL, inspectorUrl: URL): void;
25556
25432
  emitPreviewTokenExpiredEvent(proxyData: ProxyData): void;
25557
25433
  emitErrorEvent(data: ErrorEvent): void;
25558
25434
  emitErrorEvent(reason: string, cause?: Error | SerializedError): void;
@@ -25599,6 +25475,8 @@ declare type RawDevConfig = Partial<DevConfig>;
25599
25475
  declare type ReadyEvent = {
25600
25476
  type: "ready";
25601
25477
  proxyWorker: Miniflare;
25478
+ url: URL;
25479
+ inspectorUrl: URL;
25602
25480
  };
25603
25481
 
25604
25482
  declare class RedirectHandler implements Dispatcher.DispatchHandlers{
@@ -25654,7 +25532,7 @@ declare class Request implements BodyMixin {
25654
25532
 
25655
25533
  readonly arrayBuffer: () => Promise<ArrayBuffer>
25656
25534
  readonly blob: () => Promise<Blob_2>
25657
- readonly formData: () => Promise<FormData_2>
25535
+ readonly formData: () => Promise<FormData>
25658
25536
  readonly json: () => Promise<unknown>
25659
25537
  readonly text: () => Promise<string>
25660
25538
 
@@ -25738,7 +25616,7 @@ declare class Response implements BodyMixin {
25738
25616
 
25739
25617
  readonly arrayBuffer: () => Promise<ArrayBuffer>
25740
25618
  readonly blob: () => Promise<Blob_2>
25741
- readonly formData: () => Promise<FormData_2>
25619
+ readonly formData: () => Promise<FormData>
25742
25620
  readonly json: () => Promise<unknown>
25743
25621
  readonly text: () => Promise<string>
25744
25622
 
@@ -25951,7 +25829,7 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
25951
25829
  next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
25952
25830
  }
25953
25831
 
25954
- declare interface StartDevWorkerOptions {
25832
+ declare interface StartDevWorkerInput {
25955
25833
  /** The name of the worker. */
25956
25834
  name?: string;
25957
25835
  /**
@@ -25959,27 +25837,18 @@ declare interface StartDevWorkerOptions {
25959
25837
  * This is the `main` property of a wrangler.toml.
25960
25838
  * You can specify a file path or provide the contents directly.
25961
25839
  */
25962
- script: File_2<string>;
25840
+ entrypoint?: string;
25963
25841
  /** The configuration of the worker. */
25964
- config?: File_2<Config>;
25842
+ config?: string;
25965
25843
  /** The compatibility date for the workerd runtime. */
25966
25844
  compatibilityDate?: string;
25967
25845
  /** The compatibility flags for the workerd runtime. */
25968
25846
  compatibilityFlags?: string[];
25847
+ env?: string;
25969
25848
  /** The bindings available to the worker. The specified bindind type will be exposed to the worker on the `env` object under the same key. */
25970
25849
  bindings?: Record<string, Binding>;
25971
25850
  /** The triggers which will cause the worker's exported default handlers to be called. */
25972
25851
  triggers?: Trigger[];
25973
- /** Options applying to (legacy) Worker Sites. Please consider using Cloudflare Pages. */
25974
- site?: {
25975
- path: string;
25976
- include?: string[];
25977
- exclude?: string[];
25978
- };
25979
- /** Service environments. Providing support for existing workers with this property. Don't use this for new workers. */
25980
- env?: string;
25981
- /** Wrangler environments, defaults to true. */
25982
- legacyEnv?: boolean;
25983
25852
  /**
25984
25853
  * Whether Wrangler should send usage metrics to Cloudflare for this project.
25985
25854
  *
@@ -25987,27 +25856,23 @@ declare interface StartDevWorkerOptions {
25987
25856
  * Otherwise, Wrangler will use the user's preference.
25988
25857
  */
25989
25858
  sendMetrics?: boolean;
25990
- usageModel?: "bundled" | "unbound";
25991
- _bindings?: CfWorkerInit["bindings"];
25992
- _entry?: Entry;
25993
- _projectRoot?: string;
25994
- _serveAssetsFromWorker?: boolean;
25995
- _assets?: Config["assets"];
25996
- _processEntrypoint?: boolean;
25997
- _additionalModules?: CfModule[];
25998
25859
  /** Options applying to the worker's build step. Applies to deploy and dev. */
25999
25860
  build?: {
26000
25861
  /** Whether the worker and its dependencies are bundled. Defaults to true. */
26001
25862
  bundle?: boolean;
25863
+ additionalModules?: CfModule[];
26002
25864
  findAdditionalModules?: boolean;
25865
+ processEntrypoint?: boolean;
26003
25866
  /** Specifies types of modules matched by globs. */
26004
25867
  moduleRules?: Rule[];
26005
25868
  /** Replace global identifiers with constant expressions, e.g. { debug: 'true', version: '"1.0.0"' }. Only takes effect if bundle: true. */
26006
25869
  define?: Record<string, string>;
25870
+ /** Alias modules */
25871
+ alias?: Record<string, string>;
26007
25872
  /** Whether the bundled worker is minified. Only takes effect if bundle: true. */
26008
25873
  minify?: boolean;
26009
25874
  /** Options controlling a custom build step. */
26010
- custom: {
25875
+ custom?: {
26011
25876
  /** Custom shell command to run before bundling. Runs even if bundle. */
26012
25877
  command?: string;
26013
25878
  /** The cwd to run the command in. */
@@ -26018,7 +25883,8 @@ declare interface StartDevWorkerOptions {
26018
25883
  jsxFactory?: string;
26019
25884
  jsxFragment?: string;
26020
25885
  tsconfig?: string;
26021
- nodejsCompatMode?: NodeJSCompatMode;
25886
+ nodejsCompatMode?: Hook<NodeJSCompatMode, [Config]>;
25887
+ moduleRoot?: string;
26022
25888
  };
26023
25889
  /** Options applying to the worker's development preview environment. */
26024
25890
  dev?: {
@@ -26031,11 +25897,9 @@ declare interface StartDevWorkerOptions {
26031
25897
  /** Whether the worker runs on the edge or locally. */
26032
25898
  remote?: boolean;
26033
25899
  /** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
26034
- auth?: Hook<CfAccount>;
25900
+ auth?: AsyncHook<CfAccount>;
26035
25901
  /** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. */
26036
- persist?: boolean | {
26037
- path: string;
26038
- };
25902
+ persist?: string;
26039
25903
  /** Controls which logs are logged 🤙. */
26040
25904
  logLevel?: LogLevel;
26041
25905
  /** Whether the worker server restarts upon source/config file changes. */
@@ -26059,12 +25923,40 @@ declare interface StartDevWorkerOptions {
26059
25923
  outboundService?: ServiceFetch;
26060
25924
  /** An undici MockAgent to declaratively mock fetch calls to particular resources. */
26061
25925
  mockFetch?: undici.MockAgent;
26062
- /** Gets a fetcher to a specific worker, used for multi-worker development */
26063
- getRegisteredWorker?(name: string): WorkerDefinition | undefined;
25926
+ /** Describes the registry of other Workers running locally */
25927
+ registry?: WorkerRegistry;
26064
25928
  testScheduled?: boolean;
26065
25929
  };
25930
+ legacy?: {
25931
+ site?: Hook<Config["site"], [Config]>;
25932
+ assets?: Hook<Config["assets"], [Config]>;
25933
+ enableServiceEnvironments?: boolean;
25934
+ };
25935
+ unsafe?: Omit<CfUnsafe, "bindings">;
26066
25936
  }
26067
25937
 
25938
+ declare type StartDevWorkerOptions = StartDevWorkerInput & {
25939
+ /** A worker's directory. Usually where the wrangler.toml file is located */
25940
+ directory: string;
25941
+ build: StartDevWorkerInput["build"] & {
25942
+ nodejsCompatMode: NodeJSCompatMode;
25943
+ format: CfScriptFormat;
25944
+ moduleRoot: string;
25945
+ moduleRules: Rule[];
25946
+ define: Record<string, string>;
25947
+ additionalModules: CfModule[];
25948
+ processEntrypoint: boolean;
25949
+ };
25950
+ legacy: StartDevWorkerInput["legacy"] & {
25951
+ assets?: Config["assets"];
25952
+ site?: Config["site"];
25953
+ };
25954
+ dev: StartDevWorkerInput["dev"] & {
25955
+ persist: string;
25956
+ };
25957
+ entrypoint: string;
25958
+ };
25959
+
26068
25960
  /** A faster version of `request`. */
26069
25961
  declare function stream(
26070
25962
  url: string | URL_2 | UrlObject,
@@ -26077,7 +25969,7 @@ declare type TableRow<Keys extends string> = Record<Keys, string>;
26077
25969
  declare type TailConsumer = {
26078
25970
  /** The name of the service tail events will be forwarded to. */
26079
25971
  service: string;
26080
- /** (Optional) The environt of the service. */
25972
+ /** (Optional) The environment of the service. */
26081
25973
  environment?: string;
26082
25974
  };
26083
25975
 
@@ -26114,7 +26006,9 @@ declare interface TypedEventEmitter<EventMap extends Record<string | symbol, unk
26114
26006
  prependOnceListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
26115
26007
  }
26116
26008
 
26117
- declare const TypedEventEmitterImpl: new <EventMap extends Record<string | symbol, unknown[]>>() => TypedEventEmitter<EventMap>;
26009
+ declare const TypedEventEmitterImpl: {
26010
+ new <EventMap extends Record<string | symbol, unknown[]>>(): TypedEventEmitter<EventMap>;
26011
+ };
26118
26012
 
26119
26013
  declare namespace Undici {
26120
26014
  var Dispatcher: Dispatcher
@@ -26143,7 +26037,7 @@ declare namespace Undici {
26143
26037
  var Headers: Headers;
26144
26038
  var Response: Response;
26145
26039
  var Request: Request;
26146
- var FormData: FormData_2;
26040
+ var FormData: FormData;
26147
26041
  var File: File;
26148
26042
  var FileReader: FileReader;
26149
26043
  var caches: caches;
@@ -26211,7 +26105,7 @@ declare namespace undici {
26211
26105
  ProgressEventInit,
26212
26106
  ProgressEvent,
26213
26107
  FormDataEntryValue,
26214
- FormData_2 as FormData,
26108
+ FormData,
26215
26109
  DiagnosticsChannel,
26216
26110
  BinaryType,
26217
26111
  WebSocketEventMap,
@@ -26242,7 +26136,7 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
26242
26136
  bundler: BundlerController;
26243
26137
  runtimes: RuntimeController[];
26244
26138
  proxy: ProxyController;
26245
- startWorker(options: StartDevWorkerOptions): DevWorker;
26139
+ startWorker(options: StartDevWorkerInput): Promise<Worker>;
26246
26140
  constructor({ config, bundler, runtimes, proxy, }?: {
26247
26141
  config?: ConfigController | undefined;
26248
26142
  bundler?: BundlerController | undefined;
@@ -26255,7 +26149,7 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
26255
26149
 
26256
26150
  export declare const unstable_generateASSETSBinding: (opts: UnstableASSETSBindingsOptions) => (request: Request_2) => Promise<Response_2>;
26257
26151
 
26258
- export declare function unstable_getMiniflareWorkerOptions(configPath: string, environment?: string): {
26152
+ export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string): {
26259
26153
  workerOptions: SourcelessWorkerOptions;
26260
26154
  define: Record<string, string>;
26261
26155
  main?: string;
@@ -26270,6 +26164,8 @@ export declare const unstable_pages: {
26270
26164
  */
26271
26165
  export declare function unstable_splitSqlQuery(sql: string): string[];
26272
26166
 
26167
+ export declare function unstable_startWorker(options: StartDevWorkerInput): Promise<Worker>;
26168
+
26273
26169
  export declare function unstable_startWorkerRegistryServer(port: number): Promise<{
26274
26170
  server: Server<IncomingMessage, ServerResponse>;
26275
26171
  terminator: HttpTerminator;
@@ -26349,6 +26245,7 @@ export declare interface UnstableDevOptions {
26349
26245
  testScheduled?: boolean;
26350
26246
  watch?: boolean;
26351
26247
  devEnv?: boolean;
26248
+ fileBasedRegistry?: boolean;
26352
26249
  };
26353
26250
  }
26354
26251
 
@@ -26443,6 +26340,19 @@ declare interface WebSocketInit {
26443
26340
  headers?: HeadersInit
26444
26341
  }
26445
26342
 
26343
+ declare interface Worker {
26344
+ ready: Promise<void>;
26345
+ url: Promise<URL>;
26346
+ inspectorUrl: Promise<URL>;
26347
+ config: StartDevWorkerOptions;
26348
+ setConfig: ConfigController["set"];
26349
+ patchConfig: ConfigController["patch"];
26350
+ fetch: DispatchFetch;
26351
+ scheduled: MiniflareWorker["scheduled"];
26352
+ queue: MiniflareWorker["queue"];
26353
+ dispose(): Promise<void>;
26354
+ }
26355
+
26446
26356
  declare type WorkerDefinition = {
26447
26357
  port: number | undefined;
26448
26358
  protocol: "http" | "https" | undefined;
@@ -26463,6 +26373,8 @@ declare type WorkerEntrypointsDefinition = Record<"default" | string, {
26463
26373
  port: number;
26464
26374
  } | undefined>;
26465
26375
 
26376
+ declare type WorkerRegistry = Record<string, WorkerDefinition>;
26377
+
26466
26378
  declare type ZoneIdRoute = {
26467
26379
  pattern: string;
26468
26380
  zone_id: string;