8000 Renamed option `mangleProperties` -> `renameProperties` · sec-js/javascript-obfuscator@11cfaf2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 11cfaf2

Browse files
author
sanex3339
committed
Renamed option mangleProperties -> renameProperties
1 parent 5cd063f commit 11cfaf2

File tree

28 files changed

+117
-118
lines changed

28 files changed

+117
-118
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Change Log
22

33
v1.1.0
44
---
5-
* **New option:** `mangleProperties` enables mangling property names
5+
* **New option:** `renameProperties` enables mangling property names
66

77

88
v1.0.1

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ Following options are available for the JS Obfuscator:
329329
identifiersPrefix: '',
330330
inputFileName: '',
331331
log: false,
332-
mangleProperties: false,
333332
renameGlobals: false,
333+
renameProperties: false,
334334
reservedNames: [],
335335
reservedStrings: [],
336336
rotateStringArray: true,
@@ -374,8 +374,8 @@ Following options are available for the JS Obfuscator:
374374
--identifiers-dictionary '<list>' (comma separated)
375375
--identifiers-prefix <string>
376376
--log <boolean>
377-
--mangle-properties <boolean>
378377
--rename-globals <boolean>
378+
--rename-properties <boolean>
379379
--reserved-names '<list>' (comma separated)
380380
--reserved-strings '<list>' (comma separated)
381381
--rotate-string-array <boolean>
@@ -664,23 +664,23 @@ Type: `boolean` Default: `false`
664664

665665
Enables logging of the information to the console.
666666

667-
### `mangleProperties`
667+
### `renameGlobals< 10000 span class="pl-s">`
668668
Type: `boolean` Default: `false`
669669

670-
##### :warning: this option **WILL** break your code in most cases. Enable it only if you know what it does!
670+
##### :warning: this option can break your code. Enable it only if you know what it does!
671671

672-
Enables mangling property names.
672+
Enables obfuscation of global variable and function names **with declaration**.
673673

674-
To set format of renamed property names use [`identifierNamesGenerator`](#identifierNamesGenerator) option.
674+
### `renameProperties`
675+
Type: `boolean` Default: `false`
675676

676-
To control which properties will be renamed use [`reservedNames`](#reservedNames) option.
677+
##### :warning: this option **WILL** break your code in most cases. Enable it only if you know what it does!
677678

678-
### `renameGlobals`
679-
Type: `boolean` Default: `false`
679+
Enables rename of property names.
680680

681-
##### :warning: this option can break your code. Enable it only if you know what it does!
681+
To set format of renamed property names use [`identifierNamesGenerator`](#identifierNamesGenerator) option.
682682

683-
Enables obfuscation of global variable and function names **with declaration**.
683+
To control which properties will be renamed use [`reservedNames`](#reservedNames) option.
684684

685685
### `reservedNames`
686686
Type: `string[]` Default: `[]`

dist/index.browser.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.cli.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/JavaScriptObfuscator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
7070
NodeTransformer.FunctionControlFlowTransformer,
7171
NodeTransformer.LabeledStatementTransformer,
7272
NodeTransformer.LiteralTransformer,
73-
NodeTransformer.ManglePropertiesTransformer,
73+
NodeTransformer.RenamePropertiesTransformer,
7474
NodeTransformer.MemberExpressionTransformer,
7575
NodeTransformer.MetadataTransformer,
7676
NodeTransformer.MethodDefinitionTransformer,
@@ -209,8 +209,8 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
209209
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.ControlFlowFlattening);
210210
}
211211

212-
if (this.options.mangleProperties) {
213-
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.MangleProperties);
212+
if (this.options.renameProperties) {
213+
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.RenameProperties);
214214
}
215215

216216
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.Converting);

src/cli/JavaScriptObfuscatorCLI.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
238238
)
239239
.option(
240240
'--identifiers-prefix <string>',
241-
'Sets prefix for all global identifiers.'
241+
'Sets prefix for all global identifiers'
242242
)
243243
.option(
244244
'--identifiers-dictionary <list> (comma separated, without whitespaces)',
@@ -249,10 +249,6 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
249249
'--log <boolean>', 'Enables logging of the information to the console',
250250
BooleanSanitizer
251251
)
252-
.option(
253-
'--mangle-properties <boolean>', 'UNSAFE: Enables mangling property names',
254-
BooleanSanitizer
255-
)
256252
.option(
257253
'--reserved-names <list> (comma separated, without whitespaces)',
258254
'Disables obfuscation and generation of identifiers, which being matched by passed RegExp patterns (comma separated)',
@@ -264,7 +260,11 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
264260
ArraySanitizer
265261
)
266262
.option(
267-
'--rename-globals <boolean>', 'Allows to enable obfuscation of global variable and function names with declaration.',
263+
'--rename-globals <boolean>', 'Allows to enable obfuscation of global variable and function names with declaration',
264+
BooleanSanitizer
265+
)
266+
.option(
267+
'--rename-properties <boolean>', 'UNSAFE: Enables rename of property names. This probably WILL break your code',
268268
BooleanSanitizer
269269
)
270270
.option(

src/container/InversifyContainerFacade.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import { customNodesModule } from './modules/custom-nodes/CustomNodesModule';
1010
import { finalizingTransformersModule } from './modules/node-transformers/FinalizingTransformersModule';
1111
import { generatorsModule } from './modules/generators/GeneratorsModule';
1212
import { initializingTransformersModule } from './modules/node-transformers/InitializingTransformersModule';
13-
import { manglePropertiesTransformersModule } from './modules/node-transformers/ManglePropertiesTransformersModule';
1413
import { nodeModule } from './modules/node/NodeModule';
1514
import { nodeTransformersModule } from './modules/node-transformers/NodeTransformersModule';
1615
import { obfuscatingTransformersModule } from './modules/node-transformers/ObfuscatingTransformersModule';
1716
import { optionsModule } from './modules/options/OptionsModule';
1817
import { preparingTransformersModule } from './modules/node-transformers/PreparingTransformersModule';
18+
import { renamePropertiesTransformersModule } from './modules/node-transformers/RenamePropertiesTransformersModule';
1919
import { storagesModule } from './modules/storages/StoragesModule';
2020
import { utilsModule } from './modules/utils/UtilsModule';
2121

@@ -211,12 +211,12 @@ export class InversifyContainerFacade implements IInversifyContainerFacade {
211211
this.container.load(finalizingTransformersModule);
212212
this.container.load(generatorsModule);
213213
this.container.load(initializingTransformersModule);
214-
this.container.load(manglePropertiesTransformersModule);
215214
this.container.load(nodeModule);
216215
this.container.load(nodeTransformersModule);
217216
this.container.load(obfuscatingTransformersModule);
218217
this.container.load(optionsModule);
219218
this.container.load(preparingTransformersModule);
219+
this.container.load(renamePropertiesTransformersModule);
220220
this.container.load(storagesModule);
221221
this.container.load(utilsModule);
222222
}

src/container/ServiceIdentifiers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export enum ServiceIdentifiers {
3333
IJavaScriptObfuscator = 'IJavaScriptObfuscator',
3434
ILevelledTopologicalSorter = 'ILevelledTopologicalSorter',
3535
ILogger = 'ILogger',
36-
IManglePropertiesObfuscatingReplacer = 'IManglePropertiesObfuscatingReplacer',
3736
INodeGuard = 'INodeGuard',
3837
INodeTransformer = 'INodeTransformer',
3938
INodeTransformerNamesGroupsBuilder = 'INodeTransformerNamesGroupsBuilder',
@@ -45,6 +44,7 @@ export enum ServiceIdentifiers {
4544
IPrevailingKindOfVariablesAnalyzer = 'IPrevailingKindOfVariablesAnalyzer',
4645
IObjectExpressionExtractor = 'IObjectExpressionExtractor',
4746
IRandomGenerator = 'IRandomGenerator',
47+
IRenamePropertiesReplacer = 'IRenamePropertiesReplacer',
4848
IScopeIdentifiersTraverser = 'IScopeIdentifiersTraverser',
4949
ISourceCode = 'ISourceCode',
5050
IScopeAnalyzer = 'IScopeAnalyzer',

src/container/modules/node-transformers/ManglePropertiesTransformersModule.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0