Bladeren bron

service identifiers name change

sanex3339 8 jaren geleden
bovenliggende
commit
435370687a
36 gewijzigde bestanden met toevoegingen van 259 en 244 verwijderingen
  1. 148 147
      dist/index.js
  2. 2 3
      package.json
  3. 2 2
      src/Obfuscator.ts
  4. 1 1
      src/SourceMapCorrector.ts
  5. 1 1
      src/container/InversifyContainerFacade.ts
  6. 12 12
      src/container/ServiceIdentifiers.ts
  7. 16 16
      src/container/modules/custom-nodes/CustomNodesModule.ts
  8. 1 1
      src/container/modules/node-transformers/NodeControlFlowTransformersModule.ts
  9. 1 1
      src/container/modules/node-transformers/NodeObfuscatorsModule.ts
  10. 1 1
      src/container/modules/node-transformers/NodeTransformersModule.ts
  11. 1 1
      src/container/modules/stack-trace-analyzer/StackTraceAnalyzerModule.ts
  12. 14 11
      src/container/modules/storages/StoragesModule.ts
  13. 1 1
      src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts
  14. 6 4
      src/custom-nodes/control-flow-replacers-nodes/binary-expression-control-flow-replacer-nodes/BinaryExpressionFunctionNode.ts
  15. 10 8
      src/custom-nodes/control-flow-replacers-nodes/binary-expression-control-flow-replacer-nodes/ControlFlowStorageCallNode.ts
  16. 1 1
      src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts
  17. 1 1
      src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts
  18. 1 1
      src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts
  19. 2 2
      src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts
  20. 3 3
      src/node-transformers/node-control-flow-transformers/FunctionControlFlowTransformer.ts
  21. 1 1
      src/node-transformers/node-control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts
  22. 1 1
      src/node-transformers/node-obfuscators/CatchClauseObfuscator.ts
  23. 1 1
      src/node-transformers/node-obfuscators/FunctionDeclarationObfuscator.ts
  24. 1 1
      src/node-transformers/node-obfuscators/FunctionObfuscator.ts
  25. 1 1
      src/node-transformers/node-obfuscators/LabeledStatementObfuscator.ts
  26. 1 1
      src/node-transformers/node-obfuscators/LiteralObfuscator.ts
  27. 1 1
      src/node-transformers/node-obfuscators/MemberExpressionObfuscator.ts
  28. 1 1
      src/node-transformers/node-obfuscators/MethodDefinitionObfuscator.ts
  29. 1 1
      src/node-transformers/node-obfuscators/VariableDeclarationObfuscator.ts
  30. 2 2
      src/node-transformers/node-obfuscators/replacers/StringLiteralReplacer.ts
  31. 10 13
      src/node/Nodes.ts
  32. 1 1
      src/stack-trace-analyzer/StackTraceAnalyzer.ts
  33. 1 1
      src/storages/custom-node-group/CustomNodeGroupStorage.ts
  34. 4 0
      src/types/storages/TControlFlowStorage.d.ts
  35. 4 0
      src/types/storages/TCustomNodeGroupStorage.d.ts
  36. 3 0
      src/types/storages/TStringArrayStorage.d.ts

File diff suppressed because it is too large
+ 148 - 147
dist/index.js


+ 2 - 3
package.json

@@ -44,10 +44,9 @@
     "@types/esprima": "2.1.33",
     "@types/estraverse": "0.0.6",
     "@types/estree": "0.0.34",
-    "@types/joi": "9.0.33",
-    "@types/lodash": "^4.14.43",
+    "@types/lodash": "^4.14.44",
     "@types/mkdirp": "0.3.29",
-    "@types/mocha": "2.2.33",
+    "@types/mocha": "2.2.34",
     "@types/node": "6.0.52",
     "@types/sinon": "1.16.33",
     "@types/string-template": "1.0.2",

+ 2 - 2
src/Obfuscator.ts

@@ -89,8 +89,8 @@ export class Obfuscator implements IObfuscator {
     constructor (
         @inject(ServiceIdentifiers.IStackTraceAnalyzer) stackTraceAnalyzer: IStackTraceAnalyzer,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
-        @inject(ServiceIdentifiers['IStorage<ICustomNodeGroup>']) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
-        @inject(ServiceIdentifiers['Factory<INodeTransformer[]>']) nodeTransformersFactory: TNodeTransformersFactory,
+        @inject(ServiceIdentifiers.TCustomNodeGroupStorage) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
+        @inject(ServiceIdentifiers.Factory__INodeTransformer) nodeTransformersFactory: TNodeTransformersFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         this.stackTraceAnalyzer = stackTraceAnalyzer;

+ 1 - 1
src/SourceMapCorrector.ts

@@ -28,7 +28,7 @@ export class SourceMapCorrector implements ISourceMapCorrector {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<IObfuscationResult>']) obfuscationResultFactory: TObfuscationResultFactory,
+        @inject(ServiceIdentifiers.Factory__IObfuscationResult) obfuscationResultFactory: TObfuscationResultFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         this.obfuscationResultFactory = obfuscationResultFactory;

+ 1 - 1
src/container/InversifyContainerFacade.ts

@@ -60,7 +60,7 @@ export class InversifyContainerFacade implements IInversifyContainerFacade {
             .inSingletonScope();
 
         this.container
-            .bind<IObfuscationResult>(ServiceIdentifiers['Factory<IObfuscationResult>'])
+            .bind<IObfuscationResult>(ServiceIdentifiers.Factory__IObfuscationResult)
             .toFactory<IObfuscationResult>((context: interfaces.Context) => {
                 return (obfuscatedCode: string, sourceMap: string) => {
                     const obfuscationResult: IObfuscationResult = context.container

+ 12 - 12
src/container/ServiceIdentifiers.ts

@@ -1,14 +1,13 @@
 export const ServiceIdentifiers: any = {
-    'Factory<ICalleeDataExtractor>': Symbol('Factory<ICalleeDataExtractor>'),
-    'Factory<IControlFlowReplacer>': Symbol('Factory<IControlFlowReplacer>'),
-    'Factory<ICustomNode>': Symbol('Factory<ICustomNode>'),
-    'Factory<ICustomNodeGroup>': Symbol('Factory<ICustomNodeGroup>'),
-    'Factory<INodeTransformer[]>': Symbol('Factory<INodeTransformer[]>'),
-    'Factory<IObfuscationResult>': Symbol('Factory<IObfuscationResult>'),
-    'Factory<IObfuscatorReplacer>': Symbol('Factory<IObfuscatorReplacer>'),
-    'Factory<IStorage<ICustomNode>>': Symbol('Factory<IStorage<ICustomNode>>'),
+    Factory__ICalleeDataExtractor: Symbol('Factory<ICalleeDataExtractor>'),
+    Factory__IControlFlowReplacer: Symbol('Factory<IControlFlowReplacer>'),
+    Factory__ICustomNode: Symbol('Factory<ICustomNode>'),
+    Factory__ICustomNodeGroup: Symbol('Factory<ICustomNodeGroup>'),
+    Factory__INodeTransformer: Symbol('Factory<INodeTransformer[]>'),
+    Factory__IObfuscationResult: Symbol('Factory<IObfuscationResult>'),
+    Factory__IObfuscatorReplacer: Symbol('Factory<IObfuscatorReplacer>'),
+    Factory__TControlFlowStorage: Symbol('Factory<TControlFlowStorage>'),
     ICalleeDataExtractor: Symbol('ICalleeDataExtractor'),
-    ICustomNode: Symbol('ICustomNode'),
     ICustomNodeGroup: Symbol('ICustomNodeGroup'),
     IControlFlowReplacer: Symbol('IControlFlowReplacer'),
     IJavaScriptObfuscator: Symbol('IJavaScriptObfuscator'),
@@ -20,7 +19,8 @@ export const ServiceIdentifiers: any = {
     IObfuscatorReplacer: Symbol('IObfuscatorReplacer'),
     ISourceMapCorrector: Symbol('ISourceMapCorrector'),
     IStackTraceAnalyzer: Symbol('IStackTraceAnalyzer'),
-    'IStorage<ICustomNode>': Symbol('IStorage<ICustomNode>'),
-    'IStorage<ICustomNodeGroup>': Symbol('IStorage<ICustomNodeGroup>'),
-    'IStorage<string>': Symbol('IStorage<string>')
+    Newable__ICustomNode: Symbol('Newable<ICustomNode>'),
+    Newable__TControlFlowStorage: Symbol('Newable<TControlFlowStorage>'),
+    TCustomNodeGroupStorage: Symbol('TCustomNodeGroupStorage'),
+    TStringArrayStorage: Symbol('TStringArrayStorage')
 };

+ 16 - 16
src/container/modules/custom-nodes/CustomNodesModule.ts

@@ -30,55 +30,55 @@ import { StringArrayRotateFunctionNode } from '../../../custom-nodes/string-arra
 
 export const customNodesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
     // custom nodes
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(BinaryExpressionFunctionNode)
         .whenTargetNamed(CustomNodes.BinaryExpressionFunctionNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(ControlFlowStorageCallNode)
         .whenTargetNamed(CustomNodes.ControlFlowStorageCallNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(ControlFlowStorageNode)
         .whenTargetNamed(CustomNodes.ControlFlowStorageNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(ConsoleOutputDisableExpressionNode)
         .whenTargetNamed(CustomNodes.ConsoleOutputDisableExpressionNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(DebugProtectionFunctionCallNode)
         .whenTargetNamed(CustomNodes.DebugProtectionFunctionCallNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(DebugProtectionFunctionIntervalNode)
         .whenTargetNamed(CustomNodes.DebugProtectionFunctionIntervalNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(DebugProtectionFunctionNode)
         .whenTargetNamed(CustomNodes.DebugProtectionFunctionNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(DomainLockNode)
         .whenTargetNamed(CustomNodes.DomainLockNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(NodeCallsControllerFunctionNode)
         .whenTargetNamed(CustomNodes.NodeCallsControllerFunctionNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(SelfDefendingUnicodeNode)
         .whenTargetNamed(CustomNodes.SelfDefendingUnicodeNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(StringArrayCallsWrapper)
         .whenTargetNamed(CustomNodes.StringArrayCallsWrapper);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(StringArrayNode)
         .whenTargetNamed(CustomNodes.StringArrayNode);
 
-    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
+    bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(StringArrayRotateFunctionNode)
         .whenTargetNamed(CustomNodes.StringArrayRotateFunctionNode);
 
@@ -104,7 +104,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
         .whenTargetNamed(CustomNodeGroups.StringArrayCustomNodeGroup);
 
     // customNode factory
-    bind<ICustomNode>(ServiceIdentifiers['Factory<ICustomNode>'])
+    bind<ICustomNode>(ServiceIdentifiers.Factory__ICustomNode)
         .toFactory<ICustomNode>((context: interfaces.Context) => {
             const cache: Map <CustomNodes, interfaces.Newable<ICustomNode>> = new Map();
 
@@ -121,7 +121,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
 
                 const constructor: interfaces.Newable<ICustomNode> = context.container
                     .getNamed<interfaces.Newable<ICustomNode>>(
-                        ServiceIdentifiers.ICustomNode,
+                        ServiceIdentifiers.Newable__ICustomNode,
                         customNodeName
                     );
 
@@ -132,7 +132,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
         });
 
     // CustomNodeGroup factory
-    bind<ICustomNodeGroup>(ServiceIdentifiers['Factory<ICustomNodeGroup>'])
+    bind<ICustomNodeGroup>(ServiceIdentifiers.Factory__ICustomNodeGroup)
         .toFactory<ICustomNodeGroup>((context: interfaces.Context) => {
             return (customNodeGroupName: CustomNodeGroups) => {
                 return context.container.getNamed<ICustomNodeGroup>(

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

@@ -12,7 +12,7 @@ export const nodeControlFlowTransformersModule: interfaces.ContainerModule = new
         .to(BinaryExpressionControlFlowReplacer)
         .whenTargetNamed(NodeControlFlowReplacers.BinaryExpressionControlFlowReplacer);
 
-    bind<IControlFlowReplacer>(ServiceIdentifiers['Factory<IControlFlowReplacer>'])
+    bind<IControlFlowReplacer>(ServiceIdentifiers.Factory__IControlFlowReplacer)
         .toFactory<IControlFlowReplacer>((context: interfaces.Context) => {
             const cache: Map <NodeControlFlowReplacers, IControlFlowReplacer> = new Map();
 

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

@@ -27,7 +27,7 @@ export const nodeObfuscatorsModule: interfaces.ContainerModule = new ContainerMo
         .to(StringLiteralReplacer)
         .whenTargetNamed(NodeObfuscatorsReplacers.StringLiteralReplacer);
 
-    bind<IObfuscatorReplacer>(ServiceIdentifiers['Factory<IObfuscatorReplacer>'])
+    bind<IObfuscatorReplacer>(ServiceIdentifiers.Factory__IObfuscatorReplacer)
         .toFactory<IObfuscatorReplacer>((context: interfaces.Context) => {
             const cache: Map <NodeObfuscatorsReplacers, IObfuscatorReplacer> = new Map();
 

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

@@ -61,7 +61,7 @@ export const nodeTransformersModule: interfaces.ContainerModule = new ContainerM
         .whenTargetNamed(NodeTransformers.VariableDeclarationObfuscator);
 
     // node transformers factory
-    bind<INodeTransformer[]>(ServiceIdentifiers['Factory<INodeTransformer[]>'])
+    bind<INodeTransformer[]>(ServiceIdentifiers.Factory__INodeTransformer)
         .toFactory<INodeTransformer[]>((context: interfaces.Context) => {
             const cache: Map <NodeTransformers, INodeTransformer> = new Map();
 

+ 1 - 1
src/container/modules/stack-trace-analyzer/StackTraceAnalyzerModule.ts

@@ -30,7 +30,7 @@ export const stackTraceAnalyzerModule: interfaces.ContainerModule = new Containe
         .whenTargetNamed(CalleeDataExtractors.ObjectExpressionCalleeDataExtractor);
 
     // node transformers factory
-    bind<ICalleeDataExtractor>(ServiceIdentifiers['Factory<ICalleeDataExtractor>'])
+    bind<ICalleeDataExtractor>(ServiceIdentifiers.Factory__ICalleeDataExtractor)
         .toFactory<ICalleeDataExtractor>((context: interfaces.Context) => {
             const cache: Map <CalleeDataExtractors, ICalleeDataExtractor> = new Map();
 

+ 14 - 11
src/container/modules/storages/StoragesModule.ts

@@ -1,9 +1,9 @@
 import { ContainerModule, interfaces } from 'inversify';
 import { ServiceIdentifiers } from '../../ServiceIdentifiers';
 
-import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
-import { ICustomNodeGroup } from '../../../interfaces/custom-nodes/ICustomNodeGroup';
-import { IStorage } from '../../../interfaces/storages/IStorage';
+import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
+import { TCustomNodeGroupStorage } from '../../../types/storages/TCustomNodeGroupStorage';
+import { TStringArrayStorage } from '../../../types/storages/TStringArrayStorage';
 
 import { ControlFlowStorage } from '../../../storages/control-flow/ControlFlowStorage';
 import { CustomNodeGroupStorage } from '../../../storages/custom-node-group/CustomNodeGroupStorage';
@@ -11,22 +11,25 @@ import { StringArrayStorage } from '../../../storages/string-array/StringArraySt
 
 export const storagesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
     // storages
-    bind<IStorage<ICustomNodeGroup>>(ServiceIdentifiers['IStorage<ICustomNodeGroup>'])
+    bind<TCustomNodeGroupStorage>(ServiceIdentifiers.TCustomNodeGroupStorage)
         .to(CustomNodeGroupStorage)
         .inSingletonScope();
 
-    bind<IStorage<ICustomNode>>(ServiceIdentifiers['IStorage<ICustomNode>'])
-        .to(ControlFlowStorage);
-
-    bind<IStorage<string>>(ServiceIdentifiers['IStorage<string>'])
+    bind<TStringArrayStorage>(ServiceIdentifiers.TStringArrayStorage)
         .to(StringArrayStorage)
         .inSingletonScope();
 
+    bind<interfaces.Newable<TControlFlowStorage>>(ServiceIdentifiers.Newable__TControlFlowStorage)
+        .toConstructor(ControlFlowStorage);
+
     // controlFlowStorage factory
-    bind<IStorage<ICustomNode>>(ServiceIdentifiers['Factory<IStorage<ICustomNode>>'])
-        .toFactory<IStorage<ICustomNode>>((context: interfaces.Context) => {
+    bind<TControlFlowStorage>(ServiceIdentifiers.Factory__TControlFlowStorage)
+        .toFactory<TControlFlowStorage>((context: interfaces.Context) => {
             return () => {
-                return new ControlFlowStorage();
+                const constructor: interfaces.Newable<TControlFlowStorage> = context.container
+                    .get<interfaces.Newable<TControlFlowStorage>>(ServiceIdentifiers.Newable__TControlFlowStorage);
+
+                return new constructor();
             };
         });
 });

+ 1 - 1
src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts

@@ -48,7 +48,7 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {

+ 6 - 4
src/custom-nodes/control-flow-replacers-nodes/binary-expression-control-flow-replacer-nodes/BinaryExpressionFunctionNode.ts

@@ -1,6 +1,8 @@
 import { injectable, inject } from 'inversify';
 import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
+import { BinaryOperator } from 'estree';
+
 import { TStatement } from '../../../types/node/TStatement';
 
 import { IOptions } from '../../../interfaces/options/IOptions';
@@ -14,10 +16,10 @@ import { RandomGeneratorUtils } from '../../../utils/RandomGeneratorUtils';
 @injectable()
 export class BinaryExpressionFunctionNode extends AbstractCustomNode {
     /**
-     * @type {string}
+     * @type {BinaryOperator}
      */
     @initializable()
-    private operator: string;
+    private operator: BinaryOperator;
 
     /**
      * @param options
@@ -31,7 +33,7 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
     /**
      * @param operator
      */
-    public initialize (operator: string): void {
+    public initialize (operator: BinaryOperator): void {
         this.operator = operator;
     }
 
@@ -49,7 +51,7 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
                 Nodes.getBlockStatementNode([
                     Nodes.getReturnStatementNode(
                         Nodes.getBinaryExpressionNode(
-                            <any>this.operator,
+                            this.operator,
                             Nodes.getIdentifierNode('x'),
                             Nodes.getIdentifierNode('y')
                         )

+ 10 - 8
src/custom-nodes/control-flow-replacers-nodes/binary-expression-control-flow-replacer-nodes/ControlFlowStorageCallNode.ts

@@ -1,6 +1,8 @@
 import { injectable, inject } from 'inversify';
 import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
+import { Expression } from 'estree';
+
 import { TStatement } from '../../../types/node/TStatement';
 
 import { IOptions } from '../../../interfaces/options/IOptions';
@@ -25,16 +27,16 @@ export class ControlFlowStorageCallNode extends AbstractCustomNode {
     private controlFlowStorageName: string;
 
     /**
-     * @type {string}
+     * @type {Expression}
      */
     @initializable()
-    private leftValue: string;
+    private leftValue: Expression;
 
     /**
-     * @type {string}
+     * @type {ESTree.Expression}
      */
     @initializable()
-    private rightValue: string;
+    private rightValue: Expression;
 
     /**
      * @param options
@@ -54,8 +56,8 @@ export class ControlFlowStorageCallNode extends AbstractCustomNode {
     public initialize (
         controlFlowStorageName: string,
         controlFlowStorageKey: string,
-        leftValue: string,
-        rightValue: string,
+        leftValue: Expression,
+        rightValue: Expression,
     ): void {
         this.controlFlowStorageName = controlFlowStorageName;
         this.controlFlowStorageKey = controlFlowStorageKey;
@@ -72,8 +74,8 @@ export class ControlFlowStorageCallNode extends AbstractCustomNode {
                         Nodes.getIdentifierNode(this.controlFlowStorageKey)
                     ),
                     [
-                        <any>this.leftValue,
-                        <any>this.rightValue
+                        this.leftValue,
+                        this.rightValue
                     ]
                 )
             )

+ 1 - 1
src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts

@@ -48,7 +48,7 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {

+ 1 - 1
src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts

@@ -48,7 +48,7 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {

+ 1 - 1
src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts

@@ -48,7 +48,7 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {

+ 2 - 2
src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts

@@ -57,9 +57,9 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
-        @inject(ServiceIdentifiers['IStorage<string>']) stringArrayStorage: IStorage<string>,
+        @inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStorage<string>,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 3 - 3
src/node-transformers/node-control-flow-transformers/FunctionControlFlowTransformer.ts

@@ -75,9 +75,9 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<IStorage<ICustomNode>>']) controlFlowStorageFactory: TControlFlowStorageFactory,
-        @inject(ServiceIdentifiers['Factory<IControlFlowReplacer>']) controlFlowReplacerFactory: TControlFlowReplacerFactory,
-        @inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__TControlFlowStorage) controlFlowStorageFactory: TControlFlowStorageFactory,
+        @inject(ServiceIdentifiers.Factory__IControlFlowReplacer) controlFlowReplacerFactory: TControlFlowReplacerFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

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

@@ -38,7 +38,7 @@ export class BinaryExpressionControlFlowReplacer extends AbstractControlFlowRepl
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 1 - 1
src/node-transformers/node-obfuscators/CatchClauseObfuscator.ts

@@ -36,7 +36,7 @@ export class CatchClauseObfuscator extends AbstractNodeTransformer {
      * @param options
      */
     constructor(
-        @inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
+        @inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 1 - 1
src/node-transformers/node-obfuscators/FunctionDeclarationObfuscator.ts

@@ -39,7 +39,7 @@ export class FunctionDeclarationObfuscator extends AbstractNodeTransformer {
      * @param options
      */
     constructor(
-        @inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
+        @inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 1 - 1
src/node-transformers/node-obfuscators/FunctionObfuscator.ts

@@ -36,7 +36,7 @@ export class FunctionObfuscator extends AbstractNodeTransformer {
      * @param options
      */
     constructor(
-        @inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
+        @inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 1 - 1
src/node-transformers/node-obfuscators/LabeledStatementObfuscator.ts

@@ -44,7 +44,7 @@ export class LabeledStatementObfuscator extends AbstractNodeTransformer {
      * @param options
      */
     constructor(
-        @inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
+        @inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 1 - 1
src/node-transformers/node-obfuscators/LiteralObfuscator.ts

@@ -24,7 +24,7 @@ export class LiteralObfuscator extends AbstractNodeTransformer {
      * @param options
      */
     constructor(
-        @inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
+        @inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 1 - 1
src/node-transformers/node-obfuscators/MemberExpressionObfuscator.ts

@@ -25,7 +25,7 @@ export class MemberExpressionObfuscator extends AbstractNodeTransformer {
      * @param options
      */
     constructor(
-        @inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
+        @inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 1 - 1
src/node-transformers/node-obfuscators/MethodDefinitionObfuscator.ts

@@ -36,7 +36,7 @@ export class MethodDefinitionObfuscator extends AbstractNodeTransformer {
      * @param options
      */
     constructor(
-        @inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
+        @inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 1 - 1
src/node-transformers/node-obfuscators/VariableDeclarationObfuscator.ts

@@ -40,7 +40,7 @@ export class VariableDeclarationObfuscator extends AbstractNodeTransformer {
      * @param options
      */
     constructor(
-        @inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
+        @inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 2 - 2
src/node-transformers/node-obfuscators/replacers/StringLiteralReplacer.ts

@@ -41,8 +41,8 @@ export class StringLiteralReplacer extends AbstractReplacer {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['IStorage<ICustomNodeGroup>']) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
-        @inject(ServiceIdentifiers['IStorage<string>']) stringArrayStorage: IStorage<string>,
+        @inject(ServiceIdentifiers.TCustomNodeGroupStorage) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
+        @inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStorage<string>,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);

+ 10 - 13
src/node/Nodes.ts

@@ -7,13 +7,13 @@ import { NodeType } from '../enums/NodeType';
 
 export class Nodes {
     /**
-     * @param bodyNodes
+     * @param body
      * @returns {ESTree.Program}
      */
-    public static getProgramNode (bodyNodes: TStatement[] = []): ESTree.Program {
+    public static getProgramNode (body: TStatement[] = []): ESTree.Program {
         return {
             type: NodeType.Program,
-            body: bodyNodes,
+            body,
             sourceType: 'script',
             obfuscated: false
         };
@@ -40,26 +40,26 @@ export class Nodes {
     }
 
     /**
-     * @param bodyNodes
+     * @param body
      * @returns {ESTree.BlockStatement}
      */
-    public static getBlockStatementNode (bodyNodes: ESTree.Statement[] = []): ESTree.BlockStatement {
+    public static getBlockStatementNode (body: ESTree.Statement[] = []): ESTree.BlockStatement {
         return {
             type: NodeType.BlockStatement,
-            body: bodyNodes,
+            body,
             obfuscated: false
         };
     }
 
     /**
-     * @param bodyNodes
+     * @param body
      * @returns {ESTree.CatchClause}
      */
-    public static getCatchClauseNode (bodyNodes: ESTree.Statement[] = []): ESTree.CatchClause {
+    public static getCatchClauseNode (body: ESTree.Statement[] = []): ESTree.CatchClause {
         return {
             type: NodeType.CatchClause,
             param: Nodes.getIdentifierNode('err'),
-            body: Nodes.getBlockStatementNode(bodyNodes),
+            body: Nodes.getBlockStatementNode(body),
             obfuscated: false
         };
     }
@@ -137,10 +137,7 @@ export class Nodes {
      * @param consequent
      * @returns {ESTree.IfStatement}
      */
-    public static getIfStatementNode (
-        test: ESTree.Expression,
-        consequent: ESTree.BlockStatement,
-    ): ESTree.IfStatement {
+    public static getIfStatementNode (test: ESTree.Expression, consequent: ESTree.BlockStatement,): ESTree.IfStatement {
         return {
             type: NodeType.IfStatement,
             test,

+ 1 - 1
src/stack-trace-analyzer/StackTraceAnalyzer.ts

@@ -74,7 +74,7 @@ export class StackTraceAnalyzer implements IStackTraceAnalyzer {
     private calleeDataExtractorsFactory: (calleeDataExtractorName: CalleeDataExtractors) => ICalleeDataExtractor;
 
     constructor (
-        @inject(ServiceIdentifiers['Factory<ICalleeDataExtractor>']) calleeDataExtractorsFactory: TCalleeDataExtractorsFactory
+        @inject(ServiceIdentifiers.Factory__ICalleeDataExtractor) calleeDataExtractorsFactory: TCalleeDataExtractorsFactory
     ) {
         this.calleeDataExtractorsFactory = calleeDataExtractorsFactory;
     }

+ 1 - 1
src/storages/custom-node-group/CustomNodeGroupStorage.ts

@@ -39,7 +39,7 @@ export class CustomNodeGroupStorage extends MapStorage <ICustomNodeGroup> {
      * @param options
      */
     constructor (
-        @inject(ServiceIdentifiers['Factory<ICustomNodeGroup>']) customNodeGroupFactory: TCustomNodeGroupFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomNodeGroup) customNodeGroupFactory: TCustomNodeGroupFactory,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super();

+ 4 - 0
src/types/storages/TControlFlowStorage.d.ts

@@ -0,0 +1,4 @@
+import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
+import { IStorage } from '../../interfaces/storages/IStorage';
+
+export type TControlFlowStorage = IStorage<ICustomNode>;

+ 4 - 0
src/types/storages/TCustomNodeGroupStorage.d.ts

@@ -0,0 +1,4 @@
+import { ICustomNodeGroup } from '../../interfaces/custom-nodes/ICustomNodeGroup';
+import { IStorage } from '../../interfaces/storages/IStorage';
+
+export type TCustomNodeGroupStorage = IStorage<ICustomNodeGroup>;

+ 3 - 0
src/types/storages/TStringArrayStorage.d.ts

@@ -0,0 +1,3 @@
+import { IStorage } from '../../interfaces/storages/IStorage';
+
+export type TStringArrayStorage = IStorage<string>;

Some files were not shown because too many files changed in this diff