-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace chalk with nanocolors #13783
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1615e42:
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/48901/ |
Seems like I need help with E2E tests, since they are out of this repo:
|
\1. Is probably because Jest depends on |
@nicolo-ribaudo thanks for the advice! I fixed both issues. Just have an issue between Jest and dual CJS/ESM packages like |
I can take a look at it; we have a custom Jest resolver that might cause problems. |
Ugh, I cannot reproduce the failure locally 😕 |
Same for me :-/ I am planning to check Node.js version or randomly change resolver (like adding |
Ok I can reproduce it running |
@SimenB I don't know if it's expected, but this is another case where the I added if (request.includes("nano")) console.log("RESOLVE", request, options); to babel/test/jestExportsMapResolver.cjs Line 28 in 6818b22
I think this happens when loading the I can easily work around the problem, but I'd like to know if it's expected. @ai To make the tests pass, you can replace this line: - const resolver = getResolver(options.conditions || ["default"]);
+ const resolver = getResolver(options.conditions || ["require", "default"]); babel/test/jestExportsMapResolver.cjs Line 29 in 6818b22
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dear Babel maintainers, thank you for all your work. @nicolo-ribaudo
I strongly advise against migrating to nanocolors. Let me explain.
@ai, who is well-known in the JavaScript community for Autoprefixer, PostCSS, etc., shamelessly copied one of my most downloaded node packages (Colorette, >20M/week) and rebranded it as nanocolors.
A substantial amount of work and hours have gone into Colorette over the years, we've fixed numerous bugs and found creative ways to optimize performance, decrease package size, and more. nanocolors blatantly plagiarizes all this work. It's unethical and unprofessional.
Seeing him leverage his notability and following to promote and increase the adoption of nanocolors (eslint/eslint#15102), which he just released a few days ago, is unethical and disgraceful. As an open-source maintainer myself I feel profoundly discouraged.
This is not in the true spirit of open source.
@nicolo-ribaudo could you add a |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
No one has complained to us about Chalk's performance since we fixed it in Chalk v3 (2 years ago), but we are always open to working on improving performance.
I estimate around 20 kB package size and 40 kB install size (32 kB if you exclude the TypeScript types). However, this measurement is flawed too. We could just move all the readme contents to a docs folder (which is not inclduded in the package) to save some kilobytes. Performance like now or better if we manage to optimize for micro-benchmarks.
I'm curious what kind of high scales you're using Nano Colors on where it matters whether it runs 11K or 47K operations a second? And that's just the simple micro-benchmark (which again does not reflect real world usage). In your complex benchmark, Chalk is much closer. |
I just really like micro-optimization. I believe that we are in “Slow Web” because we are systematically moved performance optimizations for later. I prefer Telegram’s (chat) approach when performance is an initial feature of the project, Even when performance optimization is not visible, I want [by my projects] to promote performance-first thinking. For the case of Nano ID or Nano Colors, I am thinking that it is some sort of art: If we are thinking about performance of this smallest part, we will think about performance of the whole system. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
If you were to benchmark a babel/webpack/rollup run for any difference contributed by swapping color-coding libraries, I'm willing to bet, it's not even going to be measurable - if switching colors on the console contributed in any substantial way to the overall performance of these extremely large and complex tools, with all their parsers, compilers, source-maps, and what-have-you, there would have to be something terribly wrong with the performance of the color-coding library. There is nothing that suggests that's the case. To reiterate: this doesn't solve any problem. |
Babel is still mostly on Chalk v2, so perhaps it would be more straightforward just to upgrade it. |
A cursory look through a Github search for If someone would like to PR, feel free to ping me directly if any issues arise. I'll respond ASAP. |
The blocker of chalk upgrade is that Babel 7 still supports Node 6. We can upgrade to Chalk 4 for Babel 8. |
I'm afraid you could at most bump Chalk to version 3 since I believe for now since Babel 7 still supports Node.js 8 (at least requiring Node.js 10 has only been merged for Babel 8 (see theBabel release plan) |
Rollup team member and kinda-rollup-plugins-repo-lead here. This debate is conversational yak shaving. Rollup core wouldn't measurably be effected by ANSI color rendering on the CLI. But yeah we get these kinds of PRs as well. First it was (As a non-biased disclaimer I personally use |
This thread is just getting silly (if not outright abusive) - I'll unsubscribe so I avoid getting it anywhere in my feed. @nicolo-ribaudo I'd love to figure out the Jest bug - feel free to ping me from some other issue (or create an issue in Jest's tracker and tag me) |
@SimenB - I might have ended up here after everyone but I only see leftover discussion and people making compelling arguments and working out conflict constructively. The communication from the project and from chalk/ colorette / nanocolors maintainers (at least not deleted) seems very reasonable and even though people are disagreement they are having a conversation. I don't have a horse in the "what library to use here?" race - I just wanted to provide positive feedback about how the discussion has been going with everyone respecting each other and the project and everyone trying to communicate constructively even though things got heated. Honestly I am even considering bringing this up to the Node.js moderation team so we can study how the conflict was successfully de-escalated... |
Just some context for anyone coming in late: There were a few comments that were objectively abusive. The author has since been banned from Github and thus the comments have been deleted. I believe SimenB was referring to those, not the good-faith discussion prior. Try not to mis-interpret his comment as such 🙃 There's a slight chance it'll happen again so keep that in mind moving forward with the thread. For whatever reason this PR has garnered a lot of eyes. |
I ask again to everyone that will come in the future to keep the thread clean for PR-related comments, please. |
The comment I was referring to has been deleted, so mine looks a bit out of context. That said, I'll once again unsubscribe from this PR - please don't tag me again here (GH seemingly has no option for muting a thread) ❤️ (The entire PR can probably be closed as the module has been deprecated: ai/nanocolors@bb8e666) |
I deprecated Give me a day, I will close this PR and create another one. |
I don't want to be subscribed to this issue, please don't tag me (mods: feel 100% free to hide/delete my comments) |
Another 0.x package released a week ago? Please copy and paste all my previous comments. (and if you hadn't seen it, the maintainer of that package makes fun of you @ai personally, in the README.) This whole story now a farce - over a change that nobody needs or asked for. |
Perhaps this clarification is unnecessary, but given all the earlier drama: the comment in that package is just poking fun - the interactions between the authors on Twitter and in pull requests have been nothing but constructive. |
In Nano Colors repo they stated that the lib is deprecated and suggest using Pico Colors instead:
|
All my projects was moved to I am closing the PR for now. I hope it will help from trolls and off-topic. |
Fixes #1, Fixes #2
I color output library from
chalk
to Nano Colors. Reasons:node_modules
.chalk
has 5 dependencies and takes 101 kB.import { red } from 'nanocolors'
.tty
,TERM
,NO_COLOR
,FORCE_COLOR
env variables. It is ready for Windows and CI.