Skip to content

Commit 9f3f017

Browse files
committed
refactor: use the built-in chalk from chalk-pipe to reduce package size
1 parent fe12f28 commit 9f3f017

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@
2121
"prepare": "husky"
2222
},
2323
"dependencies": {
24-
"chalk": "^5.3.0",
2524
"chalk-pipe": "^6.0.0",
2625
"get-east-asian-width": "^1.3.0"
2726
},
2827
"devDependencies": {
2928
"@swc/core": "^1.5.0",
30-
"@types/chalk": "^2.2.0",
3129
"@types/chalk-pipe": "^2.0.4",
3230
"@types/node": "^20.12.7",
3331
"@vitest/coverage-istanbul": "^1.5.1",

src/core/PaletteError.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import chalk, { type ChalkInstance } from 'chalk';
2-
import chalkPipe from 'chalk-pipe';
1+
import chalkPipe, { chalk, type ChalkInstance } from 'chalk-pipe';
32
import { isBgRgb, isRgb, isString, normalizeRgb } from '../helpers/index.js';
43

54
/**
@@ -14,6 +13,7 @@ export default class PaletteError extends Error {
1413
* @param {(string | Error)} message - The error message or an Error object.
1514
*/
1615
constructor(message: string | Error) {
16+
// TODO: Error.cause
1717
super(isString(message) ? message : message?.message || '');
1818

1919
/**

src/core/PrintError.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { basename } from 'node:path';
22
import { cwd, stdout } from 'node:process';
33
import type { WriteStream } from 'node:tty';
44
import { eastAsianWidth } from 'get-east-asian-width';
5-
import type { ChalkInstance } from 'chalk';
5+
import type { ChalkInstance } from 'chalk-pipe';
66
import type { TraceOption } from '../shared/index.js';
77
import TraceError from './TraceError.js';
88

test/core/PaletteError.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chalk from 'chalk';
1+
import { chalk } from 'chalk-pipe';
22
import { expect, test } from 'vitest';
33
import PaletteError from '../../src/core/PaletteError.js';
44

0 commit comments

Comments
 (0)