UNPKG

vercel

Version:

The command-line interface for Vercel

1,510 lines (1,494 loc) • 58 kB
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 { require_string_width } from "./chunk-4GQQJY5Y.js"; import { __commonJS, __require, __toESM } from "./chunk-TZ2YI2VH.js"; // ../../node_modules/.pnpm/cli-table3@0.6.3/node_modules/cli-table3/src/debug.js var require_debug = __commonJS({ "../../node_modules/.pnpm/cli-table3@0.6.3/node_modules/cli-table3/src/debug.js"(exports, module) { var messages = []; var level = 0; var debug = (msg, min) => { if (level >= min) { messages.push(msg); } }; debug.WARN = 1; debug.INFO = 2; debug.DEBUG = 3; debug.reset = () => { messages = []; }; debug.setDebugLevel = (v) => { level = v; }; debug.warn = (msg) => debug(msg, debug.WARN); debug.info = (msg) => debug(msg, debug.INFO); debug.debug = (msg) => debug(msg, debug.DEBUG); debug.debugMessages = () => messages; module.exports = debug; } }); // ../../node_modules/.pnpm/cli-table3@0.6.3/node_modules/cli-table3/src/utils.js var require_utils = __commonJS({ "../../node_modules/.pnpm/cli-table3@0.6.3/node_modules/cli-table3/src/utils.js"(exports, module) { var stringWidth = require_string_width(); function codeRegex(capture) { return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g; } function strlen(str) { let code = codeRegex(); let stripped = ("" + str).replace(code, ""); let split = stripped.split("\n"); return split.reduce(function(memo, s) { return stringWidth(s) > memo ? stringWidth(s) : memo; }, 0); } function repeat(str, times) { return Array(times + 1).join(str); } function pad(str, len, pad2, dir) { let length = strlen(str); if (len + 1 >= length) { let padlen = len - length; switch (dir) { case "right": { str = repeat(pad2, padlen) + str; break; } case "center": { let right = Math.ceil(padlen / 2); let left = padlen - right; str = repeat(pad2, left) + str + repeat(pad2, right); break; } default: { str = str + repeat(pad2, padlen); break; } } } return str; } var codeCache = {}; function addToCodeCache(name, on, off) { on = "\x1B[" + on + "m"; off = "\x1B[" + off + "m"; codeCache[on] = { set: name, to: true }; codeCache[off] = { set: name, to: false }; codeCache[name] = { on, off }; } addToCodeCache("bold", 1, 22); addToCodeCache("italics", 3, 23); addToCodeCache("underline", 4, 24); addToCodeCache("inverse", 7, 27); addToCodeCache("strikethrough", 9, 29); function updateState(state, controlChars) { let controlCode = controlChars[1] ? parseInt(controlChars[1].split(";")[0]) : 0; if (controlCode >= 30 && controlCode <= 39 || controlCode >= 90 && controlCode <= 97) { state.lastForegroundAdded = controlChars[0]; return; } if (controlCode >= 40 && controlCode <= 49 || controlCode >= 100 && controlCode <= 107) { state.lastBackgroundAdded = controlChars[0]; return; } if (controlCode === 0) { for (let i in state) { if (Object.prototype.hasOwnProperty.call(state, i)) { delete state[i]; } } return; } let info = codeCache[controlChars[0]]; if (info) { state[info.set] = info.to; } } function readState(line) { let code = codeRegex(true); let controlChars = code.exec(line); let state = {}; while (controlChars !== null) { updateState(state, controlChars); controlChars = code.exec(line); } return state; } function unwindState(state, ret) { let lastBackgroundAdded = state.lastBackgroundAdded; let lastForegroundAdded = state.lastForegroundAdded; delete state.lastBackgroundAdded; delete state.lastForegroundAdded; Object.keys(state).forEach(function(key) { if (state[key]) { ret += codeCache[key].off; } }); if (lastBackgroundAdded && lastBackgroundAdded != "\x1B[49m") { ret += "\x1B[49m"; } if (lastForegroundAdded && lastForegroundAdded != "\x1B[39m") { ret += "\x1B[39m"; } return ret; } function rewindState(state, ret) { let lastBackgroundAdded = state.lastBackgroundAdded; let lastForegroundAdded = state.lastForegroundAdded; delete state.lastBackgroundAdded; delete state.lastForegroundAdded; Object.keys(state).forEach(function(key) { if (state[key]) { ret = codeCache[key].on + ret; } }); if (lastBackgroundAdded && lastBackgroundAdded != "\x1B[49m") { ret = lastBackgroundAdded + ret; } if (lastForegroundAdded && lastForegroundAdded != "\x1B[39m") { ret = lastForegroundAdded + ret; } return ret; } function truncateWidth(str, desiredLength) { if (str.length === strlen(str)) { return str.substr(0, desiredLength); } while (strlen(str) > desiredLength) { str = str.slice(0, -1); } return str; } function truncateWidthWithAnsi(str, desiredLength) { let code = codeRegex(true); let split = str.split(codeRegex()); let splitIndex = 0; let retLen = 0; let ret = ""; let myArray; let state = {}; while (retLen < desiredLength) { myArray = code.exec(str); let toAdd = split[splitIndex]; splitIndex++; if (retLen + strlen(toAdd) > desiredLength) { toAdd = truncateWidth(toAdd, desiredLength - retLen); } ret += toAdd; retLen += strlen(toAdd); if (retLen < desiredLength) { if (!myArray) { break; } ret += myArray[0]; updateState(state, myArray); } } return unwindState(state, ret); } function truncate(str, desiredLength, truncateChar) { truncateChar = truncateChar || "\u2026"; let lengthOfStr = strlen(str); if (lengthOfStr <= desiredLength) { return str; } desiredLength -= strlen(truncateChar); let ret = truncateWidthWithAnsi(str, desiredLength); return ret + truncateChar; } function defaultOptions() { return { chars: { top: "\u2500", "top-mid": "\u252C", "top-left": "\u250C", "top-right": "\u2510", bottom: "\u2500", "bottom-mid": "\u2534", "bottom-left": "\u2514", "bottom-right": "\u2518", left: "\u2502", "left-mid": "\u251C", mid: "\u2500", "mid-mid": "\u253C", right: "\u2502", "right-mid": "\u2524", middle: "\u2502" }, truncate: "\u2026", colWidths: [], rowHeights: [], colAligns: [], rowAligns: [], style: { "padding-left": 1, "padding-right": 1, head: ["red"], border: ["grey"], compact: false }, head: [] }; } function mergeOptions(options, defaults) { options = options || {}; defaults = defaults || defaultOptions(); let ret = Object.assign({}, defaults, options); ret.chars = Object.assign({}, defaults.chars, options.chars); ret.style = Object.assign({}, defaults.style, options.style); return ret; } function wordWrap(maxLength, input) { let lines = []; let split = input.split(/(\s+)/g); let line = []; let lineLength = 0; let whitespace; for (let i = 0; i < split.length; i += 2) { let word = split[i]; let newLength = lineLength + strlen(word); if (lineLength > 0 && whitespace) { newLength += whitespace.length; } if (newLength > maxLength) { if (lineLength !== 0) { lines.push(line.join("")); } line = [word]; lineLength = strlen(word); } else { line.push(whitespace || "", word); lineLength = newLength; } whitespace = split[i + 1]; } if (lineLength) { lines.push(line.join("")); } return lines; } function textWrap(maxLength, input) { let lines = []; let line = ""; function pushLine(str, ws) { if (line.length && ws) line += ws; line += str; while (line.length > maxLength) { lines.push(line.slice(0, maxLength)); line = line.slice(maxLength); } } let split = input.split(/(\s+)/g); for (let i = 0; i < split.length; i += 2) { pushLine(split[i], i && split[i - 1]); } if (line.length) lines.push(line); return lines; } function multiLineWordWrap(maxLength, input, wrapOnWordBoundary = true) { let output = []; input = input.split("\n"); const handler = wrapOnWordBoundary ? wordWrap : textWrap; for (let i = 0; i < input.length; i++) { output.push.apply(output, handler(maxLength, input[i])); } return output; } function colorizeLines(input) { let state = {}; let output = []; for (let i = 0; i < input.length; i++) { let line = rewindState(state, input[i]); state = readState(line); let temp = Object.assign({}, state); output.push(unwindState(temp, line)); } return output; } function hyperlink(url, text) { const OSC = "\x1B]"; const BEL = "\x07"; const SEP = ";"; return [OSC, "8", SEP, SEP, url || text, BEL, text, OSC, "8", SEP, SEP, BEL].join(""); } module.exports = { strlen, repeat, pad, truncate, mergeOptions, wordWrap: multiLineWordWrap, colorizeLines, hyperlink }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/styles.js var require_styles = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/styles.js"(exports, module) { var styles = {}; module["exports"] = styles; var codes = { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29], black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], gray: [90, 39], grey: [90, 39], brightRed: [91, 39], brightGreen: [92, 39], brightYellow: [93, 39], brightBlue: [94, 39], brightMagenta: [95, 39], brightCyan: [96, 39], brightWhite: [97, 39], bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgGray: [100, 49], bgGrey: [100, 49], bgBrightRed: [101, 49], bgBrightGreen: [102, 49], bgBrightYellow: [103, 49], bgBrightBlue: [104, 49], bgBrightMagenta: [105, 49], bgBrightCyan: [106, 49], bgBrightWhite: [107, 49], // legacy styles for colors pre v1.0.0 blackBG: [40, 49], redBG: [41, 49], greenBG: [42, 49], yellowBG: [43, 49], blueBG: [44, 49], magentaBG: [45, 49], cyanBG: [46, 49], whiteBG: [47, 49] }; Object.keys(codes).forEach(function(key) { var val = codes[key]; var style = styles[key] = []; style.open = "\x1B[" + val[0] + "m"; style.close = "\x1B[" + val[1] + "m"; }); } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/has-flag.js var require_has_flag = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/has-flag.js"(exports, module) { "use strict"; module.exports = function(flag, argv) { argv = argv || process.argv; var terminatorPos = argv.indexOf("--"); var prefix = /^-{1,2}/.test(flag) ? "" : "--"; var pos = argv.indexOf(prefix + flag); return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js var require_supports_colors = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js"(exports, module) { "use strict"; var os = __require("os"); var hasFlag = require_has_flag(); var env = process.env; var forceColor = void 0; if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) { forceColor = false; } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) { forceColor = true; } if ("FORCE_COLOR" in env) { forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; } function translateLevel(level) { if (level === 0) { return false; } return { level, hasBasic: true, has256: level >= 2, has16m: level >= 3 }; } function supportsColor(stream) { if (forceColor === false) { return 0; } if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) { return 3; } if (hasFlag("color=256")) { return 2; } if (stream && !stream.isTTY && forceColor !== true) { return 0; } var min = forceColor ? 1 : 0; if (process.platform === "win32") { var osRelease = os.release().split("."); if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { return Number(osRelease[2]) >= 14931 ? 3 : 2; } return 1; } if ("CI" in env) { if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some(function(sign) { return sign in env; }) || env.CI_NAME === "codeship") { return 1; } return min; } if ("TEAMCITY_VERSION" in env) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } if ("TERM_PROGRAM" in env) { var version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10); switch (env.TERM_PROGRAM) { case "iTerm.app": return version >= 3 ? 3 : 2; case "Hyper": return 3; case "Apple_Terminal": return 2; } } if (/-256(color)?$/i.test(env.TERM)) { return 2; } if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { return 1; } if ("COLORTERM" in env) { return 1; } if (env.TERM === "dumb") { return min; } return min; } function getSupportLevel(stream) { var level = supportsColor(stream); return translateLevel(level); } module.exports = { supportsColor: getSupportLevel, stdout: getSupportLevel(process.stdout), stderr: getSupportLevel(process.stderr) }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/trap.js var require_trap = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/trap.js"(exports, module) { module["exports"] = function runTheTrap(text, options) { var result = ""; text = text || "Run the trap, drop the bass"; text = text.split(""); var trap = { a: ["@", "\u0104", "\u023A", "\u0245", "\u0394", "\u039B", "\u0414"], b: ["\xDF", "\u0181", "\u0243", "\u026E", "\u03B2", "\u0E3F"], c: ["\xA9", "\u023B", "\u03FE"], d: ["\xD0", "\u018A", "\u0500", "\u0501", "\u0502", "\u0503"], e: [ "\xCB", "\u0115", "\u018E", "\u0258", "\u03A3", "\u03BE", "\u04BC", "\u0A6C" ], f: ["\u04FA"], g: ["\u0262"], h: ["\u0126", "\u0195", "\u04A2", "\u04BA", "\u04C7", "\u050A"], i: ["\u0F0F"], j: ["\u0134"], k: ["\u0138", "\u04A0", "\u04C3", "\u051E"], l: ["\u0139"], m: ["\u028D", "\u04CD", "\u04CE", "\u0520", "\u0521", "\u0D69"], n: ["\xD1", "\u014B", "\u019D", "\u0376", "\u03A0", "\u048A"], o: [ "\xD8", "\xF5", "\xF8", "\u01FE", "\u0298", "\u047A", "\u05DD", "\u06DD", "\u0E4F" ], p: ["\u01F7", "\u048E"], q: ["\u09CD"], r: ["\xAE", "\u01A6", "\u0210", "\u024C", "\u0280", "\u042F"], s: ["\xA7", "\u03DE", "\u03DF", "\u03E8"], t: ["\u0141", "\u0166", "\u0373"], u: ["\u01B1", "\u054D"], v: ["\u05D8"], w: ["\u0428", "\u0460", "\u047C", "\u0D70"], x: ["\u04B2", "\u04FE", "\u04FC", "\u04FD"], y: ["\xA5", "\u04B0", "\u04CB"], z: ["\u01B5", "\u0240"] }; text.forEach(function(c) { c = c.toLowerCase(); var chars = trap[c] || [" "]; var rand = Math.floor(Math.random() * chars.length); if (typeof trap[c] !== "undefined") { result += trap[c][rand]; } else { result += c; } }); return result; }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/zalgo.js var require_zalgo = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/zalgo.js"(exports, module) { module["exports"] = function zalgo(text, options) { text = text || " he is here "; var soul = { "up": [ "\u030D", "\u030E", "\u0304", "\u0305", "\u033F", "\u0311", "\u0306", "\u0310", "\u0352", "\u0357", "\u0351", "\u0307", "\u0308", "\u030A", "\u0342", "\u0313", "\u0308", "\u034A", "\u034B", "\u034C", "\u0303", "\u0302", "\u030C", "\u0350", "\u0300", "\u0301", "\u030B", "\u030F", "\u0312", "\u0313", "\u0314", "\u033D", "\u0309", "\u0363", "\u0364", "\u0365", "\u0366", "\u0367", "\u0368", "\u0369", "\u036A", "\u036B", "\u036C", "\u036D", "\u036E", "\u036F", "\u033E", "\u035B", "\u0346", "\u031A" ], "down": [ "\u0316", "\u0317", "\u0318", "\u0319", "\u031C", "\u031D", "\u031E", "\u031F", "\u0320", "\u0324", "\u0325", "\u0326", "\u0329", "\u032A", "\u032B", "\u032C", "\u032D", "\u032E", "\u032F", "\u0330", "\u0331", "\u0332", "\u0333", "\u0339", "\u033A", "\u033B", "\u033C", "\u0345", "\u0347", "\u0348", "\u0349", "\u034D", "\u034E", "\u0353", "\u0354", "\u0355", "\u0356", "\u0359", "\u035A", "\u0323" ], "mid": [ "\u0315", "\u031B", "\u0300", "\u0301", "\u0358", "\u0321", "\u0322", "\u0327", "\u0328", "\u0334", "\u0335", "\u0336", "\u035C", "\u035D", "\u035E", "\u035F", "\u0360", "\u0362", "\u0338", "\u0337", "\u0361", " \u0489" ] }; var all = [].concat(soul.up, soul.down, soul.mid); function randomNumber(range) { var r = Math.floor(Math.random() * range); return r; } function isChar(character) { var bool = false; all.filter(function(i) { bool = i === character; }); return bool; } function heComes(text2, options2) { var result = ""; var counts; var l; options2 = options2 || {}; options2["up"] = typeof options2["up"] !== "undefined" ? options2["up"] : true; options2["mid"] = typeof options2["mid"] !== "undefined" ? options2["mid"] : true; options2["down"] = typeof options2["down"] !== "undefined" ? options2["down"] : true; options2["size"] = typeof options2["size"] !== "undefined" ? options2["size"] : "maxi"; text2 = text2.split(""); for (l in text2) { if (isChar(l)) { continue; } result = result + text2[l]; counts = { "up": 0, "down": 0, "mid": 0 }; switch (options2.size) { case "mini": counts.up = randomNumber(8); counts.mid = randomNumber(2); counts.down = randomNumber(8); break; case "maxi": counts.up = randomNumber(16) + 3; counts.mid = randomNumber(4) + 1; counts.down = randomNumber(64) + 3; break; default: counts.up = randomNumber(8) + 1; counts.mid = randomNumber(6) / 2; counts.down = randomNumber(8) + 1; break; } var arr = ["up", "mid", "down"]; for (var d in arr) { var index = arr[d]; for (var i = 0; i <= counts[index]; i++) { if (options2[index]) { result = result + soul[index][randomNumber(soul[index].length)]; } } } } return result; } return heComes(text, options); }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/america.js var require_america = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/america.js"(exports, module) { module["exports"] = function(colors) { return function(letter, i, exploded) { if (letter === " ") return letter; switch (i % 3) { case 0: return colors.red(letter); case 1: return colors.white(letter); case 2: return colors.blue(letter); } }; }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/zebra.js var require_zebra = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/zebra.js"(exports, module) { module["exports"] = function(colors) { return function(letter, i, exploded) { return i % 2 === 0 ? letter : colors.inverse(letter); }; }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/rainbow.js var require_rainbow = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/rainbow.js"(exports, module) { module["exports"] = function(colors) { var rainbowColors = ["red", "yellow", "green", "blue", "magenta"]; return function(letter, i, exploded) { if (letter === " ") { return letter; } else { return colors[rainbowColors[i++ % rainbowColors.length]](letter); } }; }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/random.js var require_random = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/maps/random.js"(exports, module) { module["exports"] = function(colors) { var available = [ "underline", "inverse", "grey", "yellow", "red", "green", "blue", "white", "cyan", "magenta", "brightYellow", "brightRed", "brightGreen", "brightBlue", "brightWhite", "brightCyan", "brightMagenta" ]; return function(letter, i, exploded) { return letter === " " ? letter : colors[available[Math.round(Math.random() * (available.length - 2))]](letter); }; }; } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/colors.js var require_colors = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/colors.js"(exports, module) { var colors = {}; module["exports"] = colors; colors.themes = {}; var util = __require("util"); var ansiStyles = colors.styles = require_styles(); var defineProps = Object.defineProperties; var newLineRegex = new RegExp(/[\r\n]+/g); colors.supportsColor = require_supports_colors().supportsColor; if (typeof colors.enabled === "undefined") { colors.enabled = colors.supportsColor() !== false; } colors.enable = function() { colors.enabled = true; }; colors.disable = function() { colors.enabled = false; }; colors.stripColors = colors.strip = function(str) { return ("" + str).replace(/\x1B\[\d+m/g, ""); }; var stylize = colors.stylize = function stylize2(str, style) { if (!colors.enabled) { return str + ""; } var styleMap = ansiStyles[style]; if (!styleMap && style in colors) { return colors[style](str); } return styleMap.open + str + styleMap.close; }; var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; var escapeStringRegexp = function(str) { if (typeof str !== "string") { throw new TypeError("Expected a string"); } return str.replace(matchOperatorsRe, "\\$&"); }; function build(_styles) { var builder = function builder2() { return applyStyle.apply(builder2, arguments); }; builder._styles = _styles; builder.__proto__ = proto; return builder; } var styles = function() { var ret = {}; ansiStyles.grey = ansiStyles.gray; Object.keys(ansiStyles).forEach(function(key) { ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), "g"); ret[key] = { get: function() { return build(this._styles.concat(key)); } }; }); return ret; }(); var proto = defineProps(function colors2() { }, styles); function applyStyle() { var args = Array.prototype.slice.call(arguments); var str = args.map(function(arg) { if (arg != null && arg.constructor === String) { return arg; } else { return util.inspect(arg); } }).join(" "); if (!colors.enabled || !str) { return str; } var newLinesPresent = str.indexOf("\n") != -1; var nestedStyles = this._styles; var i = nestedStyles.length; while (i--) { var code = ansiStyles[nestedStyles[i]]; str = code.open + str.replace(code.closeRe, code.open) + code.close; if (newLinesPresent) { str = str.replace(newLineRegex, function(match) { return code.close + match + code.open; }); } } return str; } colors.setTheme = function(theme) { if (typeof theme === "string") { console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));"); return; } for (var style in theme) { (function(style2) { colors[style2] = function(str) { if (typeof theme[style2] === "object") { var out = str; for (var i in theme[style2]) { out = colors[theme[style2][i]](out); } return out; } return colors[theme[style2]](str); }; })(style); } }; function init() { var ret = {}; Object.keys(styles).forEach(function(name) { ret[name] = { get: function() { return build([name]); } }; }); return ret; } var sequencer = function sequencer2(map2, str) { var exploded = str.split(""); exploded = exploded.map(map2); return exploded.join(""); }; colors.trap = require_trap(); colors.zalgo = require_zalgo(); colors.maps = {}; colors.maps.america = require_america()(colors); colors.maps.zebra = require_zebra()(colors); colors.maps.rainbow = require_rainbow()(colors); colors.maps.random = require_random()(colors); for (map in colors.maps) { (function(map2) { colors[map2] = function(str) { return sequencer(colors.maps[map2], str); }; })(map); } var map; defineProps(colors, init()); } }); // ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/safe.js var require_safe = __commonJS({ "../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/safe.js"(exports, module) { var colors = require_colors(); module["exports"] = colors; } }); // ../../node_modules/.pnpm/cli-table3@0.6.3/node_modules/cli-table3/src/cell.js var require_cell = __commonJS({ "../../node_modules/.pnpm/cli-table3@0.6.3/node_modules/cli-table3/src/cell.js"(exports, module) { var { info, debug } = require_debug(); var utils = require_utils(); var Cell = class _Cell { /** * A representation of a cell within the table. * Implementations must have `init` and `draw` methods, * as well as `colSpan`, `rowSpan`, `desiredHeight` and `desiredWidth` properties. * @param options * @constructor */ constructor(options) { this.setOptions(options); this.x = null; this.y = null; } setOptions(options) { if (["boolean", "number", "string"].indexOf(typeof options) !== -1) { options = { content: "" + options }; } options = options || {}; this.options = options; let content = options.content; if (["boolean", "number", "string"].indexOf(typeof content) !== -1) { this.content = String(content); } else if (!content) { this.content = this.options.href || ""; } else { throw new Error("Content needs to be a primitive, got: " + typeof content); } this.colSpan = options.colSpan || 1; this.rowSpan = options.rowSpan || 1; if (this.options.href) { Object.defineProperty(this, "href", { get() { return this.options.href; } }); } } mergeTableOptions(tableOptions, cells) { this.cells = cells; let optionsChars = this.options.chars || {}; let tableChars = tableOptions.chars; let chars = this.chars = {}; CHAR_NAMES.forEach(function(name) { setOption(optionsChars, tableChars, name, chars); }); this.truncate = this.options.truncate || tableOptions.truncate; let style = this.options.style = this.options.style || {}; let tableStyle = tableOptions.style; setOption(style, tableStyle, "padding-left", this); setOption(style, tableStyle, "padding-right", this); this.head = style.head || tableStyle.head; this.border = style.border || tableStyle.border; this.fixedWidth = tableOptions.colWidths[this.x]; this.lines = this.computeLines(tableOptions); this.desiredWidth = utils.strlen(this.content) + this.paddingLeft + this.paddingRight; this.desiredHeight = this.lines.length; } computeLines(tableOptions) { const tableWordWrap = tableOptions.wordWrap || tableOptions.textWrap; const { wordWrap = tableWordWrap } = this.options; if (this.fixedWidth && wordWrap) { this.fixedWidth -= this.paddingLeft + this.paddingRight; if (this.colSpan) { let i = 1; while (i < this.colSpan) { this.fixedWidth += tableOptions.colWidths[this.x + i]; i++; } } const { wrapOnWordBoundary: tableWrapOnWordBoundary = true } = tableOptions; const { wrapOnWordBoundary = tableWrapOnWordBoundary } = this.options; return this.wrapLines(utils.wordWrap(this.fixedWidth, this.content, wrapOnWordBoundary)); } return this.wrapLines(this.content.split("\n")); } wrapLines(computedLines) { const lines = utils.colorizeLines(computedLines); if (this.href) { return lines.map((line) => utils.hyperlink(this.href, line)); } return lines; } /** * Initializes the Cells data structure. * * @param tableOptions - A fully populated set of tableOptions. * In addition to the standard default values, tableOptions must have fully populated the * `colWidths` and `rowWidths` arrays. Those arrays must have lengths equal to the number * of columns or rows (respectively) in this table, and each array item must be a Number. * */ init(tableOptions) { let x = this.x; let y = this.y; this.widths = tableOptions.colWidths.slice(x, x + this.colSpan); this.heights = tableOptions.rowHeights.slice(y, y + this.rowSpan); this.width = this.widths.reduce(sumPlusOne, -1); this.height = this.heights.reduce(sumPlusOne, -1); this.hAlign = this.options.hAlign || tableOptions.colAligns[x]; this.vAlign = this.options.vAlign || tableOptions.rowAligns[y]; this.drawRight = x + this.colSpan == tableOptions.colWidths.length; } /** * Draws the given line of the cell. * This default implementation defers to methods `drawTop`, `drawBottom`, `drawLine` and `drawEmpty`. * @param lineNum - can be `top`, `bottom` or a numerical line number. * @param spanningCell - will be a number if being called from a RowSpanCell, and will represent how * many rows below it's being called from. Otherwise it's undefined. * @returns {String} The representation of this line. */ draw(lineNum, spanningCell) { if (lineNum == "top") return this.drawTop(this.drawRight); if (lineNum == "bottom") return this.drawBottom(this.drawRight); let content = utils.truncate(this.content, 10, this.truncate); if (!lineNum) { info(`${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`); } else { } let padLen = Math.max(this.height - this.lines.length, 0); let padTop; switch (this.vAlign) { case "center": padTop = Math.ceil(padLen / 2); break; case "bottom": padTop = padLen; break; default: padTop = 0; } if (lineNum < padTop || lineNum >= padTop + this.lines.length) { return this.drawEmpty(this.drawRight, spanningCell); } let forceTruncation = this.lines.length > this.height && lineNum + 1 >= this.height; return this.drawLine(lineNum - padTop, this.drawRight, forceTruncation, spanningCell); } /** * Renders the top line of the cell. * @param drawRight - true if this method should render the right edge of the cell. * @returns {String} */ drawTop(drawRight) { let content = []; if (this.cells) { this.widths.forEach(function(width, index) { content.push(this._topLeftChar(index)); content.push(utils.repeat(this.chars[this.y == 0 ? "top" : "mid"], width)); }, this); } else { content.push(this._topLeftChar(0)); content.push(utils.repeat(this.chars[this.y == 0 ? "top" : "mid"], this.width)); } if (drawRight) { content.push(this.chars[this.y == 0 ? "topRight" : "rightMid"]); } return this.wrapWithStyleColors("border", content.join("")); } _topLeftChar(offset) { let x = this.x + offset; let leftChar; if (this.y == 0) { leftChar = x == 0 ? "topLeft" : offset == 0 ? "topMid" : "top"; } else { if (x == 0) { leftChar = "leftMid"; } else { leftChar = offset == 0 ? "midMid" : "bottomMid"; if (this.cells) { let spanAbove = this.cells[this.y - 1][x] instanceof _Cell.ColSpanCell; if (spanAbove) { leftChar = offset == 0 ? "topMid" : "mid"; } if (offset == 0) { let i = 1; while (this.cells[this.y][x - i] instanceof _Cell.ColSpanCell) { i++; } if (this.cells[this.y][x - i] instanceof _Cell.RowSpanCell) { leftChar = "leftMid"; } } } } } return this.chars[leftChar]; } wrapWithStyleColors(styleProperty, content) { if (this[styleProperty] && this[styleProperty].length) { try { let colors = require_safe(); for (let i = this[styleProperty].length - 1; i >= 0; i--) { colors = colors[this[styleProperty][i]]; } return colors(content); } catch (e) { return content; } } else { return content; } } /** * Renders a line of text. * @param lineNum - Which line of text to render. This is not necessarily the line within the cell. * There may be top-padding above the first line of text. * @param drawRight - true if this method should render the right edge of the cell. * @param forceTruncationSymbol - `true` if the rendered text should end with the truncation symbol even * if the text fits. This is used when the cell is vertically truncated. If `false` the text should * only include the truncation symbol if the text will not fit horizontally within the cell width. * @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined. * @returns {String} */ drawLine(lineNum, drawRight, forceTruncationSymbol, spanningCell) { let left = this.chars[this.x == 0 ? "left" : "middle"]; if (this.x && spanningCell && this.cells) { let cellLeft = this.cells[this.y + spanningCell][this.x - 1]; while (cellLeft instanceof ColSpanCell) { cellLeft = this.cells[cellLeft.y][cellLeft.x - 1]; } if (!(cellLeft instanceof RowSpanCell)) { left = this.chars["rightMid"]; } } let leftPadding = utils.repeat(" ", this.paddingLeft); let right = drawRight ? this.chars["right"] : ""; let rightPadding = utils.repeat(" ", this.paddingRight); let line = this.lines[lineNum]; let len = this.width - (this.paddingLeft + this.paddingRight); if (forceTruncationSymbol) line += this.truncate || "\u2026"; let content = utils.truncate(line, len, this.truncate); content = utils.pad(content, len, " ", this.hAlign); content = leftPadding + content + rightPadding; return this.stylizeLine(left, content, right); } stylizeLine(left, content, right) { left = this.wrapWithStyleColors("border", left); right = this.wrapWithStyleColors("border", right); if (this.y === 0) { content = this.wrapWithStyleColors("head", content); } return left + content + right; } /** * Renders the bottom line of the cell. * @param drawRight - true if this method should render the right edge of the cell. * @returns {String} */ drawBottom(drawRight) { let left = this.chars[this.x == 0 ? "bottomLeft" : "bottomMid"]; let content = utils.repeat(this.chars.bottom, this.width); let right = drawRight ? this.chars["bottomRight"] : ""; return this.wrapWithStyleColors("border", left + content + right); } /** * Renders a blank line of text within the cell. Used for top and/or bottom padding. * @param drawRight - true if this method should render the right edge of the cell. * @param spanningCell - a number of if being called from a RowSpanCell. (how many rows below). otherwise undefined. * @returns {String} */ drawEmpty(drawRight, spanningCell) { let left = this.chars[this.x == 0 ? "left" : "middle"]; if (this.x && spanningCell && this.cells) { let cellLeft = this.cells[this.y + spanningCell][this.x - 1]; while (cellLeft instanceof ColSpanCell) { cellLeft = this.cells[cellLeft.y][cellLeft.x - 1]; } if (!(cellLeft instanceof RowSpanCell)) { left = this.chars["rightMid"]; } } let right = drawRight ? this.chars["right"] : ""; let content = utils.repeat(" ", this.width); return this.stylizeLine(left, content, right); } }; var ColSpanCell = class { /** * A Cell that doesn't do anything. It just draws empty lines. * Used as a placeholder in column spanning. * @constructor */ constructor() { } draw(lineNum) { if (typeof lineNum === "number") { debug(`${this.y}-${this.x}: 1x1 ColSpanCell`); } return ""; } init() { } mergeTableOptions() { } }; var RowSpanCell = class { /** * A placeholder Cell for a Cell that spans multiple rows. * It delegates rendering to the original cell, but adds the appropriate offset. * @param originalCell * @constructor */ constructor(originalCell) { this.originalCell = originalCell; } init(tableOptions) { let y = this.y; let originalY = this.originalCell.y; this.cellOffset = y - originalY; this.offset = findDimension(tableOptions.rowHeights, originalY, this.cellOffset); } draw(lineNum) { if (lineNum == "top") { return this.originalCell.draw(this.offset, this.cellOffset); } if (lineNum == "bottom") { return this.originalCell.draw("bottom"); } debug(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`); return this.originalCell.draw(this.offset + 1 + lineNum); } mergeTableOptions() { } }; function firstDefined(...args) { return args.filter((v) => v !== void 0 && v !== null).shift(); } function setOption(objA, objB, nameB, targetObj) { let nameA = nameB.split("-"); if (nameA.length > 1) { nameA[1] = nameA[1].charAt(0).toUpperCase() + nameA[1].substr(1); nameA = nameA.join(""); targetObj[nameA] = firstDefined(objA[nameA], objA[nameB], objB[nameA], objB[nameB]); } else { targetObj[nameB] = firstDefined(objA[nameB], objB[nameB]); } } function findDimension(dimensionTable, startingIndex, span) { let ret = dimensionTable[startingIndex]; for (let i = 1; i < span; i++) { ret += 1 + dimensionTable[startingIndex + i]; } return ret; } function sumPlusOne(a, b) { return a + b + 1; } var CHAR_NAMES = [ "top", "top-mid", "top-left", "top-right", "bottom", "bottom-mid", "bottom-left", "bottom-right", "left", "left-mid", "mid", "mid-mid", "right", "right-mid", "middle" ]; module.exports = Cell; module.exports.ColSpanCell = ColSpanCell; module.exports.RowSpanCell = RowSpanCell; } }); // ../../node_modules/.pnpm/cli-table3@0.6.3/node_modules/cli-table3/src/layout-manager.js var require_layout_manager = __commonJS({ "../../node_modules/.pnpm/cli-table3@0.6.3/node_modules/cli-table3/src/layout-manager.js"(exports, module) { var { warn, debug } = require_debug(); var Cell = require_cell(); var { ColSpanCell, RowSpanCell } = Cell; (function() { function next(alloc, col) { if (alloc[col] > 0) { return next(alloc, col + 1); } return col; } function layoutTable(table2) { let alloc = {}; table2.forEach(function(row, rowIndex) { let col = 0; row.forEach(function(cell) { cell.y = rowIndex; cell.x = rowIndex ? next(alloc, col) : col; const rowSpan = cell.rowSpan || 1; const colSpan = cell.colSpan || 1; if (rowSpan > 1) { for (let cs = 0; cs < colSpan; cs++) { alloc[cell.x + cs] = rowSpan; } } col = cell.x + colSpan; }); Object.keys(alloc).forEach((idx) => { alloc[idx]--; if (alloc[idx] < 1) delete alloc[idx]; }); }); } function maxWidth(table2) { let mw = 0; table2.forEach(function(row) { row.forEach(function(cell) { mw = Math.max(mw, cell.x + (cell.colSpan || 1)); }); }); return mw; } function maxHeight(table2) { return table2.length; } function cellsConflict(cell1, cell2) { let yMin1 = cell1.y; let yMax1 = cell1.y - 1 + (cell1.rowSpan || 1); let yMin2 = cell2.y; let yMax2 = cell2.y - 1 + (cell2.rowSpan || 1); let yConflict = !(yMin1 > yMax2 || yMin2 > yMax1); let xMin1 = cell1.x; let xMax1 = cell1.x - 1 + (cell1.colSpan || 1); let xMin2 = cell2.x; let xMax2 = cell2.x - 1 + (cell2.colSpan || 1); let xConflict = !(xMin1 > xMax2 || xMin2 > xMax1); return yConflict && xConflict; } function conflictExists(rows, x, y) { let i_max = Math.min(rows.length - 1, y); let cell = { x, y }; for (let i = 0; i <= i_max; i++) { let row = rows[i]; for (let j = 0; j < row.length; j++) { if (cellsConflict(cell, row[j])) { return true; } } } return false; } function allBlank(rows, y, xMin, xMax) { for (let x = xMin; x < xMax; x++) { if (conflictExists(rows, x, y)) { return false; } } return true; } function addRowSpanCells(table2) { table2.forEach(function(row, rowIndex) { row.forEach(function(cell) { for (let i = 1; i < cell.rowSpan; i++) { let rowSpanCell = new RowSpanCell(cell); rowSpanCell.x = cell.x; rowSpanCell.y = cell.y + i; rowSpanCell.colSpan = cell.colSpan; insertCell(rowSpanCell, table2[rowIndex + i]); } }); }); } function addColSpanCells(cellRows) { for (let rowIndex = cellRows.length - 1; rowIndex >= 0; rowIndex--) { let cellColumns = cellRows[rowIndex]; for (let columnIndex = 0; columnIndex < cellColumns.length; columnIndex++) { let cell = cellColumns[columnIndex]; for (let k = 1; k < cell.colSpan; k++) { let colSpanCell = new ColSpanCell(); colSpanCell.x = cell.x + k; colSpanCell.y = cell.y; cellColumns.splice(columnIndex + 1, 0, colSpanCell); } } } } function insertCell(cell, row) { let x = 0; while (x < row.length && row[x].x < cell.x) { x++; } row.splice(x, 0, cell); } function fillInTable(table2) { let h_max = maxHeight(table2); let w_max = maxWidth(table2); debug(`Max rows: ${h_max}; Max cols: ${w_max}`); for (let y = 0; y < h_max; y++) { for (let x = 0; x < w_max; x++) { if (!conflictExists(table2, x, y)) { let opts = { x, y, colSpan: 1, rowSpan: 1 }; x++; while (x < w_max && !conflictExists(table2, x, y)) { opts.colSpan++; x++; }