wrangler 4.35.0 → 4.36.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.
@@ -9,6 +9,7 @@ import Protocol from 'devtools-protocol/types/protocol-mapping';
9
9
  import { ContainerNormalizedConfig } from '@cloudflare/containers-shared';
10
10
  import { IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
11
11
  import { URLSearchParams } from 'node:url';
12
+ import Cloudflare from 'cloudflare';
12
13
 
13
14
  /**
14
15
  * The `Environment` interface declares all the configuration fields that
@@ -45,6 +46,35 @@ type CloudchamberConfig = {
45
46
  memory?: string;
46
47
  ipv4?: boolean;
47
48
  };
49
+ type UnsafeBinding = {
50
+ /**
51
+ * The name of the binding provided to the Worker
52
+ */
53
+ name: string;
54
+ /**
55
+ * The 'type' of the unsafe binding.
56
+ */
57
+ type: string;
58
+ dev?: {
59
+ plugin: {
60
+ /**
61
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
62
+ * @example "@cloudflare/my-external-miniflare-plugin"
63
+ */
64
+ package: string;
65
+ /**
66
+ * Plugin is the name of the plugin exposed by the package.
67
+ * @example "MY_UNSAFE_PLUGIN"
68
+ */
69
+ name: string;
70
+ };
71
+ /**
72
+ * Optional mapping of unsafe bindings names to options provided for the plugin.
73
+ */
74
+ options?: Record<string, unknown>;
75
+ };
76
+ [key: string]: unknown;
77
+ };
48
78
  /**
49
79
  * Configuration for a container application
50
80
  */
@@ -517,8 +547,8 @@ type WorkflowBinding = {
517
547
  class_name: string;
518
548
  /** The script where the Workflow is defined (if it's external to this Worker) */
519
549
  script_name?: string;
520
- /** Whether the Workflow should be remote or not (only available under `--x-remote-bindings`) */
521
- experimental_remote?: boolean;
550
+ /** Whether the Workflow should be remote or not */
551
+ remote?: boolean;
522
552
  };
523
553
  /**
524
554
  * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
@@ -619,8 +649,8 @@ interface EnvironmentNonInheritable {
619
649
  id?: string;
620
650
  /** The ID of the KV namespace used during `wrangler dev` */
621
651
  preview_id?: string;
622
- /** Whether the KV namespace should be remote or not (only available under `--x-remote-bindings`) */
623
- experimental_remote?: boolean;
652
+ /** Whether the KV namespace should be remote or not */
653
+ remote?: boolean;
624
654
  }[];
625
655
  /**
626
656
  * These specify bindings to send email from inside your Worker.
@@ -640,8 +670,8 @@ interface EnvironmentNonInheritable {
640
670
  destination_address?: string;
641
671
  /** If this binding should be restricted to a set of verified addresses */
642
672
  allowed_destination_addresses?: string[];
643
- /** Whether the binding should be remote or not (only available under `--x-remote-bindings`) */
644
- experimental_remote?: boolean;
673
+ /** Whether the binding should be remote or not */
674
+ remote?: boolean;
645
675
  }[];
646
676
  /**
647
677
  * Specifies Queues that are bound to this Worker environment.
@@ -663,8 +693,8 @@ interface EnvironmentNonInheritable {
663
693
  queue: string;
664
694
  /** The number of seconds to wait before delivering a message */
665
695
  delivery_delay?: number;
666
- /** Whether the Queue producer should be remote or not (only available under `--x-remote-bindings`) */
667
- experimental_remote?: boolean;
696
+ /** Whether the Queue producer should be remote or not */
697
+ remote?: boolean;
668
698
  }[];
669
699
  /** Consumer configuration */
670
700
  consumers?: {
@@ -708,8 +738,8 @@ interface EnvironmentNonInheritable {
708
738
  preview_bucket_name?: string;
709
739
  /** The jurisdiction that the bucket exists in. Default if not present. */
710
740
  jurisdiction?: string;
711
- /** Whether the R2 bucket should be remote or not (only available under `--x-remote-bindings`) */
712
- experimental_remote?: boolean;
741
+ /** Whether the R2 bucket should be remote or not */
742
+ remote?: boolean;
713
743
  }[];
714
744
  /**
715
745
  * Specifies D1 databases that are bound to this Worker environment.
@@ -737,8 +767,8 @@ interface EnvironmentNonInheritable {
737
767
  migrations_dir?: string;
738
768
  /** Internal use only. */
739
769
  database_internal_env?: string;
740
- /** Whether the D1 database should be remote or not (only available under `--x-remote-bindings`) */
741
- experimental_remote?: boolean;
770
+ /** Whether the D1 database should be remote or not */
771
+ remote?: boolean;
742
772
  }[];
743
773
  /**
744
774
  * Specifies Vectorize indexes that are bound to this Worker environment.
@@ -756,8 +786,8 @@ interface EnvironmentNonInheritable {
756
786
  binding: string;
757
787
  /** The name of the index. */
758
788
  index_name: string;
759
- /** Whether the Vectorize index should be remote or not (only available under `--x-remote-bindings`) */
760
- experimental_remote?: boolean;
789
+ /** Whether the Vectorize index should be remote or not */
790
+ remote?: boolean;
761
791
  }[];
762
792
  /**
763
793
  * Specifies Hyperdrive configs that are bound to this Worker environment.
@@ -809,8 +839,8 @@ interface EnvironmentNonInheritable {
809
839
  entrypoint?: string;
810
840
  /** Optional properties that will be made available to the service via ctx.props. */
811
841
  props?: Record<string, unknown>;
812
- /** Whether the service binding should be remote or not (only available under `--x-remote-bindings`) */
813
- experimental_remote?: boolean;
842
+ /** Whether the service binding should be remote or not */
843
+ remote?: boolean;
814
844
  }[] | undefined;
815
845
  /**
816
846
  * Specifies analytics engine datasets that are bound to this Worker environment.
@@ -842,8 +872,8 @@ interface EnvironmentNonInheritable {
842
872
  */
843
873
  browser: {
844
874
  binding: string;
845
- /** Whether the Browser binding should be remote or not (only available under `--x-remote-bindings`) */
846
- experimental_remote?: boolean;
875
+ /** Whether the Browser binding should be remote or not */
876
+ remote?: boolean;
847
877
  } | undefined;
848
878
  /**
849
879
  * Binding to the AI project.
@@ -859,8 +889,8 @@ interface EnvironmentNonInheritable {
859
889
  ai: {
860
890
  binding: string;
861
891
  staging?: boolean;
862
- /** Whether the AI binding should be remote or not (only available under `--x-remote-bindings`) */
863
- experimental_remote?: boolean;
892
+ /** Whether the AI binding should be remote or not */
893
+ remote?: boolean;
864
894
  } | undefined;
865
895
  /**
866
896
  * Binding to Cloudflare Images
@@ -875,8 +905,8 @@ interface EnvironmentNonInheritable {
875
905
  */
876
906
  images: {
877
907
  binding: string;
878
- /** Whether the Images binding should be remote or not (only available under `--x-remote-bindings`) */
879
- experimental_remote?: boolean;
908
+ /** Whether the Images binding should be remote or not */
909
+ remote?: boolean;
880
910
  } | undefined;
881
911
  /**
882
912
  * Binding to the Worker Version's metadata
@@ -899,11 +929,7 @@ interface EnvironmentNonInheritable {
899
929
  * can be used to implement bindings for features that haven't released and aren't supported
900
930
  * directly by wrangler or miniflare.
901
931
  */
902
- bindings?: {
903
- name: string;
904
- type: string;
905
- [key: string]: unknown;
906
- }[];
932
+ bindings?: UnsafeBinding[];
907
933
  /**
908
934
  * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
909
935
  * here will always be applied to metadata last, so can add new or override existing fields.
@@ -940,8 +966,8 @@ interface EnvironmentNonInheritable {
940
966
  binding: string;
941
967
  /** The uuid of the uploaded mTLS certificate */
942
968
  certificate_id: string;
943
- /** Whether the mtls fetcher should be remote or not (only available under `--x-remote-bindings`) */
944
- experimental_remote?: boolean;
969
+ /** Whether the mtls fetcher should be remote or not */
970
+ remote?: boolean;
945
971
  }[];
946
972
  /**
947
973
  * Specifies a list of Tail Workers that are bound to this Worker environment
@@ -971,8 +997,8 @@ interface EnvironmentNonInheritable {
971
997
  namespace: string;
972
998
  /** Details about the outbound Worker which will handle outbound requests from your namespace */
973
999
  outbound?: DispatchNamespaceOutbound;
974
- /** Whether the Dispatch Namespace should be remote or not (only available under `--x-remote-bindings`) */
975
- experimental_remote?: boolean;
1000
+ /** Whether the Dispatch Namespace should be remote or not */
1001
+ remote?: boolean;
976
1002
  }[];
977
1003
  /**
978
1004
  * Specifies list of Pipelines bound to this Worker environment
@@ -1021,6 +1047,28 @@ interface EnvironmentNonInheritable {
1021
1047
  /** Whether the timer is enabled */
1022
1048
  enable_timer?: boolean;
1023
1049
  }[];
1050
+ /**
1051
+ * Specifies rate limit bindings that are bound to this Worker environment.
1052
+ *
1053
+ * NOTE: This field is not automatically inherited from the top level environment,
1054
+ * and so must be specified in every named environment.
1055
+ *
1056
+ * @default []
1057
+ * @nonInheritable
1058
+ */
1059
+ ratelimits: {
1060
+ /** The binding name used to refer to the rate limiter in the Worker. */
1061
+ name: string;
1062
+ /** The namespace ID for this rate limiter. */
1063
+ namespace_id: string;
1064
+ /** Simple rate limiting configuration. */
1065
+ simple: {
1066
+ /** The maximum number of requests allowed in the time period. */
1067
+ limit: number;
1068
+ /** The time period in seconds (10 for ten seconds, 60 for one minute). */
1069
+ period: 10 | 60;
1070
+ };
1071
+ }[];
1024
1072
  }
1025
1073
  /**
1026
1074
  * The raw environment configuration that we read from the config file.
@@ -1188,7 +1236,7 @@ interface CfModule {
1188
1236
  interface CfKvNamespace {
1189
1237
  binding: string;
1190
1238
  id?: string | typeof INHERIT_SYMBOL;
1191
- experimental_remote?: boolean;
1239
+ remote?: boolean;
1192
1240
  raw?: boolean;
1193
1241
  }
1194
1242
  /**
@@ -1196,7 +1244,7 @@ interface CfKvNamespace {
1196
1244
  */
1197
1245
  type CfSendEmailBindings = {
1198
1246
  name: string;
1199
- experimental_remote?: boolean;
1247
+ remote?: boolean;
1200
1248
  } & ({
1201
1249
  destination_address?: string;
1202
1250
  } | {
@@ -1208,7 +1256,7 @@ type CfSendEmailBindings = {
1208
1256
  interface CfAIBinding {
1209
1257
  binding: string;
1210
1258
  staging?: boolean;
1211
- experimental_remote?: boolean;
1259
+ remote?: boolean;
1212
1260
  raw?: boolean;
1213
1261
  }
1214
1262
  /**
@@ -1225,21 +1273,21 @@ interface CfWorkflow {
1225
1273
  class_name: string;
1226
1274
  binding: string;
1227
1275
  script_name?: string;
1228
- experimental_remote?: boolean;
1276
+ remote?: boolean;
1229
1277
  raw?: boolean;
1230
1278
  }
1231
1279
  interface CfQueue {
1232
1280
  binding: string;
1233
1281
  queue_name: string;
1234
1282
  delivery_delay?: number;
1235
- experimental_remote?: boolean;
1283
+ remote?: boolean;
1236
1284
  raw?: boolean;
1237
1285
  }
1238
1286
  interface CfR2Bucket {
1239
1287
  binding: string;
1240
1288
  bucket_name?: string | typeof INHERIT_SYMBOL;
1241
1289
  jurisdiction?: string;
1242
- experimental_remote?: boolean;
1290
+ remote?: boolean;
1243
1291
  raw?: boolean;
1244
1292
  }
1245
1293
  interface CfD1Database {
@@ -1250,14 +1298,14 @@ interface CfD1Database {
1250
1298
  database_internal_env?: string;
1251
1299
  migrations_table?: string;
1252
1300
  migrations_dir?: string;
1253
- experimental_remote?: boolean;
1301
+ remote?: boolean;
1254
1302
  raw?: boolean;
1255
1303
  }
1256
1304
  interface CfVectorize {
1257
1305
  binding: string;
1258
1306
  index_name: string;
1259
1307
  raw?: boolean;
1260
- experimental_remote?: boolean;
1308
+ remote?: boolean;
1261
1309
  }
1262
1310
  interface CfSecretsStoreSecrets {
1263
1311
  binding: string;
@@ -1268,6 +1316,14 @@ interface CfHelloWorld {
1268
1316
  binding: string;
1269
1317
  enable_timer?: boolean;
1270
1318
  }
1319
+ interface CfRateLimit {
1320
+ name: string;
1321
+ namespace_id: string;
1322
+ simple: {
1323
+ limit: number;
1324
+ period: 10 | 60;
1325
+ };
1326
+ }
1271
1327
  interface CfHyperdrive {
1272
1328
  binding: string;
1273
1329
  id: string;
@@ -1279,7 +1335,7 @@ interface CfService {
1279
1335
  environment?: string;
1280
1336
  entrypoint?: string;
1281
1337
  props?: Record<string, unknown>;
1282
- experimental_remote?: boolean;
1338
+ remote?: boolean;
1283
1339
  }
1284
1340
  interface CfAnalyticsEngineDataset {
1285
1341
  binding: string;
@@ -1293,12 +1349,12 @@ interface CfDispatchNamespace {
1293
1349
  environment?: string;
1294
1350
  parameters?: string[];
1295
1351
  };
1296
- experimental_remote?: boolean;
1352
+ remote?: boolean;
1297
1353
  }
1298
1354
  interface CfMTlsCertificate {
1299
1355
  binding: string;
1300
1356
  certificate_id: string;
1301
- experimental_remote?: boolean;
1357
+ remote?: boolean;
1302
1358
  }
1303
1359
  interface CfLogfwdrBinding {
1304
1360
  name: string;
@@ -1307,11 +1363,29 @@ interface CfLogfwdrBinding {
1307
1363
  interface CfPipeline {
1308
1364
  binding: string;
1309
1365
  pipeline: string;
1310
- experimental_remote?: boolean;
1366
+ remote?: boolean;
1311
1367
  }
1312
1368
  interface CfUnsafeBinding {
1313
1369
  name: string;
1314
1370
  type: string;
1371
+ dev?: {
1372
+ plugin: {
1373
+ /**
1374
+ * Package is the bare specifier of the package that exposes plugins to integrate into Miniflare via a named `plugins` export.
1375
+ * @example "@cloudflare/my-external-miniflare-plugin"
1376
+ */
1377
+ package: string;
1378
+ /**
1379
+ * Plugin is the name of the plugin exposed by the package.
1380
+ * @example "my-unsafe-plugin"
1381
+ */
1382
+ name: string;
1383
+ };
1384
+ /**
1385
+ * dev-only options to pass to the plugin.
1386
+ */
1387
+ options?: Record<string, unknown>;
1388
+ };
1315
1389
  }
1316
1390
  type CfUnsafeMetadata = Record<string, unknown>;
1317
1391
  type CfCapnp = {
@@ -1628,6 +1702,7 @@ type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {
1628
1702
  };
1629
1703
  type ReadConfigOptions = ResolveConfigPathOptions & {
1630
1704
  hideWarnings?: boolean;
1705
+ preserveOriginalMain?: boolean;
1631
1706
  };
1632
1707
  type ConfigBindingOptions = Pick<Config, "ai" | "browser" | "d1_databases" | "dispatch_namespaces" | "durable_objects" | "queues" | "r2_buckets" | "services" | "kv_namespaces" | "mtls_certificates" | "vectorize" | "workflows">;
1633
1708
  /**
@@ -2098,7 +2173,7 @@ interface StartDevWorkerInput {
2098
2173
  watch?: boolean;
2099
2174
  /** Whether a script tag is inserted on text/html responses which will reload the page upon file changes. Defaults to false. */
2100
2175
  liveReload?: boolean;
2101
- /** The local address to reach your worker. Applies to experimental_remote: true (remote mode) and remote: false (local mode). */
2176
+ /** The local address to reach your worker. Applies to remote: true (remote mode) and remote: false (local mode). */
2102
2177
  server?: {
2103
2178
  hostname?: string;
2104
2179
  port?: number;
@@ -2259,7 +2334,9 @@ type Binding = {
2259
2334
  type: "logfwdr";
2260
2335
  } & NameOmit<CfLogfwdrBinding>) | ({
2261
2336
  type: "unsafe_hello_world";
2262
- } & BindingOmit<CfHelloWorld>) | {
2337
+ } & BindingOmit<CfHelloWorld>) | ({
2338
+ type: "ratelimit";
2339
+ } & NameOmit<CfRateLimit>) | {
2263
2340
  type: `unsafe_${string}`;
2264
2341
  } | {
2265
2342
  type: "assets";
@@ -2682,7 +2759,6 @@ type StartRemoteProxySessionOptions = {
2682
2759
  complianceRegion?: Config["compliance_region"];
2683
2760
  };
2684
2761
  declare function startRemoteProxySession(bindings: StartDevWorkerInput["bindings"], options?: StartRemoteProxySessionOptions): Promise<RemoteProxySession>;
2685
- declare function pickRemoteBindings(bindings: Record<string, Binding>): Record<string, Binding>;
2686
2762
  type WranglerConfigObject = {
2687
2763
  /** The path to the wrangler config file */
2688
2764
  path: string;
@@ -2743,7 +2819,10 @@ declare class Logger {
2743
2819
  log: (...args: unknown[]) => void;
2744
2820
  warn: (...args: unknown[]) => void;
2745
2821
  error: (...args: unknown[]) => void;
2746
- table<Keys extends string>(data: TableRow<Keys>[]): void;
2822
+ table<Keys extends string>(data: TableRow<Keys>[], options?: {
2823
+ wordWrap: boolean;
2824
+ head?: Keys[];
2825
+ }): void;
2747
2826
  console<M extends Exclude<keyof Console, "Console">>(method: M, ...args: Parameters<Console[M]>): void;
2748
2827
  get once(): {
2749
2828
  info: (...args: unknown[]) => void;
@@ -2799,6 +2878,7 @@ type Teams =
2799
2878
  | "Product: KV"
2800
2879
  | "Product: R2"
2801
2880
  | "Product: R2 Data Catalog"
2881
+ | "Product: R2 SQL"
2802
2882
  | "Product: D1"
2803
2883
  | "Product: Queues"
2804
2884
  | "Product: AI"
@@ -2807,7 +2887,8 @@ type Teams =
2807
2887
  | "Product: Vectorize"
2808
2888
  | "Product: Workflows"
2809
2889
  | "Product: Cloudchamber"
2810
- | "Product: SSL";
2890
+ | "Product: SSL"
2891
+ | "Product: WVPC";
2811
2892
 
2812
2893
  type StringKeyOf<T> = Extract<keyof T, string>;
2813
2894
  type DeepFlatten<T> = T extends object ? {
@@ -2856,6 +2937,10 @@ type HandlerContext = {
2856
2937
  UserError: typeof UserError;
2857
2938
  FatalError: typeof FatalError;
2858
2939
  };
2940
+ /**
2941
+ * API SDK
2942
+ */
2943
+ sdk: Cloudflare;
2859
2944
  };
2860
2945
  type CommandDefinition<NamedArgDefs extends NamedArgDefinitions = NamedArgDefinitions> = {
2861
2946
  /**
@@ -3026,6 +3111,7 @@ declare function createCLIParser(argv: string[]): {
3026
3111
  readonly describe: "Experimental: Enable Remote Bindings";
3027
3112
  readonly type: "boolean";
3028
3113
  readonly hidden: true;
3114
+ readonly default: true;
3029
3115
  readonly alias: readonly ["x-remote-bindings"];
3030
3116
  };
3031
3117
  readonly "experimental-provision": {
@@ -3055,4 +3141,4 @@ interface Unstable_ASSETSBindingsOptions {
3055
3141
  }
3056
3142
  declare const generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
3057
3143
 
3058
- export { type ConfigBindingOptions as Experimental_ConfigBindingOptions, type RemoteProxySession as Experimental_RemoteProxySession, type GetPlatformProxyOptions, type PlatformProxy, type SourcelessWorkerOptions, type Unstable_ASSETSBindingsOptions, type Binding as Unstable_Binding, 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 StartRemoteProxySessionOptions as experimental_StartRemoteProxySessionOptions, experimental_getWranglerCommands, maybeStartOrUpdateRemoteProxySession as experimental_maybeStartOrUpdateRemoteProxySession, experimental_patchConfig, pickRemoteBindings as experimental_pickRemoteBindings, experimental_readRawConfig, startRemoteProxySession as experimental_startRemoteProxySession, getPlatformProxy, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, generateASSETSBinding as unstable_generateASSETSBinding, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, unstable_pages, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
3144
+ export { type Binding, type ConfigBindingOptions as Experimental_ConfigBindingOptions, 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, experimental_getWranglerCommands, experimental_patchConfig, experimental_readRawConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, generateASSETSBinding as unstable_generateASSETSBinding, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, unstable_pages, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };