Upgrade to latest 6.1.2 Espree version.

The attachComment option is removed that's why CommentTransformer refactored to emulate the old behaviour.
This commit is contained in:
Dmitry Zamotkin
2019-12-02 23:35:14 +03:00
parent 2ff9f2cd17
commit dfe704d3ba
11 changed files with 80 additions and 53 deletions
+3 -5
View File
@@ -28,12 +28,8 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
* @type {Options}
*/
private static readonly espreeParseOptions: espree.ParseOptions = {
attachComment: true,
comment: true,
ecmaFeatures: {
experimentalObjectRestSpread: true
},
ecmaVersion: 9,
ecmaVersion: 10,
loc: true,
range: true
};
@@ -160,6 +156,8 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
* @returns {Program}
*/
private transformAstTree (astTree: ESTree.Program): ESTree.Program {
astTree = this.runTransformationStage(astTree, TransformationStage.Initializing);
const isEmptyAstTree: boolean = NodeGuards.isProgramNode(astTree)
&& !astTree.body.length
&& !astTree.leadingComments