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
Refactor export map builder #2991
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2991 +/- ##
==========================================
+ Coverage 81.81% 82.45% +0.63%
==========================================
Files 77 86 +9
Lines 3795 3813 +18
Branches 1257 1256 -1
==========================================
+ Hits 3105 3144 +39
+ Misses 690 669 -21 ☔ View full report in Codecov by Sentry. |
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.
Thanks, this is great!
It seems like this refactor is exposing a lot of previously uncovered lines. It's fine to land this without covering them, but it would be even better if this PR (or another one, landed first) could include additional tests so we can ensure the uncovered lines are all covered
src/exportMap/captureDependency.js
Outdated
@@ -0,0 +1,60 @@ | |||
export function captureDependency( |
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.
export function captureDependency( | |
export default function captureDependency( |
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.
Why would captureDependency
be the default and not, say, captureDependencyWithSpecifiers
that is exported from the same file?
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.
because the filename is "captureDependency". a default export is what a module is, a named export is something a module has, and most modules should be something.
I reviewed the lines that aren't covered. |
Has been merged via |
6d8a0b8
to
8587c85
Compare
exportMapBuilder.js contains a huge god-object with 651 lines of code, with tightly coupled procedures that are hard to follow.
Lets extract procedures and classes, and put them in well named files.
This separation will also help with encapsulation and decoupling.
It's not perfect yet, but a reduction from 651 lines to 207 lines is a 68% decrease.