-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Upgrade to babel-plugin-ember-template-compilation
v2
#762
Upgrade to babel-plugin-ember-template-compilation
v2
#762
Conversation
require.resolve('babel-plugin-ember-template-compilation'), | ||
{ | ||
precompile, | ||
// As above, we present the AST transforms in reverse order | ||
transforms: [...pluginInfo.plugins].reverse(), |
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.
This new API uses forward order so the reverse()
should not be needed.
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'll double check, but without the reverse
I believe I was seeing inverted execution order compared to what's on master
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.
Ok, well I trust your findings over my memory as long as you're checking.
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 you're right, I think the plugin runs them in the order stated, but it's ember-cli-htmlbars that has always reversed them before handing them onward.
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.
Confirmed: if I register the test plugin twice and log from the PathExpression
visitor, keeping the reverse()
call preserves the same output ordering I see on master
.
I tested this change out on a big app and a very big app, no problems EDIT: both apps are on 3.28 |
The 2.0 release of
babel-plugin-ember-template-compilation
introduces the ability for template AST transforms to manipulate JS scope, but it also reworked the plugin's options format slightly, so we need to adjust how we configure it here.Note: this diff is more legible with the "Hide whitespace changes" button, as a fair chunk of change in
utils.js
is moving logic we no longer need forbabel-plugin-ember-template-compilation
under the other arm of the surrounding conditional.I've tested this out in a couple medium-sized projects that are on Ember 3.27+, but I'd love extra 👀 (particularly from @ef4)