Commit Graph

59 Commits

Author SHA1 Message Date
Donny/강동윤
40bb695f64
fix(es/minifier): Fix context of call/new expressions () 2022-08-14 18:56:35 +09:00
Austaras
ca21fd0c4d
fix(es/minifier): Inline vars declared in conditional paths () 2022-08-05 13:25:28 +00:00
Donny/강동윤
3943eb24d1
feat(es/minifier): Consider char frequencies () 2022-08-03 10:20:17 +00:00
Austaras
77497e4fbe
fix(es/fixer): Don't insert extra paren when left of BinExpr is UpdateExpr () 2022-08-03 08:41:40 +00:00
Austaras
b221f90117
fix(es/minifier): Optimize inlining function calls with a literal in arguments () 2022-08-02 11:37:40 +00:00
Austaras
8611161c02
fix(es/minifier): Ignore member expression without side-effects in assign position () 2022-07-31 16:40:58 +09:00
Austaras
11f495ad37
fix(es/minifier): Check if an inlined value is mutated () 2022-07-29 04:49:09 +00:00
Donny/강동윤
64a99461ec
fix(es/minifier): Change default es version to es5 () 2022-07-29 02:40:14 +00:00
Austaras
ee84842d22
fix(es/minifier): Preserve order of side-effects in sequences pass () 2022-07-24 13:55:37 +00:00
Austaras
6573324d9c
feat(es/minifier): Calculate correct size () 2022-07-20 08:25:26 +00:00
Austaras
2e9c9bea1a
fix(es/minifier): Fix size calculation of numbers () 2022-07-17 18:07:35 +09:00
Donny/강동윤
16ece4dce0
fix(es/minifier): Don't merge exported declarations () 2022-07-13 06:07:31 +00:00
Donny/강동윤
0e4a03ccc6
fix(es/minifier): Don't inline a callable expression if it's used as a reference () 2022-07-06 03:53:11 +00:00
Donny/강동윤
b76b4999cc
fix(es/codegen): Fix codegen of some non-ascii characters () 2022-07-05 10:22:25 +00:00
Donny/강동윤
eedcb114a2
test(es/minifier): Add a test case for the minifier () 2022-06-20 14:38:23 +00:00
Donny/강동윤
36d960c7e9
perf(es/hygiene): Make hygiene faster () 2022-06-15 14:36:57 +00:00
Austaras
47bdc6a6b1
feat(es/minifier): Turn Array/Object calls into literals () 2022-06-12 02:36:49 +00:00
magic-akari
594089488b
feat(es/minifier): Drop new token if possible () 2022-06-11 05:27:13 +00:00
Donny/강동윤
be87494495
fix(es/minifier): Reserve more symbols on eval () 2022-06-10 08:49:56 +00:00
Austaras
83ae6a1f1f
feat(es/minifier): Remove extra parens in BinExpr () 2022-06-05 05:52:22 +00:00
Donny/강동윤
8365c3d0df
fix(es/minifier): Make if_return to not drop required returns () 2022-05-30 06:46:01 +00:00
Donny/강동윤
0567f67664
fix(es/minifier): Apply name mangler for more cases () 2022-05-29 11:15:16 +00:00
Donny/강동윤
7f69b9c80f
test(es/minifier): Add snapshots for the mangler ()
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
brightwu
f28d9c143b
fix(es/resolver): Fix more edge cases related to catch and var () 2022-05-24 09:24:42 +00:00
Donny/강동윤
49b3c2715c
refactor(es/minifier): Make rust-analyzer fast, really () 2022-05-23 16:16:05 +09:00
Donny/강동윤
47e6cc5190
refactor(es/minifier): Make rust-analyzer faster ()
- We now use a separate crate for testing the minifier. This makes IDE much faster.
2022-05-23 15:53:01 +09:00
Donny/강동윤
dc67911f61
feat(es/minifier): Implement more skipping rules for sequences () 2022-05-20 16:01:27 +09:00
Donny/강동윤
1358f452e7
fix(es/minifier): Consider more side effects while inlining () 2022-05-20 04:57:38 +00:00
Kevin Barabash
72fbf692a4
fix(es/codegen): Don't add a newline after an arrow body () 2022-05-19 07:12:37 +00:00
Donny/강동윤
73dfa95e5a
fix(es/minifier): Fix analysis of assignment patterns () 2022-05-19 05:10:12 +00:00
Donny/강동윤
9a27b5f275
perf(es/minifier): Make minifier more parallel () 2022-05-18 13:51:25 +00:00
Donny/강동윤
183e884cbf
fix(es/minifier): Don't hoist functions with dead_code () 2022-05-18 07:25:25 +00:00
Donny/강동윤
c01476d9ae
feat(es/minifier): Enable conditionals by default () 2022-05-17 07:34:47 +00:00
Donny/강동윤
04d66dbc8b
feat(es/minifier): Enable computed_props by default () 2022-05-16 12:51:38 +00:00
Donny/강동윤
3bb4b74d94
fix(es/minifier): Consider fallthrough while merging swtich cases () 2022-05-16 12:27:24 +00:00
Donny/강동윤
36ff4f735f
test(es/minifier): Add size tests using dbg-swc () 2022-05-16 03:01:53 +00:00
Donny/강동윤
8a40b583a5
feat(es/minifier): Implement directives () 2022-05-15 10:02:55 +00:00
Donny/강동윤
56a227ad9d fix(es/minifier): Don't create direct eval ()
- `expr_simplifier`: Preserve `this`.
 - `ExprReplacer`: Inject `0` after inlining eval.
 - `MultiReplacer`: Inject `0` after inlining eval.
2022-05-12 15:14:18 +09:00
Donny/강동윤
6a97c7bef8
fix(es/utils): Fix wrong apis ()
# 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/강동윤
2ab7594b4a
fix(es/minifier): Fix switches () 2022-05-09 21:36:09 +00:00
Donny/강동윤
3521ce09e7
fix(es/minifier): Consider more aliases in sequences pass () 2022-05-09 16:36:40 +00:00
Donny/강동윤
56c3010f6b
fix(es/resolver): Fix more try catch issues () 2022-05-09 17:50:30 +09:00
Donny/강동윤
9e79f9ced6
fix(es/resolver): Fix handling of a complex try catch () 2022-05-08 10:12:50 +00:00
Austaras
b3b6fd448c
feat(es/minifier): Remove duplicate control flow in nested blocks () 2022-05-08 13:07:58 +09:00
Donny/강동윤
f9b6016d4b
fix(es/minifier): Distinguish raw and cooked while joining template literals () 2022-05-07 10:10:50 +00:00
Donny/강동윤
c5b4ef4377
feat(es/minifier): Drop vars using sequential inliner () 2022-05-07 08:19:56 +00:00
Austaras
5d3a01ad35
fix(es/minifier): Skip getter/setter when collapsing vars () 2022-05-07 16:23:13 +09:00
Donny/강동윤
a6d404a8c2
chore(repo): Configure prettier () 2022-05-04 14:25:28 +00:00
Donny/강동윤
918c9c8a21
feat(es/minifier): Drop pure new calls () 2022-04-29 07:22:13 +00:00
Donny/강동윤
7a584d755a
feat(es/minifier): Consider cost of functions for inlining () 2022-04-29 05:58:59 +00:00