mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Applying optimize-js for obfuscated code
This commit is contained in:
@@ -12,6 +12,8 @@ import { Obfuscator } from "./Obfuscator";
|
||||
import { Options } from "./options/Options";
|
||||
import { SourceMapCorrector } from "./SourceMapCorrector";
|
||||
|
||||
const optimizeJs = require('optimize-js');
|
||||
|
||||
export class JavaScriptObfuscatorInternal {
|
||||
/**
|
||||
* @type {GenerateOptions}
|
||||
@@ -67,6 +69,10 @@ export class JavaScriptObfuscatorInternal {
|
||||
|
||||
const generatorOutput: IGeneratorOutput = escodegen.generate(astTree, escodegenParams);
|
||||
|
||||
if (options.optimize) {
|
||||
generatorOutput.code = optimizeJs(generatorOutput.code);
|
||||
}
|
||||
|
||||
generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
|
||||
|
||||
return generatorOutput;
|
||||
|
||||
Reference in New Issue
Block a user