Commit Graph

26 Commits

Author SHA1 Message Date
HeYunfei
a1ccc8afdf
feat(es/minifier): Make name mangler understand block scoping ()
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/5090.
 - Closes https://github.com/swc-project/swc/issues/5766.
2023-01-06 03:14:10 +00:00
Donny/강동윤
6365acc9f5
test(es/minifier): Organize terser tests ()
**Description:**

Our minifier is better than terser in some cases, so we don't need to match the output of terser exactly.
2022-10-11 08:25:11 +00:00
Donny/강동윤
8c4873f81e
test(es/minifier): Remove mangle-only snapshots ()
**Description:**

We don't have to store snapshots of all fixtures.
2022-09-28 21:35:52 +09:00
Donny/강동윤
93964a82ea
test(es/minifier): Remove analysis snapshot ()
**Description:**

This PR removes analysis snapshots as it disturbs code review process
2022-09-23 13:14:42 +09:00
Donny/강동윤
a9873e505d
perf(es/minifier): Optimize analyzer () 2022-09-20 08:21:39 +00:00
Alexander Akait
ccd618ce54
perf(html/minifier): Improve performance () 2022-09-13 14:01:41 +09:00
Austaras
ee26337a25
feat(es/minifier): Inline lazily initialized variables ()
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/강동윤
60ce462215
feat(es/minifier): Align name mangler with terser () 2022-09-06 21:37:58 +09:00
Donny/강동윤
d81fe67e4b
feat(es/minifier): Improve gzipped size () 2022-08-26 05:23:01 +00:00
Austaras
d2f3e29bb0
feat(es/minifier): Ignore recursive usage for function calls and pure calls () 2022-08-17 23:24:10 +00: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
Donny/강동윤
36d960c7e9
perf(es/hygiene): Make hygiene faster () 2022-06-15 14:36:57 +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
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/강동윤
274648ec26
feat(es/minifier): Improve if_return () 2022-05-18 08:39:57 +00:00
Donny/강동윤
36ff4f735f
test(es/minifier): Add size tests using dbg-swc () 2022-05-16 03:01:53 +00:00
Donny/강동윤
53610fdafc
feat(es/resolver): Use different syntax context for unresolved refs ()
- 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/강동윤
7e8f613272
feat(es/minifier): Enable conditionals by default () 2022-04-12 02:12:10 +00:00
Alexander Akait
634d732803
feat(es/ast): Add raw to Str () 2022-03-22 07:54:08 +00:00
Donny/강동윤
be09ea6991
feat(es/minifier): Drop noop calls () 2022-03-15 16:23:32 +09:00
Donny/강동윤
260c2a885e
feat(es/minifier): Implement more rules ()
swc_ecma_minifier:
 - `conditionals`: Preserve a conditional expression if test is not resolved.
 - `unsafe_arrows`: Optimize an anonymous function expression as an arrow expression.
 - `unsafe_methods`: Optimize a method property where the only statement is return to an arrow expression.
2022-03-04 02:09:15 +00:00
Donny/강동윤
ac1d4058f2
fix(es/minifier): Fix analyzer ()
swc_ecma_utils:
 - `collect_decls`: Support paramters of arrow expressions.

swc_ecma_minifier:
 - `analyzer`: Fix `has_property_mutation`.
2022-02-14 15:47:16 +09:00
Donny/강동윤
73e9185bba
test(es/minifier): Add snapshot testing for the analyzer () 2022-02-11 18:33:08 +09:00
Donny/강동윤
2b2f6955f2
refactor: Flatten ecmascript () 2021-11-10 19:00:54 +09:00