Add rollup declarations plugin #2200
Open
+272
−4
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.
This invokes glint as a rollup plugin, and contains a workaround for broken gts imports, see typed-ember/glint#628.
This is an attempt to fix this long standing issue, which Glint v2 seems to fix. But we want this to work now, so v2 addons have a blessed way to support gts files. It's influenced by previous attempts (embroider-build/addon-blueprint#255, embroider-build/addon-blueprint#292), but takes a slightly different approach:
@embroider/addon-dev
so people don't have inlined plugin code in their rollup configjscodeshift
to rewrite broken imports (strip the.gts
extension), but I was hesitant to bring in that large dependency for that simple task. Rewriting import paths using a simple regex seems safe enough to me, especially since this is operating only on Glint-emitted code (no custom formatting expected)glint
executableThe long-term idea is that once Glint v2 is out, we can use that for the plugin, removing the workaround and ideally invoking programmatic Glint APIs instead of spawning it as a new process. But all of that without causing much churn for users, as they should be able to keep their rollup config unchanged.
Here is how this would be eventually adopted in the blueprint: embroider-build/addon-blueprint#315