mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Added mangleProperties option
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)',
|
||||
|
||||
@@ -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[];
|
||||
|
||||
@@ -150,6 +150,12 @@ export class Options implements IOptions {
|
||||
@IsBoolean()
|
||||
public readonly log!: boolean;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
@IsBoolean()
|
||||
public readonly mangleProperties!: boolean;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,7 @@ export const DEFAULT_PRESET: TInputOptions = Object.freeze({
|
||||
identifiersDictionary: [],
|
||||
inputFileName: '',
|
||||
log: false,
|
||||
mangleProperties: false,
|
||||
renameGlobals: false,
|
||||
reservedNames: [],
|
||||
reservedStrings: [],
|
||||
|
||||
@@ -20,6 +20,7 @@ export const NO_ADDITIONAL_NODES_PRESET: TInputOptions = Object.freeze({
|
||||
identifiersDictionary: [],
|
||||
inputFileName: '',
|
||||
log: false,
|
||||
mangleProperties: false,
|
||||
renameGlobals: false,
|
||||
reservedNames: [],
|
||||
reservedStrings: [],
|
||||
|
||||
Reference in New Issue
Block a user