wrangler 4.7.0 → 4.7.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.7.0",
3
+ "version": "4.7.1",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -56,8 +56,8 @@
56
56
  "path-to-regexp": "6.3.0",
57
57
  "unenv": "2.0.0-rc.15",
58
58
  "workerd": "1.20250321.0",
59
- "@cloudflare/kv-asset-handler": "0.4.0",
60
- "miniflare": "4.20250321.1"
59
+ "miniflare": "4.20250321.2",
60
+ "@cloudflare/kv-asset-handler": "0.4.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aws-sdk/client-s3": "^3.721.0",
@@ -115,7 +115,7 @@
115
115
  "pretty-bytes": "^6.0.0",
116
116
  "prompts": "^2.4.2",
117
117
  "resolve": "^1.22.8",
118
- "rimraf": "^5.0.10",
118
+ "rimraf": "^6.0.1",
119
119
  "selfsigned": "^2.0.1",
120
120
  "semiver": "^1.1.0",
121
121
  "shell-quote": "^1.8.1",
@@ -135,11 +135,11 @@
135
135
  "xdg-app-paths": "^8.3.0",
136
136
  "xxhash-wasm": "^1.0.1",
137
137
  "yargs": "^17.7.2",
138
- "@cloudflare/cli": "1.1.1",
139
138
  "@cloudflare/eslint-config-worker": "1.1.0",
140
- "@cloudflare/pages-shared": "^0.13.20",
139
+ "@cloudflare/pages-shared": "^0.13.21",
141
140
  "@cloudflare/workers-shared": "0.17.1",
142
- "@cloudflare/workers-tsconfig": "0.0.0"
141
+ "@cloudflare/workers-tsconfig": "0.0.0",
142
+ "@cloudflare/cli": "1.1.1"
143
143
  },
144
144
  "peerDependencies": {
145
145
  "@cloudflare/workers-types": "^4.20250321.0"
@@ -81185,7 +81185,7 @@ var import_undici3 = __toESM(require_undici());
81185
81185
 
81186
81186
  // package.json
81187
81187
  var name = "wrangler";
81188
- var version = "4.7.0";
81188
+ var version = "4.7.1";
81189
81189
 
81190
81190
  // src/environment-variables/misc-variables.ts
81191
81191
  init_import_meta_url();
@@ -90086,11 +90086,14 @@ function hasCursor(result_info) {
90086
90086
  }
90087
90087
  __name(hasCursor, "hasCursor");
90088
90088
  function renderError(err, level = 0) {
90089
+ const indent = " ".repeat(level);
90089
90090
  const chainedMessages = err.error_chain?.map(
90090
90091
  (chainedError) => `
90091
- ${" ".repeat(level)}- ${renderError(chainedError, level + 1)}`
90092
+
90093
+ ${indent}- ${renderError(chainedError, level + 1)}`
90092
90094
  ).join("\n") ?? "";
90093
- return (err.code ? `${err.message} [code: ${err.code}]` : err.message) + chainedMessages;
90095
+ return (err.code ? `${err.message} [code: ${err.code}]` : err.message) + (err.documentation_url ? `
90096
+ ${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
90094
90097
  }
90095
90098
  __name(renderError, "renderError");
90096
90099
 
@@ -114338,6 +114341,22 @@ var CommandRegistrationError = class extends Error {
114338
114341
 
114339
114342
  // src/core/register-yargs-command.ts
114340
114343
  init_import_meta_url();
114344
+
114345
+ // src/utils/is-local.ts
114346
+ init_import_meta_url();
114347
+ function isLocal(args, defaultValue = true) {
114348
+ if (args.local === void 0 && args.remote === void 0) {
114349
+ return defaultValue;
114350
+ }
114351
+ return args.local === true || args.remote === false;
114352
+ }
114353
+ __name(isLocal, "isLocal");
114354
+ function printResourceLocation(location) {
114355
+ logger.log(source_default.hex("#BD5B08").bold("Resource location:"), location);
114356
+ }
114357
+ __name(printResourceLocation, "printResourceLocation");
114358
+
114359
+ // src/core/register-yargs-command.ts
114341
114360
  function createRegisterYargsCommand(yargs, subHelp) {
114342
114361
  return /* @__PURE__ */ __name(function registerCommand(segment, def, registerSubTreeCallback) {
114343
114362
  yargs.command(
@@ -114386,6 +114405,21 @@ function createHandler(def) {
114386
114405
  logger.warn(def.metadata.statusMessage);
114387
114406
  }
114388
114407
  await def.validateArgs?.(args);
114408
+ const shouldPrintResourceLocation = typeof def.behaviour?.printResourceLocation === "function" ? def.behaviour?.printResourceLocation(args) : def.behaviour?.printResourceLocation;
114409
+ if (shouldPrintResourceLocation) {
114410
+ const remote = "remote" in args && typeof args.remote === "boolean" ? args.remote : void 0;
114411
+ const local = "local" in args && typeof args.local === "boolean" ? args.local : void 0;
114412
+ const resourceIsLocal = isLocal({ remote, local });
114413
+ if (resourceIsLocal) {
114414
+ printResourceLocation("local");
114415
+ logger.log(
114416
+ `Use --remote if you want to access the remote instance.
114417
+ `
114418
+ );
114419
+ } else {
114420
+ printResourceLocation("remote");
114421
+ }
114422
+ }
114389
114423
  const experimentalFlags = def.behaviour?.overrideExperimentalFlags ? def.behaviour?.overrideExperimentalFlags(args) : {
114390
114424
  MULTIWORKER: false,
114391
114425
  RESOURCES_PROVISION: args.experimentalProvision ?? false
@@ -118435,16 +118469,6 @@ function getValidBindingName(name2, fallback) {
118435
118469
  }
118436
118470
  __name(getValidBindingName, "getValidBindingName");
118437
118471
 
118438
- // src/utils/is-local.ts
118439
- init_import_meta_url();
118440
- function isLocal(args, defaultValue = true) {
118441
- if (args.local === void 0 && args.remote === void 0) {
118442
- return defaultValue;
118443
- }
118444
- return args.local === true || args.remote === false;
118445
- }
118446
- __name(isLocal, "isLocal");
118447
-
118448
118472
  // src/kv/index.ts
118449
118473
  var kvNamespace = createNamespace({
118450
118474
  metadata: {
@@ -118498,6 +118522,7 @@ var kvNamespaceCreateCommand = createCommand({
118498
118522
  const preview = args.preview ? "_preview" : "";
118499
118523
  const title = `${environment}${args.namespace}${preview}`;
118500
118524
  const accountId = await requireAuth(config);
118525
+ printResourceLocation("remote");
118501
118526
  logger.log(`\u{1F300} Creating namespace with title "${title}"`);
118502
118527
  const namespaceId = await createKVNamespace(accountId, title);
118503
118528
  sendMetricsEvent("create kv namespace", {
@@ -118531,7 +118556,7 @@ var kvNamespaceListCommand = createCommand({
118531
118556
  owner: "Product: KV"
118532
118557
  },
118533
118558
  args: {},
118534
- behaviour: { printBanner: false },
118559
+ behaviour: { printBanner: false, printResourceLocation: false },
118535
118560
  async handler(args) {
118536
118561
  const config = readConfig(args);
118537
118562
  const accountId = await requireAuth(config);
@@ -118568,6 +118593,7 @@ var kvNamespaceDeleteCommand = createCommand({
118568
118593
  },
118569
118594
  async handler(args) {
118570
118595
  const config = readConfig(args);
118596
+ printResourceLocation("remote");
118571
118597
  let id;
118572
118598
  try {
118573
118599
  id = getKVNamespaceId(args, config);
@@ -118591,6 +118617,9 @@ var kvKeyPutCommand = createCommand({
118591
118617
  status: "stable",
118592
118618
  owner: "Product: KV"
118593
118619
  },
118620
+ behaviour: {
118621
+ printResourceLocation: true
118622
+ },
118594
118623
  positionalArgs: ["key", "value"],
118595
118624
  args: {
118596
118625
  key: {
@@ -118710,6 +118739,11 @@ var kvKeyListCommand = createCommand({
118710
118739
  status: "stable",
118711
118740
  owner: "Product: KV"
118712
118741
  },
118742
+ behaviour: {
118743
+ // implicitly expects to output JSON only
118744
+ printResourceLocation: false,
118745
+ printBanner: false
118746
+ },
118713
118747
  args: {
118714
118748
  binding: {
118715
118749
  type: "string",
@@ -118749,7 +118783,6 @@ var kvKeyListCommand = createCommand({
118749
118783
  validateArgs(args) {
118750
118784
  demandOneOfOption("binding", "namespace-id")(args);
118751
118785
  },
118752
- behaviour: { printBanner: false },
118753
118786
  async handler({ prefix, ...args }) {
118754
118787
  const localMode = isLocal(args);
118755
118788
  const config = readConfig(args);
@@ -118782,6 +118815,10 @@ var kvKeyGetCommand = createCommand({
118782
118815
  status: "stable",
118783
118816
  owner: "Product: KV"
118784
118817
  },
118818
+ behaviour: {
118819
+ printBanner: false,
118820
+ printResourceLocation: false
118821
+ },
118785
118822
  positionalArgs: ["key"],
118786
118823
  args: {
118787
118824
  key: {
@@ -118827,7 +118864,6 @@ var kvKeyGetCommand = createCommand({
118827
118864
  validateArgs(args) {
118828
118865
  demandOneOfOption("binding", "namespace-id")(args);
118829
118866
  },
118830
- behaviour: { printBanner: false },
118831
118867
  async handler({ key, ...args }) {
118832
118868
  const localMode = isLocal(args);
118833
118869
  const config = readConfig(args);
@@ -118874,6 +118910,9 @@ var kvKeyDeleteCommand = createCommand({
118874
118910
  status: "stable",
118875
118911
  owner: "Product: KV"
118876
118912
  },
118913
+ behaviour: {
118914
+ printResourceLocation: true
118915
+ },
118877
118916
  positionalArgs: ["key"],
118878
118917
  args: {
118879
118918
  key: {
@@ -118939,6 +118978,10 @@ var kvBulkGetCommand = createCommand({
118939
118978
  status: "open-beta",
118940
118979
  owner: "Product: KV"
118941
118980
  },
118981
+ behaviour: {
118982
+ printBanner: false,
118983
+ printResourceLocation: false
118984
+ },
118942
118985
  positionalArgs: ["filename"],
118943
118986
  args: {
118944
118987
  filename: {
@@ -119043,6 +119086,9 @@ var kvBulkPutCommand = createCommand({
119043
119086
  status: "stable",
119044
119087
  owner: "Product: KV"
119045
119088
  },
119089
+ behaviour: {
119090
+ printResourceLocation: true
119091
+ },
119046
119092
  positionalArgs: ["filename"],
119047
119093
  args: {
119048
119094
  filename: {
@@ -119185,6 +119231,9 @@ var kvBulkDeleteCommand = createCommand({
119185
119231
  status: "stable",
119186
119232
  owner: "Product: KV"
119187
119233
  },
119234
+ behaviour: {
119235
+ printResourceLocation: true
119236
+ },
119188
119237
  positionalArgs: ["filename"],
119189
119238
  args: {
119190
119239
  filename: {
@@ -124601,9 +124650,8 @@ var secretBulkCommand = createCommand({
124601
124650
  logger.log(`\u2728 ${upsertBindings.length} secrets successfully uploaded`);
124602
124651
  } catch (err) {
124603
124652
  logger.log("");
124604
- logger.log("Finished processing secrets JSON file:");
124605
- logger.log(`\u2728 0 secrets successfully uploaded`);
124606
- throw new Error(`\u{1F6A8} ${upsertBindings.length} secrets failed to upload`);
124653
+ logger.log(`\u{1F6A8} Secrets failed to upload`);
124654
+ throw err;
124607
124655
  }
124608
124656
  }
124609
124657
  });
@@ -124828,11 +124876,8 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
124828
124876
  `\u2728 ${Object.keys(upsertBindings).length} secrets successfully uploaded`
124829
124877
  );
124830
124878
  } catch (err) {
124831
- logger.log("Finished processing secrets file:");
124832
- logger.log(`\u2728 0 secrets successfully uploaded`);
124833
- throw new FatalError(
124834
- `\u{1F6A8} ${Object.keys(upsertBindings).length} secrets failed to upload`
124835
- );
124879
+ logger.log(`\u{1F6A8} Secrets failed to upload`);
124880
+ throw err;
124836
124881
  }
124837
124882
  }
124838
124883
  ).command(
@@ -128957,7 +129002,9 @@ function addCreateOptions(yargs) {
128957
129002
  }).group(["transform-worker"], `${source_default.bold("Transformations")}`).option("transform-worker", {
128958
129003
  type: "string",
128959
129004
  describe: "Pipeline transform Worker and entrypoint (<worker>.<entrypoint>)",
128960
- demandOption: false
129005
+ demandOption: false,
129006
+ hidden: true
129007
+ // TODO: Remove once transformations launch
128961
129008
  }).group(
128962
129009
  [
128963
129010
  "r2-bucket",
@@ -129005,7 +129052,7 @@ function addCreateOptions(yargs) {
129005
129052
  demandOption: false
129006
129053
  }).option("file-template", {
129007
129054
  type: "string",
129008
- describe: "Template for individual file names (must include ${slug})",
129055
+ describe: `Template for individual file names (must include \${slug}). For example: "\${slug}.log.gz"`,
129009
129056
  demandOption: false,
129010
129057
  coerce: /* @__PURE__ */ __name((val2) => {
129011
129058
  if (!val2.includes("${slug}")) {
@@ -129013,6 +129060,10 @@ function addCreateOptions(yargs) {
129013
129060
  }
129014
129061
  return val2;
129015
129062
  }, "coerce")
129063
+ }).group(["shard-count"], `${source_default.bold("Pipeline settings")}`).option("shard-count", {
129064
+ type: "number",
129065
+ describe: "Number of pipeline shards. More shards handle higher request volume; fewer shards produce larger output files",
129066
+ demandOption: false
129016
129067
  });
129017
129068
  }
129018
129069
  __name(addCreateOptions, "addCreateOptions");
@@ -129100,6 +129151,9 @@ async function createPipelineHandler(args) {
129100
129151
  if (args.fileTemplate) {
129101
129152
  pipelineConfig.destination.path.filename = args.fileTemplate;
129102
129153
  }
129154
+ if (args.shardCount) {
129155
+ pipelineConfig.metadata.shards = args.shardCount;
129156
+ }
129103
129157
  logger.log(`\u{1F300} Creating Pipeline named "${name2}"`);
129104
129158
  const pipeline = await createPipeline(accountId, pipelineConfig);
129105
129159
  logger.log(
@@ -129255,7 +129309,9 @@ function addUpdateOptions(yargs) {
129255
129309
  }).group(["transform-worker"], `${source_default.bold("Transformations")}`).option("transform-worker", {
129256
129310
  type: "string",
129257
129311
  describe: 'Pipeline transform Worker and entrypoint, to transform ingested records. Specified as <worker-name>.<entrypoint>, or "none".',
129258
- demandOption: false
129312
+ demandOption: false,
129313
+ hidden: true
129314
+ // TODO: Remove once transformations launch
129259
129315
  }).group(
129260
129316
  [
129261
129317
  "r2-bucket",
@@ -129305,6 +129361,10 @@ function addUpdateOptions(yargs) {
129305
129361
  }
129306
129362
  return val2;
129307
129363
  }, "coerce")
129364
+ }).group(["shard-count"], `${source_default.bold("Pipeline settings")}`).option("shard-count", {
129365
+ type: "number",
129366
+ describe: "Number of pipeline shards. More shards handle higher request volume; fewer shards produce larger output files",
129367
+ demandOption: false
129308
129368
  });
129309
129369
  }
129310
129370
  __name(addUpdateOptions, "addUpdateOptions");
@@ -129411,6 +129471,9 @@ async function updatePipelineHandler(args) {
129411
129471
  if (args.fileTemplate) {
129412
129472
  pipelineConfig.destination.path.filename = args.fileTemplate;
129413
129473
  }
129474
+ if (args.shardCount) {
129475
+ pipelineConfig.metadata.shards = args.shardCount;
129476
+ }
129414
129477
  logger.log(`\u{1F300} Updating Pipeline "${name2}"`);
129415
129478
  const pipeline = await updatePipeline(accountId, name2, pipelineConfig);
129416
129479
  logger.log(
@@ -131072,7 +131135,7 @@ var r2BucketDeleteCommand = createCommand({
131072
131135
  init_import_meta_url();
131073
131136
  var r2BucketCatalogNamespace = createNamespace({
131074
131137
  metadata: {
131075
- description: "Manage the data catalog for your R2 buckets - provides an Iceberg REST interface for query engines like Spark, DuckDB, and Trino",
131138
+ description: "Manage the data catalog for your R2 buckets - provides an Iceberg REST interface for query engines like Spark and PyIceberg",
131076
131139
  status: "open-beta",
131077
131140
  owner: "Product: R2 Data Catalog"
131078
131141
  }
@@ -131107,7 +131170,7 @@ var r2BucketCatalogEnableCommand = createCommand({
131107
131170
  Catalog URI: '${catalogHost}'
131108
131171
  Warehouse: '${response.name}'
131109
131172
 
131110
- Use this Catalog URI with Iceberg-compatible query engines (Spark, DuckDB, Trino, etc.) to query data as tables.
131173
+ Use this Catalog URI with Iceberg-compatible query engines (Spark, PyIceberg etc.) to query data as tables.
131111
131174
  Note: You will need a Cloudflare API token with 'R2 Data Catalog' permission to authenticate your client with this catalog.
131112
131175
  For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
131113
131176
  );
@@ -131180,7 +131243,6 @@ var r2BucketCatalogGetCommand = createCommand({
131180
131243
  catalogHost = `https://catalog.cloudflarestorage.com/${catalog.name}`;
131181
131244
  }
131182
131245
  const output = {
131183
- Bucket: args.bucket,
131184
131246
  "Catalog URI": catalogHost,
131185
131247
  Warehouse: catalog.name,
131186
131248
  Status: catalog.status
@@ -132484,7 +132546,6 @@ var import_node_buffer5 = require("node:buffer");
132484
132546
  var fs21 = __toESM(require("node:fs"));
132485
132547
  var path56 = __toESM(require("node:path"));
132486
132548
  var stream = __toESM(require("node:stream"));
132487
- var remoteFlagWarning = "By default, `wrangler r2` commands access a local simulator of your R2 bucket, the same as that used by `wrangler dev`. To access your remote R2 bucket, re-run the command with the --remote flag";
132488
132549
  var r2ObjectNamespace = createNamespace({
132489
132550
  metadata: {
132490
132551
  description: `Manage R2 objects`,
@@ -132537,6 +132598,11 @@ var r2ObjectGetCommand = createCommand({
132537
132598
  type: "string"
132538
132599
  }
132539
132600
  },
132601
+ behaviour: {
132602
+ printResourceLocation(args) {
132603
+ return !args?.pipe;
132604
+ }
132605
+ },
132540
132606
  positionalArgs: ["objectPath"],
132541
132607
  async handler(objectGetYargs, { config }) {
132542
132608
  const localMode = isLocal(objectGetYargs);
@@ -132561,9 +132627,6 @@ var r2ObjectGetCommand = createCommand({
132561
132627
  output = process.stdout;
132562
132628
  }
132563
132629
  if (localMode) {
132564
- if (!pipe) {
132565
- logger.warn(remoteFlagWarning);
132566
- }
132567
132630
  await usingLocalBucket(
132568
132631
  objectGetYargs.persistTo,
132569
132632
  config,
@@ -132677,6 +132740,11 @@ var r2ObjectPutCommand = createCommand({
132677
132740
  type: "string"
132678
132741
  }
132679
132742
  },
132743
+ behaviour: {
132744
+ printResourceLocation(args) {
132745
+ return !args?.pipe;
132746
+ }
132747
+ },
132680
132748
  async handler(objectPutYargs, { config }) {
132681
132749
  const {
132682
132750
  objectPath,
@@ -132741,7 +132809,6 @@ ${key} is ${prettyBytes(objectSize, {
132741
132809
  `Creating object "${key}"${storageClassLog} in bucket "${fullBucketName}".`
132742
132810
  );
132743
132811
  if (localMode) {
132744
- logger.warn(remoteFlagWarning);
132745
132812
  await usingLocalBucket(
132746
132813
  persistTo,
132747
132814
  config,
@@ -132829,6 +132896,9 @@ var r2ObjectDeleteCommand = createCommand({
132829
132896
  type: "string"
132830
132897
  }
132831
132898
  },
132899
+ behaviour: {
132900
+ printResourceLocation: true
132901
+ },
132832
132902
  async handler(args) {
132833
132903
  const localMode = isLocal(args);
132834
132904
  const { objectPath, jurisdiction } = args;
@@ -132840,7 +132910,6 @@ var r2ObjectDeleteCommand = createCommand({
132840
132910
  }
132841
132911
  logger.log(`Deleting object "${key}" from bucket "${fullBucketName}".`);
132842
132912
  if (localMode) {
132843
- logger.warn(remoteFlagWarning);
132844
132913
  await usingLocalBucket(
132845
132914
  args.persistTo,
132846
132915
  config,