UglifyJS.git
10 years agoindentation
Mihai Bazon [Wed, 30 Oct 2013 08:44:50 +0000 (10:44 +0200)]
indentation

10 years agoFix output for `x = 2 * (a % b / b * c)`
Mihai Bazon [Wed, 30 Oct 2013 07:11:55 +0000 (09:11 +0200)]
Fix output for `x = 2 * (a % b / b * c)`

(issue #337)

10 years agominor
Mihai Bazon [Wed, 30 Oct 2013 07:10:56 +0000 (09:10 +0200)]
minor

10 years agoDisallow reversal where lhs has higher or equal precedence
Richard van Velzen [Tue, 29 Oct 2013 20:37:36 +0000 (21:37 +0100)]
Disallow reversal where lhs has higher or equal precedence

Fixes #267

10 years agoFix typo
Mihai Bazon [Tue, 29 Oct 2013 13:53:54 +0000 (15:53 +0200)]
Fix typo

10 years agoFix reading arguments
Mihai Bazon [Tue, 29 Oct 2013 12:01:26 +0000 (14:01 +0200)]
Fix reading arguments

i.e. read `-c unsafe,unsafe-comps` as `-c unsafe=true,unsafe_comps=true`

10 years agoAvoid shadowing name of function expression with function argument
Mihai Bazon [Tue, 29 Oct 2013 11:18:09 +0000 (13:18 +0200)]
Avoid shadowing name of function expression with function argument

Close #179, #326, #327

10 years agoAdd "preamble" output option
Mihai Bazon [Tue, 29 Oct 2013 08:43:43 +0000 (10:43 +0200)]
Add "preamble" output option

Close #335

10 years agoFix codegen for when comments_before is undefined.
Mihai Bazon [Mon, 28 Oct 2013 07:39:29 +0000 (09:39 +0200)]
Fix codegen for when comments_before is undefined.

Fix #333

10 years agoMerge branch 'master' of github.com:mishoo/UglifyJS2
Mihai Bazon [Sun, 27 Oct 2013 08:03:01 +0000 (10:03 +0200)]
Merge branch 'master' of github.com:mishoo/UglifyJS2

10 years agoDisplay number of failed tests and corresponding files
Mihai Bazon [Sun, 27 Oct 2013 08:02:44 +0000 (10:02 +0200)]
Display number of failed tests and corresponding files

10 years agoMerge pull request #330 from markjaquith/master
Mihai Bazon [Sun, 27 Oct 2013 08:01:57 +0000 (01:01 -0700)]
Merge pull request #330 from markjaquith/master

Unit test to detect issue in 8d14efe for #126 that causes aggressive parenthesis removal, functional differences

10 years agoMerge pull request #331 from rvanvelzen/rhs-strings-fix
Mihai Bazon [Sun, 27 Oct 2013 08:01:11 +0000 (01:01 -0700)]
Merge pull request #331 from rvanvelzen/rhs-strings-fix

Fix RHS concat (raised in #330)

10 years agoFix RHS concat (raised in #330)
Richard van Velzen [Sat, 26 Oct 2013 16:44:52 +0000 (18:44 +0200)]
Fix RHS concat (raised in #330)

When attempting to concat the left-side of the rhs, make sure the rhs is
a string.

10 years agoAdd a unit test for issue-126
Mark Jaquith [Fri, 25 Oct 2013 20:28:15 +0000 (16:28 -0400)]
Add a unit test for issue-126

Add a unit test to test to test for aggressive parenthesis removal that causes functional changes.

10 years agoMerge pull request #325 from rvanvelzen/fix-269
Mihai Bazon [Thu, 24 Oct 2013 09:39:07 +0000 (02:39 -0700)]
Merge pull request #325 from rvanvelzen/fix-269

Fix #269

10 years agoFix #269
Richard van Velzen [Thu, 24 Oct 2013 09:08:33 +0000 (11:08 +0200)]
Fix #269

Shorten most primitives where possible. Also optimize some edge cases.

10 years agoMerge pull request #323 from rvanvelzen/undefined-drop-vars-fix
Mihai Bazon [Wed, 23 Oct 2013 20:58:09 +0000 (13:58 -0700)]
Merge pull request #323 from rvanvelzen/undefined-drop-vars-fix

Fix #280

10 years agoFix #280
Richard van Velzen [Wed, 23 Oct 2013 20:26:04 +0000 (22:26 +0200)]
Fix #280

The `init` of the `ForStatement` is not a `BlockStatement` before it was
descended. The descend has to happen first, and *then* the actual
checks.

10 years agoMerge pull request #322 from rvanvelzen/test-exit-code-1
Mihai Bazon [Wed, 23 Oct 2013 18:37:36 +0000 (11:37 -0700)]
Merge pull request #322 from rvanvelzen/test-exit-code-1

Add an exit code to the test suite

10 years agoAdd an exit code to the test suite
Richard van Velzen [Wed, 23 Oct 2013 18:24:58 +0000 (20:24 +0200)]
Add an exit code to the test suite

By adding the exit code 1 (or any other non-zero exit code) `npm test`
will know the tests didn't perform correctly. This way it's easier to
know if pull requests are good or bad.

10 years agoRevert #3a81f60 for now
Mihai Bazon [Tue, 22 Oct 2013 18:49:33 +0000 (21:49 +0300)]
Revert #3a81f60 for now

(with it some tests break and it can generate invalid output, see issue #44)

10 years agov2.4.1
Mihai Bazon [Tue, 22 Oct 2013 18:31:01 +0000 (21:31 +0300)]
v2.4.1

10 years ago`arguments` outside of a function is an ordinary variable.
Mihai Bazon [Thu, 17 Oct 2013 15:20:33 +0000 (18:20 +0300)]
`arguments` outside of a function is an ordinary variable.

Fix #501

10 years agowrap up
Mihai Bazon [Wed, 9 Oct 2013 19:15:43 +0000 (22:15 +0300)]
wrap up

10 years agoDon't drop_unused before compression.
Mihai Bazon [Wed, 9 Oct 2013 16:15:09 +0000 (19:15 +0300)]
Don't drop_unused before compression.

Fix #280, #282

10 years agoRename clean_getters to pure_getters; add pure_funcs.
Mihai Bazon [Fri, 4 Oct 2013 10:17:25 +0000 (13:17 +0300)]
Rename clean_getters to pure_getters; add pure_funcs.

10 years agoMerge pull request #308 from meteor/fix-unicode-keys
Mihai Bazon [Fri, 4 Oct 2013 07:13:52 +0000 (00:13 -0700)]
Merge pull request #308 from meteor/fix-unicode-keys

Only allow identifier start characters at the beginning of identifiers.

10 years agoOnly allow identifier start characters at the beginning of identifiers.
David Glasser [Fri, 4 Oct 2013 00:02:19 +0000 (17:02 -0700)]
Only allow identifier start characters at the beginning of identifiers.

Without this fix, the following source:

   x = {"\u200c": 42};

would incorrectly be converted into a quoteless key. But while \u200c is allowed
to be in identifiers, it cannot be at the beginning, as per ES5.

(For example, the SockJS client library doesn't work under uglify starting with
d9ad3c7c.)

10 years agoadd `clean_getters` compressor option (default `false`)
Mihai Bazon [Wed, 2 Oct 2013 16:33:45 +0000 (19:33 +0300)]
add `clean_getters` compressor option (default `false`)

allows one to specify if `foo.bar` is considered to have side effects.

10 years agominor optimization
Mihai Bazon [Wed, 2 Oct 2013 12:31:31 +0000 (15:31 +0300)]
minor optimization

unlikely to help in hand-written code:

    (something() ? foo : bar) == foo  ==>  something()

10 years agoFix error in the output minifying `Function("return this")()`
Mihai Bazon [Mon, 30 Sep 2013 08:49:29 +0000 (11:49 +0300)]
Fix error in the output minifying `Function("return this")()`

11 years agoMore attempts to determine when addition is associative
Mihai Bazon [Sun, 22 Sep 2013 12:26:10 +0000 (15:26 +0300)]
More attempts to determine when addition is associative

Somebody hit me with bug reports on this. :)

Refs #300

11 years agoActually let's move away those monsters from the evaluate function
Mihai Bazon [Sun, 22 Sep 2013 11:54:32 +0000 (14:54 +0300)]
Actually let's move away those monsters from the evaluate function

ev() should do a single thing — evaluate constant expressions.  if that's
not possible, just return the original node.  it's not the best place for
partial evaluation there, instead doing it in the compress functions.

11 years agoMore dirty handling of [ ... ].join() in unsafe mode
Mihai Bazon [Sun, 22 Sep 2013 10:12:34 +0000 (13:12 +0300)]
More dirty handling of [ ... ].join() in unsafe mode

Close #300

11 years agoEvaluate [...].join() if possible: minor bugfix
Dan Wolff [Fri, 20 Sep 2013 04:24:25 +0000 (06:24 +0200)]
Evaluate [...].join() if possible: minor bugfix

Follow-up to 78e98d2.

11 years agoWhen `unsafe` is set, evaluate [...].join() if possible
Mihai Bazon [Thu, 19 Sep 2013 15:20:45 +0000 (18:20 +0300)]
When `unsafe` is set, evaluate [...].join() if possible

Close #298

11 years agoConcatenate strings also on the right-hand side of an expression that cannot be evalu...
Dan Wolff [Thu, 19 Sep 2013 08:58:50 +0000 (10:58 +0200)]
Concatenate strings also on the right-hand side of an expression that cannot be evaluated. Fix #126

E.g. converts:
  a+'Hello'+'World'
to
  a+'HelloWorld'

11 years agoAvoid printing <!-- in the output (HTML5 comment)
Mihai Bazon [Fri, 6 Sep 2013 07:10:45 +0000 (10:10 +0300)]
Avoid printing <!-- in the output (HTML5 comment)

11 years agoSupport HTML5 comment syntax (enabled by default!)
Mihai Bazon [Fri, 6 Sep 2013 06:54:30 +0000 (09:54 +0300)]
Support HTML5 comment syntax (enabled by default!)

See http://javascript.spec.whatwg.org/#comment-syntax
    https://github.com/mishoo/UglifyJS/issues/503
    https://github.com/marijnh/acorn/issues/62

11 years agominor
Mihai Bazon [Fri, 6 Sep 2013 06:52:56 +0000 (09:52 +0300)]
minor

11 years agoFix names.
Mihai Bazon [Mon, 2 Sep 2013 16:38:00 +0000 (19:38 +0300)]
Fix names.

11 years agoDisallow `continue` referring to a non-IterationStatement. Fix #287
Mihai Bazon [Mon, 2 Sep 2013 16:36:16 +0000 (19:36 +0300)]
Disallow `continue` referring to a non-IterationStatement.  Fix #287

Simplifies handling of labels (their definition/references can be easily
figured out at parse time, no need to do it in `figure_out_scope`).

11 years agoBetter fix for #286
Mihai Bazon [Mon, 2 Sep 2013 08:36:48 +0000 (11:36 +0300)]
Better fix for #286

11 years agoFix parsing `a.case /= 1`
Mihai Bazon [Mon, 2 Sep 2013 08:09:54 +0000 (11:09 +0300)]
Fix parsing `a.case /= 1`

Close #286

11 years agoFix parsing regexp after unary-prefix operator
Mihai Bazon [Mon, 2 Sep 2013 06:56:27 +0000 (09:56 +0300)]
Fix parsing regexp after unary-prefix operator

++/x/.y

Fix #284

11 years agoBetter reporting of parse errors
Mihai Bazon [Mon, 2 Sep 2013 06:55:34 +0000 (09:55 +0300)]
Better reporting of parse errors

11 years agov2.4.0
Mihai Bazon [Thu, 22 Aug 2013 12:06:42 +0000 (15:06 +0300)]
v2.4.0

11 years agoRemove --ie-proof from the readme.
Mihai Bazon [Thu, 22 Aug 2013 07:10:25 +0000 (10:10 +0300)]
Remove --ie-proof from the readme.

Fix #276

11 years agoMove support for `negate_iife` in the compressor, rather than code generator
Mihai Bazon [Tue, 20 Aug 2013 14:45:52 +0000 (17:45 +0300)]
Move support for `negate_iife` in the compressor, rather than code generator

(the code generator doesn't maintain enough context to know whether
the return value is important or discarded)

Fixes #272

11 years agoMerge pull request #270 from michaelficarra/GH-259
Mihai Bazon [Mon, 19 Aug 2013 07:21:08 +0000 (00:21 -0700)]
Merge pull request #270 from michaelficarra/GH-259

fixes #259: don't unnecessarily quote object properties when --screw-ie8

11 years agofixes #259: don't unnecessarily quote object properties when --screw-ie8
Michael Ficarra [Mon, 19 Aug 2013 00:45:06 +0000 (19:45 -0500)]
fixes #259: don't unnecessarily quote object properties when --screw-ie8

11 years agofix usage
Mihai Bazon [Thu, 8 Aug 2013 06:15:13 +0000 (09:15 +0300)]
fix usage

11 years agoDon't drop unused setter argument.
Mihai Bazon [Wed, 7 Aug 2013 09:04:58 +0000 (12:04 +0300)]
Don't drop unused setter argument.

Fix #257

11 years agoSupport `-p relative`. Fix #256
Mihai Bazon [Wed, 7 Aug 2013 08:43:47 +0000 (11:43 +0300)]
Support `-p relative`.  Fix #256

11 years agoAdd support for browserify
Forbes Lindesay [Thu, 1 Aug 2013 04:51:09 +0000 (05:51 +0100)]
Add support for browserify

11 years agoDon't pretend to evaluate lambdas
Mihai Bazon [Sun, 4 Aug 2013 18:44:17 +0000 (21:44 +0300)]
Don't pretend to evaluate lambdas

Fix #255

11 years agoFix #251
Mihai Bazon [Tue, 30 Jul 2013 09:16:29 +0000 (12:16 +0300)]
Fix #251

11 years agoDon't require arguments to --enclose
Mihai Bazon [Sun, 28 Jul 2013 08:11:11 +0000 (11:11 +0300)]
Don't require arguments to --enclose

11 years agoReverting "added option for dropping unused params"
Mihai Bazon [Thu, 25 Jul 2013 15:08:36 +0000 (18:08 +0300)]
Reverting "added option for dropping unused params"
Revert "added option for dropping unused params"

(turns out we already had the `unused` option for this.)

This reverts commit e54df2226f7f3887d2f850cea8caf5c0353dce00.

11 years agoadded option for dropping unused params
Dusan Bartos [Thu, 25 Jul 2013 13:32:21 +0000 (15:32 +0200)]
added option for dropping unused params

11 years agoFix output for arrays whose last element is a hole: [1,,]
David Glasser [Wed, 16 Jan 2013 19:59:19 +0000 (14:59 -0500)]
Fix output for arrays whose last element is a hole: [1,,]

1529ab96 started to do this (by considering holes to be separate from
"undefined") but it still converted
   [1,,]    (length 2, last element hole, trailing comma)
to
   [1,]     (length 1, trailing comma)

Unfortunately the test suite doesn't really make this clear: the new test here
passes with or without this patch because run-tests.js beautifys the expected
output (in "make_code"), which does the incorrect transformation! If you make
some manual change to arrays.js to make the test fail and see the INPUT and
OUTPUT, then you can see that without this fix, [1,,] -> [1,], and with this fix
it stays [1,,].

11 years agoRevert previous patch, it was no good.
Mihai Bazon [Mon, 15 Jul 2013 08:59:23 +0000 (11:59 +0300)]
Revert previous patch, it was no good.

11 years agoAdd "position" option to parser, to specify initial pos/line/col
Mihai Bazon [Mon, 15 Jul 2013 08:27:11 +0000 (11:27 +0300)]
Add "position" option to parser, to specify initial pos/line/col

(for parsing embedded scripts)

11 years agoApply transformer to AST_VarDef's name
Mihai Bazon [Sun, 14 Jul 2013 10:24:09 +0000 (13:24 +0300)]
Apply transformer to AST_VarDef's name

Fix #237

11 years agoFix typo.
Mihai Bazon [Fri, 12 Jul 2013 06:56:58 +0000 (09:56 +0300)]
Fix typo.

Close #239

11 years agoReset the base54 counters every time minify is called.
Mihai Bazon [Fri, 28 Jun 2013 07:08:13 +0000 (10:08 +0300)]
Reset the base54 counters every time minify is called.

Close #229

11 years agoDon't swap binary ops when "use asm" is in effect.
Mihai Bazon [Fri, 7 Jun 2013 09:51:23 +0000 (12:51 +0300)]
Don't swap binary ops when "use asm" is in effect.

Refs #167

11 years agoMerge pull request #220 from lautis/escape-null
Mihai Bazon [Mon, 3 Jun 2013 18:10:14 +0000 (11:10 -0700)]
Merge pull request #220 from lautis/escape-null

Escape null characters as \x00

11 years agoEscape null characters as \x00
Ville Lautanala [Mon, 3 Jun 2013 17:18:42 +0000 (20:18 +0300)]
Escape null characters as \x00

Since \0 might be mistakenly interpreted as octal if followed by a
number and using literal null is in some cases interpreted as end of
string, escape null as \x00.

11 years agov2.3.6
Mihai Bazon [Thu, 23 May 2013 20:42:32 +0000 (23:42 +0300)]
v2.3.6

11 years agoMerge pull request #213 from mattrobenolt/patch-1
Mihai Bazon [Wed, 22 May 2013 18:30:54 +0000 (11:30 -0700)]
Merge pull request #213 from mattrobenolt/patch-1

SourceMapping pragma has changed to //#

11 years agoAdd `negate_iife` option to the code generator.
Mihai Bazon [Wed, 22 May 2013 18:22:14 +0000 (21:22 +0300)]
Add `negate_iife` option to the code generator.

See discussion in a9511dfbe5c0d96d8cacb87582aa9a19737bbb98

11 years agoSet "global" on undeclared SymbolDef-s
Mihai Bazon [Wed, 22 May 2013 10:08:19 +0000 (13:08 +0300)]
Set "global" on undeclared SymbolDef-s

11 years agoThe extra /* */ isn't needed now
Matt Robenolt [Tue, 21 May 2013 14:50:21 +0000 (08:50 -0600)]
The extra /* */ isn't needed now

11 years agoSourceMapping pragma has changed to //#
Matt Robenolt [Tue, 21 May 2013 14:46:27 +0000 (08:46 -0600)]
SourceMapping pragma has changed to //#

See: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit

The spec was updated on May 16th since `//@` was causing some issues with IE.

11 years agoFix output of statement: `new function(){...};`
Mihai Bazon [Mon, 20 May 2013 05:27:37 +0000 (08:27 +0300)]
Fix output of statement: `new function(){...};`

Close #209

11 years agov2.3.5
Mihai Bazon [Sun, 19 May 2013 11:25:05 +0000 (14:25 +0300)]
v2.3.5

11 years agoFix package.json (use `repository` instead of `repositories`)
Mihai Bazon [Sun, 19 May 2013 11:24:33 +0000 (14:24 +0300)]
Fix package.json (use `repository` instead of `repositories`)

11 years agov2.3.4
Mihai Bazon [Wed, 15 May 2013 10:27:40 +0000 (13:27 +0300)]
v2.3.4

11 years agoAdd `--expr`, an option to parse a single expression (suitable for JSON)
Mihai Bazon [Wed, 15 May 2013 10:27:23 +0000 (13:27 +0300)]
Add `--expr`, an option to parse a single expression (suitable for JSON)

11 years agoOnly compress code in `new Function` if all arguments are strings.
Mihai Bazon [Tue, 14 May 2013 15:36:31 +0000 (18:36 +0300)]
Only compress code in `new Function` if all arguments are strings.

11 years agov2.3.3
Mihai Bazon [Tue, 14 May 2013 08:33:28 +0000 (11:33 +0300)]
v2.3.3

11 years agoCompress code passed to `new Function` if it's a constant.
Mihai Bazon [Tue, 14 May 2013 07:47:06 +0000 (10:47 +0300)]
Compress code passed to `new Function` if it's a constant.

Only for `--unsafe`.

Close #203

11 years agoFix a["1_1"]
Mihai Bazon [Tue, 14 May 2013 07:41:28 +0000 (10:41 +0300)]
Fix a["1_1"]

Close #204

11 years agoMerge pull request #202 from nschonni/add-travis-ci
Mihai Bazon [Fri, 10 May 2013 09:56:24 +0000 (02:56 -0700)]
Merge pull request #202 from nschonni/add-travis-ci

Add CI build for supported Node versions

11 years agov2.3.2
Mihai Bazon [Thu, 9 May 2013 05:58:55 +0000 (08:58 +0300)]
v2.3.2

11 years agoUse the negation hack rather than parens for a toplevel function expression call
Mihai Bazon [Thu, 9 May 2013 05:58:47 +0000 (08:58 +0300)]
Use the negation hack rather than parens for a toplevel function expression call

(only in !beautify mode)

11 years agoFix is_assignable
Mihai Bazon [Thu, 9 May 2013 05:44:24 +0000 (08:44 +0300)]
Fix is_assignable

(not likely to be noticed, it's only used in `strict` parse mode)

11 years agoAdd Travis build badge to README
Nick Schonning [Thu, 9 May 2013 03:48:12 +0000 (23:48 -0400)]
Add Travis build badge to README

11 years agoAdd CI build for supported Node versions
Nick Schonning [Thu, 9 May 2013 03:42:06 +0000 (23:42 -0400)]
Add CI build for supported Node versions

11 years agoadd a test for zero-length string in is_identifier_string, which is used in property...
Trey Griffith [Wed, 8 May 2013 19:29:46 +0000 (15:29 -0400)]
add a test for zero-length string in is_identifier_string, which is used in property compression. Also added a test exercising the change.

11 years agoFix property names
Mihai Bazon [Wed, 8 May 2013 19:37:48 +0000 (22:37 +0300)]
Fix property names

Close #199

11 years agov2.3.1
Mihai Bazon [Wed, 8 May 2013 13:45:36 +0000 (16:45 +0300)]
v2.3.1

11 years agoBetter fix for equality of typeof ... against "undefined"
Mihai Bazon [Wed, 8 May 2013 13:22:39 +0000 (16:22 +0300)]
Better fix for equality of typeof ... against "undefined"

11 years agoFixed typeof undefined optimization and updated related test case to
Justin Lau [Sun, 5 May 2013 12:38:32 +0000 (20:38 +0800)]
Fixed typeof undefined optimization and updated related test case to
accomodates the sort behaviour changes made in commit
mishoo/UglifyJS2@aebafad41eab48f43ed649ce8c77e8f1528b50da.
Signed-off-by: Justin Lau <justin@tclau.com>
11 years agoAdded test cases for #104.
Justin Lau [Sun, 5 May 2013 11:54:27 +0000 (19:54 +0800)]
Added test cases for #104.
Signed-off-by: Justin Lau <justin@tclau.com>
11 years agoMerge pull request #195 from kjbekkelund/typo
Mihai Bazon [Wed, 8 May 2013 12:51:52 +0000 (05:51 -0700)]
Merge pull request #195 from kjbekkelund/typo

Fix typo in bin and readme

11 years agoFixed dot properties not optimizing unicode identifiers. Signed-off-by: Justin Lau...
Justin Lau [Sun, 5 May 2013 18:45:41 +0000 (02:45 +0800)]
Fixed dot properties not optimizing unicode identifiers. Signed-off-by: Justin Lau <justin@tclau.com>

11 years agoAdded test scenario with unicode in properties name.
Justin Lau [Sun, 5 May 2013 17:26:33 +0000 (01:26 +0800)]
Added test scenario with unicode in properties name.
Signed-off-by: Justin Lau <justin@tclau.com>