You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
799 lines
40 KiB
799 lines
40 KiB
|
2 years ago
|
import { c as createConsola$1, L as LogLevels } from './consola.ce5c7a59.mjs';
|
||
|
|
import { B as BasicReporter, p as parseStack } from './consola.3c86be48.mjs';
|
||
|
|
import process$1 from 'node:process';
|
||
|
|
import * as tty from 'tty';
|
||
|
|
|
||
|
|
const providers = [
|
||
|
|
["APPVEYOR"],
|
||
|
|
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
||
|
|
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
||
|
|
["APPCIRCLE", "AC_APPCIRCLE"],
|
||
|
|
["BAMBOO", "bamboo_planKey"],
|
||
|
|
["BITBUCKET", "BITBUCKET_COMMIT"],
|
||
|
|
["BITRISE", "BITRISE_IO"],
|
||
|
|
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
||
|
|
["BUILDKITE"],
|
||
|
|
["CIRCLE", "CIRCLECI"],
|
||
|
|
["CIRRUS", "CIRRUS_CI"],
|
||
|
|
["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }],
|
||
|
|
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
||
|
|
["CODEFRESH", "CF_BUILD_ID"],
|
||
|
|
["DRONE"],
|
||
|
|
["DRONE", "DRONE_BUILD_EVENT"],
|
||
|
|
["DSARI"],
|
||
|
|
["GITHUB_ACTIONS"],
|
||
|
|
["GITLAB", "GITLAB_CI"],
|
||
|
|
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
||
|
|
["GOCD", "GO_PIPELINE_LABEL"],
|
||
|
|
["LAYERCI"],
|
||
|
|
["HUDSON", "HUDSON_URL"],
|
||
|
|
["JENKINS", "JENKINS_URL"],
|
||
|
|
["MAGNUM"],
|
||
|
|
["NETLIFY"],
|
||
|
|
["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
|
||
|
|
["NEVERCODE"],
|
||
|
|
["RENDER"],
|
||
|
|
["SAIL", "SAILCI"],
|
||
|
|
["SEMAPHORE"],
|
||
|
|
["SCREWDRIVER"],
|
||
|
|
["SHIPPABLE"],
|
||
|
|
["SOLANO", "TDDIUM"],
|
||
|
|
["STRIDER"],
|
||
|
|
["TEAMCITY", "TEAMCITY_VERSION"],
|
||
|
|
["TRAVIS"],
|
||
|
|
["VERCEL", "NOW_BUILDER"],
|
||
|
|
["APPCENTER", "APPCENTER_BUILD_ID"],
|
||
|
|
["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
|
||
|
|
["STACKBLITZ"],
|
||
|
|
["STORMKIT"],
|
||
|
|
["CLEAVR"]
|
||
|
|
];
|
||
|
|
function detectProvider(env) {
|
||
|
|
for (const provider of providers) {
|
||
|
|
const envName = provider[1] || provider[0];
|
||
|
|
if (env[envName]) {
|
||
|
|
return {
|
||
|
|
name: provider[0].toLowerCase(),
|
||
|
|
...provider[2]
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (env.SHELL && env.SHELL === "/bin/jsh") {
|
||
|
|
return {
|
||
|
|
name: "stackblitz",
|
||
|
|
ci: false
|
||
|
|
};
|
||
|
|
}
|
||
|
|
return {
|
||
|
|
name: "",
|
||
|
|
ci: false
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
const processShim = typeof process !== "undefined" ? process : {};
|
||
|
|
const envShim = processShim.env || {};
|
||
|
|
const providerInfo = detectProvider(envShim);
|
||
|
|
const nodeENV = envShim.NODE_ENV || "";
|
||
|
|
processShim.platform;
|
||
|
|
providerInfo.name;
|
||
|
|
const isCI$1 = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
||
|
|
const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
||
|
|
const isDebug = toBoolean(envShim.DEBUG);
|
||
|
|
const isTest = nodeENV === "test" || toBoolean(envShim.TEST);
|
||
|
|
toBoolean(envShim.MINIMAL) || isCI$1 || isTest || !hasTTY;
|
||
|
|
function toBoolean(val) {
|
||
|
|
return val ? val !== "false" : false;
|
||
|
|
}
|
||
|
|
|
||
|
|
function ansiRegex({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 ? undefined : 'g');
|
||
|
|
}
|
||
|
|
|
||
|
|
function stripAnsi(string) {
|
||
|
|
if (typeof string !== 'string') {
|
||
|
|
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
||
|
|
}
|
||
|
|
|
||
|
|
return string.replace(ansiRegex(), '');
|
||
|
|
}
|
||
|
|
|
||
|
|
var eastasianwidthExports = {};
|
||
|
|
var eastasianwidth = {
|
||
|
|
get exports(){ return eastasianwidthExports; },
|
||
|
|
set exports(v){ eastasianwidthExports = v; },
|
||
|
|
};
|
||
|
|
|
||
|
|
(function (module) {
|
||
|
|
var eaw = {};
|
||
|
|
|
||
|
|
{
|
||
|
|
module.exports = eaw;
|
||
|
|
}
|
||
|
|
|
||
|
|
eaw.eastAsianWidth = function(character) {
|
||
|
|
var x = character.charCodeAt(0);
|
||
|
|
var y = (character.length == 2) ? character.charCodeAt(1) : 0;
|
||
|
|
var codePoint = x;
|
||
|
|
if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
|
||
|
|
x &= 0x3FF;
|
||
|
|
y &= 0x3FF;
|
||
|
|
codePoint = (x << 10) | y;
|
||
|
|
codePoint += 0x10000;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ((0x3000 == codePoint) ||
|
||
|
|
(0xFF01 <= codePoint && codePoint <= 0xFF60) ||
|
||
|
|
(0xFFE0 <= codePoint && codePoint <= 0xFFE6)) {
|
||
|
|
return 'F';
|
||
|
|
}
|
||
|
|
if ((0x20A9 == codePoint) ||
|
||
|
|
(0xFF61 <= codePoint && codePoint <= 0xFFBE) ||
|
||
|
|
(0xFFC2 <= codePoint && codePoint <= 0xFFC7) ||
|
||
|
|
(0xFFCA <= codePoint && codePoint <= 0xFFCF) ||
|
||
|
|
(0xFFD2 <= codePoint && codePoint <= 0xFFD7) ||
|
||
|
|
(0xFFDA <= codePoint && codePoint <= 0xFFDC) ||
|
||
|
|
(0xFFE8 <= codePoint && codePoint <= 0xFFEE)) {
|
||
|
|
return 'H';
|
||
|
|
}
|
||
|
|
if ((0x1100 <= codePoint && codePoint <= 0x115F) ||
|
||
|
|
(0x11A3 <= codePoint && codePoint <= 0x11A7) ||
|
||
|
|
(0x11FA <= codePoint && codePoint <= 0x11FF) ||
|
||
|
|
(0x2329 <= codePoint && codePoint <= 0x232A) ||
|
||
|
|
(0x2E80 <= codePoint && codePoint <= 0x2E99) ||
|
||
|
|
(0x2E9B <= codePoint && codePoint <= 0x2EF3) ||
|
||
|
|
(0x2F00 <= codePoint && codePoint <= 0x2FD5) ||
|
||
|
|
(0x2FF0 <= codePoint && codePoint <= 0x2FFB) ||
|
||
|
|
(0x3001 <= codePoint && codePoint <= 0x303E) ||
|
||
|
|
(0x3041 <= codePoint && codePoint <= 0x3096) ||
|
||
|
|
(0x3099 <= codePoint && codePoint <= 0x30FF) ||
|
||
|
|
(0x3105 <= codePoint && codePoint <= 0x312D) ||
|
||
|
|
(0x3131 <= codePoint && codePoint <= 0x318E) ||
|
||
|
|
(0x3190 <= codePoint && codePoint <= 0x31BA) ||
|
||
|
|
(0x31C0 <= codePoint && codePoint <= 0x31E3) ||
|
||
|
|
(0x31F0 <= codePoint && codePoint <= 0x321E) ||
|
||
|
|
(0x3220 <= codePoint && codePoint <= 0x3247) ||
|
||
|
|
(0x3250 <= codePoint && codePoint <= 0x32FE) ||
|
||
|
|
(0x3300 <= codePoint && codePoint <= 0x4DBF) ||
|
||
|
|
(0x4E00 <= codePoint && codePoint <= 0xA48C) ||
|
||
|
|
(0xA490 <= codePoint && codePoint <= 0xA4C6) ||
|
||
|
|
(0xA960 <= codePoint && codePoint <= 0xA97C) ||
|
||
|
|
(0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
|
||
|
|
(0xD7B0 <= codePoint && codePoint <= 0xD7C6) ||
|
||
|
|
(0xD7CB <= codePoint && codePoint <= 0xD7FB) ||
|
||
|
|
(0xF900 <= codePoint && codePoint <= 0xFAFF) ||
|
||
|
|
(0xFE10 <= codePoint && codePoint <= 0xFE19) ||
|
||
|
|
(0xFE30 <= codePoint && codePoint <= 0xFE52) ||
|
||
|
|
(0xFE54 <= codePoint && codePoint <= 0xFE66) ||
|
||
|
|
(0xFE68 <= codePoint && codePoint <= 0xFE6B) ||
|
||
|
|
(0x1B000 <= codePoint && codePoint <= 0x1B001) ||
|
||
|
|
(0x1F200 <= codePoint && codePoint <= 0x1F202) ||
|
||
|
|
(0x1F210 <= codePoint && codePoint <= 0x1F23A) ||
|
||
|
|
(0x1F240 <= codePoint && codePoint <= 0x1F248) ||
|
||
|
|
(0x1F250 <= codePoint && codePoint <= 0x1F251) ||
|
||
|
|
(0x20000 <= codePoint && codePoint <= 0x2F73F) ||
|
||
|
|
(0x2B740 <= codePoint && codePoint <= 0x2FFFD) ||
|
||
|
|
(0x30000 <= codePoint && codePoint <= 0x3FFFD)) {
|
||
|
|
return 'W';
|
||
|
|
}
|
||
|
|
if ((0x0020 <= codePoint && codePoint <= 0x007E) ||
|
||
|
|
(0x00A2 <= codePoint && codePoint <= 0x00A3) ||
|
||
|
|
(0x00A5 <= codePoint && codePoint <= 0x00A6) ||
|
||
|
|
(0x00AC == codePoint) ||
|
||
|
|
(0x00AF == codePoint) ||
|
||
|
|
(0x27E6 <= codePoint && codePoint <= 0x27ED) ||
|
||
|
|
(0x2985 <= codePoint && codePoint <= 0x2986)) {
|
||
|
|
return 'Na';
|
||
|
|
}
|
||
|
|
if ((0x00A1 == codePoint) ||
|
||
|
|
(0x00A4 == codePoint) ||
|
||
|
|
(0x00A7 <= codePoint && codePoint <= 0x00A8) ||
|
||
|
|
(0x00AA == codePoint) ||
|
||
|
|
(0x00AD <= codePoint && codePoint <= 0x00AE) ||
|
||
|
|
(0x00B0 <= codePoint && codePoint <= 0x00B4) ||
|
||
|
|
(0x00B6 <= codePoint && codePoint <= 0x00BA) ||
|
||
|
|
(0x00BC <= codePoint && codePoint <= 0x00BF) ||
|
||
|
|
(0x00C6 == codePoint) ||
|
||
|
|
(0x00D0 == codePoint) ||
|
||
|
|
(0x00D7 <= codePoint && codePoint <= 0x00D8) ||
|
||
|
|
(0x00DE <= codePoint && codePoint <= 0x00E1) ||
|
||
|
|
(0x00E6 == codePoint) ||
|
||
|
|
(0x00E8 <= codePoint && codePoint <= 0x00EA) ||
|
||
|
|
(0x00EC <= codePoint && codePoint <= 0x00ED) ||
|
||
|
|
(0x00F0 == codePoint) ||
|
||
|
|
(0x00F2 <= codePoint && codePoint <= 0x00F3) ||
|
||
|
|
(0x00F7 <= codePoint && codePoint <= 0x00FA) ||
|
||
|
|
(0x00FC == codePoint) ||
|
||
|
|
(0x00FE == codePoint) ||
|
||
|
|
(0x0101 == codePoint) ||
|
||
|
|
(0x0111 == codePoint) ||
|
||
|
|
(0x0113 == codePoint) ||
|
||
|
|
(0x011B == codePoint) ||
|
||
|
|
(0x0126 <= codePoint && codePoint <= 0x0127) ||
|
||
|
|
(0x012B == codePoint) ||
|
||
|
|
(0x0131 <= codePoint && codePoint <= 0x0133) ||
|
||
|
|
(0x0138 == codePoint) ||
|
||
|
|
(0x013F <= codePoint && codePoint <= 0x0142) ||
|
||
|
|
(0x0144 == codePoint) ||
|
||
|
|
(0x0148 <= codePoint && codePoint <= 0x014B) ||
|
||
|
|
(0x014D == codePoint) ||
|
||
|
|
(0x0152 <= codePoint && codePoint <= 0x0153) ||
|
||
|
|
(0x0166 <= codePoint && codePoint <= 0x0167) ||
|
||
|
|
(0x016B == codePoint) ||
|
||
|
|
(0x01CE == codePoint) ||
|
||
|
|
(0x01D0 == codePoint) ||
|
||
|
|
(0x01D2 == codePoint) ||
|
||
|
|
(0x01D4 == codePoint) ||
|
||
|
|
(0x01D6 == codePoint) ||
|
||
|
|
(0x01D8 == codePoint) ||
|
||
|
|
(0x01DA == codePoint) ||
|
||
|
|
(0x01DC == codePoint) ||
|
||
|
|
(0x0251 == codePoint) ||
|
||
|
|
(0x0261 == codePoint) ||
|
||
|
|
(0x02C4 == codePoint) ||
|
||
|
|
(0x02C7 == codePoint) ||
|
||
|
|
(0x02C9 <= codePoint && codePoint <= 0x02CB) ||
|
||
|
|
(0x02CD == codePoint) ||
|
||
|
|
(0x02D0 == codePoint) ||
|
||
|
|
(0x02D8 <= codePoint && codePoint <= 0x02DB) ||
|
||
|
|
(0x02DD == codePoint) ||
|
||
|
|
(0x02DF == codePoint) ||
|
||
|
|
(0x0300 <= codePoint && codePoint <= 0x036F) ||
|
||
|
|
(0x0391 <= codePoint && codePoint <= 0x03A1) ||
|
||
|
|
(0x03A3 <= codePoint && codePoint <= 0x03A9) ||
|
||
|
|
(0x03B1 <= codePoint && codePoint <= 0x03C1) ||
|
||
|
|
(0x03C3 <= codePoint && codePoint <= 0x03C9) ||
|
||
|
|
(0x0401 == codePoint) ||
|
||
|
|
(0x0410 <= codePoint && codePoint <= 0x044F) ||
|
||
|
|
(0x0451 == codePoint) ||
|
||
|
|
(0x2010 == codePoint) ||
|
||
|
|
(0x2013 <= codePoint && codePoint <= 0x2016) ||
|
||
|
|
(0x2018 <= codePoint && codePoint <= 0x2019) ||
|
||
|
|
(0x201C <= codePoint && codePoint <= 0x201D) ||
|
||
|
|
(0x2020 <= codePoint && codePoint <= 0x2022) ||
|
||
|
|
(0x2024 <= codePoint && codePoint <= 0x2027) ||
|
||
|
|
(0x2030 == codePoint) ||
|
||
|
|
(0x2032 <= codePoint && codePoint <= 0x2033) ||
|
||
|
|
(0x2035 == codePoint) ||
|
||
|
|
(0x203B == codePoint) ||
|
||
|
|
(0x203E == codePoint) ||
|
||
|
|
(0x2074 == codePoint) ||
|
||
|
|
(0x207F == codePoint) ||
|
||
|
|
(0x2081 <= codePoint && codePoint <= 0x2084) ||
|
||
|
|
(0x20AC == codePoint) ||
|
||
|
|
(0x2103 == codePoint) ||
|
||
|
|
(0x2105 == codePoint) ||
|
||
|
|
(0x2109 == codePoint) ||
|
||
|
|
(0x2113 == codePoint) ||
|
||
|
|
(0x2116 == codePoint) ||
|
||
|
|
(0x2121 <= codePoint && codePoint <= 0x2122) ||
|
||
|
|
(0x2126 == codePoint) ||
|
||
|
|
(0x212B == codePoint) ||
|
||
|
|
(0x2153 <= codePoint && codePoint <= 0x2154) ||
|
||
|
|
(0x215B <= codePoint && codePoint <= 0x215E) ||
|
||
|
|
(0x2160 <= codePoint && codePoint <= 0x216B) ||
|
||
|
|
(0x2170 <= codePoint && codePoint <= 0x2179) ||
|
||
|
|
(0x2189 == codePoint) ||
|
||
|
|
(0x2190 <= codePoint && codePoint <= 0x2199) ||
|
||
|
|
(0x21B8 <= codePoint && codePoint <= 0x21B9) ||
|
||
|
|
(0x21D2 == codePoint) ||
|
||
|
|
(0x21D4 == codePoint) ||
|
||
|
|
(0x21E7 == codePoint) ||
|
||
|
|
(0x2200 == codePoint) ||
|
||
|
|
(0x2202 <= codePoint && codePoint <= 0x2203) ||
|
||
|
|
(0x2207 <= codePoint && codePoint <= 0x2208) ||
|
||
|
|
(0x220B == codePoint) ||
|
||
|
|
(0x220F == codePoint) ||
|
||
|
|
(0x2211 == codePoint) ||
|
||
|
|
(0x2215 == codePoint) ||
|
||
|
|
(0x221A == codePoint) ||
|
||
|
|
(0x221D <= codePoint && codePoint <= 0x2220) ||
|
||
|
|
(0x2223 == codePoint) ||
|
||
|
|
(0x2225 == codePoint) ||
|
||
|
|
(0x2227 <= codePoint && codePoint <= 0x222C) ||
|
||
|
|
(0x222E == codePoint) ||
|
||
|
|
(0x2234 <= codePoint && codePoint <= 0x2237) ||
|
||
|
|
(0x223C <= codePoint && codePoint <= 0x223D) ||
|
||
|
|
(0x2248 == codePoint) ||
|
||
|
|
(0x224C == codePoint) ||
|
||
|
|
(0x2252 == codePoint) ||
|
||
|
|
(0x2260 <= codePoint && codePoint <= 0x2261) ||
|
||
|
|
(0x2264 <= codePoint && codePoint <= 0x2267) ||
|
||
|
|
(0x226A <= codePoint && codePoint <= 0x226B) ||
|
||
|
|
(0x226E <= codePoint && codePoint <= 0x226F) ||
|
||
|
|
(0x2282 <= codePoint && codePoint <= 0x2283) ||
|
||
|
|
(0x2286 <= codePoint && codePoint <= 0x2287) ||
|
||
|
|
(0x2295 == codePoint) ||
|
||
|
|
(0x2299 == codePoint) ||
|
||
|
|
(0x22A5 == codePoint) ||
|
||
|
|
(0x22BF == codePoint) ||
|
||
|
|
(0x2312 == codePoint) ||
|
||
|
|
(0x2460 <= codePoint && codePoint <= 0x24E9) ||
|
||
|
|
(0x24EB <= codePoint && codePoint <= 0x254B) ||
|
||
|
|
(0x2550 <= codePoint && codePoint <= 0x2573) ||
|
||
|
|
(0x2580 <= codePoint && codePoint <= 0x258F) ||
|
||
|
|
(0x2592 <= codePoint && codePoint <= 0x2595) ||
|
||
|
|
(0x25A0 <= codePoint && codePoint <= 0x25A1) ||
|
||
|
|
(0x25A3 <= codePoint && codePoint <= 0x25A9) ||
|
||
|
|
(0x25B2 <= codePoint && codePoint <= 0x25B3) ||
|
||
|
|
(0x25B6 <= codePoint && codePoint <= 0x25B7) ||
|
||
|
|
(0x25BC <= codePoint && codePoint <= 0x25BD) ||
|
||
|
|
(0x25C0 <= codePoint && codePoint <= 0x25C1) ||
|
||
|
|
(0x25C6 <= codePoint && codePoint <= 0x25C8) ||
|
||
|
|
(0x25CB == codePoint) ||
|
||
|
|
(0x25CE <= codePoint && codePoint <= 0x25D1) ||
|
||
|
|
(0x25E2 <= codePoint && codePoint <= 0x25E5) ||
|
||
|
|
(0x25EF == codePoint) ||
|
||
|
|
(0x2605 <= codePoint && codePoint <= 0x2606) ||
|
||
|
|
(0x2609 == codePoint) ||
|
||
|
|
(0x260E <= codePoint && codePoint <= 0x260F) ||
|
||
|
|
(0x2614 <= codePoint && codePoint <= 0x2615) ||
|
||
|
|
(0x261C == codePoint) ||
|
||
|
|
(0x261E == codePoint) ||
|
||
|
|
(0x2640 == codePoint) ||
|
||
|
|
(0x2642 == codePoint) ||
|
||
|
|
(0x2660 <= codePoint && codePoint <= 0x2661) ||
|
||
|
|
(0x2663 <= codePoint && codePoint <= 0x2665) ||
|
||
|
|
(0x2667 <= codePoint && codePoint <= 0x266A) ||
|
||
|
|
(0x266C <= codePoint && codePoint <= 0x266D) ||
|
||
|
|
(0x266F == codePoint) ||
|
||
|
|
(0x269E <= codePoint && codePoint <= 0x269F) ||
|
||
|
|
(0x26BE <= codePoint && codePoint <= 0x26BF) ||
|
||
|
|
(0x26C4 <= codePoint && codePoint <= 0x26CD) ||
|
||
|
|
(0x26CF <= codePoint && codePoint <= 0x26E1) ||
|
||
|
|
(0x26E3 == codePoint) ||
|
||
|
|
(0x26E8 <= codePoint && codePoint <= 0x26FF) ||
|
||
|
|
(0x273D == codePoint) ||
|
||
|
|
(0x2757 == codePoint) ||
|
||
|
|
(0x2776 <= codePoint && codePoint <= 0x277F) ||
|
||
|
|
(0x2B55 <= codePoint && codePoint <= 0x2B59) ||
|
||
|
|
(0x3248 <= codePoint && codePoint <= 0x324F) ||
|
||
|
|
(0xE000 <= codePoint && codePoint <= 0xF8FF) ||
|
||
|
|
(0xFE00 <= codePoint && codePoint <= 0xFE0F) ||
|
||
|
|
(0xFFFD == codePoint) ||
|
||
|
|
(0x1F100 <= codePoint && codePoint <= 0x1F10A) ||
|
||
|
|
(0x1F110 <= codePoint && codePoint <= 0x1F12D) ||
|
||
|
|
(0x1F130 <= codePoint && codePoint <= 0x1F169) ||
|
||
|
|
(0x1F170 <= codePoint && codePoint <= 0x1F19A) ||
|
||
|
|
(0xE0100 <= codePoint && codePoint <= 0xE01EF) ||
|
||
|
|
(0xF0000 <= codePoint && codePoint <= 0xFFFFD) ||
|
||
|
|
(0x100000 <= codePoint && codePoint <= 0x10FFFD)) {
|
||
|
|
return 'A';
|
||
|
|
}
|
||
|
|
|
||
|
|
return 'N';
|
||
|
|
};
|
||
|
|
|
||
|
|
eaw.characterLength = function(character) {
|
||
|
|
var code = this.eastAsianWidth(character);
|
||
|
|
if (code == 'F' || code == 'W' || code == 'A') {
|
||
|
|
return 2;
|
||
|
|
} else {
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
// Split a string considering surrogate-pairs.
|
||
|
|
function stringToArray(string) {
|
||
|
|
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
||
|
|
}
|
||
|
|
|
||
|
|
eaw.length = function(string) {
|
||
|
|
var characters = stringToArray(string);
|
||
|
|
var len = 0;
|
||
|
|
for (var i = 0; i < characters.length; i++) {
|
||
|
|
len = len + this.characterLength(characters[i]);
|
||
|
|
}
|
||
|
|
return len;
|
||
|
|
};
|
||
|
|
|
||
|
|
eaw.slice = function(text, start, end) {
|
||
|
|
textLen = eaw.length(text);
|
||
|
|
start = start ? start : 0;
|
||
|
|
end = end ? end : 1;
|
||
|
|
if (start < 0) {
|
||
|
|
start = textLen + start;
|
||
|
|
}
|
||
|
|
if (end < 0) {
|
||
|
|
end = textLen + end;
|
||
|
|
}
|
||
|
|
var result = '';
|
||
|
|
var eawLen = 0;
|
||
|
|
var chars = stringToArray(text);
|
||
|
|
for (var i = 0; i < chars.length; i++) {
|
||
|
|
var char = chars[i];
|
||
|
|
var charLen = eaw.length(char);
|
||
|
|
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
|
||
|
|
if (eawLen + charLen <= end) {
|
||
|
|
result += char;
|
||
|
|
} else {
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
eawLen += charLen;
|
||
|
|
}
|
||
|
|
return result;
|
||
|
|
};
|
||
|
|
} (eastasianwidth));
|
||
|
|
|
||
|
|
const eastAsianWidth = eastasianwidthExports;
|
||
|
|
|
||
|
|
var emojiRegex = function () {
|
||
|
|
// https://mths.be/emoji
|
||
|
|
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\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])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\
|
||
|
|
};
|
||
|
|
|
||
|
|
function stringWidth(string, options = {}) {
|
||
|
|
if (typeof string !== 'string' || string.length === 0) {
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
options = {
|
||
|
|
ambiguousIsNarrow: true,
|
||
|
|
...options
|
||
|
|
};
|
||
|
|
|
||
|
|
string = stripAnsi(string);
|
||
|
|
|
||
|
|
if (string.length === 0) {
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
string = string.replace(emojiRegex(), ' ');
|
||
|
|
|
||
|
|
const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
|
||
|
|
let width = 0;
|
||
|
|
|
||
|
|
for (const character of string) {
|
||
|
|
const codePoint = character.codePointAt(0);
|
||
|
|
|
||
|
|
// Ignore control characters
|
||
|
|
if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Ignore combining characters
|
||
|
|
if (codePoint >= 0x300 && codePoint <= 0x36F) {
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
|
||
|
|
const code = eastAsianWidth.eastAsianWidth(character);
|
||
|
|
switch (code) {
|
||
|
|
case 'F':
|
||
|
|
case 'W':
|
||
|
|
width += 2;
|
||
|
|
break;
|
||
|
|
case 'A':
|
||
|
|
width += ambiguousCharacterWidth;
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
width += 1;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return width;
|
||
|
|
}
|
||
|
|
|
||
|
|
function isUnicodeSupported() {
|
||
|
|
if (process$1.platform !== 'win32') {
|
||
|
|
return process$1.env.TERM !== 'linux'; // Linux console (kernel)
|
||
|
|
}
|
||
|
|
|
||
|
|
return Boolean(process$1.env.CI)
|
||
|
|
|| Boolean(process$1.env.WT_SESSION) // Windows Terminal
|
||
|
|
|| Boolean(process$1.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)
|
||
|
|
|| process$1.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
|
||
|
|
|| process$1.env.TERM_PROGRAM === 'Terminus-Sublime'
|
||
|
|
|| process$1.env.TERM_PROGRAM === 'vscode'
|
||
|
|
|| process$1.env.TERM === 'xterm-256color'
|
||
|
|
|| process$1.env.TERM === 'alacritty'
|
||
|
|
|| process$1.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
|
||
|
|
}
|
||
|
|
|
||
|
|
const {
|
||
|
|
env = {},
|
||
|
|
argv = [],
|
||
|
|
platform = "",
|
||
|
|
} = typeof process === "undefined" ? {} : process;
|
||
|
|
|
||
|
|
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
||
|
|
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
||
|
|
const isWindows = platform === "win32";
|
||
|
|
const isDumbTerminal = env.TERM === "dumb";
|
||
|
|
|
||
|
|
const isCompatibleTerminal =
|
||
|
|
tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
||
|
|
|
||
|
|
const isCI =
|
||
|
|
"CI" in env &&
|
||
|
|
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
||
|
|
|
||
|
|
const isColorSupported =
|
||
|
|
!isDisabled &&
|
||
|
|
(isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI);
|
||
|
|
|
||
|
|
const replaceClose = (
|
||
|
|
index,
|
||
|
|
string,
|
||
|
|
close,
|
||
|
|
replace,
|
||
|
|
head = string.substring(0, index) + replace,
|
||
|
|
tail = string.substring(index + close.length),
|
||
|
|
next = tail.indexOf(close)
|
||
|
|
) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
||
|
|
|
||
|
|
const clearBleed = (index, string, open, close, replace) =>
|
||
|
|
index < 0
|
||
|
|
? open + string + close
|
||
|
|
: open + replaceClose(index, string, close, replace) + close;
|
||
|
|
|
||
|
|
const filterEmpty =
|
||
|
|
(open, close, replace = open, at = open.length + 1) =>
|
||
|
|
(string) =>
|
||
|
|
string || !(string === "" || string === undefined)
|
||
|
|
? clearBleed(
|
||
|
|
("" + string).indexOf(close, at),
|
||
|
|
string,
|
||
|
|
open,
|
||
|
|
close,
|
||
|
|
replace
|
||
|
|
)
|
||
|
|
: "";
|
||
|
|
|
||
|
|
const init = (open, close, replace) =>
|
||
|
|
filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
|
||
|
|
|
||
|
|
const colors = {
|
||
|
|
reset: init(0, 0),
|
||
|
|
bold: init(1, 22, "\x1b[22m\x1b[1m"),
|
||
|
|
dim: init(2, 22, "\x1b[22m\x1b[2m"),
|
||
|
|
italic: init(3, 23),
|
||
|
|
underline: init(4, 24),
|
||
|
|
inverse: init(7, 27),
|
||
|
|
hidden: init(8, 28),
|
||
|
|
strikethrough: init(9, 29),
|
||
|
|
black: init(30, 39),
|
||
|
|
red: init(31, 39),
|
||
|
|
green: init(32, 39),
|
||
|
|
yellow: init(33, 39),
|
||
|
|
blue: init(34, 39),
|
||
|
|
magenta: init(35, 39),
|
||
|
|
cyan: init(36, 39),
|
||
|
|
white: init(37, 39),
|
||
|
|
gray: init(90, 39),
|
||
|
|
bgBlack: init(40, 49),
|
||
|
|
bgRed: init(41, 49),
|
||
|
|
bgGreen: init(42, 49),
|
||
|
|
bgYellow: init(43, 49),
|
||
|
|
bgBlue: init(44, 49),
|
||
|
|
bgMagenta: init(45, 49),
|
||
|
|
bgCyan: init(46, 49),
|
||
|
|
bgWhite: init(47, 49),
|
||
|
|
blackBright: init(90, 39),
|
||
|
|
redBright: init(91, 39),
|
||
|
|
greenBright: init(92, 39),
|
||
|
|
yellowBright: init(93, 39),
|
||
|
|
blueBright: init(94, 39),
|
||
|
|
magentaBright: init(95, 39),
|
||
|
|
cyanBright: init(96, 39),
|
||
|
|
whiteBright: init(97, 39),
|
||
|
|
bgBlackBright: init(100, 49),
|
||
|
|
bgRedBright: init(101, 49),
|
||
|
|
bgGreenBright: init(102, 49),
|
||
|
|
bgYellowBright: init(103, 49),
|
||
|
|
bgBlueBright: init(104, 49),
|
||
|
|
bgMagentaBright: init(105, 49),
|
||
|
|
bgCyanBright: init(106, 49),
|
||
|
|
bgWhiteBright: init(107, 49),
|
||
|
|
};
|
||
|
|
|
||
|
|
const createColors = ({ useColor = isColorSupported } = {}) =>
|
||
|
|
useColor
|
||
|
|
? colors
|
||
|
|
: Object.keys(colors).reduce(
|
||
|
|
(colors, key) => ({ ...colors, [key]: String }),
|
||
|
|
{}
|
||
|
|
);
|
||
|
|
|
||
|
|
const {
|
||
|
|
reset,
|
||
|
|
bold,
|
||
|
|
dim,
|
||
|
|
italic,
|
||
|
|
underline,
|
||
|
|
inverse,
|
||
|
|
hidden,
|
||
|
|
strikethrough,
|
||
|
|
black,
|
||
|
|
red,
|
||
|
|
green,
|
||
|
|
yellow,
|
||
|
|
blue,
|
||
|
|
magenta,
|
||
|
|
cyan,
|
||
|
|
white,
|
||
|
|
gray,
|
||
|
|
bgBlack,
|
||
|
|
bgRed,
|
||
|
|
bgGreen,
|
||
|
|
bgYellow,
|
||
|
|
bgBlue,
|
||
|
|
bgMagenta,
|
||
|
|
bgCyan,
|
||
|
|
bgWhite,
|
||
|
|
blackBright,
|
||
|
|
redBright,
|
||
|
|
greenBright,
|
||
|
|
yellowBright,
|
||
|
|
blueBright,
|
||
|
|
magentaBright,
|
||
|
|
cyanBright,
|
||
|
|
whiteBright,
|
||
|
|
bgBlackBright,
|
||
|
|
bgRedBright,
|
||
|
|
bgGreenBright,
|
||
|
|
bgYellowBright,
|
||
|
|
bgBlueBright,
|
||
|
|
bgMagentaBright,
|
||
|
|
bgCyanBright,
|
||
|
|
bgWhiteBright,
|
||
|
|
} = createColors();
|
||
|
|
|
||
|
|
const colors$1 = {
|
||
|
|
__proto__: null,
|
||
|
|
bgBlack: bgBlack,
|
||
|
|
bgBlackBright: bgBlackBright,
|
||
|
|
bgBlue: bgBlue,
|
||
|
|
bgBlueBright: bgBlueBright,
|
||
|
|
bgCyan: bgCyan,
|
||
|
|
bgCyanBright: bgCyanBright,
|
||
|
|
bgGreen: bgGreen,
|
||
|
|
bgGreenBright: bgGreenBright,
|
||
|
|
bgMagenta: bgMagenta,
|
||
|
|
bgMagentaBright: bgMagentaBright,
|
||
|
|
bgRed: bgRed,
|
||
|
|
bgRedBright: bgRedBright,
|
||
|
|
bgWhite: bgWhite,
|
||
|
|
bgWhiteBright: bgWhiteBright,
|
||
|
|
bgYellow: bgYellow,
|
||
|
|
bgYellowBright: bgYellowBright,
|
||
|
|
black: black,
|
||
|
|
blackBright: blackBright,
|
||
|
|
blue: blue,
|
||
|
|
blueBright: blueBright,
|
||
|
|
bold: bold,
|
||
|
|
createColors: createColors,
|
||
|
|
cyan: cyan,
|
||
|
|
cyanBright: cyanBright,
|
||
|
|
dim: dim,
|
||
|
|
gray: gray,
|
||
|
|
green: green,
|
||
|
|
greenBright: greenBright,
|
||
|
|
hidden: hidden,
|
||
|
|
inverse: inverse,
|
||
|
|
isColorSupported: isColorSupported,
|
||
|
|
italic: italic,
|
||
|
|
magenta: magenta,
|
||
|
|
magentaBright: magentaBright,
|
||
|
|
red: red,
|
||
|
|
redBright: redBright,
|
||
|
|
reset: reset,
|
||
|
|
strikethrough: strikethrough,
|
||
|
|
underline: underline,
|
||
|
|
white: white,
|
||
|
|
whiteBright: whiteBright,
|
||
|
|
yellow: yellow,
|
||
|
|
yellowBright: yellowBright
|
||
|
|
};
|
||
|
|
|
||
|
|
const TYPE_COLOR_MAP = {
|
||
|
|
info: "cyan",
|
||
|
|
fail: "red",
|
||
|
|
success: "green",
|
||
|
|
ready: "green",
|
||
|
|
start: "magenta"
|
||
|
|
};
|
||
|
|
const LEVEL_COLOR_MAP = {
|
||
|
|
0: "red",
|
||
|
|
1: "yellow"
|
||
|
|
};
|
||
|
|
const unicode = isUnicodeSupported();
|
||
|
|
const s = (c, fallback) => unicode ? c : fallback;
|
||
|
|
const TYPE_ICONS = {
|
||
|
|
error: s("\u2716", "\xD7"),
|
||
|
|
fatal: s("\u2716", "\xD7"),
|
||
|
|
ready: s("\u2714", "\u221A"),
|
||
|
|
warn: s("\u26A0", "\u203C"),
|
||
|
|
info: s("\u2139", "i"),
|
||
|
|
success: s("\u2714", "\u221A"),
|
||
|
|
debug: s("\u2699", "D"),
|
||
|
|
trace: s("\u2192", "\u2192"),
|
||
|
|
fail: s("\u2716", "\xD7"),
|
||
|
|
start: s("\u25D0", "o"),
|
||
|
|
log: ""
|
||
|
|
};
|
||
|
|
class FancyReporter extends BasicReporter {
|
||
|
|
formatStack(stack) {
|
||
|
|
return "\n" + parseStack(stack).map(
|
||
|
|
(line) => " " + line.replace(/^at +/, (m) => gray(m)).replace(/\((.+)\)/, (_, m) => `(${cyan(m)})`)
|
||
|
|
).join("\n");
|
||
|
|
}
|
||
|
|
formatType(logObj, isBadge, opts) {
|
||
|
|
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
||
|
|
if (isBadge) {
|
||
|
|
return getBgColor(typeColor)(
|
||
|
|
black(` ${logObj.type.toUpperCase()} `)
|
||
|
|
);
|
||
|
|
}
|
||
|
|
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
||
|
|
return _type ? getColor(typeColor)(_type) : "";
|
||
|
|
}
|
||
|
|
formatLogObj(logObj, opts) {
|
||
|
|
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
||
|
|
"\n"
|
||
|
|
);
|
||
|
|
const isBadge = logObj.badge ?? logObj.level < 2;
|
||
|
|
const date = this.formatDate(logObj.date, opts);
|
||
|
|
const coloredDate = date && gray(date);
|
||
|
|
const type = this.formatType(logObj, isBadge, opts);
|
||
|
|
const tag = logObj.tag ? gray(logObj.tag) : "";
|
||
|
|
let line;
|
||
|
|
const left = this.filterAndJoin([type, highlightBackticks(message)]);
|
||
|
|
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
||
|
|
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
||
|
|
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${gray(`[${right}]`)} ` : "") + left;
|
||
|
|
line += highlightBackticks(
|
||
|
|
additional.length > 0 ? "\n" + additional.join("\n") : ""
|
||
|
|
);
|
||
|
|
if (logObj.type === "trace") {
|
||
|
|
const _err = new Error("Trace: " + logObj.message);
|
||
|
|
line += this.formatStack(_err.stack || "");
|
||
|
|
}
|
||
|
|
return isBadge ? "\n" + line + "\n" : line;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function highlightBackticks(str) {
|
||
|
|
return str.replace(/`([^`]+)`/gm, (_, m) => cyan(m));
|
||
|
|
}
|
||
|
|
function getColor(color = "white") {
|
||
|
|
return colors$1[color] || white;
|
||
|
|
}
|
||
|
|
function getBgColor(color = "bgWhite") {
|
||
|
|
return colors$1[`bg${color[0].toUpperCase()}${color.slice(1)}`] || bgWhite;
|
||
|
|
}
|
||
|
|
|
||
|
|
function createConsola(options = {}) {
|
||
|
|
let level = _getDefaultLogLevel();
|
||
|
|
if (process.env.CONSOLA_LEVEL) {
|
||
|
|
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
||
|
|
}
|
||
|
|
const consola2 = createConsola$1({
|
||
|
|
level,
|
||
|
|
defaults: { level },
|
||
|
|
stdout: process.stdout,
|
||
|
|
stderr: process.stderr,
|
||
|
|
prompt: (...args) => import('../chunks/prompt.mjs').then((m) => m.prompt(...args)),
|
||
|
|
reporters: options.reporters || [
|
||
|
|
options.fancy ?? !(isCI$1 || isTest) ? new FancyReporter() : new BasicReporter()
|
||
|
|
],
|
||
|
|
...options
|
||
|
|
});
|
||
|
|
return consola2;
|
||
|
|
}
|
||
|
|
function _getDefaultLogLevel() {
|
||
|
|
if (isDebug) {
|
||
|
|
return LogLevels.debug;
|
||
|
|
}
|
||
|
|
if (isTest) {
|
||
|
|
return LogLevels.warn;
|
||
|
|
}
|
||
|
|
return LogLevels.info;
|
||
|
|
}
|
||
|
|
const consola = createConsola();
|
||
|
|
|
||
|
|
export { inverse as a, green as b, cyan as c, dim as d, bgWhite as e, red as f, gray as g, hidden as h, isUnicodeSupported as i, createConsola as j, consola as k, reset as r, strikethrough as s, yellow as y };
|