implement AST validation (#3863)

This commit is contained in:
Alex Lam S.L
2020-05-09 02:58:03 +01:00
committed by GitHub
parent b06fd8a933
commit f74b7f7401
8 changed files with 290 additions and 44 deletions

View File

@@ -85,9 +85,11 @@ function minify(files, options) {
sourceMap: false,
timings: false,
toplevel: false,
validate: false,
warnings: false,
wrap: false,
}, true);
if (options.validate) AST_Node.enable_validation();
var timings = options.timings && {
start: Date.now()
};
@@ -253,5 +255,7 @@ function minify(files, options) {
return result;
} catch (ex) {
return { error: ex };
} finally {
AST_Node.disable_validation();
}
}