UglifyJS.git
7 years agofix `collapse_vars` on default function argument (#2299)
Alex Lam S.L [Sun, 3 Sep 2017 18:32:33 +0000 (02:32 +0800)]
fix `collapse_vars` on default function argument (#2299)

Avoid collision with local variable `undefined` under certain corner cases.

fixes #2298

7 years agocorrectly count declarations after `hoist_vars` (#2297)
Alex Lam S.L [Sun, 3 Sep 2017 09:23:31 +0000 (17:23 +0800)]
correctly count declarations after `hoist_vars` (#2297)

fixes #2295

7 years agoFix CLI example for mangle reserved list of names (#2294)
David Šanda [Wed, 30 Aug 2017 16:55:32 +0000 (18:55 +0200)]
Fix CLI example for mangle reserved list of names (#2294)

7 years agoFix CLI source-maps examples (#2291)
David Šanda [Tue, 29 Aug 2017 15:49:20 +0000 (17:49 +0200)]
Fix CLI source-maps examples (#2291)

fixes #2284

7 years agofix `unused` patching of `AST_For.init` blocks (#2289)
Alex Lam S.L [Mon, 28 Aug 2017 17:10:04 +0000 (01:10 +0800)]
fix `unused` patching of `AST_For.init` blocks (#2289)

fixes #2288

7 years agov3.0.28
Alex Lam S.L [Sat, 19 Aug 2017 16:27:01 +0000 (00:27 +0800)]
v3.0.28

7 years agodon't escape null characters as \0 when followed by any digit (#2273)
Erik Desjardins [Mon, 14 Aug 2017 04:30:08 +0000 (00:30 -0400)]
don't escape null characters as \0 when followed by any digit (#2273)

fixes #2272

7 years agofix `ie8` mangling of top-level `AST_SymbolCatch` (#2263)
Alex Lam S.L [Mon, 31 Jul 2017 18:38:32 +0000 (02:38 +0800)]
fix `ie8` mangling of top-level `AST_SymbolCatch` (#2263)

fixes #2254

7 years agov3.0.27
Alex Lam S.L [Sat, 29 Jul 2017 17:50:42 +0000 (01:50 +0800)]
v3.0.27

7 years agoimprove `mangle.properties` (#2261)
Alex Lam S.L [Sat, 29 Jul 2017 15:02:04 +0000 (23:02 +0800)]
improve `mangle.properties` (#2261)

- include dead code when `keep_quoted`
- unify `keep_quoted` & `reserved`
- make `test/run-tests.js` consistent with `minify()`

fixes #2256

7 years agoissue template: describe acceptable JS input (#2255)
kzc [Thu, 27 Jul 2017 13:38:36 +0000 (09:38 -0400)]
issue template: describe acceptable JS input (#2255)

7 years agov3.0.26
Alex Lam S.L [Sun, 23 Jul 2017 04:39:36 +0000 (12:39 +0800)]
v3.0.26

7 years agounescape surrogate pairs only (#2246)
Alex Lam S.L [Sun, 23 Jul 2017 04:38:21 +0000 (12:38 +0800)]
unescape surrogate pairs only (#2246)

fixes #2242

7 years agoupdate dependencies (#2241)
Alex Lam S.L [Sun, 16 Jul 2017 08:20:40 +0000 (16:20 +0800)]
update dependencies (#2241)

- acorn@5.1.1
- commander@2.11.0
- mocha@3.4.2

7 years agov3.0.25
Alex Lam S.L [Sun, 16 Jul 2017 03:05:53 +0000 (11:05 +0800)]
v3.0.25

7 years agoreject malformed CLI parameters (#2239)
Alex Lam S.L [Sat, 15 Jul 2017 15:50:27 +0000 (23:50 +0800)]
reject malformed CLI parameters (#2239)

fixes #2237

7 years agoensure `ie8` works with mangled properties (#2238)
Alex Lam S.L [Sat, 15 Jul 2017 14:50:59 +0000 (22:50 +0800)]
ensure `ie8` works with mangled properties (#2238)

fixes #2234

7 years agodrop `unused` builtin globals under `unsafe` (#2236)
Alex Lam S.L [Sat, 15 Jul 2017 07:16:11 +0000 (15:16 +0800)]
drop `unused` builtin globals under `unsafe` (#2236)

fixes #2233

7 years agofix `unsafe` `evaluate` of `Object` static methods (#2232)
Alex Lam S.L [Fri, 14 Jul 2017 11:52:01 +0000 (19:52 +0800)]
fix `unsafe` `evaluate` of `Object` static methods (#2232)

fixes #2231

7 years agodrop `unused` compound assignments (#2230)
Alex Lam S.L [Thu, 13 Jul 2017 16:39:34 +0000 (00:39 +0800)]
drop `unused` compound assignments (#2230)

fixes #2226

7 years agoenhance `passes` (#2229)
Alex Lam S.L [Wed, 12 Jul 2017 18:18:59 +0000 (02:18 +0800)]
enhance `passes` (#2229)

- remove hardcoded upper limit
- continue based on node count reduction
- emit verbose statistics

fixes #2226

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)