From: Mihai Bazon Date: Wed, 3 Oct 2012 09:49:33 +0000 (+0300) Subject: drop tmp. files X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=bd94eeb6f7ba5a6cbc8f9547766857d9873f862a;p=UglifyJS.git drop tmp. files --- diff --git a/tmp/browser.js b/tmp/browser.js deleted file mode 100644 index 7972d346..00000000 --- a/tmp/browser.js +++ /dev/null @@ -1,17 +0,0 @@ -var func = function TEST () { - -}; - -console.time("parse"); -var ast = parse(func.toString()); -console.timeEnd("parse"); - - - -ast.walk({ - _visit: function(node, descend) { - console.log(node); - console.log(node.TYPE, ":", node.start.pos); - if (descend) descend.call(node); - } -}); diff --git a/tmp/index.html b/tmp/index.html deleted file mode 100644 index b8380fc0..00000000 --- a/tmp/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/tmp/test-maps.js b/tmp/test-maps.js deleted file mode 100755 index 438d198f..00000000 --- a/tmp/test-maps.js +++ /dev/null @@ -1,41 +0,0 @@ -#! /usr/bin/env node - -var sys = require("util"); -var fs = require("fs"); - -var UglifyJS = require("../tools/node"); - -var files = process.argv.slice(2); -var map = UglifyJS.SourceMap(); -var output = UglifyJS.OutputStream({ - beautify : false, - source_map : map -}); - -function do_file(file) { - var code = fs.readFileSync(file, "utf8"); - - // parse - var ast = UglifyJS.parse(code); - - // mangle - ast.figure_out_scope(); - ast.mangle_names(); - - // compress - var compressor = UglifyJS.Compressor(); - ast.squeeze(compressor); - - // generate source into the output stream - // first reset the current file name in the source map. - UglifyJS.time_it("generate", function(){ - map.set_source(file); - ast.print(output); - }); -}; - -files.forEach(do_file); - -fs.writeFileSync("/tmp/source-map.json", map, "utf8"); - -sys.print(output); diff --git a/tmp/test-node.js b/tmp/test-node.js deleted file mode 100755 index f2e0626b..00000000 --- a/tmp/test-node.js +++ /dev/null @@ -1,39 +0,0 @@ -#! /usr/bin/env node - -var sys = require("util"); -var fs = require("fs"); - -var UglifyJS = require("../tools/node"); - -var filename = process.argv[2]; -var code = fs.readFileSync(filename, "utf8"); - -var ast = UglifyJS.parse(code); - -var tt = new UglifyJS.TreeTransformer( - function before(node, descend) { - if (node instanceof UglifyJS.AST_Var) { - //return new UglifyJS.AST_EmptyStatement(node); - return UglifyJS.MAP.skip; - } - }, - function after(node) { - console.log("After ", node.TYPE); - } -); - -var x = ast.transform(tt); -sys.print(x.print_to_string({ beautify: true })); - -// ast.figure_out_scope(); -// ast = ast.squeeze(UglifyJS.Compressor()); - -// ast.compute_char_frequency(); -// UglifyJS.base54.sort(); - -// ast.figure_out_scope(); -// ast.scope_warnings(); -// ast.mangle_names(); - -// sys.error(UglifyJS.base54.get()); -// sys.print(ast.print_to_string({ beautify: true })); diff --git a/tmp/todo b/tmp/todo deleted file mode 100644 index b6f58dba..00000000 --- a/tmp/todo +++ /dev/null @@ -1,79 +0,0 @@ -✓ a = a + x ==> a+=x - -******* - -✓ join consecutive var statements - -******* -✓ -x == false ==> x == 0 -x == true ==> x == 1 - -should warn too; -JS is so sloppy that this could be an indication of a bug. - -******* - -✓ - -x, x ==> x -x = foo, x ==> x - -other similar cases? - -******* - -Try to concatenate all scripts somehow before starting minification; -the issue will be keeping track of the current source file for -generating source maps. perhaps store that in the AST? Have a single -AST_Toplevel for all files. - -XXX? Not sure if this is worth the trouble. - -******* - -✓ - -discard spurious break statements - -******* - -for (...) { - if (foo) continue; - ... -} - -==> - -for (...) { - if (!foo) { ... } -} - -******* - -The following seems to compress suboptimally. Should probably run more -passes somewhere. - -function setOpacity(el, o) { - if (o != null) { - if (o == "" && o != 0) { - is_ie - ? el.style.filter = "" - : el.style.opacity = ""; - } else { - is_ie - ? el.style.filter = "alpha(opacity=" + Math.round(o * 100) + ")" - : el.style.opacity = o; - } - return o; - } else { - if (!is_ie) - return parseFloat(el.style.opacity); - else - if (/alpha\(opacity=([0-9.])+\)/.test(el.style.opacity)) - return parseFloat(RegExp.$1); - } -} - -******* -