-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
(tests) Log transform- instead of proposal- in preset-env
#15473
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
(tests) Log transform- instead of proposal- in preset-env
#15473
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/54237/ |
transform- instead of proposal- in `preset-env- debugtransform- instead of proposal- in preset-env debug
JLHwung
left a comment
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.
I think changing logs here will be confusing to end users. Take proposal-optional-chaining for example:
- We haven't published
@babel/plugin-transform-optional-chainingyet - There aren't docs for
@babel/plugin-transform-optional-chainingon our website, and we don't have redirection rule to theproposal-*transform
So users will have to mentally match some transform-* debug output to the exact proposal-* one. They probably won't know which transform-* is actually proposal-* until when they hit a npm 404 error, which seems more like a Babel bug to them than a polish to us...
As for fixture changes, I think we may have to duplicate all debug fixtures to babel 8.
Can we start the renaming process gradually? We can publish transform-* in the next minor and make proposal-* an alias to the transform-* plugins, then we archive the proposal-* plugins and have preset-env directly using transform-* plugins, so the debug log is consistent.
|
That plan sounds good 👍 Wdyt if I update this PR to only unify the fixtures (without actually changing what our users see), while working on the rename in parallel? I'd like to avoid duplicating the fixtures, because in practice it means that we have to run the tests twice every time we want to update snapshots (which is easy to forget, until you see the error on CI). |
transform- instead of proposal- in preset-env debugtransform- instead of proposal- in preset-env debug
4f3c010 to
cd9cede
Compare
| // the output logs so that we don't have to duplicate all the debug fixtures for | ||
| // the two different Babel versions. | ||
| // TODO(Babel 8): Remove this. | ||
| result = result.replace(/(\s+)proposal-/gm, "$1transform-"); |
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.
The normalizeOutput is also applied to the transformed code. Can we make a new flag, e.g. normalizePresetEnvDebug like we did for normalizePathSeparator? Then we can enable this flag only when we are validating logs, preferably from preset-env only. So the fixture runner won't accidentally replace proposal- to transform- out of the preset-env scope.
cd9cede to
fae1e27
Compare
transform- instead of proposal- in preset-env debugtransform- instead of proposal- in preset-env
The main reason for this PR is to reduce the output difference between Babel 8 and Babel 7, which is quite annoying (I noticed it while reviewing #15068)
As mentioned in #14976 (comment), this change is only about how we present the log and I don't think it counts as a breaking change.
Users can already use options like
"exclude": ["transform-class-static-blocks"](even if technically the npm package name uses-proposal-), so it's ok to also use it in the debug logs. Most users should only use the preset and not the individual packages anyway, and this hides from them the distinction between "transform" and "proposal that become Stage 4 since when the plugin was released", which is just historical and doesn't matter in practice.