2 changed files with 138 additions and 2 deletions
@ -0,0 +1,134 @@
|
||||
Index: node_modules/uglify-js/bin/uglifyjs
|
||||
--- node_modules/uglify-js/bin/uglifyjs.orig 2013-10-03 11:31:41.000000000 +0200
|
||||
+++ node_modules/uglify-js/bin/uglifyjs 2013-10-31 21:25:20.748079575 +0100
|
||||
@@ -102,18 +102,18 @@
|
||||
|
||||
if (ARGS.version || ARGS.V) {
|
||||
var json = require("../package.json");
|
||||
- sys.puts(json.name + ' ' + json.version);
|
||||
+ console.log(json.name + ' ' + json.version);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (ARGS.ast_help) {
|
||||
var desc = UglifyJS.describe_ast();
|
||||
- sys.puts(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2));
|
||||
+ console.log(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (ARGS.h || ARGS.help) {
|
||||
- sys.puts(optimist.help());
|
||||
+ console.log(optimist.help());
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
|
||||
if (ARGS.self) {
|
||||
if (files.length > 0) {
|
||||
- sys.error("WARN: Ignoring input files since --self was passed");
|
||||
+ console.error("WARN: Ignoring input files since --self was passed");
|
||||
}
|
||||
files = UglifyJS.FILES;
|
||||
if (!ARGS.wrap) ARGS.wrap = "UglifyJS";
|
||||
@@ -179,7 +179,7 @@
|
||||
if (ORIG_MAP) {
|
||||
ORIG_MAP = JSON.parse(fs.readFileSync(ORIG_MAP));
|
||||
if (files.length == 0) {
|
||||
- sys.error("INFO: Using file from the input source map: " + ORIG_MAP.file);
|
||||
+ console.error("INFO: Using file from the input source map: " + ORIG_MAP.file);
|
||||
files = [ ORIG_MAP.file ];
|
||||
}
|
||||
if (ARGS.source_map_root == null) {
|
||||
@@ -192,12 +192,12 @@
|
||||
}
|
||||
|
||||
if (files.indexOf("-") >= 0 && ARGS.source_map) {
|
||||
- sys.error("ERROR: Source map doesn't work with input from STDIN");
|
||||
+ console.error("ERROR: Source map doesn't work with input from STDIN");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (files.filter(function(el){ return el == "-" }).length > 1) {
|
||||
- sys.error("ERROR: Can read a single file from STDIN (two or more dashes specified)");
|
||||
+ console.error("ERROR: Can read a single file from STDIN (two or more dashes specified)");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -219,9 +219,9 @@
|
||||
var compressor = COMPRESS && UglifyJS.Compressor(COMPRESS);
|
||||
} catch(ex) {
|
||||
if (ex instanceof UglifyJS.DefaultsError) {
|
||||
- sys.error(ex.msg);
|
||||
- sys.error("Supported options:");
|
||||
- sys.error(sys.inspect(ex.defs));
|
||||
+ console.error(ex.msg);
|
||||
+ console.error("Supported options:");
|
||||
+ console.error(sys.inspect(ex.defs));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,7 @@
|
||||
async.eachLimit(files, 1, function (file, cb) {
|
||||
read_whole_file(file, function (err, code) {
|
||||
if (err) {
|
||||
- sys.error("ERROR: can't read file: " + file);
|
||||
+ console.error("ERROR: can't read file: " + file);
|
||||
process.exit(1);
|
||||
}
|
||||
if (ARGS.p != null) {
|
||||
@@ -265,9 +265,9 @@
|
||||
});
|
||||
} catch(ex) {
|
||||
if (ex instanceof UglifyJS.JS_Parse_Error) {
|
||||
- sys.error("Parse error at " + file + ":" + ex.line + "," + ex.col);
|
||||
- sys.error(ex.message);
|
||||
- sys.error(ex.stack);
|
||||
+ console.error("Parse error at " + file + ":" + ex.line + "," + ex.col);
|
||||
+ console.error(ex.message);
|
||||
+ console.error(ex.stack);
|
||||
process.exit(1);
|
||||
}
|
||||
throw ex;
|
||||
@@ -344,16 +344,16 @@
|
||||
if (OUTPUT_FILE) {
|
||||
fs.writeFileSync(OUTPUT_FILE, output, "utf8");
|
||||
} else {
|
||||
- sys.print(output);
|
||||
- sys.error("\n");
|
||||
+ console.log(output);
|
||||
+ console.error("\n");
|
||||
}
|
||||
|
||||
if (ARGS.stats) {
|
||||
- sys.error(UglifyJS.string_template("Timing information (compressed {count} files):", {
|
||||
+ console.error(UglifyJS.string_template("Timing information (compressed {count} files):", {
|
||||
count: files.length
|
||||
}));
|
||||
for (var i in STATS) if (STATS.hasOwnProperty(i)) {
|
||||
- sys.error(UglifyJS.string_template("- {name}: {time}s", {
|
||||
+ console.error(UglifyJS.string_template("- {name}: {time}s", {
|
||||
name: i,
|
||||
time: (STATS[i] / 1000).toFixed(3)
|
||||
}));
|
||||
@@ -380,7 +380,7 @@
|
||||
ast = UglifyJS.parse(x);
|
||||
} catch(ex) {
|
||||
if (ex instanceof UglifyJS.JS_Parse_Error) {
|
||||
- sys.error("Error parsing arguments in: " + x);
|
||||
+ console.error("Error parsing arguments in: " + x);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -396,8 +396,8 @@
|
||||
ret[name] = value;
|
||||
return true; // no descend
|
||||
}
|
||||
- sys.error(node.TYPE)
|
||||
- sys.error("Error parsing arguments in: " + x);
|
||||
+ console.error(node.TYPE)
|
||||
+ console.error("Error parsing arguments in: " + x);
|
||||
process.exit(1);
|
||||
}));
|
||||
}
|
||||
Loading…
Reference in new issue