Browse Source

fix outputs

master
parent
commit
dc5c06104d
  1. 134
      uglifyjs/uglifyjs.patch
  2. 6
      uglifyjs/uglifyjs.spec

134
uglifyjs/uglifyjs.patch

@ -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);
}));
}

6
uglifyjs/uglifyjs.spec

@ -23,7 +23,7 @@
# package version
%define V_uglifyjs 2.4.1
%define V_uglifyjs_snap 20131025
%define V_uglifyjs_snap 20131031
# package information
Name: uglifyjs
@ -36,11 +36,12 @@ Class: EVAL
Group: Languages
License: BSD
Version: %{V_uglifyjs}
Release: 20131025
Release: 20131031
# list of sources
Source0: http://download.openpkg.org/components/versioned/uglifyjs/uglifyjs-%{V_uglifyjs}-%{V_uglifyjs_snap}.tar.gz
Source1: uglifyjs.sh
Patch0: uglifyjs.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20100101, discount, w3m
@ -59,6 +60,7 @@ PreReq: OpenPKG, openpkg >= 20100101, node
%prep
%setup -q -c
%patch -p0
%build
( cd node_modules/uglify-js

Loading…
Cancel
Save