Replace chalk with picocolors#2736
Draft
kravetsone wants to merge 6 commits into
Draft
Conversation
Replace `chalk` with `picocolors` for better perfomance and reduce bundle size
|
I recommend reading this: https://github.com/chalk/chalk#why-not-switch-to-a-smaller-coloring-package |
Contributor
Author
in our case, it makes no sense to rely on chalk. he is by nature not so small and fast. but for your smaller alternative, thank you! yoctocolors and colorette is also fine and we can use it too. I think it's worth waiting for a response from one of the core team drizzle. but in fact, even chalk is not very critical here. |
|
It seems that picocolors released version 1.1.0 featuring bright colors variant. Can this be unblocked? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
chalkwithpicocolorsfor better perfomance and reduce bundle size.Benchmarks from
picocolorsrepoBenchmarks
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 kBLibrary 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 msBenchmark 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/secBenchmark 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/secBut 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
chalkdependency with a lighter alternative jestjs/jest#15189chalkdependency with a lighter alternative eslint/eslint#18686chalkdependency withpicocolorsvanilla-extract-css/vanilla-extract#1385chalkdependency with a lighter alternative facebook/jscodeshift#600I love you Drizzle!