Skip to content
This repository was archived by the owner on Jan 31, 2018. It is now read-only.
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

@LeoIannacone

Description

@LeoIannacone

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions