Alex Lam S.L
2cbbf5c375
support async function ( #4333 )
2020-12-07 05:22:40 +08:00
Alex Lam S.L
645d5a348b
workaround Safari quirks ( #4314 )
...
fixes #1753
2020-11-21 10:30:46 +08:00
Alex Lam S.L
8d30902ba9
fix corner case in mangle ( #4311 )
2020-11-21 08:05:40 +08:00
Alex Lam S.L
aff842f2f9
fix corner case in arguments ( #4293 )
...
fixes #4291
2020-11-18 08:54:58 +08:00
Alex Lam S.L
e5f80afc53
support destructured literals ( #4278 )
2020-11-17 08:01:24 +08:00
Alex Lam S.L
fd8c0212b8
fix corner case in ie8 ( #4232 )
...
fixes #4231
2020-10-20 14:02:39 +08:00
Alex Lam S.L
256950c2c0
fix corner case in ie8 ( #4230 )
...
fixes #4229
2020-10-20 06:13:23 +08:00
Alex Lam S.L
96bf7fceab
support let ( #4227 )
2020-10-19 08:32:39 +08:00
Alex Lam S.L
0e234a25c5
fix corner case in reduce_vars ( #4211 )
...
fixes #4210
2020-10-13 15:52:03 +08:00
Alex Lam S.L
9b7a13c8c7
fix corner case in ie8 & mangle ( #4196 )
...
fixes #4195
2020-10-12 12:43:26 +08:00
Alex Lam S.L
b1b8898e7c
fix corner case in functions ( #4192 )
...
fixes #4191
2020-10-12 09:26:56 +08:00
Alex Lam S.L
55451e7b78
support const ( #4190 )
2020-10-12 01:18:57 +08:00
Alex Lam S.L
9c0feb69e5
fix corner case in reduce_vars ( #4189 )
...
fixes #4188
2020-10-07 22:01:39 +08:00
Alex Lam S.L
220dc95c0d
clean up scope-related variables ( #4179 )
2020-10-05 06:56:52 +08:00
Alex Lam S.L
8f0521d51d
retrofit try-catch-finally as block-scoped ( #4178 )
...
- support optional catch binding
2020-10-05 05:30:14 +08:00
Alex Lam S.L
95ef4d5377
fix corner case in mangle ( #4174 )
2020-10-04 08:24:41 +08:00
Alex Lam S.L
baf4903aa7
fix corner cases of catch variable inlining ( #4169 )
2020-10-03 07:02:28 +08:00
Alex Lam S.L
ccd91b9952
retrofit catch as block-scoped ( #4165 )
2020-10-02 23:29:58 +08:00
Alex Lam S.L
7de8daa4b1
minor clean up ( #4149 )
2020-09-23 23:06:12 +08:00
Alex Lam S.L
3ac575f2e8
introduce merge_vars ( #4100 )
2020-09-15 10:01:48 +08:00
Alex Lam S.L
7dc61cdc89
tidy up various interfaces ( #4066 )
2020-08-24 04:39:38 +08:00
Alex Lam S.L
35fe1092d3
simplify traversal logic ( #4063 )
2020-08-23 05:45:35 +08:00
Alex Lam S.L
61b66e83f1
fix corner case in ie8 ( #4016 )
...
fixes #4015
2020-07-21 02:32:20 +08:00
Alex Lam S.L
8b2cfd45fa
fix corner case in rename ( #4000 )
...
fixes #3999
2020-06-15 01:29:01 +08:00
Alex Lam S.L
6bf1486935
update links to repository after rename ( #3847 )
2020-05-05 21:07:33 +08:00
Alex Lam S.L
3ee13cae02
improve compress ( #3814 )
...
- avoid identifier overflow through consecutive API calls
- simplify `reduce_vars`
- enhance `unsafe` `evaluate`
2020-04-24 06:50:53 +08:00
Alex Lam S.L
c810ecd081
improve handling of eval ( #3776 )
...
closes #3768
2020-04-11 06:36:17 +08:00
Alex Lam S.L
0a1c9b34ce
fix corner case in evaluate & ie8 ( #3751 )
...
fixes #3750
2020-03-21 00:55:24 +08:00
Alex Lam S.L
d1a78920d9
workaround firefox asm.js quirks ( #3650 )
...
fixes #3636
2019-12-28 23:14:53 +00:00
Alex Lam S.L
82b3eed5ef
fix corner case in ie8 & mangle ( #3524 )
...
fixes #3523
2019-10-24 23:43:19 +08:00
Alex Lam S.L
02308a7b56
fix corner case in reduce_vars ( #3510 )
...
fixes #3509
2019-10-22 20:36:05 +08:00
Alex Lam S.L
1549db70e6
fix corner case in ie8 ( #3487 )
...
fixes #3486
2019-10-16 12:18:27 +08:00
Alex Lam S.L
8ff9a3c8fb
fix corner cases in ie8 ( #3485 )
...
fixes #3484
2019-10-16 06:37:40 +08:00
Alex Lam S.L
91cae51d8f
fix corner case in evaluate & ie8 ( #3483 )
...
fixes #3482
2019-10-16 01:09:16 +08:00
Alex Lam S.L
8af2f5fbcf
fix corner case in rename ( #3481 )
...
fixes #3480
2019-10-15 19:44:07 +08:00
Alex Lam S.L
86a8016323
fix corner case in ie8 & mangle ( #3479 )
...
fixes #3478
2019-10-15 17:14:48 +08:00
Alex Lam S.L
f86f615d83
fix corner case in ie8 & mangle ( #3476 )
...
fixes #3475
2019-10-15 14:18:12 +08:00
Alex Lam S.L
d3d1d11926
fix corner case in ie8 & rename ( #3474 )
...
fixes #3473
2019-10-15 07:27:02 +08:00
Alex Lam S.L
a39bdb5840
fix corner case with collapse_vars & ie8 ( #3469 )
...
fixes #3468
2019-10-14 13:34:35 +08:00
Alex Lam S.L
e8a2c0b5bf
fix corner case in functions ( #3365 )
...
fixes #3364
2019-04-18 17:03:52 +08:00
Alex Lam S.L
21cd7e3f57
reduce test exports ( #3361 )
2019-04-17 16:19:08 +08:00
Alex Lam S.L
5172ba5f2a
introduce functions ( #3360 )
...
`var f = function() {};` => `function f() {}`
2019-04-15 22:23:11 +08:00
Alex Lam S.L
a74e600fa0
mangle shadowed lambda under ie8 correctly ( #3356 )
...
fixes #3355
2019-04-01 15:22:00 +08:00
Alex Lam S.L
627f5fb41e
fix corner case with nameCache ( #3338 )
...
fixes #3301
2019-03-15 01:15:50 +08:00
Alex Lam S.L
fc78423f1d
clean up webkit quirks ( #3229 )
2018-08-08 16:15:45 +08:00
Alex Lam S.L
304db15a20
fix corner case in ie8 & rename ( #3223 )
2018-07-26 16:35:43 +08:00
Alex Lam S.L
cea685f8d9
fix corner case in ie8 ( #3216 )
...
fixes #3215
2018-07-19 14:45:36 +08:00
Alex Lam S.L
ab36b9b10a
fix corner case in ie8 ( #3198 )
...
fixes #3197
2018-06-24 04:00:36 +08:00
Alex Lam S.L
9e19e63551
general clean-ups ( #3175 )
2018-06-06 17:50:56 +08:00
Alex Lam S.L
24d9633a35
fix corner cases with eval() ( #3147 )
...
fixes #3146
2018-05-24 14:29:30 +08:00
Alex Lam S.L
838f837379
improve general performance ( #3104 )
2018-04-27 04:30:29 +08:00
Alex Lam S.L
e5f6a88233
fix corner case in reuse of mangle options ( #3062 )
2018-04-08 02:29:37 +08:00
Alex Lam S.L
81603ecd15
improve performance through makePredicate() ( #3048 )
2018-04-03 15:15:01 +08:00
Alex Lam S.L
fa3250199a
mangle unused nested AST_SymbolCatch correctly ( #3038 )
...
fixes #3035
2018-03-30 16:23:09 +09:00
Alex Lam S.L
49bfc6b555
improve performance ( #3020 )
...
- replace `find_if()` with `all()` wherever possible
- move ESTree-specific logic out of `figure_out_scope()`
2018-03-23 03:43:52 +08:00
Alex Lam S.L
10b3752b1e
fix mangle of AST_SymbolLambda under ie8 ( #2978 )
...
fixes #2976
2018-03-07 17:20:38 +08:00
Alex Lam S.L
455790202a
minor clean-ups ( #2951 )
2018-02-24 02:24:47 +08:00
Alex Lam S.L
f40f5eb228
improve mangle ( #2948 )
2018-02-23 23:51:49 +08:00
Alex Lam S.L
5e2cd07d6f
handle duplicate function declarations correctly ( #2837 )
...
fixes #2836
2018-01-23 01:28:09 +08:00
kzc
2cab348341
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.
2018-01-14 01:40:51 +08:00
kzc
d4d7d99b70
add SymbolDef IDs to --output ast ( #2772 )
2018-01-12 15:41:09 +08:00
Alex Lam S.L
bf832cde16
improve synergy between compress and rename ( #2755 )
2018-01-09 17:55:41 +08:00
Alex Lam S.L
9f23185f2b
fix corner case with arguments as function name ( #2729 )
...
fixes #2728
2018-01-05 22:21:18 +08:00
Alex Lam S.L
afbcebddf6
fix mangle name collision across files ( #2722 )
2018-01-05 05:08:09 +08:00
Alex Lam S.L
cfe3a98ce5
drop unused assignment based on reduce_vars ( #2709 )
2018-01-04 01:03:33 +08:00
Alex Lam S.L
14778e049b
fix reduce_vars on AST_Defun ( #2708 )
2018-01-03 17:18:38 +08:00
Alex Lam S.L
4832bc5d88
replace single-use recursive functions ( #2659 )
...
fixes #2628
2017-12-26 21:25:35 +08:00
Alex Lam S.L
172079a47f
improve code reuse ( #2542 )
2017-12-01 03:40:46 +08:00
Alex Lam S.L
30cfea2e7a
fix rename ( #2501 )
...
- suppress spurious `rename` from `commander`
- handle `AST_SymbolCatch` correctly
2017-11-24 03:05:43 +08:00
Alex Lam S.L
f4e2fb9864
expand symbol space to improve compression ( #2460 )
...
- give globally distinct names to distinct variables
- improve ability to compress cross-scoped
- introduce `options.rename` to `minify()`
- default `true` if both `compress` & `mangle`
2017-11-19 19:29:51 +08:00
Alex Lam S.L
c6cfa04d10
allow symbol replacement on multiple occurrences ( #2472 )
...
- all-or-nothing replacement
- avoid unmangleable names
fixes #2436
2017-11-12 22:31:47 +08:00
Alex Lam S.L
e7c21e87e3
fix ie8 mangling of top-level AST_SymbolCatch ( #2263 )
...
fixes #2254
2017-08-01 02:38:32 +08:00
Alex Lam S.L
a5ffe2c23f
drop unused builtin globals under unsafe ( #2236 )
...
fixes #2233
2017-07-15 15:16:11 +08:00
Alex Lam S.L
94e5e00c03
refactor compute_char_frequency() ( #2152 )
...
- minimise maintenance when updating AST
- maximise code sharing between `master` & `harmony`
2017-06-23 20:05:31 +08:00
Alex Lam S.L
343ea326c2
ensure mangling works if catch reuses a scope variable ( #2123 )
...
fixes #2120
2017-06-20 02:14:05 +08:00
Alex Lam S.L
3f961bbba0
compute uses_arguments correctly in figure_out_scope() ( #2099 )
...
fixes #2097
2017-06-15 03:28:26 +08:00
Alex Lam S.L
293c566d6c
marshal mangle[.properties].reserved from non-Array values ( #2072 )
2017-06-09 04:29:12 +08:00
Alex Lam S.L
c70fb60384
clean up lib/scope.js ( #2003 )
...
fixes #2004
2017-05-26 03:58:35 +08:00
Alex Lam S.L
3ca902258c
fix bugs with getter/setter ( #1926 )
...
- `reduce_vars`
- `side_effects`
- property access for object
- `AST_SymbolAccessor` as key names
enhance `test/ufuzz.js`
- add object getter & setter
- property assignment to setter
- avoid infinite recursion in setter
- fix & adjust assignment operators
- 50% `=`
- 25% `+=`
- 2.5% each for the rest
- avoid "Invalid array length"
- fix `console.log()`
- bypass getter
- curb recursive reference
- deprecate `-E`, always report runtime errors
2017-05-14 02:10:34 +08:00
Alex Lam S.L
c391576d52
remove support for const ( #1910 )
...
As this is not part of ES5.
2017-05-12 14:57:41 +08:00
Alex Lam S.L
4ffb6fce76
compress duplicated variable definitions ( #1817 )
...
These are surprisingly common, as people reuse the same variable name within loops or switch branches.
2017-04-17 17:11:29 +08:00
Alex Lam S.L
ec443e422c
unify CLI & API under minify() ( #1811 )
...
- rename `screw_ie8` to `ie8`
- rename `mangle.except` to `mangle.reserved`
- rename `mangle.properties.ignore_quoted` to `mangle.properties.keep_quoted`
- compact `sourceMap` options
- more stringent verification on input `options`
- toplevel shorthands
- `ie8`
- `keep_fnames`
- `toplevel`
- `warnings`
- support arrays and unquoted string values on CLI
- drop `fromString` from `minify()`
- `minify()` no longer handles any `fs` operations
- unify order of operations for `mangle_properties()` on CLI & API
- `bin/uglifyjs` used to `mangle_properties()` before even `Compressor`
- `minify()` used to `mangle_properties()` after `Compressor` but before `mangle_names()`
- both will now do `Compressor`, `mangle_names()` then `mangle_properties()`
- `options.parse` / `--parse` for parser options beyond `bare_returns`
- add `mangle.properties.builtins` to disable built-in reserved list
- disable with `--mangle-props builtins` on CLI
- `warnings` now off by default
- add `--warn` and `--verbose` on CLI
- drop `--enclose`
- drop `--export-all`
- drop `--reserved-file`
- use `--mangle reserved` instead
- drop `--reserve-domprops`
- enabled by default, disable with `--mangle-props domprops`
- drop `--prefix`
- use `--source-map base` instead
- drop `--lint`
- remove `bin/extract-props.js`
- limit exposure of internal APIs
- update documentations
closes #96
closes #102
closes #136
closes #166
closes #243
closes #254
closes #261
closes #311
closes #700
closes #748
closes #912
closes #1072
closes #1366
fixes #101
fixes #123
fixes #124
fixes #263
fixes #379
fixes #419
fixes #423
fixes #461
fixes #465
fixes #576
fixes #737
fixes #772
fixes #958
fixes #1036
fixes #1142
fixes #1175
fixes #1220
fixes #1223
fixes #1280
fixes #1359
fixes #1368
2017-04-15 23:50:50 +08:00
Alex Lam S.L
a0c3836ba0
sort options in alphabetical order ( #1743 )
...
They started off as functional groups I guess, but given the sheer number of options this is becoming too difficult to read.
2017-03-31 16:41:04 +08:00
Alex Lam S.L
c595b84032
fix catch symbol mangling ( #1734 )
...
Only need to look up the immediate non-block/catch scope for the same-name special case.
fixes #1733
2017-03-31 02:57:47 +08:00
Alex Lam S.L
65da9acce6
handle var within catch of the same name ( #1711 )
...
The following code prints `1`:
var a = 1;
!function(){
a = 4;
try{
throw 2;
} catch (a) {
var a = 3;
}
}();
console.log(a);
fixes #1708
2017-03-28 16:42:39 +08:00
Alex Lam S.L
984a21704e
fix mangle for variable declared within catch block ( #1706 )
...
fixes #1704
2017-03-28 03:26:35 +08:00
Alex Lam S.L
57ce5bd9e0
handle overlapped variable definitions ( #1691 )
...
Process variable definitions with or without assigned values against:
- `arguments`
- named function arguments
- multiple definitions within same scope
Essentially demote variable declarations with no value assignments.
Also fixed invalid use of `AST_VarDef` over `arguments` - should use a member of `AST_SymbolDeclaration` instead.
2017-03-27 01:30:21 +08:00
Alex Lam S.L
9e6b128374
fix catch variable reference in IE8 ( #1587 )
...
`AST_Scope.def_variable()` will overwrite `AST_Symbol.thedef`, so save a copy before calling.
fixes #1586
2017-03-10 03:15:21 +08:00
Alex Lam S.L
b70591be1a
handle variable declaration within catch blocks ( #1546 )
...
accounts for IE8- scoping
2017-03-05 13:13:44 +08:00
Alex Lam S.L
1f0333e9f1
stay safe with constants in IE8- ( #1547 )
...
- `undefined` etc. can be redefined at top-level for IE8-, so disable related optimisations
- fixed `--support-ie8` catch mangle bug
2017-03-05 12:51:11 +08:00
Alex Lam S.L
16cd5d57a5
consolidate evaluate & reduce_vars ( #1505 )
...
- improve marking efficiency
- apply smarter `const` replacement to `var`
fixes #1501
2017-02-26 00:40:33 +08:00
alexlamsl
4e49302916
enable collapse_vars & reduce_vars by default
...
- fix corner cases in `const` optimisation
- deprecate `/*@const*/`
fixes #1497
closes #1498
2017-02-24 01:46:57 +08:00
alexlamsl
e275148998
enhance global_defs
...
- support arrays, objects & AST_Node
- support `"a.b":1` on both cli & API
- emit warning if variable is modified
- override top-level variables
fixes #1416
closes #1198
closes #1469
2017-02-21 13:29:58 +08:00
alexlamsl
a0f4fd390a
improve reduce_vars and fix a bug
...
- update modified flag between compress() passes
- support IIFE arguments
- fix corner case with multiple definitions
closes #1473
2017-02-21 13:29:58 +08:00
alexlamsl
fa668a28b4
fix corner case in keep_fnames
...
happens when inner function:
- just below top level
- not referenced
- `unused` is disabled
closes #1445
2017-02-18 19:00:54 +08:00
alexlamsl
686a496b1c
remove unused AST_Scope.nesting & AST_SymbolRef.frame
...
they are computed but never used
closes #1444
2017-02-18 18:59:40 +08:00
Alex Lam S.L
1eaa211e09
fix mangling collision with keep_fnames ( #1431 )
...
* fix mangling collision with keep_fnames
fixes #1423
* pass mangle options to figure_out_scope()
bring command-line in line with minify()
2017-01-26 12:18:28 +01:00
Alex Lam S.L
0d7d4918eb
augment evaluate to extract within objects ( #1425 )
...
- gated by `unsafe`
- replaces previous optimisation specific to String.length
- "123"[0] => 1
- [1, 2, 3][0] => 1
- [1, 2, 3].length => 3
- does not apply to objects with overridden prototype functions
2017-01-26 12:14:18 +01:00
alexlamsl
48284844a4
add missing LHS cases which global_defs should avoid
2017-01-19 21:06:28 +01:00
Jann Horn
266ddd9639
fix uses_arguments handling (broken since 6605d15783)
...
Using the symbol declaration tracking of UglifyJS doesn't make sense here
anyway, `arguments` always comes from something in the current scope.
fixes #1299
2016-10-23 21:29:18 +02:00