Skip to content

Correct the parent scope for static blocks #6001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 5, 2025
Merged

Correct the parent scope for static blocks #6001

merged 3 commits into from
Jul 5, 2025

Conversation

TrickyPi
Copy link
Member

@TrickyPi TrickyPi commented Jul 3, 2025

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
resolves #5990

Description

Copy link

vercel bot commented Jul 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rollup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2025 1:05pm

Copy link

github-actions bot commented Jul 3, 2025

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#fix/5990

Notice: 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:
https://rollup-8n4wjpps8-rollup-js.vercel.app/repl/?pr=6001

Copy link

github-actions bot commented Jul 3, 2025

Performance report

  • BUILD: 7012ms, 823 MB
    • initialize: 0ms, 24.7 MB (+8%)
    • generate module graph: 2631ms, 630 MB
      • generate ast: 1409ms, 619 MB
    • sort and bind modules: 398ms, 690 MB
    • mark included statements: 3981ms, 823 MB
      • treeshaking pass 1: 2330ms, 819 MB
      • treeshaking pass 2: 464ms (-10ms, -2.2%), 826 MB
      • treeshaking pass 3: 400ms, 824 MB
      • treeshaking pass 4: 387ms, 820 MB
      • treeshaking pass 5: 385ms, 823 MB
  • GENERATE: 914ms (+186ms, +25.6%), 911 MB
    • initialize render: 0ms, 903 MB
    • generate chunks: 189ms (+85ms, +81.6%), 865 MB (+4%)
      • optimize chunks: 0ms, 883 MB (-4%)
    • render chunks: 641ms, 900 MB
    • transform chunks: 21ms, 911 MB
    • generate bundle: 0ms, 911 MB

Copy link

codecov bot commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.79%. Comparing base (5a7f9e2) to head (d59bae6).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #6001     +/-   ##
=========================================
  Coverage   98.78%   98.79%             
=========================================
  Files         270      270             
  Lines        8745    10559   +1814     
  Branches     1512     2815   +1303     
=========================================
+ Hits         8639    10432   +1793     
- Misses         73       87     +14     
- Partials       33       40      +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for analyzing and the quick fix! I took the liberty and push one small change to directly compare the code of the node to avoid a property lookup in the generated code, but in general the fix is correct! Unfortunately, the custom logic here makes it hard to ensure it is always up to date with all possible nodes in ClassBodies.

@TrickyPi
Copy link
Member Author

TrickyPi commented Jul 5, 2025

Thanks for the improvement!

Unfortunately, the custom logic here makes it hard to ensure it is always up to date with all possible nodes in ClassBodies.

Yeah! We might need to revisit this logic if more node types show up in ClassBodies in the future.

@lukastaegert lukastaegert added this pull request to the merge queue Jul 5, 2025
Merged via the queue into master with commit 9cebb0b Jul 5, 2025
42 checks passed
@lukastaegert lukastaegert deleted the fix/5990 branch July 5, 2025 04:52
Copy link

This PR has been released as part of rollup@4.45.0. You can test it via npm install rollup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Classes with static init blocks are only removed when treeshake is "smallest"
2 participants