vercel 54.6.1 → 54.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{add-PABR7UDW.js → add-67QG24DA.js} +8 -8
- package/dist/chunks/{chunk-3TDGMELF.js → chunk-2R5WYHZW.js} +2 -2
- package/dist/chunks/{chunk-3ZDA2CNR.js → chunk-2SYGBHZU.js} +1 -1
- package/dist/chunks/{chunk-YP423QYK.js → chunk-3EOZ4ZDJ.js} +2 -2
- package/dist/chunks/{chunk-TKQCQ2Z4.js → chunk-6ABZRR5D.js} +7 -7
- package/dist/chunks/{chunk-TM2USC5N.js → chunk-7HAY2TY5.js} +3 -3
- package/dist/chunks/{chunk-ULXHXZCZ.js → chunk-7OUZIPHA.js} +1 -1
- package/dist/chunks/{chunk-KTMAZEOI.js → chunk-ACS2IKKO.js} +66 -10
- package/dist/chunks/{chunk-HXCZ6ZNO.js → chunk-CJPMAEBA.js} +2 -2
- package/dist/chunks/{chunk-SRVNEJVN.js → chunk-CMQXECHW.js} +2 -2
- package/dist/chunks/{chunk-5EKBCYHA.js → chunk-CPWI2SWV.js} +2 -2
- package/dist/chunks/{chunk-DSVJF7BT.js → chunk-FQ5AMV7J.js} +4 -4
- package/dist/chunks/{chunk-NYJXGEIR.js → chunk-FV5RQPKY.js} +1 -1
- package/dist/chunks/{chunk-V2EPUZ7C.js → chunk-GIJMTTDG.js} +1491 -168
- package/dist/chunks/{chunk-55ZHYOXR.js → chunk-GVL6A2EH.js} +2 -2
- package/dist/chunks/{chunk-UGXBNJMO.js → chunk-IDFKAJW3.js} +1 -0
- package/dist/chunks/{chunk-BDBG7347.js → chunk-ILYEE673.js} +2 -2
- package/dist/chunks/{chunk-TFLXDK24.js → chunk-IXR7P5OR.js} +7 -7
- package/dist/chunks/{chunk-5IH3CKCW.js → chunk-JWLKJA7N.js} +4 -4
- package/dist/chunks/{chunk-YV5W67AJ.js → chunk-KP6S4KU2.js} +45 -777
- package/dist/chunks/{chunk-TTOZFGDX.js → chunk-LOQRUMOE.js} +2 -2
- package/dist/chunks/{chunk-DJA3IN2X.js → chunk-O7SEN4RY.js} +2 -2
- package/dist/chunks/{chunk-FJOUYHN4.js → chunk-OAUXTVXM.js} +1 -1
- package/dist/chunks/{chunk-L3BYKHWE.js → chunk-PBX6K5OJ.js} +9 -7
- package/dist/chunks/{chunk-NVHKS2AA.js → chunk-POF76PSB.js} +4 -4
- package/dist/chunks/{chunk-F7OFM5NM.js → chunk-PPCVO6KR.js} +3 -3
- package/dist/chunks/{chunk-KSS3AMDU.js → chunk-QN7GS5KD.js} +2 -2
- package/dist/chunks/{chunk-C2V6DCWN.js → chunk-TIJBJ7EO.js} +2 -2
- package/dist/chunks/{chunk-YAOSNCGO.js → chunk-TJQZGB6S.js} +2 -2
- package/dist/chunks/{chunk-HD3NJHWT.js → chunk-VWXC5XIE.js} +2 -2
- package/dist/chunks/{chunk-DUIYXUIB.js → chunk-WGF7XCUT.js} +10 -14
- package/dist/chunks/{chunk-ZINNI4TC.js → chunk-WWLVPUED.js} +1 -1
- package/dist/chunks/chunk-XDU5XSTQ.js +152 -0
- package/dist/chunks/{chunk-H33IJ7OP.js → chunk-XQUJUKTN.js} +1 -1
- package/dist/chunks/{chunk-OM5Z2KO5.js → chunk-ZTHVV4KB.js} +1 -1
- package/dist/chunks/{compile-vercel-config-UWWV5Q74.js → compile-vercel-config-R5X7XQH3.js} +4 -4
- package/dist/chunks/{delete-Z2TQELK6.js → delete-QUCIXBSR.js} +6 -6
- package/dist/chunks/{disable-D7GG4H3R.js → disable-N7JFRNT5.js} +6 -6
- package/dist/chunks/{discard-IIG3TUIT.js → discard-PDT55IX4.js} +6 -6
- package/dist/chunks/{edit-DD2KENCR.js → edit-C35BISPR.js} +7 -7
- package/dist/chunks/{enable-UCYQRKCL.js → enable-AIKCOZPH.js} +6 -6
- package/dist/chunks/{export-U4BZUMSZ.js → export-SQBM4PT6.js} +6 -6
- package/dist/chunks/{inspect-PYA4NFIT.js → inspect-FQ6NOVDU.js} +8 -8
- package/dist/chunks/{list-RDT3KISX.js → list-XJIRH6SE.js} +6 -6
- package/dist/chunks/{list-QHVLSNFO.js → list-ZJVOBYVT.js} +9 -9
- package/dist/chunks/{ls-E3EILWRU.js → ls-SOTFIBD6.js} +8 -8
- package/dist/chunks/{publish-HSIQS5SO.js → publish-US2CACSX.js} +6 -6
- package/dist/chunks/{query-5SREWTMU.js → query-DUJSSD3L.js} +8 -8
- package/dist/chunks/{reorder-QRLPE5HF.js → reorder-Y5N4VOO7.js} +6 -6
- package/dist/chunks/{restore-AI3YOHCB.js → restore-TTEF3WC7.js} +6 -6
- package/dist/chunks/{rm-ZLDS7FJG.js → rm-AARNIFI5.js} +8 -8
- package/dist/chunks/{rule-inspect-2LDHZJ24.js → rule-inspect-TQBZNJUL.js} +8 -8
- package/dist/chunks/{rules-DTEFM3BW.js → rules-QWOMXETM.js} +8 -8
- package/dist/chunks/{schema-G6O7BMIJ.js → schema-CZIQHHUV.js} +9 -9
- package/dist/chunks/{types-V6KTYGWP.js → types-LU2G5DD3.js} +4 -4
- package/dist/chunks/{update-A3O2FDGF.js → update-A2FXWT7E.js} +8 -8
- package/dist/commands/build/index.js +15 -17
- package/dist/commands/deploy/index.js +23 -24
- package/dist/commands/dev/index.js +14 -14
- package/dist/commands/env/index.js +18 -19
- package/dist/commands/link/index.js +20 -21
- package/dist/commands/list/index.js +10 -10
- package/dist/commands-bulk.js +1503 -1277
- package/dist/index.js +20 -21
- package/dist/version.mjs +1 -1
- package/package.json +20 -20
- package/dist/chunks/chunk-76ZNZKIN.js +0 -17
- package/dist/chunks/chunk-OF7SJ4AC.js +0 -680
|
@@ -7,15 +7,9 @@ const __dirname = __dirname_(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
highlight
|
|
9
9
|
} from "./chunk-V5P25P7F.js";
|
|
10
|
-
import {
|
|
11
|
-
ua_default
|
|
12
|
-
} from "./chunk-76ZNZKIN.js";
|
|
13
10
|
import {
|
|
14
11
|
getLocalPathConfig
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
autoInstallVercelPlugin
|
|
18
|
-
} from "./chunk-OF7SJ4AC.js";
|
|
12
|
+
} from "./chunk-PPCVO6KR.js";
|
|
19
13
|
import {
|
|
20
14
|
DEFAULT_VERCEL_CONFIG_FILENAME,
|
|
21
15
|
VERCEL_CONFIG_EXTENSIONS,
|
|
@@ -24,22 +18,24 @@ import {
|
|
|
24
18
|
esm_default,
|
|
25
19
|
esm_default2,
|
|
26
20
|
esm_default3,
|
|
27
|
-
getUser,
|
|
28
|
-
humanizePath,
|
|
29
21
|
isBackspaceKey,
|
|
30
22
|
isEnterKey,
|
|
31
23
|
isVercelTomlEnabled,
|
|
32
24
|
makeTheme,
|
|
33
25
|
onExit,
|
|
26
|
+
performDeviceCodeFlow,
|
|
27
|
+
processTokenResponse,
|
|
28
|
+
refreshTokenRequest,
|
|
34
29
|
require_cli_width,
|
|
35
30
|
require_dist as require_dist2,
|
|
36
31
|
require_lib2 as require_lib,
|
|
37
32
|
require_source as require_source2,
|
|
38
33
|
require_wrap_ansi,
|
|
34
|
+
ua_default,
|
|
39
35
|
useKeypress,
|
|
40
36
|
usePrefix,
|
|
41
37
|
useState
|
|
42
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-GIJMTTDG.js";
|
|
43
39
|
import {
|
|
44
40
|
require_load_json_file
|
|
45
41
|
} from "./chunk-4CIXZOP4.js";
|
|
@@ -48,14 +44,12 @@ import {
|
|
|
48
44
|
} from "./chunk-N2T234LO.js";
|
|
49
45
|
import {
|
|
50
46
|
parseArguments,
|
|
51
|
-
printError,
|
|
52
47
|
require_strip_ansi
|
|
53
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-XQUJUKTN.js";
|
|
54
49
|
import {
|
|
55
50
|
APIError,
|
|
56
|
-
NowError
|
|
57
|
-
|
|
58
|
-
} from "./chunk-UGXBNJMO.js";
|
|
51
|
+
NowError
|
|
52
|
+
} from "./chunk-IDFKAJW3.js";
|
|
59
53
|
import {
|
|
60
54
|
emoji,
|
|
61
55
|
link_default,
|
|
@@ -79,11 +73,11 @@ var require_yoctocolors_cjs = __commonJS({
|
|
|
79
73
|
"../../node_modules/.pnpm/yoctocolors-cjs@2.1.3/node_modules/yoctocolors-cjs/index.js"(exports, module) {
|
|
80
74
|
var tty = __require("tty");
|
|
81
75
|
var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
82
|
-
var format = (
|
|
76
|
+
var format = (open, close) => {
|
|
83
77
|
if (!hasColors) {
|
|
84
78
|
return (input) => input;
|
|
85
79
|
}
|
|
86
|
-
const openCode = `\x1B[${
|
|
80
|
+
const openCode = `\x1B[${open}m`;
|
|
87
81
|
const closeCode = `\x1B[${close}m`;
|
|
88
82
|
return (input) => {
|
|
89
83
|
const string = input + "";
|
|
@@ -396,330 +390,6 @@ var require_dist3 = __commonJS({
|
|
|
396
390
|
}
|
|
397
391
|
});
|
|
398
392
|
|
|
399
|
-
// ../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js
|
|
400
|
-
var require_is_docker = __commonJS({
|
|
401
|
-
"../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports, module) {
|
|
402
|
-
"use strict";
|
|
403
|
-
var fs = __require("fs");
|
|
404
|
-
var isDocker;
|
|
405
|
-
function hasDockerEnv() {
|
|
406
|
-
try {
|
|
407
|
-
fs.statSync("/.dockerenv");
|
|
408
|
-
return true;
|
|
409
|
-
} catch (_) {
|
|
410
|
-
return false;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
function hasDockerCGroup() {
|
|
414
|
-
try {
|
|
415
|
-
return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
416
|
-
} catch (_) {
|
|
417
|
-
return false;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
module.exports = () => {
|
|
421
|
-
if (isDocker === void 0) {
|
|
422
|
-
isDocker = hasDockerEnv() || hasDockerCGroup();
|
|
423
|
-
}
|
|
424
|
-
return isDocker;
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
// ../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js
|
|
430
|
-
var require_is_wsl = __commonJS({
|
|
431
|
-
"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports, module) {
|
|
432
|
-
"use strict";
|
|
433
|
-
var os = __require("os");
|
|
434
|
-
var fs = __require("fs");
|
|
435
|
-
var isDocker = require_is_docker();
|
|
436
|
-
var isWsl = () => {
|
|
437
|
-
if (process.platform !== "linux") {
|
|
438
|
-
return false;
|
|
439
|
-
}
|
|
440
|
-
if (os.release().toLowerCase().includes("microsoft")) {
|
|
441
|
-
if (isDocker()) {
|
|
442
|
-
return false;
|
|
443
|
-
}
|
|
444
|
-
return true;
|
|
445
|
-
}
|
|
446
|
-
try {
|
|
447
|
-
return fs.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
|
|
448
|
-
} catch (_) {
|
|
449
|
-
return false;
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
if (process.env.__IS_WSL_TEST__) {
|
|
453
|
-
module.exports = isWsl;
|
|
454
|
-
} else {
|
|
455
|
-
module.exports = isWsl();
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
// ../../node_modules/.pnpm/define-lazy-prop@2.0.0/node_modules/define-lazy-prop/index.js
|
|
461
|
-
var require_define_lazy_prop = __commonJS({
|
|
462
|
-
"../../node_modules/.pnpm/define-lazy-prop@2.0.0/node_modules/define-lazy-prop/index.js"(exports, module) {
|
|
463
|
-
"use strict";
|
|
464
|
-
module.exports = (object, propertyName, fn) => {
|
|
465
|
-
const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
466
|
-
Object.defineProperty(object, propertyName, {
|
|
467
|
-
configurable: true,
|
|
468
|
-
enumerable: true,
|
|
469
|
-
get() {
|
|
470
|
-
const result = fn();
|
|
471
|
-
define(result);
|
|
472
|
-
return result;
|
|
473
|
-
},
|
|
474
|
-
set(value) {
|
|
475
|
-
define(value);
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
return object;
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
// ../../node_modules/.pnpm/open@8.4.0/node_modules/open/index.js
|
|
484
|
-
var require_open = __commonJS({
|
|
485
|
-
"../../node_modules/.pnpm/open@8.4.0/node_modules/open/index.js"(exports, module) {
|
|
486
|
-
var path2 = __require("path");
|
|
487
|
-
var childProcess = __require("child_process");
|
|
488
|
-
var { promises: fs, constants: fsConstants } = __require("fs");
|
|
489
|
-
var isWsl = require_is_wsl();
|
|
490
|
-
var isDocker = require_is_docker();
|
|
491
|
-
var defineLazyProperty = require_define_lazy_prop();
|
|
492
|
-
var localXdgOpenPath = path2.join(__dirname, "xdg-open");
|
|
493
|
-
var { platform, arch } = process;
|
|
494
|
-
var getWslDrivesMountPoint = (() => {
|
|
495
|
-
const defaultMountPoint = "/mnt/";
|
|
496
|
-
let mountPoint;
|
|
497
|
-
return async function() {
|
|
498
|
-
if (mountPoint) {
|
|
499
|
-
return mountPoint;
|
|
500
|
-
}
|
|
501
|
-
const configFilePath = "/etc/wsl.conf";
|
|
502
|
-
let isConfigFileExists = false;
|
|
503
|
-
try {
|
|
504
|
-
await fs.access(configFilePath, fsConstants.F_OK);
|
|
505
|
-
isConfigFileExists = true;
|
|
506
|
-
} catch {
|
|
507
|
-
}
|
|
508
|
-
if (!isConfigFileExists) {
|
|
509
|
-
return defaultMountPoint;
|
|
510
|
-
}
|
|
511
|
-
const configContent = await fs.readFile(configFilePath, { encoding: "utf8" });
|
|
512
|
-
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
513
|
-
if (!configMountPoint) {
|
|
514
|
-
return defaultMountPoint;
|
|
515
|
-
}
|
|
516
|
-
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
517
|
-
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
518
|
-
return mountPoint;
|
|
519
|
-
};
|
|
520
|
-
})();
|
|
521
|
-
var pTryEach = async (array, mapper) => {
|
|
522
|
-
let latestError;
|
|
523
|
-
for (const item of array) {
|
|
524
|
-
try {
|
|
525
|
-
return await mapper(item);
|
|
526
|
-
} catch (error) {
|
|
527
|
-
latestError = error;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
throw latestError;
|
|
531
|
-
};
|
|
532
|
-
var baseOpen = async (options) => {
|
|
533
|
-
options = {
|
|
534
|
-
wait: false,
|
|
535
|
-
background: false,
|
|
536
|
-
newInstance: false,
|
|
537
|
-
allowNonzeroExitCode: false,
|
|
538
|
-
...options
|
|
539
|
-
};
|
|
540
|
-
if (Array.isArray(options.app)) {
|
|
541
|
-
return pTryEach(options.app, (singleApp) => baseOpen({
|
|
542
|
-
...options,
|
|
543
|
-
app: singleApp
|
|
544
|
-
}));
|
|
545
|
-
}
|
|
546
|
-
let { name: app, arguments: appArguments = [] } = options.app || {};
|
|
547
|
-
appArguments = [...appArguments];
|
|
548
|
-
if (Array.isArray(app)) {
|
|
549
|
-
return pTryEach(app, (appName) => baseOpen({
|
|
550
|
-
...options,
|
|
551
|
-
app: {
|
|
552
|
-
name: appName,
|
|
553
|
-
arguments: appArguments
|
|
554
|
-
}
|
|
555
|
-
}));
|
|
556
|
-
}
|
|
557
|
-
let command;
|
|
558
|
-
const cliArguments = [];
|
|
559
|
-
const childProcessOptions = {};
|
|
560
|
-
if (platform === "darwin") {
|
|
561
|
-
command = "open";
|
|
562
|
-
if (options.wait) {
|
|
563
|
-
cliArguments.push("--wait-apps");
|
|
564
|
-
}
|
|
565
|
-
if (options.background) {
|
|
566
|
-
cliArguments.push("--background");
|
|
567
|
-
}
|
|
568
|
-
if (options.newInstance) {
|
|
569
|
-
cliArguments.push("--new");
|
|
570
|
-
}
|
|
571
|
-
if (app) {
|
|
572
|
-
cliArguments.push("-a", app);
|
|
573
|
-
}
|
|
574
|
-
} else if (platform === "win32" || isWsl && !isDocker()) {
|
|
575
|
-
const mountPoint = await getWslDrivesMountPoint();
|
|
576
|
-
command = isWsl ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` : `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
|
|
577
|
-
cliArguments.push(
|
|
578
|
-
"-NoProfile",
|
|
579
|
-
"-NonInteractive",
|
|
580
|
-
"\u2013ExecutionPolicy",
|
|
581
|
-
"Bypass",
|
|
582
|
-
"-EncodedCommand"
|
|
583
|
-
);
|
|
584
|
-
if (!isWsl) {
|
|
585
|
-
childProcessOptions.windowsVerbatimArguments = true;
|
|
586
|
-
}
|
|
587
|
-
const encodedArguments = ["Start"];
|
|
588
|
-
if (options.wait) {
|
|
589
|
-
encodedArguments.push("-Wait");
|
|
590
|
-
}
|
|
591
|
-
if (app) {
|
|
592
|
-
encodedArguments.push(`"\`"${app}\`""`, "-ArgumentList");
|
|
593
|
-
if (options.target) {
|
|
594
|
-
appArguments.unshift(options.target);
|
|
595
|
-
}
|
|
596
|
-
} else if (options.target) {
|
|
597
|
-
encodedArguments.push(`"${options.target}"`);
|
|
598
|
-
}
|
|
599
|
-
if (appArguments.length > 0) {
|
|
600
|
-
appArguments = appArguments.map((arg) => `"\`"${arg}\`""`);
|
|
601
|
-
encodedArguments.push(appArguments.join(","));
|
|
602
|
-
}
|
|
603
|
-
options.target = Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
|
|
604
|
-
} else {
|
|
605
|
-
if (app) {
|
|
606
|
-
command = app;
|
|
607
|
-
} else {
|
|
608
|
-
const isBundled = !__dirname || __dirname === "/";
|
|
609
|
-
let exeLocalXdgOpen = false;
|
|
610
|
-
try {
|
|
611
|
-
await fs.access(localXdgOpenPath, fsConstants.X_OK);
|
|
612
|
-
exeLocalXdgOpen = true;
|
|
613
|
-
} catch {
|
|
614
|
-
}
|
|
615
|
-
const useSystemXdgOpen = process.versions.electron || platform === "android" || isBundled || !exeLocalXdgOpen;
|
|
616
|
-
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
617
|
-
}
|
|
618
|
-
if (appArguments.length > 0) {
|
|
619
|
-
cliArguments.push(...appArguments);
|
|
620
|
-
}
|
|
621
|
-
if (!options.wait) {
|
|
622
|
-
childProcessOptions.stdio = "ignore";
|
|
623
|
-
childProcessOptions.detached = true;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
if (options.target) {
|
|
627
|
-
cliArguments.push(options.target);
|
|
628
|
-
}
|
|
629
|
-
if (platform === "darwin" && appArguments.length > 0) {
|
|
630
|
-
cliArguments.push("--args", ...appArguments);
|
|
631
|
-
}
|
|
632
|
-
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
633
|
-
if (options.wait) {
|
|
634
|
-
return new Promise((resolve2, reject) => {
|
|
635
|
-
subprocess.once("error", reject);
|
|
636
|
-
subprocess.once("close", (exitCode) => {
|
|
637
|
-
if (options.allowNonzeroExitCode && exitCode > 0) {
|
|
638
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
resolve2(subprocess);
|
|
642
|
-
});
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
subprocess.unref();
|
|
646
|
-
return subprocess;
|
|
647
|
-
};
|
|
648
|
-
var open2 = (target, options) => {
|
|
649
|
-
if (typeof target !== "string") {
|
|
650
|
-
throw new TypeError("Expected a `target`");
|
|
651
|
-
}
|
|
652
|
-
return baseOpen({
|
|
653
|
-
...options,
|
|
654
|
-
target
|
|
655
|
-
});
|
|
656
|
-
};
|
|
657
|
-
var openApp = (name, options) => {
|
|
658
|
-
if (typeof name !== "string") {
|
|
659
|
-
throw new TypeError("Expected a `name`");
|
|
660
|
-
}
|
|
661
|
-
const { arguments: appArguments = [] } = options || {};
|
|
662
|
-
if (appArguments !== void 0 && appArguments !== null && !Array.isArray(appArguments)) {
|
|
663
|
-
throw new TypeError("Expected `appArguments` as Array type");
|
|
664
|
-
}
|
|
665
|
-
return baseOpen({
|
|
666
|
-
...options,
|
|
667
|
-
app: {
|
|
668
|
-
name,
|
|
669
|
-
arguments: appArguments
|
|
670
|
-
}
|
|
671
|
-
});
|
|
672
|
-
};
|
|
673
|
-
function detectArchBinary(binary) {
|
|
674
|
-
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
675
|
-
return binary;
|
|
676
|
-
}
|
|
677
|
-
const { [arch]: archBinary } = binary;
|
|
678
|
-
if (!archBinary) {
|
|
679
|
-
throw new Error(`${arch} is not supported`);
|
|
680
|
-
}
|
|
681
|
-
return archBinary;
|
|
682
|
-
}
|
|
683
|
-
function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
|
|
684
|
-
if (wsl && isWsl) {
|
|
685
|
-
return detectArchBinary(wsl);
|
|
686
|
-
}
|
|
687
|
-
if (!platformBinary) {
|
|
688
|
-
throw new Error(`${platform} is not supported`);
|
|
689
|
-
}
|
|
690
|
-
return detectArchBinary(platformBinary);
|
|
691
|
-
}
|
|
692
|
-
var apps = {};
|
|
693
|
-
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
694
|
-
darwin: "google chrome",
|
|
695
|
-
win32: "chrome",
|
|
696
|
-
linux: ["google-chrome", "google-chrome-stable", "chromium"]
|
|
697
|
-
}, {
|
|
698
|
-
wsl: {
|
|
699
|
-
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
700
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
701
|
-
}
|
|
702
|
-
}));
|
|
703
|
-
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
704
|
-
darwin: "firefox",
|
|
705
|
-
win32: "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
|
|
706
|
-
linux: "firefox"
|
|
707
|
-
}, {
|
|
708
|
-
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
709
|
-
}));
|
|
710
|
-
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
711
|
-
darwin: "microsoft edge",
|
|
712
|
-
win32: "msedge",
|
|
713
|
-
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
714
|
-
}, {
|
|
715
|
-
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
716
|
-
}));
|
|
717
|
-
open2.apps = apps;
|
|
718
|
-
open2.openApp = openApp;
|
|
719
|
-
module.exports = open2;
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
|
|
723
393
|
// src/util/config/global-path.ts
|
|
724
394
|
import path from "path";
|
|
725
395
|
import * as config from "@vercel/cli-config";
|
|
@@ -868,7 +538,7 @@ function readLocalConfig(prefix = process.cwd()) {
|
|
|
868
538
|
}
|
|
869
539
|
|
|
870
540
|
// src/util/client.ts
|
|
871
|
-
var
|
|
541
|
+
var import_chalk4 = __toESM(require_source(), 1);
|
|
872
542
|
|
|
873
543
|
// ../../node_modules/.pnpm/@inquirer+confirm@3.1.2/node_modules/@inquirer/confirm/dist/esm/index.mjs
|
|
874
544
|
var esm_default4 = createPrompt((config3, done) => {
|
|
@@ -1821,10 +1491,10 @@ ${theme.style.description(selectedChoice.description)}` : ``;
|
|
|
1821
1491
|
|
|
1822
1492
|
// src/util/client.ts
|
|
1823
1493
|
var import_async_retry = __toESM(require_dist3(), 1);
|
|
1824
|
-
var
|
|
1494
|
+
var import_node_fetch = __toESM(require_lib2(), 1);
|
|
1825
1495
|
import { join as join2, resolve } from "path";
|
|
1826
1496
|
import { EventEmitter } from "events";
|
|
1827
|
-
import { URL
|
|
1497
|
+
import { URL } from "url";
|
|
1828
1498
|
import {
|
|
1829
1499
|
getGlobalPathConfig as getSharedGlobalPathConfig,
|
|
1830
1500
|
readConfigFile as readSharedConfigFile,
|
|
@@ -1872,437 +1542,31 @@ function printIndications(res) {
|
|
|
1872
1542
|
}
|
|
1873
1543
|
|
|
1874
1544
|
// src/util/login/reauthenticate.ts
|
|
1875
|
-
var import_chalk4 = __toESM(require_source(), 1);
|
|
1876
|
-
|
|
1877
|
-
// src/commands/login/future.ts
|
|
1878
1545
|
var import_chalk3 = __toESM(require_source(), 1);
|
|
1879
|
-
var open = __toESM(require_open(), 1);
|
|
1880
|
-
var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
|
|
1881
|
-
import readline3 from "readline";
|
|
1882
|
-
import { KNOWN_AGENTS } from "@vercel/detect-agent";
|
|
1883
|
-
|
|
1884
|
-
// src/util/login/update-current-team-after-login.ts
|
|
1885
|
-
async function updateCurrentTeamAfterLogin(client, ssoTeamId) {
|
|
1886
|
-
if (ssoTeamId) {
|
|
1887
|
-
client.config.currentTeam = ssoTeamId;
|
|
1888
|
-
} else {
|
|
1889
|
-
let user = null;
|
|
1890
|
-
try {
|
|
1891
|
-
user = await getUser(client);
|
|
1892
|
-
} catch (_err) {
|
|
1893
|
-
output_manager_default.error("Failed to fetch the logged in user. Please try again.");
|
|
1894
|
-
return 1;
|
|
1895
|
-
}
|
|
1896
|
-
if (user.version === "northstar" && user.defaultTeamId) {
|
|
1897
|
-
client.config.currentTeam = user.defaultTeamId;
|
|
1898
|
-
} else {
|
|
1899
|
-
delete client.config.currentTeam;
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
// src/util/oauth.ts
|
|
1905
|
-
var import_node_fetch = __toESM(require_lib2(), 1);
|
|
1906
|
-
import { hostname } from "os";
|
|
1907
|
-
var VERCEL_ISSUER = new URL("https://vercel.com");
|
|
1908
|
-
var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
|
|
1909
|
-
var userAgent = `${hostname()} @ ${ua_default}`;
|
|
1910
|
-
var _as;
|
|
1911
|
-
async function as() {
|
|
1912
|
-
if (!_as) {
|
|
1913
|
-
const discoveryResponse = await discoveryEndpointRequest(VERCEL_ISSUER);
|
|
1914
|
-
const [discoveryResponseError, as2] = await processDiscoveryEndpointResponse(discoveryResponse);
|
|
1915
|
-
if (discoveryResponseError) {
|
|
1916
|
-
throw discoveryResponseError;
|
|
1917
|
-
}
|
|
1918
|
-
_as = as2;
|
|
1919
|
-
}
|
|
1920
|
-
return _as;
|
|
1921
|
-
}
|
|
1922
|
-
async function discoveryEndpointRequest(issuer) {
|
|
1923
|
-
return await (0, import_node_fetch.default)(new URL(".well-known/openid-configuration", issuer), {
|
|
1924
|
-
headers: { "Content-Type": "application/json", "user-agent": userAgent }
|
|
1925
|
-
});
|
|
1926
|
-
}
|
|
1927
|
-
async function processDiscoveryEndpointResponse(response) {
|
|
1928
|
-
const json = await response.json();
|
|
1929
|
-
if (!response.ok) {
|
|
1930
|
-
return [new Error("Discovery endpoint request failed")];
|
|
1931
|
-
}
|
|
1932
|
-
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)) {
|
|
1933
|
-
return [new TypeError("Invalid discovery response")];
|
|
1934
|
-
}
|
|
1935
|
-
const issuer = new URL(json.issuer);
|
|
1936
|
-
if (issuer.href !== VERCEL_ISSUER.href) {
|
|
1937
|
-
return [new Error("Issuer mismatch")];
|
|
1938
|
-
}
|
|
1939
|
-
return [
|
|
1940
|
-
null,
|
|
1941
|
-
{
|
|
1942
|
-
issuer,
|
|
1943
|
-
device_authorization_endpoint: new URL(
|
|
1944
|
-
json.device_authorization_endpoint
|
|
1945
|
-
),
|
|
1946
|
-
token_endpoint: new URL(json.token_endpoint),
|
|
1947
|
-
revocation_endpoint: new URL(json.revocation_endpoint),
|
|
1948
|
-
jwks_uri: new URL(json.jwks_uri),
|
|
1949
|
-
introspection_endpoint: new URL(json.introspection_endpoint)
|
|
1950
|
-
}
|
|
1951
|
-
];
|
|
1952
|
-
}
|
|
1953
|
-
async function deviceAuthorizationRequest() {
|
|
1954
|
-
return await (0, import_node_fetch.default)((await as()).device_authorization_endpoint, {
|
|
1955
|
-
method: "POST",
|
|
1956
|
-
headers: {
|
|
1957
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
1958
|
-
"user-agent": userAgent
|
|
1959
|
-
},
|
|
1960
|
-
body: new URLSearchParams({
|
|
1961
|
-
client_id: VERCEL_CLI_CLIENT_ID,
|
|
1962
|
-
scope: "openid offline_access"
|
|
1963
|
-
})
|
|
1964
|
-
});
|
|
1965
|
-
}
|
|
1966
|
-
async function processDeviceAuthorizationResponse(response) {
|
|
1967
|
-
const json = await response.json();
|
|
1968
|
-
if (!response.ok) {
|
|
1969
|
-
return [new OAuthError("Device authorization request failed", json)];
|
|
1970
|
-
}
|
|
1971
|
-
if (typeof json !== "object" || json === null)
|
|
1972
|
-
return [new TypeError("Expected response to be an object")];
|
|
1973
|
-
if (!("device_code" in json) || typeof json.device_code !== "string")
|
|
1974
|
-
return [new TypeError("Expected `device_code` to be a string")];
|
|
1975
|
-
if (!("user_code" in json) || typeof json.user_code !== "string")
|
|
1976
|
-
return [new TypeError("Expected `user_code` to be a string")];
|
|
1977
|
-
if (!("verification_uri" in json) || typeof json.verification_uri !== "string" || !canParseURL(json.verification_uri)) {
|
|
1978
|
-
return [new TypeError("Expected `verification_uri` to be a string")];
|
|
1979
|
-
}
|
|
1980
|
-
if (!("verification_uri_complete" in json) || typeof json.verification_uri_complete !== "string" || !canParseURL(json.verification_uri_complete)) {
|
|
1981
|
-
return [
|
|
1982
|
-
new TypeError("Expected `verification_uri_complete` to be a string")
|
|
1983
|
-
];
|
|
1984
|
-
}
|
|
1985
|
-
if (!("expires_in" in json) || typeof json.expires_in !== "number")
|
|
1986
|
-
return [new TypeError("Expected `expires_in` to be a number")];
|
|
1987
|
-
if (!("interval" in json) || typeof json.interval !== "number")
|
|
1988
|
-
return [new TypeError("Expected `interval` to be a number")];
|
|
1989
|
-
return [
|
|
1990
|
-
null,
|
|
1991
|
-
{
|
|
1992
|
-
device_code: json.device_code,
|
|
1993
|
-
user_code: json.user_code,
|
|
1994
|
-
verification_uri: json.verification_uri,
|
|
1995
|
-
verification_uri_complete: json.verification_uri_complete,
|
|
1996
|
-
expiresAt: Date.now() + json.expires_in * 1e3,
|
|
1997
|
-
interval: json.interval
|
|
1998
|
-
}
|
|
1999
|
-
];
|
|
2000
|
-
}
|
|
2001
|
-
async function deviceAccessTokenRequest(options) {
|
|
2002
|
-
try {
|
|
2003
|
-
return [
|
|
2004
|
-
null,
|
|
2005
|
-
await (0, import_node_fetch.default)((await as()).token_endpoint, {
|
|
2006
|
-
method: "POST",
|
|
2007
|
-
headers: {
|
|
2008
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2009
|
-
"user-agent": userAgent
|
|
2010
|
-
},
|
|
2011
|
-
body: new URLSearchParams({
|
|
2012
|
-
client_id: VERCEL_CLI_CLIENT_ID,
|
|
2013
|
-
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
2014
|
-
...options
|
|
2015
|
-
}),
|
|
2016
|
-
// TODO: Drop `node-fetch` and just use `signal`
|
|
2017
|
-
timeout: 10 * 1e3,
|
|
2018
|
-
// @ts-expect-error: Signal is part of `fetch` spec, should drop `node-fetch`
|
|
2019
|
-
signal: AbortSignal.timeout(10 * 1e3)
|
|
2020
|
-
})
|
|
2021
|
-
];
|
|
2022
|
-
} catch (error) {
|
|
2023
|
-
if (error instanceof Error)
|
|
2024
|
-
return [error];
|
|
2025
|
-
return [
|
|
2026
|
-
new Error("An unknown error occurred. See the logs for details.", {
|
|
2027
|
-
cause: error
|
|
2028
|
-
})
|
|
2029
|
-
];
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
async function processTokenResponse(response) {
|
|
2033
|
-
const json = await response.json();
|
|
2034
|
-
if (!response.ok) {
|
|
2035
|
-
return [new OAuthError("Device access token request failed", json)];
|
|
2036
|
-
}
|
|
2037
|
-
if (typeof json !== "object" || json === null)
|
|
2038
|
-
return [new TypeError("Expected response to be an object")];
|
|
2039
|
-
if (!("access_token" in json) || typeof json.access_token !== "string")
|
|
2040
|
-
return [new TypeError("Expected `access_token` to be a string")];
|
|
2041
|
-
if (!("token_type" in json) || json.token_type !== "Bearer")
|
|
2042
|
-
return [new TypeError('Expected `token_type` to be "Bearer"')];
|
|
2043
|
-
if (!("expires_in" in json) || typeof json.expires_in !== "number")
|
|
2044
|
-
return [new TypeError("Expected `expires_in` to be a number")];
|
|
2045
|
-
if ("refresh_token" in json && (typeof json.refresh_token !== "string" || !json.refresh_token))
|
|
2046
|
-
return [new TypeError("Expected `refresh_token` to be a string")];
|
|
2047
|
-
if ("scope" in json && typeof json.scope !== "string")
|
|
2048
|
-
return [new TypeError("Expected `scope` to be a string")];
|
|
2049
|
-
return [null, json];
|
|
2050
|
-
}
|
|
2051
|
-
async function revocationRequest(options) {
|
|
2052
|
-
return await (0, import_node_fetch.default)((await as()).revocation_endpoint, {
|
|
2053
|
-
method: "POST",
|
|
2054
|
-
headers: {
|
|
2055
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2056
|
-
"user-agent": userAgent
|
|
2057
|
-
},
|
|
2058
|
-
body: new URLSearchParams({ ...options, client_id: VERCEL_CLI_CLIENT_ID })
|
|
2059
|
-
});
|
|
2060
|
-
}
|
|
2061
|
-
async function processRevocationResponse(response) {
|
|
2062
|
-
if (response.ok)
|
|
2063
|
-
return [null, null];
|
|
2064
|
-
const json = await response.json();
|
|
2065
|
-
return [new OAuthError("Revocation request failed", json)];
|
|
2066
|
-
}
|
|
2067
|
-
async function refreshTokenRequest(options) {
|
|
2068
|
-
return await (0, import_node_fetch.default)((await as()).token_endpoint, {
|
|
2069
|
-
method: "POST",
|
|
2070
|
-
headers: {
|
|
2071
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2072
|
-
"user-agent": userAgent
|
|
2073
|
-
},
|
|
2074
|
-
body: new URLSearchParams({
|
|
2075
|
-
client_id: VERCEL_CLI_CLIENT_ID,
|
|
2076
|
-
grant_type: "refresh_token",
|
|
2077
|
-
...options
|
|
2078
|
-
})
|
|
2079
|
-
});
|
|
2080
|
-
}
|
|
2081
|
-
function processOAuthErrorResponse(json) {
|
|
2082
|
-
if (typeof json !== "object" || json === null)
|
|
2083
|
-
return new TypeError("Expected response to be an object");
|
|
2084
|
-
if (!("error" in json) || typeof json.error !== "string")
|
|
2085
|
-
return new TypeError("Expected `error` to be a string");
|
|
2086
|
-
if ("error_description" in json && typeof json.error_description !== "string")
|
|
2087
|
-
return new TypeError("Expected `error_description` to be a string");
|
|
2088
|
-
if ("error_uri" in json && typeof json.error_uri !== "string")
|
|
2089
|
-
return new TypeError("Expected `error_uri` to be a string");
|
|
2090
|
-
return json;
|
|
2091
|
-
}
|
|
2092
|
-
var OAuthError = class extends Error {
|
|
2093
|
-
constructor(message, response) {
|
|
2094
|
-
var __super = (...args) => {
|
|
2095
|
-
super(...args);
|
|
2096
|
-
};
|
|
2097
|
-
const error = processOAuthErrorResponse(response);
|
|
2098
|
-
if (error instanceof TypeError) {
|
|
2099
|
-
const message2 = `Unexpected server response: ${JSON.stringify(response)}`;
|
|
2100
|
-
__super(message2);
|
|
2101
|
-
this.cause = new Error(message2, { cause: error });
|
|
2102
|
-
this.code = "server_error";
|
|
2103
|
-
return;
|
|
2104
|
-
}
|
|
2105
|
-
let cause = error.error;
|
|
2106
|
-
if (error.error_description)
|
|
2107
|
-
cause += `: ${error.error_description}`;
|
|
2108
|
-
if (error.error_uri)
|
|
2109
|
-
cause += ` (${error.error_uri})`;
|
|
2110
|
-
__super(message, { cause });
|
|
2111
|
-
this.cause = new Error(cause);
|
|
2112
|
-
this.code = error.error;
|
|
2113
|
-
}
|
|
2114
|
-
};
|
|
2115
|
-
function isOAuthError(error) {
|
|
2116
|
-
return error instanceof OAuthError;
|
|
2117
|
-
}
|
|
2118
|
-
function canParseURL(url) {
|
|
2119
|
-
try {
|
|
2120
|
-
return !!new URL(url);
|
|
2121
|
-
} catch {
|
|
2122
|
-
return false;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
// src/commands/login/future.ts
|
|
2127
|
-
async function performDeviceCodeFlow(client, options) {
|
|
2128
|
-
const deviceAuthorizationResponse = await deviceAuthorizationRequest();
|
|
2129
|
-
output_manager_default.debug(
|
|
2130
|
-
`'Device Authorization response:', ${await deviceAuthorizationResponse.clone().text()}`
|
|
2131
|
-
);
|
|
2132
|
-
const [deviceAuthorizationError, deviceAuthorization] = await processDeviceAuthorizationResponse(deviceAuthorizationResponse);
|
|
2133
|
-
if (deviceAuthorizationError) {
|
|
2134
|
-
printError(deviceAuthorizationError);
|
|
2135
|
-
return null;
|
|
2136
|
-
}
|
|
2137
|
-
const { device_code, user_code, verification_uri, expiresAt, interval } = deviceAuthorization;
|
|
2138
|
-
let { verification_uri_complete } = deviceAuthorization;
|
|
2139
|
-
if (options?.teamId) {
|
|
2140
|
-
const url = new URL(verification_uri_complete);
|
|
2141
|
-
url.searchParams.set("team_id", options.teamId);
|
|
2142
|
-
verification_uri_complete = url.toString();
|
|
2143
|
-
}
|
|
2144
|
-
const isCursorAgent = client.agentName === KNOWN_AGENTS.CURSOR || client.agentName === KNOWN_AGENTS.CURSOR_CLI;
|
|
2145
|
-
const shouldSkipBrowser = process.env.CI && !isCursorAgent;
|
|
2146
|
-
output_manager_default.log(
|
|
2147
|
-
`
|
|
2148
|
-
Visit ${import_chalk3.default.bold(
|
|
2149
|
-
output_manager_default.link(
|
|
2150
|
-
verification_uri.replace("https://", ""),
|
|
2151
|
-
verification_uri_complete,
|
|
2152
|
-
{ color: false, fallback: () => verification_uri_complete }
|
|
2153
|
-
)
|
|
2154
|
-
)}${output_manager_default.supportsHyperlink ? ` and enter ${import_chalk3.default.bold(user_code)}` : ""}
|
|
2155
|
-
`
|
|
2156
|
-
);
|
|
2157
|
-
if (!shouldSkipBrowser) {
|
|
2158
|
-
try {
|
|
2159
|
-
const browserProcess = await open.default(verification_uri_complete);
|
|
2160
|
-
browserProcess.on("error", (error) => {
|
|
2161
|
-
output_manager_default.debug(`Failed to open browser: ${error}`);
|
|
2162
|
-
});
|
|
2163
|
-
} catch (error) {
|
|
2164
|
-
output_manager_default.debug(`Failed to open browser: ${error}`);
|
|
2165
|
-
if (client.isAgent && client.nonInteractive) {
|
|
2166
|
-
output_manager_default.log(
|
|
2167
|
-
`
|
|
2168
|
-
${import_chalk3.default.yellow("\u26A0")} ${import_chalk3.default.bold("Browser could not be opened automatically.")}
|
|
2169
|
-
`
|
|
2170
|
-
);
|
|
2171
|
-
output_manager_default.log(
|
|
2172
|
-
`Please ask the user to manually visit the URL above and complete the authentication process.
|
|
2173
|
-
`
|
|
2174
|
-
);
|
|
2175
|
-
}
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
const rl = readline3.createInterface({
|
|
2179
|
-
input: process.stdin,
|
|
2180
|
-
output: process.stdout
|
|
2181
|
-
}).on("SIGINT", () => {
|
|
2182
|
-
process.exit(0);
|
|
2183
|
-
});
|
|
2184
|
-
output_manager_default.spinner("Waiting for authentication...");
|
|
2185
|
-
let intervalMs = interval * 1e3;
|
|
2186
|
-
let result = null;
|
|
2187
|
-
let flowError = new Error(
|
|
2188
|
-
"Timed out waiting for authentication. Please try again."
|
|
2189
|
-
);
|
|
2190
|
-
async function pollForToken() {
|
|
2191
|
-
while (Date.now() < expiresAt) {
|
|
2192
|
-
const [tokenResponseError, tokenResponse] = await deviceAccessTokenRequest({ device_code });
|
|
2193
|
-
if (tokenResponseError) {
|
|
2194
|
-
if (tokenResponseError.message.includes("timeout")) {
|
|
2195
|
-
intervalMs *= 2;
|
|
2196
|
-
output_manager_default.debug(
|
|
2197
|
-
`Connection timeout. Slowing down, polling every ${intervalMs / 1e3}s...`
|
|
2198
|
-
);
|
|
2199
|
-
await wait(intervalMs);
|
|
2200
|
-
continue;
|
|
2201
|
-
}
|
|
2202
|
-
return tokenResponseError;
|
|
2203
|
-
}
|
|
2204
|
-
output_manager_default.debug(
|
|
2205
|
-
`'Device Access Token response:', ${await tokenResponse.clone().text()}`
|
|
2206
|
-
);
|
|
2207
|
-
const [tokensError, tokens] = await processTokenResponse(tokenResponse);
|
|
2208
|
-
if (isOAuthError(tokensError)) {
|
|
2209
|
-
const { code } = tokensError;
|
|
2210
|
-
switch (code) {
|
|
2211
|
-
case "authorization_pending":
|
|
2212
|
-
await wait(intervalMs);
|
|
2213
|
-
continue;
|
|
2214
|
-
case "slow_down":
|
|
2215
|
-
intervalMs += 5 * 1e3;
|
|
2216
|
-
output_manager_default.debug(
|
|
2217
|
-
`Authorization server requests to slow down. Polling every ${intervalMs / 1e3}s...`
|
|
2218
|
-
);
|
|
2219
|
-
await wait(intervalMs);
|
|
2220
|
-
continue;
|
|
2221
|
-
default:
|
|
2222
|
-
return tokensError.cause;
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
if (tokensError)
|
|
2226
|
-
return tokensError;
|
|
2227
|
-
output_manager_default.print((0, import_ansi_escapes3.eraseLines)(2));
|
|
2228
|
-
result = {
|
|
2229
|
-
access_token: tokens.access_token,
|
|
2230
|
-
expires_in: tokens.expires_in,
|
|
2231
|
-
refresh_token: tokens.refresh_token
|
|
2232
|
-
};
|
|
2233
|
-
return;
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
flowError = await pollForToken();
|
|
2237
|
-
output_manager_default.stopSpinner();
|
|
2238
|
-
rl.close();
|
|
2239
|
-
if (flowError) {
|
|
2240
|
-
printError(flowError);
|
|
2241
|
-
return null;
|
|
2242
|
-
}
|
|
2243
|
-
return result;
|
|
2244
|
-
}
|
|
2245
|
-
async function login(client, telemetry) {
|
|
2246
|
-
const tokens = await performDeviceCodeFlow(client);
|
|
2247
|
-
if (!tokens) {
|
|
2248
|
-
telemetry.trackState("error");
|
|
2249
|
-
return 1;
|
|
2250
|
-
}
|
|
2251
|
-
const isInitialLogin = !client.authConfig.token;
|
|
2252
|
-
client.updateAuthConfig({
|
|
2253
|
-
token: tokens.access_token,
|
|
2254
|
-
userId: void 0,
|
|
2255
|
-
expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in,
|
|
2256
|
-
refreshToken: tokens.refresh_token
|
|
2257
|
-
});
|
|
2258
|
-
client.updateConfig({ currentTeam: void 0 });
|
|
2259
|
-
if (isInitialLogin) {
|
|
2260
|
-
await updateCurrentTeamAfterLogin(client);
|
|
2261
|
-
}
|
|
2262
|
-
client.writeToAuthConfigFile();
|
|
2263
|
-
client.writeToConfigFile();
|
|
2264
|
-
output_manager_default.debug(`Saved credentials in "${humanizePath(client.getGlobalPathConfig())}"`);
|
|
2265
|
-
output_manager_default.print(`
|
|
2266
|
-
${import_chalk3.default.cyan("Congratulations!")} You are now signed in.
|
|
2267
|
-
|
|
2268
|
-
To deploy something, run ${getCommandName()}.
|
|
2269
|
-
|
|
2270
|
-
${emoji("tip")} To deploy every commit automatically,
|
|
2271
|
-
connect a Git Repository (${import_chalk3.default.bold(output_manager_default.link("vercel.link/git", "https://vercel.link/git", { color: false }))}).
|
|
2272
|
-
`);
|
|
2273
|
-
telemetry.trackState("success");
|
|
2274
|
-
await autoInstallVercelPlugin(client);
|
|
2275
|
-
return 0;
|
|
2276
|
-
}
|
|
2277
|
-
async function wait(intervalMs) {
|
|
2278
|
-
await new Promise((resolve2) => setTimeout(resolve2, intervalMs));
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
// src/util/login/reauthenticate.ts
|
|
2282
1546
|
async function reauthenticate(client, error) {
|
|
2283
1547
|
const { tokenSource } = client.authConfig;
|
|
2284
1548
|
const reauthAction = error.enforced ? "SAML re-authentication is required" : "Re-authentication is required";
|
|
2285
1549
|
if (tokenSource === "flag") {
|
|
2286
1550
|
throw new Error(
|
|
2287
|
-
`${reauthAction} for ${(0,
|
|
1551
|
+
`${reauthAction} for ${(0, import_chalk3.bold)(error.scope)} scope, but the token provided via \`--token\` does not have access. Provide a token that is authorized for that scope.`
|
|
2288
1552
|
);
|
|
2289
1553
|
}
|
|
2290
1554
|
if (tokenSource === "env") {
|
|
2291
1555
|
throw new Error(
|
|
2292
|
-
`${reauthAction} for ${(0,
|
|
1556
|
+
`${reauthAction} for ${(0, import_chalk3.bold)(error.scope)} scope, but the token provided via the VERCEL_TOKEN environment variable does not have access. Set VERCEL_TOKEN to a token that is authorized for that scope.`
|
|
2293
1557
|
);
|
|
2294
1558
|
}
|
|
2295
|
-
if (!client.stdin.isTTY) {
|
|
1559
|
+
if (!client.stdin.isTTY && process.env.CI) {
|
|
2296
1560
|
throw new Error(
|
|
2297
|
-
`${reauthAction} for ${(0,
|
|
1561
|
+
`${reauthAction} for ${(0, import_chalk3.bold)(error.scope)} scope, but the current environment is non-interactive so the device-code flow cannot be completed. Run \`vercel login\` in an interactive shell, or set VERCEL_TOKEN / pass \`--token\` with a token that is authorized for that scope.`
|
|
2298
1562
|
);
|
|
2299
1563
|
}
|
|
2300
1564
|
if (error.teamId && error.enforced) {
|
|
2301
1565
|
output_manager_default.log(
|
|
2302
|
-
`You must re-authenticate with SAML to use ${(0,
|
|
1566
|
+
`You must re-authenticate with SAML to use ${(0, import_chalk3.bold)(error.scope)} scope.`
|
|
2303
1567
|
);
|
|
2304
1568
|
} else {
|
|
2305
|
-
output_manager_default.log(`You must re-authenticate to use ${(0,
|
|
1569
|
+
output_manager_default.log(`You must re-authenticate to use ${(0, import_chalk3.bold)(error.scope)} scope.`);
|
|
2306
1570
|
}
|
|
2307
1571
|
const tokens = await performDeviceCodeFlow(client, {
|
|
2308
1572
|
teamId: error.teamId || void 0
|
|
@@ -2317,7 +1581,7 @@ async function reauthenticate(client, error) {
|
|
|
2317
1581
|
refreshToken: tokens.refresh_token
|
|
2318
1582
|
});
|
|
2319
1583
|
client.writeToAuthConfigFile();
|
|
2320
|
-
output_manager_default.success(`Authentication complete for ${(0,
|
|
1584
|
+
output_manager_default.success(`Authentication complete for ${(0, import_chalk3.bold)(error.scope)} scope.`);
|
|
2321
1585
|
return { token: tokens.access_token, email: "" };
|
|
2322
1586
|
}
|
|
2323
1587
|
|
|
@@ -2376,7 +1640,7 @@ var Client = class extends EventEmitter {
|
|
|
2376
1640
|
output_manager_default.prettyError(error);
|
|
2377
1641
|
} else {
|
|
2378
1642
|
output_manager_default.error(
|
|
2379
|
-
`Failed to re-authenticate for ${(0,
|
|
1643
|
+
`Failed to re-authenticate for ${(0, import_chalk4.bold)(error.scope)} scope`
|
|
2380
1644
|
);
|
|
2381
1645
|
}
|
|
2382
1646
|
throw error;
|
|
@@ -2403,8 +1667,8 @@ ${error.stack}`);
|
|
|
2403
1667
|
this.nonInteractive = opts.nonInteractive ?? this.isAgent;
|
|
2404
1668
|
this.dangerouslySkipPermissions = opts.dangerouslySkipPermissions ?? false;
|
|
2405
1669
|
const theme = {
|
|
2406
|
-
prefix: (0,
|
|
2407
|
-
style: { answer:
|
|
1670
|
+
prefix: (0, import_chalk4.gray)("?"),
|
|
1671
|
+
style: { answer: import_chalk4.gray }
|
|
2408
1672
|
};
|
|
2409
1673
|
this.input = {
|
|
2410
1674
|
text: (opts2) => esm_default6({ theme, ...opts2 }, { input: this.stdin, output: this.stderr }),
|
|
@@ -2576,18 +1840,18 @@ ${error.stack}`);
|
|
|
2576
1840
|
const agentInfo = this.agentName ? ` (${this.agentName})` : "";
|
|
2577
1841
|
output_manager_default.print("\n");
|
|
2578
1842
|
output_manager_default.print(
|
|
2579
|
-
(0,
|
|
1843
|
+
(0, import_chalk4.bgRed)((0, import_chalk4.white)((0, import_chalk4.bold)(" \u26A0 WARNING "))) + (0, import_chalk4.red)((0, import_chalk4.bold)(" AGENT MODE - DELETE CONFIRMATION BYPASSED\n"))
|
|
2580
1844
|
);
|
|
2581
1845
|
output_manager_default.print(
|
|
2582
|
-
(0,
|
|
2583
|
-
` An AI agent${agentInfo} is executing a ${(0,
|
|
1846
|
+
(0, import_chalk4.yellow)(
|
|
1847
|
+
` An AI agent${agentInfo} is executing a ${(0, import_chalk4.bold)("DELETE")} request with --dangerously-skip-permissions flag.
|
|
2584
1848
|
`
|
|
2585
1849
|
)
|
|
2586
1850
|
);
|
|
2587
|
-
output_manager_default.print((0,
|
|
1851
|
+
output_manager_default.print((0, import_chalk4.yellow)(` This operation will delete data: ${(0, import_chalk4.bold)(url)}
|
|
2588
1852
|
`));
|
|
2589
1853
|
output_manager_default.print(
|
|
2590
|
-
(0,
|
|
1854
|
+
(0, import_chalk4.yellow)(
|
|
2591
1855
|
` The --dangerously-skip-permissions flag has bypassed the confirmation prompt.
|
|
2592
1856
|
|
|
2593
1857
|
`
|
|
@@ -2599,12 +1863,12 @@ ${error.stack}`);
|
|
|
2599
1863
|
}
|
|
2600
1864
|
if (!this.stdin.isTTY) {
|
|
2601
1865
|
output_manager_default.error(
|
|
2602
|
-
`DELETE operations require confirmation. Use ${(0,
|
|
1866
|
+
`DELETE operations require confirmation. Use ${(0, import_chalk4.bold)("--dangerously-skip-permissions")} to skip confirmation in non-interactive mode.`
|
|
2603
1867
|
);
|
|
2604
1868
|
return false;
|
|
2605
1869
|
}
|
|
2606
|
-
const message = `You are about to perform a ${(0,
|
|
2607
|
-
${(0,
|
|
1870
|
+
const message = `You are about to perform a ${(0, import_chalk4.red)((0, import_chalk4.bold)("DELETE"))} operation on:
|
|
1871
|
+
${(0, import_chalk4.bold)(url)}
|
|
2608
1872
|
|
|
2609
1873
|
Are you sure you want to proceed?`;
|
|
2610
1874
|
output_manager_default.print("\n");
|
|
@@ -2616,7 +1880,7 @@ Are you sure you want to proceed?`;
|
|
|
2616
1880
|
return confirmed;
|
|
2617
1881
|
}
|
|
2618
1882
|
async _fetch(_url, opts = {}) {
|
|
2619
|
-
const url = new
|
|
1883
|
+
const url = new URL(_url, this.apiUrl);
|
|
2620
1884
|
if (opts.accountId || opts.useCurrentTeam !== false) {
|
|
2621
1885
|
if (opts.accountId) {
|
|
2622
1886
|
if (opts.accountId.startsWith("team_")) {
|
|
@@ -2628,7 +1892,7 @@ Are you sure you want to proceed?`;
|
|
|
2628
1892
|
url.searchParams.set("teamId", this.config.currentTeam);
|
|
2629
1893
|
}
|
|
2630
1894
|
}
|
|
2631
|
-
const headers = new
|
|
1895
|
+
const headers = new import_node_fetch.Headers(opts.headers);
|
|
2632
1896
|
headers.set("user-agent", ua_default);
|
|
2633
1897
|
if (this.agentName) {
|
|
2634
1898
|
headers.set("x-ai-agent", this.agentName);
|
|
@@ -2653,12 +1917,20 @@ Are you sure you want to proceed?`;
|
|
|
2653
1917
|
return `#${requestId} \u2192 ${opts.method || "GET"} ${url.href}`;
|
|
2654
1918
|
}
|
|
2655
1919
|
},
|
|
2656
|
-
(0,
|
|
1920
|
+
(0, import_node_fetch.default)(url, { agent: this.agent, ...opts, headers, body })
|
|
2657
1921
|
);
|
|
2658
1922
|
}
|
|
2659
1923
|
fetch(url, opts = {}) {
|
|
2660
1924
|
return this.retry(async (bail) => {
|
|
2661
|
-
|
|
1925
|
+
let res;
|
|
1926
|
+
try {
|
|
1927
|
+
res = await this._fetch(url, opts);
|
|
1928
|
+
} catch (err) {
|
|
1929
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
1930
|
+
return bail(err);
|
|
1931
|
+
}
|
|
1932
|
+
throw err;
|
|
1933
|
+
}
|
|
2662
1934
|
printIndications(res);
|
|
2663
1935
|
if (!res.ok) {
|
|
2664
1936
|
if (opts.redirect === "manual" && res.status >= 300 && res.status < 400) {
|
|
@@ -2692,7 +1964,7 @@ Are you sure you want to proceed?`;
|
|
|
2692
1964
|
}, opts.retry);
|
|
2693
1965
|
}
|
|
2694
1966
|
async *fetchPaginated(url, opts) {
|
|
2695
|
-
const endpoint = typeof url === "string" ? new
|
|
1967
|
+
const endpoint = typeof url === "string" ? new URL(url, this.apiUrl) : new URL(url.href);
|
|
2696
1968
|
if (!endpoint.searchParams.has("limit")) {
|
|
2697
1969
|
endpoint.searchParams.set("limit", "100");
|
|
2698
1970
|
}
|
|
@@ -2722,10 +1994,6 @@ export {
|
|
|
2722
1994
|
getGlobalPathConfig2 as getGlobalPathConfig,
|
|
2723
1995
|
require_dist3 as require_dist,
|
|
2724
1996
|
printIndications,
|
|
2725
|
-
require_open,
|
|
2726
|
-
revocationRequest,
|
|
2727
|
-
processRevocationResponse,
|
|
2728
|
-
login,
|
|
2729
1997
|
readConfigFile,
|
|
2730
1998
|
writeToConfigFile,
|
|
2731
1999
|
readAuthConfigFile2 as readAuthConfigFile,
|