Introduce environments #9
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Up to now,
@glint/template
contained a kind of hodge-podge of knowledge about keywords and globals available in different contexts (GlimmerX vs Glimmer.js vs Ember etc), while@glint/cli
and@glint/tsserver-plugin
were both hard-coded to look for@glimmerx/component
in a module to determine whether to attempt template transformation.This PR introduces the notion of an environment that a given project is targeting. An environment specifies information used in transforming templates (such as where to look for tag imports from) as well as exposing signatures for the available keywords/globals and determining how userspace entities (like components and custom helpers) interact with the type system.
Down the line, if we consider things like supporting current Ember idioms, environments may also influence things like whether templates can "see" in-scope identifiers or not.
Notes
.glintrc
file is now required in order to determine the active environment for a project@glint/transform
no longer references@glint/template
, but rather the configured environment (which likely re-exports a number of types from@glint/template
)@glint/cli
and@glint/tsserver-plugin
now stage their test apps undertest-packages/ephemeral
rather than in system tmp, as package resolution starts to get wonky otherwise (PnP would be the 'real' solution for this... someday 😭)@glint/template
(its exports, not its internals) is likely coming, but not something that needs to be tangled up with this