wrangler 4.62.0 → 4.64.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.
@@ -1,6 +1,6 @@
1
- import { Rule as Rule$1, CfModule, Environment as Environment$1, CfScriptFormat, CfModuleType, Config as Config$1, CfKvNamespace, CfSendEmailBindings, CfBrowserBinding, CfAIBinding, CfImagesBinding, CfDurableObject, CfWorkflow, CfQueue, CfR2Bucket, CfD1Database, CfVectorize, CfHyperdrive, CfService, CfAnalyticsEngineDataset, CfDispatchNamespace, CfMTlsCertificate, CfPipeline, CfSecretsStoreSecrets, CfLogfwdrBinding, CfHelloWorld, CfRateLimit, CfWorkerLoader, CfVpcService, CfMediaBinding, DurableObjectMigration as DurableObjectMigration$1, ContainerApp as ContainerApp$1, ZoneIdRoute as ZoneIdRoute$1, ZoneNameRoute as ZoneNameRoute$1, CustomDomainRoute as CustomDomainRoute$1, CfTailConsumer, ContainerEngine as ContainerEngine$1, CfUnsafe, ConfigBindingOptions, NormalizeAndValidateConfigArgs, ResolveConfigPathOptions, RawConfig as RawConfig$1, PackageJSON, ParseError, CfWorkerInit, ComplianceConfig, UserError, FatalError } from '@cloudflare/workers-utils';
2
- export { ConfigBindingOptions as Experimental_ConfigBindingOptions, experimental_patchConfig, experimental_readRawConfig, defaultWranglerConfig as unstable_defaultWranglerConfig } from '@cloudflare/workers-utils';
3
- import { Json as Json$1, Request, Response as Response$1, NodeJSCompatMode, DispatchFetch, Miniflare, WorkerRegistry, MiniflareOptions, Mutex, WorkerOptions, ModuleRule, RemoteProxyConnectionString } from 'miniflare';
1
+ import { Rule as Rule$1, CfModule, Environment as Environment$1, CfScriptFormat, CfModuleType, Config as Config$1, Binding, DurableObjectMigration as DurableObjectMigration$1, ContainerApp as ContainerApp$1, Trigger, CfTailConsumer, ServiceFetch, ContainerEngine as ContainerEngine$1, CfUnsafe, ConfigBindingOptions, NormalizeAndValidateConfigArgs, ResolveConfigPathOptions, RawConfig as RawConfig$1, PackageJSON, ParseError, CfWorkerInit, ComplianceConfig, UserError, FatalError } from '@cloudflare/workers-utils';
2
+ export { Binding, ConfigBindingOptions as Experimental_ConfigBindingOptions, experimental_patchConfig, experimental_readRawConfig, defaultWranglerConfig as unstable_defaultWranglerConfig } from '@cloudflare/workers-utils';
3
+ import { Json as Json$1, WorkerRegistry, Miniflare, MiniflareOptions, Mutex, Response as Response$1, NodeJSCompatMode, DispatchFetch, RemoteProxyConnectionString, WorkerOptions, ModuleRule, Request } from 'miniflare';
4
4
  import * as undici from 'undici';
5
5
  import { RequestInfo, RequestInit, Response, FormData } from 'undici';
6
6
  import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
@@ -194,13 +194,13 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
194
194
  };
195
195
  };
196
196
  latest_stage: {
197
- status: "canceled" | "active" | "idle" | "success" | "failure" | "skipped";
197
+ status: "canceled" | "active" | "success" | "idle" | "failure" | "skipped";
198
198
  name: "build" | "queued" | "deploy" | "initialize" | "clone_repo";
199
199
  started_on: string | null;
200
200
  ended_on: string | null;
201
201
  };
202
202
  stages: {
203
- status: "canceled" | "active" | "idle" | "success" | "failure" | "skipped";
203
+ status: "canceled" | "active" | "success" | "idle" | "failure" | "skipped";
204
204
  name: "build" | "queued" | "deploy" | "initialize" | "clone_repo";
205
205
  started_on: string | null;
206
206
  ended_on: string | null;
@@ -238,13 +238,6 @@ declare const unstable_pages: {
238
238
  deploy: typeof deploy;
239
239
  };
240
240
 
241
- type _Params<ParamsArray extends [unknown?]> = ParamsArray extends [infer P] ? P : undefined;
242
- type _EventMethods = keyof Protocol.Events;
243
- type DevToolsEvent<Method extends _EventMethods> = Method extends unknown ? {
244
- method: Method;
245
- params: _Params<Protocol.Events[Method]>;
246
- } : never;
247
-
248
241
  type AssetsOptions = {
249
242
  directory: string;
250
243
  binding?: string;
@@ -323,6 +316,139 @@ interface CfAccount {
323
316
  accountId: string;
324
317
  }
325
318
 
319
+ type _Params<ParamsArray extends [unknown?]> = ParamsArray extends [infer P] ? P : undefined;
320
+ type _EventMethods = keyof Protocol.Events;
321
+ type DevToolsEvent<Method extends _EventMethods> = Method extends unknown ? {
322
+ method: Method;
323
+ params: _Params<Protocol.Events[Method]>;
324
+ } : never;
325
+
326
+ type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker" | "MultiworkerRuntimeController"> | BaseErrorEvent<"ProxyController", {
327
+ config?: StartDevWorkerOptions;
328
+ bundle?: Bundle;
329
+ }> | BaseErrorEvent<"BundlerController", {
330
+ config?: StartDevWorkerOptions;
331
+ filePath?: string;
332
+ }>;
333
+ type BaseErrorEvent<Source = string, Data = undefined> = {
334
+ type: "error";
335
+ reason: string;
336
+ cause: Error | SerializedError;
337
+ source: Source;
338
+ data: Data;
339
+ };
340
+ type ConfigUpdateEvent = {
341
+ type: "configUpdate";
342
+ config: StartDevWorkerOptions;
343
+ };
344
+ type BundleStartEvent = {
345
+ type: "bundleStart";
346
+ config: StartDevWorkerOptions;
347
+ };
348
+ type BundleCompleteEvent = {
349
+ type: "bundleComplete";
350
+ config: StartDevWorkerOptions;
351
+ bundle: Bundle;
352
+ };
353
+ type ReloadStartEvent = {
354
+ type: "reloadStart";
355
+ config: StartDevWorkerOptions;
356
+ bundle: Bundle;
357
+ };
358
+ type ReloadCompleteEvent = {
359
+ type: "reloadComplete";
360
+ config: StartDevWorkerOptions;
361
+ bundle: Bundle;
362
+ proxyData: ProxyData;
363
+ };
364
+ type DevRegistryUpdateEvent = {
365
+ type: "devRegistryUpdate";
366
+ registry: WorkerRegistry;
367
+ };
368
+ type PreviewTokenExpiredEvent = {
369
+ type: "previewTokenExpired";
370
+ proxyData: ProxyData;
371
+ };
372
+ type ReadyEvent = {
373
+ type: "ready";
374
+ proxyWorker: Miniflare;
375
+ url: URL;
376
+ inspectorUrl: URL | undefined;
377
+ };
378
+ type ProxyWorkerIncomingRequestBody = {
379
+ type: "play";
380
+ proxyData: ProxyData;
381
+ } | {
382
+ type: "pause";
383
+ };
384
+ type ProxyWorkerOutgoingRequestBody = {
385
+ type: "error";
386
+ error: SerializedError;
387
+ } | {
388
+ type: "previewTokenExpired";
389
+ proxyData: ProxyData;
390
+ } | {
391
+ type: "debug-log";
392
+ args: Parameters<typeof console.debug>;
393
+ };
394
+
395
+ type InspectorProxyWorkerIncomingWebSocketMessage = {
396
+ type: ReloadStartEvent["type"];
397
+ } | {
398
+ type: ReloadCompleteEvent["type"];
399
+ proxyData: ProxyData;
400
+ };
401
+ type InspectorProxyWorkerOutgoingWebsocketMessage = DevToolsEvent<"Runtime.consoleAPICalled"> | DevToolsEvent<"Runtime.exceptionThrown">;
402
+ type InspectorProxyWorkerOutgoingRequestBody = {
403
+ type: "error";
404
+ error: SerializedError;
405
+ } | {
406
+ type: "runtime-websocket-error";
407
+ error: SerializedError;
408
+ } | {
409
+ type: "debug-log";
410
+ args: Parameters<typeof console.debug>;
411
+ } | {
412
+ type: "load-network-resource";
413
+ url: string;
414
+ };
415
+ type SerializedError = {
416
+ message: string;
417
+ name?: string;
418
+ stack?: string | undefined;
419
+ cause?: unknown;
420
+ };
421
+ type UrlOriginParts = Pick<URL, "protocol" | "hostname" | "port">;
422
+ type UrlOriginAndPathnameParts = Pick<URL, "protocol" | "hostname" | "port" | "pathname">;
423
+ type ProxyData = {
424
+ userWorkerUrl: UrlOriginParts;
425
+ userWorkerInspectorUrl?: UrlOriginAndPathnameParts;
426
+ userWorkerInnerUrlOverrides?: Partial<UrlOriginParts>;
427
+ headers: Record<string, string>;
428
+ liveReload?: boolean;
429
+ proxyLogsToController?: boolean;
430
+ };
431
+
432
+ type ControllerEvent = ErrorEvent | ConfigUpdateEvent | BundleStartEvent | BundleCompleteEvent | ReloadStartEvent | ReloadCompleteEvent | DevRegistryUpdateEvent | PreviewTokenExpiredEvent;
433
+ interface ControllerBus {
434
+ dispatch(event: ControllerEvent): void;
435
+ }
436
+ declare abstract class Controller {
437
+ #private;
438
+ protected bus: ControllerBus;
439
+ constructor(bus: ControllerBus);
440
+ teardown(): Promise<void>;
441
+ protected emitErrorEvent(event: ErrorEvent): void;
442
+ }
443
+ declare abstract class RuntimeController extends Controller {
444
+ abstract onBundleStart(_: BundleStartEvent): void;
445
+ abstract onBundleComplete(_: BundleCompleteEvent): void;
446
+ abstract onPreviewTokenExpired(_: PreviewTokenExpiredEvent): void;
447
+ protected emitReloadStartEvent(data: ReloadStartEvent): void;
448
+ protected emitReloadCompleteEvent(data: ReloadCompleteEvent): void;
449
+ protected emitDevRegistryUpdateEvent(data: DevRegistryUpdateEvent): void;
450
+ }
451
+
326
452
  declare class ConfigController extends Controller {
327
453
  #private;
328
454
  latestInput?: StartDevWorkerInput;
@@ -334,6 +460,76 @@ declare class ConfigController extends Controller {
334
460
  emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
335
461
  }
336
462
 
463
+ declare class BundlerController extends Controller {
464
+ #private;
465
+ onConfigUpdate(event: ConfigUpdateEvent): void;
466
+ teardown(): Promise<void>;
467
+ emitBundleStartEvent(config: StartDevWorkerOptions): void;
468
+ emitBundleCompleteEvent(config: StartDevWorkerOptions, bundle: EsbuildBundle): void;
469
+ }
470
+
471
+ declare class ProxyController extends Controller {
472
+ ready: DeferredPromise<ReadyEvent>;
473
+ localServerReady: DeferredPromise<void>;
474
+ proxyWorker?: Miniflare;
475
+ proxyWorkerOptions?: MiniflareOptions;
476
+ private inspectorProxyWorkerWebSocket?;
477
+ protected latestConfig?: StartDevWorkerOptions;
478
+ protected latestBundle?: EsbuildBundle;
479
+ secret: `${string}-${string}-${string}-${string}-${string}`;
480
+ protected createProxyWorker(): void;
481
+ private reconnectInspectorProxyWorker;
482
+ runtimeMessageMutex: Mutex;
483
+ sendMessageToProxyWorker(message: ProxyWorkerIncomingRequestBody, retries?: number): Promise<void>;
484
+ sendMessageToInspectorProxyWorker(message: InspectorProxyWorkerIncomingWebSocketMessage, retries?: number): Promise<void>;
485
+ get inspectorEnabled(): boolean;
486
+ onConfigUpdate(data: ConfigUpdateEvent): void;
487
+ onBundleStart(data: BundleStartEvent): void;
488
+ onReloadStart(data: ReloadStartEvent): void;
489
+ onReloadComplete(data: ReloadCompleteEvent): void;
490
+ onProxyWorkerMessage(message: ProxyWorkerOutgoingRequestBody): void;
491
+ onInspectorProxyWorkerMessage(message: InspectorProxyWorkerOutgoingWebsocketMessage): void;
492
+ onInspectorProxyWorkerRequest(message: InspectorProxyWorkerOutgoingRequestBody): Promise<Response$1>;
493
+ _torndown: boolean;
494
+ teardown(): Promise<void>;
495
+ emitReadyEvent(proxyWorker: Miniflare, url: URL, inspectorUrl: URL | undefined): void;
496
+ emitPreviewTokenExpiredEvent(proxyData: ProxyData): void;
497
+ emitErrorEvent(data: ErrorEvent): void;
498
+ emitErrorEvent(reason: string, cause?: Error | SerializedError): void;
499
+ }
500
+
501
+ type ControllerFactory<C extends Controller> = (devEnv: DevEnv) => C;
502
+ declare class DevEnv extends EventEmitter implements ControllerBus {
503
+ config: ConfigController;
504
+ bundler: BundlerController;
505
+ runtimes: RuntimeController[];
506
+ proxy: ProxyController;
507
+ startWorker(options: StartDevWorkerInput): Promise<Worker>;
508
+ constructor({ configFactory, bundlerFactory, runtimeFactories, proxyFactory, }?: {
509
+ configFactory?: ControllerFactory<ConfigController>;
510
+ bundlerFactory?: ControllerFactory<BundlerController>;
511
+ runtimeFactories?: ControllerFactory<RuntimeController>[];
512
+ proxyFactory?: ControllerFactory<ProxyController>;
513
+ });
514
+ /**
515
+ * Central message bus dispatch method.
516
+ * All events from controllers flow through here, making the event routing explicit and traceable.
517
+ *
518
+ * Event flow:
519
+ * - ConfigController emits configUpdate → BundlerController, ProxyController
520
+ * - BundlerController emits bundleStart → ProxyController, RuntimeControllers
521
+ * - BundlerController emits bundleComplete → RuntimeControllers
522
+ * - RuntimeController emits reloadStart → ProxyController
523
+ * - RuntimeController emits reloadComplete → ProxyController
524
+ * - RuntimeController emits devRegistryUpdate → ConfigController
525
+ * - ProxyController emits previewTokenExpired → RuntimeControllers
526
+ * - Any controller emits error → DevEnv error handler
527
+ */
528
+ dispatch(event: ControllerEvent): void;
529
+ private handleErrorEvent;
530
+ teardown(): Promise<void>;
531
+ }
532
+
337
533
  type MiniflareWorker = Awaited<ReturnType<Miniflare["getWorker"]>>;
338
534
  interface Worker {
339
535
  ready: Promise<void>;
@@ -521,241 +717,6 @@ type Hook<T extends HookValues, Args extends unknown[] = []> = T | ((...args: Ar
521
717
  type AsyncHook<T extends HookValues, Args extends unknown[] = []> = Hook<T, Args> | Hook<Promise<T>, Args>;
522
718
  type Bundle = EsbuildBundle;
523
719
  type LogLevel = "debug" | "info" | "log" | "warn" | "error" | "none";
524
- type File<Contents = string, Path = string> = {
525
- path: Path;
526
- } | {
527
- contents: Contents;
528
- path?: Path;
529
- };
530
- type BinaryFile = File<Uint8Array>;
531
- type QueueConsumer = NonNullable<Config$1["queues"]["consumers"]>[number];
532
- type Trigger = {
533
- type: "workers.dev";
534
- } | {
535
- type: "route";
536
- pattern: string;
537
- } | ({
538
- type: "route";
539
- } & ZoneIdRoute$1) | ({
540
- type: "route";
541
- } & ZoneNameRoute$1) | ({
542
- type: "route";
543
- } & CustomDomainRoute$1) | {
544
- type: "cron";
545
- cron: string;
546
- } | ({
547
- type: "queue-consumer";
548
- } & QueueConsumer);
549
- type BindingOmit<T> = Omit<T, "binding">;
550
- type NameOmit<T> = Omit<T, "name">;
551
- type Binding = {
552
- type: "plain_text";
553
- value: string;
554
- } | {
555
- type: "json";
556
- value: Json$1;
557
- } | ({
558
- type: "kv_namespace";
559
- } & BindingOmit<CfKvNamespace>) | ({
560
- type: "send_email";
561
- } & NameOmit<CfSendEmailBindings>) | {
562
- type: "wasm_module";
563
- source: BinaryFile;
564
- } | {
565
- type: "text_blob";
566
- source: File;
567
- } | ({
568
- type: "browser";
569
- } & BindingOmit<CfBrowserBinding>) | ({
570
- type: "ai";
571
- } & BindingOmit<CfAIBinding>) | ({
572
- type: "images";
573
- } & BindingOmit<CfImagesBinding>) | {
574
- type: "version_metadata";
575
- } | {
576
- type: "data_blob";
577
- source: BinaryFile;
578
- } | ({
579
- type: "durable_object_namespace";
580
- } & NameOmit<CfDurableObject>) | ({
581
- type: "workflow";
582
- } & BindingOmit<CfWorkflow>) | ({
583
- type: "queue";
584
- } & BindingOmit<CfQueue>) | ({
585
- type: "r2_bucket";
586
- } & BindingOmit<CfR2Bucket>) | ({
587
- type: "d1";
588
- } & BindingOmit<CfD1Database>) | ({
589
- type: "vectorize";
590
- } & BindingOmit<CfVectorize>) | ({
591
- type: "hyperdrive";
592
- } & BindingOmit<CfHyperdrive>) | ({
593
- type: "service";
594
- } & BindingOmit<CfService>) | {
595
- type: "fetcher";
596
- fetcher: ServiceFetch;
597
- } | ({
598
- type: "analytics_engine";
599
- } & BindingOmit<CfAnalyticsEngineDataset>) | ({
600
- type: "dispatch_namespace";
601
- } & BindingOmit<CfDispatchNamespace>) | ({
602
- type: "mtls_certificate";
603
- } & BindingOmit<CfMTlsCertificate>) | ({
604
- type: "pipeline";
605
- } & BindingOmit<CfPipeline>) | ({
606
- type: "secrets_store_secret";
607
- } & BindingOmit<CfSecretsStoreSecrets>) | ({
608
- type: "logfwdr";
609
- } & NameOmit<CfLogfwdrBinding>) | ({
610
- type: "unsafe_hello_world";
611
- } & BindingOmit<CfHelloWorld>) | ({
612
- type: "ratelimit";
613
- } & NameOmit<CfRateLimit>) | ({
614
- type: "worker_loader";
615
- } & BindingOmit<CfWorkerLoader>) | ({
616
- type: "vpc_service";
617
- } & BindingOmit<CfVpcService>) | ({
618
- type: "media";
619
- } & BindingOmit<CfMediaBinding>) | {
620
- type: `unsafe_${string}`;
621
- } | {
622
- type: "assets";
623
- };
624
- type ServiceFetch = (request: Request) => Promise<Response$1> | Response$1;
625
-
626
- type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker" | "MultiworkerRuntimeController"> | BaseErrorEvent<"ProxyController", {
627
- config?: StartDevWorkerOptions;
628
- bundle?: Bundle;
629
- }> | BaseErrorEvent<"BundlerController", {
630
- config?: StartDevWorkerOptions;
631
- filePath?: string;
632
- }>;
633
- type BaseErrorEvent<Source = string, Data = undefined> = {
634
- type: "error";
635
- reason: string;
636
- cause: Error | SerializedError;
637
- source: Source;
638
- data: Data;
639
- };
640
- type ConfigUpdateEvent = {
641
- type: "configUpdate";
642
- config: StartDevWorkerOptions;
643
- };
644
- type BundleStartEvent = {
645
- type: "bundleStart";
646
- config: StartDevWorkerOptions;
647
- };
648
- type BundleCompleteEvent = {
649
- type: "bundleComplete";
650
- config: StartDevWorkerOptions;
651
- bundle: Bundle;
652
- };
653
- type ReloadStartEvent = {
654
- type: "reloadStart";
655
- config: StartDevWorkerOptions;
656
- bundle: Bundle;
657
- };
658
- type ReloadCompleteEvent = {
659
- type: "reloadComplete";
660
- config: StartDevWorkerOptions;
661
- bundle: Bundle;
662
- proxyData: ProxyData;
663
- };
664
- type DevRegistryUpdateEvent = {
665
- type: "devRegistryUpdate";
666
- registry: WorkerRegistry;
667
- };
668
- type PreviewTokenExpiredEvent = {
669
- type: "previewTokenExpired";
670
- proxyData: ProxyData;
671
- };
672
- type ReadyEvent = {
673
- type: "ready";
674
- proxyWorker: Miniflare;
675
- url: URL;
676
- inspectorUrl: URL | undefined;
677
- };
678
- type ProxyWorkerIncomingRequestBody = {
679
- type: "play";
680
- proxyData: ProxyData;
681
- } | {
682
- type: "pause";
683
- };
684
- type ProxyWorkerOutgoingRequestBody = {
685
- type: "error";
686
- error: SerializedError;
687
- } | {
688
- type: "previewTokenExpired";
689
- proxyData: ProxyData;
690
- } | {
691
- type: "debug-log";
692
- args: Parameters<typeof console.debug>;
693
- };
694
-
695
- type InspectorProxyWorkerIncomingWebSocketMessage = {
696
- type: ReloadStartEvent["type"];
697
- } | {
698
- type: ReloadCompleteEvent["type"];
699
- proxyData: ProxyData;
700
- };
701
- type InspectorProxyWorkerOutgoingWebsocketMessage = DevToolsEvent<"Runtime.consoleAPICalled"> | DevToolsEvent<"Runtime.exceptionThrown">;
702
- type InspectorProxyWorkerOutgoingRequestBody = {
703
- type: "error";
704
- error: SerializedError;
705
- } | {
706
- type: "runtime-websocket-error";
707
- error: SerializedError;
708
- } | {
709
- type: "debug-log";
710
- args: Parameters<typeof console.debug>;
711
- } | {
712
- type: "load-network-resource";
713
- url: string;
714
- };
715
- type SerializedError = {
716
- message: string;
717
- name?: string;
718
- stack?: string | undefined;
719
- cause?: unknown;
720
- };
721
- type UrlOriginParts = Pick<URL, "protocol" | "hostname" | "port">;
722
- type UrlOriginAndPathnameParts = Pick<URL, "protocol" | "hostname" | "port" | "pathname">;
723
- type ProxyData = {
724
- userWorkerUrl: UrlOriginParts;
725
- userWorkerInspectorUrl?: UrlOriginAndPathnameParts;
726
- userWorkerInnerUrlOverrides?: Partial<UrlOriginParts>;
727
- headers: Record<string, string>;
728
- liveReload?: boolean;
729
- proxyLogsToController?: boolean;
730
- };
731
-
732
- type ControllerEvent = ErrorEvent | ConfigUpdateEvent | BundleStartEvent | BundleCompleteEvent | ReloadStartEvent | ReloadCompleteEvent | DevRegistryUpdateEvent | PreviewTokenExpiredEvent;
733
- interface ControllerBus {
734
- dispatch(event: ControllerEvent): void;
735
- }
736
- declare abstract class Controller {
737
- #private;
738
- protected bus: ControllerBus;
739
- constructor(bus: ControllerBus);
740
- teardown(): Promise<void>;
741
- protected emitErrorEvent(event: ErrorEvent): void;
742
- }
743
- declare abstract class RuntimeController extends Controller {
744
- abstract onBundleStart(_: BundleStartEvent): void;
745
- abstract onBundleComplete(_: BundleCompleteEvent): void;
746
- abstract onPreviewTokenExpired(_: PreviewTokenExpiredEvent): void;
747
- protected emitReloadStartEvent(data: ReloadStartEvent): void;
748
- protected emitReloadCompleteEvent(data: ReloadCompleteEvent): void;
749
- protected emitDevRegistryUpdateEvent(data: DevRegistryUpdateEvent): void;
750
- }
751
-
752
- declare class BundlerController extends Controller {
753
- #private;
754
- onConfigUpdate(event: ConfigUpdateEvent): void;
755
- teardown(): Promise<void>;
756
- emitBundleStartEvent(config: StartDevWorkerOptions): void;
757
- emitBundleCompleteEvent(config: StartDevWorkerOptions, bundle: EsbuildBundle): void;
758
- }
759
720
 
760
721
  type MaybePromise<T> = T | Promise<T>;
761
722
  type DeferredPromise<T> = {
@@ -765,68 +726,6 @@ type DeferredPromise<T> = {
765
726
  };
766
727
  declare function convertConfigBindingsToStartWorkerBindings(configBindings: ConfigBindingOptions): StartDevWorkerOptions["bindings"];
767
728
 
768
- declare class ProxyController extends Controller {
769
- ready: DeferredPromise<ReadyEvent>;
770
- localServerReady: DeferredPromise<void>;
771
- proxyWorker?: Miniflare;
772
- proxyWorkerOptions?: MiniflareOptions;
773
- private inspectorProxyWorkerWebSocket?;
774
- protected latestConfig?: StartDevWorkerOptions;
775
- protected latestBundle?: EsbuildBundle;
776
- secret: `${string}-${string}-${string}-${string}-${string}`;
777
- protected createProxyWorker(): void;
778
- private reconnectInspectorProxyWorker;
779
- runtimeMessageMutex: Mutex;
780
- sendMessageToProxyWorker(message: ProxyWorkerIncomingRequestBody, retries?: number): Promise<void>;
781
- sendMessageToInspectorProxyWorker(message: InspectorProxyWorkerIncomingWebSocketMessage, retries?: number): Promise<void>;
782
- get inspectorEnabled(): boolean;
783
- onConfigUpdate(data: ConfigUpdateEvent): void;
784
- onBundleStart(data: BundleStartEvent): void;
785
- onReloadStart(data: ReloadStartEvent): void;
786
- onReloadComplete(data: ReloadCompleteEvent): void;
787
- onProxyWorkerMessage(message: ProxyWorkerOutgoingRequestBody): void;
788
- onInspectorProxyWorkerMessage(message: InspectorProxyWorkerOutgoingWebsocketMessage): void;
789
- onInspectorProxyWorkerRequest(message: InspectorProxyWorkerOutgoingRequestBody): Promise<Response$1>;
790
- _torndown: boolean;
791
- teardown(): Promise<void>;
792
- emitReadyEvent(proxyWorker: Miniflare, url: URL, inspectorUrl: URL | undefined): void;
793
- emitPreviewTokenExpiredEvent(proxyData: ProxyData): void;
794
- emitErrorEvent(data: ErrorEvent): void;
795
- emitErrorEvent(reason: string, cause?: Error | SerializedError): void;
796
- }
797
-
798
- type ControllerFactory<C extends Controller> = (devEnv: DevEnv) => C;
799
- declare class DevEnv extends EventEmitter implements ControllerBus {
800
- config: ConfigController;
801
- bundler: BundlerController;
802
- runtimes: RuntimeController[];
803
- proxy: ProxyController;
804
- startWorker(options: StartDevWorkerInput): Promise<Worker>;
805
- constructor({ configFactory, bundlerFactory, runtimeFactories, proxyFactory, }?: {
806
- configFactory?: ControllerFactory<ConfigController>;
807
- bundlerFactory?: ControllerFactory<BundlerController>;
808
- runtimeFactories?: ControllerFactory<RuntimeController>[];
809
- proxyFactory?: ControllerFactory<ProxyController>;
810
- });
811
- /**
812
- * Central message bus dispatch method.
813
- * All events from controllers flow through here, making the event routing explicit and traceable.
814
- *
815
- * Event flow:
816
- * - ConfigController emits configUpdate → BundlerController, ProxyController
817
- * - BundlerController emits bundleStart → ProxyController, RuntimeControllers
818
- * - BundlerController emits bundleComplete → RuntimeControllers
819
- * - RuntimeController emits reloadStart → ProxyController
820
- * - RuntimeController emits reloadComplete → ProxyController
821
- * - RuntimeController emits devRegistryUpdate → ConfigController
822
- * - ProxyController emits previewTokenExpired → RuntimeControllers
823
- * - Any controller emits error → DevEnv error handler
824
- */
825
- dispatch(event: ControllerEvent): void;
826
- private handleErrorEvent;
827
- teardown(): Promise<void>;
828
- }
829
-
830
729
  declare function startWorker(options: StartDevWorkerInput): Promise<Worker>;
831
730
 
832
731
  type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {
@@ -2465,9 +2364,18 @@ interface EnvironmentMap {
2465
2364
  */
2466
2365
  declare function getVarsForDev(configPath: string | undefined, envFiles: string[] | undefined, vars: Config$1["vars"], env: string | undefined, silent?: boolean): Config$1["vars"];
2467
2366
 
2367
+ /** Makes a subset of properties in a type optional
2368
+ *
2369
+ * @example
2370
+ * - type A = { s: string, b: boolean, n: number }
2371
+ * - Optional<A, 'b'|'n'> = { s: string, b?: boolean, n?: number }
2372
+ */
2373
+ type Optional<T, K extends keyof T> = Omit<T, K> & Pick<Partial<T>, K>;
2374
+
2468
2375
  type FrameworkInfo = {
2469
2376
  id: string;
2470
2377
  name: string;
2378
+ class: typeof Framework;
2471
2379
  };
2472
2380
 
2473
2381
  type ConfigurationOptions = {
@@ -2492,14 +2400,14 @@ type ConfigurationResults = {
2492
2400
  declare abstract class Framework {
2493
2401
  readonly id: string;
2494
2402
  readonly name: string;
2495
- constructor(frameworkInfo: FrameworkInfo);
2403
+ constructor(frameworkInfo: Pick<FrameworkInfo, "id" | "name">);
2496
2404
  isConfigured(_projectPath: string): boolean;
2497
2405
  abstract configure(options: ConfigurationOptions): Promise<ConfigurationResults> | ConfigurationResults;
2498
2406
  configurationDescription?: string;
2499
2407
  autoConfigSupported: boolean;
2500
2408
  }
2501
2409
 
2502
- type AutoConfigDetails = {
2410
+ type AutoConfigDetailsBase = {
2503
2411
  /** The name of the worker */
2504
2412
  workerName: string;
2505
2413
  /** The path to the project (defaults to cwd) */
@@ -2508,13 +2416,20 @@ type AutoConfigDetails = {
2508
2416
  packageJson?: PackageJSON;
2509
2417
  /** Whether the project is already configured (no autoconfig required) */
2510
2418
  configured: boolean;
2511
- /** Details about the detected framework (if any) */
2512
- framework?: Framework;
2419
+ /** Details about the detected framework. It can be a JS framework or 'Static' if no actual JS framework is used. */
2420
+ framework: Framework;
2513
2421
  /** The build command used to build the project (if any) */
2514
2422
  buildCommand?: string;
2515
2423
  /** The output directory (if no framework is used, points to the raw asset files) */
2516
- outputDir?: string;
2424
+ outputDir: string;
2517
2425
  };
2426
+ type AutoConfigDetailsForConfiguredProject = Optional<AutoConfigDetailsBase, "framework" | "outputDir"> & {
2427
+ configured: true;
2428
+ };
2429
+ type AutoConfigDetailsForNonConfiguredProject = AutoConfigDetailsBase & {
2430
+ configured: false;
2431
+ };
2432
+ type AutoConfigDetails = AutoConfigDetailsForConfiguredProject | AutoConfigDetailsForNonConfiguredProject;
2518
2433
  type AutoConfigOptions = {
2519
2434
  /** Whether to run autoconfig without actually applying any filesystem modification (default: false) */
2520
2435
  dryRun?: boolean;
@@ -2774,10 +2689,7 @@ declare class Logger {
2774
2689
  private formatMessage;
2775
2690
  }
2776
2691
 
2777
- /**
2778
- * Print all the bindings a worker using a given config would have access to
2779
- */
2780
- declare function printBindings(bindings: Partial<CfWorkerInit["bindings"]>, tailConsumers?: CfTailConsumer[], streamingTailConsumers?: CfTailConsumer[], containers?: ContainerApp$1[], context?: {
2692
+ type PrintContext = {
2781
2693
  log?: (message: string) => void;
2782
2694
  registry?: WorkerRegistry | null;
2783
2695
  local?: boolean;
@@ -2786,7 +2698,12 @@ declare function printBindings(bindings: Partial<CfWorkerInit["bindings"]>, tail
2786
2698
  name?: string;
2787
2699
  provisioning?: boolean;
2788
2700
  warnIfNoBindings?: boolean;
2789
- }): void;
2701
+ unsafeMetadata?: Record<string, unknown>;
2702
+ };
2703
+ /**
2704
+ * Print all the bindings a worker using a given config would have access to
2705
+ */
2706
+ declare function printBindings(bindings: Partial<CfWorkerInit["bindings"]>, tailConsumers?: CfTailConsumer[], streamingTailConsumers?: CfTailConsumer[], containers?: ContainerApp$1[], context?: Omit<PrintContext, "unsafeMetadata">): void;
2790
2707
 
2791
2708
  /**
2792
2709
  * Split an SQLQuery into an array of statements
@@ -3153,11 +3070,18 @@ declare function experimental_getWranglerCommands(): {
3153
3070
  globalFlags: ReturnType<typeof createCLIParser>["globalFlags"];
3154
3071
  };
3155
3072
 
3073
+ /**
3074
+ * This file contains:
3075
+ *
3076
+ * - The main entrypoint for the CLI, which calls `main()` from `index.ts`.
3077
+ * - The exports for the public API of the package.
3078
+ */
3079
+
3156
3080
  interface Unstable_ASSETSBindingsOptions {
3157
3081
  log: Logger;
3158
3082
  proxyPort?: number;
3159
3083
  directory?: string;
3160
3084
  }
3161
- declare const generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
3085
+ declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
3162
3086
 
3163
- export { type Binding, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, Framework as experimental_AutoConfigFramework, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, generateASSETSBinding as unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, getDurableObjectClassNameToUseSQLiteMap as unstable_getDurableObjectClassNameToUseSQLiteMap, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, getWorkerNameFromProject as unstable_getWorkerNameFromProject, unstable_pages, printBindings as unstable_printBindings, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
3087
+ export { type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, Framework as experimental_AutoConfigFramework, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, getDurableObjectClassNameToUseSQLiteMap as unstable_getDurableObjectClassNameToUseSQLiteMap, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, getWorkerNameFromProject as unstable_getWorkerNameFromProject, unstable_pages, printBindings as unstable_printBindings, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };