feat: enhance the treehshaking for unary expression#5775
feat: enhance the treehshaking for unary expression#5775lukastaegert merged 4 commits intomasterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ff8b5fa to
8926159
Compare
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#feat/treeshakes-unaryNotice: Ensure you have installed the latest stable Rust toolchain. If you haven't installed it yet, please see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust. or load it into the REPL: |
Performance report
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5775 +/- ##
=======================================
Coverage 99.01% 99.01%
=======================================
Files 259 259
Lines 8090 8114 +24
Branches 1363 1370 +7
=======================================
+ Hits 8010 8034 +24
Misses 53 53
Partials 27 27 ☔ View full report in Codecov by Sentry. |
lukastaegert
left a comment
There was a problem hiding this comment.
I think this is a really cool idea and should usually provide a nice benefit. It can even help to tree-shake code, which is especially cool. I have some comments to look at, but in general I like the feature!
|
I've been struggling with this for a long time, and I feel that the smallest representation can be delegated to specialized compression tools like |
97eb7e6 to
97e4b83
Compare
That sounds good to me, and I see your point with numbers. And thank you for taking the time to think this through. |
|
This PR has been released as part of rollup@4.30.0. You can test it via |
|
Hi @TrickyPi. In updating my projects from a previous version of Rollup I noticed that this PR converts Thanks for the insight and your work on Rollup. |
It's just a final output representation. While choosing between |
|
That's the thing. Readability is subjective. In my larger / complex project with many build assets with some that are intermediary / checked in to repos I immediately noticed this change. I'm at the end release candidate stage with many pre-releases prior just before a final release for this effort and updated Rollup from From a readability point of view for those that use |
|
Awesome.. Thanks for the consideration! |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
resolves #5732
Description
If the argument has no side effects and the unary expression can evaluate to a literal value, I think we can use that literal value directly in the finalized code.