Skip to content

Commit 44c581a

Browse files
committed
Replace nanocolors with picocolors
1 parent 8ba21fd commit 44c581a

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

lib/css-syntax-error.es6

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import nanocolors from 'nanocolors'
1+
import pico from 'picocolors'
22

33
import terminalHighlight from './terminal-highlight'
44

@@ -174,7 +174,7 @@ class CssSyntaxError extends Error {
174174

175175
let css = this.source
176176
if (terminalHighlight) {
177-
if (typeof color === 'undefined') color = nanocolors.isColorSupported
177+
if (typeof color === 'undefined') color = pico.isColorSupported
178178
if (color) css = terminalHighlight(css)
179179
}
180180

@@ -185,14 +185,14 @@ class CssSyntaxError extends Error {
185185
let maxWidth = String(end).length
186186

187187
function mark (text) {
188-
if (color && nanocolors.red) {
189-
return nanocolors.red(nanocolors.bold(text))
188+
if (color && pico.red) {
189+
return pico.red(pico.bold(text))
190190
}
191191
return text
192192
}
193193
function aside (text) {
194-
if (color && nanocolors.gray) {
195-
return nanocolors.gray(text)
194+
if (color && pico.gray) {
195+
return pico.gray(text)
196196
}
197197
return text
198198
}

lib/terminal-highlight.es6

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import nanocolors from 'nanocolors'
1+
import pico from 'picocolors'
22

33
import tokenizer from './tokenize'
44
import Input from './input'
55

66
const HIGHLIGHT_THEME = {
7-
brackets: nanocolors.cyan,
8-
'at-word': nanocolors.cyan,
9-
comment: nanocolors.gray,
10-
string: nanocolors.green,
11-
class: nanocolors.yellow,
12-
call: nanocolors.cyan,
13-
hash: nanocolors.magenta,
14-
'(': nanocolors.cyan,
15-
')': nanocolors.cyan,
16-
'{': nanocolors.yellow,
17-
'}': nanocolors.yellow,
18-
'[': nanocolors.yellow,
19-
']': nanocolors.yellow,
20-
':': nanocolors.yellow,
21-
';': nanocolors.yellow
7+
brackets: pico.cyan,
8+
'at-word': pico.cyan,
9+
comment: pico.gray,
10+
string: pico.green,
11+
class: pico.yellow,
12+
call: pico.cyan,
13+
hash: pico.magenta,
14+
'(': pico.cyan,
15+
')': pico.cyan,
16+
'{': pico.yellow,
17+
'}': pico.yellow,
18+
'[': pico.yellow,
19+
']': pico.yellow,
20+
':': pico.yellow,
21+
';': pico.yellow
2222
}
2323

2424
function getTokenType ([type, value], processor) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"homepage": "https://postcss.org/",
3030
"repository": "postcss/postcss",
3131
"dependencies": {
32-
"nanocolors": "^0.2.2",
32+
"picocolors": "^0.2.1",
3333
"source-map": "^0.6.1"
3434
},
3535
"devDependencies": {

test/browser.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
jest.doMock('fs', () => ({}))
2-
jest.doMock('nanocolors', () => require('nanocolors/index.browser.cjs'))
2+
jest.doMock('picocolors', () => require('picocolors/picocolors.browser.js'))
33

44
let postcss = require('..')
55

test/css-syntax-error.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
let nanocolors = require('nanocolors')
21
let stripAnsi = require('strip-ansi')
32
let Concat = require('concat-with-sourcemaps')
3+
let pico = require('picocolors')
44
let path = require('path')
55

66
let CssSyntaxError = require('../lib/css-syntax-error')
@@ -45,7 +45,7 @@ it('has stack trace', () => {
4545
})
4646

4747
it('highlights broken line with colors', () => {
48-
let c = nanocolors
48+
let c = pico
4949
expect(parseError('#a .b {').showSourceCode(true)).toEqual(
5050
c.red(c.bold('>')) +
5151
c.gray(' 1 | ') +

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,11 +5117,6 @@ nan@^2.9.2:
51175117
resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7"
51185118
integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==
51195119

5120-
nanocolors@^0.2.2:
5121-
version "0.2.2"
5122-
resolved "https://registry.yarnpkg.com/nanocolors/-/nanocolors-0.2.2.tgz#94a4b7e45ecdebdbea7cb0a8349f9447a9677675"
5123-
integrity sha512-t4mwdKizEGLFeZzDbr1r6SjwKYZQEB0Z/trGsdAIsw5EadaR010/zvJ0arkw6vznyTevcMi9BtppprJ5aqLXRg==
5124-
51255120
nanomatch@^1.2.9:
51265121
version "1.2.13"
51275122
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
@@ -5705,6 +5700,11 @@ performance-now@^2.1.0:
57055700
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
57065701
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
57075702

5703+
picocolors@^0.2.1:
5704+
version "0.2.1"
5705+
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-0.2.1.tgz#570670f793646851d1ba135996962abad587859f"
5706+
integrity sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==
5707+
57085708
pify@^2.0.0:
57095709
version "2.3.0"
57105710
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"

0 commit comments

Comments
 (0)