discourse/frontend/discourse/lib/babel-transform-module-renames.js
Jarek Radosz 1ffbb44ab8
DEV: Move more packages into discourse app dir (#35816)
This time (following the admin move) - select-kit, float-kit,
truth-helpers, and dialog-holder

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-11-06 17:56:18 +01:00

16 lines
516 B
JavaScript

// https://astexplorer.net/#/gist/14696755417f9d41c8c2bd72c187b0da/41a903d14d860270fa4eefab69c8ae8934971cdc
export default function ({ types: t }) {
return {
visitor: {
ImportDeclaration(path) {
const moduleName = path.node.source.value;
if (
/^(admin|select-kit|float-kit|dialog-holder)\//.test(moduleName) ||
moduleName.startsWith("truth-helpers")
) {
path.node.source = t.stringLiteral(`discourse/${moduleName}`);
}
},
},
};
}