Skip to content

Commit 2dec564

Browse files
TrySoundbradlc
andauthored
Replace chalk with picocolors (#6039)
* Replace chalk with picocolors Already used in latest postcss, autoprefixer and browserslist versions. See https://github.com/alexeyraspopov/picocolors * Update `dim` function Co-authored-by: Brad Cornes <[email protected]>
1 parent 04686b8 commit 2dec564

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

package-lock.json

+12-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
},
6262
"dependencies": {
6363
"arg": "^5.0.1",
64-
"chalk": "^4.1.2",
6564
"chokidar": "^3.5.3",
6665
"color-name": "^1.1.4",
6766
"cosmiconfig": "^7.0.1",
@@ -73,6 +72,7 @@
7372
"is-glob": "^4.0.3",
7473
"normalize-path": "^3.0.0",
7574
"object-hash": "^2.2.0",
75+
"picocolors": "^1.0.0",
7676
"postcss": "^8.4.6",
7777
"postcss-js": "^4.0.0",
7878
"postcss-load-config": "^3.1.3",

src/featureFlags.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chalk from 'chalk'
1+
import colors from 'picocolors'
22
import log from './util/log'
33

44
let defaults = {
@@ -41,7 +41,7 @@ export function issueFlagNotices(config) {
4141

4242
if (experimentalFlagsEnabled(config).length > 0) {
4343
let changes = experimentalFlagsEnabled(config)
44-
.map((s) => chalk.yellow(s))
44+
.map((s) => colors.yellow(s))
4545
.join(', ')
4646

4747
log.warn('experimental-flags-enabled', [

src/util/log.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import chalk from 'chalk'
1+
import colors from 'picocolors'
22

33
let alreadyShown = new Set()
44

5-
function log(chalk, messages, key) {
5+
function log(type, messages, key) {
66
if (process.env.JEST_WORKER_ID !== undefined) return
77

88
if (key && alreadyShown.has(key)) return
99
if (key) alreadyShown.add(key)
1010

1111
console.warn('')
12-
messages.forEach((message) => console.warn(chalk, '-', message))
12+
messages.forEach((message) => console.warn(type, '-', message))
1313
}
1414

1515
export function dim(input) {
16-
return chalk.dim(input)
16+
return colors.dim(input)
1717
}
1818

1919
export default {
2020
info(key, messages) {
21-
log(chalk.bold.cyan('info'), ...(Array.isArray(key) ? [key] : [messages, key]))
21+
log(colors.bold(colors.cyan('info')), ...(Array.isArray(key) ? [key] : [messages, key]))
2222
},
2323
warn(key, messages) {
24-
log(chalk.bold.yellow('warn'), ...(Array.isArray(key) ? [key] : [messages, key]))
24+
log(colors.bold(colors.yellow('warn')), ...(Array.isArray(key) ? [key] : [messages, key]))
2525
},
2626
risk(key, messages) {
27-
log(chalk.bold.magenta('risk'), ...(Array.isArray(key) ? [key] : [messages, key]))
27+
log(colors.bold(colors.magenta('risk')), ...(Array.isArray(key) ? [key] : [messages, key]))
2828
},
2929
}

0 commit comments

Comments
 (0)