kzc [Thu, 30 Jun 2016 18:56:12 +0000 (14:56 -0400)]
Change the default sequences limit to 200 to speed up compress.
Has little or no impact on minification size in the majority of
cases but can speed up rollup builds significantly.
This sequences change also has the beneficial side effect of avoiding
"stack size exceeded" errors on very large input files.
The user is free to alter the sequences limit if they are so inclined.
The previous sequences limit was 2000. 20 is often sufficient.
kzc [Sun, 26 Jun 2016 21:16:02 +0000 (17:16 -0400)]
Allow sequences maximum length to be user configurable.
Geraint [Mon, 27 Jun 2016 11:01:21 +0000 (12:01 +0100)]
Allow input files to be map (url->filename)
Anthony Van de Gejuchte [Mon, 13 Jun 2016 10:36:47 +0000 (12:36 +0200)]
Various LineTerminator changes
* Escaped newlines should also produce SyntaxError
* Fix multiline comment parsing and add tests
* Adapt makePredicate to handle \u2028 and \u2029
* Move up nlb check in regex so it's checked before any escape handling
* Change error messages to conform ecma standard
* Find_eol not recornizing \u2028 and \u2029 as line terminator
* Remove \u180e as it is removed in unicode 6.3.0 from the category zs
kzc [Thu, 30 Jun 2016 04:24:34 +0000 (00:24 -0400)]
Enable --screw-ie8 by default.
catch identifier is mangled correctly for ES5 standards-compliant JS engines by default.
Unconditionally use the ie8 if/do-while workaround whether or not --screw-ie8 is enabled.
To support non-standard ie8 javascript use: uglifyjs --support-ie8
iliashk [Sat, 25 Jun 2016 08:48:39 +0000 (11:48 +0300)]
Add Node API documentation for mangling options
kzc [Thu, 23 Jun 2016 16:54:38 +0000 (12:54 -0400)]
Fix spidermonkey AST (ESTree) export and import, Array holes
Fixes: #1156 #1161
Also add test to exercise Uglify after spidermonkey export/import of itself.
Anthony Van de Gejuchte [Thu, 23 Jun 2016 14:53:48 +0000 (16:53 +0200)]
Move OctalEscapeSequence to read_escape_char
This should simplify and improve implementation, make it easier to
implement template strings, and keep master a bit more in sync with
harmony.
Previous implementation wasn't broken, though the loop gave me the
impression it could read infinite numbers and annoyed me a bit. It was
also slightly unnecessary because the lookup involved only 3 characters.
Richard van Velzen [Wed, 22 Jun 2016 10:24:31 +0000 (12:24 +0200)]
v2.6.4
Mihai Bazon [Tue, 21 Jun 2016 20:14:05 +0000 (23:14 +0300)]
Merge pull request #1155 from kzc/issue_1154
Fix conditional expressions of form (x ? -1 : -1)
kzc [Tue, 21 Jun 2016 18:52:13 +0000 (14:52 -0400)]
Fix conditional expressions of form (x ? -1 : -1)
Fixes #1154, #1153
kzc [Sun, 19 Jun 2016 03:06:59 +0000 (23:06 -0400)]
Don't replace undefined, NaN and Infinity within with scope
Anthony Van de Gejuchte [Mon, 20 Jun 2016 12:18:47 +0000 (14:18 +0200)]
Keep master in sync with harmony
* Do not mangle when no mangle is required
* Improve use_asm reset while printing code
Richard van Velzen [Mon, 20 Jun 2016 06:39:46 +0000 (08:39 +0200)]
Don't assume DEBUG is defined when exporting --self
Potential fix for #1148
Richard van Velzen [Sun, 19 Jun 2016 19:56:06 +0000 (21:56 +0200)]
v2.6.3
Asia [Sat, 18 Jun 2016 20:17:51 +0000 (22:17 +0200)]
Document the except option to mangle
Added documentation for the `except` option to the `mangle` option in the API reference.
Shrey Banga [Thu, 5 May 2016 20:44:59 +0000 (13:44 -0700)]
Respect quote style in object literals
The option added in
fbbaa42ee55a7f753f7cab9b1a905ccf73cf26d5 wasn't
being respected inside object literals, so quoted property names would
still be stripped out with this option.
This is mostly a corner-case, but useful when the output is passed to
something like the Closure compiler, where quoted property names can be
used to prevent mangling.
Anthony Van de Gejuchte [Sat, 18 Jun 2016 15:28:22 +0000 (17:28 +0200)]
Normalize error messages
Anthony Van de Gejuchte [Mon, 13 Jun 2016 19:11:08 +0000 (21:11 +0200)]
Don't mix strings with directives in output
* Don't interpret strings with escaped content as directive
* Don't interpret strings after empty statement as directive
* Adapt output to prevent strings being represent as directive
* Introduce UGLIFY_DEBUG to allow internal testing like EXPECT_DIRECTIVE
Anthony Van de Gejuchte [Mon, 13 Jun 2016 16:19:06 +0000 (18:19 +0200)]
Fix test262 failures related to <, <=, in and instanceof
Fixed-by: @kzc
Anthony Van de Gejuchte [Sun, 12 Jun 2016 15:34:05 +0000 (17:34 +0200)]
Re-add parens after new expression in beautify mode
Anthony Van de Gejuchte [Sun, 12 Jun 2016 16:58:20 +0000 (18:58 +0200)]
Don't allow with statements in strict mode
Anthony Van de Gejuchte [Fri, 10 Jun 2016 13:42:55 +0000 (15:42 +0200)]
Stop dropping args in new expressions
Richard van Velzen [Sun, 12 Jun 2016 12:35:43 +0000 (14:35 +0200)]
Fix octal string strict mode tests
David Bau [Mon, 23 Dec 2013 16:05:04 +0000 (16:05 +0000)]
Escape null characters as \0 unless followed by 0-7.
Anthony Van de Gejuchte [Thu, 9 Jun 2016 22:34:20 +0000 (00:34 +0200)]
Don't drop unused if scope uses with statement
Fix provided by @kzc
Anthony Van de Gejuchte [Fri, 20 May 2016 08:25:35 +0000 (10:25 +0200)]
Throw errors in strict mode for octal strings
Adds a directive tracker for the parser/tokenizer to
allow parsing depending on directive context.
Anthony Van de Gejuchte [Wed, 8 Jun 2016 18:11:32 +0000 (20:11 +0200)]
Catch errors when compression test fails to parse
Anthony Van de Gejuchte [Mon, 6 Jun 2016 23:33:13 +0000 (01:33 +0200)]
Fix uglify attempting to rewrite invalid new expressions
ChALkeR [Tue, 7 Jun 2016 09:25:16 +0000 (12:25 +0300)]
Export tokenizer function
In uglify-js@1, both parser and tokenizer methods were exported
This allows to use tokenizer() separately, e.g. to wrap or override it, as
parse() method accepts not only text, but also tokenized functions.
Anthony Van de Gejuchte [Sun, 5 Jun 2016 00:44:59 +0000 (02:44 +0200)]
Do not allow newlines in regex
kzc [Thu, 26 May 2016 18:47:16 +0000 (14:47 -0400)]
collapse_vars: Do not consider RegExp literals to be constants
Fixes #1100
kzc [Sun, 22 May 2016 15:35:41 +0000 (11:35 -0400)]
Optimize if_return for single if/return cases.
Fixes #1089
Richard van Velzen [Wed, 18 May 2016 16:49:55 +0000 (18:49 +0200)]
Completely allow evaluating -0
Richard van Velzen [Tue, 17 May 2016 20:34:38 +0000 (22:34 +0200)]
Never produce -0 when evaluating expressions (like -"")
Fix for #1085. The major case was already there, but more expressions can result in -0.
kzc [Sun, 15 May 2016 23:12:17 +0000 (19:12 -0400)]
Simplify iife `new` fix
as suggested by @rvanvelzen.
Added a test for IIFEs in nested contexts.
kzc [Mon, 9 May 2016 07:19:28 +0000 (03:19 -0400)]
Do not apply negate_iife optimization to `new` expression
kzc [Tue, 3 May 2016 19:08:40 +0000 (15:08 -0400)]
Retain comments before AST_Constants during mangle.
Anthony Van de Gejuchte [Tue, 3 May 2016 15:41:40 +0000 (17:41 +0200)]
Fix regression causing tests to fail on windows
kzc [Sun, 1 May 2016 04:59:29 +0000 (00:59 -0400)]
Workaround for process.exit() tty output truncation.
Fixes #1055
Anthony Van de Gejuchte [Tue, 26 Apr 2016 17:20:37 +0000 (19:20 +0200)]
Add node 6 to travis
kzc [Mon, 25 Apr 2016 04:42:18 +0000 (00:42 -0400)]
Handle CR line endings in comments.
Fixes #1050
Mihai Bazon [Tue, 26 Apr 2016 19:09:52 +0000 (22:09 +0300)]
Merge pull request #1053 from rvanvelzen/hoist_if_return_funs
Hoist functions when reversing if (x) return; ... vs. if (!x) ...
Richard van Velzen [Tue, 26 Apr 2016 09:49:55 +0000 (11:49 +0200)]
Add test cases for slightly more esoteric cases
Richard van Velzen [Tue, 26 Apr 2016 09:43:03 +0000 (11:43 +0200)]
Add test case for hoisting a single function
Richard van Velzen [Sat, 23 Apr 2016 21:48:33 +0000 (23:48 +0200)]
Hoist functions when reversing if (x) return; ... vs. if (!x) ...
Fixes #1052
kzc [Tue, 12 Apr 2016 13:19:38 +0000 (09:19 -0400)]
Add `passes` compress option. Fix duplicate compress warnings.
kzc [Fri, 15 Apr 2016 23:58:46 +0000 (19:58 -0400)]
Parse comments without recursion to avoid RangeError.
Fixes #993
Richard van Velzen [Tue, 12 Apr 2016 18:30:44 +0000 (20:30 +0200)]
Prevent endless recursion when evaluating self-referencing consts
Fix #1041
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.
Mihai Bazon [Tue, 12 Apr 2016 11:15:14 +0000 (14:15 +0300)]
Actually limit sequence length.
Fix #1038
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.
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.
kzc [Thu, 7 Apr 2016 13:57:30 +0000 (09:57 -0400)]
Simplify member(name, array) implementation.
Mihai Bazon [Thu, 7 Apr 2016 10:15:28 +0000 (13:15 +0300)]
Avoid using inherited hasOwnProperty
Fix #1031
kzc [Sat, 2 Apr 2016 04:21:13 +0000 (00:21 -0400)]
Optimize ternaries with boolean consequent or alternative.
Fixes #511
kzc [Mon, 28 Mar 2016 21:58:50 +0000 (17:58 -0400)]
Speedup `unused` compress option for already minified code
Fixes: #321 #917 #1022
Sebastien Daniel [Fri, 4 Mar 2016 12:32:24 +0000 (07:32 -0500)]
added documentation on conditional compilation using API
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.
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
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.
kzc [Tue, 15 Mar 2016 15:44:09 +0000 (11:44 -0400)]
Attempt to increase timeout for mocha let test.
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.
philippsimon [Mon, 14 Mar 2016 11:21:25 +0000 (12:21 +0100)]
Fix: Uglified Number.prototype functions on big numbers
kzc [Sat, 27 Feb 2016 20:33:10 +0000 (15:33 -0500)]
#877 Ignore mangle sort option
Mihai Bazon [Mon, 22 Feb 2016 19:39:14 +0000 (21:39 +0200)]
v2.6.2
kzc [Sun, 21 Feb 2016 23:47:21 +0000 (18:47 -0500)]
boolean_expression ? true : false --> boolean_expression
kzc [Sun, 21 Feb 2016 17:05:02 +0000 (12:05 -0500)]
Take operator || precendence into account for AST_If optimization.
Fixes #979.
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
alexlamsl [Tue, 16 Feb 2016 18:52:28 +0000 (02:52 +0800)]
preserve ThisBinding for side_effects
Richard van Velzen [Tue, 16 Feb 2016 18:00:48 +0000 (19:00 +0100)]
Don't compress (0, eval)() to eval()
alexlamsl [Tue, 16 Feb 2016 10:15:59 +0000 (18:15 +0800)]
Preserve ThisBinding in conditionals & collapse_vars
Fixes #973
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
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.
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`
Martii [Sat, 6 Feb 2016 19:46:18 +0000 (12:46 -0700)]
Create and map `bare-returns` into new `parse` property name
Boris Letocha [Sun, 31 Jan 2016 20:41:38 +0000 (21:41 +0100)]
Fixes #951 missing export for SymbolDef
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
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.
kzc [Thu, 28 Jan 2016 17:17:06 +0000 (12:17 -0500)]
collapse_vars: fix if/else and ternary operator side effects
kzc [Thu, 28 Jan 2016 16:04:30 +0000 (11:04 -0500)]
collapse_vars: small change to README
kzc [Thu, 28 Jan 2016 16:01:17 +0000 (11:01 -0500)]
collapse_vars: document option in README
kzc [Wed, 27 Jan 2016 23:35:49 +0000 (18:35 -0500)]
collapse_vars: fix bug in repeated var defs of same name
Bryan Rayner [Wed, 27 Jan 2016 20:24:32 +0000 (14:24 -0600)]
Add mangleProperties documentation to README
Add additional documentation to mangleProperties.
kzc [Wed, 27 Jan 2016 19:18:46 +0000 (14:18 -0500)]
fix bug in collapse_vars for right side of "||" and "&&"
kzc [Wed, 27 Jan 2016 07:17:06 +0000 (02:17 -0500)]
Collapse single use var definitions
Fix #721
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)
Jeremy Marzka [Mon, 18 Jan 2016 02:54:09 +0000 (21:54 -0500)]
Added a mangle properties option
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.
Samuel Reed [Wed, 20 Jan 2016 17:35:45 +0000 (11:35 -0600)]
Tighten up @const regex.
Samuel Reed [Wed, 20 Jan 2016 17:03:41 +0000 (11:03 -0600)]
Simplify by skipping extra tree walk.
Samuel Reed [Wed, 20 Jan 2016 16:52:48 +0000 (10:52 -0600)]
Use TreeWalker for more accurate @const results and update tests
Samuel Reed [Tue, 19 Jan 2016 19:24:36 +0000 (13:24 -0600)]
Update README for /** @const */
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.
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
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`
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.
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
Anthony Van de Gejuchte [Thu, 14 Jan 2016 23:04:05 +0000 (00:04 +0100)]
Make arguments test slightly more strict
Anthony Van de Gejuchte [Thu, 14 Jan 2016 21:32:46 +0000 (22:32 +0100)]
Add scope test for arguments