mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-24 02:41:20 +08:00
This is already used for more than just themes, and we plan to extend its usage even further
26 lines
572 B
JavaScript
Vendored
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,
|
|
};
|
|
},
|
|
},
|
|
};
|
|
}
|