wrangler 4.31.0 → 4.33.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,11 +1,11 @@
1
- import { Json, Request, Response as Response$1, DispatchFetch, NodeJSCompatMode, Miniflare, MiniflareOptions, Mutex, WorkerOptions, ModuleRule, RemoteProxyConnectionString } from 'miniflare';
1
+ import { Json, Request, Response as Response$1, DispatchFetch, NodeJSCompatMode, Miniflare, WorkerRegistry, MiniflareOptions, Mutex, WorkerOptions, ModuleRule, RemoteProxyConnectionString } from 'miniflare';
2
2
  import * as undici from 'undici';
3
3
  import { RequestInfo, RequestInit, Response, FormData } from 'undici';
4
- import { CamelCaseKey, ArgumentsCamelCase, InferredOptionTypes, Alias, PositionalOptions, Options } from 'yargs';
4
+ import { CamelCaseKey, Argv, PositionalOptions, Options, ArgumentsCamelCase, InferredOptionTypes, Alias } from 'yargs';
5
5
  import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
6
+ import { Metafile } from 'esbuild';
6
7
  import { EventEmitter } from 'node:events';
7
8
  import Protocol from 'devtools-protocol/types/protocol-mapping';
8
- import { Metafile } from 'esbuild';
9
9
  import { ContainerNormalizedConfig } from '@cloudflare/containers-shared';
10
10
  import { IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
11
11
  import { URLSearchParams } from 'node:url';
@@ -150,11 +150,22 @@ type ContainerApp = {
150
150
  namespace_id: string;
151
151
  };
152
152
  /**
153
- * How a rollout should be done, defining the size of it
153
+ * Configures what percentage of instances should be updated at each step of a rollout.
154
+ * You can specify this as a single number, or an array of numbers.
155
+ *
156
+ * If this is a single number, each step will progress by that percentage.
157
+ * The options are 5, 10, 20, 25, 50 or 100.
158
+ *
159
+ * If this is an array, each step specifies the cumulative rollout progress.
160
+ * The final step must be 100.
161
+ *
162
+ * This can be overridden adhoc by deploying with the `--containers-rollout=immediate` flag,
163
+ * which will roll out to 100% of instances in one step.
164
+ *
154
165
  * @optional
155
- * @default 25
166
+ * @default [10,100]
156
167
  * */
157
- rollout_step_percentage?: number;
168
+ rollout_step_percentage?: number | number[];
158
169
  /**
159
170
  * How a rollout should be created. It supports the following modes:
160
171
  * - full_auto: The container application will be rolled out fully automatically.
@@ -162,6 +173,7 @@ type ContainerApp = {
162
173
  * - manual: The container application will be rollout fully by manually actioning progress steps.
163
174
  * @optional
164
175
  * @default "full_auto"
176
+ * @hidden
165
177
  */
166
178
  rollout_kind?: "full_auto" | "none" | "full_manual";
167
179
  /**
@@ -770,9 +782,18 @@ interface EnvironmentNonInheritable {
770
782
  services: {
771
783
  /** The binding name used to refer to the bound service. */
772
784
  binding: string;
773
- /** The name of the service. */
785
+ /**
786
+ * The name of the service.
787
+ * To bind to a worker in a specific environment,
788
+ * you should use the format `<worker_name>-<environment_name>`.
789
+ */
774
790
  service: string;
775
- /** The environment of the service (e.g. production, staging, etc). */
791
+ /**
792
+ * @hidden
793
+ * @deprecated you should use `service: <worker_name>-<environment_name>` instead.
794
+ * This refers to the deprecated concept of 'service environments'.
795
+ * The environment of the service (e.g. production, staging, etc).
796
+ */
776
797
  environment?: string;
777
798
  /** Optionally, the entrypoint (named export) of the service to bind to. */
778
799
  entrypoint?: string;
@@ -1065,6 +1086,239 @@ type ContainerEngine = {
1065
1086
  localDocker: DockerConfiguration;
1066
1087
  } | string;
1067
1088
 
1089
+ /**
1090
+ * A symbol to inherit a binding from the deployed worker.
1091
+ */
1092
+ declare const INHERIT_SYMBOL: unique symbol;
1093
+
1094
+ /**
1095
+ * The type of Worker
1096
+ */
1097
+ type CfScriptFormat = "modules" | "service-worker";
1098
+ /**
1099
+ * A module type.
1100
+ */
1101
+ type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
1102
+ /**
1103
+ * An imported module.
1104
+ */
1105
+ interface CfModule {
1106
+ /**
1107
+ * The module name.
1108
+ *
1109
+ * @example
1110
+ * './src/index.js'
1111
+ */
1112
+ name: string;
1113
+ /**
1114
+ * The absolute path of the module on disk, or `undefined` if this is a
1115
+ * virtual module. Used as the source URL for this module, so source maps are
1116
+ * correctly resolved.
1117
+ *
1118
+ * @example
1119
+ * '/path/to/src/index.js'
1120
+ */
1121
+ filePath: string | undefined;
1122
+ /**
1123
+ * The module content, usually JavaScript or WASM code.
1124
+ *
1125
+ * @example
1126
+ * export default {
1127
+ * async fetch(request) {
1128
+ * return new Response('Ok')
1129
+ * }
1130
+ * }
1131
+ */
1132
+ content: string | Buffer<ArrayBuffer>;
1133
+ /**
1134
+ * An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present
1135
+ * if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled
1136
+ * we need to also copy the relevant sourcemaps into the final out directory.
1137
+ */
1138
+ sourceMap?: CfWorkerSourceMap;
1139
+ /**
1140
+ * The module type.
1141
+ *
1142
+ * If absent, will default to the main module's type.
1143
+ */
1144
+ type?: CfModuleType;
1145
+ }
1146
+ /**
1147
+ * A KV namespace.
1148
+ */
1149
+ interface CfKvNamespace {
1150
+ binding: string;
1151
+ id?: string | typeof INHERIT_SYMBOL;
1152
+ experimental_remote?: boolean;
1153
+ raw?: boolean;
1154
+ }
1155
+ /**
1156
+ * A binding to send email.
1157
+ */
1158
+ type CfSendEmailBindings = {
1159
+ name: string;
1160
+ experimental_remote?: boolean;
1161
+ } & ({
1162
+ destination_address?: string;
1163
+ } | {
1164
+ allowed_destination_addresses?: string[];
1165
+ });
1166
+ /**
1167
+ * A binding to the AI project
1168
+ */
1169
+ interface CfAIBinding {
1170
+ binding: string;
1171
+ staging?: boolean;
1172
+ experimental_remote?: boolean;
1173
+ raw?: boolean;
1174
+ }
1175
+ /**
1176
+ * A Durable Object.
1177
+ */
1178
+ interface CfDurableObject {
1179
+ name: string;
1180
+ class_name: string;
1181
+ script_name?: string;
1182
+ environment?: string;
1183
+ }
1184
+ interface CfWorkflow {
1185
+ name: string;
1186
+ class_name: string;
1187
+ binding: string;
1188
+ script_name?: string;
1189
+ experimental_remote?: boolean;
1190
+ raw?: boolean;
1191
+ }
1192
+ interface CfQueue {
1193
+ binding: string;
1194
+ queue_name: string;
1195
+ delivery_delay?: number;
1196
+ experimental_remote?: boolean;
1197
+ raw?: boolean;
1198
+ }
1199
+ interface CfR2Bucket {
1200
+ binding: string;
1201
+ bucket_name?: string | typeof INHERIT_SYMBOL;
1202
+ jurisdiction?: string;
1203
+ experimental_remote?: boolean;
1204
+ raw?: boolean;
1205
+ }
1206
+ interface CfD1Database {
1207
+ binding: string;
1208
+ database_id?: string | typeof INHERIT_SYMBOL;
1209
+ database_name?: string;
1210
+ preview_database_id?: string;
1211
+ database_internal_env?: string;
1212
+ migrations_table?: string;
1213
+ migrations_dir?: string;
1214
+ experimental_remote?: boolean;
1215
+ raw?: boolean;
1216
+ }
1217
+ interface CfVectorize {
1218
+ binding: string;
1219
+ index_name: string;
1220
+ raw?: boolean;
1221
+ experimental_remote?: boolean;
1222
+ }
1223
+ interface CfSecretsStoreSecrets {
1224
+ binding: string;
1225
+ store_id: string;
1226
+ secret_name: string;
1227
+ }
1228
+ interface CfHelloWorld {
1229
+ binding: string;
1230
+ enable_timer?: boolean;
1231
+ }
1232
+ interface CfHyperdrive {
1233
+ binding: string;
1234
+ id: string;
1235
+ localConnectionString?: string;
1236
+ }
1237
+ interface CfService {
1238
+ binding: string;
1239
+ service: string;
1240
+ environment?: string;
1241
+ entrypoint?: string;
1242
+ props?: Record<string, unknown>;
1243
+ experimental_remote?: boolean;
1244
+ }
1245
+ interface CfAnalyticsEngineDataset {
1246
+ binding: string;
1247
+ dataset?: string;
1248
+ }
1249
+ interface CfDispatchNamespace {
1250
+ binding: string;
1251
+ namespace: string;
1252
+ outbound?: {
1253
+ service: string;
1254
+ environment?: string;
1255
+ parameters?: string[];
1256
+ };
1257
+ experimental_remote?: boolean;
1258
+ }
1259
+ interface CfMTlsCertificate {
1260
+ binding: string;
1261
+ certificate_id: string;
1262
+ experimental_remote?: boolean;
1263
+ }
1264
+ interface CfLogfwdrBinding {
1265
+ name: string;
1266
+ destination: string;
1267
+ }
1268
+ interface CfPipeline {
1269
+ binding: string;
1270
+ pipeline: string;
1271
+ experimental_remote?: boolean;
1272
+ }
1273
+ interface CfUnsafeBinding {
1274
+ name: string;
1275
+ type: string;
1276
+ }
1277
+ type CfUnsafeMetadata = Record<string, unknown>;
1278
+ type CfCapnp = {
1279
+ base_path?: never;
1280
+ source_schemas?: never;
1281
+ compiled_schema: string;
1282
+ } | {
1283
+ base_path: string;
1284
+ source_schemas: string[];
1285
+ compiled_schema?: never;
1286
+ };
1287
+ interface CfUnsafe {
1288
+ bindings: CfUnsafeBinding[] | undefined;
1289
+ metadata: CfUnsafeMetadata | undefined;
1290
+ capnp: CfCapnp | undefined;
1291
+ }
1292
+ interface CfTailConsumer {
1293
+ service: string;
1294
+ environment?: string;
1295
+ }
1296
+ interface CfWorkerSourceMap {
1297
+ /**
1298
+ * The name of the source map.
1299
+ *
1300
+ * @example
1301
+ * 'out.js.map'
1302
+ */
1303
+ name: string;
1304
+ /**
1305
+ * The content of the source map, which is a JSON object described by the v3
1306
+ * spec.
1307
+ *
1308
+ * @example
1309
+ * {
1310
+ * "version" : 3,
1311
+ * "file": "out.js",
1312
+ * "sourceRoot": "",
1313
+ * "sources": ["foo.js", "bar.js"],
1314
+ * "sourcesContent": [null, null],
1315
+ * "names": ["src", "maps", "are", "fun"],
1316
+ * "mappings": "A,AAAB;;ABCDE;"
1317
+ * }
1318
+ */
1319
+ content: string | Buffer;
1320
+ }
1321
+
1068
1322
  /**
1069
1323
  * This is the static type definition for the configuration object.
1070
1324
  *
@@ -1308,6 +1562,7 @@ interface CommonYargsOptions {
1308
1562
  "experimental-provision": boolean | undefined;
1309
1563
  "experimental-remote-bindings": boolean | undefined;
1310
1564
  }
1565
+ type CommonYargsArgv = Argv<CommonYargsOptions>;
1311
1566
  type RemoveIndex<T> = {
1312
1567
  [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
1313
1568
  };
@@ -1346,243 +1601,10 @@ declare const experimental_readRawConfig: (args: ReadConfigCommandArgs, options?
1346
1601
  userConfigPath: string | undefined;
1347
1602
  };
1348
1603
 
1349
- /**
1350
- * A symbol to inherit a binding from the deployed worker.
1351
- */
1352
- declare const INHERIT_SYMBOL: unique symbol;
1353
-
1354
- /**
1355
- * The type of Worker
1356
- */
1357
- type CfScriptFormat = "modules" | "service-worker";
1358
- /**
1359
- * A module type.
1360
- */
1361
- type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
1362
- /**
1363
- * An imported module.
1364
- */
1365
- interface CfModule {
1366
- /**
1367
- * The module name.
1368
- *
1369
- * @example
1370
- * './src/index.js'
1371
- */
1372
- name: string;
1373
- /**
1374
- * The absolute path of the module on disk, or `undefined` if this is a
1375
- * virtual module. Used as the source URL for this module, so source maps are
1376
- * correctly resolved.
1377
- *
1378
- * @example
1379
- * '/path/to/src/index.js'
1380
- */
1381
- filePath: string | undefined;
1382
- /**
1383
- * The module content, usually JavaScript or WASM code.
1384
- *
1385
- * @example
1386
- * export default {
1387
- * async fetch(request) {
1388
- * return new Response('Ok')
1389
- * }
1390
- * }
1391
- */
1392
- content: string | Buffer<ArrayBuffer>;
1393
- /**
1394
- * An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present
1395
- * if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled
1396
- * we need to also copy the relevant sourcemaps into the final out directory.
1397
- */
1398
- sourceMap?: CfWorkerSourceMap;
1399
- /**
1400
- * The module type.
1401
- *
1402
- * If absent, will default to the main module's type.
1403
- */
1404
- type?: CfModuleType;
1405
- }
1406
- /**
1407
- * A KV namespace.
1408
- */
1409
- interface CfKvNamespace {
1410
- binding: string;
1411
- id?: string | typeof INHERIT_SYMBOL;
1412
- experimental_remote?: boolean;
1413
- raw?: boolean;
1414
- }
1415
- /**
1416
- * A binding to send email.
1417
- */
1418
- type CfSendEmailBindings = {
1419
- name: string;
1420
- experimental_remote?: boolean;
1421
- } & ({
1422
- destination_address?: string;
1423
- } | {
1424
- allowed_destination_addresses?: string[];
1425
- });
1426
- /**
1427
- * A binding to the AI project
1428
- */
1429
- interface CfAIBinding {
1430
- binding: string;
1431
- staging?: boolean;
1432
- experimental_remote?: boolean;
1433
- raw?: boolean;
1434
- }
1435
- /**
1436
- * A Durable Object.
1437
- */
1438
- interface CfDurableObject {
1439
- name: string;
1440
- class_name: string;
1441
- script_name?: string;
1442
- environment?: string;
1443
- }
1444
- interface CfWorkflow {
1445
- name: string;
1446
- class_name: string;
1447
- binding: string;
1448
- script_name?: string;
1449
- experimental_remote?: boolean;
1450
- raw?: boolean;
1451
- }
1452
- interface CfQueue {
1453
- binding: string;
1454
- queue_name: string;
1455
- delivery_delay?: number;
1456
- experimental_remote?: boolean;
1457
- raw?: boolean;
1458
- }
1459
- interface CfR2Bucket {
1460
- binding: string;
1461
- bucket_name?: string | typeof INHERIT_SYMBOL;
1462
- jurisdiction?: string;
1463
- experimental_remote?: boolean;
1464
- raw?: boolean;
1465
- }
1466
- interface CfD1Database {
1467
- binding: string;
1468
- database_id?: string | typeof INHERIT_SYMBOL;
1469
- database_name?: string;
1470
- preview_database_id?: string;
1471
- database_internal_env?: string;
1472
- migrations_table?: string;
1473
- migrations_dir?: string;
1474
- experimental_remote?: boolean;
1475
- raw?: boolean;
1476
- }
1477
- interface CfVectorize {
1478
- binding: string;
1479
- index_name: string;
1480
- raw?: boolean;
1481
- experimental_remote?: boolean;
1482
- }
1483
- interface CfSecretsStoreSecrets {
1484
- binding: string;
1485
- store_id: string;
1486
- secret_name: string;
1487
- }
1488
- interface CfHelloWorld {
1489
- binding: string;
1490
- enable_timer?: boolean;
1491
- }
1492
- interface CfHyperdrive {
1493
- binding: string;
1494
- id: string;
1495
- localConnectionString?: string;
1496
- }
1497
- interface CfService {
1498
- binding: string;
1499
- service: string;
1500
- environment?: string;
1501
- entrypoint?: string;
1502
- props?: Record<string, unknown>;
1503
- experimental_remote?: boolean;
1504
- }
1505
- interface CfAnalyticsEngineDataset {
1506
- binding: string;
1507
- dataset?: string;
1508
- }
1509
- interface CfDispatchNamespace {
1510
- binding: string;
1511
- namespace: string;
1512
- outbound?: {
1513
- service: string;
1514
- environment?: string;
1515
- parameters?: string[];
1516
- };
1517
- experimental_remote?: boolean;
1518
- }
1519
- interface CfMTlsCertificate {
1520
- binding: string;
1521
- certificate_id: string;
1522
- experimental_remote?: boolean;
1523
- }
1524
- interface CfLogfwdrBinding {
1525
- name: string;
1526
- destination: string;
1527
- }
1528
- interface CfPipeline {
1529
- binding: string;
1530
- pipeline: string;
1531
- experimental_remote?: boolean;
1532
- }
1533
- interface CfUnsafeBinding {
1534
- name: string;
1535
- type: string;
1536
- }
1537
- type CfUnsafeMetadata = Record<string, unknown>;
1538
- type CfCapnp = {
1539
- base_path?: never;
1540
- source_schemas?: never;
1541
- compiled_schema: string;
1542
- } | {
1543
- base_path: string;
1544
- source_schemas: string[];
1545
- compiled_schema?: never;
1546
- };
1547
- interface CfUnsafe {
1548
- bindings: CfUnsafeBinding[] | undefined;
1549
- metadata: CfUnsafeMetadata | undefined;
1550
- capnp: CfCapnp | undefined;
1551
- }
1552
- interface CfTailConsumer {
1553
- service: string;
1554
- environment?: string;
1555
- }
1556
- interface CfWorkerSourceMap {
1557
- /**
1558
- * The name of the source map.
1559
- *
1560
- * @example
1561
- * 'out.js.map'
1562
- */
1563
- name: string;
1564
- /**
1565
- * The content of the source map, which is a JSON object described by the v3
1566
- * spec.
1567
- *
1568
- * @example
1569
- * {
1570
- * "version" : 3,
1571
- * "file": "out.js",
1572
- * "sourceRoot": "",
1573
- * "sources": ["foo.js", "bar.js"],
1574
- * "sourcesContent": [null, null],
1575
- * "names": ["src", "maps", "are", "fun"],
1576
- * "mappings": "A,AAAB;;ABCDE;"
1577
- * }
1578
- */
1579
- content: string | Buffer;
1580
- }
1581
-
1582
- interface EnablePagesAssetsServiceBindingOptions {
1583
- proxyPort?: number;
1584
- directory?: string;
1585
- }
1604
+ interface EnablePagesAssetsServiceBindingOptions {
1605
+ proxyPort?: number;
1606
+ directory?: string;
1607
+ }
1586
1608
 
1587
1609
  interface Unstable_DevOptions {
1588
1610
  config?: string;
@@ -1777,6 +1799,7 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1777
1799
  modified_on: string;
1778
1800
  short_id: string;
1779
1801
  build_image_major_version: number;
1802
+ kv_namespaces?: any;
1780
1803
  source?: {
1781
1804
  type: "github" | "gitlab";
1782
1805
  config: {
@@ -1791,7 +1814,6 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
1791
1814
  preview_branch_excludes?: string[] | undefined;
1792
1815
  };
1793
1816
  } | undefined;
1794
- kv_namespaces?: any;
1795
1817
  env_vars?: any;
1796
1818
  durable_object_namespaces?: any;
1797
1819
  is_skipped?: boolean | undefined;
@@ -1811,26 +1833,6 @@ declare const unstable_pages: {
1811
1833
  */
1812
1834
  type ComplianceConfig = Partial<Pick<Config, "compliance_region">>;
1813
1835
 
1814
- type WorkerRegistry = Record<string, WorkerDefinition>;
1815
- type WorkerEntrypointsDefinition = Record<"default" | string, {
1816
- host: string;
1817
- port: number;
1818
- } | undefined>;
1819
- type WorkerDefinition = {
1820
- port: number | undefined;
1821
- protocol: "http" | "https" | undefined;
1822
- host: string | undefined;
1823
- mode: "local" | "remote";
1824
- headers?: Record<string, string>;
1825
- entrypointAddresses?: WorkerEntrypointsDefinition;
1826
- durableObjects: {
1827
- name: string;
1828
- className: string;
1829
- }[];
1830
- durableObjectsHost?: string;
1831
- durableObjectsPort?: number;
1832
- };
1833
-
1834
1836
  type _Params<ParamsArray extends [unknown?]> = ParamsArray extends [infer P] ? P : undefined;
1835
1837
  type _EventMethods = keyof Protocol.Events;
1836
1838
  type DevToolsEvent<Method extends _EventMethods> = Method extends unknown ? {
@@ -1948,6 +1950,7 @@ declare class ConfigController extends Controller<ConfigControllerEventMap> {
1948
1950
  latestConfig?: StartDevWorkerOptions;
1949
1951
  set(input: StartDevWorkerInput, throwErrors?: boolean): Promise<StartDevWorkerOptions | undefined>;
1950
1952
  patch(input: Partial<StartDevWorkerInput>): Promise<StartDevWorkerOptions | undefined>;
1953
+ onDevRegistryUpdate(event: DevRegistryUpdateEvent): void;
1951
1954
  teardown(): Promise<void>;
1952
1955
  emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
1953
1956
  }
@@ -2073,8 +2076,6 @@ interface StartDevWorkerInput {
2073
2076
  outboundService?: ServiceFetch;
2074
2077
  /** An undici MockAgent to declaratively mock fetch calls to particular resources. */
2075
2078
  mockFetch?: undici.MockAgent;
2076
- /** Describes the registry of other Workers running locally */
2077
- registry?: WorkerRegistry | null;
2078
2079
  testScheduled?: boolean;
2079
2080
  /** Whether to use Vectorize as a remote binding -- the worker is run locally but accesses to Vectorize are made remotely */
2080
2081
  bindVectorizeToProd?: boolean;
@@ -2087,6 +2088,8 @@ interface StartDevWorkerInput {
2087
2088
  containerBuildId?: string;
2088
2089
  /** Whether to build and connect to containers during local dev. Requires Docker daemon to be running. Defaults to true. */
2089
2090
  enableContainers?: boolean;
2091
+ /** Path to the dev registry directory */
2092
+ registry?: string;
2090
2093
  /** Path to the docker executable. Defaults to 'docker' */
2091
2094
  dockerPath?: string;
2092
2095
  /** Options for the container engine */
@@ -2262,6 +2265,10 @@ type ReloadCompleteEvent = {
2262
2265
  bundle: Bundle;
2263
2266
  proxyData: ProxyData;
2264
2267
  };
2268
+ type DevRegistryUpdateEvent = {
2269
+ type: "devRegistryUpdate";
2270
+ registry: WorkerRegistry;
2271
+ };
2265
2272
  type PreviewTokenExpiredEvent = {
2266
2273
  type: "previewTokenExpired";
2267
2274
  proxyData: ProxyData;
@@ -2324,8 +2331,6 @@ type ProxyData = {
2324
2331
  headers: Record<string, string>;
2325
2332
  liveReload?: boolean;
2326
2333
  proxyLogsToController?: boolean;
2327
- internalDurableObjects?: CfDurableObject[];
2328
- entrypointAddresses: WorkerEntrypointsDefinition | undefined;
2329
2334
  };
2330
2335
 
2331
2336
  interface TypedEventEmitter<EventMap extends Record<string | symbol, unknown[]>> extends EventEmitter {
@@ -2354,6 +2359,7 @@ declare abstract class Controller<EventMap extends ControllerEventMap = Controll
2354
2359
  type RuntimeControllerEventMap = ControllerEventMap & {
2355
2360
  reloadStart: [ReloadStartEvent];
2356
2361
  reloadComplete: [ReloadCompleteEvent];
2362
+ devRegistryUpdate: [DevRegistryUpdateEvent];
2357
2363
  };
2358
2364
  declare abstract class RuntimeController extends Controller<RuntimeControllerEventMap> {
2359
2365
  abstract onBundleStart(_: BundleStartEvent): void;
@@ -2908,13 +2914,100 @@ type DefinitionTreeNode = {
2908
2914
  };
2909
2915
  type DefinitionTree = Map<string, DefinitionTreeNode>;
2910
2916
 
2917
+ type CreateCommandResult<NamedArgDefs extends NamedArgDefinitions> = DeepFlatten<{
2918
+ args: HandlerArgs<NamedArgDefs>;
2919
+ }>;
2920
+
2921
+ /**
2922
+ * Class responsible for registering and managing commands within a command registry.
2923
+ */
2924
+ declare class CommandRegistry {
2925
+ #private;
2926
+ /**
2927
+ * Initializes the command registry with the given command registration function.
2928
+ */
2929
+ constructor(registerCommand: RegisterCommand);
2930
+ /**
2931
+ * Defines multiple commands and their corresponding definitions.
2932
+ */
2933
+ define(defs: {
2934
+ command: Command;
2935
+ definition: AliasDefinition | CreateCommandResult<NamedArgDefinitions> | NamespaceDefinition;
2936
+ }[]): void;
2937
+ getDefinitionTreeRoot(): DefinitionTreeNode;
2938
+ /**
2939
+ * Registers all commands in the command registry, walking through the definition tree.
2940
+ */
2941
+ registerAll(): void;
2942
+ /**
2943
+ * Registers a specific namespace if not already registered.
2944
+ * TODO: Remove this once all commands use the command registry.
2945
+ * See https://github.com/cloudflare/workers-sdk/pull/7357#discussion_r1862138470 for more details.
2946
+ */
2947
+ registerNamespace(namespace: string): void;
2948
+ }
2949
+ /**
2950
+ * Type for the function used to register commands.
2951
+ */
2952
+ type RegisterCommand = (segment: string, def: InternalDefinition, registerSubTreeCallback: () => void) => void;
2953
+
2954
+ declare function createCLIParser(argv: string[]): {
2955
+ wrangler: CommonYargsArgv;
2956
+ registry: CommandRegistry;
2957
+ globalFlags: {
2958
+ readonly v: {
2959
+ readonly describe: "Show version number";
2960
+ readonly alias: "version";
2961
+ readonly type: "boolean";
2962
+ };
2963
+ readonly cwd: {
2964
+ readonly describe: "Run as if Wrangler was started in the specified directory instead of the current working directory";
2965
+ readonly type: "string";
2966
+ readonly requiresArg: true;
2967
+ };
2968
+ readonly config: {
2969
+ readonly alias: "c";
2970
+ readonly describe: "Path to Wrangler configuration file";
2971
+ readonly type: "string";
2972
+ readonly requiresArg: true;
2973
+ };
2974
+ readonly env: {
2975
+ readonly alias: "e";
2976
+ readonly describe: "Environment to use for operations, and for selecting .env and .dev.vars files";
2977
+ readonly type: "string";
2978
+ readonly requiresArg: true;
2979
+ };
2980
+ readonly "env-file": {
2981
+ readonly describe: "Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files";
2982
+ readonly type: "string";
2983
+ readonly array: true;
2984
+ readonly requiresArg: true;
2985
+ };
2986
+ readonly "experimental-remote-bindings": {
2987
+ readonly describe: "Experimental: Enable Remote Bindings";
2988
+ readonly type: "boolean";
2989
+ readonly hidden: true;
2990
+ readonly alias: readonly ["x-remote-bindings"];
2991
+ };
2992
+ readonly "experimental-provision": {
2993
+ readonly describe: "Experimental: Enable automatic resource provisioning";
2994
+ readonly type: "boolean";
2995
+ readonly hidden: true;
2996
+ readonly alias: readonly ["x-provision"];
2997
+ };
2998
+ };
2999
+ };
3000
+
2911
3001
  /**
2912
3002
  * EXPERIMENTAL: Get all registered Wrangler commands for documentation generation.
2913
3003
  * This API is experimental and may change without notice.
2914
3004
  *
2915
- * @returns The complete command tree structure with all metadata
3005
+ * @returns An object containing the command tree structure and global flags
2916
3006
  */
2917
- declare function experimental_getWranglerCommands(): DefinitionTreeNode;
3007
+ declare function experimental_getWranglerCommands(): {
3008
+ registry: DefinitionTreeNode;
3009
+ globalFlags: ReturnType<typeof createCLIParser>["globalFlags"];
3010
+ };
2918
3011
 
2919
3012
  interface Unstable_ASSETSBindingsOptions {
2920
3013
  log: Logger;