discourse/app/assets/javascripts/asset-processor/rollup-plugins/discourse-gjs.js
David Taylor 585ba17f56
DEV: Rename theme-transpiler to asset-processor (#35498)
This is already used for more than just themes, and we plan to extend
its usage even further
2025-10-20 14:16:46 +01:00

26 lines
572 B
JavaScript
Vendored

import { Preprocessor } from "../content-tag";
const preprocessor = new Preprocessor();
export default function discourseGjs() {
return {
name: "discourse-gjs",
transform: {
// Enforce running the gjs transform before any others like babel that expect valid JS
order: "pre",
handler(input, id) {
if (!id.endsWith(".gjs")) {
return null;
}
let { code, map } = preprocessor.process(input, {
filename: id,
});
return {
code,
map,
};
},
},
};
}