소스 검색

Fixed require of external user config file #2

sanex3339 7 년 전
부모
커밋
58f606bcd8
5개의 변경된 파일13개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 0
      CHANGELOG.md
  2. 0 0
      dist/index.js
  3. 8 4
      src/cli/utils/CLIUtils.ts
  4. 0 0
      test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts
  5. 1 1
      test/index.spec.ts

+ 4 - 0
CHANGELOG.md

@@ -5,6 +5,10 @@ v0.11.0
 * **New option:** `log` enables logging of the information to the console.
 * **New option:** `log` enables logging of the information to the console.
 * **New option:** `renameGlobals` allows to enable obfuscation of global variable and function names with declaration.
 * **New option:** `renameGlobals` allows to enable obfuscation of global variable and function names with declaration.
 
 
+v0.10.1
+---
+* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/76
+
 v0.10.0
 v0.10.0
 ---
 ---
 * **New option:** `deadCodeInjection`. With this option random blocks of dead code will add to the obfuscated code.
 * **New option:** `deadCodeInjection`. With this option random blocks of dead code will add to the obfuscated code.

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


+ 8 - 4
src/cli/utils/CLIUtils.ts

@@ -78,11 +78,15 @@ export class CLIUtils {
      * @returns {Object}
      * @returns {Object}
      */
      */
     public static getUserConfig (configPath: string): Object {
     public static getUserConfig (configPath: string): Object {
-        const nativeRequire: Function = typeof __non_webpack_require__ === 'function'
-            ? __non_webpack_require__
-            : require;
+        let config: Object;
 
 
-        return nativeRequire(configPath);
+        try {
+            config = require(configPath);
+        } catch (e) {
+            config = __non_webpack_require__(configPath);
+        }
+
+        return config;
     }
     }
 
 
     /**
     /**

+ 0 - 0
test/functional-tests/javascript-obfuscator-cli/JavaScriptObfuscatorCLI.spec.ts → test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts


+ 1 - 1
test/index.spec.ts

@@ -30,7 +30,7 @@ import './unit-tests/utils/Utils.spec';
  * Functional tests
  * Functional tests
  */
  */
 import './functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec';
 import './functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec';
-import './functional-tests/javascript-obfuscator-cli/JavaScriptObfuscatorCLI.spec';
+import './functional-tests/cli/JavaScriptObfuscatorCLI.spec';
 import './functional-tests/javascript-obfuscator-internal/JavaScriptObfuscatorInternal.spec';
 import './functional-tests/javascript-obfuscator-internal/JavaScriptObfuscatorInternal.spec';
 import './functional-tests/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.spec';
 import './functional-tests/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.spec';
 import './functional-tests/custom-nodes/domain-lock-nodes/DomainLockNode.spec';
 import './functional-tests/custom-nodes/domain-lock-nodes/DomainLockNode.spec';

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