UglifyJS.git
9 years agoDeclare boolean type for --keep-fnames
Mihai Bazon [Mon, 5 Jan 2015 09:20:00 +0000 (11:20 +0200)]
Declare boolean type for --keep-fnames

9 years agoMerge branch 'keep-function-expression-names' of https://github.com/rvanvelzen/UglifyJS2
Mihai Bazon [Mon, 5 Jan 2015 09:11:38 +0000 (11:11 +0200)]
Merge branch 'keep-function-expression-names' of https://github.com/rvanvelzen/UglifyJS2

9 years agoSupport keep_fnames in compressor, and --keep-fnames. #552
Mihai Bazon [Mon, 5 Jan 2015 09:03:13 +0000 (11:03 +0200)]
Support keep_fnames in compressor, and --keep-fnames. #552

Passing `--keep-fnames` will enable it both for compressor/mangler, so that
function names will not be dropped (when unused) nor mangled.

9 years agoAdd an option to prevent function names from being mangled
Richard van Velzen [Sun, 4 Jan 2015 19:53:19 +0000 (20:53 +0100)]
Add an option to prevent function names from being mangled

See #552. This is mostly useful for having the actual function names in traces.

9 years agousing the original sourcemap as the base
Caridy Patino [Tue, 11 Nov 2014 19:38:01 +0000 (14:38 -0500)]
using the original sourcemap as the base

* Creates a new SourceMapGenerator based on a SourceMapConsumer:
  https://github.com/mozilla/source-map#sourcemapgeneratorfromsourcemapsourcemapconsumer

9 years agoResolve the relative path to lib files last
truiken [Fri, 29 Aug 2014 18:41:13 +0000 (11:41 -0700)]
Resolve the relative path to lib files last

This allows usage of UglifyJS on build systems which have a flat (or non-matching relative) directory structure for source files.

9 years agoAdd a "keep_fnames" option to the compressor to retain function expression names
Richard van Velzen [Sun, 4 Jan 2015 19:14:38 +0000 (20:14 +0100)]
Add a "keep_fnames" option to the compressor to retain function expression names

See #552. This is useful for stack traces.

9 years agopasses in references to process and Buffer to silence ReferenceErrors
achingbrain [Thu, 28 Nov 2013 08:32:39 +0000 (08:32 +0000)]
passes in references to process and Buffer to silence ReferenceErrors

9 years agoFix backslashes in source-map paths on Windows
Derek Wickern [Thu, 23 Oct 2014 23:27:53 +0000 (16:27 -0700)]
Fix backslashes in source-map paths on Windows

9 years agoUpdate README.md
Austin Brown [Thu, 27 Mar 2014 06:15:44 +0000 (23:15 -0700)]
Update README.md

otions => options

9 years agoUse svg instead of png to get better image quality
Peter Dave Hello [Thu, 25 Dec 2014 14:41:33 +0000 (22:41 +0800)]
Use svg instead of png to get better image quality

9 years agoFix #556
Richard van Velzen [Thu, 23 Oct 2014 14:16:19 +0000 (16:16 +0200)]
Fix #556

`\uFEFF` (ZERO WIDTH NO-BREAK SPACE) is removed when parsing, but was
un-escaped for the output when `ascii_only` was false.

When using
UglifyJS multiple times (creating packages from minified sources, for
example), this would lead to problems because the byte was removed when
parsing for the second time.

9 years agoMerge pull request #570 from rvanvelzen/fix-569
Richard van Velzen [Sun, 4 Jan 2015 13:02:08 +0000 (14:02 +0100)]
Merge pull request #570 from rvanvelzen/fix-569

Fix #569

9 years agoMerge pull request #584 from clyfish/fix-base54
Richard van Velzen [Sun, 4 Jan 2015 13:00:23 +0000 (14:00 +0100)]
Merge pull request #584 from clyfish/fix-base54

fix base54

9 years agoMerge pull request #592 from micschro/patch-1
Richard van Velzen [Sun, 4 Jan 2015 12:53:31 +0000 (13:53 +0100)]
Merge pull request #592 from micschro/patch-1

Fix max_line_len not working for JSON files

9 years agoMerge pull request #600 from KenPowers/master
Richard van Velzen [Sun, 4 Jan 2015 12:52:02 +0000 (13:52 +0100)]
Merge pull request #600 from KenPowers/master

Use yargs instead of optimist.

9 years agoFix #569
Richard van Velzen [Thu, 23 Oct 2014 13:57:12 +0000 (15:57 +0200)]
Fix #569

When no arguments are given to `new Function()`, it should be treated as
a regular anonymous function (http://es5.github.io/#x15.3.2.1)

9 years agoUse yargs instead of optimist.
Kenneth Powers [Thu, 1 Jan 2015 06:04:54 +0000 (01:04 -0500)]
Use yargs instead of optimist.

9 years agoMerge pull request #599 from rvanvelzen/fix-597
Mihai Bazon [Wed, 31 Dec 2014 12:18:31 +0000 (14:18 +0200)]
Merge pull request #599 from rvanvelzen/fix-597

Fix #597

9 years agoFix #597
Richard van Velzen [Wed, 31 Dec 2014 11:23:00 +0000 (12:23 +0100)]
Fix #597

NaN and Infinity were replaced in the output generation, instead of
during compression. This could lead to results where `1/0` was inserted
without parens leading to invalid output.

The nodes are replaced in the compression step now, and the output
generation returns their regular names. This should not be a problem,
since they're already only constructed from the original name.

9 years agoFix max_line_len not working for JSON files
micschro [Wed, 17 Dec 2014 15:31:03 +0000 (16:31 +0100)]
Fix max_line_len not working for JSON files

As `maybe_newline()` is only called when `might_need_semicolon` is `true`, the `max_line_len` option has no effect for files without (or with very few) semicolons (like JSON files). A simple for this problem is to use `maybe_newline()` instead of `noop` as the `newline()` function in non-beautify mode.

9 years agov2.4.16
Mihai Bazon [Tue, 9 Dec 2014 13:21:44 +0000 (15:21 +0200)]
v2.4.16

9 years agoMerge pull request #546 from jacobk/patch-1
Mihai Bazon [Thu, 4 Dec 2014 12:07:08 +0000 (14:07 +0200)]
Merge pull request #546 from jacobk/patch-1

Use uglify source map token names if missing

9 years agofix base54
Cheng Liangyu [Mon, 1 Dec 2014 05:16:44 +0000 (13:16 +0800)]
fix base54

9 years agoAdd option to allow return outside of functions.
Mihai Bazon [Mon, 20 Oct 2014 15:12:13 +0000 (18:12 +0300)]
Add option to allow return outside of functions.

Close #288

9 years agoDocument `keep_fargs`. Close #557
Mihai Bazon [Sun, 28 Sep 2014 09:36:36 +0000 (12:36 +0300)]
Document `keep_fargs`.  Close #557

9 years agoReferencing a global is assumed to have side effects.
Mihai Bazon [Sun, 28 Sep 2014 08:16:51 +0000 (11:16 +0300)]
Referencing a global is assumed to have side effects.

Close #550

10 years agoMerge pull request #549 from Arnavion/unreferenced-catch-symbol
Mihai Bazon [Sat, 13 Sep 2014 06:29:34 +0000 (09:29 +0300)]
Merge pull request #549 from Arnavion/unreferenced-catch-symbol

Don't warn for an unreferenced exception symbol in a catch block.

10 years agoDon't warn for an unreferenced exception symbol in a catch block.
Arnavion [Sat, 13 Sep 2014 04:01:19 +0000 (21:01 -0700)]
Don't warn for an unreferenced exception symbol in a catch block.

10 years agoMerge pull request #541 from TalAter/conditional-improvements
Mihai Bazon [Tue, 9 Sep 2014 15:45:12 +0000 (18:45 +0300)]
Merge pull request #541 from TalAter/conditional-improvements

Conditional assignment of equivalent constants compressed  ( x=y?1:1 --> x=1 )

10 years agoUse uglify source map token names if missing
Jacob Kristhammar [Tue, 9 Sep 2014 11:02:50 +0000 (13:02 +0200)]
Use uglify source map token names if missing

10 years agoCompress conditions that have side effects using sequences
Tal Ater [Wed, 3 Sep 2014 23:57:49 +0000 (02:57 +0300)]
Compress conditions that have side effects using sequences

10 years agoAdded a test for else if
Tal Ater [Tue, 2 Sep 2014 22:35:30 +0000 (01:35 +0300)]
Added a test for else if

10 years agoCompress conditional assignments where all possible outcomes are equivalant and condi...
Tal Ater [Tue, 2 Sep 2014 20:30:25 +0000 (23:30 +0300)]
Compress conditional assignments where all possible outcomes are equivalant and condition has no side effects

10 years agoTurn foo.new into foo["new"] when not --screw-ie8. Fix #534
Mihai Bazon [Tue, 26 Aug 2014 07:11:01 +0000 (10:11 +0300)]
Turn foo.new into foo["new"] when not --screw-ie8.  Fix #534

10 years agoPrevent error for Function(""). Close #538
Mihai Bazon [Wed, 20 Aug 2014 06:16:34 +0000 (09:16 +0300)]
Prevent error for Function("").  Close #538

10 years agoMerge pull request #529 from RReverser/master
Mihai Bazon [Mon, 4 Aug 2014 20:05:29 +0000 (23:05 +0300)]
Merge pull request #529 from RReverser/master

Added example for usage with SpiderMonkey AST

10 years agoAdded example for usage with SpiderMonkey AST.
Ingvar Stepanyan [Mon, 4 Aug 2014 17:48:14 +0000 (20:48 +0300)]
Added example for usage with SpiderMonkey AST.

10 years agoMerge branch 'master' of https://github.com/RReverser/UglifyJS2
Mihai Bazon [Mon, 4 Aug 2014 06:01:19 +0000 (09:01 +0300)]
Merge branch 'master' of https://github.com/RReverser/UglifyJS2

10 years agoInstall newest NPM on oldest Node.js.
Ingvar Stepanyan [Sun, 3 Aug 2014 18:44:59 +0000 (21:44 +0300)]
Install newest NPM on oldest Node.js.

10 years agoAdded generative testing for AST conversions.
Ingvar Stepanyan [Sun, 3 Aug 2014 17:48:59 +0000 (20:48 +0300)]
Added generative testing for AST conversions.

10 years agoMerge branch 'patch-1' of https://github.com/gdw2/UglifyJS2
Mihai Bazon [Sun, 3 Aug 2014 08:08:39 +0000 (11:08 +0300)]
Merge branch 'patch-1' of https://github.com/gdw2/UglifyJS2

10 years agoSpiderMonkey `Identifier` nodes should contain mangled names.
Ingvar Stepanyan [Sat, 2 Aug 2014 22:28:58 +0000 (01:28 +0300)]
SpiderMonkey `Identifier` nodes should contain mangled names.

10 years agoSmall fixes for AST conversion.
Ingvar Stepanyan [Sat, 2 Aug 2014 10:18:27 +0000 (13:18 +0300)]
Small fixes for AST conversion.

10 years agoFixes and improvements for UglifyJS->SM AST conversion.
Ingvar Stepanyan [Fri, 1 Aug 2014 20:31:28 +0000 (23:31 +0300)]
Fixes and improvements for UglifyJS->SM AST conversion.

* Explicitly forbidden multiple catch clauses as SM-specific feature.
* Simplified describing of UglifyJS->Mozilla AST conversion rules.
* Moved alias rules to single place.
* Removed usage of dynamic type bindings in generated code (speed-up).

10 years agoImproved UglifyJS<->SpiderMonkey AST conversions.
Ingvar Stepanyan [Fri, 1 Aug 2014 12:13:31 +0000 (15:13 +0300)]
Improved UglifyJS<->SpiderMonkey AST conversions.

* Added directives recognition in SM AST.
* Moved semi-standard SM `Property` type to separate handler.
* Added `const` recognition from SM AST.
* Removed redundant `this`-as-identifier recognition.
* Removed redundant rules for abstract SM types.
* Described `CatchClause` using string syntax.
* Added support for semi-standard `range` tuple as location source.
* Added back-conversion support (to be improved).

10 years agoAdded license
gdw2 [Mon, 28 Jul 2014 20:49:44 +0000 (13:49 -0700)]
Added license

10 years agoFix parens for AST_Undefined
Mihai Bazon [Fri, 18 Jul 2014 08:31:41 +0000 (11:31 +0300)]
Fix parens for AST_Undefined

Do the same as for AST_Unary, since we output undefined as `void 0`.

Reported at https://github.com/mishoo/UglifyJS2/issues/338#issuecomment-48858341

10 years agov2.4.15
Mihai Bazon [Wed, 9 Jul 2014 15:01:40 +0000 (18:01 +0300)]
v2.4.15

10 years agoLock source-map to 0.1.34
Mihai Bazon [Wed, 9 Jul 2014 15:01:23 +0000 (18:01 +0300)]
Lock source-map to 0.1.34

10 years agoCheck for the case an AST_For's init is an EmptyStatement
Mihai Bazon [Tue, 1 Jul 2014 20:10:44 +0000 (23:10 +0300)]
Check for the case an AST_For's init is an EmptyStatement

(lame fix for #503)

10 years agoEvaluate "foo".length ==> 3
Dan Wolff [Mon, 30 Jun 2014 22:51:42 +0000 (00:51 +0200)]
Evaluate "foo".length ==> 3

10 years agoMerge pull request #499 from shinnn/master
Mihai Bazon [Thu, 26 Jun 2014 06:30:25 +0000 (09:30 +0300)]
Merge pull request #499 from shinnn/master

Update .travis.yml to pass the test on Travis CI

10 years agoDo not run a test for Node v0.4
Shinnosuke Watanabe [Thu, 26 Jun 2014 04:17:59 +0000 (13:17 +0900)]
Do not run a test for Node v0.4

Travis CI doesn’t support Node v0.4.

http://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Provide
d-Node.js-Versions

10 years agov2.4.14
Mihai Bazon [Thu, 12 Jun 2014 14:24:33 +0000 (17:24 +0300)]
v2.4.14

10 years agoActually, even better. #475
Mihai Bazon [Sun, 27 Apr 2014 18:42:14 +0000 (21:42 +0300)]
Actually, even better.  #475

- also handle x = + ++y, x = - --y;
- don't use parens, a space suffices.

10 years agoBetter fix for #475
Mihai Bazon [Sun, 27 Apr 2014 17:54:54 +0000 (20:54 +0300)]
Better fix for #475

10 years agoFix parens in +(+x). Close #475
Mihai Bazon [Sun, 27 Apr 2014 17:51:01 +0000 (20:51 +0300)]
Fix parens in +(+x).  Close #475

10 years agoMerge branch 'master' of github.com:mishoo/UglifyJS2
Mihai Bazon [Thu, 24 Apr 2014 07:56:57 +0000 (10:56 +0300)]
Merge branch 'master' of github.com:mishoo/UglifyJS2

10 years agoMerge pull request #445 from ConradIrwin/try-statement
Mihai Bazon [Thu, 24 Apr 2014 07:46:53 +0000 (10:46 +0300)]
Merge pull request #445 from ConradIrwin/try-statement

Handle TryStatements trees from acorn >=0.2.0

10 years agoUpdate tests.
Mihai Bazon [Fri, 18 Apr 2014 08:19:52 +0000 (11:19 +0300)]
Update tests.

10 years agoAlways quote property names that contain non-ASCII characters.
Mihai Bazon [Fri, 18 Apr 2014 07:47:38 +0000 (10:47 +0300)]
Always quote property names that contain non-ASCII characters.

Fix #328

10 years agoMerge pull request #470 from ebednarz/master
Mihai Bazon [Sun, 13 Apr 2014 09:54:12 +0000 (12:54 +0300)]
Merge pull request #470 from ebednarz/master

Fix sourceMapIncludeSources exception in Node API

10 years agoadd sourceMappingUrl to output in node module
OiNutter [Fri, 11 Apr 2014 15:09:56 +0000 (16:09 +0100)]
add sourceMappingUrl to output in node module

If options.outSourceMap is specified the sourceMappingURL comment
should be appended to the output stream

10 years agoFix sourceMapIncludeSources exception in Node API
ebednarz [Sun, 13 Apr 2014 09:16:10 +0000 (11:16 +0200)]
Fix sourceMapIncludeSources exception in Node API

https://github.com/mishoo/UglifyJS2/issues/459

10 years agoMerge pull request #454 from Arnavion/allow-colons-in-wrap_enclose
Mihai Bazon [Mon, 24 Mar 2014 13:10:35 +0000 (15:10 +0200)]
Merge pull request #454 from Arnavion/allow-colons-in-wrap_enclose

Allow colons in the pairs passed to AST_Toplevel.wrap_enclose

10 years agoAllow colons in the pairs passed to AST_Toplevel.wrap_enclose
Arnavion [Sun, 23 Mar 2014 01:02:21 +0000 (18:02 -0700)]
Allow colons in the pairs passed to AST_Toplevel.wrap_enclose

10 years agov2.4.13
Mihai Bazon [Tue, 11 Mar 2014 13:22:37 +0000 (15:22 +0200)]
v2.4.13

10 years agoHandle TryStatements trees from acorn >=0.2.0
Conrad Irwin [Fri, 7 Mar 2014 01:07:49 +0000 (17:07 -0800)]
Handle TryStatements trees from acorn >=0.2.0

10 years agoMerge pull request #439 from Arnavion/null-source-in-sourcemap
Mihai Bazon [Mon, 3 Mar 2014 07:19:39 +0000 (09:19 +0200)]
Merge pull request #439 from Arnavion/null-source-in-sourcemap

Handle the case when SourceMapConsumer.originalPositionFor returns null source.

10 years agoHandle the case when SourceMapConsumer.originalPositionFor returns null source.
Arnavion [Mon, 3 Mar 2014 03:20:19 +0000 (19:20 -0800)]
Handle the case when SourceMapConsumer.originalPositionFor returns null source.

This happens when SourceMapConsumer does not have a valid position to map the input line and column. This is a change in mozilla/source-map starting from version 0.1.33

Fixes #436

10 years agoMangle name of exception when --screw-ie8. Fix #430.
Mihai Bazon [Fri, 14 Feb 2014 11:58:14 +0000 (13:58 +0200)]
Mangle name of exception when --screw-ie8.  Fix #430.

The effect of not mangling it was visible only with --screw-ie8 (otherwise
the names would be mangled exactly because they leaked into the parent
scope).

10 years agoAdd option `keep_fargs`.
Mihai Bazon [Sat, 8 Feb 2014 10:33:56 +0000 (12:33 +0200)]
Add option `keep_fargs`.

By default it's `false`.  Pass `true` if you need to keep unused function
arguments.

Close #188.

10 years agoMerge pull request #424 from mattbasta/simplify_conditionals
Mihai Bazon [Fri, 7 Feb 2014 09:31:11 +0000 (11:31 +0200)]
Merge pull request #424 from mattbasta/simplify_conditionals

Simplify nested conditionals if possible

10 years agoSimplify nested conditionals if possible
Matt Basta [Thu, 6 Feb 2014 20:39:13 +0000 (12:39 -0800)]
Simplify nested conditionals if possible

10 years agoMerge pull request #422 from mourner/patch-1
Mihai Bazon [Thu, 6 Feb 2014 16:13:10 +0000 (18:13 +0200)]
Merge pull request #422 from mourner/patch-1

Fix readme typo (when -> with)

10 years agofix readme typo (when -> with)
Vladimir Agafonkin [Thu, 6 Feb 2014 16:11:33 +0000 (18:11 +0200)]
fix readme typo (when -> with)

10 years agoFix if_return dropping the alternative. Close #413
Mihai Bazon [Fri, 31 Jan 2014 08:44:13 +0000 (10:44 +0200)]
Fix if_return dropping the alternative.  Close #413

10 years agoUpdate source-map
Mihai Bazon [Sun, 26 Jan 2014 08:18:20 +0000 (10:18 +0200)]
Update source-map

10 years agoMerge branch 'sourcesContent' of https://github.com/arty-name/UglifyJS2 into arty...
Mihai Bazon [Sun, 26 Jan 2014 08:15:24 +0000 (10:15 +0200)]
Merge branch 'sourcesContent' of https://github.com/arty-name/UglifyJS2 into arty-name-sourcesContent

10 years agov2.4.12
Mihai Bazon [Sun, 26 Jan 2014 08:11:00 +0000 (10:11 +0200)]
v2.4.12

10 years agoMerge branch 'master' of github.com:mishoo/UglifyJS2
Mihai Bazon [Sun, 26 Jan 2014 08:07:10 +0000 (10:07 +0200)]
Merge branch 'master' of github.com:mishoo/UglifyJS2

10 years agoMerge pull request #408 from danielstutzman/escape-null-in-regex
Mihai Bazon [Sun, 26 Jan 2014 08:06:19 +0000 (00:06 -0800)]
Merge pull request #408 from danielstutzman/escape-null-in-regex

Don't unescape \x00 in regexes (it breaks IE8)

10 years agoMove unescaping regexps under a codegen option (`unescape_regexps`)
Mihai Bazon [Sun, 26 Jan 2014 08:05:55 +0000 (10:05 +0200)]
Move unescaping regexps under a codegen option (`unescape_regexps`)

10 years agoDon't unescape \x00 in regexes (it breaks IE8)
Daniel Stutzman [Sat, 25 Jan 2014 18:55:39 +0000 (11:55 -0700)]
Don't unescape \x00 in regexes (it breaks IE8)

10 years agov2.4.11
Mihai Bazon [Tue, 21 Jan 2014 09:44:28 +0000 (11:44 +0200)]
v2.4.11

10 years agoMore chars that cannot be unescaped in regexps.
Mihai Bazon [Tue, 21 Jan 2014 09:44:00 +0000 (11:44 +0200)]
More chars that cannot be unescaped in regexps.

10 years agoFix end token for conditionals. Close #404
Mihai Bazon [Tue, 21 Jan 2014 08:38:59 +0000 (10:38 +0200)]
Fix end token for conditionals.  Close #404

10 years agoMerge pull request #402 from lautis/bom-regexps
Mihai Bazon [Sun, 19 Jan 2014 14:14:12 +0000 (06:14 -0800)]
Merge pull request #402 from lautis/bom-regexps

Don't unescape byte order marks in regexps

10 years agoDon't unescape byte order marks in regexps
Ville Lautanala [Sun, 19 Jan 2014 10:27:03 +0000 (12:27 +0200)]
Don't unescape byte order marks in regexps

10 years agov2.4.10
Mihai Bazon [Sat, 18 Jan 2014 10:32:45 +0000 (12:32 +0200)]
v2.4.10

10 years agoDon't unescape \x2f (slash) in regexps. #54
Mihai Bazon [Sat, 18 Jan 2014 10:31:50 +0000 (12:31 +0200)]
Don't unescape \x2f (slash) in regexps.  #54

10 years agoFix example
Mihai Bazon [Fri, 17 Jan 2014 13:48:47 +0000 (15:48 +0200)]
Fix example

10 years agov2.4.9
Mihai Bazon [Wed, 15 Jan 2014 20:31:09 +0000 (22:31 +0200)]
v2.4.9

10 years agosimplify
Mihai Bazon [Fri, 10 Jan 2014 08:36:15 +0000 (10:36 +0200)]
simplify

10 years agoUnescape Unicode sequences in regexps when ascii_only is false. #54
Mihai Bazon [Fri, 10 Jan 2014 08:33:58 +0000 (10:33 +0200)]
Unescape Unicode sequences in regexps when ascii_only is false.  #54

10 years agoadded hasOwnProperty check to avoid warnings
Artemy Tregubenko [Thu, 9 Jan 2014 14:20:05 +0000 (15:20 +0100)]
added hasOwnProperty check to avoid warnings

10 years agoAdded support for sourcesContent property of source map
Artemy Tregubenko [Thu, 9 Jan 2014 14:12:00 +0000 (15:12 +0100)]
Added support for sourcesContent property of source map

10 years agoBetter process_for_angular before other statement reductions. #395
Mihai Bazon [Wed, 8 Jan 2014 09:39:24 +0000 (11:39 +0200)]
Better process_for_angular before other statement reductions.  #395

10 years agoSupport @ngInject with `angular` compressor option. Close #395.
Mihai Bazon [Wed, 8 Jan 2014 09:28:32 +0000 (11:28 +0200)]
Support @ngInject with `angular` compressor option.  Close #395.