You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given some effort, this can probably made to work with older LTS versions. The implementation strategy is actually straightforward and just transpiles the templates into basic syntax like {{#if}}{{else}} and helper calls.
If there is demand to support older Ember version, we can probably make it happen. I am unlikely to do it myself, but would be happy to guide someone else to do it. Here are some pointers.
So far, the main limitation is that it requires a tiny change in the tokenizer in order to parse named blocks correctly. Without this change, <:foo> is parsed into the same thing as <foo>. This change has been backported to the latest version of LTS 3.12 and 3.16.
On older LTS, backporting the change is not an option. Instead, we can do one of these:
Try to monkey patch the tokenizer change into the template compiler at runtime. This is plausible but the code is nested deep inside the template compiler's module and it's not trivial to get too.
Try to use the source location information on the ElementNode and read back into the original source to see if there was a colon in there. This could work, but I'm not sure how robust it will be, given the source location is not super reliable on old versions of the template compiler, and it may be completely wrong if it was touched by other AST plugins before us.
Bundle a recent version of the ember or glimmer template compiler, use it a broccoli build step to preprocess all template files – parse it with the new template compiler and our AST plugin, then reprint the result as handlebars source, before passing them into the version of ember template compiler used by the app. This is probably the most robust solution, and building out the infrastructure to do this is something that could benefit future work in polyfilling template features as well as helping V2 addons. Unfortunately, I'm not exactly sure how to do this myself, so you will probably need to ask for help from someone on the Ember CLI team.
The text was updated successfully, but these errors were encountered:
Given some effort, this can probably made to work with older LTS versions. The implementation strategy is actually straightforward and just transpiles the templates into basic syntax like
{{#if}}
{{else}}
and helper calls.If there is demand to support older Ember version, we can probably make it happen. I am unlikely to do it myself, but would be happy to guide someone else to do it. Here are some pointers.
So far, the main limitation is that it requires a tiny change in the tokenizer in order to parse named blocks correctly. Without this change,
<:foo>
is parsed into the same thing as<foo>
. This change has been backported to the latest version of LTS 3.12 and 3.16.On older LTS, backporting the change is not an option. Instead, we can do one of these:
Try to monkey patch the tokenizer change into the template compiler at runtime. This is plausible but the code is nested deep inside the template compiler's module and it's not trivial to get too.
Try to use the source location information on the
ElementNode
and read back into the original source to see if there was a colon in there. This could work, but I'm not sure how robust it will be, given the source location is not super reliable on old versions of the template compiler, and it may be completely wrong if it was touched by other AST plugins before us.Bundle a recent version of the ember or glimmer template compiler, use it a broccoli build step to preprocess all template files – parse it with the new template compiler and our AST plugin, then reprint the result as handlebars source, before passing them into the version of ember template compiler used by the app. This is probably the most robust solution, and building out the infrastructure to do this is something that could benefit future work in polyfilling template features as well as helping V2 addons. Unfortunately, I'm not exactly sure how to do this myself, so you will probably need to ask for help from someone on the Ember CLI team.
The text was updated successfully, but these errors were encountered: