Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace
chalk
withpicocolors
for better perfomance and reduce bundle size.Benchmarks from
picocolors
repoBenchmarks
The space in node_modules including sub-dependencies:
$ node ./benchmarks/size.js Data from packagephobia.com chalk 101 kB cli-color 1249 kB ansi-colors 25 kB kleur 21 kB colorette 17 kB nanocolors 16 kB + picocolors 7 kB
Library loading time:
$ node ./benchmarks/loading.js chalk 6.167 ms cli-color 31.431 ms ansi-colors 1.585 ms kleur 2.008 ms kleur/colors 0.773 ms colorette 2.476 ms nanocolors 0.833 ms + picocolors 0.466 ms
Benchmark for simple use case:
$ node ./benchmarks/simple.js chalk 24,066,342 ops/sec cli-color 938,700 ops/sec ansi-colors 4,532,542 ops/sec kleur 20,343,122 ops/sec kleur/colors 35,415,770 ops/sec colorette 34,244,834 ops/sec nanocolors 33,443,265 ops/sec + picocolors 33,271,645 ops/sec
Benchmark for complex use cases:
$ node ./benchmarks/complex.js chalk 969,915 ops/sec cli-color 131,639 ops/sec ansi-colors 342,250 ops/sec kleur 611,880 ops/sec kleur/colors 1,129,526 ops/sec colorette 1,747,277 ops/sec nanocolors 1,251,312 ops/sec + picocolors 2,024,086 ops/sec
But it blocked by alexeyraspopov/picocolors#55
Some colors are not available (and the package version with them has not been published) we can replace them or wait for 1.1.0
SImillar pull requests/issues
chalk
dependency with a lighter alternative jestjs/jest#15189chalk
dependency with a lighter alternative eslint/eslint#18686chalk
dependency withpicocolors
vanilla-extract-css/vanilla-extract#1385chalk
dependency with a lighter alternative facebook/jscodeshift#600I love you Drizzle!