Skip to content

Commit f934d88

Browse files
committed
types: work around backburner runtime paths shenanigans
The legal runtime import for the `backburner.js` package is apparently `backburner`, but I have not yet been able to identify where that rename occurs. We should ultimately align that to use the package name instead of a custom import specifier, but for now, unblock publishing types from source by rewriting all imports in the emitted types from `'backburner'` to `'backburner.js'`.
1 parent 5cb0cc9 commit f934d88

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

types/publish.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,14 @@ export function rewriteModule(code, moduleName) {
563563
let source = path.node.source;
564564
if (isStringLiteral(source)) {
565565
source.value = normalizeSpecifier(moduleName, source.value);
566+
567+
// This makes it so that the types we publish point to the types defined
568+
// by `backburner.js`, basically doing the type-time equivalent of the
569+
// no good, very bad runtime shenanigans Ember does... *somewhere*... in
570+
// the build to make `import Backburner from 'backburner'` work.
571+
if (source.value === 'backburner') {
572+
source.value = 'backburner.js';
573+
}
566574
}
567575
this.traverse(path);
568576
},

0 commit comments

Comments
 (0)