UglifyJS.git
7 years agofix gzip stream in `test/benchmark.js` (#2228)
Alex Lam S.L [Tue, 11 Jul 2017 18:55:57 +0000 (02:55 +0800)]
fix gzip stream in `test/benchmark.js` (#2228)

7 years agoenhance source mapping on IIFEs (#2224)
Alex Lam S.L [Mon, 10 Jul 2017 18:34:28 +0000 (02:34 +0800)]
enhance source mapping on IIFEs (#2224)

fixes #2213

7 years agobenchmark gzipped output (#2220)
Alex Lam S.L [Sat, 8 Jul 2017 17:44:59 +0000 (01:44 +0800)]
benchmark gzipped output (#2220)

7 years agodocs: update benchmarks using node 8, add babili (#2218)
kzc [Sat, 8 Jul 2017 16:48:53 +0000 (12:48 -0400)]
docs: update benchmarks using node 8, add babili (#2218)

7 years agov3.0.24
Alex Lam S.L [Sat, 8 Jul 2017 04:53:20 +0000 (12:53 +0800)]
v3.0.24

7 years agohandle duplicate argument names in `collapse_vars` (#2215)
Alex Lam S.L [Fri, 7 Jul 2017 20:42:35 +0000 (04:42 +0800)]
handle duplicate argument names in `collapse_vars` (#2215)

7 years agoinlining of static methods & constants (#2211)
Alex Lam S.L [Thu, 6 Jul 2017 21:35:32 +0000 (05:35 +0800)]
inlining of static methods & constants (#2211)

- guard by `unsafe`
- support `Array`, `Math`, `Number`, `Object` & `String`

fixes #2207

7 years agoinline property access of object literal (#2209)
Alex Lam S.L [Thu, 6 Jul 2017 13:51:58 +0000 (21:51 +0800)]
inline property access of object literal (#2209)

- only if property value is side-effect-free
- guard by `unsafe`

fixes #2208

7 years agosuppress `collapse_vars` of `this` as call argument (#2204)
Alex Lam S.L [Wed, 5 Jul 2017 17:03:52 +0000 (01:03 +0800)]
suppress `collapse_vars` of `this` as call argument (#2204)

fixes #2203

7 years agoimprove `compress` granularity through `typeofs` (#2201)
Alex Lam S.L [Wed, 5 Jul 2017 11:20:33 +0000 (19:20 +0800)]
improve `compress` granularity through `typeofs` (#2201)

fixes #2198

7 years agominor clean-ups to `evaluate` (#2197)
Alex Lam S.L [Mon, 3 Jul 2017 10:52:39 +0000 (18:52 +0800)]
minor clean-ups to `evaluate` (#2197)

7 years agoimprove parenthesis emission (#2196)
Alex Lam S.L [Sun, 2 Jul 2017 20:17:37 +0000 (04:17 +0800)]
improve parenthesis emission (#2196)

- eliminate `throw` usages
- suppress extraneous parenthesis
  - `new function() {foo.bar()}.baz`
  - `for (function() { "foo" in bar; };;);`

7 years agoclean up `TreeWalker.pop()` (#2195)
Alex Lam S.L [Sun, 2 Jul 2017 19:23:38 +0000 (03:23 +0800)]
clean up `TreeWalker.pop()` (#2195)

Remove superfluous parameter.

7 years agorefactor `throw` usage within `compress` (#2193)
Alex Lam S.L [Sun, 2 Jul 2017 18:10:56 +0000 (02:10 +0800)]
refactor `throw` usage within `compress` (#2193)

Eliminate exceptional constructs from normal control flow.

7 years agodocument fast mangle-only minify mode (#2194)
kzc [Sun, 2 Jul 2017 17:37:04 +0000 (13:37 -0400)]
document fast mangle-only minify mode (#2194)

7 years agov3.0.23
Alex Lam S.L [Sun, 2 Jul 2017 09:24:22 +0000 (17:24 +0800)]
v3.0.23

7 years agodrop argument value after `collapse_vars` (#2190)
Alex Lam S.L [Sat, 1 Jul 2017 20:28:11 +0000 (04:28 +0800)]
drop argument value after `collapse_vars` (#2190)

7 years agoimprove `inline` efficiency (#2188)
Alex Lam S.L [Sat, 1 Jul 2017 17:05:14 +0000 (01:05 +0800)]
improve `inline` efficiency (#2188)

... by teaching `collapse_vars` some new tricks.

fixes #2187

7 years agov3.0.22
Alex Lam S.L [Fri, 30 Jun 2017 03:18:34 +0000 (11:18 +0800)]
v3.0.22

7 years agoimprove usability of name cache under `minify()` (#2176)
Alex Lam S.L [Thu, 29 Jun 2017 04:48:34 +0000 (12:48 +0800)]
improve usability of name cache under `minify()` (#2176)

fixes #2174

7 years agov3.0.21
Alex Lam S.L [Wed, 28 Jun 2017 16:49:06 +0000 (00:49 +0800)]
v3.0.21

7 years agoimprove `unsafe_Func` (#2171)
Alex Lam S.L [Tue, 27 Jun 2017 15:53:42 +0000 (23:53 +0800)]
improve `unsafe_Func` (#2171)

- minimise disturbance to `compute_char_frequency()`
- remove extraneous quotation marks

7 years agoparse `@global_defs` as expressions (#2169)
Alex Lam S.L [Tue, 27 Jun 2017 02:31:19 +0000 (10:31 +0800)]
parse `@global_defs` as expressions (#2169)

- let parser rejects non-conformant input
- eliminate need for extraneous parenthesis

7 years agov3.0.20
Alex Lam S.L [Sun, 25 Jun 2017 07:05:05 +0000 (15:05 +0800)]
v3.0.20

7 years agomore tests for #2158 (#2160)
Alex Lam S.L [Sun, 25 Jun 2017 06:21:48 +0000 (14:21 +0800)]
more tests for #2158 (#2160)

7 years agofix `cascade` & `collapse` on property access of constants (#2158)
Alex Lam S.L [Sat, 24 Jun 2017 13:30:06 +0000 (21:30 +0800)]
fix `cascade` & `collapse` on property access of constants (#2158)

7 years agorefactor `compute_char_frequency()` (#2152)
Alex Lam S.L [Fri, 23 Jun 2017 12:05:31 +0000 (20:05 +0800)]
refactor `compute_char_frequency()` (#2152)

- minimise maintenance when updating AST
- maximise code sharing between `master` & `harmony`

7 years agosynchronise `mangle.properties` for `minify()` & `test/compress` (#2151)
Alex Lam S.L [Fri, 23 Jun 2017 07:53:13 +0000 (15:53 +0800)]
synchronise `mangle.properties` for `minify()` & `test/compress` (#2151)

7 years agorefactor `Compressor.toplevel` (#2149)
Alex Lam S.L [Fri, 23 Jun 2017 05:11:40 +0000 (13:11 +0800)]
refactor `Compressor.toplevel` (#2149)

7 years agominimise `reduce_vars` cloning overhead (#2148)
Alex Lam S.L [Thu, 22 Jun 2017 22:59:53 +0000 (06:59 +0800)]
minimise `reduce_vars` cloning overhead (#2148)

7 years agofix `reduce_vars` on `this` (#2145)
Alex Lam S.L [Thu, 22 Jun 2017 20:44:57 +0000 (04:44 +0800)]
fix `reduce_vars` on `this` (#2145)

fixes #2140

7 years agofix for-in loop parsing (#2144)
Alex Lam S.L [Thu, 22 Jun 2017 20:14:30 +0000 (04:14 +0800)]
fix for-in loop parsing (#2144)

7 years agov3.0.19
Alex Lam S.L [Wed, 21 Jun 2017 19:24:22 +0000 (03:24 +0800)]
v3.0.19

7 years agoensure mangling works if catch reuses a scope variable (#2123)
Alex Lam S.L [Mon, 19 Jun 2017 18:14:05 +0000 (02:14 +0800)]
ensure mangling works if catch reuses a scope variable (#2123)

fixes #2120

7 years agov3.0.18
Alex Lam S.L [Sun, 18 Jun 2017 07:01:20 +0000 (15:01 +0800)]
v3.0.18

7 years agomake defensive copies when `inline` (#2116)
Alex Lam S.L [Sat, 17 Jun 2017 06:32:37 +0000 (14:32 +0800)]
make defensive copies when `inline` (#2116)

fixes #2114

7 years agofix loss of context in `collapse_vars` & `cascade` (#2112)
Alex Lam S.L [Fri, 16 Jun 2017 13:18:43 +0000 (21:18 +0800)]
fix loss of context in `collapse_vars` & `cascade` (#2112)

fixes #2110

7 years agoin-place `tigten_body()` (#2111)
Alex Lam S.L [Fri, 16 Jun 2017 11:19:54 +0000 (19:19 +0800)]
in-place `tigten_body()` (#2111)

By reducing copies of `AST_Node` arrays, we should be able to reduce:
- memory pressure
- potential bugs caused by multiple references in AST
- duplicated executions of `OPT()`

7 years agocorrectly determine scope of `AST_This` (#2109)
Alex Lam S.L [Fri, 16 Jun 2017 06:54:46 +0000 (14:54 +0800)]
correctly determine scope of `AST_This` (#2109)

fixes #2107

7 years agoenforce `inline` scope restriction (#2106)
Alex Lam S.L [Thu, 15 Jun 2017 19:21:38 +0000 (03:21 +0800)]
enforce `inline` scope restriction (#2106)

fixes #2105

7 years agov3.0.17
Alex Lam S.L [Thu, 15 Jun 2017 10:59:37 +0000 (18:59 +0800)]
v3.0.17

7 years agosuppress `inline` of `this` (#2103)
Alex Lam S.L [Thu, 15 Jun 2017 04:14:16 +0000 (12:14 +0800)]
suppress `inline` of `this` (#2103)

fixes #2101

7 years agoavoid intermittent test time-out failures (#2100)
Alex Lam S.L [Wed, 14 Jun 2017 20:47:57 +0000 (04:47 +0800)]
avoid intermittent test time-out failures (#2100)

7 years agocompute `uses_arguments` correctly in `figure_out_scope()` (#2099)
Alex Lam S.L [Wed, 14 Jun 2017 19:28:26 +0000 (03:28 +0800)]
compute `uses_arguments` correctly in `figure_out_scope()` (#2099)

fixes #2097

7 years agofix parsing of `expect_stdout` (#2096)
Alex Lam S.L [Wed, 14 Jun 2017 17:00:03 +0000 (01:00 +0800)]
fix parsing of `expect_stdout` (#2096)

fixes #2095

7 years agov3.0.16
Alex Lam S.L [Wed, 14 Jun 2017 08:45:09 +0000 (16:45 +0800)]
v3.0.16

7 years agoadd comment about quote_style and gzip (#2092)
kzc [Wed, 14 Jun 2017 04:23:03 +0000 (00:23 -0400)]
add comment about quote_style and gzip (#2092)

7 years agocache web assets between CI runs (#2089)
Alex Lam S.L [Wed, 14 Jun 2017 03:53:10 +0000 (11:53 +0800)]
cache web assets between CI runs (#2089)

- skip `test/jetstream.js` for `node@0.12`

7 years agofix CLI parsing of `--source-map content` (#2088)
Ziad El Khoury Hanna [Tue, 13 Jun 2017 08:30:46 +0000 (10:30 +0200)]
fix CLI parsing of `--source-map content` (#2088)

fixes #2082

7 years agoadd Node.js 8 to Travis CI (#2086)
Alex Lam S.L [Mon, 12 Jun 2017 22:21:16 +0000 (06:21 +0800)]
add Node.js 8 to Travis CI (#2086)

- explicitly terminate `test/jetstream.js` upon completion
- log verbose output from `test/benchmark.js` & `test/jetstream.js`
- remove obsolete workaround for Travis CI

7 years agoallow `expect_stdout` to specify `Error` (#2087)
Alex Lam S.L [Mon, 12 Jun 2017 20:57:26 +0000 (04:57 +0800)]
allow `expect_stdout` to specify `Error` (#2087)

7 years agofix variable accounting in `inline` (#2085)
Alex Lam S.L [Mon, 12 Jun 2017 17:40:14 +0000 (01:40 +0800)]
fix variable accounting in `inline` (#2085)

fixes #2084

7 years agosuppress false positives for-in loops (#2080)
Alex Lam S.L [Sat, 10 Jun 2017 05:55:17 +0000 (13:55 +0800)]
suppress false positives for-in loops (#2080)

fixes #2079

7 years agofix portability of `sandbox.run_code()` on Node.js 0.1x (#2078)
Alex Lam S.L [Fri, 9 Jun 2017 17:08:58 +0000 (01:08 +0800)]
fix portability of `sandbox.run_code()` on Node.js 0.1x (#2078)

7 years agofix non-string parameters (#2076)
Alex Lam S.L [Fri, 9 Jun 2017 16:11:40 +0000 (00:11 +0800)]
fix non-string parameters (#2076)

`Stream.write()` is not as versatile as `console.log()`

7 years agoreport `test/ufuzz.js` failures in `process.stderr` (#2074)
Alex Lam S.L [Fri, 9 Jun 2017 07:56:28 +0000 (15:56 +0800)]
report `test/ufuzz.js` failures in `process.stderr` (#2074)

7 years agomarshal `mangle[.properties].reserved` from non-Array values (#2072)
Alex Lam S.L [Thu, 8 Jun 2017 20:29:12 +0000 (04:29 +0800)]
marshal `mangle[.properties].reserved` from non-Array values (#2072)

7 years agofix iteration over object with inherited properties (#2068)
Alex Lam S.L [Wed, 7 Jun 2017 19:27:03 +0000 (03:27 +0800)]
fix iteration over object with inherited properties (#2068)

fixes #2055

7 years agofix `cascade` on multi-branch evaluations (#2067)
Alex Lam S.L [Wed, 7 Jun 2017 11:52:01 +0000 (19:52 +0800)]
fix `cascade` on multi-branch evaluations (#2067)

Partially reverts #2059 as this has better coverage and performance.

fixes #2062

7 years agofix CLI output corruption (#2061)
Alex Lam S.L [Tue, 6 Jun 2017 20:25:32 +0000 (04:25 +0800)]
fix CLI output corruption (#2061)

Using `console.error()` & `console.log()` result in inconsistent formatting across Node.js versions.

Avoid this issue by directly writing to `process.stderr` & `process.stdout` instead.

Miscellaneous
- prettify invalid option listing

7 years agofix `inline` handling of `AST_Call.args` (#2059)
Alex Lam S.L [Tue, 6 Jun 2017 14:55:25 +0000 (22:55 +0800)]
fix `inline` handling of `AST_Call.args` (#2059)

7 years agoimplement `test/jetstream.js --debug` (#2058)
Alex Lam S.L [Tue, 6 Jun 2017 11:28:12 +0000 (19:28 +0800)]
implement `test/jetstream.js --debug` (#2058)

7 years agoimplement function inlining (#2053)
Alex Lam S.L [Mon, 5 Jun 2017 21:49:53 +0000 (05:49 +0800)]
implement function inlining (#2053)

- empty body
- single `AST_Return`
- single `AST_SimpleStatement`
- avoid `/*#__PURE__*/`

Miscellaneous
- enhance single-use function substitution

fixes #281

7 years agoworkaround webkit parsing error (#2056)
Alex Lam S.L [Mon, 5 Jun 2017 20:06:42 +0000 (04:06 +0800)]
workaround webkit parsing error (#2056)

apply `webkit` to jetstream tests

7 years agofix `AST_Function` scope invariance (#2052)
Alex Lam S.L [Sun, 4 Jun 2017 11:27:43 +0000 (19:27 +0800)]
fix `AST_Function` scope invariance (#2052)

improve function name hack in `run_code()`

7 years agoadd tests for `AST_SymbolAccessor` (#2049)
Alex Lam S.L [Sat, 3 Jun 2017 08:08:10 +0000 (16:08 +0800)]
add tests for `AST_SymbolAccessor` (#2049)

7 years agoclean up `lib/parse.js` (#2047)
Alex Lam S.L [Sat, 3 Jun 2017 06:00:59 +0000 (14:00 +0800)]
clean up `lib/parse.js` (#2047)

- remove unused definitions
- replace `array_to_hash()`

7 years agobetter document behavior of unsafe_Func (#2043)
kzc [Fri, 2 Jun 2017 04:07:17 +0000 (00:07 -0400)]
better document behavior of unsafe_Func (#2043)

7 years agov3.0.15
Alex Lam S.L [Thu, 1 Jun 2017 10:12:38 +0000 (18:12 +0800)]
v3.0.15

7 years agofix non-identifier getter/setter name (#2041)
Alex Lam S.L [Thu, 1 Jun 2017 10:11:16 +0000 (18:11 +0800)]
fix non-identifier getter/setter name (#2041)

fixes #2040

7 years agowhitelist `unsafe` `evaluate` candidates (#2039)
Alex Lam S.L [Wed, 31 May 2017 20:33:05 +0000 (04:33 +0800)]
whitelist `unsafe` `evaluate` candidates (#2039)

- all arguments may accept constant values
- return constant value
- free of side effects
- available & identical across locales and runtime environments

7 years agoenhance `unsafe` `evaluate` (#2037)
Alex Lam S.L [Wed, 31 May 2017 16:56:28 +0000 (00:56 +0800)]
enhance `unsafe` `evaluate` (#2037)

7 years agoreformat mangle options section of README (#2036)
kzc [Wed, 31 May 2017 13:52:43 +0000 (09:52 -0400)]
reformat mangle options section of README (#2036)

7 years agov3.0.14
Alex Lam S.L [Wed, 31 May 2017 03:34:51 +0000 (11:34 +0800)]
v3.0.14

7 years agointroduce `unsafe_Func` (#2033)
Alex Lam S.L [Tue, 30 May 2017 19:38:00 +0000 (03:38 +0800)]
introduce `unsafe_Func` (#2033)

Separate flag for #203 functionality.

7 years agowiden CLI parse error code fragment displayed (#2032)
Alex Lam S.L [Tue, 30 May 2017 17:56:52 +0000 (01:56 +0800)]
widen CLI parse error code fragment displayed (#2032)

fixes #2030

7 years agov3.0.13
Alex Lam S.L [Mon, 29 May 2017 02:52:13 +0000 (10:52 +0800)]
v3.0.13

7 years agobetter fix for #512 & #2010 (#2019)
Alex Lam S.L [Mon, 29 May 2017 02:51:41 +0000 (10:51 +0800)]
better fix for #512 & #2010 (#2019)

- remove duplicated functionalities
- fix similar issue with `else`

7 years agodisplay default values in `--help options` (#2018)
Alex Lam S.L [Sun, 28 May 2017 14:57:20 +0000 (22:57 +0800)]
display default values in `--help options` (#2018)

7 years agoimplement `--help options` (#2017)
Alex Lam S.L [Sun, 28 May 2017 10:21:44 +0000 (18:21 +0800)]
implement `--help options` (#2017)

7 years agoimprove CLI usability (#2016)
Alex Lam S.L [Sat, 27 May 2017 20:09:40 +0000 (04:09 +0800)]
improve CLI usability (#2016)

Report supported options upon invalid option syntax.

fixes #1883

7 years agoextend `node_version` range on applicable tests (#2015)
Alex Lam S.L [Sat, 27 May 2017 14:18:28 +0000 (22:18 +0800)]
extend `node_version` range on applicable tests (#2015)

7 years agov3.0.12
Alex Lam S.L [Sat, 27 May 2017 10:08:09 +0000 (18:08 +0800)]
v3.0.12

7 years agofix `hoist_funs` on block-scoped `function` under "use strict" (#2013)
Alex Lam S.L [Sat, 27 May 2017 09:44:59 +0000 (17:44 +0800)]
fix `hoist_funs` on block-scoped `function` under "use strict" (#2013)

Technically not part of ES5, but commonly used code exists in the wild.

7 years agofix `if_return` on `AST_Defun` (#2010)
Alex Lam S.L [Sat, 27 May 2017 05:41:49 +0000 (13:41 +0800)]
fix `if_return` on `AST_Defun` (#2010)

Previous fiix for #1052 perturbs declaration order of functions which leads to incorrect behaviour under "use strict".

7 years agoclarify what --mangle-props does (#2012)
kzc [Sat, 27 May 2017 05:17:30 +0000 (01:17 -0400)]
clarify what --mangle-props does (#2012)

7 years agobetter document mangle properties options (#2009)
kzc [Fri, 26 May 2017 18:28:43 +0000 (14:28 -0400)]
better document mangle properties options (#2009)

7 years agofix and expand --mangle-props documentation (#2008)
kzc [Fri, 26 May 2017 17:25:51 +0000 (13:25 -0400)]
fix and expand --mangle-props documentation (#2008)

fixes #2007

7 years agofix `dead_code` on block-scoped `function` under "use strict" (#2006)
Alex Lam S.L [Fri, 26 May 2017 08:08:51 +0000 (16:08 +0800)]
fix `dead_code` on block-scoped `function` under "use strict" (#2006)

Technically not part of ES5, but commonly used code exists in the wild.

7 years agoclean up `lib/scope.js` (#2003)
Alex Lam S.L [Thu, 25 May 2017 19:58:35 +0000 (03:58 +0800)]
clean up `lib/scope.js` (#2003)

fixes #2004

7 years agoreport timing breakdown (#2000)
Alex Lam S.L [Wed, 24 May 2017 23:15:55 +0000 (07:15 +0800)]
report timing breakdown (#2000)

fix corner cases with `sourceMap`

fixes #1998

7 years agoensure new line after `describe_ast()` (#1999)
Alex Lam S.L [Wed, 24 May 2017 18:32:36 +0000 (02:32 +0800)]
ensure new line after `describe_ast()` (#1999)

7 years agoreinstate `describe_ast()` on CLI (#1996)
Alex Lam S.L [Tue, 23 May 2017 18:30:09 +0000 (02:30 +0800)]
reinstate `describe_ast()` on CLI (#1996)

fixes #1995

7 years agov3.0.11
Alex Lam S.L [Tue, 23 May 2017 14:26:59 +0000 (22:26 +0800)]
v3.0.11

7 years agofix source map offset (#1993)
Alex Lam S.L [Tue, 23 May 2017 12:25:48 +0000 (20:25 +0800)]
fix source map offset (#1993)

Account for whitespace insertions.

fixes #505
fixes #890

7 years agoadd another minify() options example (#1988)
kzc [Mon, 22 May 2017 04:19:07 +0000 (00:19 -0400)]
add another minify() options example (#1988)

7 years agoimprove usability of `global_defs` in `minify()` (#1987)
Alex Lam S.L [Sun, 21 May 2017 17:38:43 +0000 (01:38 +0800)]
improve usability of `global_defs` in `minify()` (#1987)

Use `@key` to `parse()` string value as `AST_Node`.

fixes #1986

7 years agomore refinement of minify() documentation (#1983)
kzc [Sat, 20 May 2017 20:55:03 +0000 (16:55 -0400)]
more refinement of minify() documentation (#1983)

7 years agov3.0.10
Alex Lam S.L [Sat, 20 May 2017 17:30:17 +0000 (01:30 +0800)]
v3.0.10

7 years agoadd "es5" to package.json keywords (#1980)
kzc [Sat, 20 May 2017 14:09:51 +0000 (10:09 -0400)]
add "es5" to package.json keywords (#1980)