Austaras
83c7887600
fix(es/minifier): Remove more pure calls ( #5900 )
2022-09-19 12:21:15 +00:00
Donny/강동윤
0bbcfe15ee
test(es/minifier): Add a test for a fixed issue ( #5897 )
2022-09-19 17:25:49 +09:00
Donny/강동윤
4e656af1ec
feat(es/minifier): Drop variable from the sequential inliner ( #5896 )
...
**Description:**
We now drop variable declarations if we are going to eliminate the only usage.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5693 .
2022-09-19 07:40:04 +00:00
IWANABETHATGUY
7d6d04b421
fix(es/codegen): Drop the last comma in an array literal ( #5877 )
...
**Description:**
Drop the last comma in an array literal.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5692 .
2022-09-16 15:48:28 +09:00
Donny/강동윤
c3fa96b21b
fix(es/minifier): Fix unicode handling ( #5875 )
2022-09-15 14:45:33 +00:00
magic-akari
90d311c042
fix(es/minifier): Fix handling of .toFixed
call without an argument ( #5868 )
2022-09-15 16:00:36 +09:00
Donny/강동윤
991a34e0c2
fix(es/minifier): Remove fake_block
while calculating next scope ( #5869 )
...
**Description:**
We now remove `fake_block` mark from `with_ctx`.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5865
2022-09-15 06:04:47 +00:00
Alexander Akait
7f62fa6227
perf(html): Reduce memory usage ( #5867 )
2022-09-15 04:17:05 +00:00
Austaras
63fb0c4ad3
feat(es/minifier): Move assign with seq init into seq ( #5847 )
2022-09-14 12:57:18 +00:00
Donny/강동윤
32f18068ad
fix(es/minifier): Preserve more side effects ( #5853 )
...
**Description:**
We now preserve more side effects.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5680 .
2022-09-14 06:51:56 +00:00
magic-akari
2b2464271a
fix(es/codegen): Remove redundant ;
after export default decl ( #5851 )
2022-09-14 06:07:15 +00:00
Donny/강동윤
a5f7b6946f
fix(es/minifier): Don't replace parameters of IIFE if it's recursive ( #5852 )
...
**Description:**
While investigating, I found that problem is not the analysis of recursive functions. Instead, it was a problem with the IIFE evaluator, which replaces parameters even if it's recursive.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5846
2022-09-14 05:02:14 +00:00
Donny/강동윤
0284c1bf40
test(es/transforms): Enable tests for fixed issues ( #5845 )
2022-09-13 10:32:00 +00:00
Alexander Akait
ccd618ce54
perf(html/minifier): Improve performance ( #5838 )
2022-09-13 14:01:41 +09:00
Austaras
8567a38c4a
feat(es/minifier): Extend inlining of identifiers to multi-usage ( #5832 )
2022-09-13 03:52:47 +00:00
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
Donny/강동윤
f11461d3f5
test(es): Enable tests for fixed issues ( #5784 )
2022-09-08 15:05:39 +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
Austaras
948d708144
fix(es/minifier): Don't drop parameters in an exported function ( #5757 )
2022-09-06 10:39:23 +09:00
Donny/강동윤
6ba6da62d7
perf(es/minifier): Make dead branch remover parallel ( #5734 )
2022-09-04 07:33:26 +00:00
Austaras
5b2d024788
feat(es/minifier): Relax requirement for IIFE invokation ( #5721 )
2022-09-03 07:33:31 +00:00
Donny/강동윤
5e151c8a8e
feat(es/minifier): Support cycles in DCE ( #5715 )
2022-09-03 04:41:54 +00: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/강동윤
1085667049
perf(es/minifier): Enable parallel processing ( #5705 )
2022-09-01 13:36:30 +09:00
Donny/강동윤
5e2b6d5551
feat(es/minifier): Remove useless ES version check ( #5703 )
2022-08-31 11:11:54 +00:00
Donny/강동윤
217f519940
feat(es/minifier): Ignore closure in initializer from sequential inliner ( #5702 )
2022-08-31 10:33:22 +00:00
Donny/강동윤
fd39bb6bff
fix(es/minifier): Don't inline variables declared multiple times ( #5667 )
2022-08-30 07:52:21 +00:00
Donny/강동윤
d43334eb92
feat(es/minifier): Remove redundant check ( #5664 )
2022-08-30 12:22:18 +09:00
Donny/강동윤
537449e53b
fix(es/codegen): Emit trailing semicolon ( #5659 )
2022-08-29 10:10:55 +00:00
Donny/강동윤
100f359e5d
fix(es/minifier): Fix optimization of template literals with escape ( #5650 )
2022-08-28 03:15:12 +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
Donny/강동윤
7f5095dd5e
test(es/minifier): Add tests for size ( #5561 )
2022-08-19 06:03:42 +00:00
Austaras
69f8945911
feat(es/minifier): Remove more functions and classes ( #5552 )
2022-08-19 04:28:06 +00:00
Donny/강동윤
7487e3341d
feat(es/minifier): Optimize more string property names ( #5545 )
2022-08-18 11:58:05 +09:00
Donny/강동윤
935a2fbd00
feat(dbg-swc): Improve minifier comparator ( #5541 )
2022-08-18 09:37:19 +09: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
5aa96e00d8
fix(es/minifier): Remove recklessly inline ( #5528 )
2022-08-17 13:06:01 +00:00
Donny/강동윤
69ce1b24d5
test(es/minifier): Remove useless, slow tests ( #5502 )
2022-08-17 15:12:30 +09:00
Donny/강동윤
40bb695f64
fix(es/minifier): Fix context of call/new expressions ( #5487 )
2022-08-14 18:56:35 +09:00
Donny/강동윤
3eb1f4b2b1
chore(ci): Fix lints ( #5462 )
2022-08-12 13:13:35 +00:00
Donny/강동윤
7b8658eef2
test(es/minifier): Organize simple size tests ( #5402 )
2022-08-06 22:01:01 +09:00
Austaras
ca21fd0c4d
fix(es/minifier): Inline vars declared in conditional paths ( #5392 )
2022-08-05 13:25:28 +00:00
Donny/강동윤
86da5441e6
test(es/minifier): Organize simple size tests ( #5403 )
2022-08-05 16:42:59 +09:00
Donny/강동윤
a46669d334
test(es/minifier): Add snapshots of compressed libraries ( #5389 )
2022-08-04 08:32:59 +00:00
Austaras
e37b7e8caa
feat(es/codegen): Remove more whitespaces from BinExpr
( #5380 )
2022-08-04 16:52:06 +09:00
Donny/강동윤
84a1ef856a
test(es/minifier): Update the golden list ( #5378 )
2022-08-03 21:17:47 +09:00
Donny/강동윤
3943eb24d1
feat(es/minifier): Consider char frequencies ( #5375 )
2022-08-03 10:20:17 +00:00
Austaras
77497e4fbe
fix(es/fixer): Don't insert extra paren when left of BinExpr
is UpdateExpr
( #5376 )
2022-08-03 08:41:40 +00:00
Donny/강동윤
4fdbe40c74
feat(es/minifier): Remove duplicate var
declarations ( #5373 )
2022-08-03 13:05:56 +09:00
Austaras
b221f90117
fix(es/minifier): Optimize inlining function calls with a literal in arguments ( #5365 )
2022-08-02 11:37:40 +00:00
Austaras
8611161c02
fix(es/minifier): Ignore member expression without side-effects in assign position ( #5344 )
2022-07-31 16:40:58 +09:00
Austaras
11f495ad37
fix(es/minifier): Check if an inlined value is mutated ( #5318 )
2022-07-29 04:49:09 +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
ee84842d22
fix(es/minifier): Preserve order of side-effects in sequences pass ( #5283 )
2022-07-24 13:55:37 +00:00
Donny/강동윤
037a53d5d1
perf(es/ast): Use Atom
in some places ( #5271 )
2022-07-22 20:09:25 +09:00
Austaras
6573324d9c
feat(es/minifier): Calculate correct size ( #5253 )
2022-07-20 08:25:26 +00:00
Austaras
3f0856db2e
feat(es/codegen): Optimize number and bigint literal ( #5223 )
2022-07-18 03:27:03 +00:00
Austaras
2e9c9bea1a
fix(es/minifier): Fix size calculation of numbers ( #5232 )
2022-07-17 18:07:35 +09:00
Donny/강동윤
16ece4dce0
fix(es/minifier): Don't merge exported declarations ( #5193 )
2022-07-13 06:07:31 +00:00
Donny/강동윤
d8f57abd26
perf(es/minifier): Remove wrong logic ( #5178 )
2022-07-11 11:37:13 +00:00
Donny/강동윤
0e4a03ccc6
fix(es/minifier): Don't inline a callable expression if it's used as a reference ( #5118 )
2022-07-06 03:53:11 +00:00
Donny/강동윤
b76b4999cc
fix(es/codegen): Fix codegen of some non-ascii characters ( #5108 )
2022-07-05 10:22:25 +00:00
Austaras
9519e801ea
fix(es/resolver): Fix handling of block scoped functions ( #5092 )
2022-07-05 05:04:49 +00:00
Donny/강동윤
eedcb114a2
test(es/minifier): Add a test case for the minifier ( #5013 )
2022-06-20 14:38:23 +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
Donny/강동윤
99a474cb2d
refactor(es/minifier): Use Program
instead of Module
( #4969 )
2022-06-14 16:33:38 +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
Austaras
83ae6a1f1f
feat(es/minifier): Remove extra parens in BinExpr
( #4878 )
2022-06-05 05:52:22 +00:00
Donny/강동윤
8365c3d0df
fix(es/minifier): Make if_return
to not drop required returns ( #4847 )
2022-05-30 06:46:01 +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
Donny/강동윤
073b1469e6
fix(es/minifier): Don't create names which is same as an unresolved var ( #4806 )
2022-05-26 09:27:24 +00:00
Donny/강동윤
1c48a8c8f4
fix(es/minifier): Consider side effects while removing an object spread ( #4788 )
2022-05-26 07:37:34 +00:00
Donny/강동윤
38a866a900
test(es): Make execution tests faster ( #4789 )
2022-05-25 06:23:35 +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/강동윤
0f85f7b9de
chore(ci): Fix CI ( #4747 )
2022-05-23 07:47:05 +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/강동윤
a51816a577
feat(es/minifier): Handle prefix update expressions with sequential inliner ( #4741 )
2022-05-23 04:29:31 +00:00
Donny/강동윤
9e42382091
feat(es/minifier): Implement pure_funcs
( #4710 )
2022-05-22 12:07:28 +00:00
Donny/강동윤
dc67911f61
feat(es/minifier): Implement more skipping rules for sequences
( #4716 )
2022-05-20 16:01:27 +09:00
Donny/강동윤
1358f452e7
fix(es/minifier): Consider more side effects while inlining ( #4715 )
2022-05-20 04:57:38 +00:00
Kevin Barabash
72fbf692a4
fix(es/codegen): Don't add a newline after an arrow body ( #4711 )
2022-05-19 07:12:37 +00:00
Donny/강동윤
73dfa95e5a
fix(es/minifier): Fix analysis of assignment patterns ( #4712 )
2022-05-19 05:10:12 +00:00
Donny/강동윤
6f565fbb3a
test(es/minifier): Categorize more tests ( #4709 )
2022-05-19 04:33:11 +00:00
Donny/강동윤
9a27b5f275
perf(es/minifier): Make minifier more parallel ( #4699 )
2022-05-18 13:51:25 +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/강동윤
c01476d9ae
feat(es/minifier): Enable conditionals
by default ( #4687 )
2022-05-17 07:34:47 +00:00
Donny/강동윤
04d66dbc8b
feat(es/minifier): Enable computed_props
by default ( #4678 )
2022-05-16 12:51:38 +00:00
Donny/강동윤
3bb4b74d94
fix(es/minifier): Consider fallthrough while merging swtich cases ( #4672 )
2022-05-16 12:27:24 +00:00
Donny/강동윤
ba6688a783
feat(dbg-swc): Make reducer parallel ( #4676 )
2022-05-16 12:49:42 +09:00
Donny/강동윤
36ff4f735f
test(es/minifier): Add size tests using dbg-swc
( #4664 )
2022-05-16 03:01:53 +00:00
Donny/강동윤
8a40b583a5
feat(es/minifier): Implement directives
( #4668 )
2022-05-15 10:02:55 +00:00
Donny/강동윤
96cec97b2c
fix(es/minifier): Don't inline a function if we need referential equality ( #4665 )
2022-05-15 09:37:34 +00:00
Donny/강동윤
eb8508f88c
feat(es/codegen): Implement ascii-only ( #4660 )
2022-05-15 05:07:21 +00:00
Donny/강동윤
053f42b3aa
feat(es/minifier): Improve minifier ( #4655 )
...
swc_ecma_transforms_base:
- Improved `fixer`.
swc_ecma_minifier:
- `ignore_return_value`: Support computed access to array literals.
2022-05-14 07:06:03 +00:00
Donny/강동윤
9c190f0a8e
fix(es/minifier): Fix optimization of spread ( #4639 )
2022-05-12 09:20:44 +00:00
Donny/강동윤
79f87e03db
test(es/minifier): Execute more tests ( #4636 )
2022-05-12 16:28:52 +09:00
Donny/강동윤
56a227ad9d
fix(es/minifier): Don't create direct eval
( #4634 )
...
- `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 ( #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/강동윤
6918e3a4fb
test(es/minifier): Postpone tests which can be verified by execution tests ( #4600 )
2022-05-10 14:47:37 +09:00
Donny/강동윤
859dc440b4
fix(es/minifier): Preserve more this
( #4599 )
2022-05-10 05:20:36 +00:00
Donny/강동윤
d611d543ea
fix(es/fixer): Handle new yield
( #4598 )
2022-05-10 04:17:11 +00:00
Donny/강동윤
8944a3bdf5
fix(es/minifier): Fix switch with a unknown case ( #4597 )
2022-05-10 03:55:34 +00:00
Donny/강동윤
097ff1ddc1
fix(es/minifier): Fix with
and NaN
( #4596 )
2022-05-10 03:21:43 +00:00
Donny/강동윤
2ab7594b4a
fix(es/minifier): Fix switches ( #4595 )
2022-05-09 21:36:09 +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/강동윤
7e80c10cba
fix(es/minifier): Don't create an invalid labeled statement ( #4581 )
2022-05-09 09:15:12 +00:00
Donny/강동윤
56c3010f6b
fix(es/resolver): Fix more try catch issues ( #4582 )
2022-05-09 17:50:30 +09:00
Donny/강동윤
e43689b7d5
fix(es/minifier): Preserve more identifiers if eval
or with
exists ( #4580 )
2022-05-09 07:17:33 +00:00
Donny/강동윤
7fc9bbccd9
feat(config): Make all configuration overridable ( #4575 )
2022-05-09 05:38:27 +00: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/강동윤
f9b6016d4b
fix(es/minifier): Distinguish raw
and cooked
while joining template literals ( #4559 )
2022-05-07 10:10:50 +00:00
Donny/강동윤
c5b4ef4377
feat(es/minifier): Drop vars using sequential inliner ( #4547 )
2022-05-07 08:19:56 +00:00
Austaras
5d3a01ad35
fix(es/minifier): Skip getter/setter when collapsing vars ( #4557 )
2022-05-07 16:23:13 +09:00
Donny/강동윤
b0efd00f38
test(es/minifier): Ignore difference of parens ( #4546 )
2022-05-07 06:08:23 +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/강동윤
3d3e3bb1d2
test(es/minifier): Categorize more tests ( #4538 )
2022-05-06 13:54:32 +09:00
Donny/강동윤
a6d404a8c2
chore(repo): Configure prettier
( #4523 )
2022-05-04 14:25:28 +00:00
Donny/강동윤
09ba3c0e68
feat(es/minifier): Add pristine_globals
( #4480 )
2022-04-29 08:40:16 +00:00
Donny/강동윤
918c9c8a21
feat(es/minifier): Drop pure new
calls ( #4478 )
2022-04-29 07:22:13 +00:00
Donny/강동윤
7a584d755a
feat(es/minifier): Consider cost of functions for inlining ( #4470 )
2022-04-29 05:58:59 +00:00
Donny/강동윤
273954640a
feat(es/minifier): Drop more returns ( #4471 )
2022-04-28 13:28:33 +00:00
Donny/강동윤
233c4d5b86
fix(es/minifier): Fix skipping logic of sequential inliner ( #4469 )
2022-04-28 11:41:41 +00:00
Donny/강동윤
effc85df57
fix(es/minifier): Disable some passes for hoist_props
( #4468 )
2022-04-28 08:32:03 +00:00
Donny/강동윤
0bc0bae90d
fix(es/async-generator): Fix yield*
in async generators ( #4452 )
2022-04-28 04:14:17 +00:00
Austaras
ec7dfb9209
chore(es/minifier): Don't run tests with infinite loops ( #4448 )
2022-04-27 02:21:39 +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/강동윤
8048597c9e
feat(es/optimization): Accept top level mark from simplifiers ( #4434 )
2022-04-25 15:31:59 +00:00
Donny/강동윤
8118569045
fix(es/minifier): Remove wrong logic for optimizing delete
s ( #4429 )
2022-04-25 12:32:02 +00:00
Donny/강동윤
9733917cc7
fix(es/minifier): Fix analysis of update expressions ( #4428 )
2022-04-25 12:07:27 +00:00
Donny/강동윤
8ab12fd97b
fix(es/minifier): Preserve more side effects ( #4420 )
2022-04-25 06:56:19 +00:00
Donny/강동윤
aa19b65f9c
fix(es/minifier): Don't drop arguments to an IIFE without body ( #4419 )
2022-04-24 15:27:51 +00:00
Donny/강동윤
9b34ecfd2e
test(es/minifier): Categorize tests ( #4410 )
2022-04-24 12:11:02 +00:00
Donny/강동윤
f787f8c819
test(es/minifier): Execute terser tests if possible ( #4418 )
2022-04-24 11:40:39 +00:00
Austaras
83244add33
fix(es/minifier): Remove the last break in the last BlockStmt
( #4413 )
2022-04-24 03:26:49 +00:00
Donny/강동윤
4e113037e5
test(es/minifier): Use _
instead of -
for terser tests ( #4411 )
2022-04-23 18:34:00 +00:00
Donny/강동윤
ab88637937
test(es/minifier): Split tests into improvement and stabilization ( #4409 )
2022-04-23 13:40:28 +00:00
Donny/강동윤
375cc5975a
fix(es/minifier): Disable conditionals
by default ( #4391 )
2022-04-22 10:44:53 +09:00
Austaras
8cf3ddda6c
feat(es/minifier): Improve handling of switches ( #4260 )
2022-04-21 10:00:25 +00:00
Donny/강동윤
87859e373d
fix(es/minifier): Preserve more labels ( #4380 )
2022-04-21 07:23:50 +00:00
Donny/강동윤
922299a490
fix(es/minifier): Don't drop labels if required ( #4370 )
2022-04-20 13:34:21 +00:00
Donny/강동윤
4a8b1dad1d
test(es/minifier): Organize tests ( #4375 )
2022-04-20 15:52:03 +09:00
Donny/강동윤
a8eb00cc54
perf(es/minifier): Change default value of passes
to 3
( #4373 )
2022-04-19 22:02:33 +00:00
Donny/강동윤
a8ed5ba357
fix(es/minifier): Apply name mangler as much as we can ( #4365 )
2022-04-19 17:20:12 +09:00
Donny/강동윤
128175c329
fix(es/minifier): Fix default values of toplevel
( #4366 )
2022-04-19 07:31:48 +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/강동윤
2e095face5
feat(es/minifier): Improve evaluation of template literals ( #4359 )
2022-04-18 08:43:54 +09:00
Donny/강동윤
e13b8625f2
feat(es/minifier): Implement more evaluation rules ( #4356 )
...
- We now handle `array.join` in parallel optimizer.
- We now handle `[].join` of template literals.
- We now optimize a template literal as a string addition, in unsafe mode.
2022-04-17 22:16:21 +00:00
Donny/강동윤
b3b95acc75
feat(es/minifier): const
=> let
( #3654 )
2022-04-17 15:52:29 +00:00
Austaras
5a5e41aaaa
fix(es/minifier): Preserve vars in dead branches ( #4345 )
2022-04-17 08:15:14 +00:00
Donny/강동윤
4110fcb961
fix(es/minifier): Inline before cloning ( #4338 )
2022-04-15 11:01:29 +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/강동윤
0245e26af5
fix(es/codegen): Fix overflow of numeric literals ( #4321 )
2022-04-13 10:16:51 +00:00
Alexander Akait
81370d16cb
fix(css/parser): Parse legacy calc
s ( #4320 )
2022-04-13 07:02:31 +00:00
Donny/강동윤
74a5087989
feat(es/minifier): Enable dead_code
by default ( #4309 )
2022-04-12 03:40:10 +00:00
Donny/강동윤
7e8f613272
feat(es/minifier): Enable conditionals
by default ( #4301 )
2022-04-12 02:12:10 +00:00
那里好脏不可以
37a8c90750
chore(*): Typo + fomatting ( #4304 )
2022-04-11 18:45:58 +00:00
Austaras
df0d572b4f
chore(es/minifier): Update terser test references ( #4297 )
2022-04-10 06:50:52 +00:00
Donny/강동윤
c961371c31
fix(es/minifier): Fix handling of eval
( #4273 )
2022-04-08 08:56:28 +00:00
Donny/강동윤
434dcf4af7
refactor(es/minifier): Merge code for multi-replacer ( #4269 )
2022-04-07 08:08:42 +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
Alexander Akait
f39d3aca4d
feat(es/ast): Add raw
to Num
( #4245 )
2022-04-05 12:46:35 +00:00
Donny/강동윤
350a19587e
fix(es/minifier): Fix infinite loops ( #4250 )
...
- We now don't mark changes due to `negate_cost` as a change.
2022-04-05 07:29:10 +00:00
Donny/강동윤
4701da576f
feat(es/minifier): Improve inliner and evaluator ( #4216 )
2022-04-05 06:25:23 +00:00
magic-akari
6a51d0471a
fix(es/minifier): Handle empty RegExp ( #4235 )
2022-04-04 03:46:07 +00:00
Donny/강동윤
fe358ad0b9
feat(es/minifier): Improve sequential inlining ( #4231 )
2022-04-03 13:13:15 +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/강동윤
9a9a4f37d8
fix(es/minifier): Fix react-ace
( #4183 )
2022-03-29 10:13: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
Donny/강동윤
b37dafbd27
feat(es/minifier): Implement rules for optimizing loops ( #4157 )
2022-03-25 12:08:14 +00:00
Donny/강동윤
97dfcb9ccb
chore(es/minifier): Add logging ( #4156 )
2022-03-25 06:44:07 +00:00
Donny/강동윤
ee5c48c935
feat(es/minifier): Implement more rules for optimizing for-if-break ( #4140 )
2022-03-24 00:49:32 +00:00
Donny/강동윤
1d3763d96c
feat(es/minifier): Implement some unsafe evaluation rules ( #4133 )
2022-03-23 22:56:13 +00:00
Alexander Akait
48f3dc8cc4
feat(es/codegen): Compress \t
in string literals more ( #4131 )
2022-03-23 21:37:03 +00:00
magic-akari
bf1924d1a8
feat(es/typescript): Support optional variance annotations ( #4008 )
2022-03-23 14:36:37 +00:00
Alexander Akait
f5a5217506
fix(es/codegen): Fix codegen of template literals ( #4124 )
2022-03-23 12:39:47 +00:00
Donny/강동윤
13b2f38cdd
fix(es/typescript): Collect all bindings in strip
( #4118 )
2022-03-22 10:03:58 +00:00
Alexander Akait
634d732803
feat(es/ast): Add raw
to Str
( #4071 )
2022-03-22 07:54:08 +00:00
Donny/강동윤
4a9817f003
fix(es/minifier): Consider side effects while lifting sequences ( #4116 )
2022-03-22 06:25:19 +00:00
Donny/강동윤
c6f8742669
feat(es/minifier): Implement more evaluation rules ( #4030 )
2022-03-21 20:07:59 +09:00
Alexander Akait
bd444c0ceb
fix(es/codegen): Fix codegen of string literals ( #4037 )
2022-03-16 14:25:26 +00:00
Donny/강동윤
be09ea6991
feat(es/minifier): Drop noop calls ( #4019 )
2022-03-15 16:23:32 +09:00
Donny/강동윤
a23af2dea2
feat(es/minifier): Compress more comparisons ( #3996 )
2022-03-13 09:11:16 +00:00
Donny/강동윤
64ca5bae4d
feat(es/minifier): Implement more rules for arrows
( #3992 )
2022-03-13 03:27:15 +00:00
magic-akari
04db7e2a9b
perf(es/minifier): Refactor base54 ( #3989 )
2022-03-12 15:36:42 +00:00
Donny/강동윤
76e646804a
fix(es/parser): Parse if-else chain iteratively ( #3961 )
2022-03-11 09:10:54 +00:00
underfin
91a302a672
fix(es/minifier): Preserve fuction parameters used for template literals in evaluate
and reduce_vars
( #3949 )
2022-03-10 15:21:06 +00:00
underfin
cc564ff6c5
fix(es/minifier): Skip exported vars while collapsing vars ( #3928 )
2022-03-10 06:19:25 +00:00
Donny/강동윤
9e4dea6663
feat(es/minifier): Improve dropping of unused vars ( #3923 )
2022-03-09 15:43:01 +00:00
Austaras
bd838ac5a9
feat(es/minifier): Remove pure calls ( #3925 )
2022-03-09 11:55:31 +00:00
Austaras
7cfa930a62
feat(es/fixer): Remove extra parens around IIFE in statements ( #3918 )
2022-03-08 14:35:18 +00:00
Austaras
9dd0105c5b
feat(es/fixer): Remove extra parens around iife in expression position ( #3887 )
2022-03-07 03:51:57 +00:00
Donny/강동윤
a2643608a7
feat(es/minifier): Implement pure_getters
partially ( #3872 )
2022-03-05 20:18:52 +00:00
Donny/강동윤
260c2a885e
feat(es/minifier): Implement more rules ( #3841 )
...
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/강동윤
0fc819e2ef
fix(es/minifier): Support declaring multiple bindings with the same name ( #3837 )
2022-03-04 06:58:39 +09:00
Donny/강동윤
364532e9a7
feat(es/minifier): Improve sequential inlining ( #3820 )
2022-03-03 19:18:43 +00:00
Donny/강동윤
043fba274e
fix(es/hygiene): Fix renaming bugs ( #3824 )
2022-03-03 06:21:13 +00:00
Donny/강동윤
8a468f7544
fix(es/minifier): Don't reorder unnecessarily ( #3817 )
2022-03-02 08:57:50 +00:00
Donny/강동윤
89388e6ac3
fix(es/minifier): Preserve more variables ( #3805 )
2022-03-02 07:13:57 +00:00
Donny/강동윤
789eb7baa9
feat(es/minifier): Drop more function parameters in strict mode ( #3814 )
2022-03-02 06:41:11 +00:00
Austaras
e1b13eb21a
feat(es/codegen): Optimize output of new expressions without arguments ( #3800 )
2022-03-01 10:55:49 +00:00
Donny/강동윤
8beaa202e2
fix(es/minifier): Fix optimizations of terminating expressions ( #3794 )
2022-03-01 09:55:45 +00:00
Donny/강동윤
73cab638a1
fix(es/minifier): Preserve unresolved references ( #3780 )
...
swc_ecma_minifier:
- `pure`: Add an optional list of bindings.
- `pure`: Drop identifier only if we have the complete list of bindings.
- `pure`: Allow using `GLOBALS`.
- `pure`: Drop some pure member expressions.
- Move identifier dropping logic from the stateful optimizer to the pure optimizer.
- `pure`: Drop more references to global declarations.
2022-02-28 16:31:13 +00:00
Donny/강동윤
86072b57f9
test(es/minifier): Prepare porting more rules from terser
( #3779 )
2022-02-28 13:49:10 +00:00
Donny/강동윤
714e05e553
feat(es/minifier): Consider arguments
while dropping unused assignments ( #3775 )
...
swc_ecma_minifier:
- `analyze`: Track usage of `arguments`.
2022-02-28 21:57:09 +09:00
Donny/강동윤
cfc036381a
fix(es/minifier): Fix inlining logic ( #3776 )
...
swc_ecma_minifier:
- Make `inline_vars_in_node` use `MultiReplacer`.
2022-02-28 12:07:12 +00:00
Donny/강동윤
e7f7f69db4
fix(es/minifier): Disable some operations for asm.js codes ( #3572 )
2022-02-28 07:40:04 +00:00
Donny/강동윤
3d944656bf
refactor(es): Make compilation faster ( #3749 )
2022-02-26 06:41:14 +00:00
Donny/강동윤
da2c77d9af
perf(es/minifier): Parallelize join_vars
( #3655 )
2022-02-21 05:34:32 +00:00
Donny/강동윤
de6effc6e1
feat(es/minifier): Drop more unused vars ( #3656 )
2022-02-21 04:35:56 +00:00
Donny/강동윤
e9fabd61e8
feat(es/minifier): Improve name mangler ( #3638 )
2022-02-20 12:08:26 +00:00
Donny/강동윤
10adf1e548
feat(es/minifier): Merge exports ( #3643 )
2022-02-20 10:44:21 +00:00
Donny/강동윤
d2c94416a8
feat(es/minifier): Treat !0
as a literal while inlining ( #3631 )
2022-02-19 17:33:36 +09:00
Donny/강동윤
bfc9897e34
fix(es/minifier): Disable name mangler if eval
is used ( #3526 )
2022-02-15 07:29:45 +00:00
Donny/강동윤
ac1d4058f2
fix(es/minifier): Fix analyzer ( #3557 )
...
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 ( #3529 )
2022-02-11 18:33:08 +09:00
Donny/강동윤
a7f0e84bbf
feat(es/minifier): Drop useless assignments ( #3528 )
...
testing:
- Allow skipping diff using an environment variable `DIFF`.
swc_ecma_minifier:
- `pure`: Drop useless assignemnts.
2022-02-11 08:43:48 +00:00
William Tetlow
5488159ba5
feat(es/minifier): Implement reserved
mangle option ( #3476 )
2022-02-10 13:53:47 +09:00
Donny/강동윤
9b76783281
refactor(common): Cleanup & rustfmt ( #3495 )
...
swc_common:
- Merge identical source codes.
swc_css_parser:
- Deny `clippy::all`.
- Fix lints.
2022-02-09 06:33:32 +00:00
Donny/강동윤
292add7d26
fix(es/minifier): Make sequences
less aggressive ( #3480 )
...
swc_ecma_minifier:
- `sequences`: Abort on RHS contains the left id.
2022-02-08 19:10:22 +09:00