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

Do not warn unnecessarily for namespace conflicts #4363

Merged
merged 2 commits into from Jan 25, 2022

Conversation

lukastaegert
Copy link
Member

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

Previously, the logic to resolve exports especially across conflicting namespace reexports was separate from the logic that would warn about conflicting namespace reexports.

In fact, the latter logic was broken in so far as it warned about situations like

// main.js
export const foo = 'main';
export * from './other.js';

// other.js
export const foo = 'other';

There is no reason to warn here as explicit (re)exports always take precedence over namespace reexports.

This refactors the entire logic and merges both mechanisms. This has the advantage that you only get a warning when a conflicting export is actually used, which is in line with how it works in actual JS runtimes.

@github-actions
Copy link

github-actions bot commented Jan 24, 2022

Thank you for your contribution! ❤️

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

npm install rollup/rollup#namespace-conflicts

or load it into the REPL:
https://rollupjs.org/repl/?pr=4363

@codecov
Copy link

codecov bot commented Jan 24, 2022

Codecov Report

Merging #4363 (27780bf) into master (3ca594e) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4363      +/-   ##
==========================================
- Coverage   98.69%   98.68%   -0.01%     
==========================================
  Files         205      205              
  Lines        7339     7326      -13     
  Branches     2089     2083       -6     
==========================================
- Hits         7243     7230      -13     
  Misses         36       36              
  Partials       60       60              
Impacted Files Coverage Δ
src/Graph.ts 100.00% <ø> (ø)
src/ExternalModule.ts 100.00% <100.00%> (ø)
src/Module.ts 100.00% <100.00%> (ø)
src/utils/error.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ca594e...27780bf. Read the comment docs.

@lukastaegert lukastaegert merged commit 9eeb6a0 into master Jan 25, 2022
@lukastaegert lukastaegert deleted the namespace-conflicts branch January 25, 2022 05:46
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.

None yet

1 participant