wrangler 4.99.0 → 4.100.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, Entry, CfModuleType, ApiCredentials, Config as Config$1, Binding, DurableObjectMigration as DurableObjectMigration$1, ContainerApp as ContainerApp$1, Trigger, CfTailConsumer, ServiceFetch, ContainerEngine as ContainerEngine$1, CfUnsafe, CfScriptFormat, AssetsOptions as AssetsOptions$1, ConfigBindingFieldName, RawConfig as RawConfig$1, NormalizeAndValidateConfigArgs, ResolveConfigPathOptions, PackageJSON, ParseError, ComplianceConfig, UserError, FatalError } from '@cloudflare/workers-utils';
1
+ import { Rule as Rule$1, CfModule, Environment as Environment$1, Entry, CfModuleType, StartDevWorkerInput, NodeJSCompatMode, CfScriptFormat, Config as Config$1, AsyncHook, CfAccount as CfAccount$1, AssetsOptions as AssetsOptions$1, Binding, ConfigBindingFieldName, RawConfig as RawConfig$1, NormalizeAndValidateConfigArgs, ResolveConfigPathOptions, PackageJSON, ApiCredentials, ParseError, LoggerLevel, ComplianceConfig, UserError, FatalError } from '@cloudflare/workers-utils';
2
2
  export { Binding, 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, WorkerdStructuredLog, DispatchFetch, RemoteProxyConnectionString, WorkerOptions, ModuleRule, Request } from 'miniflare';
3
+ import { Json as Json$1, WorkerdStructuredLog, DispatchFetch, Miniflare, WorkerRegistry, MiniflareOptions, Mutex, Response as Response$1, 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 { Metafile } from 'esbuild';
@@ -9,6 +9,7 @@ import { EventEmitter } from 'node:events';
9
9
  import { ContainerNormalizedConfig } from '@cloudflare/containers-shared';
10
10
  import { FetcherScheduledOptions, FetcherScheduledResult, IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
11
11
  import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
12
+ export { printBindings as unstable_printBindings } from '@cloudflare/deploy-helpers';
12
13
  import { URLSearchParams } from 'node:url';
13
14
  import { Argv, PositionalOptions, Options, ArgumentsCamelCase, InferredOptionTypes, InferredOptionType } from 'yargs';
14
15
  import Cloudflare from 'cloudflare';
@@ -168,8 +169,8 @@ interface PagesDeployOptions {
168
169
  */
169
170
  declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, sourceMaps, args, }: PagesDeployOptions): Promise<{
170
171
  deploymentResponse: {
171
- url: string;
172
172
  id: string;
173
+ url: string;
173
174
  environment: "production" | "preview";
174
175
  build_config: {
175
176
  build_command: string;
@@ -192,14 +193,14 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
192
193
  };
193
194
  };
194
195
  latest_stage: {
195
- status: "skipped" | "active" | "canceled" | "idle" | "success" | "failure";
196
- name: "build" | "queued" | "deploy" | "initialize" | "clone_repo";
196
+ status: "skipped" | "active" | "canceled" | "success" | "idle" | "failure";
197
+ name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
197
198
  started_on: string | null;
198
199
  ended_on: string | null;
199
200
  };
200
201
  stages: {
201
- status: "skipped" | "active" | "canceled" | "idle" | "success" | "failure";
202
- name: "build" | "queued" | "deploy" | "initialize" | "clone_repo";
202
+ status: "skipped" | "active" | "canceled" | "success" | "idle" | "failure";
203
+ name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
203
204
  started_on: string | null;
204
205
  ended_on: string | null;
205
206
  }[];
@@ -303,6 +304,13 @@ type Experimental_GenerateTypesResult = GenerateTypesResult;
303
304
  */
304
305
  declare function generateTypes(options: Experimental_GenerateTypesOptions): Promise<Experimental_GenerateTypesResult>;
305
306
 
307
+ type _Params<ParamsArray extends [unknown?]> = ParamsArray extends [infer P] ? P : undefined;
308
+ type _EventMethods = keyof Protocol.Events;
309
+ type DevToolsEvent<Method extends _EventMethods> = Method extends unknown ? {
310
+ method: Method;
311
+ params: _Params<Protocol.Events[Method]>;
312
+ } : never;
313
+
306
314
  /**
307
315
  * Information about Wrangler's bundling process that needs passed through
308
316
  * for DevTools sourcemap transformation
@@ -324,28 +332,64 @@ type EsbuildBundle = {
324
332
  sourceMapMetadata: SourceMapMetadata | undefined;
325
333
  };
326
334
 
327
- /**
328
- * A Cloudflare account.
329
- */
330
- interface CfAccount {
331
- /**
332
- * An API token.
333
- *
334
- * @link https://api.cloudflare.com/#user-api-tokens-properties
335
- */
336
- apiToken: ApiCredentials;
337
- /**
338
- * An account ID.
339
- */
340
- accountId: string;
335
+ declare class ConfigController extends Controller {
336
+ #private;
337
+ latestInput?: StartDevWorkerInput;
338
+ latestConfig?: StartDevWorkerOptions;
339
+ set(input: StartDevWorkerInput, throwErrors?: boolean): Promise<StartDevWorkerOptions | undefined>;
340
+ patch(input: Partial<StartDevWorkerInput>): Promise<StartDevWorkerOptions | undefined>;
341
+ onDevRegistryUpdate(event: DevRegistryUpdateEvent): void;
342
+ teardown(): Promise<void>;
343
+ emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
341
344
  }
342
345
 
343
- type _Params<ParamsArray extends [unknown?]> = ParamsArray extends [infer P] ? P : undefined;
344
- type _EventMethods = keyof Protocol.Events;
345
- type DevToolsEvent<Method extends _EventMethods> = Method extends unknown ? {
346
- method: Method;
347
- params: _Params<Protocol.Events[Method]>;
348
- } : never;
346
+ type MiniflareWorker = Awaited<ReturnType<Miniflare["getWorker"]>>;
347
+ interface Worker {
348
+ ready: Promise<void>;
349
+ url: Promise<URL>;
350
+ inspectorUrl: Promise<URL | undefined>;
351
+ config: StartDevWorkerOptions;
352
+ setConfig: ConfigController["set"];
353
+ patchConfig: ConfigController["patch"];
354
+ fetch: DispatchFetch;
355
+ scheduled: MiniflareWorker["scheduled"];
356
+ queue: MiniflareWorker["queue"];
357
+ dispose(): Promise<void>;
358
+ raw: DevEnv;
359
+ }
360
+ type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets" | "config" | "containers" | "dev"> & {
361
+ /** The configuration path of the worker */
362
+ config?: string;
363
+ /** A worker's directory. Usually where the Wrangler configuration file is located */
364
+ projectRoot: string;
365
+ build: StartDevWorkerInput["build"] & {
366
+ nodejsCompatMode: NodeJSCompatMode;
367
+ format: CfScriptFormat;
368
+ moduleRoot: string;
369
+ moduleRules: Rule$1[];
370
+ define: Record<string, string>;
371
+ additionalModules: CfModule[];
372
+ exports: string[];
373
+ processEntrypoint: boolean;
374
+ };
375
+ legacy: StartDevWorkerInput["legacy"] & {
376
+ site?: Config$1["site"];
377
+ };
378
+ dev: StartDevWorkerInput["dev"] & {
379
+ persist: string | false;
380
+ auth?: AsyncHook<CfAccount$1>;
381
+ /** Handles structured runtime logs. */
382
+ structuredLogsHandler?: (log: WorkerdStructuredLog) => void;
383
+ /** An undici MockAgent to declaratively mock fetch calls to particular resources. */
384
+ mockFetch?: undici.MockAgent;
385
+ };
386
+ entrypoint: string;
387
+ assets?: AssetsOptions$1;
388
+ containers?: ContainerNormalizedConfig[];
389
+ name: string;
390
+ complianceRegion: Config$1["compliance_region"];
391
+ };
392
+ type Bundle = EsbuildBundle;
349
393
 
350
394
  type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker" | "MultiworkerRuntimeController"> | BaseErrorEvent<"ProxyController", {
351
395
  config?: StartDevWorkerOptions;
@@ -476,17 +520,6 @@ declare abstract class RuntimeController extends Controller {
476
520
  protected emitDevRegistryUpdateEvent(data: DevRegistryUpdateEvent): void;
477
521
  }
478
522
 
479
- declare class ConfigController extends Controller {
480
- #private;
481
- latestInput?: StartDevWorkerInput;
482
- latestConfig?: StartDevWorkerOptions;
483
- set(input: StartDevWorkerInput, throwErrors?: boolean): Promise<StartDevWorkerOptions | undefined>;
484
- patch(input: Partial<StartDevWorkerInput>): Promise<StartDevWorkerOptions | undefined>;
485
- onDevRegistryUpdate(event: DevRegistryUpdateEvent): void;
486
- teardown(): Promise<void>;
487
- emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
488
- }
489
-
490
523
  declare class BundlerController extends Controller {
491
524
  #private;
492
525
  onConfigUpdate(event: ConfigUpdateEvent): void;
@@ -495,6 +528,13 @@ declare class BundlerController extends Controller {
495
528
  emitBundleCompleteEvent(config: StartDevWorkerOptions, bundle: EsbuildBundle): void;
496
529
  }
497
530
 
531
+ type MaybePromise<T> = T | Promise<T>;
532
+ type DeferredPromise<T> = {
533
+ promise: Promise<T>;
534
+ resolve: (_: MaybePromise<T>) => void;
535
+ reject: (_: Error) => void;
536
+ };
537
+
498
538
  declare class ProxyController extends Controller {
499
539
  ready: DeferredPromise<ReadyEvent>;
500
540
  localServerReady: DeferredPromise<void>;
@@ -561,219 +601,131 @@ declare class DevEnv extends EventEmitter implements ControllerBus {
561
601
  teardown(): Promise<void>;
562
602
  }
563
603
 
564
- type MiniflareWorker = Awaited<ReturnType<Miniflare["getWorker"]>>;
565
- interface Worker {
566
- ready: Promise<void>;
567
- url: Promise<URL>;
568
- inspectorUrl: Promise<URL | undefined>;
569
- config: StartDevWorkerOptions;
570
- setConfig: ConfigController["set"];
571
- patchConfig: ConfigController["patch"];
572
- fetch: DispatchFetch;
573
- scheduled: MiniflareWorker["scheduled"];
574
- queue: MiniflareWorker["queue"];
575
- dispose(): Promise<void>;
576
- raw: DevEnv;
577
- }
578
- interface StartDevWorkerInput {
579
- /** The name of the worker. */
580
- name?: string;
581
- /**
582
- * The javascript or typescript entry-point of the worker.
583
- * This is the `main` property of a Wrangler configuration file.
584
- */
585
- entrypoint?: string;
586
- /** The configuration path of the worker, or a normalized configuration object. */
587
- config?: string | Config$1;
588
- /** The compatibility date for the workerd runtime. */
589
- compatibilityDate?: string;
590
- /** The compatibility flags for the workerd runtime. */
591
- compatibilityFlags?: string[];
592
- /** Specify the compliance region mode of the Worker. */
593
- complianceRegion?: Config$1["compliance_region"];
594
- /** Configuration for Python modules. */
595
- pythonModules?: {
596
- /** A list of glob patterns to exclude files from the python_modules directory when bundling. */
597
- exclude?: string[];
604
+ declare function startWorker(options: StartDevWorkerInput): Promise<Worker>;
605
+
606
+ declare const dev: {
607
+ args: {
608
+ v: boolean | undefined;
609
+ cwd: string | undefined;
610
+ config: string | undefined;
611
+ env: string | undefined;
612
+ envFile: string[] | undefined;
613
+ experimentalProvision: boolean | undefined;
614
+ experimentalAutoCreate: boolean;
615
+ installSkills: boolean;
616
+ script: string | undefined;
617
+ name: string | undefined;
618
+ compatibilityDate: string | undefined;
619
+ compatibilityFlags: string[] | undefined;
620
+ latest: boolean;
621
+ assets: string | undefined;
622
+ bundle: boolean | undefined;
623
+ noBundle: boolean;
624
+ ip: string | undefined;
625
+ port: number | undefined;
626
+ inspectorPort: number | undefined;
627
+ inspectorIp: string | undefined;
628
+ routes: string[] | undefined;
629
+ host: string | undefined;
630
+ localProtocol: "http" | "https" | undefined;
631
+ httpsKeyPath: string | undefined;
632
+ httpsCertPath: string | undefined;
633
+ localUpstream: string | undefined;
634
+ enableContainers: boolean | undefined;
635
+ site: string | undefined;
636
+ siteInclude: string[] | undefined;
637
+ siteExclude: string[] | undefined;
638
+ upstreamProtocol: "http" | "https" | undefined;
639
+ var: string[] | undefined;
640
+ define: string[] | undefined;
641
+ alias: string[] | undefined;
642
+ jsxFactory: string | undefined;
643
+ jsxFragment: string | undefined;
644
+ tsconfig: string | undefined;
645
+ remote: boolean;
646
+ local: boolean | undefined;
647
+ minify: boolean | undefined;
648
+ nodeCompat: boolean | undefined;
649
+ persistTo: string | undefined;
650
+ liveReload: boolean | undefined;
651
+ legacyEnv: boolean | undefined;
652
+ testScheduled: boolean;
653
+ logLevel: "debug" | "none" | "error" | "log" | "info" | "warn" | undefined;
654
+ showInteractiveDevSession: boolean | undefined;
655
+ types: boolean | undefined;
656
+ tunnel: boolean | undefined;
657
+ tunnelName: string | undefined;
658
+ experimentalNewConfig: boolean;
659
+ _: (string | number)[];
660
+ $0: string;
598
661
  };
599
- env?: string;
600
- /**
601
- * An array of paths to the .env files to load for this worker, relative to the project directory.
602
- *
603
- * If not specified, defaults to the standard `.env` files as given by `getDefaultEnvFiles()`.
604
- * The project directory is where the Wrangler configuration file is located or the current working directory otherwise.
605
- */
606
- envFiles?: string[];
607
- /** The bindings available to the worker. The specified bindind type will be exposed to the worker on the `env` object under the same key. */
608
- bindings?: Record<string, Binding>;
662
+ };
663
+ type AdditionalDevProps = {
609
664
  /**
610
- * Default bindings that can be overridden by config bindings.
665
+ * Default vars that can be overridden by config vars.
611
666
  * Useful for injecting environment-specific defaults like CF_PAGES variables.
612
667
  */
613
668
  defaultBindings?: Record<string, Extract<Binding, {
614
669
  type: "plain_text";
615
670
  }>>;
616
- migrations?: DurableObjectMigration$1[];
617
- containers?: ContainerApp$1[];
618
- /** The triggers which will cause the worker's exported default handlers to be called. */
619
- triggers?: Trigger[];
620
- tailConsumers?: CfTailConsumer[];
621
- streamingTailConsumers?: CfTailConsumer[];
622
- /**
623
- * Whether Wrangler should send usage metrics to Cloudflare for this project.
624
- *
625
- * When defined this will override any user settings.
626
- * Otherwise, Wrangler will use the user's preference.
627
- */
628
- sendMetrics?: boolean;
629
- /** Options applying to the worker's build step. Applies to deploy and dev. */
630
- build?: {
631
- /** Whether the worker and its dependencies are bundled. Defaults to true. */
632
- bundle?: boolean;
633
- additionalModules?: CfModule[];
634
- findAdditionalModules?: boolean;
635
- processEntrypoint?: boolean;
636
- /** Specifies types of modules matched by globs. */
637
- moduleRules?: Rule$1[];
638
- /** Replace global identifiers with constant expressions, e.g. { debug: 'true', version: '"1.0.0"' }. Only takes effect if bundle: true. */
639
- define?: Record<string, string>;
640
- /** Alias modules */
641
- alias?: Record<string, string>;
642
- /** Whether the bundled worker is minified. Only takes effect if bundle: true. */
643
- minify?: boolean;
644
- /** Whether to keep function names after JavaScript transpilations. */
645
- keepNames?: boolean;
646
- /** Options controlling a custom build step. */
647
- custom?: {
648
- /** Custom shell command to run before bundling. Runs even if bundle. */
649
- command?: string;
650
- /** The cwd to run the command in. */
651
- workingDirectory?: string;
652
- /** Filepath(s) to watch for changes. Upon changes, the command will be rerun. */
653
- watch?: string | string[];
654
- };
655
- jsxFactory?: string;
656
- jsxFragment?: string;
657
- tsconfig?: string;
658
- nodejsCompatMode?: Hook<NodeJSCompatMode, [Config$1]>;
659
- moduleRoot?: string;
660
- };
661
- /** Options applying to the worker's development preview environment. */
662
- dev?: {
663
- /** Options applying to the worker's inspector server. False disables the inspector server. */
664
- inspector?: {
665
- hostname?: string;
666
- port?: number;
667
- secure?: boolean;
668
- } | false;
669
- /** Whether the worker runs on the edge or locally. This has several options:
670
- * - true | "minimal": Run your Worker's code & bindings in a remote preview session, optionally using minimal mode as an internal detail
671
- * - false: Run your Worker's code & bindings in a local simulator
672
- * - undefined (default): Run your Worker's code locally, and any configured remote bindings remotely
673
- */
674
- remote?: boolean | "minimal";
675
- /** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
676
- auth?: AsyncHook<CfAccount, [Pick<Config$1, "account_id">]>;
677
- /** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. Set to `false` to disable persistence. */
678
- persist?: string | false;
679
- /** Controls which logs are logged 🤙. */
680
- logLevel?: LogLevel;
681
- /** Whether the worker server restarts upon source/config file changes. */
682
- watch?: boolean;
683
- /** Whether a script tag is inserted on text/html responses which will reload the page upon file changes. Defaults to false. */
684
- liveReload?: boolean;
685
- /** The local address to reach your worker. Applies to remote: true (remote mode) and remote: false (local mode). */
686
- server?: {
687
- hostname?: string;
688
- port?: number;
689
- secure?: boolean;
690
- httpsKeyPath?: string;
691
- httpsCertPath?: string;
692
- };
693
- /** Controls what request.url looks like inside the worker. */
694
- origin?: {
695
- hostname?: string;
696
- secure?: boolean;
697
- };
698
- /** A hook for outbound fetch calls from within the worker. */
699
- outboundService?: ServiceFetch;
700
- /** Handles structured runtime logs. */
701
- structuredLogsHandler?: (log: WorkerdStructuredLog) => void;
702
- /** An undici MockAgent to declaratively mock fetch calls to particular resources. */
703
- mockFetch?: undici.MockAgent;
704
- testScheduled?: boolean;
705
- /** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
706
- multiworkerPrimary?: boolean;
707
- /** Whether to infer the local request origin from configured routes. */
708
- inferOriginFromRoutes?: boolean;
709
- containerBuildId?: string;
710
- /** Whether to build and connect to containers during local dev. Requires Docker daemon to be running. Defaults to true. */
711
- enableContainers?: boolean;
712
- /** Path to the dev registry directory */
713
- registry?: string;
714
- /** Path to the docker executable. Defaults to 'docker' */
715
- dockerPath?: string;
716
- /** Options for the container engine */
717
- containerEngine?: ContainerEngine$1;
718
- /** Re-generate your worker types when your Wrangler configuration file changes */
719
- generateTypes?: boolean;
720
- /** Tunnel configuration for this dev session. */
721
- tunnel?: {
722
- enabled: boolean;
723
- name?: string;
724
- };
725
- };
726
- legacy?: {
727
- site?: Hook<Config$1["site"], [Config$1]>;
728
- useServiceEnvironments?: boolean;
729
- };
730
- unsafe?: Omit<CfUnsafe, "bindings">;
731
- assets?: string;
732
- experimental?: Record<string, never>;
733
- }
734
- type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets" | "config" | "containers" | "dev"> & {
735
- /** The configuration path of the worker */
736
- config?: string;
737
- /** A worker's directory. Usually where the Wrangler configuration file is located */
738
- projectRoot: string;
739
- build: StartDevWorkerInput["build"] & {
740
- nodejsCompatMode: NodeJSCompatMode;
741
- format: CfScriptFormat;
742
- moduleRoot: string;
743
- moduleRules: Rule$1[];
744
- define: Record<string, string>;
745
- additionalModules: CfModule[];
746
- exports: string[];
747
- processEntrypoint: boolean;
671
+ vars?: Record<string, string | Json$1>;
672
+ kv?: {
673
+ binding: string;
674
+ id?: string;
675
+ preview_id?: string;
676
+ }[];
677
+ durableObjects?: {
678
+ name: string;
679
+ class_name: string;
680
+ script_name?: string | undefined;
681
+ environment?: string | undefined;
682
+ }[];
683
+ services?: {
684
+ binding: string;
685
+ service: string;
686
+ environment?: string;
687
+ entrypoint?: string;
688
+ }[];
689
+ r2?: {
690
+ binding: string;
691
+ bucket_name?: string;
692
+ preview_bucket_name?: string;
693
+ jurisdiction?: string;
694
+ }[];
695
+ ai?: {
696
+ binding: string;
748
697
  };
749
- legacy: StartDevWorkerInput["legacy"] & {
750
- site?: Config$1["site"];
698
+ stream?: {
699
+ binding: string;
700
+ remote?: boolean;
751
701
  };
752
- dev: StartDevWorkerInput["dev"] & {
753
- persist: string | false;
754
- auth?: AsyncHook<CfAccount>;
702
+ version_metadata?: {
703
+ binding: string;
755
704
  };
756
- entrypoint: string;
757
- assets?: AssetsOptions$1;
758
- containers?: ContainerNormalizedConfig[];
759
- name: string;
760
- complianceRegion: Config$1["compliance_region"];
705
+ d1Databases?: Array<Omit<Environment$1["d1_databases"][number], "database_id"> & {
706
+ database_id?: string;
707
+ }>;
708
+ processEntrypoint?: boolean;
709
+ additionalModules?: CfModule[];
710
+ moduleRoot?: string;
711
+ rules?: Rule$1[];
712
+ showInteractiveDevSession?: boolean;
761
713
  };
762
- type HookValues = string | number | boolean | object | undefined | null;
763
- type Hook<T extends HookValues, Args extends unknown[] = []> = T | ((...args: Args) => T);
764
- type AsyncHook<T extends HookValues, Args extends unknown[] = []> = Hook<T, Args> | Hook<Promise<T>, Args>;
765
- type Bundle = EsbuildBundle;
766
- type LogLevel = "debug" | "info" | "log" | "warn" | "error" | "none";
767
-
768
- type MaybePromise<T> = T | Promise<T>;
769
- type DeferredPromise<T> = {
770
- promise: Promise<T>;
771
- resolve: (_: MaybePromise<T>) => void;
772
- reject: (_: Error) => void;
714
+ type DevArguments = Omit<(typeof dev)["args"], "installSkills">;
715
+ type StartDevOptions = DevArguments & AdditionalDevProps & {
716
+ forceLocal?: boolean;
717
+ accountId?: string;
718
+ disableDevRegistry?: boolean;
719
+ enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
720
+ onReady?: (ip: string, port: number) => void;
721
+ enableIpc?: boolean;
722
+ dockerPath?: string;
723
+ containerEngine?: string;
724
+ /** Set to `false` to disable persistence. When `true` or `undefined`, uses default persistence path. */
725
+ persist?: boolean;
773
726
  };
774
- declare function convertConfigBindingsToStartWorkerBindings(configBindings: Partial<Pick<Config$1, ConfigBindingFieldName>>): StartDevWorkerOptions["bindings"];
775
727
 
776
- declare function startWorker(options: StartDevWorkerInput): Promise<Worker>;
728
+ declare function convertConfigBindingsToStartWorkerBindings(configBindings: Partial<Pick<Config$1, ConfigBindingFieldName>>): StartDevWorkerOptions["bindings"];
777
729
 
778
730
  type TestHarnessOptions = {
779
731
  /**
@@ -3125,6 +3077,22 @@ declare function unstable_getMiniflareWorkerOptions(config: Config, env?: string
3125
3077
  containerBuildId?: string;
3126
3078
  }): Unstable_MiniflareWorkerOptions;
3127
3079
 
3080
+ /**
3081
+ * A Cloudflare account.
3082
+ */
3083
+ interface CfAccount {
3084
+ /**
3085
+ * An API token.
3086
+ *
3087
+ * @link https://api.cloudflare.com/#user-api-tokens-properties
3088
+ */
3089
+ apiToken: ApiCredentials;
3090
+ /**
3091
+ * An account ID.
3092
+ */
3093
+ accountId: string;
3094
+ }
3095
+
3128
3096
  type StartRemoteProxySessionOptions = {
3129
3097
  workerName?: string;
3130
3098
  auth?: NonNullable<StartDevWorkerInput["dev"]>["auth"];
@@ -3174,23 +3142,14 @@ declare function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObje
3174
3142
  auth?: AsyncHook<CfAccount> | undefined;
3175
3143
  } | null>;
3176
3144
 
3177
- declare const LOGGER_LEVELS: {
3178
- readonly none: -1;
3179
- readonly error: 0;
3180
- readonly warn: 1;
3181
- readonly info: 2;
3182
- readonly log: 3;
3183
- readonly debug: 4;
3184
- };
3185
- type LoggerLevel = keyof typeof LOGGER_LEVELS;
3186
3145
  type TableRow<Keys extends string> = Record<Keys, string>;
3187
3146
  declare class Logger {
3188
3147
  #private;
3189
3148
  constructor();
3190
3149
  private overrideLoggerLevel?;
3191
3150
  private onceHistory;
3192
- get loggerLevel(): "debug" | "none" | "error" | "info" | "log" | "warn";
3193
- set loggerLevel(val: "debug" | "none" | "error" | "info" | "log" | "warn");
3151
+ get loggerLevel(): "debug" | "none" | "error" | "log" | "info" | "warn";
3152
+ set loggerLevel(val: "debug" | "none" | "error" | "log" | "info" | "warn");
3194
3153
  resetLoggerLevel(): void;
3195
3154
  columns: number;
3196
3155
  json: (data: unknown) => void;
@@ -3220,23 +3179,6 @@ declare class Logger {
3220
3179
  private formatMessage;
3221
3180
  }
3222
3181
 
3223
- type PrintContext = {
3224
- log?: (message: string) => void;
3225
- registry?: WorkerRegistry | null;
3226
- local?: boolean;
3227
- isMultiWorker?: boolean;
3228
- remoteBindingsDisabled?: boolean;
3229
- name?: string;
3230
- provisioning?: boolean;
3231
- warnIfNoBindings?: boolean;
3232
- unsafeMetadata?: Record<string, unknown>;
3233
- };
3234
- /**
3235
- * Print all the bindings a worker would have access to.
3236
- * Accepts StartDevWorkerInput["bindings"] format
3237
- */
3238
- declare function printBindings(bindings: StartDevWorkerInput["bindings"], tailConsumers?: CfTailConsumer[], streamingTailConsumers?: CfTailConsumer[], containers?: ContainerApp$1[], context?: PrintContext): void;
3239
-
3240
3182
  /**
3241
3183
  * Resolves the named tunnel to hostnames whose ingress rules
3242
3184
  * target the current local dev origin and the token needed
@@ -3250,6 +3192,28 @@ declare function resolveNamedTunnel(name: string, origin: URL, options: {
3250
3192
  token: string;
3251
3193
  }>;
3252
3194
 
3195
+ /**
3196
+ * Run the dev server until it tears down (a hotkey quit in a TTY, or a
3197
+ * signal from a non-interactive parent). Mirrors `wrangler dev`'s command
3198
+ * handler and installs no signal handlers of its own, so signal handling
3199
+ * and exit codes match `wrangler dev` exactly.
3200
+ *
3201
+ * @param options Fully-built `StartDevOptions` (built in `bin/cf-wrangler.js`).
3202
+ * @returns `0` on a clean teardown.
3203
+ */
3204
+ declare function runCfWranglerDev(options: StartDevOptions): Promise<number>;
3205
+
3206
+ interface DevArgs {
3207
+ mode?: string;
3208
+ port?: number;
3209
+ host?: string;
3210
+ local?: boolean;
3211
+ }
3212
+ declare class ArgParseError extends Error {
3213
+ constructor(message: string);
3214
+ }
3215
+ declare function parseArgs(argv: string[]): DevArgs;
3216
+
3253
3217
  /**
3254
3218
  * Split an SQLQuery into an array of statements
3255
3219
  */
@@ -3257,6 +3221,18 @@ declare function splitSqlQuery(sql: string): string[];
3257
3221
 
3258
3222
  declare function runAutoConfig(autoConfigDetails: AutoConfigDetails, autoConfigOptions?: AutoConfigOptions): Promise<AutoConfigSummary>;
3259
3223
 
3224
+ /**
3225
+ * The implementation for fetching a kv value from the cloudflare API.
3226
+ * We special-case this one call, because it's the only API call that
3227
+ * doesn't return json. We inline the implementation and try not to share
3228
+ * any code with the other calls. We should push back on any new APIs that
3229
+ * try to introduce non-"standard" response structures.
3230
+ *
3231
+ * Note: any calls to fetchKVGetValue must call encodeURIComponent on key
3232
+ * before passing it
3233
+ */
3234
+ declare function fetchKVGetValue(complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string): Promise<ArrayBuffer>;
3235
+
3260
3236
  /**
3261
3237
  * Make a fetch request, and extract the `result` from the JSON response.
3262
3238
  */
@@ -3267,6 +3243,14 @@ declare function fetchResult<ResponseType>(complianceConfig: ComplianceConfig, r
3267
3243
  * and repeating the request if the results are paginated.
3268
3244
  */
3269
3245
  declare function fetchListResult<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams): Promise<ResponseType[]>;
3246
+ /**
3247
+ * Make a fetch request for a list of values,
3248
+ * extracting the `result` from the JSON response,
3249
+ * and repeating the request if the results are paginated.
3250
+ *
3251
+ * This is similar to fetchListResult, but it uses the `page` query parameter instead of `cursor`.
3252
+ */
3253
+ declare function fetchPagedListResult<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams): Promise<ResponseType[]>;
3270
3254
 
3271
3255
  interface ConfirmOptions {
3272
3256
  defaultValue?: boolean;
@@ -3395,6 +3379,8 @@ type HandlerContext = {
3395
3379
  */
3396
3380
  fetchResult: typeof fetchResult;
3397
3381
  fetchListResult: typeof fetchListResult;
3382
+ fetchPagedListResult: typeof fetchPagedListResult;
3383
+ fetchKVGetValue: typeof fetchKVGetValue;
3398
3384
  /**
3399
3385
  * Interactive prompts
3400
3386
  */
@@ -3676,4 +3662,4 @@ interface Unstable_ASSETSBindingsOptions {
3676
3662
  }
3677
3663
  declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
3678
3664
 
3679
- export { type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, 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, type WorkerHandle, createTestHarness, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, 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, resolveNamedTunnel as unstable_resolveNamedTunnel, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
3665
+ export { ArgParseError, type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, 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, type WorkerHandle, createTestHarness, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, parseArgs as parseCfWranglerArgs, runCfWranglerDev, 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, readConfig as unstable_readConfig, resolveNamedTunnel as unstable_resolveNamedTunnel, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };