@putout/babel 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/babel.cjs +631 -127
- package/package.json +1 -1
- package/bundle/core.cjs +0 -72287
package/bundle/babel.cjs
CHANGED
|
@@ -101,22 +101,22 @@ function isIdentifierName(name) {
|
|
|
101
101
|
return !isFirst;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
const reservedWords$
|
|
104
|
+
const reservedWords$2 = {
|
|
105
105
|
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
|
106
106
|
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
|
107
107
|
strictBind: ["eval", "arguments"]
|
|
108
108
|
};
|
|
109
|
-
const keywords$
|
|
110
|
-
const reservedWordsStrictSet$
|
|
111
|
-
new Set(reservedWords$
|
|
112
|
-
function isReservedWord$
|
|
109
|
+
const keywords$3 = new Set(reservedWords$2.keyword);
|
|
110
|
+
const reservedWordsStrictSet$2 = new Set(reservedWords$2.strict);
|
|
111
|
+
new Set(reservedWords$2.strictBind);
|
|
112
|
+
function isReservedWord$2(word, inModule) {
|
|
113
113
|
return inModule && word === "await" || word === "enum";
|
|
114
114
|
}
|
|
115
|
-
function isStrictReservedWord$
|
|
116
|
-
return isReservedWord$
|
|
115
|
+
function isStrictReservedWord$2(word, inModule) {
|
|
116
|
+
return isReservedWord$2(word, inModule) || reservedWordsStrictSet$2.has(word);
|
|
117
117
|
}
|
|
118
|
-
function isKeyword$
|
|
119
|
-
return keywords$
|
|
118
|
+
function isKeyword$2(word) {
|
|
119
|
+
return keywords$3.has(word);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
var _isDigit$1 = function isDigit(code) {
|
|
@@ -2947,7 +2947,7 @@ function is$1(type, node, opts) {
|
|
|
2947
2947
|
function isValidIdentifier(name, reserved = true) {
|
|
2948
2948
|
if (typeof name !== "string") return false;
|
|
2949
2949
|
if (reserved) {
|
|
2950
|
-
if (isKeyword$
|
|
2950
|
+
if (isKeyword$2(name) || isStrictReservedWord$2(name, true)) {
|
|
2951
2951
|
return false;
|
|
2952
2952
|
}
|
|
2953
2953
|
}
|
|
@@ -3610,7 +3610,7 @@ defineType$4("Identifier", {
|
|
|
3610
3610
|
meta: node
|
|
3611
3611
|
})) return;
|
|
3612
3612
|
}
|
|
3613
|
-
if ((isKeyword$
|
|
3613
|
+
if ((isKeyword$2(node.name) || isReservedWord$2(node.name, false)) && node.name !== "this") {
|
|
3614
3614
|
throw new TypeError(`"${node.name}" is not a valid identifier`);
|
|
3615
3615
|
}
|
|
3616
3616
|
}
|
|
@@ -12633,28 +12633,28 @@ function isIdentifierChar(code) {
|
|
|
12633
12633
|
}
|
|
12634
12634
|
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
12635
12635
|
}
|
|
12636
|
-
const reservedWords = {
|
|
12636
|
+
const reservedWords$1 = {
|
|
12637
12637
|
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
|
12638
12638
|
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
|
12639
12639
|
strictBind: ["eval", "arguments"]
|
|
12640
12640
|
};
|
|
12641
|
-
const keywords = new Set(reservedWords.keyword);
|
|
12642
|
-
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
|
12643
|
-
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
|
12644
|
-
function isReservedWord(word, inModule) {
|
|
12641
|
+
const keywords$2 = new Set(reservedWords$1.keyword);
|
|
12642
|
+
const reservedWordsStrictSet$1 = new Set(reservedWords$1.strict);
|
|
12643
|
+
const reservedWordsStrictBindSet = new Set(reservedWords$1.strictBind);
|
|
12644
|
+
function isReservedWord$1(word, inModule) {
|
|
12645
12645
|
return inModule && word === "await" || word === "enum";
|
|
12646
12646
|
}
|
|
12647
|
-
function isStrictReservedWord(word, inModule) {
|
|
12648
|
-
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
12647
|
+
function isStrictReservedWord$1(word, inModule) {
|
|
12648
|
+
return isReservedWord$1(word, inModule) || reservedWordsStrictSet$1.has(word);
|
|
12649
12649
|
}
|
|
12650
12650
|
function isStrictBindOnlyReservedWord(word) {
|
|
12651
12651
|
return reservedWordsStrictBindSet.has(word);
|
|
12652
12652
|
}
|
|
12653
12653
|
function isStrictBindReservedWord(word, inModule) {
|
|
12654
|
-
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
12654
|
+
return isStrictReservedWord$1(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
12655
12655
|
}
|
|
12656
|
-
function isKeyword(word) {
|
|
12657
|
-
return keywords.has(word);
|
|
12656
|
+
function isKeyword$1(word) {
|
|
12657
|
+
return keywords$2.has(word);
|
|
12658
12658
|
}
|
|
12659
12659
|
function isIteratorStart(current, next, next2) {
|
|
12660
12660
|
return current === 64 && next === 64 && isIdentifierStart(next2);
|
|
@@ -23299,14 +23299,14 @@ class ExpressionParser extends LValParser {
|
|
|
23299
23299
|
if (!canBeReservedWord(word)) {
|
|
23300
23300
|
return;
|
|
23301
23301
|
}
|
|
23302
|
-
if (checkKeywords && isKeyword(word)) {
|
|
23302
|
+
if (checkKeywords && isKeyword$1(word)) {
|
|
23303
23303
|
this.raise(Errors.UnexpectedKeyword, {
|
|
23304
23304
|
at: startLoc,
|
|
23305
23305
|
keyword: word
|
|
23306
23306
|
});
|
|
23307
23307
|
return;
|
|
23308
23308
|
}
|
|
23309
|
-
const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
|
|
23309
|
+
const reservedTest = !this.state.strict ? isReservedWord$1 : isBinding ? isStrictBindReservedWord : isStrictReservedWord$1;
|
|
23310
23310
|
if (reservedTest(word, this.inModule)) {
|
|
23311
23311
|
this.raise(Errors.UnexpectedReservedWord, {
|
|
23312
23312
|
at: startLoc,
|
|
@@ -25975,15 +25975,33 @@ var jsTokens_1 = function*(input, {jsx = false} = {}) {
|
|
|
25975
25975
|
|
|
25976
25976
|
var jsTokens = /*@__PURE__*/getDefaultExportFromCjs(jsTokens_1);
|
|
25977
25977
|
|
|
25978
|
-
const
|
|
25978
|
+
const reservedWords = {
|
|
25979
|
+
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
|
25980
|
+
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
|
25981
|
+
strictBind: ["eval", "arguments"]
|
|
25982
|
+
};
|
|
25983
|
+
const keywords = new Set(reservedWords.keyword);
|
|
25984
|
+
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
|
25985
|
+
new Set(reservedWords.strictBind);
|
|
25986
|
+
function isReservedWord(word, inModule) {
|
|
25987
|
+
return inModule && word === "await" || word === "enum";
|
|
25988
|
+
}
|
|
25989
|
+
function isStrictReservedWord(word, inModule) {
|
|
25990
|
+
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
25991
|
+
}
|
|
25992
|
+
function isKeyword(word) {
|
|
25993
|
+
return keywords.has(word);
|
|
25994
|
+
}
|
|
25979
25995
|
|
|
25980
|
-
const
|
|
25996
|
+
const ANSI_BACKGROUND_OFFSET$1 = 10;
|
|
25981
25997
|
|
|
25982
|
-
const
|
|
25998
|
+
const wrapAnsi16$1 = (offset = 0) => code => `\u001B[${code + offset}m`;
|
|
25983
25999
|
|
|
25984
|
-
const
|
|
26000
|
+
const wrapAnsi256$1 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
|
25985
26001
|
|
|
25986
|
-
const
|
|
26002
|
+
const wrapAnsi16m$1 = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
26003
|
+
|
|
26004
|
+
const styles$3 = {
|
|
25987
26005
|
modifier: {
|
|
25988
26006
|
reset: [0, 0],
|
|
25989
26007
|
// 21 isn't widely supported and 22 does the same thing
|
|
@@ -26042,49 +26060,49 @@ const styles$1 = {
|
|
|
26042
26060
|
},
|
|
26043
26061
|
};
|
|
26044
26062
|
|
|
26045
|
-
Object.keys(styles$
|
|
26046
|
-
const foregroundColorNames = Object.keys(styles$
|
|
26047
|
-
const backgroundColorNames = Object.keys(styles$
|
|
26048
|
-
[...foregroundColorNames, ...backgroundColorNames];
|
|
26063
|
+
Object.keys(styles$3.modifier);
|
|
26064
|
+
const foregroundColorNames$1 = Object.keys(styles$3.color);
|
|
26065
|
+
const backgroundColorNames$1 = Object.keys(styles$3.bgColor);
|
|
26066
|
+
[...foregroundColorNames$1, ...backgroundColorNames$1];
|
|
26049
26067
|
|
|
26050
|
-
function assembleStyles() {
|
|
26068
|
+
function assembleStyles$1() {
|
|
26051
26069
|
const codes = new Map();
|
|
26052
26070
|
|
|
26053
|
-
for (const [groupName, group] of Object.entries(styles$
|
|
26071
|
+
for (const [groupName, group] of Object.entries(styles$3)) {
|
|
26054
26072
|
for (const [styleName, style] of Object.entries(group)) {
|
|
26055
|
-
styles$
|
|
26073
|
+
styles$3[styleName] = {
|
|
26056
26074
|
open: `\u001B[${style[0]}m`,
|
|
26057
26075
|
close: `\u001B[${style[1]}m`,
|
|
26058
26076
|
};
|
|
26059
26077
|
|
|
26060
|
-
group[styleName] = styles$
|
|
26078
|
+
group[styleName] = styles$3[styleName];
|
|
26061
26079
|
|
|
26062
26080
|
codes.set(style[0], style[1]);
|
|
26063
26081
|
}
|
|
26064
26082
|
|
|
26065
|
-
Object.defineProperty(styles$
|
|
26083
|
+
Object.defineProperty(styles$3, groupName, {
|
|
26066
26084
|
value: group,
|
|
26067
26085
|
enumerable: false,
|
|
26068
26086
|
});
|
|
26069
26087
|
}
|
|
26070
26088
|
|
|
26071
|
-
Object.defineProperty(styles$
|
|
26089
|
+
Object.defineProperty(styles$3, 'codes', {
|
|
26072
26090
|
value: codes,
|
|
26073
26091
|
enumerable: false,
|
|
26074
26092
|
});
|
|
26075
26093
|
|
|
26076
|
-
styles$
|
|
26077
|
-
styles$
|
|
26094
|
+
styles$3.color.close = '\u001B[39m';
|
|
26095
|
+
styles$3.bgColor.close = '\u001B[49m';
|
|
26078
26096
|
|
|
26079
|
-
styles$
|
|
26080
|
-
styles$
|
|
26081
|
-
styles$
|
|
26082
|
-
styles$
|
|
26083
|
-
styles$
|
|
26084
|
-
styles$
|
|
26097
|
+
styles$3.color.ansi = wrapAnsi16$1();
|
|
26098
|
+
styles$3.color.ansi256 = wrapAnsi256$1();
|
|
26099
|
+
styles$3.color.ansi16m = wrapAnsi16m$1();
|
|
26100
|
+
styles$3.bgColor.ansi = wrapAnsi16$1(ANSI_BACKGROUND_OFFSET$1);
|
|
26101
|
+
styles$3.bgColor.ansi256 = wrapAnsi256$1(ANSI_BACKGROUND_OFFSET$1);
|
|
26102
|
+
styles$3.bgColor.ansi16m = wrapAnsi16m$1(ANSI_BACKGROUND_OFFSET$1);
|
|
26085
26103
|
|
|
26086
26104
|
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
|
26087
|
-
Object.defineProperties(styles$
|
|
26105
|
+
Object.defineProperties(styles$3, {
|
|
26088
26106
|
rgbToAnsi256: {
|
|
26089
26107
|
value(red, green, blue) {
|
|
26090
26108
|
// We use the extended greyscale palette here, with the exception of
|
|
@@ -26134,7 +26152,7 @@ function assembleStyles() {
|
|
|
26134
26152
|
enumerable: false,
|
|
26135
26153
|
},
|
|
26136
26154
|
hexToAnsi256: {
|
|
26137
|
-
value: hex => styles$
|
|
26155
|
+
value: hex => styles$3.rgbToAnsi256(...styles$3.hexToRgb(hex)),
|
|
26138
26156
|
enumerable: false,
|
|
26139
26157
|
},
|
|
26140
26158
|
ansi256ToAnsi: {
|
|
@@ -26183,51 +26201,51 @@ function assembleStyles() {
|
|
|
26183
26201
|
enumerable: false,
|
|
26184
26202
|
},
|
|
26185
26203
|
rgbToAnsi: {
|
|
26186
|
-
value: (red, green, blue) => styles$
|
|
26204
|
+
value: (red, green, blue) => styles$3.ansi256ToAnsi(styles$3.rgbToAnsi256(red, green, blue)),
|
|
26187
26205
|
enumerable: false,
|
|
26188
26206
|
},
|
|
26189
26207
|
hexToAnsi: {
|
|
26190
|
-
value: hex => styles$
|
|
26208
|
+
value: hex => styles$3.ansi256ToAnsi(styles$3.hexToAnsi256(hex)),
|
|
26191
26209
|
enumerable: false,
|
|
26192
26210
|
},
|
|
26193
26211
|
});
|
|
26194
26212
|
|
|
26195
|
-
return styles$
|
|
26213
|
+
return styles$3;
|
|
26196
26214
|
}
|
|
26197
26215
|
|
|
26198
|
-
const ansiStyles = assembleStyles();
|
|
26216
|
+
const ansiStyles$1 = assembleStyles$1();
|
|
26199
26217
|
|
|
26200
26218
|
/* eslint-env browser */
|
|
26201
26219
|
|
|
26202
|
-
const level = (() => {
|
|
26203
|
-
if (navigator
|
|
26220
|
+
const level$1 = (() => {
|
|
26221
|
+
if (globalThis?.navigator?.userAgentData) {
|
|
26204
26222
|
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
|
|
26205
26223
|
if (brand && brand.version > 93) {
|
|
26206
26224
|
return 3;
|
|
26207
26225
|
}
|
|
26208
26226
|
}
|
|
26209
26227
|
|
|
26210
|
-
if (/\b(Chrome|Chromium)\//.test(navigator
|
|
26228
|
+
if (/\b(Chrome|Chromium)\//.test(globalThis?.navigator?.userAgent)) {
|
|
26211
26229
|
return 1;
|
|
26212
26230
|
}
|
|
26213
26231
|
|
|
26214
26232
|
return 0;
|
|
26215
26233
|
})();
|
|
26216
26234
|
|
|
26217
|
-
const colorSupport = level !== 0 && {
|
|
26218
|
-
level,
|
|
26235
|
+
const colorSupport$1 = level$1 !== 0 && {
|
|
26236
|
+
level: level$1,
|
|
26219
26237
|
hasBasic: true,
|
|
26220
|
-
has256: level >= 2,
|
|
26221
|
-
has16m: level >= 3,
|
|
26238
|
+
has256: level$1 >= 2,
|
|
26239
|
+
has16m: level$1 >= 3,
|
|
26222
26240
|
};
|
|
26223
26241
|
|
|
26224
|
-
const supportsColor = {
|
|
26225
|
-
stdout: colorSupport,
|
|
26226
|
-
stderr: colorSupport,
|
|
26242
|
+
const supportsColor$1 = {
|
|
26243
|
+
stdout: colorSupport$1,
|
|
26244
|
+
stderr: colorSupport$1,
|
|
26227
26245
|
};
|
|
26228
26246
|
|
|
26229
26247
|
// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.
|
|
26230
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
26248
|
+
function stringReplaceAll$1(string, substring, replacer) {
|
|
26231
26249
|
let index = string.indexOf(substring);
|
|
26232
26250
|
if (index === -1) {
|
|
26233
26251
|
return string;
|
|
@@ -26246,7 +26264,7 @@ function stringReplaceAll(string, substring, replacer) {
|
|
|
26246
26264
|
return returnValue;
|
|
26247
26265
|
}
|
|
26248
26266
|
|
|
26249
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
26267
|
+
function stringEncaseCRLFWithFirstIndex$1(string, prefix, postfix, index) {
|
|
26250
26268
|
let endIndex = 0;
|
|
26251
26269
|
let returnValue = '';
|
|
26252
26270
|
do {
|
|
@@ -26260,131 +26278,131 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
26260
26278
|
return returnValue;
|
|
26261
26279
|
}
|
|
26262
26280
|
|
|
26263
|
-
const {stdout: stdoutColor, stderr: stderrColor} = supportsColor;
|
|
26281
|
+
const {stdout: stdoutColor$1, stderr: stderrColor$1} = supportsColor$1;
|
|
26264
26282
|
|
|
26265
|
-
const GENERATOR = Symbol('GENERATOR');
|
|
26266
|
-
const STYLER = Symbol('STYLER');
|
|
26267
|
-
const IS_EMPTY = Symbol('IS_EMPTY');
|
|
26283
|
+
const GENERATOR$1 = Symbol('GENERATOR');
|
|
26284
|
+
const STYLER$1 = Symbol('STYLER');
|
|
26285
|
+
const IS_EMPTY$1 = Symbol('IS_EMPTY');
|
|
26268
26286
|
|
|
26269
26287
|
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
|
26270
|
-
const levelMapping = [
|
|
26288
|
+
const levelMapping$1 = [
|
|
26271
26289
|
'ansi',
|
|
26272
26290
|
'ansi',
|
|
26273
26291
|
'ansi256',
|
|
26274
26292
|
'ansi16m',
|
|
26275
26293
|
];
|
|
26276
26294
|
|
|
26277
|
-
const styles = Object.create(null);
|
|
26295
|
+
const styles$2 = Object.create(null);
|
|
26278
26296
|
|
|
26279
|
-
const applyOptions = (object, options = {}) => {
|
|
26297
|
+
const applyOptions$1 = (object, options = {}) => {
|
|
26280
26298
|
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
26281
26299
|
throw new Error('The `level` option should be an integer from 0 to 3');
|
|
26282
26300
|
}
|
|
26283
26301
|
|
|
26284
26302
|
// Detect level if not set manually
|
|
26285
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
26303
|
+
const colorLevel = stdoutColor$1 ? stdoutColor$1.level : 0;
|
|
26286
26304
|
object.level = options.level === undefined ? colorLevel : options.level;
|
|
26287
26305
|
};
|
|
26288
26306
|
|
|
26289
|
-
class Chalk {
|
|
26307
|
+
let Chalk$1 = class Chalk {
|
|
26290
26308
|
constructor(options) {
|
|
26291
26309
|
// eslint-disable-next-line no-constructor-return
|
|
26292
|
-
return chalkFactory(options);
|
|
26310
|
+
return chalkFactory$1(options);
|
|
26293
26311
|
}
|
|
26294
|
-
}
|
|
26312
|
+
};
|
|
26295
26313
|
|
|
26296
|
-
const chalkFactory = options => {
|
|
26314
|
+
const chalkFactory$1 = options => {
|
|
26297
26315
|
const chalk = (...strings) => strings.join(' ');
|
|
26298
|
-
applyOptions(chalk, options);
|
|
26316
|
+
applyOptions$1(chalk, options);
|
|
26299
26317
|
|
|
26300
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
26318
|
+
Object.setPrototypeOf(chalk, createChalk$1.prototype);
|
|
26301
26319
|
|
|
26302
26320
|
return chalk;
|
|
26303
26321
|
};
|
|
26304
26322
|
|
|
26305
|
-
function createChalk(options) {
|
|
26306
|
-
return chalkFactory(options);
|
|
26323
|
+
function createChalk$1(options) {
|
|
26324
|
+
return chalkFactory$1(options);
|
|
26307
26325
|
}
|
|
26308
26326
|
|
|
26309
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
26327
|
+
Object.setPrototypeOf(createChalk$1.prototype, Function.prototype);
|
|
26310
26328
|
|
|
26311
|
-
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
26312
|
-
styles[styleName] = {
|
|
26329
|
+
for (const [styleName, style] of Object.entries(ansiStyles$1)) {
|
|
26330
|
+
styles$2[styleName] = {
|
|
26313
26331
|
get() {
|
|
26314
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
26332
|
+
const builder = createBuilder$1(this, createStyler$1(style.open, style.close, this[STYLER$1]), this[IS_EMPTY$1]);
|
|
26315
26333
|
Object.defineProperty(this, styleName, {value: builder});
|
|
26316
26334
|
return builder;
|
|
26317
26335
|
},
|
|
26318
26336
|
};
|
|
26319
26337
|
}
|
|
26320
26338
|
|
|
26321
|
-
styles.visible = {
|
|
26339
|
+
styles$2.visible = {
|
|
26322
26340
|
get() {
|
|
26323
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
26341
|
+
const builder = createBuilder$1(this, this[STYLER$1], true);
|
|
26324
26342
|
Object.defineProperty(this, 'visible', {value: builder});
|
|
26325
26343
|
return builder;
|
|
26326
26344
|
},
|
|
26327
26345
|
};
|
|
26328
26346
|
|
|
26329
|
-
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
26347
|
+
const getModelAnsi$1 = (model, level, type, ...arguments_) => {
|
|
26330
26348
|
if (model === 'rgb') {
|
|
26331
26349
|
if (level === 'ansi16m') {
|
|
26332
|
-
return ansiStyles[type].ansi16m(...arguments_);
|
|
26350
|
+
return ansiStyles$1[type].ansi16m(...arguments_);
|
|
26333
26351
|
}
|
|
26334
26352
|
|
|
26335
26353
|
if (level === 'ansi256') {
|
|
26336
|
-
return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
|
|
26354
|
+
return ansiStyles$1[type].ansi256(ansiStyles$1.rgbToAnsi256(...arguments_));
|
|
26337
26355
|
}
|
|
26338
26356
|
|
|
26339
|
-
return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
|
|
26357
|
+
return ansiStyles$1[type].ansi(ansiStyles$1.rgbToAnsi(...arguments_));
|
|
26340
26358
|
}
|
|
26341
26359
|
|
|
26342
26360
|
if (model === 'hex') {
|
|
26343
|
-
return getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));
|
|
26361
|
+
return getModelAnsi$1('rgb', level, type, ...ansiStyles$1.hexToRgb(...arguments_));
|
|
26344
26362
|
}
|
|
26345
26363
|
|
|
26346
|
-
return ansiStyles[type][model](...arguments_);
|
|
26364
|
+
return ansiStyles$1[type][model](...arguments_);
|
|
26347
26365
|
};
|
|
26348
26366
|
|
|
26349
|
-
const usedModels = ['rgb', 'hex', 'ansi256'];
|
|
26367
|
+
const usedModels$1 = ['rgb', 'hex', 'ansi256'];
|
|
26350
26368
|
|
|
26351
|
-
for (const model of usedModels) {
|
|
26352
|
-
styles[model] = {
|
|
26369
|
+
for (const model of usedModels$1) {
|
|
26370
|
+
styles$2[model] = {
|
|
26353
26371
|
get() {
|
|
26354
26372
|
const {level} = this;
|
|
26355
26373
|
return function (...arguments_) {
|
|
26356
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);
|
|
26357
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
26374
|
+
const styler = createStyler$1(getModelAnsi$1(model, levelMapping$1[level], 'color', ...arguments_), ansiStyles$1.color.close, this[STYLER$1]);
|
|
26375
|
+
return createBuilder$1(this, styler, this[IS_EMPTY$1]);
|
|
26358
26376
|
};
|
|
26359
26377
|
},
|
|
26360
26378
|
};
|
|
26361
26379
|
|
|
26362
26380
|
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
|
26363
|
-
styles[bgModel] = {
|
|
26381
|
+
styles$2[bgModel] = {
|
|
26364
26382
|
get() {
|
|
26365
26383
|
const {level} = this;
|
|
26366
26384
|
return function (...arguments_) {
|
|
26367
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
|
|
26368
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
26385
|
+
const styler = createStyler$1(getModelAnsi$1(model, levelMapping$1[level], 'bgColor', ...arguments_), ansiStyles$1.bgColor.close, this[STYLER$1]);
|
|
26386
|
+
return createBuilder$1(this, styler, this[IS_EMPTY$1]);
|
|
26369
26387
|
};
|
|
26370
26388
|
},
|
|
26371
26389
|
};
|
|
26372
26390
|
}
|
|
26373
26391
|
|
|
26374
|
-
const proto = Object.defineProperties(() => {}, {
|
|
26375
|
-
...styles,
|
|
26392
|
+
const proto$1 = Object.defineProperties(() => {}, {
|
|
26393
|
+
...styles$2,
|
|
26376
26394
|
level: {
|
|
26377
26395
|
enumerable: true,
|
|
26378
26396
|
get() {
|
|
26379
|
-
return this[GENERATOR].level;
|
|
26397
|
+
return this[GENERATOR$1].level;
|
|
26380
26398
|
},
|
|
26381
26399
|
set(level) {
|
|
26382
|
-
this[GENERATOR].level = level;
|
|
26400
|
+
this[GENERATOR$1].level = level;
|
|
26383
26401
|
},
|
|
26384
26402
|
},
|
|
26385
26403
|
});
|
|
26386
26404
|
|
|
26387
|
-
const createStyler = (open, close, parent) => {
|
|
26405
|
+
const createStyler$1 = (open, close, parent) => {
|
|
26388
26406
|
let openAll;
|
|
26389
26407
|
let closeAll;
|
|
26390
26408
|
if (parent === undefined) {
|
|
@@ -26404,28 +26422,28 @@ const createStyler = (open, close, parent) => {
|
|
|
26404
26422
|
};
|
|
26405
26423
|
};
|
|
26406
26424
|
|
|
26407
|
-
const createBuilder = (self, _styler, _isEmpty) => {
|
|
26425
|
+
const createBuilder$1 = (self, _styler, _isEmpty) => {
|
|
26408
26426
|
// Single argument is hot path, implicit coercion is faster than anything
|
|
26409
26427
|
// eslint-disable-next-line no-implicit-coercion
|
|
26410
|
-
const builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
|
26428
|
+
const builder = (...arguments_) => applyStyle$1(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
|
26411
26429
|
|
|
26412
26430
|
// We alter the prototype because we must return a function, but there is
|
|
26413
26431
|
// no way to create a function with a different prototype
|
|
26414
|
-
Object.setPrototypeOf(builder, proto);
|
|
26432
|
+
Object.setPrototypeOf(builder, proto$1);
|
|
26415
26433
|
|
|
26416
|
-
builder[GENERATOR] = self;
|
|
26417
|
-
builder[STYLER] = _styler;
|
|
26418
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
26434
|
+
builder[GENERATOR$1] = self;
|
|
26435
|
+
builder[STYLER$1] = _styler;
|
|
26436
|
+
builder[IS_EMPTY$1] = _isEmpty;
|
|
26419
26437
|
|
|
26420
26438
|
return builder;
|
|
26421
26439
|
};
|
|
26422
26440
|
|
|
26423
|
-
const applyStyle = (self, string) => {
|
|
26441
|
+
const applyStyle$1 = (self, string) => {
|
|
26424
26442
|
if (self.level <= 0 || !string) {
|
|
26425
|
-
return self[IS_EMPTY] ? '' : string;
|
|
26443
|
+
return self[IS_EMPTY$1] ? '' : string;
|
|
26426
26444
|
}
|
|
26427
26445
|
|
|
26428
|
-
let styler = self[STYLER];
|
|
26446
|
+
let styler = self[STYLER$1];
|
|
26429
26447
|
|
|
26430
26448
|
if (styler === undefined) {
|
|
26431
26449
|
return string;
|
|
@@ -26437,7 +26455,7 @@ const applyStyle = (self, string) => {
|
|
|
26437
26455
|
// Replace any instances already present with a re-opening code
|
|
26438
26456
|
// otherwise only the part of the string until said closing code
|
|
26439
26457
|
// will be colored, and the rest will simply be 'plain'.
|
|
26440
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
26458
|
+
string = stringReplaceAll$1(string, styler.close, styler.open);
|
|
26441
26459
|
|
|
26442
26460
|
styler = styler.parent;
|
|
26443
26461
|
}
|
|
@@ -26448,18 +26466,18 @@ const applyStyle = (self, string) => {
|
|
|
26448
26466
|
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
|
26449
26467
|
const lfIndex = string.indexOf('\n');
|
|
26450
26468
|
if (lfIndex !== -1) {
|
|
26451
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
26469
|
+
string = stringEncaseCRLFWithFirstIndex$1(string, closeAll, openAll, lfIndex);
|
|
26452
26470
|
}
|
|
26453
26471
|
|
|
26454
26472
|
return openAll + string + closeAll;
|
|
26455
26473
|
};
|
|
26456
26474
|
|
|
26457
|
-
Object.defineProperties(createChalk.prototype, styles);
|
|
26475
|
+
Object.defineProperties(createChalk$1.prototype, styles$2);
|
|
26458
26476
|
|
|
26459
|
-
const chalk = createChalk();
|
|
26460
|
-
createChalk({level: stderrColor ? stderrColor.level : 0});
|
|
26477
|
+
const chalk$2 = createChalk$1();
|
|
26478
|
+
createChalk$1({level: stderrColor$1 ? stderrColor$1.level : 0});
|
|
26461
26479
|
|
|
26462
|
-
var chalk$
|
|
26480
|
+
var chalk$3 = chalk$2;
|
|
26463
26481
|
|
|
26464
26482
|
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
|
26465
26483
|
function getDefs$1(chalk) {
|
|
@@ -26481,7 +26499,7 @@ let tokenize;
|
|
|
26481
26499
|
{
|
|
26482
26500
|
const getTokenType = function (token) {
|
|
26483
26501
|
if (token.type === "IdentifierName") {
|
|
26484
|
-
if (isKeyword
|
|
26502
|
+
if (isKeyword(token.value) || isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) {
|
|
26485
26503
|
return "keyword";
|
|
26486
26504
|
}
|
|
26487
26505
|
if (token.value[0] !== token.value[0].toLowerCase()) {
|
|
@@ -26582,17 +26600,17 @@ function highlightTokens(defs, text) {
|
|
|
26582
26600
|
return highlighted;
|
|
26583
26601
|
}
|
|
26584
26602
|
function shouldHighlight(options) {
|
|
26585
|
-
return chalk$
|
|
26603
|
+
return chalk$3.level > 0 || options.forceColor;
|
|
26586
26604
|
}
|
|
26587
26605
|
let chalkWithForcedColor$1 = undefined;
|
|
26588
26606
|
function getChalk$1(forceColor) {
|
|
26589
26607
|
if (forceColor) {
|
|
26590
|
-
chalkWithForcedColor$1 ??= new Chalk({
|
|
26608
|
+
chalkWithForcedColor$1 ??= new Chalk$1({
|
|
26591
26609
|
level: 1
|
|
26592
26610
|
});
|
|
26593
26611
|
return chalkWithForcedColor$1;
|
|
26594
26612
|
}
|
|
26595
|
-
return chalk$
|
|
26613
|
+
return chalk$3;
|
|
26596
26614
|
}
|
|
26597
26615
|
function highlight(code, options = {}) {
|
|
26598
26616
|
if (code !== "" && shouldHighlight(options)) {
|
|
@@ -26603,6 +26621,492 @@ function highlight(code, options = {}) {
|
|
|
26603
26621
|
}
|
|
26604
26622
|
}
|
|
26605
26623
|
|
|
26624
|
+
const ANSI_BACKGROUND_OFFSET = 10;
|
|
26625
|
+
|
|
26626
|
+
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
|
|
26627
|
+
|
|
26628
|
+
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
|
26629
|
+
|
|
26630
|
+
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
26631
|
+
|
|
26632
|
+
const styles$1 = {
|
|
26633
|
+
modifier: {
|
|
26634
|
+
reset: [0, 0],
|
|
26635
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
26636
|
+
bold: [1, 22],
|
|
26637
|
+
dim: [2, 22],
|
|
26638
|
+
italic: [3, 23],
|
|
26639
|
+
underline: [4, 24],
|
|
26640
|
+
overline: [53, 55],
|
|
26641
|
+
inverse: [7, 27],
|
|
26642
|
+
hidden: [8, 28],
|
|
26643
|
+
strikethrough: [9, 29],
|
|
26644
|
+
},
|
|
26645
|
+
color: {
|
|
26646
|
+
black: [30, 39],
|
|
26647
|
+
red: [31, 39],
|
|
26648
|
+
green: [32, 39],
|
|
26649
|
+
yellow: [33, 39],
|
|
26650
|
+
blue: [34, 39],
|
|
26651
|
+
magenta: [35, 39],
|
|
26652
|
+
cyan: [36, 39],
|
|
26653
|
+
white: [37, 39],
|
|
26654
|
+
|
|
26655
|
+
// Bright color
|
|
26656
|
+
blackBright: [90, 39],
|
|
26657
|
+
gray: [90, 39], // Alias of `blackBright`
|
|
26658
|
+
grey: [90, 39], // Alias of `blackBright`
|
|
26659
|
+
redBright: [91, 39],
|
|
26660
|
+
greenBright: [92, 39],
|
|
26661
|
+
yellowBright: [93, 39],
|
|
26662
|
+
blueBright: [94, 39],
|
|
26663
|
+
magentaBright: [95, 39],
|
|
26664
|
+
cyanBright: [96, 39],
|
|
26665
|
+
whiteBright: [97, 39],
|
|
26666
|
+
},
|
|
26667
|
+
bgColor: {
|
|
26668
|
+
bgBlack: [40, 49],
|
|
26669
|
+
bgRed: [41, 49],
|
|
26670
|
+
bgGreen: [42, 49],
|
|
26671
|
+
bgYellow: [43, 49],
|
|
26672
|
+
bgBlue: [44, 49],
|
|
26673
|
+
bgMagenta: [45, 49],
|
|
26674
|
+
bgCyan: [46, 49],
|
|
26675
|
+
bgWhite: [47, 49],
|
|
26676
|
+
|
|
26677
|
+
// Bright color
|
|
26678
|
+
bgBlackBright: [100, 49],
|
|
26679
|
+
bgGray: [100, 49], // Alias of `bgBlackBright`
|
|
26680
|
+
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
|
26681
|
+
bgRedBright: [101, 49],
|
|
26682
|
+
bgGreenBright: [102, 49],
|
|
26683
|
+
bgYellowBright: [103, 49],
|
|
26684
|
+
bgBlueBright: [104, 49],
|
|
26685
|
+
bgMagentaBright: [105, 49],
|
|
26686
|
+
bgCyanBright: [106, 49],
|
|
26687
|
+
bgWhiteBright: [107, 49],
|
|
26688
|
+
},
|
|
26689
|
+
};
|
|
26690
|
+
|
|
26691
|
+
Object.keys(styles$1.modifier);
|
|
26692
|
+
const foregroundColorNames = Object.keys(styles$1.color);
|
|
26693
|
+
const backgroundColorNames = Object.keys(styles$1.bgColor);
|
|
26694
|
+
[...foregroundColorNames, ...backgroundColorNames];
|
|
26695
|
+
|
|
26696
|
+
function assembleStyles() {
|
|
26697
|
+
const codes = new Map();
|
|
26698
|
+
|
|
26699
|
+
for (const [groupName, group] of Object.entries(styles$1)) {
|
|
26700
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
26701
|
+
styles$1[styleName] = {
|
|
26702
|
+
open: `\u001B[${style[0]}m`,
|
|
26703
|
+
close: `\u001B[${style[1]}m`,
|
|
26704
|
+
};
|
|
26705
|
+
|
|
26706
|
+
group[styleName] = styles$1[styleName];
|
|
26707
|
+
|
|
26708
|
+
codes.set(style[0], style[1]);
|
|
26709
|
+
}
|
|
26710
|
+
|
|
26711
|
+
Object.defineProperty(styles$1, groupName, {
|
|
26712
|
+
value: group,
|
|
26713
|
+
enumerable: false,
|
|
26714
|
+
});
|
|
26715
|
+
}
|
|
26716
|
+
|
|
26717
|
+
Object.defineProperty(styles$1, 'codes', {
|
|
26718
|
+
value: codes,
|
|
26719
|
+
enumerable: false,
|
|
26720
|
+
});
|
|
26721
|
+
|
|
26722
|
+
styles$1.color.close = '\u001B[39m';
|
|
26723
|
+
styles$1.bgColor.close = '\u001B[49m';
|
|
26724
|
+
|
|
26725
|
+
styles$1.color.ansi = wrapAnsi16();
|
|
26726
|
+
styles$1.color.ansi256 = wrapAnsi256();
|
|
26727
|
+
styles$1.color.ansi16m = wrapAnsi16m();
|
|
26728
|
+
styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
26729
|
+
styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
26730
|
+
styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
26731
|
+
|
|
26732
|
+
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
|
26733
|
+
Object.defineProperties(styles$1, {
|
|
26734
|
+
rgbToAnsi256: {
|
|
26735
|
+
value(red, green, blue) {
|
|
26736
|
+
// We use the extended greyscale palette here, with the exception of
|
|
26737
|
+
// black and white. normal palette only has 4 greyscale shades.
|
|
26738
|
+
if (red === green && green === blue) {
|
|
26739
|
+
if (red < 8) {
|
|
26740
|
+
return 16;
|
|
26741
|
+
}
|
|
26742
|
+
|
|
26743
|
+
if (red > 248) {
|
|
26744
|
+
return 231;
|
|
26745
|
+
}
|
|
26746
|
+
|
|
26747
|
+
return Math.round(((red - 8) / 247) * 24) + 232;
|
|
26748
|
+
}
|
|
26749
|
+
|
|
26750
|
+
return 16
|
|
26751
|
+
+ (36 * Math.round(red / 255 * 5))
|
|
26752
|
+
+ (6 * Math.round(green / 255 * 5))
|
|
26753
|
+
+ Math.round(blue / 255 * 5);
|
|
26754
|
+
},
|
|
26755
|
+
enumerable: false,
|
|
26756
|
+
},
|
|
26757
|
+
hexToRgb: {
|
|
26758
|
+
value(hex) {
|
|
26759
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
26760
|
+
if (!matches) {
|
|
26761
|
+
return [0, 0, 0];
|
|
26762
|
+
}
|
|
26763
|
+
|
|
26764
|
+
let [colorString] = matches;
|
|
26765
|
+
|
|
26766
|
+
if (colorString.length === 3) {
|
|
26767
|
+
colorString = [...colorString].map(character => character + character).join('');
|
|
26768
|
+
}
|
|
26769
|
+
|
|
26770
|
+
const integer = Number.parseInt(colorString, 16);
|
|
26771
|
+
|
|
26772
|
+
return [
|
|
26773
|
+
/* eslint-disable no-bitwise */
|
|
26774
|
+
(integer >> 16) & 0xFF,
|
|
26775
|
+
(integer >> 8) & 0xFF,
|
|
26776
|
+
integer & 0xFF,
|
|
26777
|
+
/* eslint-enable no-bitwise */
|
|
26778
|
+
];
|
|
26779
|
+
},
|
|
26780
|
+
enumerable: false,
|
|
26781
|
+
},
|
|
26782
|
+
hexToAnsi256: {
|
|
26783
|
+
value: hex => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
|
|
26784
|
+
enumerable: false,
|
|
26785
|
+
},
|
|
26786
|
+
ansi256ToAnsi: {
|
|
26787
|
+
value(code) {
|
|
26788
|
+
if (code < 8) {
|
|
26789
|
+
return 30 + code;
|
|
26790
|
+
}
|
|
26791
|
+
|
|
26792
|
+
if (code < 16) {
|
|
26793
|
+
return 90 + (code - 8);
|
|
26794
|
+
}
|
|
26795
|
+
|
|
26796
|
+
let red;
|
|
26797
|
+
let green;
|
|
26798
|
+
let blue;
|
|
26799
|
+
|
|
26800
|
+
if (code >= 232) {
|
|
26801
|
+
red = (((code - 232) * 10) + 8) / 255;
|
|
26802
|
+
green = red;
|
|
26803
|
+
blue = red;
|
|
26804
|
+
} else {
|
|
26805
|
+
code -= 16;
|
|
26806
|
+
|
|
26807
|
+
const remainder = code % 36;
|
|
26808
|
+
|
|
26809
|
+
red = Math.floor(code / 36) / 5;
|
|
26810
|
+
green = Math.floor(remainder / 6) / 5;
|
|
26811
|
+
blue = (remainder % 6) / 5;
|
|
26812
|
+
}
|
|
26813
|
+
|
|
26814
|
+
const value = Math.max(red, green, blue) * 2;
|
|
26815
|
+
|
|
26816
|
+
if (value === 0) {
|
|
26817
|
+
return 30;
|
|
26818
|
+
}
|
|
26819
|
+
|
|
26820
|
+
// eslint-disable-next-line no-bitwise
|
|
26821
|
+
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
|
26822
|
+
|
|
26823
|
+
if (value === 2) {
|
|
26824
|
+
result += 60;
|
|
26825
|
+
}
|
|
26826
|
+
|
|
26827
|
+
return result;
|
|
26828
|
+
},
|
|
26829
|
+
enumerable: false,
|
|
26830
|
+
},
|
|
26831
|
+
rgbToAnsi: {
|
|
26832
|
+
value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
|
|
26833
|
+
enumerable: false,
|
|
26834
|
+
},
|
|
26835
|
+
hexToAnsi: {
|
|
26836
|
+
value: hex => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
|
|
26837
|
+
enumerable: false,
|
|
26838
|
+
},
|
|
26839
|
+
});
|
|
26840
|
+
|
|
26841
|
+
return styles$1;
|
|
26842
|
+
}
|
|
26843
|
+
|
|
26844
|
+
const ansiStyles = assembleStyles();
|
|
26845
|
+
|
|
26846
|
+
/* eslint-env browser */
|
|
26847
|
+
|
|
26848
|
+
const level = (() => {
|
|
26849
|
+
if (globalThis?.navigator?.userAgentData) {
|
|
26850
|
+
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
|
|
26851
|
+
if (brand && brand.version > 93) {
|
|
26852
|
+
return 3;
|
|
26853
|
+
}
|
|
26854
|
+
}
|
|
26855
|
+
|
|
26856
|
+
if (/\b(Chrome|Chromium)\//.test(globalThis?.navigator?.userAgent)) {
|
|
26857
|
+
return 1;
|
|
26858
|
+
}
|
|
26859
|
+
|
|
26860
|
+
return 0;
|
|
26861
|
+
})();
|
|
26862
|
+
|
|
26863
|
+
const colorSupport = level !== 0 && {
|
|
26864
|
+
level,
|
|
26865
|
+
hasBasic: true,
|
|
26866
|
+
has256: level >= 2,
|
|
26867
|
+
has16m: level >= 3,
|
|
26868
|
+
};
|
|
26869
|
+
|
|
26870
|
+
const supportsColor = {
|
|
26871
|
+
stdout: colorSupport,
|
|
26872
|
+
stderr: colorSupport,
|
|
26873
|
+
};
|
|
26874
|
+
|
|
26875
|
+
// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.
|
|
26876
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
26877
|
+
let index = string.indexOf(substring);
|
|
26878
|
+
if (index === -1) {
|
|
26879
|
+
return string;
|
|
26880
|
+
}
|
|
26881
|
+
|
|
26882
|
+
const substringLength = substring.length;
|
|
26883
|
+
let endIndex = 0;
|
|
26884
|
+
let returnValue = '';
|
|
26885
|
+
do {
|
|
26886
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
26887
|
+
endIndex = index + substringLength;
|
|
26888
|
+
index = string.indexOf(substring, endIndex);
|
|
26889
|
+
} while (index !== -1);
|
|
26890
|
+
|
|
26891
|
+
returnValue += string.slice(endIndex);
|
|
26892
|
+
return returnValue;
|
|
26893
|
+
}
|
|
26894
|
+
|
|
26895
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
26896
|
+
let endIndex = 0;
|
|
26897
|
+
let returnValue = '';
|
|
26898
|
+
do {
|
|
26899
|
+
const gotCR = string[index - 1] === '\r';
|
|
26900
|
+
returnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
|
26901
|
+
endIndex = index + 1;
|
|
26902
|
+
index = string.indexOf('\n', endIndex);
|
|
26903
|
+
} while (index !== -1);
|
|
26904
|
+
|
|
26905
|
+
returnValue += string.slice(endIndex);
|
|
26906
|
+
return returnValue;
|
|
26907
|
+
}
|
|
26908
|
+
|
|
26909
|
+
const {stdout: stdoutColor, stderr: stderrColor} = supportsColor;
|
|
26910
|
+
|
|
26911
|
+
const GENERATOR = Symbol('GENERATOR');
|
|
26912
|
+
const STYLER = Symbol('STYLER');
|
|
26913
|
+
const IS_EMPTY = Symbol('IS_EMPTY');
|
|
26914
|
+
|
|
26915
|
+
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
|
26916
|
+
const levelMapping = [
|
|
26917
|
+
'ansi',
|
|
26918
|
+
'ansi',
|
|
26919
|
+
'ansi256',
|
|
26920
|
+
'ansi16m',
|
|
26921
|
+
];
|
|
26922
|
+
|
|
26923
|
+
const styles = Object.create(null);
|
|
26924
|
+
|
|
26925
|
+
const applyOptions = (object, options = {}) => {
|
|
26926
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
26927
|
+
throw new Error('The `level` option should be an integer from 0 to 3');
|
|
26928
|
+
}
|
|
26929
|
+
|
|
26930
|
+
// Detect level if not set manually
|
|
26931
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
26932
|
+
object.level = options.level === undefined ? colorLevel : options.level;
|
|
26933
|
+
};
|
|
26934
|
+
|
|
26935
|
+
class Chalk {
|
|
26936
|
+
constructor(options) {
|
|
26937
|
+
// eslint-disable-next-line no-constructor-return
|
|
26938
|
+
return chalkFactory(options);
|
|
26939
|
+
}
|
|
26940
|
+
}
|
|
26941
|
+
|
|
26942
|
+
const chalkFactory = options => {
|
|
26943
|
+
const chalk = (...strings) => strings.join(' ');
|
|
26944
|
+
applyOptions(chalk, options);
|
|
26945
|
+
|
|
26946
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
26947
|
+
|
|
26948
|
+
return chalk;
|
|
26949
|
+
};
|
|
26950
|
+
|
|
26951
|
+
function createChalk(options) {
|
|
26952
|
+
return chalkFactory(options);
|
|
26953
|
+
}
|
|
26954
|
+
|
|
26955
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
26956
|
+
|
|
26957
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
26958
|
+
styles[styleName] = {
|
|
26959
|
+
get() {
|
|
26960
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
26961
|
+
Object.defineProperty(this, styleName, {value: builder});
|
|
26962
|
+
return builder;
|
|
26963
|
+
},
|
|
26964
|
+
};
|
|
26965
|
+
}
|
|
26966
|
+
|
|
26967
|
+
styles.visible = {
|
|
26968
|
+
get() {
|
|
26969
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
26970
|
+
Object.defineProperty(this, 'visible', {value: builder});
|
|
26971
|
+
return builder;
|
|
26972
|
+
},
|
|
26973
|
+
};
|
|
26974
|
+
|
|
26975
|
+
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
26976
|
+
if (model === 'rgb') {
|
|
26977
|
+
if (level === 'ansi16m') {
|
|
26978
|
+
return ansiStyles[type].ansi16m(...arguments_);
|
|
26979
|
+
}
|
|
26980
|
+
|
|
26981
|
+
if (level === 'ansi256') {
|
|
26982
|
+
return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
|
|
26983
|
+
}
|
|
26984
|
+
|
|
26985
|
+
return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
|
|
26986
|
+
}
|
|
26987
|
+
|
|
26988
|
+
if (model === 'hex') {
|
|
26989
|
+
return getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));
|
|
26990
|
+
}
|
|
26991
|
+
|
|
26992
|
+
return ansiStyles[type][model](...arguments_);
|
|
26993
|
+
};
|
|
26994
|
+
|
|
26995
|
+
const usedModels = ['rgb', 'hex', 'ansi256'];
|
|
26996
|
+
|
|
26997
|
+
for (const model of usedModels) {
|
|
26998
|
+
styles[model] = {
|
|
26999
|
+
get() {
|
|
27000
|
+
const {level} = this;
|
|
27001
|
+
return function (...arguments_) {
|
|
27002
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);
|
|
27003
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
27004
|
+
};
|
|
27005
|
+
},
|
|
27006
|
+
};
|
|
27007
|
+
|
|
27008
|
+
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
|
27009
|
+
styles[bgModel] = {
|
|
27010
|
+
get() {
|
|
27011
|
+
const {level} = this;
|
|
27012
|
+
return function (...arguments_) {
|
|
27013
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
|
|
27014
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
27015
|
+
};
|
|
27016
|
+
},
|
|
27017
|
+
};
|
|
27018
|
+
}
|
|
27019
|
+
|
|
27020
|
+
const proto = Object.defineProperties(() => {}, {
|
|
27021
|
+
...styles,
|
|
27022
|
+
level: {
|
|
27023
|
+
enumerable: true,
|
|
27024
|
+
get() {
|
|
27025
|
+
return this[GENERATOR].level;
|
|
27026
|
+
},
|
|
27027
|
+
set(level) {
|
|
27028
|
+
this[GENERATOR].level = level;
|
|
27029
|
+
},
|
|
27030
|
+
},
|
|
27031
|
+
});
|
|
27032
|
+
|
|
27033
|
+
const createStyler = (open, close, parent) => {
|
|
27034
|
+
let openAll;
|
|
27035
|
+
let closeAll;
|
|
27036
|
+
if (parent === undefined) {
|
|
27037
|
+
openAll = open;
|
|
27038
|
+
closeAll = close;
|
|
27039
|
+
} else {
|
|
27040
|
+
openAll = parent.openAll + open;
|
|
27041
|
+
closeAll = close + parent.closeAll;
|
|
27042
|
+
}
|
|
27043
|
+
|
|
27044
|
+
return {
|
|
27045
|
+
open,
|
|
27046
|
+
close,
|
|
27047
|
+
openAll,
|
|
27048
|
+
closeAll,
|
|
27049
|
+
parent,
|
|
27050
|
+
};
|
|
27051
|
+
};
|
|
27052
|
+
|
|
27053
|
+
const createBuilder = (self, _styler, _isEmpty) => {
|
|
27054
|
+
// Single argument is hot path, implicit coercion is faster than anything
|
|
27055
|
+
// eslint-disable-next-line no-implicit-coercion
|
|
27056
|
+
const builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
|
27057
|
+
|
|
27058
|
+
// We alter the prototype because we must return a function, but there is
|
|
27059
|
+
// no way to create a function with a different prototype
|
|
27060
|
+
Object.setPrototypeOf(builder, proto);
|
|
27061
|
+
|
|
27062
|
+
builder[GENERATOR] = self;
|
|
27063
|
+
builder[STYLER] = _styler;
|
|
27064
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
27065
|
+
|
|
27066
|
+
return builder;
|
|
27067
|
+
};
|
|
27068
|
+
|
|
27069
|
+
const applyStyle = (self, string) => {
|
|
27070
|
+
if (self.level <= 0 || !string) {
|
|
27071
|
+
return self[IS_EMPTY] ? '' : string;
|
|
27072
|
+
}
|
|
27073
|
+
|
|
27074
|
+
let styler = self[STYLER];
|
|
27075
|
+
|
|
27076
|
+
if (styler === undefined) {
|
|
27077
|
+
return string;
|
|
27078
|
+
}
|
|
27079
|
+
|
|
27080
|
+
const {openAll, closeAll} = styler;
|
|
27081
|
+
if (string.includes('\u001B')) {
|
|
27082
|
+
while (styler !== undefined) {
|
|
27083
|
+
// Replace any instances already present with a re-opening code
|
|
27084
|
+
// otherwise only the part of the string until said closing code
|
|
27085
|
+
// will be colored, and the rest will simply be 'plain'.
|
|
27086
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
27087
|
+
|
|
27088
|
+
styler = styler.parent;
|
|
27089
|
+
}
|
|
27090
|
+
}
|
|
27091
|
+
|
|
27092
|
+
// We can move both next actions out of loop, because remaining actions in loop won't have
|
|
27093
|
+
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
|
27094
|
+
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
|
27095
|
+
const lfIndex = string.indexOf('\n');
|
|
27096
|
+
if (lfIndex !== -1) {
|
|
27097
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
27098
|
+
}
|
|
27099
|
+
|
|
27100
|
+
return openAll + string + closeAll;
|
|
27101
|
+
};
|
|
27102
|
+
|
|
27103
|
+
Object.defineProperties(createChalk.prototype, styles);
|
|
27104
|
+
|
|
27105
|
+
const chalk = createChalk();
|
|
27106
|
+
createChalk({level: stderrColor ? stderrColor.level : 0});
|
|
27107
|
+
|
|
27108
|
+
var chalk$1 = chalk;
|
|
27109
|
+
|
|
26606
27110
|
let chalkWithForcedColor = undefined;
|
|
26607
27111
|
function getChalk(forceColor) {
|
|
26608
27112
|
if (forceColor) {
|
|
@@ -33995,7 +34499,7 @@ var common = setup$1;
|
|
|
33995
34499
|
}
|
|
33996
34500
|
|
|
33997
34501
|
// Internet Explorer and Edge do not support colors.
|
|
33998
|
-
if (typeof navigator !== 'undefined' && navigator
|
|
34502
|
+
if (typeof navigator !== 'undefined' && globalThis?.navigator?.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
33999
34503
|
return false;
|
|
34000
34504
|
}
|
|
34001
34505
|
|
|
@@ -34006,9 +34510,9 @@ var common = setup$1;
|
|
|
34006
34510
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
34007
34511
|
// Is firefox >= v31?
|
|
34008
34512
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
34009
|
-
(typeof navigator !== 'undefined' && navigator
|
|
34513
|
+
(typeof navigator !== 'undefined' && globalThis?.navigator?.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
34010
34514
|
// Double check webkit in userAgent just in case we are in a worker
|
|
34011
|
-
(typeof navigator !== 'undefined' && navigator
|
|
34515
|
+
(typeof navigator !== 'undefined' && globalThis?.navigator?.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
34012
34516
|
}
|
|
34013
34517
|
|
|
34014
34518
|
/**
|