mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Utility classes with state now are non-static
This commit is contained in:
@@ -59,7 +59,7 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator {
|
||||
*/
|
||||
public obfuscate (sourceCode: string): IObfuscationResult {
|
||||
// parse AST tree
|
||||
const astTree: ESTree.Program = esprima.parse(sourceCode, { loc: this.options.sourceMap });
|
||||
const astTree: ESTree.Program = this.parseCode(sourceCode);
|
||||
|
||||
// obfuscate AST tree
|
||||
const obfuscatedAstTree: ESTree.Program = this.obfuscator.obfuscateAstTree(astTree);
|
||||
@@ -70,6 +70,16 @@ export class JavaScriptObfuscatorInternal implements IJavaScriptObfuscator {
|
||||
return this.getObfuscationResult(generatorOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sourceCode
|
||||
* @return {ESTree.Program}
|
||||
*/
|
||||
private parseCode (sourceCode: string): ESTree.Program {
|
||||
return esprima.parse(sourceCode, {
|
||||
loc: this.options.sourceMap
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sourceCode
|
||||
* @param astTree
|
||||
|
||||
Reference in New Issue
Block a user