Nest minified code in a function

This commit is contained in:
Ethan O'Brien 2023-08-12 09:50:45 -05:00
parent 9d17345e6d
commit 55fb909ffc
3 changed files with 4 additions and 2 deletions

View file

@ -4201,3 +4201,4 @@ class EmulatorJS {
this.gameManager.setCheat(index, checked, code); this.gameManager.setCheat(index, checked, code);
} }
} }
window.EmulatorJS = EmulatorJS;

File diff suppressed because one or more lines are too long

View file

@ -11,10 +11,11 @@ let files = [
'socket.io.min.js', 'socket.io.min.js',
'emulator.js' 'emulator.js'
] ]
let code = ""; let code = "(function() {\n";
for (let i=0; i<files.length; i++) { for (let i=0; i<files.length; i++) {
code += fs.readFileSync('../'+files[i], 'utf8') + "\n"; code += fs.readFileSync('../'+files[i], 'utf8') + "\n";
} }
code += "\n})();"
function minify(source){ function minify(source){
const ast = UglifyJS.parse(source); const ast = UglifyJS.parse(source);