chlklib 1.0.0 → 1.0.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/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\t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UAAQ,SAAS,IAAI;AACrB,UAAQ,MAAM,IAAI;AAClB,UAAQ,QAAQ,IAAI;AAEpB,SAAO;AACR;AAEA,MAAM,aAAa,CAAC,MAAM,WAAW;AACpC,MAAI,KAAK,SAAS,KAAK,CAAC,QAAQ;AAC/B,WAAO,KAAK,QAAQ,IAAI,KAAK;AAAA,EAC9B;AAEA,MAAI,SAAS,KAAK,MAAM;AAExB,MAAI,WAAW,QAAW;AACzB,WAAO;AAAA,EACR;AAEA,QAAM,EAAC,SAAS,SAAQ,IAAI;AAC5B,MAAI,OAAO,SAAS,MAAQ,GAAG;AAC9B,WAAO,WAAW,QAAW;AAI5B,mBAAS,mCAAiB,QAAQ,OAAO,OAAO,OAAO,IAAI;AAE3D,eAAS,OAAO;AAAA,IACjB;AAAA,EACD;AAKA,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,YAA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S,iBAAiB,QAAQ,OAAO,OAAO,OAAO,IAAI;AAE3D,eAAS,OAAO;AAAA,IACjB;AAAA,EACD;AAKA,QAAM,UAAU,OAAO,QAAQ,IAAI;AACnC,MAAI,YAAY,IAAI;AACnB,aAAS,+BAA+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;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,52 @@
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 utilities_exports = {};
19
+ __export(utilities_exports, {
20
+ stringEncaseCRLFWithFirstIndex: () => stringEncaseCRLFWithFirstIndex,
21
+ stringReplaceAll: () => stringReplaceAll
22
+ });
23
+ module.exports = __toCommonJS(utilities_exports);
24
+ function stringReplaceAll(string, substring, replacer) {
25
+ let index = string.indexOf(substring);
26
+ if (index === -1) {
27
+ return string;
28
+ }
29
+ const substringLength = substring.length;
30
+ let endIndex = 0;
31
+ let returnValue = "";
32
+ do {
33
+ returnValue += string.slice(endIndex, index) + substring + replacer;
34
+ endIndex = index + substringLength;
35
+ index = string.indexOf(substring, endIndex);
36
+ } while (index !== -1);
37
+ returnValue += string.slice(endIndex);
38
+ return returnValue;
39
+ }
40
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
41
+ let endIndex = 0;
42
+ let returnValue = "";
43
+ do {
44
+ const gotCR = string[index - 1] === "\r";
45
+ returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
46
+ endIndex = index + 1;
47
+ index = string.indexOf("\n", endIndex);
48
+ } while (index !== -1);
49
+ returnValue += string.slice(endIndex);
50
+ return returnValue;
51
+ }
52
+ //# sourceMappingURL=utilities.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../source/utilities.js"],
4
+ "sourcesContent": ["// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.\nexport function stringReplaceAll(string, substring, replacer) {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.slice(endIndex, index) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n\nexport function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,SAAS,iBAAiB,QAAQ,WAAW,UAAU;AAC7D,MAAI,QAAQ,OAAO,QAAQ,SAAS;AACpC,MAAI,UAAU,IAAI;AACjB,WAAO;AAAA,EACR;AAEA,QAAM,kBAAkB,UAAU;AAClC,MAAI,WAAW;AACf,MAAI,cAAc;AAClB,KAAG;AACF,mBAAe,OAAO,MAAM,UAAU,KAAK,IAAI,YAAY;AAC3D,eAAW,QAAQ;AACnB,YAAQ,OAAO,QAAQ,WAAW,QAAQ;AAAA,EAC3C,SAAS,UAAU;AAEnB,iBAAe,OAAO,MAAM,QAAQ;AACpC,SAAO;AACR;AAEO,SAAS,+BAA+B,QAAQ,QAAQ,SAAS,OAAO;AAC9E,MAAI,WAAW;AACf,MAAI,cAAc;AAClB,KAAG;AACF,UAAM,QAAQ,OAAO,QAAQ,CAAC,MAAM;AACpC,mBAAe,OAAO,MAAM,UAAW,QAAQ,QAAQ,IAAI,KAAM,IAAI,UAAU,QAAQ,SAAS,QAAQ;AACxG,eAAW,QAAQ;AACnB,YAAQ,OAAO,QAAQ,MAAM,QAAQ;AAAA,EACtC,SAAS,UAAU;AAEnB,iBAAe,OAAO,MAAM,QAAQ;AACpC,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -0,0 +1,33 @@
1
+ function stringReplaceAll(string, substring, replacer) {
2
+ let index = string.indexOf(substring);
3
+ if (index === -1) {
4
+ return string;
5
+ }
6
+ const substringLength = substring.length;
7
+ let endIndex = 0;
8
+ let returnValue = "";
9
+ do {
10
+ returnValue += string.slice(endIndex, index) + substring + replacer;
11
+ endIndex = index + substringLength;
12
+ index = string.indexOf(substring, endIndex);
13
+ } while (index !== -1);
14
+ returnValue += string.slice(endIndex);
15
+ return returnValue;
16
+ }
17
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
18
+ let endIndex = 0;
19
+ let returnValue = "";
20
+ do {
21
+ const gotCR = string[index - 1] === "\r";
22
+ returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
23
+ endIndex = index + 1;
24
+ index = string.indexOf("\n", endIndex);
25
+ } while (index !== -1);
26
+ returnValue += string.slice(endIndex);
27
+ return returnValue;
28
+ }
29
+ export {
30
+ stringEncaseCRLFWithFirstIndex,
31
+ stringReplaceAll
32
+ };
33
+ //# sourceMappingURL=utilities.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../source/utilities.js"],
4
+ "sourcesContent": ["// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.\nexport function stringReplaceAll(string, substring, replacer) {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.slice(endIndex, index) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n\nexport function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n"],
5
+ "mappings": "AACO,SAAS,iBAAiB,QAAQ,WAAW,UAAU;AAC7D,MAAI,QAAQ,OAAO,QAAQ,SAAS;AACpC,MAAI,UAAU,IAAI;AACjB,WAAO;AAAA,EACR;AAEA,QAAM,kBAAkB,UAAU;AAClC,MAAI,WAAW;AACf,MAAI,cAAc;AAClB,KAAG;AACF,mBAAe,OAAO,MAAM,UAAU,KAAK,IAAI,YAAY;AAC3D,eAAW,QAAQ;AACnB,YAAQ,OAAO,QAAQ,WAAW,QAAQ;AAAA,EAC3C,SAAS,UAAU;AAEnB,iBAAe,OAAO,MAAM,QAAQ;AACpC,SAAO;AACR;AAEO,SAAS,+BAA+B,QAAQ,QAAQ,SAAS,OAAO;AAC9E,MAAI,WAAW;AACf,MAAI,cAAc;AAClB,KAAG;AACF,UAAM,QAAQ,OAAO,QAAQ,CAAC,MAAM;AACpC,mBAAe,OAAO,MAAM,UAAW,QAAQ,QAAQ,IAAI,KAAM,IAAI,UAAU,QAAQ,SAAS,QAAQ;AACxG,eAAW,QAAQ;AACnB,YAAQ,OAAO,QAAQ,MAAM,QAAQ;AAAA,EACtC,SAAS,UAAU;AAEnB,iBAAe,OAAO,MAAM,QAAQ;AACpC,SAAO;AACR;",
6
+ "names": []
7
+ }