UglifyJS.git
8 years agoPrevent endless recursion when evaluating self-referencing consts
Richard van Velzen [Tue, 12 Apr 2016 18:30:44 +0000 (20:30 +0200)]
Prevent endless recursion when evaluating self-referencing consts

Fix #1041

8 years agoAdd base54.reset() to compress tests
Richard van Velzen [Tue, 12 Apr 2016 18:08:09 +0000 (20:08 +0200)]
Add base54.reset() to compress tests

Without this reset, char counts bleed to next tests. One test had a bad expect clause.

8 years agoActually limit sequence length.
Mihai Bazon [Tue, 12 Apr 2016 11:15:14 +0000 (14:15 +0300)]
Actually limit sequence length.

Fix #1038

8 years agoFix warnings for referenced non-hoisted functions.
kzc [Sun, 10 Apr 2016 19:41:38 +0000 (15:41 -0400)]
Fix warnings for referenced non-hoisted functions.

Fixes #1034

Also added `expect_warnings` functionality to test framework.

8 years agoMerge pull request #1032 from kzc/member
Mihai Bazon [Thu, 7 Apr 2016 21:32:14 +0000 (00:32 +0300)]
Merge pull request #1032 from kzc/member

Simplify member(name, array) implementation.

8 years agoSimplify member(name, array) implementation.
kzc [Thu, 7 Apr 2016 13:57:30 +0000 (09:57 -0400)]
Simplify member(name, array) implementation.

8 years agoAvoid using inherited hasOwnProperty
Mihai Bazon [Thu, 7 Apr 2016 10:15:28 +0000 (13:15 +0300)]
Avoid using inherited hasOwnProperty

Fix #1031

8 years agoOptimize ternaries with boolean consequent or alternative.
kzc [Sat, 2 Apr 2016 04:21:13 +0000 (00:21 -0400)]
Optimize ternaries with boolean consequent or alternative.

Fixes #511

8 years agoSpeedup `unused` compress option for already minified code
kzc [Mon, 28 Mar 2016 21:58:50 +0000 (17:58 -0400)]
Speedup `unused` compress option for already minified code

Fixes: #321 #917 #1022

8 years agoadded documentation on conditional compilation using API
Sebastien Daniel [Fri, 4 Mar 2016 12:32:24 +0000 (07:32 -0500)]
added documentation on conditional compilation using API

8 years agoMerge pull request #1011 from kzc/dont-produce-let-in-mangle
Mihai Bazon [Thu, 24 Mar 2016 16:16:26 +0000 (18:16 +0200)]
Merge pull request #1011 from kzc/dont-produce-let-in-mangle

Do not produce `let` as a variable name in mangle.

8 years agoMerge pull request #1019 from kzc/escape-ascii-only
Mihai Bazon [Thu, 24 Mar 2016 16:08:57 +0000 (18:08 +0200)]
Merge pull request #1019 from kzc/escape-ascii-only

Escape all ASCII control characters within strings for ascii_only

8 years agoEscape all ASCII control characters within strings when using ascii_only.
kzc [Thu, 24 Mar 2016 15:51:54 +0000 (11:51 -0400)]
Escape all ASCII control characters within strings when using ascii_only.

Fixes #1017.

Tab characters within strings are now output as `\t` in all output modes.

8 years agoAttempt to increase timeout for mocha let test.
kzc [Tue, 15 Mar 2016 15:44:09 +0000 (11:44 -0400)]
Attempt to increase timeout for mocha let test.

8 years agoDo not produce `let` as a variable name in mangle.
kzc [Tue, 15 Mar 2016 15:20:32 +0000 (11:20 -0400)]
Do not produce `let` as a variable name in mangle.
Would previously occur in large generated functions with 21,000+ variables.
Fixes #986.

8 years agoFix: Uglified Number.prototype functions on big numbers
philippsimon [Mon, 14 Mar 2016 11:21:25 +0000 (12:21 +0100)]
Fix: Uglified Number.prototype functions on big numbers

8 years ago#877 Ignore mangle sort option
kzc [Sat, 27 Feb 2016 20:33:10 +0000 (15:33 -0500)]
#877 Ignore mangle sort option

8 years agov2.6.2
Mihai Bazon [Mon, 22 Feb 2016 19:39:14 +0000 (21:39 +0200)]
v2.6.2

8 years agoboolean_expression ? true : false --> boolean_expression
kzc [Sun, 21 Feb 2016 23:47:21 +0000 (18:47 -0500)]
boolean_expression ? true : false --> boolean_expression

8 years agoTake operator || precendence into account for AST_If optimization.
kzc [Sun, 21 Feb 2016 17:05:02 +0000 (12:05 -0500)]
Take operator || precendence into account for AST_If optimization.

Fixes #979.

8 years agoAllow --no-* options to disable their respective parameter
Richard van Velzen [Wed, 17 Feb 2016 19:04:45 +0000 (20:04 +0100)]
Allow --no-* options to disable their respective parameter

Fixes #974 and #972

8 years agopreserve ThisBinding for side_effects
alexlamsl [Tue, 16 Feb 2016 18:52:28 +0000 (02:52 +0800)]
preserve ThisBinding for side_effects

8 years agoDon't compress (0, eval)() to eval()
Richard van Velzen [Tue, 16 Feb 2016 18:00:48 +0000 (19:00 +0100)]
Don't compress (0, eval)() to eval()

8 years agoPreserve ThisBinding in conditionals & collapse_vars
alexlamsl [Tue, 16 Feb 2016 10:15:59 +0000 (18:15 +0800)]
Preserve ThisBinding in conditionals & collapse_vars

Fixes #973

8 years agoMerge pull request #948 from kzc/collapse_vars_doc
Richard van Velzen [Thu, 11 Feb 2016 21:13:30 +0000 (22:13 +0100)]
Merge pull request #948 from kzc/collapse_vars_doc

collapse_vars: document the compress option in README

8 years agoRevert "using the original sourcemap as the base"
sergeyv [Mon, 8 Feb 2016 21:42:07 +0000 (13:42 -0800)]
Revert "using the original sourcemap as the base"

This reverts commit ad18689d926d25c7a25b95c630c2ad05b7b5f5b5.

Reason for revert: introduce issue #882

Currently, generated sourcemap contains copy of all existing mappings and adds new mappings from uglified code to original one.
However, previous mapping are no longer valid and shouldn't be added.

8 years agoAllow cli options to be specified in separate definitions
Richard van Velzen [Mon, 8 Feb 2016 09:36:28 +0000 (10:36 +0100)]
Allow cli options to be specified in separate definitions

Fix for #963. This allows stuff like `--define a=1 --define b=1` besides only `--define a=1,b=1`

8 years agoCreate and map `bare-returns` into new `parse` property name
Martii [Sat, 6 Feb 2016 19:46:18 +0000 (12:46 -0700)]
Create and map `bare-returns` into new `parse` property name

8 years agoFixes #951 missing export for SymbolDef
Boris Letocha [Sun, 31 Jan 2016 20:41:38 +0000 (21:41 +0100)]
Fixes #951 missing export for SymbolDef

8 years agoMerge pull request #949 from kzc/collapse_vars_conditions
Mihai Bazon [Fri, 29 Jan 2016 16:05:39 +0000 (18:05 +0200)]
Merge pull request #949 from kzc/collapse_vars_conditions

collapse_vars: fix if/else and ternary operator side effects

8 years agocollapse_vars: avoid replacement across AST_Case nodes to be on safe side even though...
kzc [Fri, 29 Jan 2016 15:35:07 +0000 (10:35 -0500)]
collapse_vars: avoid replacement across AST_Case nodes to be on safe side even though no issues seen.

8 years agocollapse_vars: fix if/else and ternary operator side effects
kzc [Thu, 28 Jan 2016 17:17:06 +0000 (12:17 -0500)]
collapse_vars: fix if/else and ternary operator side effects

8 years agocollapse_vars: small change to README
kzc [Thu, 28 Jan 2016 16:04:30 +0000 (11:04 -0500)]
collapse_vars: small change to README

8 years agocollapse_vars: document option in README
kzc [Thu, 28 Jan 2016 16:01:17 +0000 (11:01 -0500)]
collapse_vars: document option in README

8 years agocollapse_vars: fix bug in repeated var defs of same name
kzc [Wed, 27 Jan 2016 23:35:49 +0000 (18:35 -0500)]
collapse_vars: fix bug in repeated var defs of same name

8 years agoAdd mangleProperties documentation to README
Bryan Rayner [Wed, 27 Jan 2016 20:24:32 +0000 (14:24 -0600)]
Add mangleProperties documentation to README

Add additional documentation to mangleProperties.

8 years agofix bug in collapse_vars for right side of "||" and "&&"
kzc [Wed, 27 Jan 2016 19:18:46 +0000 (14:18 -0500)]
fix bug in collapse_vars for right side of "||" and "&&"

8 years agoCollapse single use var definitions
kzc [Wed, 27 Jan 2016 07:17:06 +0000 (02:17 -0500)]
Collapse single use var definitions

Fix #721

8 years agoAdd start/end in the `arguments` definition
Mihai Bazon [Wed, 27 Jan 2016 09:36:03 +0000 (11:36 +0200)]
Add start/end in the `arguments` definition

(keeps my https://github.com/mishoo/jsinfo.el working)

8 years agoAdded a mangle properties option
Jeremy Marzka [Mon, 18 Jan 2016 02:54:09 +0000 (21:54 -0500)]
Added a mangle properties option

8 years agoMerge pull request #928 from STRML/constPragma
Richard van Velzen [Wed, 20 Jan 2016 18:04:36 +0000 (19:04 +0100)]
Merge pull request #928 from STRML/constPragma

Mark vars with /** @const */ pragma as consts so they can be eliminated.

8 years agoTighten up @const regex.
Samuel Reed [Wed, 20 Jan 2016 17:35:45 +0000 (11:35 -0600)]
Tighten up @const regex.

8 years agoSimplify by skipping extra tree walk.
Samuel Reed [Wed, 20 Jan 2016 17:03:41 +0000 (11:03 -0600)]
Simplify by skipping extra tree walk.

8 years agoUse TreeWalker for more accurate @const results and update tests
Samuel Reed [Wed, 20 Jan 2016 16:52:48 +0000 (10:52 -0600)]
Use TreeWalker for more accurate @const results and update tests

8 years agoUpdate README for /** @const */
Samuel Reed [Tue, 19 Jan 2016 19:24:36 +0000 (13:24 -0600)]
Update README for /** @const */

8 years agoMark vars with /** @const */ pragma as consts so they can be eliminated.
Samuel Reed [Tue, 19 Jan 2016 19:12:32 +0000 (13:12 -0600)]
Mark vars with /** @const */ pragma as consts so they can be eliminated.

Fixes older browser support for consts and allows more flexibility
in dead code removal.

8 years agoAllow operator names as getters/setters
Anthony Van de Gejuchte [Fri, 15 Jan 2016 14:58:15 +0000 (15:58 +0100)]
Allow operator names as getters/setters

Fixes #919

Fix provided by @kzc

8 years agoAdd keywords to package.json
Anthony Van de Gejuchte [Sat, 16 Jan 2016 20:35:39 +0000 (21:35 +0100)]
Add keywords to package.json

Should hopefully bump up on the results of the npm site when searching `uglify`

8 years agoAdd some tests for comment-filters through api
Anthony Van de Gejuchte [Tue, 19 Jan 2016 13:00:22 +0000 (14:00 +0100)]
Add some tests for comment-filters through api

Also never bother comment options to filter comment5/shebang comments
as they have their custom filter.

8 years agoMerge pull request #918 from avdg/fix-arguments-handling
Richard van Velzen [Mon, 18 Jan 2016 17:35:48 +0000 (18:35 +0100)]
Merge pull request #918 from avdg/fix-arguments-handling

Never mangle arguments and keep them in their scope

8 years agoMake arguments test slightly more strict
Anthony Van de Gejuchte [Thu, 14 Jan 2016 23:04:05 +0000 (00:04 +0100)]
Make arguments test slightly more strict

8 years agoAdd scope test for arguments
Anthony Van de Gejuchte [Thu, 14 Jan 2016 21:32:46 +0000 (22:32 +0100)]
Add scope test for arguments

8 years agoNever mangle arguments and keep them in their scope
Anthony Van de Gejuchte [Sun, 10 Jan 2016 22:33:54 +0000 (23:33 +0100)]
Never mangle arguments and keep them in their scope

Fixes #892

Helped-by: kzc
8 years agoMerge pull request #905 from avdg/unit-tests
Richard van Velzen [Thu, 14 Jan 2016 07:54:40 +0000 (08:54 +0100)]
Merge pull request #905 from avdg/unit-tests

Add unit tests

8 years agoAdd test case for line continuation
Anthony Van de Gejuchte [Tue, 12 Jan 2016 23:30:32 +0000 (00:30 +0100)]
Add test case for line continuation

8 years agoFix hoisting the var in ForIn
Mihai Bazon [Tue, 5 Jan 2016 11:56:52 +0000 (13:56 +0200)]
Fix hoisting the var in ForIn

Close #913

8 years agoAdd mocha tests
Anthony Van de Gejuchte [Sun, 27 Dec 2015 21:28:03 +0000 (22:28 +0100)]
Add mocha tests

8 years agoFix ch that could contain other newline characters
Anthony Van de Gejuchte [Sun, 27 Dec 2015 21:24:37 +0000 (22:24 +0100)]
Fix ch that could contain other newline characters

8 years agoDo not allow newlines in string literals
Anthony Van de Gejuchte [Sat, 26 Dec 2015 14:08:37 +0000 (15:08 +0100)]
Do not allow newlines in string literals

8 years agoMerge pull request #874 from kzc/fix-conditionals
Richard van Velzen [Sat, 26 Dec 2015 13:28:33 +0000 (14:28 +0100)]
Merge pull request #874 from kzc/fix-conditionals

#873 Fix `conditionals` optimizations with default compress options

8 years agoMerge pull request #896 from avdg/do-while-semicolon
Richard van Velzen [Sat, 26 Dec 2015 13:26:22 +0000 (14:26 +0100)]
Merge pull request #896 from avdg/do-while-semicolon

Semicolon after do...while statement is optional

8 years agoDisable loop optimization for parse-only tests
Anthony Van de Gejuchte [Fri, 18 Dec 2015 14:25:24 +0000 (15:25 +0100)]
Disable loop optimization for parse-only tests

8 years agoAdd tests
Anthony Van de Gejuchte [Fri, 18 Dec 2015 13:39:48 +0000 (14:39 +0100)]
Add tests

8 years agoSemicolon after do...while statement is optional
Anthony Van de Gejuchte [Thu, 17 Dec 2015 22:02:35 +0000 (23:02 +0100)]
Semicolon after do...while statement is optional

8 years agoMerge pull request #879 from ReadmeCritic/master
Richard van Velzen [Mon, 7 Dec 2015 18:04:56 +0000 (19:04 +0100)]
Merge pull request #879 from ReadmeCritic/master

Update README URLs based on HTTP redirects

8 years agoUpdate README URLs based on HTTP redirects
ReadmeCritic [Fri, 27 Nov 2015 16:46:55 +0000 (08:46 -0800)]
Update README URLs based on HTTP redirects

8 years ago#873 Fix `conditionals` optimizations with default compress options
kzc [Tue, 24 Nov 2015 18:27:50 +0000 (13:27 -0500)]
#873 Fix `conditionals` optimizations with default compress options

8 years agov2.6.1
Mihai Bazon [Mon, 16 Nov 2015 10:10:47 +0000 (12:10 +0200)]
v2.6.1

8 years agoFix endless loop
Mihai Bazon [Mon, 16 Nov 2015 10:07:15 +0000 (12:07 +0200)]
Fix endless loop

Close #866

8 years agoLimit max iterations for tighten_body
Mihai Bazon [Mon, 16 Nov 2015 10:06:12 +0000 (12:06 +0200)]
Limit max iterations for tighten_body

Ref #866

8 years agoMerge pull request #864 from plievone/patch-1
Richard van Velzen [Sat, 14 Nov 2015 11:04:49 +0000 (12:04 +0100)]
Merge pull request #864 from plievone/patch-1

Fix docs for keep_fargs

8 years agoFix docs for keep_fargs
plievone [Sat, 14 Nov 2015 09:38:00 +0000 (11:38 +0200)]
Fix docs for keep_fargs

Compression options `keep_fargs` and `unsafe` were decoupled in v.2.5.0 (commit 5fd1245), so document actual keep_fargs default.

8 years agov2.6.0
Mihai Bazon [Thu, 12 Nov 2015 10:46:28 +0000 (12:46 +0200)]
v2.6.0

8 years agoFix output for "use asm" code from SpiderMonkey AST
Mihai Bazon [Thu, 12 Nov 2015 10:18:25 +0000 (12:18 +0200)]
Fix output for "use asm" code from SpiderMonkey AST

(will only work properly if the SM tree contains "raw" properties for
Literal number nodes)

8 years agoBuild label def/refs info when figuring out scope
Mihai Bazon [Thu, 12 Nov 2015 09:48:06 +0000 (11:48 +0200)]
Build label def/refs info when figuring out scope

Fix #862

8 years agoReplace util.error with console.log
Mihai Bazon [Thu, 12 Nov 2015 09:47:37 +0000 (11:47 +0200)]
Replace util.error with console.log

8 years agoRework has_directive
Mihai Bazon [Wed, 11 Nov 2015 20:15:25 +0000 (22:15 +0200)]
Rework has_directive

It's now available during tree walking, i.e. walker.has_directive("use
asm"), rather than as part of the scope.  It's thus no longer necessary
to call `figure_out_scope` before codegen.  Added special bits in the
code generator to overcome the fact that it doesn't inherit from
TreeWalker.

Fix #861

8 years agoMerge pull request #854 from kzc/moz-regexp-2
Mihai Bazon [Tue, 10 Nov 2015 08:12:30 +0000 (10:12 +0200)]
Merge pull request #854 from kzc/moz-regexp-2

Have mozilla AST RegExpLiteral parser use regex.pattern and regex.flags

8 years agoFix parsing invalid input
Mihai Bazon [Mon, 9 Nov 2015 11:15:20 +0000 (13:15 +0200)]
Fix parsing invalid input

i.e. `x = 1.xe` â€” because parseFloat("1.xe") returns 1, this parsed as
`x = 1`.

Ref #857

8 years agoPrevent ReDoS by not using a regexp to verify floating point numbers
Richard van Velzen [Mon, 9 Nov 2015 10:28:27 +0000 (11:28 +0100)]
Prevent ReDoS by not using a regexp to verify floating point numbers

`parseFloat` will return `NaN` for invalid numbers anyway, which is the check used to throw the parse error.

Fixes #857

8 years agosimplify mozilla AST RegExpLiteral token parse and handle corner cases of regex.patte...
kzc [Mon, 2 Nov 2015 18:10:37 +0000 (13:10 -0500)]
simplify mozilla AST RegExpLiteral token parse and handle corner cases of regex.pattern better

8 years agoHave mozilla AST RegExpLiteral parser use regex.pattern and regex.flags rather than...
kzc [Mon, 2 Nov 2015 17:24:09 +0000 (12:24 -0500)]
Have mozilla AST RegExpLiteral parser use regex.pattern and regex.flags rather than non-standard `raw` property.

8 years agorename To_Moz_Literal to To_Moz_RegExp
kzc [Sun, 1 Nov 2015 15:20:42 +0000 (10:20 -0500)]
rename To_Moz_Literal to To_Moz_RegExp

8 years agoFixed RegExp literal in mozilla AST generation/output and added a --dump-spidermonkey...
kzc [Sun, 1 Nov 2015 05:02:52 +0000 (01:02 -0400)]
Fixed RegExp literal in mozilla AST generation/output and added a --dump-spidermonkey-ast flag

8 years ago`return undefined` optimization no longer uses `return_void_0` option
kzc [Wed, 28 Oct 2015 21:51:46 +0000 (17:51 -0400)]
`return undefined` optimization no longer uses `return_void_0` option

8 years agomore tests for `return undefined` optimization
kzc [Wed, 28 Oct 2015 17:41:41 +0000 (13:41 -0400)]
more tests for `return undefined` optimization

8 years agooptimize `return undefined` and `return void 0`
kzc [Wed, 28 Oct 2015 17:25:27 +0000 (13:25 -0400)]
optimize `return undefined` and `return void 0`

8 years agoAllow specification beautify options in tests
Richard van Velzen [Wed, 28 Oct 2015 19:50:01 +0000 (20:50 +0100)]
Allow specification beautify options in tests

Caught an error in #847 as well - `output` wasn't passed anywhere which led to an exception. `options` was available though.

8 years agoStop building for io.js
Richard van Velzen [Wed, 28 Oct 2015 19:36:03 +0000 (20:36 +0100)]
Stop building for io.js

8 years agofixes #845: \v escaping should be restricted to "screw_ie8" mode
Michael Ficarra [Tue, 27 Oct 2015 16:05:21 +0000 (09:05 -0700)]
fixes #845: \v escaping should be restricted to "screw_ie8" mode

8 years agoFix #836
Fábio Santos [Tue, 20 Oct 2015 18:48:56 +0000 (19:48 +0100)]
Fix #836

8 years agoMake_string was missing \v and wasnt reversing vertical tabs even though read_escaped...
startswithaj [Thu, 15 Oct 2015 06:50:53 +0000 (16:50 +1000)]
Make_string was missing \v and wasnt reversing vertical tabs even though read_escaped_char coverts them

8 years agoadd `--pure-funcs` option
Damian Krzeminski [Wed, 14 Oct 2015 01:05:37 +0000 (21:05 -0400)]
add `--pure-funcs` option

it has the same effect as specifying `pure_funcs` in `--compressor`
option, however it's much easier to use

instead of:

    --compressor 'pure_func=["Math.floor","debug","console.logTime"]'

it's now possible:

    --compressor --pure-funcs Math.floor debug console.logTime

fixes #684

8 years agoupgrade yargs 3.5.4 -> 3.10.0
Damian Krzeminski [Wed, 14 Oct 2015 01:01:36 +0000 (21:01 -0400)]
upgrade yargs 3.5.4 -> 3.10.0

we need a version with better support for 'array' params
see: https://github.com/bcoe/yargs/pull/164

8 years agoMerge pull request #829 from kzc/html_comment_ops
Mihai Bazon [Tue, 13 Oct 2015 06:59:40 +0000 (09:59 +0300)]
Merge pull request #829 from kzc/html_comment_ops

Fix other operator output producing <!-- or -->

8 years agoFix other operator output related to <!-- or -->
kzc [Tue, 13 Oct 2015 05:17:10 +0000 (01:17 -0400)]
Fix other operator output related to <!-- or -->

8 years agoFix tests
Mihai Bazon [Mon, 12 Oct 2015 07:27:00 +0000 (10:27 +0300)]
Fix tests

8 years agoOnly encode <!-- and --> in strings when inline_script
Mihai Bazon [Mon, 12 Oct 2015 07:21:22 +0000 (10:21 +0300)]
Only encode <!-- and --> in strings when inline_script

8 years agoOutput `-- >` instead of `-->` in expressions. Escape `<!--` and `-->` within string...
kzc [Mon, 12 Oct 2015 04:20:42 +0000 (00:20 -0400)]
Output `-- >` instead of `-->` in expressions. Escape `<!--` and `-->` within string literals.

8 years agov2.5.0
Mihai Bazon [Sun, 11 Oct 2015 15:24:38 +0000 (18:24 +0300)]
v2.5.0