-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Inline HBS Reform #462
Inline HBS Reform #462
Conversation
It doesn't belong in here.
- drop modules-api-polyfill - drop proposal syntaxes
and update tests to use the newest standard by default
Before we were inheriting old ones from some dep of ours.
This lets us interop with other plugins that are inserting calls to our modules.
So we have a pure JS implementation with no node dependencies that can be built for the browser.
I believe this was necessary for when this plugin had to layer cleanly on top of/before the Ember modules polyfill. There ended up being so many edge cases there that we had to just ship modules, or it wouldn't fully work 🙃 |
This branch is instead becoming a separate repo: https://github.com/emberjs/babel-plugin-ember-template-compilation
|
This accompanies embroider-build/embroider#893 and similar PRs to ember-cli-htmlbars and ember-template-imports will be forthcoming.
This is a radical simplification of this plugin, along with a full port to typescript. The main reason we can simplify is that we're dropping support for Ember versions that need modules-api-polyfill (a source of much pain and complexity when it comes to composing babel plugins).
I have confirmed that other consumers of template compilation like Embroider and ember-template-imports can use their own standalone babel plugins that compose nicely with this one, so they can emit
precompileTemplate
, and this plugin will handle that with one shared implementation.Along with this, I'd prefer to rename this package
@ember/template-compilation
, because that's its public API:The older patterns like
import { hbs } from 'ember-cli-htmlbars'
are still available, but are understood to be sugar forprecompile
, becauseprecompile
is a superset of all the rest and it should be understood as the foundational primitive for all template compilation in Ember. Even standalone.hbs
files are conceptually sugar forexport default precompileTemplate(...)
. The actual rename will presumably need an RFC.This cuts all the special ember-template-imports support from this plugin, since it doesn't belong here and was only entangled due to the cruft we have removed. I'll have a PR to ember-template-imports porting its code back into there.
In the process of porting to typescript, several real edge case crashes were found, like not handling spread elements within the options we parse.
There was also a whole dance of
registerRefs
that was having no effect at all, perhaps it was only needed on older babel versions.