mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
added tslint-loader and tslint fixes
This commit is contained in:
@@ -59,6 +59,23 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sourceCode
|
||||
* @returns {IObfuscationResult}
|
||||
*/
|
||||
public obfuscate (sourceCode: string): IObfuscationResult {
|
||||
// parse AST tree
|
||||
const astTree: ESTree.Program = esprima.parse(sourceCode, JavaScriptObfuscatorInternal.esprimaParams);
|
||||
|
||||
// obfuscate AST tree
|
||||
const obfuscatedAstTree: ESTree.Program = this.obfuscator.obfuscateAstTree(astTree);
|
||||
|
||||
// generate code
|
||||
const generatorOutput: IGeneratorOutput = this.generateCode(sourceCode, obfuscatedAstTree);
|
||||
|
||||
return this.getObfuscationResult(generatorOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sourceCode
|
||||
* @param astTree
|
||||
@@ -94,21 +111,4 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator {
|
||||
generatorOutput.map
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sourceCode
|
||||
* @returns {IObfuscationResult}
|
||||
*/
|
||||
public obfuscate (sourceCode: string): IObfuscationResult {
|
||||
// parse AST tree
|
||||
const astTree: ESTree.Program = esprima.parse(sourceCode, JavaScriptObfuscatorInternal.esprimaParams);
|
||||
|
||||
// obfuscate AST tree
|
||||
const obfuscatedAstTree: ESTree.Program = this.obfuscator.obfuscateAstTree(astTree);
|
||||
|
||||
// generate code
|
||||
const generatorOutput: IGeneratorOutput = this.generateCode(sourceCode, obfuscatedAstTree);
|
||||
|
||||
return this.getObfuscationResult(generatorOutput);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user