chalk 5.3.0 → 5.4.0
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/package.json +3 -3
- package/readme.md +23 -53
- package/source/index.d.ts +6 -1
- package/source/vendor/supports-color/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chalk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Terminal string styling done right",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "chalk/chalk",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"types": "./source/index.d.ts",
|
|
19
|
+
"sideEffects": false,
|
|
19
20
|
"engines": {
|
|
20
21
|
"node": "^12.17.0 || ^14.13 || >=16.0.0"
|
|
21
22
|
},
|
|
@@ -58,10 +59,9 @@
|
|
|
58
59
|
"log-update": "^5.0.0",
|
|
59
60
|
"matcha": "^0.7.0",
|
|
60
61
|
"tsd": "^0.19.0",
|
|
61
|
-
"xo": "^0.
|
|
62
|
+
"xo": "^0.57.0",
|
|
62
63
|
"yoctodelay": "^2.0.0"
|
|
63
64
|
},
|
|
64
|
-
"sideEffects": false,
|
|
65
65
|
"xo": {
|
|
66
66
|
"rules": {
|
|
67
67
|
"unicorn/prefer-string-slice": "off",
|
package/readme.md
CHANGED
|
@@ -12,59 +12,13 @@
|
|
|
12
12
|
[](https://codecov.io/gh/chalk/chalk)
|
|
13
13
|
[](https://www.npmjs.com/package/chalk?activeTab=dependents)
|
|
14
14
|
[](https://www.npmjs.com/package/chalk)
|
|
15
|
-
[](https://repl.it/github/chalk/chalk)
|
|
16
15
|
|
|
17
16
|

|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<div align="center">
|
|
24
|
-
<p>
|
|
25
|
-
<p>
|
|
26
|
-
<sup>
|
|
27
|
-
Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a>
|
|
28
|
-
</sup>
|
|
29
|
-
</p>
|
|
30
|
-
<sup>Special thanks to:</sup>
|
|
31
|
-
<br>
|
|
32
|
-
<br>
|
|
33
|
-
<a href="https://standardresume.co/tech">
|
|
34
|
-
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160">
|
|
35
|
-
</a>
|
|
36
|
-
<br>
|
|
37
|
-
<br>
|
|
38
|
-
<a href="https://retool.com/?utm_campaign=sindresorhus">
|
|
39
|
-
<img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230">
|
|
40
|
-
</a>
|
|
41
|
-
<br>
|
|
42
|
-
<br>
|
|
43
|
-
<a href="https://strapi.io/?ref=sindresorhus">
|
|
44
|
-
<div>
|
|
45
|
-
<img src="https://sindresorhus.com/assets/thanks/strapi-logo-white-bg.png" width="220" alt="Strapi">
|
|
46
|
-
</div>
|
|
47
|
-
<b>Strapi is the leading open-source headless CMS.</b>
|
|
48
|
-
<div>
|
|
49
|
-
<sup>It’s 100% JavaScript, fully customizable, and developer-first.</sup>
|
|
50
|
-
</div>
|
|
51
|
-
</a>
|
|
52
|
-
<br>
|
|
53
|
-
<br>
|
|
54
|
-
<a href="https://www.stackaid.us/?utm_campaign=sindre">
|
|
55
|
-
<div>
|
|
56
|
-
<img src="https://sindresorhus.com/assets/thanks/stackaid-logo.png" width="230" alt="StackAid">
|
|
57
|
-
</div>
|
|
58
|
-
<b>Fund your open source dependencies</b>
|
|
59
|
-
</a>
|
|
60
|
-
<br>
|
|
61
|
-
<br>
|
|
62
|
-
</p>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
<br>
|
|
18
|
+
## Info
|
|
19
|
+
|
|
20
|
+
- [Why not switch to a smaller coloring package?](https://github.com/chalk/chalk?tab=readme-ov-file#why-not-switch-to-a-smaller-coloring-package)
|
|
21
|
+
- See [yoctocolors](https://github.com/sindresorhus/yoctocolors) for a smaller alternative
|
|
68
22
|
|
|
69
23
|
## Highlights
|
|
70
24
|
|
|
@@ -77,7 +31,7 @@
|
|
|
77
31
|
- Doesn't extend `String.prototype`
|
|
78
32
|
- Clean and focused
|
|
79
33
|
- Actively maintained
|
|
80
|
-
- [Used by ~
|
|
34
|
+
- [Used by ~115,000 packages](https://www.npmjs.com/browse/depended/chalk) as of July 4, 2024
|
|
81
35
|
|
|
82
36
|
## Install
|
|
83
37
|
|
|
@@ -297,9 +251,25 @@ Since Chrome 69, ANSI escape codes are natively supported in the developer conso
|
|
|
297
251
|
|
|
298
252
|
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
|
299
253
|
|
|
300
|
-
##
|
|
254
|
+
## FAQ
|
|
255
|
+
|
|
256
|
+
### Why not switch to a smaller coloring package?
|
|
257
|
+
|
|
258
|
+
Chalk may be larger, but there is a reason for that. It offers a more user-friendly API, well-documented types, supports millions of colors, and covers edge cases that smaller alternatives miss. Chalk is mature, reliable, and built to last.
|
|
259
|
+
|
|
260
|
+
But beyond the technical aspects, there's something more critical: trust and long-term maintenance. I have been active in open source for over a decade, and I'm committed to keeping Chalk maintained. Smaller packages might seem appealing now, but there's no guarantee they will be around for the long term, or that they won't become malicious over time.
|
|
261
|
+
|
|
262
|
+
Chalk is also likely already in your dependency tree (since 100K+ packages depend on it), so switching won’t save space—in fact, it might increase it. npm deduplicates dependencies, so multiple Chalk instances turn into one, but adding another package alongside it will increase your overall size.
|
|
263
|
+
|
|
264
|
+
If the goal is to clean up the ecosystem, switching away from Chalk won’t even make a dent. The real problem lies with packages that have very deep dependency trees (for example, those including a lot of polyfills). Chalk has no dependencies. It's better to focus on impactful changes rather than minor optimizations.
|
|
265
|
+
|
|
266
|
+
If absolute package size is important to you, I also maintain [yoctocolors](https://github.com/sindresorhus/yoctocolors), one of the smallest color packages out there.
|
|
267
|
+
|
|
268
|
+
*\- [Sindre](https://github.com/sindresorhus)*
|
|
269
|
+
|
|
270
|
+
### But the smaller coloring package has benchmarks showing it is faster
|
|
301
271
|
|
|
302
|
-
[
|
|
272
|
+
[Micro-benchmarks are flawed](https://sindresorhus.com/blog/micro-benchmark-fallacy) because they measure performance in unrealistic, isolated scenarios, often giving a distorted view of real-world performance. Don't believe marketing fluff. All the coloring packages are more than fast enough.
|
|
303
273
|
|
|
304
274
|
## Related
|
|
305
275
|
|
package/source/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// TODO: Make it this when TS suports that.
|
|
2
2
|
// import {ModifierName, ForegroundColor, BackgroundColor, ColorName} from '#ansi-styles';
|
|
3
3
|
// import {ColorInfo, ColorSupportLevel} from '#supports-color';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ModifierName,
|
|
6
|
+
ForegroundColorName,
|
|
7
|
+
BackgroundColorName,
|
|
8
|
+
ColorName,
|
|
9
|
+
} from './vendor/ansi-styles/index.js';
|
|
5
10
|
import {ColorInfo, ColorSupportLevel} from './vendor/supports-color/index.js';
|
|
6
11
|
|
|
7
12
|
export interface Options {
|
|
@@ -112,11 +112,11 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
if ('CI' in env) {
|
|
115
|
-
if ('GITHUB_ACTIONS'
|
|
115
|
+
if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {
|
|
116
116
|
return 3;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
if (['TRAVIS', '
|
|
119
|
+
if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
120
120
|
return 1;
|
|
121
121
|
}
|
|
122
122
|
|