UglifyJS.git
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

8 years agohave minify() call figure_out_scope() if needed to produce well formed "use asm"...
kzc [Wed, 7 Oct 2015 20:31:57 +0000 (16:31 -0400)]
have minify() call figure_out_scope() if needed to produce well formed "use asm" code

8 years agoget rid of SCOPE_IS_NEEDED as it was always true
kzc [Wed, 7 Oct 2015 19:33:24 +0000 (15:33 -0400)]
get rid of SCOPE_IS_NEEDED as it was always true

8 years agoFix handling of "use asm" when no command line flags are passed to uglifyjs. SCOPE_IS...
kzc [Wed, 7 Oct 2015 17:10:53 +0000 (13:10 -0400)]
Fix handling of "use asm" when no command line flags are passed to uglifyjs. SCOPE_IS_NEEDED is unconditionally true now. Refactored floating point literal parsing to be more in keeping with the AST class design.

8 years agoPin dependencies with npm shrinkwrap
SpainTrain [Thu, 24 Sep 2015 20:24:50 +0000 (16:24 -0400)]
Pin dependencies with npm shrinkwrap

* Use `npm run shrinkwrap` to create a shrinkwrap file with all dependencies pinned
* Update dependency `source-map` to latest (Closes #738)

8 years agoadd asm.js test
kzc [Tue, 6 Oct 2015 21:05:36 +0000 (17:05 -0400)]
add asm.js test

8 years agoAdd proper support for "use asm"; blocks. Disable -c optimization within "use asm...
kzc [Mon, 5 Oct 2015 23:51:09 +0000 (19:51 -0400)]
Add proper support for "use asm"; blocks. Disable -c optimization within "use asm"; sections and preserve floating point literals in their original form. Non-asm.js sections are optimized as before. Asm.js sections can still be mangled and minified of whitespace. No special command line flags are required.

8 years agoImplement shebang support
Anthony Van de Gejuchte [Fri, 20 Feb 2015 15:08:01 +0000 (16:08 +0100)]
Implement shebang support

8 years agoMerge pull request #808 from avdg/travis
Mihai Bazon [Thu, 24 Sep 2015 16:27:54 +0000 (19:27 +0300)]
Merge pull request #808 from avdg/travis

Add node 4.x in Travis

8 years agoAdd node 4.x in Travis
Anthony Van de Gejuchte [Thu, 24 Sep 2015 15:41:52 +0000 (17:41 +0200)]
Add node 4.x in Travis

8 years agoDisable node 0.8 in Travis
Mihai Bazon [Thu, 24 Sep 2015 15:26:23 +0000 (18:26 +0300)]
Disable node 0.8 in Travis

8 years agoFix mozilla-ast after module loading changes
Mihai Bazon [Thu, 24 Sep 2015 15:12:06 +0000 (18:12 +0300)]
Fix mozilla-ast after module loading changes

Need to explicitly qualify stuff now, since it's not evaluated in some
global scope.

Ref #636

8 years agoNo longer use `vm` to load code.
Mihai Bazon [Thu, 24 Sep 2015 14:57:47 +0000 (17:57 +0300)]
No longer use `vm` to load code.

Improves performance 2x on node > 0.10.

Ref #636

8 years agoFix wrap_commonjs to include code first
Mihai Bazon [Thu, 24 Sep 2015 14:55:37 +0000 (17:55 +0300)]
Fix wrap_commonjs to include code first

(code could have directives, i.e. "use strict")

9 years agouse a valid SPDX license identifier
Kyle Mitchell [Mon, 4 May 2015 23:33:09 +0000 (23:33 +0000)]
use a valid SPDX license identifier

9 years agoControl keeping function arguments with a single option
Ville Lautanala [Fri, 22 May 2015 22:46:08 +0000 (01:46 +0300)]
Control keeping function arguments with a single option

9 years agoMerge pull request #786 from istr/anonymous-source-map
Richard van Velzen [Sun, 6 Sep 2015 15:06:14 +0000 (17:06 +0200)]
Merge pull request #786 from istr/anonymous-source-map

Allow for anonymous map generation using string type check

9 years agoallow for anonymous map generation using string type check
Ingo Struck [Thu, 27 Aug 2015 17:38:33 +0000 (19:38 +0200)]
allow for anonymous map generation using string type check

9 years agoFix bad parsing of `new new x()()` constructs
Richard van Velzen [Thu, 6 Aug 2015 19:27:46 +0000 (21:27 +0200)]
Fix bad parsing of `new new x()()` constructs

Fixes #739

9 years agoDon't change sequences that influence lexical binding in calls
Richard van Velzen [Tue, 25 Aug 2015 08:53:35 +0000 (10:53 +0200)]
Don't change sequences that influence lexical binding in calls

Fixes #782

9 years agoMerge pull request #767 from vjeux/208
Richard van Velzen [Mon, 10 Aug 2015 18:29:37 +0000 (20:29 +0200)]
Merge pull request #767 from vjeux/208

[Fix] --define replaces SymbolRefs in LHS of assignments

9 years ago[Fix] --define replaces SymbolRefs in LHS of assignments
Christopher Chedeau [Mon, 10 Aug 2015 18:22:36 +0000 (11:22 -0700)]
[Fix] --define replaces SymbolRefs in LHS of assignments

See #208 for context

9 years agoMerge pull request #736 from AlbertoGP/master
Richard van Velzen [Fri, 7 Aug 2015 12:12:41 +0000 (14:12 +0200)]
Merge pull request #736 from AlbertoGP/master

fromString option, use index from argument array for filename instead of "?"

9 years agoMerge pull request #729 from DrewML/keep_fnames_docs
Richard van Velzen [Fri, 7 Aug 2015 12:11:50 +0000 (14:11 +0200)]
Merge pull request #729 from DrewML/keep_fnames_docs

Add keep_fnames compressor option to README.md

9 years agoFix mangling of property names which overwrite unmangleable properties
Richard van Velzen [Fri, 31 Jul 2015 13:56:33 +0000 (15:56 +0200)]
Fix mangling of property names which overwrite unmangleable properties

Fixes #747.

9 years agoMerge pull request #753 from Surgo/master
Richard van Velzen [Wed, 5 Aug 2015 19:17:42 +0000 (21:17 +0200)]
Merge pull request #753 from Surgo/master

Support wrap and exportAll options for node.js tools.

9 years agoMerge pull request #757 from rvanvelzen/semicolon-fix
Mihai Bazon [Thu, 30 Jul 2015 14:25:13 +0000 (17:25 +0300)]
Merge pull request #757 from rvanvelzen/semicolon-fix

Fix semicolon printing when restricting max line length

9 years agoFix semicolon printing when restricting max line length
Richard van Velzen [Wed, 29 Jul 2015 15:57:18 +0000 (17:57 +0200)]
Fix semicolon printing when restricting max line length

Fixes #755

9 years agoRevert "Fix semicolon printing when restricting max line length"
Richard van Velzen [Thu, 30 Jul 2015 13:57:18 +0000 (15:57 +0200)]
Revert "Fix semicolon printing when restricting max line length"

This reverts commit 170e8b519e64463a39d293480e52f97b64d8ab89.

9 years agoFix semicolon printing when restricting max line length
Richard van Velzen [Wed, 29 Jul 2015 15:57:18 +0000 (17:57 +0200)]
Fix semicolon printing when restricting max line length

Fixes #755

9 years agoReplace util.puts in run-tests with console.log
Richard van Velzen [Wed, 29 Jul 2015 13:24:45 +0000 (15:24 +0200)]
Replace util.puts in run-tests with console.log

See d2dda34b2a8de310f26a26e58ed28275ba5ecc7f

9 years agoMake node.js 0.8 the minimum supported version.
XhmikosR [Tue, 14 Apr 2015 20:17:41 +0000 (23:17 +0300)]
Make node.js 0.8 the minimum supported version.

Node.js 0.4 and 0.6 are ancient; things don't work there.
Update Travis CI configuration accordingly.

Note, that the npm update in Travis is needed for 0.8 only at the moment.

9 years agoRe-use the caught exception's error message in the parse error call.
Chris Cowan [Thu, 14 May 2015 19:27:56 +0000 (12:27 -0700)]
Re-use the caught exception's error message in the parse error call.

9 years agoGive a good error message if an invalid regular expression is found.
Chris Cowan [Thu, 14 May 2015 19:03:54 +0000 (12:03 -0700)]
Give a good error message if an invalid regular expression is found.

9 years agoAdvanced way to specify if a function call might have side effects. #400
thorn0 [Sat, 18 Jan 2014 13:16:43 +0000 (15:16 +0200)]
Advanced way to specify if a function call might have side effects. #400

9 years agoSupport wrap and exportAll options.
Kosei Kitahara [Tue, 28 Jul 2015 12:36:22 +0000 (21:36 +0900)]
Support wrap and exportAll options.

9 years agov2.4.24
Mihai Bazon [Wed, 22 Jul 2015 13:58:09 +0000 (16:58 +0300)]
v2.4.24

9 years agoDon't attempt to negate non-boolean AST_Binary
Mihai Bazon [Wed, 22 Jul 2015 13:53:25 +0000 (16:53 +0300)]
Don't attempt to negate non-boolean AST_Binary

Fix #751

9 years agoMerge pull request #735 from kzc/master
Mihai Bazon [Mon, 20 Jul 2015 06:58:01 +0000 (09:58 +0300)]
Merge pull request #735 from kzc/master

optimizations for && and || where left side is constant expression

9 years agoDon't drop parens in a * (b * c). Close #744
Mihai Bazon [Tue, 30 Jun 2015 07:07:13 +0000 (10:07 +0300)]
Don't drop parens in a * (b * c).  Close #744

9 years agofromString option, use index from argument array for filename instead of "?"
Alberto González Palomo [Mon, 15 Jun 2015 16:03:06 +0000 (18:03 +0200)]
fromString option, use index from argument array for filename instead of "?"

The index allows the caller to map things like parse errors back to the
code chunk where they appeared.

9 years agospacing
kzc [Sun, 14 Jun 2015 21:45:19 +0000 (17:45 -0400)]
spacing

9 years agooperator && and || optimization: add "else" before "if" as intended
kzc [Sun, 14 Jun 2015 21:44:26 +0000 (17:44 -0400)]
operator && and || optimization: add "else" before "if" as intended

9 years agooptimizations for && and || where left side is constant expression
kzc [Fri, 12 Jun 2015 03:22:38 +0000 (23:22 -0400)]
optimizations for && and || where left side is constant expression

9 years agoMerge pull request #733 from jcxplorer/add-mangle-regex-option
Mihai Bazon [Tue, 9 Jun 2015 13:33:21 +0000 (16:33 +0300)]
Merge pull request #733 from jcxplorer/add-mangle-regex-option

Add --mangle-regex option

9 years agoChange --mangle-regex to accept a full regex
Joao Carlos [Tue, 9 Jun 2015 12:14:41 +0000 (15:14 +0300)]
Change --mangle-regex to accept a full regex

9 years agoShow descriptive error when --mangle-regex is invalid
Joao Carlos [Tue, 9 Jun 2015 11:31:49 +0000 (14:31 +0300)]
Show descriptive error when --mangle-regex is invalid

9 years agoAdd --mangle-regex option
Joao Carlos [Tue, 9 Jun 2015 10:21:22 +0000 (13:21 +0300)]
Add --mangle-regex option

9 years agoAdd keep_fnames compressor option to README.md
Andrew Levine [Tue, 2 Jun 2015 20:32:10 +0000 (15:32 -0500)]
Add keep_fnames compressor option to README.md

9 years agov2.4.23
Mihai Bazon [Wed, 20 May 2015 14:48:30 +0000 (17:48 +0300)]
v2.4.23

9 years agoTreat \uFEFF as whitespace.
Mihai Bazon [Wed, 20 May 2015 13:17:46 +0000 (16:17 +0300)]
Treat \uFEFF as whitespace.

Fix #714

9 years agov2.4.22
Mihai Bazon [Mon, 18 May 2015 10:58:25 +0000 (13:58 +0300)]
v2.4.22

9 years agoFix compressing conditionals
Mihai Bazon [Mon, 18 May 2015 10:56:04 +0000 (13:56 +0300)]
Fix compressing conditionals

Only transform foo() ? EXP(x) : EXP(y) into EXP(foo() ? x : y) if EXP has no
side effects.

Fix #710

9 years agofix again reserved props
Mihai Bazon [Wed, 13 May 2015 19:03:00 +0000 (22:03 +0300)]
fix again reserved props

9 years agoMake reserved names take priority over the name cache
Mihai Bazon [Thu, 7 May 2015 12:01:16 +0000 (15:01 +0300)]
Make reserved names take priority over the name cache

9 years agoOnly drop the BOM when it's the first character.
Mihai Bazon [Tue, 5 May 2015 07:11:38 +0000 (10:11 +0300)]
Only drop the BOM when it's the first character.

Close #704

9 years agov2.4.21
Mihai Bazon [Mon, 4 May 2015 16:14:42 +0000 (19:14 +0300)]
v2.4.21

9 years agoFix blank lines in the output.
Mihai Bazon [Mon, 4 May 2015 14:55:42 +0000 (17:55 +0300)]
Fix blank lines in the output.

The issue was more obvious when max_line_len has a small value, rather than
the default 32K characters.  A blank line showed up after most statements.

9 years agoRemove deprecated calls to utils.print/utils.error
Mihai Bazon [Mon, 4 May 2015 12:07:16 +0000 (15:07 +0300)]
Remove deprecated calls to utils.print/utils.error

Close #542, #641, #647

9 years agoAvoid spurious brackets when dropping unused vars
Mihai Bazon [Mon, 4 May 2015 11:49:17 +0000 (14:49 +0300)]
Avoid spurious brackets when dropping unused vars

Fix #702

9 years agoFix parsing strings with literal DOS newlines
Mihai Bazon [Thu, 23 Apr 2015 09:08:19 +0000 (12:08 +0300)]
Fix parsing strings with literal DOS newlines

(should not set newline_before)

Fix #693

9 years agoIf name_cache is specified, do rename cached properties
Mihai Bazon [Wed, 22 Apr 2015 14:34:49 +0000 (17:34 +0300)]
If name_cache is specified, do rename cached properties

(even if --mangle-props is not there)

9 years agoFix tests
Mihai Bazon [Fri, 17 Apr 2015 08:28:59 +0000 (11:28 +0300)]
Fix tests

9 years agoDrop NaN -> 0/0 transformation.
Mihai Bazon [Fri, 17 Apr 2015 08:25:19 +0000 (11:25 +0300)]
Drop NaN -> 0/0 transformation.

Fix #687

9 years agoAdded expect_exact for testing the OutputStream
Fábio Santos [Sun, 12 Apr 2015 13:51:26 +0000 (14:51 +0100)]
Added expect_exact for testing the OutputStream

This works almost exactly like `expect`, except that you pass a literal string
of which the result is compared with the generated output.

9 years agoNormalize package.json.
XhmikosR [Tue, 14 Apr 2015 15:29:14 +0000 (18:29 +0300)]
Normalize package.json.

* Specify the files to install in package.json
* Add missing properties
* Follow `npm init`'s scheme

9 years agoTest on latest `node` and `io.js`
Jordan Harband [Sat, 11 Apr 2015 22:35:18 +0000 (15:35 -0700)]
Test on latest `node` and `io.js`

Per https://github.com/mishoo/UglifyJS2/commit/0262b4244c13b3ef148bf096874847aea84b93e5 - if you're going to stop testing on 0.8, you should be testing on 0.12.

Also allow failures on unstable nodes and "older than two latest" `io.js` versions, and enable "sudo: false" which makes tests run faster.

9 years agov2.4.20
Mihai Bazon [Mon, 13 Apr 2015 15:59:21 +0000 (18:59 +0300)]
v2.4.20

9 years agoFix compression of conditionals
Mihai Bazon [Mon, 13 Apr 2015 14:29:48 +0000 (17:29 +0300)]
Fix compression of conditionals

Don't move the condition on the right side of an assignment when
the left side may have side effects.

Fix #677

9 years agoUse the `before` visitor in mangle props
Mihai Bazon [Fri, 10 Apr 2015 08:33:29 +0000 (11:33 +0300)]
Use the `before` visitor in mangle props

(works around a bug in our tree walker which, while cloning nodes, breaks
references between labeled statements and break/continue labels)

9 years agoMore fixes for the breaking changes in yargs
Mihai Bazon [Sun, 5 Apr 2015 10:19:46 +0000 (13:19 +0300)]
More fixes for the breaking changes in yargs

Close #670

9 years agoMerge pull request #669 from galvanix/documentation-inSourceMap
Mihai Bazon [Sat, 4 Apr 2015 12:29:03 +0000 (15:29 +0300)]
Merge pull request #669 from galvanix/documentation-inSourceMap

Document passing source maps directly to minify() using inSourceMap

9 years agoDocument passing source maps directly to minify() using inSourceMap
David Caldwell [Sat, 4 Apr 2015 00:27:28 +0000 (17:27 -0700)]
Document passing source maps directly to minify() using inSourceMap

9 years agov2.4.19
Mihai Bazon [Sun, 29 Mar 2015 11:02:37 +0000 (14:02 +0300)]
v2.4.19

9 years agoMerge pull request #660 from ntkme/fix-long-options
Mihai Bazon [Sun, 29 Mar 2015 11:01:21 +0000 (14:01 +0300)]
Merge pull request #660 from ntkme/fix-long-options

Fix long options

9 years agoFix long options
ãªã¤ã [Sun, 29 Mar 2015 10:50:00 +0000 (03:50 -0700)]
Fix long options

9 years agoDisable testing with Node 0.8
Mihai Bazon [Sun, 29 Mar 2015 10:19:07 +0000 (13:19 +0300)]
Disable testing with Node 0.8

9 years agov2.4.18
Mihai Bazon [Sun, 29 Mar 2015 10:15:27 +0000 (13:15 +0300)]
v2.4.18

9 years agoUpdate README
Mihai Bazon [Sun, 29 Mar 2015 10:13:40 +0000 (13:13 +0300)]
Update README

9 years agoMerge branch 'propmangle'
Mihai Bazon [Sun, 29 Mar 2015 09:50:43 +0000 (12:50 +0300)]
Merge branch 'propmangle'

9 years agoAdd tool to extract property names
Mihai Bazon [Sun, 29 Mar 2015 09:38:06 +0000 (12:38 +0300)]
Add tool to extract property names

9 years agoMerge in more DOM properties.
Mihai Bazon [Tue, 24 Mar 2015 11:59:57 +0000 (13:59 +0200)]
Merge in more DOM properties.

9 years agoFix compressing `![foo()];` as a statement
Mihai Bazon [Mon, 23 Mar 2015 21:27:00 +0000 (23:27 +0200)]
Fix compressing `![foo()];` as a statement

need to check whether the literal has any side effects before replacing that
with `false`.

9 years ago[sequencesize] Actually even better:
Mihai Bazon [Sun, 22 Mar 2015 11:01:42 +0000 (13:01 +0200)]
[sequencesize] Actually even better:

do create the sequence even if the stat list is bigger than 2000 statements,
but limit the sequence itself to 2000 expressions.

Ref #414

9 years agoAvoid sequencesize for more than 2000 statements.
Mihai Bazon [Sun, 22 Mar 2015 10:51:15 +0000 (12:51 +0200)]
Avoid sequencesize for more than 2000 statements.

It hardly saves any bytes for a sequence so long, and it risks blowing the
stack with the recursive Seq functions.

Ref #414

9 years agoAdd start/end nodes for NaN/Infinity transformations
Mihai Bazon [Sun, 22 Mar 2015 10:50:36 +0000 (12:50 +0200)]
Add start/end nodes for NaN/Infinity transformations

9 years agoExport readDefaultReservedFile
Mihai Bazon [Sun, 22 Mar 2015 09:04:28 +0000 (11:04 +0200)]
Export readDefaultReservedFile

9 years agoKeep unused function arguments by default
Mihai Bazon [Fri, 20 Mar 2015 08:28:51 +0000 (10:28 +0200)]
Keep unused function arguments by default

Discarding unused function arguments affects function.length, which can lead
to some hard to debug issues.  This optimization is now done only in "unsafe
mode".

Fix #121

9 years agoDon't use Object.create
Mihai Bazon [Thu, 19 Mar 2015 10:54:43 +0000 (12:54 +0200)]
Don't use Object.create

9 years agotools/props.html: output complete JSON
Mihai Bazon [Thu, 19 Mar 2015 08:10:01 +0000 (10:10 +0200)]
tools/props.html: output complete JSON

9 years agoAdd --reserve-domprops along with a default exclusion list in tools/domprops.json
Mihai Bazon [Wed, 18 Mar 2015 10:09:09 +0000 (12:09 +0200)]
Add --reserve-domprops along with a default exclusion list in tools/domprops.json

9 years agoSupport multiple --reserved-file args
Mihai Bazon [Wed, 18 Mar 2015 09:53:17 +0000 (11:53 +0200)]
Support multiple --reserved-file args