Added mangleProperties option

This commit is contained in:
sanex3339
2020-06-06 10:04:25 +03:00
parent 06176c29a6
commit f5e06fcfed
10 changed files with 39 additions and 41438 deletions
+4 -1
View File
@@ -209,7 +209,10 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.ControlFlowFlattening);
}
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.MangleProperties);
if (this.options.mangleProperties) {
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.MangleProperties);
}
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.Converting);
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.Obfuscating);
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.Finalizing);
+4
View File
@@ -249,6 +249,10 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
'--log <boolean>', 'Enables logging of the information to the console',
BooleanSanitizer
)
.option(
'--mangle-properties <boolean>', 'UNSAFE: Enables mangling property names',
BooleanSanitizer
)
.option(
'--reserved-names <list> (comma separated, without whitespaces)',
'Disables obfuscation and generation of identifiers, which being matched by passed RegExp patterns (comma separated)',
+1
View File
@@ -21,6 +21,7 @@ export interface IOptions {
readonly identifiersPrefix: string;
readonly inputFileName: string;
readonly log: boolean;
readonly mangleProperties: boolean;
readonly renameGlobals: boolean;
readonly reservedNames: string[];
readonly reservedStrings: string[];
+6
View File
@@ -150,6 +150,12 @@ export class Options implements IOptions {
@IsBoolean()
public readonly log!: boolean;
/**
* @type {boolean}
*/
@IsBoolean()
public readonly mangleProperties!: boolean;
/**
* @type {boolean}
*/
+1
View File
@@ -21,6 +21,7 @@ export const DEFAULT_PRESET: TInputOptions = Object.freeze({
identifiersDictionary: [],
inputFileName: '',
log: false,
mangleProperties: false,
renameGlobals: false,
reservedNames: [],
reservedStrings: [],
+1
View File
@@ -20,6 +20,7 @@ export const NO_ADDITIONAL_NODES_PRESET: TInputOptions = Object.freeze({
identifiersDictionary: [],
inputFileName: '',
log: false,
mangleProperties: false,
renameGlobals: false,
reservedNames: [],
reservedStrings: [],