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
Refine SystemJS export rendering #4199
Conversation
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#improve-systemjs-rendering or load it into the REPL: |
1086780
to
d0aa307
Compare
Codecov Report
@@ Coverage Diff @@
## master #4199 +/- ##
==========================================
+ Coverage 98.34% 98.37% +0.02%
==========================================
Files 202 202
Lines 7244 7254 +10
Branches 2123 2127 +4
==========================================
+ Hits 7124 7136 +12
Misses 58 58
+ Partials 62 60 -2
Continue to review full report at Codecov.
|
d0aa307
to
1d97348
Compare
1d97348
to
52ce573
Compare
|
||
var k, l; | ||
var k, l; exports({ k: k, l: l }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As much as possible it is usually a good idea to bulk together calls to the exports({})
function. This is because when there are export *
or reexports in play, there is a cascade of function calls to propagate the binding updates, so fewer cascades are better for performance as this can degrade on very exported graphs otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undefined bindings are an exception, but this reduces quite a bit complexity. On the other hand, there is now much more grouping for declarations that contain more than one export, see below lines 22 and 24.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only did a brief review, but looks good to me.
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
In SystemJS, we manually need to update export bindings whenever the underlying variable changes. This PR refines and unifies the code created by Rollup, often replacing IIFEs with more efficient comma expressions.
It also fixes an issue where using a postfix unary update operator applied to a variable with more than one export name would return the updated value instead of the original value: Old REPL, New REPL.
This will also make the code easier to maintain and help when generating ES2015+ output.
Here is an overview of the most important changes: