Commit Graph

79 Commits

Author SHA1 Message Date
Donny/강동윤
36d960c7e9
perf(es/hygiene): Make hygiene faster (#4952) 2022-06-15 14:36:57 +00:00
Donny/강동윤
b3f6f20721
fix(es/resolver): Make catch parameter not disturb resolving (#4976) 2022-06-15 05:24:39 +00:00
Austaras
47bdc6a6b1
feat(es/minifier): Turn Array/Object calls into literals (#4947) 2022-06-12 02:36:49 +00:00
magic-akari
594089488b
feat(es/minifier): Drop new token if possible (#4932) 2022-06-11 05:27:13 +00:00
Donny/강동윤
be87494495
fix(es/minifier): Reserve more symbols on eval (#4925) 2022-06-10 08:49:56 +00:00
Donny/강동윤
0567f67664
fix(es/minifier): Apply name mangler for more cases (#4840) 2022-05-29 11:15:16 +00:00
Donny/강동윤
7f69b9c80f
test(es/minifier): Add snapshots for the mangler (#4823)
I found a way to make the name mangler parallel, but I want to ensure that we don't break anything.
2022-05-27 07:32:23 +00:00
Donny/강동윤
4b27df9f12
perf(es/minifier): Make more passes parallel (#4821) 2022-05-27 06:48:08 +00:00
brightwu
f28d9c143b
fix(es/resolver): Fix more edge cases related to catch and var (#4773) 2022-05-24 09:24:42 +00:00
Donny/강동윤
e4dee1ed33
fix(es/minifier): Consider parameters while detecting pure calls (#4748) 2022-05-23 13:04:11 +00:00
Donny/강동윤
49b3c2715c
refactor(es/minifier): Make rust-analyzer fast, really (#4746) 2022-05-23 16:16:05 +09:00
Donny/강동윤
47e6cc5190
refactor(es/minifier): Make rust-analyzer faster (#4744)
- We now use a separate crate for testing the minifier. This makes IDE much faster.
2022-05-23 15:53:01 +09:00
Donny/강동윤
73dfa95e5a
fix(es/minifier): Fix analysis of assignment patterns (#4712) 2022-05-19 05:10:12 +00:00
Donny/강동윤
274648ec26
feat(es/minifier): Improve if_return (#4694) 2022-05-18 08:39:57 +00:00
Donny/강동윤
183e884cbf
fix(es/minifier): Don't hoist functions with dead_code (#4695) 2022-05-18 07:25:25 +00:00
Donny/강동윤
36ff4f735f
test(es/minifier): Add size tests using dbg-swc (#4664) 2022-05-16 03:01:53 +00:00
Donny/강동윤
6a97c7bef8
fix(es/utils): Fix wrong apis (#4604)
# API Changes

## `swc_ecma_utils`

### Renames

 - `find_ids` => `find_pat_ids`
 - `prepend` => `prepend_stmt`
 - `as_bool` => `cast_to_bool`
 - `as_number` => `as_pure_number`
 - `as_string` => `cast_to_string`
 - (`as_pure_bool`, `cast_to_number` is not renamed)
 - `UsageFinder` => `IdentUsageFinder`.
 - `IdentFinder` => `IdentRefFinder`.

## Changes

 - Re-export of `HANDLER` from `swc_common::errors` is removed. Use `swc_common::error::HANDLER` instead.
 - Re-export of `Id` from `swc_ecma_ast` is removed. Use `swc_ecma_ast::Id` instead.
 - `ExprCtx` is used for apis related to `Expr`.
 - `preserve_effects` is now a method of `ExprCtx`. It was a top-level function.
 - `extract_side_effects_to` is now a method of `ExprCtx`. It was a top-level function.
 - `IdentUsageFinder` (previously `UsageFinder`) now takes `Id` instead of `Ident`.
 - `IdentRefFinder` (previously `IdentFinder`) now takes `Id` instead of `Ident`.
 - `ExprExt::is_ident_ref_to` is removed.
 - `Expr::is_global_ref_to` is added.
 - `:🆔:id` is removed. Use `Ident::to_id()` instead.
2022-05-11 04:36:22 +00:00
Donny/강동윤
097ff1ddc1
fix(es/minifier): Fix with and NaN (#4596) 2022-05-10 03:21:43 +00:00
Donny/강동윤
dd09cdf8b1
fix(es/minifier): Fix handling of NaN (#4593) 2022-05-09 19:08:28 +00:00
Donny/강동윤
3521ce09e7
fix(es/minifier): Consider more aliases in sequences pass (#4583) 2022-05-09 16:36:40 +00:00
Donny/강동윤
8db3442216
fix(es/minifier): Unwrap blocks more carefully (#4586) 2022-05-09 11:24:53 +00:00
Donny/강동윤
56c3010f6b
fix(es/resolver): Fix more try catch issues (#4582) 2022-05-09 17:50:30 +09:00
Donny/강동윤
9e79f9ced6
fix(es/resolver): Fix handling of a complex try catch (#4574) 2022-05-08 10:12:50 +00:00
Donny/강동윤
bf5ee018b3
test(es/minifier): Fix test system (#4571) 2022-05-08 08:27:14 +00:00
Donny/강동윤
af368eead2
fix(es/minifier): Improve sequential inliner (#4570) 2022-05-08 06:12:42 +00:00
Austaras
b3b6fd448c
feat(es/minifier): Remove duplicate control flow in nested blocks (#4569) 2022-05-08 13:07:58 +09:00
Donny/강동윤
920d9a7678
fix(es/minifier): Fix handling of template literals (#4563) 2022-05-08 01:56:38 +09:00
Donny/강동윤
c5b4ef4377
feat(es/minifier): Drop vars using sequential inliner (#4547) 2022-05-07 08:19:56 +00:00
Kristján Oddsson
3d5d234047
fix(es/minifier): Respect keepClassNames for class expressions (#4536)
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
2022-05-06 05:17:45 +00:00
Donny/강동윤
a6d404a8c2
chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00
Donny/강동윤
53610fdafc
feat(es/resolver): Use different syntax context for unresolved refs (#4436)
- We don't need a list of bindings to check if an identifier is unresolved.
 - Checking if an identifier is unresolved is now one CPU instruction.
   - Previously it was one hashmap operation.
 - This PR also improves performance, by removing the hashmaps mentioned above.
2022-04-26 07:38:50 +00:00
Donny/강동윤
9733917cc7
fix(es/minifier): Fix analysis of update expressions (#4428) 2022-04-25 12:07:27 +00:00
Donny/강동윤
4e113037e5
test(es/minifier): Use _ instead of - for terser tests (#4411) 2022-04-23 18:34:00 +00:00
Austaras
8cf3ddda6c
feat(es/minifier): Improve handling of switches (#4260) 2022-04-21 10:00:25 +00:00
Donny/강동윤
e60ae2a486
feat(es/minifier): Implement all template literal evaluation rules (#4360)
- We now handle nested template literals.
 - We now drop expressions in template literals if it's ignored.
2022-04-18 02:43:55 +00:00
Donny/강동윤
f92242dcb1
feat(es/minifier): Improve sequential inliner (#4335)
- We now skip more expressions.
2022-04-15 08:25:31 +00:00
Donny/강동윤
8886a4b572
fix(es/minifier): Respect dead_code (#4328) 2022-04-14 06:00:43 +00:00
Donny/강동윤
2002554fa2
refactor(es/minifier): Clean up logging (#4322) 2022-04-13 23:23:07 +09:00
Donny/강동윤
7e8f613272
feat(es/minifier): Enable conditionals by default (#4301) 2022-04-12 02:12:10 +00:00
Austaras
df0d572b4f
chore(es/minifier): Update terser test references (#4297) 2022-04-10 06:50:52 +00:00
Donny/강동윤
1f5cac4d41
feat(es/minifier): Implement more rules for hoist_props (#4262) 2022-04-06 11:01:45 +00:00
Donny/강동윤
ab1f440103
feat(es/minifier): Exclude local bindings from aliases (#4261)
- We now exclude bindings created by the initializer while analyzing aliases.
2022-04-06 06:28:49 +00:00
Donny/강동윤
4701da576f
feat(es/minifier): Improve inliner and evaluator (#4216) 2022-04-05 06:25:23 +00:00
Donny/강동윤
55b98fc874
fix(es/minifier): Remap variables on IIFE evaluation (#4230)
- We now check if there's pending inlining before remapping variables.
 - We now use ad-hoc type for remapping.
 - We now inline before remapping to prevent interference with inlining.
2022-04-03 11:39:05 +00:00
Donny/강동윤
10718547e0
fix(es/minifier): Fix evaluation of IIFEs (#4207)
- We now remap parameters using a new syntax context. This is required because we may copy functions, and it can result in duplicated variables with respect to the span hygiene.
 - We now visit the sequence expression generated by inlining. This is to improve performance in some cases.
 - We now remove variables from variable statements if it's identical to a parameter declared in the function.
 - IIFE evaluation is now aware of `this` being different for member expressions.
 - We now have more logic for detecting simple functions.
2022-03-31 09:11:54 +00:00
Donny/강동윤
11fe5fabd8
feat(es/minifier): Evaluate more iifes (#4200) 2022-03-30 23:35:30 +00:00
Donny/강동윤
6d3ea17aa6
feat(es/minifier): Optimize switches more correctly (#4180) 2022-03-29 04:25:15 +00:00
Donny/강동윤
a6f6799811
feat(es/minifier): Evaluate trivial expressions (#4179) 2022-03-29 01:46:09 +00:00
Donny/강동윤
6f25e5774b
feat(es/minifier): Implement more rules for dropping unused assignemnts (#4171) 2022-03-28 09:14:16 +00:00
magic-akari
bf1924d1a8
feat(es/typescript): Support optional variance annotations (#4008) 2022-03-23 14:36:37 +00:00