Replace picocolors with node:util.styleText() in @babel/code-frame#17678
Replace picocolors with node:util.styleText() in @babel/code-frame#17678nicolo-ribaudo merged 10 commits intobabel:mainfrom
picocolors with node:util.styleText() in @babel/code-frame#17678Conversation
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
I think it's fine if we make it so in the browser it throws when trying to force colors.
|
b71cfd3 to
e624503
Compare
|
Unfortunately, we do not support conditional export of |
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/60821 |
d054721 to
77dd463
Compare
|
The CI error is relevant, but it appears to have existed before. |
f7fc364 to
469a3cd
Compare
|
Other PR merged |
|
commit: |
|
Thanks for your help! |
|
|
||
| export function highlight(code: string) { | ||
| return code; | ||
| } |
There was a problem hiding this comment.
I remember I shared some code between two versions.
Will this make it harder to maintain having duplicate logic?
There was a problem hiding this comment.
I've forgotten why I restored them...
Now I've made them shared again.
| if (process.emitWarning) { | ||
| // A string is directly supplied to emitWarning, because when supplying an | ||
| // Error object node throws in the tests because of different contexts | ||
| process.emitWarning(message, "DeprecationWarning"); |
There was a problem hiding this comment.
This should be removed from browser version.
69adf2f to
08a21c1
Compare
| return ` ${gutter}${line.length > 0 ? ` ${line}` : ""}`; | ||
| } | ||
| }) | ||
| .join("\n"); |
There was a problem hiding this comment.
If we pass {gutter, marker, message} as argument, we should be able to share these 40 lines?
There was a problem hiding this comment.
I've removed the coloring logic, it's actually the content. :)
There was a problem hiding this comment.
I know, but we can still pass these 3 empty functions.
| "exports": { | ||
| ".": { | ||
| "types": "./lib/index.d.ts", | ||
| "browser": "./lib/browser.cjs", |
There was a problem hiding this comment.
Let's do this in a separate PR
Fixes #1, Fixes #2styleTextis available in browser, how do we process?Fixes #16945
Closes #14555