-
Notifications
You must be signed in to change notification settings - Fork 51
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
Support import paths with .gts
extensions
#618
Support import paths with .gts
extensions
#618
Comments
.gts
extensions
@ef4 and I did some spelunking here. As a spike, this issue is fixed by rewriting .gts imports to .ts imports immediately before this line:
The approach to doing this given the current architecture of While working on this, we were very confused that the transformed ast from |
Yeah, this is related to what I had proposed in point 3 of this old comment: #297 (comment) Now that we've stabilized the pure-JS representation of templates in https://github.com/emberjs/rfcs/blob/master/text/0931-template-compiler-api.md, if I had the chance to redo the glint environment API I would want to change it so the environments emit the standard template representation plus source maps, and glint core would only need to understand that. As it is, the environments aren't really allowed to do transformations and thus they leak a lot of knowledge into core. |
The TS compiler APIs don't (or at least didn't, to my knowledge) have a good consistent touchpoint for handing off a modified AST. They do have a transformer interface, but its availability varies across the different invocation versions (check vs watch vs project-build vs language service, etc).
The TS AST (or closer to a CST) is actually quite good at maintaining details about trivia like whitespace, though that also makes it very finicky to work with. In part for that reason, the transform originally used Babel, which was much easier to maintain, but also much slower (not to mention heavier dependency-wise). We now do the bare minimum of node maintenance to ensure we can reserialize the tree back to source code, but it would likely require more detailed effort to make sure we're producing one that will fully pass muster in memory.
As I said in that thread, and in several other contexts since then, the goal was not that Directionally, the idea was that the core transformation logic would become aware of the final syntax and we'd no longer need to maintain an interface for environments to manage transformations.
If you anticipate further experimentation in the syntactic space for how templates are embedded within scripts, then formalizing something like that could be valuable. We initially investigated and discarded the idea of using sourcemaps for handling location mapping, though I don't remember the specifics of that decision any more. It's certainly nice that you get composability 'for free' with that approach. On the other hand, if you don't foresee new embedding mechanisms happening (even if the template syntax itself changes), then my personal take is that effort would be better spent on having The caveat I'll offer on all of the above, though, is that the primary reason I stepped down from the Ember TS team is that I don't have the capacity any more to actively shepherd this project. Given that, if you feel differently about what's worth investing in or see opportunities to simplify functionality that I didn't, then as long as the Ember TS team is on board I certainly won't have any objection. |
Based on the above and reflecting that we may need wider analysis to decide how to adjust glint's packages, I'm going to create a narrow PR to address this specific issue keeping the current architecture. |
This is not resolved -- followup issue here: #628 |
I also opened this here: embroider-build/addon-blueprint#194
But I have a repro here: universal-ember/ember-primitives#114
error looks like this:
Note that
gts
extensions were used in the import path to avoid needing@rollup/plugin-node-resolve
I already have:
so I guess I'd expect it to also work for
gts
extensions?The text was updated successfully, but these errors were encountered: