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 <bradlc41@gmail.com>
This commit is contained in:
parent
04686b8a05
commit
2dec5649c9
4 changed files with 22 additions and 12 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import chalk from 'chalk'
|
||||
import colors from 'picocolors'
|
||||
import log from './util/log'
|
||||
|
||||
let defaults = {
|
||||
|
|
@ -41,7 +41,7 @@ export function issueFlagNotices(config) {
|
|||
|
||||
if (experimentalFlagsEnabled(config).length > 0) {
|
||||
let changes = experimentalFlagsEnabled(config)
|
||||
.map((s) => chalk.yellow(s))
|
||||
.map((s) => colors.yellow(s))
|
||||
.join(', ')
|
||||
|
||||
log.warn('experimental-flags-enabled', [
|
||||
|
|
|
|||
|
|
@ -1,29 +1,29 @@
|
|||
import chalk from 'chalk'
|
||||
import colors from 'picocolors'
|
||||
|
||||
let alreadyShown = new Set()
|
||||
|
||||
function log(chalk, messages, key) {
|
||||
function log(type, messages, key) {
|
||||
if (process.env.JEST_WORKER_ID !== undefined) return
|
||||
|
||||
if (key && alreadyShown.has(key)) return
|
||||
if (key) alreadyShown.add(key)
|
||||
|
||||
console.warn('')
|
||||
messages.forEach((message) => console.warn(chalk, '-', message))
|
||||
messages.forEach((message) => console.warn(type, '-', message))
|
||||
}
|
||||
|
||||
export function dim(input) {
|
||||
return chalk.dim(input)
|
||||
return colors.dim(input)
|
||||
}
|
||||
|
||||
export default {
|
||||
info(key, messages) {
|
||||
log(chalk.bold.cyan('info'), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
log(colors.bold(colors.cyan('info')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
},
|
||||
warn(key, messages) {
|
||||
log(chalk.bold.yellow('warn'), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
log(colors.bold(colors.yellow('warn')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
},
|
||||
risk(key, messages) {
|
||||
log(chalk.bold.magenta('risk'), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
log(colors.bold(colors.magenta('risk')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue