소스 검색

Some refactoring related to latest changes

sanex3339 8 년 전
부모
커밋
e17265bb59
24개의 변경된 파일151개의 추가작업 그리고 127개의 파일을 삭제
  1. 53 44
      dist/index.js
  2. 2 2
      src/container/ServiceIdentifiers.ts
  3. 1 1
      src/container/modules/node-transformers/ControlFlowTransformersModule.ts
  4. 14 14
      src/container/modules/node-transformers/ObfuscatingTransformersModule.ts
  5. 1 1
      src/enums/container/ObfuscatingReplacers.ts
  6. 2 2
      src/interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer.d.ts
  7. 0 0
      src/interfaces/node-transformers/dead-code-injection-transformers/IDeadCodeInjectionReplacer.d.ts
  8. 0 0
      src/interfaces/node-transformers/obfuscating-transformers/IEncodedValue.d.ts
  9. 0 0
      src/interfaces/node-transformers/obfuscating-transformers/IIdentifierReplacer.d.ts
  10. 0 0
      src/interfaces/node-transformers/obfuscating-transformers/IObfuscatingReplacer.d.ts
  11. 1 1
      src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts
  12. 5 5
      src/node-transformers/obfuscating-transformers/CatchClauseTransformer.ts
  13. 5 5
      src/node-transformers/obfuscating-transformers/FunctionDeclarationTransformer.ts
  14. 5 5
      src/node-transformers/obfuscating-transformers/FunctionTransformer.ts
  15. 5 5
      src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts
  16. 9 9
      src/node-transformers/obfuscating-transformers/LiteralTransformer.ts
  17. 5 5
      src/node-transformers/obfuscating-transformers/VariableDeclarationTransformer.ts
  18. 1 1
      src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts
  19. 3 3
      src/node-transformers/obfuscating-transformers/obfuscating-replacers/BooleanLiteralReplacer.ts
  20. 1 1
      src/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierReplacer.ts
  21. 32 17
      src/node-transformers/obfuscating-transformers/obfuscating-replacers/StringLiteralReplacer.ts
  22. 1 1
      src/types/container/TControlFlowReplacerFactory.d.ts
  23. 5 0
      src/types/container/TObfuscatingReplacerFactory.d.ts
  24. 0 5
      src/types/container/TObfuscationReplacerFactory.d.ts

+ 53 - 44
dist/index.js

@@ -120,7 +120,7 @@ exports.ServiceIdentifiers = {
     Factory__ICustomNodeGroup: Symbol('Factory<ICustomNodeGroup>'),
     Factory__INodeTransformer: Symbol('Factory<INodeTransformer[]>'),
     Factory__IObfuscationResult: Symbol('Factory<IObfuscationResult>'),
-    Factory__IObfuscationReplacer: Symbol('Factory<IObfuscationReplacer>'),
+    Factory__IObfuscatingReplacer: Symbol('Factory<IObfuscatingReplacer>'),
     Factory__TControlFlowStorage: Symbol('Factory<TControlFlowStorage>'),
     ICalleeDataExtractor: Symbol('ICalleeDataExtractor'),
     ICustomNodeGroup: Symbol('ICustomNodeGroup'),
@@ -132,7 +132,7 @@ exports.ServiceIdentifiers = {
     IObfuscationResult: Symbol('IObfuscationResult'),
     IObfuscator: Symbol('IObfuscator'),
     IOptions: Symbol('IOptions'),
-    IObfuscationReplacer: Symbol('IObfuscationReplacer'),
+    IObfuscatingReplacer: Symbol('IObfuscatingReplacer'),
     ISourceMapCorrector: Symbol('ISourceMapCorrector'),
     IStackTraceAnalyzer: Symbol('IStackTraceAnalyzer'),
     Newable__ICustomNode: Symbol('Newable<ICustomNode>'),
@@ -1311,13 +1311,13 @@ exports.ObfuscationEvents = {
 
 
 Object.defineProperty(exports, "__esModule", { value: true });
-var ObfuscationReplacers;
-(function (ObfuscationReplacers) {
-    ObfuscationReplacers[ObfuscationReplacers["BooleanReplacer"] = 0] = "BooleanReplacer";
-    ObfuscationReplacers[ObfuscationReplacers["IdentifierReplacer"] = 1] = "IdentifierReplacer";
-    ObfuscationReplacers[ObfuscationReplacers["NumberLiteralReplacer"] = 2] = "NumberLiteralReplacer";
-    ObfuscationReplacers[ObfuscationReplacers["StringLiteralReplacer"] = 3] = "StringLiteralReplacer";
-})(ObfuscationReplacers = exports.ObfuscationReplacers || (exports.ObfuscationReplacers = {}));
+var ObfuscatingReplacers;
+(function (ObfuscatingReplacers) {
+    ObfuscatingReplacers[ObfuscatingReplacers["BooleanReplacer"] = 0] = "BooleanReplacer";
+    ObfuscatingReplacers[ObfuscatingReplacers["IdentifierReplacer"] = 1] = "IdentifierReplacer";
+    ObfuscatingReplacers[ObfuscatingReplacers["NumberLiteralReplacer"] = 2] = "NumberLiteralReplacer";
+    ObfuscatingReplacers[ObfuscatingReplacers["StringLiteralReplacer"] = 3] = "StringLiteralReplacer";
+})(ObfuscatingReplacers = exports.ObfuscatingReplacers || (exports.ObfuscatingReplacers = {}));
 
 /***/ }),
 /* 17 */
@@ -2894,23 +2894,23 @@ exports.nodeTransformersModule = new inversify_1.ContainerModule(function (bind)
 Object.defineProperty(exports, "__esModule", { value: true });
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
-var ObfuscationReplacers_1 = __webpack_require__(16);
+var ObfuscatingReplacers_1 = __webpack_require__(16);
 var BooleanLiteralReplacer_1 = __webpack_require__(98);
 var IdentifierReplacer_1 = __webpack_require__(99);
 var NumberLiteralReplacer_1 = __webpack_require__(100);
 var StringLiteralReplacer_1 = __webpack_require__(101);
 exports.obfuscatingTransformersModule = new inversify_1.ContainerModule(function (bind) {
-    bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationReplacer).to(BooleanLiteralReplacer_1.BooleanLiteralReplacer).whenTargetNamed(ObfuscationReplacers_1.ObfuscationReplacers.BooleanReplacer);
-    bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationReplacer).to(IdentifierReplacer_1.IdentifierReplacer).whenTargetNamed(ObfuscationReplacers_1.ObfuscationReplacers.IdentifierReplacer);
-    bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationReplacer).to(NumberLiteralReplacer_1.NumberLiteralReplacer).whenTargetNamed(ObfuscationReplacers_1.ObfuscationReplacers.NumberLiteralReplacer);
-    bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationReplacer).to(StringLiteralReplacer_1.StringLiteralReplacer).whenTargetNamed(ObfuscationReplacers_1.ObfuscationReplacers.StringLiteralReplacer);
-    bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationReplacer).toFactory(function (context) {
+    bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(BooleanLiteralReplacer_1.BooleanLiteralReplacer).whenTargetNamed(ObfuscatingReplacers_1.ObfuscatingReplacers.BooleanReplacer);
+    bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(IdentifierReplacer_1.IdentifierReplacer).whenTargetNamed(ObfuscatingReplacers_1.ObfuscatingReplacers.IdentifierReplacer);
+    bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(NumberLiteralReplacer_1.NumberLiteralReplacer).whenTargetNamed(ObfuscatingReplacers_1.ObfuscatingReplacers.NumberLiteralReplacer);
+    bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(StringLiteralReplacer_1.StringLiteralReplacer).whenTargetNamed(ObfuscatingReplacers_1.ObfuscatingReplacers.StringLiteralReplacer);
+    bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer).toFactory(function (context) {
         var cache = new Map();
         return function (replacerName) {
             if (cache.has(replacerName)) {
                 return cache.get(replacerName);
             }
-            var obfuscationReplacer = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationReplacer, replacerName);
+            var obfuscationReplacer = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer, replacerName);
             cache.set(replacerName, obfuscationReplacer);
             return obfuscationReplacer;
         };
@@ -5563,7 +5563,7 @@ var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var estraverse = __webpack_require__(12);
-var ObfuscationReplacers_1 = __webpack_require__(16);
+var ObfuscatingReplacers_1 = __webpack_require__(16);
 var AbstractNodeTransformer_1 = __webpack_require__(11);
 var Node_1 = __webpack_require__(6);
 var CatchClauseTransformer = function (_AbstractNodeTransfor) {
@@ -5574,7 +5574,7 @@ var CatchClauseTransformer = function (_AbstractNodeTransfor) {
 
         var _this = _possibleConstructorReturn(this, (CatchClauseTransformer.__proto__ || Object.getPrototypeOf(CatchClauseTransformer)).call(this, options));
 
-        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscationReplacers_1.ObfuscationReplacers.IdentifierReplacer);
+        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscatingReplacers_1.ObfuscatingReplacers.IdentifierReplacer);
         return _this;
     }
 
@@ -5628,7 +5628,7 @@ var CatchClauseTransformer = function (_AbstractNodeTransfor) {
 
     return CatchClauseTransformer;
 }(AbstractNodeTransformer_1.AbstractNodeTransformer);
-CatchClauseTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], CatchClauseTransformer);
+CatchClauseTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], CatchClauseTransformer);
 exports.CatchClauseTransformer = CatchClauseTransformer;
 
 /***/ }),
@@ -5651,7 +5651,7 @@ var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var estraverse = __webpack_require__(12);
-var ObfuscationReplacers_1 = __webpack_require__(16);
+var ObfuscatingReplacers_1 = __webpack_require__(16);
 var NodeType_1 = __webpack_require__(14);
 var AbstractNodeTransformer_1 = __webpack_require__(11);
 var Node_1 = __webpack_require__(6);
@@ -5665,7 +5665,7 @@ var FunctionDeclarationTransformer = function (_AbstractNodeTransfor) {
         var _this = _possibleConstructorReturn(this, (FunctionDeclarationTransformer.__proto__ || Object.getPrototypeOf(FunctionDeclarationTransformer)).call(this, options));
 
         _this.replaceableIdentifiers = new Map();
-        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscationReplacers_1.ObfuscationReplacers.IdentifierReplacer);
+        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscatingReplacers_1.ObfuscatingReplacers.IdentifierReplacer);
         return _this;
     }
 
@@ -5739,7 +5739,7 @@ var FunctionDeclarationTransformer = function (_AbstractNodeTransfor) {
 
     return FunctionDeclarationTransformer;
 }(AbstractNodeTransformer_1.AbstractNodeTransformer);
-FunctionDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], FunctionDeclarationTransformer);
+FunctionDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], FunctionDeclarationTransformer);
 exports.FunctionDeclarationTransformer = FunctionDeclarationTransformer;
 
 /***/ }),
@@ -5762,7 +5762,7 @@ var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var estraverse = __webpack_require__(12);
-var ObfuscationReplacers_1 = __webpack_require__(16);
+var ObfuscatingReplacers_1 = __webpack_require__(16);
 var AbstractNodeTransformer_1 = __webpack_require__(11);
 var Node_1 = __webpack_require__(6);
 var FunctionTransformer = function (_AbstractNodeTransfor) {
@@ -5773,7 +5773,7 @@ var FunctionTransformer = function (_AbstractNodeTransfor) {
 
         var _this = _possibleConstructorReturn(this, (FunctionTransformer.__proto__ || Object.getPrototypeOf(FunctionTransformer)).call(this, options));
 
-        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscationReplacers_1.ObfuscationReplacers.IdentifierReplacer);
+        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscatingReplacers_1.ObfuscatingReplacers.IdentifierReplacer);
         return _this;
     }
 
@@ -5846,7 +5846,7 @@ var FunctionTransformer = function (_AbstractNodeTransfor) {
 
     return FunctionTransformer;
 }(AbstractNodeTransformer_1.AbstractNodeTransformer);
-FunctionTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], FunctionTransformer);
+FunctionTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], FunctionTransformer);
 exports.FunctionTransformer = FunctionTransformer;
 
 /***/ }),
@@ -5869,7 +5869,7 @@ var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var estraverse = __webpack_require__(12);
-var ObfuscationReplacers_1 = __webpack_require__(16);
+var ObfuscatingReplacers_1 = __webpack_require__(16);
 var AbstractNodeTransformer_1 = __webpack_require__(11);
 var Node_1 = __webpack_require__(6);
 var LabeledStatementTransformer = function (_AbstractNodeTransfor) {
@@ -5880,7 +5880,7 @@ var LabeledStatementTransformer = function (_AbstractNodeTransfor) {
 
         var _this = _possibleConstructorReturn(this, (LabeledStatementTransformer.__proto__ || Object.getPrototypeOf(LabeledStatementTransformer)).call(this, options));
 
-        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscationReplacers_1.ObfuscationReplacers.IdentifierReplacer);
+        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscatingReplacers_1.ObfuscatingReplacers.IdentifierReplacer);
         return _this;
     }
 
@@ -5928,7 +5928,7 @@ var LabeledStatementTransformer = function (_AbstractNodeTransfor) {
 
     return LabeledStatementTransformer;
 }(AbstractNodeTransformer_1.AbstractNodeTransformer);
-LabeledStatementTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], LabeledStatementTransformer);
+LabeledStatementTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], LabeledStatementTransformer);
 exports.LabeledStatementTransformer = LabeledStatementTransformer;
 
 /***/ }),
@@ -5952,7 +5952,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
 var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
-var ObfuscationReplacers_1 = __webpack_require__(16);
+var ObfuscatingReplacers_1 = __webpack_require__(16);
 var AbstractNodeTransformer_1 = __webpack_require__(11);
 var Node_1 = __webpack_require__(6);
 var LiteralTransformer = function (_AbstractNodeTransfor) {
@@ -5963,7 +5963,7 @@ var LiteralTransformer = function (_AbstractNodeTransfor) {
 
         var _this = _possibleConstructorReturn(this, (LiteralTransformer.__proto__ || Object.getPrototypeOf(LiteralTransformer)).call(this, options));
 
-        _this.obfuscationReplacerFactory = obfuscatingReplacerFactory;
+        _this.obfuscatingReplacerFactory = obfuscatingReplacerFactory;
         return _this;
     }
 
@@ -5988,11 +5988,11 @@ var LiteralTransformer = function (_AbstractNodeTransfor) {
             }
             switch (_typeof(literalNode.value)) {
                 case 'boolean':
-                    return this.obfuscationReplacerFactory(ObfuscationReplacers_1.ObfuscationReplacers.BooleanReplacer).replace(literalNode.value);
+                    return this.obfuscatingReplacerFactory(ObfuscatingReplacers_1.ObfuscatingReplacers.BooleanReplacer).replace(literalNode.value);
                 case 'number':
-                    return this.obfuscationReplacerFactory(ObfuscationReplacers_1.ObfuscationReplacers.NumberLiteralReplacer).replace(literalNode.value);
+                    return this.obfuscatingReplacerFactory(ObfuscatingReplacers_1.ObfuscatingReplacers.NumberLiteralReplacer).replace(literalNode.value);
                 case 'string':
-                    return this.obfuscationReplacerFactory(ObfuscationReplacers_1.ObfuscationReplacers.StringLiteralReplacer).replace(literalNode.value);
+                    return this.obfuscatingReplacerFactory(ObfuscatingReplacers_1.ObfuscatingReplacers.StringLiteralReplacer).replace(literalNode.value);
                 default:
                     return literalNode;
             }
@@ -6001,7 +6001,7 @@ var LiteralTransformer = function (_AbstractNodeTransfor) {
 
     return LiteralTransformer;
 }(AbstractNodeTransformer_1.AbstractNodeTransformer);
-LiteralTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], LiteralTransformer);
+LiteralTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], LiteralTransformer);
 exports.LiteralTransformer = LiteralTransformer;
 
 /***/ }),
@@ -6098,7 +6098,7 @@ var tslib_1 = __webpack_require__(1);
 var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(2);
 var estraverse = __webpack_require__(12);
-var ObfuscationReplacers_1 = __webpack_require__(16);
+var ObfuscatingReplacers_1 = __webpack_require__(16);
 var NodeType_1 = __webpack_require__(14);
 var AbstractNodeTransformer_1 = __webpack_require__(11);
 var Node_1 = __webpack_require__(6);
@@ -6112,7 +6112,7 @@ var VariableDeclarationTransformer = function (_AbstractNodeTransfor) {
         var _this = _possibleConstructorReturn(this, (VariableDeclarationTransformer.__proto__ || Object.getPrototypeOf(VariableDeclarationTransformer)).call(this, options));
 
         _this.replaceableIdentifiers = new Map();
-        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscationReplacers_1.ObfuscationReplacers.IdentifierReplacer);
+        _this.identifierReplacer = obfuscatingReplacerFactory(ObfuscatingReplacers_1.ObfuscatingReplacers.IdentifierReplacer);
         return _this;
     }
 
@@ -6198,7 +6198,7 @@ var VariableDeclarationTransformer = function (_AbstractNodeTransfor) {
 
     return VariableDeclarationTransformer;
 }(AbstractNodeTransformer_1.AbstractNodeTransformer);
-VariableDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], VariableDeclarationTransformer);
+VariableDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object])], VariableDeclarationTransformer);
 exports.VariableDeclarationTransformer = VariableDeclarationTransformer;
 
 /***/ }),
@@ -6478,19 +6478,28 @@ var StringLiteralReplacer = StringLiteralReplacer_1 = function (_AbstractObfusca
                 encodedValue = _getEncodedValue.encodedValue,
                 key = _getEncodedValue.key;
 
-            var hexadecimalIndex = this.getArrayHexadecimalIndex(encodedValue);
             var rotatedStringArrayStorageId = Utils_1.Utils.stringRotate(this.stringArrayStorage.getStorageId(), 1);
             var stringArrayStorageCallsWrapperName = "_" + Utils_1.Utils.hexadecimalPrefix + rotatedStringArrayStorageId;
-            var hexadecimalLiteralNode = Nodes_1.Nodes.getLiteralNode(hexadecimalIndex);
-            hexadecimalLiteralNode.obfuscatedNode = true;
-            var callExpressionArgs = [hexadecimalLiteralNode];
+            var callExpressionArgs = [StringLiteralReplacer_1.getHexadecimalLiteralNode(this.getArrayHexadecimalIndex(encodedValue))];
             if (key) {
-                var rc4KeyLiteralNode = Nodes_1.Nodes.getLiteralNode(Utils_1.Utils.stringToUnicodeEscapeSequence(key, !this.options.unicodeEscapeSequence));
-                rc4KeyLiteralNode.obfuscatedNode = true;
-                callExpressionArgs.push(rc4KeyLiteralNode);
+                callExpressionArgs.push(StringLiteralReplacer_1.getRc4KeyLiteralNode(Utils_1.Utils.stringToUnicodeEscapeSequence(key, !this.options.unicodeEscapeSequence)));
             }
             return Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getIdentifierNode(stringArrayStorageCallsWrapperName), callExpressionArgs);
         }
+    }], [{
+        key: "getHexadecimalLiteralNode",
+        value: function getHexadecimalLiteralNode(hexadecimalIndex) {
+            var hexadecimalLiteralNode = Nodes_1.Nodes.getLiteralNode(hexadecimalIndex);
+            hexadecimalLiteralNode.obfuscatedNode = true;
+            return hexadecimalLiteralNode;
+        }
+    }, {
+        key: "getRc4KeyLiteralNode",
+        value: function getRc4KeyLiteralNode(literalValue) {
+            var rc4KeyLiteralNode = Nodes_1.Nodes.getLiteralNode(literalValue);
+            rc4KeyLiteralNode.obfuscatedNode = true;
+            return rc4KeyLiteralNode;
+        }
     }]);
 
     return StringLiteralReplacer;

+ 2 - 2
src/container/ServiceIdentifiers.ts

@@ -5,7 +5,7 @@ export const ServiceIdentifiers: any = {
     Factory__ICustomNodeGroup: Symbol('Factory<ICustomNodeGroup>'),
     Factory__INodeTransformer: Symbol('Factory<INodeTransformer[]>'),
     Factory__IObfuscationResult: Symbol('Factory<IObfuscationResult>'),
-    Factory__IObfuscationReplacer: Symbol('Factory<IObfuscationReplacer>'),
+    Factory__IObfuscatingReplacer: Symbol('Factory<IObfuscatingReplacer>'),
     Factory__TControlFlowStorage: Symbol('Factory<TControlFlowStorage>'),
     ICalleeDataExtractor: Symbol('ICalleeDataExtractor'),
     ICustomNodeGroup: Symbol('ICustomNodeGroup'),
@@ -17,7 +17,7 @@ export const ServiceIdentifiers: any = {
     IObfuscationResult: Symbol('IObfuscationResult'),
     IObfuscator: Symbol('IObfuscator'),
     IOptions: Symbol('IOptions'),
-    IObfuscationReplacer: Symbol('IObfuscationReplacer'),
+    IObfuscatingReplacer: Symbol('IObfuscatingReplacer'),
     ISourceMapCorrector: Symbol('ISourceMapCorrector'),
     IStackTraceAnalyzer: Symbol('IStackTraceAnalyzer'),
     Newable__ICustomNode: Symbol('Newable<ICustomNode>'),

+ 1 - 1
src/container/modules/node-transformers/ControlFlowTransformersModule.ts

@@ -1,7 +1,7 @@
 import { ContainerModule, interfaces } from 'inversify';
 import { ServiceIdentifiers } from '../../ServiceIdentifiers';
 
-import { IControlFlowReplacer } from '../../../interfaces/node-transformers/IControlFlowReplacer';
+import { IControlFlowReplacer } from '../../../interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer';
 
 import { ControlFlowReplacers } from '../../../enums/container/ControlFlowReplacers';
 

+ 14 - 14
src/container/modules/node-transformers/ObfuscatingTransformersModule.ts

@@ -1,9 +1,9 @@
 import { ContainerModule, interfaces } from 'inversify';
 import { ServiceIdentifiers } from '../../ServiceIdentifiers';
 
-import { IObfuscatingReplacer } from '../../../interfaces/node-transformers/IObfuscatingReplacer';
+import { IObfuscatingReplacer } from '../../../interfaces/node-transformers/obfuscating-transformers/IObfuscatingReplacer';
 
-import { ObfuscationReplacers } from '../../../enums/container/ObfuscationReplacers';
+import { ObfuscatingReplacers } from '../../../enums/container/ObfuscatingReplacers';
 
 import { BooleanLiteralReplacer } from '../../../node-transformers/obfuscating-transformers/obfuscating-replacers/BooleanLiteralReplacer';
 import { IdentifierReplacer } from '../../../node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierReplacer';
@@ -11,33 +11,33 @@ import { NumberLiteralReplacer } from '../../../node-transformers/obfuscating-tr
 import { StringLiteralReplacer } from '../../../node-transformers/obfuscating-transformers/obfuscating-replacers/StringLiteralReplacer';
 
 export const obfuscatingTransformersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
-    bind<IObfuscatingReplacer>(ServiceIdentifiers.IObfuscationReplacer)
+    bind<IObfuscatingReplacer>(ServiceIdentifiers.IObfuscatingReplacer)
         .to(BooleanLiteralReplacer)
-        .whenTargetNamed(ObfuscationReplacers.BooleanReplacer);
+        .whenTargetNamed(ObfuscatingReplacers.BooleanReplacer);
 
-    bind<IObfuscatingReplacer>(ServiceIdentifiers.IObfuscationReplacer)
+    bind<IObfuscatingReplacer>(ServiceIdentifiers.IObfuscatingReplacer)
         .to(IdentifierReplacer)
-        .whenTargetNamed(ObfuscationReplacers.IdentifierReplacer);
+        .whenTargetNamed(ObfuscatingReplacers.IdentifierReplacer);
 
-    bind<IObfuscatingReplacer>(ServiceIdentifiers.IObfuscationReplacer)
+    bind<IObfuscatingReplacer>(ServiceIdentifiers.IObfuscatingReplacer)
         .to(NumberLiteralReplacer)
-        .whenTargetNamed(ObfuscationReplacers.NumberLiteralReplacer);
+        .whenTargetNamed(ObfuscatingReplacers.NumberLiteralReplacer);
 
-    bind<IObfuscatingReplacer>(ServiceIdentifiers.IObfuscationReplacer)
+    bind<IObfuscatingReplacer>(ServiceIdentifiers.IObfuscatingReplacer)
         .to(StringLiteralReplacer)
-        .whenTargetNamed(ObfuscationReplacers.StringLiteralReplacer);
+        .whenTargetNamed(ObfuscatingReplacers.StringLiteralReplacer);
 
-    bind<IObfuscatingReplacer>(ServiceIdentifiers.Factory__IObfuscationReplacer)
+    bind<IObfuscatingReplacer>(ServiceIdentifiers.Factory__IObfuscatingReplacer)
         .toFactory<IObfuscatingReplacer>((context: interfaces.Context) => {
-            const cache: Map <ObfuscationReplacers, IObfuscatingReplacer> = new Map();
+            const cache: Map <ObfuscatingReplacers, IObfuscatingReplacer> = new Map();
 
-            return (replacerName: ObfuscationReplacers) => {
+            return (replacerName: ObfuscatingReplacers) => {
                 if (cache.has(replacerName)) {
                     return <IObfuscatingReplacer>cache.get(replacerName);
                 }
 
                 const obfuscationReplacer: IObfuscatingReplacer = context.container.getNamed<IObfuscatingReplacer>(
-                    ServiceIdentifiers.IObfuscationReplacer,
+                    ServiceIdentifiers.IObfuscatingReplacer,
                     replacerName
                 );
 

+ 1 - 1
src/enums/container/ObfuscationReplacers.ts → src/enums/container/ObfuscatingReplacers.ts

@@ -1,4 +1,4 @@
-export enum ObfuscationReplacers {
+export enum ObfuscatingReplacers {
     BooleanReplacer,
     IdentifierReplacer,
     NumberLiteralReplacer,

+ 2 - 2
src/interfaces/node-transformers/IControlFlowReplacer.d.ts → src/interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer.d.ts

@@ -1,7 +1,7 @@
 import * as ESTree from 'estree';
 
-import { ICustomNode } from '../custom-nodes/ICustomNode';
-import { IStorage } from '../storages/IStorage';
+import { ICustomNode } from '../../custom-nodes/ICustomNode';
+import { IStorage } from '../../storages/IStorage';
 
 export interface IControlFlowReplacer {
     /**

+ 0 - 0
src/interfaces/node-transformers/IDeadCodeInjectionReplacer.d.ts → src/interfaces/node-transformers/dead-code-injection-transformers/IDeadCodeInjectionReplacer.d.ts


+ 0 - 0
src/interfaces/node-transformers/IEncodedValue.d.ts → src/interfaces/node-transformers/obfuscating-transformers/IEncodedValue.d.ts


+ 0 - 0
src/interfaces/node-transformers/IIdentifierReplacer.d.ts → src/interfaces/node-transformers/obfuscating-transformers/IIdentifierReplacer.d.ts


+ 0 - 0
src/interfaces/node-transformers/IObfuscatingReplacer.d.ts → src/interfaces/node-transformers/obfuscating-transformers/IObfuscatingReplacer.d.ts


+ 1 - 1
src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts

@@ -5,7 +5,7 @@ import * as ESTree from 'estree';
 
 import { TCustomNodeFactory } from '../../../types/container/TCustomNodeFactory';
 
-import { IControlFlowReplacer } from '../../../interfaces/node-transformers/IControlFlowReplacer';
+import { IControlFlowReplacer } from '../../../interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IStorage } from '../../../interfaces/storages/IStorage';

+ 5 - 5
src/node-transformers/obfuscating-transformers/CatchClauseTransformer.ts

@@ -4,13 +4,13 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 
-import { TObfuscationReplacerFactory } from '../../types/container/TObfuscationReplacerFactory';
+import { TObfuscatingReplacerFactory } from '../../types/container/TObfuscatingReplacerFactory';
 
 import { IOptions } from '../../interfaces/options/IOptions';
-import { IIdentifierReplacer } from '../../interfaces/node-transformers/IIdentifierReplacer';
+import { IIdentifierReplacer } from '../../interfaces/node-transformers/obfuscating-transformers/IIdentifierReplacer';
 import { IVisitor } from '../../interfaces/IVisitor';
 
-import { ObfuscationReplacers } from '../../enums/container/ObfuscationReplacers';
+import { ObfuscatingReplacers } from '../../enums/container/ObfuscatingReplacers';
 
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { Node } from '../../node/Node';
@@ -35,12 +35,12 @@ export class CatchClauseTransformer extends AbstractNodeTransformer {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers.Factory__IObfuscationReplacer) obfuscatingReplacerFactory: TObfuscationReplacerFactory,
+        @inject(ServiceIdentifiers.Factory__IObfuscatingReplacer) obfuscatingReplacerFactory: TObfuscatingReplacerFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);
 
-        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscationReplacers.IdentifierReplacer);
+        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscatingReplacers.IdentifierReplacer);
     }
 
     /**

+ 5 - 5
src/node-transformers/obfuscating-transformers/FunctionDeclarationTransformer.ts

@@ -5,13 +5,13 @@ import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 
 import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
-import { TObfuscationReplacerFactory } from '../../types/container/TObfuscationReplacerFactory';
+import { TObfuscatingReplacerFactory } from '../../types/container/TObfuscatingReplacerFactory';
 
 import { IOptions } from '../../interfaces/options/IOptions';
-import { IIdentifierReplacer } from '../../interfaces/node-transformers/IIdentifierReplacer';
+import { IIdentifierReplacer } from '../../interfaces/node-transformers/obfuscating-transformers/IIdentifierReplacer';
 import { IVisitor } from '../../interfaces/IVisitor';
 
-import { ObfuscationReplacers } from '../../enums/container/ObfuscationReplacers';
+import { ObfuscatingReplacers } from '../../enums/container/ObfuscatingReplacers';
 import { NodeType } from '../../enums/NodeType';
 
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
@@ -44,12 +44,12 @@ export class FunctionDeclarationTransformer extends AbstractNodeTransformer {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers.Factory__IObfuscationReplacer) obfuscatingReplacerFactory: TObfuscationReplacerFactory,
+        @inject(ServiceIdentifiers.Factory__IObfuscatingReplacer) obfuscatingReplacerFactory: TObfuscatingReplacerFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);
 
-        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscationReplacers.IdentifierReplacer);
+        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscatingReplacers.IdentifierReplacer);
     }
 
     /**

+ 5 - 5
src/node-transformers/obfuscating-transformers/FunctionTransformer.ts

@@ -4,13 +4,13 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 
-import { TObfuscationReplacerFactory } from '../../types/container/TObfuscationReplacerFactory';
+import { TObfuscatingReplacerFactory } from '../../types/container/TObfuscatingReplacerFactory';
 
 import { IOptions } from '../../interfaces/options/IOptions';
-import { IIdentifierReplacer } from '../../interfaces/node-transformers/IIdentifierReplacer';
+import { IIdentifierReplacer } from '../../interfaces/node-transformers/obfuscating-transformers/IIdentifierReplacer';
 import { IVisitor } from '../../interfaces/IVisitor';
 
-import { ObfuscationReplacers } from '../../enums/container/ObfuscationReplacers';
+import { ObfuscatingReplacers } from '../../enums/container/ObfuscatingReplacers';
 
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { Node } from '../../node/Node';
@@ -35,12 +35,12 @@ export class FunctionTransformer extends AbstractNodeTransformer {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers.Factory__IObfuscationReplacer) obfuscatingReplacerFactory: TObfuscationReplacerFactory,
+        @inject(ServiceIdentifiers.Factory__IObfuscatingReplacer) obfuscatingReplacerFactory: TObfuscatingReplacerFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);
 
-        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscationReplacers.IdentifierReplacer);
+        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscatingReplacers.IdentifierReplacer);
     }
 
     /**

+ 5 - 5
src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts

@@ -4,13 +4,13 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 
-import { TObfuscationReplacerFactory } from '../../types/container/TObfuscationReplacerFactory';
+import { TObfuscatingReplacerFactory } from '../../types/container/TObfuscatingReplacerFactory';
 
 import { IOptions } from '../../interfaces/options/IOptions';
-import { IIdentifierReplacer } from '../../interfaces/node-transformers/IIdentifierReplacer';
+import { IIdentifierReplacer } from '../../interfaces/node-transformers/obfuscating-transformers/IIdentifierReplacer';
 import { IVisitor } from '../../interfaces/IVisitor';
 
-import { ObfuscationReplacers } from '../../enums/container/ObfuscationReplacers';
+import { ObfuscatingReplacers } from '../../enums/container/ObfuscatingReplacers';
 
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { Node } from '../../node/Node';
@@ -43,12 +43,12 @@ export class LabeledStatementTransformer extends AbstractNodeTransformer {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers.Factory__IObfuscationReplacer) obfuscatingReplacerFactory: TObfuscationReplacerFactory,
+        @inject(ServiceIdentifiers.Factory__IObfuscatingReplacer) obfuscatingReplacerFactory: TObfuscatingReplacerFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);
 
-        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscationReplacers.IdentifierReplacer);
+        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscatingReplacers.IdentifierReplacer);
     }
 
     /**

+ 9 - 9
src/node-transformers/obfuscating-transformers/LiteralTransformer.ts

@@ -3,12 +3,12 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 
 import * as ESTree from 'estree';
 
-import { TObfuscationReplacerFactory } from '../../types/container/TObfuscationReplacerFactory';
+import { TObfuscatingReplacerFactory } from '../../types/container/TObfuscatingReplacerFactory';
 
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IVisitor } from '../../interfaces/IVisitor';
 
-import { ObfuscationReplacers } from '../../enums/container/ObfuscationReplacers';
+import { ObfuscatingReplacers } from '../../enums/container/ObfuscatingReplacers';
 
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { Node } from '../../node/Node';
@@ -16,21 +16,21 @@ import { Node } from '../../node/Node';
 @injectable()
 export class LiteralTransformer extends AbstractNodeTransformer {
     /**
-     * @type {TObfuscationReplacerFactory}
+     * @type {TObfuscatingReplacerFactory}
      */
-    private readonly obfuscationReplacerFactory: TObfuscationReplacerFactory;
+    private readonly obfuscatingReplacerFactory: TObfuscatingReplacerFactory;
 
     /**
      * @param obfuscatingReplacerFactory
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers.Factory__IObfuscationReplacer) obfuscatingReplacerFactory: TObfuscationReplacerFactory,
+        @inject(ServiceIdentifiers.Factory__IObfuscatingReplacer) obfuscatingReplacerFactory: TObfuscatingReplacerFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);
 
-        this.obfuscationReplacerFactory = obfuscatingReplacerFactory;
+        this.obfuscatingReplacerFactory = obfuscatingReplacerFactory;
     }
 
     /**
@@ -58,15 +58,15 @@ export class LiteralTransformer extends AbstractNodeTransformer {
 
         switch (typeof literalNode.value) {
             case 'boolean':
-                return this.obfuscationReplacerFactory(ObfuscationReplacers.BooleanReplacer)
+                return this.obfuscatingReplacerFactory(ObfuscatingReplacers.BooleanReplacer)
                     .replace(<boolean>literalNode.value);
 
             case 'number':
-                return this.obfuscationReplacerFactory(ObfuscationReplacers.NumberLiteralReplacer)
+                return this.obfuscatingReplacerFactory(ObfuscatingReplacers.NumberLiteralReplacer)
                     .replace(<number>literalNode.value);
 
             case 'string':
-                return this.obfuscationReplacerFactory(ObfuscationReplacers.StringLiteralReplacer)
+                return this.obfuscatingReplacerFactory(ObfuscatingReplacers.StringLiteralReplacer)
                     .replace(<string>literalNode.value);
 
             default:

+ 5 - 5
src/node-transformers/obfuscating-transformers/VariableDeclarationTransformer.ts

@@ -5,13 +5,13 @@ import * as estraverse from 'estraverse';
 import * as ESTree from 'estree';
 
 import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
-import { TObfuscationReplacerFactory } from '../../types/container/TObfuscationReplacerFactory';
+import { TObfuscatingReplacerFactory } from '../../types/container/TObfuscatingReplacerFactory';
 
 import { IOptions } from '../../interfaces/options/IOptions';
-import { IIdentifierReplacer } from '../../interfaces/node-transformers/IIdentifierReplacer';
+import { IIdentifierReplacer } from '../../interfaces/node-transformers/obfuscating-transformers/IIdentifierReplacer';
 import { IVisitor } from '../../interfaces/IVisitor';
 
-import { ObfuscationReplacers } from '../../enums/container/ObfuscationReplacers';
+import { ObfuscatingReplacers } from '../../enums/container/ObfuscatingReplacers';
 import { NodeType } from '../../enums/NodeType';
 
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
@@ -45,12 +45,12 @@ export class VariableDeclarationTransformer extends AbstractNodeTransformer {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers.Factory__IObfuscationReplacer) obfuscatingReplacerFactory: TObfuscationReplacerFactory,
+        @inject(ServiceIdentifiers.Factory__IObfuscatingReplacer) obfuscatingReplacerFactory: TObfuscatingReplacerFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);
 
-        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscationReplacers.IdentifierReplacer);
+        this.identifierReplacer = <IIdentifierReplacer>obfuscatingReplacerFactory(ObfuscatingReplacers.IdentifierReplacer);
     }
 
     /**

+ 1 - 1
src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts

@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 import * as ESTree from 'estree';
 
-import { IObfuscatingReplacer } from '../../../interfaces/node-transformers/IObfuscatingReplacer';
+import { IObfuscatingReplacer } from '../../../interfaces/node-transformers/obfuscating-transformers/IObfuscatingReplacer';
 import { IOptions } from '../../../interfaces/options/IOptions';
 
 @injectable()

+ 3 - 3
src/node-transformers/obfuscating-transformers/obfuscating-replacers/BooleanLiteralReplacer.ts

@@ -44,8 +44,8 @@ export class BooleanLiteralReplacer extends AbstractObfuscatingReplacer {
      * @returns {ESTree.Node}
      */
     public replace (nodeValue: boolean): ESTree.Node {
-        return nodeValue ?
-            BooleanLiteralReplacer.getTrueUnaryExpressionNode() :
-            BooleanLiteralReplacer.getFalseUnaryExpressionNode();
+        return nodeValue
+            ? BooleanLiteralReplacer.getTrueUnaryExpressionNode()
+            : BooleanLiteralReplacer.getFalseUnaryExpressionNode();
     }
 }

+ 1 - 1
src/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierReplacer.ts

@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 import * as ESTree from 'estree';
 
-import { IIdentifierReplacer } from '../../../interfaces/node-transformers/IIdentifierReplacer';
+import { IIdentifierReplacer } from '../../../interfaces/node-transformers/obfuscating-transformers/IIdentifierReplacer';
 import { IOptions } from '../../../interfaces/options/IOptions';
 
 import { AbstractObfuscatingReplacer } from './AbstractObfuscatingReplacer';

+ 32 - 17
src/node-transformers/obfuscating-transformers/obfuscating-replacers/StringLiteralReplacer.ts

@@ -4,7 +4,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 import * as ESTree from 'estree';
 
 import { ICustomNodeGroup } from '../../../interfaces/custom-nodes/ICustomNodeGroup';
-import { IEncodedValue } from '../../../interfaces/node-transformers/IEncodedValue';
+import { IEncodedValue } from '../../../interfaces/node-transformers/obfuscating-transformers/IEncodedValue';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IStorage } from '../../../interfaces/storages/IStorage';
 
@@ -67,6 +67,30 @@ export class StringLiteralReplacer extends AbstractObfuscatingReplacer {
             .n(() => RandomGeneratorUtils.getRandomGenerator().string({length: 4}), 50);
     }
 
+    /**
+     * @param hexadecimalIndex
+     * @return {ESTree.Literal}
+     */
+    private static getHexadecimalLiteralNode (hexadecimalIndex: string): ESTree.Literal {
+        const hexadecimalLiteralNode: ESTree.Literal = Nodes.getLiteralNode(hexadecimalIndex);
+
+        hexadecimalLiteralNode.obfuscatedNode = true;
+
+        return hexadecimalLiteralNode;
+    }
+
+    /**
+     * @param literalValue
+     * @return {ESTree.Literal}
+     */
+    private static getRc4KeyLiteralNode (literalValue: string): ESTree.Literal {
+        const rc4KeyLiteralNode: ESTree.Literal = Nodes.getLiteralNode(literalValue);
+
+        rc4KeyLiteralNode.obfuscatedNode = true;
+
+        return rc4KeyLiteralNode;
+    }
+
     /**
      * @param nodeValue
      * @returns {ESTree.Node}
@@ -159,31 +183,22 @@ export class StringLiteralReplacer extends AbstractObfuscatingReplacer {
      */
     private replaceWithStringArrayCallNode (value: string): ESTree.Node {
         const { encodedValue, key }: IEncodedValue = this.getEncodedValue(value);
-        const hexadecimalIndex: string = this.getArrayHexadecimalIndex(encodedValue);
         const rotatedStringArrayStorageId: string = Utils.stringRotate(this.stringArrayStorage.getStorageId(), 1);
         const stringArrayStorageCallsWrapperName: string = `_${Utils.hexadecimalPrefix}${rotatedStringArrayStorageId}`;
-
-        const hexadecimalLiteralNode: ESTree.Literal = Nodes.getLiteralNode(hexadecimalIndex);
-
-        hexadecimalLiteralNode.obfuscatedNode = true;
-
         const callExpressionArgs: (ESTree.Expression | ESTree.SpreadElement)[] = [
-            hexadecimalLiteralNode
+            StringLiteralReplacer.getHexadecimalLiteralNode(
+                this.getArrayHexadecimalIndex(encodedValue)
+            )
         ];
 
         if (key) {
-            const rc4KeyLiteralNode: ESTree.Literal = Nodes.getLiteralNode(
+            callExpressionArgs.push(StringLiteralReplacer.getRc4KeyLiteralNode(
                 Utils.stringToUnicodeEscapeSequence(key, !this.options.unicodeEscapeSequence)
-            );
-
-            rc4KeyLiteralNode.obfuscatedNode = true;
-            callExpressionArgs.push(rc4KeyLiteralNode);
+            ));
         }
 
-        return  Nodes.getCallExpressionNode(
-            Nodes.getIdentifierNode(
-                stringArrayStorageCallsWrapperName
-            ),
+        return Nodes.getCallExpressionNode(
+            Nodes.getIdentifierNode(stringArrayStorageCallsWrapperName),
             callExpressionArgs
         );
     }

+ 1 - 1
src/types/container/TControlFlowReplacerFactory.d.ts

@@ -1,4 +1,4 @@
-import { IControlFlowReplacer } from '../../interfaces/node-transformers/IControlFlowReplacer';
+import { IControlFlowReplacer } from '../../interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer';
 
 import { ControlFlowReplacers } from '../../enums/container/ControlFlowReplacers';
 

+ 5 - 0
src/types/container/TObfuscatingReplacerFactory.d.ts

@@ -0,0 +1,5 @@
+import { IObfuscatingReplacer } from '../../interfaces/node-transformers/obfuscating-transformers/IObfuscatingReplacer';
+
+import { ObfuscatingReplacers } from '../../enums/container/ObfuscatingReplacers';
+
+export type TObfuscatingReplacerFactory = (replacer: ObfuscatingReplacers) => IObfuscatingReplacer;

+ 0 - 5
src/types/container/TObfuscationReplacerFactory.d.ts

@@ -1,5 +0,0 @@
-import { IObfuscatingReplacer } from '../../interfaces/node-transformers/IObfuscatingReplacer';
-
-import { ObfuscationReplacers } from '../../enums/container/ObfuscationReplacers';
-
-export type TObfuscationReplacerFactory = (replacer: ObfuscationReplacers) => IObfuscatingReplacer;