fix: parse Webpack 5 module maps nested in UMD wrappers - #733
Conversation
🦋 Changeset detectedLatest commit: eba7f74 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
791cc23 to
fee1368
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #733 +/- ##
==========================================
+ Coverage 76.39% 78.58% +2.19%
==========================================
Files 17 17
Lines 1004 1060 +56
Branches 360 383 +23
==========================================
+ Hits 767 833 +66
+ Misses 207 199 -8
+ Partials 30 28 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
valscion
left a comment
There was a problem hiding this comment.
Looks good to me! Can you take a look at the coverage report? To my eyes it looks like some branches you added are lacking code coverage. Ideally we'd have more tests that verify a real webpack bundle parses correctly without having to pass any custom optiona ourselves in test.
I'm ready to merge this once the coverage question has been dealt with
|
Looks like that #723 getting merged also caused a merge conflict here which needs to be resolved. |
Discover nested Webpack bootstrap IIFEs and select the correct non-empty module map using stats IDs and runtime structure, preserving accurate parsed module attribution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2cd1d86-732d-44fb-b556-cf0b08f9906c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2cd1d86-732d-44fb-b556-cf0b08f9906c
Add a generated UMD fixture parsed through the standard no-options harness and cover candidate fallback behavior while simplifying selection. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
fee1368 to
c24d570
Compare
|
Addressed the coverage feedback in c24d570 and eba7f74.
The targeted parser/analyzer tests, lint/type/format checks, and production build pass locally. |
Exercise every production line and branch added by the nested Webpack 5 UMD fix while preserving single-pass root asset module selection. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Thanks for the review, @valscion. I’ve rebased onto the latest The tests now include a generated Webpack 5 UMD bundle parsed through the normal no-options path, plus candidate-selection edge cases. All production lines and branches added by this PR have 100% coverage. The PR is conflict-free and ready for another look when you have time. |
valscion
left a comment
There was a problem hiding this comment.
Looks good to me, thanks for the contribution!
Summary
Related to #372.
Webpack 5 UMD output nests its bootstrap IIFE inside the UMD factory. The analyzer previously missed that module map, while empty or unrelated competing IIFEs could also be selected incorrectly.
This change:
A patch Changeset is included.
What kind of change does this PR introduce?
Fix.
Did you add tests for your changes?
Yes. The tests cover unhinted, partially hinted, tied, and non-matching candidate selection, analyzer module-ID plumbing, and single-pass asset-module collection.
Validation:
npm test -- test/parseUtils.js test/analyzerUtils.js— 27 passednpm run build— passednpm run test:coverage— 136 passed, 4 skippednpm run lint— ESLint, TypeScript, and Prettier passedgit diff --check— passedDoes this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
No documentation changes are required. This corrects existing bundle parsing behavior.
Use of AI
GitHub Copilot assisted with reproducing the failure, drafting the implementation and regression tests, and iterating on review feedback.
Human verification: I reviewed every generated change and the complete final diff, verified the behavior against Webpack 5.105.2 output, and ran all validation commands listed above. The patch also received independent review before publication. I understand the implementation and remain responsible for the contribution.