From 7142c55a8316e19680ad50798c0835bea7f6ec57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Fri, 16 Aug 2024 18:09:51 +0200 Subject: [PATCH] Support more JS extensions in syntax-parser (#10615) --- packages/replay-next/src/utils/syntax-parser.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/replay-next/src/utils/syntax-parser.ts b/packages/replay-next/src/utils/syntax-parser.ts index 718e00260da..c45f2b2f2a2 100644 --- a/packages/replay-next/src/utils/syntax-parser.ts +++ b/packages/replay-next/src/utils/syntax-parser.ts @@ -134,12 +134,17 @@ function urlToLanguage(fileName: string): LRLanguage { const extension = fileName.split(".").pop()!.split("?").shift()!; switch (extension) { case "js": + case "mjs": + case "cjs": return javascriptLanguage; case "jsx": return jsxLanguage; case "ts": return typescriptLanguage; case "tsx": + // .mts and .cts follow .tsx parsing rules (they don't support angle bracket casting and they allow JSX) + case "mts": + case "cts": return tsxLanguage; case "json": return jsonLanguage;