Donny/강동윤
08f6e81d8e
feat(es/minifier): Ignore more return values ( #5981 )
2022-09-28 14:20:37 +00:00
Donny/강동윤
bc2c0f4133
fix(es/codegen): Fix codegen of a negative number ( #5980 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5912 .
2022-09-28 13:40:07 +00: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/강동윤
0e69890764
feat(es/minifier): Evaluate more literals in comparison ( #5976 )
...
**Description:**
I'll fix the performance issue with a follow-up PR.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/4415 .
2022-09-28 08:07:55 +00:00
Austaras
aff4ea5f44
fix(es/minifier): Preserve exports in DCE ( #5973 )
2022-09-28 05:35:51 +00:00
Donny/강동윤
dcd516d2bd
feat(es/minifier): Ignore more expressions in sequential inliner ( #5961 )
...
**Description:**
We can skip **member access** to `console` as it does not have any side effects.
2022-09-27 07:45:44 +00:00
Donny/강동윤
48cddc16f6
test(es/minifier): Categorize terser tests ( #5960 )
...
**Description:**
I'm going to focus on rules enabled by default. I updated some tests because our one was better, and postponed `unsafe` tests.
2022-09-27 15:18:57 +09:00
Austaras
573418fc96
fix(es/resolver): Use a separate mark for the name of FnExpr
( #5959 )
2022-09-27 14:50:35 +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/강동윤
e16827cc9d
feat(es/minifier): Drop cycles in nested functions ( #5933 )
2022-09-22 13:54:49 +00:00
Donny/강동윤
5314ac5d02
feat(es/minifier): Use char frequency data for property manglers ( #5932 )
2022-09-22 22:14:26 +09:00
Donny/강동윤
e9c704182b
feat(es/minifier): Improve analysis of reassignments ( #5931 )
2022-09-22 10:22:18 +00:00
Donny/강동윤
f2224132c1
fix(es/minifier): Prepend vars when dropping vars in a for loop initializer ( #5930 )
...
**Description:**
The minifier appends initializer of for statements instead of prepending it.
**Related issue:**
- https://github.com/vercel/next.js/discussions/30237#discussioncomment-3704795
2022-09-22 09:18:41 +00:00
Donny/강동윤
ac7b066d9a
feat(es/minifier): Inline rest parameters of IIFE ( #5929 )
2022-09-22 06:16:29 +00:00
Donny/강동윤
565bf317f6
feat(es/minifier): Evaluate more expressions ( #5926 )
2022-09-22 03:53:14 +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/강동윤
31711e76af
test(es/minifier): Add an execution test for a fixed issue ( #5925 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5914 .
2022-09-21 12:19:14 +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/강동윤
0b34bcb40e
test(es/minifier): Add a test for a wrong issue ( #5923 )
2022-09-21 19:52:52 +09:00
Donny/강동윤
fe40d8312b
test(es): Accept arguments ( #5916 )
...
**Description:**
This PR adds a way to provide arguments to `exec_node_js`.
2022-09-21 16:23:10 +09:00
Donny/강동윤
a9873e505d
perf(es/minifier): Optimize analyzer ( #5908 )
2022-09-20 08:21:39 +00:00
Donny/강동윤
1df72430a5
perf(es/minifier): Invoke DCE only before the first compression ( #5907 )
...
**Description:**
Invoke DCE only before the first compression. I verified that this patch does not affect the compression rate of the real-world inputs greatly.
2022-09-20 15:41:26 +09:00
Donny/강동윤
aacf7aaf80
feat(es/minifier): Drop function identifier in a single pass ( #5901 )
...
**Description:**
We only inline function declarations if `ref_count` is 1, so we don't need to preserve the name of the function.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/5682 .
2022-09-19 15:07:56 +00:00
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