소스 검색

Pass `simplify` and `numbersToExpressions` options to CustomCodeHelperObfuscator obfuscation

sanex3339 4 년 전
부모
커밋
19fa1fb602
6개의 변경된 파일11개의 추가작업 그리고 3개의 파일을 삭제
  1. 0 0
      dist/index.browser.js
  2. 0 0
      dist/index.cli.js
  3. 0 0
      dist/index.js
  4. 2 0
      src/custom-code-helpers/CustomCodeHelperObfuscator.ts
  5. 6 2
      test/dev/dev.ts
  6. 3 1
      test/unit-tests/utils/NumberUtils.spec.ts

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/index.browser.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/index.cli.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/index.js


+ 2 - 0
src/custom-code-helpers/CustomCodeHelperObfuscator.ts

@@ -47,6 +47,8 @@ export class CustomCodeHelperObfuscator implements ICustomCodeHelperObfuscator {
                 ...NO_ADDITIONAL_NODES_PRESET,
                 identifierNamesGenerator: this.options.identifierNamesGenerator,
                 identifiersDictionary: this.options.identifiersDictionary,
+                numbersToExpressions: this.options.numbersToExpressions,
+                simplify: this.options.simplify,
                 seed: this.randomGenerator.getRawSeed(),
                 ...additionalOptions
             }

+ 6 - 2
test/dev/dev.ts

@@ -8,12 +8,16 @@ import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNo
     let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
         `
             const foo = 0;
+            const bar = 'abc';
             
-            console.log(foo);
+            console.log(foo, bar);
         `,
         {
             ...NO_ADDITIONAL_NODES_PRESET,
-            numbersToExpressions: true
+            compact: false,
+            numbersToExpressions: true,
+            stringArray: true,
+            stringArrayThreshold: 1
         }
     ).getObfuscatedCode();
 

+ 3 - 1
test/unit-tests/utils/NumberUtils.spec.ts

@@ -2,7 +2,9 @@ import { assert } from 'chai';
 
 import { NumberUtils } from '../../../src/utils/NumberUtils';
 
-describe('NumberUtils', () => {
+describe('NumberUtils', function () {
+    this.timeout(30000);
+
     describe('toHex', () => {
         describe('Variant #1: number `0`', () => {
             const number: number = 0;

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.