switch to uglify-es
This commit is contained in:
parent
e3eff47ff3
commit
9f9ae2e7e2
3 changed files with 20 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
var exports = {
|
var exports = {
|
||||||
COPYRIGHT:"Copyright (C) 2014-2018 Stewart Allen <sa@grid.space> - All Rights Reserved",
|
COPYRIGHT:"Copyright (C) 2014-2018 Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||||
LICENSE:"See the license.md file included with the source distribution",
|
LICENSE:"See the license.md file included with the source distribution",
|
||||||
VERSION:"1.2.3"
|
VERSION:"1.2.4"
|
||||||
};
|
};
|
||||||
if (!module) var module = {};
|
if (!module) var module = {};
|
||||||
module.exports = exports;
|
module.exports = exports;
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ function concatCode(array) {
|
||||||
cachepath = filepath;
|
cachepath = filepath;
|
||||||
}
|
}
|
||||||
cached = getCachedFile(filepath, cachepath, function(path) {
|
cached = getCachedFile(filepath, cachepath, function(path) {
|
||||||
return uglify.minify(filepath).code;
|
return minify(filepath);
|
||||||
});
|
});
|
||||||
code.push(cached);
|
code.push(cached);
|
||||||
});
|
});
|
||||||
|
|
@ -488,6 +488,16 @@ function handleData(req, res, next) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function minify(path) {
|
||||||
|
let code = fs.readFileSync(path);
|
||||||
|
let mini = uglify.minify(code.toString());
|
||||||
|
if (mini.error) {
|
||||||
|
console.trace(mini.error);
|
||||||
|
throw mini.error;
|
||||||
|
}
|
||||||
|
return mini.code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} req
|
* @param {Object} req
|
||||||
* @param {Object} res
|
* @param {Object} res
|
||||||
|
|
@ -523,7 +533,7 @@ function handleJS(req, res, next) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var start = new Date().getTime(),
|
var start = new Date().getTime(),
|
||||||
code = uglify.minify([fpath]).code,
|
code = minify(fpath),
|
||||||
end = new Date().getTime();
|
end = new Date().getTime();
|
||||||
|
|
||||||
log({minify:fpath, in:f.size, out:code.length, time:(end-start)});
|
log({minify:fpath, in:f.size, out:code.length, time:(end-start)});
|
||||||
|
|
@ -686,7 +696,7 @@ var ver = require('../js/license.js'),
|
||||||
spawn = require('child_process').spawn,
|
spawn = require('child_process').spawn,
|
||||||
level = require('levelup')('./persist/', {valueEncoding:"json"}),
|
level = require('levelup')('./persist/', {valueEncoding:"json"}),
|
||||||
https = require('https'),
|
https = require('https'),
|
||||||
uglify = require('uglify-js'),
|
uglify = require('uglify-es'),
|
||||||
connect = require('connect'),
|
connect = require('connect'),
|
||||||
request = require('request'),
|
request = require('request'),
|
||||||
serveStatic = require('serve-static'),
|
serveStatic = require('serve-static'),
|
||||||
|
|
@ -963,7 +973,7 @@ function initModule(file, dir) {
|
||||||
if (clearJS) {
|
if (clearJS) {
|
||||||
code[endpoint] = fs.readFileSync(path);
|
code[endpoint] = fs.readFileSync(path);
|
||||||
} else {
|
} else {
|
||||||
code[endpoint] = uglify.minify(path).code;
|
code[endpoint] = minify(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
10
package.json
10
package.json
|
|
@ -27,18 +27,18 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"buffer-crc32": "^0.2.13",
|
"buffer-crc32": "^0.2.13",
|
||||||
"compression": "^1.7.2",
|
"compression": "^1.7.3",
|
||||||
"connect": "^3.6.6",
|
"connect": "^3.6.6",
|
||||||
"express-useragent": "^1.0.12",
|
"express-useragent": "^1.0.12",
|
||||||
"leveldown": "^1.9.0",
|
"leveldown": "^1.9.0",
|
||||||
"levelup": "^1.3.9",
|
"levelup": "^1.3.9",
|
||||||
"moment": "^2.21.0",
|
"moment": "^2.22.2",
|
||||||
"n3d-threejs": "^72.0.0",
|
"n3d-threejs": "^72.0.0",
|
||||||
"pixi.js": "^4.7.0",
|
"pixi.js": "^4.8.2",
|
||||||
"request": "^2.83.0",
|
"request": "^2.88.0",
|
||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
"tween.js": "^0.14.0",
|
"tween.js": "^0.14.0",
|
||||||
"uglify-js": "^2.8.29",
|
"uglify-es": "^3.3.9",
|
||||||
"validator": "^8.2.0"
|
"validator": "^8.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue