diff --git a/src/fixes/glint.js b/src/fixes/glint.js index 1a8a5a9..269eb7b 100644 --- a/src/fixes/glint.js +++ b/src/fixes/glint.js @@ -39,6 +39,16 @@ export function fixGTSExtensions(contents) { path.node.argument.value = path.node.argument.value.replace(/\.gts$/, ''); }); + root + .find(j.ExportAllDeclaration) + .filter((path) => path.node.source?.value?.includes('.gts')) + .forEach((path) => { + // TODO: this may only be appropriate when + // moduleResolution = "bundler" + // @ts-expect-error + path.node.source.value = path.node.source.value.replace(/\.gts$/, ''); + }); + return root.toSource(); } diff --git a/src/fixes/glint.test.ts b/src/fixes/glint.test.ts index 354939f..443da83 100644 --- a/src/fixes/glint.test.ts +++ b/src/fixes/glint.test.ts @@ -36,6 +36,14 @@ describe('fixGTSExtensions', () => { expect(result).toBe(`export { x } from "./foo";`); }); + test('works on export star', () => { + let code = `export * from './component.gts';`; + + let result = fixGTSExtensions(code); + + expect(result).toBe(`export * from "./component";`); + }); + test('works on inline imports', () => { let code = stripIndent` import("@ember/component/template-only").TOC;