0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 10:47:18 +08:00
discourse/frontend/asset-processor/rollup-plugins/discourse-hbs.js

28 lines
820 B
JavaScript
Vendored

export default function discourseHbs() {
return {
name: "discourse-hbs",
transform: {
order: "pre",
handler(input, id) {
if (id.endsWith(".hbs")) {
return {
code: `
import { hbs } from 'ember-cli-htmlbars';
export default hbs(${JSON.stringify(input)}, { moduleName: ${JSON.stringify(id)} });
import deprecated from 'discourse/lib/deprecated';
deprecated(
"The file '${id}' uses the deprecated .hbs extension. Refactor it to use '.gjs' instead.",
{
id: "discourse.hbs-extension",
url: "https://meta.discourse.org/t/398896",
}
);
`,
map: null,
};
}
},
},
};
}