Andreas Lind Petersen [Sun, 31 Mar 2013 09:51:43 +0000 (11:51 +0200)]
uglifyjs binary: Make read_whole_file async and don't attempt to read STDIN synchronously.
Mihai Bazon [Mon, 25 Mar 2013 16:05:44 +0000 (09:05 -0700)]
Merge pull request #163 from mzgol/screw-oldie
renamed --screw-ie to --screw-oldie, documented it in README.md, indicat...
Michał Gołębiowski [Mon, 25 Mar 2013 15:11:07 +0000 (16:11 +0100)]
renamed --screw-ie to --screw-ie8, documented it in README.md, indicated it doesn't break IE9+
Jake Harding [Fri, 1 Mar 2013 05:21:14 +0000 (21:21 -0800)]
Add support for enclose option. Closes #139.
Mihai Bazon [Sat, 23 Mar 2013 22:57:35 +0000 (00:57 +0200)]
Don't print the warning on parse error, just throw a JS_Parse_Error.
Fix #159
Mihai Bazon [Fri, 22 Mar 2013 16:02:08 +0000 (18:02 +0200)]
Keep legit code working even when --screw-ie is not passed.
Previously:
Without `--screw-ie`, UglifyJS would always leak names of function
expressions into the containing scope, as if they were function
declarations. That was to emulate IE<9 behavior. Code relying on this
IE bug would continue to work properly after mangling, although it would
only work in IE (since other engines don't share the bug). Sometimes
this broke legitimage code (see #153 and #155).
With `--screw-ie` the names would not be leaked into the current scope,
working properly in legit cases; but still it broke legit code when
running in IE<9 (see #24).
Currently:
Regardless of the `--screw-ie` setting, the names will not be leaked.
Code relying on the IE bug will not work properly after mangling.
<evil laughter here>
Without `--screw-ie`: a hack has been added to the mangler to avoid
using the same name for a function expression and some other variable in
the same scope. This keeps legit code working, at the (negligible,
indeed) cost of one more identifier.
With `--screw-ie` you allow the mangler to name function expressions
with the same identifier as another variable in scope. After mangling
code might break in IE<9.
Oh man, the commit message is longer than the patch.
Fix #153, #155
Mihai Bazon [Wed, 13 Mar 2013 08:36:55 +0000 (01:36 -0700)]
Merge pull request #125 from devongovett/master
Allow inSourceMap option to be a generated JSON source map
Mihai Bazon [Wed, 13 Mar 2013 07:44:06 +0000 (09:44 +0200)]
Support mangling toplevel names
Close #127
Mihai Bazon [Sun, 10 Mar 2013 22:04:31 +0000 (00:04 +0200)]
Disable `unsafe` by default
Close #147
Mihai Bazon [Wed, 6 Mar 2013 06:17:09 +0000 (22:17 -0800)]
Merge pull request #146 from mbostock/read-all-stdin
Read the entire STDIN.
Mike Bostock [Wed, 6 Mar 2013 04:35:49 +0000 (20:35 -0800)]
Read the entire STDIN.
The problem with reading synchronously from /dev/stdin is that you can get a
spurious EOF when the input buffer is empty, even if more content is coming. Now
STDIN is read from a loop, and only stops polling when all input has been read.
This fixes #70 #85 and other errors related to parsing large files on STDIN.
Mihai Bazon [Mon, 4 Mar 2013 08:06:01 +0000 (10:06 +0200)]
Fix reordering comparisons
Close #143
Mihai Bazon [Sat, 2 Mar 2013 12:28:34 +0000 (14:28 +0200)]
Add `--screw-ie` option
For now the implication is that UglifyJS will not leak a function
expression's name in the surrounding scope (IE < 9 does that).
(ref. mishoo/UglifyJS#485)
Mihai Bazon [Fri, 1 Mar 2013 11:12:03 +0000 (13:12 +0200)]
Drop last `default:` if it's the last branch and empty
Close #141
Mihai Bazon [Fri, 1 Mar 2013 08:26:06 +0000 (10:26 +0200)]
Compress boolean constants after evaluation
Close #137
Mihai Bazon [Fri, 22 Feb 2013 11:58:16 +0000 (13:58 +0200)]
Add license
Close #131
Mihai Bazon [Tue, 19 Feb 2013 16:12:19 +0000 (18:12 +0200)]
Fix compressing `do {...} while (false)`
It's not safe to transform it to {...} because the body might contain
`break`. The solution could be more elaborate (detect if body contains
`break`) but I don't think it's worth the trouble.
Close #129
Mihai Bazon [Thu, 14 Feb 2013 10:51:13 +0000 (12:51 +0200)]
v2.2.5
Devon Govett [Sun, 10 Feb 2013 18:06:13 +0000 (10:06 -0800)]
Allow inSourceMap to be a generated JSON source map instead of just a file name
Mihai Bazon [Wed, 6 Feb 2013 09:57:59 +0000 (11:57 +0200)]
Force space after literal regexp when used in "instanceof" or "in"
Close #118
Mihai Bazon [Wed, 6 Feb 2013 09:51:09 +0000 (11:51 +0200)]
Give up evaluating (unary-prefix '-' 0)
Close #117
------
JS, WHY YOU SUCK SO BADLY? ;-(
Mihai Bazon [Wed, 6 Feb 2013 09:38:29 +0000 (11:38 +0200)]
Fix parens for NaN
Close #116
Mihai Bazon [Wed, 6 Feb 2013 09:36:04 +0000 (11:36 +0200)]
Fix parens for negative numbers
Close #115
Mihai Bazon [Wed, 6 Feb 2013 09:28:49 +0000 (11:28 +0200)]
Fix parens for AST_New
Close #114
Mihai Bazon [Wed, 6 Feb 2013 09:15:31 +0000 (11:15 +0200)]
Fix handling of constants
Close #113
Mihai Bazon [Tue, 5 Feb 2013 17:10:33 +0000 (19:10 +0200)]
Ugly hack to print comments before return/throw statements
Close #112
Mihai Bazon [Mon, 4 Feb 2013 07:44:31 +0000 (23:44 -0800)]
Merge pull request #111 from mattrobenolt/safer-sourcemap
Wraps sourceMappingURL in a multiline comment. Fixes #108
Matt Robenolt [Mon, 4 Feb 2013 00:01:01 +0000 (16:01 -0800)]
Wraps sourceMappingURL in a multiline comment. Fixes #108
Mihai Bazon [Fri, 1 Feb 2013 11:31:28 +0000 (13:31 +0200)]
v2.2.4
Mihai Bazon [Sat, 26 Jan 2013 12:24:54 +0000 (14:24 +0200)]
Fix end token for Assign nodes
Mihai Bazon [Fri, 1 Feb 2013 07:50:59 +0000 (23:50 -0800)]
Merge pull request #94 from paulmillr/patch-1
Add better fromstring docs.
Mihai Bazon [Thu, 24 Jan 2013 13:51:33 +0000 (05:51 -0800)]
Merge pull request #106 from gibson042/105
Fix #105: property comparison to undefined is not always safe
Richard Gibson [Thu, 24 Jan 2013 04:52:04 +0000 (23:52 -0500)]
Fix #105: property comparison to undefined is not always safe
Mihai Bazon [Sun, 20 Jan 2013 10:32:07 +0000 (12:32 +0200)]
Add --source-map-url option
Fix #100
Fix #47
Mihai Bazon [Thu, 17 Jan 2013 09:16:55 +0000 (11:16 +0200)]
[AST_Hole] the print function can be a no-op.
David Glasser [Wed, 16 Jan 2013 19:59:19 +0000 (14:59 -0500)]
Fix output for arrays containing undefined values.
1b6bcca7 was a first attempt at this. That commit made Uglify stop replacing
holes with undefined, but instead it started replacing undefined with
holes. This is slightly problematic, because there is a difference between a
hole and an undefined value. More problematically, it changed [1,undefined] to
[1,] which generally doesn't even parse as a hole (just as a trailing comma), so
it didn't even preserve the length of the array!
Instead, parse holes as their own special AST node which prints invisibly.
Mihai Bazon [Thu, 17 Jan 2013 09:08:59 +0000 (01:08 -0800)]
Merge pull request #98 from ForbesLindesay/patch-1
Update installation instructions
Mihai Bazon [Thu, 17 Jan 2013 09:01:38 +0000 (11:01 +0200)]
Handle String() with no arguments.
Fix #91
Forbes Lindesay [Thu, 17 Jan 2013 00:13:42 +0000 (00:13 +0000)]
Update installation instructions re #4
Paul Miller [Sun, 13 Jan 2013 16:45:43 +0000 (18:45 +0200)]
Add better fromstring docs.
Mihai Bazon [Tue, 8 Jan 2013 22:21:25 +0000 (14:21 -0800)]
Merge pull request #90 from jakearchibald/patch-1
Compressor options use underscores rather than hyphens
Jake Archibald [Tue, 8 Jan 2013 20:33:58 +0000 (12:33 -0800)]
Compressor options use underscores rather than hyphens
Mihai Bazon [Fri, 4 Jan 2013 20:50:53 +0000 (22:50 +0200)]
v2.2.3
Mihai Bazon [Fri, 4 Jan 2013 12:17:33 +0000 (14:17 +0200)]
Fix handling of labels in nested scopes
Mihai Bazon [Fri, 4 Jan 2013 09:24:29 +0000 (11:24 +0200)]
Support `output`, `mangle` and `compress` options to `UglifyJS.minify`.
Close #57
Close #86
Close #33
Mihai Bazon [Thu, 3 Jan 2013 10:28:35 +0000 (02:28 -0800)]
Merge pull request #87 from BenoitZugmeyer/master
Add a --version option
Benoît Zugmeyer [Thu, 3 Jan 2013 10:22:37 +0000 (11:22 +0100)]
Set --version as a boolean #87
Benoît Zugmeyer [Thu, 3 Jan 2013 10:06:07 +0000 (11:06 +0100)]
--version option
Mihai Bazon [Wed, 2 Jan 2013 10:39:00 +0000 (12:39 +0200)]
Implement `-m sort=true`
close #83
Mihai Bazon [Fri, 21 Dec 2012 23:24:04 +0000 (01:24 +0200)]
Accept string or number as name of an accessor.
[not sure I'm happy about this fix]
Reference mishoo/UglifyJS#478
Mihai Bazon [Fri, 21 Dec 2012 19:04:15 +0000 (21:04 +0200)]
Optimize new Array(1, 2, 3) → [1, 2, 3]
Close #74
Mihai Bazon [Fri, 21 Dec 2012 09:57:08 +0000 (11:57 +0200)]
Fix output when semicolons is off.
(need to force a semicolon for the empty body of an `if`)
Close #72
Mihai Bazon [Wed, 12 Dec 2012 09:50:03 +0000 (11:50 +0200)]
Small cleanup
Mihai Bazon [Thu, 6 Dec 2012 12:25:18 +0000 (14:25 +0200)]
v2.2.2
Mihai Bazon [Thu, 6 Dec 2012 10:27:57 +0000 (12:27 +0200)]
Add proper parens in "NoIn" expressions.
fix #60.
Mihai Bazon [Wed, 5 Dec 2012 11:14:49 +0000 (13:14 +0200)]
small improvement on merging assignments into hoisted vars
Mihai Bazon [Wed, 5 Dec 2012 10:30:25 +0000 (12:30 +0200)]
When hoisting variables, try to merge in assignments that follow.
Mihai Bazon [Fri, 30 Nov 2012 09:33:50 +0000 (11:33 +0200)]
Revert "Fixed reading from STDIN."
It breaks usage like this:
echo '...code...' | uglifyjs
This reverts commit
e48802ad291fae5a16f2d23cbd25a0c433cdbe48.
Mihai Bazon [Fri, 30 Nov 2012 09:26:37 +0000 (11:26 +0200)]
Add test for issue #59
Mihai Bazon [Fri, 30 Nov 2012 09:16:09 +0000 (11:16 +0200)]
Don't messup compressor stack while optimizing Switch
Fix #59
Mihai Bazon [Thu, 29 Nov 2012 09:23:07 +0000 (01:23 -0800)]
Merge pull request #58 from roxeteer/master
Fixed reading from STDIN
Visa Kopu [Thu, 29 Nov 2012 08:51:15 +0000 (10:51 +0200)]
Fixed reading from STDIN.
Mihai Bazon [Sat, 24 Nov 2012 08:02:08 +0000 (10:02 +0200)]
fix #55
Mihai Bazon [Fri, 23 Nov 2012 08:25:44 +0000 (10:25 +0200)]
v2.2.1
Mihai Bazon [Fri, 23 Nov 2012 08:20:00 +0000 (10:20 +0200)]
fix for https://github.com/mishoo/UglifyJS/issues/474
Mihai Bazon [Wed, 21 Nov 2012 11:27:03 +0000 (13:27 +0200)]
rename the npm package to "uglify-js" and cli tool to "uglifyjs"
Mihai Bazon [Sun, 18 Nov 2012 15:37:45 +0000 (17:37 +0200)]
fix #51
Mihai Bazon [Sat, 17 Nov 2012 10:05:31 +0000 (12:05 +0200)]
retain (1,eval) as is when it's the expression of an AST_Call
otherwise we change the meaning of eval from global to lexical.
Richard van Velzen [Wed, 14 Nov 2012 13:04:47 +0000 (14:04 +0100)]
Add support for somewhat preserving line numbers.
Usage: uglifyjs2 -b "beautify=0,preserve_line=1" /path/to/js
ref #46
Mihai Bazon [Wed, 14 Nov 2012 10:21:43 +0000 (12:21 +0200)]
better solution for the last test in constant switch folding
Mihai Bazon [Wed, 14 Nov 2012 10:06:07 +0000 (12:06 +0200)]
optimize constant switch blocks
ref. mishoo/UglifyJS#441
Mihai Bazon [Tue, 13 Nov 2012 12:34:38 +0000 (14:34 +0200)]
Merge branch 'optimize_concat' of https://github.com/rvanvelzen/UglifyJS2 into rvanvelzen-optimize_concat
Mihai Bazon [Tue, 13 Nov 2012 12:32:07 +0000 (14:32 +0200)]
don't change order in binary expressions if both operands have side effects
Richard van Velzen [Mon, 12 Nov 2012 14:41:03 +0000 (15:41 +0100)]
Add simple optimization for empty-string concats.
ref. #43
Mihai Bazon [Mon, 12 Nov 2012 11:24:52 +0000 (13:24 +0200)]
v2.1.11
Mihai Bazon [Mon, 12 Nov 2012 11:23:57 +0000 (13:23 +0200)]
fix invalid AST produced by dropping unused variable
close #44
Mihai Bazon [Mon, 12 Nov 2012 08:47:56 +0000 (00:47 -0800)]
Merge pull request #41 from Skalman/toString-patch
Convert x.toString() to ""+x instead of x+""
Dan Wolff [Sun, 11 Nov 2012 13:53:34 +0000 (15:53 +0200)]
convert x.toString() to ""+x instead of x+""
In some places this can save one byte in whitespace, e.g. after return.
Example:
function f(arg) {
// return""+arg - no space between return and ""
return arg.toString();
}
Mihai Bazon [Fri, 9 Nov 2012 14:43:49 +0000 (16:43 +0200)]
declare dependency versions
close #40
Mihai Bazon [Thu, 8 Nov 2012 13:39:14 +0000 (15:39 +0200)]
AST_LabelRef no longer inherits from AST_SymbolRef
Mihai Bazon [Thu, 8 Nov 2012 10:33:27 +0000 (12:33 +0200)]
v2.1.10
Mihai Bazon [Thu, 8 Nov 2012 10:31:28 +0000 (12:31 +0200)]
fix API breakage
close #36, #38
Mihai Bazon [Wed, 7 Nov 2012 16:57:51 +0000 (18:57 +0200)]
optimization for if/break as first statement in a loop body
for(...; x; ...) if (y) break; → for(...; x&&!y; ...);
similarly for `while` and some combinations (i.e. the `break` appears in the
`else` clause, etc.)
Mihai Bazon [Wed, 7 Nov 2012 13:27:12 +0000 (15:27 +0200)]
ignore node_modules/
Mihai Bazon [Wed, 7 Nov 2012 11:31:58 +0000 (13:31 +0200)]
v2.1.9
Mihai Bazon [Wed, 7 Nov 2012 11:31:43 +0000 (13:31 +0200)]
fix another small regression
we do need parens here: `new (foo.bar().baz)`, but not here: `new foo.bar.baz`
Mihai Bazon [Wed, 7 Nov 2012 11:03:11 +0000 (13:03 +0200)]
v2.1.8
Mihai Bazon [Wed, 7 Nov 2012 11:02:51 +0000 (13:02 +0200)]
fix regression from
5346fb94 (shouldn't parenthesize i++ in x[i++])
Mihai Bazon [Wed, 7 Nov 2012 10:45:23 +0000 (12:45 +0200)]
v2.1.7
Mihai Bazon [Wed, 7 Nov 2012 10:43:27 +0000 (12:43 +0200)]
add AST_Accessor and AST_SymbolAccessor node types
AST_Accessor will represent the function for a setter or getter. Since they
are not mangleable, and they should not introduce a name in scope, we have a
new node for their name (AST_SymbolAccessor) which doesn't inherit from
AST_SymbolDeclaration.
fix #37
Mihai Bazon [Wed, 7 Nov 2012 10:26:33 +0000 (12:26 +0200)]
parenthesize property access when it's the expression in New
refs #35
Mihai Bazon [Wed, 7 Nov 2012 09:49:06 +0000 (11:49 +0200)]
further fix for parens around New (refs #35)
Mihai Bazon [Wed, 7 Nov 2012 09:36:15 +0000 (11:36 +0200)]
parenthesize a Call expression when its parent is New
fix #35
Mihai Bazon [Wed, 7 Nov 2012 09:23:17 +0000 (11:23 +0200)]
add proper parens around unary expressions
fix #34
Mihai Bazon [Tue, 6 Nov 2012 09:39:41 +0000 (11:39 +0200)]
add option to mangle names even if eval/with is in use
(for more fair comparison to Closure compiler)
Mihai Bazon [Mon, 5 Nov 2012 20:23:51 +0000 (22:23 +0200)]
discard the hack that worked around the deprecation warning
(since the source-map module no longer uses require.js)
refs #9
Mihai Bazon [Mon, 5 Nov 2012 14:01:20 +0000 (16:01 +0200)]
convert `while` into `for`
Mihai Bazon [Mon, 5 Nov 2012 14:01:09 +0000 (16:01 +0200)]
minor
Mihai Bazon [Mon, 5 Nov 2012 11:13:06 +0000 (13:13 +0200)]
minor optimization
for `==` or `!=` against a constant, prefer to display the constant first.
should help a bit after gzip, i.e.:
typeof foo=="undefined"
^^^^^^ ^^^^^^^^^^^^^
vs:
"undefined"==typeof foo
^^^^^^^^^^^^^^^^^^^ (longer sequence that could repeat)
idea stolen from closure.
Mihai Bazon [Mon, 5 Nov 2012 11:09:39 +0000 (13:09 +0200)]
print final semicolon
close #28