Skip to content
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

Handle self-referencing namespaces #4991

Merged
merged 1 commit into from May 16, 2023
Merged

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented May 14, 2023

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:

Description

This ensures that using "export * as variable" will use a getter for the namespace itself inside the namespace to avoid accessing the namespace variable before it is created.

https://rollup-8btvtg165-rollup-js.vercel.app/repl/?pr=4991&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIybmFtZSUyMiUzQSUyMm1haW4uanMlMjIlMkMlMjJjb2RlJTIyJTNBJTIyZXhwb3J0JTIwKiUyMGFzJTIwbnMlMjBmcm9tJTIwJy4lMkZtYWluLmpzJyUzQiU1Q25leHBvcnQlMjBkZWZhdWx0JTIwJ2ZvbyclM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSU3RCU1RCUyQyUyMm9wdGlvbnMlMjIlM0ElN0IlN0QlN0Q=

@vercel
Copy link

vercel bot commented May 14, 2023

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

Name Status Preview Updated (UTC)
rollup ✅ Ready (Inspect) Visit Preview May 14, 2023 4:40am

@github-actions
Copy link

github-actions bot commented May 14, 2023

Thank you for your contribution! ❤️

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

npm install rollup/rollup#self-referencing-namespace

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

@codecov
Copy link

codecov bot commented May 14, 2023

Codecov Report

Merging #4991 (b030892) into master (9a4c9e1) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4991   +/-   ##
=======================================
  Coverage   98.96%   98.96%           
=======================================
  Files         222      222           
  Lines        8135     8135           
  Branches     2239     2239           
=======================================
  Hits         8051     8051           
  Misses         30       30           
  Partials       54       54           
Impacted Files Coverage Δ
src/ast/variables/NamespaceVariable.ts 100.00% <100.00%> (ø)

@lukastaegert lukastaegert merged commit 67f2416 into master May 16, 2023
12 checks passed
@lukastaegert lukastaegert deleted the self-referencing-namespace branch May 16, 2023 07:10
@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.21.8. 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.

bug: ReferenceError: Cannot access 'main$1' before initialization
2 participants