This repository was archived by the owner on Jan 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
This repository was archived by the owner on Jan 31, 2018. It is now read-only.
Please update to Uglify JS version 2.x #34
Copy link
Copy link
Open
Description
Hi,
we packaged your module in Debian.. However we cannot have different version of UglifyJS in our repository. The UglifyJS we ship is updated to the branch 2.x, which makes your module incompatible with.
Can you please consider an update to support only UglifyJS 2.x?
Here a patch I started to work on, can you review it ?
--- a/lib/dryice/index.js
+++ b/lib/dryice/index.js
@@ -828,7 +828,7 @@
var code = fs.readFileSync(module.fullname).toString();
var ast;
try {
- ast = ujs.parser.parse(code, false);
+ ast = ujs.parse(code, {strict: false});
}
catch (ex) {
console.error('- Failed to compile ' + module.path + ': ' + ex);
@@ -882,10 +882,8 @@
}
};
- var walker = ujs.uglify.ast_walker();
- walker.with_walkers(walkers, function() {
- return walker.walk(ast);
- });
+ var walker = new ujs.TreeWalker(walkers.call);
+ ast.walk(walker);
return reply;
}
@@ -999,27 +997,18 @@
}
var opt = copy.filter.uglifyjs.options;
- var ast;
+
try {
- ast = ujs.parser.parse(input, opt.parse_strict_semicolons);
+ return ujs.minify(input, {
+ fromString: true,
+ mangle: opt.mangle,
+ output: { beautify: opt.beautify }
+ });
}
catch (ex) {
- console.error('- Failed to compile code: ' + ex);
+ console.error('- Failed to compile code: ', ex);
return input;
}
-
- if (opt.mangle) {
- ast = ujs.uglify.ast_mangle(ast, opt.mangle_toplevel);
- }
-
- if (opt.squeeze) {
- ast = ujs.uglify.ast_squeeze(ast, opt.squeeze_options);
- if (opt.squeeze_more) {
- ast = ujs.uglify.ast_squeeze_more(ast);
- }
- }
-
- return ujs.uglify.gen_code(ast, opt.beautify);
};
copy.filter.uglifyjs.onRead = false;
/**
Cheers.
Metadata
Metadata
Assignees
Labels
No labels