sanex3339 9 lat temu
rodzic
commit
19b1a13971

+ 3 - 2
dist/src/JavaScriptObfuscator.js

@@ -13,8 +13,9 @@ class JavaScriptObfuscator {
     static generateCode(astTree, options) {
         let escodegenParams = Object.assign({}, JavaScriptObfuscator.escodegenParams);
         if (options.hasOwnProperty('compact')) {
-            escodegenParams.format = {};
-            escodegenParams.format.compact = options.compact;
+            escodegenParams.format = {
+                compact: options.compact
+            };
         }
         return escodegen.generate(astTree, escodegenParams);
     }

+ 3 - 1
dist/src/Obfuscator.js

@@ -88,7 +88,9 @@ class Obfuscator {
         if (this.options['debugProtection']) {
             this.setNodesGroup(new DebugProtectionNodesGroup_1.DebugProtectionNodesGroup(this.options));
         }
-        this.setNodesGroup(new UnicodeArrayNodesGroup_1.UnicodeArrayNodesGroup(this.options));
+        if (this.options['unicodeArray']) {
+            this.setNodesGroup(new UnicodeArrayNodesGroup_1.UnicodeArrayNodesGroup(this.options));
+        }
     }
 }
 exports.Obfuscator = Obfuscator;

+ 0 - 3
dist/src/node-groups/UnicodeArrayNodesGroup.js

@@ -12,9 +12,6 @@ class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
         this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
         this.unicodeArrayRotateValue = this.options['rotateUnicodeArray'] ? Utils_1.Utils.getRandomInteger(100, 500) : 0;
         let unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(this.unicodeArrayName, this.unicodeArrayRotateValue), unicodeArray = unicodeArrayNode.getNodeData();
-        if (!this.options['unicodeArray']) {
-            return;
-        }
         this.nodes.set('unicodeArrayNode', unicodeArrayNode);
         if (this.options['wrapUnicodeArrayCalls']) {
             this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray));

+ 3 - 2
src/JavaScriptObfuscator.ts

@@ -41,8 +41,9 @@ export class JavaScriptObfuscator {
         let escodegenParams: escodegen.GenerateOptions = Object.assign({}, JavaScriptObfuscator.escodegenParams);
 
         if (options.hasOwnProperty('compact')) {
-            escodegenParams.format = {};
-            escodegenParams.format.compact = options.compact;
+            escodegenParams.format = {
+                compact: options.compact
+            };
         }
 
         return escodegen.generate(astTree, escodegenParams);

+ 6 - 4
src/Obfuscator.ts

@@ -155,9 +155,11 @@ export class Obfuscator {
             this.setNodesGroup(new DebugProtectionNodesGroup(this.options));
         }
 
-        /**
-         * Important to set this nodes latest to prevent runtime errors cause by `rotateUnicodeArray` option
-         */
-        this.setNodesGroup(new UnicodeArrayNodesGroup(this.options));
+        if (this.options['unicodeArray']) {
+            /**
+             * Important to set this nodes latest to prevent runtime errors cause by `rotateUnicodeArray` option
+             */
+            this.setNodesGroup(new UnicodeArrayNodesGroup(this.options));
+        }
     }
 }

+ 0 - 4
src/node-groups/UnicodeArrayNodesGroup.ts

@@ -37,10 +37,6 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
             ),
             unicodeArray: string [] = unicodeArrayNode.getNodeData();
 
-        if (!this.options['unicodeArray']) {
-            return;
-        }
-
         this.nodes.set(
             'unicodeArrayNode',
             unicodeArrayNode