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 to UNUSED_EXTERNAL_IMPORT
warning information about the origin of the problem
#4054
Add to UNUSED_EXTERNAL_IMPORT
warning information about the origin of the problem
#4054
Conversation
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install cawa-93/rollup#unused-external-imports-improvements or load it into the REPL: |
names: unused, | ||
source: this.id | ||
source: this.id, | ||
sources: importersArray |
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.
I'm not sure how appropriate to use sources
key. I did not find any description of the properties of the RollupWarning
interface.
Lines 9 to 22 in a4a3b8a
export interface RollupWarning extends RollupLogProps { | |
chunkName?: string; | |
cycle?: string[]; | |
exporter?: string; | |
exportName?: string; | |
guess?: string; | |
importer?: string; | |
missing?: string; | |
modules?: string[]; | |
names?: string[]; | |
reexporter?: string; | |
source?: string; | |
sources?: string[]; | |
} |
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.
Looking at the other usages, sources should be reasonable.
Codecov Report
@@ Coverage Diff @@
## master #4054 +/- ##
==========================================
- Coverage 97.48% 97.45% -0.03%
==========================================
Files 192 192
Lines 6788 6795 +7
Branches 1996 1996
==========================================
+ Hits 6617 6622 +5
Misses 84 84
- Partials 87 89 +2
Continue to review full report at Codecov.
|
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.
Some things could likely be simplified, otherwise looks good
src/ExternalModule.ts
Outdated
const {importers, dynamicImporters} = this.declarations[name].module | ||
|
||
if (Array.isArray(importers)) importers.forEach(v => importersSet.add(v)) | ||
if (Array.isArray(dynamicImporters)) dynamicImporters.forEach(v => importersSet.add(v)) |
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.
By the types, these checks should not be needed. This is also reflected in the coverage right now. Or do you see a scenario where there might be an issue?
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.
During my previous experiments there was a situation when dynamicImporters
was undefined
. I assume that the types are not quite correct. Therefore, for reinsurance, I added a check.
names: unused, | ||
source: this.id | ||
source: this.id, | ||
sources: importersArray |
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.
Looking at the other usages, sources should be reasonable.
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
UNUSED_EXTERNAL_IMPORT
warning #4052Description
This patch add to
UNUSED_EXTERNAL_IMPORT
warning information about the origin of the problem