Просмотр исходного кода

Custom nodes refactoring. CustomNodeObfuscator class.

sanex3339 5 лет назад
Родитель
Сommit
9dde522879
74 измененных файлов с 422 добавлено и 27563 удалено
  1. 0 0
      dist/index.browser.js
  2. 0 14045
      dist/index.cli.js
  3. 0 13348
      dist/index.js
  4. 1 1
      src/container/ServiceIdentifiers.ts
  5. 10 0
      src/container/modules/custom-nodes/CustomNodesModule.ts
  6. 17 48
      src/custom-nodes/AbstractCustomNode.ts
  7. 1 1
      src/custom-nodes/AbstractCustomNodeGroup.ts
  8. 74 0
      src/custom-nodes/CustomNodeObfuscator.ts
  9. 0 0
      src/custom-nodes/common/templates/GlobalVariableNoEvalTemplate.ts
  10. 0 0
      src/custom-nodes/common/templates/GlobalVariableTemplate1.ts
  11. 0 0
      src/custom-nodes/common/templates/GlobalVariableTemplate2.ts
  12. 0 0
      src/custom-nodes/common/templates/SingleNodeCallControllerTemplate.ts
  13. 13 4
      src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts
  14. 0 0
      src/custom-nodes/console-output-nodes/templates/ConsoleOutputDisableExpressionTemplate.ts
  15. 11 2
      src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts
  16. 11 2
      src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts
  17. 11 2
      src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts
  18. 11 2
      src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts
  19. 11 2
      src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts
  20. 11 2
      src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts
  21. 11 2
      src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts
  22. 10 1
      src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts
  23. 11 2
      src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts
  24. 11 2
      src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts
  25. 12 3
      src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts
  26. 12 3
      src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts
  27. 14 5
      src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts
  28. 0 0
      src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate.ts
  29. 0 0
      src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate.ts
  30. 0 0
      src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebugProtectionFunctionTemplate.ts
  31. 0 0
      src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebuggerTemplate.ts
  32. 0 0
      src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebuggerTemplateNoEval.ts
  33. 13 4
      src/custom-nodes/domain-lock-nodes/DomainLockNode.ts
  34. 0 0
      src/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate.ts
  35. 12 3
      src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts
  36. 11 2
      src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts
  37. 13 4
      src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts
  38. 0 0
      src/custom-nodes/self-defending-nodes/templates/SelfDefendingTemplate.ts
  39. 19 10
      src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts
  40. 12 3
      src/custom-nodes/string-array-nodes/StringArrayNode.ts
  41. 14 5
      src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts
  42. 0 0
      src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/AtobTemplate.ts
  43. 0 0
      src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/Rc4Template.ts
  44. 2 2
      src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts
  45. 1 1
      src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate.ts
  46. 0 0
      src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts
  47. 1 1
      src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate.ts
  48. 0 0
      src/custom-nodes/string-array-nodes/templates/string-array-node/StringArrayTemplate.ts
  49. 1 1
      src/custom-nodes/string-array-nodes/templates/string-array-rotate-function-node/SelfDefendingTemplate.ts
  50. 0 0
      src/custom-nodes/string-array-nodes/templates/string-array-rotate-function-node/StringArrayRotateFunctionTemplate.ts
  51. 10 0
      src/interfaces/custom-nodes/ICustomNodeObfuscator.ts
  52. 5 5
      test/dev/dev.ts
  53. 1 1
      test/functional-tests/custom-nodes/common/templates/GlobalVariableNoEvalTemplate.spec.ts
  54. 5 5
      test/functional-tests/custom-nodes/debug-protection-nodes/templates/DebugProtectionFunctionCallTemplate.spec.ts
  55. 0 0
      test/functional-tests/custom-nodes/debug-protection-nodes/templates/fixtures/input.js
  56. 0 0
      test/functional-tests/custom-nodes/debug-protection-nodes/templates/fixtures/single-call.js
  57. 0 0
      test/functional-tests/custom-nodes/debug-protection-nodes/templates/workers/evaluation-worker.js
  58. 10 10
      test/functional-tests/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate.spec.ts
  59. 0 0
      test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-const.js
  60. 0 0
      test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-let.js
  61. 0 0
      test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-var.js
  62. 15 15
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/StringArrayCallsWrapperNodeTemplate.spec.ts
  63. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-const.js
  64. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-let.js
  65. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-var.js
  66. 4 4
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/StringArrayRotateFunctionTemplate.spec.ts
  67. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-const.js
  68. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-let.js
  69. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-var.js
  70. 4 4
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/StringArrayTemplate.spec.ts
  71. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/fixtures/prevailing-kind-of-variables-const.js
  72. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/fixtures/prevailing-kind-of-variables-let.js
  73. 0 0
      test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/fixtures/prevailing-kind-of-variables-var.js
  74. 6 6
      test/index.spec.ts

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/index.browser.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 14045
dist/index.cli.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 13348
dist/index.js


+ 1 - 1
src/container/ServiceIdentifiers.ts

@@ -22,6 +22,7 @@ export enum ServiceIdentifiers {
     ICustomNodeGroup = 'ICustomNodeGroup',
     IControlFlowReplacer = 'IControlFlowReplacer',
     ICustomNodeFormatter = 'ICustomNodeFormatter',
+    ICustomNodeObfuscator = 'ICustomNodeObfuscator',
     IEscapeSequenceEncoder = 'IEscapeSequenceEncoder',
     IIdentifierNamesGenerator = 'IIdentifierNamesGenerator',
     IIdentifierObfuscatingReplacer = 'IIdentifierObfuscatingReplacer',
@@ -41,7 +42,6 @@ export enum ServiceIdentifiers {
     IRandomGenerator = 'IRandomGenerator',
     IScopeIdentifiersTraverser = 'IScopeIdentifiersTraverser',
     ISourceCode = 'ISourceCode',
-    ISourceMapCorrector = 'ISourceMapCorrector',
     IScopeAnalyzer = 'IScopeAnalyzer',
     IStringArrayStorage = 'IStringArrayStorage',
     IStringArrayStorageAnalyzer = 'IStringArrayStorageAnalyzer',

+ 10 - 0
src/container/modules/custom-nodes/CustomNodesModule.ts

@@ -40,6 +40,8 @@ import { StringArrayNode } from '../../../custom-nodes/string-array-nodes/String
 import { StringArrayRotateFunctionNode } from '../../../custom-nodes/string-array-nodes/StringArrayRotateFunctionNode';
 import { StringLiteralControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode';
 import { StringLiteralNode } from '../../../custom-nodes/control-flow-flattening-nodes/StringLiteralNode';
+import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { CustomNodeObfuscator } from '../../../custom-nodes/CustomNodeObfuscator';
 
 export const customNodesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
     // custom nodes
@@ -163,6 +165,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
                 ServiceIdentifiers.ICustomNodeFormatter,
+                ServiceIdentifiers.ICustomNodeObfuscator,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IOptions,
                 ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer
@@ -175,6 +178,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
                 ServiceIdentifiers.ICustomNodeFormatter,
+                ServiceIdentifiers.ICustomNodeObfuscator,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IOptions
             ));
@@ -186,6 +190,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
                 ServiceIdentifiers.ICustomNodeFormatter,
+                ServiceIdentifiers.ICustomNodeObfuscator,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IOptions,
                 ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer
@@ -200,4 +205,9 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
     bind<ICustomNodeFormatter>(ServiceIdentifiers.ICustomNodeFormatter)
         .to(CustomNodeFormatter)
         .inSingletonScope();
+
+    // custom node obfuscator
+    bind<ICustomNodeObfuscator>(ServiceIdentifiers.ICustomNodeObfuscator)
+        .to(CustomNodeObfuscator)
+        .inSingletonScope();
 });

+ 17 - 48
src/custom-nodes/AbstractCustomNode.ts

@@ -2,21 +2,17 @@ import { inject, injectable } from 'inversify';
 import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
 
 import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TInputOptions } from '../types/options/TInputOptions';
 import { TStatement } from '../types/node/TStatement';
 
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
+import { ICustomNodeFormatter } from '../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
 import { IOptions } from '../interfaces/options/IOptions';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../interfaces/custom-nodes/ICustomNodeFormatter';
-
-import { GlobalVariableTemplate1 } from '../templates/GlobalVariableTemplate1';
-import { GlobalVariableTemplate2 } from '../templates/GlobalVariableTemplate2';
-
-import { NO_ADDITIONAL_NODES_PRESET } from '../options/presets/NoCustomNodes';
 
-import { JavaScriptObfuscator } from '../JavaScriptObfuscatorFacade';
+import { GlobalVariableTemplate1 } from './common/templates/GlobalVariableTemplate1';
+import { GlobalVariableTemplate2 } from './common/templates/GlobalVariableTemplate2';
 
 @injectable()
 export abstract class AbstractCustomNode <
@@ -35,6 +31,16 @@ export abstract class AbstractCustomNode <
      */
     protected cachedNode: TStatement[] | null = null;
 
+    /**
+     * @type {ICustomNodeFormatter}
+     */
+    protected readonly customNodeFormatter: ICustomNodeFormatter;
+
+    /**
+     * @type {ICustomNodeObfuscator}
+     */
+    protected readonly customNodeObfuscator: ICustomNodeObfuscator;
+
     /**
      * @type {IIdentifierNamesGenerator}
      */
@@ -50,14 +56,10 @@ export abstract class AbstractCustomNode <
      */
     protected readonly randomGenerator: IRandomGenerator;
 
-    /**
-     * @type {ICustomNodeFormatter}
-     */
-    protected readonly customNodeFormatter: ICustomNodeFormatter;
-
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -65,11 +67,13 @@ export abstract class AbstractCustomNode <
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
         this.customNodeFormatter = customNodeFormatter;
+        this.customNodeObfuscator = customNodeObfuscator;
         this.randomGenerator = randomGenerator;
         this.options = options;
     }
@@ -105,41 +109,6 @@ export abstract class AbstractCustomNode <
         return '';
     }
 
-    /**
-     * @param {string} template
-     * @param {TInputOptions} options
-     * @returns {string}
-     */
-    protected obfuscateTemplate (template: string, options: TInputOptions = {}): string {
-        const reservedNames: string[] = this.getPreservedNames(options.reservedNames);
-
-        return JavaScriptObfuscator.obfuscate(
-            template,
-            {
-                ...NO_ADDITIONAL_NODES_PRESET,
-                identifierNamesGenerator: this.options.identifierNamesGenerator,
-                identifiersDictionary: this.options.identifiersDictionary,
-                seed: this.randomGenerator.getRawSeed(),
-                ...options,
-                reservedNames
-            }
-        ).getObfuscatedCode();
-    }
-
-    /**
-     * @param {string[]} additionalNames
-     * @returns {string[]}
-     */
-    private getPreservedNames (additionalNames: string[] = []): string[] {
-        return Array
-            .from(new Set([
-                ...Array.from(this.identifierNamesGenerator.getPreservedNames().values()),
-                ...additionalNames
-            ])
-            .values())
-            .map((preservedName: string) => `^${preservedName}$`);
-    }
-
     /**
      * @param {TInitialData} args
      */

+ 1 - 1
src/custom-nodes/AbstractCustomNodeGroup.ts

@@ -4,12 +4,12 @@ import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TNodeWithStatements } from '../types/node/TNodeWithStatements';
 
+import { ICallsGraphData } from '../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
 import { ICustomNodeGroup } from '../interfaces/custom-nodes/ICustomNodeGroup';
 import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
 import { IOptions } from '../interfaces/options/IOptions';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
-import { ICallsGraphData } from '../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
 
 import { CustomNode } from '../enums/custom-nodes/CustomNode';
 import { ObfuscationEvent } from '../enums/event-emitters/ObfuscationEvent';

+ 74 - 0
src/custom-nodes/CustomNodeObfuscator.ts

@@ -0,0 +1,74 @@
+import { inject, injectable } from 'inversify';
+import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
+
+import { TInputOptions } from '../types/options/TInputOptions';
+
+import { ICustomNodeObfuscator } from '../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { IOptions } from '../interfaces/options/IOptions';
+import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
+
+import { IdentifierNamesGenerator } from '../enums/generators/identifier-names-generators/IdentifierNamesGenerator';
+
+import { NO_ADDITIONAL_NODES_PRESET } from '../options/presets/NoCustomNodes';
+
+import { JavaScriptObfuscator } from '../JavaScriptObfuscatorFacade';
+
+@injectable()
+export class CustomNodeObfuscator implements ICustomNodeObfuscator {
+    /**
+     * @type {IOptions}
+     */
+    private readonly options: IOptions;
+
+    /**
+     * @type {IRandomGenerator}
+     */
+    private readonly randomGenerator: IRandomGenerator;
+
+    /**
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    public constructor (
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        this.randomGenerator = randomGenerator;
+        this.options = options;
+    }
+
+    /**
+     * @param {string} template
+     * @param {TInputOptions} additionalOptions
+     * @returns {string}
+     */
+    public obfuscateTemplate (template: string, additionalOptions: TInputOptions = {}): string {
+        /**
+         * During the first pass we should rename all identifiers to a random one
+         */
+        const firstPassObfuscatedCode = JavaScriptObfuscator.obfuscate(
+            template,
+            {
+                ...NO_ADDITIONAL_NODES_PRESET,
+                identifierNamesGenerator: IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator
+            }
+        ).getObfuscatedCode();
+
+        /**
+         * During the seconds pass we should obfuscate template to the same format as the main code
+         * Also, we should add additional transformations that depends on the custom node
+         */
+        const secondPassObfuscatedCode = JavaScriptObfuscator.obfuscate(
+            firstPassObfuscatedCode,
+            {
+                ...NO_ADDITIONAL_NODES_PRESET,
+                identifierNamesGenerator: this.options.identifierNamesGenerator,
+                identifiersDictionary: this.options.identifiersDictionary,
+                seed: this.randomGenerator.getRawSeed(),
+                ...additionalOptions
+            }
+        ).getObfuscatedCode();
+
+        return secondPassObfuscatedCode;
+    }
+}

+ 0 - 0
src/templates/GlobalVariableNoEvalTemplate.ts → src/custom-nodes/common/templates/GlobalVariableNoEvalTemplate.ts


+ 0 - 0
src/templates/GlobalVariableTemplate1.ts → src/custom-nodes/common/templates/GlobalVariableTemplate1.ts


+ 0 - 0
src/templates/GlobalVariableTemplate2.ts → src/custom-nodes/common/templates/GlobalVariableTemplate2.ts


+ 0 - 0
src/templates/SingleNodeCallControllerTemplate.ts → src/custom-nodes/common/templates/SingleNodeCallControllerTemplate.ts


+ 13 - 4
src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts

@@ -4,14 +4,15 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
 
-import { ConsoleOutputDisableExpressionTemplate } from '../../templates/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate';
-import { GlobalVariableNoEvalTemplate } from '../../templates/GlobalVariableNoEvalTemplate';
+import { ConsoleOutputDisableExpressionTemplate } from './templates/ConsoleOutputDisableExpressionTemplate';
+import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariableNoEvalTemplate';
 
 import { initializable } from '../../decorators/Initializable';
 
@@ -29,6 +30,7 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -36,10 +38,17 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 0 - 0
src/templates/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts → src/custom-nodes/console-output-nodes/templates/ConsoleOutputDisableExpressionTemplate.ts


+ 11 - 2
src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts

@@ -6,9 +6,10 @@ import type { BinaryOperator } from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeFactory } from '../../node/NodeFactory';
@@ -24,6 +25,7 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -31,10 +33,17 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 11 - 2
src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts

@@ -6,9 +6,10 @@ import * as ESTree from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../decorators/Initializable';
 
@@ -40,6 +41,7 @@ export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -47,10 +49,17 @@ export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 11 - 2
src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts

@@ -6,9 +6,10 @@ import * as ESTree from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../decorators/Initializable';
 
@@ -27,6 +28,7 @@ export class CallExpressionFunctionNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -34,10 +36,17 @@ export class CallExpressionFunctionNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 11 - 2
src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts

@@ -6,9 +6,10 @@ import type { LogicalOperator } from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeFactory } from '../../node/NodeFactory';
@@ -24,6 +25,7 @@ export class LogicalExpressionFunctionNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -31,10 +33,17 @@ export class LogicalExpressionFunctionNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 11 - 2
src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts

@@ -4,9 +4,10 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../decorators/Initializable';
 
@@ -24,6 +25,7 @@ export class StringLiteralNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -31,10 +33,17 @@ export class StringLiteralNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 11 - 2
src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts

@@ -6,9 +6,10 @@ import type * as ESTree from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../../decorators/Initializable';
 
@@ -45,6 +46,7 @@ export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -52,10 +54,17 @@ export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 11 - 2
src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts

@@ -7,10 +7,11 @@ import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../../decorators/Initializable';
 
@@ -30,6 +31,7 @@ export class ControlFlowStorageNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -37,10 +39,17 @@ export class ControlFlowStorageNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 10 - 1
src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts

@@ -6,6 +6,7 @@ import type { Expression } from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../../types/node/TStatement';
 
+import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
@@ -43,6 +44,7 @@ export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCu
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -50,10 +52,17 @@ export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCu
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 11 - 2
src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts

@@ -4,9 +4,10 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../../decorators/Initializable';
 
@@ -31,6 +32,7 @@ export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -38,10 +40,17 @@ export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 11 - 2
src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts

@@ -6,9 +6,10 @@ import type { BinaryOperator, BlockStatement } from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeFactory } from '../../node/NodeFactory';
@@ -29,6 +30,7 @@ export class BlockStatementDeadCodeInjectionNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -36,10 +38,17 @@ export class BlockStatementDeadCodeInjectionNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

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

@@ -4,13 +4,14 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { DebugProtectionFunctionCallTemplate } from '../../templates/debug-protection-nodes/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate';
+import { DebugProtectionFunctionCallTemplate } from './templates/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -32,6 +33,7 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -39,10 +41,17 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

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

@@ -4,13 +4,14 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { DebugProtectionFunctionIntervalTemplate } from '../../templates/debug-protection-nodes/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate';
+import { DebugProtectionFunctionIntervalTemplate } from './templates/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -26,6 +27,7 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -33,10 +35,17 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 14 - 5
src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts

@@ -4,17 +4,18 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { DebuggerTemplate } from '../../templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplate';
-import { DebuggerTemplateNoEval } from '../../templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplateNoEval';
-import { DebugProtectionFunctionTemplate } from '../../templates/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate';
+import { DebuggerTemplate } from './templates/debug-protection-function-node/DebuggerTemplate';
+import { DebuggerTemplateNoEval } from './templates/debug-protection-function-node/DebuggerTemplateNoEval';
+import { DebugProtectionFunctionTemplate } from './templates/debug-protection-function-node/DebugProtectionFunctionTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -30,6 +31,7 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -37,10 +39,17 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 0 - 0
src/templates/debug-protection-nodes/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate.ts → src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate.ts


+ 0 - 0
src/templates/debug-protection-nodes/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate.ts → src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate.ts


+ 0 - 0
src/templates/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate.ts → src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebugProtectionFunctionTemplate.ts


+ 0 - 0
src/templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplate.ts → src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebuggerTemplate.ts


+ 0 - 0
src/templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplateNoEval.ts → src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebuggerTemplateNoEval.ts


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

@@ -4,17 +4,18 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { ICryptUtils } from '../../interfaces/utils/ICryptUtils';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { DomainLockNodeTemplate } from '../../templates/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate';
-import { GlobalVariableNoEvalTemplate } from '../../templates/GlobalVariableNoEvalTemplate';
+import { DomainLockNodeTemplate } from './templates/DomainLockNodeTemplate';
+import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariableNoEvalTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -35,6 +36,7 @@ export class DomainLockNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {ICryptUtils} cryptUtils
@@ -43,11 +45,18 @@ export class DomainLockNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.ICryptUtils) cryptUtils: ICryptUtils
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
 
         this.cryptUtils = cryptUtils;
     }

+ 0 - 0
src/templates/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate.ts → src/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate.ts


+ 12 - 3
src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts

@@ -4,6 +4,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
@@ -12,7 +13,7 @@ import { ObfuscationEvent } from '../../enums/event-emitters/ObfuscationEvent';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { SingleNodeCallControllerTemplate } from '../../templates/SingleNodeCallControllerTemplate';
+import { SingleNodeCallControllerTemplate } from '../common/templates/SingleNodeCallControllerTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -34,6 +35,7 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -41,10 +43,17 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**
@@ -69,7 +78,7 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
      */
     protected getNodeTemplate (): string {
         if (this.appendEvent === ObfuscationEvent.AfterObfuscation) {
-            return this.obfuscateTemplate(
+            return this.customNodeObfuscator.obfuscateTemplate(
                 this.customNodeFormatter.formatTemplate(SingleNodeCallControllerTemplate(), {
                     singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                 })

+ 11 - 2
src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts

@@ -7,9 +7,10 @@ import { TIdentifierNamesGeneratorFactory } from '../../types/container/generato
 import { TNodeWithLexicalScope } from '../../types/node/TNodeWithLexicalScope';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeFactory } from '../../node/NodeFactory';
@@ -28,6 +29,7 @@ export class ObjectExpressionVariableDeclarationHostNode extends AbstractCustomN
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -35,10 +37,17 @@ export class ObjectExpressionVariableDeclarationHostNode extends AbstractCustomN
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     public initialize (lexicalScopeNode: TNodeWithLexicalScope, properties: ESTree.Property[]): void {

+ 13 - 4
src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts

@@ -4,14 +4,15 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { SelfDefendingTemplate } from '../../templates/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate';
+import { SelfDefendingTemplate } from './templates/SelfDefendingTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -32,6 +33,7 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
@@ -40,11 +42,18 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
 
         this.escapeSequenceEncoder = escapeSequenceEncoder;
     }
@@ -68,7 +77,7 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
      * @returns {string}
      */
     protected getNodeTemplate (): string {
-        return this.obfuscateTemplate(
+        return this.customNodeObfuscator.obfuscateTemplate(
             this.customNodeFormatter.formatTemplate(SelfDefendingTemplate(this.escapeSequenceEncoder), {
                 selfDefendingFunctionName: this.randomGenerator.getRandomString(5),
                 singleNodeCallControllerFunctionName: this.callsControllerFunctionName

+ 0 - 0
src/templates/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts → src/custom-nodes/self-defending-nodes/templates/SelfDefendingTemplate.ts


+ 19 - 10
src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts

@@ -4,23 +4,24 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
 import { StringArrayEncoding } from '../../enums/StringArrayEncoding';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { AtobTemplate } from '../../templates/AtobTemplate';
-import { GlobalVariableNoEvalTemplate } from '../../templates/GlobalVariableNoEvalTemplate';
-import { Rc4Template } from '../../templates/Rc4Template';
-import { SelfDefendingTemplate } from '../../templates/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate';
-import { StringArrayBase64DecodeNodeTemplate } from '../../templates/string-array-nodes/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate';
-import { StringArrayCallsWrapperTemplate } from '../../templates/string-array-nodes/string-array-calls-wrapper/StringArrayCallsWrapperTemplate';
-import { StringArrayRc4DecodeNodeTemplate } from '../../templates/string-array-nodes/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate';
+import { AtobTemplate } from './templates/string-array-calls-wrapper/AtobTemplate';
+import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariableNoEvalTemplate';
+import { Rc4Template } from './templates/string-array-calls-wrapper/Rc4Template';
+import { SelfDefendingTemplate } from './templates/string-array-calls-wrapper/SelfDefendingTemplate';
+import { StringArrayBase64DecodeNodeTemplate } from './templates/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate';
+import { StringArrayCallsWrapperTemplate } from './templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate';
+import { StringArrayRc4DecodeNodeTemplate } from './templates/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -47,6 +48,7 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
@@ -55,11 +57,18 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
 
         this.escapeSequenceEncoder = escapeSequenceEncoder;
     }
@@ -92,7 +101,7 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
 
         const preservedNames: string[] = [this.stringArrayName];
 
-        return this.obfuscateTemplate(
+        return this.customNodeObfuscator.obfuscateTemplate(
             this.customNodeFormatter.formatTemplate(StringArrayCallsWrapperTemplate(), {
                 decodeNodeTemplate,
                 stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,

+ 12 - 3
src/custom-nodes/string-array-nodes/StringArrayNode.ts

@@ -4,14 +4,15 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 import { IStringArrayStorage } from '../../interfaces/storages/string-array-storage/IStringArrayStorage';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { StringArrayTemplate } from '../../templates/string-array-nodes/string-array-node/StringArrayTemplate';
+import { StringArrayTemplate } from './templates/string-array-node/StringArrayTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -33,6 +34,7 @@ export class StringArrayNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      */
@@ -40,10 +42,17 @@ export class StringArrayNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
     }
 
     /**

+ 14 - 5
src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts

@@ -4,15 +4,16 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 
+import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 import { initializable } from '../../decorators/Initializable';
 
-import { SelfDefendingTemplate } from '../../templates/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate';
-import { StringArrayRotateFunctionTemplate } from '../../templates/string-array-nodes/string-array-rotate-function-node/StringArrayRotateFunctionTemplate';
+import { SelfDefendingTemplate } from './templates/string-array-rotate-function-node/SelfDefendingTemplate';
+import { StringArrayRotateFunctionTemplate } from './templates/string-array-rotate-function-node/StringArrayRotateFunctionTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeUtils } from '../../node/NodeUtils';
@@ -40,6 +41,7 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {ICustomNodeFormatter} customNodeFormatter
+     * @param {ICustomNodeObfuscator} customNodeObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
@@ -48,11 +50,18 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
+        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
     ) {
-        super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
+        super(
+            identifierNamesGeneratorFactory,
+            customNodeFormatter,
+            customNodeObfuscator,
+            randomGenerator,
+            options
+        );
 
         this.escapeSequenceEncoder = escapeSequenceEncoder;
     }
@@ -96,7 +105,7 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
             code = `${whileFunctionName}(++${timesName})`;
         }
 
-        return this.obfuscateTemplate(
+        return this.customNodeObfuscator.obfuscateTemplate(
             this.customNodeFormatter.formatTemplate(StringArrayRotateFunctionTemplate(), {
                 code,
                 timesName,

+ 0 - 0
src/templates/AtobTemplate.ts → src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/AtobTemplate.ts


+ 0 - 0
src/templates/Rc4Template.ts → src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/Rc4Template.ts


+ 2 - 2
src/templates/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts → src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts

@@ -1,5 +1,5 @@
-import { IEscapeSequenceEncoder } from '../../../interfaces/utils/IEscapeSequenceEncoder';
-import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+import { IEscapeSequenceEncoder } from '../../../../interfaces/utils/IEscapeSequenceEncoder';
+import { IRandomGenerator } from '../../../../interfaces/utils/IRandomGenerator';
 
 /**
  * @param {IRandomGenerator} randomGenerator

+ 1 - 1
src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate.ts → src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate.ts

@@ -1,4 +1,4 @@
-import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+import { IRandomGenerator } from '../../../../interfaces/utils/IRandomGenerator';
 
 /**
  * @param {IRandomGenerator} randomGenerator

+ 0 - 0
src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts → src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts


+ 1 - 1
src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate.ts → src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate.ts

@@ -1,4 +1,4 @@
-import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+import { IRandomGenerator } from '../../../../interfaces/utils/IRandomGenerator';
 
 /**
  * @param {IRandomGenerator} randomGenerator

+ 0 - 0
src/templates/string-array-nodes/string-array-node/StringArrayTemplate.ts → src/custom-nodes/string-array-nodes/templates/string-array-node/StringArrayTemplate.ts


+ 1 - 1
src/templates/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts → src/custom-nodes/string-array-nodes/templates/string-array-rotate-function-node/SelfDefendingTemplate.ts

@@ -1,4 +1,4 @@
-import { IEscapeSequenceEncoder } from '../../../interfaces/utils/IEscapeSequenceEncoder';
+import { IEscapeSequenceEncoder } from '../../../../interfaces/utils/IEscapeSequenceEncoder';
 
 /**
  * SelfDefendingTemplate. Enter code in infinity loop.

+ 0 - 0
src/templates/string-array-nodes/string-array-rotate-function-node/StringArrayRotateFunctionTemplate.ts → src/custom-nodes/string-array-nodes/templates/string-array-rotate-function-node/StringArrayRotateFunctionTemplate.ts


+ 10 - 0
src/interfaces/custom-nodes/ICustomNodeObfuscator.ts

@@ -0,0 +1,10 @@
+import { TInputOptions } from '../../types/options/TInputOptions';
+
+export interface ICustomNodeObfuscator {
+    /**
+     * @param {string} template
+     * @param {TInputOptions} additionalOptions
+     * @returns {string}
+     */
+    obfuscateTemplate (template: string, additionalOptions?: TInputOptions): string;
+}

+ 5 - 5
test/dev/dev.ts

@@ -7,16 +7,16 @@ import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNo
 
     let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
         `
-            const b = function () {}
-
-            // javascript-obfuscator:disable
-            function a () {}
-            // javascript-obfuscator:enable
+            function foo () {
+            
+            }
         `,
         {
             ...NO_ADDITIONAL_NODES_PRESET,
             compact: false,
             identifierNamesGenerator: 'mangled',
+            renameGlobals: true,
+            reservedNames: ['a'],
             log: true
         }
     ).getObfuscatedCode();

+ 1 - 1
test/functional-tests/templates/GlobalVariableNoEvalTemplate.spec.ts → test/functional-tests/custom-nodes/common/templates/GlobalVariableNoEvalTemplate.spec.ts

@@ -4,7 +4,7 @@ import format from 'string-template';
 
 import { assert } from 'chai';
 
-import { GlobalVariableNoEvalTemplate } from '../../../src/templates/GlobalVariableNoEvalTemplate';
+import { GlobalVariableNoEvalTemplate } from '../../../../../src/custom-nodes/common/templates/GlobalVariableNoEvalTemplate';
 
 describe('GlobalVariableNoEvalTemplate', () => {
     describe('Variant #1: simple', () => {

+ 5 - 5
test/functional-tests/templates/debug-protection-nodes/DebugProtectionFunctionCallTemplate.spec.ts → test/functional-tests/custom-nodes/debug-protection-nodes/templates/DebugProtectionFunctionCallTemplate.spec.ts

@@ -1,14 +1,14 @@
 import { assert } from 'chai';
 import { spawn, Thread, Worker } from 'threads/dist';
 
-import { readFileAsString } from '../../../helpers/readFileAsString';
+import { readFileAsString } from '../../../../helpers/readFileAsString';
 
-import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
-import { IdentifierNamesGenerator } from '../../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator';
-import { ObfuscationTarget } from '../../../../src/enums/ObfuscationTarget';
+import { IdentifierNamesGenerator } from '../../../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator';
+import { ObfuscationTarget } from '../../../../../src/enums/ObfuscationTarget';
 
-import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
+import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
 
 async function spawnThread(obfuscatedCode: string, threadCallback: Function, timeoutCallback: Function): Promise<void> {
     const evaluationWorker = await spawn(new Worker('./workers/evaluation-worker'));

+ 0 - 0
test/functional-tests/templates/debug-protection-nodes/fixtures/input.js → test/functional-tests/custom-nodes/debug-protection-nodes/templates/fixtures/input.js


+ 0 - 0
test/functional-tests/templates/debug-protection-nodes/fixtures/single-call.js → test/functional-tests/custom-nodes/debug-protection-nodes/templates/fixtures/single-call.js


+ 0 - 0
test/functional-tests/templates/debug-protection-nodes/workers/evaluation-worker.js → test/functional-tests/custom-nodes/debug-protection-nodes/templates/workers/evaluation-worker.js


+ 10 - 10
test/functional-tests/templates/domain-lock-nodes/DomainLockNodeTemplate.spec.ts → test/functional-tests/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate.spec.ts

@@ -4,20 +4,20 @@ import format from 'string-template';
 
 import { assert } from 'chai';
 
-import { ServiceIdentifiers } from '../../../../src/container/ServiceIdentifiers';
+import { ServiceIdentifiers } from '../../../../../src/container/ServiceIdentifiers';
 
-import { ICryptUtils } from '../../../../src/interfaces/utils/ICryptUtils';
-import { IInversifyContainerFacade } from '../../../../src/interfaces/container/IInversifyContainerFacade';
-import { IObfuscatedCode } from '../../../../src/interfaces/source-code/IObfuscatedCode';
+import { ICryptUtils } from '../../../../../src/interfaces/utils/ICryptUtils';
+import { IInversifyContainerFacade } from '../../../../../src/interfaces/container/IInversifyContainerFacade';
+import { IObfuscatedCode } from '../../../../../src/interfaces/source-code/IObfuscatedCode';
 
-import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
-import { DomainLockNodeTemplate } from '../../../../src/templates/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate';
-import { GlobalVariableTemplate1 } from '../../../../src/templates/GlobalVariableTemplate1';
+import { DomainLockNodeTemplate } from '../../../../../src/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate';
+import { GlobalVariableTemplate1 } from '../../../../../src/custom-nodes/common/templates/GlobalVariableTemplate1';
 
-import { InversifyContainerFacade } from '../../../../src/container/InversifyContainerFacade';
-import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
-import { readFileAsString } from '../../../helpers/readFileAsString';
+import { InversifyContainerFacade } from '../../../../../src/container/InversifyContainerFacade';
+import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
+import { readFileAsString } from '../../../../helpers/readFileAsString';
 
 /**
  * @param {string} currentDomain

+ 0 - 0
test/functional-tests/templates/domain-lock-nodes/fixtures/prevailing-kind-of-variables-const.js → test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-const.js


+ 0 - 0
test/functional-tests/templates/domain-lock-nodes/fixtures/prevailing-kind-of-variables-let.js → test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-let.js


+ 0 - 0
test/functional-tests/templates/domain-lock-nodes/fixtures/prevailing-kind-of-variables-var.js → test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-var.js


+ 15 - 15
test/functional-tests/templates/string-array-nodes/string-array-calls-wrapper-node-template/StringArrayCallsWrapperNodeTemplate.spec.ts → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/StringArrayCallsWrapperNodeTemplate.spec.ts

@@ -4,25 +4,25 @@ import format from 'string-template';
 
 import { assert } from 'chai';
 
-import { ServiceIdentifiers } from '../../../../../src/container/ServiceIdentifiers';
+import { ServiceIdentifiers } from '../../../../../../src/container/ServiceIdentifiers';
 
-import { ICryptUtils } from '../../../../../src/interfaces/utils/ICryptUtils';
-import { IInversifyContainerFacade } from '../../../../../src/interfaces/container/IInversifyContainerFacade';
-import { IObfuscatedCode } from '../../../../../src/interfaces/source-code/IObfuscatedCode';
-import { IRandomGenerator } from '../../../../../src/interfaces/utils/IRandomGenerator';
+import { ICryptUtils } from '../../../../../../src/interfaces/utils/ICryptUtils';
+import { IInversifyContainerFacade } from '../../../../../../src/interfaces/container/IInversifyContainerFacade';
+import { IObfuscatedCode } from '../../../../../../src/interfaces/source-code/IObfuscatedCode';
+import { IRandomGenerator } from '../../../../../../src/interfaces/utils/IRandomGenerator';
 
-import { AtobTemplate } from '../../../../../src/templates/AtobTemplate';
-import { GlobalVariableTemplate1 } from '../../../../../src/templates/GlobalVariableTemplate1';
-import { Rc4Template } from '../../../../../src/templates/Rc4Template';
-import { StringArrayBase64DecodeNodeTemplate } from '../../../../../src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate';
-import { StringArrayCallsWrapperTemplate } from '../../../../../src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayCallsWrapperTemplate';
-import { StringArrayRc4DecodeNodeTemplate } from '../../../../../src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate';
+import { AtobTemplate } from '../../../../../../src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/AtobTemplate';
+import { GlobalVariableTemplate1 } from '../../../../../../src/custom-nodes/common/templates/GlobalVariableTemplate1';
+import { Rc4Template } from '../../../../../../src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/Rc4Template';
+import { StringArrayBase64DecodeNodeTemplate } from '../../../../../../src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate';
+import { StringArrayCallsWrapperTemplate } from '../../../../../../src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate';
+import { StringArrayRc4DecodeNodeTemplate } from '../../../../../../src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate';
 
-import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
-import { InversifyContainerFacade } from '../../../../../src/container/InversifyContainerFacade';
-import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
-import { readFileAsString } from '../../../../helpers/readFileAsString';
+import { InversifyContainerFacade } from '../../../../../../src/container/InversifyContainerFacade';
+import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
+import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 describe('StringArrayCallsWrapperNodeTemplate', () => {
     const stringArrayName: string = 'stringArrayName';

+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-const.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-const.js


+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-let.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-let.js


+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-var.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/fixtures/prevailing-kind-of-variables-var.js


+ 4 - 4
test/functional-tests/templates/string-array-nodes/string-array-rotate-function-template/StringArrayRotateFunctionTemplate.spec.ts → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/StringArrayRotateFunctionTemplate.spec.ts

@@ -2,12 +2,12 @@ import 'reflect-metadata';
 
 import { assert } from 'chai';
 
-import { IObfuscatedCode } from '../../../../../src/interfaces/source-code/IObfuscatedCode';
+import { IObfuscatedCode } from '../../../../../../src/interfaces/source-code/IObfuscatedCode';
 
-import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
-import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
-import { readFileAsString } from '../../../../helpers/readFileAsString';
+import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
+import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 describe('StringArrayRotateFunctionTemplate', () => {
     describe('Prevailing kind of variables', () => {

+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-const.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-const.js


+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-let.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-let.js


+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-var.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/fixtures/prevailing-kind-of-variables-var.js


+ 4 - 4
test/functional-tests/templates/string-array-nodes/string-array-template/StringArrayTemplate.spec.ts → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/StringArrayTemplate.spec.ts

@@ -2,12 +2,12 @@ import 'reflect-metadata';
 
 import { assert } from 'chai';
 
-import { IObfuscatedCode } from '../../../../../src/interfaces/source-code/IObfuscatedCode';
+import { IObfuscatedCode } from '../../../../../../src/interfaces/source-code/IObfuscatedCode';
 
-import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
+import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../../src/options/presets/NoCustomNodes';
 
-import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
-import { readFileAsString } from '../../../../helpers/readFileAsString';
+import { JavaScriptObfuscator } from '../../../../../../src/JavaScriptObfuscatorFacade';
+import { readFileAsString } from '../../../../../helpers/readFileAsString';
 
 describe('StringArrayTemplate', () => {
     describe('Prevailing kind of variables', () => {

+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-template/fixtures/prevailing-kind-of-variables-const.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/fixtures/prevailing-kind-of-variables-const.js


+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-template/fixtures/prevailing-kind-of-variables-let.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/fixtures/prevailing-kind-of-variables-let.js


+ 0 - 0
test/functional-tests/templates/string-array-nodes/string-array-template/fixtures/prevailing-kind-of-variables-var.js → test/functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/fixtures/prevailing-kind-of-variables-var.js


+ 6 - 6
test/index.spec.ts

@@ -98,12 +98,12 @@ import './functional-tests/node-transformers/preparing-transformers/variable-pre
 import './functional-tests/options/OptionsNormalizer.spec';
 import './functional-tests/options/domain-lock/Validation.spec';
 import './functional-tests/storages/string-array-storage/StringArrayStorage.spec';
-import './functional-tests/templates/debug-protection-nodes/DebugProtectionFunctionCallTemplate.spec';
-import './functional-tests/templates/domain-lock-nodes/DomainLockNodeTemplate.spec';
-import './functional-tests/templates/GlobalVariableNoEvalTemplate.spec';
-import './functional-tests/templates/string-array-nodes/string-array-template/StringArrayTemplate.spec';
-import './functional-tests/templates/string-array-nodes/string-array-calls-wrapper-node-template/StringArrayCallsWrapperNodeTemplate.spec';
-import './functional-tests/templates/string-array-nodes/string-array-rotate-function-template/StringArrayRotateFunctionTemplate.spec';
+import './functional-tests/custom-nodes/debug-protection-nodes/templates/DebugProtectionFunctionCallTemplate.spec';
+import './functional-tests/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate.spec';
+import './functional-tests/custom-nodes/common/templates/GlobalVariableNoEvalTemplate.spec';
+import './functional-tests/custom-nodes/string-array-nodes/templates/string-array-template/StringArrayTemplate.spec';
+import './functional-tests/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper-node-template/StringArrayCallsWrapperNodeTemplate.spec';
+import './functional-tests/custom-nodes/string-array-nodes/templates/string-array-rotate-function-template/StringArrayRotateFunctionTemplate.spec';
 
 /**
  * Performance tests

Некоторые файлы не были показаны из-за большого количества измененных файлов