wrangler 0.0.21 → 0.0.24

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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/bin/wrangler.js +10 -1
  3. package/miniflare-dist/index.mjs +79 -0
  4. package/miniflare-dist/index.mjs.map +7 -0
  5. package/package.json +3 -4
  6. package/src/__tests__/configuration.test.ts +522 -300
  7. package/src/__tests__/dev.test.tsx +99 -3
  8. package/src/__tests__/guess-worker-format.test.ts +10 -0
  9. package/src/__tests__/index.test.ts +3 -11
  10. package/src/__tests__/kv.test.ts +16 -18
  11. package/src/__tests__/pages.test.ts +48 -10
  12. package/src/__tests__/publish.test.ts +1319 -421
  13. package/src/__tests__/r2.test.ts +4 -4
  14. package/src/__tests__/tail.test.ts +29 -4
  15. package/src/bundle.ts +15 -2
  16. package/src/config/README.md +6 -6
  17. package/src/config/config.ts +16 -77
  18. package/src/config/environment.ts +67 -1
  19. package/src/config/index.ts +13 -3
  20. package/src/config/validation-helpers.ts +105 -19
  21. package/src/config/validation.ts +272 -97
  22. package/src/dev/dev.tsx +72 -42
  23. package/src/dev/local.tsx +103 -118
  24. package/src/dev/use-esbuild.ts +4 -0
  25. package/src/entry.ts +84 -3
  26. package/src/index.tsx +137 -113
  27. package/src/intl-polyfill.d.ts +139 -0
  28. package/src/kv.ts +7 -27
  29. package/src/miniflare-cli/README.md +30 -0
  30. package/src/miniflare-cli/enum-keys.ts +17 -0
  31. package/src/miniflare-cli/index.ts +37 -0
  32. package/src/module-collection.ts +58 -53
  33. package/src/pages.tsx +26 -10
  34. package/src/publish.ts +17 -21
  35. package/src/sites.tsx +59 -52
  36. package/src/tail/printing.ts +2 -2
  37. package/src/user.tsx +12 -3
  38. package/wrangler-dist/cli.js +836 -649
  39. package/wrangler-dist/cli.js.map +2 -2
  40. package/src/__tests__/dev2.test.tsx +0 -154
package/src/index.tsx CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  unexpectedKeyValueProps,
33
33
  } from "./kv";
34
34
  import { getPackageManager } from "./package-manager";
35
- import { pages } from "./pages";
35
+ import { pages, pagesBetaWarning } from "./pages";
36
36
  import { formatMessage, ParseError, parseJSON, readFileSync } from "./parse";
37
37
  import publish from "./publish";
38
38
  import { createR2Bucket, deleteR2Bucket, listR2Buckets } from "./r2";
@@ -100,24 +100,36 @@ function printWranglerBanner() {
100
100
  }
101
101
 
102
102
  function isLegacyEnv(args: unknown, config: Config): boolean {
103
- return (
104
- (args as { "legacy-env": boolean | undefined })["legacy-env"] ??
105
- config.legacy_env
106
- );
103
+ return config.legacy_env;
107
104
  }
108
105
 
109
106
  function getScriptName(
110
107
  args: { name: string | undefined; env: string | undefined },
111
108
  config: Config
112
109
  ): string | undefined {
113
- const shortScriptName = args.name ?? config.name;
114
- if (!shortScriptName) {
115
- return;
110
+ if (args.name && isLegacyEnv(args, config) && args.env) {
111
+ throw new CommandLineArgsError(
112
+ "In legacy environment mode you cannot use --name and --env together. If you want to specify a Worker name for a specific environment you can add the following to your wrangler.toml config:" +
113
+ `
114
+ [env.${args.env}]
115
+ name = "${args.name}"
116
+ `
117
+ );
116
118
  }
117
119
 
118
- return isLegacyEnv(args, config)
119
- ? `${shortScriptName}${args.env ? `-${args.env}` : ""}`
120
- : shortScriptName;
120
+ return args.name ?? config.name;
121
+ }
122
+
123
+ /**
124
+ * Alternative to the getScriptName() because special Legacy cases allowed "name", and "env" together in Wrangler1
125
+ */
126
+ function getLegacyScriptName(
127
+ args: { name: string | undefined; env: string | undefined },
128
+ config: Config
129
+ ) {
130
+ return args.name && args.env && isLegacyEnv(args, config)
131
+ ? `${args.name}-${args.env}`
132
+ : args.name ?? config.name;
121
133
  }
122
134
 
123
135
  /**
@@ -207,6 +219,7 @@ class DeprecationError extends Error {
207
219
 
208
220
  export async function main(argv: string[]): Promise<void> {
209
221
  const wrangler = makeCLI(argv)
222
+ .strict()
210
223
  // We handle errors ourselves in a try-catch around `yargs.parse`.
211
224
  // If you want the "help info" to be displayed then throw an instance of `CommandLineArgsError`.
212
225
  // Otherwise we just log the error that was thrown without any "help info".
@@ -285,6 +298,12 @@ export async function main(argv: string[]): Promise<void> {
285
298
  describe: "The name of your worker",
286
299
  type: "string",
287
300
  })
301
+ .option("type", {
302
+ describe: "The type of worker to create",
303
+ type: "string",
304
+ choices: ["rust", "javascript", "webpack"],
305
+ deprecated: true,
306
+ })
288
307
  .option("yes", {
289
308
  describe: 'Answer "yes" to any prompts for new projects',
290
309
  type: "boolean",
@@ -293,7 +312,7 @@ export async function main(argv: string[]): Promise<void> {
293
312
  },
294
313
  async (args) => {
295
314
  printWranglerBanner();
296
- if ("type" in args) {
315
+ if (args.type) {
297
316
  let message = "The --type option is no longer supported.";
298
317
  if (args.type === "webpack") {
299
318
  message +=
@@ -711,6 +730,7 @@ export async function main(argv: string[]): Promise<void> {
711
730
  .option("env", {
712
731
  describe: "Perform on a specific environment",
713
732
  type: "string",
733
+ alias: "e",
714
734
  })
715
735
  .option("compatibility-date", {
716
736
  describe: "Date to use for compatibility checks",
@@ -785,6 +805,10 @@ export async function main(argv: string[]): Promise<void> {
785
805
  describe: "The function that is called for each JSX fragment",
786
806
  type: "string",
787
807
  })
808
+ .option("tsconfig", {
809
+ describe: "Path to a custom tsconfig.json file",
810
+ type: "string",
811
+ })
788
812
  .option("local", {
789
813
  alias: "l",
790
814
  describe: "Run on my machine",
@@ -798,10 +822,10 @@ export async function main(argv: string[]): Promise<void> {
798
822
  },
799
823
  async (args) => {
800
824
  printWranglerBanner();
801
- const config = readConfig(
825
+ const configPath =
802
826
  (args.config as ConfigPath) ||
803
- (args.script && findWranglerToml(path.dirname(args.script)))
804
- );
827
+ (args.script && findWranglerToml(path.dirname(args.script)));
828
+ const config = readConfig(configPath, args);
805
829
  const entry = await getEntry(args, config, "dev");
806
830
 
807
831
  if (args["experimental-public"]) {
@@ -857,16 +881,6 @@ export async function main(argv: string[]): Promise<void> {
857
881
  return zones[0]?.id;
858
882
  }
859
883
 
860
- const environments = config.env ?? {};
861
- const envRootObj = args.env ? environments[args.env] || {} : config;
862
-
863
- const hostLike =
864
- args.host ||
865
- config.dev.host ||
866
- (args.routes && args.routes[0]) ||
867
- envRootObj.route ||
868
- (envRootObj.routes && envRootObj.routes[0]);
869
-
870
884
  // When we're given a host (in one of the above ways), we do 2 things:
871
885
  // - We try to extract a host from it
872
886
  // - We try to get a zone id from the host
@@ -877,28 +891,37 @@ export async function main(argv: string[]): Promise<void> {
877
891
  // get a zone id for it, by lopping off subdomains until we get a hit
878
892
  // from the API. That's it!
879
893
 
880
- const host = typeof hostLike === "string" ? getHost(hostLike) : undefined;
881
-
882
- let zoneId: string | undefined;
883
- const hostPieces = typeof host === "string" ? host.split(".") : undefined;
884
-
885
- while (hostPieces && hostPieces.length > 1) {
886
- zoneId = await getZoneId(hostPieces.join("."));
887
- if (zoneId) break;
888
- hostPieces.shift();
889
- }
890
- if (host && !zoneId) {
891
- throw new Error(`Could not find zone for ${hostLike}`);
894
+ let zone: { host: string; id: string } | undefined;
895
+
896
+ if (!args.local) {
897
+ const hostLike =
898
+ args.host ||
899
+ config.dev.host ||
900
+ (args.routes && args.routes[0]) ||
901
+ config.route ||
902
+ (config.routes && config.routes[0]);
903
+ const host =
904
+ typeof hostLike === "string" ? getHost(hostLike) : undefined;
905
+ let zoneId: string | undefined;
906
+ const hostPieces =
907
+ typeof host === "string" ? host.split(".") : undefined;
908
+ while (hostPieces && hostPieces.length > 1) {
909
+ zoneId = await getZoneId(hostPieces.join("."));
910
+ if (zoneId) break;
911
+ hostPieces.shift();
912
+ }
913
+ if (host && !zoneId) {
914
+ throw new Error(`Could not find zone for ${hostLike}`);
915
+ }
916
+ zone =
917
+ typeof zoneId === "string" && typeof host === "string"
918
+ ? {
919
+ host,
920
+ id: zoneId,
921
+ }
922
+ : undefined;
892
923
  }
893
924
 
894
- const zone =
895
- typeof zoneId === "string" && typeof host === "string"
896
- ? {
897
- host,
898
- id: zoneId,
899
- }
900
- : undefined;
901
-
902
925
  const { waitUntilExit } = render(
903
926
  <Dev
904
927
  name={getScriptName(args, config)}
@@ -907,10 +930,11 @@ export async function main(argv: string[]): Promise<void> {
907
930
  zone={zone}
908
931
  rules={getRules(config)}
909
932
  legacyEnv={isLegacyEnv(args, config)}
910
- buildCommand={config.build || {}}
933
+ build={config.build || {}}
911
934
  initialMode={args.local ? "local" : "remote"}
912
- jsxFactory={args["jsx-factory"] || envRootObj?.jsx_factory}
913
- jsxFragment={args["jsx-fragment"] || envRootObj?.jsx_fragment}
935
+ jsxFactory={args["jsx-factory"] || config.jsx_factory}
936
+ jsxFragment={args["jsx-fragment"] || config.jsx_fragment}
937
+ tsconfig={args.tsconfig ?? config.tsconfig}
914
938
  upstreamProtocol={upstreamProtocol}
915
939
  localProtocol={
916
940
  // The typings are not quite clever enough to handle element accesses, only property accesses,
@@ -945,9 +969,9 @@ export async function main(argv: string[]): Promise<void> {
945
969
  (args["compatibility-flags"] as string[]) ||
946
970
  config.compatibility_flags
947
971
  }
948
- usageModel={envRootObj.usage_model}
972
+ usageModel={config.usage_model}
949
973
  bindings={{
950
- kv_namespaces: envRootObj.kv_namespaces?.map(
974
+ kv_namespaces: config.kv_namespaces?.map(
951
975
  ({ binding, preview_id, id: _id }) => {
952
976
  // In `dev`, we make folks use a separate kv namespace called
953
977
  // `preview_id` instead of `id` so that they don't
@@ -968,12 +992,12 @@ export async function main(argv: string[]): Promise<void> {
968
992
  };
969
993
  }
970
994
  ),
971
- vars: envRootObj.vars,
995
+ vars: config.vars,
972
996
  wasm_modules: config.wasm_modules,
973
997
  text_blobs: config.text_blobs,
974
- durable_objects: envRootObj.durable_objects,
975
- r2_buckets: envRootObj.r2_buckets,
976
- unsafe: envRootObj.unsafe?.bindings,
998
+ durable_objects: config.durable_objects,
999
+ r2_buckets: config.r2_buckets,
1000
+ unsafe: config.unsafe?.bindings,
977
1001
  }}
978
1002
  />
979
1003
  );
@@ -990,6 +1014,7 @@ export async function main(argv: string[]): Promise<void> {
990
1014
  .option("env", {
991
1015
  type: "string",
992
1016
  describe: "Perform on a specific environment",
1017
+ alias: "e",
993
1018
  })
994
1019
  .positional("script", {
995
1020
  describe: "The path to an entry point for your worker",
@@ -1054,6 +1079,10 @@ export async function main(argv: string[]): Promise<void> {
1054
1079
  .option("jsx-fragment", {
1055
1080
  describe: "The function that is called for each JSX fragment",
1056
1081
  type: "string",
1082
+ })
1083
+ .option("tsconfig", {
1084
+ describe: "Path to a custom tsconfig.json file",
1085
+ type: "string",
1057
1086
  });
1058
1087
  },
1059
1088
  async (args) => {
@@ -1069,10 +1098,10 @@ export async function main(argv: string[]): Promise<void> {
1069
1098
  );
1070
1099
  }
1071
1100
 
1072
- const config = readConfig(
1101
+ const configPath =
1073
1102
  (args.config as ConfigPath) ||
1074
- (args.script && findWranglerToml(path.dirname(args.script)))
1075
- );
1103
+ (args.script && findWranglerToml(path.dirname(args.script)));
1104
+ const config = readConfig(configPath, args);
1076
1105
  const entry = await getEntry(args, config, "publish");
1077
1106
 
1078
1107
  if (args.latest) {
@@ -1103,6 +1132,7 @@ export async function main(argv: string[]): Promise<void> {
1103
1132
  triggers: args.triggers,
1104
1133
  jsxFactory: args["jsx-factory"],
1105
1134
  jsxFragment: args["jsx-fragment"],
1135
+ tsconfig: args.tsconfig,
1106
1136
  routes: args.routes,
1107
1137
  assetPaths,
1108
1138
  legacyEnv: isLegacyEnv(args, config),
@@ -1124,7 +1154,7 @@ export async function main(argv: string[]): Promise<void> {
1124
1154
  })
1125
1155
  // TODO: auto-detect if this should be json or pretty based on atty
1126
1156
  .option("format", {
1127
- default: "json",
1157
+ default: "pretty",
1128
1158
  choices: ["json", "pretty"],
1129
1159
  describe: "The format of log entries",
1130
1160
  })
@@ -1159,6 +1189,7 @@ export async function main(argv: string[]): Promise<void> {
1159
1189
  .option("env", {
1160
1190
  type: "string",
1161
1191
  describe: "Perform on a specific environment",
1192
+ alias: "e",
1162
1193
  })
1163
1194
  .option("debug", {
1164
1195
  type: "boolean",
@@ -1173,9 +1204,9 @@ export async function main(argv: string[]): Promise<void> {
1173
1204
  if (args.format === "pretty") {
1174
1205
  printWranglerBanner();
1175
1206
  }
1176
- const config = readConfig(args.config as ConfigPath);
1207
+ const config = readConfig(args.config as ConfigPath, args);
1177
1208
 
1178
- const scriptName = getScriptName(args, config);
1209
+ const scriptName = getLegacyScriptName(args, config);
1179
1210
 
1180
1211
  if (!scriptName) {
1181
1212
  throw new Error("Missing script name");
@@ -1286,14 +1317,11 @@ export async function main(argv: string[]): Promise<void> {
1286
1317
  "***************************************************\n"
1287
1318
  );
1288
1319
 
1289
- const config = readConfig(args.config as ConfigPath);
1320
+ const config = readConfig(args.config as ConfigPath, args);
1290
1321
  const entry = await getEntry({}, config, "dev");
1291
1322
 
1292
1323
  const accountId = await requireAuth(config);
1293
1324
 
1294
- const environments = config.env ?? {};
1295
- const envRootObj = args.env ? environments[args.env] || {} : config;
1296
-
1297
1325
  const { waitUntilExit } = render(
1298
1326
  <Dev
1299
1327
  name={config.name}
@@ -1302,10 +1330,11 @@ export async function main(argv: string[]): Promise<void> {
1302
1330
  env={args.env}
1303
1331
  zone={undefined}
1304
1332
  legacyEnv={isLegacyEnv(args, config)}
1305
- buildCommand={config.build || {}}
1333
+ build={config.build || {}}
1306
1334
  initialMode={args.local ? "local" : "remote"}
1307
- jsxFactory={envRootObj?.jsx_factory}
1308
- jsxFragment={envRootObj?.jsx_fragment}
1335
+ jsxFactory={config.jsx_factory}
1336
+ jsxFragment={config.jsx_fragment}
1337
+ tsconfig={config.tsconfig}
1309
1338
  upstreamProtocol={config.dev.upstream_protocol}
1310
1339
  localProtocol={config.dev.local_protocol}
1311
1340
  enableLocalPersistence={false}
@@ -1324,7 +1353,7 @@ export async function main(argv: string[]): Promise<void> {
1324
1353
  }
1325
1354
  usageModel={config.usage_model}
1326
1355
  bindings={{
1327
- kv_namespaces: envRootObj.kv_namespaces?.map(
1356
+ kv_namespaces: config.kv_namespaces?.map(
1328
1357
  ({ binding, preview_id, id: _id }) => {
1329
1358
  // In `dev`, we make folks use a separate kv namespace called
1330
1359
  // `preview_id` instead of `id` so that they don't
@@ -1345,12 +1374,12 @@ export async function main(argv: string[]): Promise<void> {
1345
1374
  };
1346
1375
  }
1347
1376
  ),
1348
- vars: envRootObj.vars,
1377
+ vars: config.vars,
1349
1378
  wasm_modules: config.wasm_modules,
1350
1379
  text_blobs: config.text_blobs,
1351
- durable_objects: envRootObj.durable_objects,
1352
- r2_buckets: envRootObj.r2_buckets,
1353
- unsafe: envRootObj.unsafe?.bindings,
1380
+ durable_objects: config.durable_objects,
1381
+ r2_buckets: config.r2_buckets,
1382
+ unsafe: config.unsafe?.bindings,
1354
1383
  }}
1355
1384
  inspectorPort={await getPort({ port: 9229 })}
1356
1385
  />
@@ -1398,7 +1427,7 @@ export async function main(argv: string[]): Promise<void> {
1398
1427
  }
1399
1428
  )
1400
1429
  .command(
1401
- "delete",
1430
+ "delete [id]",
1402
1431
  "Delete a route associated with a zone",
1403
1432
  (yargs) => {
1404
1433
  return yargs
@@ -1473,13 +1502,14 @@ export async function main(argv: string[]): Promise<void> {
1473
1502
  type: "string",
1474
1503
  describe:
1475
1504
  "Binds the secret to the Worker of the specific environment",
1505
+ alias: "e",
1476
1506
  });
1477
1507
  },
1478
1508
  async (args) => {
1479
1509
  printWranglerBanner();
1480
- const config = readConfig(args.config as ConfigPath);
1510
+ const config = readConfig(args.config as ConfigPath, args);
1481
1511
 
1482
- const scriptName = getScriptName(args, config);
1512
+ const scriptName = getLegacyScriptName(args, config);
1483
1513
  if (!scriptName) {
1484
1514
  throw new Error("Missing script name");
1485
1515
  }
@@ -1590,12 +1620,13 @@ export async function main(argv: string[]): Promise<void> {
1590
1620
  type: "string",
1591
1621
  describe:
1592
1622
  "Binds the secret to the Worker of the specific environment",
1623
+ alias: "e",
1593
1624
  });
1594
1625
  },
1595
1626
  async (args) => {
1596
- const config = readConfig(args.config as ConfigPath);
1627
+ const config = readConfig(args.config as ConfigPath, args);
1597
1628
 
1598
- const scriptName = getScriptName(args, config);
1629
+ const scriptName = getLegacyScriptName(args, config);
1599
1630
  if (!scriptName) {
1600
1631
  throw new Error("Missing script name");
1601
1632
  }
@@ -1640,12 +1671,13 @@ export async function main(argv: string[]): Promise<void> {
1640
1671
  type: "string",
1641
1672
  describe:
1642
1673
  "Binds the secret to the Worker of the specific environment.",
1674
+ alias: "e",
1643
1675
  });
1644
1676
  },
1645
1677
  async (args) => {
1646
- const config = readConfig(args.config as ConfigPath);
1678
+ const config = readConfig(args.config as ConfigPath, args);
1647
1679
 
1648
- const scriptName = getScriptName(args, config);
1680
+ const scriptName = getLegacyScriptName(args, config);
1649
1681
  if (!scriptName) {
1650
1682
  throw new Error("Missing script name");
1651
1683
  }
@@ -1684,6 +1716,7 @@ export async function main(argv: string[]): Promise<void> {
1684
1716
  .option("env", {
1685
1717
  type: "string",
1686
1718
  describe: "Perform on a specific environment",
1719
+ alias: "e",
1687
1720
  })
1688
1721
  .option("preview", {
1689
1722
  type: "boolean",
@@ -1692,12 +1725,6 @@ export async function main(argv: string[]): Promise<void> {
1692
1725
  },
1693
1726
  async (args) => {
1694
1727
  printWranglerBanner();
1695
- if (args._.length > 2) {
1696
- const extraArgs = args._.slice(2).join(" ");
1697
- throw new CommandLineArgsError(
1698
- `Unexpected additional positional arguments "${extraArgs}".`
1699
- );
1700
- }
1701
1728
 
1702
1729
  if (!isValidNamespaceBinding(args.namespace)) {
1703
1730
  throw new CommandLineArgsError(
@@ -1705,7 +1732,7 @@ export async function main(argv: string[]): Promise<void> {
1705
1732
  );
1706
1733
  }
1707
1734
 
1708
- const config = readConfig(args.config as ConfigPath);
1735
+ const config = readConfig(args.config as ConfigPath, args);
1709
1736
  if (!config.name) {
1710
1737
  console.warn(
1711
1738
  "No configured name present, using `worker` as a prefix for the title"
@@ -1742,7 +1769,7 @@ export async function main(argv: string[]): Promise<void> {
1742
1769
  "Outputs a list of all KV namespaces associated with your account id.",
1743
1770
  {},
1744
1771
  async (args) => {
1745
- const config = readConfig(args.config as ConfigPath);
1772
+ const config = readConfig(args.config as ConfigPath, args);
1746
1773
 
1747
1774
  const accountId = await requireAuth(config);
1748
1775
 
@@ -1770,6 +1797,7 @@ export async function main(argv: string[]): Promise<void> {
1770
1797
  .option("env", {
1771
1798
  type: "string",
1772
1799
  describe: "Perform on a specific environment",
1800
+ alias: "e",
1773
1801
  })
1774
1802
  .option("preview", {
1775
1803
  type: "boolean",
@@ -1778,7 +1806,7 @@ export async function main(argv: string[]): Promise<void> {
1778
1806
  },
1779
1807
  async (args) => {
1780
1808
  printWranglerBanner();
1781
- const config = readConfig(args.config as ConfigPath);
1809
+ const config = readConfig(args.config as ConfigPath, args);
1782
1810
 
1783
1811
  let id;
1784
1812
  try {
@@ -1851,6 +1879,7 @@ export async function main(argv: string[]): Promise<void> {
1851
1879
  .option("env", {
1852
1880
  type: "string",
1853
1881
  describe: "Perform on a specific environment",
1882
+ alias: "e",
1854
1883
  })
1855
1884
  .option("preview", {
1856
1885
  type: "boolean",
@@ -1873,7 +1902,7 @@ export async function main(argv: string[]): Promise<void> {
1873
1902
  },
1874
1903
  async ({ key, ttl, expiration, ...args }) => {
1875
1904
  printWranglerBanner();
1876
- const config = readConfig(args.config as ConfigPath);
1905
+ const config = readConfig(args.config as ConfigPath, args);
1877
1906
  const namespaceId = getNamespaceId(args, config);
1878
1907
  // One of `args.path` and `args.value` must be defined
1879
1908
  const value = args.path
@@ -1918,6 +1947,7 @@ export async function main(argv: string[]): Promise<void> {
1918
1947
  .option("env", {
1919
1948
  type: "string",
1920
1949
  describe: "Perform on a specific environment",
1950
+ alias: "e",
1921
1951
  })
1922
1952
  .option("preview", {
1923
1953
  type: "boolean",
@@ -1932,7 +1962,7 @@ export async function main(argv: string[]): Promise<void> {
1932
1962
  },
1933
1963
  async ({ prefix, ...args }) => {
1934
1964
  // TODO: support for limit+cursor (pagination)
1935
- const config = readConfig(args.config as ConfigPath);
1965
+ const config = readConfig(args.config as ConfigPath, args);
1936
1966
  const namespaceId = getNamespaceId(args, config);
1937
1967
 
1938
1968
  const accountId = await requireAuth(config);
@@ -1967,6 +1997,7 @@ export async function main(argv: string[]): Promise<void> {
1967
1997
  .option("env", {
1968
1998
  type: "string",
1969
1999
  describe: "Perform on a specific environment",
2000
+ alias: "e",
1970
2001
  })
1971
2002
  .option("preview", {
1972
2003
  type: "boolean",
@@ -1980,7 +2011,7 @@ export async function main(argv: string[]): Promise<void> {
1980
2011
  });
1981
2012
  },
1982
2013
  async ({ key, ...args }) => {
1983
- const config = readConfig(args.config as ConfigPath);
2014
+ const config = readConfig(args.config as ConfigPath, args);
1984
2015
  const namespaceId = getNamespaceId(args, config);
1985
2016
 
1986
2017
  const accountId = await requireAuth(config);
@@ -2010,6 +2041,7 @@ export async function main(argv: string[]): Promise<void> {
2010
2041
  .option("env", {
2011
2042
  type: "string",
2012
2043
  describe: "Perform on a specific environment",
2044
+ alias: "e",
2013
2045
  })
2014
2046
  .option("preview", {
2015
2047
  type: "boolean",
@@ -2018,7 +2050,7 @@ export async function main(argv: string[]): Promise<void> {
2018
2050
  },
2019
2051
  async ({ key, ...args }) => {
2020
2052
  printWranglerBanner();
2021
- const config = readConfig(args.config as ConfigPath);
2053
+ const config = readConfig(args.config as ConfigPath, args);
2022
2054
  const namespaceId = getNamespaceId(args, config);
2023
2055
 
2024
2056
  console.log(
@@ -2065,6 +2097,7 @@ export async function main(argv: string[]): Promise<void> {
2065
2097
  .option("env", {
2066
2098
  type: "string",
2067
2099
  describe: "Perform on a specific environment",
2100
+ alias: "e",
2068
2101
  })
2069
2102
  .option("preview", {
2070
2103
  type: "boolean",
@@ -2077,7 +2110,7 @@ export async function main(argv: string[]): Promise<void> {
2077
2110
  // This could be made more efficient with a streaming parser/uploader
2078
2111
  // but we'll do that in the future if needed.
2079
2112
 
2080
- const config = readConfig(args.config as ConfigPath);
2113
+ const config = readConfig(args.config as ConfigPath, args);
2081
2114
  const namespaceId = getNamespaceId(args, config);
2082
2115
  const content = parseJSON(readFileSync(filename), filename);
2083
2116
 
@@ -2170,6 +2203,7 @@ export async function main(argv: string[]): Promise<void> {
2170
2203
  .option("env", {
2171
2204
  type: "string",
2172
2205
  describe: "Perform on a specific environment",
2206
+ alias: "e",
2173
2207
  })
2174
2208
  .option("preview", {
2175
2209
  type: "boolean",
@@ -2183,7 +2217,7 @@ export async function main(argv: string[]): Promise<void> {
2183
2217
  },
2184
2218
  async ({ filename, ...args }) => {
2185
2219
  printWranglerBanner();
2186
- const config = readConfig(args.config as ConfigPath);
2220
+ const config = readConfig(args.config as ConfigPath, args);
2187
2221
  const namespaceId = getNamespaceId(args, config);
2188
2222
 
2189
2223
  if (!args.force) {
@@ -2244,8 +2278,12 @@ export async function main(argv: string[]): Promise<void> {
2244
2278
  }
2245
2279
  );
2246
2280
 
2247
- wrangler.command("pages", "⚡️ Configure Cloudflare Pages", (pagesYargs) =>
2248
- pages(pagesYargs.command(subHelp))
2281
+ wrangler.command(
2282
+ "pages",
2283
+ "⚡️ Configure Cloudflare Pages",
2284
+ async (pagesYargs) => {
2285
+ await pages(pagesYargs.command(subHelp).epilogue(pagesBetaWarning));
2286
+ }
2249
2287
  );
2250
2288
 
2251
2289
  wrangler.command("r2", "📦 Interact with an R2 store", (r2Yargs) => {
@@ -2264,15 +2302,8 @@ export async function main(argv: string[]): Promise<void> {
2264
2302
  },
2265
2303
  async (args) => {
2266
2304
  printWranglerBanner();
2267
- // We expect three values in `_`: `r2`, `bucket`, `create`.
2268
- if (args._.length > 3) {
2269
- const extraArgs = args._.slice(3).join(" ");
2270
- throw new CommandLineArgsError(
2271
- `Unexpected additional positional arguments "${extraArgs}".`
2272
- );
2273
- }
2274
2305
 
2275
- const config = readConfig(args.config as ConfigPath);
2306
+ const config = readConfig(args.config as ConfigPath, args);
2276
2307
 
2277
2308
  const accountId = await requireAuth(config);
2278
2309
 
@@ -2283,7 +2314,7 @@ export async function main(argv: string[]): Promise<void> {
2283
2314
  );
2284
2315
 
2285
2316
  r2BucketYargs.command("list", "List R2 buckets", {}, async (args) => {
2286
- const config = readConfig(args.config as ConfigPath);
2317
+ const config = readConfig(args.config as ConfigPath, args);
2287
2318
 
2288
2319
  const accountId = await requireAuth(config);
2289
2320
 
@@ -2302,15 +2333,8 @@ export async function main(argv: string[]): Promise<void> {
2302
2333
  },
2303
2334
  async (args) => {
2304
2335
  printWranglerBanner();
2305
- // We expect three values in `_`: `r2`, `bucket`, `delete`.
2306
- if (args._.length > 3) {
2307
- const extraArgs = args._.slice(3).join(" ");
2308
- throw new CommandLineArgsError(
2309
- `Unexpected additional positional arguments "${extraArgs}".`
2310
- );
2311
- }
2312
2336
 
2313
- const config = readConfig(args.config as ConfigPath);
2337
+ const config = readConfig(args.config as ConfigPath, args);
2314
2338
 
2315
2339
  const accountId = await requireAuth(config);
2316
2340