vercel
Version:
The command-line interface for Vercel
607 lines (594 loc) • 29.6 kB
JavaScript
import { createRequire as __createRequire } from 'node:module';
import { fileURLToPath as __fileURLToPath } from 'node:url';
import { dirname as __dirname_ } from 'node:path';
const require = __createRequire(import.meta.url);
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __dirname_(__filename);
import {
getCommandName,
getCommandNamePlain,
normalizeFlagName,
parseRetryAfterHeaderAsMillis,
require_bytes,
stripSensitiveAuthArgs
} from "./chunk-UGXBNJMO.js";
import {
output_manager_default
} from "./chunk-ZQKJVHXY.js";
import {
require_source
} from "./chunk-S7KYDPEM.js";
import {
__commonJS,
__toESM
} from "./chunk-TZ2YI2VH.js";
// ../../node_modules/.pnpm/arg@5.0.0/node_modules/arg/index.js
var require_arg = __commonJS({
"../../node_modules/.pnpm/arg@5.0.0/node_modules/arg/index.js"(exports, module) {
var flagSymbol = Symbol("arg flag");
var ArgError = class _ArgError extends Error {
constructor(msg, code) {
super(msg);
this.name = "ArgError";
this.code = code;
Object.setPrototypeOf(this, _ArgError.prototype);
}
};
function arg2(opts, { argv = process.argv.slice(2), permissive = false, stopAtPositional = false } = {}) {
if (!opts) {
throw new ArgError("argument specification object is required", "ARG_CONFIG_NO_SPEC");
}
const result = { _: [] };
const aliases = {};
const handlers = {};
for (const key of Object.keys(opts)) {
if (!key) {
throw new ArgError("argument key cannot be an empty string", "ARG_CONFIG_EMPTY_KEY");
}
if (key[0] !== "-") {
throw new ArgError(`argument key must start with '-' but found: '${key}'`, "ARG_CONFIG_NONOPT_KEY");
}
if (key.length === 1) {
throw new ArgError(`argument key must have a name; singular '-' keys are not allowed: ${key}`, "ARG_CONFIG_NONAME_KEY");
}
if (typeof opts[key] === "string") {
aliases[key] = opts[key];
continue;
}
let type = opts[key];
let isFlag = false;
if (Array.isArray(type) && type.length === 1 && typeof type[0] === "function") {
const [fn] = type;
type = (value, name, prev = []) => {
prev.push(fn(value, name, prev[prev.length - 1]));
return prev;
};
isFlag = fn === Boolean || fn[flagSymbol] === true;
} else if (typeof type === "function") {
isFlag = type === Boolean || type[flagSymbol] === true;
} else {
throw new ArgError(`type missing or not a function or valid array type: ${key}`, "ARG_CONFIG_VAD_TYPE");
}
if (key[1] !== "-" && key.length > 2) {
throw new ArgError(`short argument keys (with a single hyphen) must have only one character: ${key}`, "ARG_CONFIG_SHORTOPT_TOOLONG");
}
handlers[key] = [type, isFlag];
}
for (let i = 0, len = argv.length; i < len; i++) {
const wholeArg = argv[i];
if (stopAtPositional && result._.length > 0) {
result._ = result._.concat(argv.slice(i));
break;
}
if (wholeArg === "--") {
result._ = result._.concat(argv.slice(i + 1));
break;
}
if (wholeArg.length > 1 && wholeArg[0] === "-") {
const separatedArguments = wholeArg[1] === "-" || wholeArg.length === 2 ? [wholeArg] : wholeArg.slice(1).split("").map((a) => `-${a}`);
for (let j = 0; j < separatedArguments.length; j++) {
const arg3 = separatedArguments[j];
const [originalArgName, argStr] = arg3[1] === "-" ? arg3.split(/=(.*)/, 2) : [arg3, void 0];
let argName = originalArgName;
while (argName in aliases) {
argName = aliases[argName];
}
if (!(argName in handlers)) {
if (permissive) {
result._.push(arg3);
continue;
} else {
throw new ArgError(`unknown or unexpected option: ${originalArgName}`, "ARG_UNKNOWN_OPTION");
}
}
const [type, isFlag] = handlers[argName];
if (!isFlag && j + 1 < separatedArguments.length) {
throw new ArgError(`option requires argument (but was followed by another short argument): ${originalArgName}`, "ARG_MISSING_REQUIRED_SHORTARG");
}
if (isFlag) {
result[argName] = type(true, argName, result[argName]);
} else if (argStr === void 0) {
if (argv.length < i + 2 || argv[i + 1].length > 1 && argv[i + 1][0] === "-" && !(argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) && (type === Number || // eslint-disable-next-line no-undef
typeof BigInt !== "undefined" && type === BigInt))) {
const extended = originalArgName === argName ? "" : ` (alias for ${argName})`;
throw new ArgError(`option requires argument: ${originalArgName}${extended}`, "ARG_MISSING_REQUIRED_LONGARG");
}
result[argName] = type(argv[i + 1], argName, result[argName]);
++i;
} else {
result[argName] = type(argStr, argName, result[argName]);
}
}
} else {
result._.push(wholeArg);
}
}
return result;
}
arg2.flag = (fn) => {
fn[flagSymbol] = true;
return fn;
};
arg2.COUNT = arg2.flag((v, name, existingCount) => (existingCount || 0) + 1);
arg2.ArgError = ArgError;
module.exports = arg2;
}
});
// ../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js
var require_ansi_regex = __commonJS({
"../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js"(exports, module) {
"use strict";
module.exports = ({ onlyFirst = false } = {}) => {
const pattern = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
].join("|");
return new RegExp(pattern, onlyFirst ? void 0 : "g");
};
}
});
// ../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js
var require_strip_ansi = __commonJS({
"../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports, module) {
"use strict";
var ansiRegex = require_ansi_regex();
module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
}
});
// ../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js
var require_is_fullwidth_code_point = __commonJS({
"../../node_modules/.pnpm/is-fullwidth-code-point@3.0.0/node_modules/is-fullwidth-code-point/index.js"(exports, module) {
"use strict";
var isFullwidthCodePoint = (codePoint) => {
if (Number.isNaN(codePoint)) {
return false;
}
if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
131072 <= codePoint && codePoint <= 262141)) {
return true;
}
return false;
};
module.exports = isFullwidthCodePoint;
module.exports.default = isFullwidthCodePoint;
}
});
// ../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js
var require_emoji_regex = __commonJS({
"../../node_modules/.pnpm/emoji-regex@8.0.0/node_modules/emoji-regex/index.js"(exports, module) {
"use strict";
module.exports = function() {
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD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C78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
};
}
});
// ../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
var require_string_width = __commonJS({
"../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js"(exports, module) {
"use strict";
var stripAnsi = require_strip_ansi();
var isFullwidthCodePoint = require_is_fullwidth_code_point();
var emojiRegex = require_emoji_regex();
var stringWidth = (string) => {
if (typeof string !== "string" || string.length === 0) {
return 0;
}
string = stripAnsi(string);
if (string.length === 0) {
return 0;
}
string = string.replace(emojiRegex(), " ");
let width = 0;
for (let i = 0; i < string.length; i++) {
const code = string.codePointAt(i);
if (code <= 31 || code >= 127 && code <= 159) {
continue;
}
if (code >= 768 && code <= 879) {
continue;
}
if (code > 65535) {
i++;
}
width += isFullwidthCodePoint(code) ? 2 : 1;
}
return width;
};
module.exports = stringWidth;
module.exports.default = stringWidth;
}
});
// src/util/get-flags-specification.ts
function getFlagsSpecification(options) {
const flagsSpecification = {};
for (const option of options) {
flagsSpecification[`--${option.name}`] = option.type;
if (option.shorthand) {
flagsSpecification[`-${option.shorthand}`] = `--${option.name}`;
}
}
return flagsSpecification;
}
// src/util/arg-common.ts
var globalCommandOptions = [
{
name: "help",
shorthand: "h",
type: Boolean,
description: "Output usage information",
deprecated: false
},
{
name: "version",
shorthand: "v",
type: Boolean,
description: "Output the version number",
deprecated: false
},
{
name: "cwd",
shorthand: null,
type: String,
argument: "DIR",
description: "Sets the current working directory for a single run of a command",
deprecated: false
},
{
name: "local-config",
shorthand: "A",
type: String,
argument: "FILE",
description: "Path to the local `vercel.json` file",
deprecated: false
},
{
name: "global-config",
shorthand: "Q",
type: String,
argument: "DIR",
description: "Path to the global `.vercel` directory",
deprecated: false
},
{
name: "debug",
shorthand: "d",
type: Boolean,
description: "Debug mode (default off)",
deprecated: false
},
{
name: "no-color",
shorthand: null,
type: Boolean,
description: "No color mode (default off)",
deprecated: false
},
{
name: "non-interactive",
shorthand: null,
type: Boolean,
description: "Run without interactive prompts; when an agent is detected this is the default",
deprecated: false
},
{
name: "scope",
shorthand: "S",
type: String,
description: "Set a custom scope",
deprecated: false
},
{
name: "token",
shorthand: "t",
type: String,
argument: "TOKEN",
description: "Login token",
deprecated: false
},
{ name: "team", shorthand: "T", type: String, deprecated: false },
{ name: "api", shorthand: null, type: String, deprecated: false }
];
var GLOBAL_CLI_FLAG_NAMES = (() => {
const set = /* @__PURE__ */ new Set();
for (const opt of globalCommandOptions) {
set.add(`--${opt.name}`);
if (opt.shorthand) {
set.add(`-${opt.shorthand}`);
}
}
return set;
})();
function globalCliFlagTakesValue(flagName) {
const normalized = normalizeFlagName(flagName);
for (const opt of globalCommandOptions) {
if (`--${opt.name}` === normalized) {
return opt.type === String;
}
if (opt.shorthand && `-${opt.shorthand}` === normalized) {
return opt.type === String;
}
}
return false;
}
var SUBCOMMAND_FLAG_TAKES_VALUE = /* @__PURE__ */ new Set([
"--status",
"--name",
"--slug",
"--version",
// redirects list --version
"--search",
"--format",
"--page",
"--per-page"
]);
function suggestionFlagTakesSeparateValue(flagName) {
const name = normalizeFlagName(flagName);
if (globalCliFlagTakesValue(name))
return true;
return SUBCOMMAND_FLAG_TAKES_VALUE.has(name);
}
function getSameSubcommandSuggestionFlags(args) {
const safeArgs = stripSensitiveAuthArgs(args);
const out = [];
for (let i = 0; i < safeArgs.length; i++) {
const a = safeArgs[i];
if (!a.startsWith("-"))
continue;
out.push(a);
if (a.includes("="))
continue;
const name = a;
if (suggestionFlagTakesSeparateValue(name) && i + 1 < safeArgs.length && !safeArgs[i + 1].startsWith("-")) {
out.push(safeArgs[++i]);
}
}
return out;
}
var GLOBAL_OPTIONS = getFlagsSpecification(globalCommandOptions);
var arg_common_default = () => GLOBAL_OPTIONS;
var yesOption = {
name: "yes",
shorthand: "y",
type: Boolean,
deprecated: false,
description: "Accept default value for all prompts"
};
var nextOption = {
name: "next",
shorthand: "N",
type: Number,
deprecated: false,
description: "Show next page of results",
argument: "MS"
};
var confirmOption = {
name: "confirm",
shorthand: "c",
type: Boolean,
deprecated: true
};
var limitOption = {
name: "limit",
shorthand: null,
type: Number,
deprecated: false,
description: "Number of results to return per page (default: 20, max: 100)",
argument: "NUMBER"
};
var forceOption = {
name: "force",
shorthand: "f",
type: Boolean,
deprecated: false
};
var formatOption = {
name: "format",
shorthand: "F",
type: String,
argument: "FORMAT",
description: "Specify the output format (json)",
deprecated: false
};
var jsonOption = {
name: "json",
shorthand: null,
type: Boolean,
deprecated: true,
description: "DEPRECATED: Use --format=json instead"
};
var allOption = {
name: "all",
shorthand: "a",
type: Boolean,
deprecated: false,
description: "List resources across all projects"
};
var GLOBAL_LONG_TO_OPT = /* @__PURE__ */ new Map();
var GLOBAL_SHORT_TO_OPT = /* @__PURE__ */ new Map();
for (const opt of globalCommandOptions) {
GLOBAL_LONG_TO_OPT.set(`--${opt.name}`, opt);
if (opt.shorthand) {
GLOBAL_SHORT_TO_OPT.set(`-${opt.shorthand}`, opt);
}
}
function getGlobalFlagsOnlyFromArgs(args) {
const safeArgs = stripSensitiveAuthArgs(args);
const out = [];
for (let i = 0; i < safeArgs.length; i++) {
const a = safeArgs[i];
let opt;
if (a.startsWith("--") && a.includes("=")) {
const name = a.slice(2).split("=")[0];
opt = GLOBAL_LONG_TO_OPT.get(`--${name}`);
if (opt)
out.push(a);
continue;
}
opt = GLOBAL_LONG_TO_OPT.get(a) || GLOBAL_SHORT_TO_OPT.get(a);
if (!opt)
continue;
out.push(a);
if (opt.type === String && !a.includes("=")) {
const next = safeArgs[i + 1];
if (next && !next.startsWith("-")) {
out.push(next);
i++;
}
}
}
return out;
}
function getCommandNameWithGlobalFlags(commandTemplate, argv) {
const flags = getGlobalFlagsOnlyFromArgs(argv.slice(2));
return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
}
// src/util/get-args.ts
var import_arg = __toESM(require_arg(), 1);
function getArgs(argv, argsOptions, argOptions = {}) {
return (0, import_arg.default)(Object.assign({}, arg_common_default(), argsOptions), {
...argOptions,
argv
});
}
function parseArguments(args, flagsSpecification, parserOptions = {}) {
const { _: positional, ...rest } = (0, import_arg.default)(
Object.assign({}, arg_common_default(), flagsSpecification),
{
...parserOptions,
argv: args
}
);
return { args: positional, flags: rest };
}
// src/util/output/error.ts
var import_chalk = __toESM(require_source(), 1);
// src/util/error.ts
var import_bytes = __toESM(require_bytes(), 1);
async function responseError(res, fallbackMessage = null, parsedBody = {}) {
let message = "";
let bodyError;
if (res.status >= 400 && res.status < 500) {
let body;
try {
body = await res.json();
} catch (_err) {
body = parsedBody;
}
bodyError = body.error || body.err || {};
message = bodyError.message;
}
if (!message) {
message = fallbackMessage === null ? "Response Error" : fallbackMessage;
}
const err = new Error(`${message} (${res.status})`);
err.status = res.status;
err.serverMessage = message;
if (bodyError) {
for (const field of Object.keys(bodyError)) {
if (field !== "message") {
err[field] = bodyError[field];
}
}
}
if (res.status === 429 || res.status === 503) {
const parsed = parseRetryAfterHeaderAsMillis(
res.headers.get("Retry-After")
);
err.retryAfterMs = parsed ?? (res.status === 429 ? 0 : void 0);
}
return err;
}
function toEnumerableError(err) {
const enumerable = {};
enumerable.name = err.name;
for (const key of Object.getOwnPropertyNames(err)) {
enumerable[key] = err[key];
}
return enumerable;
}
function printError(error2) {
if (typeof error2 === "string") {
error2 = new Error(error2);
}
const apiError = error2;
const { message, stack, status, code, sizeLimit } = apiError;
output_manager_default.debug(`handling error: ${stack}`);
if (message === "User force closed the prompt with 0 null") {
return;
}
if (status === 403) {
output_manager_default.error(
message || `Authentication error. Run ${getCommandName("login")} to log-in again.`
);
} else if (status === 429) {
output_manager_default.error(message);
} else if (code === "size_limit_exceeded") {
output_manager_default.error(`File size limit exceeded (${(0, import_bytes.default)(sizeLimit)})`);
} else if (message) {
output_manager_default.prettyError(apiError);
} else if (status === 500) {
output_manager_default.error("Unexpected server error. Please retry.");
} else if (code === "USER_ABORT") {
output_manager_default.log("Canceled");
} else {
output_manager_default.error(`Unexpected error. Please try again later. (${message})`);
}
}
export {
getFlagsSpecification,
globalCommandOptions,
GLOBAL_CLI_FLAG_NAMES,
globalCliFlagTakesValue,
getSameSubcommandSuggestionFlags,
yesOption,
nextOption,
confirmOption,
limitOption,
forceOption,
formatOption,
jsonOption,
allOption,
getGlobalFlagsOnlyFromArgs,
getCommandNameWithGlobalFlags,
getArgs,
parseArguments,
require_strip_ansi,
require_string_width,
responseError,
toEnumerableError,
printError
};