mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
dev
This commit is contained in:
Vendored
+3
-2
@@ -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);
|
||||
}
|
||||
|
||||
Vendored
+3
-1
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,6 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
|
||||
),
|
||||
unicodeArray: string [] = unicodeArrayNode.getNodeData();
|
||||
|
||||
if (!this.options['unicodeArray']) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.nodes.set(
|
||||
'unicodeArrayNode',
|
||||
unicodeArrayNode
|
||||
|
||||
Reference in New Issue
Block a user