Skip to content

Commit bfe710d

Browse files
Fixed handling of Babel parse failures
1 parent 608059a commit bfe710d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -308,18 +308,18 @@ const createJSAst = async (options) => {
308308
try {
309309
const ast = fileToJsAst(file);
310310
writeAstFile(file, ast, options);
311-
} catch (err) {
312-
console.error(file, err.message);
313-
}
314-
if (ts) {
315-
try {
316-
const tsAst = ts.program.getSourceFile(file);
317-
tsc.forEachChild(tsAst, ts.addType);
318-
writeTypesFile(file, ts.seenTypes, options);
319-
ts.seenTypes.clear();
320-
} catch (err) {
321-
console.warn("Retrieving types", file, ":", err.message);
311+
if (ts) {
312+
try {
313+
const tsAst = ts.program.getSourceFile(file);
314+
tsc.forEachChild(tsAst, ts.addType);
315+
writeTypesFile(file, ts.seenTypes, options);
316+
ts.seenTypes.clear();
317+
} catch (err) {
318+
console.warn("Retrieving types", file, ":", err.message);
319+
}
322320
}
321+
} catch (err) {
322+
console.error("Parsing", file, ":", err.message);
323323
}
324324
}
325325
} catch (err) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@joernio/astgen",
3-
"version": "3.10.0",
3+
"version": "3.12.0",
44
"description": "Generate JS/TS AST in json format with Babel",
55
"exports": "./index.js",
66
"keywords": [

0 commit comments

Comments
 (0)