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

Fix "default" reexport issues in non ESM/System formats #3084

Merged
merged 8 commits into from Aug 28, 2019

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Aug 26, 2019

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 #2992
Resolves #2977

Description

This fixes two very important issues that could lead to incorrect code in all formats except ESM and System when a default export of an external dependency is reexported.

This is the first:
https://rollupjs.org/repl/?version=1.20.2&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMCU3QiUyMGRlZmF1bHQlMjAlN0QlMjBmcm9tJTIwJ3glMkZmb28nJTNCJTVDbmV4cG9ydCUyMCU3QiUyMG5hbWVkUHJvcCUyMCU3RCUyMGZyb20lMjAneCUyRmJhciclM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSU3RCU1RCUyQyUyMm9wdGlvbnMlMjIlM0ElN0IlMjJmb3JtYXQlMjIlM0ElMjJhbWQlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==

Note how in line 7, a non-existing variable foo_default is accessed.

This is the second:
https://rollupjs.org/repl/?version=1.20.2&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMCU3QiUyMGRlZmF1bHQlMjAlN0QlMjBmcm9tJTIwJTVDJTIyZXh0ZXJuYWwlNUMlMjIlM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSU3RCU1RCUyQyUyMm9wdGlvbnMlMjIlM0ElN0IlMjJmb3JtYXQlMjIlM0ElMjJhbWQlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==

Not how first in the interop block, the default is assigned to the "external" variable and then later, the export is taken from external.default and not external.

@codecov
Copy link

codecov bot commented Aug 26, 2019

Codecov Report

Merging #3084 into master will increase coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3084      +/-   ##
==========================================
+ Coverage   88.81%   88.95%   +0.13%     
==========================================
  Files         165      165              
  Lines        5731     5721      -10     
  Branches     1743     1741       -2     
==========================================
- Hits         5090     5089       -1     
+ Misses        388      385       -3     
+ Partials      253      247       -6
Impacted Files Coverage Δ
src/finalisers/shared/getExportBlock.ts 100% <100%> (+12.28%) ⬆️
src/finalisers/shared/getInteropBlock.ts 100% <100%> (+18.18%) ⬆️

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 cc5fd63...7442d7e. Read the comment docs.

@lukastaegert lukastaegert merged commit e2fa18d into master Aug 28, 2019
@lukastaegert lukastaegert deleted the gh-2992-reexport-mixed-amd branch August 28, 2019 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant