Donny/강동윤
9ce3df091f
feat(es/minifier): Distinguish calls in alias analyzer ( #6080 )
...
**Description:**
This PR improves the alias analyzer by distinguishing call and reference, thus reducing the number of identifiers.
---
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2022-10-08 03:15:18 +00:00
Austaras
c9427f1ec4
fix(es/minifier): Improve infection analysis ( #6044 )
2022-10-06 18:12:09 +09:00
Donny/강동윤
38df5978c1
fix(es/minifier): Mark delete
as a property mutation ( #6063 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/6004 .
2022-10-06 04:47:58 +00:00
Donny/강동윤
d65fba134d
fix(es/minifier): Fix infection analysis of sequential inliner ( #6053 )
...
**Description:**
This PR fixes the callee issue by fixing the infection analyzer.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/6047
2022-10-06 02:46:22 +00:00
Donny/강동윤
197c4e269d
fix(es/minifier): Don't evaluate String.fromCharCode
for non-ascii values ( #6033 )
2022-10-04 16:46:59 +09:00
Austaras
c4850997a2
feat(es/minifier): Inline vars initialized before the declaration ( #6027 )
2022-10-03 08:58:38 +00:00
Donny/강동윤
877936f626
feat(es/minifier): Clone trivial literals in sequential inliner ( #6005 )
...
**Description:**
As our minifier is two-pass by default, this is enough.
At the first pass, we inline all numeric literals using sequential inliner, and minifier can then inline constants correctly in the second pass.
2022-10-03 07:20:48 +00:00
Austaras
61807abf6e
feat(es/minifier): Inline function calls in more cases ( #6010 )
2022-10-01 18:18:45 +09:00
Donny/강동윤
286334c4d0
feat(es/minifier): Drop vars from sequential inliner ( #5993 )
...
**Description:**
This PR renames `CloningMultiReplacer` to `Finalizer` and makes it handle the removal of unused variables. Also, this PR improves the sequential inliner so we can drop variables within a single pass.
2022-09-30 09:43:31 +00:00
Donny/강동윤
aeb7f300a8
feat(es/minifier): Invoke sequential inliner for inlined IIFEs ( #5991 )
...
**Description:**
Inlined IIFEs have the exact pattern sequential inliner wants, so it's good to invoke it.
2022-09-29 11:03:06 +00:00
Donny/강동윤
f8358fbe2b
fix(es/minifier): Remove wrong variable joiner pass ( #5992 )
...
**Description:**
We had two passes for joining variables. This PR removes one in the full optimizer, which is wrong.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5989 .
2022-09-29 19:11:18 +09:00
Austaras
1a11cfd46f
feat(es/minifier): Improve fn-local analysis for better inlining ( #5955 )
2022-09-29 14:16:28 +09:00
Donny/강동윤
8c4873f81e
test(es/minifier): Remove mangle-only snapshots ( #5979 )
...
**Description:**
We don't have to store snapshots of all fixtures.
2022-09-28 21:35:52 +09:00
Donny/강동윤
33a15c8d82
fix(es/minifier): Fix analysis of parameters ( #5954 )
...
**Description:**
Although the author of the issue talked about `@react-pdf/renderer`, it's a bug related to `brotli`, not react pdf renderer.
After investigation, I found that the bug is caused by not marking parameters as initialized. So I fixed the analyzer.
**Related issue:**
- https://github.com/vercel/next.js/issues/40803 .
2022-09-27 12:19:36 +09:00
Donny/강동윤
9d1974248d
fix(es/minifier): Fix skipping logic of sequential inliner ( #5956 )
...
**Description:**
This PR implements `is_skippable_for_seq` fully.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5935 .
2022-09-26 15:05:52 +00:00
Donny/강동윤
97647861bf
fix(es/minifier): Track aliasing via assignments ( #5940 )
2022-09-23 14:22:41 +09:00
Donny/강동윤
93964a82ea
test(es/minifier): Remove analysis snapshot ( #5939 )
...
**Description:**
This PR removes analysis snapshots as it disturbs code review process
2022-09-23 13:14:42 +09:00
Donny/강동윤
7bcaaef4f7
feat(es/minifier): Mangle labels ( #5934 )
...
**Description:**
This PR adds code to mangle labels.
2022-09-22 23:24:05 +09:00
Donny/강동윤
e9c704182b
feat(es/minifier): Improve analysis of reassignments ( #5931 )
2022-09-22 10:22:18 +00:00
Donny/강동윤
19ce2737b1
feat(es/minifier): Collapse let
without init ( #5909 )
...
**Description:**
This patch applies the variable collapsing logic for the variables declared with `var` to the variables declared with `let`. This requires some patch about the behavior of visitors about `BlockStmt`, so this patch includes relevant changes.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5696 .
2022-09-21 15:04:29 +00:00
Donny/강동윤
e303f7e853
fix(es/minifier): Fix analysis of assignments ( #5924 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5910
2022-09-21 11:33:25 +00:00
Donny/강동윤
a9873e505d
perf(es/minifier): Optimize analyzer ( #5908 )
2022-09-20 08:21:39 +00: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
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
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/강동윤
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
Austaras
5b2d024788
feat(es/minifier): Relax requirement for IIFE invokation ( #5721 )
2022-09-03 07:33:31 +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/강동윤
d43334eb92
feat(es/minifier): Remove redundant check ( #5664 )
2022-08-30 12:22:18 +09: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
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
77497e4fbe
fix(es/fixer): Don't insert extra paren when left of BinExpr
is UpdateExpr
( #5376 )
2022-08-03 08:41:40 +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
Austaras
6573324d9c
feat(es/minifier): Calculate correct size ( #5253 )
2022-07-20 08:25:26 +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