From aeda546c1f917aecf2f83ffc8f57bda473745091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Fri, 19 Jul 2024 20:12:58 +0800 Subject: [PATCH] refactor: replace colorette with picocolors --- package.json | 2 +- pnpm-lock.yaml | 11 +++-------- src/errors.ts | 2 +- src/lib/report-size.ts | 2 +- src/log.ts | 2 +- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 13c0f53d9..3668bd8e1 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "execa": "^5.1.1", "globby": "^11.1.0", "joycon": "^3.1.1", + "picocolors": "^1.0.1", "postcss-load-config": "^6.0.1", "resolve-from": "^5.0.0", "rollup": "^4.18.1", @@ -74,7 +75,6 @@ "@types/fs-extra": "11.0.4", "@types/node": "20.14.11", "@types/resolve": "1.20.6", - "colorette": "2.0.20", "flat": "6.0.1", "fs-extra": "11.2.0", "postcss": "8.4.39", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd16e8a40..ec678e411 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,6 +35,9 @@ importers: joycon: specifier: ^3.1.1 version: 3.1.1 + picocolors: + specifier: ^1.0.1 + version: 1.0.1 postcss-load-config: specifier: ^6.0.1 version: 6.0.1(jiti@1.21.6)(postcss@8.4.39)(yaml@2.4.5) @@ -75,9 +78,6 @@ importers: '@types/resolve': specifier: 1.20.6 version: 1.20.6 - colorette: - specifier: 2.0.20 - version: 2.0.20 flat: specifier: 6.0.1 version: 6.0.1 @@ -852,9 +852,6 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - colorette@2.0.20: - resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} - commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -2273,8 +2270,6 @@ snapshots: color-name@1.1.4: {} - colorette@2.0.20: {} - commander@2.20.3: {} commander@4.1.1: {} diff --git a/src/errors.ts b/src/errors.ts index b0a78c3ed..d6b2dde66 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,5 +1,5 @@ import { isMainThread, parentPort } from 'node:worker_threads' -import * as colors from 'colorette' +import * as colors from 'picocolors' export class PrettyError extends Error { constructor(message: string) { diff --git a/src/lib/report-size.ts b/src/lib/report-size.ts index 863053dd1..efd841e2f 100644 --- a/src/lib/report-size.ts +++ b/src/lib/report-size.ts @@ -1,4 +1,4 @@ -import * as colors from 'colorette' +import * as colors from 'picocolors' import type { Logger } from '../log' const prettyBytes = (bytes: number) => { diff --git a/src/log.ts b/src/log.ts index fa550f732..0a8565e94 100644 --- a/src/log.ts +++ b/src/log.ts @@ -1,6 +1,6 @@ import util from 'node:util' import { isMainThread, parentPort } from 'node:worker_threads' -import * as colors from 'colorette' +import * as colors from 'picocolors' type LOG_TYPE = 'info' | 'success' | 'error' | 'warn'