Bläddra i källkod

Added `mangleProperties` to the runtime tests. Readme update

sanex3339 5 år sedan
förälder
incheckning
5cd063fe92
4 ändrade filer med 16 tillägg och 7 borttagningar
  1. 5 0
      CHANGELOG.md
  2. 3 3
      README.md
  3. 1 1
      package.json
  4. 7 3
      test/runtime-tests/JavaScriptObfuscatorRuntime.spec.ts

+ 5 - 0
CHANGELOG.md

@@ -1,5 +1,10 @@
 Change Log
 
+v1.1.0
+---
+* **New option:** `mangleProperties` enables mangling property names
+
+
 v1.0.1
 ---
 * Fixed .d.ts typings. https://github.com/javascript-obfuscator/javascript-obfuscator/issues/623

+ 3 - 3
README.md

@@ -667,13 +667,13 @@ Enables logging of the information to the console.
 ### `mangleProperties`
 Type: `boolean` Default: `false`
 
-##### :warning: this option will break your code in most cases. Enable it only if you know what it does!
+##### :warning: this option **WILL** break your code in most cases. Enable it only if you know what it does!
 
 Enables mangling property names. 
 
-Generated names are being controlled by [`identifierNamesGenerator`](#identifierNamesGenerator) option.
+To set format of renamed property names use [`identifierNamesGenerator`](#identifierNamesGenerator) option.
 
-It is possible to control which properties will be mangled with [`reservedNames`](#reservedNames) option.
+To control which properties will be renamed use [`reservedNames`](#reservedNames) option.
 
 ### `renameGlobals`
 Type: `boolean` Default: `false`

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "javascript-obfuscator",
-  "version": "1.0.1",
+  "version": "1.1.0",
   "description": "JavaScript obfuscator",
   "keywords": [
     "obfuscator",

+ 7 - 3
test/runtime-tests/JavaScriptObfuscatorRuntime.spec.ts

@@ -25,6 +25,7 @@ describe('JavaScriptObfuscator runtime eval', function () {
         debugProtection: true,
         disableConsoleOutput: true,
         domainLock: ['obfuscator.io'],
+        mangleProperties: true,
         reservedNames: ['generate', 'sha256'],
         rotateStringArray: true,
         selfDefending: true,
@@ -67,7 +68,8 @@ describe('JavaScriptObfuscator runtime eval', function () {
                     code,
                     {
                         ...baseOptions,
-                        ...options
+                        ...options,
+                        mangleProperties: false
                     }
                 ).getObfuscatedCode();
 
@@ -178,7 +180,8 @@ describe('JavaScriptObfuscator runtime eval', function () {
                     code,
                     {
                         ...baseOptions,
-                        ...options
+                        ...options,
+                        mangleProperties: false
                     }
                 ).getObfuscatedCode();
 
@@ -248,7 +251,8 @@ describe('JavaScriptObfuscator runtime eval', function () {
                         {
                             ...baseOptions,
                             ...options,
-                            ...webpackBootstrapOptions
+                            ...webpackBootstrapOptions,
+                            reservedNames: ['^foo$']
                         }
                     ).getObfuscatedCode();