Commit Graph

103 Commits

Author SHA1 Message Date
Donny/강동윤
cfe575e35a
perf(es/minifier): Make expression simplifier stateless and parallel (#5819) 2022-09-11 06:18:44 +00:00
Donny/강동윤
7391cc99b1
perf(css/minifier): Use JsWord instead of &str (#5806) 2022-09-10 07:20:51 +00:00
Austaras
ee26337a25
feat(es/minifier): Inline lazily initialized variables (#5737)
Safety:

For a function-local variable, an expression with side-effects would be a call, including an indirect one with a member expression.

 - If the call is function-local, it will be analyzed by the analyzer and inliner will not work.
 - If the call is not a function-local one, it cannot modify the local variable.
2022-09-08 08:07:43 +00:00
Donny/강동윤
24b60d2b64
feat(es/minifier): Change order of renaming to align with terser (#5780)
**Description:**

 - Change the order of renaming to match one of `terser`.
2022-09-08 05:23:23 +00:00
Donny/강동윤
32a73fbf22
fix(es/minifier): Fix calculation of character frequency (#5772) 2022-09-07 04:46:21 +00:00
Austaras
90852f5aa6
fix(es/minifier): Fix analysis of assignments and classes (#5770) 2022-09-07 03:51:42 +00:00
Donny/강동윤
60ce462215
feat(es/minifier): Align name mangler with terser (#5763) 2022-09-06 21:37:58 +09:00
Donny/강동윤
8827c38faf
feat(es/minifier): Make DCE single-pass (#5699) 2022-09-01 16:30:21 +00:00
Austaras
4ef99f346b
feat(es/minifier): Relax function inline requirement (#5607) 2022-09-01 19:36:16 +09:00
Donny/강동윤
5e2b6d5551
feat(es/minifier): Remove useless ES version check (#5703) 2022-08-31 11:11:54 +00:00
Donny/강동윤
a06e6e9ce5
fix(es/minifier): Fix alias analyzer (#5639) 2022-08-26 10:06:25 +00:00
Donny/강동윤
d44bbffa02
fix(es/minifier): Revert alias analyzer work (#5634) 2022-08-26 08:45:49 +00:00
Donny/강동윤
00e635b9ea
fix(es/minifier): Improve alias analyzer (#5500) 2022-08-26 07:56:40 +00:00
Donny/강동윤
d81fe67e4b
feat(es/minifier): Improve gzipped size (#5631) 2022-08-26 05:23:01 +00:00
Austaras
69f8945911
feat(es/minifier): Remove more functions and classes (#5552) 2022-08-19 04:28:06 +00:00
Austaras
d2f3e29bb0
feat(es/minifier): Ignore recursive usage for function calls and pure calls (#5526) 2022-08-17 23:24:10 +00:00
Austaras
ca21fd0c4d
fix(es/minifier): Inline vars declared in conditional paths (#5392) 2022-08-05 13:25:28 +00:00
Donny/강동윤
3943eb24d1
feat(es/minifier): Consider char frequencies (#5375) 2022-08-03 10:20:17 +00:00
Austaras
b221f90117
fix(es/minifier): Optimize inlining function calls with a literal in arguments (#5365) 2022-08-02 11:37:40 +00:00
Donny/강동윤
64a99461ec
fix(es/minifier): Change default es version to es5 (#5333) 2022-07-29 02:40:14 +00:00
Austaras
0f254d5ce5
feat(es/codegen): Remove extra space before a private method (#5295) 2022-07-26 03:35:49 +00:00
Austaras
6573324d9c
feat(es/minifier): Calculate correct size (#5253) 2022-07-20 08:25:26 +00:00
Austaras
2e9c9bea1a
fix(es/minifier): Fix size calculation of numbers (#5232) 2022-07-17 18:07:35 +09:00
Austaras
9519e801ea
fix(es/resolver): Fix handling of block scoped functions (#5092) 2022-07-05 05:04:49 +00:00
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