UglifyJS.git
6 years agofix accounting after conversion to assignment (#2847)
Alex Lam S.L [Fri, 26 Jan 2018 06:21:11 +0000 (14:21 +0800)]
fix accounting after conversion to assignment (#2847)

Missing reference to `AST_SymbolRef` created by `unused` causes `collapse_vars` to misbehave.

fixes #2846

6 years agobackport of #2835 (#2841)
Alex Lam S.L [Mon, 22 Jan 2018 21:45:45 +0000 (05:45 +0800)]
backport of #2835 (#2841)

6 years agodrop assignments to constant expressions only (#2839)
Alex Lam S.L [Mon, 22 Jan 2018 18:49:54 +0000 (02:49 +0800)]
drop assignments to constant expressions only (#2839)

fixes #2838

6 years agohandle duplicate function declarations correctly (#2837)
Alex Lam S.L [Mon, 22 Jan 2018 17:28:09 +0000 (01:28 +0800)]
handle duplicate function declarations correctly (#2837)

fixes #2836

6 years agov3.3.8
Alex Lam S.L [Sun, 21 Jan 2018 07:08:01 +0000 (07:08 +0000)]
v3.3.8

6 years agofix `unsafe` `evaluate` of `AST_Array` (#2825)
Alex Lam S.L [Sat, 20 Jan 2018 17:39:44 +0000 (01:39 +0800)]
fix `unsafe` `evaluate` of `AST_Array` (#2825)

fixes #2822

6 years agoenable `unsafe` for `test/ufuzz.js` (#2819)
Alex Lam S.L [Fri, 19 Jan 2018 15:47:42 +0000 (23:47 +0800)]
enable `unsafe` for `test/ufuzz.js` (#2819)

- introduce `unsafe_undefined`
- safer `.toString()` compression

Miscellaneous
- rename `unsafe_Function`

6 years agoimprove `unused` on built-in functions (#2817)
Alex Lam S.L [Fri, 19 Jan 2018 12:41:57 +0000 (20:41 +0800)]
improve `unused` on built-in functions (#2817)

6 years agoavoid duplicate property names in object literals under "use strict" (#2818)
Alex Lam S.L [Fri, 19 Jan 2018 12:13:50 +0000 (20:13 +0800)]
avoid duplicate property names in object literals under "use strict" (#2818)

fixes #2816

6 years agofix & improve `test/ufuzz.js` (#2815)
Alex Lam S.L [Fri, 19 Jan 2018 06:07:20 +0000 (14:07 +0800)]
fix & improve `test/ufuzz.js` (#2815)

- use correct `options` when testing `rename`
- mask arbitrarily assigned function IDs to reduce rate of false positives

6 years agofix time-out for respawned `test/ufuzz.js` (#2814)
Alex Lam S.L [Thu, 18 Jan 2018 22:11:19 +0000 (06:11 +0800)]
fix time-out for respawned `test/ufuzz.js` (#2814)

6 years agocompress `undefined` property names (#2811)
Alex Lam S.L [Thu, 18 Jan 2018 16:36:30 +0000 (00:36 +0800)]
compress `undefined` property names (#2811)

- enforce property names as string
- handle `void 0` as `undefined` in `hoist_props` & `reduce_vars`

6 years agofix `join_vars` property assignment for negative array index (#2810)
kzc [Thu, 18 Jan 2018 13:52:54 +0000 (08:52 -0500)]
fix `join_vars` property assignment for negative array index (#2810)

fixes #2790

6 years agoenhance `test/ufuzz.js` (#2808)
Alex Lam S.L [Thu, 18 Jan 2018 06:08:05 +0000 (14:08 +0800)]
enhance `test/ufuzz.js` (#2808)

- standalone test for `rename`
- handle `keep_fargs` & `rename` upon failure

6 years agofaster output of comments (#2806)
Alex Lam S.L [Wed, 17 Jan 2018 18:57:33 +0000 (02:57 +0800)]
faster output of comments (#2806)

6 years agofix `AST_Scope.clone()` (#2803)
Alex Lam S.L [Wed, 17 Jan 2018 13:33:13 +0000 (21:33 +0800)]
fix `AST_Scope.clone()` (#2803)

fixes #2799

6 years agosuppress `unsafe_proto` for LHS expressions (#2804)
Alex Lam S.L [Wed, 17 Jan 2018 12:41:51 +0000 (20:41 +0800)]
suppress `unsafe_proto` for LHS expressions (#2804)

6 years agoconfigure `rename` with CLI (#2802)
Alex Lam S.L [Wed, 17 Jan 2018 07:12:22 +0000 (15:12 +0800)]
configure `rename` with CLI (#2802)

6 years agoextend `join_vars` & `sequences` (#2798)
Alex Lam S.L [Wed, 17 Jan 2018 05:58:27 +0000 (13:58 +0800)]
extend `join_vars` & `sequences` (#2798)

6 years agoimprove `mocha` tests (#2797)
Alex Lam S.L [Tue, 16 Jan 2018 09:51:25 +0000 (17:51 +0800)]
improve `mocha` tests (#2797)

- workaround sporadic delays from Travis CI

6 years agoimprove `test/travis-ufuzz.js` (#2795)
Alex Lam S.L [Tue, 16 Jan 2018 09:33:21 +0000 (17:33 +0800)]
improve `test/travis-ufuzz.js` (#2795)

- print usage
- support concurrent jobs
- improve instance utilisation
- resume after V8 self-destruct

6 years agogeneral improvements around `AST_ForIn` (#2796)
Alex Lam S.L [Tue, 16 Jan 2018 09:03:12 +0000 (17:03 +0800)]
general improvements around `AST_ForIn` (#2796)

- compress using `collapse_vars`
- remove unused `name`
- simplify `loop_body`

6 years agofix typo in README (#2792)
Joël Galeran [Tue, 16 Jan 2018 02:29:38 +0000 (03:29 +0100)]
fix typo in README (#2792)

6 years agohandle VM failure gracefully (#2791)
Alex Lam S.L [Mon, 15 Jan 2018 15:41:39 +0000 (23:41 +0800)]
handle VM failure gracefully (#2791)

6 years agoimprove `test/travis-ufuzz.js` (#2789)
Alex Lam S.L [Mon, 15 Jan 2018 11:18:21 +0000 (19:18 +0800)]
improve `test/travis-ufuzz.js` (#2789)

- wait for instance to boot
- run on forked repositories
- workaround `request_limit_reached`

6 years agoenhance `collapse_vars` (#2788)
Alex Lam S.L [Mon, 15 Jan 2018 10:47:23 +0000 (18:47 +0800)]
enhance `collapse_vars` (#2788)

6 years agoavoid suboptimal termination in `passes` (#2787)
Alex Lam S.L [Mon, 15 Jan 2018 08:42:31 +0000 (16:42 +0800)]
avoid suboptimal termination in `passes` (#2787)

6 years agoavoid double counting within single-use functions (#2785)
Alex Lam S.L [Mon, 15 Jan 2018 08:42:15 +0000 (16:42 +0800)]
avoid double counting within single-use functions (#2785)

fixes #2783

6 years agoimprove `test/travis-ufuzz.js` (#2786)
Alex Lam S.L [Mon, 15 Jan 2018 07:08:35 +0000 (15:08 +0800)]
improve `test/travis-ufuzz.js` (#2786)

- use more RAM
- show progress in console
- report failure as job status

6 years agorun `test/ufuzz.js` when Travis CI is idle (#2784)
Alex Lam S.L [Sun, 14 Jan 2018 20:56:06 +0000 (04:56 +0800)]
run `test/ufuzz.js` when Travis CI is idle (#2784)

6 years agov3.3.7
Alex Lam S.L [Sun, 14 Jan 2018 09:13:26 +0000 (09:13 +0000)]
v3.3.7

6 years agofix & extend `join_vars` for object assigments (#2781)
Alex Lam S.L [Sun, 14 Jan 2018 09:11:31 +0000 (17:11 +0800)]
fix & extend `join_vars` for object assigments (#2781)

6 years agoimprove SymbolDef info in `--output ast` (#2778)
kzc [Sat, 13 Jan 2018 17:40:51 +0000 (12:40 -0500)]
improve SymbolDef info in `--output ast` (#2778)

* SymbolDef info (a.k.a. `thedef`) is now represented as a string containing `"ID name [mangled_name]"`.
* Enhance display of `globals`, `variables`, `functions` and `enclosed`.
* `SymbolDef.next_id` starts at `1` and the `id` is adjusted for `-o ast` display.

6 years agov3.3.6
Alex Lam S.L [Sat, 13 Jan 2018 05:37:42 +0000 (05:37 +0000)]
v3.3.6

6 years agofix `reduce_vars` on `AST_Accessor` (#2776)
Alex Lam S.L [Fri, 12 Jan 2018 18:46:14 +0000 (02:46 +0800)]
fix `reduce_vars` on `AST_Accessor` (#2776)

fixes #2774

6 years agoadd SymbolDef IDs to --output ast (#2772)
kzc [Fri, 12 Jan 2018 07:41:09 +0000 (02:41 -0500)]
add SymbolDef IDs to --output ast (#2772)

6 years agofix output of imported AST (#2771)
Alex Lam S.L [Thu, 11 Jan 2018 17:05:49 +0000 (01:05 +0800)]
fix output of imported AST (#2771)

6 years agoupdate dependencies (#2770)
Alex Lam S.L [Thu, 11 Jan 2018 16:32:17 +0000 (00:32 +0800)]
update dependencies (#2770)

- acorn@5.3.0
- commander@2.13.0

6 years agofix nested `unused` assignments (#2769)
Alex Lam S.L [Thu, 11 Jan 2018 15:13:44 +0000 (23:13 +0800)]
fix nested `unused` assignments (#2769)

fixes #2768

6 years agofix corner case in #2763 (#2766)
Alex Lam S.L [Thu, 11 Jan 2018 13:18:08 +0000 (21:18 +0800)]
fix corner case in #2763 (#2766)

6 years agojoin object assignments (#2763)
Alex Lam S.L [Thu, 11 Jan 2018 09:08:21 +0000 (17:08 +0800)]
join object assignments (#2763)

6 years agoskip only `var`s in `if_return` (#2759)
Alex Lam S.L [Wed, 10 Jan 2018 11:08:46 +0000 (19:08 +0800)]
skip only `var`s in `if_return` (#2759)

fixes #2747

6 years agoenhance `conditionals` (#2758)
Alex Lam S.L [Wed, 10 Jan 2018 08:59:57 +0000 (16:59 +0800)]
enhance `conditionals` (#2758)

`x ? y || z : z` --> `x && y || z`

6 years agoimprove synergy between `compress` and `rename` (#2755)
Alex Lam S.L [Tue, 9 Jan 2018 09:55:41 +0000 (17:55 +0800)]
improve synergy between `compress` and `rename` (#2755)

6 years agopatch variable declaractions extracted within `catch` (#2753)
Alex Lam S.L [Tue, 9 Jan 2018 05:54:35 +0000 (13:54 +0800)]
patch variable declaractions extracted within `catch` (#2753)

fixes #2749

6 years agoimprove `rename` reproducibility (#2754)
Alex Lam S.L [Tue, 9 Jan 2018 05:53:05 +0000 (13:53 +0800)]
improve `rename` reproducibility (#2754)

fixes #2752

6 years agocompress loops with immediate `break` (#2746)
Alex Lam S.L [Mon, 8 Jan 2018 06:30:18 +0000 (14:30 +0800)]
compress loops with immediate `break` (#2746)

fixes #2740

6 years agov3.3.5
Alex Lam S.L [Sun, 7 Jan 2018 11:51:36 +0000 (11:51 +0000)]
v3.3.5

6 years agoimprove `process.exit()` workaround (#2741)
Alex Lam S.L [Sun, 7 Jan 2018 09:53:50 +0000 (17:53 +0800)]
improve `process.exit()` workaround (#2741)

- use public API
- fix issue with Node.js 0.10 on WIndows

6 years agofix recursive function `inline` (#2738)
Alex Lam S.L [Sun, 7 Jan 2018 07:31:24 +0000 (15:31 +0800)]
fix recursive function `inline` (#2738)

fixes #2737

6 years agoenable AppVeyor CI (#2739)
Alex Lam S.L [Sun, 7 Jan 2018 06:14:58 +0000 (14:14 +0800)]
enable AppVeyor CI (#2739)

6 years agohandle trailing line comments correctly (#2736)
Alex Lam S.L [Sat, 6 Jan 2018 13:05:21 +0000 (21:05 +0800)]
handle trailing line comments correctly (#2736)

fixes #2734

6 years agocompress `RegExp()` in `unsafe` (#2735)
Alex Lam S.L [Sat, 6 Jan 2018 13:04:47 +0000 (21:04 +0800)]
compress `RegExp()` in `unsafe` (#2735)

6 years agoenhance `unsafe_proto` (#2733)
Alex Lam S.L [Fri, 5 Jan 2018 22:16:51 +0000 (06:16 +0800)]
enhance `unsafe_proto` (#2733)

6 years agoufuzz: add strings "a", "b", "c" to VALUES (#2732)
kzc [Fri, 5 Jan 2018 21:54:53 +0000 (16:54 -0500)]
ufuzz: add strings "a", "b", "c" to VALUES (#2732)

6 years agofix corner case with `arguments` as function name (#2729)
Alex Lam S.L [Fri, 5 Jan 2018 14:21:18 +0000 (22:21 +0800)]
fix corner case with `arguments` as function name (#2729)

fixes #2728

6 years agoimprove `if_return` (#2727)
Alex Lam S.L [Fri, 5 Jan 2018 12:24:30 +0000 (20:24 +0800)]
improve `if_return` (#2727)

6 years agowarn on deprecated features (#2726)
Alex Lam S.L [Fri, 5 Jan 2018 11:36:02 +0000 (19:36 +0800)]
warn on deprecated features (#2726)

- `function.arguments`
- `function.callers`

fixes #2719

6 years agofix `mangle` name collision across files (#2722)
Alex Lam S.L [Thu, 4 Jan 2018 21:08:09 +0000 (05:08 +0800)]
fix `mangle` name collision across files (#2722)

6 years agofix corner case in `inline` (#2720)
Alex Lam S.L [Thu, 4 Jan 2018 15:38:37 +0000 (23:38 +0800)]
fix corner case in `inline` (#2720)

6 years agoreminify tests upon `expect_stdout` (#2716)
Alex Lam S.L [Thu, 4 Jan 2018 12:13:05 +0000 (20:13 +0800)]
reminify tests upon `expect_stdout` (#2716)

6 years agoforbid block-scoped `AST_Defun` in strict mode (#2718)
Alex Lam S.L [Thu, 4 Jan 2018 10:45:51 +0000 (18:45 +0800)]
forbid block-scoped `AST_Defun` in strict mode (#2718)

6 years agopreserve constant modification under strict mode (#2717)
Alex Lam S.L [Thu, 4 Jan 2018 07:53:53 +0000 (15:53 +0800)]
preserve constant modification under strict mode (#2717)

6 years agoextend `inline` (#2714)
Alex Lam S.L [Thu, 4 Jan 2018 04:58:40 +0000 (12:58 +0800)]
extend `inline` (#2714)

- compress `function` with variables within loops
- restrict to `AST_Var` for better compatibility with ES6+

6 years agoapply `collapse_vars` to loop conditions (#2712)
Alex Lam S.L [Wed, 3 Jan 2018 19:18:28 +0000 (03:18 +0800)]
apply `collapse_vars` to loop conditions (#2712)

6 years agodrop `unused` assignment based on `reduce_vars` (#2709)
Alex Lam S.L [Wed, 3 Jan 2018 17:03:33 +0000 (01:03 +0800)]
drop `unused` assignment based on `reduce_vars` (#2709)

6 years agofix `reduce_vars` on `AST_Defun` (#2708)
Alex Lam S.L [Wed, 3 Jan 2018 09:18:38 +0000 (17:18 +0800)]
fix `reduce_vars` on `AST_Defun` (#2708)

6 years agoextend `__PURE__` to `AST_New` (#2706)
Alex Lam S.L [Tue, 2 Jan 2018 20:48:07 +0000 (04:48 +0800)]
extend `__PURE__` to `AST_New` (#2706)

fixes #2705

6 years agoinline functions with `AST_Var` (#2688)
Alex Lam S.L [Tue, 2 Jan 2018 17:54:44 +0000 (01:54 +0800)]
inline functions with `AST_Var` (#2688)

6 years agoenhance `collapse_vars` (#2704)
Alex Lam S.L [Tue, 2 Jan 2018 10:42:15 +0000 (18:42 +0800)]
enhance `collapse_vars` (#2704)

6 years agoenhance `if_return` (#2703)
Alex Lam S.L [Tue, 2 Jan 2018 07:09:51 +0000 (15:09 +0800)]
enhance `if_return` (#2703)

6 years agoreset argument value within loop after `inline` (#2699)
Alex Lam S.L [Mon, 1 Jan 2018 17:24:53 +0000 (01:24 +0800)]
reset argument value within loop after `inline` (#2699)

6 years agoscan within IIFEs of assigned values (#2702)
Alex Lam S.L [Mon, 1 Jan 2018 17:24:23 +0000 (01:24 +0800)]
scan within IIFEs of assigned values (#2702)

fixes #2701

6 years agoenhance `join_vars` & `sequences` (#2697)
Alex Lam S.L [Sun, 31 Dec 2017 16:09:26 +0000 (00:09 +0800)]
enhance `join_vars` & `sequences` (#2697)

- nudge declarations without assignments
  - within `AST_BlockStatement`
  - across `AST_If`

6 years agofix `inline` on duplicate argument names (#2698)
Alex Lam S.L [Sun, 31 Dec 2017 12:59:58 +0000 (20:59 +0800)]
fix `inline` on duplicate argument names (#2698)

6 years agoreduce hoisting declarations (#2687)
Alex Lam S.L [Sun, 31 Dec 2017 08:15:00 +0000 (16:15 +0800)]
reduce hoisting declarations (#2687)

6 years agov3.3.4
Alex Lam S.L [Sat, 30 Dec 2017 16:01:14 +0000 (00:01 +0800)]
v3.3.4

6 years agofix `dead_code` on escaped `return` assignment (#2693)
Alex Lam S.L [Sat, 30 Dec 2017 07:20:25 +0000 (15:20 +0800)]
fix `dead_code` on escaped `return` assignment (#2693)

fixes #2692

6 years agominor clean-ups (#2686)
Alex Lam S.L [Fri, 29 Dec 2017 06:04:52 +0000 (14:04 +0800)]
minor clean-ups (#2686)

6 years agov3.3.3
Alex Lam S.L [Thu, 28 Dec 2017 19:07:39 +0000 (03:07 +0800)]
v3.3.3

6 years agofix `pure_getters` on `AST_Binary` (#2681)
Alex Lam S.L [Thu, 28 Dec 2017 09:01:01 +0000 (17:01 +0800)]
fix `pure_getters` on `AST_Binary` (#2681)

fixes #2678

6 years agoimprove assignment variations (#2671)
Alex Lam S.L [Thu, 28 Dec 2017 07:36:55 +0000 (15:36 +0800)]
improve assignment variations (#2671)

6 years agofix function inlining within loops (#2675)
Alex Lam S.L [Wed, 27 Dec 2017 18:53:14 +0000 (02:53 +0800)]
fix function inlining within loops (#2675)

fixes #2663

6 years agofix `dead_code` on `return` assignments (#2668)
Alex Lam S.L [Tue, 26 Dec 2017 23:40:34 +0000 (07:40 +0800)]
fix `dead_code` on `return` assignments (#2668)

fixes #2666

6 years agoretain recursive function names (#2667)
Alex Lam S.L [Tue, 26 Dec 2017 23:00:12 +0000 (07:00 +0800)]
retain recursive function names (#2667)

fixes #2665

6 years agofix bugs on substituted `AST_Defun` (#2661)
Alex Lam S.L [Tue, 26 Dec 2017 21:31:37 +0000 (05:31 +0800)]
fix bugs on substituted `AST_Defun` (#2661)

fixes #2660

6 years agoreplace single-use recursive functions (#2659)
Alex Lam S.L [Tue, 26 Dec 2017 13:25:35 +0000 (21:25 +0800)]
replace single-use recursive functions (#2659)

fixes #2628

6 years agosuppress `inline` within substituted `AST_Scope` (#2658)
Alex Lam S.L [Tue, 26 Dec 2017 10:56:59 +0000 (18:56 +0800)]
suppress `inline` within substituted `AST_Scope` (#2658)

fixes #2657

6 years agoimprove `unused` over duplicate variable names (#2656)
Alex Lam S.L [Tue, 26 Dec 2017 10:29:28 +0000 (18:29 +0800)]
improve `unused` over duplicate variable names (#2656)

6 years agov3.3.2
Alex Lam S.L [Mon, 25 Dec 2017 17:38:56 +0000 (01:38 +0800)]
v3.3.2

6 years agoparse LF & comment correctly (#2653)
Alex Lam S.L [Mon, 25 Dec 2017 17:38:01 +0000 (01:38 +0800)]
parse LF & comment correctly (#2653)

fixes #2652

6 years agov3.3.1
Alex Lam S.L [Sun, 24 Dec 2017 19:08:28 +0000 (03:08 +0800)]
v3.3.1

6 years agoadd `html-minifier` to benchmarks (#2646)
Alex Lam S.L [Sun, 24 Dec 2017 19:07:46 +0000 (03:07 +0800)]
add `html-minifier` to benchmarks (#2646)

6 years agofix infinite loop during `inline` (#2645)
Alex Lam S.L [Sun, 24 Dec 2017 17:57:11 +0000 (01:57 +0800)]
fix infinite loop during `inline` (#2645)

fixes #2644

6 years agov3.3.0
Alex Lam S.L [Sun, 24 Dec 2017 09:34:56 +0000 (17:34 +0800)]
v3.3.0

6 years agofix comments output & improve `/*@__PURE__*/`
Alex Lam S.L [Sun, 24 Dec 2017 04:38:45 +0000 (12:38 +0800)]
fix comments output & improve `/*@__PURE__*/`

- fix whitespace around comments
- fix comment parsing around parentheses
- consider parentheses when parsing `/*@__PURE__*/`
- remove all `/*@__PURE__*/` on output

fixes #2638

6 years agofix corner cases with `collapse_vars`, `inline` & `reduce_vars` (#2637)
Alex Lam S.L [Sat, 23 Dec 2017 17:24:12 +0000 (01:24 +0800)]
fix corner cases with `collapse_vars`, `inline` & `reduce_vars` (#2637)

fixes #2630

6 years agofix escape analysis on `AST_PropAccess` (#2636)
Alex Lam S.L [Sat, 23 Dec 2017 16:36:46 +0000 (00:36 +0800)]
fix escape analysis on `AST_PropAccess` (#2636)

6 years agomake comments output more robust (#2633)
Alex Lam S.L [Thu, 21 Dec 2017 20:59:54 +0000 (04:59 +0800)]
make comments output more robust (#2633)

- improve handling of comments right after `return`
- retain comments after `OutputStream`
- preserve trailing comments
- fix handling of new line before comments
- handle comments around parentheses

fixes #88
fixes #112
fixes #218
fixes #372
fixes #2629

6 years agoextend `test/ufuzz.js` to `inline` & `reduce_funcs` (#2620)
Alex Lam S.L [Wed, 20 Dec 2017 15:52:18 +0000 (23:52 +0800)]
extend `test/ufuzz.js` to `inline` & `reduce_funcs` (#2620)

- forward call `fN()`
- allow forward call functions to be single-use
- avoid generating `AST_Defun` within blocks