Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions packages/addon-dev/src/rollup-declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,22 @@ async function fixDeclarationsInMatchingFiles(dir: string) {
);
}

// Strip any .gts extension from imports in d.ts files, as these won't resolve. See https://github.com/typed-ember/glint/issues/628
// Once Glint v2 is available, this shouldn't be needed anymore.
// Strip any .gts extension from imports in d.ts files, as these won't resolve.
// See:
// - https://github.com/typed-ember/glint/issues/628
// - https://github.com/typed-ember/glint/pull/999/files
function fixDeclarations(content: string) {
return content
.replace(/from\s+'([^']+)\.gts'/g, `from '$1'`)
.replace(/from\s+"([^"]+)\.gts"/g, `from '$1'`)
.replace(/import\("([^"]+)\.gts"\)/g, `import('$1')`)
.replace(/import\('([^']+)\.gts'\)/g, `import('$1')`);
return (
content
.replace(/from\s+'([^']+)\.gts'/g, `from '$1'`)
.replace(/from\s+"([^"]+)\.gts"/g, `from '$1'`)
.replace(/import\("([^"]+)\.gts"\)/g, `import('$1')`)
.replace(/import\('([^']+)\.gts'\)/g, `import('$1')`)
// ts projects with mixed js (+ .d.ts)
// aka gts with gjs + .gjs.d.ts
.replace(/from\s+'([^']+)\.gjs'/g, `from '$1'`)
.replace(/from\s+"([^"]+)\.gjs"/g, `from '$1'`)
.replace(/import\("([^"]+)\.gjs"\)/g, `import('$1')`)
.replace(/import\('([^']+)\.gjs'\)/g, `import('$1')`)
);
}
Loading