Browse Source

sync branch with dev

sanex3339 8 years ago
parent
commit
5d0434fa97

+ 5 - 0
README.md

@@ -465,6 +465,8 @@ Performance will 50-100% slower than without obfuscation
     compact: true,
     controlFlowFlattening: true,
     controlFlowFlatteningThreshold: 1,
+    deadCodeInjection: true,
+	deadCodeInjectionThreshold: 1,
     debugProtection: true,
     debugProtectionInterval: true,
     disableConsoleOutput: true,
@@ -486,6 +488,8 @@ Performance will 30-35% slower than without obfuscation
     compact: true,
     controlFlowFlattening: true,
     controlFlowFlatteningThreshold: 0.75,
+    deadCodeInjection: true,
+    deadCodeInjectionThreshold: 0.75,
     debugProtection: false,
     debugProtectionInterval: false,
     disableConsoleOutput: true,
@@ -506,6 +510,7 @@ Performance will slightly slower than without obfuscation
 {
     compact: true,
     controlFlowFlattening: false,
+    deadCodeInjection: false,
     debugProtection: false,
     debugProtectionInterval: false,
     disableConsoleOutput: true,

File diff suppressed because it is too large
+ 247 - 172
dist/index.js


+ 1 - 6
src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts

@@ -6,7 +6,6 @@ import * as ESTree from 'estree';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IVisitor } from '../../interfaces/IVisitor';
 
-
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { Node } from '../../node/Node';
 import { RandomGeneratorUtils } from '../../utils/RandomGeneratorUtils';
@@ -48,10 +47,6 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
             return blockStatementNode;
         }
 
-        const blockStatementBody: ESTree.Statement[] = blockStatementNode.body;
-
-
-
-        return blockStatementBody[0];
+        return blockStatementNode;
     }
 }

+ 2 - 2
test/dev/dev.ts

@@ -30,8 +30,8 @@ import { NO_CUSTOM_NODES_PRESET } from '../../src/options/presets/NoCustomNodes'
             compact: false,
             stringArray: true,
             stringArrayThreshold: 1,
-            controlFlowFlattening: true,
-            controlFlowFlatteningThreshold: 1
+            deadCodeInjection: true,
+            deadCodeInjectionThreshold: 1
         }
     ).getObfuscatedCode();
 

Some files were not shown because too many files changed in this diff