mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Types refactoring
This commit is contained in:
+5
-5
@@ -3,13 +3,13 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../../types/node/TStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../../interfaces/storages/IStorage';
|
||||
|
||||
import { initializable } from '../../../decorators/Initializable';
|
||||
|
||||
@@ -21,10 +21,10 @@ import { NodeUtils } from '../../../node/NodeUtils';
|
||||
@injectable()
|
||||
export class ControlFlowStorageNode extends AbstractCustomNode {
|
||||
/**
|
||||
* @type {IStorage <ICustomNode>}
|
||||
* @type {TControlFlowStorage}
|
||||
*/
|
||||
@initializable()
|
||||
private controlFlowStorage!: IStorage <ICustomNode>;
|
||||
private controlFlowStorage!: TControlFlowStorage;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
@@ -41,9 +41,9 @@ export class ControlFlowStorageNode extends AbstractCustomNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {IStorage<ICustomNode>} controlFlowStorage
|
||||
* @param {TControlFlowStorage} controlFlowStorage
|
||||
*/
|
||||
public initialize (controlFlowStorage: IStorage <ICustomNode>): void {
|
||||
public initialize (controlFlowStorage: TControlFlowStorage): void {
|
||||
this.controlFlowStorage = controlFlowStorage;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ import format from 'string-template';
|
||||
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
import { TStringArrayStorage } from '../../types/storages/TStringArrayStorage';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../interfaces/storages/IStorage';
|
||||
|
||||
import { initializable } from '../../decorators/Initializable';
|
||||
|
||||
@@ -21,10 +21,10 @@ import { StringArrayStorage } from '../../storages/string-array/StringArrayStora
|
||||
@injectable()
|
||||
export class StringArrayNode extends AbstractCustomNode {
|
||||
/**
|
||||
* @type {IStorage <string>}
|
||||
* @type {TStringArrayStorage}
|
||||
*/
|
||||
@initializable()
|
||||
private stringArrayStorage!: IStorage <string>;
|
||||
private stringArrayStorage!: TStringArrayStorage;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
@@ -53,12 +53,12 @@ export class StringArrayNode extends AbstractCustomNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {IStorage<string>} stringArrayStorage
|
||||
* @param {TStringArrayStorage} stringArrayStorage
|
||||
* @param {string} stringArrayName
|
||||
* @param {number} stringArrayRotateValue
|
||||
*/
|
||||
public initialize (
|
||||
stringArrayStorage: IStorage <string>,
|
||||
stringArrayStorage: TStringArrayStorage,
|
||||
stringArrayName: string,
|
||||
stringArrayRotateValue: number
|
||||
): void {
|
||||
|
||||
@@ -4,12 +4,12 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TNodeWithBlockScope } from '../../../types/node/TNodeWithBlockScope';
|
||||
import { TStringArrayStorage } from '../../../types/storages/TStringArrayStorage';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
|
||||
import { IStackTraceData } from '../../../interfaces/analyzers/stack-trace-analyzer/IStackTraceData';
|
||||
import { IStorage } from '../../../interfaces/storages/IStorage';
|
||||
|
||||
import { initializable } from '../../../decorators/Initializable';
|
||||
|
||||
@@ -38,20 +38,20 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
private readonly customNodeFactory: TCustomNodeFactory;
|
||||
|
||||
/**
|
||||
* @type {IStorage <string>}
|
||||
* @type {TStringArrayStorage}
|
||||
*/
|
||||
private readonly stringArrayStorage: IStorage <string>;
|
||||
private readonly stringArrayStorage: TStringArrayStorage;
|
||||
|
||||
/**
|
||||
* @param {TCustomNodeFactory} customNodeFactory
|
||||
* @param {IStorage<string>} stringArrayStorage
|
||||
* @param {TStringArrayStorage} stringArrayStorage
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
|
||||
@inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStorage<string>,
|
||||
@inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: TStringArrayStorage,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { ICustomNode } from '../../custom-nodes/ICustomNode';
|
||||
import { IStorage } from '../../storages/IStorage';
|
||||
import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
|
||||
|
||||
export interface IControlFlowReplacer {
|
||||
/**
|
||||
@@ -13,6 +12,6 @@ export interface IControlFlowReplacer {
|
||||
replace (
|
||||
node: ESTree.Node,
|
||||
parentNode: ESTree.Node,
|
||||
controlFlowStorage: IStorage <ICustomNode>
|
||||
controlFlowStorage: TControlFlowStorage
|
||||
): ESTree.Node;
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ import * as ESTree from 'estree';
|
||||
|
||||
import { TControlFlowCustomNodeFactory } from '../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
|
||||
import { TControlFlowReplacerFactory } from '../../types/container/node-transformers/TControlFlowReplacerFactory';
|
||||
import { TControlFlowStorage } from '../../types/storages/TControlFlowStorage';
|
||||
import { TControlFlowStorageFactory } from '../../types/container/node-transformers/TControlFlowStorageFactory';
|
||||
import { TNodeWithBlockScope } from '../../types/node/TNodeWithBlockScope';
|
||||
|
||||
import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../interfaces/storages/IStorage';
|
||||
import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
|
||||
|
||||
import { ControlFlowCustomNode } from '../../enums/custom-nodes/ControlFlowCustomNode';
|
||||
@@ -49,9 +49,9 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
|
||||
private static readonly hostNodeSearchMaxDepth: number = 2;
|
||||
|
||||
/**
|
||||
* @type {Map<ESTree.Node, IStorage<ICustomNode>>}
|
||||
* @type {Map<ESTree.Node, TControlFlowStorage>}
|
||||
*/
|
||||
private readonly controlFlowData: Map <ESTree.Node, IStorage<ICustomNode>> = new Map();
|
||||
private readonly controlFlowData: Map <ESTree.Node, TControlFlowStorage> = new Map();
|
||||
|
||||
/**
|
||||
* @type {Set<ESTree.Function>}
|
||||
@@ -141,7 +141,7 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
|
||||
}
|
||||
|
||||
const hostNode: TNodeWithBlockScope = this.getHostNode(functionNode.body);
|
||||
const controlFlowStorage: IStorage<ICustomNode> = this.getControlFlowStorage(hostNode);
|
||||
const controlFlowStorage: TControlFlowStorage = this.getControlFlowStorage(hostNode);
|
||||
|
||||
this.controlFlowData.set(hostNode, controlFlowStorage);
|
||||
this.transformFunctionBody(functionNode.body, controlFlowStorage);
|
||||
@@ -163,17 +163,17 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
|
||||
|
||||
/**
|
||||
* @param {TNodeWithBlockScope} hostNode
|
||||
* @returns {IStorage<ICustomNode>}
|
||||
* @returns {TControlFlowStorage}
|
||||
*/
|
||||
private getControlFlowStorage (hostNode: TNodeWithBlockScope): IStorage<ICustomNode> {
|
||||
const controlFlowStorage: IStorage <ICustomNode> = this.controlFlowStorageFactory();
|
||||
private getControlFlowStorage (hostNode: TNodeWithBlockScope): TControlFlowStorage {
|
||||
const controlFlowStorage: TControlFlowStorage = this.controlFlowStorageFactory();
|
||||
|
||||
if (this.controlFlowData.has(hostNode)) {
|
||||
if (this.hostNodesWithControlFlowNode.has(hostNode)) {
|
||||
hostNode.body.shift();
|
||||
}
|
||||
|
||||
const hostControlFlowStorage: IStorage<ICustomNode> = <IStorage<ICustomNode>>this.controlFlowData.get(hostNode);
|
||||
const hostControlFlowStorage: TControlFlowStorage = <TControlFlowStorage>this.controlFlowData.get(hostNode);
|
||||
|
||||
controlFlowStorage.mergeWith(hostControlFlowStorage, true);
|
||||
}
|
||||
@@ -219,9 +219,9 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
|
||||
|
||||
/**
|
||||
* @param {BlockStatement} functionNodeBody
|
||||
* @param {IStorage<ICustomNode>} controlFlowStorage
|
||||
* @param {TControlFlowStorage} controlFlowStorage
|
||||
*/
|
||||
private transformFunctionBody (functionNodeBody: ESTree.BlockStatement, controlFlowStorage: IStorage<ICustomNode>): void {
|
||||
private transformFunctionBody (functionNodeBody: ESTree.BlockStatement, controlFlowStorage: TControlFlowStorage): void {
|
||||
estraverse.replace(functionNodeBody, {
|
||||
enter: (node: ESTree.Node, parentNode: ESTree.Node | null): estraverse.VisitorOption | ESTree.Node => {
|
||||
if (NodeMetadata.isIgnoredNode(node)) {
|
||||
|
||||
+5
-5
@@ -4,12 +4,12 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TControlFlowCustomNodeFactory } from '../../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
|
||||
import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
|
||||
|
||||
import { IControlFlowReplacer } from '../../../interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer';
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../../interfaces/storages/IStorage';
|
||||
|
||||
@injectable()
|
||||
export abstract class AbstractControlFlowReplacer implements IControlFlowReplacer {
|
||||
@@ -72,21 +72,21 @@ export abstract class AbstractControlFlowReplacer implements IControlFlowReplace
|
||||
/**
|
||||
* @param {Node} node
|
||||
* @param {Node} parentNode
|
||||
* @param {IStorage<ICustomNode>} controlFlowStorage
|
||||
* @param {TControlFlowStorage} controlFlowStorage
|
||||
* @returns {Node}
|
||||
*/
|
||||
public abstract replace (node: ESTree.Node, parentNode: ESTree.Node, controlFlowStorage: IStorage <ICustomNode>): ESTree.Node;
|
||||
public abstract replace (node: ESTree.Node, parentNode: ESTree.Node, controlFlowStorage: TControlFlowStorage): ESTree.Node;
|
||||
|
||||
/**
|
||||
* @param {ICustomNode} customNode
|
||||
* @param {IStorage<ICustomNode>} controlFlowStorage
|
||||
* @param {TControlFlowStorage} controlFlowStorage
|
||||
* @param {string} replacerId
|
||||
* @param {number} usingExistingIdentifierChance
|
||||
* @returns {string}
|
||||
*/
|
||||
protected insertCustomNodeToControlFlowStorage (
|
||||
customNode: ICustomNode,
|
||||
controlFlowStorage: IStorage <ICustomNode>,
|
||||
controlFlowStorage: TControlFlowStorage,
|
||||
replacerId: string,
|
||||
usingExistingIdentifierChance: number
|
||||
): string {
|
||||
|
||||
+3
-3
@@ -4,11 +4,11 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TControlFlowCustomNodeFactory } from '../../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
|
||||
import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../../interfaces/storages/IStorage';
|
||||
|
||||
import { ControlFlowCustomNode } from '../../../enums/custom-nodes/ControlFlowCustomNode';
|
||||
|
||||
@@ -38,13 +38,13 @@ export class BinaryExpressionControlFlowReplacer extends ExpressionWithOperatorC
|
||||
/**
|
||||
* @param {BinaryExpression} binaryExpressionNode
|
||||
* @param {Node} parentNode
|
||||
* @param {IStorage<ICustomNode>} controlFlowStorage
|
||||
* @param {TControlFlowStorage} controlFlowStorage
|
||||
* @returns {Node}
|
||||
*/
|
||||
public replace (
|
||||
binaryExpressionNode: ESTree.BinaryExpression,
|
||||
parentNode: ESTree.Node,
|
||||
controlFlowStorage: IStorage <ICustomNode>
|
||||
controlFlowStorage: TControlFlowStorage
|
||||
): ESTree.Node {
|
||||
const replacerId: string = binaryExpressionNode.operator;
|
||||
const binaryExpressionFunctionCustomNode: ICustomNode = this.controlFlowCustomNodeFactory(
|
||||
|
||||
+3
-3
@@ -4,12 +4,12 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TControlFlowCustomNodeFactory } from '../../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
|
||||
import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
|
||||
import { TStatement } from '../../../types/node/TStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../../interfaces/storages/IStorage';
|
||||
|
||||
import { ControlFlowCustomNode } from '../../../enums/custom-nodes/ControlFlowCustomNode';
|
||||
|
||||
@@ -40,13 +40,13 @@ export class CallExpressionControlFlowReplacer extends AbstractControlFlowReplac
|
||||
/**
|
||||
* @param {CallExpression} callExpressionNode
|
||||
* @param {NodeGuards} parentNode
|
||||
* @param {IStorage<ICustomNode>} controlFlowStorage
|
||||
* @param {TControlFlowStorage} controlFlowStorage
|
||||
* @returns {NodeGuards}
|
||||
*/
|
||||
public replace (
|
||||
callExpressionNode: ESTree.CallExpression,
|
||||
parentNode: ESTree.Node,
|
||||
controlFlowStorage: IStorage <ICustomNode>
|
||||
controlFlowStorage: TControlFlowStorage
|
||||
): ESTree.Node {
|
||||
const callee: ESTree.Expression = <ESTree.Expression>callExpressionNode.callee;
|
||||
|
||||
|
||||
+3
-3
@@ -4,11 +4,11 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TControlFlowCustomNodeFactory } from '../../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
|
||||
import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../../interfaces/storages/IStorage';
|
||||
|
||||
import { ControlFlowCustomNode } from '../../../enums/custom-nodes/ControlFlowCustomNode';
|
||||
|
||||
@@ -40,13 +40,13 @@ export class LogicalExpressionControlFlowReplacer extends ExpressionWithOperator
|
||||
/**
|
||||
* @param {LogicalExpression} logicalExpressionNode
|
||||
* @param {NodeGuards} parentNode
|
||||
* @param {IStorage<ICustomNode>} controlFlowStorage
|
||||
* @param {TControlFlowStorage} controlFlowStorage
|
||||
* @returns {NodeGuards}
|
||||
*/
|
||||
public replace (
|
||||
logicalExpressionNode: ESTree.LogicalExpression,
|
||||
parentNode: ESTree.Node,
|
||||
controlFlowStorage: IStorage <ICustomNode>
|
||||
controlFlowStorage: TControlFlowStorage
|
||||
): ESTree.Node {
|
||||
if (this.checkForProhibitedExpressions(logicalExpressionNode.left, logicalExpressionNode.right)) {
|
||||
return logicalExpressionNode;
|
||||
|
||||
+3
-3
@@ -4,12 +4,12 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TControlFlowCustomNodeFactory } from '../../../types/container/custom-nodes/TControlFlowCustomNodeFactory';
|
||||
import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
|
||||
import { TStatement } from '../../../types/node/TStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../../interfaces/storages/IStorage';
|
||||
|
||||
import { ControlFlowCustomNode } from '../../../enums/custom-nodes/ControlFlowCustomNode';
|
||||
|
||||
@@ -40,13 +40,13 @@ export class StringLiteralControlFlowReplacer extends AbstractControlFlowReplace
|
||||
/**
|
||||
* @param {Literal} literalNode
|
||||
* @param {NodeGuards} parentNode
|
||||
* @param {IStorage<ICustomNode>} controlFlowStorage
|
||||
* @param {TControlFlowStorage} controlFlowStorage
|
||||
* @returns {NodeGuards}
|
||||
*/
|
||||
public replace (
|
||||
literalNode: ESTree.Literal,
|
||||
parentNode: ESTree.Node,
|
||||
controlFlowStorage: IStorage <ICustomNode>
|
||||
controlFlowStorage: TControlFlowStorage
|
||||
): ESTree.Node {
|
||||
if (NodeGuards.isPropertyNode(parentNode) && parentNode.key === literalNode) {
|
||||
return literalNode;
|
||||
|
||||
+6
-5
@@ -3,12 +3,13 @@ import { ServiceIdentifiers } from '../../../../container/ServiceIdentifiers';
|
||||
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TStringArrayStorage } from '../../../../types/storages/TStringArrayStorage';
|
||||
|
||||
import { ICryptUtils } from '../../../../interfaces/utils/ICryptUtils';
|
||||
import { IEncodedValue } from '../../../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IEncodedValue';
|
||||
import { IEscapeSequenceEncoder } from '../../../../interfaces/utils/IEscapeSequenceEncoder';
|
||||
import { IOptions } from '../../../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../../../interfaces/utils/IRandomGenerator';
|
||||
import { IStorage } from '../../../../interfaces/storages/IStorage';
|
||||
import { IStringArrayIndexData } from '../../../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IStringArrayIndexData';
|
||||
|
||||
import { StringArrayEncoding } from '../../../../enums/StringArrayEncoding';
|
||||
@@ -66,19 +67,19 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
|
||||
private readonly stringLiteralHexadecimalIndexCache: Map <string, string> = new Map();
|
||||
|
||||
/**
|
||||
* @type {IStorage<string>}
|
||||
* @type {TStringArrayStorage}
|
||||
*/
|
||||
private readonly stringArrayStorage: IStorage<string>;
|
||||
private readonly stringArrayStorage: TStringArrayStorage;
|
||||
|
||||
/**
|
||||
* @param {IStorage<string>} stringArrayStorage
|
||||
* @param {TStringArrayStorage} stringArrayStorage
|
||||
* @param {IEscapeSequenceEncoder} escapeSequenceEncoder
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {ICryptUtils} cryptUtils
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStorage<string>,
|
||||
@inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: TStringArrayStorage,
|
||||
@inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.ICryptUtils) cryptUtils: ICryptUtils,
|
||||
|
||||
@@ -3,13 +3,14 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TCustomNodeGroupStorage } from '../../types/storages/TCustomNodeGroupStorage';
|
||||
|
||||
import { ICustomNodeGroup } from '../../interfaces/custom-nodes/ICustomNodeGroup';
|
||||
import { IObfuscationEventEmitter } from '../../interfaces/event-emitters/IObfuscationEventEmitter';
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
||||
import { IStackTraceAnalyzer } from '../../interfaces/analyzers/stack-trace-analyzer/IStackTraceAnalyzer';
|
||||
import { IStackTraceData } from '../../interfaces/analyzers/stack-trace-analyzer/IStackTraceData';
|
||||
import { IStorage } from '../../interfaces/storages/IStorage';
|
||||
import { IVisitor } from '../../interfaces/node-transformers/IVisitor';
|
||||
|
||||
import { ObfuscationEvent } from '../../enums/event-emitters/ObfuscationEvent';
|
||||
@@ -24,9 +25,9 @@ import { NodeGuards } from '../../node/NodeGuards';
|
||||
@injectable()
|
||||
export class CustomNodesTransformer extends AbstractNodeTransformer {
|
||||
/**
|
||||
* @type {IStorage<ICustomNodeGroup>}
|
||||
* @type {TCustomNodeGroupStorage}
|
||||
*/
|
||||
private readonly customNodeGroupStorage: IStorage<ICustomNodeGroup>;
|
||||
private readonly customNodeGroupStorage: TCustomNodeGroupStorage;
|
||||
|
||||
/**
|
||||
* @type {IObfuscationEventEmitter}
|
||||
@@ -46,14 +47,14 @@ export class CustomNodesTransformer extends AbstractNodeTransformer {
|
||||
/**
|
||||
* @param {IStackTraceAnalyzer} stackTraceAnalyzer
|
||||
* @param {IObfuscationEventEmitter} obfuscationEventEmitter
|
||||
* @param {IStorage<ICustomNodeGroup>} customNodeGroupStorage
|
||||
* @param {TCustomNodeGroupStorage} customNodeGroupStorage
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.IStackTraceAnalyzer) stackTraceAnalyzer: IStackTraceAnalyzer,
|
||||
@inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
|
||||
@inject(ServiceIdentifiers.TCustomNodeGroupStorage) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
|
||||
@inject(ServiceIdentifiers.TCustomNodeGroupStorage) customNodeGroupStorage: TCustomNodeGroupStorage,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import { interfaces } from 'inversify';
|
||||
|
||||
import { TInputOptions } from '../options/TInputOptions';
|
||||
|
||||
export type TInversifyContainerModuleFactory = (options: TInputOptions) => interfaces.ContainerModule;
|
||||
@@ -1,4 +1,3 @@
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IStorage } from '../../../interfaces/storages/IStorage';
|
||||
import { TControlFlowStorage } from '../../storages/TControlFlowStorage';
|
||||
|
||||
export type TControlFlowStorageFactory = () => IStorage<ICustomNode>;
|
||||
export type TControlFlowStorageFactory = () => TControlFlowStorage;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
|
||||
import { INodeTransformer } from '../../interfaces/node-transformers/INodeTransformer';
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IStorage } from '../../interfaces/storages/IStorage';
|
||||
|
||||
export type TNodeTransformer = (new (customNodesStorage: IStorage<ICustomNode>, options: IOptions) => INodeTransformer);
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
|
||||
import { IStorage } from '../../interfaces/storages/IStorage';
|
||||
|
||||
export type TControlFlowStorage = IStorage<ICustomNode>;
|
||||
export type TControlFlowStorage = IStorage <ICustomNode>;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { ICustomNodeGroup } from '../../interfaces/custom-nodes/ICustomNodeGroup';
|
||||
import { IStorage } from '../../interfaces/storages/IStorage';
|
||||
|
||||
export type TCustomNodeGroupStorage = IStorage<ICustomNodeGroup>;
|
||||
export type TCustomNodeGroupStorage = IStorage <ICustomNodeGroup>;
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
import { IStorage } from '../../interfaces/storages/IStorage';
|
||||
|
||||
export type TStringArrayStorage = IStorage<string>;
|
||||
export type TStringArrayStorage = IStorage <string>;
|
||||
|
||||
Reference in New Issue
Block a user