Переглянути джерело

moved `optimize-js` to separate branch temporary

sanex3339 8 роки тому
батько
коміт
7d27fb1583

+ 0 - 5
README.md

@@ -188,11 +188,6 @@ This option can slightly slow down your code speed.
 All literals in Unicode array become encoded in Base64.
 All literals in Unicode array become encoded in Base64.
 To decode strings, a special function will be inserted on the page under `unicodeArray` node.
 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`
 ### `reservedNames`
 Type: `string[]` Default: `[]`
 Type: `string[]` Default: `[]`
 
 

+ 0 - 1
package.json

@@ -29,7 +29,6 @@
     "estraverse": "^4.2.0",
     "estraverse": "^4.2.0",
     "format-unicorn": "^1.1.0",
     "format-unicorn": "^1.1.0",
     "mkdirp": "^0.5.1",
     "mkdirp": "^0.5.1",
-    "optimize-js": "^1.0.1",
     "source-map-support": "^0.4.2"
     "source-map-support": "^0.4.2"
   },
   },
   "devDependencies": {
   "devDependencies": {

+ 0 - 10
src/JavaScriptObfuscatorInternal.ts

@@ -7,15 +7,11 @@ import { IGeneratorOutput } from "./interfaces/IGeneratorOutput";
 import { IObfuscationResult } from "./interfaces/IObfuscationResult";
 import { IObfuscationResult } from "./interfaces/IObfuscationResult";
 import { IOptions } from './interfaces/IOptions';
 import { IOptions } from './interfaces/IOptions';
 
 
-import { SourceMapMode } from "./enums/SourceMapMode";
-
 import { ObfuscationResult } from "./ObfuscationResult";
 import { ObfuscationResult } from "./ObfuscationResult";
 import { Obfuscator } from "./Obfuscator";
 import { Obfuscator } from "./Obfuscator";
 import { Options } from "./options/Options";
 import { Options } from "./options/Options";
 import { SourceMapCorrector } from "./SourceMapCorrector";
 import { SourceMapCorrector } from "./SourceMapCorrector";
 
 
-const optimizeJs = require('optimize-js');
-
 export class JavaScriptObfuscatorInternal {
 export class JavaScriptObfuscatorInternal {
     /**
     /**
      * @type {GenerateOptions}
      * @type {GenerateOptions}
@@ -71,12 +67,6 @@ export class JavaScriptObfuscatorInternal {
 
 
         const generatorOutput: IGeneratorOutput = escodegen.generate(astTree, escodegenParams);
         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() : '';
         generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
 
 
         return generatorOutput;
         return generatorOutput;

+ 0 - 1
src/cli/JavaScriptObfuscatorCLI.ts

@@ -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('--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('--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('--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('--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('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean)
             .option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean)
             .option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean)

+ 0 - 1
src/interfaces/IObfuscatorOptions.d.ts

@@ -6,7 +6,6 @@ export interface IObfuscatorOptions {
     debugProtectionInterval?: boolean;
     debugProtectionInterval?: boolean;
     disableConsoleOutput?: boolean;
     disableConsoleOutput?: boolean;
     encodeUnicodeLiterals?: boolean;
     encodeUnicodeLiterals?: boolean;
-    optimize?: boolean;
     reservedNames?: string[];
     reservedNames?: string[];
     rotateUnicodeArray?: boolean;
     rotateUnicodeArray?: boolean;
     selfDefending?: boolean;
     selfDefending?: boolean;

+ 0 - 1
src/interfaces/IOptions.d.ts

@@ -6,7 +6,6 @@ export interface IOptions {
     readonly debugProtectionInterval: boolean;
     readonly debugProtectionInterval: boolean;
     readonly disableConsoleOutput: boolean;
     readonly disableConsoleOutput: boolean;
     readonly encodeUnicodeLiterals: boolean;
     readonly encodeUnicodeLiterals: boolean;
-    readonly optimize: boolean;
     readonly reservedNames: string[];
     readonly reservedNames: string[];
     readonly rotateUnicodeArray: boolean;
     readonly rotateUnicodeArray: boolean;
     readonly selfDefending: boolean;
     readonly selfDefending: boolean;

+ 0 - 6
src/options/Options.ts

@@ -72,12 +72,6 @@ export class Options implements IOptions {
     @IsBoolean()
     @IsBoolean()
     public readonly encodeUnicodeLiterals: boolean;
     public readonly encodeUnicodeLiterals: boolean;
 
 
-    /**
-     * @type {boolean}
-     */
-    @IsBoolean()
-    public readonly optimize: boolean;
-
     /**
     /**
      * @type {string[]}
      * @type {string[]}
      */
      */

+ 0 - 1
src/preset-options/DefaultPreset.ts

@@ -9,7 +9,6 @@ export const DEFAULT_PRESET: IObfuscatorOptions = Object.freeze({
     disableConsoleOutput: true,
     disableConsoleOutput: true,
     domainLock: [],
     domainLock: [],
     encodeUnicodeLiterals: false,
     encodeUnicodeLiterals: false,
-    optimize: false,
     reservedNames: [],
     reservedNames: [],
     rotateUnicodeArray: true,
     rotateUnicodeArray: true,
     selfDefending: true,
     selfDefending: true,

+ 0 - 1
src/preset-options/NoCustomNodesPreset.ts

@@ -9,7 +9,6 @@ export const NO_CUSTOM_NODES_PRESET: IObfuscatorOptions = Object.freeze({
     disableConsoleOutput: false,
     disableConsoleOutput: false,
     domainLock: [],
     domainLock: [],
     encodeUnicodeLiterals: false,
     encodeUnicodeLiterals: false,
-    optimize: false,
     reservedNames: [],
     reservedNames: [],
     rotateUnicodeArray: false,
     rotateUnicodeArray: false,
     selfDefending: false,
     selfDefending: false,