javascript-obfuscator 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +30 -5
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cli.js +1 -1
- package/dist/index.cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/typings/src/container/ServiceIdentifiers.d.ts +2 -1
- package/typings/src/custom-nodes/control-flow-flattening-nodes/{StringLiteralNode.d.ts → LiteralNode.d.ts} +4 -3
- package/typings/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.d.ts +2 -2
- package/typings/src/enums/custom-nodes/ControlFlowCustomNode.d.ts +2 -2
- package/typings/src/enums/node-transformers/NodeTransformer.d.ts +1 -0
- package/typings/src/enums/node-transformers/control-flow-transformers/control-flow-replacers/ControlFlowReplacer.d.ts +1 -0
- package/typings/src/enums/storages/ControlFlowStorage.d.ts +4 -0
- package/typings/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.d.ts +2 -1
- package/typings/src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.d.ts +1 -0
- package/typings/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.d.ts +1 -0
- package/typings/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.d.ts +9 -2
- package/typings/src/generators/identifier-names-generators/MangledShuffledIdentifierNamesGenerator.d.ts +2 -2
- package/typings/src/interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator.d.ts +1 -0
- package/typings/src/interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer.d.ts +3 -2
- package/typings/src/interfaces/options/IOptions.d.ts +2 -0
- package/typings/src/interfaces/storages/IWeakMapStorage.d.ts +9 -0
- package/typings/src/interfaces/storages/control-flow-transformers/IControlFlowStorage.d.ts +4 -0
- package/typings/src/interfaces/storages/string-array-transformers/IStringArrayScopeCallsWrappersDataStorage.d.ts +2 -2
- package/typings/src/interfaces/utils/ISetUtils.d.ts +3 -0
- package/typings/src/node/NodeLiteralUtils.d.ts +2 -0
- package/typings/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.d.ts +22 -13
- package/typings/src/node-transformers/control-flow-transformers/StringArrayControlFlowTransformer.d.ts +25 -0
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.d.ts +8 -5
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.d.ts +4 -3
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.d.ts +4 -3
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.d.ts +2 -1
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.d.ts +4 -3
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/StringArrayCallControlFlowReplacer.d.ts +14 -0
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.d.ts +5 -4
- package/typings/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.d.ts +0 -2
- package/typings/src/options/Options.d.ts +2 -0
- package/typings/src/options/normalizer-rules/StringArrayCallsTransformThresholdRule.d.ts +2 -0
- package/typings/src/storages/WeakMapStorage.d.ts +17 -0
- package/typings/src/storages/control-flow-transformers/FunctionControlFlowStorage.d.ts +11 -0
- package/typings/src/storages/control-flow-transformers/StringControlFlowStorage.d.ts +8 -0
- package/typings/src/storages/string-array-transformers/StringArrayScopeCallsWrappersDataStorage.d.ts +2 -2
- package/typings/src/types/container/node-transformers/TControlFlowStorageFactory.d.ts +2 -2
- package/typings/src/types/container/node-transformers/TControlFlowStorageFactoryCreator.d.ts +3 -0
- package/typings/src/types/node/TNumberLiteralNode.d.ts +4 -0
- package/typings/src/utils/SetUtils.d.ts +7 -0
- package/typings/src/storages/custom-nodes/ControlFlowStorage.d.ts +0 -7
- package/typings/src/types/storages/TControlFlowStorage.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
|
|
3
|
+
v3.2.0
|
|
4
|
+
---
|
|
5
|
+
* **New options**: `stringArrayCallsTransform` and `stringArrayCallsTransformThreshold`
|
|
6
|
+
* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/pull/1046
|
|
7
|
+
|
|
3
8
|
v3.1.0
|
|
4
9
|
---
|
|
5
10
|
* Added support of `es2022` features: class static block
|
package/README.md
CHANGED
|
@@ -379,10 +379,12 @@ Following options are available for the JS Obfuscator:
|
|
|
379
379
|
splitStrings: false,
|
|
380
380
|
splitStringsChunkLength: 10,
|
|
381
381
|
stringArray: true,
|
|
382
|
+
stringArrayCallsTransform: true,
|
|
383
|
+
stringArrayCallsTransformThreshold: 0.5,
|
|
384
|
+
stringArrayEncoding: [],
|
|
382
385
|
stringArrayIndexesType: [
|
|
383
386
|
'hexadecimal-number'
|
|
384
387
|
],
|
|
385
|
-
stringArrayEncoding: [],
|
|
386
388
|
stringArrayIndexShift: true,
|
|
387
389
|
stringArrayRotate: true,
|
|
388
390
|
stringArrayShuffle: true,
|
|
@@ -441,8 +443,10 @@ Following options are available for the JS Obfuscator:
|
|
|
441
443
|
--split-strings <boolean>
|
|
442
444
|
--split-strings-chunk-length <number>
|
|
443
445
|
--string-array <boolean>
|
|
444
|
-
--string-array-
|
|
446
|
+
--string-array-calls-transform <boolean>
|
|
447
|
+
--string-array-calls-transform-threshold <number>
|
|
445
448
|
--string-array-encoding '<list>' (comma separated) [none, base64, rc4]
|
|
449
|
+
--string-array-indexes-type '<list>' (comma separated) [hexadecimal-number, hexadecimal-numeric-string]
|
|
446
450
|
--string-array-index-shift <boolean>
|
|
447
451
|
--string-array-rotate <boolean>
|
|
448
452
|
--string-array-shuffle <boolean>
|
|
@@ -1097,6 +1101,20 @@ Type: `boolean` Default: `true`
|
|
|
1097
1101
|
|
|
1098
1102
|
Removes string literals and place them in a special array. For instance, the string `"Hello World"` in `var m = "Hello World";` will be replaced with something like `var m = _0x12c456[0x1];`
|
|
1099
1103
|
|
|
1104
|
+
### `stringArrayCallsTransform`
|
|
1105
|
+
Type: `boolean` Default: `true`
|
|
1106
|
+
|
|
1107
|
+
##### :warning: [`stringArray`](#stringarray) option must be enabled
|
|
1108
|
+
|
|
1109
|
+
Enables the transformation of calls to the [`stringArray`](#stringarray). All arguments of these calls may be extracted to different object depending on [`stringArrayCallsTransformThreshold`](#stringarraycallstransformthreshold) value.
|
|
1110
|
+
|
|
1111
|
+
### `stringArrayCallsTransformThreshold`
|
|
1112
|
+
Type: `number` Default: `0.5`
|
|
1113
|
+
|
|
1114
|
+
##### :warning: [`stringArray`](#stringarray) and [`stringArrayCallsTransformThreshold`](#stringarraycallstransformthreshold) options must be enabled
|
|
1115
|
+
|
|
1116
|
+
You can use this setting to adjust the probability (from 0 to 1) that calls to the string array will be transformed.
|
|
1117
|
+
|
|
1100
1118
|
### `stringArrayEncoding`
|
|
1101
1119
|
Type: `string[]` Default: `[]`
|
|
1102
1120
|
|
|
@@ -1419,7 +1437,7 @@ Unicode escape sequence increases code size greatly and strings easily can be re
|
|
|
1419
1437
|
## Preset Options
|
|
1420
1438
|
### High obfuscation, low performance
|
|
1421
1439
|
|
|
1422
|
-
|
|
1440
|
+
The performance will be much slower than without obfuscation
|
|
1423
1441
|
|
|
1424
1442
|
```javascript
|
|
1425
1443
|
{
|
|
@@ -1440,6 +1458,8 @@ Performance will 50-100% slower than without obfuscation
|
|
|
1440
1458
|
splitStrings: true,
|
|
1441
1459
|
splitStringsChunkLength: 5,
|
|
1442
1460
|
stringArray: true,
|
|
1461
|
+
stringArray: true,
|
|
1462
|
+
stringArrayCallsTransform: true,
|
|
1443
1463
|
stringArrayEncoding: ['rc4'],
|
|
1444
1464
|
stringArrayIndexShift: true,
|
|
1445
1465
|
stringArrayRotate: true,
|
|
@@ -1456,7 +1476,7 @@ Performance will 50-100% slower than without obfuscation
|
|
|
1456
1476
|
|
|
1457
1477
|
### Medium obfuscation, optimal performance
|
|
1458
1478
|
|
|
1459
|
-
|
|
1479
|
+
The performance will be slower than without obfuscation
|
|
1460
1480
|
|
|
1461
1481
|
```javascript
|
|
1462
1482
|
{
|
|
@@ -1477,6 +1497,8 @@ Performance will 30-35% slower than without obfuscation
|
|
|
1477
1497
|
splitStrings: true,
|
|
1478
1498
|
splitStringsChunkLength: 10,
|
|
1479
1499
|
stringArray: true,
|
|
1500
|
+
stringArrayCallsTransform: true,
|
|
1501
|
+
stringArrayCallsTransformThreshold: 0.75,
|
|
1480
1502
|
stringArrayEncoding: ['base64'],
|
|
1481
1503
|
stringArrayIndexShift: true,
|
|
1482
1504
|
stringArrayRotate: true,
|
|
@@ -1493,7 +1515,7 @@ Performance will 30-35% slower than without obfuscation
|
|
|
1493
1515
|
|
|
1494
1516
|
### Low obfuscation, High performance
|
|
1495
1517
|
|
|
1496
|
-
|
|
1518
|
+
The performance will be at a relatively normal level
|
|
1497
1519
|
|
|
1498
1520
|
```javascript
|
|
1499
1521
|
{
|
|
@@ -1511,6 +1533,7 @@ Performance will slightly slower than without obfuscation
|
|
|
1511
1533
|
simplify: true,
|
|
1512
1534
|
splitStrings: false,
|
|
1513
1535
|
stringArray: true,
|
|
1536
|
+
stringArrayCallsTransform: false,
|
|
1514
1537
|
stringArrayEncoding: [],
|
|
1515
1538
|
stringArrayIndexShift: true,
|
|
1516
1539
|
stringArrayRotate: true,
|
|
@@ -1542,6 +1565,8 @@ Performance will slightly slower than without obfuscation
|
|
|
1542
1565
|
simplify: true,
|
|
1543
1566
|
splitStrings: false,
|
|
1544
1567
|
stringArray: true,
|
|
1568
|
+
stringArrayCallsTransform: false,
|
|
1569
|
+
stringArrayCallsTransformThreshold: 0.5,
|
|
1545
1570
|
stringArrayEncoding: [],
|
|
1546
1571
|
stringArrayIndexShift: true,
|
|
1547
1572
|
stringArrayRotate: true,
|