Quellcode durchsuchen

Migrate to ESTree WIP BROKEN

sanex3339 vor 8 Jahren
Ursprung
Commit
5d2220c18a
58 geänderte Dateien mit 335 neuen und 548 gelöschten Zeilen
  1. 45 45
      dist/index.js
  2. 12 12
      package.json
  3. 3 3
      src/JavaScriptObfuscatorInternal.ts
  4. 29 32
      src/NodeUtils.ts
  5. 16 29
      src/Nodes.ts
  6. 8 8
      src/Obfuscator.ts
  7. 7 6
      src/custom-nodes/AbstractCustomNode.ts
  8. 3 3
      src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts
  9. 4 3
      src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts
  10. 4 3
      src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts
  11. 4 3
      src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts
  12. 4 4
      src/custom-nodes/domain-lock-nodes/DomainLockNode.ts
  13. 3 3
      src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts
  14. 6 5
      src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts
  15. 6 5
      src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts
  16. 6 5
      src/custom-nodes/unicode-array-nodes/UnicodeArrayNode.ts
  17. 6 5
      src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts
  18. 2 2
      src/interfaces/INodeObfuscator.d.ts
  19. 2 2
      src/interfaces/IObfuscator.d.ts
  20. 0 3
      src/interfaces/nodes/IArrowFunctionExpressionNode.d.ts
  21. 0 7
      src/interfaces/nodes/IBlockStatementNode.d.ts
  22. 0 9
      src/interfaces/nodes/ICallExpressionNode.d.ts
  23. 0 8
      src/interfaces/nodes/ICatchClauseNode.d.ts
  24. 0 7
      src/interfaces/nodes/IExpressionStatementNode.d.ts
  25. 0 3
      src/interfaces/nodes/IFunctionDeclarationNode.d.ts
  26. 0 3
      src/interfaces/nodes/IFunctionExpressionNode.d.ts
  27. 0 14
      src/interfaces/nodes/IFunctionNode.d.ts
  28. 0 5
      src/interfaces/nodes/IIdentifierNode.d.ts
  29. 0 8
      src/interfaces/nodes/IIfStatementNode.ts
  30. 5 0
      src/interfaces/nodes/ILiteral.d.ts
  31. 0 7
      src/interfaces/nodes/ILiteralNode.d.ts
  32. 0 9
      src/interfaces/nodes/IMemberExpressionNode.d.ts
  33. 0 12
      src/interfaces/nodes/IMethodDefinitionNode.d.ts
  34. 4 3
      src/interfaces/nodes/INode.d.ts
  35. 0 6
      src/interfaces/nodes/IObjectExpressionNode.d.ts
  36. 0 8
      src/interfaces/nodes/IProgramNode.d.ts
  37. 0 12
      src/interfaces/nodes/IPropertyNode.d.ts
  38. 0 7
      src/interfaces/nodes/ISpreadElementNode.d.ts
  39. 0 7
      src/interfaces/nodes/IVariableDeclarationNode.d.ts
  40. 0 7
      src/interfaces/nodes/IVariableDeclaratorNode.d.ts
  41. 3 2
      src/node-obfuscators/AbstractNodeObfuscator.ts
  42. 6 8
      src/node-obfuscators/CatchClauseObfuscator.ts
  43. 7 9
      src/node-obfuscators/FunctionDeclarationObfuscator.ts
  44. 8 10
      src/node-obfuscators/FunctionObfuscator.ts
  45. 2 4
      src/node-obfuscators/LiteralObfuscator.ts
  46. 6 10
      src/node-obfuscators/MemberExpressionObfuscator.ts
  47. 4 6
      src/node-obfuscators/MethodDefinitionObfuscator.ts
  48. 7 12
      src/node-obfuscators/ObjectExpressionObfuscator.ts
  49. 9 12
      src/node-obfuscators/VariableDeclarationObfuscator.ts
  50. 2 3
      src/types/TNodeWithBlockStatement.d.ts
  51. 1 1
      src/types/TOptionsNormalizerRule.d.ts
  52. 0 9
      src/types/nodes/TExpression.d.ts
  53. 0 7
      src/types/nodes/TStatement.d.ts
  54. 33 49
      test/mocks/NodeMocks.ts
  55. 47 57
      test/unit-tests/NodeUtils.spec.ts
  56. 4 4
      test/unit-tests/node-obfuscators/CatchClauseObfuscator.spec.ts
  57. 7 9
      test/unit-tests/node-obfuscators/FunctionDeclarationObfuscator.spec.ts
  58. 10 13
      test/unit-tests/node-obfuscators/FunctionObfuscator.spec.ts

+ 45 - 45
dist/index.js

@@ -745,7 +745,7 @@ var IdentifierReplacer = function (_AbstractReplacer_1$A) {
     _inherits(IdentifierReplacer, _AbstractReplacer_1$A);
 
     function IdentifierReplacer() {
-        var _Object$getPrototypeO;
+        var _ref;
 
         _classCallCheck(this, IdentifierReplacer);
 
@@ -753,7 +753,7 @@ var IdentifierReplacer = function (_AbstractReplacer_1$A) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(IdentifierReplacer)).call.apply(_Object$getPrototypeO, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_ref = IdentifierReplacer.__proto__ || Object.getPrototypeOf(IdentifierReplacer)).call.apply(_ref, [this].concat(args)));
 
         _this.namesMap = new Map();
         return _this;
@@ -814,7 +814,7 @@ var StringLiteralReplacer = function (_AbstractReplacer_1$A) {
     function StringLiteralReplacer() {
         _classCallCheck(this, StringLiteralReplacer);
 
-        return _possibleConstructorReturn(this, Object.getPrototypeOf(StringLiteralReplacer).apply(this, arguments));
+        return _possibleConstructorReturn(this, (StringLiteralReplacer.__proto__ || Object.getPrototypeOf(StringLiteralReplacer)).apply(this, arguments));
     }
 
     _createClass(StringLiteralReplacer, [{
@@ -1023,25 +1023,25 @@ exports.JSFuck = {
     e: '(true+"")[3]',
     f: '(false+"")[0]',
     g: '(false+[0]+String)[20]',
-    h: '(+(101))["to"+String["name"]](21)[1]',
+    h: '(+(101))["toString"](21)[1]',
     i: '([false]+undefined)[10]',
     j: '([]["entries"]()+"")[3]',
-    k: '(+(20))["to"+String["name"]](21)',
+    k: '(+(20))["toString"](21)',
     l: '(false+"")[2]',
     m: '(Number+"")[11]',
     n: '(undefined+"")[1]',
     o: '(true+[]["fill"])[10]',
-    p: '(+(211))["to"+String["name"]](31)[1]',
-    q: '(+(212))["to"+String["name"]](31)[1]',
+    p: '(+(211))["toString"](31)[1]',
+    q: '(+(212))["toString"](31)[1]',
     r: '(true+"")[1]',
     s: '(false+"")[3]',
     t: '(true+"")[0]',
     u: '(undefined+"")[0]',
-    v: '(+(31))["to"+String["name"]](32)',
-    w: '(+(32))["to"+String["name"]](33)',
-    x: '(+(101))["to"+String["name"]](34)[1]',
+    v: '(+(31))["toString"](32)',
+    w: '(+(32))["toString"](33)',
+    x: '(+(101))["toString"](34)[1]',
     y: '(NaN+[Infinity])[10]',
-    z: '(+(35))["to"+String["name"]](36)',
+    z: '(+(35))["toString"](36)',
     A: '(+[]+Array)[10]',
     B: '(+[]+Boolean)[10]',
     C: 'Function("return escape")()(("")["italics"]())[2]',
@@ -1062,7 +1062,7 @@ exports.JSFuck = {
     R: '(+[]+RegExp)[10]',
     S: '(+[]+String)[10]',
     T: '(NaN+Function("return Date")()())[30]',
-    U: '(NaN+Function("return{}")()["to"+String["name"]]["call"]())[11]',
+    U: '(NaN+Function("return{}")()["toString"]["call"]())[11]',
     V: '\'V\'',
     W: '\'W\'',
     X: '\'X\'',
@@ -1094,7 +1094,7 @@ var NumberLiteralReplacer = function (_AbstractReplacer_1$A) {
     function NumberLiteralReplacer() {
         _classCallCheck(this, NumberLiteralReplacer);
 
-        return _possibleConstructorReturn(this, Object.getPrototypeOf(NumberLiteralReplacer).apply(this, arguments));
+        return _possibleConstructorReturn(this, (NumberLiteralReplacer.__proto__ || Object.getPrototypeOf(NumberLiteralReplacer)).apply(this, arguments));
     }
 
     _createClass(NumberLiteralReplacer, [{
@@ -1628,7 +1628,7 @@ var ConsoleOutputDisableExpressionNode = function (_AbstractCustomNode_) {
     _inherits(ConsoleOutputDisableExpressionNode, _AbstractCustomNode_);
 
     function ConsoleOutputDisableExpressionNode() {
-        var _Object$getPrototypeO;
+        var _ref;
 
         _classCallCheck(this, ConsoleOutputDisableExpressionNode);
 
@@ -1636,7 +1636,7 @@ var ConsoleOutputDisableExpressionNode = function (_AbstractCustomNode_) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).call.apply(_Object$getPrototypeO, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_ref = ConsoleOutputDisableExpressionNode.__proto__ || Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).call.apply(_ref, [this].concat(args)));
 
         _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
         return _this;
@@ -1686,7 +1686,7 @@ var DebugProtectionFunctionCallNode = function (_AbstractCustomNode_) {
     function DebugProtectionFunctionCallNode(debugProtectionFunctionName, options) {
         _classCallCheck(this, DebugProtectionFunctionCallNode);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionCallNode).call(this, options));
+        var _this = _possibleConstructorReturn(this, (DebugProtectionFunctionCallNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionCallNode)).call(this, options));
 
         _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
         _this.debugProtectionFunctionName = debugProtectionFunctionName;
@@ -1739,7 +1739,7 @@ var DebugProtectionFunctionIntervalNode = function (_AbstractCustomNode_) {
     function DebugProtectionFunctionIntervalNode(debugProtectionFunctionName, options) {
         _classCallCheck(this, DebugProtectionFunctionIntervalNode);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionIntervalNode).call(this, options));
+        var _this = _possibleConstructorReturn(this, (DebugProtectionFunctionIntervalNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionIntervalNode)).call(this, options));
 
         _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
         _this.debugProtectionFunctionName = debugProtectionFunctionName;
@@ -1793,7 +1793,7 @@ var DebugProtectionFunctionNode = function (_AbstractCustomNode_) {
     function DebugProtectionFunctionNode(debugProtectionFunctionName, options) {
         _classCallCheck(this, DebugProtectionFunctionNode);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionNode).call(this, options));
+        var _this = _possibleConstructorReturn(this, (DebugProtectionFunctionNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionNode)).call(this, options));
 
         _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
         _this.debugProtectionFunctionName = debugProtectionFunctionName;
@@ -1857,7 +1857,7 @@ var DomainLockNode = function (_AbstractCustomNode_) {
     _inherits(DomainLockNode, _AbstractCustomNode_);
 
     function DomainLockNode() {
-        var _Object$getPrototypeO;
+        var _ref;
 
         _classCallCheck(this, DomainLockNode);
 
@@ -1865,7 +1865,7 @@ var DomainLockNode = function (_AbstractCustomNode_) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(DomainLockNode)).call.apply(_Object$getPrototypeO, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_ref = DomainLockNode.__proto__ || Object.getPrototypeOf(DomainLockNode)).call.apply(_ref, [this].concat(args)));
 
         _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
         return _this;
@@ -1926,7 +1926,7 @@ var SelfDefendingUnicodeNode = function (_AbstractCustomNode_) {
     _inherits(SelfDefendingUnicodeNode, _AbstractCustomNode_);
 
     function SelfDefendingUnicodeNode() {
-        var _Object$getPrototypeO;
+        var _ref;
 
         _classCallCheck(this, SelfDefendingUnicodeNode);
 
@@ -1934,7 +1934,7 @@ var SelfDefendingUnicodeNode = function (_AbstractCustomNode_) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SelfDefendingUnicodeNode)).call.apply(_Object$getPrototypeO, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_ref = SelfDefendingUnicodeNode.__proto__ || Object.getPrototypeOf(SelfDefendingUnicodeNode)).call.apply(_ref, [this].concat(args)));
 
         _this.appendState = AppendState_1.AppendState.AfterObfuscation;
         return _this;
@@ -1995,7 +1995,7 @@ var UnicodeArrayCallsWrapper = function (_AbstractCustomNode_) {
     function UnicodeArrayCallsWrapper(unicodeArrayCallsWrapperName, unicodeArrayName, unicodeArray, options) {
         _classCallCheck(this, UnicodeArrayCallsWrapper);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayCallsWrapper).call(this, options));
+        var _this = _possibleConstructorReturn(this, (UnicodeArrayCallsWrapper.__proto__ || Object.getPrototypeOf(UnicodeArrayCallsWrapper)).call(this, options));
 
         _this.appendState = AppendState_1.AppendState.AfterObfuscation;
         _this.unicodeArrayCallsWrapperName = unicodeArrayCallsWrapperName;
@@ -2020,7 +2020,7 @@ var UnicodeArrayCallsWrapper = function (_AbstractCustomNode_) {
     }, {
         key: "getNode",
         value: function getNode() {
-            return _get(Object.getPrototypeOf(UnicodeArrayCallsWrapper.prototype), "getNode", this).call(this);
+            return _get(UnicodeArrayCallsWrapper.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayCallsWrapper.prototype), "getNode", this).call(this);
         }
     }, {
         key: "getNodeStructure",
@@ -2072,7 +2072,7 @@ var UnicodeArrayDecodeNode = function (_AbstractCustomNode_) {
     function UnicodeArrayDecodeNode(unicodeArrayName, unicodeArray, options) {
         _classCallCheck(this, UnicodeArrayDecodeNode);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayDecodeNode).call(this, options));
+        var _this = _possibleConstructorReturn(this, (UnicodeArrayDecodeNode.__proto__ || Object.getPrototypeOf(UnicodeArrayDecodeNode)).call(this, options));
 
         _this.appendState = AppendState_1.AppendState.AfterObfuscation;
         _this.unicodeArrayName = unicodeArrayName;
@@ -2091,7 +2091,7 @@ var UnicodeArrayDecodeNode = function (_AbstractCustomNode_) {
     }, {
         key: "getNode",
         value: function getNode() {
-            return _get(Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), "getNode", this).call(this);
+            return _get(UnicodeArrayDecodeNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), "getNode", this).call(this);
         }
     }, {
         key: "getNodeStructure",
@@ -2152,7 +2152,7 @@ var UnicodeArrayNode = function (_AbstractCustomNode_) {
 
         _classCallCheck(this, UnicodeArrayNode);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayNode).call(this, options));
+        var _this = _possibleConstructorReturn(this, (UnicodeArrayNode.__proto__ || Object.getPrototypeOf(UnicodeArrayNode)).call(this, options));
 
         _this.appendState = AppendState_1.AppendState.AfterObfuscation;
         _this.unicodeArray = unicodeArray;
@@ -2183,7 +2183,7 @@ var UnicodeArrayNode = function (_AbstractCustomNode_) {
         key: 'getNode',
         value: function getNode() {
             this.unicodeArray.rotateArray(this.unicodeArrayRotateValue);
-            return _get(Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
+            return _get(UnicodeArrayNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
         }
     }, {
         key: 'updateNodeData',
@@ -2239,7 +2239,7 @@ var UnicodeArrayRotateFunctionNode = function (_AbstractCustomNode_) {
     function UnicodeArrayRotateFunctionNode(unicodeArrayName, unicodeArray, unicodeArrayRotateValue, options) {
         _classCallCheck(this, UnicodeArrayRotateFunctionNode);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayRotateFunctionNode).call(this, options));
+        var _this = _possibleConstructorReturn(this, (UnicodeArrayRotateFunctionNode.__proto__ || Object.getPrototypeOf(UnicodeArrayRotateFunctionNode)).call(this, options));
 
         _this.appendState = AppendState_1.AppendState.AfterObfuscation;
         _this.unicodeArrayName = unicodeArrayName;
@@ -2259,7 +2259,7 @@ var UnicodeArrayRotateFunctionNode = function (_AbstractCustomNode_) {
     }, {
         key: "getNode",
         value: function getNode() {
-            return _get(Object.getPrototypeOf(UnicodeArrayRotateFunctionNode.prototype), "getNode", this).call(this);
+            return _get(UnicodeArrayRotateFunctionNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayRotateFunctionNode.prototype), "getNode", this).call(this);
         }
     }, {
         key: "getNodeStructure",
@@ -2312,7 +2312,7 @@ var ConsoleOutputNodesGroup = function (_AbstractNodesGroup_) {
     function ConsoleOutputNodesGroup(options) {
         _classCallCheck(this, ConsoleOutputNodesGroup);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ConsoleOutputNodesGroup).call(this, options));
+        var _this = _possibleConstructorReturn(this, (ConsoleOutputNodesGroup.__proto__ || Object.getPrototypeOf(ConsoleOutputNodesGroup)).call(this, options));
 
         if (!_this.options.disableConsoleOutput) {
             return _possibleConstructorReturn(_this);
@@ -2351,7 +2351,7 @@ var DebugProtectionNodesGroup = function (_AbstractNodesGroup_) {
     function DebugProtectionNodesGroup(options) {
         _classCallCheck(this, DebugProtectionNodesGroup);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionNodesGroup).call(this, options));
+        var _this = _possibleConstructorReturn(this, (DebugProtectionNodesGroup.__proto__ || Object.getPrototypeOf(DebugProtectionNodesGroup)).call(this, options));
 
         _this.debugProtectionFunctionIdentifier = Utils_1.Utils.getRandomVariableName();
         if (!_this.options.debugProtection) {
@@ -2392,7 +2392,7 @@ var DomainLockNodesGroup = function (_AbstractNodesGroup_) {
     function DomainLockNodesGroup(options) {
         _classCallCheck(this, DomainLockNodesGroup);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DomainLockNodesGroup).call(this, options));
+        var _this = _possibleConstructorReturn(this, (DomainLockNodesGroup.__proto__ || Object.getPrototypeOf(DomainLockNodesGroup)).call(this, options));
 
         if (!_this.options.domainLock.length) {
             return _possibleConstructorReturn(_this);
@@ -2428,7 +2428,7 @@ var SelfDefendingNodesGroup = function (_AbstractNodesGroup_) {
     function SelfDefendingNodesGroup(options) {
         _classCallCheck(this, SelfDefendingNodesGroup);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SelfDefendingNodesGroup).call(this, options));
+        var _this = _possibleConstructorReturn(this, (SelfDefendingNodesGroup.__proto__ || Object.getPrototypeOf(SelfDefendingNodesGroup)).call(this, options));
 
         if (!_this.options.selfDefending) {
             return _possibleConstructorReturn(_this);
@@ -2469,7 +2469,7 @@ var UnicodeArrayNodesGroup = function (_AbstractNodesGroup_) {
     function UnicodeArrayNodesGroup(options) {
         _classCallCheck(this, UnicodeArrayNodesGroup);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayNodesGroup).call(this, options));
+        var _this = _possibleConstructorReturn(this, (UnicodeArrayNodesGroup.__proto__ || Object.getPrototypeOf(UnicodeArrayNodesGroup)).call(this, options));
 
         _this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
         _this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
@@ -2532,7 +2532,7 @@ var CatchClauseObfuscator = function (_AbstractNodeObfuscat) {
     function CatchClauseObfuscator(nodes, options) {
         _classCallCheck(this, CatchClauseObfuscator);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CatchClauseObfuscator).call(this, nodes, options));
+        var _this = _possibleConstructorReturn(this, (CatchClauseObfuscator.__proto__ || Object.getPrototypeOf(CatchClauseObfuscator)).call(this, nodes, options));
 
         _this.identifierReplacer = new IdentifierReplacer_1.IdentifierReplacer(_this.nodes, _this.options);
         return _this;
@@ -2603,7 +2603,7 @@ var FunctionDeclarationObfuscator = function (_AbstractNodeObfuscat) {
     function FunctionDeclarationObfuscator(nodes, options) {
         _classCallCheck(this, FunctionDeclarationObfuscator);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(FunctionDeclarationObfuscator).call(this, nodes, options));
+        var _this = _possibleConstructorReturn(this, (FunctionDeclarationObfuscator.__proto__ || Object.getPrototypeOf(FunctionDeclarationObfuscator)).call(this, nodes, options));
 
         _this.identifierReplacer = new IdentifierReplacer_1.IdentifierReplacer(_this.nodes, _this.options);
         return _this;
@@ -2678,7 +2678,7 @@ var FunctionObfuscator = function (_AbstractNodeObfuscat) {
     function FunctionObfuscator(nodes, options) {
         _classCallCheck(this, FunctionObfuscator);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(FunctionObfuscator).call(this, nodes, options));
+        var _this = _possibleConstructorReturn(this, (FunctionObfuscator.__proto__ || Object.getPrototypeOf(FunctionObfuscator)).call(this, nodes, options));
 
         _this.identifierReplacer = new IdentifierReplacer_1.IdentifierReplacer(_this.nodes, _this.options);
         return _this;
@@ -2757,7 +2757,7 @@ var LiteralObfuscator = function (_AbstractNodeObfuscat) {
     function LiteralObfuscator() {
         _classCallCheck(this, LiteralObfuscator);
 
-        return _possibleConstructorReturn(this, Object.getPrototypeOf(LiteralObfuscator).apply(this, arguments));
+        return _possibleConstructorReturn(this, (LiteralObfuscator.__proto__ || Object.getPrototypeOf(LiteralObfuscator)).apply(this, arguments));
     }
 
     _createClass(LiteralObfuscator, [{
@@ -2820,7 +2820,7 @@ var MemberExpressionObfuscator = function (_AbstractNodeObfuscat) {
     function MemberExpressionObfuscator() {
         _classCallCheck(this, MemberExpressionObfuscator);
 
-        return _possibleConstructorReturn(this, Object.getPrototypeOf(MemberExpressionObfuscator).apply(this, arguments));
+        return _possibleConstructorReturn(this, (MemberExpressionObfuscator.__proto__ || Object.getPrototypeOf(MemberExpressionObfuscator)).apply(this, arguments));
     }
 
     _createClass(MemberExpressionObfuscator, [{
@@ -2902,7 +2902,7 @@ var MethodDefinitionObfuscator = function (_AbstractNodeObfuscat) {
     _inherits(MethodDefinitionObfuscator, _AbstractNodeObfuscat);
 
     function MethodDefinitionObfuscator() {
-        var _Object$getPrototypeO;
+        var _ref;
 
         _classCallCheck(this, MethodDefinitionObfuscator);
 
@@ -2910,7 +2910,7 @@ var MethodDefinitionObfuscator = function (_AbstractNodeObfuscat) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(MethodDefinitionObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_ref = MethodDefinitionObfuscator.__proto__ || Object.getPrototypeOf(MethodDefinitionObfuscator)).call.apply(_ref, [this].concat(args)));
 
         _this.ignoredNames = ['constructor'];
         return _this;
@@ -2972,7 +2972,7 @@ var ObjectExpressionObfuscator = function (_AbstractNodeObfuscat) {
     function ObjectExpressionObfuscator() {
         _classCallCheck(this, ObjectExpressionObfuscator);
 
-        return _possibleConstructorReturn(this, Object.getPrototypeOf(ObjectExpressionObfuscator).apply(this, arguments));
+        return _possibleConstructorReturn(this, (ObjectExpressionObfuscator.__proto__ || Object.getPrototypeOf(ObjectExpressionObfuscator)).apply(this, arguments));
     }
 
     _createClass(ObjectExpressionObfuscator, [{
@@ -3055,7 +3055,7 @@ var VariableDeclarationObfuscator = function (_AbstractNodeObfuscat) {
     function VariableDeclarationObfuscator(nodes, options) {
         _classCallCheck(this, VariableDeclarationObfuscator);
 
-        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(VariableDeclarationObfuscator).call(this, nodes, options));
+        var _this = _possibleConstructorReturn(this, (VariableDeclarationObfuscator.__proto__ || Object.getPrototypeOf(VariableDeclarationObfuscator)).call(this, nodes, options));
 
         _this.identifierReplacer = new IdentifierReplacer_1.IdentifierReplacer(_this.nodes, _this.options);
         return _this;
@@ -3141,7 +3141,7 @@ var BooleanLiteralReplacer = function (_AbstractReplacer_1$A) {
     function BooleanLiteralReplacer() {
         _classCallCheck(this, BooleanLiteralReplacer);
 
-        return _possibleConstructorReturn(this, Object.getPrototypeOf(BooleanLiteralReplacer).apply(this, arguments));
+        return _possibleConstructorReturn(this, (BooleanLiteralReplacer.__proto__ || Object.getPrototypeOf(BooleanLiteralReplacer)).apply(this, arguments));
     }
 
     _createClass(BooleanLiteralReplacer, [{

+ 12 - 12
package.json

@@ -25,26 +25,26 @@
     "class-validator": "^0.5.0",
     "commander": "^2.9.0",
     "escodegen": "^1.8.1",
-    "esprima": "^2.7.2",
+    "esprima": "^3.0.0",
     "estraverse": "^4.2.0",
     "format-unicorn": "^1.1.0",
     "mkdirp": "^0.5.1",
     "source-map-support": "^0.4.2"
   },
   "devDependencies": {
-    "@types/chai": "^3.4.31",
+    "@types/chai": "^3.4.32",
     "@types/chance": "^0.7.28",
     "@types/commander": "^2.3.29",
-    "@types/escodegen": "^0.0.3",
-    "@types/esprima": "^2.1.30",
-    "@types/estraverse": "^0.0.3",
+    "@types/escodegen": "^0.0.5",
+    "@types/esprima": "^2.1.31",
+    "@types/estraverse": "^0.0.5",
     "@types/format-unicorn": "^0.0.28",
-    "@types/joi": "^9.0.30",
+    "@types/joi": "^9.0.31",
     "@types/mkdirp": "^0.3.28",
-    "@types/mocha": "^2.2.30",
-    "@types/node": "^4.0.30",
-    "@types/sinon": "^1.16.28",
-    "babel-cli": "^6.11.4",
+    "@types/mocha": "^2.2.31",
+    "@types/node": "^6.0.38",
+    "@types/sinon": "^1.16.29",
+    "babel-cli": "^6.14.0",
     "babel-loader": "^6.2.5",
     "babel-preset-es2015": "^6.13.2",
     "chai": "^3.5.0",
@@ -55,9 +55,9 @@
     "sinon": "^2.0.0-pre.2",
     "ts-loader": "^0.8.2",
     "ts-node": "^1.3.0",
-    "tslint": "^3.14.0",
+    "tslint": "^3.15.1",
     "typescript": "^2.0.0",
-    "webpack": "^2.1.0-beta.21",
+    "webpack": "^2.1.0-beta.22",
     "webpack-node-externals": "^1.3.3"
   },
   "repository": {

+ 3 - 3
src/JavaScriptObfuscatorInternal.ts

@@ -1,9 +1,9 @@
 import * as esprima from 'esprima';
 import * as escodegen from 'escodegen';
+import * as ESTree from 'estree';
 
 import { IObfuscatorOptions } from "./interfaces/IObfuscatorOptions";
 import { IGeneratorOutput } from "./interfaces/IGeneratorOutput";
-import { INode } from './interfaces/nodes/INode';
 import { IObfuscationResult } from "./interfaces/IObfuscationResult";
 import { IOptions } from './interfaces/IOptions';
 
@@ -58,7 +58,7 @@ export class JavaScriptObfuscatorInternal {
      * @param astTree
      * @param options
      */
-    private static generateCode (sourceCode: string, astTree: INode, options: IOptions): IGeneratorOutput {
+    private static generateCode (sourceCode: string, astTree: ESTree.Node, options: IOptions): IGeneratorOutput {
         let escodegenParams: escodegen.GenerateOptions = Object.assign(
                 {},
                 JavaScriptObfuscatorInternal.escodegenParams
@@ -95,7 +95,7 @@ export class JavaScriptObfuscatorInternal {
     }
 
     public obfuscate (): void {
-        let astTree: INode = esprima.parse(this.sourceCode, {
+        let astTree: ESTree.Node = esprima.parse(this.sourceCode, {
             loc: true
         });
 

+ 29 - 32
src/NodeUtils.ts

@@ -1,12 +1,9 @@
 import * as escodegen from 'escodegen';
 import * as esprima from 'esprima';
 import * as estraverse from 'estraverse';
-
-import { ILiteralNode } from "./interfaces/nodes/ILiteralNode";
-import { INode } from './interfaces/nodes/INode';
+import * as ESTree from 'estree';
 
 import { TNodeWithBlockStatement } from "./types/TNodeWithBlockStatement";
-import { TStatement } from "./types/nodes/TStatement";
 
 import { NodeType } from "./enums/NodeType";
 
@@ -28,9 +25,9 @@ export class NodeUtils {
     /**
      * @param node
      */
-    public static addXVerbatimPropertyToLiterals (node: INode): void {
+    public static addXVerbatimPropertyToLiterals (node: ESTree.Node): void {
         NodeUtils.typedReplace(node, NodeType.Literal, {
-            leave: (node: ILiteralNode) => {
+            leave: (node: ESTree.Literal) => {
                 node['x-verbatim-property'] = {
                     content : node.raw,
                     precedence: escodegen.Precedence.Primary
@@ -43,7 +40,7 @@ export class NodeUtils {
      * @param blockScopeBody
      * @param node
      */
-    public static appendNode (blockScopeBody: INode[], node: INode): void {
+    public static appendNode (blockScopeBody: ESTree.Node[], node: ESTree.Node): void {
         if (!NodeUtils.validateNode(node)) {
             return;
         }
@@ -53,10 +50,10 @@ export class NodeUtils {
 
     /**
      * @param code
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public static convertCodeToStructure (code: string): INode {
-        let structure: INode = esprima.parse(code);
+    public static convertCodeToStructure (code: string): ESTree.Node {
+        let structure: ESTree.Node = esprima.parse(code);
 
         NodeUtils.addXVerbatimPropertyToLiterals(structure);
         NodeUtils.parentize(structure);
@@ -67,9 +64,9 @@ export class NodeUtils {
     /**
      * @param node
      * @param index
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public static getBlockStatementNodeByIndex (node: INode, index: number = 0): INode {
+    public static getBlockStatementNodeByIndex (node: ESTree.Node, index: number = 0): ESTree.Node {
         if (Nodes.isNodeHasBlockStatement(node)) {
             if (node.body[index] === undefined) {
                 throw new ReferenceError(`Wrong index \`${index}\`. Block-statement body length is \`${node.body.length}\``);
@@ -84,21 +81,21 @@ export class NodeUtils {
     /**
      * @param node
      * @param depth
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public static getBlockScopeOfNode (node: INode, depth: number = 0): TNodeWithBlockStatement {
-        let parentNode: INode | undefined = node.parentNode;
+    public static getBlockScopeOfNode (node: ESTree.Node, depth: number = 0): TNodeWithBlockStatement {
+        let parentNode: ESTree.Node | undefined = node['parentNode'];
 
         if (!parentNode) {
             throw new ReferenceError('`parentNode` property of given node is `undefined`');
         }
 
         if (Nodes.isBlockStatementNode(parentNode)) {
-            if (!parentNode.parentNode) {
+            if (!parentNode['parentNode']) {
                 throw new ReferenceError('`parentNode` property of `parentNode` of given node is `undefined`');
             }
 
-            if (!Utils.arrayContains(NodeUtils.nodesWithBlockScope, parentNode.parentNode.type)) {
+            if (!Utils.arrayContains(NodeUtils.nodesWithBlockScope, parentNode['parentNode'].type)) {
                 return NodeUtils.getBlockScopeOfNode(parentNode, depth);
             } else if (depth > 0) {
                 return NodeUtils.getBlockScopeOfNode(parentNode, --depth);
@@ -119,7 +116,7 @@ export class NodeUtils {
      * @param node
      * @param index
      */
-    public static insertNodeAtIndex (blockScopeBody: INode[], node: INode, index: number): void {
+    public static insertNodeAtIndex (blockScopeBody: ESTree.Node[], node: ESTree.Node, index: number): void {
         if (!NodeUtils.validateNode(node)) {
             return;
         }
@@ -130,18 +127,18 @@ export class NodeUtils {
     /**
      * @param node
      */
-    public static parentize (node: INode): void {
+    public static parentize (node: ESTree.Node): void {
         let isRootNode: boolean = true;
 
         estraverse.replace(node, {
-            enter: (node: INode, parentNode: INode): any => {
-                let value: INode;
+            enter: (node: ESTree.Node, parentNode: ESTree.Node): any => {
+                let value: ESTree.Node;
 
                 if (isRootNode) {
                     if (node.type === NodeType.Program) {
                         value = node;
                     } else {
-                        value = Nodes.getProgramNode(<TStatement[]>[node]);
+                        value = Nodes.getProgramNode(<ESTree.Statement[]>[node]);
                         value['parentNode'] = value;
                     }
 
@@ -159,7 +156,7 @@ export class NodeUtils {
      * @param blockScopeBody
      * @param node
      */
-    public static prependNode (blockScopeBody: INode[], node: INode): void {
+    public static prependNode (blockScopeBody: ESTree.Node[], node: ESTree.Node): void {
         if (!NodeUtils.validateNode(node)) {
             return;
         }
@@ -173,9 +170,9 @@ export class NodeUtils {
      * @param visitor
      */
     public static typedReplace (
-        node: INode,
+        node: ESTree.Node,
         nodeType: string,
-        visitor: {enter?: (node: INode) => void, leave?: (node: INode) => void},
+        visitor: {enter?: (node: ESTree.Node) => void, leave?: (node: ESTree.Node) => void},
     ): void {
         NodeUtils.typedTraverse(node, nodeType, visitor, 'replace');
     }
@@ -187,20 +184,20 @@ export class NodeUtils {
      * @param traverseType
      */
     public static typedTraverse (
-        node: INode,
+        node: ESTree.Node,
         nodeType: string,
-        visitor: {enter?: (node: INode) => void, leave?: (node: INode) => void},
+        visitor: {enter?: (node: ESTree.Node) => void, leave?: (node: ESTree.Node) => void},
         traverseType: string = 'traverse'
     ): void {
         (<any>estraverse)[traverseType](node, {
-            enter: (node: INode): any => {
+            enter: (node: ESTree.Node): any => {
                 if (node.type === nodeType && visitor.enter) {
-                    visitor.enter(node)
+                    visitor.enter(node);
                 }
             },
-            leave: (node: INode): any => {
+            leave: (node: ESTree.Node): any => {
                 if (node.type === nodeType && visitor.leave) {
-                    visitor.leave(node)
+                    visitor.leave(node);
                 }
             }
         });
@@ -210,7 +207,7 @@ export class NodeUtils {
      * @param node
      * @returns {boolean}
      */
-    private static validateNode (node: INode): boolean {
+    private static validateNode (node: ESTree.Node): boolean {
         return !!node && node.hasOwnProperty('type');
     }
 }

+ 16 - 29
src/Nodes.ts

@@ -1,17 +1,4 @@
-import { IArrowFunctionExpressionNode } from "./interfaces/nodes/IArrowFunctionExpressionNode";
-import { IBlockStatementNode } from "./interfaces/nodes/IBlockStatementNode";
-import { IIdentifierNode } from "./interfaces/nodes/IIdentifierNode";
-import { IFunctionDeclarationNode } from "./interfaces/nodes/IFunctionDeclarationNode";
-import { IFunctionExpressionNode } from "./interfaces/nodes/IFunctionExpressionNode";
-import { ILiteralNode } from "./interfaces/nodes/ILiteralNode";
-import { IMemberExpressionNode } from "./interfaces/nodes/IMemberExpressionNode";
-import { INode } from "./interfaces/nodes/INode";
-import { IProgramNode } from "./interfaces/nodes/IProgramNode";
-import { IPropertyNode } from "./interfaces/nodes/IPropertyNode";
-import { IVariableDeclarationNode } from "./interfaces/nodes/IVariableDeclarationNode";
-import { IVariableDeclaratorNode } from "./interfaces/nodes/IVariableDeclaratorNode";
-
-import { TStatement } from "./types/nodes/TStatement";
+import * as ESTree from 'estree';
 
 import { TNodeWithBlockStatement } from "./types/TNodeWithBlockStatement";
 
@@ -20,9 +7,9 @@ import { NodeType } from "./enums/NodeType";
 export class Nodes {
     /**
      * @param bodyNode
-     * @returns IProgramNode
+     * @returns ESTree.Program
      */
-    public static getProgramNode (bodyNode: TStatement[]): IProgramNode {
+    public static getProgramNode (bodyNode: ESTree.Statement[]): ESTree.Program {
         return {
             'type': NodeType.Program,
             'body': bodyNode,
@@ -34,7 +21,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isArrowFunctionExpressionNode (node: INode): node is IArrowFunctionExpressionNode {
+    public static isArrowFunctionExpressionNode (node: ESTree.Node): node is ESTree.ArrowFunctionExpression {
         return node.type === NodeType.ArrowFunctionExpression;
     }
 
@@ -42,7 +29,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isBlockStatementNode (node: INode): node is IBlockStatementNode {
+    public static isBlockStatementNode (node: ESTree.Node): node is ESTree.BlockStatement {
         return node.type === NodeType.BlockStatement;
     }
 
@@ -50,7 +37,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isFunctionDeclarationNode (node: INode): node is IFunctionDeclarationNode {
+    public static isFunctionDeclarationNode (node: ESTree.Node): node is ESTree.FunctionDeclaration {
         return node.type === NodeType.FunctionDeclaration;
     }
 
@@ -58,7 +45,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isFunctionExpressionNode (node: INode): node is IFunctionExpressionNode {
+    public static isFunctionExpressionNode (node: ESTree.Node): node is ESTree.FunctionExpression {
         return node.type === NodeType.FunctionExpression;
     }
 
@@ -66,7 +53,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isIdentifierNode (node: INode): node is IIdentifierNode {
+    public static isIdentifierNode (node: ESTree.Node): node is ESTree.Identifier {
         return node.type === NodeType.Identifier;
     }
 
@@ -74,7 +61,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isLiteralNode (node: INode): node is ILiteralNode {
+    public static isLiteralNode (node: ESTree.Node): node is ESTree.Literal {
         return node.type === NodeType.Literal;
     }
 
@@ -82,7 +69,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isMemberExpressionNode (node: INode): node is IMemberExpressionNode {
+    public static isMemberExpressionNode (node: ESTree.Node): node is ESTree.MemberExpression {
         return node.type === NodeType.MemberExpression;
     }
 
@@ -91,7 +78,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isProgramNode (node: INode): node is IProgramNode {
+    public static isProgramNode (node: ESTree.Node): node is ESTree.Program {
         return node.type === NodeType.Program;
     }
 
@@ -100,7 +87,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isPropertyNode (node: INode): node is IPropertyNode {
+    public static isPropertyNode (node: ESTree.Node): node is ESTree.Property {
         return node.type === NodeType.Property;
     }
 
@@ -109,7 +96,7 @@ export class Nodes {
      * @param parentNode
      * @returns {boolean}
      */
-    public static isReplaceableIdentifierNode (node: INode, parentNode: INode): node is IIdentifierNode {
+    public static isReplaceableIdentifierNode (node: ESTree.Node, parentNode: ESTree.Node): node is ESTree.Identifier {
         if (!Nodes.isIdentifierNode(node)) {
             return false;
         }
@@ -129,7 +116,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isVariableDeclarationNode (node: INode): node is IVariableDeclarationNode {
+    public static isVariableDeclarationNode (node: ESTree.Node): node is ESTree.VariableDeclaration {
         return node.type === NodeType.VariableDeclaration;
     }
 
@@ -138,7 +125,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isVariableDeclaratorNode (node: INode): node is IVariableDeclaratorNode {
+    public static isVariableDeclaratorNode (node: ESTree.Node): node is ESTree.VariableDeclarator {
         return node.type === NodeType.VariableDeclarator;
     }
 
@@ -146,7 +133,7 @@ export class Nodes {
      * @param node
      * @returns {boolean}
      */
-    public static isNodeHasBlockStatement (node: INode): node is TNodeWithBlockStatement {
+    public static isNodeHasBlockStatement (node: ESTree.Node): node is TNodeWithBlockStatement {
         return node.hasOwnProperty('body') && Array.isArray((<TNodeWithBlockStatement>node).body);
     }
 }

+ 8 - 8
src/Obfuscator.ts

@@ -1,7 +1,7 @@
 import * as estraverse from 'estraverse';
+import * as ESTree from 'estree';
 
 import { ICustomNode } from './interfaces/custom-nodes/ICustomNode';
-import { INode } from './interfaces/nodes/INode';
 import { IObfuscator } from "./interfaces/IObfuscator";
 import { IOptions } from "./interfaces/IOptions";
 
@@ -73,9 +73,9 @@ export class Obfuscator implements IObfuscator {
 
     /**
      * @param node
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public obfuscateNode (node: INode): INode {
+    public obfuscateNode (node: ESTree.Node): ESTree.Node {
         if (Nodes.isProgramNode(node) && !node.body.length) {
             return node;
         }
@@ -92,7 +92,7 @@ export class Obfuscator implements IObfuscator {
     /**
      * @param astTree
      */
-    private afterObfuscation (astTree: INode): void {
+    private afterObfuscation (astTree: ESTree.Node): void {
         this.nodes.forEach((node: ICustomNode) => {
             if (node.getAppendState() === AppendState.AfterObfuscation) {
                 node.appendNode(astTree);
@@ -103,7 +103,7 @@ export class Obfuscator implements IObfuscator {
     /**
      * @param astTree
      */
-    private beforeObfuscation (astTree: INode): void {
+    private beforeObfuscation (astTree: ESTree.Node): void {
         this.nodes.forEach((node: ICustomNode) => {
             if (node.getAppendState() === AppendState.BeforeObfuscation) {
                 node.appendNode(astTree);
@@ -116,7 +116,7 @@ export class Obfuscator implements IObfuscator {
      * @param node
      * @param parentNode
      */
-    private initializeNodeObfuscators (node: INode, parentNode: INode): void {
+    private initializeNodeObfuscators (node: ESTree.Node, parentNode: ESTree.Node): void {
         let nodeObfuscators: TNodeObfuscator[] | undefined = this.nodeObfuscators.get(node.type);
 
         if (!nodeObfuscators) {
@@ -131,9 +131,9 @@ export class Obfuscator implements IObfuscator {
     /**
      * @param node
      */
-    private obfuscate (node: INode): void {
+    private obfuscate (node: ESTree.Node): void {
         estraverse.replace(node, {
-            leave: (node: INode, parentNode: INode): any => {
+            leave: (node: ESTree.Node, parentNode: ESTree.Node): any => {
                 this.initializeNodeObfuscators(node, parentNode);
             }
         });

+ 7 - 6
src/custom-nodes/AbstractCustomNode.ts

@@ -1,5 +1,6 @@
+import * as ESTree from 'estree';
+
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
-import { INode } from '../interfaces/nodes/INode';
 import { IOptions } from "../interfaces/IOptions";
 
 import { AppendState } from '../enums/AppendState';
@@ -25,7 +26,7 @@ export abstract class AbstractCustomNode implements ICustomNode {
     /**
      * @param astTree
      */
-    public abstract appendNode (astTree: INode): void;
+    public abstract appendNode (astTree: ESTree.Node): void;
 
     /**
      * @returns {AppendState}
@@ -35,14 +36,14 @@ export abstract class AbstractCustomNode implements ICustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public getNode (): INode {
+    public getNode (): ESTree.Node {
         return this.getNodeStructure();
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected abstract getNodeStructure (): INode;
+    protected abstract getNodeStructure (): ESTree.Node;
 }

+ 3 - 3
src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts

@@ -1,4 +1,4 @@
-import { INode } from "../../interfaces/nodes/INode";
+import * as ESTree from 'estree';
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
 
@@ -36,9 +36,9 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
      *  _console
      *  })();
      *
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         return NodeUtils.convertCodeToStructure(
             ConsoleOutputDisableExpressionTemplate()
         );

+ 4 - 3
src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts

@@ -1,6 +1,7 @@
+import * as ESTree from 'estree';
+
 import 'format-unicorn';
 
-import { INode } from "../../interfaces/nodes/INode";
 import { IOptions } from "../../interfaces/IOptions";
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
@@ -41,9 +42,9 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         return NodeUtils.convertCodeToStructure(
             DebugProtectionFunctionCallTemplate().formatUnicorn({
                 debugProtectionFunctionName: this.debugProtectionFunctionName

+ 4 - 3
src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts

@@ -1,6 +1,7 @@
+import * as ESTree from 'estree';
+
 import 'format-unicorn';
 
-import { INode } from "../../interfaces/nodes/INode";
 import { IOptions } from "../../interfaces/IOptions";
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
@@ -41,9 +42,9 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         return NodeUtils.convertCodeToStructure(
             DebugProtectionFunctionIntervalTemplate().formatUnicorn({
                 debugProtectionFunctionName: this.debugProtectionFunctionName

+ 4 - 3
src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts

@@ -1,6 +1,7 @@
+import * as ESTree from 'estree';
+
 import 'format-unicorn';
 
-import { INode } from "../../interfaces/nodes/INode";
 import { IOptions } from "../../interfaces/IOptions";
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
@@ -57,9 +58,9 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode {
     /**
      * Found this trick in JScrambler
      *
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         return NodeUtils.convertCodeToStructure(
             DebugProtectionFunctionTemplate().formatUnicorn({
                 debugProtectionFunctionName: this.debugProtectionFunctionName

+ 4 - 4
src/custom-nodes/domain-lock-nodes/DomainLockNode.ts

@@ -1,6 +1,6 @@
-import 'format-unicorn';
+import * as ESTree from 'estree';
 
-import { INode } from "../../interfaces/nodes/INode";
+import 'format-unicorn';
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
 
@@ -26,9 +26,9 @@ export class DomainLockNode extends AbstractCustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         let domainsString = this.options.domainLock.join(';'),
             [hiddenDomainsString, diff] = Utils.hideString(domainsString, domainsString.length * 3);
 

+ 3 - 3
src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts

@@ -1,4 +1,4 @@
-import { INode } from "../../interfaces/nodes/INode";
+import * as ESTree from 'estree';
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
 
@@ -37,9 +37,9 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         return NodeUtils.convertCodeToStructure(
             JavaScriptObfuscator.obfuscate(
                 SelfDefendingTemplate(),

+ 6 - 5
src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts

@@ -1,6 +1,7 @@
+import * as ESTree from 'estree';
+
 import 'format-unicorn';
 
-import { INode } from "../../interfaces/nodes/INode";
 import { IOptions } from "../../interfaces/IOptions";
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
@@ -73,16 +74,16 @@ export class UnicodeArrayCallsWrapper extends AbstractCustomNode {
     };
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public getNode (): INode {
+    public getNode (): ESTree.Node {
         return super.getNode();
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         let keyName: string = Utils.getRandomVariableName();
 
         return NodeUtils.convertCodeToStructure(

+ 6 - 5
src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts

@@ -1,6 +1,7 @@
+import * as ESTree from 'estree';
+
 import 'format-unicorn';
 
-import { INode } from "../../interfaces/nodes/INode";
 import { IOptions } from "../../interfaces/IOptions";
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
@@ -62,16 +63,16 @@ export class UnicodeArrayDecodeNode extends AbstractCustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public getNode (): INode {
+    public getNode (): ESTree.Node {
         return super.getNode();
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         const forLoopFunctionName: string = 'forLoopFunc';
 
         let code: string;

+ 6 - 5
src/custom-nodes/unicode-array-nodes/UnicodeArrayNode.ts

@@ -1,6 +1,7 @@
+import * as ESTree from 'estree';
+
 import 'format-unicorn';
 
-import { INode } from '../../interfaces/nodes/INode';
 import { IOptions } from "../../interfaces/IOptions";
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
@@ -85,9 +86,9 @@ export class UnicodeArrayNode extends AbstractCustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public getNode (): INode {
+    public getNode (): ESTree.Node {
         this.unicodeArray.rotateArray(this.unicodeArrayRotateValue);
 
         return super.getNode();
@@ -101,9 +102,9 @@ export class UnicodeArrayNode extends AbstractCustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         return NodeUtils.convertCodeToStructure(
             UnicodeArrayTemplate().formatUnicorn({
                 unicodeArrayName: this.unicodeArrayName,

+ 6 - 5
src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts

@@ -1,6 +1,7 @@
+import * as ESTree from 'estree';
+
 import 'format-unicorn';
 
-import { INode } from "../../interfaces/nodes/INode";
 import { IOptions } from "../../interfaces/IOptions";
 
 import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
@@ -70,16 +71,16 @@ export class UnicodeArrayRotateFunctionNode extends AbstractCustomNode {
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    public getNode (): INode {
+    public getNode (): ESTree.Node {
         return super.getNode();
     }
 
     /**
-     * @returns {INode}
+     * @returns {ESTree.Node}
      */
-    protected getNodeStructure (): INode {
+    protected getNodeStructure (): ESTree.Node {
         let code: string = '',
             timesName: string = Utils.getRandomVariableName(),
             whileFunctionName: string = Utils.getRandomVariableName();

+ 2 - 2
src/interfaces/INodeObfuscator.d.ts

@@ -1,9 +1,9 @@
-import { INode } from '../interfaces/nodes/INode';
+import * as ESTree from 'estree';
 
 export interface INodeObfuscator {
     /**
      * @param node
      * @param parentNode
      */
-    obfuscateNode (node: INode, parentNode?: INode): void;
+    obfuscateNode (node: ESTree.Node, parentNode?: ESTree.Node): void;
 }

+ 2 - 2
src/interfaces/IObfuscator.d.ts

@@ -1,5 +1,5 @@
-import { INode } from "./nodes/INode";
+import * as ESTree from 'estree';
 
 export interface IObfuscator {
-    obfuscateNode (node: INode): INode;
+    obfuscateNode (node: ESTree.Node): ESTree.Node;
 }

+ 0 - 3
src/interfaces/nodes/IArrowFunctionExpressionNode.d.ts

@@ -1,3 +0,0 @@
-import { IFunctionNode } from "./IFunctionNode";
-
-export interface IArrowFunctionExpressionNode extends IFunctionNode {}

+ 0 - 7
src/interfaces/nodes/IBlockStatementNode.d.ts

@@ -1,7 +0,0 @@
-import { TStatement } from "../../types/nodes/TStatement";
-
-import { INode } from "./INode";
-
-export interface IBlockStatementNode extends INode {
-    body: TStatement[];
-}

+ 0 - 9
src/interfaces/nodes/ICallExpressionNode.d.ts

@@ -1,9 +0,0 @@
-import { TExpression } from "../../types/nodes/TExpression";
-
-import { INode } from "./INode";
-import { ISpreadElementNode } from "./ISpreadElementNode";
-
-export interface ICallExpressionNode extends INode {
-    callee: TExpression;
-    arguments: TExpression[] | ISpreadElementNode[];
-}

+ 0 - 8
src/interfaces/nodes/ICatchClauseNode.d.ts

@@ -1,8 +0,0 @@
-import { IBlockStatementNode } from "./IBlockStatementNode";
-import { IIdentifierNode } from "./IIdentifierNode";
-import { INode } from "./INode";
-
-export interface ICatchClauseNode extends INode {
-    param: IIdentifierNode;
-    body: IBlockStatementNode;
-}

+ 0 - 7
src/interfaces/nodes/IExpressionStatementNode.d.ts

@@ -1,7 +0,0 @@
-import { TExpression } from "../../types/nodes/TExpression";
-
-import { INode } from "./INode";
-
-export interface IExpressionStatementNode extends INode {
-    expression: TExpression;
-}

+ 0 - 3
src/interfaces/nodes/IFunctionDeclarationNode.d.ts

@@ -1,3 +0,0 @@
-import { IFunctionNode } from "./IFunctionNode";
-
-export interface IFunctionDeclarationNode extends IFunctionNode {}

+ 0 - 3
src/interfaces/nodes/IFunctionExpressionNode.d.ts

@@ -1,3 +0,0 @@
-import { IFunctionNode } from "./IFunctionNode";
-
-export interface IFunctionExpressionNode extends IFunctionNode {}

+ 0 - 14
src/interfaces/nodes/IFunctionNode.d.ts

@@ -1,14 +0,0 @@
-import { TExpression } from "../../types/nodes/TExpression";
-
-import { IBlockStatementNode } from "./IBlockStatementNode";
-import { IIdentifierNode } from "./IIdentifierNode";
-import { INode } from "./INode";
-
-export interface IFunctionNode extends INode {
-    id: IIdentifierNode;
-    params: IIdentifierNode[];
-    defaults?: TExpression[];
-    body: IBlockStatementNode;
-    generator: boolean;
-    expression: boolean;
-}

+ 0 - 5
src/interfaces/nodes/IIdentifierNode.d.ts

@@ -1,5 +0,0 @@
-import { INode } from "./INode";
-
-export interface IIdentifierNode extends INode {
-    name: string;
-}

+ 0 - 8
src/interfaces/nodes/IIfStatementNode.ts

@@ -1,8 +0,0 @@
-import { IBlockStatementNode } from "./IBlockStatementNode";
-import { INode } from "./INode";
-
-export interface IIfStatementNode extends INode {
-    test: any;
-    consequent: IBlockStatementNode;
-    alternate: IBlockStatementNode | null;
-}

+ 5 - 0
src/interfaces/nodes/ILiteral.d.ts

@@ -0,0 +1,5 @@
+import * as ESTree from 'estree';
+
+interface ILiteral extends ESTree.SimpleLiteral {
+    'x-verbatim-property'?: any;
+}

+ 0 - 7
src/interfaces/nodes/ILiteralNode.d.ts

@@ -1,7 +0,0 @@
-import { INode } from "./INode";
-
-export interface ILiteralNode extends INode {
-    value: boolean|number|string;
-    raw: string;
-    'x-verbatim-property'?: any;
-}

+ 0 - 9
src/interfaces/nodes/IMemberExpressionNode.d.ts

@@ -1,9 +0,0 @@
-import { IIdentifierNode } from "./IIdentifierNode";
-import { ILiteralNode } from "./ILiteralNode";
-import { INode } from "./INode";
-
-export interface IMemberExpressionNode extends INode {
-    computed: boolean;
-    object: IIdentifierNode;
-    property: IIdentifierNode|ILiteralNode;
-}

+ 0 - 12
src/interfaces/nodes/IMethodDefinitionNode.d.ts

@@ -1,12 +0,0 @@
-import { IFunctionExpressionNode } from "./IFunctionExpressionNode";
-import { IIdentifierNode } from "./IIdentifierNode";
-import { ILiteralNode } from "./ILiteralNode";
-import { INode } from "./INode";
-
-export interface IMethodDefinitionNode extends INode {
-    key: IIdentifierNode|ILiteralNode;
-    computed: boolean;
-    value: IFunctionExpressionNode;
-    kind: string;
-    static: boolean;
-}

+ 4 - 3
src/interfaces/nodes/INode.d.ts

@@ -1,4 +1,5 @@
-export interface INode {
-    type: string;
-    parentNode?: INode;
+import * as ESTree from 'estree';
+
+export interface INode extends ESTree.BaseNode {
+    parentNode?: ESTree.Node;
 }

+ 0 - 6
src/interfaces/nodes/IObjectExpressionNode.d.ts

@@ -1,6 +0,0 @@
-import { IPropertyNode } from "./IPropertyNode";
-import { INode } from "./INode";
-
-export interface IObjectExpressionNode extends INode {
-    properties: IPropertyNode[];
-}

+ 0 - 8
src/interfaces/nodes/IProgramNode.d.ts

@@ -1,8 +0,0 @@
-import { TStatement } from "../../types/nodes/TStatement";
-
-import { INode } from "./INode";
-
-export interface IProgramNode extends INode {
-    body: TStatement[];
-    sourceType: string;
-}

+ 0 - 12
src/interfaces/nodes/IPropertyNode.d.ts

@@ -1,12 +0,0 @@
-import { IIdentifierNode } from "./IIdentifierNode";
-import { ILiteralNode } from "./ILiteralNode";
-import { INode } from "./INode";
-
-export interface IPropertyNode extends INode {
-    key: IIdentifierNode|ILiteralNode;
-    computed: boolean;
-    value: IIdentifierNode|ILiteralNode;
-    kind: string;
-    method: boolean;
-    shorthand: boolean;
-}

+ 0 - 7
src/interfaces/nodes/ISpreadElementNode.d.ts

@@ -1,7 +0,0 @@
-import { TExpression } from "../../types/nodes/TExpression";
-
-import { INode } from "./INode";
-
-export interface ISpreadElementNode extends INode {
-    argument: TExpression;
-}

+ 0 - 7
src/interfaces/nodes/IVariableDeclarationNode.d.ts

@@ -1,7 +0,0 @@
-import { INode } from "./INode";
-import { IVariableDeclaratorNode } from "./IVariableDeclaratorNode";
-
-export interface IVariableDeclarationNode extends INode {
-    declarations: IVariableDeclaratorNode[];
-    kind: string;
-}

+ 0 - 7
src/interfaces/nodes/IVariableDeclaratorNode.d.ts

@@ -1,7 +0,0 @@
-import { IIdentifierNode } from "./IIdentifierNode";
-import { INode } from "./INode";
-
-export interface IVariableDeclaratorNode extends INode {
-    id: IIdentifierNode;
-    init: any;
-}

+ 3 - 2
src/node-obfuscators/AbstractNodeObfuscator.ts

@@ -1,6 +1,7 @@
+import * as ESTree from 'estree';
+
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
 import { INodeObfuscator } from '../interfaces/INodeObfuscator';
-import { INode } from "../interfaces/nodes/INode";
 import { IOptions } from "../interfaces/IOptions";
 
 export abstract class AbstractNodeObfuscator implements INodeObfuscator {
@@ -27,5 +28,5 @@ export abstract class AbstractNodeObfuscator implements INodeObfuscator {
      * @param node
      * @param parentNode
      */
-    public abstract obfuscateNode (node: INode, parentNode?: INode): void;
+    public abstract obfuscateNode (node: ESTree.Node, parentNode?: ESTree.Node): void;
 }

+ 6 - 8
src/node-obfuscators/CatchClauseObfuscator.ts

@@ -1,9 +1,7 @@
 import * as estraverse from 'estraverse';
+import * as ESTree from 'estree';
 
-import { ICatchClauseNode } from "../interfaces/nodes/ICatchClauseNode";
 import { ICustomNode } from "../interfaces/custom-nodes/ICustomNode";
-import { IIdentifierNode } from "../interfaces/nodes/IIdentifierNode";
-import { INode } from '../interfaces/nodes/INode';
 import { IOptions } from "../interfaces/IOptions";
 
 import { NodeType } from "../enums/NodeType";
@@ -40,7 +38,7 @@ export class CatchClauseObfuscator extends AbstractNodeObfuscator {
     /**
      * @param catchClauseNode
      */
-    public obfuscateNode (catchClauseNode: ICatchClauseNode): void {
+    public obfuscateNode (catchClauseNode: ESTree.CatchClause): void {
         this.storeCatchClauseParam(catchClauseNode);
         this.replaceCatchClauseParam(catchClauseNode);
     }
@@ -48,18 +46,18 @@ export class CatchClauseObfuscator extends AbstractNodeObfuscator {
     /**
      * @param catchClauseNode
      */
-    private storeCatchClauseParam (catchClauseNode: ICatchClauseNode): void {
+    private storeCatchClauseParam (catchClauseNode: ESTree.CatchClause): void {
         NodeUtils.typedReplace(catchClauseNode.param, NodeType.Identifier, {
-            leave: (node: IIdentifierNode) => this.identifierReplacer.storeNames(node.name)
+            leave: (node: ESTree.Identifier) => this.identifierReplacer.storeNames(node.name)
         });
     }
 
     /**
      * @param catchClauseNode
      */
-    private replaceCatchClauseParam (catchClauseNode: ICatchClauseNode): void {
+    private replaceCatchClauseParam (catchClauseNode: ESTree.CatchClause): void {
         estraverse.replace(catchClauseNode, {
-            leave: (node: INode, parentNode: INode): any => {
+            leave: (node: ESTree.Node, parentNode: ESTree.Node): any => {
                 if (Nodes.isReplaceableIdentifierNode(node, parentNode)) {
                     node.name = this.identifierReplacer.replace(node.name);
                 }

+ 7 - 9
src/node-obfuscators/FunctionDeclarationObfuscator.ts

@@ -1,9 +1,7 @@
 import * as estraverse from 'estraverse';
+import * as ESTree from 'estree';
 
 import { ICustomNode } from "../interfaces/custom-nodes/ICustomNode";
-import { IFunctionDeclarationNode } from "../interfaces/nodes/IFunctionDeclarationNode";
-import { IIdentifierNode } from "../interfaces/nodes/IIdentifierNode";
-import { INode } from "../interfaces/nodes/INode";
 import { IOptions } from "../interfaces/IOptions";
 
 import { NodeType } from "../enums/NodeType";
@@ -42,7 +40,7 @@ export class FunctionDeclarationObfuscator extends AbstractNodeObfuscator {
      * @param functionDeclarationNode
      * @param parentNode
      */
-    public obfuscateNode (functionDeclarationNode: IFunctionDeclarationNode, parentNode: INode): void {
+    public obfuscateNode (functionDeclarationNode: ESTree.FunctionDeclaration, parentNode: ESTree.Node): void {
         if (parentNode.type === NodeType.Program) {
             return;
         }
@@ -54,22 +52,22 @@ export class FunctionDeclarationObfuscator extends AbstractNodeObfuscator {
     /**
      * @param functionDeclarationNode
      */
-    private storeFunctionName (functionDeclarationNode: IFunctionDeclarationNode): void {
+    private storeFunctionName (functionDeclarationNode: ESTree.FunctionDeclaration): void {
         NodeUtils.typedReplace(functionDeclarationNode.id, NodeType.Identifier, {
-            leave: (node: IIdentifierNode) => this.identifierReplacer.storeNames(node.name)
+            leave: (node: ESTree.Identifier) => this.identifierReplacer.storeNames(node.name)
         });
     }
 
     /**
      * @param functionDeclarationNode
      */
-    private replaceFunctionName (functionDeclarationNode: IFunctionDeclarationNode): void {
-        let scopeNode: INode = NodeUtils.getBlockScopeOfNode(
+    private replaceFunctionName (functionDeclarationNode: ESTree.FunctionDeclaration): void {
+        let scopeNode: ESTree.Node = NodeUtils.getBlockScopeOfNode(
             functionDeclarationNode
         );
 
         estraverse.replace(scopeNode, {
-            enter: (node: INode, parentNode: INode): any => {
+            enter: (node: ESTree.Node, parentNode: ESTree.Node): any => {
                 if (Nodes.isReplaceableIdentifierNode(node, parentNode)) {
                     node.name = this.identifierReplacer.replace(node.name);
                 }

+ 8 - 10
src/node-obfuscators/FunctionObfuscator.ts

@@ -1,9 +1,7 @@
 import * as estraverse from 'estraverse';
+import * as ESTree from 'estree';
 
 import { ICustomNode } from "../interfaces/custom-nodes/ICustomNode";
-import { IFunctionNode } from "../interfaces/nodes/IFunctionNode";
-import { IIdentifierNode } from "../interfaces/nodes/IIdentifierNode";
-import { INode } from "../interfaces/nodes/INode";
 import { IOptions } from "../interfaces/IOptions";
 
 import { NodeType } from "../enums/NodeType";
@@ -40,7 +38,7 @@ export class FunctionObfuscator extends AbstractNodeObfuscator {
     /**
      * @param functionNode
      */
-    public obfuscateNode (functionNode: IFunctionNode): void {
+    public obfuscateNode (functionNode: ESTree.Function): void {
         this.storeFunctionParams(functionNode);
         this.replaceFunctionParams(functionNode);
     }
@@ -48,11 +46,11 @@ export class FunctionObfuscator extends AbstractNodeObfuscator {
     /**
      * @param functionNode
      */
-    private storeFunctionParams (functionNode: IFunctionNode): void {
+    private storeFunctionParams (functionNode: ESTree.Function): void {
         functionNode.params
-            .forEach((paramsNode: INode) => {
+            .forEach((paramsNode: ESTree.Node) => {
                 NodeUtils.typedReplace(paramsNode, NodeType.Identifier, {
-                    leave: (node: IIdentifierNode) => this.identifierReplacer.storeNames(node.name)
+                    leave: (node: ESTree.Identifier) => this.identifierReplacer.storeNames(node.name)
                 });
             });
     }
@@ -60,9 +58,9 @@ export class FunctionObfuscator extends AbstractNodeObfuscator {
     /**
      * @param functionNode
      */
-    private replaceFunctionParams (functionNode: IFunctionNode): void {
+    private replaceFunctionParams (functionNode: ESTree.Function): void {
         let replaceVisitor: estraverse.Visitor = {
-            leave: (node: INode, parentNode: INode): any => {
+            leave: (node: ESTree.Node, parentNode: ESTree.Node): any => {
                 if (Nodes.isReplaceableIdentifierNode(node, parentNode)) {
                     node.name = this.identifierReplacer.replace(node.name);
                 }
@@ -70,7 +68,7 @@ export class FunctionObfuscator extends AbstractNodeObfuscator {
         };
 
         functionNode.params
-            .forEach((paramsNode: INode) => {
+            .forEach((paramsNode: ESTree.Node) => {
                 estraverse.replace(paramsNode, replaceVisitor);
             });
 

+ 2 - 4
src/node-obfuscators/LiteralObfuscator.ts

@@ -1,7 +1,5 @@
 import * as escodegen from 'escodegen';
-
-import { ILiteralNode } from "../interfaces/nodes/ILiteralNode";
-import { INode } from "../interfaces/nodes/INode";
+import * as ESTree from 'estree';
 
 import { AbstractNodeObfuscator } from './AbstractNodeObfuscator';
 import { BooleanLiteralReplacer } from "./replacers/BooleanLiteralReplacer";
@@ -14,7 +12,7 @@ export class LiteralObfuscator extends AbstractNodeObfuscator {
      * @param literalNode
      * @param parentNode
      */
-    public obfuscateNode (literalNode: ILiteralNode, parentNode: INode): void {
+    public obfuscateNode (literalNode: ESTree.Literal, parentNode: ESTree.Node): void {
         if (Nodes.isPropertyNode(parentNode) && parentNode.key === literalNode) {
             return;
         }

+ 6 - 10
src/node-obfuscators/MemberExpressionObfuscator.ts

@@ -1,10 +1,6 @@
 import * as escodegen from 'escodegen';
 import * as estraverse from 'estraverse';
-
-import { IIdentifierNode } from "../interfaces/nodes/IIdentifierNode";
-import { ILiteralNode } from "../interfaces/nodes/ILiteralNode";
-import { IMemberExpressionNode } from "../interfaces/nodes/IMemberExpressionNode";
-import { INode } from "../interfaces/nodes/INode";
+import * as ESTree from 'estree';
 
 import { NodeType } from "../enums/NodeType";
 
@@ -16,9 +12,9 @@ export class MemberExpressionObfuscator extends AbstractNodeObfuscator {
     /**
      * @param memberExpressionNode
      */
-    public obfuscateNode (memberExpressionNode: IMemberExpressionNode): void {
+    public obfuscateNode (memberExpressionNode: ESTree.MemberExpression): void {
         estraverse.replace(memberExpressionNode.property, {
-            leave: (node: INode, parentNode: INode): any => {
+            leave: (node: ESTree.Node, parentNode: ESTree.Node): any => {
                 if (Nodes.isLiteralNode(node)) {
                     this.obfuscateLiteralProperty(node);
 
@@ -49,9 +45,9 @@ export class MemberExpressionObfuscator extends AbstractNodeObfuscator {
      *
      * @param node
      */
-    private obfuscateIdentifierProperty (node: IIdentifierNode): void {
+    private obfuscateIdentifierProperty (node: ESTree.Identifier): void {
         let nodeValue: string = node.name,
-            literalNode: ILiteralNode = {
+            literalNode: ESTree.Literal = {
                 raw: `'${nodeValue}'`,
                 'x-verbatim-property': {
                     content : new StringLiteralReplacer(this.nodes, this.options).replace(nodeValue),
@@ -75,7 +71,7 @@ export class MemberExpressionObfuscator extends AbstractNodeObfuscator {
      *
      * @param node
      */
-    private obfuscateLiteralProperty (node: ILiteralNode): void {
+    private obfuscateLiteralProperty (node: ESTree.Literal): void {
         if (typeof node.value === 'string' && !node['x-verbatim-property']) {
             node['x-verbatim-property'] = {
                 content : new StringLiteralReplacer(this.nodes, this.options).replace(node.value),

+ 4 - 6
src/node-obfuscators/MethodDefinitionObfuscator.ts

@@ -1,7 +1,5 @@
 import * as estraverse from 'estraverse';
-
-import { IMethodDefinitionNode } from "../interfaces/nodes/IMethodDefinitionNode";
-import { INode } from "../interfaces/nodes/INode";
+import * as ESTree from 'estree';
 
 import { AbstractNodeObfuscator } from './AbstractNodeObfuscator';
 import { Nodes } from "../Nodes";
@@ -25,16 +23,16 @@ export class MethodDefinitionObfuscator extends AbstractNodeObfuscator {
      * @param methodDefinitionNode
      * @param parentNode
      */
-    public obfuscateNode (methodDefinitionNode: IMethodDefinitionNode, parentNode: INode): void {
+    public obfuscateNode (methodDefinitionNode: ESTree.MethodDefinition, parentNode: ESTree.Node): void {
         this.replaceMethodName(methodDefinitionNode);
     }
 
     /**
      * @param methodDefinitionNode
      */
-    private replaceMethodName (methodDefinitionNode: IMethodDefinitionNode): void {
+    private replaceMethodName (methodDefinitionNode: ESTree.MethodDefinition): void {
         estraverse.replace(methodDefinitionNode.key, {
-            leave: (node: INode): any => {
+            leave: (node: ESTree.Node): any => {
                 if (
                     Nodes.isIdentifierNode(node) &&
                     !Utils.arrayContains(this.ignoredNames, node.name) &&

+ 7 - 12
src/node-obfuscators/ObjectExpressionObfuscator.ts

@@ -1,11 +1,6 @@
 import * as escodegen from 'escodegen';
 import * as estraverse from 'estraverse';
-
-import { IIdentifierNode } from "../interfaces/nodes/IIdentifierNode";
-import { ILiteralNode } from "../interfaces/nodes/ILiteralNode";
-import { IObjectExpressionNode } from "../interfaces/nodes/IObjectExpressionNode";
-import { IPropertyNode } from "../interfaces/nodes/IPropertyNode";
-import { INode } from "../interfaces/nodes/INode";
+import * as ESTree from 'estree';
 
 import { NodeType } from "../enums/NodeType";
 
@@ -27,11 +22,11 @@ export class ObjectExpressionObfuscator extends AbstractNodeObfuscator {
     /**
      * @param objectExpressionNode
      */
-    public obfuscateNode (objectExpressionNode: IObjectExpressionNode): void {
+    public obfuscateNode (objectExpressionNode: ESTree.ObjectExpression): void {
         objectExpressionNode.properties
-            .forEach((property: IPropertyNode) => {
+            .forEach((property: ESTree.Property) => {
                 estraverse.replace(property.key, {
-                    leave: (node: INode, parentNode: INode): any => {
+                    leave: (node: ESTree.Node, parentNode: ESTree.Node): any => {
                         if (Nodes.isLiteralNode(node)) {
                             this.obfuscateLiteralPropertyKey(node);
 
@@ -49,7 +44,7 @@ export class ObjectExpressionObfuscator extends AbstractNodeObfuscator {
     /**
      * @param node
      */
-    private obfuscateLiteralPropertyKey (node: ILiteralNode): void {
+    private obfuscateLiteralPropertyKey (node: ESTree.Literal): void {
         if (typeof node.value === 'string' && !node['x-verbatim-property']) {
             node['x-verbatim-property'] = {
                 content : Utils.stringToUnicode(node.value),
@@ -61,9 +56,9 @@ export class ObjectExpressionObfuscator extends AbstractNodeObfuscator {
     /**
      * @param node
      */
-    private obfuscateIdentifierPropertyKey (node: IIdentifierNode): void {
+    private obfuscateIdentifierPropertyKey (node: ESTree.Identifier): void {
         let nodeValue: string = node.name,
-            literalNode: ILiteralNode = {
+            literalNode: ESTree.Literal = {
                 raw: `'${nodeValue}'`,
                 'x-verbatim-property': {
                     content : Utils.stringToUnicode(nodeValue),

+ 9 - 12
src/node-obfuscators/VariableDeclarationObfuscator.ts

@@ -1,11 +1,8 @@
 import * as estraverse from 'estraverse';
+import * as ESTree from 'estree';
 
 import { ICustomNode } from "../interfaces/custom-nodes/ICustomNode";
-import { IIdentifierNode } from "../interfaces/nodes/IIdentifierNode";
-import { INode } from "../interfaces/nodes/INode";
 import { IOptions } from "../interfaces/IOptions";
-import { IVariableDeclarationNode } from "../interfaces/nodes/IVariableDeclarationNode";
-import { IVariableDeclaratorNode } from "../interfaces/nodes/IVariableDeclaratorNode";
 
 import { NodeType } from "../enums/NodeType";
 
@@ -44,7 +41,7 @@ export class VariableDeclarationObfuscator extends AbstractNodeObfuscator {
      * @param variableDeclarationNode
      * @param parentNode
      */
-    public obfuscateNode (variableDeclarationNode: IVariableDeclarationNode, parentNode: INode): void {
+    public obfuscateNode (variableDeclarationNode: ESTree.VariableDeclaration, parentNode: ESTree.Node): void {
         if (parentNode.type === NodeType.Program) {
             return;
         }
@@ -56,11 +53,11 @@ export class VariableDeclarationObfuscator extends AbstractNodeObfuscator {
     /**
      * @param variableDeclarationNode
      */
-    private storeVariableNames (variableDeclarationNode: IVariableDeclarationNode): void {
+    private storeVariableNames (variableDeclarationNode: ESTree.VariableDeclaration): void {
         variableDeclarationNode.declarations
-            .forEach((declarationNode: IVariableDeclaratorNode) => {
+            .forEach((declarationNode: ESTree.VariableDeclarator) => {
                 NodeUtils.typedReplace(declarationNode.id, NodeType.Identifier, {
-                    leave: (node: IIdentifierNode) => this.identifierReplacer.storeNames(node.name)
+                    leave: (node: ESTree.Identifier) => this.identifierReplacer.storeNames(node.name)
                 });
             });
     }
@@ -69,21 +66,21 @@ export class VariableDeclarationObfuscator extends AbstractNodeObfuscator {
      * @param variableDeclarationNode
      * @param variableParentNode
      */
-    private replaceVariableNames (variableDeclarationNode: IVariableDeclarationNode, variableParentNode: INode): void {
-        let scopeNode: INode = variableDeclarationNode.kind === 'var' ? NodeUtils.getBlockScopeOfNode(
+    private replaceVariableNames (variableDeclarationNode: ESTree.VariableDeclaration, variableParentNode: ESTree.Node): void {
+        let scopeNode: ESTree.Node = variableDeclarationNode.kind === 'var' ? NodeUtils.getBlockScopeOfNode(
                 variableDeclarationNode
             ) : variableParentNode,
             isNodeAfterVariableDeclaratorFlag: boolean = false;
 
         estraverse.replace(scopeNode, {
-            enter: (node: INode, parentNode: INode): any => {
+            enter: (node: ESTree.Node, parentNode: ESTree.Node): any => {
                 if (
                     Nodes.isArrowFunctionExpressionNode(node) ||
                     Nodes.isFunctionDeclarationNode(node) ||
                     Nodes.isFunctionExpressionNode(node)
                 ) {
                     estraverse.replace(node, {
-                        enter: (node: INode, parentNode: INode): any => {
+                        enter: (node: ESTree.Node, parentNode: ESTree.Node): any => {
                             if (Nodes.isReplaceableIdentifierNode(node, parentNode)) {
                                 node.name = this.identifierReplacer.replace(node.name);
                             }

+ 2 - 3
src/types/TNodeWithBlockStatement.d.ts

@@ -1,4 +1,3 @@
-import { IBlockStatementNode } from "../interfaces/nodes/IBlockStatementNode";
-import { IProgramNode } from "../interfaces/nodes/IProgramNode";
+import * as ESTree from 'estree';
 
-export type TNodeWithBlockStatement = IBlockStatementNode|IProgramNode;
+export type TNodeWithBlockStatement = ESTree.BlockStatement|ESTree.Program;

+ 1 - 1
src/types/TOptionsNormalizerRule.d.ts

@@ -1,3 +1,3 @@
-import {IOptions} from "../interfaces/IOptions";
+import { IOptions } from "../interfaces/IOptions";
 
 export type TOptionsNormalizerRule = (options: IOptions) => IOptions;

+ 0 - 9
src/types/nodes/TExpression.d.ts

@@ -1,9 +0,0 @@
-import { IArrowFunctionExpressionNode } from "../../interfaces/nodes/IArrowFunctionExpressionNode";
-import { ICallExpressionNode } from "../../interfaces/nodes/ICallExpressionNode";
-import { IFunctionExpressionNode } from "../../interfaces/nodes/IFunctionExpressionNode";
-import { IIdentifierNode } from "../../interfaces/nodes/IIdentifierNode";
-import { ILiteralNode } from "../../interfaces/nodes/ILiteralNode";
-import { IMemberExpressionNode } from "../../interfaces/nodes/IMemberExpressionNode";
-
-export type TExpression = IArrowFunctionExpressionNode | ICallExpressionNode | IFunctionExpressionNode |
-    IIdentifierNode | ILiteralNode | IMemberExpressionNode;

+ 0 - 7
src/types/nodes/TStatement.d.ts

@@ -1,7 +0,0 @@
-import { IExpressionStatementNode } from "../../interfaces/nodes/IExpressionStatementNode";
-import { IFunctionDeclarationNode } from "../../interfaces/nodes/IFunctionDeclarationNode";
-import { IIfStatementNode } from "../../interfaces/nodes/IIfStatementNode";
-import { IVariableDeclarationNode } from "../../interfaces/nodes/IVariableDeclarationNode";
-
-export type TStatement = IExpressionStatementNode | IFunctionDeclarationNode | IIfStatementNode |
-    IVariableDeclarationNode;

+ 33 - 49
test/mocks/NodeMocks.ts

@@ -1,30 +1,14 @@
 import * as escodegen from 'escodegen';
-
-import { TExpression } from "../../src/types/nodes/TExpression";
-import { TStatement } from "../../src/types/nodes/TStatement";
-
-import { IBlockStatementNode } from "../../src/interfaces/nodes/IBlockStatementNode";
-import { ICallExpressionNode } from "../../src/interfaces/nodes/ICallExpressionNode";
-import { ICatchClauseNode } from "../../src/interfaces/nodes/ICatchClauseNode";
-import { IExpressionStatementNode } from "../../src/interfaces/nodes/IExpressionStatementNode";
-import { IFunctionDeclarationNode } from "../../src/interfaces/nodes/IFunctionDeclarationNode";
-import { IIdentifierNode } from "../../src/interfaces/nodes/IIdentifierNode";
-import { IIfStatementNode } from "../../src/interfaces/nodes/IIfStatementNode";
-import { ILiteralNode } from "../../src/interfaces/nodes/ILiteralNode";
-import { IMemberExpressionNode } from "../../src/interfaces/nodes/IMemberExpressionNode";
-import { IProgramNode } from "../../src/interfaces/nodes/IProgramNode";
-import { ISpreadElementNode } from "../../src/interfaces/nodes/ISpreadElementNode";
-import { IVariableDeclarationNode } from "../../src/interfaces/nodes/IVariableDeclarationNode";
-import { IVariableDeclaratorNode } from "../../src/interfaces/nodes/IVariableDeclaratorNode";
+import * as ESTree from 'estree';
 
 import { NodeType } from "../../src/enums/NodeType";
 
 export class NodeMocks {
     /**
      * @param bodyNodes
-     * @returns {IProgramNode}
+     * @returns {ESTree.Program}
      */
-    public static getProgramNode (bodyNodes: TStatement[] = []): IProgramNode {
+    public static getProgramNode (bodyNodes: ESTree.Statement[] = []): ESTree.Program {
         return {
             type: NodeType.Program,
             body: bodyNodes,
@@ -34,9 +18,9 @@ export class NodeMocks {
 
     /**
      * @param bodyNodes
-     * @returns {IBlockStatementNode}
+     * @returns {ESTree.BlockStatement}
      */
-    public static getBlockStatementNode (bodyNodes: TStatement[] = []): IBlockStatementNode {
+    public static getBlockStatementNode (bodyNodes: ESTree.Statement[] = []): ESTree.BlockStatement {
         return {
             type: NodeType.BlockStatement,
             body: bodyNodes
@@ -45,9 +29,9 @@ export class NodeMocks {
 
     /**
      * @param bodyNodes
-     * @returns {ICatchClauseNode}
+     * @returns {ESTree.CatchClause}
      */
-    public static getCatchClauseNode (bodyNodes: TStatement[] = []): ICatchClauseNode {
+    public static getCatchClauseNode (bodyNodes: ESTree.Statement[] = []): ESTree.CatchClause {
         return {
             type: NodeType.CatchClause,
             param: NodeMocks.getIdentifierNode('err'),
@@ -58,12 +42,12 @@ export class NodeMocks {
     /**
      * @param callee
      * @param args
-     * @returns {ICallExpressionNode}
+     * @returns {ESTree.CallExpression}
      */
     public static getCallExpressionNode (
-        callee: TExpression,
-        args: TExpression[] | ISpreadElementNode[] = []
-    ): ICallExpressionNode {
+        callee: ESTree.Expression,
+        args: ESTree.Expression[] | ESTree.SpreadElement[] = []
+    ): ESTree.CallExpression {
         return {
             type: NodeType.CallExpression,
             callee: callee,
@@ -73,11 +57,11 @@ export class NodeMocks {
 
     /**
      * @param expression
-     * @returns {IExpressionStatementNode}
+     * @returns {ESTree.ExpressionStatement}
      */
     public static getExpressionStatementNode (
-        expression: TExpression = NodeMocks.getIdentifierNode()
-    ): IExpressionStatementNode {
+        expression: ESTree.Expression = NodeMocks.getIdentifierNode()
+    ): ESTree.ExpressionStatement {
         return {
             type: NodeType.ExpressionStatement,
             expression: expression
@@ -88,13 +72,13 @@ export class NodeMocks {
      * @param functionName
      * @param blockStatementNode
      * @param params
-     * @returns {IFunctionDeclarationNode}
+     * @returns {ESTree.FunctionDeclaration}
      */
     public static getFunctionDeclarationNode (
         functionName: string,
-        blockStatementNode: IBlockStatementNode,
-        params: IIdentifierNode[] = []
-    ): IFunctionDeclarationNode {
+        blockStatementNode: ESTree.BlockStatement,
+        params: ESTree.Identifier[] = []
+    ): ESTree.FunctionDeclaration {
         return {
             type: NodeType.FunctionDeclaration,
             id: NodeMocks.getIdentifierNode(functionName),
@@ -107,9 +91,9 @@ export class NodeMocks {
 
     /**
      * @param blockStatementNode
-     * @returns {IIfStatementNode}
+     * @returns {ESTree.IfStatement}
      */
-    public static getIfStatementNode (blockStatementNode: IBlockStatementNode): IIfStatementNode {
+    public static getIfStatementNode (blockStatementNode: ESTree.BlockStatement): ESTree.IfStatement {
         return {
             type: 'IfStatement',
             test: {
@@ -124,9 +108,9 @@ export class NodeMocks {
 
     /**
      * @param identifierName
-     * @returns {IIdentifierNode}
+     * @returns {ESTree.Identifier}
      */
-    public static getIdentifierNode (identifierName: string = 'identifier'): IIdentifierNode {
+    public static getIdentifierNode (identifierName: string = 'identifier'): ESTree.Identifier {
         return {
             type: NodeType.Identifier,
             name: identifierName,
@@ -135,9 +119,9 @@ export class NodeMocks {
 
     /**
      * @param value
-     * @returns {ILiteralNode}
+     * @returns {ESTree.Literal}
      */
-    public static getLiteralNode (value: boolean|number|string = 'value'): ILiteralNode {
+    public static getLiteralNode (value: boolean|number|string = 'value'): ESTree.Literal {
         return {
             type: NodeType.Literal,
             value: value,
@@ -152,12 +136,12 @@ export class NodeMocks {
     /**
      * @param object
      * @param property
-     * @return {IMemberExpressionNode}
+     * @return {ESTree.MemberExpression}
      */
     public static getMemberExpressionNode (
-        object: IIdentifierNode,
-        property: IIdentifierNode|ILiteralNode
-    ): IMemberExpressionNode {
+        object: ESTree.Identifier,
+        property: ESTree.Identifier|ESTree.Literal
+    ): ESTree.MemberExpression {
         return {
             type: NodeType.MemberExpression,
             computed: false,
@@ -169,12 +153,12 @@ export class NodeMocks {
     /**
      * @param declarations
      * @param kind
-     * @returns {IVariableDeclarationNode}
+     * @returns {ESTree.VariableDeclaration}
      */
     public static getVariableDeclarationNode (
-        declarations: IVariableDeclaratorNode[] = [],
+        declarations: ESTree.VariableDeclarator[] = [],
         kind: string = 'var'
-    ): IVariableDeclarationNode {
+    ): ESTree.VariableDeclaration {
         return {
             type: NodeType.VariableDeclaration,
             declarations: declarations,
@@ -185,9 +169,9 @@ export class NodeMocks {
     /**
      * @param id
      * @param init
-     * @returns {IVariableDeclaratorNode}
+     * @returns {ESTree.VariableDeclarator}
      */
-    public static getVariableDeclaratorNode (id: IIdentifierNode, init: any): IVariableDeclaratorNode {
+    public static getVariableDeclaratorNode (id: ESTree.Identifier, init: any): ESTree.VariableDeclarator {
         return {
             type: NodeType.VariableDeclarator,
             id: id,

+ 47 - 57
test/unit-tests/NodeUtils.spec.ts

@@ -1,15 +1,5 @@
 import * as chai from 'chai';
-
-import { IBlockStatementNode } from "../../src/interfaces/nodes/IBlockStatementNode";
-import { IExpressionStatementNode } from "../../src/interfaces/nodes/IExpressionStatementNode";
-import { IFunctionDeclarationNode } from "../../src/interfaces/nodes/IFunctionDeclarationNode";
-import { IIdentifierNode } from "../../src/interfaces/nodes/IIdentifierNode";
-import { IIfStatementNode } from "../../src/interfaces/nodes/IIfStatementNode";
-import { ILiteralNode } from "../../src/interfaces/nodes/ILiteralNode";
-import { INode } from "../../src/interfaces/nodes/INode";
-import { IProgramNode } from "../../src/interfaces/nodes/IProgramNode";
-import { IVariableDeclarationNode } from "../../src/interfaces/nodes/IVariableDeclarationNode";
-import { IVariableDeclaratorNode } from "../../src/interfaces/nodes/IVariableDeclaratorNode";
+import * as ESTree from 'estree';
 
 import { NodeMocks } from '../mocks/NodeMocks';
 import { NodeUtils } from '../../src/NodeUtils';
@@ -19,7 +9,7 @@ chai.use(require('chai-members-deep'));
 const assert: any = chai.assert;
 
 describe('NodeUtils', () => {
-    describe('addXVerbatimPropertyToLiterals (node: INode): void', () => {
+    describe('addXVerbatimPropertyToLiterals (node: ESTree.Node): void', () => {
         let literalNode: any,
             expectedLiteralNode: any;
 
@@ -37,10 +27,10 @@ describe('NodeUtils', () => {
         });
     });
 
-    describe('appendNode (blockScopeBody: INode[], node: INode): void', () => {
-        let blockStatementNode: IBlockStatementNode,
-            expectedBlockStatementNode: IBlockStatementNode,
-            expressionStatementNode: IExpressionStatementNode;
+    describe('appendNode (blockScopeBody: ESTree.Node[], node: ESTree.Node): void', () => {
+        let blockStatementNode: ESTree.BlockStatement,
+            expectedBlockStatementNode: ESTree.BlockStatement,
+            expressionStatementNode: ESTree.ExpressionStatement;
 
         beforeEach(() => {
             expressionStatementNode = NodeMocks.getExpressionStatementNode();
@@ -60,20 +50,20 @@ describe('NodeUtils', () => {
 
         it('should does not change `BlockStatement` node body if given node is not a valid Node', () => {
             assert.doesNotChange(
-                () => NodeUtils.appendNode(blockStatementNode.body, <INode>{}),
+                () => NodeUtils.appendNode(blockStatementNode.body, <ESTree.Node>{}),
                 blockStatementNode,
                 'body'
             );
         });
     });
 
-    describe('convertCodeToStructure (code: string): INode', () => {
+    describe('convertCodeToStructure (code: string): ESTree.Node', () => {
         let code: string,
-            identifierNode: IIdentifierNode,
-            literalNode: ILiteralNode,
-            programNode: IProgramNode,
-            variableDeclarationNode: IVariableDeclarationNode,
-            variableDeclaratorNode: IVariableDeclaratorNode;
+            identifierNode: ESTree.Identifier,
+            literalNode: ESTree.Literal,
+            programNode: ESTree.Program,
+            variableDeclarationNode: ESTree.VariableDeclaration,
+            variableDeclaratorNode: ESTree.VariableDeclarator;
 
         beforeEach(() => {
             code = `
@@ -101,15 +91,15 @@ describe('NodeUtils', () => {
             literalNode['parentNode'] = variableDeclaratorNode;
         });
 
-        it('should convert code to `INode` structure', () => {
+        it('should convert code to `ESTree.Node` structure', () => {
             assert.deepEqualIdent(NodeUtils.convertCodeToStructure(code), variableDeclarationNode);
         });
     });
 
-    describe('getBlockStatementNodeByIndex (node: INode, index: number = 0): INode', () => {
-        let blockStatementNode: IBlockStatementNode,
-            expressionStatementNode1: IExpressionStatementNode,
-            expressionStatementNode2: IExpressionStatementNode;
+    describe('getBlockStatementNodeByIndex (node: ESTree.Node, index: number = 0): ESTree.Node', () => {
+        let blockStatementNode: ESTree.BlockStatemen,
+            expressionStatementNode1: ESTree.ExpressionStatement,
+            expressionStatementNode2: ESTree.ExpressionStatement;
 
         beforeEach(() => {
             expressionStatementNode1 = NodeMocks.getExpressionStatementNode();
@@ -135,17 +125,17 @@ describe('NodeUtils', () => {
         });
     });
 
-    describe('getBlockScopeOfNode (node: INode, depth: number = 0): TNodeWithBlockStatement', () => {
-        let functionDeclarationBlockStatementNode: IBlockStatementNode,
-            ifStatementBlockStatementNode1: IBlockStatementNode,
-            ifStatementBlockStatementNode2: IBlockStatementNode,
-            ifStatementNode1: IIfStatementNode,
-            ifStatementNode2: IIfStatementNode,
-            expressionStatementNode1: IExpressionStatementNode,
-            expressionStatementNode2: IExpressionStatementNode,
-            expressionStatementNode3: IExpressionStatementNode,
-            functionDeclarationNode: IFunctionDeclarationNode,
-            programNode: IProgramNode;
+    describe('getBlockScopeOfNode (node: ESTree.Node, depth: number = 0): TNodeWithBlockStatement', () => {
+        let functionDeclarationBlockStatementNode: ESTree.BlockStatement,
+            ifStatementBlockStatementNode1: ESTree.BlockStatement,
+            ifStatementBlockStatementNode2: ESTree.BlockStatement,
+            ifStatementNode1: ESTree.IfStatement,
+            ifStatementNode2: ESTree.IfStatement,
+            expressionStatementNode1: ESTree.ExpressionStatement,
+            expressionStatementNode2: ESTree.ExpressionStatement,
+            expressionStatementNode3: ESTree.ExpressionStatement,
+            functionDeclarationNode: ESTree.FunctionDeclaration,
+            programNode: ESTree.Program;
 
         beforeEach(() => {
             expressionStatementNode1 = NodeMocks.getExpressionStatementNode();
@@ -201,11 +191,11 @@ describe('NodeUtils', () => {
         });
     });
 
-    describe('insertNodeAtIndex (blockScopeBody: INode[], node: INode, index: number): void', () => {
-        let blockStatementNode: IBlockStatementNode,
-            expectedBlockStatementNode: IBlockStatementNode,
-            expressionStatementNode1: IExpressionStatementNode,
-            expressionStatementNode2: IExpressionStatementNode;
+    describe('insertNodeAtIndex (blockScopeBody: ESTree.Node[], node: ESTree.Node, index: number): void', () => {
+        let blockStatementNode: ESTree.BlockStatement,
+            expectedBlockStatementNode: ESTree.BlockStatement,
+            expressionStatementNode1: ESTree.ExpressionStatement,
+            expressionStatementNode2: ESTree.ExpressionStatement;
 
         beforeEach(() => {
             expressionStatementNode1 = NodeMocks.getExpressionStatementNode();
@@ -229,19 +219,19 @@ describe('NodeUtils', () => {
 
         it('should does not change `BlockStatement` node body if given node is not a valid Node', () => {
             assert.doesNotChange(
-                () => NodeUtils.insertNodeAtIndex(blockStatementNode.body, <INode>{}, 1),
+                () => NodeUtils.insertNodeAtIndex(blockStatementNode.body, <ESTree.Node>{}, 1),
                 blockStatementNode,
                 'body'
             );
         });
     });
 
-    describe('parentize (node: INode): void', () => {
-        let ifStatementNode: IIfStatementNode,
-            ifStatementBlockStatementNode: IBlockStatementNode,
-            expressionStatementNode1: IExpressionStatementNode,
-            expressionStatementNode2: IExpressionStatementNode,
-            programNode: IProgramNode;
+    describe('parentize (node: ESTree.Node): void', () => {
+        let ifStatementNode: ESTree.IfStatement,
+            ifStatementBlockStatementNode: ESTree.BlockStatement,
+            expressionStatementNode1: ESTree.ExpressionStatement,
+            expressionStatementNode2: ESTree.ExpressionStatement,
+            programNode: ESTree.Program;
 
         beforeEach(() => {
             expressionStatementNode1 = NodeMocks.getExpressionStatementNode();
@@ -284,11 +274,11 @@ describe('NodeUtils', () => {
         });
     });
 
-    describe('prependNode (blockScopeBody: INode[], node: INode): void', () => {
-        let blockStatementNode: IBlockStatementNode,
-            expectedBlockStatementNode: IBlockStatementNode,
-            expressionStatementNode1: IExpressionStatementNode,
-            expressionStatementNode2: IExpressionStatementNode;
+    describe('prependNode (blockScopeBody: ESTree.Node[], node: ESTree.Node): void', () => {
+        let blockStatementNode: ESTree.BlockStatement,
+            expectedBlockStatementNode: ESTree.BlockStatement,
+            expressionStatementNode1: ESTree.ExpressionStatement,
+            expressionStatementNode2: ESTree.ExpressionStatement;
 
         beforeEach(() => {
             expressionStatementNode1 = NodeMocks.getExpressionStatementNode();
@@ -312,7 +302,7 @@ describe('NodeUtils', () => {
 
         it('should does not change `BlockStatement` node body if given node is not a valid Node', () => {
             assert.doesNotChange(
-                () => NodeUtils.prependNode(blockStatementNode.body, <INode>{}),
+                () => NodeUtils.prependNode(blockStatementNode.body, <ESTree.Node>{}),
                 blockStatementNode,
                 'body'
             );

+ 4 - 4
test/unit-tests/node-obfuscators/CatchClauseObfuscator.spec.ts

@@ -1,6 +1,6 @@
-import { ICatchClauseNode } from "../../../src/interfaces/nodes/ICatchClauseNode";
+import * as ESTree from 'estree';
+
 import { ICustomNode } from "../../../src/interfaces/custom-nodes/ICustomNode";
-import { IExpressionStatementNode } from "../../../src/interfaces/nodes/IExpressionStatementNode";
 
 import { DEFAULT_PRESET } from "../../../src/preset-options/DefaultPreset";
 
@@ -15,10 +15,10 @@ const assert: Chai.AssertStatic = require('chai').assert;
 describe('CatchClauseObfuscator', () => {
     describe('obfuscateNode (catchClauseNode: ICatchClauseNode): void', () => {
         let catchClauseObfuscator: CatchClauseObfuscator,
-            catchClauseNode: ICatchClauseNode;
+            catchClauseNode: ESTree.CatchClause;
 
         beforeEach(() => {
-            let expressionStatementNode: IExpressionStatementNode = {
+            let expressionStatementNode: ESTree.ExpressionStatement = {
                 type: NodeType.ExpressionStatement,
                 expression: {
                     type: NodeType.CallExpression,

+ 7 - 9
test/unit-tests/node-obfuscators/FunctionDeclarationObfuscator.spec.ts

@@ -1,8 +1,6 @@
-import { IBlockStatementNode } from "../../../src/interfaces/nodes/IBlockStatementNode";
+import * as ESTree from 'estree';
+
 import { ICustomNode } from "../../../src/interfaces/custom-nodes/ICustomNode";
-import { IExpressionStatementNode } from "../../../src/interfaces/nodes/IExpressionStatementNode";
-import { IFunctionDeclarationNode } from "../../../src/interfaces/nodes/IFunctionDeclarationNode";
-import { IProgramNode } from "../../../src/interfaces/nodes/IProgramNode";
 
 import { DEFAULT_PRESET } from "../../../src/preset-options/DefaultPreset";
 
@@ -14,11 +12,11 @@ const assert: Chai.AssertStatic = require('chai').assert;
 
 describe('FunctionDeclarationObfuscator', () => {
     describe('obfuscateNode (functionDeclarationNode: IFunctionDeclarationNode, parentNode: INode): void', () => {
-        let expressionStatementNode: IExpressionStatementNode,
+        let expressionStatementNode: ESTree.ExpressionStatement,
             functionDeclarationObfuscator: FunctionDeclarationObfuscator,
-            functionDeclarationNode: IFunctionDeclarationNode,
+            functionDeclarationNode: ESTree.FunctionDeclaration,
             functionName: string = 'functionDeclaration',
-            programNode: IProgramNode;
+            programNode: ESTree.Program;
 
         beforeEach(() => {
             expressionStatementNode = NodeMocks.getExpressionStatementNode(
@@ -37,8 +35,8 @@ describe('FunctionDeclarationObfuscator', () => {
         });
 
         describe('if `functionDeclaration` node parent node is not a Program node', () => {
-            let blockStatementNode: IBlockStatementNode,
-                functionDeclarationParentNode: IFunctionDeclarationNode;
+            let blockStatementNode: ESTree.BlockStatement,
+                functionDeclarationParentNode: ESTree.FunctionDeclaration;
 
             beforeEach(() => {
                 blockStatementNode = NodeMocks.getBlockStatementNode([

+ 10 - 13
test/unit-tests/node-obfuscators/FunctionObfuscator.spec.ts

@@ -1,9 +1,6 @@
-import { IBlockStatementNode } from "../../../src/interfaces/nodes/IBlockStatementNode";
+import * as ESTree from 'estree';
+
 import { ICustomNode } from "../../../src/interfaces/custom-nodes/ICustomNode";
-import { IExpressionStatementNode } from "../../../src/interfaces/nodes/IExpressionStatementNode";
-import { IFunctionDeclarationNode } from "../../../src/interfaces/nodes/IFunctionDeclarationNode";
-import { IIdentifierNode } from "../../../src/interfaces/nodes/IIdentifierNode";
-import { IProgramNode } from "../../../src/interfaces/nodes/IProgramNode";
 
 import { DEFAULT_PRESET } from "../../../src/preset-options/DefaultPreset";
 
@@ -16,18 +13,18 @@ const assert: Chai.AssertStatic = require('chai').assert;
 
 describe('FunctionObfuscator', () => {
     describe('obfuscateNode (functionNode: IFunctionNode): void', () => {
-        let blockStatementNode: IBlockStatementNode,
-            expressionStatementNode1: IExpressionStatementNode,
-            expressionStatementNode2: IExpressionStatementNode,
+        let blockStatementNode: ESTree.BlockStatement,
+            expressionStatementNode1: ESTree.ExpressionStatement,
+            expressionStatementNode2: ESTree.ExpressionStatement,
             functionObfuscator: FunctionObfuscator,
-            functionDeclarationNode: IFunctionDeclarationNode,
+            functionDeclarationNode: ESTree.FunctionDeclaration,
             functionName: string = 'functionDeclaration',
             identifierName: string = 'identifierName',
-            identifierNode1: IIdentifierNode,
-            identifierNode2: IIdentifierNode,
-            identifierNode3: IIdentifierNode,
+            identifierNode1: ESTree.Identifier,
+            identifierNode2: ESTree.Identifier,
+            identifierNode3: ESTree.Identifier,
             paramName: string = 'param1',
-            programNode: IProgramNode;
+            programNode: ESTree.Program;
 
         before(() => {
             identifierNode1 = NodeMocks.getIdentifierNode(paramName);