vercel 46.0.1 → 46.0.2-canary.a0bfa7a5

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 +514 -547
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ var require_dist2 = __commonJS2({
93
93
  var __toCommonJS4 = (mod) => __copyProps4(__defProp4({}, "__esModule", { value: true }), mod);
94
94
  var src_exports2 = {};
95
95
  __export4(src_exports2, {
96
- errorToString: () => errorToString15,
96
+ errorToString: () => errorToString14,
97
97
  isErrnoException: () => isErrnoException20,
98
98
  isError: () => isError14,
99
99
  isErrorLike: () => isErrorLike2,
@@ -111,7 +111,7 @@ var require_dist2 = __commonJS2({
111
111
  return isError14(error3) && "code" in error3;
112
112
  };
113
113
  var isErrorLike2 = (error3) => isObject2(error3) && "message" in error3;
114
- var errorToString15 = (error3, fallback) => {
114
+ var errorToString14 = (error3, fallback) => {
115
115
  if (isError14(error3) || isErrorLike2(error3))
116
116
  return error3.message;
117
117
  if (typeof error3 === "string")
@@ -121,7 +121,7 @@ var require_dist2 = __commonJS2({
121
121
  var normalizeError3 = (error3) => {
122
122
  if (isError14(error3))
123
123
  return error3;
124
- const errorMessage = errorToString15(error3);
124
+ const errorMessage = errorToString14(error3);
125
125
  return isErrorLike2(error3) ? Object.assign(new Error(errorMessage), error3) : new Error(errorMessage);
126
126
  };
127
127
  function isSpawnError2(v) {
@@ -33261,7 +33261,7 @@ var init_command20 = __esm({
33261
33261
  loginCommand = {
33262
33262
  name: "login",
33263
33263
  aliases: [],
33264
- description: "Authenticate using your email or team id.",
33264
+ description: "Sign in to your Vercel account.",
33265
33265
  arguments: [
33266
33266
  {
33267
33267
  name: "email or team id",
@@ -33274,41 +33274,29 @@ var init_command20 = __esm({
33274
33274
  description: "Log in with GitHub",
33275
33275
  shorthand: null,
33276
33276
  type: Boolean,
33277
- deprecated: false
33277
+ deprecated: true
33278
33278
  },
33279
33279
  {
33280
33280
  name: "oob",
33281
33281
  description: 'Log in with "out of band" authentication',
33282
33282
  shorthand: null,
33283
33283
  type: Boolean,
33284
- deprecated: false
33284
+ deprecated: true
33285
33285
  },
33286
- { name: "gitlab", shorthand: null, type: Boolean, deprecated: false },
33287
- { name: "bitbucket", shorthand: null, type: Boolean, deprecated: false },
33286
+ { name: "gitlab", shorthand: null, type: Boolean, deprecated: true },
33287
+ { name: "bitbucket", shorthand: null, type: Boolean, deprecated: true },
33288
33288
  {
33289
33289
  name: "future",
33290
33290
  description: "Sign in using OAuth Device Authorization",
33291
33291
  shorthand: null,
33292
33292
  type: Boolean,
33293
- deprecated: false
33293
+ deprecated: true
33294
33294
  }
33295
33295
  ],
33296
33296
  examples: [
33297
33297
  {
33298
- name: "Log into the Vercel platform",
33298
+ name: "Sign in to your Vercel account.",
33299
33299
  value: `${packageName} login`
33300
- },
33301
- {
33302
- name: "Log in using a specific email address",
33303
- value: `${packageName} login username@example.com`
33304
- },
33305
- {
33306
- name: 'Log in using a specific team "slug" for SAML Single Sign-On',
33307
- value: `${packageName} login acme`
33308
- },
33309
- {
33310
- name: 'Log in using GitHub in "out-of-band" mode',
33311
- value: `${packageName} login --github --oob`
33312
33300
  }
33313
33301
  ]
33314
33302
  };
@@ -33324,7 +33312,7 @@ var init_command21 = __esm({
33324
33312
  logoutCommand = {
33325
33313
  name: "logout",
33326
33314
  aliases: [],
33327
- description: "Logout the current authenticated user.",
33315
+ description: "Sign out the currently authenticated user.",
33328
33316
  arguments: [],
33329
33317
  options: [
33330
33318
  {
@@ -33332,12 +33320,12 @@ var init_command21 = __esm({
33332
33320
  description: "Sign out by calling the Vercel OAuth Revocation Endpoint.",
33333
33321
  shorthand: null,
33334
33322
  type: Boolean,
33335
- deprecated: false
33323
+ deprecated: true
33336
33324
  }
33337
33325
  ],
33338
33326
  examples: [
33339
33327
  {
33340
- name: "Logout from the CLI",
33328
+ name: "Sign out the currently authenticated user.",
33341
33329
  value: `${packageName} logout`
33342
33330
  }
33343
33331
  ]
@@ -41527,6 +41515,261 @@ var init_print_indications = __esm({
41527
41515
  }
41528
41516
  });
41529
41517
 
41518
+ // src/util/oauth.ts
41519
+ async function as() {
41520
+ if (!_as) {
41521
+ const discoveryResponse = await discoveryEndpointRequest(VERCEL_ISSUER);
41522
+ const [discoveryResponseError, as2] = await processDiscoveryEndpointResponse(discoveryResponse);
41523
+ if (discoveryResponseError) {
41524
+ throw discoveryResponseError;
41525
+ }
41526
+ _as = as2;
41527
+ }
41528
+ return _as;
41529
+ }
41530
+ async function discoveryEndpointRequest(issuer) {
41531
+ return await (0, import_node_fetch.default)(new URL(".well-known/openid-configuration", issuer), {
41532
+ headers: { "Content-Type": "application/json", "user-agent": userAgent }
41533
+ });
41534
+ }
41535
+ async function processDiscoveryEndpointResponse(response) {
41536
+ const json = await response.json();
41537
+ if (!response.ok) {
41538
+ return [new Error("Discovery endpoint request failed")];
41539
+ }
41540
+ if (typeof json !== "object" || json === null || !canParseURL(json.issuer) || !canParseURL(json.device_authorization_endpoint) || !canParseURL(json.token_endpoint) || !canParseURL(json.revocation_endpoint) || !canParseURL(json.jwks_uri) || !canParseURL(json.introspection_endpoint)) {
41541
+ return [new TypeError("Invalid discovery response")];
41542
+ }
41543
+ const issuer = new URL(json.issuer);
41544
+ if (issuer.href !== VERCEL_ISSUER.href) {
41545
+ return [new Error("Issuer mismatch")];
41546
+ }
41547
+ return [
41548
+ null,
41549
+ {
41550
+ issuer,
41551
+ device_authorization_endpoint: new URL(
41552
+ json.device_authorization_endpoint
41553
+ ),
41554
+ token_endpoint: new URL(json.token_endpoint),
41555
+ revocation_endpoint: new URL(json.revocation_endpoint),
41556
+ jwks_uri: new URL(json.jwks_uri),
41557
+ introspection_endpoint: new URL(json.introspection_endpoint)
41558
+ }
41559
+ ];
41560
+ }
41561
+ async function deviceAuthorizationRequest() {
41562
+ return await (0, import_node_fetch.default)((await as()).device_authorization_endpoint, {
41563
+ method: "POST",
41564
+ headers: {
41565
+ "Content-Type": "application/x-www-form-urlencoded",
41566
+ "user-agent": userAgent
41567
+ },
41568
+ body: new URLSearchParams({
41569
+ client_id: VERCEL_CLI_CLIENT_ID,
41570
+ scope: "openid offline_access"
41571
+ })
41572
+ });
41573
+ }
41574
+ async function processDeviceAuthorizationResponse(response) {
41575
+ const json = await response.json();
41576
+ if (!response.ok) {
41577
+ return [new OAuthError("Device authorization request failed", json)];
41578
+ }
41579
+ if (typeof json !== "object" || json === null)
41580
+ return [new TypeError("Expected response to be an object")];
41581
+ if (!("device_code" in json) || typeof json.device_code !== "string")
41582
+ return [new TypeError("Expected `device_code` to be a string")];
41583
+ if (!("user_code" in json) || typeof json.user_code !== "string")
41584
+ return [new TypeError("Expected `user_code` to be a string")];
41585
+ if (!("verification_uri" in json) || typeof json.verification_uri !== "string" || !canParseURL(json.verification_uri)) {
41586
+ return [new TypeError("Expected `verification_uri` to be a string")];
41587
+ }
41588
+ if (!("verification_uri_complete" in json) || typeof json.verification_uri_complete !== "string" || !canParseURL(json.verification_uri_complete)) {
41589
+ return [
41590
+ new TypeError("Expected `verification_uri_complete` to be a string")
41591
+ ];
41592
+ }
41593
+ if (!("expires_in" in json) || typeof json.expires_in !== "number")
41594
+ return [new TypeError("Expected `expires_in` to be a number")];
41595
+ if (!("interval" in json) || typeof json.interval !== "number")
41596
+ return [new TypeError("Expected `interval` to be a number")];
41597
+ return [
41598
+ null,
41599
+ {
41600
+ device_code: json.device_code,
41601
+ user_code: json.user_code,
41602
+ verification_uri: json.verification_uri,
41603
+ verification_uri_complete: json.verification_uri_complete,
41604
+ expiresAt: Date.now() + json.expires_in * 1e3,
41605
+ interval: json.interval
41606
+ }
41607
+ ];
41608
+ }
41609
+ async function deviceAccessTokenRequest(options) {
41610
+ try {
41611
+ return [
41612
+ null,
41613
+ await (0, import_node_fetch.default)((await as()).token_endpoint, {
41614
+ method: "POST",
41615
+ headers: {
41616
+ "Content-Type": "application/x-www-form-urlencoded",
41617
+ "user-agent": userAgent
41618
+ },
41619
+ body: new URLSearchParams({
41620
+ client_id: VERCEL_CLI_CLIENT_ID,
41621
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
41622
+ ...options
41623
+ }),
41624
+ // TODO: Drop `node-fetch` and just use `signal`
41625
+ timeout: 10 * 1e3,
41626
+ // @ts-expect-error: Signal is part of `fetch` spec, should drop `node-fetch`
41627
+ signal: AbortSignal.timeout(10 * 1e3)
41628
+ })
41629
+ ];
41630
+ } catch (error3) {
41631
+ if (error3 instanceof Error)
41632
+ return [error3];
41633
+ return [
41634
+ new Error("An unknown error occurred. See the logs for details.", {
41635
+ cause: error3
41636
+ })
41637
+ ];
41638
+ }
41639
+ }
41640
+ async function processTokenResponse(response) {
41641
+ const json = await response.json();
41642
+ if (!response.ok) {
41643
+ return [new OAuthError("Device access token request failed", json)];
41644
+ }
41645
+ if (typeof json !== "object" || json === null)
41646
+ return [new TypeError("Expected response to be an object")];
41647
+ if (!("access_token" in json) || typeof json.access_token !== "string")
41648
+ return [new TypeError("Expected `access_token` to be a string")];
41649
+ if (!("token_type" in json) || json.token_type !== "Bearer")
41650
+ return [new TypeError('Expected `token_type` to be "Bearer"')];
41651
+ if (!("expires_in" in json) || typeof json.expires_in !== "number")
41652
+ return [new TypeError("Expected `expires_in` to be a number")];
41653
+ if ("refresh_token" in json && (typeof json.refresh_token !== "string" || !json.refresh_token))
41654
+ return [new TypeError("Expected `refresh_token` to be a string")];
41655
+ if ("scope" in json && typeof json.scope !== "string")
41656
+ return [new TypeError("Expected `scope` to be a string")];
41657
+ return [null, json];
41658
+ }
41659
+ async function revocationRequest(options) {
41660
+ return await (0, import_node_fetch.default)((await as()).revocation_endpoint, {
41661
+ method: "POST",
41662
+ headers: {
41663
+ "Content-Type": "application/x-www-form-urlencoded",
41664
+ "user-agent": userAgent
41665
+ },
41666
+ body: new URLSearchParams({ ...options, client_id: VERCEL_CLI_CLIENT_ID })
41667
+ });
41668
+ }
41669
+ async function processRevocationResponse(response) {
41670
+ if (response.ok)
41671
+ return [null, null];
41672
+ const json = await response.json();
41673
+ return [new OAuthError("Revocation request failed", json)];
41674
+ }
41675
+ async function refreshTokenRequest(options) {
41676
+ return await (0, import_node_fetch.default)((await as()).token_endpoint, {
41677
+ method: "POST",
41678
+ headers: {
41679
+ "Content-Type": "application/x-www-form-urlencoded",
41680
+ "user-agent": ua_default
41681
+ },
41682
+ body: new URLSearchParams({
41683
+ client_id: VERCEL_CLI_CLIENT_ID,
41684
+ grant_type: "refresh_token",
41685
+ ...options
41686
+ })
41687
+ });
41688
+ }
41689
+ function processOAuthErrorResponse(json) {
41690
+ if (typeof json !== "object" || json === null)
41691
+ return new TypeError("Expected response to be an object");
41692
+ if (!("error" in json) || typeof json.error !== "string")
41693
+ return new TypeError("Expected `error` to be a string");
41694
+ if ("error_description" in json && typeof json.error_description !== "string")
41695
+ return new TypeError("Expected `error_description` to be a string");
41696
+ if ("error_uri" in json && typeof json.error_uri !== "string")
41697
+ return new TypeError("Expected `error_uri` to be a string");
41698
+ return json;
41699
+ }
41700
+ function isOAuthError(error3) {
41701
+ return error3 instanceof OAuthError;
41702
+ }
41703
+ function canParseURL(url3) {
41704
+ try {
41705
+ return !!new URL(url3);
41706
+ } catch {
41707
+ return false;
41708
+ }
41709
+ }
41710
+ async function inspectTokenRequest(token) {
41711
+ return (0, import_node_fetch.default)((await as()).introspection_endpoint, {
41712
+ method: "POST",
41713
+ headers: {
41714
+ "Content-Type": "application/x-www-form-urlencoded",
41715
+ "user-agent": ua_default
41716
+ },
41717
+ body: new URLSearchParams({ token })
41718
+ });
41719
+ }
41720
+ async function processInspectTokenResponse(response) {
41721
+ try {
41722
+ const token = await response.json();
41723
+ if (!token || typeof token !== "object" || !("active" in token)) {
41724
+ throw new IntrospectionError("Invalid token introspection response");
41725
+ }
41726
+ return [null, token];
41727
+ } catch (cause) {
41728
+ return [new IntrospectionError("Could not introspect token.", { cause })];
41729
+ }
41730
+ }
41731
+ var import_node_fetch, import_os3, VERCEL_ISSUER, VERCEL_CLI_CLIENT_ID, userAgent, _as, OAuthError, IntrospectionError;
41732
+ var init_oauth = __esm({
41733
+ "src/util/oauth.ts"() {
41734
+ "use strict";
41735
+ import_node_fetch = __toESM3(require_lib7());
41736
+ init_ua();
41737
+ import_os3 = require("os");
41738
+ VERCEL_ISSUER = new URL("https://vercel.com");
41739
+ VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
41740
+ userAgent = `${(0, import_os3.hostname)()} @ ${ua_default}`;
41741
+ OAuthError = class extends Error {
41742
+ constructor(message2, response) {
41743
+ var __super = (...args) => {
41744
+ super(...args);
41745
+ };
41746
+ const error3 = processOAuthErrorResponse(response);
41747
+ if (error3 instanceof TypeError) {
41748
+ const message3 = `Unexpected server response: ${JSON.stringify(response)}`;
41749
+ __super(message3);
41750
+ this.cause = new Error(message3, { cause: error3 });
41751
+ this.code = "server_error";
41752
+ return;
41753
+ }
41754
+ let cause = error3.error;
41755
+ if (error3.error_description)
41756
+ cause += `: ${error3.error_description}`;
41757
+ if (error3.error_uri)
41758
+ cause += ` (${error3.error_uri})`;
41759
+ __super(message2, { cause });
41760
+ this.cause = new Error(cause);
41761
+ this.code = error3.error;
41762
+ }
41763
+ };
41764
+ IntrospectionError = class extends Error {
41765
+ constructor() {
41766
+ super(...arguments);
41767
+ this.name = "IntrospectionError";
41768
+ }
41769
+ };
41770
+ }
41771
+ });
41772
+
41530
41773
  // ../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js
41531
41774
  var require_is_docker = __commonJS2({
41532
41775
  "../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports2, module2) {
@@ -42185,7 +42428,7 @@ function verify(client2, verificationToken, email2, provider, ssoUserId) {
42185
42428
  }
42186
42429
  if (!client2.authConfig.token) {
42187
42430
  const hyphens = new RegExp("-", "g");
42188
- const host = (0, import_os3.hostname)().replace(hyphens, " ").replace(".local", "");
42431
+ const host = (0, import_os4.hostname)().replace(hyphens, " ").replace(".local", "");
42189
42432
  const tokenName = `${getTitleName()} CLI on ${host} via ${provider}`;
42190
42433
  url3.searchParams.set("tokenName", tokenName);
42191
42434
  }
@@ -42194,12 +42437,12 @@ function verify(client2, verificationToken, email2, provider, ssoUserId) {
42194
42437
  }
42195
42438
  return client2.fetch(url3.href, { useCurrentTeam: false });
42196
42439
  }
42197
- var import_url2, import_os3;
42440
+ var import_url2, import_os4;
42198
42441
  var init_verify = __esm({
42199
42442
  "src/util/login/verify.ts"() {
42200
42443
  "use strict";
42201
42444
  import_url2 = require("url");
42202
- import_os3 = require("os");
42445
+ import_os4 = require("os");
42203
42446
  init_pkg_name();
42204
42447
  }
42205
42448
  });
@@ -42310,7 +42553,7 @@ var init_github = __esm({
42310
42553
  "src/util/login/github.ts"() {
42311
42554
  "use strict";
42312
42555
  import_url3 = require("url");
42313
- init_oauth();
42556
+ init_oauth2();
42314
42557
  }
42315
42558
  });
42316
42559
 
@@ -42324,7 +42567,7 @@ var init_google = __esm({
42324
42567
  "src/util/login/google.ts"() {
42325
42568
  "use strict";
42326
42569
  import_url4 = require("url");
42327
- init_oauth();
42570
+ init_oauth2();
42328
42571
  }
42329
42572
  });
42330
42573
 
@@ -42338,7 +42581,7 @@ var init_gitlab = __esm({
42338
42581
  "src/util/login/gitlab.ts"() {
42339
42582
  "use strict";
42340
42583
  import_url5 = require("url");
42341
- init_oauth();
42584
+ init_oauth2();
42342
42585
  }
42343
42586
  });
42344
42587
 
@@ -42357,7 +42600,7 @@ var init_bitbucket = __esm({
42357
42600
  "src/util/login/bitbucket.ts"() {
42358
42601
  "use strict";
42359
42602
  import_url6 = require("url");
42360
- init_oauth();
42603
+ init_oauth2();
42361
42604
  }
42362
42605
  });
42363
42606
 
@@ -42391,7 +42634,7 @@ async function prompt(client2, error3, outOfBand, ssoUserId) {
42391
42634
  const email2 = await readInput(client2, "Enter your email address:");
42392
42635
  result = await doEmailLogin(client2, email2, ssoUserId);
42393
42636
  } else if (choice === "saml") {
42394
- const slug = error3?.teamId || await readInput(client2, "Enter your Team slug:");
42637
+ const slug = error3?.scope || error3?.teamId || await readInput(client2, "Enter your Team slug:");
42395
42638
  result = await doSamlLogin(client2, slug, outOfBand, ssoUserId);
42396
42639
  }
42397
42640
  return result;
@@ -42558,7 +42801,7 @@ function isSSH() {
42558
42801
  return Boolean(process.env.SSH_CLIENT || process.env.SSH_TTY);
42559
42802
  }
42560
42803
  var import_http, import_open, import_url7, import_async_listen, import_is_docker;
42561
- var init_oauth = __esm({
42804
+ var init_oauth2 = __esm({
42562
42805
  "src/util/login/oauth.ts"() {
42563
42806
  "use strict";
42564
42807
  import_http = __toESM3(require("http"));
@@ -42576,17 +42819,53 @@ var init_oauth = __esm({
42576
42819
  });
42577
42820
 
42578
42821
  // src/util/login/saml.ts
42579
- function doSamlLogin(client2, teamIdOrSlug, outOfBand, ssoUserId) {
42822
+ async function doSamlLogin(client2, teamIdOrSlug, outOfBand, ssoUserId) {
42823
+ if (client2.authConfig.type === "oauth") {
42824
+ const { session_id, client_id } = await decodeToken(client2);
42825
+ const params2 = { session_id, client_id };
42826
+ const url4 = new import_url8.URL(
42827
+ `https://vercel.com/sso/${teamIdOrSlug}?${new URLSearchParams(params2).toString()}`
42828
+ );
42829
+ return doOauthLogin(
42830
+ client2,
42831
+ url4,
42832
+ "SAML Single Sign-On",
42833
+ outOfBand,
42834
+ ssoUserId
42835
+ );
42836
+ }
42580
42837
  const url3 = new import_url8.URL("/auth/sso", client2.apiUrl);
42581
42838
  url3.searchParams.set("teamId", teamIdOrSlug);
42582
42839
  return doOauthLogin(client2, url3, "SAML Single Sign-On", outOfBand, ssoUserId);
42583
42840
  }
42841
+ async function decodeToken(client2) {
42842
+ const { token } = client2.authConfig;
42843
+ if (!token) {
42844
+ throw new Error(
42845
+ `No existing credentials found. Please run \`vercel login\`.`
42846
+ );
42847
+ }
42848
+ const inspectResponse = await inspectTokenRequest(token);
42849
+ const [inspectError, inspectResult] = await processInspectTokenResponse(inspectResponse);
42850
+ if (inspectError)
42851
+ throw inspectError;
42852
+ if (!inspectResult.active || !inspectResult.session_id || !inspectResult.client_id) {
42853
+ throw new Error(
42854
+ `Invalid token type. Run \`vercel login\` to log-in and try again.`
42855
+ );
42856
+ }
42857
+ return {
42858
+ session_id: inspectResult.session_id,
42859
+ client_id: inspectResult.client_id
42860
+ };
42861
+ }
42584
42862
  var import_url8;
42585
42863
  var init_saml = __esm({
42586
42864
  "src/util/login/saml.ts"() {
42587
42865
  "use strict";
42588
42866
  import_url8 = require("url");
42589
42867
  init_oauth();
42868
+ init_oauth2();
42590
42869
  }
42591
42870
  });
42592
42871
 
@@ -42597,7 +42876,7 @@ async function reauthenticate(client2, error3) {
42597
42876
  `You must re-authenticate with SAML to use ${(0, import_chalk16.bold)(error3.scope)} scope.`
42598
42877
  );
42599
42878
  if (await client2.input.confirm(`Log in with SAML?`, true)) {
42600
- return doSamlLogin(client2, error3.teamId);
42879
+ return doSamlLogin(client2, error3.scope ?? error3.teamId);
42601
42880
  }
42602
42881
  } else {
42603
42882
  output_manager_default.log(`You must re-authenticate to use ${(0, import_chalk16.bold)(error3.scope)} scope.`);
@@ -60572,7 +60851,7 @@ var require_create_deployment = __commonJS2({
60572
60851
  var import_upload = require_upload();
60573
60852
  var import_utils4 = require_utils13();
60574
60853
  var import_errors4 = require_errors2();
60575
- var import_error_utils39 = require_dist2();
60854
+ var import_error_utils38 = require_dist2();
60576
60855
  var import_build_utils18 = require("@vercel/build-utils");
60577
60856
  var import_tar_fs2 = __toESM4(require_tar_fs());
60578
60857
  var import_zlib = require("zlib");
@@ -60654,7 +60933,7 @@ var require_create_deployment = __commonJS2({
60654
60933
  files = await (0, import_hashes.hashes)(fileList);
60655
60934
  }
60656
60935
  } catch (err) {
60657
- if (clientOptions.prebuilt && (0, import_error_utils39.isErrnoException)(err) && err.code === "ENOENT" && err.path) {
60936
+ if (clientOptions.prebuilt && (0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT" && err.path) {
60658
60937
  const errPath = (0, import_path41.relative)(workPath, err.path);
60659
60938
  err.message = `File does not exist: "${(0, import_path41.relative)(workPath, errPath)}"`;
60660
60939
  if (errPath.split(import_path41.sep).includes("node_modules")) {
@@ -60768,11 +61047,11 @@ var require_dist7 = __commonJS2({
60768
61047
  });
60769
61048
 
60770
61049
  // src/util/config/global-path.ts
60771
- var import_os4, import_fs, import_path3, import_xdg_app_paths2, isDirectory, getGlobalPathConfig, global_path_default;
61050
+ var import_os5, import_fs, import_path3, import_xdg_app_paths2, isDirectory, getGlobalPathConfig, global_path_default;
60772
61051
  var init_global_path = __esm({
60773
61052
  "src/util/config/global-path.ts"() {
60774
61053
  "use strict";
60775
- import_os4 = require("os");
61054
+ import_os5 = require("os");
60776
61055
  import_fs = __toESM3(require("fs"));
60777
61056
  import_path3 = __toESM3(require("path"));
60778
61057
  import_xdg_app_paths2 = __toESM3(require_xdg_app_paths());
@@ -60791,7 +61070,7 @@ var init_global_path = __esm({
60791
61070
  const possibleConfigPaths = [
60792
61071
  ...vercelDirectories,
60793
61072
  // latest vercel directory
60794
- import_path3.default.join((0, import_os4.homedir)(), ".now"),
61073
+ import_path3.default.join((0, import_os5.homedir)(), ".now"),
60795
61074
  // legacy config in user's home directory
60796
61075
  ...(0, import_xdg_app_paths2.default)("now").dataDirs()
60797
61076
  // legacy XDG directory
@@ -60982,233 +61261,6 @@ var init_promise = __esm({
60982
61261
  }
60983
61262
  });
60984
61263
 
60985
- // src/util/oauth.ts
60986
- async function as() {
60987
- if (!_as) {
60988
- const discoveryResponse = await discoveryEndpointRequest(VERCEL_ISSUER);
60989
- const [discoveryResponseError, as2] = await processDiscoveryEndpointResponse(discoveryResponse);
60990
- if (discoveryResponseError) {
60991
- throw discoveryResponseError;
60992
- }
60993
- _as = as2;
60994
- }
60995
- return _as;
60996
- }
60997
- async function discoveryEndpointRequest(issuer) {
60998
- return await (0, import_node_fetch.default)(new URL(".well-known/openid-configuration", issuer), {
60999
- headers: { "Content-Type": "application/json", "user-agent": userAgent }
61000
- });
61001
- }
61002
- async function processDiscoveryEndpointResponse(response) {
61003
- const json = await response.json();
61004
- if (!response.ok) {
61005
- return [new Error("Discovery endpoint request failed")];
61006
- }
61007
- if (typeof json !== "object" || json === null || !canParseURL(json.issuer) || !canParseURL(json.device_authorization_endpoint) || !canParseURL(json.token_endpoint) || !canParseURL(json.revocation_endpoint) || !canParseURL(json.jwks_uri)) {
61008
- return [new TypeError("Invalid discovery response")];
61009
- }
61010
- const issuer = new URL(json.issuer);
61011
- if (issuer.href !== VERCEL_ISSUER.href) {
61012
- return [new Error("Issuer mismatch")];
61013
- }
61014
- return [
61015
- null,
61016
- {
61017
- issuer,
61018
- device_authorization_endpoint: new URL(
61019
- json.device_authorization_endpoint
61020
- ),
61021
- token_endpoint: new URL(json.token_endpoint),
61022
- revocation_endpoint: new URL(json.revocation_endpoint),
61023
- jwks_uri: new URL(json.jwks_uri)
61024
- }
61025
- ];
61026
- }
61027
- async function deviceAuthorizationRequest() {
61028
- return await (0, import_node_fetch.default)((await as()).device_authorization_endpoint, {
61029
- method: "POST",
61030
- headers: {
61031
- "Content-Type": "application/x-www-form-urlencoded",
61032
- "user-agent": userAgent
61033
- },
61034
- body: new URLSearchParams({
61035
- client_id: VERCEL_CLI_CLIENT_ID,
61036
- scope: "openid offline_access"
61037
- })
61038
- });
61039
- }
61040
- async function processDeviceAuthorizationResponse(response) {
61041
- const json = await response.json();
61042
- if (!response.ok) {
61043
- return [new OAuthError("Device authorization request failed", json)];
61044
- }
61045
- if (typeof json !== "object" || json === null)
61046
- return [new TypeError("Expected response to be an object")];
61047
- if (!("device_code" in json) || typeof json.device_code !== "string")
61048
- return [new TypeError("Expected `device_code` to be a string")];
61049
- if (!("user_code" in json) || typeof json.user_code !== "string")
61050
- return [new TypeError("Expected `user_code` to be a string")];
61051
- if (!("verification_uri" in json) || typeof json.verification_uri !== "string" || !canParseURL(json.verification_uri)) {
61052
- return [new TypeError("Expected `verification_uri` to be a string")];
61053
- }
61054
- if (!("verification_uri_complete" in json) || typeof json.verification_uri_complete !== "string" || !canParseURL(json.verification_uri_complete)) {
61055
- return [
61056
- new TypeError("Expected `verification_uri_complete` to be a string")
61057
- ];
61058
- }
61059
- if (!("expires_in" in json) || typeof json.expires_in !== "number")
61060
- return [new TypeError("Expected `expires_in` to be a number")];
61061
- if (!("interval" in json) || typeof json.interval !== "number")
61062
- return [new TypeError("Expected `interval` to be a number")];
61063
- return [
61064
- null,
61065
- {
61066
- device_code: json.device_code,
61067
- user_code: json.user_code,
61068
- verification_uri: json.verification_uri,
61069
- verification_uri_complete: json.verification_uri_complete,
61070
- expiresAt: Date.now() + json.expires_in * 1e3,
61071
- interval: json.interval
61072
- }
61073
- ];
61074
- }
61075
- async function deviceAccessTokenRequest(options) {
61076
- try {
61077
- return [
61078
- null,
61079
- await (0, import_node_fetch.default)((await as()).token_endpoint, {
61080
- method: "POST",
61081
- headers: {
61082
- "Content-Type": "application/x-www-form-urlencoded",
61083
- "user-agent": userAgent
61084
- },
61085
- body: new URLSearchParams({
61086
- client_id: VERCEL_CLI_CLIENT_ID,
61087
- grant_type: "urn:ietf:params:oauth:grant-type:device_code",
61088
- ...options
61089
- }),
61090
- // TODO: Drop `node-fetch` and just use `signal`
61091
- timeout: 10 * 1e3,
61092
- // @ts-expect-error: Signal is part of `fetch` spec, should drop `node-fetch`
61093
- signal: AbortSignal.timeout(10 * 1e3)
61094
- })
61095
- ];
61096
- } catch (error3) {
61097
- if (error3 instanceof Error)
61098
- return [error3];
61099
- return [
61100
- new Error("An unknown error occurred. See the logs for details.", {
61101
- cause: error3
61102
- })
61103
- ];
61104
- }
61105
- }
61106
- async function processTokenResponse(response) {
61107
- const json = await response.json();
61108
- if (!response.ok) {
61109
- return [new OAuthError("Device access token request failed", json)];
61110
- }
61111
- if (typeof json !== "object" || json === null)
61112
- return [new TypeError("Expected response to be an object")];
61113
- if (!("access_token" in json) || typeof json.access_token !== "string")
61114
- return [new TypeError("Expected `access_token` to be a string")];
61115
- if (!("token_type" in json) || json.token_type !== "Bearer")
61116
- return [new TypeError('Expected `token_type` to be "Bearer"')];
61117
- if (!("expires_in" in json) || typeof json.expires_in !== "number")
61118
- return [new TypeError("Expected `expires_in` to be a number")];
61119
- if ("refresh_token" in json && (typeof json.refresh_token !== "string" || !json.refresh_token))
61120
- return [new TypeError("Expected `refresh_token` to be a string")];
61121
- if ("scope" in json && typeof json.scope !== "string")
61122
- return [new TypeError("Expected `scope` to be a string")];
61123
- return [null, json];
61124
- }
61125
- async function revocationRequest(options) {
61126
- return await (0, import_node_fetch.default)((await as()).revocation_endpoint, {
61127
- method: "POST",
61128
- headers: {
61129
- "Content-Type": "application/x-www-form-urlencoded",
61130
- "user-agent": userAgent
61131
- },
61132
- body: new URLSearchParams({ ...options, client_id: VERCEL_CLI_CLIENT_ID })
61133
- });
61134
- }
61135
- async function processRevocationResponse(response) {
61136
- if (response.ok)
61137
- return [null, null];
61138
- const json = await response.json();
61139
- return [new OAuthError("Revocation request failed", json)];
61140
- }
61141
- async function refreshTokenRequest(options) {
61142
- return await (0, import_node_fetch.default)((await as()).token_endpoint, {
61143
- method: "POST",
61144
- headers: {
61145
- "Content-Type": "application/x-www-form-urlencoded",
61146
- "user-agent": ua_default
61147
- },
61148
- body: new URLSearchParams({
61149
- client_id: VERCEL_CLI_CLIENT_ID,
61150
- grant_type: "refresh_token",
61151
- ...options
61152
- })
61153
- });
61154
- }
61155
- function processOAuthErrorResponse(json) {
61156
- if (typeof json !== "object" || json === null)
61157
- return new TypeError("Expected response to be an object");
61158
- if (!("error" in json) || typeof json.error !== "string")
61159
- return new TypeError("Expected `error` to be a string");
61160
- if ("error_description" in json && typeof json.error_description !== "string")
61161
- return new TypeError("Expected `error_description` to be a string");
61162
- if ("error_uri" in json && typeof json.error_uri !== "string")
61163
- return new TypeError("Expected `error_uri` to be a string");
61164
- return json;
61165
- }
61166
- function isOAuthError(error3) {
61167
- return error3 instanceof OAuthError;
61168
- }
61169
- function canParseURL(url3) {
61170
- try {
61171
- return !!new URL(url3);
61172
- } catch {
61173
- return false;
61174
- }
61175
- }
61176
- var import_node_fetch, import_os5, VERCEL_ISSUER, VERCEL_CLI_CLIENT_ID, userAgent, _as, OAuthError;
61177
- var init_oauth2 = __esm({
61178
- "src/util/oauth.ts"() {
61179
- "use strict";
61180
- import_node_fetch = __toESM3(require_lib7());
61181
- init_ua();
61182
- import_os5 = require("os");
61183
- VERCEL_ISSUER = new URL("https://vercel.com");
61184
- VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
61185
- userAgent = `${(0, import_os5.hostname)()} @ ${ua_default}`;
61186
- OAuthError = class extends Error {
61187
- constructor(message2, response) {
61188
- var __super = (...args) => {
61189
- super(...args);
61190
- };
61191
- const error3 = processOAuthErrorResponse(response);
61192
- if (error3 instanceof TypeError) {
61193
- const message3 = `Unexpected server response: ${JSON.stringify(response)}`;
61194
- __super(message3);
61195
- this.cause = new Error(message3, { cause: error3 });
61196
- this.code = "server_error";
61197
- return;
61198
- }
61199
- let cause = error3.error;
61200
- if (error3.error_description)
61201
- cause += `: ${error3.error_description}`;
61202
- if (error3.error_uri)
61203
- cause += ` (${error3.error_uri})`;
61204
- __super(message2, { cause });
61205
- this.cause = new Error(cause);
61206
- this.code = error3.error;
61207
- }
61208
- };
61209
- }
61210
- });
61211
-
61212
61264
  // src/util/client.ts
61213
61265
  function isOAuthAuth(authConfig) {
61214
61266
  return authConfig.type === "oauth";
@@ -61243,7 +61295,7 @@ var init_client = __esm({
61243
61295
  import_error_utils6 = __toESM3(require_dist2());
61244
61296
  init_sleep();
61245
61297
  init_output_manager();
61246
- init_oauth2();
61298
+ init_oauth();
61247
61299
  isSAMLError = (v) => {
61248
61300
  return v && v.saml;
61249
61301
  };
@@ -61265,8 +61317,10 @@ var init_client = __esm({
61265
61317
  }
61266
61318
  throw error3;
61267
61319
  }
61268
- this.authConfig.token = result.token;
61269
- writeToAuthConfigFile(this.authConfig);
61320
+ if (this.authConfig.type !== "oauth") {
61321
+ this.authConfig.token = result.token;
61322
+ writeToAuthConfigFile(this.authConfig);
61323
+ }
61270
61324
  });
61271
61325
  this._onRetry = (error3) => {
61272
61326
  output_manager_default.debug(`Retrying: ${error3}
@@ -94353,6 +94407,15 @@ var init_telemetry = __esm({
94353
94407
  value: this.redactedValue
94354
94408
  });
94355
94409
  }
94410
+ trackLoginState(state) {
94411
+ if (state === "started")
94412
+ this.loginAttempt = (0, import_node_crypto.randomUUID)();
94413
+ if (this.loginAttempt) {
94414
+ this.track({ key: `login:attempt:${this.loginAttempt}`, value: state });
94415
+ }
94416
+ if (state !== "started")
94417
+ this.loginAttempt = void 0;
94418
+ }
94356
94419
  trackCliFlagHelp(command, subcommands) {
94357
94420
  let subcommand;
94358
94421
  if (subcommands) {
@@ -94363,9 +94426,6 @@ var init_telemetry = __esm({
94363
94426
  value: subcommand ? `${command}:${subcommand}` : command
94364
94427
  });
94365
94428
  }
94366
- trackCliFlagFuture(command) {
94367
- this.track({ key: "flag:future", value: command });
94368
- }
94369
94429
  };
94370
94430
  TelemetryEventStore = class {
94371
94431
  constructor(opts) {
@@ -114249,14 +114309,14 @@ var require_read_config_file = __commonJS2({
114249
114309
  var import_js_yaml = __toESM4(require_js_yaml2());
114250
114310
  var import_toml = __toESM4(require_toml());
114251
114311
  var import_fs9 = require("fs");
114252
- var import_error_utils39 = require_dist2();
114312
+ var import_error_utils38 = require_dist2();
114253
114313
  var { readFile: readFile6 } = import_fs9.promises;
114254
114314
  async function readFileOrNull(file) {
114255
114315
  try {
114256
114316
  const data = await readFile6(file);
114257
114317
  return data;
114258
114318
  } catch (error3) {
114259
- if (!(0, import_error_utils39.isErrnoException)(error3)) {
114319
+ if (!(0, import_error_utils38.isErrnoException)(error3)) {
114260
114320
  throw error3;
114261
114321
  }
114262
114322
  if (error3.code !== "ENOENT") {
@@ -120090,7 +120150,7 @@ var require_local_file_system_detector = __commonJS2({
120090
120150
  var import_promises4 = __toESM4(require("fs/promises"));
120091
120151
  var import_path41 = require("path");
120092
120152
  var import_filesystem = require_filesystem();
120093
- var import_error_utils39 = require_dist2();
120153
+ var import_error_utils38 = require_dist2();
120094
120154
  var LocalFileSystemDetector5 = class _LocalFileSystemDetector extends import_filesystem.DetectorFilesystem {
120095
120155
  constructor(rootPath) {
120096
120156
  super();
@@ -120101,7 +120161,7 @@ var require_local_file_system_detector = __commonJS2({
120101
120161
  await import_promises4.default.stat(this.getFilePath(name));
120102
120162
  return true;
120103
120163
  } catch (err) {
120104
- if ((0, import_error_utils39.isErrnoException)(err) && err.code === "ENOENT") {
120164
+ if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT") {
120105
120165
  return false;
120106
120166
  }
120107
120167
  throw err;
@@ -146816,7 +146876,7 @@ async function main4(client2) {
146816
146876
  if (!subcommand && needHelp) {
146817
146877
  telemetry2.trackCliFlagHelp(cacheCommand.name);
146818
146878
  output_manager_default.print(help2(cacheCommand, { columns: client2.stderr.columns }));
146819
- return 2;
146879
+ return 0;
146820
146880
  }
146821
146881
  function printHelp(command) {
146822
146882
  telemetry2.trackCliFlagHelp(command.name, subcommandOriginal);
@@ -178253,7 +178313,7 @@ async function link3(client2) {
178253
178313
  if (parsedArgs.flags["--help"]) {
178254
178314
  telemetry2.trackCliFlagHelp("link");
178255
178315
  output_manager_default.print(help2(linkCommand, { columns: client2.stderr.columns }));
178256
- return 2;
178316
+ return 0;
178257
178317
  }
178258
178318
  telemetry2.trackCliFlagRepo(parsedArgs.flags["--repo"]);
178259
178319
  telemetry2.trackCliFlagYes(parsedArgs.flags["--yes"]);
@@ -178433,7 +178493,7 @@ async function list5(client2) {
178433
178493
  if (parsedArgs.flags["--help"]) {
178434
178494
  telemetry2.trackCliFlagHelp("list");
178435
178495
  print(help2(listCommand, { columns: client2.stderr.columns }));
178436
- return 2;
178496
+ return 0;
178437
178497
  }
178438
178498
  if (parsedArgs.args.length > 2) {
178439
178499
  error3(`${getCommandName("ls [app]")} accepts at most one argument`);
@@ -179209,32 +179269,6 @@ var init_mcp2 = __esm({
179209
179269
  }
179210
179270
  });
179211
179271
 
179212
- // ../../node_modules/.pnpm/email-validator@1.1.1/node_modules/email-validator/index.js
179213
- var require_email_validator = __commonJS2({
179214
- "../../node_modules/.pnpm/email-validator@1.1.1/node_modules/email-validator/index.js"(exports2) {
179215
- "use strict";
179216
- var tester = /^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-?\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;
179217
- exports2.validate = function(email2) {
179218
- if (!email2)
179219
- return false;
179220
- if (email2.length > 254)
179221
- return false;
179222
- var valid = tester.test(email2);
179223
- if (!valid)
179224
- return false;
179225
- var parts = email2.split("@");
179226
- if (parts[0].length > 64)
179227
- return false;
179228
- var domainParts = parts[1].split(".");
179229
- if (domainParts.some(function(part) {
179230
- return part.length > 63;
179231
- }))
179232
- return false;
179233
- return true;
179234
- };
179235
- }
179236
- });
179237
-
179238
179272
  // src/util/telemetry/commands/login/index.ts
179239
179273
  var LoginTelemetryClient;
179240
179274
  var init_login2 = __esm({
@@ -179242,12 +179276,72 @@ var init_login2 = __esm({
179242
179276
  "use strict";
179243
179277
  init_telemetry();
179244
179278
  LoginTelemetryClient = class extends TelemetryClient {
179279
+ /**
179280
+ * Tracks the state of the login process.
179281
+ * - `started` when the user initiates the login process.
179282
+ * - `canceled` when the user cancels the login process.
179283
+ * - `error` when the user encounters an error during the login process.
179284
+ * - `success` when the user successfully logs in.
179285
+ */
179286
+ trackState(...args2) {
179287
+ this.trackLoginState(...args2);
179288
+ }
179245
179289
  };
179246
179290
  }
179247
179291
  });
179248
179292
 
179249
- // src/commands/login/future.ts
179293
+ // src/commands/login/index.ts
179294
+ var login_exports = {};
179295
+ __export3(login_exports, {
179296
+ default: () => login2
179297
+ });
179250
179298
  async function login2(client2) {
179299
+ let parsedArgs = null;
179300
+ const flagsSpecification = getFlagsSpecification(loginCommand.options);
179301
+ const telemetry2 = new LoginTelemetryClient({
179302
+ opts: {
179303
+ store: client2.telemetryEventStore
179304
+ }
179305
+ });
179306
+ try {
179307
+ parsedArgs = parseArguments(client2.argv.slice(2), flagsSpecification);
179308
+ } catch (error4) {
179309
+ printError(error4);
179310
+ return 1;
179311
+ }
179312
+ if (parsedArgs.flags["--help"]) {
179313
+ telemetry2.trackCliFlagHelp("login");
179314
+ output_manager_default.print(help2(loginCommand, { columns: client2.stderr.columns }));
179315
+ return 0;
179316
+ }
179317
+ if (parsedArgs.flags["--token"]) {
179318
+ output_manager_default.error('`--token` may not be used with the "login" command');
179319
+ return 2;
179320
+ }
179321
+ const obsoleteFlags = Object.keys(parsedArgs.flags).filter((flag) => {
179322
+ const flagKey = flag.replace("--", "");
179323
+ const option = loginCommand.options.find((o) => o.name === flagKey);
179324
+ if (!option || typeof option === "number")
179325
+ return;
179326
+ return "deprecated" in option && option.deprecated;
179327
+ });
179328
+ if (obsoleteFlags.length) {
179329
+ const flags = obsoleteFlags.map((f) => import_chalk107.default.bold(f)).join(", ");
179330
+ output_manager_default.warn(`The following flags are deprecated: ${flags}`);
179331
+ }
179332
+ const obsoleteArguments = parsedArgs.args.slice(1);
179333
+ if (obsoleteArguments.length) {
179334
+ const args2 = obsoleteArguments.map((a) => import_chalk107.default.bold(a)).join(", ");
179335
+ output_manager_default.warn(`The following arguments are deprecated: ${args2}`);
179336
+ }
179337
+ if (obsoleteArguments.length || obsoleteFlags.length) {
179338
+ output_manager_default.print(
179339
+ // TODO: fix link
179340
+ `Read more in our ${output_manager_default.link("changelog", "https://vercel.com/changelog")}.
179341
+ `
179342
+ );
179343
+ }
179344
+ telemetry2.trackState("started");
179251
179345
  const deviceAuthorizationResponse = await deviceAuthorizationRequest();
179252
179346
  output_manager_default.debug(
179253
179347
  `'Device Authorization response:', ${await deviceAuthorizationResponse.clone().text()}`
@@ -179255,6 +179349,7 @@ async function login2(client2) {
179255
179349
  const [deviceAuthorizationError, deviceAuthorization] = await processDeviceAuthorizationResponse(deviceAuthorizationResponse);
179256
179350
  if (deviceAuthorizationError) {
179257
179351
  printError(deviceAuthorizationError);
179352
+ telemetry2.trackState("error");
179258
179353
  return 1;
179259
179354
  }
179260
179355
  const {
@@ -179265,6 +179360,7 @@ async function login2(client2) {
179265
179360
  expiresAt,
179266
179361
  interval
179267
179362
  } = deviceAuthorization;
179363
+ let rlClosed = false;
179268
179364
  const rl = import_node_readline.default.createInterface({
179269
179365
  input: process.stdin,
179270
179366
  output: process.stdout
@@ -179285,6 +179381,7 @@ async function login2(client2) {
179285
179381
  output_manager_default.print((0, import_ansi_escapes6.eraseLines)(2));
179286
179382
  output_manager_default.spinner("Waiting for authentication...");
179287
179383
  rl.close();
179384
+ rlClosed = true;
179288
179385
  }
179289
179386
  );
179290
179387
  output_manager_default.spinner("Waiting for authentication...");
@@ -179356,41 +179453,61 @@ async function login2(client2) {
179356
179453
  }
179357
179454
  error3 = await pollForToken();
179358
179455
  output_manager_default.stopSpinner();
179359
- rl.close();
179360
- if (!error3)
179456
+ if (!rlClosed) {
179457
+ rl.close();
179458
+ }
179459
+ if (!error3) {
179460
+ telemetry2.trackState("success");
179361
179461
  return 0;
179462
+ }
179463
+ telemetry2.trackState("error");
179362
179464
  printError(error3);
179363
179465
  return 1;
179364
179466
  }
179365
- var import_node_readline, import_chalk107, open6, import_ansi_escapes6;
179366
- var init_future = __esm({
179367
- "src/commands/login/future.ts"() {
179467
+ var import_chalk107, import_node_readline, open6, import_ansi_escapes6;
179468
+ var init_login3 = __esm({
179469
+ "src/commands/login/index.ts"() {
179368
179470
  "use strict";
179369
- import_node_readline = __toESM3(require("readline"));
179471
+ init_get_args();
179472
+ init_help();
179473
+ init_command20();
179474
+ init_get_flags_specification();
179475
+ init_error2();
179476
+ init_output_manager();
179477
+ init_login2();
179370
179478
  import_chalk107 = __toESM3(require_source());
179479
+ import_node_readline = __toESM3(require("readline"));
179371
179480
  open6 = __toESM3(require_open());
179372
179481
  import_ansi_escapes6 = __toESM3(require_ansi_escapes());
179373
- init_error2();
179374
179482
  init_update_current_team_after_login();
179375
179483
  init_global_path();
179376
179484
  init_pkg_name();
179377
179485
  init_emoji();
179378
179486
  init_humanize_path();
179379
- init_oauth2();
179380
- init_output_manager();
179487
+ init_oauth();
179381
179488
  }
179382
179489
  });
179383
179490
 
179384
- // src/commands/login/index.ts
179385
- var login_exports = {};
179386
- __export3(login_exports, {
179387
- default: () => login3
179491
+ // src/util/telemetry/commands/logout/index.ts
179492
+ var LogoutTelemetryClient;
179493
+ var init_logout = __esm({
179494
+ "src/util/telemetry/commands/logout/index.ts"() {
179495
+ "use strict";
179496
+ init_telemetry();
179497
+ LogoutTelemetryClient = class extends TelemetryClient {
179498
+ };
179499
+ }
179388
179500
  });
179389
- async function login3(client2) {
179390
- const isInitialLogin = !client2.authConfig.token;
179501
+
179502
+ // src/commands/logout/index.ts
179503
+ var logout_exports = {};
179504
+ __export3(logout_exports, {
179505
+ default: () => logout
179506
+ });
179507
+ async function logout(client2) {
179391
179508
  let parsedArgs = null;
179392
- const flagsSpecification = getFlagsSpecification(loginCommand.options);
179393
- const telemetry2 = new LoginTelemetryClient({
179509
+ const flagsSpecification = getFlagsSpecification(logoutCommand.options);
179510
+ const telemetry2 = new LogoutTelemetryClient({
179394
179511
  opts: {
179395
179512
  store: client2.telemetryEventStore
179396
179513
  }
@@ -179401,106 +179518,34 @@ async function login3(client2) {
179401
179518
  printError(error3);
179402
179519
  return 1;
179403
179520
  }
179404
- if (parsedArgs.flags["--future"]) {
179405
- telemetry2.trackCliFlagFuture("login");
179406
- return await login2(client2);
179407
- }
179408
179521
  if (parsedArgs.flags["--help"]) {
179409
- telemetry2.trackCliFlagHelp("login");
179410
- output_manager_default.print(help2(loginCommand, { columns: client2.stderr.columns }));
179411
- return 2;
179412
- }
179413
- if (parsedArgs.flags["--token"]) {
179414
- output_manager_default.error('`--token` may not be used with the "login" command');
179415
- return 2;
179416
- }
179417
- const input = parsedArgs.args[1];
179418
- let result = 1;
179419
- if (input) {
179420
- if ((0, import_email_validator.validate)(input)) {
179421
- result = await doEmailLogin(client2, input);
179422
- } else {
179423
- result = await doSamlLogin(client2, input, parsedArgs.flags["--oob"]);
179424
- }
179425
- } else if (parsedArgs.flags["--github"]) {
179426
- result = await doGithubLogin(client2, parsedArgs.flags["--oob"]);
179427
- } else if (parsedArgs.flags["--gitlab"]) {
179428
- result = await doGitlabLogin(client2, parsedArgs.flags["--oob"]);
179429
- } else if (parsedArgs.flags["--bitbucket"]) {
179430
- result = await doBitbucketLogin(client2, parsedArgs.flags["--oob"]);
179431
- } else {
179432
- result = await prompt(client2, void 0, parsedArgs.flags["--oob"]);
179433
- }
179434
- if (typeof result === "number") {
179435
- return result;
179522
+ telemetry2.trackCliFlagHelp("logout");
179523
+ output_manager_default.print(help2(logoutCommand, { columns: client2.stderr.columns }));
179524
+ return 0;
179436
179525
  }
179437
- client2.authConfig.token = result.token;
179438
- if (result.teamId) {
179439
- client2.config.currentTeam = result.teamId;
179440
- } else {
179441
- delete client2.config.currentTeam;
179526
+ const obsoleteFlags = Object.keys(parsedArgs.flags).filter((flag) => {
179527
+ const flagKey = flag.replace("--", "");
179528
+ const option = logoutCommand.options.find((o) => o.name === flagKey);
179529
+ if (!option || typeof option === "number")
179530
+ return;
179531
+ return "deprecated" in option && option.deprecated;
179532
+ });
179533
+ if (obsoleteFlags.length) {
179534
+ const flags = obsoleteFlags.map((f) => import_chalk108.default.bold(f)).join(", ");
179535
+ output_manager_default.warn(`The following flags are deprecated: ${flags}`);
179442
179536
  }
179443
- if (isInitialLogin) {
179444
- await updateCurrentTeamAfterLogin(client2, client2.config.currentTeam);
179537
+ const obsoleteArguments = parsedArgs.args.slice(1);
179538
+ if (obsoleteArguments.length) {
179539
+ const args2 = obsoleteArguments.map((a) => import_chalk108.default.bold(a)).join(", ");
179540
+ output_manager_default.warn(`The following arguments are deprecated: ${args2}`);
179445
179541
  }
179446
- writeToAuthConfigFile(client2.authConfig);
179447
- writeToConfigFile(client2.config);
179448
- output_manager_default.debug(`Saved credentials in "${humanizePath(global_path_default())}"`);
179449
- output_manager_default.print(
179450
- `${import_chalk108.default.cyan("Congratulations!")} You are now logged in. In order to deploy something, run ${getCommandName()}.
179451
- `
179452
- );
179453
- output_manager_default.print(
179454
- `${prependEmoji(
179455
- `Connect your Git Repositories to deploy every branch push automatically (https://vercel.link/git).`,
179456
- emoji("tip")
179457
- )}
179542
+ if (obsoleteArguments.length || obsoleteFlags.length) {
179543
+ output_manager_default.print(
179544
+ // TODO: fix link
179545
+ `Read more in our ${output_manager_default.link("changelog", "https://vercel.com/changelog")}.
179458
179546
  `
179459
- );
179460
- return 0;
179461
- }
179462
- var import_email_validator, import_chalk108;
179463
- var init_login3 = __esm({
179464
- "src/commands/login/index.ts"() {
179465
- "use strict";
179466
- import_email_validator = __toESM3(require_email_validator());
179467
- import_chalk108 = __toESM3(require_source());
179468
- init_humanize_path();
179469
- init_get_args();
179470
- init_prompt();
179471
- init_saml();
179472
- init_email();
179473
- init_github();
179474
- init_gitlab();
179475
- init_bitbucket();
179476
- init_emoji();
179477
- init_pkg_name();
179478
- init_global_path();
179479
- init_files();
179480
- init_help();
179481
- init_command20();
179482
- init_update_current_team_after_login();
179483
- init_get_flags_specification();
179484
- init_error2();
179485
- init_output_manager();
179486
- init_login2();
179487
- init_future();
179488
- }
179489
- });
179490
-
179491
- // src/util/telemetry/commands/logout/index.ts
179492
- var LogoutTelemetryClient;
179493
- var init_logout = __esm({
179494
- "src/util/telemetry/commands/logout/index.ts"() {
179495
- "use strict";
179496
- init_telemetry();
179497
- LogoutTelemetryClient = class extends TelemetryClient {
179498
- };
179547
+ );
179499
179548
  }
179500
- });
179501
-
179502
- // src/commands/logout/future.ts
179503
- async function logout(client2) {
179504
179549
  const { authConfig } = client2;
179505
179550
  if (!authConfig.token) {
179506
179551
  output_manager_default.note(
@@ -179512,7 +179557,9 @@ async function logout(client2) {
179512
179557
  const revocationResponse = await revocationRequest({
179513
179558
  token: authConfig.token
179514
179559
  });
179515
- output_manager_default.debug(`'Revocation response:', ${await revocationResponse.clone().text()}`);
179560
+ output_manager_default.debug(
179561
+ `'Revocation response:', ${await revocationResponse.clone().text()}`
179562
+ );
179516
179563
  const [revocationError] = await processRevocationResponse(revocationResponse);
179517
179564
  let logoutError = false;
179518
179565
  if (revocationError) {
@@ -179537,101 +179584,21 @@ async function logout(client2) {
179537
179584
  }
179538
179585
  return 1;
179539
179586
  }
179540
- var import_error_utils31;
179541
- var init_future2 = __esm({
179542
- "src/commands/logout/future.ts"() {
179543
- "use strict";
179544
- import_error_utils31 = __toESM3(require_dist2());
179545
- init_pkg_name();
179546
- init_oauth2();
179547
- init_output_manager();
179548
- }
179549
- });
179550
-
179551
- // src/commands/logout/index.ts
179552
- var logout_exports = {};
179553
- __export3(logout_exports, {
179554
- default: () => logout2
179555
- });
179556
- async function logout2(client2) {
179557
- const { authConfig, config: config2 } = client2;
179558
- let parsedArgs = null;
179559
- const flagsSpecification = getFlagsSpecification(logoutCommand.options);
179560
- const telemetry2 = new LogoutTelemetryClient({
179561
- opts: {
179562
- store: client2.telemetryEventStore
179563
- }
179564
- });
179565
- try {
179566
- parsedArgs = parseArguments(client2.argv.slice(2), flagsSpecification);
179567
- } catch (error3) {
179568
- printError(error3);
179569
- return 1;
179570
- }
179571
- if (parsedArgs.flags["--help"]) {
179572
- telemetry2.trackCliFlagHelp("logout");
179573
- output_manager_default.print(help2(logoutCommand, { columns: client2.stderr.columns }));
179574
- return 2;
179575
- }
179576
- if (authConfig.type === "oauth") {
179577
- return await logout(client2);
179578
- }
179579
- if (!authConfig.token) {
179580
- output_manager_default.note(
179581
- `Not currently logged in, so ${getCommandName("logout")} did nothing`
179582
- );
179583
- return 0;
179584
- }
179585
- output_manager_default.spinner("Logging out\u2026", 200);
179586
- let exitCode2 = 0;
179587
- try {
179588
- await client2.fetch("/v3/user/tokens/current", {
179589
- method: "DELETE",
179590
- useCurrentTeam: false
179591
- });
179592
- } catch (err) {
179593
- if (isAPIError(err)) {
179594
- if (err.status === 403) {
179595
- output_manager_default.debug("Token is invalid so it cannot be revoked");
179596
- } else if (err.status !== 200) {
179597
- output_manager_default.debug(err?.message ?? "");
179598
- exitCode2 = 1;
179599
- }
179600
- }
179601
- }
179602
- delete config2.currentTeam;
179603
- delete authConfig.token;
179604
- try {
179605
- writeToConfigFile(config2);
179606
- writeToAuthConfigFile(authConfig);
179607
- output_manager_default.debug("Configuration has been deleted");
179608
- } catch (err) {
179609
- output_manager_default.debug((0, import_error_utils32.errorToString)(err));
179610
- exitCode2 = 1;
179611
- }
179612
- if (exitCode2 === 0) {
179613
- output_manager_default.log("Logged out!");
179614
- } else {
179615
- output_manager_default.error("Failed during logout");
179616
- }
179617
- return exitCode2;
179618
- }
179619
- var import_error_utils32;
179587
+ var import_chalk108, import_error_utils31;
179620
179588
  var init_logout2 = __esm({
179621
179589
  "src/commands/logout/index.ts"() {
179622
179590
  "use strict";
179623
179591
  init_error2();
179624
- init_files();
179625
179592
  init_get_args();
179626
- init_pkg_name();
179627
- init_errors_ts();
179628
- import_error_utils32 = __toESM3(require_dist2());
179629
179593
  init_help();
179630
179594
  init_command21();
179631
179595
  init_get_flags_specification();
179632
179596
  init_output_manager();
179633
179597
  init_logout();
179634
- init_future2();
179598
+ import_chalk108 = __toESM3(require_source());
179599
+ import_error_utils31 = __toESM3(require_dist2());
179600
+ init_pkg_name();
179601
+ init_oauth();
179635
179602
  }
179636
179603
  });
179637
179604
 
@@ -180456,13 +180423,13 @@ async function main15(client2) {
180456
180423
  if (!subcommand && needHelp) {
180457
180424
  telemetry2.trackCliFlagHelp("project");
180458
180425
  output_manager_default.print(help2(projectCommand, { columns: client2.stderr.columns }));
180459
- return 2;
180426
+ return 0;
180460
180427
  }
180461
180428
  function printHelp(command) {
180462
180429
  output_manager_default.print(
180463
180430
  help2(command, { parent: projectCommand, columns: client2.stderr.columns })
180464
180431
  );
180465
- return 2;
180432
+ return 0;
180466
180433
  }
180467
180434
  if (!parsedArgs.args[1]) {
180468
180435
  subcommand = "list";
@@ -180966,7 +180933,7 @@ var promote_exports = {};
180966
180933
  __export3(promote_exports, {
180967
180934
  default: () => promote_default
180968
180935
  });
180969
- var import_ms27, import_error_utils33, promote_default;
180936
+ var import_ms27, import_error_utils32, promote_default;
180970
180937
  var init_promote2 = __esm({
180971
180938
  "src/commands/promote/index.ts"() {
180972
180939
  "use strict";
@@ -180974,7 +180941,7 @@ var init_promote2 = __esm({
180974
180941
  init_get_args();
180975
180942
  init_get_project_by_cwd_or_link();
180976
180943
  init_error2();
180977
- import_error_utils33 = __toESM3(require_dist2());
180944
+ import_error_utils32 = __toESM3(require_dist2());
180978
180945
  init_request_promote();
180979
180946
  init_status2();
180980
180947
  init_command26();
@@ -181044,7 +181011,7 @@ var init_promote2 = __esm({
181044
181011
  yes
181045
181012
  });
181046
181013
  } catch (err) {
181047
- if ((0, import_error_utils33.isErrnoException)(err)) {
181014
+ if ((0, import_error_utils32.isErrnoException)(err)) {
181048
181015
  if (err.code === "ERR_CANCELED") {
181049
181016
  return 0;
181050
181017
  }
@@ -181345,7 +181312,7 @@ async function redeploy(client2) {
181345
181312
  return printDeploymentStatus(deployment, deployStamp, noWait);
181346
181313
  } catch (err) {
181347
181314
  output_manager_default.prettyError(err);
181348
- if ((0, import_error_utils34.isErrnoException)(err) && err.code === "ERR_INVALID_TEAM") {
181315
+ if ((0, import_error_utils33.isErrnoException)(err) && err.code === "ERR_INVALID_TEAM") {
181349
181316
  output_manager_default.error(
181350
181317
  `Use ${import_chalk119.default.bold("vc switch")} to change your current team`
181351
181318
  );
@@ -181353,7 +181320,7 @@ async function redeploy(client2) {
181353
181320
  return 1;
181354
181321
  }
181355
181322
  }
181356
- var import_chalk119, import_client13, import_error_utils34;
181323
+ var import_chalk119, import_client13, import_error_utils33;
181357
181324
  var init_redeploy2 = __esm({
181358
181325
  "src/commands/redeploy/index.ts"() {
181359
181326
  "use strict";
@@ -181365,7 +181332,7 @@ var init_redeploy2 = __esm({
181365
181332
  init_get_deployment_by_id_or_url();
181366
181333
  init_get_scope();
181367
181334
  init_error2();
181368
- import_error_utils34 = __toESM3(require_dist2());
181335
+ import_error_utils33 = __toESM3(require_dist2());
181369
181336
  init_util();
181370
181337
  init_print_deployment_status();
181371
181338
  init_stamp();
@@ -182019,14 +181986,14 @@ var rollback_exports = {};
182019
181986
  __export3(rollback_exports, {
182020
181987
  default: () => rollback_default
182021
181988
  });
182022
- var import_error_utils35, import_ms31, rollback_default;
181989
+ var import_error_utils34, import_ms31, rollback_default;
182023
181990
  var init_rollback2 = __esm({
182024
181991
  "src/commands/rollback/index.ts"() {
182025
181992
  "use strict";
182026
181993
  init_get_args();
182027
181994
  init_get_project_by_cwd_or_link();
182028
181995
  init_error2();
182029
- import_error_utils35 = __toESM3(require_dist2());
181996
+ import_error_utils34 = __toESM3(require_dist2());
182030
181997
  import_ms31 = __toESM3(require_ms());
182031
181998
  init_request_rollback();
182032
181999
  init_status3();
@@ -182094,7 +182061,7 @@ var init_rollback2 = __esm({
182094
182061
  timeout
182095
182062
  });
182096
182063
  } catch (err) {
182097
- if ((0, import_error_utils35.isErrnoException)(err)) {
182064
+ if ((0, import_error_utils34.isErrnoException)(err)) {
182098
182065
  if (err.code === "ERR_CANCELED") {
182099
182066
  return 0;
182100
182067
  }
@@ -183102,10 +183069,10 @@ Please select a team scope using ${getCommandName(
183102
183069
  try {
183103
183070
  email2 = await client2.input.text({
183104
183071
  message: `- ${inviteUserPrefix}`,
183105
- validate: validateEmail2
183072
+ validate: validateEmail
183106
183073
  });
183107
183074
  } catch (err) {
183108
- if (!(0, import_error_utils36.isError)(err) || err.message !== "USER_ABORT") {
183075
+ if (!(0, import_error_utils35.isError)(err) || err.message !== "USER_ABORT") {
183109
183076
  throw err;
183110
183077
  }
183111
183078
  }
@@ -183135,7 +183102,7 @@ Please select a team scope using ${getCommandName(
183135
183102
  } catch (err) {
183136
183103
  output_manager_default.stopSpinner();
183137
183104
  process.stderr.write(eraseLines(emails.length + 2));
183138
- output_manager_default.error((0, import_error_utils36.errorToString)(err));
183105
+ output_manager_default.error((0, import_error_utils35.errorToString)(err));
183139
183106
  hasError = true;
183140
183107
  for (const email3 of emails) {
183141
183108
  output_manager_default.log(`${import_chalk125.default.cyan(chars_default.tick)} ${sentEmailPrefix}${email3}`);
@@ -183156,7 +183123,7 @@ Please select a team scope using ${getCommandName(
183156
183123
  }
183157
183124
  return 0;
183158
183125
  }
183159
- var import_chalk125, import_error_utils36, validateEmail2, domains;
183126
+ var import_chalk125, import_error_utils35, validateEmail, domains;
183160
183127
  var init_invite2 = __esm({
183161
183128
  "src/commands/teams/invite.ts"() {
183162
183129
  "use strict";
@@ -183172,14 +183139,14 @@ var init_invite2 = __esm({
183172
183139
  init_get_teams();
183173
183140
  init_invite_user_to_team();
183174
183141
  init_errors_ts();
183175
- import_error_utils36 = __toESM3(require_dist2());
183142
+ import_error_utils35 = __toESM3(require_dist2());
183176
183143
  init_invite();
183177
183144
  init_output_manager();
183178
183145
  init_get_args();
183179
183146
  init_get_flags_specification();
183180
183147
  init_error2();
183181
183148
  init_command33();
183182
- validateEmail2 = (data) => email.test(data.trim()) || data.length === 0;
183149
+ validateEmail = (data) => email.test(data.trim()) || data.length === 0;
183183
183150
  domains = Array.from(
183184
183151
  /* @__PURE__ */ new Set([
183185
183152
  "aol.com",
@@ -183248,7 +183215,7 @@ async function add7(client2) {
183248
183215
  default: slug
183249
183216
  });
183250
183217
  } catch (err) {
183251
- if ((0, import_error_utils37.isError)(err) && err.message === "USER_ABORT") {
183218
+ if ((0, import_error_utils36.isError)(err) && err.message === "USER_ABORT") {
183252
183219
  output_manager_default.log("Canceled");
183253
183220
  return 0;
183254
183221
  }
@@ -183261,7 +183228,7 @@ async function add7(client2) {
183261
183228
  } catch (err) {
183262
183229
  output_manager_default.stopSpinner();
183263
183230
  output_manager_default.print(eraseLines(2));
183264
- output_manager_default.error((0, import_error_utils37.errorToString)(err));
183231
+ output_manager_default.error((0, import_error_utils36.errorToString)(err));
183265
183232
  }
183266
183233
  } while (!team);
183267
183234
  output_manager_default.stopSpinner();
@@ -183277,7 +183244,7 @@ async function add7(client2) {
183277
183244
  validate: validateName
183278
183245
  });
183279
183246
  } catch (err) {
183280
- if ((0, import_error_utils37.isError)(err) && err.message === "USER_ABORT") {
183247
+ if ((0, import_error_utils36.isError)(err) && err.message === "USER_ABORT") {
183281
183248
  output_manager_default.log("No name specified");
183282
183249
  return 2;
183283
183250
  }
@@ -183304,7 +183271,7 @@ async function add7(client2) {
183304
183271
  });
183305
183272
  return 0;
183306
183273
  }
183307
- var import_chalk126, import_error_utils37, validateSlug, validateName, teamUrlPrefix, teamNamePrefix;
183274
+ var import_chalk126, import_error_utils36, validateSlug, validateName, teamUrlPrefix, teamNamePrefix;
183308
183275
  var init_add13 = __esm({
183309
183276
  "src/commands/teams/add.ts"() {
183310
183277
  "use strict";
@@ -183317,7 +183284,7 @@ var init_add13 = __esm({
183317
183284
  init_pkg_name();
183318
183285
  init_create_team();
183319
183286
  init_patch_team();
183320
- import_error_utils37 = __toESM3(require_dist2());
183287
+ import_error_utils36 = __toESM3(require_dist2());
183321
183288
  init_output_manager();
183322
183289
  validateSlug = (value) => /^[a-z]+[a-z0-9_-]*$/.test(value);
183323
183290
  validateName = (value) => /^[ a-zA-Z0-9_-]+$/.test(value);
@@ -183920,7 +183887,7 @@ async function whoami(client2) {
183920
183887
  if (parsedArgs.flags["--help"]) {
183921
183888
  telemetry2.trackCliFlagHelp("whoami");
183922
183889
  output_manager_default.print(help2(whoamiCommand, { columns: client2.stderr.columns }));
183923
- return 2;
183890
+ return 0;
183924
183891
  }
183925
183892
  const { contextName } = await getScope(client2, { getTeam: false });
183926
183893
  if (client2.stdout.isTTY) {
@@ -183946,7 +183913,7 @@ var init_whoami2 = __esm({
183946
183913
  });
183947
183914
 
183948
183915
  // src/index.ts
183949
- var import_error_utils38 = __toESM3(require_dist2());
183916
+ var import_error_utils37 = __toESM3(require_dist2());
183950
183917
  var import_path40 = require("path");
183951
183918
  var import_fs8 = require("fs");
183952
183919
  var import_fs_extra24 = __toESM3(require_lib());
@@ -184805,7 +184772,7 @@ var import_detect_agent = __toESM3(require_dist20());
184805
184772
  try {
184806
184773
  process.cwd();
184807
184774
  } catch (err) {
184808
- if ((0, import_error_utils38.isError)(err) && err.message.includes("uv_cwd")) {
184775
+ if ((0, import_error_utils37.isError)(err) && err.message.includes("uv_cwd")) {
184809
184776
  console.error("Error: The current working directory does not exist.");
184810
184777
  process.exit(1);
184811
184778
  }
@@ -184906,7 +184873,7 @@ var main17 = async () => {
184906
184873
  const bareHelpSubcommand = targetOrSubcommand === "help" && !subSubCommand;
184907
184874
  if (bareHelpOption || bareHelpSubcommand) {
184908
184875
  output_manager_default.print(help());
184909
- return 2;
184876
+ return 0;
184910
184877
  }
184911
184878
  try {
184912
184879
  await (0, import_fs_extra24.mkdirp)(VERCEL_DIR4);
@@ -184914,7 +184881,7 @@ var main17 = async () => {
184914
184881
  output_manager_default.error(
184915
184882
  `An unexpected error occurred while trying to create the global directory "${humanizePath(
184916
184883
  VERCEL_DIR4
184917
- )}" ${(0, import_error_utils38.errorToString)(err)}`
184884
+ )}" ${(0, import_error_utils37.errorToString)(err)}`
184918
184885
  );
184919
184886
  return 1;
184920
184887
  }
@@ -184922,7 +184889,7 @@ var main17 = async () => {
184922
184889
  try {
184923
184890
  config2 = readConfigFile();
184924
184891
  } catch (err) {
184925
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT") {
184892
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ENOENT") {
184926
184893
  config2 = defaultGlobalConfig;
184927
184894
  try {
184928
184895
  writeToConfigFile(config2);
@@ -184930,7 +184897,7 @@ var main17 = async () => {
184930
184897
  output_manager_default.error(
184931
184898
  `An unexpected error occurred while trying to save the config to "${humanizePath(
184932
184899
  VERCEL_CONFIG_PATH
184933
- )}" ${(0, import_error_utils38.errorToString)(err2)}`
184900
+ )}" ${(0, import_error_utils37.errorToString)(err2)}`
184934
184901
  );
184935
184902
  return 1;
184936
184903
  }
@@ -184938,7 +184905,7 @@ var main17 = async () => {
184938
184905
  output_manager_default.error(
184939
184906
  `An unexpected error occurred while trying to read the config in "${humanizePath(
184940
184907
  VERCEL_CONFIG_PATH
184941
- )}" ${(0, import_error_utils38.errorToString)(err)}`
184908
+ )}" ${(0, import_error_utils37.errorToString)(err)}`
184942
184909
  );
184943
184910
  return 1;
184944
184911
  }
@@ -184947,7 +184914,7 @@ var main17 = async () => {
184947
184914
  try {
184948
184915
  authConfig = readAuthConfigFile();
184949
184916
  } catch (err) {
184950
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT") {
184917
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ENOENT") {
184951
184918
  authConfig = defaultAuthConfig;
184952
184919
  try {
184953
184920
  writeToAuthConfigFile(authConfig);
@@ -184955,7 +184922,7 @@ var main17 = async () => {
184955
184922
  output_manager_default.error(
184956
184923
  `An unexpected error occurred while trying to write the auth config to "${humanizePath(
184957
184924
  VERCEL_AUTH_CONFIG_PATH
184958
- )}" ${(0, import_error_utils38.errorToString)(err2)}`
184925
+ )}" ${(0, import_error_utils37.errorToString)(err2)}`
184959
184926
  );
184960
184927
  return 1;
184961
184928
  }
@@ -184963,7 +184930,7 @@ var main17 = async () => {
184963
184930
  output_manager_default.error(
184964
184931
  `An unexpected error occurred while trying to read the auth config in "${humanizePath(
184965
184932
  VERCEL_AUTH_CONFIG_PATH
184966
- )}" ${(0, import_error_utils38.errorToString)(err)}`
184933
+ )}" ${(0, import_error_utils37.errorToString)(err)}`
184967
184934
  );
184968
184935
  return 1;
184969
184936
  }
@@ -185147,7 +185114,7 @@ var main17 = async () => {
185147
185114
  if (err instanceof Error) {
185148
185115
  output_manager_default.debug(err.stack || err.toString());
185149
185116
  }
185150
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "NOT_AUTHORIZED") {
185117
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "NOT_AUTHORIZED") {
185151
185118
  output_manager_default.prettyError({
185152
185119
  message: `You do not have access to the specified account`,
185153
185120
  link: "https://err.sh/vercel/scope-not-accessible"
@@ -185155,7 +185122,7 @@ var main17 = async () => {
185155
185122
  return 1;
185156
185123
  }
185157
185124
  output_manager_default.error(
185158
- `Not able to load user because of unexpected error: ${(0, import_error_utils38.errorToString)(err)}`
185125
+ `Not able to load user because of unexpected error: ${(0, import_error_utils37.errorToString)(err)}`
185159
185126
  );
185160
185127
  return 1;
185161
185128
  }
@@ -185170,14 +185137,14 @@ var main17 = async () => {
185170
185137
  try {
185171
185138
  teams2 = await getTeams(client);
185172
185139
  } catch (err) {
185173
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "not_authorized") {
185140
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "not_authorized") {
185174
185141
  output_manager_default.prettyError({
185175
185142
  message: `You do not have access to the specified team`,
185176
185143
  link: "https://err.sh/vercel/scope-not-accessible"
185177
185144
  });
185178
185145
  return 1;
185179
185146
  }
185180
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "rate_limited") {
185147
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "rate_limited") {
185181
185148
  output_manager_default.prettyError({
185182
185149
  message: "Rate limited. Too many requests to the same endpoint: /teams"
185183
185150
  });
@@ -185210,7 +185177,7 @@ var main17 = async () => {
185210
185177
  );
185211
185178
  telemetry2.trackCliExtension();
185212
185179
  } catch (err) {
185213
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT") {
185180
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ENOENT") {
185214
185181
  targetCommand2 = subcommand = "deploy";
185215
185182
  } else {
185216
185183
  throw err;
@@ -185386,7 +185353,7 @@ var main17 = async () => {
185386
185353
  exitCode2 = await func(client);
185387
185354
  }
185388
185355
  } catch (err) {
185389
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOTFOUND") {
185356
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ENOTFOUND") {
185390
185357
  const matches = /getaddrinfo ENOTFOUND (.*)$/.exec(err.message || "");
185391
185358
  if (matches && matches[1]) {
185392
185359
  const hostname3 = matches[1];
@@ -185401,7 +185368,7 @@ var main17 = async () => {
185401
185368
  }
185402
185369
  return 1;
185403
185370
  }
185404
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ECONNRESET") {
185371
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ECONNRESET") {
185405
185372
  const matches = /request to https:\/\/(.*?)\//.exec(err.message || "");
185406
185373
  const hostname3 = matches?.[1];
185407
185374
  if (hostname3) {
@@ -185413,7 +185380,7 @@ var main17 = async () => {
185413
185380
  }
185414
185381
  return 1;
185415
185382
  }
185416
- if ((0, import_error_utils38.isErrnoException)(err) && (err.code === "NOT_AUTHORIZED" || err.code === "TEAM_DELETED")) {
185383
+ if ((0, import_error_utils37.isErrnoException)(err) && (err.code === "NOT_AUTHORIZED" || err.code === "TEAM_DELETED")) {
185417
185384
  output_manager_default.prettyError(err);
185418
185385
  return 1;
185419
185386
  }
@@ -185422,7 +185389,7 @@ var main17 = async () => {
185422
185389
  output_manager_default.prettyError(err);
185423
185390
  return 1;
185424
185391
  }
185425
- if ((0, import_error_utils38.isErrnoException)(err)) {
185392
+ if ((0, import_error_utils37.isErrnoException)(err)) {
185426
185393
  if (typeof err.stack === "string") {
185427
185394
  output_manager_default.debug(err.stack);
185428
185395
  }