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
[babel 8] Remove getChalk
function
#15812
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/54949/ |
I guess |
Yeah thanks, I was just reading #15499 (comment) some minutes ago :) |
e53303d
to
ce1b708
Compare
385d98e
to
f1c29e8
Compare
CI is finally green |
let chalkWithForcedColor: Chalk = undefined; | ||
function getChalk(forceColor: boolean) { | ||
if (forceColor) { | ||
chalkWithForcedColor ??= new chalk.constructor({ enabled: true, level: 1 }); |
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.
If forceColor
is true
, getChalk
will return a memoized chalk instance, previously it returned a new instance. The new behaviour aligns with the one when forceColor
is false
.
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.
Yeah I noticed it while changing this -- I think it's ok, it has the benefit of allocating less objects (+ as you noted aligning with forceColor: false
) and no actual disadvantages.
Can you update babel/website#2765? |
Fixes #1, Fixes #2
There is no good reason for us to have chalk exposed as part of our public API, and it's making the upgrade to v4/5 incredibly complex.