mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
moved optimize-js to separate branch temporary
This commit is contained in:
@@ -188,11 +188,6 @@ This option can slightly slow down your code speed.
|
||||
All literals in Unicode array become encoded in Base64.
|
||||
To decode strings, a special function will be inserted on the page under `unicodeArray` node.
|
||||
|
||||
### `optimize`
|
||||
Type: `boolean` Default: `false`
|
||||
|
||||
Enables optimizations for obfuscated code with help of [optimize-js](https://github.com/nolanlawson/optimize-js)
|
||||
|
||||
### `reservedNames`
|
||||
Type: `string[]` Default: `[]`
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
"estraverse": "^4.2.0",
|
||||
"format-unicorn": "^1.1.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"optimize-js": "^1.0.1",
|
||||
"source-map-support": "^0.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -7,15 +7,11 @@ import { IGeneratorOutput } from "./interfaces/IGeneratorOutput";
|
||||
import { IObfuscationResult } from "./interfaces/IObfuscationResult";
|
||||
import { IOptions } from './interfaces/IOptions';
|
||||
|
||||
import { SourceMapMode } from "./enums/SourceMapMode";
|
||||
|
||||
import { ObfuscationResult } from "./ObfuscationResult";
|
||||
import { Obfuscator } from "./Obfuscator";
|
||||
import { Options } from "./options/Options";
|
||||
import { SourceMapCorrector } from "./SourceMapCorrector";
|
||||
|
||||
const optimizeJs = require('optimize-js');
|
||||
|
||||
export class JavaScriptObfuscatorInternal {
|
||||
/**
|
||||
* @type {GenerateOptions}
|
||||
@@ -71,12 +67,6 @@ export class JavaScriptObfuscatorInternal {
|
||||
|
||||
const generatorOutput: IGeneratorOutput = escodegen.generate(astTree, escodegenParams);
|
||||
|
||||
if (options.optimize) {
|
||||
generatorOutput.code = optimizeJs(generatorOutput.code, {
|
||||
sourceMap: options.sourceMap && options.sourceMapMode === SourceMapMode.Inline
|
||||
});
|
||||
}
|
||||
|
||||
generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
|
||||
|
||||
return generatorOutput;
|
||||
|
||||
@@ -127,7 +127,6 @@ export class JavaScriptObfuscatorCLI {
|
||||
.option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--optimize <boolean>', 'Enables optimizations for obfuscated code with help of `optimize-js`', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', (val: string) => val.split(','))
|
||||
.option('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
|
||||
-1
@@ -6,7 +6,6 @@ export interface IObfuscatorOptions {
|
||||
debugProtectionInterval?: boolean;
|
||||
disableConsoleOutput?: boolean;
|
||||
encodeUnicodeLiterals?: boolean;
|
||||
optimize?: boolean;
|
||||
reservedNames?: string[];
|
||||
rotateUnicodeArray?: boolean;
|
||||
selfDefending?: boolean;
|
||||
|
||||
Vendored
-1
@@ -6,7 +6,6 @@ export interface IOptions {
|
||||
readonly debugProtectionInterval: boolean;
|
||||
readonly disableConsoleOutput: boolean;
|
||||
readonly encodeUnicodeLiterals: boolean;
|
||||
readonly optimize: boolean;
|
||||
readonly reservedNames: string[];
|
||||
readonly rotateUnicodeArray: boolean;
|
||||
readonly selfDefending: boolean;
|
||||
|
||||
@@ -72,12 +72,6 @@ export class Options implements IOptions {
|
||||
@IsBoolean()
|
||||
public readonly encodeUnicodeLiterals: boolean;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
@IsBoolean()
|
||||
public readonly optimize: boolean;
|
||||
|
||||
/**
|
||||
* @type {string[]}
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,6 @@ export const DEFAULT_PRESET: IObfuscatorOptions = Object.freeze({
|
||||
disableConsoleOutput: true,
|
||||
domainLock: [],
|
||||
encodeUnicodeLiterals: false,
|
||||
optimize: false,
|
||||
reservedNames: [],
|
||||
rotateUnicodeArray: true,
|
||||
selfDefending: true,
|
||||
|
||||
@@ -9,7 +9,6 @@ export const NO_CUSTOM_NODES_PRESET: IObfuscatorOptions = Object.freeze({
|
||||
disableConsoleOutput: false,
|
||||
domainLock: [],
|
||||
encodeUnicodeLiterals: false,
|
||||
optimize: false,
|
||||
reservedNames: [],
|
||||
rotateUnicodeArray: false,
|
||||
selfDefending: false,
|
||||
|
||||
Reference in New Issue
Block a user