Forráskód Böngészése

Migration to ESTree

sanex3339 8 éve
szülő
commit
bd441260d9

+ 36 - 36
dist/index.js

@@ -745,7 +745,7 @@ var IdentifierReplacer = function (_AbstractReplacer_1$A) {
     _inherits(IdentifierReplacer, _AbstractReplacer_1$A);
 
     function IdentifierReplacer() {
-        var _ref;
+        var _Object$getPrototypeO;
 
         _classCallCheck(this, IdentifierReplacer);
 
@@ -753,7 +753,7 @@ var IdentifierReplacer = function (_AbstractReplacer_1$A) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_ref = IdentifierReplacer.__proto__ || Object.getPrototypeOf(IdentifierReplacer)).call.apply(_ref, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(IdentifierReplacer)).call.apply(_Object$getPrototypeO, [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, (StringLiteralReplacer.__proto__ || Object.getPrototypeOf(StringLiteralReplacer)).apply(this, arguments));
+        return _possibleConstructorReturn(this, Object.getPrototypeOf(StringLiteralReplacer).apply(this, arguments));
     }
 
     _createClass(StringLiteralReplacer, [{
@@ -1094,7 +1094,7 @@ var NumberLiteralReplacer = function (_AbstractReplacer_1$A) {
     function NumberLiteralReplacer() {
         _classCallCheck(this, NumberLiteralReplacer);
 
-        return _possibleConstructorReturn(this, (NumberLiteralReplacer.__proto__ || Object.getPrototypeOf(NumberLiteralReplacer)).apply(this, arguments));
+        return _possibleConstructorReturn(this, Object.getPrototypeOf(NumberLiteralReplacer).apply(this, arguments));
     }
 
     _createClass(NumberLiteralReplacer, [{
@@ -1628,7 +1628,7 @@ var ConsoleOutputDisableExpressionNode = function (_AbstractCustomNode_) {
     _inherits(ConsoleOutputDisableExpressionNode, _AbstractCustomNode_);
 
     function ConsoleOutputDisableExpressionNode() {
-        var _ref;
+        var _Object$getPrototypeO;
 
         _classCallCheck(this, ConsoleOutputDisableExpressionNode);
 
@@ -1636,7 +1636,7 @@ var ConsoleOutputDisableExpressionNode = function (_AbstractCustomNode_) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_ref = ConsoleOutputDisableExpressionNode.__proto__ || Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).call.apply(_ref, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).call.apply(_Object$getPrototypeO, [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, (DebugProtectionFunctionCallNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionCallNode)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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, (DebugProtectionFunctionIntervalNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionIntervalNode)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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, (DebugProtectionFunctionNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionNode)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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 _ref;
+        var _Object$getPrototypeO;
 
         _classCallCheck(this, DomainLockNode);
 
@@ -1865,7 +1865,7 @@ var DomainLockNode = function (_AbstractCustomNode_) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_ref = DomainLockNode.__proto__ || Object.getPrototypeOf(DomainLockNode)).call.apply(_ref, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(DomainLockNode)).call.apply(_Object$getPrototypeO, [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 _ref;
+        var _Object$getPrototypeO;
 
         _classCallCheck(this, SelfDefendingUnicodeNode);
 
@@ -1934,7 +1934,7 @@ var SelfDefendingUnicodeNode = function (_AbstractCustomNode_) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_ref = SelfDefendingUnicodeNode.__proto__ || Object.getPrototypeOf(SelfDefendingUnicodeNode)).call.apply(_ref, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SelfDefendingUnicodeNode)).call.apply(_Object$getPrototypeO, [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, (UnicodeArrayCallsWrapper.__proto__ || Object.getPrototypeOf(UnicodeArrayCallsWrapper)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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(UnicodeArrayCallsWrapper.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayCallsWrapper.prototype), "getNode", this).call(this);
+            return _get(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, (UnicodeArrayDecodeNode.__proto__ || Object.getPrototypeOf(UnicodeArrayDecodeNode)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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(UnicodeArrayDecodeNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), "getNode", this).call(this);
+            return _get(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, (UnicodeArrayNode.__proto__ || Object.getPrototypeOf(UnicodeArrayNode)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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(UnicodeArrayNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
+            return _get(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, (UnicodeArrayRotateFunctionNode.__proto__ || Object.getPrototypeOf(UnicodeArrayRotateFunctionNode)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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(UnicodeArrayRotateFunctionNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayRotateFunctionNode.prototype), "getNode", this).call(this);
+            return _get(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, (ConsoleOutputNodesGroup.__proto__ || Object.getPrototypeOf(ConsoleOutputNodesGroup)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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, (DebugProtectionNodesGroup.__proto__ || Object.getPrototypeOf(DebugProtectionNodesGroup)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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, (DomainLockNodesGroup.__proto__ || Object.getPrototypeOf(DomainLockNodesGroup)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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, (SelfDefendingNodesGroup.__proto__ || Object.getPrototypeOf(SelfDefendingNodesGroup)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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, (UnicodeArrayNodesGroup.__proto__ || Object.getPrototypeOf(UnicodeArrayNodesGroup)).call(this, options));
+        var _this = _possibleConstructorReturn(this, 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, (CatchClauseObfuscator.__proto__ || Object.getPrototypeOf(CatchClauseObfuscator)).call(this, nodes, options));
+        var _this = _possibleConstructorReturn(this, 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, (FunctionDeclarationObfuscator.__proto__ || Object.getPrototypeOf(FunctionDeclarationObfuscator)).call(this, nodes, options));
+        var _this = _possibleConstructorReturn(this, 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, (FunctionObfuscator.__proto__ || Object.getPrototypeOf(FunctionObfuscator)).call(this, nodes, options));
+        var _this = _possibleConstructorReturn(this, 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, (LiteralObfuscator.__proto__ || Object.getPrototypeOf(LiteralObfuscator)).apply(this, arguments));
+        return _possibleConstructorReturn(this, Object.getPrototypeOf(LiteralObfuscator).apply(this, arguments));
     }
 
     _createClass(LiteralObfuscator, [{
@@ -2820,7 +2820,7 @@ var MemberExpressionObfuscator = function (_AbstractNodeObfuscat) {
     function MemberExpressionObfuscator() {
         _classCallCheck(this, MemberExpressionObfuscator);
 
-        return _possibleConstructorReturn(this, (MemberExpressionObfuscator.__proto__ || Object.getPrototypeOf(MemberExpressionObfuscator)).apply(this, arguments));
+        return _possibleConstructorReturn(this, Object.getPrototypeOf(MemberExpressionObfuscator).apply(this, arguments));
     }
 
     _createClass(MemberExpressionObfuscator, [{
@@ -2902,7 +2902,7 @@ var MethodDefinitionObfuscator = function (_AbstractNodeObfuscat) {
     _inherits(MethodDefinitionObfuscator, _AbstractNodeObfuscat);
 
     function MethodDefinitionObfuscator() {
-        var _ref;
+        var _Object$getPrototypeO;
 
         _classCallCheck(this, MethodDefinitionObfuscator);
 
@@ -2910,7 +2910,7 @@ var MethodDefinitionObfuscator = function (_AbstractNodeObfuscat) {
             args[_key] = arguments[_key];
         }
 
-        var _this = _possibleConstructorReturn(this, (_ref = MethodDefinitionObfuscator.__proto__ || Object.getPrototypeOf(MethodDefinitionObfuscator)).call.apply(_ref, [this].concat(args)));
+        var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(MethodDefinitionObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
 
         _this.ignoredNames = ['constructor'];
         return _this;
@@ -2972,7 +2972,7 @@ var ObjectExpressionObfuscator = function (_AbstractNodeObfuscat) {
     function ObjectExpressionObfuscator() {
         _classCallCheck(this, ObjectExpressionObfuscator);
 
-        return _possibleConstructorReturn(this, (ObjectExpressionObfuscator.__proto__ || Object.getPrototypeOf(ObjectExpressionObfuscator)).apply(this, arguments));
+        return _possibleConstructorReturn(this, 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, (VariableDeclarationObfuscator.__proto__ || Object.getPrototypeOf(VariableDeclarationObfuscator)).call(this, nodes, options));
+        var _this = _possibleConstructorReturn(this, 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, (BooleanLiteralReplacer.__proto__ || Object.getPrototypeOf(BooleanLiteralReplacer)).apply(this, arguments));
+        return _possibleConstructorReturn(this, Object.getPrototypeOf(BooleanLiteralReplacer).apply(this, arguments));
     }
 
     _createClass(BooleanLiteralReplacer, [{

+ 1 - 2
package.json

@@ -42,13 +42,12 @@
     "@types/joi": "^9.0.31",
     "@types/mkdirp": "^0.3.28",
     "@types/mocha": "^2.2.31",
-    "@types/node": "^6.0.38",
+    "@types/node": "^4.0.30",
     "@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",
-    "chai-members-deep": "^1.1.0",
     "coveralls": "^2.11.12",
     "istanbul": "1.1.0-alpha.1",
     "mocha": "^3.0.2",

+ 3 - 3
src/NodeUtils.ts

@@ -84,18 +84,18 @@ export class NodeUtils {
      * @returns {ESTree.Node}
      */
     public static getBlockScopeOfNode (node: ESTree.Node, depth: number = 0): TNodeWithBlockStatement {
-        let parentNode: ESTree.Node | undefined = node['parentNode'];
+        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);

+ 17 - 0
src/declarations/ESTree.d.ts

@@ -0,0 +1,17 @@
+/* tslint:disable:interface-name */
+
+import * as ESTree from 'estree';
+
+declare module 'estree' {
+    interface BaseNode {
+        parentNode?: ESTree.Node;
+    }
+
+    interface SimpleLiteral extends ESTree.BaseNode, ESTree.BaseExpression {
+        'x-verbatim-property'?: any;
+    }
+
+    interface RegExpLiteral extends ESTree.BaseNode, ESTree.BaseExpression {
+        'x-verbatim-property'?: any;
+    }
+}

+ 3 - 3
src/interfaces/custom-nodes/ICustomNode.d.ts

@@ -1,4 +1,4 @@
-import { INode } from '../nodes/INode';
+import * as ESTree from 'estree';
 
 import { AppendState } from '../../enums/AppendState';
 
@@ -6,7 +6,7 @@ export interface ICustomNode {
     /**
      * @param astTree
      */
-    appendNode (astTree: INode): void;
+    appendNode (astTree: ESTree.Node): void;
 
     /**
      * @returns {AppendState}
@@ -16,5 +16,5 @@ export interface ICustomNode {
     /**
      * @returns INode
      */
-    getNode (): INode;
+    getNode (): ESTree.Node;
 }

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

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

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

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

+ 3 - 5
test/mocks/NodeMocks.ts

@@ -84,8 +84,7 @@ export class NodeMocks {
             id: NodeMocks.getIdentifierNode(functionName),
             params: params,
             body: blockStatementNode,
-            generator: false,
-            expression: false
+            generator: false
         };
     }
 
@@ -101,8 +100,7 @@ export class NodeMocks {
                 value: true,
                 raw: 'true'
             },
-            consequent: blockStatementNode,
-            alternate: null
+            consequent: blockStatementNode
         };
     }
 
@@ -157,7 +155,7 @@ export class NodeMocks {
      */
     public static getVariableDeclarationNode (
         declarations: ESTree.VariableDeclarator[] = [],
-        kind: string = 'var'
+        kind: 'var' | 'let' | 'const' = 'var'
     ): ESTree.VariableDeclaration {
         return {
             type: NodeType.VariableDeclaration,

+ 2 - 4
test/unit-tests/NodeUtils.spec.ts

@@ -4,8 +4,6 @@ import * as ESTree from 'estree';
 import { NodeMocks } from '../mocks/NodeMocks';
 import { NodeUtils } from '../../src/NodeUtils';
 
-chai.use(require('chai-members-deep'));
-
 const assert: any = chai.assert;
 
 describe('NodeUtils', () => {
@@ -92,12 +90,12 @@ describe('NodeUtils', () => {
         });
 
         it('should convert code to `ESTree.Node` structure', () => {
-            assert.deepEqualIdent(NodeUtils.convertCodeToStructure(code), variableDeclarationNode);
+            assert.deepEqual(NodeUtils.convertCodeToStructure(code), variableDeclarationNode);
         });
     });
 
     describe('getBlockStatementNodeByIndex (node: ESTree.Node, index: number = 0): ESTree.Node', () => {
-        let blockStatementNode: ESTree.BlockStatemen,
+        let blockStatementNode: ESTree.BlockStatement,
             expressionStatementNode1: ESTree.ExpressionStatement,
             expressionStatementNode2: ESTree.ExpressionStatement;
 

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

@@ -64,7 +64,7 @@ describe('CatchClauseObfuscator', () => {
 
         it('should obfuscate catch clause param calls in catch clause node body', () => {
             assert.match(
-                catchClauseNode.param.name,
+                (<ESTree.Identifier>catchClauseNode.param).name,
                 /^_0x\w+$/
             );
         });