UglifyJS.git
6 years agofix corner case in `inline` (#3017)
Alex Lam S.L [Thu, 22 Mar 2018 15:46:26 +0000 (23:46 +0800)]
fix corner case in `inline` (#3017)

fixes #3016

6 years agov3.3.16
Alex Lam S.L [Mon, 19 Mar 2018 06:53:51 +0000 (06:53 +0000)]
v3.3.16

6 years agoextend fuzzy RHS folding (#3006)
Alex Lam S.L [Fri, 16 Mar 2018 19:10:21 +0000 (03:10 +0800)]
extend fuzzy RHS folding (#3006)

- `a = []; if (1) x();` => `if (a = []) x();`

6 years agoimprove truthy compression (#3009)
Alex Lam S.L [Thu, 15 Mar 2018 22:12:59 +0000 (06:12 +0800)]
improve truthy compression (#3009)

6 years agorefactor brackets to braces (#3005)
Alex Lam S.L [Thu, 15 Mar 2018 07:46:45 +0000 (15:46 +0800)]
refactor brackets to braces (#3005)

6 years agov3.3.15
Alex Lam S.L [Wed, 14 Mar 2018 16:45:38 +0000 (16:45 +0000)]
v3.3.15

6 years agoupdate dependencies (#3002)
Alex Lam S.L [Wed, 14 Mar 2018 07:54:41 +0000 (15:54 +0800)]
update dependencies (#3002)

acorn 5.5.3
commander 2.15.0

Miscellaneous
- drop unmaintained package from README

6 years agoretain comments within brackets (#2999)
Alex Lam S.L [Tue, 13 Mar 2018 10:44:21 +0000 (18:44 +0800)]
retain comments within brackets (#2999)

fixes #2998

6 years agopreserve non-constant value assignments with modifications (#2997)
Alex Lam S.L [Tue, 13 Mar 2018 09:35:34 +0000 (17:35 +0800)]
preserve non-constant value assignments with modifications (#2997)

fixes #2995

6 years agohandle `case` correctly under `reduce_vars` (#2993)
Alex Lam S.L [Sun, 11 Mar 2018 07:54:43 +0000 (15:54 +0800)]
handle `case` correctly under `reduce_vars` (#2993)

fixes #2992

6 years agopreserve case when `inline_script` (#2991)
Alex Lam S.L [Sat, 10 Mar 2018 21:11:12 +0000 (05:11 +0800)]
preserve case when `inline_script` (#2991)

fixes #2989

6 years agov3.3.14
Alex Lam S.L [Sat, 10 Mar 2018 13:20:14 +0000 (13:20 +0000)]
v3.3.14

6 years agofix `mangle` of `AST_SymbolLambda` under `ie8` (#2978)
Alex Lam S.L [Wed, 7 Mar 2018 09:20:38 +0000 (17:20 +0800)]
fix `mangle` of `AST_SymbolLambda` under `ie8` (#2978)

fixes #2976

6 years agohandle negated constants correctly in `collapse_vars` (#2975)
Alex Lam S.L [Mon, 5 Mar 2018 16:45:58 +0000 (00:45 +0800)]
handle negated constants correctly in `collapse_vars` (#2975)

fixes #2974

6 years agov3.3.13
Alex Lam S.L [Sun, 4 Mar 2018 07:38:49 +0000 (07:38 +0000)]
v3.3.13

6 years agoimprove `test/run-test.js` performance (#2971)
Alex Lam S.L [Sat, 3 Mar 2018 20:50:00 +0000 (04:50 +0800)]
improve `test/run-test.js` performance (#2971)

- allow reuse of contextified sandbox
- minimise bottleneck from `vm.createContext()`

6 years agocompress `arguments[index]` (#2967)
Alex Lam S.L [Fri, 2 Mar 2018 03:22:09 +0000 (11:22 +0800)]
compress `arguments[index]` (#2967)

- always replace with existing parameter
- only introduce new parameter if `keep_fargs` is disabled

6 years agofix value reference caching in `evaluate` (#2969)
Alex Lam S.L [Thu, 1 Mar 2018 20:04:29 +0000 (04:04 +0800)]
fix value reference caching in `evaluate` (#2969)

fixes #2968

6 years agoenhance `conditionals` (#2966)
Alex Lam S.L [Wed, 28 Feb 2018 15:34:48 +0000 (23:34 +0800)]
enhance `conditionals` (#2966)

- `x ? (y, w) : (z, w)` => `x ? y : z, w`

6 years agomigrate safe transformations out of `unsafe_comps` (#2962)
Alex Lam S.L [Wed, 28 Feb 2018 14:02:24 +0000 (22:02 +0800)]
migrate safe transformations out of `unsafe_comps` (#2962)

fixes #2959

6 years agodrop `side_effects`-free `return` values (#2965)
Alex Lam S.L [Wed, 28 Feb 2018 11:59:19 +0000 (19:59 +0800)]
drop `side_effects`-free `return` values (#2965)

6 years agoenhance `collapse_vars` (#2952)
Alex Lam S.L [Wed, 28 Feb 2018 07:19:32 +0000 (15:19 +0800)]
enhance `collapse_vars` (#2952)

- `a = b, b` => `a = b`
- `a.b = c, c()` => `(a.b = c)()`

6 years agodrop lone "use strict" in function body (#2963)
Alex Lam S.L [Mon, 26 Feb 2018 07:22:52 +0000 (15:22 +0800)]
drop lone "use strict" in function body (#2963)

fixes #2961

6 years agoshow benchmark subtotal (#2960)
Dan [Mon, 26 Feb 2018 03:46:26 +0000 (04:46 +0100)]
show benchmark subtotal (#2960)

At the end of the benchmark, sums of the input, output and
gzip values are shown, such as:

    Subtotal

    Original: 7785102 bytes
    Uglified: 2283862 bytes
    GZipped:  662354 bytes

6 years agoimprove fix for #2954 (#2958)
Alex Lam S.L [Sun, 25 Feb 2018 19:14:22 +0000 (03:14 +0800)]
improve fix for #2954 (#2958)

6 years agofix `collapse_vars` on nested exception (#2955)
Alex Lam S.L [Sun, 25 Feb 2018 07:39:00 +0000 (15:39 +0800)]
fix `collapse_vars` on nested exception (#2955)

fixes #2954

6 years agodeduplicate parenthesis around object and function literals (#2953)
Alex Lam S.L [Sat, 24 Feb 2018 18:14:33 +0000 (02:14 +0800)]
deduplicate parenthesis around object and function literals (#2953)

6 years agominor clean-ups (#2951)
Alex Lam S.L [Fri, 23 Feb 2018 18:24:47 +0000 (02:24 +0800)]
minor clean-ups (#2951)

6 years agoimprove `mangle` (#2948)
Alex Lam S.L [Fri, 23 Feb 2018 15:51:49 +0000 (23:51 +0800)]
improve `mangle` (#2948)

6 years agov3.3.12
Alex Lam S.L [Thu, 22 Feb 2018 08:14:29 +0000 (08:14 +0000)]
v3.3.12

6 years agomore tests for #2938 (#2940)
Alex Lam S.L [Tue, 20 Feb 2018 20:19:42 +0000 (04:19 +0800)]
more tests for #2938 (#2940)

6 years agoworkaround `pure_getters=true` when dropping unused assignments (#2939)
Alex Lam S.L [Tue, 20 Feb 2018 09:38:40 +0000 (17:38 +0800)]
workaround `pure_getters=true` when dropping unused assignments (#2939)

fixes #2938

6 years agoimprove `unsafe` `evaluate` of `function` (#2936)
Alex Lam S.L [Mon, 19 Feb 2018 10:47:02 +0000 (18:47 +0800)]
improve `unsafe` `evaluate` of `function` (#2936)

Miscellaneous
- simplify `run_code()` hack

6 years agoreduce false positives from object literals (#2935)
Alex Lam S.L [Sun, 18 Feb 2018 22:21:07 +0000 (06:21 +0800)]
reduce false positives from object literals (#2935)

6 years agoreduce false positives from labels (#2934)
Alex Lam S.L [Sun, 18 Feb 2018 19:55:33 +0000 (03:55 +0800)]
reduce false positives from labels (#2934)

6 years agoreduce false positives from noop (#2933)
Alex Lam S.L [Sun, 18 Feb 2018 17:15:05 +0000 (01:15 +0800)]
reduce false positives from noop (#2933)

6 years agofix crash in `may_throw()` (#2932)
Alex Lam S.L [Sun, 18 Feb 2018 13:51:27 +0000 (21:51 +0800)]
fix crash in `may_throw()` (#2932)

fixes #2931

6 years agofix `dead_code` on exceptional `return` (#2930)
Alex Lam S.L [Sat, 17 Feb 2018 20:36:00 +0000 (04:36 +0800)]
fix `dead_code` on exceptional `return` (#2930)

fixes #2929

6 years agoreduce false positives from `function.toString()` (#2928)
Alex Lam S.L [Sat, 17 Feb 2018 18:13:26 +0000 (02:13 +0800)]
reduce false positives from `function.toString()` (#2928)

6 years agofix `unsafe` `evaluate` of `function` property (#2927)
Alex Lam S.L [Sat, 17 Feb 2018 13:33:36 +0000 (21:33 +0800)]
fix `unsafe` `evaluate` of `function` property (#2927)

fixes #2926

6 years agodrop unused "class" definition IIFEs (#2923)
Alex Lam S.L [Fri, 16 Feb 2018 21:11:31 +0000 (05:11 +0800)]
drop unused "class" definition IIFEs (#2923)

fixes #805

6 years agoreduce `function`-related false positives (#2925)
Alex Lam S.L [Fri, 16 Feb 2018 20:35:03 +0000 (04:35 +0800)]
reduce `function`-related false positives (#2925)

6 years agoimprove `inline` efficiency (#2924)
Alex Lam S.L [Fri, 16 Feb 2018 18:37:13 +0000 (02:37 +0800)]
improve `inline` efficiency (#2924)

6 years agofix `unsafe` `evaluate` of `AST_Function` (#2920)
Alex Lam S.L [Fri, 16 Feb 2018 09:21:46 +0000 (17:21 +0800)]
fix `unsafe` `evaluate` of `AST_Function` (#2920)

fixes #2919

6 years agov3.3.11
Alex Lam S.L [Thu, 15 Feb 2018 19:24:35 +0000 (19:24 +0000)]
v3.3.11

6 years agofix `unsafe` `evaluate` on type-converting operators (#2917)
Alex Lam S.L [Wed, 14 Feb 2018 08:48:47 +0000 (16:48 +0800)]
fix `unsafe` `evaluate` on type-converting operators (#2917)

fixes #2916

6 years agofix `collapse_vars` within loops (#2915)
Alex Lam S.L [Tue, 13 Feb 2018 21:15:52 +0000 (05:15 +0800)]
fix `collapse_vars` within loops (#2915)

fixes #2914

6 years agoreport options upon reminify input error (#2911)
Alex Lam S.L [Mon, 12 Feb 2018 23:29:39 +0000 (07:29 +0800)]
report options upon reminify input error (#2911)

6 years agocollapse within unary expressions (#2910)
Alex Lam S.L [Mon, 12 Feb 2018 23:10:37 +0000 (07:10 +0800)]
collapse within unary expressions (#2910)

6 years agofix corner case in `collapse_vars` (#2909)
Alex Lam S.L [Mon, 12 Feb 2018 17:41:22 +0000 (01:41 +0800)]
fix corner case in `collapse_vars` (#2909)

fixes #2908

6 years agosimplify `do-while` into `for` (#2907)
Alex Lam S.L [Mon, 12 Feb 2018 15:28:28 +0000 (23:28 +0800)]
simplify `do-while` into `for` (#2907)

fixes #2904

6 years agofix AST corruption due to `collapse_vars` & `inline` (#2899)
Alex Lam S.L [Thu, 8 Feb 2018 22:54:37 +0000 (06:54 +0800)]
fix AST corruption due to `collapse_vars` & `inline` (#2899)

fixes #2898

6 years agofix `join_vars` on property accessors (#2895)
Alex Lam S.L [Thu, 8 Feb 2018 17:52:39 +0000 (01:52 +0800)]
fix `join_vars` on property accessors (#2895)

fixes #2893

6 years agov3.3.10
Alex Lam S.L [Thu, 8 Feb 2018 10:16:16 +0000 (10:16 +0000)]
v3.3.10

6 years agoaccount for exceptions in `AST_Assign.left` (#2892)
Alex Lam S.L [Wed, 7 Feb 2018 19:31:51 +0000 (03:31 +0800)]
account for exceptions in `AST_Assign.left` (#2892)

fixes #2891

6 years agoupdate dependencies (#2889)
Alex Lam S.L [Wed, 7 Feb 2018 10:13:18 +0000 (18:13 +0800)]
update dependencies (#2889)

acorn 5.4.1
commander 2.14.1
semver 5.5.0

6 years agomention file encoding (#2887)
Alex Lam S.L [Tue, 6 Feb 2018 08:48:49 +0000 (16:48 +0800)]
mention file encoding (#2887)

6 years agoevaluate `to{Low,Upp}erCase()` under `unsafe` (#2886)
Alex Lam S.L [Tue, 6 Feb 2018 07:57:15 +0000 (15:57 +0800)]
evaluate `to{Low,Upp}erCase()` under `unsafe` (#2886)

6 years agoadd information on testing and code style (#2885)
Dan [Tue, 6 Feb 2018 06:19:28 +0000 (07:19 +0100)]
add information on testing and code style (#2885)

fixes #2884

6 years agodescribe a few compiler assumptions (#2883)
Dan [Tue, 6 Feb 2018 06:19:03 +0000 (07:19 +0100)]
describe a few compiler assumptions (#2883)

6 years agochange `undefined == x` to `null == x` (#2882)
Dan [Mon, 5 Feb 2018 07:00:23 +0000 (08:00 +0100)]
change `undefined == x` to `null == x` (#2882)

fixes #2871

6 years agoimprove exceptional flow compression by `collapse_vars` (#2880)
Alex Lam S.L [Sat, 3 Feb 2018 20:18:22 +0000 (04:18 +0800)]
improve exceptional flow compression by `collapse_vars` (#2880)

6 years agomaintain order between side-effects and externally observable assignments (#2879)
Alex Lam S.L [Sat, 3 Feb 2018 19:58:49 +0000 (03:58 +0800)]
maintain order between side-effects and externally observable assignments (#2879)

fixes #2878

6 years agohandle `break` & `continue` in `collapse_vars` (#2875)
Alex Lam S.L [Fri, 2 Feb 2018 23:58:43 +0000 (07:58 +0800)]
handle `break` & `continue` in `collapse_vars` (#2875)

fixes #2873

6 years agoallow `collapse_vars` across conditional branches (#2867)
Alex Lam S.L [Fri, 2 Feb 2018 18:44:40 +0000 (02:44 +0800)]
allow `collapse_vars` across conditional branches (#2867)

6 years agofix assignment logic in `reduce_vars` (#2872)
Alex Lam S.L [Fri, 2 Feb 2018 17:33:09 +0000 (01:33 +0800)]
fix assignment logic in `reduce_vars` (#2872)

fixes #2869

6 years agofix missing corner case in #2855 (#2868)
Alex Lam S.L [Fri, 2 Feb 2018 10:08:56 +0000 (18:08 +0800)]
fix missing corner case in #2855 (#2868)

6 years agoUpdate License Copyright Year to 2018 (#2866)
Ryan Gunn [Fri, 2 Feb 2018 08:30:01 +0000 (10:30 +0200)]
Update License Copyright Year to 2018 (#2866)

6 years agoalways test for `rename` (#2865)
Alex Lam S.L [Thu, 1 Feb 2018 13:42:55 +0000 (21:42 +0800)]
always test for `rename` (#2865)

6 years agobetter fix for #2858 (#2864)
Alex Lam S.L [Thu, 1 Feb 2018 12:06:36 +0000 (20:06 +0800)]
better fix for #2858 (#2864)

6 years agoaccount for side-effects in `comparisons` of `null` & `undefined` (#2863)
Alex Lam S.L [Thu, 1 Feb 2018 11:15:17 +0000 (19:15 +0800)]
account for side-effects in `comparisons` of `null` & `undefined` (#2863)

6 years agosimplify comparisons with `undefined` & `null` (#2862)
Alex Lam S.L [Thu, 1 Feb 2018 08:50:54 +0000 (16:50 +0800)]
simplify comparisons with `undefined` & `null` (#2862)

fixes #2857

6 years agoavoid `evaluate` of compound assignment after `dead_code` transform (#2861)
Alex Lam S.L [Thu, 1 Feb 2018 08:18:29 +0000 (16:18 +0800)]
avoid `evaluate` of compound assignment after `dead_code` transform (#2861)

fixes #2860

6 years agoaccount for declaration assignment in `collapse_vars` (#2859)
Alex Lam S.L [Thu, 1 Feb 2018 07:09:53 +0000 (15:09 +0800)]
account for declaration assignment in `collapse_vars` (#2859)

fixes #2858

6 years agorelax `collapse_vars` on `AST_Exit` (#2855)
Alex Lam S.L [Wed, 31 Jan 2018 15:49:59 +0000 (23:49 +0800)]
relax `collapse_vars` on `AST_Exit` (#2855)

First introduced in #1862 to stop assignments to migrate beyond `return` or `throw`. Since then `collapse_vars` has been improved to handle various side-effect-related corner cases.

6 years agoimprove symbol replacement heuristic (#2851)
Alex Lam S.L [Mon, 29 Jan 2018 09:41:15 +0000 (17:41 +0800)]
improve symbol replacement heuristic (#2851)

6 years agocompress chained compound assignments (#2850)
Alex Lam S.L [Mon, 29 Jan 2018 07:13:25 +0000 (15:13 +0800)]
compress chained compound assignments (#2850)

6 years agov3.3.9
Alex Lam S.L [Sat, 27 Jan 2018 12:56:34 +0000 (12:56 +0000)]
v3.3.9

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`