chalk 2.2.0 → 2.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/index.js +12 -5
- package/package.json +1 -1
- package/readme.md +2 -1
- package/types/index.d.ts +2 -0
package/index.js
CHANGED
|
@@ -58,11 +58,17 @@ for (const key of Object.keys(ansiStyles)) {
|
|
|
58
58
|
styles[key] = {
|
|
59
59
|
get() {
|
|
60
60
|
const codes = ansiStyles[key];
|
|
61
|
-
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], key);
|
|
61
|
+
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
styles.visible = {
|
|
67
|
+
get() {
|
|
68
|
+
return build.call(this, this._styles || [], true, 'visible');
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
66
72
|
ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
|
|
67
73
|
for (const model of Object.keys(ansiStyles.color.ansi)) {
|
|
68
74
|
if (skipModels.has(model)) {
|
|
@@ -79,7 +85,7 @@ for (const model of Object.keys(ansiStyles.color.ansi)) {
|
|
|
79
85
|
close: ansiStyles.color.close,
|
|
80
86
|
closeRe: ansiStyles.color.closeRe
|
|
81
87
|
};
|
|
82
|
-
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], model);
|
|
88
|
+
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
|
83
89
|
};
|
|
84
90
|
}
|
|
85
91
|
};
|
|
@@ -102,7 +108,7 @@ for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
|
|
102
108
|
close: ansiStyles.bgColor.close,
|
|
103
109
|
closeRe: ansiStyles.bgColor.closeRe
|
|
104
110
|
};
|
|
105
|
-
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], model);
|
|
111
|
+
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
|
106
112
|
};
|
|
107
113
|
}
|
|
108
114
|
};
|
|
@@ -110,12 +116,13 @@ for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
|
|
110
116
|
|
|
111
117
|
const proto = Object.defineProperties(() => {}, styles);
|
|
112
118
|
|
|
113
|
-
function build(_styles, key) {
|
|
119
|
+
function build(_styles, _empty, key) {
|
|
114
120
|
const builder = function () {
|
|
115
121
|
return applyStyle.apply(builder, arguments);
|
|
116
122
|
};
|
|
117
123
|
|
|
118
124
|
builder._styles = _styles;
|
|
125
|
+
builder._empty = _empty;
|
|
119
126
|
|
|
120
127
|
const self = this;
|
|
121
128
|
|
|
@@ -167,7 +174,7 @@ function applyStyle() {
|
|
|
167
174
|
}
|
|
168
175
|
|
|
169
176
|
if (!this.enabled || this.level <= 0 || !str) {
|
|
170
|
-
return str;
|
|
177
|
+
return this._empty ? '' : str;
|
|
171
178
|
}
|
|
172
179
|
|
|
173
180
|
// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
> Terminal string styling done right
|
|
11
11
|
|
|
12
|
-
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/sindresorhus/xo)
|
|
12
|
+
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/sindresorhus/xo) [](https://github.com/sindresorhus/awesome-nodejs)
|
|
13
13
|
|
|
14
14
|
### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0)
|
|
15
15
|
|
|
@@ -170,6 +170,7 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=
|
|
|
170
170
|
- `inverse`
|
|
171
171
|
- `hidden`
|
|
172
172
|
- `strikethrough` *(Not widely supported)*
|
|
173
|
+
- `visible` (Text is emitted only if enabled)
|
|
173
174
|
|
|
174
175
|
### Colors
|
|
175
176
|
|