Skip to content

A platform for community discussion. Free, open, simple.

DEV: Parse TypeScript test modules in wrap-test-modules plugin (#41636)

Sérgio Saquetim2e302a8879bb
diff --git a/frontend/discourse/lib/wrap-test-modules-plugin.mjs b/frontend/discourse/lib/wrap-test-modules-plugin.mjs
index cdc84a38e60..ff85f35b39e 100644
--- a/frontend/discourse/lib/wrap-test-modules-plugin.mjs
+++ b/frontend/discourse/lib/wrap-test-modules-plugin.mjs
@@ -5,9 +5,7 @@ export default function wrapTestModulesPlugin() {
name: "wrap-test-modules",
transform: {
filter: { id: TEST_FILE_RE },
- handler(code, id, { magicString }) {
- const ast = this.parse(code);
-
+ handler(code, id, { ast, magicString }) {
let lastImportEnd = 0;
for (const node of ast.body) {
if (node.type === "ImportDeclaration") {
diff --git a/frontend/discourse/rolldown.config.mjs b/frontend/discourse/rolldown.config.mjs
index 6e6b8e7780a..e48dfbb7ccd 100644
--- a/frontend/discourse/rolldown.config.mjs
+++ b/frontend/discourse/rolldown.config.mjs
@@ -84,6 +84,8 @@ export function buildConfig({ devMode } = {}) {
},
moduleTypes: {
".wasm": "asset",
+ ".gjs": "js",
+ ".gts": "ts",
},
input: {
discourse: "discourse.js",