js-confuser-vm 0.0.4 → 0.0.5

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/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { compileAndSerialize } from "./compiler.js";
2
+ import { DEFAULT_OPTIONS } from "./options.js";
3
+ async function obfuscate(source, options = DEFAULT_OPTIONS) {
4
+ const result = compileAndSerialize(source, options);
5
+ return result;
6
+ }
7
+ export const JsConfuserVM = {
8
+ obfuscate
9
+ };
10
+ export default JsConfuserVM;
package/dist/minify.js ADDED
@@ -0,0 +1,18 @@
1
+ import ClosureCompiler from "google-closure-compiler";
2
+ export function minify(sourceCode) {
3
+ return new Promise((resolve, reject) => {
4
+ const compiler = new ClosureCompiler({
5
+ compilation_level: "ADVANCED",
6
+ warning_level: "QUIET"
7
+ });
8
+ const compilerProcess = compiler.run((exitCode, stdOut, stdErr) => {
9
+ if (exitCode !== 0) {
10
+ reject(new Error(stdErr || `Closure Compiler exited with code ${exitCode}`));
11
+ } else {
12
+ resolve(stdOut);
13
+ }
14
+ });
15
+ compilerProcess.stdin.write(sourceCode);
16
+ compilerProcess.stdin.end();
17
+ });
18
+ }
@@ -0,0 +1 @@
1
+ export const DEFAULT_OPTIONS = {};