Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Support for Glimmer AST Plugins #141

Closed
amiller-gh opened this issue Mar 19, 2018 · 8 comments
Closed

Support for Glimmer AST Plugins #141

amiller-gh opened this issue Mar 19, 2018 · 8 comments

Comments

@amiller-gh
Copy link
Contributor

Expectiation

I can easily supply custom Glimmer AST plugins either in ember-cli-build.js, or via an addon.

Behavior

The invocation site for GlimmerJSONCompiler has no mechanism to pass Glimmer AST plugins provided in ember-cli-build.js to the underlying ember-build-utils GlimmerTemplatePrecompiler, despite plugins being supported by the ember-build-utils.

It would be helpful if addons could also provide plugins programmatically! This would probably require more architecting than just passing in plugins from ember-cli-build.js.

Related: #139. glimmer-app currently does nothing with registered template preprocessors. This makes it that much more difficult to work around the lack of Glimmer plugin support.

@amiller-gh
Copy link
Contributor Author

Please let me know if I've missed any features that already enable this use case 🙂

@rwjblue
Copy link
Member

rwjblue commented Mar 19, 2018

Ya, we can leverage the registry (like is done in ember-cli-htmlbars) to allow addons to register their custom AST plugins, then pass them forward to GlimmerJSONCompiler...

@amiller-gh
Copy link
Contributor Author

Awesome. Happy to help add a glimmer-ast-plugin registry type to the project.

Also, wow ember-cli-htmlbars is... "creative" I believe is the polite word 😅If I'm reading it right though, it looks like it should do exactly what this issue is requesting for Glimmer, but in an Ember project.

Ember addons hoping to provide ast plugins for both an Ember and Glimmer project would register both a glimmer-ast-plugin and an htmlbars-ast-plugin, correct?

@rwjblue
Copy link
Member

rwjblue commented Mar 19, 2018

Exactly! Also, the htmlbars-ast-plugins are expected to be the older style (e.g. a class { transform() {} }) now that Ember supports the newer style we should add that to ember-cli-htmlbars too...

@rwjblue
Copy link
Member

rwjblue commented Mar 19, 2018

Also, wow ember-cli-htmlbars is... "creative" I believe is the polite word

confirm 😉

@amiller-gh
Copy link
Contributor Author

Looks like we'll need a 3.2.0 release of ember-cli-preprocessor-registry that includes your updates to registry.add so we can actually register the new ASTPluginBuilder type. I have it working locally with ember-cli-preprocessor-registry@master 👍

@amiller-gh
Copy link
Contributor Author

Also of note:

GlimmerBundleCompiler from @glimmer/app-compiler needs to accept an array of ASTPluginBuilders in its options hash, like how GlimmerTemplatePrecompiler from ember-build-utilities does.

@amiller-gh
Copy link
Contributor Author

Closed with #145

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants