chlklib 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +199 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +182 -0
- package/dist/index.js.map +7 -0
- package/dist/vendor/ansi-styles/index.cjs +211 -0
- package/dist/vendor/ansi-styles/index.cjs.map +7 -0
- package/dist/vendor/ansi-styles/index.js +192 -0
- package/dist/vendor/ansi-styles/index.js.map +7 -0
- package/dist/vendor/supports-color/browser.cjs +49 -0
- package/dist/vendor/supports-color/browser.cjs.map +7 -0
- package/dist/vendor/supports-color/browser.js +30 -0
- package/dist/vendor/supports-color/browser.js.map +7 -0
- package/dist/vendor/supports-color/index.cjs +164 -0
- package/dist/vendor/supports-color/index.cjs.map +7 -0
- package/dist/vendor/supports-color/index.js +135 -0
- package/dist/vendor/supports-color/index.js.map +7 -0
- package/package.json +11 -11
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var index_exports = {};
|
|
29
|
+
__export(index_exports, {
|
|
30
|
+
Chalk: () => Chalk,
|
|
31
|
+
backgroundColorNames: () => import_ansi_styles2.backgroundColorNames,
|
|
32
|
+
backgroundColors: () => import_ansi_styles2.backgroundColorNames,
|
|
33
|
+
chalkStderr: () => chalkStderr,
|
|
34
|
+
colorNames: () => import_ansi_styles2.colorNames,
|
|
35
|
+
colors: () => import_ansi_styles2.colorNames,
|
|
36
|
+
default: () => index_default,
|
|
37
|
+
foregroundColorNames: () => import_ansi_styles2.foregroundColorNames,
|
|
38
|
+
foregroundColors: () => import_ansi_styles2.foregroundColorNames,
|
|
39
|
+
modifierNames: () => import_ansi_styles2.modifierNames,
|
|
40
|
+
modifiers: () => import_ansi_styles2.modifierNames,
|
|
41
|
+
supportsColor: () => stdoutColor,
|
|
42
|
+
supportsColorStderr: () => stderrColor
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(index_exports);
|
|
45
|
+
var import_ansi_styles = __toESM(require("#ansi-styles"), 1);
|
|
46
|
+
var import_supports_color = __toESM(require("#supports-color"), 1);
|
|
47
|
+
var import_utilities = require("./utilities.js");
|
|
48
|
+
var import_ansi_styles2 = require("./vendor/ansi-styles/index.js");
|
|
49
|
+
const { stdout: stdoutColor, stderr: stderrColor } = import_supports_color.default;
|
|
50
|
+
const GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
51
|
+
const STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
52
|
+
const IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
53
|
+
const levelMapping = [
|
|
54
|
+
"ansi",
|
|
55
|
+
"ansi",
|
|
56
|
+
"ansi256",
|
|
57
|
+
"ansi16m"
|
|
58
|
+
];
|
|
59
|
+
const styles = /* @__PURE__ */ Object.create(null);
|
|
60
|
+
const applyOptions = (object, options = {}) => {
|
|
61
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
62
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
63
|
+
}
|
|
64
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
65
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
66
|
+
};
|
|
67
|
+
class Chalk {
|
|
68
|
+
constructor(options) {
|
|
69
|
+
return chalkFactory(options);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const chalkFactory = (options) => {
|
|
73
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
74
|
+
applyOptions(chalk2, options);
|
|
75
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
76
|
+
return chalk2;
|
|
77
|
+
};
|
|
78
|
+
function createChalk(options) {
|
|
79
|
+
return chalkFactory(options);
|
|
80
|
+
}
|
|
81
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
82
|
+
for (const [styleName, style] of Object.entries(import_ansi_styles.default)) {
|
|
83
|
+
styles[styleName] = {
|
|
84
|
+
get() {
|
|
85
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
86
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
87
|
+
return builder;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
styles.visible = {
|
|
92
|
+
get() {
|
|
93
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
94
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
95
|
+
return builder;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
99
|
+
if (model === "rgb") {
|
|
100
|
+
if (level === "ansi16m") {
|
|
101
|
+
return import_ansi_styles.default[type].ansi16m(...arguments_);
|
|
102
|
+
}
|
|
103
|
+
if (level === "ansi256") {
|
|
104
|
+
return import_ansi_styles.default[type].ansi256(import_ansi_styles.default.rgbToAnsi256(...arguments_));
|
|
105
|
+
}
|
|
106
|
+
return import_ansi_styles.default[type].ansi(import_ansi_styles.default.rgbToAnsi(...arguments_));
|
|
107
|
+
}
|
|
108
|
+
if (model === "hex") {
|
|
109
|
+
return getModelAnsi("rgb", level, type, ...import_ansi_styles.default.hexToRgb(...arguments_));
|
|
110
|
+
}
|
|
111
|
+
return import_ansi_styles.default[type][model](...arguments_);
|
|
112
|
+
};
|
|
113
|
+
const usedModels = ["rgb", "hex", "ansi256"];
|
|
114
|
+
for (const model of usedModels) {
|
|
115
|
+
styles[model] = {
|
|
116
|
+
get() {
|
|
117
|
+
const { level } = this;
|
|
118
|
+
return function(...arguments_) {
|
|
119
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), import_ansi_styles.default.color.close, this[STYLER]);
|
|
120
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
125
|
+
styles[bgModel] = {
|
|
126
|
+
get() {
|
|
127
|
+
const { level } = this;
|
|
128
|
+
return function(...arguments_) {
|
|
129
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), import_ansi_styles.default.bgColor.close, this[STYLER]);
|
|
130
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const proto = Object.defineProperties(() => {
|
|
136
|
+
}, {
|
|
137
|
+
...styles,
|
|
138
|
+
level: {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get() {
|
|
141
|
+
return this[GENERATOR].level;
|
|
142
|
+
},
|
|
143
|
+
set(level) {
|
|
144
|
+
this[GENERATOR].level = level;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
const createStyler = (open, close, parent) => {
|
|
149
|
+
let openAll;
|
|
150
|
+
let closeAll;
|
|
151
|
+
if (parent === void 0) {
|
|
152
|
+
openAll = open;
|
|
153
|
+
closeAll = close;
|
|
154
|
+
} else {
|
|
155
|
+
openAll = parent.openAll + open;
|
|
156
|
+
closeAll = close + parent.closeAll;
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
open,
|
|
160
|
+
close,
|
|
161
|
+
openAll,
|
|
162
|
+
closeAll,
|
|
163
|
+
parent
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
const createBuilder = (self, _styler, _isEmpty) => {
|
|
167
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
168
|
+
Object.setPrototypeOf(builder, proto);
|
|
169
|
+
builder[GENERATOR] = self;
|
|
170
|
+
builder[STYLER] = _styler;
|
|
171
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
172
|
+
return builder;
|
|
173
|
+
};
|
|
174
|
+
const applyStyle = (self, string) => {
|
|
175
|
+
if (self.level <= 0 || !string) {
|
|
176
|
+
return self[IS_EMPTY] ? "" : string;
|
|
177
|
+
}
|
|
178
|
+
let styler = self[STYLER];
|
|
179
|
+
if (styler === void 0) {
|
|
180
|
+
return string;
|
|
181
|
+
}
|
|
182
|
+
const { openAll, closeAll } = styler;
|
|
183
|
+
if (string.includes("\x1B")) {
|
|
184
|
+
while (styler !== void 0) {
|
|
185
|
+
string = (0, import_utilities.stringReplaceAll)(string, styler.close, styler.open);
|
|
186
|
+
styler = styler.parent;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const lfIndex = string.indexOf("\n");
|
|
190
|
+
if (lfIndex !== -1) {
|
|
191
|
+
string = (0, import_utilities.stringEncaseCRLFWithFirstIndex)(string, closeAll, openAll, lfIndex);
|
|
192
|
+
}
|
|
193
|
+
return openAll + string + closeAll;
|
|
194
|
+
};
|
|
195
|
+
Object.defineProperties(createChalk.prototype, styles);
|
|
196
|
+
const chalk = createChalk();
|
|
197
|
+
const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
198
|
+
var index_default = chalk;
|
|
199
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../source/index.js"],
|
|
4
|
+
"sourcesContent": ["import ansiStyles from '#ansi-styles';\nimport supportsColor from '#supports-color';\nimport { // eslint-disable-line import/order\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex,\n} from './utilities.js';\n\nconst {stdout: stdoutColor, stderr: stderrColor} = supportsColor;\n\nconst GENERATOR = Symbol('GENERATOR');\nconst STYLER = Symbol('STYLER');\nconst IS_EMPTY = Symbol('IS_EMPTY');\n\n// `supportsColor.level` \u2192 `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m',\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nexport class Chalk {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = (...strings) => strings.join(' ');\n\tapplyOptions(chalk, options);\n\n\tObject.setPrototypeOf(chalk, createChalk.prototype);\n\n\treturn chalk;\n};\n\nfunction createChalk(options) {\n\treturn chalkFactory(options);\n}\n\nObject.setPrototypeOf(createChalk.prototype, Function.prototype);\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t},\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this[STYLER], true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t},\n};\n\nconst getModelAnsi = (model, level, type, ...arguments_) => {\n\tif (model === 'rgb') {\n\t\tif (level === 'ansi16m') {\n\t\t\treturn ansiStyles[type].ansi16m(...arguments_);\n\t\t}\n\n\t\tif (level === 'ansi256') {\n\t\t\treturn ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));\n\t\t}\n\n\t\treturn ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));\n\t}\n\n\tif (model === 'hex') {\n\t\treturn getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));\n\t}\n\n\treturn ansiStyles[type][model](...arguments_);\n};\n\nconst usedModels = ['rgb', 'hex', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this[GENERATOR].level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis[GENERATOR].level = level;\n\t\t},\n\t},\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent,\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\t// Single argument is hot path, implicit coercion is faster than anything\n\t// eslint-disable-next-line no-implicit-coercion\n\tconst builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder[GENERATOR] = self;\n\tbuilder[STYLER] = _styler;\n\tbuilder[IS_EMPTY] = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self[IS_EMPTY] ? '' : string;\n\t}\n\n\tlet styler = self[STYLER];\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.includes('\\u001B')) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nObject.defineProperties(createChalk.prototype, styles);\n\nconst chalk = createChalk();\nexport const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});\n\nexport {\n\tmodifierNames,\n\tforegroundColorNames,\n\tbackgroundColorNames,\n\tcolorNames,\n\n\t// TODO: Remove these aliases in the next major version\n\tmodifierNames as modifiers,\n\tforegroundColorNames as foregroundColors,\n\tbackgroundColorNames as backgroundColors,\n\tcolorNames as colors,\n} from './vendor/ansi-styles/index.js';\n\nexport {\n\tstdoutColor as supportsColor,\n\tstderrColor as supportsColorStderr,\n};\n\nexport default chalk;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAuB;AACvB,4BAA0B;AAC1B,uBAGO;AAyMP,IAAAA,sBAWO;AAlNP,MAAM,EAAC,QAAQ,aAAa,QAAQ,YAAW,IAAI,sBAAAC;AAEnD,MAAM,YAAY,uBAAO,WAAW;AACpC,MAAM,SAAS,uBAAO,QAAQ;AAC9B,MAAM,WAAW,uBAAO,UAAU;AAGlC,MAAM,eAAe;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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AKA,QAAM,UAAU,OAAO,QAAQ,IAAI;AACnC,MAAI,YAAY,IAAI;AACnB,iBAAS,iDAA+B,QAAQ,UAAU,SAAS,OAAO;AAAA,EAC3E;AAEA,SAAO,UAAU,SAAS;AAC3B;AAEA,OAAO,iBAAiB,YAAY,WAAW,MAAM;AAErD,MAAM,QAAQ,YAAY;AACnB,MAAM,cAAc,YAAY,EAAC,OAAO,cAAc,YAAY,QAAQ,EAAC,CAAC;AAoBnF,IAAO,gBAAQ;",
|
|
6
|
+
"names": ["import_ansi_styles", "supportsColor", "chalk", "ansiStyles"]
|
|
7
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import ansiStyles from "#ansi-styles";
|
|
2
|
+
import supportsColor from "#supports-color";
|
|
3
|
+
import {
|
|
4
|
+
stringReplaceAll,
|
|
5
|
+
stringEncaseCRLFWithFirstIndex
|
|
6
|
+
} from "./utilities.js";
|
|
7
|
+
const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
|
|
8
|
+
const GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
9
|
+
const STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
10
|
+
const IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
11
|
+
const levelMapping = [
|
|
12
|
+
"ansi",
|
|
13
|
+
"ansi",
|
|
14
|
+
"ansi256",
|
|
15
|
+
"ansi16m"
|
|
16
|
+
];
|
|
17
|
+
const styles = /* @__PURE__ */ Object.create(null);
|
|
18
|
+
const applyOptions = (object, options = {}) => {
|
|
19
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
20
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
21
|
+
}
|
|
22
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
23
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
24
|
+
};
|
|
25
|
+
class Chalk {
|
|
26
|
+
constructor(options) {
|
|
27
|
+
return chalkFactory(options);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const chalkFactory = (options) => {
|
|
31
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
32
|
+
applyOptions(chalk2, options);
|
|
33
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
34
|
+
return chalk2;
|
|
35
|
+
};
|
|
36
|
+
function createChalk(options) {
|
|
37
|
+
return chalkFactory(options);
|
|
38
|
+
}
|
|
39
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
40
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
41
|
+
styles[styleName] = {
|
|
42
|
+
get() {
|
|
43
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
44
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
45
|
+
return builder;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
styles.visible = {
|
|
50
|
+
get() {
|
|
51
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
52
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
53
|
+
return builder;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
57
|
+
if (model === "rgb") {
|
|
58
|
+
if (level === "ansi16m") {
|
|
59
|
+
return ansiStyles[type].ansi16m(...arguments_);
|
|
60
|
+
}
|
|
61
|
+
if (level === "ansi256") {
|
|
62
|
+
return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
|
|
63
|
+
}
|
|
64
|
+
return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
|
|
65
|
+
}
|
|
66
|
+
if (model === "hex") {
|
|
67
|
+
return getModelAnsi("rgb", level, type, ...ansiStyles.hexToRgb(...arguments_));
|
|
68
|
+
}
|
|
69
|
+
return ansiStyles[type][model](...arguments_);
|
|
70
|
+
};
|
|
71
|
+
const usedModels = ["rgb", "hex", "ansi256"];
|
|
72
|
+
for (const model of usedModels) {
|
|
73
|
+
styles[model] = {
|
|
74
|
+
get() {
|
|
75
|
+
const { level } = this;
|
|
76
|
+
return function(...arguments_) {
|
|
77
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansiStyles.color.close, this[STYLER]);
|
|
78
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
83
|
+
styles[bgModel] = {
|
|
84
|
+
get() {
|
|
85
|
+
const { level } = this;
|
|
86
|
+
return function(...arguments_) {
|
|
87
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
|
|
88
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const proto = Object.defineProperties(() => {
|
|
94
|
+
}, {
|
|
95
|
+
...styles,
|
|
96
|
+
level: {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get() {
|
|
99
|
+
return this[GENERATOR].level;
|
|
100
|
+
},
|
|
101
|
+
set(level) {
|
|
102
|
+
this[GENERATOR].level = level;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
const createStyler = (open, close, parent) => {
|
|
107
|
+
let openAll;
|
|
108
|
+
let closeAll;
|
|
109
|
+
if (parent === void 0) {
|
|
110
|
+
openAll = open;
|
|
111
|
+
closeAll = close;
|
|
112
|
+
} else {
|
|
113
|
+
openAll = parent.openAll + open;
|
|
114
|
+
closeAll = close + parent.closeAll;
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
open,
|
|
118
|
+
close,
|
|
119
|
+
openAll,
|
|
120
|
+
closeAll,
|
|
121
|
+
parent
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const createBuilder = (self, _styler, _isEmpty) => {
|
|
125
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
126
|
+
Object.setPrototypeOf(builder, proto);
|
|
127
|
+
builder[GENERATOR] = self;
|
|
128
|
+
builder[STYLER] = _styler;
|
|
129
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
130
|
+
return builder;
|
|
131
|
+
};
|
|
132
|
+
const applyStyle = (self, string) => {
|
|
133
|
+
if (self.level <= 0 || !string) {
|
|
134
|
+
return self[IS_EMPTY] ? "" : string;
|
|
135
|
+
}
|
|
136
|
+
let styler = self[STYLER];
|
|
137
|
+
if (styler === void 0) {
|
|
138
|
+
return string;
|
|
139
|
+
}
|
|
140
|
+
const { openAll, closeAll } = styler;
|
|
141
|
+
if (string.includes("\x1B")) {
|
|
142
|
+
while (styler !== void 0) {
|
|
143
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
144
|
+
styler = styler.parent;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const lfIndex = string.indexOf("\n");
|
|
148
|
+
if (lfIndex !== -1) {
|
|
149
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
150
|
+
}
|
|
151
|
+
return openAll + string + closeAll;
|
|
152
|
+
};
|
|
153
|
+
Object.defineProperties(createChalk.prototype, styles);
|
|
154
|
+
const chalk = createChalk();
|
|
155
|
+
const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
156
|
+
import {
|
|
157
|
+
modifierNames,
|
|
158
|
+
foregroundColorNames,
|
|
159
|
+
backgroundColorNames,
|
|
160
|
+
colorNames,
|
|
161
|
+
modifierNames as modifierNames2,
|
|
162
|
+
foregroundColorNames as foregroundColorNames2,
|
|
163
|
+
backgroundColorNames as backgroundColorNames2,
|
|
164
|
+
colorNames as colorNames2
|
|
165
|
+
} from "./vendor/ansi-styles/index.js";
|
|
166
|
+
var index_default = chalk;
|
|
167
|
+
export {
|
|
168
|
+
Chalk,
|
|
169
|
+
backgroundColorNames,
|
|
170
|
+
backgroundColorNames2 as backgroundColors,
|
|
171
|
+
chalkStderr,
|
|
172
|
+
colorNames,
|
|
173
|
+
colorNames2 as colors,
|
|
174
|
+
index_default as default,
|
|
175
|
+
foregroundColorNames,
|
|
176
|
+
foregroundColorNames2 as foregroundColors,
|
|
177
|
+
modifierNames,
|
|
178
|
+
modifierNames2 as modifiers,
|
|
179
|
+
stdoutColor as supportsColor,
|
|
180
|
+
stderrColor as supportsColorStderr
|
|
181
|
+
};
|
|
182
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../source/index.js"],
|
|
4
|
+
"sourcesContent": ["import ansiStyles from '#ansi-styles';\nimport supportsColor from '#supports-color';\nimport { // eslint-disable-line import/order\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex,\n} from './utilities.js';\n\nconst {stdout: stdoutColor, stderr: stderrColor} = supportsColor;\n\nconst GENERATOR = Symbol('GENERATOR');\nconst STYLER = Symbol('STYLER');\nconst IS_EMPTY = Symbol('IS_EMPTY');\n\n// `supportsColor.level` \u2192 `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m',\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nexport class Chalk {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = (...strings) => strings.join(' ');\n\tapplyOptions(chalk, options);\n\n\tObject.setPrototypeOf(chalk, createChalk.prototype);\n\n\treturn chalk;\n};\n\nfunction createChalk(options) {\n\treturn chalkFactory(options);\n}\n\nObject.setPrototypeOf(createChalk.prototype, Function.prototype);\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t},\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this[STYLER], true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t},\n};\n\nconst getModelAnsi = (model, level, type, ...arguments_) => {\n\tif (model === 'rgb') {\n\t\tif (level === 'ansi16m') {\n\t\t\treturn ansiStyles[type].ansi16m(...arguments_);\n\t\t}\n\n\t\tif (level === 'ansi256') {\n\t\t\treturn ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));\n\t\t}\n\n\t\treturn ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));\n\t}\n\n\tif (model === 'hex') {\n\t\treturn getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));\n\t}\n\n\treturn ansiStyles[type][model](...arguments_);\n};\n\nconst usedModels = ['rgb', 'hex', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this[GENERATOR].level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis[GENERATOR].level = level;\n\t\t},\n\t},\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent,\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\t// Single argument is hot path, implicit coercion is faster than anything\n\t// eslint-disable-next-line no-implicit-coercion\n\tconst builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder[GENERATOR] = self;\n\tbuilder[STYLER] = _styler;\n\tbuilder[IS_EMPTY] = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self[IS_EMPTY] ? '' : string;\n\t}\n\n\tlet styler = self[STYLER];\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.includes('\\u001B')) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nObject.defineProperties(createChalk.prototype, styles);\n\nconst chalk = createChalk();\nexport const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});\n\nexport {\n\tmodifierNames,\n\tforegroundColorNames,\n\tbackgroundColorNames,\n\tcolorNames,\n\n\t// TODO: Remove these aliases in the next major version\n\tmodifierNames as modifiers,\n\tforegroundColorNames as foregroundColors,\n\tbackgroundColorNames as backgroundColors,\n\tcolorNames as colors,\n} from './vendor/ansi-styles/index.js';\n\nexport {\n\tstdoutColor as supportsColor,\n\tstderrColor as supportsColorStderr,\n};\n\nexport default chalk;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,gBAAgB;AACvB,OAAO,mBAAmB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAEP,MAAM,EAAC,QAAQ,aAAa,QAAQ,YAAW,IAAI;AAEnD,MAAM,YAAY,uBAAO,WAAW;AACpC,MAAM,SAAS,uBAAO,QAAQ;AAC9B,MAAM,WAAW,uBAAO,UAAU;AAGlC,MAAM,eAAe;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,MAAM,SAAS,uBAAO,OAAO,IAAI;AAEjC,MAAM,eAAe,CAAC,QAAQ,UAAU,CAAC,MAAM;AAC9C,MAAI,QAAQ,SAAS,EAAE,OAAO,UAAU,QAAQ,KAAK,KAAK,QAAQ,SAAS,KAAK,QAAQ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AQ,EAAC,CAAC;AAEnF;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGiB,iBAAjBC;AAAA,EACwB,wBAAxBC;AAAA,EACwB,wBAAxBC;AAAA,EACc,cAAdC;AAAA,OACM;AAOP,IAAO,gBAAQ;",
|
|
6
|
+
"names": ["chalk", "modifierNames", "foregroundColorNames", "backgroundColorNames", "colorNames"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var ansi_styles_exports = {};
|
|
19
|
+
__export(ansi_styles_exports, {
|
|
20
|
+
backgroundColorNames: () => backgroundColorNames,
|
|
21
|
+
colorNames: () => colorNames,
|
|
22
|
+
default: () => ansi_styles_default,
|
|
23
|
+
foregroundColorNames: () => foregroundColorNames,
|
|
24
|
+
modifierNames: () => modifierNames
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(ansi_styles_exports);
|
|
27
|
+
const ANSI_BACKGROUND_OFFSET = 10;
|
|
28
|
+
const wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
29
|
+
const wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
30
|
+
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
31
|
+
const styles = {
|
|
32
|
+
modifier: {
|
|
33
|
+
reset: [0, 0],
|
|
34
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
35
|
+
bold: [1, 22],
|
|
36
|
+
dim: [2, 22],
|
|
37
|
+
italic: [3, 23],
|
|
38
|
+
underline: [4, 24],
|
|
39
|
+
overline: [53, 55],
|
|
40
|
+
inverse: [7, 27],
|
|
41
|
+
hidden: [8, 28],
|
|
42
|
+
strikethrough: [9, 29]
|
|
43
|
+
},
|
|
44
|
+
color: {
|
|
45
|
+
black: [30, 39],
|
|
46
|
+
red: [31, 39],
|
|
47
|
+
green: [32, 39],
|
|
48
|
+
yellow: [33, 39],
|
|
49
|
+
blue: [34, 39],
|
|
50
|
+
magenta: [35, 39],
|
|
51
|
+
cyan: [36, 39],
|
|
52
|
+
white: [37, 39],
|
|
53
|
+
// Bright color
|
|
54
|
+
blackBright: [90, 39],
|
|
55
|
+
gray: [90, 39],
|
|
56
|
+
// Alias of `blackBright`
|
|
57
|
+
grey: [90, 39],
|
|
58
|
+
// Alias of `blackBright`
|
|
59
|
+
redBright: [91, 39],
|
|
60
|
+
greenBright: [92, 39],
|
|
61
|
+
yellowBright: [93, 39],
|
|
62
|
+
blueBright: [94, 39],
|
|
63
|
+
magentaBright: [95, 39],
|
|
64
|
+
cyanBright: [96, 39],
|
|
65
|
+
whiteBright: [97, 39]
|
|
66
|
+
},
|
|
67
|
+
bgColor: {
|
|
68
|
+
bgBlack: [40, 49],
|
|
69
|
+
bgRed: [41, 49],
|
|
70
|
+
bgGreen: [42, 49],
|
|
71
|
+
bgYellow: [43, 49],
|
|
72
|
+
bgBlue: [44, 49],
|
|
73
|
+
bgMagenta: [45, 49],
|
|
74
|
+
bgCyan: [46, 49],
|
|
75
|
+
bgWhite: [47, 49],
|
|
76
|
+
// Bright color
|
|
77
|
+
bgBlackBright: [100, 49],
|
|
78
|
+
bgGray: [100, 49],
|
|
79
|
+
// Alias of `bgBlackBright`
|
|
80
|
+
bgGrey: [100, 49],
|
|
81
|
+
// Alias of `bgBlackBright`
|
|
82
|
+
bgRedBright: [101, 49],
|
|
83
|
+
bgGreenBright: [102, 49],
|
|
84
|
+
bgYellowBright: [103, 49],
|
|
85
|
+
bgBlueBright: [104, 49],
|
|
86
|
+
bgMagentaBright: [105, 49],
|
|
87
|
+
bgCyanBright: [106, 49],
|
|
88
|
+
bgWhiteBright: [107, 49]
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const modifierNames = Object.keys(styles.modifier);
|
|
92
|
+
const foregroundColorNames = Object.keys(styles.color);
|
|
93
|
+
const backgroundColorNames = Object.keys(styles.bgColor);
|
|
94
|
+
const colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
95
|
+
function assembleStyles() {
|
|
96
|
+
const codes = /* @__PURE__ */ new Map();
|
|
97
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
98
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
99
|
+
styles[styleName] = {
|
|
100
|
+
open: `\x1B[${style[0]}m`,
|
|
101
|
+
close: `\x1B[${style[1]}m`
|
|
102
|
+
};
|
|
103
|
+
group[styleName] = styles[styleName];
|
|
104
|
+
codes.set(style[0], style[1]);
|
|
105
|
+
}
|
|
106
|
+
Object.defineProperty(styles, groupName, {
|
|
107
|
+
value: group,
|
|
108
|
+
enumerable: false
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
Object.defineProperty(styles, "codes", {
|
|
112
|
+
value: codes,
|
|
113
|
+
enumerable: false
|
|
114
|
+
});
|
|
115
|
+
styles.color.close = "\x1B[39m";
|
|
116
|
+
styles.bgColor.close = "\x1B[49m";
|
|
117
|
+
styles.color.ansi = wrapAnsi16();
|
|
118
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
119
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
120
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
121
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
122
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
123
|
+
Object.defineProperties(styles, {
|
|
124
|
+
rgbToAnsi256: {
|
|
125
|
+
value(red, green, blue) {
|
|
126
|
+
if (red === green && green === blue) {
|
|
127
|
+
if (red < 8) {
|
|
128
|
+
return 16;
|
|
129
|
+
}
|
|
130
|
+
if (red > 248) {
|
|
131
|
+
return 231;
|
|
132
|
+
}
|
|
133
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
134
|
+
}
|
|
135
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
136
|
+
},
|
|
137
|
+
enumerable: false
|
|
138
|
+
},
|
|
139
|
+
hexToRgb: {
|
|
140
|
+
value(hex) {
|
|
141
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
142
|
+
if (!matches) {
|
|
143
|
+
return [0, 0, 0];
|
|
144
|
+
}
|
|
145
|
+
let [colorString] = matches;
|
|
146
|
+
if (colorString.length === 3) {
|
|
147
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
148
|
+
}
|
|
149
|
+
const integer = Number.parseInt(colorString, 16);
|
|
150
|
+
return [
|
|
151
|
+
/* eslint-disable no-bitwise */
|
|
152
|
+
integer >> 16 & 255,
|
|
153
|
+
integer >> 8 & 255,
|
|
154
|
+
integer & 255
|
|
155
|
+
/* eslint-enable no-bitwise */
|
|
156
|
+
];
|
|
157
|
+
},
|
|
158
|
+
enumerable: false
|
|
159
|
+
},
|
|
160
|
+
hexToAnsi256: {
|
|
161
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
162
|
+
enumerable: false
|
|
163
|
+
},
|
|
164
|
+
ansi256ToAnsi: {
|
|
165
|
+
value(code) {
|
|
166
|
+
if (code < 8) {
|
|
167
|
+
return 30 + code;
|
|
168
|
+
}
|
|
169
|
+
if (code < 16) {
|
|
170
|
+
return 90 + (code - 8);
|
|
171
|
+
}
|
|
172
|
+
let red;
|
|
173
|
+
let green;
|
|
174
|
+
let blue;
|
|
175
|
+
if (code >= 232) {
|
|
176
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
177
|
+
green = red;
|
|
178
|
+
blue = red;
|
|
179
|
+
} else {
|
|
180
|
+
code -= 16;
|
|
181
|
+
const remainder = code % 36;
|
|
182
|
+
red = Math.floor(code / 36) / 5;
|
|
183
|
+
green = Math.floor(remainder / 6) / 5;
|
|
184
|
+
blue = remainder % 6 / 5;
|
|
185
|
+
}
|
|
186
|
+
const value = Math.max(red, green, blue) * 2;
|
|
187
|
+
if (value === 0) {
|
|
188
|
+
return 30;
|
|
189
|
+
}
|
|
190
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
191
|
+
if (value === 2) {
|
|
192
|
+
result += 60;
|
|
193
|
+
}
|
|
194
|
+
return result;
|
|
195
|
+
},
|
|
196
|
+
enumerable: false
|
|
197
|
+
},
|
|
198
|
+
rgbToAnsi: {
|
|
199
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
200
|
+
enumerable: false
|
|
201
|
+
},
|
|
202
|
+
hexToAnsi: {
|
|
203
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
204
|
+
enumerable: false
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
return styles;
|
|
208
|
+
}
|
|
209
|
+
const ansiStyles = assembleStyles();
|
|
210
|
+
var ansi_styles_default = ansiStyles;
|
|
211
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../source/vendor/ansi-styles/index.js"],
|
|
4
|
+
"sourcesContent": ["const ANSI_BACKGROUND_OFFSET = 10;\n\nconst wrapAnsi16 = (offset = 0) => code => `\\u001B[${code + offset}m`;\n\nconst wrapAnsi256 = (offset = 0) => code => `\\u001B[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m = (offset = 0) => (red, green, blue) => `\\u001B[${38 + offset};2;${red};${green};${blue}m`;\n\nconst styles = {\n\tmodifier: {\n\t\treset: [0, 0],\n\t\t// 21 isn't widely supported and 22 does the same thing\n\t\tbold: [1, 22],\n\t\tdim: [2, 22],\n\t\titalic: [3, 23],\n\t\tunderline: [4, 24],\n\t\toverline: [53, 55],\n\t\tinverse: [7, 27],\n\t\thidden: [8, 28],\n\t\tstrikethrough: [9, 29],\n\t},\n\tcolor: {\n\t\tblack: [30, 39],\n\t\tred: [31, 39],\n\t\tgreen: [32, 39],\n\t\tyellow: [33, 39],\n\t\tblue: [34, 39],\n\t\tmagenta: [35, 39],\n\t\tcyan: [36, 39],\n\t\twhite: [37, 39],\n\n\t\t// Bright color\n\t\tblackBright: [90, 39],\n\t\tgray: [90, 39], // Alias of `blackBright`\n\t\tgrey: [90, 39], // Alias of `blackBright`\n\t\tredBright: [91, 39],\n\t\tgreenBright: [92, 39],\n\t\tyellowBright: [93, 39],\n\t\tblueBright: [94, 39],\n\t\tmagentaBright: [95, 39],\n\t\tcyanBright: [96, 39],\n\t\twhiteBright: [97, 39],\n\t},\n\tbgColor: {\n\t\tbgBlack: [40, 49],\n\t\tbgRed: [41, 49],\n\t\tbgGreen: [42, 49],\n\t\tbgYellow: [43, 49],\n\t\tbgBlue: [44, 49],\n\t\tbgMagenta: [45, 49],\n\t\tbgCyan: [46, 49],\n\t\tbgWhite: [47, 49],\n\n\t\t// Bright color\n\t\tbgBlackBright: [100, 49],\n\t\tbgGray: [100, 49], // Alias of `bgBlackBright`\n\t\tbgGrey: [100, 49], // Alias of `bgBlackBright`\n\t\tbgRedBright: [101, 49],\n\t\tbgGreenBright: [102, 49],\n\t\tbgYellowBright: [103, 49],\n\t\tbgBlueBright: [104, 49],\n\t\tbgMagentaBright: [105, 49],\n\t\tbgCyanBright: [106, 49],\n\t\tbgWhiteBright: [107, 49],\n\t},\n};\n\nexport const modifierNames = Object.keys(styles.modifier);\nexport const foregroundColorNames = Object.keys(styles.color);\nexport const backgroundColorNames = Object.keys(styles.bgColor);\nexport const colorNames = [...foregroundColorNames, ...backgroundColorNames];\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u001B[${style[0]}m`,\n\t\t\t\tclose: `\\u001B[${style[1]}m`,\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\tcodes.set(style[0], style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false,\n\t});\n\n\tstyles.color.close = '\\u001B[39m';\n\tstyles.bgColor.close = '\\u001B[49m';\n\n\tstyles.color.ansi = wrapAnsi16();\n\tstyles.color.ansi256 = wrapAnsi256();\n\tstyles.color.ansi16m = wrapAnsi16m();\n\tstyles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);\n\n\t// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js\n\tObject.defineProperties(styles, {\n\t\trgbToAnsi256: {\n\t\t\tvalue(red, green, blue) {\n\t\t\t\t// We use the extended greyscale palette here, with the exception of\n\t\t\t\t// black and white. normal palette only has 4 greyscale shades.\n\t\t\t\tif (red === green && green === blue) {\n\t\t\t\t\tif (red < 8) {\n\t\t\t\t\t\treturn 16;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (red > 248) {\n\t\t\t\t\t\treturn 231;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Math.round(((red - 8) / 247) * 24) + 232;\n\t\t\t\t}\n\n\t\t\t\treturn 16\n\t\t\t\t\t+ (36 * Math.round(red / 255 * 5))\n\t\t\t\t\t+ (6 * Math.round(green / 255 * 5))\n\t\t\t\t\t+ Math.round(blue / 255 * 5);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToRgb: {\n\t\t\tvalue(hex) {\n\t\t\t\tconst matches = /[a-f\\d]{6}|[a-f\\d]{3}/i.exec(hex.toString(16));\n\t\t\t\tif (!matches) {\n\t\t\t\t\treturn [0, 0, 0];\n\t\t\t\t}\n\n\t\t\t\tlet [colorString] = matches;\n\n\t\t\t\tif (colorString.length === 3) {\n\t\t\t\t\tcolorString = [...colorString].map(character => character + character).join('');\n\t\t\t\t}\n\n\t\t\t\tconst integer = Number.parseInt(colorString, 16);\n\n\t\t\t\treturn [\n\t\t\t\t\t/* eslint-disable no-bitwise */\n\t\t\t\t\t(integer >> 16) & 0xFF,\n\t\t\t\t\t(integer >> 8) & 0xFF,\n\t\t\t\t\tinteger & 0xFF,\n\t\t\t\t\t/* eslint-enable no-bitwise */\n\t\t\t\t];\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi256: {\n\t\t\tvalue: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t\tansi256ToAnsi: {\n\t\t\tvalue(code) {\n\t\t\t\tif (code < 8) {\n\t\t\t\t\treturn 30 + code;\n\t\t\t\t}\n\n\t\t\t\tif (code < 16) {\n\t\t\t\t\treturn 90 + (code - 8);\n\t\t\t\t}\n\n\t\t\t\tlet red;\n\t\t\t\tlet green;\n\t\t\t\tlet blue;\n\n\t\t\t\tif (code >= 232) {\n\t\t\t\t\tred = (((code - 232) * 10) + 8) / 255;\n\t\t\t\t\tgreen = red;\n\t\t\t\t\tblue = red;\n\t\t\t\t} else {\n\t\t\t\t\tcode -= 16;\n\n\t\t\t\t\tconst remainder = code % 36;\n\n\t\t\t\t\tred = Math.floor(code / 36) / 5;\n\t\t\t\t\tgreen = Math.floor(remainder / 6) / 5;\n\t\t\t\t\tblue = (remainder % 6) / 5;\n\t\t\t\t}\n\n\t\t\t\tconst value = Math.max(red, green, blue) * 2;\n\n\t\t\t\tif (value === 0) {\n\t\t\t\t\treturn 30;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tlet result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n\t\t\t\tif (value === 2) {\n\t\t\t\t\tresult += 60;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\trgbToAnsi: {\n\t\t\tvalue: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi: {\n\t\t\tvalue: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t});\n\n\treturn styles;\n}\n\nconst ansiStyles = assembleStyles();\n\nexport default ansiStyles;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,yBAAyB;AAE/B,MAAM,aAAa,CAAC,SAAS,MAAM,UAAQ,QAAU,OAAO,MAAM;AAElE,MAAM,cAAc,CAAC,SAAS,MAAM,UAAQ,QAAU,KAAK,M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