service identifiers name change

This commit is contained in:
sanex3339
2016-12-21 19:10:37 +03:00
parent 8d390178a3
commit 435370687a
36 changed files with 259 additions and 244 deletions
+2 -2
View File
@@ -89,8 +89,8 @@ export class Obfuscator implements IObfuscator {
constructor (
@inject(ServiceIdentifiers.IStackTraceAnalyzer) stackTraceAnalyzer: IStackTraceAnalyzer,
@inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
@inject(ServiceIdentifiers['IStorage<ICustomNodeGroup>']) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
@inject(ServiceIdentifiers['Factory<INodeTransformer[]>']) nodeTransformersFactory: TNodeTransformersFactory,
@inject(ServiceIdentifiers.TCustomNodeGroupStorage) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
@inject(ServiceIdentifiers.Factory__INodeTransformer) nodeTransformersFactory: TNodeTransformersFactory,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
this.stackTraceAnalyzer = stackTraceAnalyzer;
+1 -1
View File
@@ -28,7 +28,7 @@ export class SourceMapCorrector implements ISourceMapCorrector {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<IObfuscationResult>']) obfuscationResultFactory: TObfuscationResultFactory,
@inject(ServiceIdentifiers.Factory__IObfuscationResult) obfuscationResultFactory: TObfuscationResultFactory,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
this.obfuscationResultFactory = obfuscationResultFactory;
+1 -1
View File
@@ -60,7 +60,7 @@ export class InversifyContainerFacade implements IInversifyContainerFacade {
.inSingletonScope();
this.container
.bind<IObfuscationResult>(ServiceIdentifiers['Factory<IObfuscationResult>'])
.bind<IObfuscationResult>(ServiceIdentifiers.Factory__IObfuscationResult)
.toFactory<IObfuscationResult>((context: interfaces.Context) => {
return (obfuscatedCode: string, sourceMap: string) => {
const obfuscationResult: IObfuscationResult = context.container
+12 -12
View File
@@ -1,14 +1,13 @@
export const ServiceIdentifiers: any = {
'Factory<ICalleeDataExtractor>': Symbol('Factory<ICalleeDataExtractor>'),
'Factory<IControlFlowReplacer>': Symbol('Factory<IControlFlowReplacer>'),
'Factory<ICustomNode>': Symbol('Factory<ICustomNode>'),
'Factory<ICustomNodeGroup>': Symbol('Factory<ICustomNodeGroup>'),
'Factory<INodeTransformer[]>': Symbol('Factory<INodeTransformer[]>'),
'Factory<IObfuscationResult>': Symbol('Factory<IObfuscationResult>'),
'Factory<IObfuscatorReplacer>': Symbol('Factory<IObfuscatorReplacer>'),
'Factory<IStorage<ICustomNode>>': Symbol('Factory<IStorage<ICustomNode>>'),
Factory__ICalleeDataExtractor: Symbol('Factory<ICalleeDataExtractor>'),
Factory__IControlFlowReplacer: Symbol('Factory<IControlFlowReplacer>'),
Factory__ICustomNode: Symbol('Factory<ICustomNode>'),
Factory__ICustomNodeGroup: Symbol('Factory<ICustomNodeGroup>'),
Factory__INodeTransformer: Symbol('Factory<INodeTransformer[]>'),
Factory__IObfuscationResult: Symbol('Factory<IObfuscationResult>'),
Factory__IObfuscatorReplacer: Symbol('Factory<IObfuscatorReplacer>'),
Factory__TControlFlowStorage: Symbol('Factory<TControlFlowStorage>'),
ICalleeDataExtractor: Symbol('ICalleeDataExtractor'),
ICustomNode: Symbol('ICustomNode'),
ICustomNodeGroup: Symbol('ICustomNodeGroup'),
IControlFlowReplacer: Symbol('IControlFlowReplacer'),
IJavaScriptObfuscator: Symbol('IJavaScriptObfuscator'),
@@ -20,7 +19,8 @@ export const ServiceIdentifiers: any = {
IObfuscatorReplacer: Symbol('IObfuscatorReplacer'),
ISourceMapCorrector: Symbol('ISourceMapCorrector'),
IStackTraceAnalyzer: Symbol('IStackTraceAnalyzer'),
'IStorage<ICustomNode>': Symbol('IStorage<ICustomNode>'),
'IStorage<ICustomNodeGroup>': Symbol('IStorage<ICustomNodeGroup>'),
'IStorage<string>': Symbol('IStorage<string>')
Newable__ICustomNode: Symbol('Newable<ICustomNode>'),
Newable__TControlFlowStorage: Symbol('Newable<TControlFlowStorage>'),
TCustomNodeGroupStorage: Symbol('TCustomNodeGroupStorage'),
TStringArrayStorage: Symbol('TStringArrayStorage')
};
@@ -30,55 +30,55 @@ import { StringArrayRotateFunctionNode } from '../../../custom-nodes/string-arra
export const customNodesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
// custom nodes
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(BinaryExpressionFunctionNode)
.whenTargetNamed(CustomNodes.BinaryExpressionFunctionNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(ControlFlowStorageCallNode)
.whenTargetNamed(CustomNodes.ControlFlowStorageCallNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(ControlFlowStorageNode)
.whenTargetNamed(CustomNodes.ControlFlowStorageNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(ConsoleOutputDisableExpressionNode)
.whenTargetNamed(CustomNodes.ConsoleOutputDisableExpressionNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(DebugProtectionFunctionCallNode)
.whenTargetNamed(CustomNodes.DebugProtectionFunctionCallNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(DebugProtectionFunctionIntervalNode)
.whenTargetNamed(CustomNodes.DebugProtectionFunctionIntervalNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(DebugProtectionFunctionNode)
.whenTargetNamed(CustomNodes.DebugProtectionFunctionNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(DomainLockNode)
.whenTargetNamed(CustomNodes.DomainLockNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(NodeCallsControllerFunctionNode)
.whenTargetNamed(CustomNodes.NodeCallsControllerFunctionNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(SelfDefendingUnicodeNode)
.whenTargetNamed(CustomNodes.SelfDefendingUnicodeNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(StringArrayCallsWrapper)
.whenTargetNamed(CustomNodes.StringArrayCallsWrapper);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(StringArrayNode)
.whenTargetNamed(CustomNodes.StringArrayNode);
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.ICustomNode)
bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
.toConstructor(StringArrayRotateFunctionNode)
.whenTargetNamed(CustomNodes.StringArrayRotateFunctionNode);
@@ -104,7 +104,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
.whenTargetNamed(CustomNodeGroups.StringArrayCustomNodeGroup);
// customNode factory
bind<ICustomNode>(ServiceIdentifiers['Factory<ICustomNode>'])
bind<ICustomNode>(ServiceIdentifiers.Factory__ICustomNode)
.toFactory<ICustomNode>((context: interfaces.Context) => {
const cache: Map <CustomNodes, interfaces.Newable<ICustomNode>> = new Map();
@@ -121,7 +121,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
const constructor: interfaces.Newable<ICustomNode> = context.container
.getNamed<interfaces.Newable<ICustomNode>>(
ServiceIdentifiers.ICustomNode,
ServiceIdentifiers.Newable__ICustomNode,
customNodeName
);
@@ -132,7 +132,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
});
// CustomNodeGroup factory
bind<ICustomNodeGroup>(ServiceIdentifiers['Factory<ICustomNodeGroup>'])
bind<ICustomNodeGroup>(ServiceIdentifiers.Factory__ICustomNodeGroup)
.toFactory<ICustomNodeGroup>((context: interfaces.Context) => {
return (customNodeGroupName: CustomNodeGroups) => {
return context.container.getNamed<ICustomNodeGroup>(
@@ -12,7 +12,7 @@ export const nodeControlFlowTransformersModule: interfaces.ContainerModule = new
.to(BinaryExpressionControlFlowReplacer)
.whenTargetNamed(NodeControlFlowReplacers.BinaryExpressionControlFlowReplacer);
bind<IControlFlowReplacer>(ServiceIdentifiers['Factory<IControlFlowReplacer>'])
bind<IControlFlowReplacer>(ServiceIdentifiers.Factory__IControlFlowReplacer)
.toFactory<IControlFlowReplacer>((context: interfaces.Context) => {
const cache: Map <NodeControlFlowReplacers, IControlFlowReplacer> = new Map();
@@ -27,7 +27,7 @@ export const nodeObfuscatorsModule: interfaces.ContainerModule = new ContainerMo
.to(StringLiteralReplacer)
.whenTargetNamed(NodeObfuscatorsReplacers.StringLiteralReplacer);
bind<IObfuscatorReplacer>(ServiceIdentifiers['Factory<IObfuscatorReplacer>'])
bind<IObfuscatorReplacer>(ServiceIdentifiers.Factory__IObfuscatorReplacer)
.toFactory<IObfuscatorReplacer>((context: interfaces.Context) => {
const cache: Map <NodeObfuscatorsReplacers, IObfuscatorReplacer> = new Map();
@@ -61,7 +61,7 @@ export const nodeTransformersModule: interfaces.ContainerModule = new ContainerM
.whenTargetNamed(NodeTransformers.VariableDeclarationObfuscator);
// node transformers factory
bind<INodeTransformer[]>(ServiceIdentifiers['Factory<INodeTransformer[]>'])
bind<INodeTransformer[]>(ServiceIdentifiers.Factory__INodeTransformer)
.toFactory<INodeTransformer[]>((context: interfaces.Context) => {
const cache: Map <NodeTransformers, INodeTransformer> = new Map();
@@ -30,7 +30,7 @@ export const stackTraceAnalyzerModule: interfaces.ContainerModule = new Containe
.whenTargetNamed(CalleeDataExtractors.ObjectExpressionCalleeDataExtractor);
// node transformers factory
bind<ICalleeDataExtractor>(ServiceIdentifiers['Factory<ICalleeDataExtractor>'])
bind<ICalleeDataExtractor>(ServiceIdentifiers.Factory__ICalleeDataExtractor)
.toFactory<ICalleeDataExtractor>((context: interfaces.Context) => {
const cache: Map <CalleeDataExtractors, ICalleeDataExtractor> = new Map();
@@ -1,9 +1,9 @@
import { ContainerModule, interfaces } from 'inversify';
import { ServiceIdentifiers } from '../../ServiceIdentifiers';
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
import { ICustomNodeGroup } from '../../../interfaces/custom-nodes/ICustomNodeGroup';
import { IStorage } from '../../../interfaces/storages/IStorage';
import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
import { TCustomNodeGroupStorage } from '../../../types/storages/TCustomNodeGroupStorage';
import { TStringArrayStorage } from '../../../types/storages/TStringArrayStorage';
import { ControlFlowStorage } from '../../../storages/control-flow/ControlFlowStorage';
import { CustomNodeGroupStorage } from '../../../storages/custom-node-group/CustomNodeGroupStorage';
@@ -11,22 +11,25 @@ import { StringArrayStorage } from '../../../storages/string-array/StringArraySt
export const storagesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
// storages
bind<IStorage<ICustomNodeGroup>>(ServiceIdentifiers['IStorage<ICustomNodeGroup>'])
bind<TCustomNodeGroupStorage>(ServiceIdentifiers.TCustomNodeGroupStorage)
.to(CustomNodeGroupStorage)
.inSingletonScope();
bind<IStorage<ICustomNode>>(ServiceIdentifiers['IStorage<ICustomNode>'])
.to(ControlFlowStorage);
bind<IStorage<string>>(ServiceIdentifiers['IStorage<string>'])
bind<TStringArrayStorage>(ServiceIdentifiers.TStringArrayStorage)
.to(StringArrayStorage)
.inSingletonScope();
bind<interfaces.Newable<TControlFlowStorage>>(ServiceIdentifiers.Newable__TControlFlowStorage)
.toConstructor(ControlFlowStorage);
// controlFlowStorage factory
bind<IStorage<ICustomNode>>(ServiceIdentifiers['Factory<IStorage<ICustomNode>>'])
.toFactory<IStorage<ICustomNode>>((context: interfaces.Context) => {
bind<TControlFlowStorage>(ServiceIdentifiers.Factory__TControlFlowStorage)
.toFactory<TControlFlowStorage>((context: interfaces.Context) => {
return () => {
return new ControlFlowStorage();
const constructor: interfaces.Newable<TControlFlowStorage> = context.container
.get<interfaces.Newable<TControlFlowStorage>>(ServiceIdentifiers.Newable__TControlFlowStorage);
return new constructor();
};
});
});
@@ -48,7 +48,7 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
@@ -1,6 +1,8 @@
import { injectable, inject } from 'inversify';
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
import { BinaryOperator } from 'estree';
import { TStatement } from '../../../types/node/TStatement';
import { IOptions } from '../../../interfaces/options/IOptions';
@@ -14,10 +16,10 @@ import { RandomGeneratorUtils } from '../../../utils/RandomGeneratorUtils';
@injectable()
export class BinaryExpressionFunctionNode extends AbstractCustomNode {
/**
* @type {string}
* @type {BinaryOperator}
*/
@initializable()
private operator: string;
private operator: BinaryOperator;
/**
* @param options
@@ -31,7 +33,7 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
/**
* @param operator
*/
public initialize (operator: string): void {
public initialize (operator: BinaryOperator): void {
this.operator = operator;
}
@@ -49,7 +51,7 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
Nodes.getBlockStatementNode([
Nodes.getReturnStatementNode(
Nodes.getBinaryExpressionNode(
<any>this.operator,
this.operator,
Nodes.getIdentifierNode('x'),
Nodes.getIdentifierNode('y')
)
@@ -1,6 +1,8 @@
import { injectable, inject } from 'inversify';
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
import { Expression } from 'estree';
import { TStatement } from '../../../types/node/TStatement';
import { IOptions } from '../../../interfaces/options/IOptions';
@@ -25,16 +27,16 @@ export class ControlFlowStorageCallNode extends AbstractCustomNode {
private controlFlowStorageName: string;
/**
* @type {string}
* @type {Expression}
*/
@initializable()
private leftValue: string;
private leftValue: Expression;
/**
* @type {string}
* @type {ESTree.Expression}
*/
@initializable()
private rightValue: string;
private rightValue: Expression;
/**
* @param options
@@ -54,8 +56,8 @@ export class ControlFlowStorageCallNode extends AbstractCustomNode {
public initialize (
controlFlowStorageName: string,
controlFlowStorageKey: string,
leftValue: string,
rightValue: string,
leftValue: Expression,
rightValue: Expression,
): void {
this.controlFlowStorageName = controlFlowStorageName;
this.controlFlowStorageKey = controlFlowStorageKey;
@@ -72,8 +74,8 @@ export class ControlFlowStorageCallNode extends AbstractCustomNode {
Nodes.getIdentifierNode(this.controlFlowStorageKey)
),
[
<any>this.leftValue,
<any>this.rightValue
this.leftValue,
this.rightValue
]
)
)
@@ -48,7 +48,7 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
@@ -48,7 +48,7 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
@@ -48,7 +48,7 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
@@ -57,9 +57,9 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
@inject(ServiceIdentifiers['IStorage<string>']) stringArrayStorage: IStorage<string>,
@inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStorage<string>,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -75,9 +75,9 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<IStorage<ICustomNode>>']) controlFlowStorageFactory: TControlFlowStorageFactory,
@inject(ServiceIdentifiers['Factory<IControlFlowReplacer>']) controlFlowReplacerFactory: TControlFlowReplacerFactory,
@inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.Factory__TControlFlowStorage) controlFlowStorageFactory: TControlFlowStorageFactory,
@inject(ServiceIdentifiers.Factory__IControlFlowReplacer) controlFlowReplacerFactory: TControlFlowReplacerFactory,
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -38,7 +38,7 @@ export class BinaryExpressionControlFlowReplacer extends AbstractControlFlowRepl
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -36,7 +36,7 @@ export class CatchClauseObfuscator extends AbstractNodeTransformer {
* @param options
*/
constructor(
@inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -39,7 +39,7 @@ export class FunctionDeclarationObfuscator extends AbstractNodeTransformer {
* @param options
*/
constructor(
@inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -36,7 +36,7 @@ export class FunctionObfuscator extends AbstractNodeTransformer {
* @param options
*/
constructor(
@inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -44,7 +44,7 @@ export class LabeledStatementObfuscator extends AbstractNodeTransformer {
* @param options
*/
constructor(
@inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) nodeObfuscatorsReplacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -24,7 +24,7 @@ export class LiteralObfuscator extends AbstractNodeTransformer {
* @param options
*/
constructor(
@inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -25,7 +25,7 @@ export class MemberExpressionObfuscator extends AbstractNodeTransformer {
* @param options
*/
constructor(
@inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -36,7 +36,7 @@ export class MethodDefinitionObfuscator extends AbstractNodeTransformer {
* @param options
*/
constructor(
@inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -40,7 +40,7 @@ export class VariableDeclarationObfuscator extends AbstractNodeTransformer {
* @param options
*/
constructor(
@inject(ServiceIdentifiers['Factory<IObfuscatorReplacer>']) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.Factory__IObfuscatorReplacer) replacersFactory: (replacer: NodeObfuscatorsReplacers) => IObfuscatorReplacer,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
@@ -41,8 +41,8 @@ export class StringLiteralReplacer extends AbstractReplacer {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['IStorage<ICustomNodeGroup>']) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
@inject(ServiceIdentifiers['IStorage<string>']) stringArrayStorage: IStorage<string>,
@inject(ServiceIdentifiers.TCustomNodeGroupStorage) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
@inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStorage<string>,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
+10 -13
View File
@@ -7,13 +7,13 @@ import { NodeType } from '../enums/NodeType';
export class Nodes {
/**
* @param bodyNodes
* @param body
* @returns {ESTree.Program}
*/
public static getProgramNode (bodyNodes: TStatement[] = []): ESTree.Program {
public static getProgramNode (body: TStatement[] = []): ESTree.Program {
return {
type: NodeType.Program,
body: bodyNodes,
body,
sourceType: 'script',
obfuscated: false
};
@@ -40,26 +40,26 @@ export class Nodes {
}
/**
* @param bodyNodes
* @param body
* @returns {ESTree.BlockStatement}
*/
public static getBlockStatementNode (bodyNodes: ESTree.Statement[] = []): ESTree.BlockStatement {
public static getBlockStatementNode (body: ESTree.Statement[] = []): ESTree.BlockStatement {
return {
type: NodeType.BlockStatement,
body: bodyNodes,
body,
obfuscated: false
};
}
/**
* @param bodyNodes
* @param body
* @returns {ESTree.CatchClause}
*/
public static getCatchClauseNode (bodyNodes: ESTree.Statement[] = []): ESTree.CatchClause {
public static getCatchClauseNode (body: ESTree.Statement[] = []): ESTree.CatchClause {
return {
type: NodeType.CatchClause,
param: Nodes.getIdentifierNode('err'),
body: Nodes.getBlockStatementNode(bodyNodes),
body: Nodes.getBlockStatementNode(body),
obfuscated: false
};
}
@@ -137,10 +137,7 @@ export class Nodes {
* @param consequent
* @returns {ESTree.IfStatement}
*/
public static getIfStatementNode (
test: ESTree.Expression,
consequent: ESTree.BlockStatement,
): ESTree.IfStatement {
public static getIfStatementNode (test: ESTree.Expression, consequent: ESTree.BlockStatement,): ESTree.IfStatement {
return {
type: NodeType.IfStatement,
test,
@@ -74,7 +74,7 @@ export class StackTraceAnalyzer implements IStackTraceAnalyzer {
private calleeDataExtractorsFactory: (calleeDataExtractorName: CalleeDataExtractors) => ICalleeDataExtractor;
constructor (
@inject(ServiceIdentifiers['Factory<ICalleeDataExtractor>']) calleeDataExtractorsFactory: TCalleeDataExtractorsFactory
@inject(ServiceIdentifiers.Factory__ICalleeDataExtractor) calleeDataExtractorsFactory: TCalleeDataExtractorsFactory
) {
this.calleeDataExtractorsFactory = calleeDataExtractorsFactory;
}
@@ -39,7 +39,7 @@ export class CustomNodeGroupStorage extends MapStorage <ICustomNodeGroup> {
* @param options
*/
constructor (
@inject(ServiceIdentifiers['Factory<ICustomNodeGroup>']) customNodeGroupFactory: TCustomNodeGroupFactory,
@inject(ServiceIdentifiers.Factory__ICustomNodeGroup) customNodeGroupFactory: TCustomNodeGroupFactory,
@inject(ServiceIdentifiers.IOptions) options: IOptions
) {
super();
+4
View File
@@ -0,0 +1,4 @@
import { ICustomNode } from '../../interfaces/custom-nodes/ICustomNode';
import { IStorage } from '../../interfaces/storages/IStorage';
export type TControlFlowStorage = IStorage<ICustomNode>;
+4
View File
@@ -0,0 +1,4 @@
import { ICustomNodeGroup } from '../../interfaces/custom-nodes/ICustomNodeGroup';
import { IStorage } from '../../interfaces/storages/IStorage';
export type TCustomNodeGroupStorage = IStorage<ICustomNodeGroup>;
+3
View File
@@ -0,0 +1,3 @@
import { IStorage } from '../../interfaces/storages/IStorage';
export type TStringArrayStorage = IStorage<string>;