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

Add option to prevent code for external live bindings #3010

Merged
merged 3 commits into from Aug 1, 2019

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Jul 29, 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:

Description

This adds an option to prevent additional code that is generated to support live bindings with external dependencies. At the moment, three situations will be affected by this option:

// reexporting an external value
export {x} from 'external';

// reexporting an external namespace
export * from 'external';

// dynamically importing an external dependency
import('external').then(...)

This will eliminate most situations where Rollup uses getters and makes the code more efficient at the cost of spec compliancy. Circular dependencies involving external dependencies may not longer work if this option is used.

The remaining situations where Rollup will generate getters in the code that are not touched by this option are:

  • reexports from chunks that mutate their exports Example
  • accessing a reified dynamic namespace before the module was run when there are circular dependencies Example

@codecov
Copy link

codecov bot commented Jul 29, 2019

Codecov Report

Merging #3010 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3010      +/-   ##
==========================================
+ Coverage    87.8%   87.86%   +0.06%     
==========================================
  Files         166      166              
  Lines        5641     5647       +6     
  Branches     1720     1722       +2     
==========================================
+ Hits         4953     4962       +9     
  Misses        412      412              
+ Partials      276      273       -3
Impacted Files Coverage Δ
src/utils/mergeOptions.ts 88.09% <ø> (ø) ⬆️
src/finalisers/shared/getInteropNamespace.ts 100% <100%> (ø) ⬆️
src/finalisers/shared/getExportBlock.ts 87.71% <100%> (+0.44%) ⬆️
src/finalisers/amd.ts 94.28% <100%> (ø) ⬆️
src/finalisers/cjs.ts 94.87% <100%> (ø) ⬆️
src/Chunk.ts 91.2% <100%> (+0.01%) ⬆️
src/ast/nodes/Import.ts 100% <0%> (+6.81%) ⬆️

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 def3ae2...9a093b0. Read the comment docs.

@lukastaegert lukastaegert merged commit 4a0fa56 into master Aug 1, 2019
@lukastaegert lukastaegert deleted the prevent-external-live-bindings branch August 1, 2019 11:07
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