emberjs / babel-plugin-ember-template-compilation

Babel implementation of Ember's low-level template-compilation API
9 stars 11 forks source link

pass correct scope to glimmer #33

Closed patricklx closed 5 months ago

patricklx commented 6 months ago

It was in a sense useful that it would prematurely catch missing imports or definitions for template locals. But with today's state of glint and eslint we do not really need this anymore. It also prevents use of web components and specifying components for known html elements did also not work. also fixes usage of svg elments

fixes https://github.com/glimmerjs/glimmer-vm/issues/1550

look at https://github.com/emberjs/babel-plugin-ember-template-compilation/pull/33/commits/df34cb4cfce9200eb119281937288ac24ee01906 for tests diff

patricklx commented 6 months ago

Not ready after all, block params scope should not apply to own attributes or modifiers. Currently that happens. Not sure why the tests are passing. I'm refactoring this

ef4 commented 5 months ago

@patricklx and I paired on this and it's getting close to done. The remaining task is to add a test for removing things from locals, because we think we might not have that case done yet.

ef4 commented 5 months ago

While testing this I realized we're now doing too much. In the explicit scope form, we're not supposed to magically bind to javascript values in scope. That's only supposed to happen to the implicit form (the one that has eval to indicate that it has access to all surrounding javascript scope).

The only modifications we should be making to the scope bag in explicit form are modifications explicitly asked for by AST transforms. (Dropping unused names is also a safe transformation and can stay.)

patricklx commented 5 months ago

@ef4 reverted some parts and updated tests

ef4 commented 5 months ago

Thanks for all the work on this. Released in 2.2.2.