vercel 38.0.0 → 39.0.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.
Files changed (2) hide show
  1. package/dist/index.js +240 -67
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -13781,7 +13781,7 @@ var require_es6_promise = __commonJS2({
13781
13781
  len += 2;
13782
13782
  if (len === 2) {
13783
13783
  if (customSchedulerFn) {
13784
- customSchedulerFn(flush);
13784
+ customSchedulerFn(flush2);
13785
13785
  } else {
13786
13786
  scheduleFlush();
13787
13787
  }
@@ -13800,20 +13800,20 @@ var require_es6_promise = __commonJS2({
13800
13800
  var isWorker = typeof Uint8ClampedArray !== "undefined" && typeof importScripts !== "undefined" && typeof MessageChannel !== "undefined";
13801
13801
  function useNextTick() {
13802
13802
  return function() {
13803
- return process.nextTick(flush);
13803
+ return process.nextTick(flush2);
13804
13804
  };
13805
13805
  }
13806
13806
  function useVertxTimer() {
13807
13807
  if (typeof vertxNext !== "undefined") {
13808
13808
  return function() {
13809
- vertxNext(flush);
13809
+ vertxNext(flush2);
13810
13810
  };
13811
13811
  }
13812
13812
  return useSetTimeout();
13813
13813
  }
13814
13814
  function useMutationObserver() {
13815
13815
  var iterations = 0;
13816
- var observer = new BrowserMutationObserver(flush);
13816
+ var observer = new BrowserMutationObserver(flush2);
13817
13817
  var node = document.createTextNode("");
13818
13818
  observer.observe(node, { characterData: true });
13819
13819
  return function() {
@@ -13822,7 +13822,7 @@ var require_es6_promise = __commonJS2({
13822
13822
  }
13823
13823
  function useMessageChannel() {
13824
13824
  var channel = new MessageChannel();
13825
- channel.port1.onmessage = flush;
13825
+ channel.port1.onmessage = flush2;
13826
13826
  return function() {
13827
13827
  return channel.port2.postMessage(0);
13828
13828
  };
@@ -13830,11 +13830,11 @@ var require_es6_promise = __commonJS2({
13830
13830
  function useSetTimeout() {
13831
13831
  var globalSetTimeout = setTimeout;
13832
13832
  return function() {
13833
- return globalSetTimeout(flush, 1);
13833
+ return globalSetTimeout(flush2, 1);
13834
13834
  };
13835
13835
  }
13836
13836
  var queue = new Array(1e3);
13837
- function flush() {
13837
+ function flush2() {
13838
13838
  for (var i = 0; i < len; i += 2) {
13839
13839
  var callback = queue[i];
13840
13840
  var arg2 = queue[i + 1];
@@ -16221,7 +16221,7 @@ var require_sdk2 = __commonJS2({
16221
16221
  return core_1.getCurrentHub().lastEventId();
16222
16222
  }
16223
16223
  exports2.lastEventId = lastEventId;
16224
- function flush(timeout) {
16224
+ function flush2(timeout) {
16225
16225
  return tslib_1.__awaiter(this, void 0, void 0, function() {
16226
16226
  var client2;
16227
16227
  return tslib_1.__generator(this, function(_a) {
@@ -16233,7 +16233,7 @@ var require_sdk2 = __commonJS2({
16233
16233
  });
16234
16234
  });
16235
16235
  }
16236
- exports2.flush = flush;
16236
+ exports2.flush = flush2;
16237
16237
  function close2(timeout) {
16238
16238
  return tslib_1.__awaiter(this, void 0, void 0, function() {
16239
16239
  var client2;
@@ -16906,14 +16906,15 @@ var init_command3 = __esm({
16906
16906
  name: "target",
16907
16907
  shorthand: null,
16908
16908
  type: String,
16909
+ argument: "TARGET",
16909
16910
  deprecated: false,
16910
16911
  description: "Specify the target environment"
16911
16912
  },
16912
16913
  {
16913
16914
  name: "output",
16914
- description: "Directory where built assets should be written to",
16915
+ description: "Directory where built assets will be written to",
16915
16916
  shorthand: null,
16916
- argument: "PATH",
16917
+ argument: "DIR",
16917
16918
  type: String,
16918
16919
  deprecated: false
16919
16920
  },
@@ -17125,7 +17126,7 @@ var init_command5 = __esm({
17125
17126
  name: "env",
17126
17127
  shorthand: "e",
17127
17128
  type: [String],
17128
- argument: "key=value",
17129
+ argument: "KEY=VALUE",
17129
17130
  deprecated: false,
17130
17131
  description: "Specify environment variables during run-time (e.g. `-e KEY1=value1 -e KEY2=value2`)"
17131
17132
  },
@@ -17133,7 +17134,7 @@ var init_command5 = __esm({
17133
17134
  name: "build-env",
17134
17135
  shorthand: "b",
17135
17136
  type: [String],
17136
- argument: "key=value",
17137
+ argument: "KEY=VALUE",
17137
17138
  deprecated: false,
17138
17139
  description: "Specify environment variables during build-time (e.g. `-b KEY1=value1 -b KEY2=value2`)"
17139
17140
  },
@@ -17141,7 +17142,7 @@ var init_command5 = __esm({
17141
17142
  name: "meta",
17142
17143
  shorthand: "m",
17143
17144
  type: [String],
17144
- argument: "key=value",
17145
+ argument: "KEY=VALUE",
17145
17146
  deprecated: false,
17146
17147
  description: "Specify metadata for the deployment (e.g. `-m KEY1=value1 -m KEY2=value2`)"
17147
17148
  },
@@ -17149,6 +17150,7 @@ var init_command5 = __esm({
17149
17150
  name: "regions",
17150
17151
  shorthand: null,
17151
17152
  type: String,
17153
+ argument: "REGION",
17152
17154
  deprecated: false,
17153
17155
  description: "Set default regions to enable the deployment on"
17154
17156
  },
@@ -17170,6 +17172,7 @@ var init_command5 = __esm({
17170
17172
  name: "archive",
17171
17173
  shorthand: null,
17172
17174
  type: String,
17175
+ argument: "FORMAT",
17173
17176
  deprecated: false,
17174
17177
  description: "Compress the deployment code into a file before uploading it"
17175
17178
  },
@@ -17202,20 +17205,19 @@ var init_command5 = __esm({
17202
17205
  name: "name",
17203
17206
  shorthand: "n",
17204
17207
  type: String,
17205
- deprecated: true,
17206
- description: "Provide a Vercel Project name"
17208
+ deprecated: true
17207
17209
  },
17208
17210
  {
17209
17211
  name: "no-clipboard",
17210
17212
  shorthand: null,
17211
17213
  type: Boolean,
17212
- deprecated: true,
17213
- description: "Do not copy deployment URL to clipboard"
17214
+ deprecated: true
17214
17215
  },
17215
17216
  {
17216
17217
  name: "target",
17217
17218
  shorthand: null,
17218
17219
  type: String,
17220
+ argument: "TARGET",
17219
17221
  deprecated: false,
17220
17222
  description: "Specify the target deployment environment"
17221
17223
  },
@@ -17268,7 +17270,7 @@ var init_command6 = __esm({
17268
17270
  {
17269
17271
  name: "listen",
17270
17272
  description: "Specify a URI endpoint on which to listen [0.0.0.0:3000]",
17271
- argument: "uri",
17273
+ argument: "URI",
17272
17274
  shorthand: "l",
17273
17275
  type: String,
17274
17276
  deprecated: false
@@ -17548,7 +17550,15 @@ var init_command8 = __esm({
17548
17550
  required: true
17549
17551
  }
17550
17552
  ],
17551
- options: [{ name: "code", shorthand: null, type: String, deprecated: false }],
17553
+ options: [
17554
+ {
17555
+ name: "code",
17556
+ argument: "CODE",
17557
+ shorthand: null,
17558
+ type: String,
17559
+ deprecated: false
17560
+ }
17561
+ ],
17552
17562
  examples: []
17553
17563
  };
17554
17564
  domainsCommand = {
@@ -17759,9 +17769,10 @@ var init_command9 = __esm({
17759
17769
  options: [
17760
17770
  {
17761
17771
  name: "environment",
17762
- description: "Set the Environment (development, preview, production) when pulling Environment Variables",
17772
+ description: "Set the Environment when pulling Environment Variables",
17763
17773
  shorthand: null,
17764
17774
  type: String,
17775
+ argument: "TARGET",
17765
17776
  deprecated: false
17766
17777
  },
17767
17778
  {
@@ -17769,6 +17780,7 @@ var init_command9 = __esm({
17769
17780
  description: "Specify the Git branch to pull specific Environment Variables for",
17770
17781
  shorthand: null,
17771
17782
  type: String,
17783
+ argument: "NAME",
17772
17784
  deprecated: false
17773
17785
  },
17774
17786
  {
@@ -18020,7 +18032,7 @@ var init_command14 = __esm({
18020
18032
  options: [
18021
18033
  {
18022
18034
  name: "disconnect-all",
18023
- description: "disconnects all projects from the specified resource before deletion",
18035
+ description: "Disconnects all projects from the specified resource before deletion",
18024
18036
  shorthand: "a",
18025
18037
  type: Boolean,
18026
18038
  deprecated: false
@@ -18065,7 +18077,7 @@ var init_command14 = __esm({
18065
18077
  options: [
18066
18078
  {
18067
18079
  name: "all",
18068
- description: "disconnects all projects from the specified resource",
18080
+ description: "Disconnects all projects from the specified resource",
18069
18081
  shorthand: "a",
18070
18082
  type: Boolean,
18071
18083
  deprecated: false
@@ -18174,7 +18186,7 @@ var init_command15 = __esm({
18174
18186
  options: [
18175
18187
  {
18176
18188
  name: "integration",
18177
- description: "limits the resources listed to a designated integration",
18189
+ description: "Limits the resources listed to a designated integration",
18178
18190
  shorthand: "i",
18179
18191
  type: String,
18180
18192
  deprecated: false,
@@ -18182,7 +18194,7 @@ var init_command15 = __esm({
18182
18194
  },
18183
18195
  {
18184
18196
  name: "all",
18185
- description: "lists all resources regardless of project",
18197
+ description: "Lists all resources regardless of project",
18186
18198
  shorthand: "a",
18187
18199
  type: Boolean,
18188
18200
  deprecated: false
@@ -18330,7 +18342,7 @@ var init_command17 = __esm({
18330
18342
  {
18331
18343
  name: "meta",
18332
18344
  description: "Filter deployments by metadata (e.g.: `-m KEY=value`). Can appear many times.",
18333
- argument: "KEY=value",
18345
+ argument: "KEY=VALUE",
18334
18346
  shorthand: "m",
18335
18347
  type: [String],
18336
18348
  deprecated: false
@@ -18338,7 +18350,7 @@ var init_command17 = __esm({
18338
18350
  {
18339
18351
  name: "policy",
18340
18352
  description: "See deployments with provided Deployment Retention policies (e.g.: `-p KEY=value`). Can appear many times.",
18341
- argument: "KEY=value",
18353
+ argument: "KEY=VALUE",
18342
18354
  shorthand: "p",
18343
18355
  type: [String],
18344
18356
  deprecated: false
@@ -18346,7 +18358,7 @@ var init_command17 = __esm({
18346
18358
  {
18347
18359
  name: "environment",
18348
18360
  description: "",
18349
- argument: "production|preview",
18361
+ argument: "TARGET",
18350
18362
  shorthand: null,
18351
18363
  type: String,
18352
18364
  deprecated: false
@@ -18480,44 +18492,35 @@ var init_command20 = __esm({
18480
18492
  shorthand: "j",
18481
18493
  type: Boolean,
18482
18494
  deprecated: false,
18483
- description: "print each log line as a JSON object (compatible with JQ)"
18495
+ description: "Print each log line as a JSON object (compatible with JQ)"
18484
18496
  },
18485
18497
  {
18486
18498
  name: "follow",
18487
18499
  shorthand: "f",
18488
- description: "Wait for additional data [off]",
18489
18500
  type: Boolean,
18490
18501
  deprecated: true
18491
18502
  },
18492
18503
  {
18493
18504
  name: "limit",
18494
18505
  shorthand: "n",
18495
- description: "Number of log entries [100]",
18496
- argument: "NUMBER",
18497
18506
  type: Number,
18498
18507
  deprecated: true
18499
18508
  },
18500
18509
  {
18501
18510
  name: "since",
18502
18511
  shorthand: null,
18503
- description: "Only return logs after date (ISO 8601)",
18504
- argument: "SINCE",
18505
18512
  type: String,
18506
18513
  deprecated: true
18507
18514
  },
18508
18515
  {
18509
18516
  name: "until",
18510
18517
  shorthand: null,
18511
- description: "Only return logs before date (ISO 8601), ignored when used with --follow",
18512
- argument: "UNTIL",
18513
18518
  type: String,
18514
18519
  deprecated: true
18515
18520
  },
18516
18521
  {
18517
18522
  name: "output",
18518
18523
  shorthand: "o",
18519
- description: `Specify the output format (short|raw) [short]`,
18520
- argument: "MODE",
18521
18524
  type: String,
18522
18525
  deprecated: true
18523
18526
  }
@@ -18576,7 +18579,6 @@ var init_command21 = __esm({
18576
18579
  {
18577
18580
  name: "update-required",
18578
18581
  description: "A list of projects affected by an upcoming deprecation",
18579
- argument: "update-required",
18580
18582
  shorthand: null,
18581
18583
  type: Boolean,
18582
18584
  deprecated: false
@@ -18663,7 +18665,7 @@ var init_command22 = __esm({
18663
18665
  {
18664
18666
  name: "timeout",
18665
18667
  description: "Time to wait for promotion completion [3m]",
18666
- argument: "timeout",
18668
+ argument: "TIME",
18667
18669
  shorthand: null,
18668
18670
  type: String,
18669
18671
  deprecated: false
@@ -18705,7 +18707,7 @@ var init_command23 = __esm({
18705
18707
  {
18706
18708
  name: "environment",
18707
18709
  description: "Deployment environment [development]",
18708
- argument: "environment",
18710
+ argument: "TARGET",
18709
18711
  shorthand: null,
18710
18712
  type: String,
18711
18713
  deprecated: false
@@ -18713,7 +18715,7 @@ var init_command23 = __esm({
18713
18715
  {
18714
18716
  name: "git-branch",
18715
18717
  description: "Specify the Git branch to pull specific Environment Variables for",
18716
- argument: "branch",
18718
+ argument: "NAME",
18717
18719
  shorthand: null,
18718
18720
  type: String,
18719
18721
  deprecated: false
@@ -18782,6 +18784,7 @@ var init_command24 = __esm({
18782
18784
  {
18783
18785
  name: "target",
18784
18786
  shorthand: null,
18787
+ argument: "TARGET",
18785
18788
  description: "Redeploy to a specific target environment",
18786
18789
  type: String,
18787
18790
  deprecated: false
@@ -18899,7 +18902,7 @@ var init_command26 = __esm({
18899
18902
  {
18900
18903
  name: "timeout",
18901
18904
  description: "Time to wait for rollback completion [3m]",
18902
- argument: "timeout",
18905
+ argument: "TIME",
18903
18906
  shorthand: null,
18904
18907
  type: String,
18905
18908
  deprecated: false
@@ -19039,7 +19042,7 @@ var init_command28 = __esm({
19039
19042
  });
19040
19043
 
19041
19044
  // src/commands/telemetry/command.ts
19042
- var statusSubcommand3, enableSubcommand, disableSubcommand, telemetryCommand;
19045
+ var statusSubcommand3, enableSubcommand, flushSubcommand, disableSubcommand, telemetryCommand;
19043
19046
  var init_command29 = __esm({
19044
19047
  "src/commands/telemetry/command.ts"() {
19045
19048
  "use strict";
@@ -19059,6 +19062,15 @@ var init_command29 = __esm({
19059
19062
  options: [],
19060
19063
  examples: []
19061
19064
  };
19065
+ flushSubcommand = {
19066
+ name: "flush",
19067
+ aliases: [],
19068
+ description: "Internal command to flush telemetry events",
19069
+ hidden: true,
19070
+ arguments: [],
19071
+ options: [],
19072
+ examples: []
19073
+ };
19062
19074
  disableSubcommand = {
19063
19075
  name: "disable",
19064
19076
  aliases: [],
@@ -19072,7 +19084,12 @@ var init_command29 = __esm({
19072
19084
  aliases: [],
19073
19085
  description: "Allows you to enable or disable telemetry collection",
19074
19086
  arguments: [],
19075
- subcommands: [enableSubcommand, disableSubcommand, statusSubcommand3],
19087
+ subcommands: [
19088
+ enableSubcommand,
19089
+ disableSubcommand,
19090
+ statusSubcommand3,
19091
+ flushSubcommand
19092
+ ],
19076
19093
  options: [],
19077
19094
  examples: []
19078
19095
  };
@@ -70045,7 +70062,7 @@ var require_cross_spawn = __commonJS2({
70045
70062
  var cp = require("child_process");
70046
70063
  var parse9 = require_parse2();
70047
70064
  var enoent = require_enoent();
70048
- function spawn2(command, args2, options) {
70065
+ function spawn3(command, args2, options) {
70049
70066
  const parsed = parse9(command, args2, options);
70050
70067
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
70051
70068
  enoent.hookChildProcess(spawned, parsed);
@@ -70057,8 +70074,8 @@ var require_cross_spawn = __commonJS2({
70057
70074
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
70058
70075
  return result;
70059
70076
  }
70060
- module2.exports = spawn2;
70061
- module2.exports.spawn = spawn2;
70077
+ module2.exports = spawn3;
70078
+ module2.exports.spawn = spawn3;
70062
70079
  module2.exports.sync = spawnSync;
70063
70080
  module2.exports._parse = parse9;
70064
70081
  module2.exports._enoent = enoent;
@@ -72537,13 +72554,14 @@ var import_blob_polyfill = __toESM(require_Blob());
72537
72554
  });
72538
72555
 
72539
72556
  // src/util/telemetry/index.ts
72540
- var import_node_crypto, import_node_os, import_constants2, LogLabel, TelemetryClient, TelemetryEventStore;
72557
+ var import_node_crypto, import_node_os, import_node_child_process, import_constants2, LogLabel, TelemetryClient, TelemetryEventStore;
72541
72558
  var init_telemetry = __esm({
72542
72559
  "src/util/telemetry/index.ts"() {
72543
72560
  "use strict";
72544
72561
  import_node_crypto = require("crypto");
72545
72562
  import_node_os = __toESM3(require("os"));
72546
72563
  init_output_manager();
72564
+ import_node_child_process = require("child_process");
72547
72565
  import_constants2 = __toESM3(require_dist10());
72548
72566
  LogLabel = `['telemetry']:`;
72549
72567
  TelemetryClient = class {
@@ -72574,6 +72592,7 @@ var init_telemetry = __esm({
72574
72592
  }
72575
72593
  const event = {
72576
72594
  id: (0, import_node_crypto.randomUUID)(),
72595
+ eventTime: Date.now(),
72577
72596
  ...eventData
72578
72597
  };
72579
72598
  this.store.add(event);
@@ -72697,7 +72716,7 @@ var init_telemetry = __esm({
72697
72716
  }
72698
72717
  return this.config?.enabled ?? true;
72699
72718
  }
72700
- save() {
72719
+ async save() {
72701
72720
  if (this.isDebug) {
72702
72721
  output_manager_default.log(`${LogLabel} Flushing Events`);
72703
72722
  for (const event of this.events) {
@@ -72706,6 +72725,72 @@ var init_telemetry = __esm({
72706
72725
  return;
72707
72726
  }
72708
72727
  if (this.enabled) {
72728
+ const sessionId = this.events[0].sessionId;
72729
+ if (!sessionId) {
72730
+ output_manager_default.debug("Unable to send metrics: no session ID");
72731
+ return;
72732
+ }
72733
+ const events = this.events.map((event) => {
72734
+ delete event.sessionId;
72735
+ const { eventTime, teamId, ...rest } = event;
72736
+ return { event_time: eventTime, team_id: teamId, ...rest };
72737
+ });
72738
+ const payload = {
72739
+ headers: {
72740
+ "Client-id": "vercel-cli",
72741
+ "x-vercel-cli-topic-id": "generic",
72742
+ "x-vercel-cli-session-id": sessionId
72743
+ },
72744
+ body: events
72745
+ };
72746
+ await this.sendToSubprocess(payload, output_manager_default.debugEnabled);
72747
+ }
72748
+ }
72749
+ /**
72750
+ * Send the telemetry events to a subprocess, this invokes the `telemetry flush` command
72751
+ * and passes a stringified payload to the subprocess, there's a risk that if the event payload
72752
+ * increases in size, it may exceed the maximum buffer size for the subprocess, in which case the
72753
+ * child process will error and not send anything.
72754
+ * FIXME: handle max buffer size
72755
+ */
72756
+ async sendToSubprocess(payload, outputDebugEnabled) {
72757
+ const args2 = [process.execPath, process.argv[0], process.argv[1]];
72758
+ if (args2[0] === args2[1]) {
72759
+ args2.shift();
72760
+ }
72761
+ const nodeBinaryPath = args2[0];
72762
+ const script = [
72763
+ ...args2.slice(1),
72764
+ "telemetry",
72765
+ "flush",
72766
+ JSON.stringify(payload)
72767
+ ];
72768
+ if (outputDebugEnabled) {
72769
+ return new Promise((resolve12) => {
72770
+ const childProcess = (0, import_node_child_process.spawn)(nodeBinaryPath, script, {
72771
+ stdio: ["ignore", "pipe", "pipe"]
72772
+ });
72773
+ childProcess.stderr.on("data", (data) => output_manager_default.debug(data.toString()));
72774
+ childProcess.stdout.on("data", (data) => output_manager_default.debug(data.toString()));
72775
+ childProcess.on("error", (d) => {
72776
+ output_manager_default.debug(d);
72777
+ });
72778
+ setTimeout(() => {
72779
+ childProcess.kill();
72780
+ }, 2e3);
72781
+ childProcess.on("exit", () => {
72782
+ output_manager_default.debug("Telemetry subprocess exited");
72783
+ childProcess.unref();
72784
+ resolve12();
72785
+ });
72786
+ });
72787
+ } else {
72788
+ const childProcess = (0, import_node_child_process.spawn)(nodeBinaryPath, script, {
72789
+ stdio: "ignore",
72790
+ windowsHide: true,
72791
+ detached: true
72792
+ });
72793
+ childProcess.unref();
72709
72794
  }
72710
72795
  }
72711
72796
  };
@@ -74641,6 +74726,9 @@ function buildSubcommandLines(subcommands, options) {
74641
74726
  let maxWidthOfUnwrappedColumns = 0;
74642
74727
  const rows = [];
74643
74728
  for (const command of subcommands) {
74729
+ if (command.hidden) {
74730
+ continue;
74731
+ }
74644
74732
  const nameCell = `${INDENT}${command.name}`;
74645
74733
  let argsCell = INDENT;
74646
74734
  argsCell += command.arguments.map((arg2) => {
@@ -105597,7 +105685,7 @@ var init_connect_git_provider = __esm({
105597
105685
  function getGitDirectory(opts) {
105598
105686
  const { cwd, unsafe } = { ...DEFAULT_GIT_EXEC_OPTS, ...opts };
105599
105687
  try {
105600
- const gitConfigPath = (0, import_node_child_process.execSync)("git rev-parse --git-dir", {
105688
+ const gitConfigPath = (0, import_node_child_process2.execSync)("git rev-parse --git-dir", {
105601
105689
  cwd,
105602
105690
  encoding: "utf8",
105603
105691
  stdio: ["ignore", "pipe", "ignore"]
@@ -105619,11 +105707,11 @@ function isGitWorktreeOrSubmodule(opts) {
105619
105707
  const isGitSubmodule = gitDir.includes(".git/modules/");
105620
105708
  return isGitWorktree || isGitSubmodule;
105621
105709
  }
105622
- var import_node_child_process, DEFAULT_GIT_EXEC_OPTS;
105710
+ var import_node_child_process2, DEFAULT_GIT_EXEC_OPTS;
105623
105711
  var init_git_helpers = __esm({
105624
105712
  "src/util/git-helpers.ts"() {
105625
105713
  "use strict";
105626
- import_node_child_process = require("child_process");
105714
+ import_node_child_process2 = require("child_process");
105627
105715
  DEFAULT_GIT_EXEC_OPTS = {
105628
105716
  unsafe: false
105629
105717
  };
@@ -109551,7 +109639,7 @@ var require_split2 = __commonJS2({
109551
109639
  }
109552
109640
  cb();
109553
109641
  }
109554
- function flush(cb) {
109642
+ function flush2(cb) {
109555
109643
  this[kLast] += this[kDecoder].end();
109556
109644
  if (this[kLast]) {
109557
109645
  try {
@@ -109597,7 +109685,7 @@ var require_split2 = __commonJS2({
109597
109685
  options = Object.assign({}, options);
109598
109686
  options.autoDestroy = true;
109599
109687
  options.transform = transform;
109600
- options.flush = flush;
109688
+ options.flush = flush2;
109601
109689
  options.readableObjectMode = true;
109602
109690
  const stream = new Transform(options);
109603
109691
  stream[kLast] = "";
@@ -141664,7 +141752,7 @@ var require_tree_kill = __commonJS2({
141664
141752
  "../../node_modules/.pnpm/tree-kill@1.2.2/node_modules/tree-kill/index.js"(exports2, module2) {
141665
141753
  "use strict";
141666
141754
  var childProcess = require("child_process");
141667
- var spawn2 = childProcess.spawn;
141755
+ var spawn3 = childProcess.spawn;
141668
141756
  var exec2 = childProcess.exec;
141669
141757
  module2.exports = function(pid, signal, callback) {
141670
141758
  if (typeof signal === "function" && callback === void 0) {
@@ -141689,14 +141777,14 @@ var require_tree_kill = __commonJS2({
141689
141777
  break;
141690
141778
  case "darwin":
141691
141779
  buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
141692
- return spawn2("pgrep", ["-P", parentPid]);
141780
+ return spawn3("pgrep", ["-P", parentPid]);
141693
141781
  }, function() {
141694
141782
  killAll(tree, signal, callback);
141695
141783
  });
141696
141784
  break;
141697
141785
  default:
141698
141786
  buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
141699
- return spawn2("ps", ["-o", "pid", "--no-headers", "--ppid", parentPid]);
141787
+ return spawn3("ps", ["-o", "pid", "--no-headers", "--ppid", parentPid]);
141700
141788
  }, function() {
141701
141789
  killAll(tree, signal, callback);
141702
141790
  });
@@ -156076,13 +156164,15 @@ async function status(client2) {
156076
156164
  output_manager_default.print("\n");
156077
156165
  output_manager_default.log(`${import_chalk117.default.bold("Telemetry status")}: ${status2}
156078
156166
  `);
156079
- const learnMoreMessage = "";
156167
+ const learnMoreMessage = `
156168
+
156169
+ Learn more: ${import_chalk117.default.cyan(`https://vercel.com/docs/cli/about-telemetry`)}`;
156080
156170
  if (enabled) {
156081
- output_manager_default.log(`You have opted in to Vercel CLI telemetry${learnMoreMessage}.`);
156171
+ output_manager_default.log(`You have opted in to Vercel CLI telemetry${learnMoreMessage}`);
156082
156172
  } else {
156083
- output_manager_default.log("You have opted out of Vercel CLI telemetry.");
156173
+ output_manager_default.log("You have opted out of Vercel CLI telemetry");
156084
156174
  output_manager_default.log(
156085
- `No data will be collected from your machine${learnMoreMessage}.`
156175
+ `No data will be collected from your machine${learnMoreMessage}`
156086
156176
  );
156087
156177
  }
156088
156178
  return 0;
@@ -156138,6 +156228,45 @@ var init_disable = __esm({
156138
156228
  }
156139
156229
  });
156140
156230
 
156231
+ // src/commands/telemetry/flush.ts
156232
+ async function flush(client2, args2) {
156233
+ const url3 = process.env.VERCEL_TELEMETRY_BRIDGE_URL || "https://telemetry.vercel.com/api/vercel-cli/v1/events";
156234
+ const { headers, body } = JSON.parse(args2[0]);
156235
+ try {
156236
+ const res = await client2.fetch(url3, {
156237
+ method: "POST",
156238
+ headers,
156239
+ body: JSON.stringify(body),
156240
+ json: false
156241
+ });
156242
+ const status2 = res.status;
156243
+ const cliTracked = res.headers.get("x-vercel-cli-tracked") || "";
156244
+ const wasRecorded = cliTracked === "1";
156245
+ if (status2 === 204) {
156246
+ if (wasRecorded) {
156247
+ process.stderr.write("Telemetry event tracked");
156248
+ } else {
156249
+ process.stderr.write("Telemetry event ignored");
156250
+ }
156251
+ } else {
156252
+ process.stderr.write(
156253
+ `Failed to send telemetry events. Unexpected response from telemetry server: ${status2}`
156254
+ );
156255
+ }
156256
+ return 0;
156257
+ } catch (error3) {
156258
+ if (error3 instanceof Error) {
156259
+ process.stderr.write(`Failed to send telemetry events. ${error3.message}`);
156260
+ }
156261
+ return 1;
156262
+ }
156263
+ }
156264
+ var init_flush = __esm({
156265
+ "src/commands/telemetry/flush.ts"() {
156266
+ "use strict";
156267
+ }
156268
+ });
156269
+
156141
156270
  // src/util/telemetry/commands/telemetry/index.ts
156142
156271
  var TelemetryTelemetryClient;
156143
156272
  var init_telemetry2 = __esm({
@@ -156160,6 +156289,9 @@ var init_telemetry2 = __esm({
156160
156289
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
156161
156290
  trackCliSubcommandDisable(_) {
156162
156291
  }
156292
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
156293
+ trackCliSubcommandFlush(_) {
156294
+ }
156163
156295
  };
156164
156296
  }
156165
156297
  });
@@ -156183,7 +156315,7 @@ async function telemetry(client2) {
156183
156315
  handleError(err);
156184
156316
  return 1;
156185
156317
  }
156186
- const { subcommand, subcommandOriginal } = getSubcommand(
156318
+ const { subcommand, args: args2, subcommandOriginal } = getSubcommand(
156187
156319
  parsedArguments.args.slice(1),
156188
156320
  COMMAND_CONFIG14
156189
156321
  );
@@ -156210,6 +156342,8 @@ async function telemetry(client2) {
156210
156342
  }
156211
156343
  telemetryClient.trackCliSubcommandStatus(subcommandOriginal);
156212
156344
  return status(client2);
156345
+ case "flush":
156346
+ return flush(client2, args2);
156213
156347
  case "enable":
156214
156348
  if (needHelp) {
156215
156349
  telemetryClient.trackCliFlagHelp("telemetry", subcommandOriginal);
@@ -156247,6 +156381,7 @@ var init_telemetry3 = __esm({
156247
156381
  init_status3();
156248
156382
  init_enable();
156249
156383
  init_disable();
156384
+ init_flush();
156250
156385
  init_command29();
156251
156386
  init_get_flags_specification();
156252
156387
  init_telemetry2();
@@ -156256,7 +156391,8 @@ var init_telemetry3 = __esm({
156256
156391
  COMMAND_CONFIG14 = {
156257
156392
  status: getCommandAliases(statusSubcommand3),
156258
156393
  enable: getCommandAliases(enableSubcommand),
156259
- disable: getCommandAliases(disableSubcommand)
156394
+ disable: getCommandAliases(disableSubcommand),
156395
+ flush: getCommandAliases(flushSubcommand)
156260
156396
  };
156261
156397
  }
156262
156398
  });
@@ -156599,7 +156735,7 @@ init_errors_ts();
156599
156735
  init_errors_ts();
156600
156736
 
156601
156737
  // src/util/constants.ts
156602
- var SENTRY_DSN = void 0;
156738
+ var SENTRY_DSN = "https://26a24e59ba954011919a524b341b6ab5@sentry.io/1323225";
156603
156739
 
156604
156740
  // src/index.ts
156605
156741
  init_get_update_command();
@@ -157455,6 +157591,31 @@ var help = () => `
157455
157591
 
157456
157592
  // src/index.ts
157457
157593
  init_update_current_team_after_login();
157594
+
157595
+ // src/util/telemetry/check-status.ts
157596
+ init_files();
157597
+ init_output_manager();
157598
+ function checkTelemetryStatus({ config: config2 }) {
157599
+ if (config2.telemetry) {
157600
+ return;
157601
+ }
157602
+ output_manager_default.note(
157603
+ "The Vercel CLI now collects telemetry regarding usage of the CLI."
157604
+ );
157605
+ output_manager_default.log(
157606
+ "This information is used to shape the CLI roadmap and prioritize features."
157607
+ );
157608
+ output_manager_default.log(
157609
+ "You can learn more, including how to opt-out if you'd not like to participate in this program, by visiting the following URL:"
157610
+ );
157611
+ output_manager_default.log("https://vercel.com/docs/cli/about-telemetry");
157612
+ config2.telemetry = {
157613
+ enabled: true
157614
+ };
157615
+ writeToConfigFile(config2);
157616
+ }
157617
+
157618
+ // src/index.ts
157458
157619
  init_output_manager();
157459
157620
  try {
157460
157621
  process.cwd();
@@ -157626,6 +157787,9 @@ var main14 = async () => {
157626
157787
  isDebug: process.env.VERCEL_TELEMETRY_DEBUG === "1",
157627
157788
  config: config2.telemetry
157628
157789
  });
157790
+ checkTelemetryStatus({
157791
+ config: config2
157792
+ });
157629
157793
  const telemetry2 = new RootTelemetryClient({
157630
157794
  opts: {
157631
157795
  store: telemetryEventStore
@@ -157704,7 +157868,14 @@ var main14 = async () => {
157704
157868
  subcommand = subSubCommand || "deploy";
157705
157869
  client.argv.push("-h");
157706
157870
  }
157707
- const subcommandsWithoutToken = ["login", "logout", "help", "init", "build"];
157871
+ const subcommandsWithoutToken = [
157872
+ "login",
157873
+ "logout",
157874
+ "help",
157875
+ "init",
157876
+ "build",
157877
+ "telemetry"
157878
+ ];
157708
157879
  if ((!authConfig || !authConfig.token) && !client.argv.includes("-h") && !client.argv.includes("--help") && !parsedArgs.flags["--token"] && subcommand && !subcommandsWithoutToken.includes(subcommand)) {
157709
157880
  if (isTTY2) {
157710
157881
  output_manager_default.log(`No existing credentials found. Please log in:`);
@@ -158031,7 +158202,9 @@ var main14 = async () => {
158031
158202
  }
158032
158203
  return 1;
158033
158204
  }
158034
- telemetryEventStore.save();
158205
+ if (subSubCommand !== "flush") {
158206
+ await telemetryEventStore.save();
158207
+ }
158035
158208
  return exitCode2;
158036
158209
  };
158037
158210
  var handleRejection = async (err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "38.0.0",
3
+ "version": "39.0.1",
4
4
  "preferGlobal": true,
5
5
  "license": "Apache-2.0",
6
6
  "description": "The command-line interface for Vercel",
@@ -27,7 +27,7 @@
27
27
  "@vercel/hydrogen": "1.0.9",
28
28
  "@vercel/next": "4.3.19",
29
29
  "@vercel/node": "3.2.24",
30
- "@vercel/python": "4.4.0",
30
+ "@vercel/python": "4.4.1",
31
31
  "@vercel/redwood": "2.1.8",
32
32
  "@vercel/remix-builder": "2.2.13",
33
33
  "@vercel/ruby": "2.1.0",
@@ -86,7 +86,7 @@
86
86
  "@vercel/frameworks": "3.3.0",
87
87
  "@vercel/fs-detectors": "5.2.10",
88
88
  "@vercel/routing-utils": "3.1.0",
89
- "@vitest/expect": "1.4.0",
89
+ "@vitest/expect": "2.1.3",
90
90
  "ajv": "6.12.2",
91
91
  "alpha-sort": "2.0.1",
92
92
  "ansi-escapes": "4.3.2",