[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.
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.
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 #2There 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.