Skip to content
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

Drop hbs tag support in ember-template-imports #465

Merged
merged 6 commits into from
Nov 22, 2022

Conversation

dfreeman
Copy link
Member

Aligning with the discussion in ember-cli/ember-template-imports#18, this PR drops support for the hbs string tag from ember-template-imports. The expectation is that ember-template-imports itself is going to deprecate hbs soon, and since we have a good opportunity to make breaking changes at the moment, the @glint/environment-ember-template-imports package now only operates on <template> literals.

@dfreeman dfreeman added the breaking A breaking change label Nov 21, 2022
@dfreeman
Copy link
Member Author

I didn't realize how many tests we had that were using hbs from ember-template-imports 😩

TypeScript had to rework a few bits of their AST in light
of how decorators shook out for stage 3.
@chriskrycho
Copy link
Member

BRUTAL.

Thanks for doing this!

@dfreeman
Copy link
Member Author

Swapping tests over to .gts uncovered some scenarios where custom extensions weren't playing nicely with --build and --incremental modes, and it also motivated me to finally fix the "we leave <template> in your file and generate a million errors if you have one syntax error in your template" papercut, so overall this should now be a nice little bundle of DX improvements for ETI users.

Hopefully CI agrees 🤞

@chriskrycho
Copy link
Member

Oh, interesting catch and good fix on the build and incremental modes.

Previously we just left the original source file untouched,
which was fine for embedded tagged strings, but causes
a cascade of syntax errors if we leave `<template>` around.
@dfreeman dfreeman merged commit 48af607 into main Nov 22, 2022
@dfreeman dfreeman deleted the drop-template-imports-hbs branch November 22, 2022 14:26
@flashios09
Copy link

flashios09 commented Jan 20, 2023

@dfreeman I don't understand why hbs was removed !
The <template> syntax isn't compatible with typescript(.ts), force the usage of the .gts/.gjs extension
Why we can't just keep the 2 solutions for .ts and .gts/.gjs ?

With typescript(.ts):

import Component from "@glimmer/component";
import { action } from "@ember/object";
import { on } from "@ember/modifier";
import { hbs } from "ember-template-imports";

export default class MyButton extends Component {
  @action
  onClick() {
    // do something
  }
  static template = hbs(`
    <button type="button" {{on "click" this.onClick}}>{{yield}}</button>
  `, { scope: () => ({ on }) });
}

@chriskrycho
Copy link
Member

Because that’s what we decided to do as a community with emberjs/rfcs#779!

@flashios09
Copy link

@chriskrycho Does this mean that we will not be able to write SFC in typescript(.ts) anymore ?

@chriskrycho
Copy link
Member

Yes, the plan is to align everyone on .gts. 😄

@flashios09
Copy link

Ah ok, thanks, it does make sense now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants