unjs / consola

🐨 Elegant Console Logger for Node.js and Browser
Other
6.12k stars 175 forks source link

feat: re-export `chalk` #166

Closed antfu closed 1 year ago

antfu commented 1 year ago

This allows users to construct custom colors without duplicating the color library.

pi0 commented 1 year ago

This is nice idea if we keep using chalk but since consola is also likely to drop it, it can introduce more breaking changes.

Have you tried https://github.com/jorgebucaran/colorette ?

antfu commented 1 year ago

For sure!

We use picocolors all over the Vite ecosystem. If I recall correctly, it is the faster one. But I am also open for other choices (any of them would work perfectly tbh, no much opinions)

pi0 commented 1 year ago

I chose colorette mainly because it is tree-shakable and looking at code, super small and thinking to use it across unjs projects (including citty but probably also next major version of consola)

pi0 commented 1 year ago

Not that we need this perf but interesting :D

image
ntnyq commented 1 year ago

https://github.com/sindresorhus/yoctocolors is much more smaller and better at perf, but it's ESM only.

pi0 commented 1 year ago

Thanks for referencing. Yes that seems good too but more stricter (in unjs ecosystem we keep supporting CJS as much as possible).

I think for now it is best to not reexport chalk from consola and start advocating / using colorette for cases like nuxt. Seems most promising option for me atm.

Thanks for PR idea anyway @antfu ❤️