vercel 46.0.0 → 46.0.2

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 +372 -273
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -41527,6 +41527,261 @@ var init_print_indications = __esm({
41527
41527
  }
41528
41528
  });
41529
41529
 
41530
+ // src/util/oauth.ts
41531
+ async function as() {
41532
+ if (!_as) {
41533
+ const discoveryResponse = await discoveryEndpointRequest(VERCEL_ISSUER);
41534
+ const [discoveryResponseError, as2] = await processDiscoveryEndpointResponse(discoveryResponse);
41535
+ if (discoveryResponseError) {
41536
+ throw discoveryResponseError;
41537
+ }
41538
+ _as = as2;
41539
+ }
41540
+ return _as;
41541
+ }
41542
+ async function discoveryEndpointRequest(issuer) {
41543
+ return await (0, import_node_fetch.default)(new URL(".well-known/openid-configuration", issuer), {
41544
+ headers: { "Content-Type": "application/json", "user-agent": userAgent }
41545
+ });
41546
+ }
41547
+ async function processDiscoveryEndpointResponse(response) {
41548
+ const json = await response.json();
41549
+ if (!response.ok) {
41550
+ return [new Error("Discovery endpoint request failed")];
41551
+ }
41552
+ 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)) {
41553
+ return [new TypeError("Invalid discovery response")];
41554
+ }
41555
+ const issuer = new URL(json.issuer);
41556
+ if (issuer.href !== VERCEL_ISSUER.href) {
41557
+ return [new Error("Issuer mismatch")];
41558
+ }
41559
+ return [
41560
+ null,
41561
+ {
41562
+ issuer,
41563
+ device_authorization_endpoint: new URL(
41564
+ json.device_authorization_endpoint
41565
+ ),
41566
+ token_endpoint: new URL(json.token_endpoint),
41567
+ revocation_endpoint: new URL(json.revocation_endpoint),
41568
+ jwks_uri: new URL(json.jwks_uri),
41569
+ introspection_endpoint: new URL(json.introspection_endpoint)
41570
+ }
41571
+ ];
41572
+ }
41573
+ async function deviceAuthorizationRequest() {
41574
+ return await (0, import_node_fetch.default)((await as()).device_authorization_endpoint, {
41575
+ method: "POST",
41576
+ headers: {
41577
+ "Content-Type": "application/x-www-form-urlencoded",
41578
+ "user-agent": userAgent
41579
+ },
41580
+ body: new URLSearchParams({
41581
+ client_id: VERCEL_CLI_CLIENT_ID,
41582
+ scope: "openid offline_access"
41583
+ })
41584
+ });
41585
+ }
41586
+ async function processDeviceAuthorizationResponse(response) {
41587
+ const json = await response.json();
41588
+ if (!response.ok) {
41589
+ return [new OAuthError("Device authorization request failed", json)];
41590
+ }
41591
+ if (typeof json !== "object" || json === null)
41592
+ return [new TypeError("Expected response to be an object")];
41593
+ if (!("device_code" in json) || typeof json.device_code !== "string")
41594
+ return [new TypeError("Expected `device_code` to be a string")];
41595
+ if (!("user_code" in json) || typeof json.user_code !== "string")
41596
+ return [new TypeError("Expected `user_code` to be a string")];
41597
+ if (!("verification_uri" in json) || typeof json.verification_uri !== "string" || !canParseURL(json.verification_uri)) {
41598
+ return [new TypeError("Expected `verification_uri` to be a string")];
41599
+ }
41600
+ if (!("verification_uri_complete" in json) || typeof json.verification_uri_complete !== "string" || !canParseURL(json.verification_uri_complete)) {
41601
+ return [
41602
+ new TypeError("Expected `verification_uri_complete` to be a string")
41603
+ ];
41604
+ }
41605
+ if (!("expires_in" in json) || typeof json.expires_in !== "number")
41606
+ return [new TypeError("Expected `expires_in` to be a number")];
41607
+ if (!("interval" in json) || typeof json.interval !== "number")
41608
+ return [new TypeError("Expected `interval` to be a number")];
41609
+ return [
41610
+ null,
41611
+ {
41612
+ device_code: json.device_code,
41613
+ user_code: json.user_code,
41614
+ verification_uri: json.verification_uri,
41615
+ verification_uri_complete: json.verification_uri_complete,
41616
+ expiresAt: Date.now() + json.expires_in * 1e3,
41617
+ interval: json.interval
41618
+ }
41619
+ ];
41620
+ }
41621
+ async function deviceAccessTokenRequest(options) {
41622
+ try {
41623
+ return [
41624
+ null,
41625
+ await (0, import_node_fetch.default)((await as()).token_endpoint, {
41626
+ method: "POST",
41627
+ headers: {
41628
+ "Content-Type": "application/x-www-form-urlencoded",
41629
+ "user-agent": userAgent
41630
+ },
41631
+ body: new URLSearchParams({
41632
+ client_id: VERCEL_CLI_CLIENT_ID,
41633
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
41634
+ ...options
41635
+ }),
41636
+ // TODO: Drop `node-fetch` and just use `signal`
41637
+ timeout: 10 * 1e3,
41638
+ // @ts-expect-error: Signal is part of `fetch` spec, should drop `node-fetch`
41639
+ signal: AbortSignal.timeout(10 * 1e3)
41640
+ })
41641
+ ];
41642
+ } catch (error3) {
41643
+ if (error3 instanceof Error)
41644
+ return [error3];
41645
+ return [
41646
+ new Error("An unknown error occurred. See the logs for details.", {
41647
+ cause: error3
41648
+ })
41649
+ ];
41650
+ }
41651
+ }
41652
+ async function processTokenResponse(response) {
41653
+ const json = await response.json();
41654
+ if (!response.ok) {
41655
+ return [new OAuthError("Device access token request failed", json)];
41656
+ }
41657
+ if (typeof json !== "object" || json === null)
41658
+ return [new TypeError("Expected response to be an object")];
41659
+ if (!("access_token" in json) || typeof json.access_token !== "string")
41660
+ return [new TypeError("Expected `access_token` to be a string")];
41661
+ if (!("token_type" in json) || json.token_type !== "Bearer")
41662
+ return [new TypeError('Expected `token_type` to be "Bearer"')];
41663
+ if (!("expires_in" in json) || typeof json.expires_in !== "number")
41664
+ return [new TypeError("Expected `expires_in` to be a number")];
41665
+ if ("refresh_token" in json && (typeof json.refresh_token !== "string" || !json.refresh_token))
41666
+ return [new TypeError("Expected `refresh_token` to be a string")];
41667
+ if ("scope" in json && typeof json.scope !== "string")
41668
+ return [new TypeError("Expected `scope` to be a string")];
41669
+ return [null, json];
41670
+ }
41671
+ async function revocationRequest(options) {
41672
+ return await (0, import_node_fetch.default)((await as()).revocation_endpoint, {
41673
+ method: "POST",
41674
+ headers: {
41675
+ "Content-Type": "application/x-www-form-urlencoded",
41676
+ "user-agent": userAgent
41677
+ },
41678
+ body: new URLSearchParams({ ...options, client_id: VERCEL_CLI_CLIENT_ID })
41679
+ });
41680
+ }
41681
+ async function processRevocationResponse(response) {
41682
+ if (response.ok)
41683
+ return [null, null];
41684
+ const json = await response.json();
41685
+ return [new OAuthError("Revocation request failed", json)];
41686
+ }
41687
+ async function refreshTokenRequest(options) {
41688
+ return await (0, import_node_fetch.default)((await as()).token_endpoint, {
41689
+ method: "POST",
41690
+ headers: {
41691
+ "Content-Type": "application/x-www-form-urlencoded",
41692
+ "user-agent": ua_default
41693
+ },
41694
+ body: new URLSearchParams({
41695
+ client_id: VERCEL_CLI_CLIENT_ID,
41696
+ grant_type: "refresh_token",
41697
+ ...options
41698
+ })
41699
+ });
41700
+ }
41701
+ function processOAuthErrorResponse(json) {
41702
+ if (typeof json !== "object" || json === null)
41703
+ return new TypeError("Expected response to be an object");
41704
+ if (!("error" in json) || typeof json.error !== "string")
41705
+ return new TypeError("Expected `error` to be a string");
41706
+ if ("error_description" in json && typeof json.error_description !== "string")
41707
+ return new TypeError("Expected `error_description` to be a string");
41708
+ if ("error_uri" in json && typeof json.error_uri !== "string")
41709
+ return new TypeError("Expected `error_uri` to be a string");
41710
+ return json;
41711
+ }
41712
+ function isOAuthError(error3) {
41713
+ return error3 instanceof OAuthError;
41714
+ }
41715
+ function canParseURL(url3) {
41716
+ try {
41717
+ return !!new URL(url3);
41718
+ } catch {
41719
+ return false;
41720
+ }
41721
+ }
41722
+ async function inspectTokenRequest(token) {
41723
+ return (0, import_node_fetch.default)((await as()).introspection_endpoint, {
41724
+ method: "POST",
41725
+ headers: {
41726
+ "Content-Type": "application/x-www-form-urlencoded",
41727
+ "user-agent": ua_default
41728
+ },
41729
+ body: new URLSearchParams({ token })
41730
+ });
41731
+ }
41732
+ async function processInspectTokenResponse(response) {
41733
+ try {
41734
+ const token = await response.json();
41735
+ if (!token || typeof token !== "object" || !("active" in token)) {
41736
+ throw new IntrospectionError("Invalid token introspection response");
41737
+ }
41738
+ return [null, token];
41739
+ } catch (cause) {
41740
+ return [new IntrospectionError("Could not introspect token.", { cause })];
41741
+ }
41742
+ }
41743
+ var import_node_fetch, import_os3, VERCEL_ISSUER, VERCEL_CLI_CLIENT_ID, userAgent, _as, OAuthError, IntrospectionError;
41744
+ var init_oauth = __esm({
41745
+ "src/util/oauth.ts"() {
41746
+ "use strict";
41747
+ import_node_fetch = __toESM3(require_lib7());
41748
+ init_ua();
41749
+ import_os3 = require("os");
41750
+ VERCEL_ISSUER = new URL("https://vercel.com");
41751
+ VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
41752
+ userAgent = `${(0, import_os3.hostname)()} @ ${ua_default}`;
41753
+ OAuthError = class extends Error {
41754
+ constructor(message2, response) {
41755
+ var __super = (...args) => {
41756
+ super(...args);
41757
+ };
41758
+ const error3 = processOAuthErrorResponse(response);
41759
+ if (error3 instanceof TypeError) {
41760
+ const message3 = `Unexpected server response: ${JSON.stringify(response)}`;
41761
+ __super(message3);
41762
+ this.cause = new Error(message3, { cause: error3 });
41763
+ this.code = "server_error";
41764
+ return;
41765
+ }
41766
+ let cause = error3.error;
41767
+ if (error3.error_description)
41768
+ cause += `: ${error3.error_description}`;
41769
+ if (error3.error_uri)
41770
+ cause += ` (${error3.error_uri})`;
41771
+ __super(message2, { cause });
41772
+ this.cause = new Error(cause);
41773
+ this.code = error3.error;
41774
+ }
41775
+ };
41776
+ IntrospectionError = class extends Error {
41777
+ constructor() {
41778
+ super(...arguments);
41779
+ this.name = "IntrospectionError";
41780
+ }
41781
+ };
41782
+ }
41783
+ });
41784
+
41530
41785
  // ../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js
41531
41786
  var require_is_docker = __commonJS2({
41532
41787
  "../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports2, module2) {
@@ -42185,7 +42440,7 @@ function verify(client2, verificationToken, email2, provider, ssoUserId) {
42185
42440
  }
42186
42441
  if (!client2.authConfig.token) {
42187
42442
  const hyphens = new RegExp("-", "g");
42188
- const host = (0, import_os3.hostname)().replace(hyphens, " ").replace(".local", "");
42443
+ const host = (0, import_os4.hostname)().replace(hyphens, " ").replace(".local", "");
42189
42444
  const tokenName = `${getTitleName()} CLI on ${host} via ${provider}`;
42190
42445
  url3.searchParams.set("tokenName", tokenName);
42191
42446
  }
@@ -42194,12 +42449,12 @@ function verify(client2, verificationToken, email2, provider, ssoUserId) {
42194
42449
  }
42195
42450
  return client2.fetch(url3.href, { useCurrentTeam: false });
42196
42451
  }
42197
- var import_url2, import_os3;
42452
+ var import_url2, import_os4;
42198
42453
  var init_verify = __esm({
42199
42454
  "src/util/login/verify.ts"() {
42200
42455
  "use strict";
42201
42456
  import_url2 = require("url");
42202
- import_os3 = require("os");
42457
+ import_os4 = require("os");
42203
42458
  init_pkg_name();
42204
42459
  }
42205
42460
  });
@@ -42310,7 +42565,7 @@ var init_github = __esm({
42310
42565
  "src/util/login/github.ts"() {
42311
42566
  "use strict";
42312
42567
  import_url3 = require("url");
42313
- init_oauth();
42568
+ init_oauth2();
42314
42569
  }
42315
42570
  });
42316
42571
 
@@ -42324,7 +42579,7 @@ var init_google = __esm({
42324
42579
  "src/util/login/google.ts"() {
42325
42580
  "use strict";
42326
42581
  import_url4 = require("url");
42327
- init_oauth();
42582
+ init_oauth2();
42328
42583
  }
42329
42584
  });
42330
42585
 
@@ -42338,7 +42593,7 @@ var init_gitlab = __esm({
42338
42593
  "src/util/login/gitlab.ts"() {
42339
42594
  "use strict";
42340
42595
  import_url5 = require("url");
42341
- init_oauth();
42596
+ init_oauth2();
42342
42597
  }
42343
42598
  });
42344
42599
 
@@ -42357,7 +42612,7 @@ var init_bitbucket = __esm({
42357
42612
  "src/util/login/bitbucket.ts"() {
42358
42613
  "use strict";
42359
42614
  import_url6 = require("url");
42360
- init_oauth();
42615
+ init_oauth2();
42361
42616
  }
42362
42617
  });
42363
42618
 
@@ -42391,7 +42646,7 @@ async function prompt(client2, error3, outOfBand, ssoUserId) {
42391
42646
  const email2 = await readInput(client2, "Enter your email address:");
42392
42647
  result = await doEmailLogin(client2, email2, ssoUserId);
42393
42648
  } else if (choice === "saml") {
42394
- const slug = error3?.teamId || await readInput(client2, "Enter your Team slug:");
42649
+ const slug = error3?.scope || error3?.teamId || await readInput(client2, "Enter your Team slug:");
42395
42650
  result = await doSamlLogin(client2, slug, outOfBand, ssoUserId);
42396
42651
  }
42397
42652
  return result;
@@ -42558,7 +42813,7 @@ function isSSH() {
42558
42813
  return Boolean(process.env.SSH_CLIENT || process.env.SSH_TTY);
42559
42814
  }
42560
42815
  var import_http, import_open, import_url7, import_async_listen, import_is_docker;
42561
- var init_oauth = __esm({
42816
+ var init_oauth2 = __esm({
42562
42817
  "src/util/login/oauth.ts"() {
42563
42818
  "use strict";
42564
42819
  import_http = __toESM3(require("http"));
@@ -42576,17 +42831,53 @@ var init_oauth = __esm({
42576
42831
  });
42577
42832
 
42578
42833
  // src/util/login/saml.ts
42579
- function doSamlLogin(client2, teamIdOrSlug, outOfBand, ssoUserId) {
42834
+ async function doSamlLogin(client2, teamIdOrSlug, outOfBand, ssoUserId) {
42835
+ if (client2.authConfig.type === "oauth") {
42836
+ const { session_id, client_id } = await decodeToken(client2);
42837
+ const params2 = { session_id, client_id };
42838
+ const url4 = new import_url8.URL(
42839
+ `https://vercel.com/sso/${teamIdOrSlug}?${new URLSearchParams(params2).toString()}`
42840
+ );
42841
+ return doOauthLogin(
42842
+ client2,
42843
+ url4,
42844
+ "SAML Single Sign-On",
42845
+ outOfBand,
42846
+ ssoUserId
42847
+ );
42848
+ }
42580
42849
  const url3 = new import_url8.URL("/auth/sso", client2.apiUrl);
42581
42850
  url3.searchParams.set("teamId", teamIdOrSlug);
42582
42851
  return doOauthLogin(client2, url3, "SAML Single Sign-On", outOfBand, ssoUserId);
42583
42852
  }
42853
+ async function decodeToken(client2) {
42854
+ const { token } = client2.authConfig;
42855
+ if (!token) {
42856
+ throw new Error(
42857
+ `No existing credentials found. Please run \`vercel login --future\`.`
42858
+ );
42859
+ }
42860
+ const inspectResponse = await inspectTokenRequest(token);
42861
+ const [inspectError, inspectResult] = await processInspectTokenResponse(inspectResponse);
42862
+ if (inspectError)
42863
+ throw inspectError;
42864
+ if (!inspectResult.active || !inspectResult.session_id || !inspectResult.client_id) {
42865
+ throw new Error(
42866
+ `Invalid token type. Run \`vercel login --future\` to log-in and try again.`
42867
+ );
42868
+ }
42869
+ return {
42870
+ session_id: inspectResult.session_id,
42871
+ client_id: inspectResult.client_id
42872
+ };
42873
+ }
42584
42874
  var import_url8;
42585
42875
  var init_saml = __esm({
42586
42876
  "src/util/login/saml.ts"() {
42587
42877
  "use strict";
42588
42878
  import_url8 = require("url");
42589
42879
  init_oauth();
42880
+ init_oauth2();
42590
42881
  }
42591
42882
  });
42592
42883
 
@@ -42597,7 +42888,7 @@ async function reauthenticate(client2, error3) {
42597
42888
  `You must re-authenticate with SAML to use ${(0, import_chalk16.bold)(error3.scope)} scope.`
42598
42889
  );
42599
42890
  if (await client2.input.confirm(`Log in with SAML?`, true)) {
42600
- return doSamlLogin(client2, error3.teamId);
42891
+ return doSamlLogin(client2, error3.scope ?? error3.teamId);
42601
42892
  }
42602
42893
  } else {
42603
42894
  output_manager_default.log(`You must re-authenticate to use ${(0, import_chalk16.bold)(error3.scope)} scope.`);
@@ -60768,11 +61059,11 @@ var require_dist7 = __commonJS2({
60768
61059
  });
60769
61060
 
60770
61061
  // src/util/config/global-path.ts
60771
- var import_os4, import_fs, import_path3, import_xdg_app_paths2, isDirectory, getGlobalPathConfig, global_path_default;
61062
+ var import_os5, import_fs, import_path3, import_xdg_app_paths2, isDirectory, getGlobalPathConfig, global_path_default;
60772
61063
  var init_global_path = __esm({
60773
61064
  "src/util/config/global-path.ts"() {
60774
61065
  "use strict";
60775
- import_os4 = require("os");
61066
+ import_os5 = require("os");
60776
61067
  import_fs = __toESM3(require("fs"));
60777
61068
  import_path3 = __toESM3(require("path"));
60778
61069
  import_xdg_app_paths2 = __toESM3(require_xdg_app_paths());
@@ -60791,7 +61082,7 @@ var init_global_path = __esm({
60791
61082
  const possibleConfigPaths = [
60792
61083
  ...vercelDirectories,
60793
61084
  // latest vercel directory
60794
- import_path3.default.join((0, import_os4.homedir)(), ".now"),
61085
+ import_path3.default.join((0, import_os5.homedir)(), ".now"),
60795
61086
  // legacy config in user's home directory
60796
61087
  ...(0, import_xdg_app_paths2.default)("now").dataDirs()
60797
61088
  // legacy XDG directory
@@ -60982,233 +61273,6 @@ var init_promise = __esm({
60982
61273
  }
60983
61274
  });
60984
61275
 
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
61276
  // src/util/client.ts
61213
61277
  function isOAuthAuth(authConfig) {
61214
61278
  return authConfig.type === "oauth";
@@ -61243,7 +61307,7 @@ var init_client = __esm({
61243
61307
  import_error_utils6 = __toESM3(require_dist2());
61244
61308
  init_sleep();
61245
61309
  init_output_manager();
61246
- init_oauth2();
61310
+ init_oauth();
61247
61311
  isSAMLError = (v) => {
61248
61312
  return v && v.saml;
61249
61313
  };
@@ -61265,8 +61329,10 @@ var init_client = __esm({
61265
61329
  }
61266
61330
  throw error3;
61267
61331
  }
61268
- this.authConfig.token = result.token;
61269
- writeToAuthConfigFile(this.authConfig);
61332
+ if (this.authConfig.type !== "oauth") {
61333
+ this.authConfig.token = result.token;
61334
+ writeToAuthConfigFile(this.authConfig);
61335
+ }
61270
61336
  });
61271
61337
  this._onRetry = (error3) => {
61272
61338
  output_manager_default.debug(`Retrying: ${error3}
@@ -116668,6 +116734,45 @@ var require_frameworks = __commonJS2({
116668
116734
  dependency: "express",
116669
116735
  getOutputDirName: async () => "public"
116670
116736
  },
116737
+ {
116738
+ name: "xmcp",
116739
+ slug: "xmcp",
116740
+ logo: "https://api-frameworks.vercel.sh/framework-logos/xmcp.svg",
116741
+ tagline: "The MCP framework for building AI-powered tools",
116742
+ description: "A framework for building Model Context Protocol servers with zero configuration.",
116743
+ website: "https://xmcp.dev",
116744
+ detectors: {
116745
+ some: [
116746
+ {
116747
+ path: "xmcp.config.ts"
116748
+ },
116749
+ {
116750
+ path: "xmcp.config.js"
116751
+ },
116752
+ {
116753
+ matchPackage: "xmcp"
116754
+ }
116755
+ ]
116756
+ },
116757
+ settings: {
116758
+ installCommand: {
116759
+ placeholder: "`yarn install`, `pnpm install`, `npm install`, or `bun install`"
116760
+ },
116761
+ buildCommand: {
116762
+ placeholder: "`npm run build` or `xmcp build`",
116763
+ value: "xmcp build --vercel"
116764
+ },
116765
+ devCommand: {
116766
+ value: "xmcp dev",
116767
+ placeholder: "xmcp dev"
116768
+ },
116769
+ outputDirectory: {
116770
+ value: "dist"
116771
+ }
116772
+ },
116773
+ dependency: "xmcp",
116774
+ getOutputDirName: async () => "dist"
116775
+ },
116671
116776
  {
116672
116777
  name: "Other",
116673
116778
  slug: null,
@@ -129843,15 +129948,15 @@ async function getStore2(client2, argv, rwToken) {
129843
129948
  method: "GET",
129844
129949
  accountId: link4.status === "linked" ? link4.org.id : void 0
129845
129950
  });
129846
- const dateTimeFormat3 = "MM/DD/YYYY HH:mm:ss.SS";
129951
+ const dateTimeFormat2 = "MM/DD/YYYY HH:mm:ss.SS";
129847
129952
  const regionInfo = store2.store.region ? `
129848
129953
  Region: ${store2.store.region}` : "";
129849
129954
  output_manager_default.print(
129850
129955
  `Blob Store: ${import_chalk40.default.bold(store2.store.name)} (${import_chalk40.default.dim(store2.store.id)})
129851
129956
  Billing State: ${store2.store.billingState === "active" ? import_chalk40.default.green("Active") : import_chalk40.default.red("Inactive")}
129852
129957
  Size: ${(0, import_bytes3.default)(store2.store.size)}${regionInfo}
129853
- Created At: ${(0, import_date_fns.format)(new Date(store2.store.createdAt), dateTimeFormat3)}
129854
- Updated At: ${(0, import_date_fns.format)(new Date(store2.store.updatedAt), dateTimeFormat3)}
129958
+ Created At: ${(0, import_date_fns.format)(new Date(store2.store.createdAt), dateTimeFormat2)}
129959
+ Updated At: ${(0, import_date_fns.format)(new Date(store2.store.updatedAt), dateTimeFormat2)}
129855
129960
  `
129856
129961
  );
129857
129962
  } catch (err) {
@@ -146777,7 +146882,7 @@ async function main4(client2) {
146777
146882
  if (!subcommand && needHelp) {
146778
146883
  telemetry2.trackCliFlagHelp(cacheCommand.name);
146779
146884
  output_manager_default.print(help2(cacheCommand, { columns: client2.stderr.columns }));
146780
- return 2;
146885
+ return 0;
146781
146886
  }
146782
146887
  function printHelp(command) {
146783
146888
  telemetry2.trackCliFlagHelp(command.name, subcommandOriginal);
@@ -178214,7 +178319,7 @@ async function link3(client2) {
178214
178319
  if (parsedArgs.flags["--help"]) {
178215
178320
  telemetry2.trackCliFlagHelp("link");
178216
178321
  output_manager_default.print(help2(linkCommand, { columns: client2.stderr.columns }));
178217
- return 2;
178322
+ return 0;
178218
178323
  }
178219
178324
  telemetry2.trackCliFlagRepo(parsedArgs.flags["--repo"]);
178220
178325
  telemetry2.trackCliFlagYes(parsedArgs.flags["--yes"]);
@@ -178394,7 +178499,7 @@ async function list5(client2) {
178394
178499
  if (parsedArgs.flags["--help"]) {
178395
178500
  telemetry2.trackCliFlagHelp("list");
178396
178501
  print(help2(listCommand, { columns: client2.stderr.columns }));
178397
- return 2;
178502
+ return 0;
178398
178503
  }
178399
178504
  if (parsedArgs.args.length > 2) {
178400
178505
  error3(`${getCommandName("ls [app]")} accepts at most one argument`);
@@ -178810,7 +178915,13 @@ async function logs(client2) {
178810
178915
  }
178811
178916
  return 1;
178812
178917
  }
178813
- printDisclaimer(deployment);
178918
+ output_manager_default.print(
178919
+ `Displaying runtime logs for deployment ${deployment.url} (${import_chalk106.default.dim(
178920
+ deployment.id
178921
+ )}) starting from ${import_chalk106.default.bold((0, import_format3.default)(Date.now(), DATE_TIME_FORMAT))}
178922
+
178923
+ `
178924
+ );
178814
178925
  const abortController = new AbortController();
178815
178926
  return await displayRuntimeLogs(
178816
178927
  client2,
@@ -178822,19 +178933,7 @@ async function logs(client2) {
178822
178933
  abortController
178823
178934
  );
178824
178935
  }
178825
- function printDisclaimer(deployment) {
178826
- output_manager_default.warn(
178827
- `This command now displays runtime logs. To access your build logs, run \`vercel inspect --logs ${deployment.url}\``
178828
- );
178829
- output_manager_default.print(
178830
- `Displaying runtime logs for deployment ${deployment.url} (${import_chalk106.default.dim(
178831
- deployment.id
178832
- )}) starting from ${import_chalk106.default.bold((0, import_format3.default)(Date.now(), dateTimeFormat2))}
178833
-
178834
- `
178835
- );
178836
- }
178837
- var import_error_utils30, import_chalk106, import_format3, deprecatedFlags, dateTimeFormat2;
178936
+ var import_error_utils30, import_chalk106, import_format3, deprecatedFlags, DATE_TIME_FORMAT;
178838
178937
  var init_logs3 = __esm({
178839
178938
  "src/commands/logs/index.ts"() {
178840
178939
  "use strict";
@@ -178864,7 +178963,7 @@ var init_logs3 = __esm({
178864
178963
  "--until",
178865
178964
  "--output"
178866
178965
  ];
178867
- dateTimeFormat2 = "MMM dd HH:mm:ss.SS";
178966
+ DATE_TIME_FORMAT = "MMM dd HH:mm:ss.SS";
178868
178967
  }
178869
178968
  });
178870
178969
 
@@ -179343,7 +179442,7 @@ var init_future = __esm({
179343
179442
  init_pkg_name();
179344
179443
  init_emoji();
179345
179444
  init_humanize_path();
179346
- init_oauth2();
179445
+ init_oauth();
179347
179446
  init_output_manager();
179348
179447
  }
179349
179448
  });
@@ -179375,7 +179474,7 @@ async function login3(client2) {
179375
179474
  if (parsedArgs.flags["--help"]) {
179376
179475
  telemetry2.trackCliFlagHelp("login");
179377
179476
  output_manager_default.print(help2(loginCommand, { columns: client2.stderr.columns }));
179378
- return 2;
179477
+ return 0;
179379
179478
  }
179380
179479
  if (parsedArgs.flags["--token"]) {
179381
179480
  output_manager_default.error('`--token` may not be used with the "login" command');
@@ -179510,7 +179609,7 @@ var init_future2 = __esm({
179510
179609
  "use strict";
179511
179610
  import_error_utils31 = __toESM3(require_dist2());
179512
179611
  init_pkg_name();
179513
- init_oauth2();
179612
+ init_oauth();
179514
179613
  init_output_manager();
179515
179614
  }
179516
179615
  });
@@ -179538,7 +179637,7 @@ async function logout2(client2) {
179538
179637
  if (parsedArgs.flags["--help"]) {
179539
179638
  telemetry2.trackCliFlagHelp("logout");
179540
179639
  output_manager_default.print(help2(logoutCommand, { columns: client2.stderr.columns }));
179541
- return 2;
179640
+ return 0;
179542
179641
  }
179543
179642
  if (authConfig.type === "oauth") {
179544
179643
  return await logout(client2);
@@ -180423,13 +180522,13 @@ async function main15(client2) {
180423
180522
  if (!subcommand && needHelp) {
180424
180523
  telemetry2.trackCliFlagHelp("project");
180425
180524
  output_manager_default.print(help2(projectCommand, { columns: client2.stderr.columns }));
180426
- return 2;
180525
+ return 0;
180427
180526
  }
180428
180527
  function printHelp(command) {
180429
180528
  output_manager_default.print(
180430
180529
  help2(command, { parent: projectCommand, columns: client2.stderr.columns })
180431
180530
  );
180432
- return 2;
180531
+ return 0;
180433
180532
  }
180434
180533
  if (!parsedArgs.args[1]) {
180435
180534
  subcommand = "list";
@@ -183887,7 +183986,7 @@ async function whoami(client2) {
183887
183986
  if (parsedArgs.flags["--help"]) {
183888
183987
  telemetry2.trackCliFlagHelp("whoami");
183889
183988
  output_manager_default.print(help2(whoamiCommand, { columns: client2.stderr.columns }));
183890
- return 2;
183989
+ return 0;
183891
183990
  }
183892
183991
  const { contextName } = await getScope(client2, { getTeam: false });
183893
183992
  if (client2.stdout.isTTY) {
@@ -184873,7 +184972,7 @@ var main17 = async () => {
184873
184972
  const bareHelpSubcommand = targetOrSubcommand === "help" && !subSubCommand;
184874
184973
  if (bareHelpOption || bareHelpSubcommand) {
184875
184974
  output_manager_default.print(help());
184876
- return 2;
184975
+ return 0;
184877
184976
  }
184878
184977
  try {
184879
184978
  await (0, import_fs_extra24.mkdirp)(VERCEL_DIR4);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "46.0.0",
3
+ "version": "46.0.2",
4
4
  "preferGlobal": true,
5
5
  "license": "Apache-2.0",
6
6
  "description": "The command-line interface for Vercel",
@@ -28,7 +28,7 @@
28
28
  "@vercel/express": "0.0.6",
29
29
  "@vercel/hono": "0.0.14",
30
30
  "@vercel/hydrogen": "1.2.3",
31
- "@vercel/next": "4.11.2",
31
+ "@vercel/next": "4.11.3",
32
32
  "@vercel/node": "5.3.13",
33
33
  "@vercel/python": "5.0.0",
34
34
  "@vercel/redwood": "2.3.4",
@@ -84,8 +84,8 @@
84
84
  "@vercel/client": "15.3.14",
85
85
  "@vercel/detect-agent": "0.2.0",
86
86
  "@vercel/error-utils": "2.0.3",
87
- "@vercel/frameworks": "3.7.7",
88
- "@vercel/fs-detectors": "5.4.13",
87
+ "@vercel/frameworks": "3.8.0",
88
+ "@vercel/fs-detectors": "5.4.14",
89
89
  "@vercel/routing-utils": "5.1.1",
90
90
  "@vitest/expect": "2.1.3",
91
91
  "ajv": "6.12.3",