Skip to content

fix: separately export __proto__ for compatibility with CJS Transpiler Re-exports#5380

Merged
lukastaegert merged 12 commits intomasterfrom
fix/5377
Feb 15, 2024
Merged

fix: separately export __proto__ for compatibility with CJS Transpiler Re-exports#5380
lukastaegert merged 12 commits intomasterfrom
fix/5377

Conversation

@TrickyPi
Copy link
Member

@TrickyPi TrickyPi commented Feb 6, 2024

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 #5377

Description

@vercel
Copy link

vercel bot commented Feb 6, 2024

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 Feb 14, 2024 1:52pm

@TrickyPi TrickyPi changed the title fix: Separately export __proto__ for compatibility with CJS Transpiler Re-exports fix: separately export __proto__ for compatibility with CJS Transpiler Re-exports Feb 6, 2024
@github-actions
Copy link

github-actions bot commented Feb 6, 2024

Thank you for your contribution! ❤️

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

npm install rollup/rollup#fix/5377

Notice: Ensure you have installed Rust nightly. If you haven't installed it yet, please first see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust, then see https://rust-lang.github.io/rustup/concepts/channels.html to learn how to install Rust nightly.

or load it into the REPL:
https://rollup-8j2blanat-rollup-js.vercel.app/repl/?pr=5380

@codecov
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7624208) 98.81% compared to head (bd2d4fa) 98.81%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5380   +/-   ##
=======================================
  Coverage   98.81%   98.81%           
=======================================
  Files         232      232           
  Lines        9009     9013    +4     
  Branches     2351     2353    +2     
=======================================
+ Hits         8902     8906    +4     
  Misses         46       46           
  Partials       61       61           

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

@TrickyPi
Copy link
Member Author

TrickyPi commented Feb 7, 2024

Currently, the export block is not concise enough when re-exporting '*' from an external module. So, I am wondering whether introducing a flag to control it, such as reExportProtoFromExternal.

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.

Looks good to me, great work!

So, I am wondering whether introducing a flag to control it, such as reExportProtoFromExternal

Yes, I agree. This really is an edge case that of course we should somehow be able to handle, but it adds a lot of overhead to 99% of libraries without any benefit.
output. reExportProtoFromExternal sounds like a good name to me, but of course such a feature would need documentation, which would create some overhead. I think it should be enabled by default for maximum compatibility, but the docs should strongly suggest to disable it as you very likely will not need it.
Do you want to have a go within this PR? Otherwise I think we can also release it as it is and tackle this in a separate PR.

@TrickyPi
Copy link
Member Author

TrickyPi commented Feb 8, 2024

Do you want to have a go within this PR?

OK, I will do it within this PR.

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.

Great work!
The only thing left to do is to add the CLI option to the separate list of CLI options:

In cli/help.md:

  --preserveSymlinks          Do not follow symlinks when resolving files
+ --no-reexportProtoFromExternal Ignore `__proto__` in star re-exports
  --no-sanitizeFileName       Do not replace invalid characters in file names

This text is a suggestion. Here, if the default is "true", we would list the negated option but sort it by its non-negated name. Descriptions should fit within 80 characters.

And this list is duplicated (unchanged!) into docs/command-line-interface/index.md.

@TrickyPi
Copy link
Member Author

Ok, I get it. Thanks for your guidance!

@lukastaegert lukastaegert added this pull request to the merge queue Feb 15, 2024
Merged via the queue into master with commit f74d0a9 Feb 15, 2024
@lukastaegert lukastaegert deleted the fix/5377 branch February 15, 2024 05:17
@github-actions
Copy link

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

yyx990803 added a commit to vuejs/core that referenced this pull request Feb 26, 2024
original issue resolved by rollup/rollup#5380
OnlyWick pushed a commit to OnlyWick/core that referenced this pull request Feb 27, 2024
lynxlangya pushed a commit to lynxlangya/core that referenced this pull request May 30, 2024
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.

CJS re-export regression with externalLiveBindings: false

2 participants