]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Upgrading from 1.0 to 2.0 uglify version 647/head
authorIgor Lima <igor.lima@evolut.io>
Thu, 21 Feb 2013 02:24:24 +0000 (23:24 -0300)
committerIgor Lima <igor.lima@evolut.io>
Thu, 21 Feb 2013 02:24:24 +0000 (23:24 -0300)
Gruntfile.js
package.json
tasks/minify-lang.js
tasks/minify.js

index 6e65f57aa17a969baa9c7cb7c58eabbc39cbb984..1bc22691bd18b5f37f6eb95888968c6838e4c985 100644 (file)
@@ -1,5 +1,4 @@
-var fs = require('fs'),
-    uglifyjs = require('uglify-js');
+var fs = require('fs');
 
 module.exports = function (grunt) {
 
@@ -51,13 +50,12 @@ module.exports = function (grunt) {
                 files: minifiedFiles
             },
             options: {
-                mangle: {
-                    toplevel: true
-                },
-                squeeze: {
+                fromString: true,
+                mangle: true,
+                compress: {
                     dead_code: false
                 },
-                codegen: {
+                output: {
                     ascii_only: true
                 }
             }
index 5ba43f7a74da63d41993adf334d7a90df14db88e..748edb009c87e62214f1246e1f925b4159633ce3 100755 (executable)
@@ -36,7 +36,7 @@
         }
     ],
     "devDependencies" : {
-        "uglify-js" : "1.3.4",
+        "uglify-js" : "latest",
         "grunt"     : "latest",
         "grunt-contrib-jshint"    : "latest",
         "grunt-contrib-nodeunit"  : "latest",
index d7b3803d664166fd7fc9dd4c56463e698490898d..e22b74842f2474f4f18575c202deb153e670fbc1 100644 (file)
@@ -34,18 +34,21 @@ module.exports = function (grunt) {
             min,
             code,
             comments,
-            tok;
+            tok,
+            result;
 
         // Concat specified files. This should really be a single, pre-built (and
         // linted) file, but it supports any number of files.
         code = helpers.concat(files, {separator: this.data.separator});
 
         // Add the first comments
-        tok = uglifyjs.parser.tokenizer(code);
-        min = showCopyright(tok().comments_before);
+        //tok = uglifyjs.parse(code);
+        tok = uglifyjs.parse(code);
+        min = showCopyright(tok.start.comments_before);
 
         // Add the minified source.
-        min += uglifyjs(wrapFile(code), grunt.config('uglify'));
+        result = uglifyjs.minify(wrapFile(code), grunt.config('uglify.options'));
+        min += result.code;
         grunt.file.write(this.data.dest, min);
 
         // Fail task if errors were logged.
index a6b09445b70dc25d08f5df8e8a085a76efabea32..c8ff9c82b5330d2c182b89343c75167c51941bdd 100644 (file)
@@ -15,18 +15,20 @@ module.exports = function (grunt) {
             min,
             code,
             comments,
-            tok;
+            tok,
+            result;
 
         // Concat specified files. This should really be a single, pre-built (and
         // linted) file, but it supports any number of files.
         code = helpers.concat(files, {separator: this.data.separator});
 
         // Add the first comments
-        tok = uglifyjs.parser.tokenizer(code);
-        min = showCopyright(tok().comments_before);
+        tok = uglifyjs.parse(code);
+        min = showCopyright(tok.start.comments_before);
 
         // Add the minified source.
-        min += uglifyjs(code, grunt.config('uglify'));
+        result = uglifyjs.minify(code, grunt.config('uglify.options'));
+        min += result.code;
         grunt.file.write(this.data.dest, min);
 
         // Fail task if errors were logged.