Skip to content

Commit fb38eb5

Browse files
committed
use latest JS version in acorn parser
1 parent 7d809d7 commit fb38eb5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/execute/ojs/extract-resources.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,17 @@ quarto will only generate javascript files in ${
446446
}
447447

448448
let fixedSource = jsSource;
449-
450-
const ast = parseES6(jsSource, {
451-
ecmaVersion: "2020",
452-
sourceType: "module",
453-
});
449+
let ast: any = undefined;
450+
try {
451+
ast = parseES6(jsSource, {
452+
ecmaVersion: "latest",
453+
sourceType: "module",
454+
});
455+
} catch (e) {
456+
console.error(jsSource);
457+
console.error("Error parsing compiled typescript file.");
458+
throw e;
459+
}
454460
const recursionList: string[] = [];
455461
// deno-lint-ignore no-explicit-any
456462
const patchDeclaration = (node: any) => {

0 commit comments

Comments
 (0)