ソースを参照

Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/57
Refactoring

sanex3339 8 年 前
コミット
71be6ab3b9
41 ファイル変更414 行追加324 行削除
  1. 0 0
      dist/index.js
  2. 5 5
      package.json
  3. 2 2
      src/Obfuscator.ts
  4. 1 1
      src/cli/sanitizers/SourceMapModeSanitizer.ts
  5. 3 3
      src/cli/sanitizers/StringArrayEncodingSanitizer.ts
  6. 5 5
      src/custom-nodes/AbstractCustomNodeGroup.ts
  7. 2 3
      src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts
  8. 2 3
      src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts
  9. 2 3
      src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts
  10. 3 4
      src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts
  11. 2 3
      src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts
  12. 2 2
      src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts
  13. 2 3
      src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts
  14. 56 56
      src/enums/JSFuck.ts
  15. 37 39
      src/enums/NodeType.ts
  16. 4 4
      src/enums/SourceMapMode.ts
  17. 4 4
      src/enums/StringArrayEncoding.ts
  18. 4 6
      src/enums/VisitorDirection.ts
  19. 4 9
      src/enums/event-emitters/ObfuscationEvent.ts
  20. 3 3
      src/interfaces/custom-nodes/ICustomNodeGroup.d.ts
  21. 3 3
      src/interfaces/event-emitters/IObfuscationEventEmitter.d.ts
  22. 1 1
      src/interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IEncodedValue.d.ts
  23. 4 0
      src/interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IStringArrayIndexData.d.ts
  24. 69 30
      src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts
  25. 2 7
      src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts
  26. 4 13
      src/options/normalizer-rules/DeadCodeInjectionRule.ts
  27. 2 7
      src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts
  28. 2 7
      src/options/normalizer-rules/SelfDefendingRule.ts
  29. 1 6
      src/options/normalizer-rules/StringArrayEncodingRule.ts
  30. 4 9
      src/options/normalizer-rules/StringArrayRule.ts
  31. 4 9
      src/options/normalizer-rules/StringArrayThresholdRule.ts
  32. 6 2
      src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts
  33. 6 2
      src/templates/custom-nodes/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts
  34. 3 1
      src/templates/custom-nodes/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts
  35. 0 1
      src/types/event-emitters/TObfuscationEvent.d.ts
  36. 11 11
      src/utils/Utils.ts
  37. 1 1
      test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts
  38. 4 4
      test/functional-tests/node-transformers/control-flow-transformers/block-statement-control-flow-transformer/BlockStatementControlFlowTransformer.spec.ts
  39. 2 2
      test/functional-tests/node-transformers/obfuscating-transformers/literal-transformer/LiteralTransformer.spec.ts
  40. 6 6
      test/unit-tests/utils/utils/Utils.spec.ts
  41. 136 44
      yarn.lock

ファイルの差分が大きいため隠しています
+ 0 - 0
dist/index.js


+ 5 - 5
package.json

@@ -19,8 +19,8 @@
     "javascript-obfuscator": "./bin/javascript-obfuscator.js"
   },
   "dependencies": {
-    "chance": "1.0.9",
-    "class-validator": "0.7.0",
+    "chance": "1.0.10",
+    "class-validator": "0.7.1",
     "commander": "2.9.0",
     "escodegen-wallaby": "1.6.11",
     "esmangle": "1.0.1",
@@ -44,7 +44,7 @@
     "@types/estree": "0.0.35",
     "@types/mkdirp": "0.3.29",
     "@types/mocha": "2.2.41",
-    "@types/node": "7.0.31",
+    "@types/node": "8.0.0",
     "@types/sinon": "2.3.1",
     "@types/string-template": "1.0.2",
     "awesome-typescript-loader": "3.1.3",
@@ -61,8 +61,8 @@
     "ts-node": "3.0.6",
     "tslint": "5.4.3",
     "tslint-loader": "3.5.3",
-    "typescript": "2.3.4",
-    "webpack": "2.6.1",
+    "typescript": "2.4.0",
+    "webpack": "3.0.0",
     "webpack-node-externals": "1.6.0"
   },
   "repository": {

+ 2 - 2
src/Obfuscator.ts

@@ -188,8 +188,8 @@ export class Obfuscator implements IObfuscator {
         }
 
         estraverse.replace(astTree, {
-            enter: this.mergeVisitorsForDirection(enterVisitors, VisitorDirection.enter),
-            leave: this.mergeVisitorsForDirection(leaveVisitors, VisitorDirection.leave)
+            enter: this.mergeVisitorsForDirection(enterVisitors, VisitorDirection.Enter),
+            leave: this.mergeVisitorsForDirection(leaveVisitors, VisitorDirection.Leave)
         });
 
         return astTree;

+ 1 - 1
src/cli/sanitizers/SourceMapModeSanitizer.ts

@@ -6,7 +6,7 @@ export const SourceMapModeSanitizer: TCLISanitizer = (value: string): string =>
     const availableMode: boolean = Object
         .keys(SourceMapMode)
         .some((key: string): boolean => {
-            return SourceMapMode[key] === value;
+            return SourceMapMode[<any>key] === value;
         });
 
     if (!availableMode) {

+ 3 - 3
src/cli/sanitizers/StringArrayEncodingSanitizer.ts

@@ -7,11 +7,11 @@ export const StringArrayEncodingSanitizer: TCLISanitizer = (value: string): TStr
     switch (value) {
         case 'true':
         case '1':
-        case StringArrayEncoding.base64:
+        case StringArrayEncoding.Base64:
             return true;
 
-        case StringArrayEncoding.rc4:
-            return StringArrayEncoding.rc4;
+        case StringArrayEncoding.Rc4:
+            return StringArrayEncoding.Rc4;
 
         default:
             return false;

+ 5 - 5
src/custom-nodes/AbstractCustomNodeGroup.ts

@@ -2,7 +2,6 @@ import { injectable, inject } from 'inversify';
 import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
 
 import { TNodeWithBlockStatement } from '../types/node/TNodeWithBlockStatement';
-import { TObfuscationEvent } from '../types/event-emitters/TObfuscationEvent';
 
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
 import { ICustomNodeGroup } from '../interfaces/custom-nodes/ICustomNodeGroup';
@@ -10,13 +9,14 @@ import { IOptions } from '../interfaces/options/IOptions';
 import { IStackTraceData } from '../interfaces/stack-trace-analyzer/IStackTraceData';
 
 import { CustomNode } from '../enums/container/custom-nodes/CustomNode';
+import { ObfuscationEvent } from '../enums/event-emitters/ObfuscationEvent';
 
 @injectable()
 export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
     /**
-     * @type {TObfuscationEvent}
+     * @type {ObfuscationEvent}
      */
-    protected abstract readonly appendEvent: TObfuscationEvent;
+    protected abstract readonly appendEvent: ObfuscationEvent;
 
     /**
      * @type {Map<CustomNode, ICustomNode>}
@@ -49,9 +49,9 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
     public abstract appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void;
 
     /**
-     * @returns {TObfuscationEvent}
+     * @returns {ObfuscationEvent}
      */
-    public getAppendEvent (): TObfuscationEvent {
+    public getAppendEvent (): ObfuscationEvent {
         return this.appendEvent;
     }
 

+ 2 - 3
src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts

@@ -3,7 +3,6 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
-import { TObfuscationEvent } from '../../../types/event-emitters/TObfuscationEvent';
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IObfuscationEventEmitter } from '../../../interfaces/event-emitters/IObfuscationEventEmitter';
@@ -22,9 +21,9 @@ import { RandomGeneratorUtils } from '../../../utils/RandomGeneratorUtils';
 @injectable()
 export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup {
     /**
-     * @type {TObfuscationEvent}
+     * @type {ObfuscationEvent}
      */
-    protected readonly appendEvent: TObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
+    protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
 
     /**
      * @type {Map<CustomNode, ICustomNode>}

+ 2 - 3
src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts

@@ -3,7 +3,6 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
-import { TObfuscationEvent } from '../../../types/event-emitters/TObfuscationEvent';
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IObfuscationEventEmitter } from '../../../interfaces/event-emitters/IObfuscationEventEmitter';
@@ -22,9 +21,9 @@ import { RandomGeneratorUtils } from '../../../utils/RandomGeneratorUtils';
 @injectable()
 export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup {
     /**
-     * @type {TObfuscationEvent}
+     * @type {ObfuscationEvent}
      */
-    protected readonly appendEvent: TObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
+    protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
 
     /**
      * @type {Map<CustomNode, ICustomNode>}

+ 2 - 3
src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts

@@ -3,7 +3,6 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
-import { TObfuscationEvent } from '../../../types/event-emitters/TObfuscationEvent';
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IObfuscationEventEmitter } from '../../../interfaces/event-emitters/IObfuscationEventEmitter';
@@ -22,9 +21,9 @@ import { RandomGeneratorUtils } from '../../../utils/RandomGeneratorUtils';
 @injectable()
 export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
     /**
-     * @type {TObfuscationEvent}
+     * @type {ObfuscationEvent}
      */
-    protected readonly appendEvent: TObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
+    protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
 
     /**
      * @type {Map<CustomNode, ICustomNode>}

+ 3 - 4
src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts

@@ -3,7 +3,6 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 
 import * as format from 'string-template';
 
-import { TObfuscationEvent } from '../../types/event-emitters/TObfuscationEvent';
 import { TStatement } from '../../types/node/TStatement';
 
 import { IOptions } from '../../interfaces/options/IOptions';
@@ -29,10 +28,10 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
     protected callsControllerFunctionName: string;
 
     /**
-     * @type {TObfuscationEvent}
+     * @type {ObfuscationEvent}
      */
     @initializable()
-    private appendEvent: TObfuscationEvent;
+    private appendEvent: ObfuscationEvent;
 
     /**
      * @param options
@@ -47,7 +46,7 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
      * @param appendEvent
      * @param callsControllerFunctionName
      */
-    public initialize (appendEvent: TObfuscationEvent, callsControllerFunctionName: string): void {
+    public initialize (appendEvent: ObfuscationEvent, callsControllerFunctionName: string): void {
         this.appendEvent = appendEvent;
         this.callsControllerFunctionName = callsControllerFunctionName;
     }

+ 2 - 3
src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts

@@ -2,7 +2,6 @@ import { injectable, inject } from 'inversify';
 import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
-import { TObfuscationEvent } from '../../../types/event-emitters/TObfuscationEvent';
 import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
@@ -22,9 +21,9 @@ import { RandomGeneratorUtils } from '../../../utils/RandomGeneratorUtils';
 @injectable()
 export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
     /**
-     * @type {TObfuscationEvent}
+     * @type {ObfuscationEvent}
      */
-    protected appendEvent: TObfuscationEvent = ObfuscationEvent.AfterObfuscation;
+    protected appendEvent: ObfuscationEvent = ObfuscationEvent.AfterObfuscation;
 
     /**
      * @type {Map<CustomNode, ICustomNode>}

+ 2 - 2
src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts

@@ -110,7 +110,7 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
         }
 
         switch (this.options.stringArrayEncoding) {
-            case StringArrayEncoding.rc4:
+            case StringArrayEncoding.Rc4:
                 decodeStringArrayTemplate = format(StringArrayRc4DecodeNodeTemplate(), {
                     atobPolyfill: AtobTemplate(),
                     rc4Polyfill: Rc4Template(),
@@ -120,7 +120,7 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
 
                 break;
 
-            case StringArrayEncoding.base64:
+            case StringArrayEncoding.Base64:
                 decodeStringArrayTemplate = format(StringArrayBase64DecodeNodeTemplate(), {
                     atobPolyfill: AtobTemplate(),
                     selfDefendingCode,

+ 2 - 3
src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts

@@ -3,7 +3,6 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
 import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
-import { TObfuscationEvent } from '../../../types/event-emitters/TObfuscationEvent';
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IObfuscationEventEmitter } from '../../../interfaces/event-emitters/IObfuscationEventEmitter';
@@ -24,9 +23,9 @@ import { Utils } from '../../../utils/Utils';
 @injectable()
 export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
     /**
-     * @type {TObfuscationEvent}
+     * @type {ObfuscationEvent}
      */
-    protected appendEvent: TObfuscationEvent = ObfuscationEvent.AfterObfuscation;
+    protected appendEvent: ObfuscationEvent = ObfuscationEvent.AfterObfuscation;
 
     /**
      * @type {Map<CustomNode, ICustomNode>}

+ 56 - 56
src/enums/JSFuck.ts

@@ -1,58 +1,58 @@
-export const JSFuck: any = {
-    False: '![]',
-    True: '!![]',
+export enum JSFuck {
+    False = '![]',
+    True = '!![]',
 
-    a: '(false+"")[1]',
-    b: '([]["entries"]()+"")[2]',
-    c: '([]["fill"]+"")[3]',
-    d: '(undefined+"")[2]',
-    e: '(true+"")[3]',
-    f: '(false+"")[0]',
-    g: '(false+[0]+String)[20]',
-    h: '(+(101))["toString"](21)[1]',
-    i: '([false]+undefined)[10]',
-    j: '([]["entries"]()+"")[3]',
-    k: '(+(20))["toString"](21)',
-    l: '(false+"")[2]',
-    m: '(Number+"")[11]',
-    n: '(undefined+"")[1]',
-    o: '(true+[]["fill"])[10]',
-    p: '(+(211))["toString"](31)[1]',
-    q: '(+(212))["toString"](31)[1]',
-    r: '(true+"")[1]',
-    s: '(false+"")[3]',
-    t: '(true+"")[0]',
-    u: '(undefined+"")[0]',
-    v: '(+(31))["toString"](32)',
-    w: '(+(32))["toString"](33)',
-    x: '(+(101))["toString"](34)[1]',
-    y: '(NaN+[Infinity])[10]',
-    z: '(+(35))["toString"](36)',
+    a = '(false+"")[1]',
+    b = '([]["entries"]()+"")[2]',
+    c = '([]["fill"]+"")[3]',
+    d = '(undefined+"")[2]',
+    e = '(true+"")[3]',
+    f = '(false+"")[0]',
+    g = '(false+[0]+String)[20]',
+    h = '(+(101))["toString"](21)[1]',
+    i = '([false]+undefined)[10]',
+    j = '([]["entries"]()+"")[3]',
+    k = '(+(20))["toString"](21)',
+    l = '(false+"")[2]',
+    m = '(Number+"")[11]',
+    n = '(undefined+"")[1]',
+    o = '(true+[]["fill"])[10]',
+    p = '(+(211))["toString"](31)[1]',
+    q = '(+(212))["toString"](31)[1]',
+    r = '(true+"")[1]',
+    s = '(false+"")[3]',
+    t = '(true+"")[0]',
+    u = '(undefined+"")[0]',
+    v = '(+(31))["toString"](32)',
+    w = '(+(32))["toString"](33)',
+    x = '(+(101))["toString"](34)[1]',
+    y = '(NaN+[Infinity])[10]',
+    z = '(+(35))["toString"](36)',
 
-    A: '(+[]+Array)[10]',
-    B: '(+[]+Boolean)[10]',
-    C: 'Function("return escape")()(("")["italics"]())[2]',
-    D: 'Function("return escape")()([]["fill"])["slice"]("-1")',
-    E: '(RegExp+"")[12]',
-    F: '(+[]+Function)[10]',
-    G: '(false+Function("return Date")()())[30]',
-    H: `'H'`,
-    I: '(Infinity+"")[0]',
-    J: `'J'`,
-    K: `'K'`,
-    L: `'L'`,
-    M: '(true+Function("return Date")()())[30]',
-    N: '(NaN+"")[0]',
-    O: '(NaN+Function("return{}")())[11]',
-    P: `'P'`,
-    Q: `'Q'`,
-    R: '(+[]+RegExp)[10]',
-    S: '(+[]+String)[10]',
-    T: '(NaN+Function("return Date")()())[30]',
-    U: '(NaN+Function("return{}")()["toString"]["call"]())[11]',
-    V: `'V'`,
-    W: `'W'`,
-    X: `'X'`,
-    Y: `'Y'`,
-    Z: `'Z'`
-};
+    A = '(+[]+Array)[10]',
+    B = '(+[]+Boolean)[10]',
+    C = 'Function("return escape")()(("")["italics"]())[2]',
+    D = 'Function("return escape")()([]["fill"])["slice"]("-1")',
+    E = '(RegExp+"")[12]',
+    F = '(+[]+Function)[10]',
+    G = '(false+Function("return Date")()())[30]',
+    H = '\'H\'',
+    I = '(Infinity+"")[0]',
+    J = '\'J\'',
+    K = '\'K\'',
+    L = '\'L\'',
+    M = '(true+Function("return Date")()())[30]',
+    N = '(NaN+"")[0]',
+    O = '(NaN+Function("return{}")())[11]',
+    P = '\'P\'',
+    Q = '\'Q\'',
+    R = '(+[]+RegExp)[10]',
+    S = '(+[]+String)[10]',
+    T = '(NaN+Function("return Date")()())[30]',
+    U = '(NaN+Function("return{}")()["toString"]["call"]())[11]',
+    V = '\'V\'',
+    W = '\'W\'',
+    X = '\'X\'',
+    Y = '\'Y\'',
+    Z = '\'Z\'',
+}

+ 37 - 39
src/enums/NodeType.ts

@@ -1,39 +1,37 @@
-import { Utils } from '../utils/Utils';
-
-export const NodeType: any = Utils.strEnumify({
-    ArrayExpression: 'ArrayExpression',
-    ArrowFunctionExpression: 'ArrowFunctionExpression',
-    AssignmentExpression: 'AssignmentExpression',
-    AssignmentPattern: 'AssignmentPattern',
-    BinaryExpression: 'BinaryExpression',
-    BlockStatement: 'BlockStatement',
-    BreakStatement: 'BreakStatement',
-    CallExpression: 'CallExpression',
-    CatchClause: 'CatchClause',
-    ClassDeclaration: 'ClassDeclaration',
-    ContinueStatement: 'ContinueStatement',
-    ExpressionStatement: 'ExpressionStatement',
-    FunctionDeclaration: 'FunctionDeclaration',
-    FunctionExpression: 'FunctionExpression',
-    Identifier:  'Identifier',
-    IfStatement:  'IfStatement',
-    LabeledStatement: 'LabeledStatement',
-    Literal: 'Literal',
-    LogicalExpression: 'LogicalExpression',
-    MemberExpression: 'MemberExpression',
-    MethodDefinition: 'MethodDefinition',
-    ObjectExpression: 'ObjectExpression',
-    ObjectPattern: 'ObjectPattern',
-    Program: 'Program',
-    Property: 'Property',
-    ReturnStatement: 'ReturnStatement',
-    SwitchCase: 'SwitchCase',
-    SwitchStatement: 'SwitchStatement',
-    TemplateLiteral: 'TemplateLiteral',
-    TryStatement: 'TryStatement',
-    UnaryExpression: 'UnaryExpression',
-    UpdateExpression: 'UpdateExpression',
-    VariableDeclaration: 'VariableDeclaration',
-    VariableDeclarator: 'VariableDeclarator',
-    WhileStatement: 'WhileStatement'
-});
+export enum NodeType {
+    ArrayExpression = 'ArrayExpression',
+    ArrowFunctionExpression = 'ArrowFunctionExpression',
+    AssignmentExpression = 'AssignmentExpression',
+    AssignmentPattern = 'AssignmentPattern',
+    BinaryExpression = 'BinaryExpression',
+    BlockStatement = 'BlockStatement',
+    BreakStatement = 'BreakStatement',
+    CallExpression = 'CallExpression',
+    CatchClause = 'CatchClause',
+    ClassDeclaration = 'ClassDeclaration',
+    ContinueStatement = 'ContinueStatement',
+    ExpressionStatement = 'ExpressionStatement',
+    FunctionDeclaration = 'FunctionDeclaration',
+    FunctionExpression = 'FunctionExpression',
+    Identifier = 'Identifier',
+    IfStatement = 'IfStatement',
+    LabeledStatement = 'LabeledStatement',
+    Literal = 'Literal',
+    LogicalExpression = 'LogicalExpression',
+    MemberExpression = 'MemberExpression',
+    MethodDefinition = 'MethodDefinition',
+    ObjectExpression = 'ObjectExpression',
+    ObjectPattern = 'ObjectPattern',
+    Program = 'Program',
+    Property = 'Property',
+    ReturnStatement = 'ReturnStatement',
+    SwitchCase = 'SwitchCase',
+    SwitchStatement = 'SwitchStatement',
+    TemplateLiteral = 'TemplateLiteral',
+    TryStatement = 'TryStatement',
+    UnaryExpression = 'UnaryExpression',
+    UpdateExpression = 'UpdateExpression',
+    VariableDeclaration = 'VariableDeclaration',
+    VariableDeclarator = 'VariableDeclarator',
+    WhileStatement = 'WhileStatement'
+}

+ 4 - 4
src/enums/SourceMapMode.ts

@@ -1,4 +1,4 @@
-export const SourceMapMode: any = {
-    Inline: 'inline',
-    Separate: 'separate'
-};
+export enum SourceMapMode {
+    Inline = 'inline',
+    Separate = 'separate'
+}

+ 4 - 4
src/enums/StringArrayEncoding.ts

@@ -1,4 +1,4 @@
-export const StringArrayEncoding: any = {
-    base64: 'base64',
-    rc4: 'rc4'
-};
+export enum StringArrayEncoding {
+    Base64 = 'base64',
+    Rc4 = 'rc4'
+}

+ 4 - 6
src/enums/VisitorDirection.ts

@@ -1,6 +1,4 @@
-import { Utils } from '../utils/Utils';
-
-export const VisitorDirection: any = Utils.strEnumify({
-    enter: 'enter',
-    leave: 'leave'
-});
+export enum VisitorDirection {
+    Enter = 'enter',
+    Leave = 'leave'
+}

+ 4 - 9
src/enums/event-emitters/ObfuscationEvent.ts

@@ -1,9 +1,4 @@
-import { TObfuscationEvent } from '../../types/event-emitters/TObfuscationEvent';
-
-export const ObfuscationEvent: {
-    AfterObfuscation: TObfuscationEvent,
-    BeforeObfuscation: TObfuscationEvent
-} = {
-    AfterObfuscation: 'afterObfuscation',
-    BeforeObfuscation: 'beforeObfuscation'
-};
+export enum ObfuscationEvent {
+    AfterObfuscation = 'afterObfuscation',
+    BeforeObfuscation = 'beforeObfuscation'
+}

+ 3 - 3
src/interfaces/custom-nodes/ICustomNodeGroup.d.ts

@@ -1,11 +1,11 @@
 import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
-import { TObfuscationEvent } from '../../types/event-emitters/TObfuscationEvent';
 
 import { ICustomNode } from './ICustomNode';
 import { IInitializable } from '../IInitializable';
 import { IStackTraceData } from '../stack-trace-analyzer/IStackTraceData';
 
 import { CustomNode } from '../../enums/container/custom-nodes/CustomNode';
+import { ObfuscationEvent } from '../../enums/event-emitters/ObfuscationEvent';
 
 export interface ICustomNodeGroup extends IInitializable {
     /**
@@ -15,9 +15,9 @@ export interface ICustomNodeGroup extends IInitializable {
     appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void;
 
     /**
-     * @returns {TObfuscationEvent}
+     * @returns {ObfuscationEvent}
      */
-    getAppendEvent (): TObfuscationEvent;
+    getAppendEvent (): ObfuscationEvent;
 
     /**
      * @type {Map <CustomNode, ICustomNode>}

+ 3 - 3
src/interfaces/event-emitters/IObfuscationEventEmitter.d.ts

@@ -1,6 +1,6 @@
 import Events = NodeJS.Events;
 
-import { TObfuscationEvent } from '../../types/event-emitters/TObfuscationEvent';
+import { ObfuscationEvent } from '../../enums/event-emitters/ObfuscationEvent';
 
 export interface IObfuscationEventEmitter extends Events {
     /**
@@ -8,12 +8,12 @@ export interface IObfuscationEventEmitter extends Events {
      * @param listener
      * @returns this
      */
-    on(event: TObfuscationEvent, listener: Function): this;
+    on (event: ObfuscationEvent, listener: Function): this;
 
     /**
      * @param event
      * @param listener
      * @returns this
      */
-    once(event: TObfuscationEvent, listener: Function): this;
+    once (event: ObfuscationEvent, listener: Function): this;
 }

+ 1 - 1
src/interfaces/node-transformers/obfuscating-transformers/IEncodedValue.d.ts → src/interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IEncodedValue.d.ts

@@ -1,4 +1,4 @@
 export interface IEncodedValue {
     encodedValue: string;
-    key?: string;
+    key: string|null;
 }

+ 4 - 0
src/interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IStringArrayIndexData.d.ts

@@ -0,0 +1,4 @@
+export interface IStringArrayIndexData {
+    fromCache: boolean;
+    index: string;
+}

+ 69 - 30
src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts

@@ -4,9 +4,10 @@ import { ServiceIdentifiers } from '../../../../container/ServiceIdentifiers';
 import * as ESTree from 'estree';
 
 import { ICustomNodeGroup } from '../../../../interfaces/custom-nodes/ICustomNodeGroup';
-import { IEncodedValue } from '../../../../interfaces/node-transformers/obfuscating-transformers/IEncodedValue';
+import { IEncodedValue } from '../../../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IEncodedValue';
 import { IOptions } from '../../../../interfaces/options/IOptions';
 import { IStorage } from '../../../../interfaces/storages/IStorage';
+import { IStringArrayIndexData } from '../../../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/IStringArrayIndexData';
 
 import { StringArrayEncoding } from '../../../../enums/StringArrayEncoding';
 
@@ -23,6 +24,16 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
      */
     private static readonly minimumLengthForStringArray: number = 3;
 
+    /**
+     * @type {number}
+     */
+    private static rc4KeyLength: number = 4;
+
+    /**
+     * @type {number}
+     */
+    private static rc4KeysCount: number = 50;
+
     /**
      * @type {IStorage<ICustomNodeGroup>}
      */
@@ -64,7 +75,12 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
         this.stringArrayStorage = stringArrayStorage;
 
         this.rc4Keys = RandomGeneratorUtils.getRandomGenerator()
-            .n(() => RandomGeneratorUtils.getRandomGenerator().string({length: 4}), 50);
+            .n(
+                () => RandomGeneratorUtils.getRandomGenerator().string({
+                    length: StringLiteralObfuscatingReplacer.rc4KeyLength
+                }),
+                StringLiteralObfuscatingReplacer.rc4KeysCount
+            );
     }
 
     /**
@@ -96,22 +112,17 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
      * @returns {ESTree.Node}
      */
     public replace (nodeValue: string): ESTree.Node {
-        const usingStringArray: boolean = this.canUseStringArray(nodeValue);
-        const cacheKey: string = `${nodeValue}-${String(usingStringArray)}`;
+        const useStringArray: boolean = this.canUseStringArray(nodeValue);
+        const cacheKey: string = `${nodeValue}-${String(useStringArray)}`;
+        const useCacheValue: boolean = this.nodesCache.has(cacheKey) && this.options.stringArrayEncoding !== StringArrayEncoding.Rc4;
 
-        if (this.nodesCache.has(cacheKey) && this.options.stringArrayEncoding !== StringArrayEncoding.rc4) {
+        if (useCacheValue) {
             return <ESTree.Node>this.nodesCache.get(cacheKey);
         }
 
-        let resultNode: ESTree.Node;
-
-        if (usingStringArray) {
-            resultNode = this.replaceWithStringArrayCallNode(nodeValue);
-        } else {
-            resultNode = Nodes.getLiteralNode(
-                `${Utils.stringToUnicodeEscapeSequence(nodeValue, !this.options.unicodeEscapeSequence)}`
-            );
-        }
+        const resultNode: ESTree.Node = useStringArray
+            ? this.replaceWithStringArrayCallNode(nodeValue)
+            : this.replaceWithLiteralNode(nodeValue);
 
         this.nodesCache.set(cacheKey, resultNode);
 
@@ -132,20 +143,26 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
 
     /**
      * @param value
-     * @return {string}
+     * @param stringArrayStorageLength
+     * @return {IStringArrayIndexData}
      */
-    private getArrayHexadecimalIndex (value: string): string {
+    private getStringArrayHexadecimalIndex (value: string, stringArrayStorageLength: number): IStringArrayIndexData {
         if (this.stringLiteralHexadecimalIndexCache.has(value)) {
-            return <string>this.stringLiteralHexadecimalIndexCache.get(value);
+            return {
+                fromCache: true,
+                index: <string>this.stringLiteralHexadecimalIndexCache.get(value)
+            };
         }
 
-        const stringArrayStorageLength: number = this.stringArrayStorage.getLength();
-        const hexadecimalIndex: string = `${Utils.hexadecimalPrefix}${Utils.decToHex(stringArrayStorageLength)}`;
+        const hexadecimalRawIndex: string = Utils.decToHex(stringArrayStorageLength);
+        const hexadecimalIndex: string = `${Utils.hexadecimalPrefix}${hexadecimalRawIndex}`;
 
-        this.stringArrayStorage.set(stringArrayStorageLength, value);
         this.stringLiteralHexadecimalIndexCache.set(value, hexadecimalIndex);
 
-        return hexadecimalIndex;
+        return {
+            fromCache: false,
+            index: hexadecimalIndex
+        };
     }
 
     /**
@@ -154,16 +171,16 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
      */
     private getEncodedValue (value: string): IEncodedValue {
         let encodedValue: string,
-            key: string | undefined;
+            key: string | null = null;
 
         switch (this.options.stringArrayEncoding) {
-            case StringArrayEncoding.rc4:
+            case StringArrayEncoding.Rc4:
                 key = RandomGeneratorUtils.getRandomGenerator().pickone(this.rc4Keys);
                 encodedValue = CryptUtils.btoa(CryptUtils.rc4(value, key));
 
                 break;
 
-            case StringArrayEncoding.base64:
+            case StringArrayEncoding.Base64:
                 encodedValue = CryptUtils.btoa(value);
 
                 break;
@@ -172,28 +189,50 @@ export class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplace
                 encodedValue = value;
         }
 
-        encodedValue = Utils.stringToUnicodeEscapeSequence(encodedValue, !this.options.unicodeEscapeSequence);
-
         return { encodedValue, key };
     }
 
+    /**
+     * @param value
+     * @return {ESTree.Literal}
+     */
+    private replaceWithLiteralNode (value: string): ESTree.Node {
+        return Nodes.getLiteralNode(
+            Utils.stringToUnicodeEscapeSequence(
+                value,
+                this.options.unicodeEscapeSequence
+            )
+        );
+    }
+
     /**
      * @param value
      * @returns {ESTree.Node}
      */
     private replaceWithStringArrayCallNode (value: string): ESTree.Node {
         const { encodedValue, key }: IEncodedValue = this.getEncodedValue(value);
+        const escapedValue: string = Utils.stringToUnicodeEscapeSequence(encodedValue, this.options.unicodeEscapeSequence);
+
+        const stringArrayStorageLength: number = this.stringArrayStorage.getLength();
         const rotatedStringArrayStorageId: string = Utils.stringRotate(this.stringArrayStorage.getStorageId(), 1);
         const stringArrayStorageCallsWrapperName: string = `_${Utils.hexadecimalPrefix}${rotatedStringArrayStorageId}`;
+
+        const { fromCache, index }: IStringArrayIndexData = this.getStringArrayHexadecimalIndex(
+            escapedValue,
+            stringArrayStorageLength
+        );
+
+        if (!fromCache) {
+            this.stringArrayStorage.set(stringArrayStorageLength, escapedValue);
+        }
+
         const callExpressionArgs: (ESTree.Expression | ESTree.SpreadElement)[] = [
-            StringLiteralObfuscatingReplacer.getHexadecimalLiteralNode(
-                this.getArrayHexadecimalIndex(encodedValue)
-            )
+            StringLiteralObfuscatingReplacer.getHexadecimalLiteralNode(index)
         ];
 
         if (key) {
             callExpressionArgs.push(StringLiteralObfuscatingReplacer.getRc4KeyLiteralNode(
-                Utils.stringToUnicodeEscapeSequence(key, !this.options.unicodeEscapeSequence)
+                Utils.stringToUnicodeEscapeSequence(key, this.options.unicodeEscapeSequence)
             ));
         }
 

+ 2 - 7
src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts

@@ -1,18 +1,13 @@
-import { TInputOptions } from '../../types/options/TInputOptions';
 import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
 
 import { IOptions } from '../../interfaces/options/IOptions';
 
-const DISABLED_CONTROL_FLOW_FLATTENING_OPTIONS: TInputOptions = {
-    controlFlowFlattening: false,
-    controlFlowFlatteningThreshold: 0
-};
-
 export const ControlFlowFlatteningThresholdRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
     if (options.controlFlowFlatteningThreshold === 0) {
         options = {
             ...options,
-            ...DISABLED_CONTROL_FLOW_FLATTENING_OPTIONS
+            controlFlowFlattening: false,
+            controlFlowFlatteningThreshold: 0
         };
     }
 

+ 4 - 13
src/options/normalizer-rules/DeadCodeInjectionRule.ts

@@ -1,31 +1,22 @@
-import { TInputOptions } from '../../types/options/TInputOptions';
 import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
 
 import { IOptions } from '../../interfaces/options/IOptions';
 
 import { DEFAULT_PRESET } from '../presets/Default';
 
-const ENABLED_DEAD_CODE_INJECTION_OPTIONS: TInputOptions = {
-    deadCodeInjection: true,
-    stringArray: true
-};
-
-const ENABLED_STRING_ARRAY_THRESHOLD_OPTIONS: TInputOptions = {
-    stringArray: true,
-    stringArrayThreshold: DEFAULT_PRESET.stringArrayThreshold
-};
-
 export const DeadCodeInjectionRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
     if (options.deadCodeInjection) {
         options = {
             ...options,
-            ...ENABLED_DEAD_CODE_INJECTION_OPTIONS,
+            deadCodeInjection: true,
+            stringArray: true
         };
 
         if (!options.stringArrayThreshold) {
             options = {
                 ...options,
-                ...ENABLED_STRING_ARRAY_THRESHOLD_OPTIONS
+                stringArray: true,
+                stringArrayThreshold: <number>DEFAULT_PRESET.stringArrayThreshold
             };
         }
     }

+ 2 - 7
src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts

@@ -1,18 +1,13 @@
-import { TInputOptions } from '../../types/options/TInputOptions';
 import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
 
 import { IOptions } from '../../interfaces/options/IOptions';
 
-const DISABLED_DEAD_CODE_INJECTION_OPTIONS: TInputOptions = {
-    deadCodeInjection: false,
-    deadCodeInjectionThreshold: 0
-};
-
 export const DeadCodeInjectionThresholdRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
     if (options.deadCodeInjectionThreshold === 0) {
         options = {
             ...options,
-            ...DISABLED_DEAD_CODE_INJECTION_OPTIONS
+            deadCodeInjection: false,
+            deadCodeInjectionThreshold: 0
         };
     }
 

+ 2 - 7
src/options/normalizer-rules/SelfDefendingRule.ts

@@ -1,18 +1,13 @@
-import { TInputOptions } from '../../types/options/TInputOptions';
 import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
 
 import { IOptions } from '../../interfaces/options/IOptions';
 
-const SELF_DEFENDING_OPTIONS: TInputOptions = {
-    compact: true,
-    selfDefending: true
-};
-
 export const SelfDefendingRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
     if (options.selfDefending) {
         options = {
             ...options,
-            ...SELF_DEFENDING_OPTIONS
+            compact: true,
+            selfDefending: true
         };
     }
 

+ 1 - 6
src/options/normalizer-rules/StringArrayEncodingRule.ts

@@ -1,17 +1,12 @@
-import { TInputOptions } from '../../types/options/TInputOptions';
 import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
 
 import { IOptions } from '../../interfaces/options/IOptions';
 
-const STRING_ARRAY_ENCODING_OPTIONS: TInputOptions = {
-    stringArrayEncoding: 'base64'
-};
-
 export const StringArrayEncodingRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
     if (options.stringArrayEncoding === true) {
         options = {
             ...options,
-            ...STRING_ARRAY_ENCODING_OPTIONS
+            stringArrayEncoding: 'base64'
         };
     }
 

+ 4 - 9
src/options/normalizer-rules/StringArrayRule.ts

@@ -1,20 +1,15 @@
-import { TInputOptions } from '../../types/options/TInputOptions';
 import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
 
 import { IOptions } from '../../interfaces/options/IOptions';
 
-const DISABLED_STRING_ARRAY_OPTIONS: TInputOptions = {
-    rotateStringArray: false,
-    stringArray: false,
-    stringArrayEncoding: false,
-    stringArrayThreshold: 0
-};
-
 export const StringArrayRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
     if (!options.stringArray) {
         options = {
             ...options,
-            ...DISABLED_STRING_ARRAY_OPTIONS
+            rotateStringArray: false,
+            stringArray: false,
+            stringArrayEncoding: false,
+            stringArrayThreshold: 0
         };
     }
 

+ 4 - 9
src/options/normalizer-rules/StringArrayThresholdRule.ts

@@ -1,20 +1,15 @@
-import { TInputOptions } from '../../types/options/TInputOptions';
 import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
 
 import { IOptions } from '../../interfaces/options/IOptions';
 
-const DISABLED_STRING_ARRAY_OPTIONS: TInputOptions = {
-    rotateStringArray: false,
-    stringArray: false,
-    stringArrayEncoding: false,
-    stringArrayThreshold: 0
-};
-
 export const StringArrayThresholdRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
     if (options.stringArrayThreshold === 0) {
         options = {
             ...options,
-            ...DISABLED_STRING_ARRAY_OPTIONS
+            rotateStringArray: false,
+            stringArray: false,
+            stringArrayEncoding: false,
+            stringArrayThreshold: 0
         };
     }
 

+ 6 - 2
src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts

@@ -15,13 +15,17 @@ export function SelfDefendingTemplate (): string {
                 };
                 
             var test1 = function () {
-                var regExp = new RegExp('${Utils.stringToUnicodeEscapeSequence(`\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}`)}');
+                var regExp = new RegExp('${
+                    Utils.stringToUnicodeEscapeSequence(`\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}`, true)
+                }');
                 
                 return !regExp.test(func1.toString());
             };
             
             var test2 = function () {
-                var regExp = new RegExp('${Utils.stringToUnicodeEscapeSequence(`(\\\\[x|u](\\w){2,4})+`)}');
+                var regExp = new RegExp('${
+                    Utils.stringToUnicodeEscapeSequence(`(\\\\[x|u](\\w){2,4})+`, true)
+                }');
                 
                 return regExp.test(func2.toString());
             };

+ 6 - 2
src/templates/custom-nodes/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts

@@ -9,8 +9,12 @@ export function SelfDefendingTemplate (): string {
             this.rc4Bytes = rc4Bytes;
             this.states = [1, 0, 0];
             this.newState = function(){return 'newState';};
-            this.firstState = '${Utils.stringToUnicodeEscapeSequence(`\\w+ *\\(\\) *{\\w+ *`)}';
-            this.secondState = '${Utils.stringToUnicodeEscapeSequence(`['|"].+['|"];? *}`)}';
+            this.firstState = '${
+                Utils.stringToUnicodeEscapeSequence(`\\w+ *\\(\\) *{\\w+ *`, true)
+            }';
+            this.secondState = '${
+                Utils.stringToUnicodeEscapeSequence(`['|"].+['|"];? *}`, true)
+            }';
         };
         
         StatesClass.prototype.checkState = function () {

+ 3 - 1
src/templates/custom-nodes/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts

@@ -55,7 +55,9 @@ export function SelfDefendingTemplate (): string {
             };
             
             var test1 = function () {
-                var regExp = new RegExp('${Utils.stringToUnicodeEscapeSequence(`\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}`)}');
+                var regExp = new RegExp('${
+                    Utils.stringToUnicodeEscapeSequence(`\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}`, true)
+                }');
                 
                 return regExp.test(object.removeCookie.toString());
             };

+ 0 - 1
src/types/event-emitters/TObfuscationEvent.d.ts

@@ -1 +0,0 @@
-export type TObfuscationEvent = 'beforeObfuscation' | 'afterObfuscation';

+ 11 - 11
src/utils/Utils.ts

@@ -138,18 +138,18 @@ export class Utils {
         return Array
             .from(string)
             .map((character: string): string => {
-                return JSFuck[character] || character;
+                return JSFuck[<any>character] || character;
             })
             .join(' + ');
     }
 
     /**
      * @param string
-     * @param nonLatinAndNonDigitsOnly
+     * @param usingUnicodeEscapeSequence
      * @returns {string}
      */
-    public static stringToUnicodeEscapeSequence (string: string, nonLatinAndNonDigitsOnly: boolean = false): string {
-        const cacheKey: string = `${string}-${String(nonLatinAndNonDigitsOnly)}`;
+    public static stringToUnicodeEscapeSequence (string: string, usingUnicodeEscapeSequence: boolean): string {
+        const cacheKey: string = `${string}-${String(usingUnicodeEscapeSequence)}`;
 
         if (Utils.stringToUnicodeEscapeSequenceCache.has(cacheKey)) {
             return <string>Utils.stringToUnicodeEscapeSequenceCache.get(cacheKey);
@@ -157,18 +157,18 @@ export class Utils {
 
         const radix: number = 16;
         const replaceRegExp: RegExp = new RegExp('[\\s\\S]', 'g');
-        const escapeRegExp: RegExp = new RegExp('[^a-zA-Z0-9]');
-        const regexp: RegExp = new RegExp('[\\x00-\\x7F]');
+        const escapeSequenceRegExp: RegExp = new RegExp('[\'\"\\\\\\s]');
+        const regExp: RegExp = new RegExp('[\\x00-\\x7F]');
 
         let prefix: string,
             template: string;
 
-        const result: string = string.replace(replaceRegExp, (escape: string): string => {
-            if (nonLatinAndNonDigitsOnly && !escapeRegExp.exec(escape)) {
-                return escape;
+        const result: string = string.replace(replaceRegExp, (character: string): string => {
+            if (!usingUnicodeEscapeSequence && !escapeSequenceRegExp.exec(character)) {
+                return character;
             }
 
-            if (regexp.exec(escape)) {
+            if (regExp.exec(character)) {
                 prefix = '\\x';
                 template = '00';
             } else {
@@ -176,7 +176,7 @@ export class Utils {
                 template = '0000';
             }
 
-            return `${prefix}${(template + escape.charCodeAt(0).toString(radix)).slice(-template.length)}`;
+            return `${prefix}${(template + character.charCodeAt(0).toString(radix)).slice(-template.length)}`;
         });
 
         Utils.stringToUnicodeEscapeSequenceCache.set(cacheKey, result);

+ 1 - 1
test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts

@@ -254,7 +254,7 @@ describe('JavaScriptObfuscator', () => {
         });
 
         describe('cyrillic literal variable value', () => {
-            const stringArrayCyrillicRegExp: RegExp = /^var _0x(\w){4} *= *\['(\\u\d+)+'\];/;
+            const stringArrayCyrillicRegExp: RegExp = /^var _0x(\w){4} *= *\['абц'\];/;
             const stringArrayCallRegExp: RegExp = /var *test *= *_0x(\w){4}\('0x0'\);$/;
 
             let obfuscatedCode: string;

+ 4 - 4
test/functional-tests/node-transformers/control-flow-transformers/block-statement-control-flow-transformer/BlockStatementControlFlowTransformer.spec.ts

@@ -87,7 +87,7 @@ describe('BlockStatementControlFlowTransformer', function () {
             });
 
             describe('switch-case map', () => {
-                const switchCaseMapVariableRegExp: RegExp = /var *_0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4,6}\['.*'\]\['split'\]\('\\x7c'\)/;
+                const switchCaseMapVariableRegExp: RegExp = /var *_0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4,6}\['.*'\]\['split'\]\('\|'\)/;
                 const switchCaseMapStringRegExp: RegExp = /var *_0x(?:[a-f0-9]){4,6} *= *\{'.*' *: *'(.*)'\};/;
                 const expectedSwitchCasesSequence: string[] = ['0', '1', '2', '3', '4'];
 
@@ -96,7 +96,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 before(() => {
                     const switchCaseMapMatch: string = getRegExpMatch(obfuscatedCode, switchCaseMapStringRegExp);
 
-                    switchCaseMap = switchCaseMapMatch.replace(/\\x7c/g, '|').split('|').sort();
+                    switchCaseMap = switchCaseMapMatch.split('|').sort();
                 });
 
                 it('should create switch-case map variable', () => {
@@ -176,7 +176,7 @@ describe('BlockStatementControlFlowTransformer', function () {
             });
 
             describe('switch-case map', () => {
-                const switchCaseMapVariableRegExp: RegExp = /var *_0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4,6}\['.*'\]\['split'\]\('\\x7c'\)/;
+                const switchCaseMapVariableRegExp: RegExp = /var *_0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4,6}\['.*'\]\['split'\]\('\|'\)/;
                 const switchCaseMapStringRegExp: RegExp = /var *_0x(?:[a-f0-9]){4,6} *= *\{'.*' *: *'(.*)'\};/;
                 const expectedSwitchCasesSequence: string[] = ['0', '1', '2', '3', '4'];
 
@@ -185,7 +185,7 @@ describe('BlockStatementControlFlowTransformer', function () {
                 before(() => {
                     const switchCaseMapMatch: string = getRegExpMatch(obfuscatedCode, switchCaseMapStringRegExp);
 
-                    switchCaseMap = switchCaseMapMatch.replace(/\\x7c/g, '|').split('|').sort();
+                    switchCaseMap = switchCaseMapMatch.split('|').sort();
                 });
 
                 it('should create switch-case map variable', () => {

+ 2 - 2
test/functional-tests/node-transformers/obfuscating-transformers/literal-transformer/LiteralTransformer.spec.ts

@@ -190,7 +190,7 @@ describe('LiteralTransformer', () => {
         });
 
         describe('variant #8: base64 encoding', () => {
-            const stringArrayRegExp: RegExp = /^var *_0x([a-f0-9]){4} *= *\['dGVzdA\\x3d\\x3d'\];/;
+            const stringArrayRegExp: RegExp = /^var *_0x([a-f0-9]){4} *= *\['dGVzdA=='\];/;
             const stringArrayCallRegExp: RegExp = /var *test *= *_0x([a-f0-9]){4}\('0x0'\);/;
 
             let obfuscatedCode: string;
@@ -220,7 +220,7 @@ describe('LiteralTransformer', () => {
         });
 
         describe('variant #9: rc4 encoding', () => {
-            const regExp: RegExp = /var *test *= *_0x([a-f0-9]){4}\('0x0', *'(?:\w|(?:\\x[a-f0-9]*)){4}'\);/;
+            const regExp: RegExp = /var *test *= *_0x([a-f0-9]){4}\('0x0', *'.{4}'\);/;
 
             let obfuscatedCode: string;
 

+ 6 - 6
test/unit-tests/utils/utils/Utils.spec.ts

@@ -345,7 +345,7 @@ describe('Utils', () => {
             let actualString: string;
 
             before(() => {
-                actualString = Utils.stringToUnicodeEscapeSequence(string);
+                actualString = Utils.stringToUnicodeEscapeSequence(string, true);
             });
 
             it('should return a unicode escape sequence based on a given string', () => {
@@ -353,17 +353,17 @@ describe('Utils', () => {
             });
         });
 
-        describe('variant #2: escape non-digits and non-latin letters', () => {
-            const string: string = 'abc!де';
-            const expectedString: string = 'abc\\x21\\u0434\\u0435';
+        describe('variant #2: escape `escape sequences`', () => {
+            const string: string = 'abc\'\\r\\n';
+            const expectedString: string = 'abc\\x27\\x5cr\\x5cn';
 
             let actualString: string;
 
             before(() => {
-                actualString = Utils.stringToUnicodeEscapeSequence(string, true);
+                actualString = Utils.stringToUnicodeEscapeSequence(string, false);
             });
 
-            it('should return a string where only non-digits and non-latin letters are escaped', () => {
+            it('should return a string where all `escape sequences` are escaped', () => {
                 assert.equal(actualString, expectedString);
             });
         });

+ 136 - 44
yarn.lock

@@ -45,13 +45,13 @@
   resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.41.tgz#e27cf0817153eb9f2713b2d3f6c68f1e1c3ca608"
 
 "@types/node@*":
-  version "7.0.29"
-  resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.29.tgz#ccfcec5b7135c7caf6c4ffb8c7f33102340d99df"
-
-"@types/[email protected]":
   version "7.0.31"
   resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.31.tgz#80ea4d175599b2a00149c29a10a4eb2dff592e86"
 
+"@types/[email protected]":
+  version "8.0.0"
+  resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.0.tgz#acaa89247afddc7967e9902fd11761dadea1a555"
+
 "@types/[email protected]":
   version "2.3.1"
   resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-2.3.1.tgz#5e214093e9e2345219ab0f31bf310c9790ad0712"
@@ -78,17 +78,25 @@ acorn@^5.0.0:
   version "5.0.3"
   resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d"
 
-ajv-keywords@^1.1.1:
-  version "1.5.1"
-  resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c"
+ajv-keywords@^2.0.0:
+  version "2.1.0"
+  resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.0.tgz#a296e17f7bfae7c1ce4f7e0de53d29cb32162df0"
 
-ajv@^4.7.0, ajv@^4.9.1:
+ajv@^4.9.1:
   version "4.11.8"
   resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536"
   dependencies:
     co "^4.6.0"
     json-stable-stringify "^1.0.1"
 
+ajv@^5.1.5:
+  version "5.1.6"
+  resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.1.6.tgz#4b2f1a19dece93d57ac216037e3e9791c7dd1564"
+  dependencies:
+    co "^4.6.0"
+    json-schema-traverse "^0.3.0"
+    json-stable-stringify "^1.0.1"
+
 align-text@^0.1.1, align-text@^0.1.3:
   version "0.1.4"
   resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117"
@@ -848,9 +856,9 @@ [email protected], chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1:
     strip-ansi "^3.0.0"
     supports-color "^2.0.0"
 
[email protected].9:
-  version "1.0.9"
-  resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.9.tgz#85ae52c145c433d69f6f1eff24f056012b77a60f"
[email protected].10:
+  version "1.0.10"
+  resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.10.tgz#03500b04ad94e778dd2891b09ec73a6ad87b1996"
 
 check-error@^1.0.1:
   version "1.0.2"
@@ -877,9 +885,9 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
   dependencies:
     inherits "^2.0.1"
 
[email protected].0:
-  version "0.7.0"
-  resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.7.0.tgz#a45b96aaa2154d06efda1cac1061b0adf69ea55e"
[email protected].1:
+  version "0.7.1"
+  resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.7.1.tgz#86d60d30d49783113a9d5e606fecbe7aceaf50b5"
   dependencies:
     validator "^7.0.0"
 
@@ -1041,6 +1049,12 @@ crypto-browserify@^3.11.0:
     public-encrypt "^4.0.0"
     randombytes "^2.0.0"
 
+d@1:
+  version "1.0.0"
+  resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f"
+  dependencies:
+    es5-ext "^0.10.9"
+
 dashdash@^1.12.0:
   version "1.14.1"
   resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
@@ -1173,6 +1187,58 @@ error-ex@^1.2.0:
   dependencies:
     is-arrayish "^0.2.1"
 
+es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14:
+  version "0.10.23"
+  resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.23.tgz#7578b51be974207a5487821b56538c224e4e7b38"
+  dependencies:
+    es6-iterator "2"
+    es6-symbol "~3.1"
+
+es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1:
+  version "2.0.1"
+  resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512"
+  dependencies:
+    d "1"
+    es5-ext "^0.10.14"
+    es6-symbol "^3.1"
+
+es6-map@^0.1.3:
+  version "0.1.5"
+  resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0"
+  dependencies:
+    d "1"
+    es5-ext "~0.10.14"
+    es6-iterator "~2.0.1"
+    es6-set "~0.1.5"
+    es6-symbol "~3.1.1"
+    event-emitter "~0.3.5"
+
+es6-set@~0.1.5:
+  version "0.1.5"
+  resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1"
+  dependencies:
+    d "1"
+    es5-ext "~0.10.14"
+    es6-iterator "~2.0.1"
+    es6-symbol "3.1.1"
+    event-emitter "~0.3.5"
+
[email protected], es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1:
+  version "3.1.1"
+  resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
+  dependencies:
+    d "1"
+    es5-ext "~0.10.14"
+
+es6-weak-map@^2.0.1:
+  version "2.0.2"
+  resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f"
+  dependencies:
+    d "1"
+    es5-ext "^0.10.14"
+    es6-iterator "^2.0.1"
+    es6-symbol "^3.1.1"
+
 [email protected], escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
   version "1.0.5"
   resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -1198,6 +1264,15 @@ escodegen@~1.3.2:
   optionalDependencies:
     source-map "~0.1.33"
 
+escope@^3.6.0:
+  version "3.6.0"
+  resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3"
+  dependencies:
+    es6-map "^0.1.3"
+    es6-weak-map "^2.0.1"
+    esrecurse "^4.1.0"
+    estraverse "^4.1.1"
+
 escope@~1.0.1:
   version "1.0.3"
   resolved "https://registry.yarnpkg.com/escope/-/escope-1.0.3.tgz#759dce8496c4248fec2d0caaf4108bcf3f1a7f5d"
@@ -1233,6 +1308,13 @@ esprima@~1.1.1:
   version "1.1.1"
   resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.1.1.tgz#5b6f1547f4d102e670e140c509be6771d6aeb549"
 
+esrecurse@^4.1.0:
+  version "4.1.0"
+  resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220"
+  dependencies:
+    estraverse "~4.1.0"
+    object-assign "^4.0.1"
+
 esshorten@~1.1.0:
   version "1.1.1"
   resolved "https://registry.yarnpkg.com/esshorten/-/esshorten-1.1.1.tgz#174f96b7cc267e46872d814e7db7c290bdff61a9"
@@ -1241,7 +1323,7 @@ esshorten@~1.1.0:
     estraverse "~4.1.1"
     esutils "~2.0.2"
 
[email protected]:
[email protected], estraverse@^4.1.1:
   version "4.2.0"
   resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
 
@@ -1257,7 +1339,7 @@ estraverse@~1.5.0:
   version "1.5.1"
   resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.5.1.tgz#867a3e8e58a9f84618afb6c2ddbcd916b7cbaf71"
 
-estraverse@~4.1.1:
+estraverse@~4.1.0, estraverse@~4.1.1:
   version "4.1.1"
   resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2"
 
@@ -1269,6 +1351,13 @@ esutils@^2.0.2, esutils@~2.0.2:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.0.0.tgz#8151d358e20c8acc7fb745e7472c0025fe496570"
 
+event-emitter@~0.3.5:
+  version "0.3.5"
+  resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39"
+  dependencies:
+    d "1"
+    es5-ext "~0.10.14"
+
 events@^1.0.0:
   version "1.1.1"
   resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
@@ -1923,6 +2012,10 @@ json-loader@^0.5.4:
   version "0.5.4"
   resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.4.tgz#8baa1365a632f58a3c46d20175fc6002c96e37de"
 
+json-schema-traverse@^0.3.0:
+  version "0.3.0"
+  resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.0.tgz#0016c0b1ca1efe46d44d37541bcdfc19dcfae0db"
+
 [email protected]:
   version "0.2.3"
   resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"
@@ -2010,15 +2103,6 @@ loader-runner@^2.3.0:
   version "2.3.0"
   resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"
 
-loader-utils@^0.2.16:
-  version "0.2.17"
-  resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348"
-  dependencies:
-    big.js "^3.1.3"
-    emojis-list "^2.0.0"
-    json5 "^0.5.0"
-    object-assign "^4.0.1"
-
 loader-utils@^1.0.2, loader-utils@^1.1.0:
   version "1.1.0"
   resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd"
@@ -2875,9 +2959,9 @@ [email protected]:
   dependencies:
     hoek "2.x.x"
 
-source-list-map@^1.1.1:
-  version "1.1.2"
-  resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.2.tgz#9889019d1024cce55cdc069498337ef6186a11a1"
+source-list-map@^2.0.0:
+  version "2.0.0"
+  resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"
 
 [email protected], source-map-support@^0.4.0, source-map-support@^0.4.15, source-map-support@^0.4.2:
   version "0.4.15"
@@ -3181,11 +3265,11 @@ typedarray@^0.0.6:
   version "0.0.6"
   resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
 
-typescript@2.3.4:
-  version "2.3.4"
-  resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.4.tgz#3d38321828231e434f287514959c37a82b629f42"
[email protected].0:
+  version "2.4.0"
+  resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.0.tgz#aef5a8d404beba36ad339abf079ddddfffba86dd"
 
-uglify-js@^2.6, uglify-js@^2.8.27:
+uglify-js@^2.6:
   version "2.8.27"
   resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.27.tgz#47787f912b0f242e5b984343be8e35e95f694c9c"
   dependencies:
@@ -3198,6 +3282,13 @@ uglify-to-browserify@~1.0.0:
   version "1.0.2"
   resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
 
+uglifyjs-webpack-plugin@^0.4.4:
+  version "0.4.4"
+  resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.4.tgz#7829c50ee5a5b755969d4458357ed5a2dd36fbbd"
+  dependencies:
+    source-map "^0.5.6"
+    webpack-sources "^1.0.1"
+
 uid-number@^0.0.6:
   version "0.0.6"
   resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81"
@@ -3268,37 +3359,38 @@ [email protected]:
   version "1.6.0"
   resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-1.6.0.tgz#232c62ec6092b100635a3d29d83c1747128df9bd"
 
-webpack-sources@^0.2.3:
-  version "0.2.3"
-  resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.2.3.tgz#17c62bfaf13c707f9d02c479e0dcdde8380697fb"
+webpack-sources@^1.0.1:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf"
   dependencies:
-    source-list-map "^1.1.1"
+    source-list-map "^2.0.0"
     source-map "~0.5.3"
 
-webpack@2.6.1:
-  version "2.6.1"
-  resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.6.1.tgz#2e0457f0abb1ac5df3ab106c69c672f236785f07"
+webpack@3.0.0:
+  version "3.0.0"
+  resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.0.0.tgz#ee9bcebf21247f7153cb410168cab45e3a59d4d7"
   dependencies:
     acorn "^5.0.0"
     acorn-dynamic-import "^2.0.0"
-    ajv "^4.7.0"
-    ajv-keywords "^1.1.1"
+    ajv "^5.1.5"
+    ajv-keywords "^2.0.0"
     async "^2.1.2"
     enhanced-resolve "^3.0.0"
+    escope "^3.6.0"
     interpret "^1.0.0"
     json-loader "^0.5.4"
     json5 "^0.5.1"
     loader-runner "^2.3.0"
-    loader-utils "^0.2.16"
+    loader-utils "^1.1.0"
     memory-fs "~0.4.1"
     mkdirp "~0.5.0"
     node-libs-browser "^2.0.0"
     source-map "^0.5.3"
     supports-color "^3.1.0"
     tapable "~0.2.5"
-    uglify-js "^2.8.27"
+    uglifyjs-webpack-plugin "^0.4.4"
     watchpack "^1.3.1"
-    webpack-sources "^0.2.3"
+    webpack-sources "^1.0.1"
     yargs "^6.0.0"
 
 which-module@^1.0.0:

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません