vercel 56.4.0 → 56.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{add-XY2LNFK3.js → add-6GRH6G2M.js} +4 -4
- package/dist/chunks/{add-2HLAH42D.js → add-KNK5E2YT.js} +3 -3
- package/dist/chunks/{chunk-WM3UMX65.js → chunk-23U6FANO.js} +1 -1
- package/dist/chunks/chunk-2473DUBR.js +15 -0
- package/dist/chunks/{chunk-C4TEOOGB.js → chunk-26TEKOBZ.js} +63 -6
- package/dist/chunks/{chunk-S7HMSWGQ.js → chunk-3BHSS5E2.js} +2 -2
- package/dist/chunks/{chunk-PEC4ROHM.js → chunk-4MK452Y5.js} +5 -5
- package/dist/chunks/{chunk-ORMDX3GR.js → chunk-ARKHETJP.js} +1 -1
- package/dist/chunks/chunk-BM36UWE2.js +245 -0
- package/dist/chunks/{chunk-VZGX4CKB.js → chunk-CM3DLBDY.js} +1 -1
- package/dist/chunks/{chunk-SLCLT4P5.js → chunk-DI3HR3K6.js} +1 -1
- package/dist/chunks/{chunk-OSXJ6G4O.js → chunk-DOF6CJLL.js} +3 -3
- package/dist/chunks/chunk-E336ZXPP.js +43 -0
- package/dist/chunks/{chunk-K6YMSJMZ.js → chunk-EYICIM2K.js} +4 -4
- package/dist/chunks/chunk-FHEMFAHB.js +320 -0
- package/dist/chunks/{chunk-JGXABANG.js → chunk-G4MTGCZ5.js} +1 -1
- package/dist/chunks/{chunk-IN3RG4AU.js → chunk-GAOAGU5K.js} +1 -1
- package/dist/chunks/{chunk-UA3D44SL.js → chunk-GNV7547O.js} +1 -1
- package/dist/chunks/{chunk-2KNVJ7ET.js → chunk-IBP2XAUH.js} +103 -3
- package/dist/chunks/{chunk-JIK3GTU3.js → chunk-JQG5EDRD.js} +1 -1
- package/dist/chunks/{chunk-ENIJVO7C.js → chunk-PPEQUJ7T.js} +2 -2
- package/dist/chunks/{chunk-EJNFC5AV.js → chunk-PRYNIKBZ.js} +1 -1
- package/dist/chunks/{chunk-BRTMH4PL.js → chunk-SWEPOMSA.js} +1 -1
- package/dist/chunks/{chunk-QX4337BT.js → chunk-TMK6RSYW.js} +842 -842
- package/dist/chunks/chunk-WR7JTCGL.js +104 -0
- package/dist/chunks/{chunk-4QRRJEYO.js → chunk-X43U65TH.js} +2 -2
- package/dist/chunks/chunk-YTFJGKRG.js +247 -0
- package/dist/chunks/{compile-vercel-config-4Q4YZ44O.js → compile-vercel-config-IFET4E6H.js} +2 -2
- package/dist/chunks/config-validator.mjs +1 -0
- package/dist/chunks/{delete-AUDPLCMU.js → delete-PXB5WRH7.js} +3 -3
- package/dist/chunks/delete-X2MUMONI.js +150 -0
- package/dist/chunks/{disable-WFPXR7GZ.js → disable-GBL3SHJL.js} +3 -3
- package/dist/chunks/{discard-RVFKIZZG.js → discard-XVVSRGDR.js} +3 -3
- package/dist/chunks/{edit-KO5KX4WU.js → edit-EIHRP6XT.js} +4 -4
- package/dist/chunks/edit-K5Y2BDJO.js +153 -0
- package/dist/chunks/{enable-I5HE32DI.js → enable-W7AMJWKH.js} +3 -3
- package/dist/chunks/{export-4Y5L2TOT.js → export-N3AZ2KOO.js} +3 -3
- package/dist/chunks/{image-QC5MVWKN.js → image-DRTGVPVJ.js} +3 -3
- package/dist/chunks/{inspect-Q5BKZNVI.js → inspect-5YUAEI3L.js} +3 -3
- package/dist/chunks/{inspect-BULBAPNR.js → inspect-AAIVWSJI.js} +3 -3
- package/dist/chunks/{inspect-JUGFKEGR.js → inspect-DYXTX6P4.js} +3 -3
- package/dist/chunks/{inspect-PJDCPARM.js → inspect-IPSAYR2C.js} +3 -3
- package/dist/chunks/inspect-SLZLI6ZC.js +205 -0
- package/dist/chunks/{list-FJT44SB6.js → list-IF2YW73F.js} +2 -2
- package/dist/chunks/list-K2HLGUXV.js +360 -0
- package/dist/chunks/{list-N7OA4FBI.js → list-V7VTXVK4.js} +3 -3
- package/dist/chunks/{login-BPE774JW.js → login-7C6HQEOG.js} +3 -3
- package/dist/chunks/{ls-YV554CRJ.js → ls-2NU353QP.js} +3 -3
- package/dist/chunks/{ls-H52WO65Y.js → ls-NKECPPOR.js} +3 -3
- package/dist/chunks/{ls-E47M6P5O.js → ls-QQQHOJBE.js} +3 -3
- package/dist/chunks/{ls-26VFGQ6P.js → ls-RH6Y4XBS.js} +4 -4
- package/dist/chunks/open-2FAPZA6V.js +106 -0
- package/dist/chunks/{publish-DUTEBRX3.js → publish-G7PB64LJ.js} +3 -3
- package/dist/chunks/{query-QDOKUCHX.js → query-D4QBT4WR.js} +2 -2
- package/dist/chunks/{reorder-L2M3YGJ4.js → reorder-3Z7YIPAX.js} +3 -3
- package/dist/chunks/reply-7QQBXL5H.js +167 -0
- package/dist/chunks/resolve-UYKTDZEX.js +228 -0
- package/dist/chunks/{restore-BVDNAJVC.js → restore-Q2DR7SMW.js} +3 -3
- package/dist/chunks/{rm-VHWBHG3A.js → rm-O4M4GFSK.js} +3 -3
- package/dist/chunks/{rm-7KSHXSTB.js → rm-OCLUTM57.js} +4 -4
- package/dist/chunks/{rm-4OQ7G6UX.js → rm-PCWMEHQ2.js} +3 -3
- package/dist/chunks/{rule-inspect-AT6IEOUF.js → rule-inspect-XJ47UEG7.js} +4 -4
- package/dist/chunks/{rules-SQFCUKWS.js → rules-LIH5FLPJ.js} +6 -6
- package/dist/chunks/{schema-PWSCMD24.js → schema-OFALTXXM.js} +2 -2
- package/dist/chunks/{tags-BT7ZGJP2.js → tags-P4HIAI6D.js} +2 -2
- package/dist/chunks/{update-PTDGBKEH.js → update-E3ZQAFBS.js} +4 -4
- package/dist/commands/build/index.js +11 -11
- package/dist/commands/deploy/index.js +13 -12
- package/dist/commands/dev/index.js +10 -10
- package/dist/commands/env/index.js +9 -8
- package/dist/commands/link/index.js +8 -7
- package/dist/commands/list/index.js +5 -5
- package/dist/commands-bulk.js +2744 -1982
- package/dist/index.js +19 -8
- package/dist/vc.js +6 -1
- package/dist/version.mjs +1 -1
- package/package.json +92 -12
|
@@ -4,6 +4,11 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
TelemetryClient,
|
|
9
|
+
require_dist as require_dist2,
|
|
10
|
+
require_graceful_fs
|
|
11
|
+
} from "./chunk-ECCWJHC6.js";
|
|
7
12
|
import {
|
|
8
13
|
AGENT_REASON,
|
|
9
14
|
AGENT_STATUS,
|
|
@@ -15,11 +20,6 @@ import {
|
|
|
15
20
|
outputAgentError,
|
|
16
21
|
shouldEmitNonInteractiveCommandError
|
|
17
22
|
} from "./chunk-UDWRZXIT.js";
|
|
18
|
-
import {
|
|
19
|
-
TelemetryClient,
|
|
20
|
-
require_dist as require_dist2,
|
|
21
|
-
require_graceful_fs
|
|
22
|
-
} from "./chunk-ECCWJHC6.js";
|
|
23
23
|
import {
|
|
24
24
|
parseArguments,
|
|
25
25
|
printError,
|
|
@@ -6157,34 +6157,34 @@ var require_ajv = __commonJS({
|
|
|
6157
6157
|
var rules = require_rules();
|
|
6158
6158
|
var $dataMetaSchema = require_data();
|
|
6159
6159
|
var util = require_util();
|
|
6160
|
-
module.exports =
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6160
|
+
module.exports = Ajv;
|
|
6161
|
+
Ajv.prototype.validate = validate;
|
|
6162
|
+
Ajv.prototype.compile = compile;
|
|
6163
|
+
Ajv.prototype.addSchema = addSchema;
|
|
6164
|
+
Ajv.prototype.addMetaSchema = addMetaSchema;
|
|
6165
|
+
Ajv.prototype.validateSchema = validateSchema;
|
|
6166
|
+
Ajv.prototype.getSchema = getSchema;
|
|
6167
|
+
Ajv.prototype.removeSchema = removeSchema;
|
|
6168
|
+
Ajv.prototype.addFormat = addFormat;
|
|
6169
|
+
Ajv.prototype.errorsText = errorsText;
|
|
6170
|
+
Ajv.prototype._addSchema = _addSchema;
|
|
6171
|
+
Ajv.prototype._compile = _compile;
|
|
6172
|
+
Ajv.prototype.compileAsync = require_async();
|
|
6173
6173
|
var customKeyword = require_keyword();
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6174
|
+
Ajv.prototype.addKeyword = customKeyword.add;
|
|
6175
|
+
Ajv.prototype.getKeyword = customKeyword.get;
|
|
6176
|
+
Ajv.prototype.removeKeyword = customKeyword.remove;
|
|
6177
|
+
Ajv.prototype.validateKeyword = customKeyword.validate;
|
|
6178
6178
|
var errorClasses = require_error_classes();
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6179
|
+
Ajv.ValidationError = errorClasses.Validation;
|
|
6180
|
+
Ajv.MissingRefError = errorClasses.MissingRef;
|
|
6181
|
+
Ajv.$dataMetaSchema = $dataMetaSchema;
|
|
6182
6182
|
var META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
|
|
6183
6183
|
var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes", "strictDefaults"];
|
|
6184
6184
|
var META_SUPPORT_DATA = ["/properties"];
|
|
6185
|
-
function
|
|
6186
|
-
if (!(this instanceof
|
|
6187
|
-
return new
|
|
6185
|
+
function Ajv(opts) {
|
|
6186
|
+
if (!(this instanceof Ajv))
|
|
6187
|
+
return new Ajv(opts);
|
|
6188
6188
|
opts = this._opts = util.copy(opts) || {};
|
|
6189
6189
|
setLogger(this);
|
|
6190
6190
|
this._schemas = {};
|
|
@@ -34962,6 +34962,330 @@ var require_dist6 = __commonJS({
|
|
|
34962
34962
|
}
|
|
34963
34963
|
});
|
|
34964
34964
|
|
|
34965
|
+
// ../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js
|
|
34966
|
+
var require_is_docker = __commonJS({
|
|
34967
|
+
"../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports, module) {
|
|
34968
|
+
"use strict";
|
|
34969
|
+
var fs5 = __require("fs");
|
|
34970
|
+
var isDocker;
|
|
34971
|
+
function hasDockerEnv() {
|
|
34972
|
+
try {
|
|
34973
|
+
fs5.statSync("/.dockerenv");
|
|
34974
|
+
return true;
|
|
34975
|
+
} catch (_) {
|
|
34976
|
+
return false;
|
|
34977
|
+
}
|
|
34978
|
+
}
|
|
34979
|
+
function hasDockerCGroup() {
|
|
34980
|
+
try {
|
|
34981
|
+
return fs5.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
34982
|
+
} catch (_) {
|
|
34983
|
+
return false;
|
|
34984
|
+
}
|
|
34985
|
+
}
|
|
34986
|
+
module.exports = () => {
|
|
34987
|
+
if (isDocker === void 0) {
|
|
34988
|
+
isDocker = hasDockerEnv() || hasDockerCGroup();
|
|
34989
|
+
}
|
|
34990
|
+
return isDocker;
|
|
34991
|
+
};
|
|
34992
|
+
}
|
|
34993
|
+
});
|
|
34994
|
+
|
|
34995
|
+
// ../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js
|
|
34996
|
+
var require_is_wsl = __commonJS({
|
|
34997
|
+
"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports, module) {
|
|
34998
|
+
"use strict";
|
|
34999
|
+
var os3 = __require("os");
|
|
35000
|
+
var fs5 = __require("fs");
|
|
35001
|
+
var isDocker = require_is_docker();
|
|
35002
|
+
var isWsl = () => {
|
|
35003
|
+
if (process.platform !== "linux") {
|
|
35004
|
+
return false;
|
|
35005
|
+
}
|
|
35006
|
+
if (os3.release().toLowerCase().includes("microsoft")) {
|
|
35007
|
+
if (isDocker()) {
|
|
35008
|
+
return false;
|
|
35009
|
+
}
|
|
35010
|
+
return true;
|
|
35011
|
+
}
|
|
35012
|
+
try {
|
|
35013
|
+
return fs5.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
|
|
35014
|
+
} catch (_) {
|
|
35015
|
+
return false;
|
|
35016
|
+
}
|
|
35017
|
+
};
|
|
35018
|
+
if (process.env.__IS_WSL_TEST__) {
|
|
35019
|
+
module.exports = isWsl;
|
|
35020
|
+
} else {
|
|
35021
|
+
module.exports = isWsl();
|
|
35022
|
+
}
|
|
35023
|
+
}
|
|
35024
|
+
});
|
|
35025
|
+
|
|
35026
|
+
// ../../node_modules/.pnpm/define-lazy-prop@2.0.0/node_modules/define-lazy-prop/index.js
|
|
35027
|
+
var require_define_lazy_prop = __commonJS({
|
|
35028
|
+
"../../node_modules/.pnpm/define-lazy-prop@2.0.0/node_modules/define-lazy-prop/index.js"(exports, module) {
|
|
35029
|
+
"use strict";
|
|
35030
|
+
module.exports = (object, propertyName, fn) => {
|
|
35031
|
+
const define2 = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
35032
|
+
Object.defineProperty(object, propertyName, {
|
|
35033
|
+
configurable: true,
|
|
35034
|
+
enumerable: true,
|
|
35035
|
+
get() {
|
|
35036
|
+
const result = fn();
|
|
35037
|
+
define2(result);
|
|
35038
|
+
return result;
|
|
35039
|
+
},
|
|
35040
|
+
set(value) {
|
|
35041
|
+
define2(value);
|
|
35042
|
+
}
|
|
35043
|
+
});
|
|
35044
|
+
return object;
|
|
35045
|
+
};
|
|
35046
|
+
}
|
|
35047
|
+
});
|
|
35048
|
+
|
|
35049
|
+
// ../../node_modules/.pnpm/open@8.4.0/node_modules/open/index.js
|
|
35050
|
+
var require_open = __commonJS({
|
|
35051
|
+
"../../node_modules/.pnpm/open@8.4.0/node_modules/open/index.js"(exports, module) {
|
|
35052
|
+
var path = __require("path");
|
|
35053
|
+
var childProcess = __require("child_process");
|
|
35054
|
+
var { promises: fs5, constants: fsConstants } = __require("fs");
|
|
35055
|
+
var isWsl = require_is_wsl();
|
|
35056
|
+
var isDocker = require_is_docker();
|
|
35057
|
+
var defineLazyProperty = require_define_lazy_prop();
|
|
35058
|
+
var localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
35059
|
+
var { platform, arch } = process;
|
|
35060
|
+
var getWslDrivesMountPoint = (() => {
|
|
35061
|
+
const defaultMountPoint = "/mnt/";
|
|
35062
|
+
let mountPoint;
|
|
35063
|
+
return async function() {
|
|
35064
|
+
if (mountPoint) {
|
|
35065
|
+
return mountPoint;
|
|
35066
|
+
}
|
|
35067
|
+
const configFilePath = "/etc/wsl.conf";
|
|
35068
|
+
let isConfigFileExists = false;
|
|
35069
|
+
try {
|
|
35070
|
+
await fs5.access(configFilePath, fsConstants.F_OK);
|
|
35071
|
+
isConfigFileExists = true;
|
|
35072
|
+
} catch {
|
|
35073
|
+
}
|
|
35074
|
+
if (!isConfigFileExists) {
|
|
35075
|
+
return defaultMountPoint;
|
|
35076
|
+
}
|
|
35077
|
+
const configContent = await fs5.readFile(configFilePath, { encoding: "utf8" });
|
|
35078
|
+
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
35079
|
+
if (!configMountPoint) {
|
|
35080
|
+
return defaultMountPoint;
|
|
35081
|
+
}
|
|
35082
|
+
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
35083
|
+
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
35084
|
+
return mountPoint;
|
|
35085
|
+
};
|
|
35086
|
+
})();
|
|
35087
|
+
var pTryEach = async (array, mapper) => {
|
|
35088
|
+
let latestError;
|
|
35089
|
+
for (const item of array) {
|
|
35090
|
+
try {
|
|
35091
|
+
return await mapper(item);
|
|
35092
|
+
} catch (error) {
|
|
35093
|
+
latestError = error;
|
|
35094
|
+
}
|
|
35095
|
+
}
|
|
35096
|
+
throw latestError;
|
|
35097
|
+
};
|
|
35098
|
+
var baseOpen = async (options) => {
|
|
35099
|
+
options = {
|
|
35100
|
+
wait: false,
|
|
35101
|
+
background: false,
|
|
35102
|
+
newInstance: false,
|
|
35103
|
+
allowNonzeroExitCode: false,
|
|
35104
|
+
...options
|
|
35105
|
+
};
|
|
35106
|
+
if (Array.isArray(options.app)) {
|
|
35107
|
+
return pTryEach(options.app, (singleApp) => baseOpen({
|
|
35108
|
+
...options,
|
|
35109
|
+
app: singleApp
|
|
35110
|
+
}));
|
|
35111
|
+
}
|
|
35112
|
+
let { name: app, arguments: appArguments = [] } = options.app || {};
|
|
35113
|
+
appArguments = [...appArguments];
|
|
35114
|
+
if (Array.isArray(app)) {
|
|
35115
|
+
return pTryEach(app, (appName) => baseOpen({
|
|
35116
|
+
...options,
|
|
35117
|
+
app: {
|
|
35118
|
+
name: appName,
|
|
35119
|
+
arguments: appArguments
|
|
35120
|
+
}
|
|
35121
|
+
}));
|
|
35122
|
+
}
|
|
35123
|
+
let command;
|
|
35124
|
+
const cliArguments = [];
|
|
35125
|
+
const childProcessOptions = {};
|
|
35126
|
+
if (platform === "darwin") {
|
|
35127
|
+
command = "open";
|
|
35128
|
+
if (options.wait) {
|
|
35129
|
+
cliArguments.push("--wait-apps");
|
|
35130
|
+
}
|
|
35131
|
+
if (options.background) {
|
|
35132
|
+
cliArguments.push("--background");
|
|
35133
|
+
}
|
|
35134
|
+
if (options.newInstance) {
|
|
35135
|
+
cliArguments.push("--new");
|
|
35136
|
+
}
|
|
35137
|
+
if (app) {
|
|
35138
|
+
cliArguments.push("-a", app);
|
|
35139
|
+
}
|
|
35140
|
+
} else if (platform === "win32" || isWsl && !isDocker()) {
|
|
35141
|
+
const mountPoint = await getWslDrivesMountPoint();
|
|
35142
|
+
command = isWsl ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` : `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
|
|
35143
|
+
cliArguments.push(
|
|
35144
|
+
"-NoProfile",
|
|
35145
|
+
"-NonInteractive",
|
|
35146
|
+
"\u2013ExecutionPolicy",
|
|
35147
|
+
"Bypass",
|
|
35148
|
+
"-EncodedCommand"
|
|
35149
|
+
);
|
|
35150
|
+
if (!isWsl) {
|
|
35151
|
+
childProcessOptions.windowsVerbatimArguments = true;
|
|
35152
|
+
}
|
|
35153
|
+
const encodedArguments = ["Start"];
|
|
35154
|
+
if (options.wait) {
|
|
35155
|
+
encodedArguments.push("-Wait");
|
|
35156
|
+
}
|
|
35157
|
+
if (app) {
|
|
35158
|
+
encodedArguments.push(`"\`"${app}\`""`, "-ArgumentList");
|
|
35159
|
+
if (options.target) {
|
|
35160
|
+
appArguments.unshift(options.target);
|
|
35161
|
+
}
|
|
35162
|
+
} else if (options.target) {
|
|
35163
|
+
encodedArguments.push(`"${options.target}"`);
|
|
35164
|
+
}
|
|
35165
|
+
if (appArguments.length > 0) {
|
|
35166
|
+
appArguments = appArguments.map((arg) => `"\`"${arg}\`""`);
|
|
35167
|
+
encodedArguments.push(appArguments.join(","));
|
|
35168
|
+
}
|
|
35169
|
+
options.target = Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
|
|
35170
|
+
} else {
|
|
35171
|
+
if (app) {
|
|
35172
|
+
command = app;
|
|
35173
|
+
} else {
|
|
35174
|
+
const isBundled = !__dirname || __dirname === "/";
|
|
35175
|
+
let exeLocalXdgOpen = false;
|
|
35176
|
+
try {
|
|
35177
|
+
await fs5.access(localXdgOpenPath, fsConstants.X_OK);
|
|
35178
|
+
exeLocalXdgOpen = true;
|
|
35179
|
+
} catch {
|
|
35180
|
+
}
|
|
35181
|
+
const useSystemXdgOpen = process.versions.electron || platform === "android" || isBundled || !exeLocalXdgOpen;
|
|
35182
|
+
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
35183
|
+
}
|
|
35184
|
+
if (appArguments.length > 0) {
|
|
35185
|
+
cliArguments.push(...appArguments);
|
|
35186
|
+
}
|
|
35187
|
+
if (!options.wait) {
|
|
35188
|
+
childProcessOptions.stdio = "ignore";
|
|
35189
|
+
childProcessOptions.detached = true;
|
|
35190
|
+
}
|
|
35191
|
+
}
|
|
35192
|
+
if (options.target) {
|
|
35193
|
+
cliArguments.push(options.target);
|
|
35194
|
+
}
|
|
35195
|
+
if (platform === "darwin" && appArguments.length > 0) {
|
|
35196
|
+
cliArguments.push("--args", ...appArguments);
|
|
35197
|
+
}
|
|
35198
|
+
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
35199
|
+
if (options.wait) {
|
|
35200
|
+
return new Promise((resolve4, reject) => {
|
|
35201
|
+
subprocess.once("error", reject);
|
|
35202
|
+
subprocess.once("close", (exitCode) => {
|
|
35203
|
+
if (options.allowNonzeroExitCode && exitCode > 0) {
|
|
35204
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
35205
|
+
return;
|
|
35206
|
+
}
|
|
35207
|
+
resolve4(subprocess);
|
|
35208
|
+
});
|
|
35209
|
+
});
|
|
35210
|
+
}
|
|
35211
|
+
subprocess.unref();
|
|
35212
|
+
return subprocess;
|
|
35213
|
+
};
|
|
35214
|
+
var open2 = (target, options) => {
|
|
35215
|
+
if (typeof target !== "string") {
|
|
35216
|
+
throw new TypeError("Expected a `target`");
|
|
35217
|
+
}
|
|
35218
|
+
return baseOpen({
|
|
35219
|
+
...options,
|
|
35220
|
+
target
|
|
35221
|
+
});
|
|
35222
|
+
};
|
|
35223
|
+
var openApp = (name, options) => {
|
|
35224
|
+
if (typeof name !== "string") {
|
|
35225
|
+
throw new TypeError("Expected a `name`");
|
|
35226
|
+
}
|
|
35227
|
+
const { arguments: appArguments = [] } = options || {};
|
|
35228
|
+
if (appArguments !== void 0 && appArguments !== null && !Array.isArray(appArguments)) {
|
|
35229
|
+
throw new TypeError("Expected `appArguments` as Array type");
|
|
35230
|
+
}
|
|
35231
|
+
return baseOpen({
|
|
35232
|
+
...options,
|
|
35233
|
+
app: {
|
|
35234
|
+
name,
|
|
35235
|
+
arguments: appArguments
|
|
35236
|
+
}
|
|
35237
|
+
});
|
|
35238
|
+
};
|
|
35239
|
+
function detectArchBinary(binary) {
|
|
35240
|
+
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
35241
|
+
return binary;
|
|
35242
|
+
}
|
|
35243
|
+
const { [arch]: archBinary } = binary;
|
|
35244
|
+
if (!archBinary) {
|
|
35245
|
+
throw new Error(`${arch} is not supported`);
|
|
35246
|
+
}
|
|
35247
|
+
return archBinary;
|
|
35248
|
+
}
|
|
35249
|
+
function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
|
|
35250
|
+
if (wsl && isWsl) {
|
|
35251
|
+
return detectArchBinary(wsl);
|
|
35252
|
+
}
|
|
35253
|
+
if (!platformBinary) {
|
|
35254
|
+
throw new Error(`${platform} is not supported`);
|
|
35255
|
+
}
|
|
35256
|
+
return detectArchBinary(platformBinary);
|
|
35257
|
+
}
|
|
35258
|
+
var apps = {};
|
|
35259
|
+
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
35260
|
+
darwin: "google chrome",
|
|
35261
|
+
win32: "chrome",
|
|
35262
|
+
linux: ["google-chrome", "google-chrome-stable", "chromium"]
|
|
35263
|
+
}, {
|
|
35264
|
+
wsl: {
|
|
35265
|
+
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
35266
|
+
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
35267
|
+
}
|
|
35268
|
+
}));
|
|
35269
|
+
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
35270
|
+
darwin: "firefox",
|
|
35271
|
+
win32: "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
|
|
35272
|
+
linux: "firefox"
|
|
35273
|
+
}, {
|
|
35274
|
+
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
35275
|
+
}));
|
|
35276
|
+
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
35277
|
+
darwin: "microsoft edge",
|
|
35278
|
+
win32: "msedge",
|
|
35279
|
+
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
35280
|
+
}, {
|
|
35281
|
+
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
35282
|
+
}));
|
|
35283
|
+
open2.apps = apps;
|
|
35284
|
+
open2.openApp = openApp;
|
|
35285
|
+
module.exports = open2;
|
|
35286
|
+
}
|
|
35287
|
+
});
|
|
35288
|
+
|
|
34965
35289
|
// ../../node_modules/.pnpm/json-parse-better-errors@1.0.2/node_modules/json-parse-better-errors/index.js
|
|
34966
35290
|
var require_json_parse_better_errors = __commonJS({
|
|
34967
35291
|
"../../node_modules/.pnpm/json-parse-better-errors@1.0.2/node_modules/json-parse-better-errors/index.js"(exports, module) {
|
|
@@ -34992,330 +35316,6 @@ var require_json_parse_better_errors = __commonJS({
|
|
|
34992
35316
|
}
|
|
34993
35317
|
});
|
|
34994
35318
|
|
|
34995
|
-
// ../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js
|
|
34996
|
-
var require_is_docker = __commonJS({
|
|
34997
|
-
"../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports, module) {
|
|
34998
|
-
"use strict";
|
|
34999
|
-
var fs5 = __require("fs");
|
|
35000
|
-
var isDocker;
|
|
35001
|
-
function hasDockerEnv() {
|
|
35002
|
-
try {
|
|
35003
|
-
fs5.statSync("/.dockerenv");
|
|
35004
|
-
return true;
|
|
35005
|
-
} catch (_) {
|
|
35006
|
-
return false;
|
|
35007
|
-
}
|
|
35008
|
-
}
|
|
35009
|
-
function hasDockerCGroup() {
|
|
35010
|
-
try {
|
|
35011
|
-
return fs5.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
35012
|
-
} catch (_) {
|
|
35013
|
-
return false;
|
|
35014
|
-
}
|
|
35015
|
-
}
|
|
35016
|
-
module.exports = () => {
|
|
35017
|
-
if (isDocker === void 0) {
|
|
35018
|
-
isDocker = hasDockerEnv() || hasDockerCGroup();
|
|
35019
|
-
}
|
|
35020
|
-
return isDocker;
|
|
35021
|
-
};
|
|
35022
|
-
}
|
|
35023
|
-
});
|
|
35024
|
-
|
|
35025
|
-
// ../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js
|
|
35026
|
-
var require_is_wsl = __commonJS({
|
|
35027
|
-
"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports, module) {
|
|
35028
|
-
"use strict";
|
|
35029
|
-
var os3 = __require("os");
|
|
35030
|
-
var fs5 = __require("fs");
|
|
35031
|
-
var isDocker = require_is_docker();
|
|
35032
|
-
var isWsl = () => {
|
|
35033
|
-
if (process.platform !== "linux") {
|
|
35034
|
-
return false;
|
|
35035
|
-
}
|
|
35036
|
-
if (os3.release().toLowerCase().includes("microsoft")) {
|
|
35037
|
-
if (isDocker()) {
|
|
35038
|
-
return false;
|
|
35039
|
-
}
|
|
35040
|
-
return true;
|
|
35041
|
-
}
|
|
35042
|
-
try {
|
|
35043
|
-
return fs5.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
|
|
35044
|
-
} catch (_) {
|
|
35045
|
-
return false;
|
|
35046
|
-
}
|
|
35047
|
-
};
|
|
35048
|
-
if (process.env.__IS_WSL_TEST__) {
|
|
35049
|
-
module.exports = isWsl;
|
|
35050
|
-
} else {
|
|
35051
|
-
module.exports = isWsl();
|
|
35052
|
-
}
|
|
35053
|
-
}
|
|
35054
|
-
});
|
|
35055
|
-
|
|
35056
|
-
// ../../node_modules/.pnpm/define-lazy-prop@2.0.0/node_modules/define-lazy-prop/index.js
|
|
35057
|
-
var require_define_lazy_prop = __commonJS({
|
|
35058
|
-
"../../node_modules/.pnpm/define-lazy-prop@2.0.0/node_modules/define-lazy-prop/index.js"(exports, module) {
|
|
35059
|
-
"use strict";
|
|
35060
|
-
module.exports = (object, propertyName, fn) => {
|
|
35061
|
-
const define2 = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
35062
|
-
Object.defineProperty(object, propertyName, {
|
|
35063
|
-
configurable: true,
|
|
35064
|
-
enumerable: true,
|
|
35065
|
-
get() {
|
|
35066
|
-
const result = fn();
|
|
35067
|
-
define2(result);
|
|
35068
|
-
return result;
|
|
35069
|
-
},
|
|
35070
|
-
set(value) {
|
|
35071
|
-
define2(value);
|
|
35072
|
-
}
|
|
35073
|
-
});
|
|
35074
|
-
return object;
|
|
35075
|
-
};
|
|
35076
|
-
}
|
|
35077
|
-
});
|
|
35078
|
-
|
|
35079
|
-
// ../../node_modules/.pnpm/open@8.4.0/node_modules/open/index.js
|
|
35080
|
-
var require_open = __commonJS({
|
|
35081
|
-
"../../node_modules/.pnpm/open@8.4.0/node_modules/open/index.js"(exports, module) {
|
|
35082
|
-
var path = __require("path");
|
|
35083
|
-
var childProcess = __require("child_process");
|
|
35084
|
-
var { promises: fs5, constants: fsConstants } = __require("fs");
|
|
35085
|
-
var isWsl = require_is_wsl();
|
|
35086
|
-
var isDocker = require_is_docker();
|
|
35087
|
-
var defineLazyProperty = require_define_lazy_prop();
|
|
35088
|
-
var localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
35089
|
-
var { platform, arch } = process;
|
|
35090
|
-
var getWslDrivesMountPoint = (() => {
|
|
35091
|
-
const defaultMountPoint = "/mnt/";
|
|
35092
|
-
let mountPoint;
|
|
35093
|
-
return async function() {
|
|
35094
|
-
if (mountPoint) {
|
|
35095
|
-
return mountPoint;
|
|
35096
|
-
}
|
|
35097
|
-
const configFilePath = "/etc/wsl.conf";
|
|
35098
|
-
let isConfigFileExists = false;
|
|
35099
|
-
try {
|
|
35100
|
-
await fs5.access(configFilePath, fsConstants.F_OK);
|
|
35101
|
-
isConfigFileExists = true;
|
|
35102
|
-
} catch {
|
|
35103
|
-
}
|
|
35104
|
-
if (!isConfigFileExists) {
|
|
35105
|
-
return defaultMountPoint;
|
|
35106
|
-
}
|
|
35107
|
-
const configContent = await fs5.readFile(configFilePath, { encoding: "utf8" });
|
|
35108
|
-
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
35109
|
-
if (!configMountPoint) {
|
|
35110
|
-
return defaultMountPoint;
|
|
35111
|
-
}
|
|
35112
|
-
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
35113
|
-
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
35114
|
-
return mountPoint;
|
|
35115
|
-
};
|
|
35116
|
-
})();
|
|
35117
|
-
var pTryEach = async (array, mapper) => {
|
|
35118
|
-
let latestError;
|
|
35119
|
-
for (const item of array) {
|
|
35120
|
-
try {
|
|
35121
|
-
return await mapper(item);
|
|
35122
|
-
} catch (error) {
|
|
35123
|
-
latestError = error;
|
|
35124
|
-
}
|
|
35125
|
-
}
|
|
35126
|
-
throw latestError;
|
|
35127
|
-
};
|
|
35128
|
-
var baseOpen = async (options) => {
|
|
35129
|
-
options = {
|
|
35130
|
-
wait: false,
|
|
35131
|
-
background: false,
|
|
35132
|
-
newInstance: false,
|
|
35133
|
-
allowNonzeroExitCode: false,
|
|
35134
|
-
...options
|
|
35135
|
-
};
|
|
35136
|
-
if (Array.isArray(options.app)) {
|
|
35137
|
-
return pTryEach(options.app, (singleApp) => baseOpen({
|
|
35138
|
-
...options,
|
|
35139
|
-
app: singleApp
|
|
35140
|
-
}));
|
|
35141
|
-
}
|
|
35142
|
-
let { name: app, arguments: appArguments = [] } = options.app || {};
|
|
35143
|
-
appArguments = [...appArguments];
|
|
35144
|
-
if (Array.isArray(app)) {
|
|
35145
|
-
return pTryEach(app, (appName) => baseOpen({
|
|
35146
|
-
...options,
|
|
35147
|
-
app: {
|
|
35148
|
-
name: appName,
|
|
35149
|
-
arguments: appArguments
|
|
35150
|
-
}
|
|
35151
|
-
}));
|
|
35152
|
-
}
|
|
35153
|
-
let command;
|
|
35154
|
-
const cliArguments = [];
|
|
35155
|
-
const childProcessOptions = {};
|
|
35156
|
-
if (platform === "darwin") {
|
|
35157
|
-
command = "open";
|
|
35158
|
-
if (options.wait) {
|
|
35159
|
-
cliArguments.push("--wait-apps");
|
|
35160
|
-
}
|
|
35161
|
-
if (options.background) {
|
|
35162
|
-
cliArguments.push("--background");
|
|
35163
|
-
}
|
|
35164
|
-
if (options.newInstance) {
|
|
35165
|
-
cliArguments.push("--new");
|
|
35166
|
-
}
|
|
35167
|
-
if (app) {
|
|
35168
|
-
cliArguments.push("-a", app);
|
|
35169
|
-
}
|
|
35170
|
-
} else if (platform === "win32" || isWsl && !isDocker()) {
|
|
35171
|
-
const mountPoint = await getWslDrivesMountPoint();
|
|
35172
|
-
command = isWsl ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` : `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
|
|
35173
|
-
cliArguments.push(
|
|
35174
|
-
"-NoProfile",
|
|
35175
|
-
"-NonInteractive",
|
|
35176
|
-
"\u2013ExecutionPolicy",
|
|
35177
|
-
"Bypass",
|
|
35178
|
-
"-EncodedCommand"
|
|
35179
|
-
);
|
|
35180
|
-
if (!isWsl) {
|
|
35181
|
-
childProcessOptions.windowsVerbatimArguments = true;
|
|
35182
|
-
}
|
|
35183
|
-
const encodedArguments = ["Start"];
|
|
35184
|
-
if (options.wait) {
|
|
35185
|
-
encodedArguments.push("-Wait");
|
|
35186
|
-
}
|
|
35187
|
-
if (app) {
|
|
35188
|
-
encodedArguments.push(`"\`"${app}\`""`, "-ArgumentList");
|
|
35189
|
-
if (options.target) {
|
|
35190
|
-
appArguments.unshift(options.target);
|
|
35191
|
-
}
|
|
35192
|
-
} else if (options.target) {
|
|
35193
|
-
encodedArguments.push(`"${options.target}"`);
|
|
35194
|
-
}
|
|
35195
|
-
if (appArguments.length > 0) {
|
|
35196
|
-
appArguments = appArguments.map((arg) => `"\`"${arg}\`""`);
|
|
35197
|
-
encodedArguments.push(appArguments.join(","));
|
|
35198
|
-
}
|
|
35199
|
-
options.target = Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
|
|
35200
|
-
} else {
|
|
35201
|
-
if (app) {
|
|
35202
|
-
command = app;
|
|
35203
|
-
} else {
|
|
35204
|
-
const isBundled = !__dirname || __dirname === "/";
|
|
35205
|
-
let exeLocalXdgOpen = false;
|
|
35206
|
-
try {
|
|
35207
|
-
await fs5.access(localXdgOpenPath, fsConstants.X_OK);
|
|
35208
|
-
exeLocalXdgOpen = true;
|
|
35209
|
-
} catch {
|
|
35210
|
-
}
|
|
35211
|
-
const useSystemXdgOpen = process.versions.electron || platform === "android" || isBundled || !exeLocalXdgOpen;
|
|
35212
|
-
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
35213
|
-
}
|
|
35214
|
-
if (appArguments.length > 0) {
|
|
35215
|
-
cliArguments.push(...appArguments);
|
|
35216
|
-
}
|
|
35217
|
-
if (!options.wait) {
|
|
35218
|
-
childProcessOptions.stdio = "ignore";
|
|
35219
|
-
childProcessOptions.detached = true;
|
|
35220
|
-
}
|
|
35221
|
-
}
|
|
35222
|
-
if (options.target) {
|
|
35223
|
-
cliArguments.push(options.target);
|
|
35224
|
-
}
|
|
35225
|
-
if (platform === "darwin" && appArguments.length > 0) {
|
|
35226
|
-
cliArguments.push("--args", ...appArguments);
|
|
35227
|
-
}
|
|
35228
|
-
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
35229
|
-
if (options.wait) {
|
|
35230
|
-
return new Promise((resolve4, reject) => {
|
|
35231
|
-
subprocess.once("error", reject);
|
|
35232
|
-
subprocess.once("close", (exitCode) => {
|
|
35233
|
-
if (options.allowNonzeroExitCode && exitCode > 0) {
|
|
35234
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
35235
|
-
return;
|
|
35236
|
-
}
|
|
35237
|
-
resolve4(subprocess);
|
|
35238
|
-
});
|
|
35239
|
-
});
|
|
35240
|
-
}
|
|
35241
|
-
subprocess.unref();
|
|
35242
|
-
return subprocess;
|
|
35243
|
-
};
|
|
35244
|
-
var open2 = (target, options) => {
|
|
35245
|
-
if (typeof target !== "string") {
|
|
35246
|
-
throw new TypeError("Expected a `target`");
|
|
35247
|
-
}
|
|
35248
|
-
return baseOpen({
|
|
35249
|
-
...options,
|
|
35250
|
-
target
|
|
35251
|
-
});
|
|
35252
|
-
};
|
|
35253
|
-
var openApp = (name, options) => {
|
|
35254
|
-
if (typeof name !== "string") {
|
|
35255
|
-
throw new TypeError("Expected a `name`");
|
|
35256
|
-
}
|
|
35257
|
-
const { arguments: appArguments = [] } = options || {};
|
|
35258
|
-
if (appArguments !== void 0 && appArguments !== null && !Array.isArray(appArguments)) {
|
|
35259
|
-
throw new TypeError("Expected `appArguments` as Array type");
|
|
35260
|
-
}
|
|
35261
|
-
return baseOpen({
|
|
35262
|
-
...options,
|
|
35263
|
-
app: {
|
|
35264
|
-
name,
|
|
35265
|
-
arguments: appArguments
|
|
35266
|
-
}
|
|
35267
|
-
});
|
|
35268
|
-
};
|
|
35269
|
-
function detectArchBinary(binary) {
|
|
35270
|
-
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
35271
|
-
return binary;
|
|
35272
|
-
}
|
|
35273
|
-
const { [arch]: archBinary } = binary;
|
|
35274
|
-
if (!archBinary) {
|
|
35275
|
-
throw new Error(`${arch} is not supported`);
|
|
35276
|
-
}
|
|
35277
|
-
return archBinary;
|
|
35278
|
-
}
|
|
35279
|
-
function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
|
|
35280
|
-
if (wsl && isWsl) {
|
|
35281
|
-
return detectArchBinary(wsl);
|
|
35282
|
-
}
|
|
35283
|
-
if (!platformBinary) {
|
|
35284
|
-
throw new Error(`${platform} is not supported`);
|
|
35285
|
-
}
|
|
35286
|
-
return detectArchBinary(platformBinary);
|
|
35287
|
-
}
|
|
35288
|
-
var apps = {};
|
|
35289
|
-
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
35290
|
-
darwin: "google chrome",
|
|
35291
|
-
win32: "chrome",
|
|
35292
|
-
linux: ["google-chrome", "google-chrome-stable", "chromium"]
|
|
35293
|
-
}, {
|
|
35294
|
-
wsl: {
|
|
35295
|
-
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
35296
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
35297
|
-
}
|
|
35298
|
-
}));
|
|
35299
|
-
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
35300
|
-
darwin: "firefox",
|
|
35301
|
-
win32: "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
|
|
35302
|
-
linux: "firefox"
|
|
35303
|
-
}, {
|
|
35304
|
-
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
35305
|
-
}));
|
|
35306
|
-
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
35307
|
-
darwin: "microsoft edge",
|
|
35308
|
-
win32: "msedge",
|
|
35309
|
-
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
35310
|
-
}, {
|
|
35311
|
-
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
35312
|
-
}));
|
|
35313
|
-
open2.apps = apps;
|
|
35314
|
-
open2.openApp = openApp;
|
|
35315
|
-
module.exports = open2;
|
|
35316
|
-
}
|
|
35317
|
-
});
|
|
35318
|
-
|
|
35319
35319
|
// ../../node_modules/.pnpm/universalify@0.1.2/node_modules/universalify/index.js
|
|
35320
35320
|
var require_universalify2 = __commonJS({
|
|
35321
35321
|
"../../node_modules/.pnpm/universalify@0.1.2/node_modules/universalify/index.js"(exports) {
|
|
@@ -53327,7 +53327,7 @@ import { fork } from "child_process";
|
|
|
53327
53327
|
import { parse as tomlParse2 } from "smol-toml";
|
|
53328
53328
|
|
|
53329
53329
|
// src/util/projects/link.ts
|
|
53330
|
-
var
|
|
53330
|
+
var import_ajv = __toESM(require_ajv(), 1);
|
|
53331
53331
|
var import_fs_extra8 = __toESM(require_lib2(), 1);
|
|
53332
53332
|
import fs4 from "fs";
|
|
53333
53333
|
import { join as join9, relative as relative2 } from "path";
|
|
@@ -56048,6 +56048,474 @@ import { resolve as resolve3 } from "path";
|
|
|
56048
56048
|
|
|
56049
56049
|
// src/util/env/get-env-records.ts
|
|
56050
56050
|
import { URLSearchParams as URLSearchParams3 } from "url";
|
|
56051
|
+
|
|
56052
|
+
// src/commands/login/future.ts
|
|
56053
|
+
var import_chalk10 = __toESM(require_source(), 1);
|
|
56054
|
+
var open = __toESM(require_open(), 1);
|
|
56055
|
+
var import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
|
|
56056
|
+
import readline3 from "readline";
|
|
56057
|
+
import { KNOWN_AGENTS } from "@vercel/detect-agent";
|
|
56058
|
+
|
|
56059
|
+
// src/util/login/update-current-team-after-login.ts
|
|
56060
|
+
async function updateCurrentTeamAfterLogin(client, ssoTeamId) {
|
|
56061
|
+
if (ssoTeamId) {
|
|
56062
|
+
client.config.currentTeam = ssoTeamId;
|
|
56063
|
+
} else {
|
|
56064
|
+
let user = null;
|
|
56065
|
+
try {
|
|
56066
|
+
user = await getUser(client);
|
|
56067
|
+
} catch (_err) {
|
|
56068
|
+
output_manager_default.error("Failed to fetch the logged in user. Please try again.");
|
|
56069
|
+
return 1;
|
|
56070
|
+
}
|
|
56071
|
+
if (user.version === "northstar" && user.defaultTeamId) {
|
|
56072
|
+
client.config.currentTeam = user.defaultTeamId;
|
|
56073
|
+
} else {
|
|
56074
|
+
delete client.config.currentTeam;
|
|
56075
|
+
}
|
|
56076
|
+
}
|
|
56077
|
+
}
|
|
56078
|
+
|
|
56079
|
+
// src/util/ua.ts
|
|
56080
|
+
import os2 from "os";
|
|
56081
|
+
var ua_default = `${pkg_default.name} ${pkg_default.version} node-${process.version} ${os2.platform()} (${os2.arch()})`;
|
|
56082
|
+
|
|
56083
|
+
// src/util/oauth.ts
|
|
56084
|
+
import { hostname } from "os";
|
|
56085
|
+
var VERCEL_ISSUER = new URL("https://vercel.com");
|
|
56086
|
+
var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
|
|
56087
|
+
var userAgent = `${hostname()} @ ${ua_default}`;
|
|
56088
|
+
var _as;
|
|
56089
|
+
async function as() {
|
|
56090
|
+
if (!_as) {
|
|
56091
|
+
const discoveryResponse = await discoveryEndpointRequest(VERCEL_ISSUER);
|
|
56092
|
+
const [discoveryResponseError, as2] = await processDiscoveryEndpointResponse(discoveryResponse);
|
|
56093
|
+
if (discoveryResponseError) {
|
|
56094
|
+
throw discoveryResponseError;
|
|
56095
|
+
}
|
|
56096
|
+
_as = as2;
|
|
56097
|
+
}
|
|
56098
|
+
return _as;
|
|
56099
|
+
}
|
|
56100
|
+
async function discoveryEndpointRequest(issuer) {
|
|
56101
|
+
return await fetch2(new URL(".well-known/openid-configuration", issuer), {
|
|
56102
|
+
headers: { "Content-Type": "application/json", "user-agent": userAgent }
|
|
56103
|
+
});
|
|
56104
|
+
}
|
|
56105
|
+
async function processDiscoveryEndpointResponse(response) {
|
|
56106
|
+
const json = await response.json();
|
|
56107
|
+
if (!response.ok) {
|
|
56108
|
+
return [new Error("Discovery endpoint request failed")];
|
|
56109
|
+
}
|
|
56110
|
+
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)) {
|
|
56111
|
+
return [new TypeError("Invalid discovery response")];
|
|
56112
|
+
}
|
|
56113
|
+
const issuer = new URL(json.issuer);
|
|
56114
|
+
if (issuer.href !== VERCEL_ISSUER.href) {
|
|
56115
|
+
return [new Error("Issuer mismatch")];
|
|
56116
|
+
}
|
|
56117
|
+
return [
|
|
56118
|
+
null,
|
|
56119
|
+
{
|
|
56120
|
+
issuer,
|
|
56121
|
+
device_authorization_endpoint: new URL(
|
|
56122
|
+
json.device_authorization_endpoint
|
|
56123
|
+
),
|
|
56124
|
+
token_endpoint: new URL(json.token_endpoint),
|
|
56125
|
+
revocation_endpoint: new URL(json.revocation_endpoint),
|
|
56126
|
+
jwks_uri: new URL(json.jwks_uri),
|
|
56127
|
+
introspection_endpoint: new URL(json.introspection_endpoint)
|
|
56128
|
+
}
|
|
56129
|
+
];
|
|
56130
|
+
}
|
|
56131
|
+
async function deviceAuthorizationRequest(options) {
|
|
56132
|
+
const body = new URLSearchParams({
|
|
56133
|
+
client_id: VERCEL_CLI_CLIENT_ID
|
|
56134
|
+
});
|
|
56135
|
+
if (options?.refresh_token) {
|
|
56136
|
+
body.set("refresh_token", options.refresh_token);
|
|
56137
|
+
if (options.acr_values) {
|
|
56138
|
+
body.set("acr_values", options.acr_values);
|
|
56139
|
+
}
|
|
56140
|
+
} else {
|
|
56141
|
+
body.set("scope", "openid offline_access");
|
|
56142
|
+
}
|
|
56143
|
+
return await fetch2((await as()).device_authorization_endpoint, {
|
|
56144
|
+
method: "POST",
|
|
56145
|
+
headers: {
|
|
56146
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
56147
|
+
"user-agent": userAgent
|
|
56148
|
+
},
|
|
56149
|
+
body
|
|
56150
|
+
});
|
|
56151
|
+
}
|
|
56152
|
+
async function processDeviceAuthorizationResponse(response) {
|
|
56153
|
+
const json = await response.json();
|
|
56154
|
+
if (!response.ok) {
|
|
56155
|
+
return [new OAuthError("Device authorization request failed", json)];
|
|
56156
|
+
}
|
|
56157
|
+
if (typeof json !== "object" || json === null)
|
|
56158
|
+
return [new TypeError("Expected response to be an object")];
|
|
56159
|
+
if (!("device_code" in json) || typeof json.device_code !== "string")
|
|
56160
|
+
return [new TypeError("Expected `device_code` to be a string")];
|
|
56161
|
+
if (!("user_code" in json) || typeof json.user_code !== "string")
|
|
56162
|
+
return [new TypeError("Expected `user_code` to be a string")];
|
|
56163
|
+
if (!("verification_uri" in json) || typeof json.verification_uri !== "string" || !canParseURL(json.verification_uri)) {
|
|
56164
|
+
return [new TypeError("Expected `verification_uri` to be a string")];
|
|
56165
|
+
}
|
|
56166
|
+
if (!("verification_uri_complete" in json) || typeof json.verification_uri_complete !== "string" || !canParseURL(json.verification_uri_complete)) {
|
|
56167
|
+
return [
|
|
56168
|
+
new TypeError("Expected `verification_uri_complete` to be a string")
|
|
56169
|
+
];
|
|
56170
|
+
}
|
|
56171
|
+
if (!("expires_in" in json) || typeof json.expires_in !== "number")
|
|
56172
|
+
return [new TypeError("Expected `expires_in` to be a number")];
|
|
56173
|
+
if (!("interval" in json) || typeof json.interval !== "number")
|
|
56174
|
+
return [new TypeError("Expected `interval` to be a number")];
|
|
56175
|
+
return [
|
|
56176
|
+
null,
|
|
56177
|
+
{
|
|
56178
|
+
device_code: json.device_code,
|
|
56179
|
+
user_code: json.user_code,
|
|
56180
|
+
verification_uri: json.verification_uri,
|
|
56181
|
+
verification_uri_complete: json.verification_uri_complete,
|
|
56182
|
+
expiresAt: Date.now() + json.expires_in * 1e3,
|
|
56183
|
+
interval: json.interval
|
|
56184
|
+
}
|
|
56185
|
+
];
|
|
56186
|
+
}
|
|
56187
|
+
async function deviceAccessTokenRequest(options) {
|
|
56188
|
+
try {
|
|
56189
|
+
return [
|
|
56190
|
+
null,
|
|
56191
|
+
await fetch2((await as()).token_endpoint, {
|
|
56192
|
+
method: "POST",
|
|
56193
|
+
headers: {
|
|
56194
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
56195
|
+
"user-agent": userAgent
|
|
56196
|
+
},
|
|
56197
|
+
body: new URLSearchParams({
|
|
56198
|
+
client_id: VERCEL_CLI_CLIENT_ID,
|
|
56199
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
56200
|
+
...options
|
|
56201
|
+
}),
|
|
56202
|
+
signal: AbortSignal.timeout(10 * 1e3)
|
|
56203
|
+
})
|
|
56204
|
+
];
|
|
56205
|
+
} catch (error) {
|
|
56206
|
+
if (error instanceof Error)
|
|
56207
|
+
return [error];
|
|
56208
|
+
return [
|
|
56209
|
+
new Error("An unknown error occurred. See the logs for details.", {
|
|
56210
|
+
cause: error
|
|
56211
|
+
})
|
|
56212
|
+
];
|
|
56213
|
+
}
|
|
56214
|
+
}
|
|
56215
|
+
async function processTokenResponse(response) {
|
|
56216
|
+
const json = await response.json();
|
|
56217
|
+
if (!response.ok) {
|
|
56218
|
+
return [new OAuthError("Device access token request failed", json)];
|
|
56219
|
+
}
|
|
56220
|
+
if (typeof json !== "object" || json === null)
|
|
56221
|
+
return [new TypeError("Expected response to be an object")];
|
|
56222
|
+
if (!("access_token" in json) || typeof json.access_token !== "string")
|
|
56223
|
+
return [new TypeError("Expected `access_token` to be a string")];
|
|
56224
|
+
if (!("token_type" in json) || json.token_type !== "Bearer")
|
|
56225
|
+
return [new TypeError('Expected `token_type` to be "Bearer"')];
|
|
56226
|
+
if (!("expires_in" in json) || typeof json.expires_in !== "number")
|
|
56227
|
+
return [new TypeError("Expected `expires_in` to be a number")];
|
|
56228
|
+
if ("refresh_token" in json && (typeof json.refresh_token !== "string" || !json.refresh_token))
|
|
56229
|
+
return [new TypeError("Expected `refresh_token` to be a string")];
|
|
56230
|
+
if ("scope" in json && typeof json.scope !== "string")
|
|
56231
|
+
return [new TypeError("Expected `scope` to be a string")];
|
|
56232
|
+
return [null, json];
|
|
56233
|
+
}
|
|
56234
|
+
async function revocationRequest(options) {
|
|
56235
|
+
return await fetch2((await as()).revocation_endpoint, {
|
|
56236
|
+
method: "POST",
|
|
56237
|
+
headers: {
|
|
56238
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
56239
|
+
"user-agent": userAgent
|
|
56240
|
+
},
|
|
56241
|
+
body: new URLSearchParams({ ...options, client_id: VERCEL_CLI_CLIENT_ID })
|
|
56242
|
+
});
|
|
56243
|
+
}
|
|
56244
|
+
async function processRevocationResponse(response) {
|
|
56245
|
+
if (response.ok)
|
|
56246
|
+
return [null, null];
|
|
56247
|
+
const json = await response.json();
|
|
56248
|
+
return [new OAuthError("Revocation request failed", json)];
|
|
56249
|
+
}
|
|
56250
|
+
async function refreshTokenRequest(options) {
|
|
56251
|
+
return await fetch2((await as()).token_endpoint, {
|
|
56252
|
+
method: "POST",
|
|
56253
|
+
headers: {
|
|
56254
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
56255
|
+
"user-agent": userAgent
|
|
56256
|
+
},
|
|
56257
|
+
body: new URLSearchParams({
|
|
56258
|
+
client_id: VERCEL_CLI_CLIENT_ID,
|
|
56259
|
+
grant_type: "refresh_token",
|
|
56260
|
+
...options
|
|
56261
|
+
})
|
|
56262
|
+
});
|
|
56263
|
+
}
|
|
56264
|
+
function processOAuthErrorResponse(json) {
|
|
56265
|
+
if (typeof json !== "object" || json === null)
|
|
56266
|
+
return new TypeError("Expected response to be an object");
|
|
56267
|
+
if (!("error" in json) || typeof json.error !== "string")
|
|
56268
|
+
return new TypeError("Expected `error` to be a string");
|
|
56269
|
+
if ("error_description" in json && typeof json.error_description !== "string")
|
|
56270
|
+
return new TypeError("Expected `error_description` to be a string");
|
|
56271
|
+
if ("error_uri" in json && typeof json.error_uri !== "string")
|
|
56272
|
+
return new TypeError("Expected `error_uri` to be a string");
|
|
56273
|
+
return json;
|
|
56274
|
+
}
|
|
56275
|
+
var OAuthError = class extends Error {
|
|
56276
|
+
constructor(message, response) {
|
|
56277
|
+
var __super = (...args) => {
|
|
56278
|
+
super(...args);
|
|
56279
|
+
};
|
|
56280
|
+
const error = processOAuthErrorResponse(response);
|
|
56281
|
+
if (error instanceof TypeError) {
|
|
56282
|
+
const message2 = `Unexpected server response: ${JSON.stringify(response)}`;
|
|
56283
|
+
__super(message2);
|
|
56284
|
+
this.cause = new Error(message2, { cause: error });
|
|
56285
|
+
this.code = "server_error";
|
|
56286
|
+
return;
|
|
56287
|
+
}
|
|
56288
|
+
let cause = error.error;
|
|
56289
|
+
if (error.error_description)
|
|
56290
|
+
cause += `: ${error.error_description}`;
|
|
56291
|
+
if (error.error_uri)
|
|
56292
|
+
cause += ` (${error.error_uri})`;
|
|
56293
|
+
__super(message, { cause });
|
|
56294
|
+
this.cause = new Error(cause);
|
|
56295
|
+
this.code = error.error;
|
|
56296
|
+
}
|
|
56297
|
+
};
|
|
56298
|
+
function isOAuthError(error) {
|
|
56299
|
+
return error instanceof OAuthError;
|
|
56300
|
+
}
|
|
56301
|
+
function canParseURL(url) {
|
|
56302
|
+
try {
|
|
56303
|
+
return !!new URL(url);
|
|
56304
|
+
} catch {
|
|
56305
|
+
return false;
|
|
56306
|
+
}
|
|
56307
|
+
}
|
|
56308
|
+
|
|
56309
|
+
// src/commands/login/future.ts
|
|
56310
|
+
async function performDeviceCodeFlow(client, options) {
|
|
56311
|
+
const deviceAuthorizationResponse = await deviceAuthorizationRequest({
|
|
56312
|
+
refresh_token: options?.refreshToken,
|
|
56313
|
+
acr_values: options?.acrValues
|
|
56314
|
+
});
|
|
56315
|
+
output_manager_default.debug(
|
|
56316
|
+
`'Device Authorization response:', ${await deviceAuthorizationResponse.clone().text()}`
|
|
56317
|
+
);
|
|
56318
|
+
const [deviceAuthorizationError, deviceAuthorization] = await processDeviceAuthorizationResponse(deviceAuthorizationResponse);
|
|
56319
|
+
if (deviceAuthorizationError) {
|
|
56320
|
+
printError(deviceAuthorizationError);
|
|
56321
|
+
return null;
|
|
56322
|
+
}
|
|
56323
|
+
const { device_code, user_code, verification_uri, expiresAt, interval } = deviceAuthorization;
|
|
56324
|
+
let { verification_uri_complete } = deviceAuthorization;
|
|
56325
|
+
if (options?.teamId) {
|
|
56326
|
+
const url = new URL(verification_uri_complete);
|
|
56327
|
+
url.searchParams.set("team_id", options.teamId);
|
|
56328
|
+
verification_uri_complete = url.toString();
|
|
56329
|
+
}
|
|
56330
|
+
const isCursorAgent = client.agentName === KNOWN_AGENTS.CURSOR || client.agentName === KNOWN_AGENTS.CURSOR_CLI;
|
|
56331
|
+
const shouldSkipBrowser = process.env.CI && !isCursorAgent;
|
|
56332
|
+
output_manager_default.log(
|
|
56333
|
+
`
|
|
56334
|
+
Visit ${import_chalk10.default.bold(
|
|
56335
|
+
output_manager_default.link(
|
|
56336
|
+
verification_uri.replace("https://", ""),
|
|
56337
|
+
verification_uri_complete,
|
|
56338
|
+
{ color: false, fallback: () => verification_uri_complete }
|
|
56339
|
+
)
|
|
56340
|
+
)}${output_manager_default.supportsHyperlink ? ` and enter ${import_chalk10.default.bold(user_code)}` : ""}
|
|
56341
|
+
`
|
|
56342
|
+
);
|
|
56343
|
+
if (!shouldSkipBrowser) {
|
|
56344
|
+
try {
|
|
56345
|
+
const browserProcess = await open.default(verification_uri_complete);
|
|
56346
|
+
browserProcess.on("error", (error) => {
|
|
56347
|
+
output_manager_default.debug(`Failed to open browser: ${error}`);
|
|
56348
|
+
});
|
|
56349
|
+
} catch (error) {
|
|
56350
|
+
output_manager_default.debug(`Failed to open browser: ${error}`);
|
|
56351
|
+
if (client.isAgent && client.nonInteractive) {
|
|
56352
|
+
output_manager_default.log(
|
|
56353
|
+
`
|
|
56354
|
+
${import_chalk10.default.yellow("\u26A0")} ${import_chalk10.default.bold("Browser could not be opened automatically.")}
|
|
56355
|
+
`
|
|
56356
|
+
);
|
|
56357
|
+
output_manager_default.log(
|
|
56358
|
+
`Please ask the user to manually visit the URL above and complete the authentication process.
|
|
56359
|
+
`
|
|
56360
|
+
);
|
|
56361
|
+
}
|
|
56362
|
+
}
|
|
56363
|
+
}
|
|
56364
|
+
const rl = readline3.createInterface({
|
|
56365
|
+
input: process.stdin,
|
|
56366
|
+
output: process.stdout
|
|
56367
|
+
}).on("SIGINT", () => {
|
|
56368
|
+
process.exit(0);
|
|
56369
|
+
});
|
|
56370
|
+
output_manager_default.spinner("Waiting for authentication...");
|
|
56371
|
+
let intervalMs = interval * 1e3;
|
|
56372
|
+
let result = null;
|
|
56373
|
+
let flowError = new Error(
|
|
56374
|
+
"Timed out waiting for authentication. Please try again."
|
|
56375
|
+
);
|
|
56376
|
+
async function pollForToken() {
|
|
56377
|
+
while (Date.now() < expiresAt) {
|
|
56378
|
+
const [tokenResponseError, tokenResponse] = await deviceAccessTokenRequest({ device_code });
|
|
56379
|
+
if (tokenResponseError) {
|
|
56380
|
+
if (tokenResponseError.message.includes("timeout")) {
|
|
56381
|
+
intervalMs *= 2;
|
|
56382
|
+
output_manager_default.debug(
|
|
56383
|
+
`Connection timeout. Slowing down, polling every ${intervalMs / 1e3}s...`
|
|
56384
|
+
);
|
|
56385
|
+
await wait(intervalMs);
|
|
56386
|
+
continue;
|
|
56387
|
+
}
|
|
56388
|
+
return tokenResponseError;
|
|
56389
|
+
}
|
|
56390
|
+
output_manager_default.debug(
|
|
56391
|
+
`'Device Access Token response:', ${await tokenResponse.clone().text()}`
|
|
56392
|
+
);
|
|
56393
|
+
const [tokensError, tokens] = await processTokenResponse(tokenResponse);
|
|
56394
|
+
if (isOAuthError(tokensError)) {
|
|
56395
|
+
const { code: code2 } = tokensError;
|
|
56396
|
+
switch (code2) {
|
|
56397
|
+
case "authorization_pending":
|
|
56398
|
+
await wait(intervalMs);
|
|
56399
|
+
continue;
|
|
56400
|
+
case "slow_down":
|
|
56401
|
+
intervalMs += 5 * 1e3;
|
|
56402
|
+
output_manager_default.debug(
|
|
56403
|
+
`Authorization server requests to slow down. Polling every ${intervalMs / 1e3}s...`
|
|
56404
|
+
);
|
|
56405
|
+
await wait(intervalMs);
|
|
56406
|
+
continue;
|
|
56407
|
+
default:
|
|
56408
|
+
return tokensError.cause;
|
|
56409
|
+
}
|
|
56410
|
+
}
|
|
56411
|
+
if (tokensError)
|
|
56412
|
+
return tokensError;
|
|
56413
|
+
output_manager_default.print((0, import_ansi_escapes4.eraseLines)(2));
|
|
56414
|
+
result = {
|
|
56415
|
+
access_token: tokens.access_token,
|
|
56416
|
+
expires_in: tokens.expires_in,
|
|
56417
|
+
refresh_token: tokens.refresh_token
|
|
56418
|
+
};
|
|
56419
|
+
return;
|
|
56420
|
+
}
|
|
56421
|
+
}
|
|
56422
|
+
flowError = await pollForToken();
|
|
56423
|
+
output_manager_default.stopSpinner();
|
|
56424
|
+
rl.close();
|
|
56425
|
+
if (flowError) {
|
|
56426
|
+
printError(flowError);
|
|
56427
|
+
return null;
|
|
56428
|
+
}
|
|
56429
|
+
return result;
|
|
56430
|
+
}
|
|
56431
|
+
async function login(client, telemetry) {
|
|
56432
|
+
const tokens = await performDeviceCodeFlow(client);
|
|
56433
|
+
if (!tokens) {
|
|
56434
|
+
telemetry.trackState("error");
|
|
56435
|
+
return 1;
|
|
56436
|
+
}
|
|
56437
|
+
const isInitialLogin = !client.authConfig.token;
|
|
56438
|
+
client.updateAuthConfig({
|
|
56439
|
+
token: tokens.access_token,
|
|
56440
|
+
userId: void 0,
|
|
56441
|
+
expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in,
|
|
56442
|
+
refreshToken: tokens.refresh_token
|
|
56443
|
+
});
|
|
56444
|
+
client.updateConfig({ currentTeam: void 0 });
|
|
56445
|
+
if (isInitialLogin) {
|
|
56446
|
+
await updateCurrentTeamAfterLogin(client);
|
|
56447
|
+
}
|
|
56448
|
+
client.persistAuthConfig();
|
|
56449
|
+
client.writeToConfigFile();
|
|
56450
|
+
output_manager_default.debug(`Saved credentials in "${humanizePath(client.getGlobalPathConfig())}"`);
|
|
56451
|
+
output_manager_default.print(`
|
|
56452
|
+
${import_chalk10.default.cyan("Congratulations!")} You are now signed in.
|
|
56453
|
+
|
|
56454
|
+
To deploy something, run ${getCommandName()}.
|
|
56455
|
+
|
|
56456
|
+
${emoji("tip")} To deploy every commit automatically,
|
|
56457
|
+
connect a Git Repository (${import_chalk10.default.bold(output_manager_default.link("vercel.link/git", "https://vercel.link/git", { color: false }))}).
|
|
56458
|
+
`);
|
|
56459
|
+
telemetry.trackState("success");
|
|
56460
|
+
return 0;
|
|
56461
|
+
}
|
|
56462
|
+
async function wait(intervalMs) {
|
|
56463
|
+
await new Promise((resolve4) => setTimeout(resolve4, intervalMs));
|
|
56464
|
+
}
|
|
56465
|
+
|
|
56466
|
+
// src/util/env/challenge-recovery.ts
|
|
56467
|
+
async function withEnvChallengeRecovery(client, fn) {
|
|
56468
|
+
try {
|
|
56469
|
+
return await fn();
|
|
56470
|
+
} catch (error) {
|
|
56471
|
+
if (!isAPIError(error) || error.code !== "challenge_required") {
|
|
56472
|
+
throw error;
|
|
56473
|
+
}
|
|
56474
|
+
const refreshToken = client.authConfig.refreshToken;
|
|
56475
|
+
if (!refreshToken || client.authConfig.tokenSource || !client.stdin.isTTY) {
|
|
56476
|
+
throw error;
|
|
56477
|
+
}
|
|
56478
|
+
output_manager_default.stopSpinner();
|
|
56479
|
+
output_manager_default.log("Sensitive Environment Variables require fresh authentication.");
|
|
56480
|
+
const acrValues = getAcrValuesFromWWWAuthenticate(error.wwwAuthenticate);
|
|
56481
|
+
if (!acrValues) {
|
|
56482
|
+
throw error;
|
|
56483
|
+
}
|
|
56484
|
+
const tokens = await performDeviceCodeFlow(client, {
|
|
56485
|
+
refreshToken,
|
|
56486
|
+
acrValues
|
|
56487
|
+
});
|
|
56488
|
+
if (!tokens) {
|
|
56489
|
+
throw error;
|
|
56490
|
+
}
|
|
56491
|
+
client.updateAuthConfig({
|
|
56492
|
+
token: tokens.access_token,
|
|
56493
|
+
userId: void 0,
|
|
56494
|
+
expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in
|
|
56495
|
+
});
|
|
56496
|
+
if (tokens.refresh_token) {
|
|
56497
|
+
client.updateAuthConfig({ refreshToken: tokens.refresh_token });
|
|
56498
|
+
}
|
|
56499
|
+
client.persistAuthConfig();
|
|
56500
|
+
return await fn();
|
|
56501
|
+
}
|
|
56502
|
+
}
|
|
56503
|
+
function getAcrValuesFromWWWAuthenticate(header) {
|
|
56504
|
+
if (!header) {
|
|
56505
|
+
return;
|
|
56506
|
+
}
|
|
56507
|
+
const bearerIndex = header.toLowerCase().indexOf("bearer");
|
|
56508
|
+
if (bearerIndex === -1) {
|
|
56509
|
+
return;
|
|
56510
|
+
}
|
|
56511
|
+
const bearerChallenge = header.slice(bearerIndex + "bearer".length);
|
|
56512
|
+
const match = bearerChallenge.match(
|
|
56513
|
+
/(?:^|[,\s])acr_values=(?:"((?:\\.|[^"\\])*)"|([^,\s]+))/i
|
|
56514
|
+
);
|
|
56515
|
+
return match?.[1]?.replace(/\\(.)/g, "$1") ?? match?.[2];
|
|
56516
|
+
}
|
|
56517
|
+
|
|
56518
|
+
// src/util/env/get-env-records.ts
|
|
56051
56519
|
async function getEnvRecords(client, projectId, source, {
|
|
56052
56520
|
target,
|
|
56053
56521
|
gitBranch,
|
|
@@ -56074,7 +56542,10 @@ async function getEnvRecords(client, projectId, source, {
|
|
|
56074
56542
|
query.set("source", source);
|
|
56075
56543
|
}
|
|
56076
56544
|
const url = `/v10/projects/${projectId}/env?${query}`;
|
|
56077
|
-
return
|
|
56545
|
+
return withEnvChallengeRecovery(
|
|
56546
|
+
client,
|
|
56547
|
+
() => client.fetch(url)
|
|
56548
|
+
);
|
|
56078
56549
|
}
|
|
56079
56550
|
async function pullEnvRecords(client, projectIdOrDeploymentId, source, { target, gitBranch } = {}) {
|
|
56080
56551
|
output_manager_default.debug(
|
|
@@ -56096,7 +56567,10 @@ async function pullEnvRecords(client, projectIdOrDeploymentId, source, { target,
|
|
|
56096
56567
|
if (Array.from(query).length > 0) {
|
|
56097
56568
|
url += `?${query}`;
|
|
56098
56569
|
}
|
|
56099
|
-
return
|
|
56570
|
+
return withEnvChallengeRecovery(
|
|
56571
|
+
client,
|
|
56572
|
+
() => client.fetch(url)
|
|
56573
|
+
);
|
|
56100
56574
|
}
|
|
56101
56575
|
|
|
56102
56576
|
// src/util/env/diff-env-files.ts
|
|
@@ -56130,7 +56604,7 @@ var parseEnv = (env) => {
|
|
|
56130
56604
|
};
|
|
56131
56605
|
|
|
56132
56606
|
// src/util/env/diff-env-files.ts
|
|
56133
|
-
var
|
|
56607
|
+
var import_chalk11 = __toESM(require_source(), 1);
|
|
56134
56608
|
async function createEnvObject(envPath) {
|
|
56135
56609
|
const envArr = (await (0, import_fs_extra4.readFile)(envPath, "utf-8")).replace(/"/g, "").split(/\r?\n|\r/).filter((line) => /^[^#]/.test(line)).filter((line) => /=/i.test(line));
|
|
56136
56610
|
const parsedEnv = parseEnv(envArr);
|
|
@@ -56161,10 +56635,10 @@ function findChanges(oldEnv, newEnv) {
|
|
|
56161
56635
|
function buildDeltaString(oldEnv, newEnv) {
|
|
56162
56636
|
const { added, changed, removed } = findChanges(oldEnv, newEnv);
|
|
56163
56637
|
let deltaString = "";
|
|
56164
|
-
deltaString +=
|
|
56165
|
-
deltaString +=
|
|
56166
|
-
deltaString +=
|
|
56167
|
-
return deltaString ?
|
|
56638
|
+
deltaString += import_chalk11.default.green(addDeltaSection("+", changed, true));
|
|
56639
|
+
deltaString += import_chalk11.default.green(addDeltaSection("+", added));
|
|
56640
|
+
deltaString += import_chalk11.default.red(addDeltaSection("-", removed));
|
|
56641
|
+
return deltaString ? import_chalk11.default.gray(" Changes:\n") + deltaString + "\n" : deltaString;
|
|
56168
56642
|
}
|
|
56169
56643
|
function addDeltaSection(prefix, arr, changed = false) {
|
|
56170
56644
|
if (arr.length === 0)
|
|
@@ -56212,12 +56686,12 @@ var import_error_utils2 = __toESM(require_dist(), 1);
|
|
|
56212
56686
|
var import_json_parse_better_errors = __toESM(require_json_parse_better_errors(), 1);
|
|
56213
56687
|
|
|
56214
56688
|
// src/util/projects/format-project.ts
|
|
56215
|
-
var
|
|
56689
|
+
var import_chalk12 = __toESM(require_source(), 1);
|
|
56216
56690
|
function formatProject(orgSlug, projectSlug, options) {
|
|
56217
56691
|
const orgProjectSlug = `${orgSlug}/${projectSlug}`;
|
|
56218
56692
|
const projectUrl = `https://vercel.com/${orgProjectSlug}`;
|
|
56219
|
-
const projectSlugLink = output_manager_default.link(
|
|
56220
|
-
fallback: () =>
|
|
56693
|
+
const projectSlugLink = output_manager_default.link(import_chalk12.default.bold(orgProjectSlug), projectUrl, {
|
|
56694
|
+
fallback: () => import_chalk12.default.bold(orgProjectSlug),
|
|
56221
56695
|
color: false,
|
|
56222
56696
|
...options
|
|
56223
56697
|
});
|
|
@@ -56983,420 +57457,6 @@ async function getDeployment(client, contextName, hostOrId) {
|
|
|
56983
57457
|
}
|
|
56984
57458
|
}
|
|
56985
57459
|
|
|
56986
|
-
// src/commands/login/future.ts
|
|
56987
|
-
var import_chalk12 = __toESM(require_source(), 1);
|
|
56988
|
-
var open = __toESM(require_open(), 1);
|
|
56989
|
-
var import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
|
|
56990
|
-
import readline3 from "readline";
|
|
56991
|
-
import { KNOWN_AGENTS } from "@vercel/detect-agent";
|
|
56992
|
-
|
|
56993
|
-
// src/util/login/update-current-team-after-login.ts
|
|
56994
|
-
async function updateCurrentTeamAfterLogin(client, ssoTeamId) {
|
|
56995
|
-
if (ssoTeamId) {
|
|
56996
|
-
client.config.currentTeam = ssoTeamId;
|
|
56997
|
-
} else {
|
|
56998
|
-
let user = null;
|
|
56999
|
-
try {
|
|
57000
|
-
user = await getUser(client);
|
|
57001
|
-
} catch (_err) {
|
|
57002
|
-
output_manager_default.error("Failed to fetch the logged in user. Please try again.");
|
|
57003
|
-
return 1;
|
|
57004
|
-
}
|
|
57005
|
-
if (user.version === "northstar" && user.defaultTeamId) {
|
|
57006
|
-
client.config.currentTeam = user.defaultTeamId;
|
|
57007
|
-
} else {
|
|
57008
|
-
delete client.config.currentTeam;
|
|
57009
|
-
}
|
|
57010
|
-
}
|
|
57011
|
-
}
|
|
57012
|
-
|
|
57013
|
-
// src/util/ua.ts
|
|
57014
|
-
import os2 from "os";
|
|
57015
|
-
var ua_default = `${pkg_default.name} ${pkg_default.version} node-${process.version} ${os2.platform()} (${os2.arch()})`;
|
|
57016
|
-
|
|
57017
|
-
// src/util/oauth.ts
|
|
57018
|
-
import { hostname } from "os";
|
|
57019
|
-
var VERCEL_ISSUER = new URL("https://vercel.com");
|
|
57020
|
-
var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
|
|
57021
|
-
var userAgent = `${hostname()} @ ${ua_default}`;
|
|
57022
|
-
var _as;
|
|
57023
|
-
async function as() {
|
|
57024
|
-
if (!_as) {
|
|
57025
|
-
const discoveryResponse = await discoveryEndpointRequest(VERCEL_ISSUER);
|
|
57026
|
-
const [discoveryResponseError, as2] = await processDiscoveryEndpointResponse(discoveryResponse);
|
|
57027
|
-
if (discoveryResponseError) {
|
|
57028
|
-
throw discoveryResponseError;
|
|
57029
|
-
}
|
|
57030
|
-
_as = as2;
|
|
57031
|
-
}
|
|
57032
|
-
return _as;
|
|
57033
|
-
}
|
|
57034
|
-
async function discoveryEndpointRequest(issuer) {
|
|
57035
|
-
return await fetch2(new URL(".well-known/openid-configuration", issuer), {
|
|
57036
|
-
headers: { "Content-Type": "application/json", "user-agent": userAgent }
|
|
57037
|
-
});
|
|
57038
|
-
}
|
|
57039
|
-
async function processDiscoveryEndpointResponse(response) {
|
|
57040
|
-
const json = await response.json();
|
|
57041
|
-
if (!response.ok) {
|
|
57042
|
-
return [new Error("Discovery endpoint request failed")];
|
|
57043
|
-
}
|
|
57044
|
-
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)) {
|
|
57045
|
-
return [new TypeError("Invalid discovery response")];
|
|
57046
|
-
}
|
|
57047
|
-
const issuer = new URL(json.issuer);
|
|
57048
|
-
if (issuer.href !== VERCEL_ISSUER.href) {
|
|
57049
|
-
return [new Error("Issuer mismatch")];
|
|
57050
|
-
}
|
|
57051
|
-
return [
|
|
57052
|
-
null,
|
|
57053
|
-
{
|
|
57054
|
-
issuer,
|
|
57055
|
-
device_authorization_endpoint: new URL(
|
|
57056
|
-
json.device_authorization_endpoint
|
|
57057
|
-
),
|
|
57058
|
-
token_endpoint: new URL(json.token_endpoint),
|
|
57059
|
-
revocation_endpoint: new URL(json.revocation_endpoint),
|
|
57060
|
-
jwks_uri: new URL(json.jwks_uri),
|
|
57061
|
-
introspection_endpoint: new URL(json.introspection_endpoint)
|
|
57062
|
-
}
|
|
57063
|
-
];
|
|
57064
|
-
}
|
|
57065
|
-
async function deviceAuthorizationRequest(options) {
|
|
57066
|
-
const body = new URLSearchParams({
|
|
57067
|
-
client_id: VERCEL_CLI_CLIENT_ID
|
|
57068
|
-
});
|
|
57069
|
-
if (options?.refresh_token) {
|
|
57070
|
-
body.set("refresh_token", options.refresh_token);
|
|
57071
|
-
if (options.acr_values) {
|
|
57072
|
-
body.set("acr_values", options.acr_values);
|
|
57073
|
-
}
|
|
57074
|
-
} else {
|
|
57075
|
-
body.set("scope", "openid offline_access");
|
|
57076
|
-
}
|
|
57077
|
-
return await fetch2((await as()).device_authorization_endpoint, {
|
|
57078
|
-
method: "POST",
|
|
57079
|
-
headers: {
|
|
57080
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
57081
|
-
"user-agent": userAgent
|
|
57082
|
-
},
|
|
57083
|
-
body
|
|
57084
|
-
});
|
|
57085
|
-
}
|
|
57086
|
-
async function processDeviceAuthorizationResponse(response) {
|
|
57087
|
-
const json = await response.json();
|
|
57088
|
-
if (!response.ok) {
|
|
57089
|
-
return [new OAuthError("Device authorization request failed", json)];
|
|
57090
|
-
}
|
|
57091
|
-
if (typeof json !== "object" || json === null)
|
|
57092
|
-
return [new TypeError("Expected response to be an object")];
|
|
57093
|
-
if (!("device_code" in json) || typeof json.device_code !== "string")
|
|
57094
|
-
return [new TypeError("Expected `device_code` to be a string")];
|
|
57095
|
-
if (!("user_code" in json) || typeof json.user_code !== "string")
|
|
57096
|
-
return [new TypeError("Expected `user_code` to be a string")];
|
|
57097
|
-
if (!("verification_uri" in json) || typeof json.verification_uri !== "string" || !canParseURL(json.verification_uri)) {
|
|
57098
|
-
return [new TypeError("Expected `verification_uri` to be a string")];
|
|
57099
|
-
}
|
|
57100
|
-
if (!("verification_uri_complete" in json) || typeof json.verification_uri_complete !== "string" || !canParseURL(json.verification_uri_complete)) {
|
|
57101
|
-
return [
|
|
57102
|
-
new TypeError("Expected `verification_uri_complete` to be a string")
|
|
57103
|
-
];
|
|
57104
|
-
}
|
|
57105
|
-
if (!("expires_in" in json) || typeof json.expires_in !== "number")
|
|
57106
|
-
return [new TypeError("Expected `expires_in` to be a number")];
|
|
57107
|
-
if (!("interval" in json) || typeof json.interval !== "number")
|
|
57108
|
-
return [new TypeError("Expected `interval` to be a number")];
|
|
57109
|
-
return [
|
|
57110
|
-
null,
|
|
57111
|
-
{
|
|
57112
|
-
device_code: json.device_code,
|
|
57113
|
-
user_code: json.user_code,
|
|
57114
|
-
verification_uri: json.verification_uri,
|
|
57115
|
-
verification_uri_complete: json.verification_uri_complete,
|
|
57116
|
-
expiresAt: Date.now() + json.expires_in * 1e3,
|
|
57117
|
-
interval: json.interval
|
|
57118
|
-
}
|
|
57119
|
-
];
|
|
57120
|
-
}
|
|
57121
|
-
async function deviceAccessTokenRequest(options) {
|
|
57122
|
-
try {
|
|
57123
|
-
return [
|
|
57124
|
-
null,
|
|
57125
|
-
await fetch2((await as()).token_endpoint, {
|
|
57126
|
-
method: "POST",
|
|
57127
|
-
headers: {
|
|
57128
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
57129
|
-
"user-agent": userAgent
|
|
57130
|
-
},
|
|
57131
|
-
body: new URLSearchParams({
|
|
57132
|
-
client_id: VERCEL_CLI_CLIENT_ID,
|
|
57133
|
-
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
57134
|
-
...options
|
|
57135
|
-
}),
|
|
57136
|
-
signal: AbortSignal.timeout(10 * 1e3)
|
|
57137
|
-
})
|
|
57138
|
-
];
|
|
57139
|
-
} catch (error) {
|
|
57140
|
-
if (error instanceof Error)
|
|
57141
|
-
return [error];
|
|
57142
|
-
return [
|
|
57143
|
-
new Error("An unknown error occurred. See the logs for details.", {
|
|
57144
|
-
cause: error
|
|
57145
|
-
})
|
|
57146
|
-
];
|
|
57147
|
-
}
|
|
57148
|
-
}
|
|
57149
|
-
async function processTokenResponse(response) {
|
|
57150
|
-
const json = await response.json();
|
|
57151
|
-
if (!response.ok) {
|
|
57152
|
-
return [new OAuthError("Device access token request failed", json)];
|
|
57153
|
-
}
|
|
57154
|
-
if (typeof json !== "object" || json === null)
|
|
57155
|
-
return [new TypeError("Expected response to be an object")];
|
|
57156
|
-
if (!("access_token" in json) || typeof json.access_token !== "string")
|
|
57157
|
-
return [new TypeError("Expected `access_token` to be a string")];
|
|
57158
|
-
if (!("token_type" in json) || json.token_type !== "Bearer")
|
|
57159
|
-
return [new TypeError('Expected `token_type` to be "Bearer"')];
|
|
57160
|
-
if (!("expires_in" in json) || typeof json.expires_in !== "number")
|
|
57161
|
-
return [new TypeError("Expected `expires_in` to be a number")];
|
|
57162
|
-
if ("refresh_token" in json && (typeof json.refresh_token !== "string" || !json.refresh_token))
|
|
57163
|
-
return [new TypeError("Expected `refresh_token` to be a string")];
|
|
57164
|
-
if ("scope" in json && typeof json.scope !== "string")
|
|
57165
|
-
return [new TypeError("Expected `scope` to be a string")];
|
|
57166
|
-
return [null, json];
|
|
57167
|
-
}
|
|
57168
|
-
async function revocationRequest(options) {
|
|
57169
|
-
return await fetch2((await as()).revocation_endpoint, {
|
|
57170
|
-
method: "POST",
|
|
57171
|
-
headers: {
|
|
57172
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
57173
|
-
"user-agent": userAgent
|
|
57174
|
-
},
|
|
57175
|
-
body: new URLSearchParams({ ...options, client_id: VERCEL_CLI_CLIENT_ID })
|
|
57176
|
-
});
|
|
57177
|
-
}
|
|
57178
|
-
async function processRevocationResponse(response) {
|
|
57179
|
-
if (response.ok)
|
|
57180
|
-
return [null, null];
|
|
57181
|
-
const json = await response.json();
|
|
57182
|
-
return [new OAuthError("Revocation request failed", json)];
|
|
57183
|
-
}
|
|
57184
|
-
async function refreshTokenRequest(options) {
|
|
57185
|
-
return await fetch2((await as()).token_endpoint, {
|
|
57186
|
-
method: "POST",
|
|
57187
|
-
headers: {
|
|
57188
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
57189
|
-
"user-agent": userAgent
|
|
57190
|
-
},
|
|
57191
|
-
body: new URLSearchParams({
|
|
57192
|
-
client_id: VERCEL_CLI_CLIENT_ID,
|
|
57193
|
-
grant_type: "refresh_token",
|
|
57194
|
-
...options
|
|
57195
|
-
})
|
|
57196
|
-
});
|
|
57197
|
-
}
|
|
57198
|
-
function processOAuthErrorResponse(json) {
|
|
57199
|
-
if (typeof json !== "object" || json === null)
|
|
57200
|
-
return new TypeError("Expected response to be an object");
|
|
57201
|
-
if (!("error" in json) || typeof json.error !== "string")
|
|
57202
|
-
return new TypeError("Expected `error` to be a string");
|
|
57203
|
-
if ("error_description" in json && typeof json.error_description !== "string")
|
|
57204
|
-
return new TypeError("Expected `error_description` to be a string");
|
|
57205
|
-
if ("error_uri" in json && typeof json.error_uri !== "string")
|
|
57206
|
-
return new TypeError("Expected `error_uri` to be a string");
|
|
57207
|
-
return json;
|
|
57208
|
-
}
|
|
57209
|
-
var OAuthError = class extends Error {
|
|
57210
|
-
constructor(message, response) {
|
|
57211
|
-
var __super = (...args) => {
|
|
57212
|
-
super(...args);
|
|
57213
|
-
};
|
|
57214
|
-
const error = processOAuthErrorResponse(response);
|
|
57215
|
-
if (error instanceof TypeError) {
|
|
57216
|
-
const message2 = `Unexpected server response: ${JSON.stringify(response)}`;
|
|
57217
|
-
__super(message2);
|
|
57218
|
-
this.cause = new Error(message2, { cause: error });
|
|
57219
|
-
this.code = "server_error";
|
|
57220
|
-
return;
|
|
57221
|
-
}
|
|
57222
|
-
let cause = error.error;
|
|
57223
|
-
if (error.error_description)
|
|
57224
|
-
cause += `: ${error.error_description}`;
|
|
57225
|
-
if (error.error_uri)
|
|
57226
|
-
cause += ` (${error.error_uri})`;
|
|
57227
|
-
__super(message, { cause });
|
|
57228
|
-
this.cause = new Error(cause);
|
|
57229
|
-
this.code = error.error;
|
|
57230
|
-
}
|
|
57231
|
-
};
|
|
57232
|
-
function isOAuthError(error) {
|
|
57233
|
-
return error instanceof OAuthError;
|
|
57234
|
-
}
|
|
57235
|
-
function canParseURL(url) {
|
|
57236
|
-
try {
|
|
57237
|
-
return !!new URL(url);
|
|
57238
|
-
} catch {
|
|
57239
|
-
return false;
|
|
57240
|
-
}
|
|
57241
|
-
}
|
|
57242
|
-
|
|
57243
|
-
// src/commands/login/future.ts
|
|
57244
|
-
async function performDeviceCodeFlow(client, options) {
|
|
57245
|
-
const deviceAuthorizationResponse = await deviceAuthorizationRequest({
|
|
57246
|
-
refresh_token: options?.refreshToken,
|
|
57247
|
-
acr_values: options?.acrValues
|
|
57248
|
-
});
|
|
57249
|
-
output_manager_default.debug(
|
|
57250
|
-
`'Device Authorization response:', ${await deviceAuthorizationResponse.clone().text()}`
|
|
57251
|
-
);
|
|
57252
|
-
const [deviceAuthorizationError, deviceAuthorization] = await processDeviceAuthorizationResponse(deviceAuthorizationResponse);
|
|
57253
|
-
if (deviceAuthorizationError) {
|
|
57254
|
-
printError(deviceAuthorizationError);
|
|
57255
|
-
return null;
|
|
57256
|
-
}
|
|
57257
|
-
const { device_code, user_code, verification_uri, expiresAt, interval } = deviceAuthorization;
|
|
57258
|
-
let { verification_uri_complete } = deviceAuthorization;
|
|
57259
|
-
if (options?.teamId) {
|
|
57260
|
-
const url = new URL(verification_uri_complete);
|
|
57261
|
-
url.searchParams.set("team_id", options.teamId);
|
|
57262
|
-
verification_uri_complete = url.toString();
|
|
57263
|
-
}
|
|
57264
|
-
const isCursorAgent = client.agentName === KNOWN_AGENTS.CURSOR || client.agentName === KNOWN_AGENTS.CURSOR_CLI;
|
|
57265
|
-
const shouldSkipBrowser = process.env.CI && !isCursorAgent;
|
|
57266
|
-
output_manager_default.log(
|
|
57267
|
-
`
|
|
57268
|
-
Visit ${import_chalk12.default.bold(
|
|
57269
|
-
output_manager_default.link(
|
|
57270
|
-
verification_uri.replace("https://", ""),
|
|
57271
|
-
verification_uri_complete,
|
|
57272
|
-
{ color: false, fallback: () => verification_uri_complete }
|
|
57273
|
-
)
|
|
57274
|
-
)}${output_manager_default.supportsHyperlink ? ` and enter ${import_chalk12.default.bold(user_code)}` : ""}
|
|
57275
|
-
`
|
|
57276
|
-
);
|
|
57277
|
-
if (!shouldSkipBrowser) {
|
|
57278
|
-
try {
|
|
57279
|
-
const browserProcess = await open.default(verification_uri_complete);
|
|
57280
|
-
browserProcess.on("error", (error) => {
|
|
57281
|
-
output_manager_default.debug(`Failed to open browser: ${error}`);
|
|
57282
|
-
});
|
|
57283
|
-
} catch (error) {
|
|
57284
|
-
output_manager_default.debug(`Failed to open browser: ${error}`);
|
|
57285
|
-
if (client.isAgent && client.nonInteractive) {
|
|
57286
|
-
output_manager_default.log(
|
|
57287
|
-
`
|
|
57288
|
-
${import_chalk12.default.yellow("\u26A0")} ${import_chalk12.default.bold("Browser could not be opened automatically.")}
|
|
57289
|
-
`
|
|
57290
|
-
);
|
|
57291
|
-
output_manager_default.log(
|
|
57292
|
-
`Please ask the user to manually visit the URL above and complete the authentication process.
|
|
57293
|
-
`
|
|
57294
|
-
);
|
|
57295
|
-
}
|
|
57296
|
-
}
|
|
57297
|
-
}
|
|
57298
|
-
const rl = readline3.createInterface({
|
|
57299
|
-
input: process.stdin,
|
|
57300
|
-
output: process.stdout
|
|
57301
|
-
}).on("SIGINT", () => {
|
|
57302
|
-
process.exit(0);
|
|
57303
|
-
});
|
|
57304
|
-
output_manager_default.spinner("Waiting for authentication...");
|
|
57305
|
-
let intervalMs = interval * 1e3;
|
|
57306
|
-
let result = null;
|
|
57307
|
-
let flowError = new Error(
|
|
57308
|
-
"Timed out waiting for authentication. Please try again."
|
|
57309
|
-
);
|
|
57310
|
-
async function pollForToken() {
|
|
57311
|
-
while (Date.now() < expiresAt) {
|
|
57312
|
-
const [tokenResponseError, tokenResponse] = await deviceAccessTokenRequest({ device_code });
|
|
57313
|
-
if (tokenResponseError) {
|
|
57314
|
-
if (tokenResponseError.message.includes("timeout")) {
|
|
57315
|
-
intervalMs *= 2;
|
|
57316
|
-
output_manager_default.debug(
|
|
57317
|
-
`Connection timeout. Slowing down, polling every ${intervalMs / 1e3}s...`
|
|
57318
|
-
);
|
|
57319
|
-
await wait(intervalMs);
|
|
57320
|
-
continue;
|
|
57321
|
-
}
|
|
57322
|
-
return tokenResponseError;
|
|
57323
|
-
}
|
|
57324
|
-
output_manager_default.debug(
|
|
57325
|
-
`'Device Access Token response:', ${await tokenResponse.clone().text()}`
|
|
57326
|
-
);
|
|
57327
|
-
const [tokensError, tokens] = await processTokenResponse(tokenResponse);
|
|
57328
|
-
if (isOAuthError(tokensError)) {
|
|
57329
|
-
const { code: code2 } = tokensError;
|
|
57330
|
-
switch (code2) {
|
|
57331
|
-
case "authorization_pending":
|
|
57332
|
-
await wait(intervalMs);
|
|
57333
|
-
continue;
|
|
57334
|
-
case "slow_down":
|
|
57335
|
-
intervalMs += 5 * 1e3;
|
|
57336
|
-
output_manager_default.debug(
|
|
57337
|
-
`Authorization server requests to slow down. Polling every ${intervalMs / 1e3}s...`
|
|
57338
|
-
);
|
|
57339
|
-
await wait(intervalMs);
|
|
57340
|
-
continue;
|
|
57341
|
-
default:
|
|
57342
|
-
return tokensError.cause;
|
|
57343
|
-
}
|
|
57344
|
-
}
|
|
57345
|
-
if (tokensError)
|
|
57346
|
-
return tokensError;
|
|
57347
|
-
output_manager_default.print((0, import_ansi_escapes4.eraseLines)(2));
|
|
57348
|
-
result = {
|
|
57349
|
-
access_token: tokens.access_token,
|
|
57350
|
-
expires_in: tokens.expires_in,
|
|
57351
|
-
refresh_token: tokens.refresh_token
|
|
57352
|
-
};
|
|
57353
|
-
return;
|
|
57354
|
-
}
|
|
57355
|
-
}
|
|
57356
|
-
flowError = await pollForToken();
|
|
57357
|
-
output_manager_default.stopSpinner();
|
|
57358
|
-
rl.close();
|
|
57359
|
-
if (flowError) {
|
|
57360
|
-
printError(flowError);
|
|
57361
|
-
return null;
|
|
57362
|
-
}
|
|
57363
|
-
return result;
|
|
57364
|
-
}
|
|
57365
|
-
async function login(client, telemetry) {
|
|
57366
|
-
const tokens = await performDeviceCodeFlow(client);
|
|
57367
|
-
if (!tokens) {
|
|
57368
|
-
telemetry.trackState("error");
|
|
57369
|
-
return 1;
|
|
57370
|
-
}
|
|
57371
|
-
const isInitialLogin = !client.authConfig.token;
|
|
57372
|
-
client.updateAuthConfig({
|
|
57373
|
-
token: tokens.access_token,
|
|
57374
|
-
userId: void 0,
|
|
57375
|
-
expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in,
|
|
57376
|
-
refreshToken: tokens.refresh_token
|
|
57377
|
-
});
|
|
57378
|
-
client.updateConfig({ currentTeam: void 0 });
|
|
57379
|
-
if (isInitialLogin) {
|
|
57380
|
-
await updateCurrentTeamAfterLogin(client);
|
|
57381
|
-
}
|
|
57382
|
-
client.persistAuthConfig();
|
|
57383
|
-
client.writeToConfigFile();
|
|
57384
|
-
output_manager_default.debug(`Saved credentials in "${humanizePath(client.getGlobalPathConfig())}"`);
|
|
57385
|
-
output_manager_default.print(`
|
|
57386
|
-
${import_chalk12.default.cyan("Congratulations!")} You are now signed in.
|
|
57387
|
-
|
|
57388
|
-
To deploy something, run ${getCommandName()}.
|
|
57389
|
-
|
|
57390
|
-
${emoji("tip")} To deploy every commit automatically,
|
|
57391
|
-
connect a Git Repository (${import_chalk12.default.bold(output_manager_default.link("vercel.link/git", "https://vercel.link/git", { color: false }))}).
|
|
57392
|
-
`);
|
|
57393
|
-
telemetry.trackState("success");
|
|
57394
|
-
return 0;
|
|
57395
|
-
}
|
|
57396
|
-
async function wait(intervalMs) {
|
|
57397
|
-
await new Promise((resolve4) => setTimeout(resolve4, intervalMs));
|
|
57398
|
-
}
|
|
57399
|
-
|
|
57400
57460
|
// src/commands/env/pull.ts
|
|
57401
57461
|
var CONTENTS_PREFIX = "# Created by Vercel CLI\n";
|
|
57402
57462
|
function readHeadSync(path, length) {
|
|
@@ -57596,7 +57656,7 @@ async function envPullCommandLogic(client, filename, skipConfirmation, environme
|
|
|
57596
57656
|
output_manager_default.log(downloadMessage);
|
|
57597
57657
|
output_manager_default.spinner("Downloading");
|
|
57598
57658
|
const pullId = deploymentId || link.project.id;
|
|
57599
|
-
const pullResult = await
|
|
57659
|
+
const pullResult = await pullEnvRecords(client, pullId, source, {
|
|
57600
57660
|
target: environment || "development",
|
|
57601
57661
|
gitBranch
|
|
57602
57662
|
});
|
|
@@ -57681,54 +57741,6 @@ async function envPullCommandLogic(client, filename, skipConfirmation, environme
|
|
|
57681
57741
|
{ gutter: "\u2713" }
|
|
57682
57742
|
);
|
|
57683
57743
|
}
|
|
57684
|
-
async function pullEnvRecordsForEnvPull(client, pullId, source, options) {
|
|
57685
|
-
try {
|
|
57686
|
-
return await pullEnvRecords(client, pullId, source, options);
|
|
57687
|
-
} catch (error) {
|
|
57688
|
-
if (!isAPIError(error) || error.code !== "challenge_required") {
|
|
57689
|
-
throw error;
|
|
57690
|
-
}
|
|
57691
|
-
const refreshToken = client.authConfig.refreshToken;
|
|
57692
|
-
if (!refreshToken || client.authConfig.tokenSource || !client.stdin.isTTY) {
|
|
57693
|
-
throw error;
|
|
57694
|
-
}
|
|
57695
|
-
output_manager_default.stopSpinner();
|
|
57696
|
-
output_manager_default.log("Sensitive Environment Variables require fresh authentication.");
|
|
57697
|
-
const acrValues = getAcrValuesFromWWWAuthenticate(error.wwwAuthenticate);
|
|
57698
|
-
if (!acrValues) {
|
|
57699
|
-
throw error;
|
|
57700
|
-
}
|
|
57701
|
-
const tokens = await performDeviceCodeFlow(client, {
|
|
57702
|
-
refreshToken,
|
|
57703
|
-
acrValues
|
|
57704
|
-
});
|
|
57705
|
-
if (!tokens) {
|
|
57706
|
-
throw error;
|
|
57707
|
-
}
|
|
57708
|
-
client.updateAuthConfig({
|
|
57709
|
-
token: tokens.access_token,
|
|
57710
|
-
userId: void 0,
|
|
57711
|
-
expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in
|
|
57712
|
-
});
|
|
57713
|
-
client.persistAuthConfig();
|
|
57714
|
-
output_manager_default.spinner("Downloading");
|
|
57715
|
-
return await pullEnvRecords(client, pullId, source, options);
|
|
57716
|
-
}
|
|
57717
|
-
}
|
|
57718
|
-
function getAcrValuesFromWWWAuthenticate(header) {
|
|
57719
|
-
if (!header) {
|
|
57720
|
-
return;
|
|
57721
|
-
}
|
|
57722
|
-
const bearerIndex = header.toLowerCase().indexOf("bearer");
|
|
57723
|
-
if (bearerIndex === -1) {
|
|
57724
|
-
return;
|
|
57725
|
-
}
|
|
57726
|
-
const bearerChallenge = header.slice(bearerIndex + "bearer".length);
|
|
57727
|
-
const match = bearerChallenge.match(
|
|
57728
|
-
/(?:^|[,\s])acr_values=(?:"((?:\\.|[^"\\])*)"|([^,\s]+))/i
|
|
57729
|
-
);
|
|
57730
|
-
return match?.[1]?.replace(/\\(.)/g, "$1") ?? match?.[2];
|
|
57731
|
-
}
|
|
57732
57744
|
function escapeValue2(value) {
|
|
57733
57745
|
return value ? value.replace(new RegExp("\n", "g"), "\\n").replace(new RegExp("\r", "g"), "\\r") : "";
|
|
57734
57746
|
}
|
|
@@ -57775,17 +57787,16 @@ async function readFileSafe(file) {
|
|
|
57775
57787
|
}
|
|
57776
57788
|
|
|
57777
57789
|
// src/util/validate-config.ts
|
|
57778
|
-
var import_ajv = __toESM(require_ajv(), 1);
|
|
57779
57790
|
var import_routing_utils = __toESM(require_dist5(), 1);
|
|
57780
57791
|
var import_client = __toESM(require_dist7(), 1);
|
|
57781
57792
|
import {
|
|
57782
57793
|
getFunctionsSchema,
|
|
57783
57794
|
buildsSchema,
|
|
57784
|
-
getMaxDurationLimit,
|
|
57785
57795
|
getMaxDurationSchema,
|
|
57786
57796
|
NowBuildError,
|
|
57787
57797
|
getPrettyError
|
|
57788
57798
|
} from "@vercel/build-utils";
|
|
57799
|
+
import { getConfigValidator } from "./config-validator.mjs";
|
|
57789
57800
|
var imagesSchema = {
|
|
57790
57801
|
type: "object",
|
|
57791
57802
|
additionalProperties: false,
|
|
@@ -58334,19 +58345,8 @@ function buildVercelConfigSchema() {
|
|
|
58334
58345
|
}
|
|
58335
58346
|
};
|
|
58336
58347
|
}
|
|
58337
|
-
var ajv = new import_ajv.default();
|
|
58338
|
-
var validatorCacheByLimit = /* @__PURE__ */ new Map();
|
|
58339
|
-
function getConfigValidator() {
|
|
58340
|
-
const cacheKey = getMaxDurationLimit() ?? "skipped";
|
|
58341
|
-
let validate = validatorCacheByLimit.get(cacheKey);
|
|
58342
|
-
if (!validate) {
|
|
58343
|
-
validate = ajv.compile(buildVercelConfigSchema());
|
|
58344
|
-
validatorCacheByLimit.set(cacheKey, validate);
|
|
58345
|
-
}
|
|
58346
|
-
return validate;
|
|
58347
|
-
}
|
|
58348
58348
|
function validateConfig(config) {
|
|
58349
|
-
const validate = getConfigValidator();
|
|
58349
|
+
const validate = getConfigValidator(buildVercelConfigSchema);
|
|
58350
58350
|
if (!validate(config)) {
|
|
58351
58351
|
if (validate.errors && validate.errors[0]) {
|
|
58352
58352
|
const error = validate.errors[0];
|
|
@@ -58815,9 +58815,9 @@ async function getProjectLinkFromRepoLink(client, path, projectName, projectName
|
|
|
58815
58815
|
async function getLinkFromDir(dir) {
|
|
58816
58816
|
try {
|
|
58817
58817
|
const json = await readFile5(join9(dir, VERCEL_DIR_PROJECT), "utf8");
|
|
58818
|
-
const
|
|
58818
|
+
const ajv = new import_ajv.default();
|
|
58819
58819
|
const link = JSON.parse(json);
|
|
58820
|
-
if (!
|
|
58820
|
+
if (!ajv.validate(linkSchema, link)) {
|
|
58821
58821
|
const raw = link;
|
|
58822
58822
|
const projectId = raw.projectId;
|
|
58823
58823
|
const orgId = raw.orgId;
|