@@ -1,27 +1,25 @@
|
|||||||
var save_stderr = process.stderr;
|
var path = require("path");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
||||||
// discard annoying NodeJS warning ("path.existsSync is now called `fs.existsSync`.")
|
// Avoid NodeJS warning.
|
||||||
var devnull = fs.createWriteStream("/dev/null");
|
//
|
||||||
process.__defineGetter__("stderr", function(){
|
// There's a --no-deprecation command line argument supported by
|
||||||
return devnull;
|
// NodeJS, but that's tricky to use, so I'd like to set it from the
|
||||||
});
|
// program itself. Turns out you need to set `process.noDeprecation`,
|
||||||
|
// but by the time you can set that the `path` module is already
|
||||||
|
// loaded and `path.existsSync` is already changed to display that
|
||||||
|
// warning, therefore here's the poor solution:
|
||||||
|
path.existsSync = fs.existsSync;
|
||||||
|
|
||||||
var vm = require("vm");
|
var vm = require("vm");
|
||||||
var sys = require("util");
|
var sys = require("util");
|
||||||
var path = require("path");
|
|
||||||
|
|
||||||
var UglifyJS = vm.createContext({
|
var UglifyJS = vm.createContext({
|
||||||
sys : sys,
|
sys : sys,
|
||||||
console : console,
|
console : console,
|
||||||
|
|
||||||
MOZ_SourceMap : require("source-map")
|
MOZ_SourceMap : require("source-map")
|
||||||
});
|
});
|
||||||
|
|
||||||
process.__defineGetter__("stderr", function(){
|
|
||||||
return save_stderr;
|
|
||||||
});
|
|
||||||
|
|
||||||
function load_global(file) {
|
function load_global(file) {
|
||||||
file = path.resolve(path.dirname(module.filename), file);
|
file = path.resolve(path.dirname(module.filename), file);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user