diff --git a/index.ts b/index.ts index a37e33e0..f294214f 100644 --- a/index.ts +++ b/index.ts @@ -7,8 +7,7 @@ import { UnicodeArrayNodesGroup } from './src/node-groups/UnicodeArrayNodesGroup import { Utils } from './src/Utils'; let escodegen = require('escodegen'), - esprima = require('esprima'), - RawSource: any = require('webpack-core/lib/RawSource'); + esprima = require('esprima'); export class JavaScriptObfuscator { /** @@ -38,7 +37,7 @@ export class JavaScriptObfuscator { * @param astTree */ private static generateCode (astTree: any): string { - return new RawSource(escodegen.generate(astTree, JavaScriptObfuscator.escodegenParams)); + return escodegen.generate(astTree, JavaScriptObfuscator.escodegenParams); } } diff --git a/readme.md b/readme.md index 7af094b3..8f45223e 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,7 @@ #JavaScript obfuscator for Node.js JavaScript obfuscator for Node.js and free alternative of [js-obfuscator](https://github.com/caiguanhao/js-obfuscator) without any limits. +Compatible with ES6. ###Installation @@ -19,6 +20,16 @@ var obfuscatedCode = JavaScriptObfuscator.obfuscate( rotateUnicodeArray: false } ); + +console.log(obfuscatedCode); +/* +var _0x41c0 = [ + '\u0061\u0062\u0063', + '\u006c\u006f\u0067' +]; +var variable = _0x41c0[0]; +console[_0x41c0[1]](variable); +*/ ``` ## obfuscate(sourceCode, options)