wrangler 4.8.0 → 4.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.8.0",
3
+ "version": "4.9.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -57,7 +57,7 @@
57
57
  "unenv": "2.0.0-rc.15",
58
58
  "workerd": "1.20250405.0",
59
59
  "@cloudflare/kv-asset-handler": "0.4.0",
60
- "miniflare": "4.20250405.0"
60
+ "miniflare": "4.20250405.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aws-sdk/client-s3": "^3.721.0",
@@ -137,7 +137,7 @@
137
137
  "yargs": "^17.7.2",
138
138
  "@cloudflare/cli": "1.1.1",
139
139
  "@cloudflare/eslint-config-worker": "1.1.0",
140
- "@cloudflare/pages-shared": "^0.13.23",
140
+ "@cloudflare/pages-shared": "^0.13.24",
141
141
  "@cloudflare/workers-shared": "0.17.1",
142
142
  "@cloudflare/workers-tsconfig": "0.0.0"
143
143
  },
@@ -708,11 +708,13 @@ declare interface CfSecretsStoreSecrets {
708
708
  /**
709
709
  * A binding to send email.
710
710
  */
711
- declare interface CfSendEmailBindings {
711
+ declare type CfSendEmailBindings = {
712
712
  name: string;
713
+ } & ({
713
714
  destination_address?: string;
715
+ } | {
714
716
  allowed_destination_addresses?: string[];
715
- }
717
+ });
716
718
 
717
719
  declare interface CfService {
718
720
  binding: string;
@@ -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.8.0";
81188
+ var version = "4.9.0";
81189
81189
 
81190
81190
  // src/environment-variables/misc-variables.ts
81191
81191
  init_import_meta_url();
@@ -83958,16 +83958,17 @@ function printBindings(bindings, context2 = {}) {
83958
83958
  if (send_email !== void 0 && send_email.length > 0) {
83959
83959
  output.push({
83960
83960
  name: friendlyBindingNames.send_email,
83961
- entries: send_email.map(
83962
- ({ name: name2, destination_address, allowed_destination_addresses }) => {
83963
- return {
83964
- key: name2,
83965
- value: addSuffix(
83966
- destination_address || allowed_destination_addresses?.join(", ") || "unrestricted"
83967
- )
83968
- };
83969
- }
83970
- )
83961
+ entries: send_email.map((emailBinding) => {
83962
+ const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
83963
+ const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
83964
+ return {
83965
+ key: emailBinding.name,
83966
+ value: addSuffix(
83967
+ destination_address || allowed_destination_addresses?.join(", ") || "unrestricted",
83968
+ { isSimulatedLocally: true }
83969
+ )
83970
+ };
83971
+ })
83971
83972
  });
83972
83973
  }
83973
83974
  if (queues2 !== void 0 && queues2.length > 0) {
@@ -84772,7 +84773,14 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args)
84772
84773
  const definedEnvironments = Object.keys(rawConfig.env ?? {});
84773
84774
  if (isRedirectedConfig && definedEnvironments.length > 0) {
84774
84775
  diagnostics.errors.push(
84775
- `Redirected configurations cannot include environments but the following have been found: ${definedEnvironments.map((env6) => JSON.stringify(env6)).join(", ")}`
84776
+ dedent`
84777
+ Redirected configurations cannot include environments but the following have been found:\n${definedEnvironments.map((env6) => ` - ${env6}`).join("\n")}
84778
+
84779
+
84780
+ Such configurations are generated by tools, meaning that one of the tools
84781
+ your application is using is generating the incorrect configuration.
84782
+ Report this issue to the tool's author so that this can be fixed there.
84783
+ `
84776
84784
  );
84777
84785
  }
84778
84786
  const envName = args.env;
@@ -92596,11 +92604,10 @@ function castLogLevel(level) {
92596
92604
  }
92597
92605
  __name(castLogLevel, "castLogLevel");
92598
92606
  function buildLog() {
92599
- let level = castLogLevel(logger.loggerLevel);
92600
- if (level <= import_miniflare6.LogLevel.DEBUG) {
92601
- level = Math.min(level, import_miniflare6.LogLevel.WARN);
92602
- }
92603
- return new WranglerLog(level, { prefix: "wrangler-UserWorker" });
92607
+ const level = castLogLevel(logger.loggerLevel);
92608
+ return new WranglerLog(level, {
92609
+ prefix: level === import_miniflare6.LogLevel.DEBUG ? "wrangler-UserWorker" : "wrangler"
92610
+ });
92604
92611
  }
92605
92612
  __name(buildLog, "buildLog");
92606
92613
  async function buildSourceOptions(config) {
@@ -92938,6 +92945,9 @@ function buildMiniflareBindingOptions(config) {
92938
92945
  binding
92939
92946
  ]) ?? []
92940
92947
  ),
92948
+ email: {
92949
+ send_email: bindings.send_email
92950
+ },
92941
92951
  durableObjects: Object.fromEntries([
92942
92952
  ...internalObjects.map(({ name: name2, class_name }) => {
92943
92953
  const useSQLite = classNameToUseSQLite.get(class_name);
@@ -93157,6 +93167,14 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
93157
93167
  liveReload: config.liveReload,
93158
93168
  upstream,
93159
93169
  unsafeProxySharedSecret: proxyToUserWorkerAuthenticationSecret,
93170
+ unsafeTriggerHandlers: true,
93171
+ // The way we run Miniflare instances with wrangler dev is that there are two:
93172
+ // - one holding the proxy worker,
93173
+ // - and one holding the user worker.
93174
+ // The issue with that setup is that end users would see two sets of request logs from Miniflare!
93175
+ // Instead of hiding all logs from this Miniflare instance, we specifically hide the request logs,
93176
+ // allowing other logs to be shown to the user (such as details about emails being triggered)
93177
+ logRequests: false,
93160
93178
  log: log2,
93161
93179
  verbose: logger.loggerLevel === "debug",
93162
93180
  handleRuntimeStdio,
@@ -103929,16 +103947,16 @@ function createWorkerUploadForm(worker) {
103929
103947
  });
103930
103948
  }
103931
103949
  });
103932
- bindings.send_email?.forEach(
103933
- ({ name: name2, destination_address, allowed_destination_addresses }) => {
103934
- metadataBindings.push({
103935
- name: name2,
103936
- type: "send_email",
103937
- destination_address,
103938
- allowed_destination_addresses
103939
- });
103940
- }
103941
- );
103950
+ bindings.send_email?.forEach((emailBinding) => {
103951
+ const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
103952
+ const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
103953
+ metadataBindings.push({
103954
+ name: emailBinding.name,
103955
+ type: "send_email",
103956
+ destination_address,
103957
+ allowed_destination_addresses
103958
+ });
103959
+ });
103942
103960
  bindings.durable_objects?.bindings.forEach(
103943
103961
  ({ name: name2, class_name, script_name, environment }) => {
103944
103962
  metadataBindings.push({
@@ -129045,6 +129063,14 @@ function validateCorsOrigins(values) {
129045
129063
  if (!values || !values.length) {
129046
129064
  return values;
129047
129065
  }
129066
+ if (values.includes("none")) {
129067
+ if (values.length > 1) {
129068
+ throw new UserError(
129069
+ "When specifying 'none', only one value is permitted."
129070
+ );
129071
+ }
129072
+ return [];
129073
+ }
129048
129074
  if (values.includes("*")) {
129049
129075
  if (values.length > 1) {
129050
129076
  throw new UserError("When specifying '*', only one value is permitted.");
@@ -129160,7 +129186,7 @@ function addCreateOptions(yargs) {
129160
129186
  demandOption: false
129161
129187
  }).group(["shard-count"], `${source_default.bold("Pipeline settings")}`).option("shard-count", {
129162
129188
  type: "number",
129163
- describe: "Number of pipeline shards. More shards handle higher request volume; fewer shards produce larger output files. Defaults to 2 if unset. Minimum: 1, Maximum: 15",
129189
+ describe: "Number of shards for the pipeline. More shards handle higher request volume; fewer shards produce larger output files. Defaults to 2 if unset. Minimum: 1, Maximum: 15",
129164
129190
  demandOption: false
129165
129191
  });
129166
129192
  }
@@ -129254,14 +129280,14 @@ async function createPipelineHandler(args) {
129254
129280
  if (args.shardCount) {
129255
129281
  pipelineConfig.metadata.shards = args.shardCount;
129256
129282
  }
129257
- logger.log(`\u{1F300} Creating Pipeline named "${name2}"`);
129283
+ logger.log(`\u{1F300} Creating pipeline named "${name2}"`);
129258
129284
  const pipeline = await createPipeline(accountId, pipelineConfig);
129259
129285
  logger.log(
129260
- `\u2705 Successfully created Pipeline "${pipeline.name}" with ID ${pipeline.id}
129286
+ `\u2705 Successfully created pipeline "${pipeline.name}" with ID ${pipeline.id}
129261
129287
  `
129262
129288
  );
129263
129289
  logger.log(formatPipelinePretty(pipeline));
129264
- logger.log("\u{1F389} You can now send data to your Pipeline!");
129290
+ logger.log("\u{1F389} You can now send data to your pipeline!");
129265
129291
  if (args.source.includes("worker")) {
129266
129292
  logger.log(
129267
129293
  `
@@ -129284,7 +129310,7 @@ To send data to your pipeline from a Worker, add the following to your wrangler
129284
129310
  }
129285
129311
  if (args.source.includes("http")) {
129286
129312
  logger.log(`
129287
- Send data to your Pipeline's HTTP endpoint:
129313
+ Send data to your pipeline's HTTP endpoint:
129288
129314
  `);
129289
129315
  logger.log(`curl "${pipeline.endpoint}" -d '[{"foo": "bar"}]'
129290
129316
  `);
@@ -129297,7 +129323,7 @@ init_import_meta_url();
129297
129323
  function addDeleteOptions(yargs) {
129298
129324
  return yargs.positional("pipeline", {
129299
129325
  type: "string",
129300
- describe: "The name of the Pipeline to show",
129326
+ describe: "The name of the pipeline to delete",
129301
129327
  demandOption: true
129302
129328
  });
129303
129329
  }
@@ -129308,9 +129334,9 @@ async function deletePipelineHandler(args) {
129308
129334
  const accountId = await requireAuth(config);
129309
129335
  const name2 = args.pipeline;
129310
129336
  validateName("pipeline name", name2);
129311
- logger.log(`Deleting Pipeline ${name2}.`);
129337
+ logger.log(`Deleting pipeline ${name2}.`);
129312
129338
  await deletePipeline(accountId, name2);
129313
- logger.log(`Deleted Pipeline ${name2}.`);
129339
+ logger.log(`Deleted pipeline ${name2}.`);
129314
129340
  }
129315
129341
  __name(deletePipelineHandler, "deletePipelineHandler");
129316
129342
 
@@ -129319,7 +129345,7 @@ init_import_meta_url();
129319
129345
  function addGetOptions(yargs) {
129320
129346
  return yargs.positional("pipeline", {
129321
129347
  type: "string",
129322
- describe: "The name of the Pipeline to show",
129348
+ describe: "The name of the pipeline to inspect",
129323
129349
  demandOption: true
129324
129350
  }).option("format", {
129325
129351
  type: "string",
@@ -129375,7 +129401,7 @@ __name(listPipelinesHandler, "listPipelinesHandler");
129375
129401
  init_import_meta_url();
129376
129402
  function addUpdateOptions(yargs) {
129377
129403
  return yargs.positional("pipeline", {
129378
- describe: "The name of the Pipeline to update",
129404
+ describe: "The name of the pipeline to update",
129379
129405
  type: "string",
129380
129406
  demandOption: true
129381
129407
  }).option("r2-bucket", {
@@ -129388,7 +129414,7 @@ function addUpdateOptions(yargs) {
129388
129414
  `${source_default.bold("Source settings")}`
129389
129415
  ).option("source", {
129390
129416
  type: "array",
129391
- describe: "Space separated list of allowed sources. Options are 'http' or 'worker'. Setting this will remove all other existing sources.",
129417
+ describe: "Space separated list of allowed sources. Options are 'http' or 'worker'",
129392
129418
  demandOption: false
129393
129419
  }).option("require-http-auth", {
129394
129420
  type: "boolean",
@@ -129458,7 +129484,7 @@ function addUpdateOptions(yargs) {
129458
129484
  demandOption: false
129459
129485
  }).group(["shard-count"], `${source_default.bold("Pipeline settings")}`).option("shard-count", {
129460
129486
  type: "number",
129461
- describe: "Number of pipeline shards. More shards handle higher request volume; fewer shards produce larger output files",
129487
+ describe: "Number of shards for the pipeline. More shards handle higher request volume; fewer shards produce larger output files",
129462
129488
  demandOption: false
129463
129489
  });
129464
129490
  }
@@ -129516,7 +129542,7 @@ async function updatePipelineHandler(args) {
129516
129542
  const sourceHandlers = {
129517
129543
  http: /* @__PURE__ */ __name(() => {
129518
129544
  const existing = existingSources.find((s5) => s5.type === "http");
129519
- const http5 = {
129545
+ return {
129520
129546
  ...existing,
129521
129547
  // Copy over existing properties for forwards compatibility
129522
129548
  type: "http",
@@ -129524,10 +129550,6 @@ async function updatePipelineHandler(args) {
129524
129550
  ...args.requireHttpAuth && { authentication: args.requireHttpAuth }
129525
129551
  // Include only if defined
129526
129552
  };
129527
- if (args.corsOrigins && args.corsOrigins.length > 0) {
129528
- http5.cors = { origins: args.corsOrigins };
129529
- }
129530
- return http5;
129531
129553
  }, "http"),
129532
129554
  worker: /* @__PURE__ */ __name(() => {
129533
129555
  const existing = existingSources.find(
@@ -129573,14 +129595,14 @@ async function updatePipelineHandler(args) {
129573
129595
  if (args.requireHttpAuth) {
129574
129596
  httpSource.authentication = args.requireHttpAuth;
129575
129597
  }
129576
- if (args.corsOrigins && args.corsOrigins.length > 0) {
129598
+ if (args.corsOrigins) {
129577
129599
  httpSource.cors = { origins: args.corsOrigins };
129578
129600
  }
129579
129601
  }
129580
- logger.log(`\u{1F300} Updating Pipeline "${name2}"`);
129602
+ logger.log(`\u{1F300} Updating pipeline "${name2}"`);
129581
129603
  const pipeline = await updatePipeline(accountId, name2, pipelineConfig);
129582
129604
  logger.log(
129583
- `\u2705 Successfully updated Pipeline "${pipeline.name}" with ID ${pipeline.id}
129605
+ `\u2705 Successfully updated pipeline "${pipeline.name}" with ID ${pipeline.id}
129584
129606
  `
129585
129607
  );
129586
129608
  }
@@ -129670,27 +129692,27 @@ __name(parseTransform, "parseTransform");
129670
129692
  function pipelines(pipelineYargs) {
129671
129693
  return pipelineYargs.command(
129672
129694
  "create <pipeline>",
129673
- "Create a new Pipeline",
129695
+ "Create a new pipeline",
129674
129696
  addCreateOptions,
129675
129697
  createPipelineHandler
129676
129698
  ).command(
129677
129699
  "list",
129678
- "List current Pipelines",
129700
+ "List all pipelines",
129679
129701
  (yargs) => yargs,
129680
129702
  listPipelinesHandler
129681
129703
  ).command(
129682
129704
  "get <pipeline>",
129683
- "Get a Pipeline configuration",
129705
+ "Get a pipeline's configuration",
129684
129706
  addGetOptions,
129685
129707
  getPipelineHandler
129686
129708
  ).command(
129687
129709
  "update <pipeline>",
129688
- "Update a Pipeline",
129710
+ "Update a pipeline",
129689
129711
  addUpdateOptions,
129690
129712
  updatePipelineHandler
129691
129713
  ).command(
129692
129714
  "delete <pipeline>",
129693
- "Delete a Pipeline",
129715
+ "Delete a pipeline",
129694
129716
  addDeleteOptions,
129695
129717
  deletePipelineHandler
129696
129718
  );
@@ -150345,7 +150367,7 @@ function createCLIParser(argv) {
150345
150367
  registry.registerNamespace("workflows");
150346
150368
  wrangler.command(
150347
150369
  "pipelines",
150348
- `\u{1F6B0} Manage Worker Pipelines ${source_default.hex(betaCmdColor)("[open beta]")}`,
150370
+ `\u{1F6B0} Manage Cloudflare Pipelines ${source_default.hex(betaCmdColor)("[open beta]")}`,
150349
150371
  (pipelinesYargs) => {
150350
150372
  return pipelines(pipelinesYargs.command(subHelp));
150351
150373
  }