Skip to content

Commit

Permalink
chore: swap color lib (#1327)
Browse files Browse the repository at this point in the history
* chore: swap color lib

* chore: bump version
  • Loading branch information
lukeed committed Jun 19, 2020
1 parent 43d089f commit b221f4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/autoprefixer.js
@@ -1,7 +1,7 @@
let browserslist = require('browserslist')
let postcss = require('postcss')
let agents = require('caniuse-lite').agents
let chalk = require('chalk')
let kleur = require('kleur/colors')

let Browsers = require('./browsers')
let Prefixes = require('./prefixes')
Expand Down Expand Up @@ -79,10 +79,10 @@ module.exports = postcss.plugin('autoprefixer', (...reqs) => {
reqs = options.overrideBrowserslist
} else if (options.browsers) {
if (typeof console !== 'undefined' && console.warn) {
if (chalk && chalk.red) {
if (kleur.red) {
console.warn(
chalk.red(
WARNING.replace(/`[^`]+`/g, i => chalk.yellow(i.slice(1, -1)))
kleur.red(
WARNING.replace(/`[^`]+`/g, i => kleur.yellow(i.slice(1, -1)))
)
)
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -28,7 +28,7 @@
"@babel/register": "^7.9.0",
"browserslist": "^4.12.0",
"caniuse-lite": "^1.0.30001061",
"chalk": "^2.4.2",
"kleur": "^4.0.1",
"normalize-range": "^0.1.2",
"num2fraction": "^1.2.2",
"postcss": "^7.0.30",
Expand Down
4 changes: 2 additions & 2 deletions test/webpack.test.js
@@ -1,8 +1,8 @@
jest.doMock('chalk', () => ({ }))
jest.doMock('kleur/colors', () => ({ }))

let autoprefixer = require('../lib/autoprefixer')

it('works without chalk', () => {
it('works without kleur', () => {
jest.spyOn(console, 'warn').mockImplementation(() => true)
let instance = autoprefixer({ browsers: ['last 1 version'] })
expect(instance.browsers).toEqual(['last 1 version'])
Expand Down

0 comments on commit b221f4a

Please sign in to comment.