also transforming of File asts
This commit is contained in:
@@ -7,9 +7,13 @@ import * as t from "babel-types";
|
||||
*/
|
||||
|
||||
export default function (ast, comments, tokens) {
|
||||
if (ast && ast.type === "Program") {
|
||||
return t.file(ast, comments || [], tokens || []);
|
||||
} else {
|
||||
throw new Error("Not a valid ast?");
|
||||
if (ast) {
|
||||
if (ast.type === "Program") {
|
||||
return t.file(ast, comments || [], tokens || []);
|
||||
} else if (ast.type === "File") {
|
||||
return ast;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Not a valid ast?");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user