Skip to content

Account for multiple potential sources in @glint/transform #31

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

Merged
merged 4 commits into from
Dec 3, 2020

Conversation

dfreeman
Copy link
Member

@dfreeman dfreeman commented Dec 3, 2020

This PR is step 1 toward supporting standalone templates (#22). The primary change here is eliminating implicit assumptions about a 1:1 mapping between inputs and outputs in the transformation process.

This is reflected in a few key places:

  • APIs that deal with source-to-source mapping now require specifying which input a source location is tied to for input -> output mapping, and provide that same information for output -> input mapping
  • Errors emitted from the transformation process now include a reference to the source where the error originated
  • ReplacedSpans are now CorrelatedSpans with source attribution, and cover the entire transformed file, rather than only portions that have been rewritten. This simplifies the process of answering offset mapping queries, and gives an explicit answer to the question "where did this content originate" for any location in the transformed output.

Further updates will be required to:

  • actually incorporate the contents of standalone template files into the transformed module
  • handle template-only components
  • teach @glint/cli and @glint/tsserver-plugin how to discover and observe template files

@dfreeman dfreeman added the enhancement New feature or request label Dec 3, 2020
@dfreeman dfreeman merged commit 07193a0 into master Dec 3, 2020
@dfreeman dfreeman deleted the separate-templates branch December 3, 2020 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant