Codebase list node-dryice / 814e968
patch to use uglifyjs version 2.x (closes: #765814) Leo Iannacone 9 years ago
2 changed file(s) with 69 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 Description: Patch to use UglifyJS version 2.x
1 Author: Leo Iannacone <l3on@ubuntu.com>
2 Bug-Debian: https://bugs.debian.org/765814
3 Forwarded: yes, https://github.com/mozilla/dryice/issues/34
4
5 ---
6 lib/dryice/index.js | 31 ++++++++++---------------------
7 1 file changed, 10 insertions(+), 21 deletions(-)
8
9 --- a/lib/dryice/index.js
10 +++ b/lib/dryice/index.js
11 @@ -828,7 +828,7 @@
12 var code = fs.readFileSync(module.fullname).toString();
13 var ast;
14 try {
15 - ast = ujs.parser.parse(code, false);
16 + ast = ujs.parse(code, {strict: false});
17 }
18 catch (ex) {
19 console.error('- Failed to compile ' + module.path + ': ' + ex);
20 @@ -882,10 +882,8 @@
21 }
22 };
23
24 - var walker = ujs.uglify.ast_walker();
25 - walker.with_walkers(walkers, function() {
26 - return walker.walk(ast);
27 - });
28 + var walker = new ujs.TreeWalker(walkers.call);
29 + ast.walk(walker);
30
31 return reply;
32 }
33 @@ -999,27 +997,18 @@
34 }
35
36 var opt = copy.filter.uglifyjs.options;
37 - var ast;
38 +
39 try {
40 - ast = ujs.parser.parse(input, opt.parse_strict_semicolons);
41 + return ujs.minify(input, {
42 + fromString: true,
43 + mangle: opt.mangle,
44 + output: { beautify: opt.beautify }
45 + });
46 }
47 catch (ex) {
48 - console.error('- Failed to compile code: ' + ex);
49 + console.error('- Failed to compile code: ', ex);
50 return input;
51 }
52 -
53 - if (opt.mangle) {
54 - ast = ujs.uglify.ast_mangle(ast, opt.mangle_toplevel);
55 - }
56 -
57 - if (opt.squeeze) {
58 - ast = ujs.uglify.ast_squeeze(ast, opt.squeeze_options);
59 - if (opt.squeeze_more) {
60 - ast = ujs.uglify.ast_squeeze_more(ast);
61 - }
62 - }
63 -
64 - return ujs.uglify.gen_code(ast, opt.beautify);
65 };
66 copy.filter.uglifyjs.onRead = false;
67 /**
0 0000-use_uglifyjs_2.patch