diff --git a/package.json b/package.json index 38f0c47b..9a120877 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@types/md5": "2.1.32", "@types/mkdirp": "0.3.29", "@types/mocha": "2.2.41", - "@types/node": "8.0.9", + "@types/node": "8.0.10", "@types/sinon": "2.3.2", "@types/string-template": "1.0.2", "awesome-typescript-loader": "3.2.1", @@ -59,9 +59,10 @@ "istanbul": "1.1.0-alpha.1", "mocha": "3.4.2", "pre-commit": "1.2.2", - "sinon": "2.3.6", + "sinon": "2.3.7", "ts-node": "3.2.0", "tslint": "5.5.0", + "tslint-eslint-rules": "^4.1.1", "tslint-loader": "3.5.3", "typescript": "2.4.1", "webpack": "3.1.0", diff --git a/src/JavaScriptObfuscator.ts b/src/JavaScriptObfuscator.ts index d0d5f716..1346c3e1 100644 --- a/src/JavaScriptObfuscator.ts +++ b/src/JavaScriptObfuscator.ts @@ -13,9 +13,9 @@ import { JavaScriptObfuscatorCLI } from './cli/JavaScriptObfuscatorCLI'; export class JavaScriptObfuscator { /** - * @param sourceCode - * @param inputOptions - * @returns {string} + * @param {string} sourceCode + * @param {TInputOptions} inputOptions + * @returns {IObfuscationResult} */ public static obfuscate (sourceCode: string, inputOptions: TInputOptions = {}): IObfuscationResult { const inversifyContainerFacade: IInversifyContainerFacade = new InversifyContainerFacade(); @@ -32,7 +32,7 @@ export class JavaScriptObfuscator { } /** - * @param argv + * @param {string[]} argv */ public static runCLI (argv: string[]): void { new JavaScriptObfuscatorCLI(argv).run(); diff --git a/src/JavaScriptObfuscatorInternal.ts b/src/JavaScriptObfuscatorInternal.ts index a92b53f8..6be7a2c4 100644 --- a/src/JavaScriptObfuscatorInternal.ts +++ b/src/JavaScriptObfuscatorInternal.ts @@ -39,9 +39,9 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator { private readonly sourceMapCorrector: ISourceMapCorrector; /** - * @param obfuscator - * @param sourceMapCorrector - * @param options + * @param {IObfuscator} obfuscator + * @param {ISourceMapCorrector} sourceMapCorrector + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IObfuscator) obfuscator: IObfuscator, @@ -54,7 +54,7 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator { } /** - * @param sourceCode + * @param {string} sourceCode * @returns {IObfuscationResult} */ public obfuscate (sourceCode: string): IObfuscationResult { @@ -71,8 +71,8 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator { } /** - * @param sourceCode - * @return {ESTree.Program} + * @param {string} sourceCode + * @returns {Program} */ private parseCode (sourceCode: string): ESTree.Program { return esprima.parse(sourceCode, { @@ -81,8 +81,9 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator { } /** - * @param sourceCode - * @param astTree + * @param {string} sourceCode + * @param {Program} astTree + * @returns {IGeneratorOutput} */ private generateCode (sourceCode: string, astTree: ESTree.Program): IGeneratorOutput { const escodegenParams: escodegen.GenerateOptions = { @@ -111,7 +112,7 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator { } /** - * @param generatorOutput + * @param {IGeneratorOutput} generatorOutput * @returns {IObfuscationResult} */ private getObfuscationResult (generatorOutput: IGeneratorOutput): IObfuscationResult { diff --git a/src/ObfuscationResult.ts b/src/ObfuscationResult.ts index 90fc56ea..043cbb68 100644 --- a/src/ObfuscationResult.ts +++ b/src/ObfuscationResult.ts @@ -19,8 +19,8 @@ export class ObfuscationResult implements IObfuscationResult { private sourceMap: string; /** - * @param obfuscatedCode - * @param sourceMap + * @param {string} obfuscatedCode + * @param {string} sourceMap */ public initialize (obfuscatedCode: string, sourceMap: string): void { this.obfuscatedCode = obfuscatedCode; diff --git a/src/Obfuscator.ts b/src/Obfuscator.ts index 0b3685e4..04dc0eac 100644 --- a/src/Obfuscator.ts +++ b/src/Obfuscator.ts @@ -89,11 +89,11 @@ export class Obfuscator implements IObfuscator { private readonly stackTraceAnalyzer: IStackTraceAnalyzer; /** - * @param stackTraceAnalyzer - * @param obfuscationEventEmitter - * @param customNodeGroupStorage - * @param nodeTransformerFactory - * @param options + * @param {IStackTraceAnalyzer} stackTraceAnalyzer + * @param {IObfuscationEventEmitter} obfuscationEventEmitter + * @param {IStorage} customNodeGroupStorage + * @param {TNodeTransformerFactory} nodeTransformerFactory + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IStackTraceAnalyzer) stackTraceAnalyzer: IStackTraceAnalyzer, @@ -110,8 +110,8 @@ export class Obfuscator implements IObfuscator { } /** - * @param astTree - * @returns {ESTree.Program} + * @param {Program} astTree + * @returns {Program} */ public obfuscateAstTree (astTree: ESTree.Program): ESTree.Program { if (Node.isProgramNode(astTree) && !astTree.body.length) { @@ -158,8 +158,9 @@ export class Obfuscator implements IObfuscator { } /** - * @param astTree - * @param nodeTransformers + * @param {Program} astTree + * @param {NodeTransformer[]} nodeTransformers + * @returns {Program} */ private transformAstTree ( astTree: ESTree.Program, @@ -196,9 +197,9 @@ export class Obfuscator implements IObfuscator { } /** - * @param visitors - * @param direction - * @return {TVisitorDirection} + * @param {IVisitor[]} visitors + * @param {TVisitorDirection} direction + * @returns {TVisitorFunction} */ private mergeVisitorsForDirection (visitors: IVisitor[], direction: TVisitorDirection): TVisitorFunction { if (!visitors.length) { diff --git a/src/SourceMapCorrector.ts b/src/SourceMapCorrector.ts index 46b9b8fe..9c53ca64 100644 --- a/src/SourceMapCorrector.ts +++ b/src/SourceMapCorrector.ts @@ -28,9 +28,9 @@ export class SourceMapCorrector implements ISourceMapCorrector { private readonly options: IOptions; /** - * @param obfuscationResultFactory - * @param cryptUtils - * @param options + * @param {TObfuscationResultFactory} obfuscationResultFactory + * @param {ICryptUtils} cryptUtils + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IObfuscationResult) obfuscationResultFactory: TObfuscationResultFactory, @@ -43,9 +43,9 @@ export class SourceMapCorrector implements ISourceMapCorrector { } /** - * @returns {ObfuscationResult} - * @param obfuscatedCode - * @param sourceMap + * @param {string} obfuscatedCode + * @param {string} sourceMap + * @returns {IObfuscationResult} */ public correct (obfuscatedCode: string, sourceMap: string): IObfuscationResult { return this.obfuscationResultFactory( @@ -55,8 +55,8 @@ export class SourceMapCorrector implements ISourceMapCorrector { } /** - * @param obfuscatedCode - * @param sourceMap + * @param {string} obfuscatedCode + * @param {string} sourceMap * @returns {string} */ private correctObfuscatedCode (obfuscatedCode: string, sourceMap: string): string { diff --git a/src/cli/JavaScriptObfuscatorCLI.ts b/src/cli/JavaScriptObfuscatorCLI.ts index 1a3cffb9..94e0501b 100644 --- a/src/cli/JavaScriptObfuscatorCLI.ts +++ b/src/cli/JavaScriptObfuscatorCLI.ts @@ -41,7 +41,7 @@ export class JavaScriptObfuscatorCLI { private sourceCode: string = ''; /** - * @param argv + * @param {string[]} argv */ constructor (argv: string[]) { this.rawArguments = argv; @@ -234,8 +234,8 @@ export class JavaScriptObfuscatorCLI { } /** - * @param outputCodePath - * @param options + * @param {string} outputCodePath + * @param {TInputOptions} options */ private processDataWithoutSourceMap (outputCodePath: string, options: TInputOptions): void { const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(this.sourceCode, options).getObfuscatedCode(); @@ -244,8 +244,8 @@ export class JavaScriptObfuscatorCLI { } /** - * @param outputCodePath - * @param options + * @param {string} outputCodePath + * @param {TInputOptions} options */ private processDataWithSourceMap (outputCodePath: string, options: TInputOptions): void { const outputSourceMapPath: string = CLIUtils.getOutputSourceMapPath( diff --git a/src/cli/sanitizers/BooleanSanitizer.ts b/src/cli/sanitizers/BooleanSanitizer.ts index 7b6f322d..18fe41bf 100644 --- a/src/cli/sanitizers/BooleanSanitizer.ts +++ b/src/cli/sanitizers/BooleanSanitizer.ts @@ -1,5 +1,9 @@ import { TCLISanitizer } from '../../types/cli/TCLISanitizer'; +/** + * @param {string} value + * @returns {boolean} + */ export const BooleanSanitizer: TCLISanitizer = (value: string): boolean => { return value === 'true' || value === '1'; }; diff --git a/src/cli/sanitizers/SourceMapModeSanitizer.ts b/src/cli/sanitizers/SourceMapModeSanitizer.ts index 5303a2b3..8358e376 100644 --- a/src/cli/sanitizers/SourceMapModeSanitizer.ts +++ b/src/cli/sanitizers/SourceMapModeSanitizer.ts @@ -2,6 +2,10 @@ import { TCLISanitizer } from '../../types/cli/TCLISanitizer'; import { SourceMapMode } from '../../enums/SourceMapMode'; +/** + * @param {string} value + * @returns {string} + */ export const SourceMapModeSanitizer: TCLISanitizer = (value: string): string => { const availableMode: boolean = Object .keys(SourceMapMode) diff --git a/src/cli/sanitizers/StringArrayEncodingSanitizer.ts b/src/cli/sanitizers/StringArrayEncodingSanitizer.ts index 7b51c415..ba40097c 100644 --- a/src/cli/sanitizers/StringArrayEncodingSanitizer.ts +++ b/src/cli/sanitizers/StringArrayEncodingSanitizer.ts @@ -3,6 +3,10 @@ import { TStringArrayEncoding } from '../../types/options/TStringArrayEncoding'; import { StringArrayEncoding } from '../../enums/StringArrayEncoding'; +/** + * @param {string} value + * @returns {TStringArrayEncoding} + */ export const StringArrayEncodingSanitizer: TCLISanitizer = (value: string): TStringArrayEncoding => { switch (value) { case 'true': diff --git a/src/cli/utils/CLIUtils.ts b/src/cli/utils/CLIUtils.ts index 8979f65e..b3546b61 100644 --- a/src/cli/utils/CLIUtils.ts +++ b/src/cli/utils/CLIUtils.ts @@ -18,8 +18,8 @@ export class CLIUtils { private static readonly encoding: BufferEncoding = 'utf8'; /** - * @param outputPath - * @param inputPath + * @param {string} outputPath + * @param {string} inputPath * @returns {string} */ public static getOutputCodePath (outputPath: string, inputPath: string): string { @@ -36,8 +36,8 @@ export class CLIUtils { } /** - * @param outputCodePath - * @param sourceMapFileName + * @param {string} outputCodePath + * @param {string} sourceMapFileName * @returns {string} */ public static getOutputSourceMapPath (outputCodePath: string, sourceMapFileName: string = ''): string { @@ -74,7 +74,8 @@ export class CLIUtils { } /** - * @param filePath + * @param {string} filePath + * @returns {boolean} */ public static isFilePath (filePath: string): boolean { try { @@ -85,7 +86,7 @@ export class CLIUtils { } /** - * @param inputPath + * @param {string} inputPath * @returns {string} */ public static readFile (inputPath: string): string { @@ -93,7 +94,7 @@ export class CLIUtils { } /** - * @param inputPath + * @param {string} inputPath */ public static validateInputPath (inputPath: string): void { if (!CLIUtils.isFilePath(inputPath)) { @@ -106,8 +107,8 @@ export class CLIUtils { } /** - * @param outputPath - * @param data + * @param {string} outputPath + * @param {any} data */ public static writeFile (outputPath: string, data: any): void { mkdirp.sync(path.dirname(outputPath)); diff --git a/src/container/InversifyContainerFacade.ts b/src/container/InversifyContainerFacade.ts index 6262072e..9b85486c 100644 --- a/src/container/InversifyContainerFacade.ts +++ b/src/container/InversifyContainerFacade.ts @@ -39,8 +39,8 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { } /** - * @param serviceIdentifier - * @return {(context:interfaces.Context)=>(bindingName:T)=>U} + * @param {interfaces.ServiceIdentifier} serviceIdentifier + * @returns {U} */ public static getFactory ( serviceIdentifier: interfaces.ServiceIdentifier @@ -53,8 +53,8 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { } /** - * @param serviceIdentifier - * @return {(context:interfaces.Context)=>(bindingName:T)=>U} + * @param {interfaces.ServiceIdentifier} serviceIdentifier + * @returns {U} */ public static getCacheFactory ( serviceIdentifier: interfaces.ServiceIdentifier @@ -77,9 +77,9 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { } /** - * @param serviceIdentifier - * @param dependencies - * @return {(context: interfaces.Context) => (bindingName: T) => U} + * @param {interfaces.ServiceIdentifier>} serviceIdentifier + * @param {any[]} dependencies + * @returns {U} */ public static getConstructorFactory ( serviceIdentifier: interfaces.ServiceIdentifier>, @@ -114,7 +114,7 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { } /** - * @param serviceIdentifier + * @param {interfaces.ServiceIdentifier} serviceIdentifier * @returns {T} */ public get (serviceIdentifier: interfaces.ServiceIdentifier): T { @@ -122,8 +122,8 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { } /** - * @param serviceIdentifier - * @param named + * @param {interfaces.ServiceIdentifier} serviceIdentifier + * @param {string | number | symbol} named * @returns {T} */ public getNamed (serviceIdentifier: interfaces.ServiceIdentifier, named: string | number | symbol): T { @@ -131,8 +131,8 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { } /** - * @param sourceCode - * @param options + * @param {string} sourceCode + * @param {TInputOptions} options */ public load (sourceCode: string, options: TInputOptions): void { this.container diff --git a/src/custom-nodes/AbstractCustomNode.ts b/src/custom-nodes/AbstractCustomNode.ts index 9756834b..a1a343b7 100644 --- a/src/custom-nodes/AbstractCustomNode.ts +++ b/src/custom-nodes/AbstractCustomNode.ts @@ -25,7 +25,7 @@ export abstract class AbstractCustomNode implements ICustomNode { protected readonly options: IOptions; /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -34,7 +34,7 @@ export abstract class AbstractCustomNode implements ICustomNode { } /** - * @param args + * @param {any[]} args */ public abstract initialize (...args: any[]): void; diff --git a/src/custom-nodes/AbstractCustomNodeGroup.ts b/src/custom-nodes/AbstractCustomNodeGroup.ts index 0ee9b390..eaa63de0 100644 --- a/src/custom-nodes/AbstractCustomNodeGroup.ts +++ b/src/custom-nodes/AbstractCustomNodeGroup.ts @@ -40,8 +40,8 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup { protected readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -52,8 +52,8 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup { } /** - * @param blockScopeNode - * @param stackTraceData + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {IStackTraceData[]} stackTraceData */ public abstract appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void; @@ -74,8 +74,8 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup { public abstract initialize (): void; /** - * @param customNodeName - * @param callback + * @param {CustomNode} customNodeName + * @param {callback} callback */ protected appendCustomNodeIfExist (customNodeName: CustomNode, callback: (customNode: ICustomNode) => void): void { const customNode: ICustomNode | undefined = this.customNodes.get(customNodeName); @@ -88,7 +88,8 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup { } /** - * @param stackTraceLength + * @param {number} stackTraceLength + * @returns {number} */ protected getRandomStackTraceIndex (stackTraceLength: number): number { return this.randomGenerator.getRandomInteger(0, Math.max(0, Math.round(stackTraceLength - 1))); diff --git a/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts b/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts index e243afe7..54113e04 100644 --- a/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts +++ b/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts @@ -29,8 +29,8 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -42,7 +42,7 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode { } /** - * @param callsControllerFunctionName + * @param {string} callsControllerFunctionName */ public initialize (callsControllerFunctionName: string): void { this.callsControllerFunctionName = callsControllerFunctionName; diff --git a/src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts b/src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts index f121dd24..f2321cd4 100644 --- a/src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts +++ b/src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts @@ -42,10 +42,10 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup { private readonly obfuscationEventEmitter: IObfuscationEventEmitter; /** - * @param customNodeFactory - * @param obfuscationEventEmitter - * @param randomGenerator - * @param options + * @param {TCustomNodeFactory} customNodeFactory + * @param {IObfuscationEventEmitter} obfuscationEventEmitter + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, @@ -60,8 +60,8 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup { } /** - * @param blockScopeNode - * @param stackTraceData + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {IStackTraceData[]} stackTraceData */ public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void { const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length); @@ -91,7 +91,7 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup { } public initialize (): void { - this.customNodes = new Map (); + this.customNodes = new Map (); if (!this.options.disableConsoleOutput) { return; diff --git a/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts index f44939e4..1cc73079 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts @@ -28,8 +28,8 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -41,7 +41,7 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode { } /** - * @param operator + * @param {BinaryOperator} operator */ public initialize (operator: BinaryOperator): void { this.operator = operator; diff --git a/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts b/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts index 7a55bc35..b9cf5e25 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts @@ -40,8 +40,8 @@ export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode private shuffledKeys: number[]; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -52,10 +52,10 @@ export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode this.randomGenerator = randomGenerator; } - /*** - * @param blockStatementBody - * @param shuffledKeys - * @param originalKeysIndexesInShuffledArray + /** + * @param {Statement[]} blockStatementBody + * @param {number[]} shuffledKeys + * @param {number[]} originalKeysIndexesInShuffledArray */ public initialize ( blockStatementBody: ESTree.Statement[], diff --git a/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts index ae16e38b..79c15ecc 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts @@ -28,8 +28,8 @@ export class CallExpressionFunctionNode extends AbstractCustomNode { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -41,7 +41,7 @@ export class CallExpressionFunctionNode extends AbstractCustomNode { } /** - * @param expressionArguments + * @param {(Expression | SpreadElement)[]} expressionArguments */ public initialize (expressionArguments: (ESTree.Expression | ESTree.SpreadElement)[]): void { this.expressionArguments = expressionArguments; diff --git a/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts index 47c116ca..0fbed122 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts @@ -28,8 +28,8 @@ export class LogicalExpressionFunctionNode extends AbstractCustomNode { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -41,7 +41,7 @@ export class LogicalExpressionFunctionNode extends AbstractCustomNode { } /** - * @param operator + * @param {LogicalOperator} operator */ public initialize (operator: LogicalOperator): void { this.operator = operator; diff --git a/src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts b/src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts index 768efeca..24dc783a 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts @@ -25,8 +25,8 @@ export class StringLiteralNode extends AbstractCustomNode { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -38,7 +38,7 @@ export class StringLiteralNode extends AbstractCustomNode { } /** - * @param literalValue + * @param {string} literalValue */ public initialize (literalValue: string): void { this.literalValue = literalValue; diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts index ee8c2f5c..38306389 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts @@ -47,8 +47,8 @@ export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -60,10 +60,10 @@ export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode } /** - * @param controlFlowStorageName - * @param controlFlowStorageKey - * @param callee - * @param expressionArguments + * @param {string} controlFlowStorageName + * @param {string} controlFlowStorageKey + * @param {Expression} callee + * @param {(Expression | SpreadElement)[]} expressionArguments */ public initialize ( controlFlowStorageName: string, diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts index 8b1d84c7..9b7db695 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts @@ -30,8 +30,8 @@ export class ControlFlowStorageNode extends AbstractCustomNode { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -43,7 +43,7 @@ export class ControlFlowStorageNode extends AbstractCustomNode { } /** - * @param controlFlowStorage + * @param {IStorage} controlFlowStorage */ public initialize (controlFlowStorage: IStorage ): void { this.controlFlowStorage = controlFlowStorage; diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts index eb0896b9..46593a0a 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts @@ -46,8 +46,8 @@ export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCu private rightValue: Expression; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -59,10 +59,10 @@ export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCu } /** - * @param controlFlowStorageName - * @param controlFlowStorageKey - * @param leftValue - * @param rightValue + * @param {string} controlFlowStorageName + * @param {string} controlFlowStorageKey + * @param {Expression} leftValue + * @param {Expression} rightValue */ public initialize ( controlFlowStorageName: string, diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts index 27708896..416e0dca 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts @@ -32,8 +32,8 @@ export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -45,8 +45,8 @@ export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode } /** - * @param controlFlowStorageName - * @param controlFlowStorageKey + * @param {string} controlFlowStorageName + * @param {string} controlFlowStorageKey */ public initialize ( controlFlowStorageName: string, diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts index ff899a08..2cd94564 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts @@ -23,7 +23,7 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode { private debugProtectionFunctionName: string; /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -32,7 +32,7 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode { } /** - * @param debugProtectionFunctionName + * @param {string} debugProtectionFunctionName */ public initialize (debugProtectionFunctionName: string): void { this.debugProtectionFunctionName = debugProtectionFunctionName; diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts index 2612754c..00d1e684 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts @@ -23,7 +23,7 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode { private debugProtectionFunctionName: string; /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -32,7 +32,7 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode { } /** - * @param debugProtectionFunctionName + * @param {string} debugProtectionFunctionName */ public initialize (debugProtectionFunctionName: string): void { this.debugProtectionFunctionName = debugProtectionFunctionName; diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts index e38f8165..85c014c2 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts @@ -23,7 +23,7 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode { private debugProtectionFunctionName: string; /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -32,7 +32,7 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode { } /** - * @param debugProtectionFunctionName + * @param {string} debugProtectionFunctionName */ public initialize (debugProtectionFunctionName: string): void { this.debugProtectionFunctionName = debugProtectionFunctionName; diff --git a/src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts b/src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts index 101ece59..493180fe 100644 --- a/src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts +++ b/src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts @@ -42,10 +42,10 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup { private readonly obfuscationEventEmitter: IObfuscationEventEmitter; /** - * @param customNodeFactory - * @param obfuscationEventEmitter - * @param randomGenerator - * @param options + * @param {TCustomNodeFactory} customNodeFactory + * @param {IObfuscationEventEmitter} obfuscationEventEmitter + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, @@ -60,8 +60,8 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup { } /** - * @param blockScopeNode - * @param stackTraceData + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {IStackTraceData[]} stackTraceData */ public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void { // debugProtectionFunctionNode append @@ -84,7 +84,7 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup { } public initialize (): void { - this.customNodes = new Map (); + this.customNodes = new Map (); if (!this.options.debugProtection) { return; diff --git a/src/custom-nodes/domain-lock-nodes/DomainLockNode.ts b/src/custom-nodes/domain-lock-nodes/DomainLockNode.ts index 6c27c9ec..0e3841f1 100644 --- a/src/custom-nodes/domain-lock-nodes/DomainLockNode.ts +++ b/src/custom-nodes/domain-lock-nodes/DomainLockNode.ts @@ -35,9 +35,9 @@ export class DomainLockNode extends AbstractCustomNode { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param cryptUtils - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {ICryptUtils} cryptUtils + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -51,7 +51,7 @@ export class DomainLockNode extends AbstractCustomNode { } /** - * @param callsControllerFunctionName + * @param {string} callsControllerFunctionName */ public initialize (callsControllerFunctionName: string): void { this.callsControllerFunctionName = callsControllerFunctionName; diff --git a/src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts b/src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts index 243a541d..973862c9 100644 --- a/src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts +++ b/src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts @@ -42,10 +42,10 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup { private readonly obfuscationEventEmitter: IObfuscationEventEmitter; /** - * @param customNodeFactory - * @param obfuscationEventEmitter - * @param randomGenerator - * @param options + * @param {TCustomNodeFactory} customNodeFactory + * @param {IObfuscationEventEmitter} obfuscationEventEmitter + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, @@ -60,8 +60,8 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup { } /** - * @param blockScopeNode - * @param stackTraceData + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {IStackTraceData[]} stackTraceData */ public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void { const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length); @@ -91,7 +91,7 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup { } public initialize (): void { - this.customNodes = new Map (); + this.customNodes = new Map (); if (!this.options.domainLock.length) { return; diff --git a/src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts b/src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts index c4a5d462..3383a248 100644 --- a/src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts +++ b/src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts @@ -34,7 +34,7 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode { private appendEvent: ObfuscationEvent; /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -43,8 +43,8 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode { } /** - * @param appendEvent - * @param callsControllerFunctionName + * @param {ObfuscationEvent} appendEvent + * @param {string} callsControllerFunctionName */ public initialize (appendEvent: ObfuscationEvent, callsControllerFunctionName: string): void { this.appendEvent = appendEvent; diff --git a/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts b/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts index 8fb13067..f3e6958c 100644 --- a/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts +++ b/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts @@ -38,9 +38,9 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param escapeSequenceEncoder - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IEscapeSequenceEncoder} escapeSequenceEncoder + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -54,7 +54,7 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode { } /** - * @param callsControllerFunctionName + * @param {string} callsControllerFunctionName */ public initialize (callsControllerFunctionName: string): void { this.callsControllerFunctionName = callsControllerFunctionName; diff --git a/src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts b/src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts index 067166d8..a9be497b 100644 --- a/src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts +++ b/src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts @@ -42,10 +42,10 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup { private readonly obfuscationEventEmitter: IObfuscationEventEmitter; /** - * @param customNodeFactory - * @param obfuscationEventEmitter - * @param randomGenerator - * @param options + * @param {TCustomNodeFactory} customNodeFactory + * @param {IObfuscationEventEmitter} obfuscationEventEmitter + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, @@ -60,8 +60,8 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup { } /** - * @param blockScopeNode - * @param stackTraceData + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {IStackTraceData[]} stackTraceData */ public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void { const randomStackTraceIndex: number = this.getRandomStackTraceIndex(stackTraceData.length); @@ -91,7 +91,7 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup { } public initialize (): void { - this.customNodes = new Map (); + this.customNodes = new Map (); if (!this.options.selfDefending) { return; diff --git a/src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts b/src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts index 70778d84..b7bd714c 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts @@ -52,8 +52,8 @@ export class StringArrayCallsWrapper extends AbstractCustomNode { private stringArrayCallsWrapperName: string; /** - * @param escapeSequenceEncoder - * @param options + * @param {IEscapeSequenceEncoder} escapeSequenceEncoder + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder, @@ -65,9 +65,9 @@ export class StringArrayCallsWrapper extends AbstractCustomNode { } /** - * @param stringArrayStorage - * @param stringArrayName - * @param stringArrayCallsWrapperName + * @param {IStorage} stringArrayStorage + * @param {string} stringArrayName + * @param {string} stringArrayCallsWrapperName */ public initialize ( stringArrayStorage: IStorage , diff --git a/src/custom-nodes/string-array-nodes/StringArrayNode.ts b/src/custom-nodes/string-array-nodes/StringArrayNode.ts index a8a0ff83..7a8ec8cc 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayNode.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayNode.ts @@ -37,7 +37,7 @@ export class StringArrayNode extends AbstractCustomNode { private stringArrayRotateValue: number; /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -46,9 +46,9 @@ export class StringArrayNode extends AbstractCustomNode { } /** - * @param stringArrayStorage - * @param stringArrayName - * @param stringArrayRotateValue + * @param {IStorage} stringArrayStorage + * @param {string} stringArrayName + * @param {number} stringArrayRotateValue */ public initialize ( stringArrayStorage: IStorage , diff --git a/src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts b/src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts index 9f340e7d..7d2eb1b0 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts @@ -53,9 +53,9 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode { private stringArrayRotateValue: number; /** - * @param randomGenerator - * @param escapeSequenceEncoder - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IEscapeSequenceEncoder} escapeSequenceEncoder + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -69,9 +69,9 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode { } /** - * @param stringArrayStorage - * @param stringArrayName - * @param stringArrayRotateValue + * @param {IStorage} stringArrayStorage + * @param {string} stringArrayName + * @param {number} stringArrayRotateValue */ public initialize ( stringArrayStorage: IStorage , diff --git a/src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts b/src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts index e9163fd6..566ced6c 100644 --- a/src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts +++ b/src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts @@ -50,11 +50,11 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup { private stringArrayStorage: IStorage ; /** - * @param customNodeFactory - * @param obfuscationEventEmitter - * @param randomGenerator - * @param stringArrayStorage - * @param options + * @param {TCustomNodeFactory} customNodeFactory + * @param {IObfuscationEventEmitter} obfuscationEventEmitter + * @param {IRandomGenerator} randomGenerator + * @param {IStorage} stringArrayStorage + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory, @@ -71,8 +71,8 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup { } /** - * @param blockScopeNode - * @param stackTraceData + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {IStackTraceData[]} stackTraceData */ public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void { if (!this.stringArrayStorage.getLength()) { @@ -96,7 +96,7 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup { } public initialize (): void { - this.customNodes = new Map (); + this.customNodes = new Map (); if (!this.options.stringArray) { return; diff --git a/src/decorators/Initializable.ts b/src/decorators/Initializable.ts index a133ba7c..57724799 100644 --- a/src/decorators/Initializable.ts +++ b/src/decorators/Initializable.ts @@ -3,8 +3,8 @@ import { IInitializable } from '../interfaces/IInitializable'; /** - * @param initializeMethodKey - * @returns {(target:IInitializable, propertyKey:(string|symbol))=>PropertyDescriptor} + * @param {string} initializeMethodKey + * @returns {any} */ export function initializable ( initializeMethodKey: string = 'initialize' @@ -19,7 +19,7 @@ export function initializable ( const initializeMethod: Function = target[initializeMethodKey]; if (!initializeMethod || typeof initializeMethod !== 'function') { - throw new Error(`\`${initializeMethodKey}\` method with initialization logic not found. \`@${decoratorName}\` decorator requires \`${initializeMethodKey}\` method`); + throw new Error(`\`${initializeMethodKey}\` method with initialization logic not found. \`@${decoratorName}\` decorator requires \`${initializeMethodKey}\` method`); } const metadataPropertyKey: string = `_${propertyKey}`; diff --git a/src/node-transformers/AbstractNodeTransformer.ts b/src/node-transformers/AbstractNodeTransformer.ts index fcb04ef1..68b15dbd 100644 --- a/src/node-transformers/AbstractNodeTransformer.ts +++ b/src/node-transformers/AbstractNodeTransformer.ts @@ -26,8 +26,8 @@ export abstract class AbstractNodeTransformer implements INodeTransformer { protected readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -45,9 +45,9 @@ export abstract class AbstractNodeTransformer implements INodeTransformer { public abstract getVisitor (): IVisitor; /** - * @param node - * @param parentNode - * @returns {ESTree.Node} + * @param {Node} node + * @param {Node} parentNode + * @returns {Node} */ public abstract transformNode (node: ESTree.Node, parentNode: ESTree.Node): ESTree.Node; } diff --git a/src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts b/src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts index 447794fe..9261ef2a 100644 --- a/src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts +++ b/src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts @@ -29,10 +29,10 @@ export class BlockStatementControlFlowTransformer extends AbstractNodeTransforme private readonly controlFlowCustomNodeFactory: TControlFlowCustomNodeFactory; /** - * @param controlFlowCustomNodeFactory - * @param arrayUtils - * @param randomGenerator - * @param options + * @param {TControlFlowCustomNodeFactory} controlFlowCustomNodeFactory + * @param {IArrayUtils} arrayUtils + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IControlFlowCustomNode) @@ -48,14 +48,14 @@ export class BlockStatementControlFlowTransformer extends AbstractNodeTransforme } /** - * @param blockStatementNode - * @return {boolean} + * @param {BlockStatement} blockStatementNode + * @returns {boolean} */ private static blockStatementHasProhibitedStatements (blockStatementNode: ESTree.BlockStatement): boolean { return blockStatementNode.body.some((statement: ESTree.Statement) => { const isBreakOrContinueStatement: boolean = Node.isBreakStatementNode(statement) || Node.isContinueStatementNode(statement); - const isVariableDeclarationWithLetOrConstKind: boolean = Node.isVariableDeclarationNode(statement) && - (statement.kind === 'const' || statement.kind === 'let'); + const isVariableDeclarationWithLetOrConstKind: boolean = Node.isVariableDeclarationNode(statement) + && (statement.kind === 'const' || statement.kind === 'let'); return Node.isFunctionDeclarationNode(statement) || isBreakOrContinueStatement || isVariableDeclarationWithLetOrConstKind; }); @@ -75,9 +75,9 @@ export class BlockStatementControlFlowTransformer extends AbstractNodeTransforme } /** - * @param blockStatementNode - * @param parentNode - * @returns {ESTree.Node} + * @param {BlockStatement} blockStatementNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (blockStatementNode: ESTree.BlockStatement, parentNode: ESTree.Node): ESTree.Node { if ( diff --git a/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts b/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts index c3df7459..1188e990 100644 --- a/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts +++ b/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts @@ -77,11 +77,11 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer { private readonly controlFlowCustomNodeFactory: TControlFlowCustomNodeFactory; /** - * @param controlFlowStorageFactory - * @param controlFlowReplacerFactory - * @param controlFlowCustomNodeFactory - * @param randomGenerator - * @param options + * @param {TControlFlowStorageFactory} controlFlowStorageFactory + * @param {TControlFlowReplacerFactory} controlFlowReplacerFactory + * @param {TControlFlowCustomNodeFactory} controlFlowCustomNodeFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__TControlFlowStorage) @@ -118,9 +118,9 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer { } /** - * @param functionNode - * @param parentNode - * @returns {ESTree.Function} + * @param {Function} functionNode + * @param {Node} parentNode + * @returns {Function} */ public transformNode (functionNode: ESTree.Function, parentNode: ESTree.Node): ESTree.Function { this.visitedFunctionNodes.add(functionNode); @@ -151,8 +151,8 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer { } /** - * @param hostNode - * @return {IStorage} + * @param {TNodeWithBlockStatement} hostNode + * @returns {IStorage} */ private getControlFlowStorage (hostNode: TNodeWithBlockStatement): IStorage { const controlFlowStorage: IStorage = this.controlFlowStorageFactory(); @@ -171,7 +171,7 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer { } /** - * @param functionNodeBody + * @param {BlockStatement} functionNodeBody * @returns {TNodeWithBlockStatement} */ private getHostNode (functionNodeBody: ESTree.BlockStatement): TNodeWithBlockStatement { @@ -195,8 +195,8 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer { } /** - * @param node - * @return {boolean} + * @param {Node} node + * @returns {boolean} */ private isVisitedFunctionNode (node: ESTree.Node): boolean { return ( @@ -207,8 +207,8 @@ export class FunctionControlFlowTransformer extends AbstractNodeTransformer { } /** - * @param functionNodeBody - * @param controlFlowStorage + * @param {BlockStatement} functionNodeBody + * @param {IStorage} controlFlowStorage */ private transformFunctionBody (functionNodeBody: ESTree.BlockStatement, controlFlowStorage: IStorage): void { estraverse.replace(functionNodeBody, { diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts index 59cc3111..c8c93584 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts @@ -34,9 +34,9 @@ export abstract class AbstractControlFlowReplacer implements IControlFlowReplace protected readonly replacerDataByControlFlowStorageId: Map > = new Map(); /** - * @param controlFlowCustomNodeFactory - * @param randomGenerator - * @param options + * @param {TControlFlowCustomNodeFactory} controlFlowCustomNodeFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IControlFlowCustomNode) @@ -50,8 +50,8 @@ export abstract class AbstractControlFlowReplacer implements IControlFlowReplace } /** - * @param identifierDataByControlFlowStorageId - * @param controlFlowStorageId + * @param {Map>} identifierDataByControlFlowStorageId + * @param {string} controlFlowStorageId * @returns {Map} */ protected static getStorageKeysByIdForCurrentStorage ( @@ -63,25 +63,25 @@ export abstract class AbstractControlFlowReplacer implements IControlFlowReplace if (identifierDataByControlFlowStorageId.has(controlFlowStorageId)) { storageKeysById = >identifierDataByControlFlowStorageId.get(controlFlowStorageId); } else { - storageKeysById = new Map (); + storageKeysById = new Map (); } return storageKeysById; } /** - * @param node - * @param parentNode - * @param controlFlowStorage - * @returns {ESTree.Node} + * @param {Node} node + * @param {Node} parentNode + * @param {IStorage} controlFlowStorage + * @returns {Node} */ public abstract replace (node: ESTree.Node, parentNode: ESTree.Node, controlFlowStorage: IStorage ): ESTree.Node; /** - * @param customNode - * @param controlFlowStorage - * @param replacerId - * @param usingExistingIdentifierChance + * @param {ICustomNode} customNode + * @param {IStorage} controlFlowStorage + * @param {string} replacerId + * @param {number} usingExistingIdentifierChance * @returns {string} */ protected insertCustomNodeToControlFlowStorage ( diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts index 01bb35c8..b54aed13 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts @@ -22,9 +22,9 @@ export class BinaryExpressionControlFlowReplacer extends ExpressionWithOperatorC private static readonly usingExistingIdentifierChance: number = 0.5; /** - * @param controlFlowCustomNodeFactory - * @param randomGenerator - * @param options + * @param {TControlFlowCustomNodeFactory} controlFlowCustomNodeFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IControlFlowCustomNode) @@ -36,10 +36,10 @@ export class BinaryExpressionControlFlowReplacer extends ExpressionWithOperatorC } /** - * @param binaryExpressionNode - * @param parentNode - * @param controlFlowStorage - * @returns {ESTree.Node} + * @param {BinaryExpression} binaryExpressionNode + * @param {Node} parentNode + * @param {IStorage} controlFlowStorage + * @returns {Node} */ public replace ( binaryExpressionNode: ESTree.BinaryExpression, diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts index 6be53e73..07c7929e 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts @@ -24,9 +24,9 @@ export class CallExpressionControlFlowReplacer extends AbstractControlFlowReplac private static readonly usingExistingIdentifierChance: number = 0.5; /** - * @param controlFlowCustomNodeFactory - * @param randomGenerator - * @param options + * @param {TControlFlowCustomNodeFactory} controlFlowCustomNodeFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IControlFlowCustomNode) @@ -38,10 +38,10 @@ export class CallExpressionControlFlowReplacer extends AbstractControlFlowReplac } /** - * @param callExpressionNode - * @param parentNode - * @param controlFlowStorage - * @returns {ESTree.Node} + * @param {CallExpression} callExpressionNode + * @param {Node} parentNode + * @param {IStorage} controlFlowStorage + * @returns {Node} */ public replace ( callExpressionNode: ESTree.CallExpression, @@ -78,12 +78,11 @@ export class CallExpressionControlFlowReplacer extends AbstractControlFlowReplac } /** - * @param controlFlowStorageId - * @param storageKey - * @param callee - * @param expressionArguments - * @param arguments - * @returns {ESTree.Node} + * @param {string} controlFlowStorageId + * @param {string} storageKey + * @param {Expression} callee + * @param {(Expression | SpreadElement)[]} expressionArguments + * @returns {Node} */ protected getControlFlowStorageCallNode ( controlFlowStorageId: string, diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts index 8a5a4094..a3b13415 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts @@ -28,9 +28,9 @@ export abstract class ExpressionWithOperatorControlFlowReplacer extends Abstract protected readonly replacerDataByControlFlowStorageId: Map > = new Map(); /** - * @param controlFlowCustomNodeFactory - * @param randomGenerator - * @param options + * @param {TControlFlowCustomNodeFactory} controlFlowCustomNodeFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IControlFlowCustomNode) @@ -42,11 +42,11 @@ export abstract class ExpressionWithOperatorControlFlowReplacer extends Abstract } /** - * @param controlFlowStorageId - * @param storageKey - * @param leftExpression - * @param rightExpression - * @returns {ESTree.Node} + * @param {string} controlFlowStorageId + * @param {string} storageKey + * @param {Expression} leftExpression + * @param {Expression} rightExpression + * @returns {Node} */ protected getControlFlowStorageCallNode ( controlFlowStorageId: string, diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts index 34c716d0..e869e26f 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts @@ -24,9 +24,9 @@ export class LogicalExpressionControlFlowReplacer extends ExpressionWithOperator private static readonly usingExistingIdentifierChance: number = 0.5; /** - * @param controlFlowCustomNodeFactory - * @param randomGenerator - * @param options + * @param {TControlFlowCustomNodeFactory} controlFlowCustomNodeFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IControlFlowCustomNode) @@ -38,10 +38,10 @@ export class LogicalExpressionControlFlowReplacer extends ExpressionWithOperator } /** - * @param logicalExpressionNode - * @param parentNode - * @param controlFlowStorage - * @returns {ESTree.Node} + * @param {LogicalExpression} logicalExpressionNode + * @param {Node} parentNode + * @param {IStorage} controlFlowStorage + * @returns {Node} */ public replace ( logicalExpressionNode: ESTree.LogicalExpression, @@ -75,8 +75,8 @@ export class LogicalExpressionControlFlowReplacer extends ExpressionWithOperator } /** - * @param leftExpression - * @param rightExpression + * @param {Expression} leftExpression + * @param {Expression} rightExpression * @returns {boolean} */ private checkForProhibitedExpressions (leftExpression: ESTree.Expression, rightExpression: ESTree.Expression): boolean { diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts index bb786958..314ea341 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts @@ -24,9 +24,9 @@ export class StringLiteralControlFlowReplacer extends AbstractControlFlowReplace private static readonly usingExistingIdentifierChance: number = 1; /** - * @param controlFlowCustomNodeFactory - * @param randomGenerator - * @param options + * @param {TControlFlowCustomNodeFactory} controlFlowCustomNodeFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IControlFlowCustomNode) @@ -38,10 +38,10 @@ export class StringLiteralControlFlowReplacer extends AbstractControlFlowReplace } /** - * @param literalNode - * @param parentNode - * @param controlFlowStorage - * @returns {ESTree.Node} + * @param {Literal} literalNode + * @param {Node} parentNode + * @param {IStorage} controlFlowStorage + * @returns {Node} */ public replace ( literalNode: ESTree.Literal, @@ -74,9 +74,9 @@ export class StringLiteralControlFlowReplacer extends AbstractControlFlowReplace } /** - * @param controlFlowStorageId - * @param storageKey - * @returns {ESTree.Node} + * @param {string} controlFlowStorageId + * @param {string} storageKey + * @returns {Node} */ protected getControlFlowStorageCallNode ( controlFlowStorageId: string, diff --git a/src/node-transformers/converting-transformers/MemberExpressionTransformer.ts b/src/node-transformers/converting-transformers/MemberExpressionTransformer.ts index a2afa9a7..90d0417d 100644 --- a/src/node-transformers/converting-transformers/MemberExpressionTransformer.ts +++ b/src/node-transformers/converting-transformers/MemberExpressionTransformer.ts @@ -15,8 +15,8 @@ import { Node } from '../../node/Node'; @injectable() export class MemberExpressionTransformer extends AbstractNodeTransformer { /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -50,9 +50,9 @@ export class MemberExpressionTransformer extends AbstractNodeTransformer { * * Literal node will be obfuscated by LiteralTransformer * - * @param memberExpressionNode - * @param parentNode - * @returns {ESTree.Node} + * @param {MemberExpression} memberExpressionNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (memberExpressionNode: ESTree.MemberExpression, parentNode: ESTree.Node): ESTree.Node { if (Node.isIdentifierNode(memberExpressionNode.property)) { diff --git a/src/node-transformers/converting-transformers/MethodDefinitionTransformer.ts b/src/node-transformers/converting-transformers/MethodDefinitionTransformer.ts index 34ce7814..4629c301 100644 --- a/src/node-transformers/converting-transformers/MethodDefinitionTransformer.ts +++ b/src/node-transformers/converting-transformers/MethodDefinitionTransformer.ts @@ -29,8 +29,8 @@ export class MethodDefinitionTransformer extends AbstractNodeTransformer { private static readonly ignoredNames: string[] = ['constructor']; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -63,9 +63,9 @@ export class MethodDefinitionTransformer extends AbstractNodeTransformer { * object[identifier] = 1; * Literal node will be obfuscated by LiteralTransformer * - * @param methodDefinitionNode - * @param parentNode - * @returns {ESTree.Node} + * @param {MethodDefinition} methodDefinitionNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (methodDefinitionNode: ESTree.MethodDefinition, parentNode: ESTree.Node): ESTree.Node { if ( diff --git a/src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts b/src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts index d2aaab33..37284e6e 100644 --- a/src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts +++ b/src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts @@ -18,8 +18,8 @@ import { Nodes } from '../../node/Nodes'; @injectable() export class TemplateLiteralTransformer extends AbstractNodeTransformer { /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -29,8 +29,8 @@ export class TemplateLiteralTransformer extends AbstractNodeTransformer { } /** - * @param node - * @return {boolean} + * @param {Node} node + * @returns {boolean} */ private static isLiteralNodeWithStringValue (node: ESTree.Node): boolean { return node && Node.isLiteralNode(node) && typeof node.value === 'string'; @@ -50,9 +50,9 @@ export class TemplateLiteralTransformer extends AbstractNodeTransformer { } /** - * @param templateLiteralNode - * @param parentNode - * @returns {ESTree.Node} + * @param {TemplateLiteral} templateLiteralNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (templateLiteralNode: ESTree.TemplateLiteral, parentNode: ESTree.Node): ESTree.Node { const templateLiteralExpressions: ESTree.Expression[] = templateLiteralNode.expressions; diff --git a/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts b/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts index 72097b69..80f1effb 100644 --- a/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts +++ b/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts @@ -31,8 +31,8 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer { private readonly collectedBlockStatements: ESTree.BlockStatement[] = []; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -55,9 +55,9 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer { } /** - * @param programNode - * @param parentNode - * @returns {ESTree.Node} + * @param {Program} programNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (programNode: ESTree.Program, parentNode: ESTree.Node): ESTree.Node { this.transformProgramNode(programNode); @@ -66,8 +66,8 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer { } /** - * @param blockStatementNode - * @param collectedBlockStatements + * @param {BlockStatement} blockStatementNode + * @param {BlockStatement[]} collectedBlockStatements */ private collectBlockStatementNodes ( blockStatementNode: ESTree.BlockStatement, @@ -121,9 +121,9 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer { } /** - * @param blockStatementNode - * @param randomBlockStatementNode - * @return {ESTree.BlockStatement} + * @param {BlockStatement} blockStatementNode + * @param {BlockStatement} randomBlockStatementNode + * @returns {BlockStatement} */ private replaceBlockStatementNode ( blockStatementNode: ESTree.BlockStatement, @@ -165,7 +165,7 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer { } /** - * @param programNode + * @param {Program} programNode */ private transformProgramNode (programNode: ESTree.Program): void { estraverse.traverse(programNode, { diff --git a/src/node-transformers/obfuscating-transformers/CatchClauseTransformer.ts b/src/node-transformers/obfuscating-transformers/CatchClauseTransformer.ts index dab58dce..9c8df5be 100644 --- a/src/node-transformers/obfuscating-transformers/CatchClauseTransformer.ts +++ b/src/node-transformers/obfuscating-transformers/CatchClauseTransformer.ts @@ -32,9 +32,9 @@ export class CatchClauseTransformer extends AbstractNodeTransformer { private readonly identifierObfuscatingReplacer: IIdentifierObfuscatingReplacer; /** - * @param identifierObfuscatingReplacerFactory - * @param randomGenerator - * @param options + * @param {TIdentifierObfuscatingReplacerFactory} identifierObfuscatingReplacerFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer) @@ -63,9 +63,9 @@ export class CatchClauseTransformer extends AbstractNodeTransformer { } /** - * @param catchClauseNode - * @param parentNode - * @returns {ESTree.Node} + * @param {CatchClause} catchClauseNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (catchClauseNode: ESTree.CatchClause, parentNode: ESTree.Node): ESTree.Node { const nodeIdentifier: number = this.nodeIdentifier++; @@ -77,8 +77,8 @@ export class CatchClauseTransformer extends AbstractNodeTransformer { } /** - * @param catchClauseNode - * @param nodeIdentifier + * @param {CatchClause} catchClauseNode + * @param {number} nodeIdentifier */ private storeCatchClauseParam (catchClauseNode: ESTree.CatchClause, nodeIdentifier: number): void { if (Node.isIdentifierNode(catchClauseNode.param)) { @@ -87,8 +87,8 @@ export class CatchClauseTransformer extends AbstractNodeTransformer { } /** - * @param catchClauseNode - * @param nodeIdentifier + * @param {CatchClause} catchClauseNode + * @param {number} nodeIdentifier */ private replaceCatchClauseParam (catchClauseNode: ESTree.CatchClause, nodeIdentifier: number): void { estraverse.replace(catchClauseNode, { diff --git a/src/node-transformers/obfuscating-transformers/FunctionDeclarationTransformer.ts b/src/node-transformers/obfuscating-transformers/FunctionDeclarationTransformer.ts index 6aadde1e..d198f529 100644 --- a/src/node-transformers/obfuscating-transformers/FunctionDeclarationTransformer.ts +++ b/src/node-transformers/obfuscating-transformers/FunctionDeclarationTransformer.ts @@ -41,9 +41,9 @@ export class FunctionDeclarationTransformer extends AbstractNodeTransformer { private readonly replaceableIdentifiers: Map = new Map(); /** - * @param identifierObfuscatingReplacerFactory - * @param randomGenerator - * @param options + * @param {TIdentifierObfuscatingReplacerFactory} identifierObfuscatingReplacerFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer) @@ -72,9 +72,9 @@ export class FunctionDeclarationTransformer extends AbstractNodeTransformer { } /** - * @param functionDeclarationNode - * @param parentNode - * @returns {ESTree.Node} + * @param {FunctionDeclaration} functionDeclarationNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (functionDeclarationNode: ESTree.FunctionDeclaration, parentNode: ESTree.Node): ESTree.Node { const nodeIdentifier: number = this.nodeIdentifier++; @@ -98,16 +98,16 @@ export class FunctionDeclarationTransformer extends AbstractNodeTransformer { } /** - * @param functionDeclarationNode - * @param nodeIdentifier + * @param {FunctionDeclaration} functionDeclarationNode + * @param {number} nodeIdentifier */ private storeFunctionName (functionDeclarationNode: ESTree.FunctionDeclaration, nodeIdentifier: number): void { this.identifierObfuscatingReplacer.storeNames(functionDeclarationNode.id.name, nodeIdentifier); } /** - * @param scopeNode - * @param nodeIdentifier + * @param {Node} scopeNode + * @param {number} nodeIdentifier */ private replaceScopeCachedIdentifiers (scopeNode: ESTree.Node, nodeIdentifier: number): void { const cachedReplaceableIdentifiers: ESTree.Identifier[] = this.replaceableIdentifiers.get(scopeNode); @@ -120,8 +120,8 @@ export class FunctionDeclarationTransformer extends AbstractNodeTransformer { } /** - * @param scopeNode - * @param nodeIdentifier + * @param {Node} scopeNode + * @param {number} nodeIdentifier */ private replaceScopeIdentifiers (scopeNode: ESTree.Node, nodeIdentifier: number): void { const storedReplaceableIdentifiers: ESTree.Identifier[] = []; diff --git a/src/node-transformers/obfuscating-transformers/FunctionTransformer.ts b/src/node-transformers/obfuscating-transformers/FunctionTransformer.ts index 592df94d..89252bf3 100644 --- a/src/node-transformers/obfuscating-transformers/FunctionTransformer.ts +++ b/src/node-transformers/obfuscating-transformers/FunctionTransformer.ts @@ -32,9 +32,9 @@ export class FunctionTransformer extends AbstractNodeTransformer { private readonly identifierObfuscatingReplacer: IIdentifierObfuscatingReplacer; /** - * @param identifierObfuscatingReplacerFactory - * @param randomGenerator - * @param options + * @param {TIdentifierObfuscatingReplacerFactory} identifierObfuscatingReplacerFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer) @@ -67,9 +67,9 @@ export class FunctionTransformer extends AbstractNodeTransformer { } /** - * @param functionNode - * @param parentNode - * @returns {ESTree.Node} + * @param {Function} functionNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (functionNode: ESTree.Function, parentNode: ESTree.Node): ESTree.Node { const nodeIdentifier: number = this.nodeIdentifier++; @@ -81,8 +81,8 @@ export class FunctionTransformer extends AbstractNodeTransformer { } /** - * @param functionNode - * @param nodeIdentifier + * @param {Function} functionNode + * @param {number} nodeIdentifier */ private storeFunctionParams (functionNode: ESTree.Function, nodeIdentifier: number): void { functionNode.params @@ -108,8 +108,8 @@ export class FunctionTransformer extends AbstractNodeTransformer { } /** - * @param functionNode - * @param nodeIdentifier + * @param {Function} functionNode + * @param {number} nodeIdentifier */ private replaceFunctionParams (functionNode: ESTree.Function, nodeIdentifier: number): void { const replaceVisitor: estraverse.Visitor = { diff --git a/src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts b/src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts index 1b7474d2..e2aea546 100644 --- a/src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts +++ b/src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts @@ -40,9 +40,9 @@ export class LabeledStatementTransformer extends AbstractNodeTransformer { private readonly identifierObfuscatingReplacer: IIdentifierObfuscatingReplacer; /** - * @param identifierObfuscatingReplacerFactory - * @param randomGenerator - * @param options + * @param {TIdentifierObfuscatingReplacerFactory} identifierObfuscatingReplacerFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer) @@ -71,9 +71,9 @@ export class LabeledStatementTransformer extends AbstractNodeTransformer { } /** - * @param labeledStatementNode - * @param parentNode - * @returns {ESTree.Node} + * @param {LabeledStatement} labeledStatementNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (labeledStatementNode: ESTree.LabeledStatement, parentNode: ESTree.Node): ESTree.Node { const nodeIdentifier: number = this.nodeIdentifier++; @@ -85,16 +85,16 @@ export class LabeledStatementTransformer extends AbstractNodeTransformer { } /** - * @param labeledStatementNode - * @param nodeIdentifier + * @param {LabeledStatement} labeledStatementNode + * @param {number} nodeIdentifier */ private storeLabeledStatementName (labeledStatementNode: ESTree.LabeledStatement, nodeIdentifier: number): void { this.identifierObfuscatingReplacer.storeNames(labeledStatementNode.label.name, nodeIdentifier); } /** - * @param labeledStatementNode - * @param nodeIdentifier + * @param {LabeledStatement} labeledStatementNode + * @param {number} nodeIdentifier */ private replaceLabeledStatementName (labeledStatementNode: ESTree.LabeledStatement, nodeIdentifier: number): void { estraverse.replace(labeledStatementNode, { diff --git a/src/node-transformers/obfuscating-transformers/LiteralTransformer.ts b/src/node-transformers/obfuscating-transformers/LiteralTransformer.ts index 9cd181c0..dce4b1d2 100644 --- a/src/node-transformers/obfuscating-transformers/LiteralTransformer.ts +++ b/src/node-transformers/obfuscating-transformers/LiteralTransformer.ts @@ -22,9 +22,9 @@ export class LiteralTransformer extends AbstractNodeTransformer { private readonly literalObfuscatingReplacerFactory: TLiteralObfuscatingReplacerFactory; /** - * @param literalObfuscatingReplacerFactory - * @param randomGenerator - * @param options + * @param {TLiteralObfuscatingReplacerFactory} literalObfuscatingReplacerFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IObfuscatingReplacer) @@ -51,9 +51,9 @@ export class LiteralTransformer extends AbstractNodeTransformer { } /** - * @param literalNode - * @param parentNode - * @returns {ESTree.Node} + * @param {Literal} literalNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (literalNode: ESTree.Literal, parentNode: ESTree.Node): ESTree.Node { if (Node.isPropertyNode(parentNode) && parentNode.key === literalNode) { diff --git a/src/node-transformers/obfuscating-transformers/ObjectExpressionTransformer.ts b/src/node-transformers/obfuscating-transformers/ObjectExpressionTransformer.ts index 9e1e667a..4d506e7e 100644 --- a/src/node-transformers/obfuscating-transformers/ObjectExpressionTransformer.ts +++ b/src/node-transformers/obfuscating-transformers/ObjectExpressionTransformer.ts @@ -22,8 +22,8 @@ import { Node } from '../../node/Node'; @injectable() export class ObjectExpressionTransformer extends AbstractNodeTransformer { /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -33,8 +33,8 @@ export class ObjectExpressionTransformer extends AbstractNodeTransformer { } /** - * @param node - * @returns {ESTree.Literal} + * @param {Identifier} node + * @returns {Literal} */ private static transformIdentifierPropertyKey (node: ESTree.Identifier): ESTree.Literal { return { @@ -58,9 +58,9 @@ export class ObjectExpressionTransformer extends AbstractNodeTransformer { } /** - * @param objectExpressionNode - * @param parentNode - * @returns {ESTree.Node} + * @param {ObjectExpression} objectExpressionNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (objectExpressionNode: ESTree.ObjectExpression, parentNode: ESTree.Node): ESTree.Node { objectExpressionNode.properties diff --git a/src/node-transformers/obfuscating-transformers/VariableDeclarationTransformer.ts b/src/node-transformers/obfuscating-transformers/VariableDeclarationTransformer.ts index 5c9613f0..53568589 100644 --- a/src/node-transformers/obfuscating-transformers/VariableDeclarationTransformer.ts +++ b/src/node-transformers/obfuscating-transformers/VariableDeclarationTransformer.ts @@ -42,9 +42,9 @@ export class VariableDeclarationTransformer extends AbstractNodeTransformer { private readonly replaceableIdentifiers: Map = new Map(); /** - * @param identifierObfuscatingReplacerFactory - * @param randomGenerator - * @param options + * @param {TIdentifierObfuscatingReplacerFactory} identifierObfuscatingReplacerFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer) @@ -73,9 +73,9 @@ export class VariableDeclarationTransformer extends AbstractNodeTransformer { } /** - * @param variableDeclarationNode - * @param parentNode - * @returns {ESTree.Node} + * @param {VariableDeclaration} variableDeclarationNode + * @param {Node} parentNode + * @returns {Node} */ public transformNode (variableDeclarationNode: ESTree.VariableDeclaration, parentNode: ESTree.Node): ESTree.Node { const blockScopeOfVariableDeclarationNode: TNodeWithBlockStatement = NodeUtils @@ -103,8 +103,8 @@ export class VariableDeclarationTransformer extends AbstractNodeTransformer { } /** - * @param variableDeclarationNode - * @param nodeIdentifier + * @param {VariableDeclaration} variableDeclarationNode + * @param {number} nodeIdentifier */ private storeVariableNames (variableDeclarationNode: ESTree.VariableDeclaration, nodeIdentifier: number): void { variableDeclarationNode.declarations @@ -120,8 +120,8 @@ export class VariableDeclarationTransformer extends AbstractNodeTransformer { } /** - * @param scopeNode - * @param nodeIdentifier + * @param {Node} scopeNode + * @param {number} nodeIdentifier */ private replaceScopeCachedIdentifiers (scopeNode: ESTree.Node, nodeIdentifier: number): void { const cachedReplaceableIdentifiers: ESTree.Identifier[] = this.replaceableIdentifiers.get(scopeNode); @@ -134,8 +134,8 @@ export class VariableDeclarationTransformer extends AbstractNodeTransformer { } /** - * @param scopeNode - * @param nodeIdentifier + * @param {Node} scopeNode + * @param {number} nodeIdentifier */ private replaceScopeIdentifiers (scopeNode: ESTree.Node, nodeIdentifier: number): void { const storedReplaceableIdentifiers: ESTree.Identifier[] = []; diff --git a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts index c938b623..c307ae99 100644 --- a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts +++ b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts @@ -14,7 +14,7 @@ export abstract class AbstractObfuscatingReplacer implements IObfuscatingReplace protected readonly options: IOptions; /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -23,9 +23,9 @@ export abstract class AbstractObfuscatingReplacer implements IObfuscatingReplace } /** - * @param nodeValue - * @param nodeIdentifier - * @returns {ESTree.Node} + * @param {any} nodeValue + * @param {number} nodeIdentifier + * @returns {Node} */ public abstract replace (nodeValue: any, nodeIdentifier?: number): ESTree.Node; } diff --git a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts index 131d6df5..02d49dc9 100644 --- a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts +++ b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts @@ -23,8 +23,8 @@ export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplac private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator - * @param options + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator, @@ -36,9 +36,9 @@ export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplac } /** - * @param nodeValue - * @param nodeIdentifier - * @returns {ESTree.Identifier} + * @param {string} nodeValue + * @param {number} nodeIdentifier + * @returns {Identifier} */ public replace (nodeValue: string, nodeIdentifier: number): ESTree.Identifier { const mapKey: string = `${nodeValue}-${String(nodeIdentifier)}`; @@ -54,8 +54,8 @@ export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplac * Store all `nodeIdentifier`'s as keys in given `namesMap` with random names as value. * Reserved names will be ignored. * - * @param nodeName - * @param nodeIdentifier + * @param {string} nodeName + * @param {number} nodeIdentifier */ public storeNames (nodeName: string, nodeIdentifier: number): void { if (!this.isReservedName(nodeName)) { @@ -64,7 +64,7 @@ export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplac } /** - * @param name + * @param {string} name * @returns {boolean} */ private isReservedName (name: string): boolean { diff --git a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/BooleanLiteralObfuscatingReplacer.ts b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/BooleanLiteralObfuscatingReplacer.ts index d68a8a81..3bce7728 100644 --- a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/BooleanLiteralObfuscatingReplacer.ts +++ b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/BooleanLiteralObfuscatingReplacer.ts @@ -11,7 +11,7 @@ import { Nodes } from '../../../../node/Nodes'; @injectable() export class BooleanLiteralObfuscatingReplacer extends AbstractObfuscatingReplacer { /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -40,8 +40,8 @@ export class BooleanLiteralObfuscatingReplacer extends AbstractObfuscatingReplac } /** - * @param nodeValue - * @returns {ESTree.Node} + * @param {boolean} nodeValue + * @returns {Node} */ public replace (nodeValue: boolean): ESTree.Node { return nodeValue diff --git a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/NumberLiteralObfuscatingReplacer.ts b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/NumberLiteralObfuscatingReplacer.ts index 097c723d..665edc65 100644 --- a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/NumberLiteralObfuscatingReplacer.ts +++ b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/NumberLiteralObfuscatingReplacer.ts @@ -17,7 +17,7 @@ export class NumberLiteralObfuscatingReplacer extends AbstractObfuscatingReplace private readonly numberLiteralCache: Map = new Map(); /** - * @param options + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.IOptions) options: IOptions @@ -26,8 +26,8 @@ export class NumberLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param nodeValue - * @returns {ESTree.Node} + * @param {number} nodeValue + * @returns {Node} */ public replace (nodeValue: number): ESTree.Node { let rawValue: string; diff --git a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts index 2940f320..897d943b 100644 --- a/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts +++ b/src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts @@ -76,12 +76,12 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace private readonly stringArrayStorage: IStorage; /** - * @param customNodeGroupStorage - * @param stringArrayStorage - * @param escapeSequenceEncoder - * @param randomGenerator - * @param cryptUtils - * @param options + * @param {IStorage} customNodeGroupStorage + * @param {IStorage} stringArrayStorage + * @param {IEscapeSequenceEncoder} escapeSequenceEncoder + * @param {IRandomGenerator} randomGenerator + * @param {ICryptUtils} cryptUtils + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.TCustomNodeGroupStorage) customNodeGroupStorage: IStorage, @@ -91,7 +91,9 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace @inject(ServiceIdentifiers.ICryptUtils) cryptUtils: ICryptUtils, @inject(ServiceIdentifiers.IOptions) options: IOptions ) { - super(options); + super( + options + ); this.customNodeGroupStorage = customNodeGroupStorage; this.stringArrayStorage = stringArrayStorage; @@ -109,8 +111,8 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param hexadecimalIndex - * @return {ESTree.Literal} + * @param {string} hexadecimalIndex + * @returns {Literal} */ private static getHexadecimalLiteralNode (hexadecimalIndex: string): ESTree.Literal { const hexadecimalLiteralNode: ESTree.Literal = Nodes.getLiteralNode(hexadecimalIndex); @@ -121,8 +123,8 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param literalValue - * @return {ESTree.Literal} + * @param {string} literalValue + * @returns {Literal} */ private static getRc4KeyLiteralNode (literalValue: string): ESTree.Literal { const rc4KeyLiteralNode: ESTree.Literal = Nodes.getLiteralNode(literalValue); @@ -133,8 +135,8 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param nodeValue - * @returns {ESTree.Node} + * @param {string} nodeValue + * @returns {Node} */ public replace (nodeValue: string): ESTree.Node { const useStringArray: boolean = this.canUseStringArray(nodeValue); @@ -155,8 +157,8 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param nodeValue - * @return {boolean} + * @param {string} nodeValue + * @returns {boolean} */ private canUseStringArray (nodeValue: string): boolean { return ( @@ -167,9 +169,9 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param value - * @param stringArrayStorageLength - * @return {IStringArrayIndexData} + * @param {string} value + * @param {number} stringArrayStorageLength + * @returns {IStringArrayIndexData} */ private getStringArrayHexadecimalIndex (value: string, stringArrayStorageLength: number): IStringArrayIndexData { if (this.stringLiteralHexadecimalIndexCache.has(value)) { @@ -191,7 +193,7 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param value + * @param {string} value * @returns {IEncodedValue} */ private getEncodedValue (value: string): IEncodedValue { @@ -218,8 +220,8 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param value - * @return {ESTree.Literal} + * @param {string} value + * @returns {Node} */ private replaceWithLiteralNode (value: string): ESTree.Node { return Nodes.getLiteralNode( @@ -228,8 +230,8 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace } /** - * @param value - * @returns {ESTree.Node} + * @param {string} value + * @returns {Node} */ private replaceWithStringArrayCallNode (value: string): ESTree.Node { const { encodedValue, key }: IEncodedValue = this.getEncodedValue(value); diff --git a/src/node/Node.ts b/src/node/Node.ts index 060c7fdf..034b3c43 100644 --- a/src/node/Node.ts +++ b/src/node/Node.ts @@ -6,7 +6,7 @@ import { NodeType } from '../enums/NodeType'; export class Node { /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isArrowFunctionExpressionNode (node: ESTree.Node): node is ESTree.ArrowFunctionExpression { @@ -14,7 +14,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isAssignmentPatternNode (node: ESTree.Node): node is ESTree.AssignmentPattern { @@ -22,7 +22,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isBlockStatementNode (node: ESTree.Node): node is ESTree.BlockStatement { @@ -30,7 +30,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isBreakStatementNode (node: ESTree.Node): node is ESTree.BreakStatement { @@ -38,7 +38,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isCallExpressionNode (node: ESTree.Node): node is ESTree.CallExpression { @@ -46,7 +46,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isCatchClauseNode (node: ESTree.Node): node is ESTree.CatchClause { @@ -54,7 +54,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isContinueStatementNode (node: ESTree.Node): node is ESTree.ContinueStatement { @@ -62,7 +62,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isExpressionStatementNode (node: ESTree.Node): node is ESTree.ExpressionStatement { @@ -70,7 +70,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isFunctionDeclarationNode (node: ESTree.Node): node is ESTree.FunctionDeclaration { @@ -78,7 +78,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isFunctionExpressionNode (node: ESTree.Node): node is ESTree.FunctionExpression { @@ -86,7 +86,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isIdentifierNode (node: ESTree.Node): node is ESTree.Identifier { @@ -94,7 +94,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isIfStatementNode (node: ESTree.Node): node is ESTree.IfStatement { @@ -102,8 +102,8 @@ export class Node { } /** - * @param node - * @param parentNode + * @param {Node} node + * @param {Node} parentNode * @returns {boolean} */ public static isLabelIdentifierNode (node: ESTree.Node, parentNode: ESTree.Node): node is ESTree.Identifier { @@ -115,7 +115,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isLabeledStatementNode (node: ESTree.Node): node is ESTree.LabeledStatement { @@ -123,7 +123,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isLiteralNode (node: ESTree.Node): node is ESTree.Literal { @@ -131,7 +131,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isMemberExpressionNode (node: ESTree.Node): node is ESTree.MemberExpression { @@ -139,7 +139,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isMethodDefinitionNode (node: ESTree.Node): node is ESTree.MethodDefinition { @@ -147,7 +147,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isObjectPatternNode (node: ESTree.Node): node is ESTree.ObjectPattern { @@ -155,7 +155,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isObjectExpressionNode (node: ESTree.Node): node is ESTree.ObjectExpression { @@ -163,8 +163,7 @@ export class Node { } /** - * - * @param node + * @param {Node} node * @returns {boolean} */ public static isProgramNode (node: ESTree.Node): node is ESTree.Program { @@ -172,8 +171,7 @@ export class Node { } /** - * - * @param node + * @param {Node} node * @returns {boolean} */ public static isPropertyNode (node: ESTree.Node): node is ESTree.Property { @@ -181,8 +179,8 @@ export class Node { } /** - * @param node - * @param parentNode + * @param {Node} node + * @param {Node} parentNode * @returns {boolean} */ public static isReplaceableIdentifierNode (node: ESTree.Node, parentNode: ESTree.Node): node is ESTree.Identifier { @@ -201,8 +199,7 @@ export class Node { } /** - * - * @param node + * @param {Node} node * @returns {boolean} */ public static isTemplateLiteralNode (node: ESTree.Node): node is ESTree.TemplateLiteral { @@ -210,8 +207,7 @@ export class Node { } /** - * - * @param node + * @param {Node} node * @returns {boolean} */ public static isUnaryExpressionNode (node: ESTree.Node): node is ESTree.UnaryExpression { @@ -219,8 +215,7 @@ export class Node { } /** - * - * @param node + * @param {Node} node * @returns {boolean} */ public static isVariableDeclarationNode (node: ESTree.Node): node is ESTree.VariableDeclaration { @@ -228,8 +223,7 @@ export class Node { } /** - * - * @param node + * @param {Node} node * @returns {boolean} */ public static isVariableDeclaratorNode (node: ESTree.Node): node is ESTree.VariableDeclarator { @@ -237,7 +231,7 @@ export class Node { } /** - * @param node + * @param {Node} node * @returns {boolean} */ public static isNodeHasBlockStatement (node: ESTree.Node): node is TNodeWithBlockStatement { diff --git a/src/node/NodeAppender.ts b/src/node/NodeAppender.ts index 1775c9e7..bbe5d0ac 100644 --- a/src/node/NodeAppender.ts +++ b/src/node/NodeAppender.ts @@ -24,8 +24,8 @@ import { IStackTraceData } from '../interfaces/stack-trace-analyzer/IStackTraceD */ export class NodeAppender { /** - * @param blockScopeNode - * @param nodeBodyStatements + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {TStatement[]} nodeBodyStatements */ public static appendNode ( blockScopeNode: TNodeWithBlockStatement, @@ -44,10 +44,10 @@ export class NodeAppender { } /** - * @param blockScopeStackTraceData - * @param blockScopeNode - * @param nodeBodyStatements - * @param index + * @param {IStackTraceData[]} blockScopeStackTraceData + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {TStatement[]} nodeBodyStatements + * @param {number} index */ public static appendNodeToOptimalBlockScope ( blockScopeStackTraceData: IStackTraceData[], @@ -72,10 +72,10 @@ export class NodeAppender { /** * Returns deepest block scope node at given deep. * - * @param blockScopeTraceData - * @param index - * @param deep - * @returns {ESTree.BlockStatement} + * @param {IStackTraceData[]} blockScopeTraceData + * @param {number} index + * @param {number} deep + * @returns {BlockStatement} */ public static getOptimalBlockScope ( blockScopeTraceData: IStackTraceData[], @@ -96,9 +96,9 @@ export class NodeAppender { } /** - * @param blockScopeNode - * @param nodeBodyStatements - * @param index + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {TStatement[]} nodeBodyStatements + * @param {number} index */ public static insertNodeAtIndex ( blockScopeNode: TNodeWithBlockStatement, @@ -119,8 +119,8 @@ export class NodeAppender { } /** - * @param blockScopeNode - * @param nodeBodyStatements + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {TStatement[]} nodeBodyStatements */ public static prependNode ( blockScopeNode: TNodeWithBlockStatement, @@ -139,8 +139,9 @@ export class NodeAppender { } /** - * @param blockScopeNode - * @param nodeBodyStatements + * @param {TNodeWithBlockStatement} blockScopeNode + * @param {TStatement[]} nodeBodyStatements + * @returns {TStatement[]} */ private static parentizeBodyStatementsBeforeAppend ( blockScopeNode: TNodeWithBlockStatement, @@ -154,7 +155,7 @@ export class NodeAppender { } /** - * @param nodeBodyStatements + * @param {TStatement[]} nodeBodyStatements * @returns {boolean} */ private static validateBodyStatements (nodeBodyStatements: TStatement[]): boolean { diff --git a/src/node/NodeUtils.ts b/src/node/NodeUtils.ts index 9799f336..ededd2c2 100644 --- a/src/node/NodeUtils.ts +++ b/src/node/NodeUtils.ts @@ -24,8 +24,8 @@ export class NodeUtils { ]; /** - * @param astTree - * @return {T} + * @param {T} astTree + * @returns {T} */ public static addXVerbatimPropertyToLiterals (astTree: T): T { NodeUtils.typedReplace(astTree, NodeType.Literal, { @@ -41,8 +41,8 @@ export class NodeUtils { } /** - * @param astTree - * @return {ESTree.Node} + * @param {T} astTree + * @returns {T} */ public static clone (astTree: T): T { const cloneRecursive: (node: T) => T = (node: T) => { @@ -76,7 +76,7 @@ export class NodeUtils { } /** - * @param code + * @param {string} code * @returns {TStatement[]} */ public static convertCodeToStructure (code: string): TStatement[] { @@ -89,7 +89,7 @@ export class NodeUtils { } /** - * @param structure + * @param {Node[]} structure * @returns {string} */ public static convertStructureToCode (structure: ESTree.Node[]): string { @@ -105,9 +105,9 @@ export class NodeUtils { } /** - * @param node - * @param index - * @returns {ESTree.Node} + * @param {Node} node + * @param {number} index + * @returns {Node} */ public static getBlockStatementNodeByIndex (node: ESTree.Node, index: number = 0): ESTree.Node { if (Node.isNodeHasBlockStatement(node)) { @@ -122,9 +122,9 @@ export class NodeUtils { } /** - * @param node - * @param blockScopes - * @returns {ESTree.Node} + * @param {Node} node + * @param {TNodeWithBlockStatement[]} blockScopes + * @returns {TNodeWithBlockStatement[]} */ public static getBlockScopesOfNode (node: ESTree.Node, blockScopes: TNodeWithBlockStatement[] = []): TNodeWithBlockStatement[] { const parentNode: ESTree.Node | undefined = node.parentNode; @@ -153,8 +153,8 @@ export class NodeUtils { } /** - * @param node - * @param depth + * @param {Node} node + * @param {number} depth * @returns {number} */ public static getNodeBlockScopeDepth (node: ESTree.Node, depth: number = 0): number { @@ -176,8 +176,8 @@ export class NodeUtils { } /** - * @param unaryExpressionNode - * @returns {ESTree.Node} + * @param {UnaryExpression} unaryExpressionNode + * @returns {Node} */ public static getUnaryExpressionArgumentNode (unaryExpressionNode: ESTree.UnaryExpression): ESTree.Node { if (Node.isUnaryExpressionNode(unaryExpressionNode.argument)) { @@ -188,8 +188,8 @@ export class NodeUtils { } /** - * @param astTree - * @return {T} + * @param {T} astTree + * @returns {T} */ public static parentize (astTree: T): T { let isRootNode: boolean = true; @@ -220,9 +220,9 @@ export class NodeUtils { } /** - * @param astTree - * @param nodeType - * @param visitor + * @param {Node} astTree + * @param {string} nodeType + * @param {visitor} visitor */ public static typedReplace ( astTree: ESTree.Node, @@ -233,10 +233,10 @@ export class NodeUtils { } /** - * @param astTree - * @param nodeType - * @param visitor - * @param traverseType + * @param {Node} astTree + * @param {string} nodeType + * @param {Visitor} visitor + * @param {string} traverseType */ public static typedTraverse ( astTree: ESTree.Node, diff --git a/src/node/Nodes.ts b/src/node/Nodes.ts index 86ce12cf..382cb0bd 100644 --- a/src/node/Nodes.ts +++ b/src/node/Nodes.ts @@ -7,8 +7,8 @@ import { NodeType } from '../enums/NodeType'; export class Nodes { /** - * @param body - * @returns {ESTree.Program} + * @param {TStatement[]} body + * @returns {Program} */ public static getProgramNode (body: TStatement[] = []): ESTree.Program { return { @@ -20,8 +20,8 @@ export class Nodes { } /** - * @param elements - * @return {ESTree.ArrayExpression} + * @param {(Expression | SpreadElement)[]} elements + * @returns {ArrayExpression} */ public static getArrayExpressionNode ( elements: (ESTree.Expression | ESTree.SpreadElement)[] = [] @@ -33,10 +33,10 @@ export class Nodes { } /** - * @param operator - * @param left - * @param right - * @return {ESTree.AssignmentExpression} + * @param {AssignmentOperator} operator + * @param {Pattern | MemberExpression} left + * @param {Expression} right + * @returns {AssignmentExpression} */ public static getAssignmentExpressionNode ( operator: ESTree.AssignmentOperator, @@ -53,10 +53,10 @@ export class Nodes { } /** - * @param operator - * @param left - * @param right - * @returns {ESTree.BinaryExpression} + * @param {BinaryOperator} operator + * @param {Expression} left + * @param {Expression} right + * @returns {BinaryExpression} */ public static getBinaryExpressionNode ( operator: ESTree.BinaryOperator, @@ -73,8 +73,8 @@ export class Nodes { } /** - * @param body - * @returns {ESTree.BlockStatement} + * @param {Statement[]} body + * @returns {BlockStatement} */ public static getBlockStatementNode (body: ESTree.Statement[] = []): ESTree.BlockStatement { return { @@ -85,8 +85,8 @@ export class Nodes { } /** - * @param label - * @return {ESTree.BreakStatement} + * @param {Identifier} label + * @returns {BreakStatement} */ public static getBreakStatement (label?: ESTree.Identifier): ESTree.BreakStatement { const breakStatementNode: ESTree.BreakStatement = { @@ -102,8 +102,8 @@ export class Nodes { } /** - * @param body - * @returns {ESTree.CatchClause} + * @param {Statement[]} body + * @returns {CatchClause} */ public static getCatchClauseNode (body: ESTree.Statement[] = []): ESTree.CatchClause { return { @@ -115,9 +115,9 @@ export class Nodes { } /** - * @param callee - * @param args - * @returns {ESTree.CallExpression} + * @param {Expression} callee + * @param {(Expression | SpreadElement)[]} args + * @returns {CallExpression} */ public static getCallExpressionNode ( callee: ESTree.Expression, @@ -132,8 +132,8 @@ export class Nodes { } /** - * @param label - * @return {ESTree.ContinueStatement} + * @param {Identifier} label + * @returns {ContinueStatement} */ public static getContinueStatement (label?: ESTree.Identifier): ESTree.ContinueStatement { const continueStatementNode: ESTree.ContinueStatement = { @@ -149,8 +149,8 @@ export class Nodes { } /** - * @param expression - * @returns {ESTree.ExpressionStatement} + * @param {Expression} expression + * @returns {ExpressionStatement} */ public static getExpressionStatementNode (expression: ESTree.Expression): ESTree.ExpressionStatement { return { @@ -161,10 +161,10 @@ export class Nodes { } /** - * @param functionName - * @param params - * @param body - * @returns {ESTree.FunctionDeclaration} + * @param {string} functionName + * @param {Identifier[]} params + * @param {BlockStatement} body + * @returns {FunctionDeclaration} */ public static getFunctionDeclarationNode ( functionName: string, @@ -182,9 +182,9 @@ export class Nodes { } /** - * @param params - * @param body - * @returns {ESTree.FunctionExpression} + * @param {Identifier[]} params + * @param {BlockStatement} body + * @returns {FunctionExpression} */ public static getFunctionExpressionNode ( params: ESTree.Identifier[], @@ -200,10 +200,10 @@ export class Nodes { } /** - * @param test - * @param consequent - * @param alternate - * @returns {ESTree.IfStatement} + * @param {Expression} test + * @param {BlockStatement} consequent + * @param {BlockStatement} alternate + * @returns {IfStatement} */ public static getIfStatementNode ( test: ESTree.Expression, @@ -214,14 +214,14 @@ export class Nodes { type: NodeType.IfStatement, test, consequent, - ...alternate && {alternate}, + ...alternate && { alternate }, obfuscatedNode: false }; } /** - * @param name - * @returns {ESTree.Identifier} + * @param {string} name + * @returns {Identifier} */ public static getIdentifierNode (name: string): ESTree.Identifier { return { @@ -232,9 +232,9 @@ export class Nodes { } /** - * @param label - * @param body - * @returns {ESTree.LabeledStatement} + * @param {Identifier} label + * @param {Statement} body + * @returns {LabeledStatement} */ public static getLabeledStatement (label: ESTree.Identifier, body: ESTree.Statement): ESTree.LabeledStatement { return { @@ -246,9 +246,9 @@ export class Nodes { } /** - * @param value - * @param raw - * @returns {ESTree.Literal} + * @param {boolean | number | string} value + * @param {string} raw + * @returns {Literal} */ public static getLiteralNode (value: boolean|number|string, raw?: string): ESTree.Literal { raw = raw !== undefined ? raw : `'${value}'`; @@ -266,10 +266,10 @@ export class Nodes { } /** - * @param operator - * @param left - * @param right - * @returns {ESTree.LogicalExpression} + * @param {LogicalOperator} operator + * @param {Expression} left + * @param {Expression} right + * @returns {LogicalExpression} */ public static getLogicalExpressionNode ( operator: ESTree.LogicalOperator, @@ -286,10 +286,10 @@ export class Nodes { } /** - * @param object - * @param property - * @param computed - * @return {ESTree.MemberExpression} + * @param {Expression | Super} object + * @param {Expression} property + * @param {boolean} computed + * @returns {MemberExpression} */ public static getMemberExpressionNode ( object: ESTree.Expression | ESTree.Super, @@ -306,8 +306,8 @@ export class Nodes { } /** - * @param properties - * @return {ESTree.ObjectExpression} + * @param {Property[]} properties + * @returns {ObjectExpression} */ public static getObjectExpressionNode (properties: ESTree.Property[]): ESTree.ObjectExpression { return { @@ -318,7 +318,10 @@ export class Nodes { } /** - * @return {ESTree.Property} + * @param {Expression} key + * @param {Expression | Pattern} value + * @param {boolean} computed + * @returns {Property} */ public static getPropertyNode ( key: ESTree.Expression, @@ -338,10 +341,10 @@ export class Nodes { } /** - * @param operator - * @param argument - * @param prefix - * @returns {ESTree.Literal} + * @param {UnaryOperator} operator + * @param {Expression} argument + * @param {boolean} prefix + * @returns {UnaryExpression} */ public static getUnaryExpressionNode ( operator: ESTree.UnaryOperator, @@ -358,8 +361,8 @@ export class Nodes { } /** - * @param argument - * @return {ReturnStatement} + * @param {Expression} argument + * @returns {ReturnStatement} */ public static getReturnStatementNode (argument: ESTree.Expression): ESTree.ReturnStatement { return { @@ -370,9 +373,9 @@ export class Nodes { } /** - * @param discriminant - * @param cases - * @returns {ESTree.SwitchStatement} + * @param {Expression} discriminant + * @param {SwitchCase[]} cases + * @returns {SwitchStatement} */ public static getSwitchStatementNode ( discriminant: ESTree.Expression, @@ -387,9 +390,9 @@ export class Nodes { } /** - * @param test - * @param consequent - * @returns {ESTree.SwitchCase} + * @param {Expression} test + * @param {Statement[]} consequent + * @returns {SwitchCase} */ public static getSwitchCaseNode (test: ESTree.Expression, consequent: ESTree.Statement[]): ESTree.SwitchCase { return { @@ -401,9 +404,9 @@ export class Nodes { } /** - * @param operator - * @param argumentExpr - * @returns {ESTree.UpdateExpression} + * @param {UpdateOperator} operator + * @param {Expression} argumentExpr + * @returns {UpdateExpression} */ public static getUpdateExpressionNode (operator: ESTree.UpdateOperator, argumentExpr: ESTree.Expression): ESTree.UpdateExpression { return { @@ -416,9 +419,9 @@ export class Nodes { } /** - * @param declarations - * @param kind - * @returns {ESTree.VariableDeclaration} + * @param {VariableDeclarator[]} declarations + * @param {string} kind + * @returns {VariableDeclaration} */ public static getVariableDeclarationNode ( declarations: ESTree.VariableDeclarator[] = [], @@ -433,9 +436,9 @@ export class Nodes { } /** - * @param id - * @param init - * @returns {ESTree.VariableDeclarator} + * @param {Identifier} id + * @param {any} init + * @returns {VariableDeclarator} */ public static getVariableDeclaratorNode (id: ESTree.Identifier, init: any): ESTree.VariableDeclarator { return { @@ -447,9 +450,9 @@ export class Nodes { } /** - * @param test - * @param body - * @return {ESTree.WhileStatement} + * @param {Expression} test + * @param {Statement} body + * @returns {WhileStatement} */ public static getWhileStatementNode (test: ESTree.Expression, body: ESTree.Statement): ESTree.WhileStatement { return { diff --git a/src/options/Options.ts b/src/options/Options.ts index 14631282..dda89165 100644 --- a/src/options/Options.ts +++ b/src/options/Options.ts @@ -1,19 +1,19 @@ import { injectable } from 'inversify'; import { -ArrayUnique, -IsBoolean, -IsArray, -IsIn, -IsNumber, -IsString, -IsUrl, -Min, -Max, -ValidateIf, -validateSync, -ValidationError, -ValidatorOptions + ArrayUnique, + IsBoolean, + IsArray, + IsIn, + IsNumber, + IsString, + IsUrl, + Min, + Max, + ValidateIf, + validateSync, + ValidationError, + ValidatorOptions } from 'class-validator'; import { TInputOptions } from '../types/options/TInputOptions'; @@ -189,7 +189,7 @@ export class Options implements IOptions { public readonly unicodeEscapeSequence: boolean; /** - * @param inputOptions + * @param {TInputOptions} inputOptions */ constructor (inputOptions: TInputOptions) { Object.assign(this, DEFAULT_PRESET, inputOptions); diff --git a/src/options/OptionsNormalizer.ts b/src/options/OptionsNormalizer.ts index 548160dd..a9b1c3d1 100644 --- a/src/options/OptionsNormalizer.ts +++ b/src/options/OptionsNormalizer.ts @@ -31,7 +31,7 @@ export class OptionsNormalizer { ]; /** - * @param options + * @param {IOptions} options * @returns {IOptions} */ public static normalizeOptions (options: IOptions): IOptions { diff --git a/src/options/ValidationErrorsFormatter.ts b/src/options/ValidationErrorsFormatter.ts index 52a79a88..b6ebd781 100644 --- a/src/options/ValidationErrorsFormatter.ts +++ b/src/options/ValidationErrorsFormatter.ts @@ -2,7 +2,7 @@ import { ValidationError } from 'class-validator'; export class ValidationErrorsFormatter { /** - * @param validationErrors + * @param {ValidationError[]} validationErrors * @returns {string} */ public static format (validationErrors: ValidationError[]): string { @@ -16,7 +16,7 @@ export class ValidationErrorsFormatter { } /** - * @param validationError + * @param {ValidationError} validationError * @returns {string} */ private static formatError (validationError: ValidationError): string { diff --git a/src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts b/src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts index 0b3869d4..5e888f40 100644 --- a/src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts +++ b/src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts @@ -2,6 +2,10 @@ import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRu import { IOptions } from '../../interfaces/options/IOptions'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const ControlFlowFlatteningThresholdRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { if (options.controlFlowFlatteningThreshold === 0) { options = { diff --git a/src/options/normalizer-rules/DeadCodeInjectionRule.ts b/src/options/normalizer-rules/DeadCodeInjectionRule.ts index eeb058b5..864c87c4 100644 --- a/src/options/normalizer-rules/DeadCodeInjectionRule.ts +++ b/src/options/normalizer-rules/DeadCodeInjectionRule.ts @@ -4,6 +4,10 @@ import { IOptions } from '../../interfaces/options/IOptions'; import { DEFAULT_PRESET } from '../presets/Default'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const DeadCodeInjectionRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { if (options.deadCodeInjection) { options = { diff --git a/src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts b/src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts index 351a7215..b28999ba 100644 --- a/src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts +++ b/src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts @@ -2,6 +2,10 @@ import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRu import { IOptions } from '../../interfaces/options/IOptions'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const DeadCodeInjectionThresholdRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { if (options.deadCodeInjectionThreshold === 0) { options = { diff --git a/src/options/normalizer-rules/DomainLockRule.ts b/src/options/normalizer-rules/DomainLockRule.ts index 05397837..7fa46dc9 100644 --- a/src/options/normalizer-rules/DomainLockRule.ts +++ b/src/options/normalizer-rules/DomainLockRule.ts @@ -4,6 +4,10 @@ import { IOptions } from '../../interfaces/options/IOptions'; import { Utils } from '../../utils/Utils'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const DomainLockRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { if (options.domainLock.length) { const normalizedDomains: string[] = []; diff --git a/src/options/normalizer-rules/SelfDefendingRule.ts b/src/options/normalizer-rules/SelfDefendingRule.ts index 687af386..e2d4ba94 100644 --- a/src/options/normalizer-rules/SelfDefendingRule.ts +++ b/src/options/normalizer-rules/SelfDefendingRule.ts @@ -2,6 +2,10 @@ import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRu import { IOptions } from '../../interfaces/options/IOptions'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const SelfDefendingRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { if (options.selfDefending) { options = { diff --git a/src/options/normalizer-rules/SourceMapBaseUrlRule.ts b/src/options/normalizer-rules/SourceMapBaseUrlRule.ts index 0550d095..41888e0f 100644 --- a/src/options/normalizer-rules/SourceMapBaseUrlRule.ts +++ b/src/options/normalizer-rules/SourceMapBaseUrlRule.ts @@ -2,6 +2,10 @@ import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRu import { IOptions } from '../../interfaces/options/IOptions'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const SourceMapBaseUrlRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { const { sourceMapBaseUrl }: { sourceMapBaseUrl: string } = options; diff --git a/src/options/normalizer-rules/SourceMapFileNameRule.ts b/src/options/normalizer-rules/SourceMapFileNameRule.ts index 3fa22543..86e1b246 100644 --- a/src/options/normalizer-rules/SourceMapFileNameRule.ts +++ b/src/options/normalizer-rules/SourceMapFileNameRule.ts @@ -2,6 +2,10 @@ import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRu import { IOptions } from '../../interfaces/options/IOptions'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const SourceMapFileNameRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { let { sourceMapFileName }: { sourceMapFileName: string } = options; diff --git a/src/options/normalizer-rules/StringArrayEncodingRule.ts b/src/options/normalizer-rules/StringArrayEncodingRule.ts index 47624f7e..bcc828a8 100644 --- a/src/options/normalizer-rules/StringArrayEncodingRule.ts +++ b/src/options/normalizer-rules/StringArrayEncodingRule.ts @@ -2,6 +2,10 @@ import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRu import { IOptions } from '../../interfaces/options/IOptions'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const StringArrayEncodingRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { if (options.stringArrayEncoding === true) { options = { diff --git a/src/options/normalizer-rules/StringArrayRule.ts b/src/options/normalizer-rules/StringArrayRule.ts index 92ca7026..c6664fbb 100644 --- a/src/options/normalizer-rules/StringArrayRule.ts +++ b/src/options/normalizer-rules/StringArrayRule.ts @@ -2,6 +2,10 @@ import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRu import { IOptions } from '../../interfaces/options/IOptions'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const StringArrayRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { if (!options.stringArray) { options = { diff --git a/src/options/normalizer-rules/StringArrayThresholdRule.ts b/src/options/normalizer-rules/StringArrayThresholdRule.ts index 0b69c87b..8cf7bc9c 100644 --- a/src/options/normalizer-rules/StringArrayThresholdRule.ts +++ b/src/options/normalizer-rules/StringArrayThresholdRule.ts @@ -2,6 +2,10 @@ import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRu import { IOptions } from '../../interfaces/options/IOptions'; +/** + * @param {IOptions} options + * @returns {IOptions} + */ export const StringArrayThresholdRule: TOptionsNormalizerRule = (options: IOptions): IOptions => { if (options.stringArrayThreshold === 0) { options = { diff --git a/src/stack-trace-analyzer/StackTraceAnalyzer.ts b/src/stack-trace-analyzer/StackTraceAnalyzer.ts index 07b0bd42..05de24d0 100644 --- a/src/stack-trace-analyzer/StackTraceAnalyzer.ts +++ b/src/stack-trace-analyzer/StackTraceAnalyzer.ts @@ -79,7 +79,7 @@ export class StackTraceAnalyzer implements IStackTraceAnalyzer { } /** - * @param blockScopeBodyLength + * @param {number} blockScopeBodyLength * @returns {number} */ public static getLimitIndex (blockScopeBodyLength: number): number { @@ -102,7 +102,7 @@ export class StackTraceAnalyzer implements IStackTraceAnalyzer { } /** - * @param blockScopeBody + * @param {Node[]} blockScopeBody * @returns {IStackTraceData[]} */ public analyze (blockScopeBody: ESTree.Node[]): IStackTraceData[] { @@ -110,7 +110,7 @@ export class StackTraceAnalyzer implements IStackTraceAnalyzer { } /** - * @param blockScopeBody + * @param {Node[]} blockScopeBody * @returns {IStackTraceData[]} */ private analyzeRecursive (blockScopeBody: ESTree.Node[]): IStackTraceData[] { @@ -144,10 +144,9 @@ export class StackTraceAnalyzer implements IStackTraceAnalyzer { } /** - * @param stackTraceData - * @param blockScopeBody - * @param callExpressionNode - * @returns {IStackTraceData[]} + * @param {IStackTraceData[]} stackTraceData + * @param {Node[]} blockScopeBody + * @param {CallExpression} callExpressionNode */ private analyzeCallExpressionNode ( stackTraceData: IStackTraceData[], diff --git a/src/stack-trace-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts b/src/stack-trace-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts index 3b0d0a28..2fce65dc 100644 --- a/src/stack-trace-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts +++ b/src/stack-trace-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts @@ -8,9 +8,9 @@ import { ICalleeDataExtractor } from '../../interfaces/stack-trace-analyzer/ICal @injectable() export abstract class AbstractCalleeDataExtractor implements ICalleeDataExtractor { /** - * @param blockScopeBody - * @param callee - * @returns {ICalleeData|null} + * @param {Node[]} blockScopeBody + * @param {Node} callee + * @returns {ICalleeData} */ public abstract extract (blockScopeBody: ESTree.Node[], callee: ESTree.Node): ICalleeData|null; } diff --git a/src/stack-trace-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts b/src/stack-trace-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts index 644231b7..d5b74123 100644 --- a/src/stack-trace-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts +++ b/src/stack-trace-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts @@ -12,9 +12,9 @@ import { NodeUtils } from '../../node/NodeUtils'; @injectable() export class FunctionDeclarationCalleeDataExtractor extends AbstractCalleeDataExtractor { /** - * @param blockScopeBody - * @param callee - * @returns {ICalleeData|null} + * @param {Node[]} blockScopeBody + * @param {Identifier} callee + * @returns {ICalleeData} */ public extract (blockScopeBody: ESTree.Node[], callee: ESTree.Identifier): ICalleeData|null { if (!Node.isIdentifierNode(callee)) { @@ -37,9 +37,9 @@ export class FunctionDeclarationCalleeDataExtractor extends AbstractCalleeDataEx } /** - * @param targetNode - * @param name - * @returns {ESTree.BlockStatement|null} + * @param {Node} targetNode + * @param {string} name + * @returns {BlockStatement} */ private getCalleeBlockStatement (targetNode: ESTree.Node, name: string): ESTree.BlockStatement|null { let calleeBlockStatement: ESTree.BlockStatement|null = null; diff --git a/src/stack-trace-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts b/src/stack-trace-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts index ecefa9ae..0900d295 100644 --- a/src/stack-trace-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts +++ b/src/stack-trace-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts @@ -12,9 +12,9 @@ import { NodeUtils } from '../../node/NodeUtils'; @injectable() export class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExtractor { /** - * @param blockScopeBody - * @param callee - * @returns {ICalleeData|null} + * @param {Node[]} blockScopeBody + * @param {Identifier} callee + * @returns {ICalleeData} */ public extract (blockScopeBody: ESTree.Node[], callee: ESTree.Identifier): ICalleeData|null { let calleeBlockStatement: ESTree.BlockStatement|null = null; @@ -41,9 +41,9 @@ export class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExt } /** - * @param targetNode - * @param name - * @returns {ESTree.BlockStatement|null} + * @param {Node} targetNode + * @param {string} name + * @returns {BlockStatement} */ private getCalleeBlockStatement (targetNode: ESTree.Node, name: string): ESTree.BlockStatement|null { let calleeBlockStatement: ESTree.BlockStatement|null = null; diff --git a/src/stack-trace-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts b/src/stack-trace-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts index e8ab4435..79cab610 100644 --- a/src/stack-trace-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts +++ b/src/stack-trace-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts @@ -14,9 +14,9 @@ import { AbstractCalleeDataExtractor } from './AbstractCalleeDataExtractor'; @injectable() export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtractor { /** - * @param blockScopeBody - * @param callee - * @returns {ICalleeData|null} + * @param {Node[]} blockScopeBody + * @param {MemberExpression} callee + * @returns {ICalleeData} */ public extract (blockScopeBody: ESTree.Node[], callee: ESTree.MemberExpression): ICalleeData|null { if (!Node.isMemberExpressionNode(callee)) { @@ -50,8 +50,8 @@ export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtra * * Example: object.foo.bar(); // ['object', 'foo', 'bar'] * - * @param currentChain - * @param memberExpression + * @param {TObjectMembersCallsChain} currentChain + * @param {MemberExpression} memberExpression * @returns {TObjectMembersCallsChain} */ private createObjectMembersCallsChain ( @@ -84,9 +84,9 @@ export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtra } /** - * @param targetNode - * @param objectMembersCallsChain - * @returns {ESTree.BlockStatement|null} + * @param {Node} targetNode + * @param {TObjectMembersCallsChain} objectMembersCallsChain + * @returns {BlockStatement} */ private getCalleeBlockStatement ( targetNode: ESTree.Node, @@ -120,9 +120,9 @@ export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtra } /** - * @param objectExpressionProperties - * @param objectMembersCallsChain - * @returns {ESTree.BlockStatement|null} + * @param {Property[]} objectExpressionProperties + * @param {TObjectMembersCallsChain} objectMembersCallsChain + * @returns {BlockStatement} */ private findCalleeBlockStatement ( objectExpressionProperties: ESTree.Property[], diff --git a/src/storages/ArrayStorage.ts b/src/storages/ArrayStorage.ts index 87da2122..e0d49137 100644 --- a/src/storages/ArrayStorage.ts +++ b/src/storages/ArrayStorage.ts @@ -31,7 +31,7 @@ export abstract class ArrayStorage implements IStorage { private storageLength: number = 0; /** - * @param randomGenerator + * @param {IRandomGenerator} randomGenerator */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator @@ -40,7 +40,7 @@ export abstract class ArrayStorage implements IStorage { } /** - * @param key + * @param {number} key * @returns {T} */ public get (key: number): T { @@ -54,8 +54,8 @@ export abstract class ArrayStorage implements IStorage { } /** - * @param value - * @returns {number | null} + * @param {T} value + * @returns {number} */ public getKeyOf (value: T): number | null { const key: number = this.storage.indexOf(value); @@ -85,7 +85,7 @@ export abstract class ArrayStorage implements IStorage { } /** - * @param args + * @param {any[]} args */ public initialize (...args: any[]): void { this.storage = []; @@ -93,8 +93,8 @@ export abstract class ArrayStorage implements IStorage { } /** - * @param storage - * @param mergeId + * @param {this} storage + * @param {boolean} mergeId */ public mergeWith (storage: this, mergeId: boolean = false): void { this.storage = [...this.storage, ...storage.getStorage()]; @@ -105,8 +105,8 @@ export abstract class ArrayStorage implements IStorage { } /** - * @param key - * @param value + * @param {number} key + * @param {T} value */ public set (key: number, value: T): void { if (key === this.storageLength) { diff --git a/src/storages/MapStorage.ts b/src/storages/MapStorage.ts index 32b10a18..b36278dd 100644 --- a/src/storages/MapStorage.ts +++ b/src/storages/MapStorage.ts @@ -26,7 +26,7 @@ export abstract class MapStorage implements IStorage { protected storage: Map ; /** - * @param randomGenerator + * @param {IRandomGenerator} randomGenerator */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator @@ -35,7 +35,7 @@ export abstract class MapStorage implements IStorage { } /** - * @param key + * @param {string | number} key * @returns {T} */ public get (key: string | number): T { @@ -49,7 +49,7 @@ export abstract class MapStorage implements IStorage { } /** - * @param value + * @param {T} value * @returns {string | number | null} */ public getKeyOf (value: T): string | number | null { @@ -84,19 +84,19 @@ export abstract class MapStorage implements IStorage { } /** - * @param args + * @param {any[]} args */ public initialize (...args: any[]): void { - this.storage = new Map (); + this.storage = new Map (); this.storageId = this.randomGenerator.getRandomString(6); } /** - * @param storage - * @param mergeId + * @param {this} storage + * @param {boolean} mergeId */ public mergeWith (storage: this, mergeId: boolean = false): void { - this.storage = new Map ([...this.storage, ...storage.getStorage()]); + this.storage = new Map ([...this.storage, ...storage.getStorage()]); if (mergeId) { this.storageId = storage.getStorageId(); @@ -104,8 +104,8 @@ export abstract class MapStorage implements IStorage { } /** - * @param key - * @param value + * @param {string | number} key + * @param {T} value */ public set (key: string | number, value: T): void { this.storage.set(key, value); diff --git a/src/storages/control-flow/ControlFlowStorage.ts b/src/storages/control-flow/ControlFlowStorage.ts index e8394ad3..aad76fb8 100644 --- a/src/storages/control-flow/ControlFlowStorage.ts +++ b/src/storages/control-flow/ControlFlowStorage.ts @@ -9,7 +9,7 @@ import { MapStorage } from '../MapStorage'; @injectable() export class ControlFlowStorage extends MapStorage { /** - * @param randomGenerator + * @param {IRandomGenerator} randomGenerator */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator diff --git a/src/storages/custom-node-group/CustomNodeGroupStorage.ts b/src/storages/custom-node-group/CustomNodeGroupStorage.ts index b35e8426..38107982 100644 --- a/src/storages/custom-node-group/CustomNodeGroupStorage.ts +++ b/src/storages/custom-node-group/CustomNodeGroupStorage.ts @@ -35,9 +35,9 @@ export class CustomNodeGroupStorage extends MapStorage { private readonly options: IOptions; /** - * @param customNodeGroupFactory - * @param randomGenerator - * @param options + * @param {TCustomNodeGroupFactory} customNodeGroupFactory + * @param {IRandomGenerator} randomGenerator + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.Factory__ICustomNodeGroup) customNodeGroupFactory: TCustomNodeGroupFactory, @@ -53,7 +53,7 @@ export class CustomNodeGroupStorage extends MapStorage { } public initialize (): void { - this.storage = new Map (); + this.storage = new Map (); this.storageId = this.randomGenerator.getRandomString(6); CustomNodeGroupStorage.customNodeGroupsList.forEach((customNodeGroupName: CustomNodeGroup) => { diff --git a/src/storages/string-array/StringArrayStorage.ts b/src/storages/string-array/StringArrayStorage.ts index 36480b3a..ef71083c 100644 --- a/src/storages/string-array/StringArrayStorage.ts +++ b/src/storages/string-array/StringArrayStorage.ts @@ -15,8 +15,8 @@ export class StringArrayStorage extends ArrayStorage { private readonly arrayUtils: IArrayUtils; /** - * @param arrayUtils - * @param randomGenerator + * @param {IArrayUtils} arrayUtils + * @param {IRandomGenerator} randomGenerator */ constructor ( @inject(ServiceIdentifiers.IArrayUtils) arrayUtils: IArrayUtils, @@ -30,7 +30,7 @@ export class StringArrayStorage extends ArrayStorage { } /** - * @param args + * @param {any[]} args */ public initialize (...args: any[]): void { super.initialize(args); @@ -39,7 +39,7 @@ export class StringArrayStorage extends ArrayStorage { } /** - * @param rotationValue + * @param {number} rotationValue */ public rotateArray (rotationValue: number): void { this.storage = this.arrayUtils.arrayRotate(this.storage, rotationValue); diff --git a/src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts b/src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts index f758a661..79d15ba6 100644 --- a/src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts +++ b/src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts @@ -4,6 +4,7 @@ import { IEscapeSequenceEncoder } from '../../../../interfaces/utils/IEscapeSequ * SelfDefendingTemplate. Enters code in infinity loop. * Notice, that second and third call to recursiveFunc1('indexOf') has cyrillic `ะต` character instead latin * + * @param {IEscapeSequenceEncoder} escapeSequenceEncoder * @returns {string} */ export function SelfDefendingTemplate (escapeSequenceEncoder: IEscapeSequenceEncoder): string { diff --git a/src/templates/custom-nodes/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts b/src/templates/custom-nodes/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts index 2843e21c..b558d5fd 100644 --- a/src/templates/custom-nodes/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts +++ b/src/templates/custom-nodes/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts @@ -1,6 +1,7 @@ import { IEscapeSequenceEncoder } from '../../../../interfaces/utils/IEscapeSequenceEncoder'; /** + * @param {IEscapeSequenceEncoder} escapeSequenceEncoder * @returns {string} */ export function SelfDefendingTemplate (escapeSequenceEncoder: IEscapeSequenceEncoder): string { diff --git a/src/templates/custom-nodes/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts b/src/templates/custom-nodes/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts index 296477ce..388b0ca6 100644 --- a/src/templates/custom-nodes/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts +++ b/src/templates/custom-nodes/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts @@ -3,6 +3,7 @@ import { IEscapeSequenceEncoder } from '../../../../interfaces/utils/IEscapeSequ /** * SelfDefendingTemplate. Enter code in infinity loop. * + * @param {IEscapeSequenceEncoder} escapeSequenceEncoder * @returns {string} */ export function SelfDefendingTemplate (escapeSequenceEncoder: IEscapeSequenceEncoder): string { diff --git a/src/utils/ArrayUtils.ts b/src/utils/ArrayUtils.ts index 1330e952..87101cc1 100644 --- a/src/utils/ArrayUtils.ts +++ b/src/utils/ArrayUtils.ts @@ -12,7 +12,7 @@ export class ArrayUtils implements IArrayUtils { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator + * @param {IRandomGenerator} randomGenerator */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator @@ -21,8 +21,8 @@ export class ArrayUtils implements IArrayUtils { } /** - * @param length - * @return {number[]} + * @param {number} length + * @returns {number[]} */ public arrayRange (length: number): number[] { const range: number[] = []; @@ -35,8 +35,8 @@ export class ArrayUtils implements IArrayUtils { } /** - * @param array - * @param times + * @param {T[]} array + * @param {number} times * @returns {T[]} */ public arrayRotate (array: T[], times: number): T[] { @@ -61,8 +61,8 @@ export class ArrayUtils implements IArrayUtils { } /** - * @param array - * @return {T[]} + * @param {T[]} array + * @returns {T[]} */ public arrayShuffle (array: T[]): T[] { const shuffledArray: T[] = [...array]; diff --git a/src/utils/CryptUtils.ts b/src/utils/CryptUtils.ts index ee36e0b4..2471d691 100644 --- a/src/utils/CryptUtils.ts +++ b/src/utils/CryptUtils.ts @@ -15,7 +15,7 @@ export class CryptUtils implements ICryptUtils { private readonly randomGenerator: IRandomGenerator; /** - * @param randomGenerator + * @param {IRandomGenerator} randomGenerator */ constructor ( @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator @@ -23,10 +23,11 @@ export class CryptUtils implements ICryptUtils { this.randomGenerator = randomGenerator; } - /** - * @param string - */ /* tslint:disable */ + /** + * @param {string} string + * @returns {string} + */ public btoa (string: string): string { const chars: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; @@ -55,9 +56,9 @@ export class CryptUtils implements ICryptUtils { /* tslint:enable */ /** - * @param str - * @param length - * @returns {[string, string]} + * @param {string} str + * @param {number} length + * @returns {[string , string]} */ public hideString (str: string, length: number): [string, string] { const escapeRegExp: (s: string) => string = (s: string) => @@ -96,15 +97,15 @@ export class CryptUtils implements ICryptUtils { return [randomMerge(str, randomStringDiff), randomStringDiff]; } + /* tslint:disable */ /** * RC4 symmetric cipher encryption/decryption * https://gist.github.com/farhadi/2185197 * - * @param key - * @param string + * @param {string} string + * @param {string} key * @returns {string} */ - /* tslint:disable */ public rc4 (string: string, key: string): string { let s: number[] = [], j: number = 0, diff --git a/src/utils/EscapeSequenceEncoder.ts b/src/utils/EscapeSequenceEncoder.ts index 4401000c..400b73c6 100644 --- a/src/utils/EscapeSequenceEncoder.ts +++ b/src/utils/EscapeSequenceEncoder.ts @@ -10,8 +10,8 @@ export class EscapeSequenceEncoder implements IEscapeSequenceEncoder { private readonly stringsCache: Map = new Map(); /** - * @param string - * @param encodeAllSymbols + * @param {string} string + * @param {boolean} encodeAllSymbols * @returns {string} */ public encode (string: string, encodeAllSymbols: boolean): string { diff --git a/src/utils/RandomGenerator.ts b/src/utils/RandomGenerator.ts index a76122ae..00a344fd 100644 --- a/src/utils/RandomGenerator.ts +++ b/src/utils/RandomGenerator.ts @@ -45,11 +45,11 @@ export class RandomGenerator implements IRandomGenerator { /** * @type {ISourceCode} */ - private readonly sourceCode: ISourceCode; + private readonly sourceCode: ISourceCode; /** - * @param sourceCode - * @param options + * @param {ISourceCode} sourceCode + * @param {IOptions} options */ constructor ( @inject(ServiceIdentifiers.ISourceCode) sourceCode: ISourceCode, @@ -71,8 +71,8 @@ export class RandomGenerator implements IRandomGenerator { } /** - * @param min - * @param max + * @param {number} min + * @param {number} max * @returns {number} */ public getRandomFloat (min: number, max: number): number { @@ -91,8 +91,8 @@ export class RandomGenerator implements IRandomGenerator { } /** - * @param min - * @param max + * @param {number} min + * @param {number} max * @returns {number} */ public getRandomInteger (min: number, max: number): number { @@ -103,8 +103,8 @@ export class RandomGenerator implements IRandomGenerator { } /** - * @param length - * @param pool + * @param {number} length + * @param {string} pool * @returns {string} */ public getRandomString (length: number, pool: string = RandomGenerator.randomGeneratorPool): string { @@ -112,7 +112,7 @@ export class RandomGenerator implements IRandomGenerator { } /** - * @param length + * @param {number} length * @returns {string} */ public getRandomVariableName (length: number): string { diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 9aa0877b..b3f16b92 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -7,7 +7,7 @@ export class Utils { public static readonly hexadecimalPrefix: string = '0x'; /** - * @param dec + * @param {number} dec * @returns {string} */ public static decToHex (dec: number): string { @@ -17,7 +17,7 @@ export class Utils { } /** - * @param url + * @param {string} url * @returns {string} */ public static extractDomainFromUrl (url: string): string { @@ -35,7 +35,7 @@ export class Utils { } /** - * @param number + * @param {number} number * @returns {boolean} */ public static isCeilNumber (number: number): boolean { @@ -43,8 +43,8 @@ export class Utils { } /** - * @param string - * @param times + * @param {string} string + * @param {number} times * @returns {string} */ public static stringRotate (string: string, times: number): string { @@ -60,7 +60,7 @@ export class Utils { } /** - * @param string + * @param {string} string * @returns {string} */ public static stringToJSFuck (string: string): string { diff --git a/tslint.json b/tslint.json index f4e4eac0..c4bfd8f9 100644 --- a/tslint.json +++ b/tslint.json @@ -1,10 +1,14 @@ { + "extends": [ + "tslint-eslint-rules" + ], "rules": { "align": [ true, "parameters", "statements" ], + "array-bracket-spacing": [true, "never"], "ban": [ true, [ "_", "forEach" ], @@ -12,6 +16,8 @@ [ "$", "each" ], [ "angular", "forEach" ] ], + "block-spacing": [true, "always"], + "brace-style": [true, "1tbs"], "class-name": true, "comment-format": [ true, @@ -53,21 +59,32 @@ "timeEnd", "trace" ], + "no-constant-condition": true, "no-construct": true, + "no-control-regex": true, "no-debugger": true, "no-default-export": true, + "no-duplicate-case": true, "no-duplicate-variable": true, "no-empty": false, + "no-empty-character-class": true, "no-empty-interface": true, "no-eval": false, + "no-ex-assign": true, + "no-extra-boolean-cast": true, + "no-extra-semi": true, "no-inferrable-types": false, + "no-inner-declarations": [true, "both"], "no-internal-module": true, + "no-invalid-regexp": true, "no-invalid-this": true, "no-misused-new": true, + "no-multi-spaces": [true], "no-null-keyword": false, "no-parameter-properties": true, "no-reference": true, "no-reference-import": true, + "no-regex-spaces": true, "no-require-imports": false, "no-shadowed-variable": true, "no-string-literal": true, @@ -75,10 +92,12 @@ "no-switch-case-fall-through": false, "no-trailing-whitespace": false, "no-unnecessary-callback-wrapper": true, + "no-unexpected-multiline": true, "no-unused-expression": true, "no-use-before-declare": true, "no-var-keyword": true, "no-var-requires": false, + "object-curly-spacing": [true, "always"], "object-literal-sort-keys": false, "one-line": [ true, @@ -96,7 +115,27 @@ "radix": true, "semicolon": [true, "always"], "space-before-function-paren": true, + "space-in-parens": [true, "never"], "switch-default": false, + "ter-arrow-parens": true, + "ter-func-call-spacing": [true, "never"], + "ter-indent": [ + true, + 4, + { + "ArrayExpression": 1, + "CallExpression": { "arguments": "first" }, + "FunctionDeclaration": { "body": 1, "parameters": 1 }, + "FunctionExpression": { "body": 1, "parameters": 1 }, + "MemberExpression": 1, + "ObjectExpression": 1, + "outerIIFEBody": 1, + "SwitchCase": 1, + "VariableDeclarator": 1 + } + ], + "ter-no-irregular-whitespace": [true], + "ter-no-sparse-arrays": [true], "trailing-comma": false, "triple-equals": [ true, @@ -132,6 +171,12 @@ "typeof-compare": true, "unified-signatures": true, "use-isnan": true, + "valid-jsdoc": [true, { + "requireReturn": false, + "requireParamDescription": false, + "requireReturnDescription": false + }], + "valid-typeof": true, "variable-name": false, "whitespace": [ true, diff --git a/webpack.config.js b/webpack.config.js index bb22c1cb..9ed4e6b2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,11 +5,13 @@ const nodeExternals = require('webpack-node-externals'); const webpack = require('webpack'); const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin; +const copyright = 'Copyright (C) 2017 Timofey Kachalov '; + /** * @return {string} */ const getLicenseText = () => { - return "/*\nCopyright (C) 2017 Timofey Kachalov \n\n" + + return `/*\n${copyright}\n\n` + fs.readFileSync('./LICENSE.BSD', 'utf8') + "\n*/"; }; diff --git a/yarn.lock b/yarn.lock index 61d8b041..863bbb31 100644 --- a/yarn.lock +++ b/yarn.lock @@ -51,13 +51,13 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.41.tgz#e27cf0817153eb9f2713b2d3f6c68f1e1c3ca608" "@types/node@*": - version "8.0.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.7.tgz#fb0ad04b5b6f6eabe0372a32a8f1fbba5c130cae" - -"@types/node@8.0.9": version "8.0.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.9.tgz#19f44c3b6cb8a70d261d366f73650e3e3891ab2d" +"@types/node@8.0.10": + version "8.0.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.10.tgz#12efec9183b072d5f951cf86395a4c780f868a17" + "@types/sinon@2.3.2": version "2.3.2" resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-2.3.2.tgz#1e1e99e67162d78e2db17816892bf93bf5209885" @@ -1276,6 +1276,13 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +doctrine@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-0.7.2.tgz#7cb860359ba3be90e040b26b729ce4bfa654c523" + dependencies: + esutils "^1.1.6" + isarray "0.0.1" + domain-browser@^1.1.1: version "1.1.7" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" @@ -1494,6 +1501,10 @@ estraverse@~4.1.0, estraverse@~4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" +esutils@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.1.6.tgz#c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375" + esutils@^2.0.2, esutils@~2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -3372,9 +3383,9 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" -sinon@2.3.6: - version "2.3.6" - resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.3.6.tgz#95378e7e0f976a9712e9b4591ff5b39e73dc3dde" +sinon@2.3.7: + version "2.3.7" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.3.7.tgz#1451614a2eaab05bb4d876c1335cd40132ec5127" dependencies: diff "^3.1.0" formatio "1.2.0" @@ -3720,10 +3731,18 @@ tsconfig@^6.0.0: strip-bom "^3.0.0" strip-json-comments "^2.0.0" -tslib@1.7.1, tslib@^1.7.1: +tslib@1.7.1, tslib@^1.0.0, tslib@^1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" +tslint-eslint-rules@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-4.1.1.tgz#7c30e7882f26bc276bff91d2384975c69daf88ba" + dependencies: + doctrine "^0.7.2" + tslib "^1.0.0" + tsutils "^1.4.0" + tslint-loader@3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/tslint-loader/-/tslint-loader-3.5.3.tgz#343f74122d94f356b689457d3f59f64a69ab606f" @@ -3749,6 +3768,10 @@ tslint@5.5.0: tslib "^1.7.1" tsutils "^2.5.1" +tsutils@^1.4.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0" + tsutils@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.5.1.tgz#c2001390c79eec1a5ccfa7ac12d599639683e0cf" @@ -3795,16 +3818,7 @@ typescript@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.1.tgz#c3ccb16ddaa0b2314de031e7e6fee89e5ba346bc" -uglify-js@^2.6: - version "2.8.27" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.27.tgz#47787f912b0f242e5b984343be8e35e95f694c9c" - dependencies: - source-map "~0.5.1" - yargs "~3.10.0" - optionalDependencies: - uglify-to-browserify "~1.0.0" - -uglify-js@^2.8.29: +uglify-js@^2.6, uglify-js@^2.8.29: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" dependencies: